@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
|
@@ -4,120 +4,82 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _warning = _interopRequireDefault(require("rc-util/lib/warning"));
|
|
11
|
-
|
|
12
9
|
var _useMergedState5 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
13
|
-
|
|
14
10
|
var _BaseSelect = _interopRequireWildcard(require("./BaseSelect"));
|
|
15
|
-
|
|
16
11
|
var _OptionList = _interopRequireDefault(require("./OptionList"));
|
|
17
|
-
|
|
18
12
|
var _Option = _interopRequireDefault(require("./Option"));
|
|
19
|
-
|
|
20
13
|
var _OptGroup = _interopRequireDefault(require("./OptGroup"));
|
|
21
|
-
|
|
22
14
|
var _useOptions = _interopRequireDefault(require("./hooks/useOptions"));
|
|
23
|
-
|
|
24
15
|
var _SelectContext = _interopRequireDefault(require("./SelectContext"));
|
|
25
|
-
|
|
26
16
|
var _useId = _interopRequireDefault(require("./hooks/useId"));
|
|
27
|
-
|
|
28
17
|
var _useRefFunc = _interopRequireDefault(require("./hooks/useRefFunc"));
|
|
29
|
-
|
|
30
18
|
var _valueUtil = require("./utils/valueUtil");
|
|
31
|
-
|
|
32
19
|
var _warningPropsUtil = _interopRequireDefault(require("./utils/warningPropsUtil"));
|
|
33
|
-
|
|
34
20
|
var _commonUtil = require("./utils/commonUtil");
|
|
35
|
-
|
|
36
21
|
var _useFilterOptions = _interopRequireDefault(require("./hooks/useFilterOptions"));
|
|
37
|
-
|
|
38
22
|
var _useCache3 = _interopRequireDefault(require("./hooks/useCache"));
|
|
39
|
-
|
|
40
23
|
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"];
|
|
41
|
-
|
|
42
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
|
-
|
|
44
25
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
|
-
|
|
46
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
-
|
|
48
27
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
49
|
-
|
|
50
28
|
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."); }
|
|
51
|
-
|
|
52
29
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
53
|
-
|
|
54
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
55
|
-
|
|
56
31
|
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; }
|
|
57
|
-
|
|
58
32
|
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; }
|
|
59
|
-
|
|
60
|
-
function
|
|
61
|
-
|
|
33
|
+
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; }
|
|
34
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
35
|
+
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); }
|
|
62
36
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
63
|
-
|
|
64
37
|
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."); }
|
|
65
|
-
|
|
66
38
|
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); }
|
|
67
|
-
|
|
68
39
|
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; }
|
|
69
|
-
|
|
70
|
-
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; }
|
|
71
|
-
|
|
40
|
+
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; } }
|
|
72
41
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
73
|
-
|
|
74
42
|
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; }
|
|
75
|
-
|
|
76
43
|
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; }
|
|
77
|
-
|
|
78
44
|
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); }
|
|
79
|
-
|
|
80
45
|
var OMIT_DOM_PROPS = ['inputValue'];
|
|
81
|
-
|
|
82
46
|
function isRawValue(value) {
|
|
83
47
|
return !value || _typeof(value) !== 'object';
|
|
84
48
|
}
|
|
85
|
-
|
|
86
49
|
var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
87
50
|
var id = props.id,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
51
|
+
mode = props.mode,
|
|
52
|
+
_props$prefixCls = props.prefixCls,
|
|
53
|
+
prefixCls = _props$prefixCls === void 0 ? 'rc-select' : _props$prefixCls,
|
|
54
|
+
backfill = props.backfill,
|
|
55
|
+
fieldNames = props.fieldNames,
|
|
56
|
+
inputValue = props.inputValue,
|
|
57
|
+
searchValue = props.searchValue,
|
|
58
|
+
onSearch = props.onSearch,
|
|
59
|
+
_props$autoClearSearc = props.autoClearSearchValue,
|
|
60
|
+
autoClearSearchValue = _props$autoClearSearc === void 0 ? true : _props$autoClearSearc,
|
|
61
|
+
onSelect = props.onSelect,
|
|
62
|
+
onDeselect = props.onDeselect,
|
|
63
|
+
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
|
64
|
+
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? true : _props$dropdownMatchS,
|
|
65
|
+
filterOption = props.filterOption,
|
|
66
|
+
filterSort = props.filterSort,
|
|
67
|
+
optionFilterProp = props.optionFilterProp,
|
|
68
|
+
optionLabelProp = props.optionLabelProp,
|
|
69
|
+
options = props.options,
|
|
70
|
+
children = props.children,
|
|
71
|
+
defaultActiveFirstOption = props.defaultActiveFirstOption,
|
|
72
|
+
menuItemSelectedIcon = props.menuItemSelectedIcon,
|
|
73
|
+
virtual = props.virtual,
|
|
74
|
+
_props$listHeight = props.listHeight,
|
|
75
|
+
listHeight = _props$listHeight === void 0 ? 200 : _props$listHeight,
|
|
76
|
+
_props$listItemHeight = props.listItemHeight,
|
|
77
|
+
listItemHeight = _props$listItemHeight === void 0 ? 20 : _props$listItemHeight,
|
|
78
|
+
value = props.value,
|
|
79
|
+
defaultValue = props.defaultValue,
|
|
80
|
+
labelInValue = props.labelInValue,
|
|
81
|
+
onChange = props.onChange,
|
|
82
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
121
83
|
var mergedId = (0, _useId.default)(id);
|
|
122
84
|
var multiple = (0, _BaseSelect.isMultiple)(mode);
|
|
123
85
|
var childrenAsData = !!(!options && children);
|
|
@@ -125,72 +87,64 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
125
87
|
if (filterOption === undefined && mode === 'combobox') {
|
|
126
88
|
return false;
|
|
127
89
|
}
|
|
128
|
-
|
|
129
90
|
return filterOption;
|
|
130
|
-
}, [filterOption, mode]);
|
|
131
|
-
|
|
91
|
+
}, [filterOption, mode]);
|
|
92
|
+
// ========================= FieldNames =========================
|
|
132
93
|
var mergedFieldNames = React.useMemo(function () {
|
|
133
94
|
return (0, _valueUtil.fillFieldNames)(fieldNames, childrenAsData);
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
JSON.stringify(fieldNames), childrenAsData]);
|
|
138
|
-
|
|
95
|
+
}, /* eslint-disable react-hooks/exhaustive-deps */
|
|
96
|
+
[
|
|
97
|
+
// We stringify fieldNames to avoid unnecessary re-renders.
|
|
98
|
+
JSON.stringify(fieldNames), childrenAsData]);
|
|
99
|
+
// =========================== Search ===========================
|
|
139
100
|
var _useMergedState = (0, _useMergedState5.default)('', {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
101
|
+
value: searchValue !== undefined ? searchValue : inputValue,
|
|
102
|
+
postState: function postState(search) {
|
|
103
|
+
return search || '';
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
107
|
+
mergedSearchValue = _useMergedState2[0],
|
|
108
|
+
setSearchValue = _useMergedState2[1];
|
|
109
|
+
// =========================== Option ===========================
|
|
150
110
|
var parsedOptions = (0, _useOptions.default)(options, children, mergedFieldNames, optionFilterProp, optionLabelProp);
|
|
151
111
|
var valueOptions = parsedOptions.valueOptions,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
112
|
+
labelOptions = parsedOptions.labelOptions,
|
|
113
|
+
mergedOptions = parsedOptions.options;
|
|
114
|
+
// ========================= Wrap Value =========================
|
|
155
115
|
var convert2LabelValues = React.useCallback(function (draftValues) {
|
|
156
116
|
// Convert to array
|
|
157
|
-
var valueList = (0, _commonUtil.toArray)(draftValues);
|
|
158
|
-
|
|
117
|
+
var valueList = (0, _commonUtil.toArray)(draftValues);
|
|
118
|
+
// Convert to labelInValue type
|
|
159
119
|
return valueList.map(function (val) {
|
|
160
120
|
var rawValue;
|
|
161
121
|
var rawLabel;
|
|
162
122
|
var rawKey;
|
|
163
|
-
var rawDisabled;
|
|
164
|
-
|
|
123
|
+
var rawDisabled;
|
|
124
|
+
// Fill label & value
|
|
165
125
|
if (isRawValue(val)) {
|
|
166
126
|
rawValue = val;
|
|
167
127
|
} else {
|
|
168
128
|
var _val$value;
|
|
169
|
-
|
|
170
129
|
rawKey = val.key;
|
|
171
130
|
rawLabel = val.label;
|
|
172
131
|
rawValue = (_val$value = val.value) !== null && _val$value !== void 0 ? _val$value : rawKey;
|
|
173
132
|
}
|
|
174
|
-
|
|
175
133
|
var option = valueOptions.get(rawValue);
|
|
176
|
-
|
|
177
134
|
if (option) {
|
|
178
135
|
var _option$key;
|
|
179
|
-
|
|
180
136
|
// Fill missing props
|
|
181
137
|
if (rawLabel === undefined) rawLabel = option === null || option === void 0 ? void 0 : option[optionLabelProp || mergedFieldNames.label];
|
|
182
138
|
if (rawKey === undefined) rawKey = (_option$key = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key !== void 0 ? _option$key : rawValue;
|
|
183
|
-
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
|
|
184
|
-
|
|
139
|
+
rawDisabled = option === null || option === void 0 ? void 0 : option.disabled;
|
|
140
|
+
// Warning if label not same as provided
|
|
185
141
|
if (process.env.NODE_ENV !== 'production' && !optionLabelProp) {
|
|
186
142
|
var optionLabel = option === null || option === void 0 ? void 0 : option[mergedFieldNames.label];
|
|
187
|
-
|
|
188
143
|
if (optionLabel !== undefined && optionLabel !== rawLabel) {
|
|
189
144
|
(0, _warning.default)(false, '`label` of `value` is not same as `label` in Select options.');
|
|
190
145
|
}
|
|
191
146
|
}
|
|
192
147
|
}
|
|
193
|
-
|
|
194
148
|
return {
|
|
195
149
|
label: rawLabel,
|
|
196
150
|
value: rawValue,
|
|
@@ -198,54 +152,46 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
198
152
|
disabled: rawDisabled
|
|
199
153
|
};
|
|
200
154
|
});
|
|
201
|
-
}, [mergedFieldNames, optionLabelProp, valueOptions]);
|
|
202
|
-
|
|
155
|
+
}, [mergedFieldNames, optionLabelProp, valueOptions]);
|
|
156
|
+
// =========================== Values ===========================
|
|
203
157
|
var _useMergedState3 = (0, _useMergedState5.default)(defaultValue, {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
158
|
+
value: value
|
|
159
|
+
}),
|
|
160
|
+
_useMergedState4 = _slicedToArray(_useMergedState3, 2),
|
|
161
|
+
internalValue = _useMergedState4[0],
|
|
162
|
+
setInternalValue = _useMergedState4[1];
|
|
163
|
+
// Merged value with LabelValueType
|
|
211
164
|
var rawLabeledValues = React.useMemo(function () {
|
|
212
165
|
var _values$;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
166
|
+
var values = convert2LabelValues(internalValue);
|
|
167
|
+
// combobox no need save value when it's empty
|
|
216
168
|
if (mode === 'combobox' && !((_values$ = values[0]) === null || _values$ === void 0 ? void 0 : _values$.value)) {
|
|
217
169
|
return [];
|
|
218
170
|
}
|
|
219
|
-
|
|
220
171
|
return values;
|
|
221
|
-
}, [internalValue, convert2LabelValues, mode]);
|
|
222
|
-
|
|
172
|
+
}, [internalValue, convert2LabelValues, mode]);
|
|
173
|
+
// Fill label with cache to avoid option remove
|
|
223
174
|
var _useCache = (0, _useCache3.default)(rawLabeledValues, valueOptions),
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
175
|
+
_useCache2 = _slicedToArray(_useCache, 2),
|
|
176
|
+
mergedValues = _useCache2[0],
|
|
177
|
+
getMixedOption = _useCache2[1];
|
|
228
178
|
var displayValues = React.useMemo(function () {
|
|
229
179
|
// `null` need show as placeholder instead
|
|
230
180
|
// https://github.com/ant-design/ant-design/issues/25057
|
|
231
181
|
if (!mode && mergedValues.length === 1) {
|
|
232
182
|
var firstValue = mergedValues[0];
|
|
233
|
-
|
|
234
183
|
if (firstValue.value === null && (firstValue.label === null || firstValue.label === undefined)) {
|
|
235
184
|
return [];
|
|
236
185
|
}
|
|
237
186
|
}
|
|
238
|
-
|
|
239
187
|
return mergedValues.map(function (item) {
|
|
240
188
|
var _item$label;
|
|
241
|
-
|
|
242
189
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
243
190
|
label: (_item$label = item.label) !== null && _item$label !== void 0 ? _item$label : item.value
|
|
244
191
|
});
|
|
245
192
|
});
|
|
246
193
|
}, [mode, mergedValues]);
|
|
247
194
|
/** Convert `displayValues` to raw value type set */
|
|
248
|
-
|
|
249
195
|
var rawValues = React.useMemo(function () {
|
|
250
196
|
return new Set(mergedValues.map(function (val) {
|
|
251
197
|
return val.value;
|
|
@@ -254,66 +200,56 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
254
200
|
React.useEffect(function () {
|
|
255
201
|
if (mode === 'combobox') {
|
|
256
202
|
var _mergedValues$;
|
|
257
|
-
|
|
258
203
|
var strValue = (_mergedValues$ = mergedValues[0]) === null || _mergedValues$ === void 0 ? void 0 : _mergedValues$.value;
|
|
259
|
-
|
|
260
204
|
if (strValue !== undefined && strValue !== null) {
|
|
261
205
|
setSearchValue(String(strValue));
|
|
262
206
|
}
|
|
263
207
|
}
|
|
264
|
-
}, [mergedValues]);
|
|
208
|
+
}, [mergedValues]);
|
|
209
|
+
// ======================= Display Option =======================
|
|
265
210
|
// Create a placeholder item if not exist in `options`
|
|
266
|
-
|
|
267
211
|
var createTagOption = (0, _useRefFunc.default)(function (val, label) {
|
|
268
212
|
var _ref;
|
|
269
|
-
|
|
270
213
|
var mergedLabel = label !== null && label !== void 0 ? label : val;
|
|
271
214
|
return _ref = {}, _defineProperty(_ref, mergedFieldNames.value, val), _defineProperty(_ref, mergedFieldNames.label, mergedLabel), _ref;
|
|
272
|
-
});
|
|
273
|
-
|
|
215
|
+
});
|
|
216
|
+
// Fill tag as option if mode is `tags`
|
|
274
217
|
var filledTagOptions = React.useMemo(function () {
|
|
275
218
|
if (mode !== 'tags') {
|
|
276
219
|
return mergedOptions;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
220
|
+
}
|
|
221
|
+
// >>> Tag mode
|
|
222
|
+
var cloneOptions = _toConsumableArray(mergedOptions);
|
|
223
|
+
// Check if value exist in options (include new patch item)
|
|
283
224
|
var existOptions = function existOptions(val) {
|
|
284
225
|
return valueOptions.has(val);
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
|
|
226
|
+
};
|
|
227
|
+
// Fill current value as option
|
|
288
228
|
_toConsumableArray(mergedValues).sort(function (a, b) {
|
|
289
229
|
return a.value < b.value ? -1 : 1;
|
|
290
230
|
}).forEach(function (item) {
|
|
291
231
|
var val = item.value;
|
|
292
|
-
|
|
293
232
|
if (!existOptions(val)) {
|
|
294
233
|
cloneOptions.push(createTagOption(val, item.label));
|
|
295
234
|
}
|
|
296
235
|
});
|
|
297
|
-
|
|
298
236
|
return cloneOptions;
|
|
299
237
|
}, [createTagOption, mergedOptions, valueOptions, mergedValues, mode]);
|
|
300
|
-
var filteredOptions = (0, _useFilterOptions.default)(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
|
|
301
|
-
|
|
238
|
+
var filteredOptions = (0, _useFilterOptions.default)(filledTagOptions, mergedFieldNames, mergedSearchValue, mergedFilterOption, optionFilterProp);
|
|
239
|
+
// Fill options with search value if needed
|
|
302
240
|
var filledSearchOptions = React.useMemo(function () {
|
|
303
241
|
if (mode !== 'tags' || !mergedSearchValue || filteredOptions.some(function (item) {
|
|
304
242
|
return item[optionFilterProp || 'value'] === mergedSearchValue;
|
|
305
243
|
})) {
|
|
306
244
|
return filteredOptions;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
245
|
+
}
|
|
246
|
+
// Fill search value as option
|
|
310
247
|
return [createTagOption(mergedSearchValue)].concat(_toConsumableArray(filteredOptions));
|
|
311
248
|
}, [createTagOption, optionFilterProp, mode, filteredOptions, mergedSearchValue]);
|
|
312
249
|
var orderedFilteredOptions = React.useMemo(function () {
|
|
313
250
|
if (!filterSort) {
|
|
314
251
|
return filledSearchOptions;
|
|
315
252
|
}
|
|
316
|
-
|
|
317
253
|
return _toConsumableArray(filledSearchOptions).sort(function (a, b) {
|
|
318
254
|
return filterSort(a, b);
|
|
319
255
|
});
|
|
@@ -323,16 +259,15 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
323
259
|
fieldNames: mergedFieldNames,
|
|
324
260
|
childrenAsData: childrenAsData
|
|
325
261
|
});
|
|
326
|
-
}, [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
|
|
327
|
-
|
|
262
|
+
}, [orderedFilteredOptions, mergedFieldNames, childrenAsData]);
|
|
263
|
+
// =========================== Change ===========================
|
|
328
264
|
var triggerChange = function triggerChange(values) {
|
|
329
265
|
var labeledValues = convert2LabelValues(values);
|
|
330
266
|
setInternalValue(labeledValues);
|
|
331
|
-
|
|
332
|
-
|
|
267
|
+
if (onChange && (
|
|
268
|
+
// Trigger event only when value changed
|
|
333
269
|
labeledValues.length !== mergedValues.length || labeledValues.some(function (newVal, index) {
|
|
334
270
|
var _mergedValues$index;
|
|
335
|
-
|
|
336
271
|
return ((_mergedValues$index = mergedValues[index]) === null || _mergedValues$index === void 0 ? void 0 : _mergedValues$index.value) !== (newVal === null || newVal === void 0 ? void 0 : newVal.value);
|
|
337
272
|
}))) {
|
|
338
273
|
var returnValues = labelInValue ? labeledValues : labeledValues.map(function (v) {
|
|
@@ -341,40 +276,36 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
341
276
|
var returnOptions = labeledValues.map(function (v) {
|
|
342
277
|
return (0, _valueUtil.injectPropsWithOption)(getMixedOption(v.value));
|
|
343
278
|
});
|
|
344
|
-
onChange(
|
|
345
|
-
|
|
279
|
+
onChange(
|
|
280
|
+
// Value
|
|
281
|
+
multiple ? returnValues : returnValues[0],
|
|
282
|
+
// Option
|
|
346
283
|
multiple ? returnOptions : returnOptions[0]);
|
|
347
284
|
}
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
|
|
285
|
+
};
|
|
286
|
+
// ======================= Accessibility ========================
|
|
351
287
|
var _React$useState = React.useState(null),
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
288
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
289
|
+
activeValue = _React$useState2[0],
|
|
290
|
+
setActiveValue = _React$useState2[1];
|
|
356
291
|
var _React$useState3 = React.useState(0),
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
292
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
293
|
+
accessibilityIndex = _React$useState4[0],
|
|
294
|
+
setAccessibilityIndex = _React$useState4[1];
|
|
361
295
|
var mergedDefaultActiveFirstOption = defaultActiveFirstOption !== undefined ? defaultActiveFirstOption : mode !== 'combobox';
|
|
362
296
|
var onActiveValue = React.useCallback(function (active, index) {
|
|
363
297
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
298
|
+
_ref2$source = _ref2.source,
|
|
299
|
+
source = _ref2$source === void 0 ? 'keyboard' : _ref2$source;
|
|
367
300
|
setAccessibilityIndex(index);
|
|
368
|
-
|
|
369
301
|
if (backfill && mode === 'combobox' && active !== null && source === 'keyboard') {
|
|
370
302
|
setActiveValue(String(active));
|
|
371
303
|
}
|
|
372
|
-
}, [backfill, mode]);
|
|
373
|
-
|
|
304
|
+
}, [backfill, mode]);
|
|
305
|
+
// ========================= OptionList =========================
|
|
374
306
|
var triggerSelect = function triggerSelect(val, selected) {
|
|
375
307
|
var getSelectEnt = function getSelectEnt() {
|
|
376
308
|
var _option$key2;
|
|
377
|
-
|
|
378
309
|
var option = getMixedOption(val);
|
|
379
310
|
return [labelInValue ? {
|
|
380
311
|
label: option === null || option === void 0 ? void 0 : option[mergedFieldNames.label],
|
|
@@ -382,30 +313,25 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
382
313
|
key: (_option$key2 = option === null || option === void 0 ? void 0 : option.key) !== null && _option$key2 !== void 0 ? _option$key2 : val
|
|
383
314
|
} : val, (0, _valueUtil.injectPropsWithOption)(option)];
|
|
384
315
|
};
|
|
385
|
-
|
|
386
316
|
if (selected && onSelect) {
|
|
387
317
|
var _getSelectEnt = getSelectEnt(),
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
318
|
+
_getSelectEnt2 = _slicedToArray(_getSelectEnt, 2),
|
|
319
|
+
wrappedValue = _getSelectEnt2[0],
|
|
320
|
+
option = _getSelectEnt2[1];
|
|
392
321
|
onSelect(wrappedValue, option);
|
|
393
322
|
} else if (!selected && onDeselect) {
|
|
394
323
|
var _getSelectEnt3 = getSelectEnt(),
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
324
|
+
_getSelectEnt4 = _slicedToArray(_getSelectEnt3, 2),
|
|
325
|
+
_wrappedValue = _getSelectEnt4[0],
|
|
326
|
+
_option = _getSelectEnt4[1];
|
|
399
327
|
onDeselect(_wrappedValue, _option);
|
|
400
328
|
}
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
|
|
329
|
+
};
|
|
330
|
+
// Used for OptionList selection
|
|
404
331
|
var onInternalSelect = (0, _useRefFunc.default)(function (val, info) {
|
|
405
|
-
var cloneValues;
|
|
406
|
-
|
|
332
|
+
var cloneValues;
|
|
333
|
+
// Single mode always trigger select only with option list
|
|
407
334
|
var mergedSelect = multiple ? info.selected : true;
|
|
408
|
-
|
|
409
335
|
if (mergedSelect) {
|
|
410
336
|
cloneValues = multiple ? [].concat(_toConsumableArray(mergedValues), [val]) : [val];
|
|
411
337
|
} else {
|
|
@@ -413,10 +339,9 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
413
339
|
return v.value !== val;
|
|
414
340
|
});
|
|
415
341
|
}
|
|
416
|
-
|
|
417
342
|
triggerChange(cloneValues);
|
|
418
|
-
triggerSelect(val, mergedSelect);
|
|
419
|
-
|
|
343
|
+
triggerSelect(val, mergedSelect);
|
|
344
|
+
// Clean search value if single or configured
|
|
420
345
|
if (mode === 'combobox') {
|
|
421
346
|
// setSearchValue(String(val));
|
|
422
347
|
setActiveValue('');
|
|
@@ -424,49 +349,42 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
424
349
|
setSearchValue('');
|
|
425
350
|
setActiveValue('');
|
|
426
351
|
}
|
|
427
|
-
});
|
|
352
|
+
});
|
|
353
|
+
// ======================= Display Change =======================
|
|
428
354
|
// BaseSelect display values change
|
|
429
|
-
|
|
430
355
|
var onDisplayValuesChange = function onDisplayValuesChange(nextValues, info) {
|
|
431
356
|
triggerChange(nextValues);
|
|
432
|
-
|
|
433
357
|
if (info.type === 'remove' || info.type === 'clear') {
|
|
434
358
|
info.values.forEach(function (item) {
|
|
435
359
|
triggerSelect(item.value, false);
|
|
436
360
|
});
|
|
437
361
|
}
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
|
|
362
|
+
};
|
|
363
|
+
// =========================== Search ===========================
|
|
441
364
|
var onInternalSearch = function onInternalSearch(searchText, info) {
|
|
442
365
|
setSearchValue(searchText);
|
|
443
|
-
setActiveValue(null);
|
|
444
|
-
|
|
366
|
+
setActiveValue(null);
|
|
367
|
+
// [Submit] Tag mode should flush input
|
|
445
368
|
if (info.source === 'submit') {
|
|
446
|
-
var formatted = (searchText || '').trim();
|
|
447
|
-
|
|
369
|
+
var formatted = (searchText || '').trim();
|
|
370
|
+
// prevent empty tags from appearing when you click the Enter button
|
|
448
371
|
if (formatted) {
|
|
449
372
|
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues), [formatted])));
|
|
450
373
|
triggerChange(newRawValues);
|
|
451
374
|
triggerSelect(formatted, true);
|
|
452
375
|
setSearchValue('');
|
|
453
376
|
}
|
|
454
|
-
|
|
455
377
|
return;
|
|
456
378
|
}
|
|
457
|
-
|
|
458
379
|
if (info.source !== 'blur') {
|
|
459
380
|
if (mode === 'combobox') {
|
|
460
381
|
triggerChange(searchText);
|
|
461
382
|
}
|
|
462
|
-
|
|
463
383
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchText);
|
|
464
384
|
}
|
|
465
385
|
};
|
|
466
|
-
|
|
467
386
|
var onInternalSearchSplit = function onInternalSearchSplit(words) {
|
|
468
387
|
var patchValues = words;
|
|
469
|
-
|
|
470
388
|
if (mode !== 'tags') {
|
|
471
389
|
patchValues = words.map(function (word) {
|
|
472
390
|
var opt = labelOptions.get(word);
|
|
@@ -475,15 +393,13 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
475
393
|
return val !== undefined;
|
|
476
394
|
});
|
|
477
395
|
}
|
|
478
|
-
|
|
479
396
|
var newRawValues = Array.from(new Set([].concat(_toConsumableArray(rawValues), _toConsumableArray(patchValues))));
|
|
480
397
|
triggerChange(newRawValues);
|
|
481
398
|
newRawValues.forEach(function (newRawValue) {
|
|
482
399
|
triggerSelect(newRawValue, true);
|
|
483
400
|
});
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
|
|
401
|
+
};
|
|
402
|
+
// ========================== Context ===========================
|
|
487
403
|
var selectContext = React.useMemo(function () {
|
|
488
404
|
var realVirtual = virtual !== false && dropdownMatchSelectWidth !== false;
|
|
489
405
|
return _objectSpread(_objectSpread({}, parsedOptions), {}, {
|
|
@@ -499,18 +415,17 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
499
415
|
listItemHeight: listItemHeight,
|
|
500
416
|
childrenAsData: childrenAsData
|
|
501
417
|
});
|
|
502
|
-
}, [parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, childrenAsData]);
|
|
503
|
-
|
|
418
|
+
}, [parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, childrenAsData]);
|
|
419
|
+
// ========================== Warning ===========================
|
|
504
420
|
if (process.env.NODE_ENV !== 'production') {
|
|
505
421
|
(0, _warningPropsUtil.default)(props);
|
|
506
|
-
}
|
|
422
|
+
}
|
|
423
|
+
// ==============================================================
|
|
507
424
|
// == Render ==
|
|
508
425
|
// ==============================================================
|
|
509
|
-
|
|
510
|
-
|
|
511
426
|
return /*#__PURE__*/React.createElement(_SelectContext.default.Provider, {
|
|
512
427
|
value: selectContext
|
|
513
|
-
}, /*#__PURE__*/React.createElement(_BaseSelect.default,
|
|
428
|
+
}, /*#__PURE__*/React.createElement(_BaseSelect.default, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
514
429
|
// >>> MISC
|
|
515
430
|
id: mergedId,
|
|
516
431
|
prefixCls: prefixCls,
|
|
@@ -533,11 +448,9 @@ var Select = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
533
448
|
activeDescendantId: "".concat(mergedId, "_list_").concat(accessibilityIndex)
|
|
534
449
|
})));
|
|
535
450
|
});
|
|
536
|
-
|
|
537
451
|
if (process.env.NODE_ENV !== 'production') {
|
|
538
452
|
Select.displayName = 'Select';
|
|
539
453
|
}
|
|
540
|
-
|
|
541
454
|
var TypedSelect = Select;
|
|
542
455
|
TypedSelect.Option = _Option.default;
|
|
543
456
|
TypedSelect.OptGroup = _OptGroup.default;
|