@aloudata/aloudata-design 0.4.0-beta.10 → 0.4.0-beta.12
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/Avatar/component/Avatar/index.d.ts +1 -1
- package/es/Avatar/component/Avatar/index.js +12 -16
- package/es/Breadcrumb/index.js +14 -18
- package/es/Button/index.d.ts +2 -2
- package/es/Button/index.js +16 -39
- package/es/Button/style/index.less +1 -1
- package/es/Checkbox/component/CheckboxGroup/index.d.ts +0 -1
- package/es/Checkbox/component/CheckboxGroup/index.js +11 -11
- package/es/Checkbox/index.js +8 -8
- package/es/Checkbox/type.d.ts +1 -1
- package/es/Checkbox/type.js +0 -1
- package/es/ConfigProvider/defaultRenderEmpty.d.ts +2 -2
- package/es/ConfigProvider/defaultRenderEmpty.js +0 -6
- package/es/ConfigProvider/sizeContext.d.ts +2 -2
- package/es/ConfigProvider/sizeContext.js +1 -1
- package/es/Divider/index.js +7 -3
- package/es/Dropdown/Button.d.ts +1 -1
- package/es/Dropdown/Button.js +16 -14
- package/es/Dropdown/index.d.ts +3 -3
- package/es/Dropdown/index.js +10 -10
- package/es/Empty/image/Authority.d.ts +0 -1
- package/es/Empty/image/Authority.js +0 -2
- package/es/Empty/image/Dataspace.d.ts +0 -1
- package/es/Empty/image/Dataspace.js +0 -2
- package/es/Empty/image/Search.d.ts +0 -1
- package/es/Empty/image/Search.js +0 -2
- package/es/Empty/image/Simple.d.ts +0 -1
- package/es/Empty/image/Simple.js +0 -2
- package/es/Empty/image/Worksheet.d.ts +0 -1
- package/es/Empty/image/Worksheet.js +0 -2
- package/es/Empty/image/empty.d.ts +0 -1
- package/es/Empty/image/empty.js +0 -2
- package/es/Empty/index.d.ts +1 -1
- package/es/Empty/index.js +16 -24
- package/es/Icon/components/Icon.js +14 -12
- package/es/Icon/components/createFromScripts.js +2 -8
- package/es/Icon/icons/AddLine.js +17 -23
- package/es/Icon/icons/AlertFill.js +17 -23
- package/es/Icon/icons/ArrowsDownLine.js +17 -23
- package/es/Icon/icons/CancelFill.js +17 -23
- package/es/Icon/icons/CheckFill.js +17 -23
- package/es/Icon/icons/CheckLine.js +17 -23
- package/es/Icon/icons/CloseLine.js +17 -23
- package/es/Icon/icons/DatabaseLine.js +17 -23
- package/es/Icon/icons/Deleteline.js +17 -23
- package/es/Icon/icons/DownloadLine.js +17 -23
- package/es/Icon/icons/ErrorFill.js +17 -23
- package/es/Icon/icons/EyeOffLine.js +17 -23
- package/es/Icon/icons/EyeOnLine.js +17 -23
- package/es/Icon/icons/FileLine.js +17 -23
- package/es/Icon/icons/HomeFill.js +17 -23
- package/es/Icon/icons/LightningLine.js +17 -23
- package/es/Icon/icons/Loading.js +17 -23
- package/es/Icon/icons/More.js +17 -23
- package/es/Icon/icons/NewWindowsLine.js +17 -23
- package/es/Icon/icons/SearchLine.js +17 -23
- package/es/Icon/icons/SortAscendingLine.js +17 -23
- package/es/Icon/icons/SortDescendingLine.js +17 -23
- package/es/Icon/icons/TextLine.js +17 -23
- package/es/Icon/icons/UserLine.js +17 -23
- package/es/Icon/icons.js +1658 -1588
- package/es/Input/components/Group/index.js +11 -9
- package/es/Input/components/Input/index.d.ts +2 -2
- package/es/Input/components/Input/index.js +10 -9
- package/es/Input/components/Password/index.js +14 -12
- package/es/Input/components/TextArea/index.js +13 -11
- package/es/InputNumber/index.js +10 -12
- package/es/Menu/Divider.js +7 -1
- package/es/Menu/MenuItem.js +7 -1
- package/es/Menu/SubMenu.js +8 -6
- package/es/Menu/index.d.ts +1 -1
- package/es/Menu/index.js +8 -6
- package/es/Modal/index.d.ts +1 -1
- package/es/Modal/index.js +18 -28
- package/es/Modal/locale.js +4 -6
- package/es/Modal/style/index.less +6 -1
- package/es/Navigator/components/Header/index.js +0 -2
- package/es/Navigator/components/Menu/index.js +14 -18
- package/es/Navigator/components/MenuItem/index.js +6 -9
- package/es/Navigator/index.js +5 -7
- package/es/Popconfirm/index.d.ts +89 -2
- package/es/Popconfirm/index.js +105 -1
- package/es/Popconfirm/style/index.less +58 -0
- package/es/Popover/index.js +9 -9
- package/es/Radio/components/Group/index.d.ts +1 -1
- package/es/Radio/components/Group/index.js +23 -32
- package/es/Radio/components/Radio/index.js +10 -19
- package/es/Radio/interface/radioGroup.d.ts +3 -3
- package/es/Select/index.d.ts +4 -4
- package/es/Select/index.js +53 -70
- package/es/Select/rc-select/BaseSelect.d.ts +7 -7
- package/es/Select/rc-select/BaseSelect.js +155 -245
- package/es/Select/rc-select/OptGroup.js +0 -1
- package/es/Select/rc-select/Option.js +0 -1
- package/es/Select/rc-select/OptionList.d.ts +2 -2
- package/es/Select/rc-select/OptionList.js +76 -128
- package/es/Select/rc-select/Select.d.ts +8 -8
- package/es/Select/rc-select/Select.js +137 -205
- package/es/Select/rc-select/SelectTrigger.js +30 -42
- package/es/Select/rc-select/Selector/Input.d.ts +1 -1
- package/es/Select/rc-select/Selector/Input.js +29 -37
- package/es/Select/rc-select/Selector/MultipleSelector.js +72 -97
- package/es/Select/rc-select/Selector/SingleSelector.js +28 -43
- package/es/Select/rc-select/Selector/index.js +33 -58
- package/es/Select/rc-select/TransBtn.js +5 -10
- package/es/Select/rc-select/hooks/useBaseProps.js +0 -1
- package/es/Select/rc-select/hooks/useCache.d.ts +1 -1
- package/es/Select/rc-select/hooks/useCache.js +9 -12
- package/es/Select/rc-select/hooks/useDelayReset.js +4 -18
- package/es/Select/rc-select/hooks/useFilterOptions.d.ts +1 -1
- package/es/Select/rc-select/hooks/useFilterOptions.js +8 -17
- package/es/Select/rc-select/hooks/useId.js +6 -17
- package/es/Select/rc-select/hooks/useLayoutEffect.js +0 -1
- package/es/Select/rc-select/hooks/useLock.js +2 -6
- package/es/Select/rc-select/hooks/useOptions.d.ts +2 -2
- package/es/Select/rc-select/hooks/useOptions.js +2 -10
- package/es/Select/rc-select/hooks/useRefFunc.js +0 -1
- package/es/Select/rc-select/hooks/useSelectTriggerControl.js +0 -5
- package/es/Select/rc-select/utils/commonUtil.js +0 -2
- package/es/Select/rc-select/utils/keyUtil.js +4 -3
- package/es/Select/rc-select/utils/legacyUtil.js +13 -22
- package/es/Select/rc-select/utils/valueUtil.js +18 -50
- package/es/Select/rc-select/utils/warningPropsUtil.js +30 -47
- package/es/Select/style/index.js +2 -1
- package/es/Select/style/status.less +3 -1
- package/es/Select/utils/iconUtil.d.ts +3 -3
- package/es/Select/utils/iconUtil.js +16 -26
- package/es/Space/index.js +1 -1
- package/es/Spin/index.d.ts +2 -2
- package/es/Steps/components/Step/index.d.ts +1 -1
- package/es/Steps/components/Step/index.js +9 -8
- package/es/Steps/index.d.ts +8 -2
- package/es/Steps/index.js +64 -10
- package/es/Steps/style/index.less +11 -12
- package/es/Switch/index.js +17 -30
- package/es/Table/Table.js +115 -191
- package/es/Table/components/Empty/index.js +0 -2
- package/es/Table/components/Loading/index.js +0 -2
- package/es/Table/components/TableBodyRowList/index.js +20 -39
- package/es/Table/components/TableHead/index.js +57 -94
- package/es/Table/interface.d.ts +1 -1
- package/es/Table/style/index.less +8 -4
- package/es/Table/utils.js +8 -29
- package/es/Tabs/index.d.ts +22 -7
- package/es/Tabs/index.js +12 -19
- package/es/Tooltip/index.d.ts +1 -1
- package/es/Tooltip/index.js +12 -12
- package/es/_utils/hooks/useControlledState.d.ts +1 -1
- package/es/_utils/hooks/useControlledState.js +8 -21
- package/es/_utils/hooks/useId.js +2 -6
- package/es/_utils/hooks/usePrefixCls.d.ts +1 -1
- package/es/_utils/hooks/usePrefixCls.js +2 -5
- package/es/index.d.ts +1 -1
- package/es/locale-provider/context.d.ts +1 -1
- package/es/locale-provider/index.js +10 -32
- package/lib/Alert/index.js +0 -4
- package/lib/Alert/style/index.js +0 -1
- package/lib/Avatar/component/Avatar/index.d.ts +1 -1
- package/lib/Avatar/component/Avatar/index.js +11 -24
- package/lib/Avatar/index.js +0 -4
- package/lib/Avatar/style/index.js +0 -1
- package/lib/Breadcrumb/index.js +14 -23
- package/lib/Breadcrumb/style/index.js +0 -1
- package/lib/Button/index.d.ts +2 -2
- package/lib/Button/index.js +16 -47
- package/lib/Button/style/index.js +0 -1
- package/lib/Button/style/index.less +1 -1
- package/lib/Card/index.js +0 -4
- package/lib/Card/style/index.js +0 -1
- package/lib/Checkbox/component/CheckboxGroup/index.d.ts +0 -1
- package/lib/Checkbox/component/CheckboxGroup/index.js +9 -16
- package/lib/Checkbox/index.js +8 -14
- package/lib/Checkbox/style/index.js +0 -1
- package/lib/Checkbox/type.d.ts +1 -1
- package/lib/Checkbox/type.js +0 -1
- package/lib/Col/index.js +0 -4
- package/lib/Col/style/index.js +0 -1
- package/lib/ConfigProvider/defaultRenderEmpty.d.ts +2 -2
- package/lib/ConfigProvider/defaultRenderEmpty.js +0 -13
- package/lib/ConfigProvider/index.js +0 -5
- package/lib/ConfigProvider/sizeContext.d.ts +2 -2
- package/lib/ConfigProvider/sizeContext.js +1 -8
- package/lib/ConfigProvider/style/index.js +0 -1
- package/lib/DatePicker/index.js +0 -4
- package/lib/DatePicker/style/index.js +0 -1
- package/lib/Divider/index.js +7 -8
- package/lib/Divider/style/index.js +0 -1
- package/lib/Drawer/index.js +0 -4
- package/lib/Drawer/style/index.js +0 -1
- package/lib/Dropdown/Button.d.ts +1 -1
- package/lib/Dropdown/Button.js +14 -20
- package/lib/Dropdown/index.d.ts +3 -3
- package/lib/Dropdown/index.js +10 -17
- package/lib/Dropdown/style/index.js +0 -2
- package/lib/Empty/image/Authority.d.ts +0 -1
- package/lib/Empty/image/Authority.js +0 -6
- package/lib/Empty/image/Dataspace.d.ts +0 -1
- package/lib/Empty/image/Dataspace.js +0 -6
- package/lib/Empty/image/Search.d.ts +0 -1
- package/lib/Empty/image/Search.js +0 -6
- package/lib/Empty/image/Simple.d.ts +0 -1
- package/lib/Empty/image/Simple.js +0 -6
- package/lib/Empty/image/Worksheet.d.ts +0 -1
- package/lib/Empty/image/Worksheet.js +0 -6
- package/lib/Empty/image/empty.d.ts +0 -1
- package/lib/Empty/image/empty.js +0 -6
- package/lib/Empty/index.d.ts +1 -1
- package/lib/Empty/index.js +15 -37
- package/lib/Form/index.js +0 -4
- package/lib/Form/style/index.js +0 -1
- package/lib/Icon/antdIconfont.js +0 -1
- package/lib/Icon/components/Icon.js +14 -16
- package/lib/Icon/components/createFromScripts.js +2 -8
- package/lib/Icon/icons/AddLine.js +16 -30
- package/lib/Icon/icons/AlertFill.js +16 -30
- package/lib/Icon/icons/ArrowsDownLine.js +16 -30
- package/lib/Icon/icons/CancelFill.js +16 -30
- package/lib/Icon/icons/CheckFill.js +16 -30
- package/lib/Icon/icons/CheckLine.js +16 -30
- package/lib/Icon/icons/CloseLine.js +16 -30
- package/lib/Icon/icons/DatabaseLine.js +16 -30
- package/lib/Icon/icons/Deleteline.js +16 -30
- package/lib/Icon/icons/DownloadLine.js +16 -30
- package/lib/Icon/icons/ErrorFill.js +16 -30
- package/lib/Icon/icons/EyeOffLine.js +16 -30
- package/lib/Icon/icons/EyeOnLine.js +16 -30
- package/lib/Icon/icons/FileLine.js +16 -30
- package/lib/Icon/icons/HomeFill.js +16 -30
- package/lib/Icon/icons/LightningLine.js +16 -30
- package/lib/Icon/icons/Loading.js +16 -30
- package/lib/Icon/icons/More.js +16 -30
- package/lib/Icon/icons/NewWindowsLine.js +16 -30
- package/lib/Icon/icons/SearchLine.js +16 -30
- package/lib/Icon/icons/SortAscendingLine.js +16 -30
- package/lib/Icon/icons/SortDescendingLine.js +16 -30
- package/lib/Icon/icons/TextLine.js +16 -30
- package/lib/Icon/icons/UserLine.js +16 -30
- package/lib/Icon/icons.js +1658 -1588
- package/lib/Icon/index.js +0 -3
- package/lib/Input/components/Group/index.js +11 -16
- package/lib/Input/components/Input/index.d.ts +2 -2
- package/lib/Input/components/Input/index.js +10 -16
- package/lib/Input/components/Password/index.js +12 -21
- package/lib/Input/components/TextArea/index.js +13 -18
- package/lib/Input/index.js +0 -6
- package/lib/Input/style/index.js +0 -2
- package/lib/InputNumber/index.js +10 -18
- package/lib/InputNumber/style/index.js +0 -1
- package/lib/Layout/index.js +0 -4
- package/lib/Layout/style/index.js +0 -1
- package/lib/Menu/Divider.js +7 -7
- package/lib/Menu/MenuItem.js +7 -7
- package/lib/Menu/SubMenu.js +8 -13
- package/lib/Menu/index.d.ts +1 -1
- package/lib/Menu/index.js +8 -16
- package/lib/Menu/style/index.js +0 -2
- package/lib/Modal/index.d.ts +1 -1
- package/lib/Modal/index.js +17 -45
- package/lib/Modal/locale.js +4 -9
- package/lib/Modal/style/index.js +0 -1
- package/lib/Modal/style/index.less +6 -1
- package/lib/Navigator/components/Header/index.js +0 -4
- package/lib/Navigator/components/Menu/index.js +13 -24
- package/lib/Navigator/components/MenuItem/index.js +6 -15
- package/lib/Navigator/index.js +5 -15
- package/lib/Navigator/style/index.js +0 -1
- package/lib/PageHeader/index.js +0 -4
- package/lib/PageHeader/style/index.js +0 -1
- package/lib/Popconfirm/index.d.ts +89 -2
- package/lib/Popconfirm/index.js +106 -5
- package/lib/Popconfirm/style/index.js +0 -1
- package/lib/Popconfirm/style/index.less +58 -0
- package/lib/Popover/index.js +9 -14
- package/lib/Popover/style/index.js +0 -1
- package/lib/Progress/index.js +0 -3
- package/lib/Progress/style/index.js +0 -1
- package/lib/Radio/components/Group/index.d.ts +1 -1
- package/lib/Radio/components/Group/index.js +22 -41
- package/lib/Radio/components/Radio/index.js +10 -30
- package/lib/Radio/index.js +0 -4
- package/lib/Radio/interface/radioGroup.d.ts +3 -3
- package/lib/Radio/style/index.js +0 -1
- package/lib/Row/index.js +0 -4
- package/lib/Row/style/index.js +0 -1
- package/lib/Select/index.d.ts +4 -4
- package/lib/Select/index.js +52 -87
- package/lib/Select/rc-select/BaseSelect.d.ts +7 -7
- package/lib/Select/rc-select/BaseSelect.js +155 -266
- package/lib/Select/rc-select/OptGroup.js +0 -2
- package/lib/Select/rc-select/Option.js +0 -2
- package/lib/Select/rc-select/OptionList.d.ts +2 -2
- package/lib/Select/rc-select/OptionList.js +75 -146
- package/lib/Select/rc-select/Select.d.ts +8 -8
- package/lib/Select/rc-select/Select.js +137 -224
- package/lib/Select/rc-select/SelectContext.js +1 -5
- package/lib/Select/rc-select/SelectTrigger.js +29 -49
- package/lib/Select/rc-select/Selector/Input.d.ts +1 -1
- package/lib/Select/rc-select/Selector/Input.js +29 -46
- package/lib/Select/rc-select/Selector/MultipleSelector.js +71 -109
- package/lib/Select/rc-select/Selector/SingleSelector.js +28 -50
- package/lib/Select/rc-select/Selector/index.js +32 -67
- package/lib/Select/rc-select/TransBtn.js +5 -16
- package/lib/Select/rc-select/hooks/useBaseProps.js +1 -7
- package/lib/Select/rc-select/hooks/useCache.d.ts +1 -1
- package/lib/Select/rc-select/hooks/useCache.js +9 -18
- package/lib/Select/rc-select/hooks/useDelayReset.js +4 -22
- package/lib/Select/rc-select/hooks/useFilterOptions.d.ts +1 -1
- package/lib/Select/rc-select/hooks/useFilterOptions.js +8 -25
- package/lib/Select/rc-select/hooks/useId.js +6 -26
- package/lib/Select/rc-select/hooks/useLayoutEffect.js +0 -6
- package/lib/Select/rc-select/hooks/useLock.js +2 -10
- package/lib/Select/rc-select/hooks/useOptions.d.ts +2 -2
- package/lib/Select/rc-select/hooks/useOptions.js +2 -15
- package/lib/Select/rc-select/hooks/useRefFunc.js +0 -5
- package/lib/Select/rc-select/hooks/useSelectTriggerControl.js +1 -10
- package/lib/Select/rc-select/index.js +0 -7
- package/lib/Select/rc-select/utils/commonUtil.js +0 -4
- package/lib/Select/rc-select/utils/keyUtil.js +4 -5
- package/lib/Select/rc-select/utils/legacyUtil.js +12 -28
- package/lib/Select/rc-select/utils/platformUtil.js +0 -1
- package/lib/Select/rc-select/utils/valueUtil.js +18 -55
- package/lib/Select/rc-select/utils/warningPropsUtil.js +30 -56
- package/lib/Select/style/index.js +0 -2
- package/lib/Select/style/status.less +3 -1
- package/lib/Select/utils/iconUtil.d.ts +3 -3
- package/lib/Select/utils/iconUtil.js +16 -39
- package/lib/Skeleton/index.js +0 -3
- package/lib/Skeleton/style/index.js +0 -1
- package/lib/Space/index.js +2 -9
- package/lib/Space/style/index.js +0 -1
- package/lib/Spin/index.d.ts +2 -2
- package/lib/Spin/index.js +0 -3
- package/lib/Spin/style/index.js +0 -1
- package/lib/Steps/components/ProcessIcon/index.js +0 -4
- package/lib/Steps/components/Step/index.d.ts +1 -1
- package/lib/Steps/components/Step/index.js +9 -18
- package/lib/Steps/index.d.ts +8 -2
- package/lib/Steps/index.js +63 -17
- package/lib/Steps/style/index.js +0 -1
- package/lib/Steps/style/index.less +11 -12
- package/lib/Switch/index.js +17 -37
- package/lib/Switch/style/index.js +0 -1
- package/lib/Table/Table.js +117 -216
- package/lib/Table/components/Empty/index.js +0 -6
- package/lib/Table/components/Loading/index.js +0 -7
- package/lib/Table/components/TableBodyRowList/index.js +19 -47
- package/lib/Table/components/TableHead/index.js +56 -108
- package/lib/Table/index.js +0 -3
- package/lib/Table/interface.d.ts +1 -1
- package/lib/Table/style/index.js +0 -1
- package/lib/Table/style/index.less +8 -4
- package/lib/Table/utils.js +8 -33
- package/lib/Tabs/index.d.ts +22 -7
- package/lib/Tabs/index.js +10 -28
- package/lib/Tabs/style/index.js +0 -2
- package/lib/Tooltip/index.d.ts +1 -1
- package/lib/Tooltip/index.js +12 -17
- package/lib/Tooltip/style/index.js +0 -1
- package/lib/Tree/index.js +0 -3
- package/lib/Tree/style/index.js +0 -1
- package/lib/Typography/index.js +0 -4
- package/lib/Typography/style/index.js +0 -1
- package/lib/Upload/index.js +0 -4
- package/lib/Upload/style/index.js +0 -1
- package/lib/_utils/hooks/useControlledState.d.ts +1 -1
- package/lib/_utils/hooks/useControlledState.js +8 -23
- package/lib/_utils/hooks/useId.js +3 -10
- package/lib/_utils/hooks/usePrefixCls.d.ts +1 -1
- package/lib/_utils/hooks/usePrefixCls.js +2 -10
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -42
- package/lib/locale/default.js +0 -3
- package/lib/locale/en_US.js +1 -6
- package/lib/locale/zh_CN.js +1 -6
- package/lib/locale-provider/LocaleReceiver.js +0 -5
- package/lib/locale-provider/context.d.ts +1 -1
- package/lib/locale-provider/context.js +0 -2
- package/lib/locale-provider/default.js +0 -3
- package/lib/locale-provider/en_US.js +0 -3
- package/lib/locale-provider/index.js +8 -37
- package/lib/locale-provider/zh_CN.js +0 -3
- package/lib/message/index.js +0 -4
- package/lib/message/style/index.js +0 -1
- package/lib/notification/index.js +0 -4
- package/lib/notification/style/index.js +0 -1
- package/package.json +4 -3
- package/es/Table/hooks/useFrame.d.ts +0 -7
- package/es/Table/hooks/useFrame.js +0 -90
- package/es/Tabs/TabPane.d.ts +0 -21
- package/es/Tabs/TabPane.js +0 -6
- package/lib/Table/hooks/useFrame.d.ts +0 -7
- package/lib/Table/hooks/useFrame.js +0 -98
- package/lib/Tabs/TabPane.d.ts +0 -21
- package/lib/Tabs/TabPane.js +0 -18
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
var _excluded = ["id", "mode", "prefixCls", "backfill", "fieldNames", "inputValue", "searchValue", "onSearch", "autoClearSearchValue", "onSelect", "onDeselect", "dropdownMatchSelectWidth", "filterOption", "filterSort", "optionFilterProp", "optionLabelProp", "options", "children", "defaultActiveFirstOption", "menuItemSelectedIcon", "virtual", "listHeight", "listItemHeight", "value", "defaultValue", "labelInValue", "onChange"];
|
|
2
|
-
|
|
3
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
-
|
|
5
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
|
|
7
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
|
|
9
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
|
|
11
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
-
|
|
13
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
|
|
15
|
-
function
|
|
16
|
-
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
17
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
-
|
|
19
12
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
-
|
|
21
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
|
|
23
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
-
|
|
25
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
26
|
-
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
27
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
-
|
|
29
17
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
30
|
-
|
|
31
18
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
|
-
|
|
33
19
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
34
|
-
|
|
35
20
|
// @ts-nocheck
|
|
36
|
-
|
|
37
21
|
/**
|
|
38
22
|
* To match accessibility requirement, we always provide an input in the component.
|
|
39
23
|
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
|
@@ -81,46 +65,43 @@ import { toArray } from './utils/commonUtil';
|
|
|
81
65
|
import useFilterOptions from './hooks/useFilterOptions';
|
|
82
66
|
import useCache from './hooks/useCache';
|
|
83
67
|
var OMIT_DOM_PROPS = ['inputValue'];
|
|
84
|
-
|
|
85
68
|
function isRawValue(value) {
|
|
86
69
|
return !value || _typeof(value) !== 'object';
|
|
87
70
|
}
|
|
88
|
-
|
|
89
71
|
var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
90
72
|
var id = props.id,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
73
|
+
mode = props.mode,
|
|
74
|
+
_props$prefixCls = props.prefixCls,
|
|
75
|
+
prefixCls = _props$prefixCls === void 0 ? 'rc-select' : _props$prefixCls,
|
|
76
|
+
backfill = props.backfill,
|
|
77
|
+
fieldNames = props.fieldNames,
|
|
78
|
+
inputValue = props.inputValue,
|
|
79
|
+
searchValue = props.searchValue,
|
|
80
|
+
onSearch = props.onSearch,
|
|
81
|
+
_props$autoClearSearc = props.autoClearSearchValue,
|
|
82
|
+
autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
|
|
83
|
+
onSelect = props.onSelect,
|
|
84
|
+
onDeselect = props.onDeselect,
|
|
85
|
+
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
|
86
|
+
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
|
|
87
|
+
filterOption = props.filterOption,
|
|
88
|
+
filterSort = props.filterSort,
|
|
89
|
+
optionFilterProp = props.optionFilterProp,
|
|
90
|
+
optionLabelProp = props.optionLabelProp,
|
|
91
|
+
options = props.options,
|
|
92
|
+
children = props.children,
|
|
93
|
+
defaultActiveFirstOption = props.defaultActiveFirstOption,
|
|
94
|
+
menuItemSelectedIcon = props.menuItemSelectedIcon,
|
|
95
|
+
virtual = props.virtual,
|
|
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
|
+
value = props.value,
|
|
101
|
+
defaultValue = props.defaultValue,
|
|
102
|
+
labelInValue = props.labelInValue,
|
|
103
|
+
onChange = props.onChange,
|
|
104
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
124
105
|
var mergedId = useId(id);
|
|
125
106
|
var multiple = isMultiple(mode);
|
|
126
107
|
var childrenAsData = !!(!options && children);
|
|
@@ -128,72 +109,64 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
128
109
|
if (filterOption === undefined && mode === 'combobox') {
|
|
129
110
|
return false;
|
|
130
111
|
}
|
|
131
|
-
|
|
132
112
|
return filterOption;
|
|
133
|
-
}, [filterOption, mode]);
|
|
134
|
-
|
|
113
|
+
}, [filterOption, mode]);
|
|
114
|
+
// ========================= FieldNames =========================
|
|
135
115
|
var mergedFieldNames = React.useMemo(function () {
|
|
136
116
|
return fillFieldNames(fieldNames, childrenAsData);
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
JSON.stringify(fieldNames), childrenAsData]);
|
|
141
|
-
|
|
117
|
+
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
118
|
+
[
|
|
119
|
+
// We stringify fieldNames to avoid unnecessary re-renders.
|
|
120
|
+
JSON.stringify(fieldNames), childrenAsData]);
|
|
121
|
+
// =========================== Search ===========================
|
|
142
122
|
var _useMergedState = useMergedState('', {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
123
|
+
value: searchValue !== undefined ? searchValue : inputValue,
|
|
124
|
+
postState: function postState(search) {
|
|
125
|
+
return search || '';
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
129
|
+
mergedSearchValue = _useMergedState2[0],
|
|
130
|
+
setSearchValue = _useMergedState2[1];
|
|
131
|
+
// =========================== Option ===========================
|
|
153
132
|
var parsedOptions = useOptions(options, children, mergedFieldNames, optionFilterProp, optionLabelProp);
|
|
154
133
|
var valueOptions = parsedOptions.valueOptions,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
134
|
+
labelOptions = parsedOptions.labelOptions,
|
|
135
|
+
mergedOptions = parsedOptions.options;
|
|
136
|
+
// ========================= Wrap Value =========================
|
|
158
137
|
var convert2LabelValues = React.useCallback(function (draftValues) {
|
|
159
138
|
// Convert to array
|
|
160
|
-
var valueList = toArray(draftValues);
|
|
161
|
-
|
|
139
|
+
var valueList = toArray(draftValues);
|
|
140
|
+
// Convert to labelInValue type
|
|
162
141
|
return valueList.map(function (val) {
|
|
163
142
|
var rawValue;
|
|
164
143
|
var rawLabel;
|
|
165
144
|
var rawKey;
|
|
166
|
-
var rawDisabled;
|
|
167
|
-
|
|
145
|
+
var rawDisabled;
|
|
146
|
+
// Fill label & value
|
|
168
147
|
if (isRawValue(val)) {
|
|
169
148
|
rawValue = val;
|
|
170
149
|
} else {
|
|
171
150
|
var _val$value;
|
|
172
|
-
|
|
173
151
|
rawKey = val.key;
|
|
174
152
|
rawLabel = val.label;
|
|
175
153
|
rawValue = (_val$value = val.value) !== null && _val$value !== void 0 ? _val$value : rawKey;
|
|
176
154
|
}
|
|
177
|
-
|
|
178
155
|
var option = valueOptions.get(rawValue);
|
|
179
|
-
|
|
180
156
|
if (option) {
|
|
181
157
|
var _option$key;
|
|
182
|
-
|
|
183
158
|
// Fill missing props
|
|
184
159
|
if (rawLabel === undefined) rawLabel = option === null || option === void 0 ? void 0 : option[optionLabelProp || mergedFieldNames.label];
|
|
185
160
|
if (rawKey === undefined) rawKey = (_option$key = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key !== void 0 ? _option$key : rawValue;
|
|
186
|
-
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
|
|
187
|
-
|
|
161
|
+
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
|
|
162
|
+
// Warning if label not same as provided
|
|
188
163
|
if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {
|
|
189
164
|
var optionLabel = option === null || option === void 0 ? void 0 : option[mergedFieldNames.label];
|
|
190
|
-
|
|
191
165
|
if (optionLabel !== undefined && optionLabel !== rawLabel) {
|
|
192
166
|
warning(false, '`label` of `value` is not same as `label` in Select options.');
|
|
193
167
|
}
|
|
194
168
|
}
|
|
195
169
|
}
|
|
196
|
-
|
|
197
170
|
return {
|
|
198
171
|
label: rawLabel,
|
|
199
172
|
value: rawValue,
|
|
@@ -201,54 +174,46 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
201
174
|
disabled: rawDisabled
|
|
202
175
|
};
|
|
203
176
|
});
|
|
204
|
-
}, [mergedFieldNames, optionLabelProp, valueOptions]);
|
|
205
|
-
|
|
177
|
+
}, [mergedFieldNames, optionLabelProp, valueOptions]);
|
|
178
|
+
// =========================== Values ===========================
|
|
206
179
|
var _useMergedState3 = useMergedState(defaultValue, {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
180
|
+
value: value
|
|
181
|
+
}),
|
|
182
|
+
_useMergedState4 = _slicedToArray(_useMergedState3, 2),
|
|
183
|
+
internalValue = _useMergedState4[0],
|
|
184
|
+
setInternalValue = _useMergedState4[1];
|
|
185
|
+
// Merged value with LabelValueType
|
|
214
186
|
var rawLabeledValues = React.useMemo(function () {
|
|
215
187
|
var _values$;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
188
|
+
var values = convert2LabelValues(internalValue);
|
|
189
|
+
// combobox no need save value when it's empty
|
|
219
190
|
if (mode === 'combobox' && !((_values$ = values[0]) === null || _values$ === void 0 ? void 0 : _values$.value)) {
|
|
220
191
|
return [];
|
|
221
192
|
}
|
|
222
|
-
|
|
223
193
|
return values;
|
|
224
|
-
}, [internalValue, convert2LabelValues, mode]);
|
|
225
|
-
|
|
194
|
+
}, [internalValue, convert2LabelValues, mode]);
|
|
195
|
+
// Fill label with cache to avoid option remove
|
|
226
196
|
var _useCache = useCache(rawLabeledValues, valueOptions),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
197
|
+
_useCache2 = _slicedToArray(_useCache, 2),
|
|
198
|
+
mergedValues = _useCache2[0],
|
|
199
|
+
getMixedOption = _useCache2[1];
|
|
231
200
|
var displayValues = React.useMemo(function () {
|
|
232
201
|
// `null` need show as placeholder instead
|
|
233
202
|
// https://github.com/ant-design/ant-design/issues/25057
|
|
234
203
|
if (!mode && mergedValues.length === 1) {
|
|
235
204
|
var firstValue = mergedValues[0];
|
|
236
|
-
|
|
237
205
|
if (firstValue.value === null && (firstValue.label === null || firstValue.label === undefined)) {
|
|
238
206
|
return [];
|
|
239
207
|
}
|
|
240
208
|
}
|
|
241
|
-
|
|
242
209
|
return mergedValues.map(function (item) {
|
|
243
210
|
var _item$label;
|
|
244
|
-
|
|
245
211
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
246
212
|
label: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.value
|
|
247
213
|
});
|
|
248
214
|
});
|
|
249
215
|
}, [mode, mergedValues]);
|
|
250
216
|
/** Convert `displayValues` to raw value type set */
|
|
251
|
-
|
|
252
217
|
var rawValues = React.useMemo(function () {
|
|
253
218
|
return new Set(mergedValues.map(function (val) {
|
|
254
219
|
return val.value;
|
|
@@ -257,66 +222,56 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
257
222
|
React.useEffect(function () {
|
|
258
223
|
if (mode === 'combobox') {
|
|
259
224
|
var _mergedValues$;
|
|
260
|
-
|
|
261
225
|
var strValue = (_mergedValues$ = mergedValues[0]) === null || _mergedValues$ === void 0 ? void 0 : _mergedValues$.value;
|
|
262
|
-
|
|
263
226
|
if (strValue !== undefined && strValue !== null) {
|
|
264
227
|
setSearchValue(String(strValue));
|
|
265
228
|
}
|
|
266
229
|
}
|
|
267
|
-
}, [mergedValues]);
|
|
230
|
+
}, [mergedValues]);
|
|
231
|
+
// ======================= Display Option =======================
|
|
268
232
|
// Create a placeholder item if not exist in `options`
|
|
269
|
-
|
|
270
233
|
var createTagOption = useRefFunc(function (val, label) {
|
|
271
234
|
var _ref;
|
|
272
|
-
|
|
273
235
|
var mergedLabel = label !== null && label !== void 0 ? label : val;
|
|
274
236
|
return _ref = {}, _defineProperty(_ref, mergedFieldNames.value, val), _defineProperty(_ref, mergedFieldNames.label, mergedLabel), _ref;
|
|
275
|
-
});
|
|
276
|
-
|
|
237
|
+
});
|
|
238
|
+
// Fill tag as option if mode is `tags`
|
|
277
239
|
var filledTagOptions = React.useMemo(function () {
|
|
278
240
|
if (mode !== 'tags') {
|
|
279
241
|
return mergedOptions;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
242
|
+
}
|
|
243
|
+
// >>> Tag mode
|
|
244
|
+
var cloneOptions = _toConsumableArray(mergedOptions);
|
|
245
|
+
// Check if value exist in options (include new patch item)
|
|
286
246
|
var existOptions = function existOptions(val) {
|
|
287
247
|
return valueOptions.has(val);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
|
|
248
|
+
};
|
|
249
|
+
// Fill current value as option
|
|
291
250
|
_toConsumableArray(mergedValues).sort(function (a, b) {
|
|
292
251
|
return a.value < b.value ? -1 : 1;
|
|
293
252
|
}).forEach(function (item) {
|
|
294
253
|
var val = item.value;
|
|
295
|
-
|
|
296
254
|
if (!existOptions(val)) {
|
|
297
255
|
cloneOptions.push(createTagOption(val, item.label));
|
|
298
256
|
}
|
|
299
257
|
});
|
|
300
|
-
|
|
301
258
|
return cloneOptions;
|
|
302
259
|
}, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);
|
|
303
|
-
var filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
|
|
304
|
-
|
|
260
|
+
var filteredOptions = useFilterOptions(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
|
|
261
|
+
// Fill options with search value if needed
|
|
305
262
|
var filledSearchOptions = React.useMemo(function () {
|
|
306
263
|
if (mode !== 'tags' || !mergedSearchValue || filteredOptions.some(function (item) {
|
|
307
264
|
return item[optionFilterProp || 'value'] === mergedSearchValue;
|
|
308
265
|
})) {
|
|
309
266
|
return filteredOptions;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
267
|
+
}
|
|
268
|
+
// Fill search value as option
|
|
313
269
|
return [createTagOption(mergedSearchValue)].concat(_toConsumableArray(filteredOptions));
|
|
314
270
|
}, [createTagOption, optionFilterProp, mode, filteredOptions, mergedSearchValue]);
|
|
315
271
|
var orderedFilteredOptions = React.useMemo(function () {
|
|
316
272
|
if (!filterSort) {
|
|
317
273
|
return filledSearchOptions;
|
|
318
274
|
}
|
|
319
|
-
|
|
320
275
|
return _toConsumableArray(filledSearchOptions).sort(function (a, b) {
|
|
321
276
|
return filterSort(a, b);
|
|
322
277
|
});
|
|
@@ -326,16 +281,15 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
326
281
|
fieldNames: mergedFieldNames,
|
|
327
282
|
childrenAsData: childrenAsData
|
|
328
283
|
});
|
|
329
|
-
}, [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
|
|
330
|
-
|
|
284
|
+
}, [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
|
|
285
|
+
// =========================== Change ===========================
|
|
331
286
|
var triggerChange = function triggerChange(values) {
|
|
332
287
|
var labeledValues = convert2LabelValues(values);
|
|
333
288
|
setInternalValue(labeledValues);
|
|
334
|
-
|
|
335
|
-
|
|
289
|
+
if (onChange && (
|
|
290
|
+
// Trigger event only when value changed
|
|
336
291
|
labeledValues.length !== mergedValues.length || labeledValues.some(function (newVal, index) {
|
|
337
292
|
var _mergedValues$index;
|
|
338
|
-
|
|
339
293
|
return ((_mergedValues$index = mergedValues[index]) === null || _mergedValues$index === void 0 ? void 0 : _mergedValues$index.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
|
|
340
294
|
}))) {
|
|
341
295
|
var returnValues = labelInValue ? labeledValues : labeledValues.map(function (v) {
|
|
@@ -344,40 +298,36 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
344
298
|
var returnOptions = labeledValues.map(function (v) {
|
|
345
299
|
return injectPropsWithOption(getMixedOption(v.value));
|
|
346
300
|
});
|
|
347
|
-
onChange(
|
|
348
|
-
|
|
301
|
+
onChange(
|
|
302
|
+
// Value
|
|
303
|
+
multiple ? returnValues : returnValues[0],
|
|
304
|
+
// Option
|
|
349
305
|
multiple ? returnOptions : returnOptions[0]);
|
|
350
306
|
}
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
|
|
307
|
+
};
|
|
308
|
+
// ======================= Accessibility ========================
|
|
354
309
|
var _React$useState = React.useState(null),
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
310
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
311
|
+
activeValue = _React$useState2[0],
|
|
312
|
+
setActiveValue = _React$useState2[1];
|
|
359
313
|
var _React$useState3 = React.useState(0),
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
314
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
315
|
+
accessibilityIndex = _React$useState4[0],
|
|
316
|
+
setAccessibilityIndex = _React$useState4[1];
|
|
364
317
|
var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
|
|
365
318
|
var onActiveValue = React.useCallback(function (active, index) {
|
|
366
319
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
320
|
+
_ref2$source = _ref2.source,
|
|
321
|
+
source = _ref2$source === void 0 ? 'keyboard' : _ref2$source;
|
|
370
322
|
setAccessibilityIndex(index);
|
|
371
|
-
|
|
372
323
|
if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {
|
|
373
324
|
setActiveValue(String(active));
|
|
374
325
|
}
|
|
375
|
-
}, [backfill, mode]);
|
|
376
|
-
|
|
326
|
+
}, [backfill, mode]);
|
|
327
|
+
// ========================= OptionList =========================
|
|
377
328
|
var triggerSelect = function triggerSelect(val, selected) {
|
|
378
329
|
var getSelectEnt = function getSelectEnt() {
|
|
379
330
|
var _option$key2;
|
|
380
|
-
|
|
381
331
|
var option = getMixedOption(val);
|
|
382
332
|
return [labelInValue ? {
|
|
383
333
|
label: option === null || option === void 0 ? void 0 : option[mergedFieldNames.label],
|
|
@@ -385,30 +335,25 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
385
335
|
key: (_option$key2 = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key2 !== void 0 ? _option$key2 : val
|
|
386
336
|
} : val, injectPropsWithOption(option)];
|
|
387
337
|
};
|
|
388
|
-
|
|
389
338
|
if (selected && onSelect) {
|
|
390
339
|
var _getSelectEnt = getSelectEnt(),
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
340
|
+
_getSelectEnt2 = _slicedToArray(_getSelectEnt, 2),
|
|
341
|
+
wrappedValue = _getSelectEnt2[0],
|
|
342
|
+
option = _getSelectEnt2[1];
|
|
395
343
|
onSelect(wrappedValue, option);
|
|
396
344
|
} else if (!selected && onDeselect) {
|
|
397
345
|
var _getSelectEnt3 = getSelectEnt(),
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
346
|
+
_getSelectEnt4 = _slicedToArray(_getSelectEnt3, 2),
|
|
347
|
+
_wrappedValue = _getSelectEnt4[0],
|
|
348
|
+
_option = _getSelectEnt4[1];
|
|
402
349
|
onDeselect(_wrappedValue, _option);
|
|
403
350
|
}
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
|
|
351
|
+
};
|
|
352
|
+
// Used for OptionList selection
|
|
407
353
|
var onInternalSelect = useRefFunc(function (val, info) {
|
|
408
|
-
var cloneValues;
|
|
409
|
-
|
|
354
|
+
var cloneValues;
|
|
355
|
+
// Single mode always trigger select only with option list
|
|
410
356
|
var mergedSelect = multiple ? info.selected : true;
|
|
411
|
-
|
|
412
357
|
if (mergedSelect) {
|
|
413
358
|
cloneValues = multiple ? [].concat(_toConsumableArray(mergedValues), [val]) : [val];
|
|
414
359
|
} else {
|
|
@@ -416,10 +361,9 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
416
361
|
return v.value !== val;
|
|
417
362
|
});
|
|
418
363
|
}
|
|
419
|
-
|
|
420
364
|
triggerChange(cloneValues);
|
|
421
|
-
triggerSelect(val, mergedSelect);
|
|
422
|
-
|
|
365
|
+
triggerSelect(val, mergedSelect);
|
|
366
|
+
// Clean search value if single or configured
|
|
423
367
|
if (mode === 'combobox') {
|
|
424
368
|
// setSearchValue(String(val));
|
|
425
369
|
setActiveValue('');
|
|
@@ -427,49 +371,42 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
427
371
|
setSearchValue('');
|
|
428
372
|
setActiveValue('');
|
|
429
373
|
}
|
|
430
|
-
});
|
|
374
|
+
});
|
|
375
|
+
// ======================= Display Change =======================
|
|
431
376
|
// BaseSelect display values change
|
|
432
|
-
|
|
433
377
|
var onDisplayValuesChange = function onDisplayValuesChange(nextValues, info) {
|
|
434
378
|
triggerChange(nextValues);
|
|
435
|
-
|
|
436
379
|
if (info.type === 'remove' || info.type === 'clear') {
|
|
437
380
|
info.values.forEach(function (item) {
|
|
438
381
|
triggerSelect(item.value, false);
|
|
439
382
|
});
|
|
440
383
|
}
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
|
|
384
|
+
};
|
|
385
|
+
// =========================== Search ===========================
|
|
444
386
|
var onInternalSearch = function onInternalSearch(searchText, info) {
|
|
445
387
|
setSearchValue(searchText);
|
|
446
|
-
setActiveValue(null);
|
|
447
|
-
|
|
388
|
+
setActiveValue(null);
|
|
389
|
+
// [Submit] Tag mode should flush input
|
|
448
390
|
if (info.source === 'submit') {
|
|
449
|
-
var formatted = (searchText || '').trim();
|
|
450
|
-
|
|
391
|
+
var formatted = (searchText || '').trim();
|
|
392
|
+
// prevent empty tags from appearing when you click the Enter button
|
|
451
393
|
if (formatted) {
|
|
452
394
|
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues), [formatted])));
|
|
453
395
|
triggerChange(newRawValues);
|
|
454
396
|
triggerSelect(formatted, true);
|
|
455
397
|
setSearchValue('');
|
|
456
398
|
}
|
|
457
|
-
|
|
458
399
|
return;
|
|
459
400
|
}
|
|
460
|
-
|
|
461
401
|
if (info.source !== 'blur') {
|
|
462
402
|
if (mode === 'combobox') {
|
|
463
403
|
triggerChange(searchText);
|
|
464
404
|
}
|
|
465
|
-
|
|
466
405
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchText);
|
|
467
406
|
}
|
|
468
407
|
};
|
|
469
|
-
|
|
470
408
|
var onInternalSearchSplit = function onInternalSearchSplit(words) {
|
|
471
409
|
var patchValues = words;
|
|
472
|
-
|
|
473
410
|
if (mode !== 'tags') {
|
|
474
411
|
patchValues = words.map(function (word) {
|
|
475
412
|
var opt = labelOptions.get(word);
|
|
@@ -478,15 +415,13 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
478
415
|
return val !== undefined;
|
|
479
416
|
});
|
|
480
417
|
}
|
|
481
|
-
|
|
482
418
|
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues), _toConsumableArray(patchValues))));
|
|
483
419
|
triggerChange(newRawValues);
|
|
484
420
|
newRawValues.forEach(function (newRawValue) {
|
|
485
421
|
triggerSelect(newRawValue, true);
|
|
486
422
|
});
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
|
|
423
|
+
};
|
|
424
|
+
// ========================== Context ===========================
|
|
490
425
|
var selectContext = React.useMemo(function () {
|
|
491
426
|
var realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;
|
|
492
427
|
return _objectSpread(_objectSpread({}, parsedOptions), {}, {
|
|
@@ -502,18 +437,17 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
502
437
|
listItemHeight: listItemHeight,
|
|
503
438
|
childrenAsData: childrenAsData
|
|
504
439
|
});
|
|
505
|
-
}, [parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, childrenAsData]);
|
|
506
|
-
|
|
440
|
+
}, [parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, childrenAsData]);
|
|
441
|
+
// ========================== Warning ===========================
|
|
507
442
|
if (process.env.NODE_ENV !== 'production') {
|
|
508
443
|
warningProps(props);
|
|
509
|
-
}
|
|
444
|
+
}
|
|
445
|
+
// ==============================================================
|
|
510
446
|
// == Render ==
|
|
511
447
|
// ==============================================================
|
|
512
|
-
|
|
513
|
-
|
|
514
448
|
return /*#__PURE__*/React.createElement(SelectContext.Provider, {
|
|
515
449
|
value: selectContext
|
|
516
|
-
}, /*#__PURE__*/React.createElement(BaseSelect,
|
|
450
|
+
}, /*#__PURE__*/React.createElement(BaseSelect, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
517
451
|
// >>> MISC
|
|
518
452
|
id: mergedId,
|
|
519
453
|
prefixCls: prefixCls,
|
|
@@ -536,11 +470,9 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
536
470
|
activeDescendantId: "".concat(mergedId, "_list_").concat(accessibilityIndex)
|
|
537
471
|
})));
|
|
538
472
|
});
|
|
539
|
-
|
|
540
473
|
if (process.env.NODE_ENV !== 'production') {
|
|
541
474
|
Select.displayName = 'Select';
|
|
542
475
|
}
|
|
543
|
-
|
|
544
476
|
var TypedSelect = Select;
|
|
545
477
|
TypedSelect.Option = Option;
|
|
546
478
|
TypedSelect.OptGroup = OptGroup;
|