1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 | var _typeof3 = require("@babel/runtime/helpers/typeof");
|
5 | Object.defineProperty(exports, "__esModule", {
|
6 | value: true
|
7 | });
|
8 | exports.default = void 0;
|
9 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10 | var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
11 | var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
12 | var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
13 | var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
14 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15 | var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
16 | var _useMergedState5 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
17 | var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
|
18 | var React = _interopRequireWildcard(require("react"));
|
19 | var _BaseSelect = _interopRequireWildcard(require("./BaseSelect"));
|
20 | var _OptGroup = _interopRequireDefault(require("./OptGroup"));
|
21 | var _Option = _interopRequireDefault(require("./Option"));
|
22 | var _OptionList = _interopRequireDefault(require("./OptionList"));
|
23 | var _SelectContext = _interopRequireDefault(require("./SelectContext"));
|
24 | var _useCache3 = _interopRequireDefault(require("./hooks/useCache"));
|
25 | var _useFilterOptions = _interopRequireDefault(require("./hooks/useFilterOptions"));
|
26 | var _useId = _interopRequireDefault(require("./hooks/useId"));
|
27 | var _useOptions = _interopRequireDefault(require("./hooks/useOptions"));
|
28 | var _useRefFunc = _interopRequireDefault(require("./hooks/useRefFunc"));
|
29 | var _commonUtil = require("./utils/commonUtil");
|
30 | var _valueUtil = require("./utils/valueUtil");
|
31 | var _warningPropsUtil = _interopRequireWildcard(require("./utils/warningPropsUtil"));
|
32 | var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "optionRender", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "direction", "listHeight", "listItemHeight", "labelRender", "value", "defaultValue", "labelInValue", "onChange", "maxCount"];
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
64 | function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(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; }
|
65 | var OMIT_DOM_PROPS = ['inputValue'];
|
66 | function isRawValue(value) {
|
67 | return !value || (0, _typeof2.default)(value) !== 'object';
|
68 | }
|
69 | var Select = React.forwardRef(function (props, ref) {
|
70 | var id = props.id,
|
71 | mode = props.mode,
|
72 | _props$prefixCls = props.prefixCls,
|
73 | prefixCls = _props$prefixCls === void 0 ? 'rc-select' : _props$prefixCls,
|
74 | backfill = props.backfill,
|
75 | fieldNames = props.fieldNames,
|
76 | inputValue = props.inputValue,
|
77 | searchValue = props.searchValue,
|
78 | onSearch = props.onSearch,
|
79 | _props$autoClearSearc = props.autoClearSearchValue,
|
80 | autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
|
81 | onSelect = props.onSelect,
|
82 | onDeselect = props.onDeselect,
|
83 | _props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
84 | dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
|
85 | filterOption = props.filterOption,
|
86 | filterSort = props.filterSort,
|
87 | optionFilterProp = props.optionFilterProp,
|
88 | optionLabelProp = props.optionLabelProp,
|
89 | options = props.options,
|
90 | optionRender = props.optionRender,
|
91 | children = props.children,
|
92 | defaultActiveFirstOption = props.defaultActiveFirstOption,
|
93 | menuItemSelectedIcon = props.menuItemSelectedIcon,
|
94 | virtual = props.virtual,
|
95 | direction = props.direction,
|
96 | _props$listHeight = props.listHeight,
|
97 | listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,
|
98 | _props$listItemHeight = props.listItemHeight,
|
99 | listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,
|
100 | labelRender = props.labelRender,
|
101 | value = props.value,
|
102 | defaultValue = props.defaultValue,
|
103 | labelInValue = props.labelInValue,
|
104 | onChange = props.onChange,
|
105 | maxCount = props.maxCount,
|
106 | restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
107 | var mergedId = (0, _useId.default)(id);
|
108 | var multiple = (0, _BaseSelect.isMultiple)(mode);
|
109 | var childrenAsData = !!(!options && children);
|
110 | var mergedFilterOption = React.useMemo(function () {
|
111 | if (filterOption === undefined && mode === 'combobox') {
|
112 | return false;
|
113 | }
|
114 | return filterOption;
|
115 | }, [filterOption, mode]);
|
116 |
|
117 |
|
118 | var mergedFieldNames = React.useMemo(function () {
|
119 | return (0, _valueUtil.fillFieldNames)(fieldNames, childrenAsData);
|
120 | },
|
121 | [
|
122 |
|
123 | JSON.stringify(fieldNames), childrenAsData]
|
124 | );
|
125 |
|
126 |
|
127 | var _useMergedState = (0, _useMergedState5.default)('', {
|
128 | value: searchValue !== undefined ? searchValue : inputValue,
|
129 | postState: function postState(search) {
|
130 | return search || '';
|
131 | }
|
132 | }),
|
133 | _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2),
|
134 | mergedSearchValue = _useMergedState2[0],
|
135 | setSearchValue = _useMergedState2[1];
|
136 |
|
137 |
|
138 | var parsedOptions = (0, _useOptions.default)(options, children, mergedFieldNames, optionFilterProp, optionLabelProp);
|
139 | var valueOptions = parsedOptions.valueOptions,
|
140 | labelOptions = parsedOptions.labelOptions,
|
141 | mergedOptions = parsedOptions.options;
|
142 |
|
143 |
|
144 | var convert2LabelValues = React.useCallback(function (draftValues) {
|
145 |
|
146 | var valueList = (0, _commonUtil.toArray)(draftValues);
|
147 |
|
148 |
|
149 | return valueList.map(function (val) {
|
150 | var rawValue;
|
151 | var rawLabel;
|
152 | var rawKey;
|
153 | var rawDisabled;
|
154 | var rawTitle;
|
155 |
|
156 |
|
157 | if (isRawValue(val)) {
|
158 | rawValue = val;
|
159 | } else {
|
160 | var _val$value;
|
161 | rawKey = val.key;
|
162 | rawLabel = val.label;
|
163 | rawValue = (_val$value = val.value) !== null && _val$value !== void 0 ? _val$value : rawKey;
|
164 | }
|
165 | var option = valueOptions.get(rawValue);
|
166 | if (option) {
|
167 | var _option$key;
|
168 |
|
169 | if (rawLabel === undefined) rawLabel = option === null || option === void 0 ? void 0 : option[optionLabelProp || mergedFieldNames.label];
|
170 | if (rawKey === undefined) rawKey = (_option$key = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key !== void 0 ? _option$key : rawValue;
|
171 | rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
|
172 | rawTitle = option === null || option === void 0 ? void 0 : option.title;
|
173 |
|
174 |
|
175 | if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {
|
176 | var optionLabel = option === null || option === void 0 ? void 0 : option[mergedFieldNames.label];
|
177 | if (optionLabel !== undefined && ! React.isValidElement(optionLabel) && ! React.isValidElement(rawLabel) && optionLabel !== rawLabel) {
|
178 | (0, _warning.default)(false, '`label` of `value` is not same as `label` in Select options.');
|
179 | }
|
180 | }
|
181 | }
|
182 | return {
|
183 | label: rawLabel,
|
184 | value: rawValue,
|
185 | key: rawKey,
|
186 | disabled: rawDisabled,
|
187 | title: rawTitle
|
188 | };
|
189 | });
|
190 | }, [mergedFieldNames, optionLabelProp, valueOptions]);
|
191 |
|
192 |
|
193 | var _useMergedState3 = (0, _useMergedState5.default)(defaultValue, {
|
194 | value: value
|
195 | }),
|
196 | _useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2),
|
197 | internalValue = _useMergedState4[0],
|
198 | setInternalValue = _useMergedState4[1];
|
199 |
|
200 |
|
201 | var rawLabeledValues = React.useMemo(function () {
|
202 | var _values$;
|
203 | var newInternalValue = multiple && internalValue === null ? [] : internalValue;
|
204 | var values = convert2LabelValues(newInternalValue);
|
205 |
|
206 |
|
207 | if (mode === 'combobox' && (0, _commonUtil.isComboNoValue)((_values$ = values[0]) === null || _values$ === void 0 ? void 0 : _values$.value)) {
|
208 | return [];
|
209 | }
|
210 | return values;
|
211 | }, [internalValue, convert2LabelValues, mode, multiple]);
|
212 |
|
213 |
|
214 | var _useCache = (0, _useCache3.default)(rawLabeledValues, valueOptions),
|
215 | _useCache2 = (0, _slicedToArray2.default)(_useCache, 2),
|
216 | mergedValues = _useCache2[0],
|
217 | getMixedOption = _useCache2[1];
|
218 | var displayValues = React.useMemo(function () {
|
219 |
|
220 |
|
221 | if (!mode && mergedValues.length === 1) {
|
222 | var firstValue = mergedValues[0];
|
223 | if (firstValue.value === null && (firstValue.label === null || firstValue.label === undefined)) {
|
224 | return [];
|
225 | }
|
226 | }
|
227 | return mergedValues.map(function (item) {
|
228 | var _ref;
|
229 | return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
230 | label: (_ref = typeof labelRender === 'function' ? labelRender(item) : item.label) !== null && _ref !== void 0 ? _ref : item.value
|
231 | });
|
232 | });
|
233 | }, [mode, mergedValues, labelRender]);
|
234 |
|
235 |
|
236 | var rawValues = React.useMemo(function () {
|
237 | return new Set(mergedValues.map(function (val) {
|
238 | return val.value;
|
239 | }));
|
240 | }, [mergedValues]);
|
241 | React.useEffect(function () {
|
242 | if (mode === 'combobox') {
|
243 | var _mergedValues$;
|
244 | var strValue = (_mergedValues$ = mergedValues[0]) === null || _mergedValues$ === void 0 ? void 0 : _mergedValues$.value;
|
245 | setSearchValue((0, _commonUtil.hasValue)(strValue) ? String(strValue) : '');
|
246 | }
|
247 | }, [mergedValues]);
|
248 |
|
249 |
|
250 |
|
251 | var createTagOption = (0, _useRefFunc.default)(function (val, label) {
|
252 | var mergedLabel = label !== null && label !== void 0 ? label : val;
|
253 | return (0, _defineProperty2.default)((0, _defineProperty2.default)({}, mergedFieldNames.value, val), mergedFieldNames.label, mergedLabel);
|
254 | });
|
255 |
|
256 |
|
257 | var filledTagOptions = React.useMemo(function () {
|
258 | if (mode !== 'tags') {
|
259 | return mergedOptions;
|
260 | }
|
261 |
|
262 |
|
263 | var cloneOptions = (0, _toConsumableArray2.default)(mergedOptions);
|
264 |
|
265 |
|
266 | var existOptions = function existOptions(val) {
|
267 | return valueOptions.has(val);
|
268 | };
|
269 |
|
270 |
|
271 | (0, _toConsumableArray2.default)(mergedValues).sort(function (a, b) {
|
272 | return a.value < b.value ? -1 : 1;
|
273 | }).forEach(function (item) {
|
274 | var val = item.value;
|
275 | if (!existOptions(val)) {
|
276 | cloneOptions.push(createTagOption(val, item.label));
|
277 | }
|
278 | });
|
279 | return cloneOptions;
|
280 | }, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);
|
281 | var filteredOptions = (0, _useFilterOptions.default)(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
|
282 |
|
283 |
|
284 | var filledSearchOptions = React.useMemo(function () {
|
285 | if (mode !== 'tags' || !mergedSearchValue || filteredOptions.some(function (item) {
|
286 | return item[optionFilterProp || 'value'] === mergedSearchValue;
|
287 | })) {
|
288 | return filteredOptions;
|
289 | }
|
290 |
|
291 | if (filteredOptions.some(function (item) {
|
292 | return item[mergedFieldNames.value] === mergedSearchValue;
|
293 | })) {
|
294 | return filteredOptions;
|
295 | }
|
296 |
|
297 | return [createTagOption(mergedSearchValue)].concat((0, _toConsumableArray2.default)(filteredOptions));
|
298 | }, [createTagOption, optionFilterProp, mode, filteredOptions, mergedSearchValue, mergedFieldNames]);
|
299 | var orderedFilteredOptions = React.useMemo(function () {
|
300 | if (!filterSort) {
|
301 | return filledSearchOptions;
|
302 | }
|
303 | return (0, _toConsumableArray2.default)(filledSearchOptions).sort(function (a, b) {
|
304 | return filterSort(a, b, {
|
305 | searchValue: mergedSearchValue
|
306 | });
|
307 | });
|
308 | }, [filledSearchOptions, filterSort, mergedSearchValue]);
|
309 | var displayOptions = React.useMemo(function () {
|
310 | return (0, _valueUtil.flattenOptions)(orderedFilteredOptions, {
|
311 | fieldNames: mergedFieldNames,
|
312 | childrenAsData: childrenAsData
|
313 | });
|
314 | }, [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
|
315 |
|
316 |
|
317 | var triggerChange = function triggerChange(values) {
|
318 | var labeledValues = convert2LabelValues(values);
|
319 | setInternalValue(labeledValues);
|
320 | if (onChange && (
|
321 |
|
322 | labeledValues.length !== mergedValues.length || labeledValues.some(function (newVal, index) {
|
323 | var _mergedValues$index;
|
324 | return ((_mergedValues$index = mergedValues[index]) === null || _mergedValues$index === void 0 ? void 0 : _mergedValues$index.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
|
325 | }))) {
|
326 | var returnValues = labelInValue ? labeledValues : labeledValues.map(function (v) {
|
327 | return v.value;
|
328 | });
|
329 | var returnOptions = labeledValues.map(function (v) {
|
330 | return (0, _valueUtil.injectPropsWithOption)(getMixedOption(v.value));
|
331 | });
|
332 | onChange(
|
333 |
|
334 | multiple ? returnValues : returnValues[0],
|
335 |
|
336 | multiple ? returnOptions : returnOptions[0]);
|
337 | }
|
338 | };
|
339 |
|
340 |
|
341 | var _React$useState = React.useState(null),
|
342 | _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
343 | activeValue = _React$useState2[0],
|
344 | setActiveValue = _React$useState2[1];
|
345 | var _React$useState3 = React.useState(0),
|
346 | _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
|
347 | accessibilityIndex = _React$useState4[0],
|
348 | setAccessibilityIndex = _React$useState4[1];
|
349 | var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
|
350 | var onActiveValue = React.useCallback(function (active, index) {
|
351 | var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
352 | _ref3$source = _ref3.source,
|
353 | source = _ref3$source === void 0 ? 'keyboard' : _ref3$source;
|
354 | setAccessibilityIndex(index);
|
355 | if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {
|
356 | setActiveValue(String(active));
|
357 | }
|
358 | }, [backfill, mode]);
|
359 |
|
360 |
|
361 | var triggerSelect = function triggerSelect(val, selected, type) {
|
362 | var getSelectEnt = function getSelectEnt() {
|
363 | var _option$key2;
|
364 | var option = getMixedOption(val);
|
365 | return [labelInValue ? {
|
366 | label: option === null || option === void 0 ? void 0 : option[mergedFieldNames.label],
|
367 | value: val,
|
368 | key: (_option$key2 = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key2 !== void 0 ? _option$key2 : val
|
369 | } : val, (0, _valueUtil.injectPropsWithOption)(option)];
|
370 | };
|
371 | if (selected && onSelect) {
|
372 | var _getSelectEnt = getSelectEnt(),
|
373 | _getSelectEnt2 = (0, _slicedToArray2.default)(_getSelectEnt, 2),
|
374 | wrappedValue = _getSelectEnt2[0],
|
375 | _option = _getSelectEnt2[1];
|
376 | onSelect(wrappedValue, _option);
|
377 | } else if (!selected && onDeselect && type !== 'clear') {
|
378 | var _getSelectEnt3 = getSelectEnt(),
|
379 | _getSelectEnt4 = (0, _slicedToArray2.default)(_getSelectEnt3, 2),
|
380 | _wrappedValue = _getSelectEnt4[0],
|
381 | _option2 = _getSelectEnt4[1];
|
382 | onDeselect(_wrappedValue, _option2);
|
383 | }
|
384 | };
|
385 |
|
386 |
|
387 | var onInternalSelect = (0, _useRefFunc.default)(function (val, info) {
|
388 | var cloneValues;
|
389 |
|
390 |
|
391 | var mergedSelect = multiple ? info.selected : true;
|
392 | if (mergedSelect) {
|
393 | cloneValues = multiple ? [].concat((0, _toConsumableArray2.default)(mergedValues), [val]) : [val];
|
394 | } else {
|
395 | cloneValues = mergedValues.filter(function (v) {
|
396 | return v.value !== val;
|
397 | });
|
398 | }
|
399 | triggerChange(cloneValues);
|
400 | triggerSelect(val, mergedSelect);
|
401 |
|
402 |
|
403 | if (mode === 'combobox') {
|
404 |
|
405 | setActiveValue('');
|
406 | } else if (!_BaseSelect.isMultiple || autoClearSearchValue) {
|
407 | setSearchValue('');
|
408 | setActiveValue('');
|
409 | }
|
410 | });
|
411 |
|
412 |
|
413 |
|
414 | var onDisplayValuesChange = function onDisplayValuesChange(nextValues, info) {
|
415 | triggerChange(nextValues);
|
416 | var type = info.type,
|
417 | values = info.values;
|
418 | if (type === 'remove' || type === 'clear') {
|
419 | values.forEach(function (item) {
|
420 | triggerSelect(item.value, false, type);
|
421 | });
|
422 | }
|
423 | };
|
424 |
|
425 |
|
426 | var onInternalSearch = function onInternalSearch(searchText, info) {
|
427 | setSearchValue(searchText);
|
428 | setActiveValue(null);
|
429 |
|
430 |
|
431 | if (info.source === 'submit') {
|
432 | var formatted = (searchText || '').trim();
|
433 |
|
434 | if (formatted) {
|
435 | var newRawValues = Array.from(new Set([].concat((0, _toConsumableArray2.default)(rawValues), [formatted])));
|
436 | triggerChange(newRawValues);
|
437 | triggerSelect(formatted, true);
|
438 | setSearchValue('');
|
439 | }
|
440 | return;
|
441 | }
|
442 | if (info.source !== 'blur') {
|
443 | if (mode === 'combobox') {
|
444 | triggerChange(searchText);
|
445 | }
|
446 | onSearch === null || onSearch === void 0 || onSearch(searchText);
|
447 | }
|
448 | };
|
449 | var onInternalSearchSplit = function onInternalSearchSplit(words) {
|
450 | var patchValues = words;
|
451 | if (mode !== 'tags') {
|
452 | patchValues = words.map(function (word) {
|
453 | var opt = labelOptions.get(word);
|
454 | return opt === null || opt === void 0 ? void 0 : opt.value;
|
455 | }).filter(function (val) {
|
456 | return val !== undefined;
|
457 | });
|
458 | }
|
459 | var newRawValues = Array.from(new Set([].concat((0, _toConsumableArray2.default)(rawValues), (0, _toConsumableArray2.default)(patchValues))));
|
460 | triggerChange(newRawValues);
|
461 | newRawValues.forEach(function (newRawValue) {
|
462 | triggerSelect(newRawValue, true);
|
463 | });
|
464 | };
|
465 |
|
466 |
|
467 | var selectContext = React.useMemo(function () {
|
468 | var realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;
|
469 | return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, parsedOptions), {}, {
|
470 | flattenOptions: displayOptions,
|
471 | onActiveValue: onActiveValue,
|
472 | defaultActiveFirstOption: mergedDefaultActiveFirstOption,
|
473 | onSelect: onInternalSelect,
|
474 | menuItemSelectedIcon: menuItemSelectedIcon,
|
475 | rawValues: rawValues,
|
476 | fieldNames: mergedFieldNames,
|
477 | virtual: realVirtual,
|
478 | direction: direction,
|
479 | listHeight: listHeight,
|
480 | listItemHeight: listItemHeight,
|
481 | childrenAsData: childrenAsData,
|
482 | maxCount: maxCount,
|
483 | optionRender: optionRender
|
484 | });
|
485 | }, [maxCount, parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, direction, listHeight, listItemHeight, childrenAsData, optionRender]);
|
486 |
|
487 |
|
488 | if (process.env.NODE_ENV !== 'production') {
|
489 | (0, _warningPropsUtil.default)(props);
|
490 | (0, _warningPropsUtil.warningNullOptions)(mergedOptions, mergedFieldNames);
|
491 | }
|
492 |
|
493 |
|
494 |
|
495 |
|
496 | return React.createElement(_SelectContext.default.Provider, {
|
497 | value: selectContext
|
498 | }, React.createElement(_BaseSelect.default, (0, _extends2.default)({}, restProps, {
|
499 |
|
500 | id: mergedId,
|
501 | prefixCls: prefixCls,
|
502 | ref: ref,
|
503 | omitDomProps: OMIT_DOM_PROPS,
|
504 | mode: mode
|
505 |
|
506 | ,
|
507 | displayValues: displayValues,
|
508 | onDisplayValuesChange: onDisplayValuesChange
|
509 |
|
510 | ,
|
511 | direction: direction
|
512 |
|
513 | ,
|
514 | searchValue: mergedSearchValue,
|
515 | onSearch: onInternalSearch,
|
516 | autoClearSearchValue: autoClearSearchValue,
|
517 | onSearchSplit: onInternalSearchSplit,
|
518 | dropdownMatchSelectWidth: dropdownMatchSelectWidth
|
519 |
|
520 | ,
|
521 | OptionList: _OptionList.default,
|
522 | emptyOptions: !displayOptions.length
|
523 |
|
524 | ,
|
525 | activeValue: activeValue,
|
526 | activeDescendantId: "".concat(mergedId, "_list_").concat(accessibilityIndex)
|
527 | })));
|
528 | });
|
529 | if (process.env.NODE_ENV !== 'production') {
|
530 | Select.displayName = 'Select';
|
531 | }
|
532 | var TypedSelect = Select;
|
533 | TypedSelect.Option = _Option.default;
|
534 | TypedSelect.OptGroup = _OptGroup.default;
|
535 | var _default = exports.default = TypedSelect; |
\ | No newline at end of file |