@rc-component/select 1.0.7 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/es/OptionList.js +4 -1
- package/es/Select.d.ts +23 -8
- package/es/Select.js +12 -7
- package/es/hooks/useSearchConfig.d.ts +2 -0
- package/es/hooks/useSearchConfig.js +26 -0
- package/lib/OptionList.js +4 -1
- package/lib/Select.d.ts +23 -8
- package/lib/Select.js +12 -7
- package/lib/hooks/useSearchConfig.d.ts +2 -0
- package/lib/hooks/useSearchConfig.js +33 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ export default () => (
|
|
|
89
89
|
| open | control select open | boolean | |
|
|
90
90
|
| defaultOpen | control select default open | boolean | |
|
|
91
91
|
| placeholder | select placeholder | React Node | |
|
|
92
|
-
| showSearch | whether show search input in single mode | boolean | true |
|
|
92
|
+
| showSearch | whether show search input in single mode | boolean \| Object | true |
|
|
93
93
|
| allowClear | whether allowClear | boolean | { clearIcon?: ReactNode } | false |
|
|
94
94
|
| tags | when tagging is enabled the user can select from pre-existing options or create a new tag by picking the first choice, which is what the user has typed into the search box so far. | boolean | false |
|
|
95
95
|
| tagRender | render custom tags. | (props: CustomTagProps) => ReactNode | - |
|
|
@@ -99,16 +99,12 @@ export default () => (
|
|
|
99
99
|
| combobox | enable combobox mode(can not set multiple at the same time) | boolean | false |
|
|
100
100
|
| multiple | whether multiple select | boolean | false |
|
|
101
101
|
| disabled | whether disabled select | boolean | false |
|
|
102
|
-
| filterOption | whether filter options by input value. default filter by option's optionFilterProp prop's value | boolean | true/Function(inputValue:string, option:Option) |
|
|
103
|
-
| optionFilterProp | which prop value of option will be used for filter if filterOption is true | String | 'value' |
|
|
104
|
-
| filterSort | Sort function for search options sorting, see [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)'s compareFunction. | Function(optionA:Option, optionB: Option) | - |
|
|
105
102
|
| optionLabelProp | render option value or option children as content of select | String: 'value'/'children' | 'value' |
|
|
106
103
|
| defaultValue | initial selected option(s) | String \| String[] | - |
|
|
107
104
|
| value | current selected option(s) | String \| String[] \| {key:String, label:React.Node} \| {key:String, label:React.Node}[] | - |
|
|
108
105
|
| labelInValue | whether to embed label in value, see above value type. Not support `combobox` mode | boolean | false |
|
|
109
106
|
| backfill | whether backfill select option to search input (Only works in single and combobox mode) | boolean | false |
|
|
110
107
|
| onChange | called when select an option or input value change(combobox) | function(value, option:Option \| Option[]) | - |
|
|
111
|
-
| onSearch | called when input changed | function | - |
|
|
112
108
|
| onBlur | called when blur | function | - |
|
|
113
109
|
| onFocus | called when focus | function | - |
|
|
114
110
|
| onPopupScroll | called when menu is scrolled | function | - |
|
|
@@ -120,7 +116,6 @@ export default () => (
|
|
|
120
116
|
| getInputElement | customize input element | function(): Element | - |
|
|
121
117
|
| showAction | actions trigger the dropdown to show | String[]? | - |
|
|
122
118
|
| autoFocus | focus select after mount | boolean | - |
|
|
123
|
-
| autoClearSearchValue | auto clear search input value when multiple select is selected/deselected | boolean | true |
|
|
124
119
|
| prefix | specify the select prefix icon or text | ReactNode | - |
|
|
125
120
|
| suffixIcon | specify the select arrow icon | ReactNode | - |
|
|
126
121
|
| clearIcon | specify the clear icon | ReactNode | - |
|
|
@@ -141,6 +136,17 @@ export default () => (
|
|
|
141
136
|
| focus | focus select programmably | - | - |
|
|
142
137
|
| blur | blur select programmably | - | - |
|
|
143
138
|
|
|
139
|
+
### showSearch
|
|
140
|
+
|
|
141
|
+
| name | description | type | default |
|
|
142
|
+
| --- | --- | --- | --- |
|
|
143
|
+
| autoClearSearchValue | auto clear search input value when multiple select is selected/deselected | boolean | true |
|
|
144
|
+
| filterOption | whether filter options by input value. default filter by option's optionFilterProp prop's value | boolean\| (inputValue: string, option: Option) => boolean | true |
|
|
145
|
+
| filterSort | Sort function for search options sorting, see [Array.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)'s compareFunction. | Function(optionA:Option, optionB: Option) | - |
|
|
146
|
+
| optionFilterProp | which prop value of option will be used for filter if filterOption is true | String | 'value' |
|
|
147
|
+
| searchValue | The current input "search" text | string | - |
|
|
148
|
+
| onSearch | called when input changed | function | - |
|
|
149
|
+
|
|
144
150
|
### Option props
|
|
145
151
|
|
|
146
152
|
| name | description | type | default |
|
package/es/OptionList.js
CHANGED
|
@@ -203,7 +203,10 @@ const OptionList = (_, ref) => {
|
|
|
203
203
|
{
|
|
204
204
|
// value
|
|
205
205
|
const item = memoFlattenOptions[activeIndex];
|
|
206
|
-
if (item
|
|
206
|
+
if (!item || item.data.disabled) {
|
|
207
|
+
return onSelectValue(undefined);
|
|
208
|
+
}
|
|
209
|
+
if (!overMaxCount || rawValues.has(item.value)) {
|
|
207
210
|
onSelectValue(item.value);
|
|
208
211
|
} else {
|
|
209
212
|
onSelectValue(undefined);
|
package/es/Select.d.ts
CHANGED
|
@@ -67,13 +67,27 @@ export type SelectHandler<ValueType, OptionType extends BaseOptionType = Default
|
|
|
67
67
|
type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
68
68
|
export type SemanticName = BaseSelectSemanticName;
|
|
69
69
|
export type PopupSemantic = 'listItem' | 'list';
|
|
70
|
-
export interface
|
|
70
|
+
export interface SearchConfig<OptionType> {
|
|
71
|
+
searchValue?: string;
|
|
72
|
+
autoClearSearchValue?: boolean;
|
|
73
|
+
onSearch?: (value: string) => void;
|
|
74
|
+
filterOption?: boolean | FilterFunc<OptionType>;
|
|
75
|
+
filterSort?: (optionA: OptionType, optionB: OptionType, info: {
|
|
76
|
+
searchValue: string;
|
|
77
|
+
}) => number;
|
|
78
|
+
optionFilterProp?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> extends Omit<BaseSelectPropsWithoutPrivate, 'showSearch'> {
|
|
71
81
|
prefixCls?: string;
|
|
72
82
|
id?: string;
|
|
73
83
|
backfill?: boolean;
|
|
74
84
|
fieldNames?: FieldNames;
|
|
75
|
-
|
|
76
|
-
onSearch?:
|
|
85
|
+
/** @deprecated please use showSearch.onSearch */
|
|
86
|
+
onSearch?: SearchConfig<OptionType>['onSearch'];
|
|
87
|
+
showSearch?: boolean | SearchConfig<OptionType>;
|
|
88
|
+
/** @deprecated please use showSearch.searchValue */
|
|
89
|
+
searchValue?: SearchConfig<OptionType>['searchValue'];
|
|
90
|
+
/** @deprecated please use showSearch.autoClearSearchValue */
|
|
77
91
|
autoClearSearchValue?: boolean;
|
|
78
92
|
onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
79
93
|
onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
@@ -83,10 +97,11 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
83
97
|
* In TreeSelect, `false` will highlight match item.
|
|
84
98
|
* It's by design.
|
|
85
99
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
/** @deprecated please use showSearch.filterOption */
|
|
101
|
+
filterOption?: SearchConfig<OptionType>['filterOption'];
|
|
102
|
+
/** @deprecated please use showSearch.filterSort */
|
|
103
|
+
filterSort?: SearchConfig<OptionType>['filterSort'];
|
|
104
|
+
/** @deprecated please use showSearch.optionFilterProp */
|
|
90
105
|
optionFilterProp?: string;
|
|
91
106
|
optionLabelProp?: string;
|
|
92
107
|
children?: React.ReactNode;
|
|
@@ -110,7 +125,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
110
125
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
111
126
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
112
127
|
}
|
|
113
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
128
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
114
129
|
Option: typeof Option;
|
|
115
130
|
OptGroup: typeof OptGroup;
|
|
116
131
|
};
|
package/es/Select.js
CHANGED
|
@@ -46,6 +46,7 @@ import useRefFunc from "./hooks/useRefFunc";
|
|
|
46
46
|
import { hasValue, isComboNoValue, toArray } from "./utils/commonUtil";
|
|
47
47
|
import { fillFieldNames, flattenOptions, injectPropsWithOption } from "./utils/valueUtil";
|
|
48
48
|
import warningProps, { warningNullOptions } from "./utils/warningPropsUtil";
|
|
49
|
+
import useSearchConfig from "./hooks/useSearchConfig";
|
|
49
50
|
const OMIT_DOM_PROPS = ['inputValue'];
|
|
50
51
|
function isRawValue(value) {
|
|
51
52
|
return !value || typeof value !== 'object';
|
|
@@ -58,18 +59,12 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
58
59
|
backfill,
|
|
59
60
|
fieldNames,
|
|
60
61
|
// Search
|
|
61
|
-
|
|
62
|
-
onSearch,
|
|
63
|
-
autoClearSearchValue = true,
|
|
62
|
+
showSearch,
|
|
64
63
|
// Select
|
|
65
64
|
onSelect,
|
|
66
65
|
onDeselect,
|
|
67
66
|
onActive,
|
|
68
67
|
popupMatchSelectWidth = true,
|
|
69
|
-
// Options
|
|
70
|
-
filterOption,
|
|
71
|
-
filterSort,
|
|
72
|
-
optionFilterProp,
|
|
73
68
|
optionLabelProp,
|
|
74
69
|
options,
|
|
75
70
|
optionRender,
|
|
@@ -91,6 +86,15 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
91
86
|
styles,
|
|
92
87
|
...restProps
|
|
93
88
|
} = props;
|
|
89
|
+
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch, props);
|
|
90
|
+
const {
|
|
91
|
+
filterOption,
|
|
92
|
+
searchValue,
|
|
93
|
+
optionFilterProp,
|
|
94
|
+
filterSort,
|
|
95
|
+
onSearch,
|
|
96
|
+
autoClearSearchValue = true
|
|
97
|
+
} = searchConfig;
|
|
94
98
|
const mergedId = useId(id);
|
|
95
99
|
const multiple = isMultiple(mode);
|
|
96
100
|
const childrenAsData = !!(!options && children);
|
|
@@ -476,6 +480,7 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
476
480
|
direction: direction
|
|
477
481
|
// >>> Search
|
|
478
482
|
,
|
|
483
|
+
showSearch: mergedShowSearch,
|
|
479
484
|
searchValue: mergedSearchValue,
|
|
480
485
|
onSearch: onInternalSearch,
|
|
481
486
|
autoClearSearchValue: autoClearSearchValue,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
// Convert `showSearch` to unique config
|
|
4
|
+
export default function useSearchConfig(showSearch, props) {
|
|
5
|
+
const {
|
|
6
|
+
filterOption,
|
|
7
|
+
searchValue,
|
|
8
|
+
optionFilterProp,
|
|
9
|
+
filterSort,
|
|
10
|
+
onSearch,
|
|
11
|
+
autoClearSearchValue
|
|
12
|
+
} = props;
|
|
13
|
+
return React.useMemo(() => {
|
|
14
|
+
const isObject = typeof showSearch === 'object';
|
|
15
|
+
const searchConfig = {
|
|
16
|
+
filterOption,
|
|
17
|
+
searchValue,
|
|
18
|
+
optionFilterProp,
|
|
19
|
+
filterSort,
|
|
20
|
+
onSearch,
|
|
21
|
+
autoClearSearchValue,
|
|
22
|
+
...(isObject ? showSearch : {})
|
|
23
|
+
};
|
|
24
|
+
return [isObject ? true : showSearch, searchConfig];
|
|
25
|
+
}, [showSearch, filterOption, searchValue, optionFilterProp, filterSort, onSearch, autoClearSearchValue]);
|
|
26
|
+
}
|
package/lib/OptionList.js
CHANGED
|
@@ -211,7 +211,10 @@ const OptionList = (_, ref) => {
|
|
|
211
211
|
{
|
|
212
212
|
// value
|
|
213
213
|
const item = memoFlattenOptions[activeIndex];
|
|
214
|
-
if (item
|
|
214
|
+
if (!item || item.data.disabled) {
|
|
215
|
+
return onSelectValue(undefined);
|
|
216
|
+
}
|
|
217
|
+
if (!overMaxCount || rawValues.has(item.value)) {
|
|
215
218
|
onSelectValue(item.value);
|
|
216
219
|
} else {
|
|
217
220
|
onSelectValue(undefined);
|
package/lib/Select.d.ts
CHANGED
|
@@ -67,13 +67,27 @@ export type SelectHandler<ValueType, OptionType extends BaseOptionType = Default
|
|
|
67
67
|
type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
68
68
|
export type SemanticName = BaseSelectSemanticName;
|
|
69
69
|
export type PopupSemantic = 'listItem' | 'list';
|
|
70
|
-
export interface
|
|
70
|
+
export interface SearchConfig<OptionType> {
|
|
71
|
+
searchValue?: string;
|
|
72
|
+
autoClearSearchValue?: boolean;
|
|
73
|
+
onSearch?: (value: string) => void;
|
|
74
|
+
filterOption?: boolean | FilterFunc<OptionType>;
|
|
75
|
+
filterSort?: (optionA: OptionType, optionB: OptionType, info: {
|
|
76
|
+
searchValue: string;
|
|
77
|
+
}) => number;
|
|
78
|
+
optionFilterProp?: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> extends Omit<BaseSelectPropsWithoutPrivate, 'showSearch'> {
|
|
71
81
|
prefixCls?: string;
|
|
72
82
|
id?: string;
|
|
73
83
|
backfill?: boolean;
|
|
74
84
|
fieldNames?: FieldNames;
|
|
75
|
-
|
|
76
|
-
onSearch?:
|
|
85
|
+
/** @deprecated please use showSearch.onSearch */
|
|
86
|
+
onSearch?: SearchConfig<OptionType>['onSearch'];
|
|
87
|
+
showSearch?: boolean | SearchConfig<OptionType>;
|
|
88
|
+
/** @deprecated please use showSearch.searchValue */
|
|
89
|
+
searchValue?: SearchConfig<OptionType>['searchValue'];
|
|
90
|
+
/** @deprecated please use showSearch.autoClearSearchValue */
|
|
77
91
|
autoClearSearchValue?: boolean;
|
|
78
92
|
onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
79
93
|
onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
@@ -83,10 +97,11 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
83
97
|
* In TreeSelect, `false` will highlight match item.
|
|
84
98
|
* It's by design.
|
|
85
99
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
/** @deprecated please use showSearch.filterOption */
|
|
101
|
+
filterOption?: SearchConfig<OptionType>['filterOption'];
|
|
102
|
+
/** @deprecated please use showSearch.filterSort */
|
|
103
|
+
filterSort?: SearchConfig<OptionType>['filterSort'];
|
|
104
|
+
/** @deprecated please use showSearch.optionFilterProp */
|
|
90
105
|
optionFilterProp?: string;
|
|
91
106
|
optionLabelProp?: string;
|
|
92
107
|
children?: React.ReactNode;
|
|
@@ -110,7 +125,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
110
125
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
111
126
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
112
127
|
}
|
|
113
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
128
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
114
129
|
Option: typeof Option;
|
|
115
130
|
OptGroup: typeof OptGroup;
|
|
116
131
|
};
|
package/lib/Select.js
CHANGED
|
@@ -20,6 +20,7 @@ var _useRefFunc = _interopRequireDefault(require("./hooks/useRefFunc"));
|
|
|
20
20
|
var _commonUtil = require("./utils/commonUtil");
|
|
21
21
|
var _valueUtil = require("./utils/valueUtil");
|
|
22
22
|
var _warningPropsUtil = _interopRequireWildcard(require("./utils/warningPropsUtil"));
|
|
23
|
+
var _useSearchConfig = _interopRequireDefault(require("./hooks/useSearchConfig"));
|
|
23
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -65,18 +66,12 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
65
66
|
backfill,
|
|
66
67
|
fieldNames,
|
|
67
68
|
// Search
|
|
68
|
-
|
|
69
|
-
onSearch,
|
|
70
|
-
autoClearSearchValue = true,
|
|
69
|
+
showSearch,
|
|
71
70
|
// Select
|
|
72
71
|
onSelect,
|
|
73
72
|
onDeselect,
|
|
74
73
|
onActive,
|
|
75
74
|
popupMatchSelectWidth = true,
|
|
76
|
-
// Options
|
|
77
|
-
filterOption,
|
|
78
|
-
filterSort,
|
|
79
|
-
optionFilterProp,
|
|
80
75
|
optionLabelProp,
|
|
81
76
|
options,
|
|
82
77
|
optionRender,
|
|
@@ -98,6 +93,15 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
98
93
|
styles,
|
|
99
94
|
...restProps
|
|
100
95
|
} = props;
|
|
96
|
+
const [mergedShowSearch, searchConfig] = (0, _useSearchConfig.default)(showSearch, props);
|
|
97
|
+
const {
|
|
98
|
+
filterOption,
|
|
99
|
+
searchValue,
|
|
100
|
+
optionFilterProp,
|
|
101
|
+
filterSort,
|
|
102
|
+
onSearch,
|
|
103
|
+
autoClearSearchValue = true
|
|
104
|
+
} = searchConfig;
|
|
101
105
|
const mergedId = (0, _useId.default)(id);
|
|
102
106
|
const multiple = (0, _BaseSelect.isMultiple)(mode);
|
|
103
107
|
const childrenAsData = !!(!options && children);
|
|
@@ -483,6 +487,7 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
483
487
|
direction: direction
|
|
484
488
|
// >>> Search
|
|
485
489
|
,
|
|
490
|
+
showSearch: mergedShowSearch,
|
|
486
491
|
searchValue: mergedSearchValue,
|
|
487
492
|
onSearch: onInternalSearch,
|
|
488
493
|
autoClearSearchValue: autoClearSearchValue,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useSearchConfig;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
// Convert `showSearch` to unique config
|
|
11
|
+
function useSearchConfig(showSearch, props) {
|
|
12
|
+
const {
|
|
13
|
+
filterOption,
|
|
14
|
+
searchValue,
|
|
15
|
+
optionFilterProp,
|
|
16
|
+
filterSort,
|
|
17
|
+
onSearch,
|
|
18
|
+
autoClearSearchValue
|
|
19
|
+
} = props;
|
|
20
|
+
return React.useMemo(() => {
|
|
21
|
+
const isObject = typeof showSearch === 'object';
|
|
22
|
+
const searchConfig = {
|
|
23
|
+
filterOption,
|
|
24
|
+
searchValue,
|
|
25
|
+
optionFilterProp,
|
|
26
|
+
filterSort,
|
|
27
|
+
onSearch,
|
|
28
|
+
autoClearSearchValue,
|
|
29
|
+
...(isObject ? showSearch : {})
|
|
30
|
+
};
|
|
31
|
+
return [isObject ? true : showSearch, searchConfig];
|
|
32
|
+
}, [showSearch, filterOption, searchValue, optionFilterProp, filterSort, onSearch, autoClearSearchValue]);
|
|
33
|
+
}
|