@rc-component/select 1.1.0 → 1.1.2

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/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 && !item?.data?.disabled && !overMaxCount) {
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.js CHANGED
@@ -60,6 +60,12 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
60
60
  fieldNames,
61
61
  // Search
62
62
  showSearch,
63
+ searchValue: legacySearchValue,
64
+ onSearch: legacyOnSearch,
65
+ autoClearSearchValue: legacyAutoClearSearchValue,
66
+ filterOption: legacyFilterOption,
67
+ optionFilterProp: legacyOptionFilterProp,
68
+ filterSort: legacyFilterSort,
63
69
  // Select
64
70
  onSelect,
65
71
  onDeselect,
@@ -86,7 +92,15 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
86
92
  styles,
87
93
  ...restProps
88
94
  } = props;
89
- const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch, props);
95
+ const searchProps = {
96
+ searchValue: legacySearchValue,
97
+ onSearch: legacyOnSearch,
98
+ autoClearSearchValue: legacyAutoClearSearchValue,
99
+ filterOption: legacyFilterOption,
100
+ optionFilterProp: legacyOptionFilterProp,
101
+ filterSort: legacyFilterSort
102
+ };
103
+ const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch, searchProps);
90
104
  const {
91
105
  filterOption,
92
106
  searchValue,
@@ -1,2 +1,2 @@
1
- import type { SearchConfig, DefaultOptionType, SelectProps } from "../Select";
2
- export default function useSearchConfig(showSearch: boolean | SearchConfig<DefaultOptionType> | undefined, props: SelectProps): [boolean, SearchConfig<DefaultOptionType>];
1
+ import type { SearchConfig, DefaultOptionType } from "../Select";
2
+ export default function useSearchConfig(showSearch: boolean | SearchConfig<DefaultOptionType> | undefined, props: SearchConfig<DefaultOptionType>): [boolean, SearchConfig<DefaultOptionType>];
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 && !item?.data?.disabled && !overMaxCount) {
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.js CHANGED
@@ -67,6 +67,12 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
67
67
  fieldNames,
68
68
  // Search
69
69
  showSearch,
70
+ searchValue: legacySearchValue,
71
+ onSearch: legacyOnSearch,
72
+ autoClearSearchValue: legacyAutoClearSearchValue,
73
+ filterOption: legacyFilterOption,
74
+ optionFilterProp: legacyOptionFilterProp,
75
+ filterSort: legacyFilterSort,
70
76
  // Select
71
77
  onSelect,
72
78
  onDeselect,
@@ -93,7 +99,15 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
93
99
  styles,
94
100
  ...restProps
95
101
  } = props;
96
- const [mergedShowSearch, searchConfig] = (0, _useSearchConfig.default)(showSearch, props);
102
+ const searchProps = {
103
+ searchValue: legacySearchValue,
104
+ onSearch: legacyOnSearch,
105
+ autoClearSearchValue: legacyAutoClearSearchValue,
106
+ filterOption: legacyFilterOption,
107
+ optionFilterProp: legacyOptionFilterProp,
108
+ filterSort: legacyFilterSort
109
+ };
110
+ const [mergedShowSearch, searchConfig] = (0, _useSearchConfig.default)(showSearch, searchProps);
97
111
  const {
98
112
  filterOption,
99
113
  searchValue,
@@ -1,2 +1,2 @@
1
- import type { SearchConfig, DefaultOptionType, SelectProps } from "../Select";
2
- export default function useSearchConfig(showSearch: boolean | SearchConfig<DefaultOptionType> | undefined, props: SelectProps): [boolean, SearchConfig<DefaultOptionType>];
1
+ import type { SearchConfig, DefaultOptionType } from "../Select";
2
+ export default function useSearchConfig(showSearch: boolean | SearchConfig<DefaultOptionType> | undefined, props: SearchConfig<DefaultOptionType>): [boolean, SearchConfig<DefaultOptionType>];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/select",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "React Select",
5
5
  "engines": {
6
6
  "node": ">=8.x"