|
|
@@ -1,3 +1,4 @@
|
|
|
+import {filterOptions} from '@utils';
|
|
|
import css from './index.module.css';
|
|
|
import {Row, Col, Select} from 'antd';
|
|
|
import classNames from 'classnames';
|
|
|
@@ -10,6 +11,7 @@ type Props = {
|
|
|
width?: string;
|
|
|
data: {value: string, label: string}[];
|
|
|
required?: boolean;
|
|
|
+ showSearch?: boolean;
|
|
|
} & UseControllerProps<any, any>;
|
|
|
|
|
|
const ModalSelect: FC<Props> = function({
|
|
|
@@ -19,6 +21,7 @@ const ModalSelect: FC<Props> = function({
|
|
|
placeholder,
|
|
|
data,
|
|
|
required,
|
|
|
+ showSearch,
|
|
|
}) {
|
|
|
return (
|
|
|
<Row className='full-width' gutter={12}>
|
|
|
@@ -45,10 +48,11 @@ const ModalSelect: FC<Props> = function({
|
|
|
return (
|
|
|
<>
|
|
|
<Select
|
|
|
+ showSearch={showSearch}
|
|
|
rootClassName={classNames([css.modalSelect, css.filedWidth])}
|
|
|
data-testid={`select_${name}`}
|
|
|
defaultActiveFirstOption={false}
|
|
|
- filterOption={false}
|
|
|
+ filterOption={showSearch ? filterOptions : false}
|
|
|
placeholder={placeholder ?? '请选择'}
|
|
|
id={`operation_${name}`}
|
|
|
// 处理placeholder不显示问题
|