8537a8ef7f4961165e6bab12d33db86b.json
101 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\n/**\n * To match accessibility requirement, we always provide an input in the component.\n * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.\n * For focused select, we set `aria-live=\"polite\"` to update the accessibility content.\n *\n * ref:\n * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions\n */\n\nimport * as React from 'react';\nimport { useState, useRef, useEffect, useMemo } from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport Selector from './Selector';\nimport SelectTrigger from './SelectTrigger';\nimport { INTERNAL_PROPS_MARK } from './interface/generator';\nimport { toInnerValue, toOuterValues, removeLastEnabledValue, getUUID } from './utils/commonUtil';\nimport TransBtn from './TransBtn';\nimport useLock from './hooks/useLock';\nimport useDelayReset from './hooks/useDelayReset';\nimport useLayoutEffect from './hooks/useLayoutEffect';\nimport { getSeparatedContent } from './utils/valueUtil';\nimport useSelectTriggerControl from './hooks/useSelectTriggerControl';\nimport useCacheDisplayValue from './hooks/useCacheDisplayValue';\nimport useCacheOptions from './hooks/useCacheOptions';\nvar DEFAULT_OMIT_PROPS = ['removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown'];\n/**\n * This function is in internal usage.\n * Do not use it in your prod env since we may refactor this.\n */\n\nexport default function generateSelector(config) {\n var defaultPrefixCls = config.prefixCls,\n OptionList = config.components.optionList,\n convertChildrenToData = config.convertChildrenToData,\n flattenOptions = config.flattenOptions,\n getLabeledValue = config.getLabeledValue,\n filterOptions = config.filterOptions,\n isValueDisabled = config.isValueDisabled,\n findValueOption = config.findValueOption,\n warningProps = config.warningProps,\n fillOptionsWithMissingValue = config.fillOptionsWithMissingValue,\n omitDOMProps = config.omitDOMProps; // Use raw define since `React.FC` not support generic\n\n function Select(props, ref) {\n var _classNames2;\n\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? defaultPrefixCls : _props$prefixCls,\n className = props.className,\n id = props.id,\n open = props.open,\n defaultOpen = props.defaultOpen,\n options = props.options,\n children = props.children,\n mode = props.mode,\n value = props.value,\n defaultValue = props.defaultValue,\n labelInValue = props.labelInValue,\n showSearch = props.showSearch,\n inputValue = props.inputValue,\n searchValue = props.searchValue,\n filterOption = props.filterOption,\n filterSort = props.filterSort,\n _props$optionFilterPr = props.optionFilterProp,\n optionFilterProp = _props$optionFilterPr === void 0 ? 'value' : _props$optionFilterPr,\n _props$autoClearSearc = props.autoClearSearchValue,\n autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,\n onSearch = props.onSearch,\n allowClear = props.allowClear,\n clearIcon = props.clearIcon,\n showArrow = props.showArrow,\n inputIcon = props.inputIcon,\n menuItemSelectedIcon = props.menuItemSelectedIcon,\n disabled = props.disabled,\n loading = props.loading,\n defaultActiveFirstOption = props.defaultActiveFirstOption,\n _props$notFoundConten = props.notFoundContent,\n notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,\n optionLabelProp = props.optionLabelProp,\n backfill = props.backfill,\n getInputElement = props.getInputElement,\n getPopupContainer = props.getPopupContainer,\n _props$listHeight = props.listHeight,\n listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,\n _props$listItemHeight = props.listItemHeight,\n listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,\n animation = props.animation,\n transitionName = props.transitionName,\n virtual = props.virtual,\n dropdownStyle = props.dropdownStyle,\n dropdownClassName = props.dropdownClassName,\n dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,\n dropdownRender = props.dropdownRender,\n dropdownAlign = props.dropdownAlign,\n _props$showAction = props.showAction,\n showAction = _props$showAction === void 0 ? [] : _props$showAction,\n direction = props.direction,\n tokenSeparators = props.tokenSeparators,\n tagRender = props.tagRender,\n onPopupScroll = props.onPopupScroll,\n onDropdownVisibleChange = props.onDropdownVisibleChange,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onKeyUp = props.onKeyUp,\n onKeyDown = props.onKeyDown,\n onMouseDown = props.onMouseDown,\n onChange = props.onChange,\n onSelect = props.onSelect,\n onDeselect = props.onDeselect,\n onClear = props.onClear,\n _props$internalProps = props.internalProps,\n internalProps = _props$internalProps === void 0 ? {} : _props$internalProps,\n restProps = _objectWithoutProperties(props, [\"prefixCls\", \"className\", \"id\", \"open\", \"defaultOpen\", \"options\", \"children\", \"mode\", \"value\", \"defaultValue\", \"labelInValue\", \"showSearch\", \"inputValue\", \"searchValue\", \"filterOption\", \"filterSort\", \"optionFilterProp\", \"autoClearSearchValue\", \"onSearch\", \"allowClear\", \"clearIcon\", \"showArrow\", \"inputIcon\", \"menuItemSelectedIcon\", \"disabled\", \"loading\", \"defaultActiveFirstOption\", \"notFoundContent\", \"optionLabelProp\", \"backfill\", \"getInputElement\", \"getPopupContainer\", \"listHeight\", \"listItemHeight\", \"animation\", \"transitionName\", \"virtual\", \"dropdownStyle\", \"dropdownClassName\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"showAction\", \"direction\", \"tokenSeparators\", \"tagRender\", \"onPopupScroll\", \"onDropdownVisibleChange\", \"onFocus\", \"onBlur\", \"onKeyUp\", \"onKeyDown\", \"onMouseDown\", \"onChange\", \"onSelect\", \"onDeselect\", \"onClear\", \"internalProps\"]);\n\n var useInternalProps = internalProps.mark === INTERNAL_PROPS_MARK;\n var domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;\n DEFAULT_OMIT_PROPS.forEach(function (prop) {\n delete domProps[prop];\n });\n var containerRef = useRef(null);\n var triggerRef = useRef(null);\n var selectorRef = useRef(null);\n var listRef = useRef(null);\n var tokenWithEnter = useMemo(function () {\n return (tokenSeparators || []).some(function (tokenSeparator) {\n return ['\\n', '\\r\\n'].includes(tokenSeparator);\n });\n }, [tokenSeparators]);\n /** Used for component focused management */\n\n var _useDelayReset = useDelayReset(),\n _useDelayReset2 = _slicedToArray(_useDelayReset, 3),\n mockFocused = _useDelayReset2[0],\n setMockFocused = _useDelayReset2[1],\n cancelSetMockFocused = _useDelayReset2[2]; // Inner id for accessibility usage. Only work in client side\n\n\n var _useState = useState(),\n _useState2 = _slicedToArray(_useState, 2),\n innerId = _useState2[0],\n setInnerId = _useState2[1];\n\n useEffect(function () {\n setInnerId(\"rc_select_\".concat(getUUID()));\n }, []);\n var mergedId = id || innerId; // optionLabelProp\n\n var mergedOptionLabelProp = optionLabelProp;\n\n if (mergedOptionLabelProp === undefined) {\n mergedOptionLabelProp = options ? 'label' : 'children';\n } // labelInValue\n\n\n var mergedLabelInValue = mode === 'combobox' ? false : labelInValue;\n var isMultiple = mode === 'tags' || mode === 'multiple';\n var mergedShowSearch = showSearch !== undefined ? showSearch : isMultiple || mode === 'combobox'; // ============================== Ref ===============================\n\n var selectorDomRef = useRef(null);\n React.useImperativeHandle(ref, function () {\n return {\n focus: selectorRef.current.focus,\n blur: selectorRef.current.blur\n };\n }); // ============================= Value ==============================\n\n var _useMergedState = useMergedState(defaultValue, {\n value: value\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n mergedValue = _useMergedState2[0],\n setMergedValue = _useMergedState2[1];\n /** Unique raw values */\n\n\n var mergedRawValue = useMemo(function () {\n return toInnerValue(mergedValue, {\n labelInValue: mergedLabelInValue,\n combobox: mode === 'combobox'\n });\n }, [mergedValue, mergedLabelInValue]);\n /** We cache a set of raw values to speed up check */\n\n var rawValues = useMemo(function () {\n return new Set(mergedRawValue);\n }, [mergedRawValue]); // ============================= Option =============================\n // Set by option list active, it will merge into search input when mode is `combobox`\n\n var _useState3 = useState(null),\n _useState4 = _slicedToArray(_useState3, 2),\n activeValue = _useState4[0],\n setActiveValue = _useState4[1];\n\n var _useState5 = useState(''),\n _useState6 = _slicedToArray(_useState5, 2),\n innerSearchValue = _useState6[0],\n setInnerSearchValue = _useState6[1];\n\n var mergedSearchValue = innerSearchValue;\n\n if (mode === 'combobox' && mergedValue !== undefined) {\n mergedSearchValue = mergedValue;\n } else if (searchValue !== undefined) {\n mergedSearchValue = searchValue;\n } else if (inputValue) {\n mergedSearchValue = inputValue;\n }\n\n var mergedOptions = useMemo(function () {\n var newOptions = options;\n\n if (newOptions === undefined) {\n newOptions = convertChildrenToData(children);\n }\n /**\n * `tags` should fill un-list item.\n * This is not cool here since TreeSelect do not need this\n */\n\n\n if (mode === 'tags' && fillOptionsWithMissingValue) {\n newOptions = fillOptionsWithMissingValue(newOptions, mergedValue, mergedOptionLabelProp, labelInValue);\n }\n\n return newOptions || [];\n }, [options, children, mode, mergedValue]);\n var mergedFlattenOptions = useMemo(function () {\n return flattenOptions(mergedOptions, props);\n }, [mergedOptions]);\n var getValueOption = useCacheOptions(mergedRawValue, mergedFlattenOptions); // Display options for OptionList\n\n var displayOptions = useMemo(function () {\n if (!mergedSearchValue || !mergedShowSearch) {\n return _toConsumableArray(mergedOptions);\n }\n\n var filteredOptions = filterOptions(mergedSearchValue, mergedOptions, {\n optionFilterProp: optionFilterProp,\n filterOption: mode === 'combobox' && filterOption === undefined ? function () {\n return true;\n } : filterOption\n });\n\n if (mode === 'tags' && filteredOptions.every(function (opt) {\n return opt[optionFilterProp] !== mergedSearchValue;\n })) {\n filteredOptions.unshift({\n value: mergedSearchValue,\n label: mergedSearchValue,\n key: '__RC_SELECT_TAG_PLACEHOLDER__'\n });\n }\n\n if (filterSort && Array.isArray(filteredOptions)) {\n return _toConsumableArray(filteredOptions).sort(filterSort);\n }\n\n return filteredOptions;\n }, [mergedOptions, mergedSearchValue, mode, mergedShowSearch, filterSort]);\n var displayFlattenOptions = useMemo(function () {\n return flattenOptions(displayOptions, props);\n }, [displayOptions]);\n useEffect(function () {\n if (listRef.current && listRef.current.scrollTo) {\n listRef.current.scrollTo(0);\n }\n }, [mergedSearchValue]); // ============================ Selector ============================\n\n var displayValues = useMemo(function () {\n var tmpValues = mergedRawValue.map(function (val) {\n var valueOptions = getValueOption([val]);\n var displayValue = getLabeledValue(val, {\n options: valueOptions,\n prevValue: mergedValue,\n labelInValue: mergedLabelInValue,\n optionLabelProp: mergedOptionLabelProp\n });\n return _objectSpread(_objectSpread({}, displayValue), {}, {\n disabled: isValueDisabled(val, valueOptions)\n });\n });\n\n if (!mode && tmpValues.length === 1 && tmpValues[0].value === null && tmpValues[0].label === null) {\n return [];\n }\n\n return tmpValues;\n }, [mergedValue, mergedOptions, mode]); // Polyfill with cache label\n\n displayValues = useCacheDisplayValue(displayValues);\n\n var triggerSelect = function triggerSelect(newValue, isSelect, source) {\n var newValueOption = getValueOption([newValue]);\n var outOption = findValueOption([newValue], newValueOption)[0];\n\n if (!internalProps.skipTriggerSelect) {\n // Skip trigger `onSelect` or `onDeselect` if configured\n var selectValue = mergedLabelInValue ? getLabeledValue(newValue, {\n options: newValueOption,\n prevValue: mergedValue,\n labelInValue: mergedLabelInValue,\n optionLabelProp: mergedOptionLabelProp\n }) : newValue;\n\n if (isSelect && onSelect) {\n onSelect(selectValue, outOption);\n } else if (!isSelect && onDeselect) {\n onDeselect(selectValue, outOption);\n }\n } // Trigger internal event\n\n\n if (useInternalProps) {\n if (isSelect && internalProps.onRawSelect) {\n internalProps.onRawSelect(newValue, outOption, source);\n } else if (!isSelect && internalProps.onRawDeselect) {\n internalProps.onRawDeselect(newValue, outOption, source);\n }\n }\n }; // We need cache options here in case user update the option list\n\n\n var _useState7 = useState([]),\n _useState8 = _slicedToArray(_useState7, 2),\n prevValueOptions = _useState8[0],\n setPrevValueOptions = _useState8[1];\n\n var triggerChange = function triggerChange(newRawValues) {\n if (useInternalProps && internalProps.skipTriggerChange) {\n return;\n }\n\n var newRawValuesOptions = getValueOption(newRawValues);\n var outValues = toOuterValues(Array.from(newRawValues), {\n labelInValue: mergedLabelInValue,\n options: newRawValuesOptions,\n getLabeledValue: getLabeledValue,\n prevValue: mergedValue,\n optionLabelProp: mergedOptionLabelProp\n });\n var outValue = isMultiple ? outValues : outValues[0]; // Skip trigger if prev & current value is both empty\n\n if (onChange && (mergedRawValue.length !== 0 || outValues.length !== 0)) {\n var outOptions = findValueOption(newRawValues, newRawValuesOptions, {\n prevValueOptions: prevValueOptions\n }); // We will cache option in case it removed by ajax\n\n setPrevValueOptions(outOptions.map(function (option, index) {\n var clone = _objectSpread({}, option);\n\n Object.defineProperty(clone, '_INTERNAL_OPTION_VALUE_', {\n get: function get() {\n return newRawValues[index];\n }\n });\n return clone;\n }));\n onChange(outValue, isMultiple ? outOptions : outOptions[0]);\n }\n\n setMergedValue(outValue);\n };\n\n var onInternalSelect = function onInternalSelect(newValue, _ref) {\n var selected = _ref.selected,\n source = _ref.source;\n\n if (disabled) {\n return;\n }\n\n var newRawValue;\n\n if (isMultiple) {\n newRawValue = new Set(mergedRawValue);\n\n if (selected) {\n newRawValue.add(newValue);\n } else {\n newRawValue.delete(newValue);\n }\n } else {\n newRawValue = new Set();\n newRawValue.add(newValue);\n } // Multiple always trigger change and single should change if value changed\n\n\n if (isMultiple || !isMultiple && Array.from(mergedRawValue)[0] !== newValue) {\n triggerChange(Array.from(newRawValue));\n } // Trigger `onSelect`. Single mode always trigger select\n\n\n triggerSelect(newValue, !isMultiple || selected, source); // Clean search value if single or configured\n\n if (mode === 'combobox') {\n setInnerSearchValue(String(newValue));\n setActiveValue('');\n } else if (!isMultiple || autoClearSearchValue) {\n setInnerSearchValue('');\n setActiveValue('');\n }\n };\n\n var onInternalOptionSelect = function onInternalOptionSelect(newValue, info) {\n onInternalSelect(newValue, _objectSpread(_objectSpread({}, info), {}, {\n source: 'option'\n }));\n };\n\n var onInternalSelectionSelect = function onInternalSelectionSelect(newValue, info) {\n onInternalSelect(newValue, _objectSpread(_objectSpread({}, info), {}, {\n source: 'selection'\n }));\n }; // ============================= Input ==============================\n // Only works in `combobox`\n\n\n var customizeInputElement = mode === 'combobox' && getInputElement && getInputElement() || null; // ============================== Open ==============================\n\n var _useMergedState3 = useMergedState(undefined, {\n defaultValue: defaultOpen,\n value: open\n }),\n _useMergedState4 = _slicedToArray(_useMergedState3, 2),\n innerOpen = _useMergedState4[0],\n setInnerOpen = _useMergedState4[1];\n\n var mergedOpen = innerOpen; // Not trigger `open` in `combobox` when `notFoundContent` is empty\n\n var emptyListContent = !notFoundContent && !displayOptions.length;\n\n if (disabled || emptyListContent && mergedOpen && mode === 'combobox') {\n mergedOpen = false;\n }\n\n var triggerOpen = emptyListContent ? false : mergedOpen;\n\n var onToggleOpen = function onToggleOpen(newOpen) {\n var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;\n\n if (innerOpen !== nextOpen && !disabled) {\n setInnerOpen(nextOpen);\n\n if (onDropdownVisibleChange) {\n onDropdownVisibleChange(nextOpen);\n }\n }\n };\n\n useSelectTriggerControl([containerRef.current, triggerRef.current && triggerRef.current.getPopupElement()], triggerOpen, onToggleOpen); // ============================= Search =============================\n\n var triggerSearch = function triggerSearch(searchText, fromTyping, isCompositing) {\n var ret = true;\n var newSearchText = searchText;\n setActiveValue(null); // Check if match the `tokenSeparators`\n\n var patchLabels = isCompositing ? null : getSeparatedContent(searchText, tokenSeparators);\n var patchRawValues = patchLabels;\n\n if (mode === 'combobox') {\n // Only typing will trigger onChange\n if (fromTyping) {\n triggerChange([newSearchText]);\n }\n } else if (patchLabels) {\n newSearchText = '';\n\n if (mode !== 'tags') {\n patchRawValues = patchLabels.map(function (label) {\n var item = mergedFlattenOptions.find(function (_ref2) {\n var data = _ref2.data;\n return data[mergedOptionLabelProp] === label;\n });\n return item ? item.data.value : null;\n }).filter(function (val) {\n return val !== null;\n });\n }\n\n var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), _toConsumableArray(patchRawValues))));\n triggerChange(newRawValues);\n newRawValues.forEach(function (newRawValue) {\n triggerSelect(newRawValue, true, 'input');\n }); // Should close when paste finish\n\n onToggleOpen(false); // Tell Selector that break next actions\n\n ret = false;\n }\n\n setInnerSearchValue(newSearchText);\n\n if (onSearch && mergedSearchValue !== newSearchText) {\n onSearch(newSearchText);\n }\n\n return ret;\n }; // Only triggered when menu is closed & mode is tags\n // If menu is open, OptionList will take charge\n // If mode isn't tags, press enter is not meaningful when you can't see any option\n\n\n var onSearchSubmit = function onSearchSubmit(searchText) {\n var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [searchText])));\n triggerChange(newRawValues);\n newRawValues.forEach(function (newRawValue) {\n triggerSelect(newRawValue, true, 'input');\n });\n setInnerSearchValue('');\n }; // Close dropdown when disabled change\n\n\n useEffect(function () {\n if (innerOpen && !!disabled) {\n setInnerOpen(false);\n }\n }, [disabled]); // Close will clean up single mode search text\n\n useEffect(function () {\n if (!mergedOpen && !isMultiple && mode !== 'combobox') {\n triggerSearch('', false, false);\n }\n }, [mergedOpen]); // ============================ Keyboard ============================\n\n /**\n * We record input value here to check if can press to clean up by backspace\n * - null: Key is not down, this is reset by key up\n * - true: Search text is empty when first time backspace down\n * - false: Search text is not empty when first time backspace down\n */\n\n var _useLock = useLock(),\n _useLock2 = _slicedToArray(_useLock, 2),\n getClearLock = _useLock2[0],\n setClearLock = _useLock2[1]; // KeyDown\n\n\n var onInternalKeyDown = function onInternalKeyDown(event) {\n var clearLock = getClearLock();\n var which = event.which; // We only manage open state here, close logic should handle by list component\n\n if (!mergedOpen && which === KeyCode.ENTER) {\n onToggleOpen(true);\n }\n\n setClearLock(!!mergedSearchValue); // Remove value by `backspace`\n\n if (which === KeyCode.BACKSPACE && !clearLock && isMultiple && !mergedSearchValue && mergedRawValue.length) {\n var removeInfo = removeLastEnabledValue(displayValues, mergedRawValue);\n\n if (removeInfo.removedValue !== null) {\n triggerChange(removeInfo.values);\n triggerSelect(removeInfo.removedValue, false, 'input');\n }\n }\n\n for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n rest[_key - 1] = arguments[_key];\n }\n\n if (mergedOpen && listRef.current) {\n var _listRef$current;\n\n (_listRef$current = listRef.current).onKeyDown.apply(_listRef$current, [event].concat(rest));\n }\n\n if (onKeyDown) {\n onKeyDown.apply(void 0, [event].concat(rest));\n }\n }; // KeyUp\n\n\n var onInternalKeyUp = function onInternalKeyUp(event) {\n for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n rest[_key2 - 1] = arguments[_key2];\n }\n\n if (mergedOpen && listRef.current) {\n var _listRef$current2;\n\n (_listRef$current2 = listRef.current).onKeyUp.apply(_listRef$current2, [event].concat(rest));\n }\n\n if (onKeyUp) {\n onKeyUp.apply(void 0, [event].concat(rest));\n }\n }; // ========================== Focus / Blur ==========================\n\n /** Record real focus status */\n\n\n var focusRef = useRef(false);\n\n var onContainerFocus = function onContainerFocus() {\n setMockFocused(true);\n\n if (!disabled) {\n if (onFocus && !focusRef.current) {\n onFocus.apply(void 0, arguments);\n } // `showAction` should handle `focus` if set\n\n\n if (showAction.includes('focus')) {\n onToggleOpen(true);\n }\n }\n\n focusRef.current = true;\n };\n\n var onContainerBlur = function onContainerBlur() {\n setMockFocused(false, function () {\n focusRef.current = false;\n onToggleOpen(false);\n });\n\n if (disabled) {\n return;\n }\n\n if (mergedSearchValue) {\n // `tags` mode should move `searchValue` into values\n if (mode === 'tags') {\n triggerSearch('', false, false);\n triggerChange(Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [mergedSearchValue]))));\n } else if (mode === 'multiple') {\n // `multiple` mode only clean the search value but not trigger event\n setInnerSearchValue('');\n }\n }\n\n if (onBlur) {\n onBlur.apply(void 0, arguments);\n }\n };\n\n var activeTimeoutIds = [];\n useEffect(function () {\n return function () {\n activeTimeoutIds.forEach(function (timeoutId) {\n return clearTimeout(timeoutId);\n });\n activeTimeoutIds.splice(0, activeTimeoutIds.length);\n };\n }, []);\n\n var onInternalMouseDown = function onInternalMouseDown(event) {\n var target = event.target;\n var popupElement = triggerRef.current && triggerRef.current.getPopupElement(); // We should give focus back to selector if clicked item is not focusable\n\n if (popupElement && popupElement.contains(target)) {\n var timeoutId = setTimeout(function () {\n var index = activeTimeoutIds.indexOf(timeoutId);\n\n if (index !== -1) {\n activeTimeoutIds.splice(index, 1);\n }\n\n cancelSetMockFocused();\n\n if (!popupElement.contains(document.activeElement)) {\n selectorRef.current.focus();\n }\n });\n activeTimeoutIds.push(timeoutId);\n }\n\n if (onMouseDown) {\n for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n restArgs[_key3 - 1] = arguments[_key3];\n }\n\n onMouseDown.apply(void 0, [event].concat(restArgs));\n }\n }; // ========================= Accessibility ==========================\n\n\n var _useState9 = useState(0),\n _useState10 = _slicedToArray(_useState9, 2),\n accessibilityIndex = _useState10[0],\n setAccessibilityIndex = _useState10[1];\n\n var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';\n\n var onActiveValue = function onActiveValue(active, index) {\n var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n _ref3$source = _ref3.source,\n source = _ref3$source === void 0 ? 'keyboard' : _ref3$source;\n\n setAccessibilityIndex(index);\n\n if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {\n setActiveValue(String(active));\n }\n }; // ============================= Popup ==============================\n\n\n var _useState11 = useState(null),\n _useState12 = _slicedToArray(_useState11, 2),\n containerWidth = _useState12[0],\n setContainerWidth = _useState12[1];\n\n var _useState13 = useState({}),\n _useState14 = _slicedToArray(_useState13, 2),\n forceUpdate = _useState14[1]; // We need force update here since popup dom is render async\n\n\n function onPopupMouseEnter() {\n forceUpdate({});\n }\n\n useLayoutEffect(function () {\n if (triggerOpen) {\n var newWidth = Math.ceil(containerRef.current.offsetWidth);\n\n if (containerWidth !== newWidth) {\n setContainerWidth(newWidth);\n }\n }\n }, [triggerOpen]);\n var popupNode = React.createElement(OptionList, {\n ref: listRef,\n prefixCls: prefixCls,\n id: mergedId,\n open: mergedOpen,\n childrenAsData: !options,\n options: displayOptions,\n flattenOptions: displayFlattenOptions,\n multiple: isMultiple,\n values: rawValues,\n height: listHeight,\n itemHeight: listItemHeight,\n onSelect: onInternalOptionSelect,\n onToggleOpen: onToggleOpen,\n onActiveValue: onActiveValue,\n defaultActiveFirstOption: mergedDefaultActiveFirstOption,\n notFoundContent: notFoundContent,\n onScroll: onPopupScroll,\n searchValue: mergedSearchValue,\n menuItemSelectedIcon: menuItemSelectedIcon,\n virtual: virtual !== false && dropdownMatchSelectWidth !== false,\n onMouseEnter: onPopupMouseEnter\n }); // ============================= Clear ==============================\n\n var clearNode;\n\n var onClearMouseDown = function onClearMouseDown() {\n // Trigger internal `onClear` event\n if (useInternalProps && internalProps.onClear) {\n internalProps.onClear();\n }\n\n if (onClear) {\n onClear();\n }\n\n triggerChange([]);\n triggerSearch('', false, false);\n };\n\n if (!disabled && allowClear && (mergedRawValue.length || mergedSearchValue)) {\n clearNode = React.createElement(TransBtn, {\n className: \"\".concat(prefixCls, \"-clear\"),\n onMouseDown: onClearMouseDown,\n customizeIcon: clearIcon\n }, \"\\xD7\");\n } // ============================= Arrow ==============================\n\n\n var mergedShowArrow = showArrow !== undefined ? showArrow : loading || !isMultiple && mode !== 'combobox';\n var arrowNode;\n\n if (mergedShowArrow) {\n arrowNode = React.createElement(TransBtn, {\n className: classNames(\"\".concat(prefixCls, \"-arrow\"), _defineProperty({}, \"\".concat(prefixCls, \"-arrow-loading\"), loading)),\n customizeIcon: inputIcon,\n customizeIconProps: {\n loading: loading,\n searchValue: mergedSearchValue,\n open: mergedOpen,\n focused: mockFocused,\n showSearch: mergedShowSearch\n }\n });\n } // ============================ Warning =============================\n\n\n if (process.env.NODE_ENV !== 'production' && warningProps) {\n warningProps(props);\n } // ============================= Render =============================\n\n\n var mergedClassName = classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-focused\"), mockFocused), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-multiple\"), isMultiple), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-single\"), !isMultiple), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-allow-clear\"), allowClear), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-show-arrow\"), mergedShowArrow), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-disabled\"), disabled), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-loading\"), loading), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-open\"), mergedOpen), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-customize-input\"), customizeInputElement), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-show-search\"), mergedShowSearch), _classNames2));\n return React.createElement(\"div\", Object.assign({\n className: mergedClassName\n }, domProps, {\n ref: containerRef,\n onMouseDown: onInternalMouseDown,\n onKeyDown: onInternalKeyDown,\n onKeyUp: onInternalKeyUp,\n onFocus: onContainerFocus,\n onBlur: onContainerBlur\n }), mockFocused && !mergedOpen && React.createElement(\"span\", {\n style: {\n width: 0,\n height: 0,\n display: 'flex',\n overflow: 'hidden',\n opacity: 0\n },\n \"aria-live\": \"polite\"\n }, \"\".concat(mergedRawValue.join(', '))), React.createElement(SelectTrigger, {\n ref: triggerRef,\n disabled: disabled,\n prefixCls: prefixCls,\n visible: triggerOpen,\n popupElement: popupNode,\n containerWidth: containerWidth,\n animation: animation,\n transitionName: transitionName,\n dropdownStyle: dropdownStyle,\n dropdownClassName: dropdownClassName,\n direction: direction,\n dropdownMatchSelectWidth: dropdownMatchSelectWidth,\n dropdownRender: dropdownRender,\n dropdownAlign: dropdownAlign,\n getPopupContainer: getPopupContainer,\n empty: !mergedOptions.length,\n getTriggerDOMNode: function getTriggerDOMNode() {\n return selectorDomRef.current;\n }\n }, React.createElement(Selector, Object.assign({}, props, {\n domRef: selectorDomRef,\n prefixCls: prefixCls,\n inputElement: customizeInputElement,\n ref: selectorRef,\n id: mergedId,\n showSearch: mergedShowSearch,\n mode: mode,\n accessibilityIndex: accessibilityIndex,\n multiple: isMultiple,\n tagRender: tagRender,\n values: displayValues,\n open: mergedOpen,\n onToggleOpen: onToggleOpen,\n searchValue: mergedSearchValue,\n activeValue: activeValue,\n onSearch: triggerSearch,\n onSearchSubmit: onSearchSubmit,\n onSelect: onInternalSelectionSelect,\n tokenWithEnter: tokenWithEnter\n }))), arrowNode, clearNode);\n }\n\n var RefSelect = React.forwardRef(Select);\n return RefSelect;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-select/es/generate.js"],"names":["_defineProperty","_objectSpread","_toConsumableArray","_slicedToArray","_objectWithoutProperties","React","useState","useRef","useEffect","useMemo","KeyCode","classNames","useMergedState","Selector","SelectTrigger","INTERNAL_PROPS_MARK","toInnerValue","toOuterValues","removeLastEnabledValue","getUUID","TransBtn","useLock","useDelayReset","useLayoutEffect","getSeparatedContent","useSelectTriggerControl","useCacheDisplayValue","useCacheOptions","DEFAULT_OMIT_PROPS","generateSelector","config","defaultPrefixCls","prefixCls","OptionList","components","optionList","convertChildrenToData","flattenOptions","getLabeledValue","filterOptions","isValueDisabled","findValueOption","warningProps","fillOptionsWithMissingValue","omitDOMProps","Select","props","ref","_classNames2","_props$prefixCls","className","id","open","defaultOpen","options","children","mode","value","defaultValue","labelInValue","showSearch","inputValue","searchValue","filterOption","filterSort","_props$optionFilterPr","optionFilterProp","_props$autoClearSearc","autoClearSearchValue","onSearch","allowClear","clearIcon","showArrow","inputIcon","menuItemSelectedIcon","disabled","loading","defaultActiveFirstOption","_props$notFoundConten","notFoundContent","optionLabelProp","backfill","getInputElement","getPopupContainer","_props$listHeight","listHeight","_props$listItemHeight","listItemHeight","animation","transitionName","virtual","dropdownStyle","dropdownClassName","dropdownMatchSelectWidth","dropdownRender","dropdownAlign","_props$showAction","showAction","direction","tokenSeparators","tagRender","onPopupScroll","onDropdownVisibleChange","onFocus","onBlur","onKeyUp","onKeyDown","onMouseDown","onChange","onSelect","onDeselect","onClear","_props$internalProps","internalProps","restProps","useInternalProps","mark","domProps","forEach","prop","containerRef","triggerRef","selectorRef","listRef","tokenWithEnter","some","tokenSeparator","includes","_useDelayReset","_useDelayReset2","mockFocused","setMockFocused","cancelSetMockFocused","_useState","_useState2","innerId","setInnerId","concat","mergedId","mergedOptionLabelProp","undefined","mergedLabelInValue","isMultiple","mergedShowSearch","selectorDomRef","useImperativeHandle","focus","current","blur","_useMergedState","_useMergedState2","mergedValue","setMergedValue","mergedRawValue","combobox","rawValues","Set","_useState3","_useState4","activeValue","setActiveValue","_useState5","_useState6","innerSearchValue","setInnerSearchValue","mergedSearchValue","mergedOptions","newOptions","mergedFlattenOptions","getValueOption","displayOptions","filteredOptions","every","opt","unshift","label","key","Array","isArray","sort","displayFlattenOptions","scrollTo","displayValues","tmpValues","map","val","valueOptions","displayValue","prevValue","length","triggerSelect","newValue","isSelect","source","newValueOption","outOption","skipTriggerSelect","selectValue","onRawSelect","onRawDeselect","_useState7","_useState8","prevValueOptions","setPrevValueOptions","triggerChange","newRawValues","skipTriggerChange","newRawValuesOptions","outValues","from","outValue","outOptions","option","index","clone","Object","defineProperty","get","onInternalSelect","_ref","selected","newRawValue","add","delete","String","onInternalOptionSelect","info","onInternalSelectionSelect","customizeInputElement","_useMergedState3","_useMergedState4","innerOpen","setInnerOpen","mergedOpen","emptyListContent","triggerOpen","onToggleOpen","newOpen","nextOpen","getPopupElement","triggerSearch","searchText","fromTyping","isCompositing","ret","newSearchText","patchLabels","patchRawValues","item","find","_ref2","data","filter","onSearchSubmit","_useLock","_useLock2","getClearLock","setClearLock","onInternalKeyDown","event","clearLock","which","ENTER","BACKSPACE","removeInfo","removedValue","values","_len","arguments","rest","_key","_listRef$current","apply","onInternalKeyUp","_len2","_key2","_listRef$current2","focusRef","onContainerFocus","onContainerBlur","activeTimeoutIds","timeoutId","clearTimeout","splice","onInternalMouseDown","target","popupElement","contains","setTimeout","indexOf","document","activeElement","push","_len3","restArgs","_key3","_useState9","_useState10","accessibilityIndex","setAccessibilityIndex","mergedDefaultActiveFirstOption","onActiveValue","active","_ref3","_ref3$source","_useState11","_useState12","containerWidth","setContainerWidth","_useState13","_useState14","forceUpdate","onPopupMouseEnter","newWidth","Math","ceil","offsetWidth","popupNode","createElement","childrenAsData","multiple","height","itemHeight","onScroll","onMouseEnter","clearNode","onClearMouseDown","customizeIcon","mergedShowArrow","arrowNode","customizeIconProps","focused","process","env","NODE_ENV","mergedClassName","assign","style","width","display","overflow","opacity","join","visible","empty","getTriggerDOMNode","domRef","inputElement","RefSelect","forwardRef"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,aAAP,MAA0B,0CAA1B;AACA,OAAOC,kBAAP,MAA+B,8CAA/B;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AACA,OAAOC,wBAAP,MAAqC,oDAArC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,SAA3B,EAAsCC,OAAtC,QAAqD,OAArD;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,cAAP,MAA2B,iCAA3B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SAASC,YAAT,EAAuBC,aAAvB,EAAsCC,sBAAtC,EAA8DC,OAA9D,QAA6E,oBAA7E;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,OAAP,MAAoB,iBAApB;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MAAAA,cAAc,EAAEA,cAjBwC;AAkBxDhJ,MAAAA,QAAQ,EAAEsH,yBAlB8C;AAmBxDvG,MAAAA,cAAc,EAAEA;AAnBwC,KAAzB,CAA9B,CApBuC,CAlBnC,EA0DD6M,SA1DC,EA0DUJ,SA1DV,CAAP;AA2DD;;AAED,MAAIuB,SAAS,GAAGvV,KAAK,CAACwV,UAAN,CAAiBhT,MAAjB,CAAhB;AACA,SAAO+S,SAAP;AACD","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\n\n/**\n * To match accessibility requirement, we always provide an input in the component.\n * Other element will not set `tabIndex` to avoid `onBlur` sequence problem.\n * For focused select, we set `aria-live=\"polite\"` to update the accessibility content.\n *\n * ref:\n * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions\n */\nimport * as React from 'react';\nimport { useState, useRef, useEffect, useMemo } from 'react';\nimport KeyCode from \"rc-util/es/KeyCode\";\nimport classNames from 'classnames';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport Selector from './Selector';\nimport SelectTrigger from './SelectTrigger';\nimport { INTERNAL_PROPS_MARK } from './interface/generator';\nimport { toInnerValue, toOuterValues, removeLastEnabledValue, getUUID } from './utils/commonUtil';\nimport TransBtn from './TransBtn';\nimport useLock from './hooks/useLock';\nimport useDelayReset from './hooks/useDelayReset';\nimport useLayoutEffect from './hooks/useLayoutEffect';\nimport { getSeparatedContent } from './utils/valueUtil';\nimport useSelectTriggerControl from './hooks/useSelectTriggerControl';\nimport useCacheDisplayValue from './hooks/useCacheDisplayValue';\nimport useCacheOptions from './hooks/useCacheOptions';\nvar DEFAULT_OMIT_PROPS = ['removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown'];\n/**\n * This function is in internal usage.\n * Do not use it in your prod env since we may refactor this.\n */\n\nexport default function generateSelector(config) {\n var defaultPrefixCls = config.prefixCls,\n OptionList = config.components.optionList,\n convertChildrenToData = config.convertChildrenToData,\n flattenOptions = config.flattenOptions,\n getLabeledValue = config.getLabeledValue,\n filterOptions = config.filterOptions,\n isValueDisabled = config.isValueDisabled,\n findValueOption = config.findValueOption,\n warningProps = config.warningProps,\n fillOptionsWithMissingValue = config.fillOptionsWithMissingValue,\n omitDOMProps = config.omitDOMProps; // Use raw define since `React.FC` not support generic\n\n function Select(props, ref) {\n var _classNames2;\n\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? defaultPrefixCls : _props$prefixCls,\n className = props.className,\n id = props.id,\n open = props.open,\n defaultOpen = props.defaultOpen,\n options = props.options,\n children = props.children,\n mode = props.mode,\n value = props.value,\n defaultValue = props.defaultValue,\n labelInValue = props.labelInValue,\n showSearch = props.showSearch,\n inputValue = props.inputValue,\n searchValue = props.searchValue,\n filterOption = props.filterOption,\n filterSort = props.filterSort,\n _props$optionFilterPr = props.optionFilterProp,\n optionFilterProp = _props$optionFilterPr === void 0 ? 'value' : _props$optionFilterPr,\n _props$autoClearSearc = props.autoClearSearchValue,\n autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,\n onSearch = props.onSearch,\n allowClear = props.allowClear,\n clearIcon = props.clearIcon,\n showArrow = props.showArrow,\n inputIcon = props.inputIcon,\n menuItemSelectedIcon = props.menuItemSelectedIcon,\n disabled = props.disabled,\n loading = props.loading,\n defaultActiveFirstOption = props.defaultActiveFirstOption,\n _props$notFoundConten = props.notFoundContent,\n notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,\n optionLabelProp = props.optionLabelProp,\n backfill = props.backfill,\n getInputElement = props.getInputElement,\n getPopupContainer = props.getPopupContainer,\n _props$listHeight = props.listHeight,\n listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,\n _props$listItemHeight = props.listItemHeight,\n listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,\n animation = props.animation,\n transitionName = props.transitionName,\n virtual = props.virtual,\n dropdownStyle = props.dropdownStyle,\n dropdownClassName = props.dropdownClassName,\n dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,\n dropdownRender = props.dropdownRender,\n dropdownAlign = props.dropdownAlign,\n _props$showAction = props.showAction,\n showAction = _props$showAction === void 0 ? [] : _props$showAction,\n direction = props.direction,\n tokenSeparators = props.tokenSeparators,\n tagRender = props.tagRender,\n onPopupScroll = props.onPopupScroll,\n onDropdownVisibleChange = props.onDropdownVisibleChange,\n onFocus = props.onFocus,\n onBlur = props.onBlur,\n onKeyUp = props.onKeyUp,\n onKeyDown = props.onKeyDown,\n onMouseDown = props.onMouseDown,\n onChange = props.onChange,\n onSelect = props.onSelect,\n onDeselect = props.onDeselect,\n onClear = props.onClear,\n _props$internalProps = props.internalProps,\n internalProps = _props$internalProps === void 0 ? {} : _props$internalProps,\n restProps = _objectWithoutProperties(props, [\"prefixCls\", \"className\", \"id\", \"open\", \"defaultOpen\", \"options\", \"children\", \"mode\", \"value\", \"defaultValue\", \"labelInValue\", \"showSearch\", \"inputValue\", \"searchValue\", \"filterOption\", \"filterSort\", \"optionFilterProp\", \"autoClearSearchValue\", \"onSearch\", \"allowClear\", \"clearIcon\", \"showArrow\", \"inputIcon\", \"menuItemSelectedIcon\", \"disabled\", \"loading\", \"defaultActiveFirstOption\", \"notFoundContent\", \"optionLabelProp\", \"backfill\", \"getInputElement\", \"getPopupContainer\", \"listHeight\", \"listItemHeight\", \"animation\", \"transitionName\", \"virtual\", \"dropdownStyle\", \"dropdownClassName\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"showAction\", \"direction\", \"tokenSeparators\", \"tagRender\", \"onPopupScroll\", \"onDropdownVisibleChange\", \"onFocus\", \"onBlur\", \"onKeyUp\", \"onKeyDown\", \"onMouseDown\", \"onChange\", \"onSelect\", \"onDeselect\", \"onClear\", \"internalProps\"]);\n\n var useInternalProps = internalProps.mark === INTERNAL_PROPS_MARK;\n var domProps = omitDOMProps ? omitDOMProps(restProps) : restProps;\n DEFAULT_OMIT_PROPS.forEach(function (prop) {\n delete domProps[prop];\n });\n var containerRef = useRef(null);\n var triggerRef = useRef(null);\n var selectorRef = useRef(null);\n var listRef = useRef(null);\n var tokenWithEnter = useMemo(function () {\n return (tokenSeparators || []).some(function (tokenSeparator) {\n return ['\\n', '\\r\\n'].includes(tokenSeparator);\n });\n }, [tokenSeparators]);\n /** Used for component focused management */\n\n var _useDelayReset = useDelayReset(),\n _useDelayReset2 = _slicedToArray(_useDelayReset, 3),\n mockFocused = _useDelayReset2[0],\n setMockFocused = _useDelayReset2[1],\n cancelSetMockFocused = _useDelayReset2[2]; // Inner id for accessibility usage. Only work in client side\n\n\n var _useState = useState(),\n _useState2 = _slicedToArray(_useState, 2),\n innerId = _useState2[0],\n setInnerId = _useState2[1];\n\n useEffect(function () {\n setInnerId(\"rc_select_\".concat(getUUID()));\n }, []);\n var mergedId = id || innerId; // optionLabelProp\n\n var mergedOptionLabelProp = optionLabelProp;\n\n if (mergedOptionLabelProp === undefined) {\n mergedOptionLabelProp = options ? 'label' : 'children';\n } // labelInValue\n\n\n var mergedLabelInValue = mode === 'combobox' ? false : labelInValue;\n var isMultiple = mode === 'tags' || mode === 'multiple';\n var mergedShowSearch = showSearch !== undefined ? showSearch : isMultiple || mode === 'combobox'; // ============================== Ref ===============================\n\n var selectorDomRef = useRef(null);\n React.useImperativeHandle(ref, function () {\n return {\n focus: selectorRef.current.focus,\n blur: selectorRef.current.blur\n };\n }); // ============================= Value ==============================\n\n var _useMergedState = useMergedState(defaultValue, {\n value: value\n }),\n _useMergedState2 = _slicedToArray(_useMergedState, 2),\n mergedValue = _useMergedState2[0],\n setMergedValue = _useMergedState2[1];\n /** Unique raw values */\n\n\n var mergedRawValue = useMemo(function () {\n return toInnerValue(mergedValue, {\n labelInValue: mergedLabelInValue,\n combobox: mode === 'combobox'\n });\n }, [mergedValue, mergedLabelInValue]);\n /** We cache a set of raw values to speed up check */\n\n var rawValues = useMemo(function () {\n return new Set(mergedRawValue);\n }, [mergedRawValue]); // ============================= Option =============================\n // Set by option list active, it will merge into search input when mode is `combobox`\n\n var _useState3 = useState(null),\n _useState4 = _slicedToArray(_useState3, 2),\n activeValue = _useState4[0],\n setActiveValue = _useState4[1];\n\n var _useState5 = useState(''),\n _useState6 = _slicedToArray(_useState5, 2),\n innerSearchValue = _useState6[0],\n setInnerSearchValue = _useState6[1];\n\n var mergedSearchValue = innerSearchValue;\n\n if (mode === 'combobox' && mergedValue !== undefined) {\n mergedSearchValue = mergedValue;\n } else if (searchValue !== undefined) {\n mergedSearchValue = searchValue;\n } else if (inputValue) {\n mergedSearchValue = inputValue;\n }\n\n var mergedOptions = useMemo(function () {\n var newOptions = options;\n\n if (newOptions === undefined) {\n newOptions = convertChildrenToData(children);\n }\n /**\n * `tags` should fill un-list item.\n * This is not cool here since TreeSelect do not need this\n */\n\n\n if (mode === 'tags' && fillOptionsWithMissingValue) {\n newOptions = fillOptionsWithMissingValue(newOptions, mergedValue, mergedOptionLabelProp, labelInValue);\n }\n\n return newOptions || [];\n }, [options, children, mode, mergedValue]);\n var mergedFlattenOptions = useMemo(function () {\n return flattenOptions(mergedOptions, props);\n }, [mergedOptions]);\n var getValueOption = useCacheOptions(mergedRawValue, mergedFlattenOptions); // Display options for OptionList\n\n var displayOptions = useMemo(function () {\n if (!mergedSearchValue || !mergedShowSearch) {\n return _toConsumableArray(mergedOptions);\n }\n\n var filteredOptions = filterOptions(mergedSearchValue, mergedOptions, {\n optionFilterProp: optionFilterProp,\n filterOption: mode === 'combobox' && filterOption === undefined ? function () {\n return true;\n } : filterOption\n });\n\n if (mode === 'tags' && filteredOptions.every(function (opt) {\n return opt[optionFilterProp] !== mergedSearchValue;\n })) {\n filteredOptions.unshift({\n value: mergedSearchValue,\n label: mergedSearchValue,\n key: '__RC_SELECT_TAG_PLACEHOLDER__'\n });\n }\n\n if (filterSort && Array.isArray(filteredOptions)) {\n return _toConsumableArray(filteredOptions).sort(filterSort);\n }\n\n return filteredOptions;\n }, [mergedOptions, mergedSearchValue, mode, mergedShowSearch, filterSort]);\n var displayFlattenOptions = useMemo(function () {\n return flattenOptions(displayOptions, props);\n }, [displayOptions]);\n useEffect(function () {\n if (listRef.current && listRef.current.scrollTo) {\n listRef.current.scrollTo(0);\n }\n }, [mergedSearchValue]); // ============================ Selector ============================\n\n var displayValues = useMemo(function () {\n var tmpValues = mergedRawValue.map(function (val) {\n var valueOptions = getValueOption([val]);\n var displayValue = getLabeledValue(val, {\n options: valueOptions,\n prevValue: mergedValue,\n labelInValue: mergedLabelInValue,\n optionLabelProp: mergedOptionLabelProp\n });\n return _objectSpread(_objectSpread({}, displayValue), {}, {\n disabled: isValueDisabled(val, valueOptions)\n });\n });\n\n if (!mode && tmpValues.length === 1 && tmpValues[0].value === null && tmpValues[0].label === null) {\n return [];\n }\n\n return tmpValues;\n }, [mergedValue, mergedOptions, mode]); // Polyfill with cache label\n\n displayValues = useCacheDisplayValue(displayValues);\n\n var triggerSelect = function triggerSelect(newValue, isSelect, source) {\n var newValueOption = getValueOption([newValue]);\n var outOption = findValueOption([newValue], newValueOption)[0];\n\n if (!internalProps.skipTriggerSelect) {\n // Skip trigger `onSelect` or `onDeselect` if configured\n var selectValue = mergedLabelInValue ? getLabeledValue(newValue, {\n options: newValueOption,\n prevValue: mergedValue,\n labelInValue: mergedLabelInValue,\n optionLabelProp: mergedOptionLabelProp\n }) : newValue;\n\n if (isSelect && onSelect) {\n onSelect(selectValue, outOption);\n } else if (!isSelect && onDeselect) {\n onDeselect(selectValue, outOption);\n }\n } // Trigger internal event\n\n\n if (useInternalProps) {\n if (isSelect && internalProps.onRawSelect) {\n internalProps.onRawSelect(newValue, outOption, source);\n } else if (!isSelect && internalProps.onRawDeselect) {\n internalProps.onRawDeselect(newValue, outOption, source);\n }\n }\n }; // We need cache options here in case user update the option list\n\n\n var _useState7 = useState([]),\n _useState8 = _slicedToArray(_useState7, 2),\n prevValueOptions = _useState8[0],\n setPrevValueOptions = _useState8[1];\n\n var triggerChange = function triggerChange(newRawValues) {\n if (useInternalProps && internalProps.skipTriggerChange) {\n return;\n }\n\n var newRawValuesOptions = getValueOption(newRawValues);\n var outValues = toOuterValues(Array.from(newRawValues), {\n labelInValue: mergedLabelInValue,\n options: newRawValuesOptions,\n getLabeledValue: getLabeledValue,\n prevValue: mergedValue,\n optionLabelProp: mergedOptionLabelProp\n });\n var outValue = isMultiple ? outValues : outValues[0]; // Skip trigger if prev & current value is both empty\n\n if (onChange && (mergedRawValue.length !== 0 || outValues.length !== 0)) {\n var outOptions = findValueOption(newRawValues, newRawValuesOptions, {\n prevValueOptions: prevValueOptions\n }); // We will cache option in case it removed by ajax\n\n setPrevValueOptions(outOptions.map(function (option, index) {\n var clone = _objectSpread({}, option);\n\n Object.defineProperty(clone, '_INTERNAL_OPTION_VALUE_', {\n get: function get() {\n return newRawValues[index];\n }\n });\n return clone;\n }));\n onChange(outValue, isMultiple ? outOptions : outOptions[0]);\n }\n\n setMergedValue(outValue);\n };\n\n var onInternalSelect = function onInternalSelect(newValue, _ref) {\n var selected = _ref.selected,\n source = _ref.source;\n\n if (disabled) {\n return;\n }\n\n var newRawValue;\n\n if (isMultiple) {\n newRawValue = new Set(mergedRawValue);\n\n if (selected) {\n newRawValue.add(newValue);\n } else {\n newRawValue.delete(newValue);\n }\n } else {\n newRawValue = new Set();\n newRawValue.add(newValue);\n } // Multiple always trigger change and single should change if value changed\n\n\n if (isMultiple || !isMultiple && Array.from(mergedRawValue)[0] !== newValue) {\n triggerChange(Array.from(newRawValue));\n } // Trigger `onSelect`. Single mode always trigger select\n\n\n triggerSelect(newValue, !isMultiple || selected, source); // Clean search value if single or configured\n\n if (mode === 'combobox') {\n setInnerSearchValue(String(newValue));\n setActiveValue('');\n } else if (!isMultiple || autoClearSearchValue) {\n setInnerSearchValue('');\n setActiveValue('');\n }\n };\n\n var onInternalOptionSelect = function onInternalOptionSelect(newValue, info) {\n onInternalSelect(newValue, _objectSpread(_objectSpread({}, info), {}, {\n source: 'option'\n }));\n };\n\n var onInternalSelectionSelect = function onInternalSelectionSelect(newValue, info) {\n onInternalSelect(newValue, _objectSpread(_objectSpread({}, info), {}, {\n source: 'selection'\n }));\n }; // ============================= Input ==============================\n // Only works in `combobox`\n\n\n var customizeInputElement = mode === 'combobox' && getInputElement && getInputElement() || null; // ============================== Open ==============================\n\n var _useMergedState3 = useMergedState(undefined, {\n defaultValue: defaultOpen,\n value: open\n }),\n _useMergedState4 = _slicedToArray(_useMergedState3, 2),\n innerOpen = _useMergedState4[0],\n setInnerOpen = _useMergedState4[1];\n\n var mergedOpen = innerOpen; // Not trigger `open` in `combobox` when `notFoundContent` is empty\n\n var emptyListContent = !notFoundContent && !displayOptions.length;\n\n if (disabled || emptyListContent && mergedOpen && mode === 'combobox') {\n mergedOpen = false;\n }\n\n var triggerOpen = emptyListContent ? false : mergedOpen;\n\n var onToggleOpen = function onToggleOpen(newOpen) {\n var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;\n\n if (innerOpen !== nextOpen && !disabled) {\n setInnerOpen(nextOpen);\n\n if (onDropdownVisibleChange) {\n onDropdownVisibleChange(nextOpen);\n }\n }\n };\n\n useSelectTriggerControl([containerRef.current, triggerRef.current && triggerRef.current.getPopupElement()], triggerOpen, onToggleOpen); // ============================= Search =============================\n\n var triggerSearch = function triggerSearch(searchText, fromTyping, isCompositing) {\n var ret = true;\n var newSearchText = searchText;\n setActiveValue(null); // Check if match the `tokenSeparators`\n\n var patchLabels = isCompositing ? null : getSeparatedContent(searchText, tokenSeparators);\n var patchRawValues = patchLabels;\n\n if (mode === 'combobox') {\n // Only typing will trigger onChange\n if (fromTyping) {\n triggerChange([newSearchText]);\n }\n } else if (patchLabels) {\n newSearchText = '';\n\n if (mode !== 'tags') {\n patchRawValues = patchLabels.map(function (label) {\n var item = mergedFlattenOptions.find(function (_ref2) {\n var data = _ref2.data;\n return data[mergedOptionLabelProp] === label;\n });\n return item ? item.data.value : null;\n }).filter(function (val) {\n return val !== null;\n });\n }\n\n var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), _toConsumableArray(patchRawValues))));\n triggerChange(newRawValues);\n newRawValues.forEach(function (newRawValue) {\n triggerSelect(newRawValue, true, 'input');\n }); // Should close when paste finish\n\n onToggleOpen(false); // Tell Selector that break next actions\n\n ret = false;\n }\n\n setInnerSearchValue(newSearchText);\n\n if (onSearch && mergedSearchValue !== newSearchText) {\n onSearch(newSearchText);\n }\n\n return ret;\n }; // Only triggered when menu is closed & mode is tags\n // If menu is open, OptionList will take charge\n // If mode isn't tags, press enter is not meaningful when you can't see any option\n\n\n var onSearchSubmit = function onSearchSubmit(searchText) {\n var newRawValues = Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [searchText])));\n triggerChange(newRawValues);\n newRawValues.forEach(function (newRawValue) {\n triggerSelect(newRawValue, true, 'input');\n });\n setInnerSearchValue('');\n }; // Close dropdown when disabled change\n\n\n useEffect(function () {\n if (innerOpen && !!disabled) {\n setInnerOpen(false);\n }\n }, [disabled]); // Close will clean up single mode search text\n\n useEffect(function () {\n if (!mergedOpen && !isMultiple && mode !== 'combobox') {\n triggerSearch('', false, false);\n }\n }, [mergedOpen]); // ============================ Keyboard ============================\n\n /**\n * We record input value here to check if can press to clean up by backspace\n * - null: Key is not down, this is reset by key up\n * - true: Search text is empty when first time backspace down\n * - false: Search text is not empty when first time backspace down\n */\n\n var _useLock = useLock(),\n _useLock2 = _slicedToArray(_useLock, 2),\n getClearLock = _useLock2[0],\n setClearLock = _useLock2[1]; // KeyDown\n\n\n var onInternalKeyDown = function onInternalKeyDown(event) {\n var clearLock = getClearLock();\n var which = event.which; // We only manage open state here, close logic should handle by list component\n\n if (!mergedOpen && which === KeyCode.ENTER) {\n onToggleOpen(true);\n }\n\n setClearLock(!!mergedSearchValue); // Remove value by `backspace`\n\n if (which === KeyCode.BACKSPACE && !clearLock && isMultiple && !mergedSearchValue && mergedRawValue.length) {\n var removeInfo = removeLastEnabledValue(displayValues, mergedRawValue);\n\n if (removeInfo.removedValue !== null) {\n triggerChange(removeInfo.values);\n triggerSelect(removeInfo.removedValue, false, 'input');\n }\n }\n\n for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n rest[_key - 1] = arguments[_key];\n }\n\n if (mergedOpen && listRef.current) {\n var _listRef$current;\n\n (_listRef$current = listRef.current).onKeyDown.apply(_listRef$current, [event].concat(rest));\n }\n\n if (onKeyDown) {\n onKeyDown.apply(void 0, [event].concat(rest));\n }\n }; // KeyUp\n\n\n var onInternalKeyUp = function onInternalKeyUp(event) {\n for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n rest[_key2 - 1] = arguments[_key2];\n }\n\n if (mergedOpen && listRef.current) {\n var _listRef$current2;\n\n (_listRef$current2 = listRef.current).onKeyUp.apply(_listRef$current2, [event].concat(rest));\n }\n\n if (onKeyUp) {\n onKeyUp.apply(void 0, [event].concat(rest));\n }\n }; // ========================== Focus / Blur ==========================\n\n /** Record real focus status */\n\n\n var focusRef = useRef(false);\n\n var onContainerFocus = function onContainerFocus() {\n setMockFocused(true);\n\n if (!disabled) {\n if (onFocus && !focusRef.current) {\n onFocus.apply(void 0, arguments);\n } // `showAction` should handle `focus` if set\n\n\n if (showAction.includes('focus')) {\n onToggleOpen(true);\n }\n }\n\n focusRef.current = true;\n };\n\n var onContainerBlur = function onContainerBlur() {\n setMockFocused(false, function () {\n focusRef.current = false;\n onToggleOpen(false);\n });\n\n if (disabled) {\n return;\n }\n\n if (mergedSearchValue) {\n // `tags` mode should move `searchValue` into values\n if (mode === 'tags') {\n triggerSearch('', false, false);\n triggerChange(Array.from(new Set([].concat(_toConsumableArray(mergedRawValue), [mergedSearchValue]))));\n } else if (mode === 'multiple') {\n // `multiple` mode only clean the search value but not trigger event\n setInnerSearchValue('');\n }\n }\n\n if (onBlur) {\n onBlur.apply(void 0, arguments);\n }\n };\n\n var activeTimeoutIds = [];\n useEffect(function () {\n return function () {\n activeTimeoutIds.forEach(function (timeoutId) {\n return clearTimeout(timeoutId);\n });\n activeTimeoutIds.splice(0, activeTimeoutIds.length);\n };\n }, []);\n\n var onInternalMouseDown = function onInternalMouseDown(event) {\n var target = event.target;\n var popupElement = triggerRef.current && triggerRef.current.getPopupElement(); // We should give focus back to selector if clicked item is not focusable\n\n if (popupElement && popupElement.contains(target)) {\n var timeoutId = setTimeout(function () {\n var index = activeTimeoutIds.indexOf(timeoutId);\n\n if (index !== -1) {\n activeTimeoutIds.splice(index, 1);\n }\n\n cancelSetMockFocused();\n\n if (!popupElement.contains(document.activeElement)) {\n selectorRef.current.focus();\n }\n });\n activeTimeoutIds.push(timeoutId);\n }\n\n if (onMouseDown) {\n for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n restArgs[_key3 - 1] = arguments[_key3];\n }\n\n onMouseDown.apply(void 0, [event].concat(restArgs));\n }\n }; // ========================= Accessibility ==========================\n\n\n var _useState9 = useState(0),\n _useState10 = _slicedToArray(_useState9, 2),\n accessibilityIndex = _useState10[0],\n setAccessibilityIndex = _useState10[1];\n\n var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';\n\n var onActiveValue = function onActiveValue(active, index) {\n var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},\n _ref3$source = _ref3.source,\n source = _ref3$source === void 0 ? 'keyboard' : _ref3$source;\n\n setAccessibilityIndex(index);\n\n if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {\n setActiveValue(String(active));\n }\n }; // ============================= Popup ==============================\n\n\n var _useState11 = useState(null),\n _useState12 = _slicedToArray(_useState11, 2),\n containerWidth = _useState12[0],\n setContainerWidth = _useState12[1];\n\n var _useState13 = useState({}),\n _useState14 = _slicedToArray(_useState13, 2),\n forceUpdate = _useState14[1]; // We need force update here since popup dom is render async\n\n\n function onPopupMouseEnter() {\n forceUpdate({});\n }\n\n useLayoutEffect(function () {\n if (triggerOpen) {\n var newWidth = Math.ceil(containerRef.current.offsetWidth);\n\n if (containerWidth !== newWidth) {\n setContainerWidth(newWidth);\n }\n }\n }, [triggerOpen]);\n var popupNode = React.createElement(OptionList, {\n ref: listRef,\n prefixCls: prefixCls,\n id: mergedId,\n open: mergedOpen,\n childrenAsData: !options,\n options: displayOptions,\n flattenOptions: displayFlattenOptions,\n multiple: isMultiple,\n values: rawValues,\n height: listHeight,\n itemHeight: listItemHeight,\n onSelect: onInternalOptionSelect,\n onToggleOpen: onToggleOpen,\n onActiveValue: onActiveValue,\n defaultActiveFirstOption: mergedDefaultActiveFirstOption,\n notFoundContent: notFoundContent,\n onScroll: onPopupScroll,\n searchValue: mergedSearchValue,\n menuItemSelectedIcon: menuItemSelectedIcon,\n virtual: virtual !== false && dropdownMatchSelectWidth !== false,\n onMouseEnter: onPopupMouseEnter\n }); // ============================= Clear ==============================\n\n var clearNode;\n\n var onClearMouseDown = function onClearMouseDown() {\n // Trigger internal `onClear` event\n if (useInternalProps && internalProps.onClear) {\n internalProps.onClear();\n }\n\n if (onClear) {\n onClear();\n }\n\n triggerChange([]);\n triggerSearch('', false, false);\n };\n\n if (!disabled && allowClear && (mergedRawValue.length || mergedSearchValue)) {\n clearNode = React.createElement(TransBtn, {\n className: \"\".concat(prefixCls, \"-clear\"),\n onMouseDown: onClearMouseDown,\n customizeIcon: clearIcon\n }, \"\\xD7\");\n } // ============================= Arrow ==============================\n\n\n var mergedShowArrow = showArrow !== undefined ? showArrow : loading || !isMultiple && mode !== 'combobox';\n var arrowNode;\n\n if (mergedShowArrow) {\n arrowNode = React.createElement(TransBtn, {\n className: classNames(\"\".concat(prefixCls, \"-arrow\"), _defineProperty({}, \"\".concat(prefixCls, \"-arrow-loading\"), loading)),\n customizeIcon: inputIcon,\n customizeIconProps: {\n loading: loading,\n searchValue: mergedSearchValue,\n open: mergedOpen,\n focused: mockFocused,\n showSearch: mergedShowSearch\n }\n });\n } // ============================ Warning =============================\n\n\n if (process.env.NODE_ENV !== 'production' && warningProps) {\n warningProps(props);\n } // ============================= Render =============================\n\n\n var mergedClassName = classNames(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, \"\".concat(prefixCls, \"-focused\"), mockFocused), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-multiple\"), isMultiple), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-single\"), !isMultiple), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-allow-clear\"), allowClear), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-show-arrow\"), mergedShowArrow), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-disabled\"), disabled), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-loading\"), loading), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-open\"), mergedOpen), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-customize-input\"), customizeInputElement), _defineProperty(_classNames2, \"\".concat(prefixCls, \"-show-search\"), mergedShowSearch), _classNames2));\n return React.createElement(\"div\", Object.assign({\n className: mergedClassName\n }, domProps, {\n ref: containerRef,\n onMouseDown: onInternalMouseDown,\n onKeyDown: onInternalKeyDown,\n onKeyUp: onInternalKeyUp,\n onFocus: onContainerFocus,\n onBlur: onContainerBlur\n }), mockFocused && !mergedOpen && React.createElement(\"span\", {\n style: {\n width: 0,\n height: 0,\n display: 'flex',\n overflow: 'hidden',\n opacity: 0\n },\n \"aria-live\": \"polite\"\n }, \"\".concat(mergedRawValue.join(', '))), React.createElement(SelectTrigger, {\n ref: triggerRef,\n disabled: disabled,\n prefixCls: prefixCls,\n visible: triggerOpen,\n popupElement: popupNode,\n containerWidth: containerWidth,\n animation: animation,\n transitionName: transitionName,\n dropdownStyle: dropdownStyle,\n dropdownClassName: dropdownClassName,\n direction: direction,\n dropdownMatchSelectWidth: dropdownMatchSelectWidth,\n dropdownRender: dropdownRender,\n dropdownAlign: dropdownAlign,\n getPopupContainer: getPopupContainer,\n empty: !mergedOptions.length,\n getTriggerDOMNode: function getTriggerDOMNode() {\n return selectorDomRef.current;\n }\n }, React.createElement(Selector, Object.assign({}, props, {\n domRef: selectorDomRef,\n prefixCls: prefixCls,\n inputElement: customizeInputElement,\n ref: selectorRef,\n id: mergedId,\n showSearch: mergedShowSearch,\n mode: mode,\n accessibilityIndex: accessibilityIndex,\n multiple: isMultiple,\n tagRender: tagRender,\n values: displayValues,\n open: mergedOpen,\n onToggleOpen: onToggleOpen,\n searchValue: mergedSearchValue,\n activeValue: activeValue,\n onSearch: triggerSearch,\n onSearchSubmit: onSearchSubmit,\n onSelect: onInternalSelectionSelect,\n tokenWithEnter: tokenWithEnter\n }))), arrowNode, clearNode);\n }\n\n var RefSelect = React.forwardRef(Select);\n return RefSelect;\n}"]},"metadata":{},"sourceType":"module"}