Commit 53b4e4ef767d8204bee94996a9f22ced7680772c

Authored by 李婷
1 parent 6597c69c

feat: 选择表单优化

1 import { DownOutlined, UpOutlined } from '@ant-design/icons'; 1 import { DownOutlined, UpOutlined } from '@ant-design/icons';
2 import { useSetState } from 'ahooks'; 2 import { useSetState } from 'ahooks';
3 -import { Dropdown, Input } from 'antd'; 3 +import {Button, Dropdown, Input } from 'antd';
4 import type { InputProps } from 'antd/lib/input'; 4 import type { InputProps } from 'antd/lib/input';
5 import cls from 'classnames'; 5 import cls from 'classnames';
6 import React, { useImperativeHandle } from 'react'; 6 import React, { useImperativeHandle } from 'react';
@@ -83,30 +83,31 @@ export const QxInputSelect = React.forwardRef<any, InputSelectProps>( @@ -83,30 +83,31 @@ export const QxInputSelect = React.forwardRef<any, InputSelectProps>(
83 } 83 }
84 }} 84 }}
85 onOpenChange={onVisibleChange} 85 onOpenChange={onVisibleChange}
86 - disabled={disabled} 86 + disabled={true}
87 > 87 >
88 <> 88 <>
89 { 89 {
90 from === 'FORM'? 90 from === 'FORM'?
91 - <div  
92 - className={'qx-input-select__div'} 91 + <Button
  92 + disabled={disabled}
  93 + className={`qx-input-select__button`}
93 tabIndex={1} 94 tabIndex={1}
94 onClick={() => setState({ visible: !state.visible })} 95 onClick={() => setState({ visible: !state.visible })}
95 > 96 >
96 {props?.prefix} 97 {props?.prefix}
97 { !props?.value ? 98 { !props?.value ?
98 - <span className={'qx-input-select__div-main qx-input-select__div-placeholder'}>{props?.placeholder}</span>:  
99 - <span className={'qx-input-select__div-main'}> 99 + <span className={'qx-input-select__button-main qx-input-select__button-placeholder'}>{props?.placeholder}</span>:
  100 + <span className={'qx-input-select__button-main'}>
100 <span>{props?.appName}</span> 101 <span>{props?.appName}</span>
101 <QxBaseIcon 102 <QxBaseIcon
102 type="qx-icon-left" 103 type="qx-icon-left"
103 - className={'qx-input-select__div-svg'} 104 + className={'qx-input-select__button-svg'}
104 /> 105 />
105 <span>{props?.value}</span> 106 <span>{props?.value}</span>
106 </span> 107 </span>
107 } 108 }
108 {inputSuffix} 109 {inputSuffix}
109 - </div>: 110 + </Button>:
110 <Input 111 <Input
111 placeholder="请选择" 112 placeholder="请选择"
112 readOnly 113 readOnly
@@ -70,9 +70,8 @@ @@ -70,9 +70,8 @@
70 } 70 }
71 } 71 }
72 72
73 -.qx-input-select__div { 73 +.qx-input-select__button {
74 height: 32px; 74 height: 32px;
75 - border: 1px solid #d9d9d9;  
76 border-radius: 4px; 75 border-radius: 4px;
77 padding: 4px 11px; 76 padding: 4px 11px;
78 display: flex; 77 display: flex;
@@ -80,18 +79,13 @@ @@ -80,18 +79,13 @@
80 font-size: 14px; 79 font-size: 14px;
81 cursor: text; 80 cursor: text;
82 transition: all .3s; 81 transition: all .3s;
  82 + width: 100%;
83 83
84 - &:hover {  
85 - border-color: @B8;  
86 - }  
87 -  
88 - &:focus {  
89 - border-color: @B8;  
90 - box-shadow: 0 0 0 2px @B3;  
91 - outline: none; 84 + .qx-form-select__input-prefix {
  85 + color: @B8;
92 } 86 }
93 87
94 - &-main { 88 + .qx-input-select__button-main {
95 height: 22px; 89 height: 22px;
96 line-height: 22px; 90 line-height: 22px;
97 margin: 0 4px; 91 margin: 0 4px;
@@ -103,7 +97,7 @@ @@ -103,7 +97,7 @@
103 text-overflow: ellipsis; 97 text-overflow: ellipsis;
104 white-space: nowrap; 98 white-space: nowrap;
105 99
106 - .qx-input-select__div-svg { 100 + .qx-input-select__button-svg {
107 color: @N7; 101 color: @N7;
108 transform: rotate(180deg); 102 transform: rotate(180deg);
109 font-size: 16px; 103 font-size: 16px;
@@ -111,7 +105,7 @@ @@ -111,7 +105,7 @@
111 } 105 }
112 106
113 } 107 }
114 - &-placeholder { 108 + .qx-input-select__button-placeholder {
115 color: @N6; 109 color: @N6;
116 } 110 }
117 .qx-input-select__input-suffix { 111 .qx-input-select__input-suffix {
@@ -120,4 +114,12 @@ @@ -120,4 +114,12 @@
120 .qx-form-select__input-prefix { 114 .qx-form-select__input-prefix {
121 color: @B8; 115 color: @B8;
122 } 116 }
  117 +
  118 + .ant-dropdown-menu .ant-dropdown-menu-title-content {
  119 + flex: unset;
  120 + }
  121 + .ant-btn-default:not(:disabled):not(.ant-btn-disabled):hover {
  122 + color: unset;
  123 + }
  124 +
123 } 125 }