@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
|
@@ -5,341 +5,274 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.isMultiple = isMultiple;
|
|
8
|
-
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
|
|
13
10
|
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode"));
|
|
14
|
-
|
|
15
11
|
var _isMobile = _interopRequireDefault(require("rc-util/lib/isMobile"));
|
|
16
|
-
|
|
17
12
|
var _ref2 = require("rc-util/lib/ref");
|
|
18
|
-
|
|
19
13
|
var _useMergedState3 = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
20
|
-
|
|
21
14
|
var _useLayoutEffect = _interopRequireDefault(require("rc-util/lib/hooks/useLayoutEffect"));
|
|
22
|
-
|
|
23
15
|
var _valueUtil = require("./utils/valueUtil");
|
|
24
|
-
|
|
25
16
|
var _SelectTrigger = _interopRequireDefault(require("./SelectTrigger"));
|
|
26
|
-
|
|
27
17
|
var _Selector = _interopRequireDefault(require("./Selector"));
|
|
28
|
-
|
|
29
18
|
var _useSelectTriggerControl = _interopRequireDefault(require("./hooks/useSelectTriggerControl"));
|
|
30
|
-
|
|
31
19
|
var _useDelayReset3 = _interopRequireDefault(require("./hooks/useDelayReset"));
|
|
32
|
-
|
|
33
20
|
var _TransBtn = _interopRequireDefault(require("./TransBtn"));
|
|
34
|
-
|
|
35
21
|
var _useLock3 = _interopRequireDefault(require("./hooks/useLock"));
|
|
36
|
-
|
|
37
22
|
var _useBaseProps = require("./hooks/useBaseProps");
|
|
38
|
-
|
|
39
23
|
var _excluded = ["id", "prefixCls", "className", "showSearch", "tagRender", "direction", "omitDomProps", "prefix", "displayValues", "onDisplayValuesChange", "emptyOptions", "notFoundContent", "onClear", "mode", "disabled", "loading", "getInputElement", "getRawInputElement", "open", "defaultOpen", "onDropdownVisibleChange", "activeValue", "onActiveValueChange", "activeDescendantId", "searchValue", "onSearch", "onSearchSplit", "tokenSeparators", "allowClear", "showArrow", "inputIcon", "clearIcon", "OptionList", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "placement", "getPopupContainer", "showAction", "onFocus", "onBlur", "onKeyUp", "onKeyDown", "onMouseDown"];
|
|
40
|
-
|
|
41
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
|
-
|
|
43
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); }
|
|
44
|
-
|
|
45
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; }
|
|
46
|
-
|
|
47
27
|
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); }
|
|
48
|
-
|
|
49
28
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
50
|
-
|
|
51
29
|
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."); }
|
|
52
|
-
|
|
53
30
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
54
|
-
|
|
55
31
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
56
|
-
|
|
57
32
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
58
|
-
|
|
59
33
|
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."); }
|
|
60
|
-
|
|
61
34
|
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); }
|
|
62
|
-
|
|
63
35
|
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; }
|
|
64
|
-
|
|
65
|
-
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; }
|
|
66
|
-
|
|
36
|
+
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; } }
|
|
67
37
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
68
|
-
|
|
69
38
|
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; }
|
|
70
|
-
|
|
71
39
|
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; }
|
|
72
|
-
|
|
73
|
-
function
|
|
74
|
-
|
|
40
|
+
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; }
|
|
41
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
42
|
+
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); }
|
|
75
43
|
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; }
|
|
76
|
-
|
|
77
44
|
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; }
|
|
78
|
-
|
|
79
45
|
var DEFAULT_OMIT_PROPS = ['value', 'onChange', 'removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown', 'onPopupScroll', 'tabIndex'];
|
|
80
|
-
|
|
81
46
|
function isMultiple(mode) {
|
|
82
47
|
return mode === 'tags' || mode === 'multiple';
|
|
83
48
|
}
|
|
84
|
-
|
|
85
49
|
var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
86
50
|
var _customizeRawInputEle, _classNames2;
|
|
87
|
-
|
|
88
51
|
var id = props.id,
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
52
|
+
prefixCls = props.prefixCls,
|
|
53
|
+
className = props.className,
|
|
54
|
+
showSearch = props.showSearch,
|
|
55
|
+
tagRender = props.tagRender,
|
|
56
|
+
direction = props.direction,
|
|
57
|
+
omitDomProps = props.omitDomProps,
|
|
58
|
+
prefix = props.prefix,
|
|
59
|
+
displayValues = props.displayValues,
|
|
60
|
+
onDisplayValuesChange = props.onDisplayValuesChange,
|
|
61
|
+
emptyOptions = props.emptyOptions,
|
|
62
|
+
_props$notFoundConten = props.notFoundContent,
|
|
63
|
+
notFoundContent = _props$notFoundConten === void 0 ? 'Not Found' : _props$notFoundConten,
|
|
64
|
+
onClear = props.onClear,
|
|
65
|
+
mode = props.mode,
|
|
66
|
+
disabled = props.disabled,
|
|
67
|
+
loading = props.loading,
|
|
68
|
+
getInputElement = props.getInputElement,
|
|
69
|
+
getRawInputElement = props.getRawInputElement,
|
|
70
|
+
open = props.open,
|
|
71
|
+
defaultOpen = props.defaultOpen,
|
|
72
|
+
onDropdownVisibleChange = props.onDropdownVisibleChange,
|
|
73
|
+
activeValue = props.activeValue,
|
|
74
|
+
onActiveValueChange = props.onActiveValueChange,
|
|
75
|
+
activeDescendantId = props.activeDescendantId,
|
|
76
|
+
searchValue = props.searchValue,
|
|
77
|
+
onSearch = props.onSearch,
|
|
78
|
+
onSearchSplit = props.onSearchSplit,
|
|
79
|
+
tokenSeparators = props.tokenSeparators,
|
|
80
|
+
allowClear = props.allowClear,
|
|
81
|
+
showArrow = props.showArrow,
|
|
82
|
+
inputIcon = props.inputIcon,
|
|
83
|
+
clearIcon = props.clearIcon,
|
|
84
|
+
OptionList = props.OptionList,
|
|
85
|
+
animation = props.animation,
|
|
86
|
+
transitionName = props.transitionName,
|
|
87
|
+
dropdownStyle = props.dropdownStyle,
|
|
88
|
+
dropdownClassName = props.dropdownClassName,
|
|
89
|
+
dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,
|
|
90
|
+
dropdownRender = props.dropdownRender,
|
|
91
|
+
dropdownAlign = props.dropdownAlign,
|
|
92
|
+
placement = props.placement,
|
|
93
|
+
getPopupContainer = props.getPopupContainer,
|
|
94
|
+
_props$showAction = props.showAction,
|
|
95
|
+
showAction = _props$showAction === void 0 ? [] : _props$showAction,
|
|
96
|
+
onFocus = props.onFocus,
|
|
97
|
+
onBlur = props.onBlur,
|
|
98
|
+
onKeyUp = props.onKeyUp,
|
|
99
|
+
onKeyDown = props.onKeyDown,
|
|
100
|
+
onMouseDown = props.onMouseDown,
|
|
101
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
102
|
+
// ============================== MISC ==============================
|
|
141
103
|
var multiple = isMultiple(mode);
|
|
142
104
|
var mergedShowSearch = (showSearch !== undefined ? showSearch : multiple) || mode === 'combobox';
|
|
143
|
-
|
|
144
105
|
var domProps = _objectSpread({}, restProps);
|
|
145
|
-
|
|
146
106
|
DEFAULT_OMIT_PROPS.forEach(function (propName) {
|
|
147
107
|
delete domProps[propName];
|
|
148
108
|
});
|
|
149
109
|
omitDomProps === null || omitDomProps === void 0 ? void 0 : omitDomProps.forEach(function (propName) {
|
|
150
110
|
delete domProps[propName];
|
|
151
|
-
});
|
|
152
|
-
|
|
111
|
+
});
|
|
112
|
+
// ============================= Mobile =============================
|
|
153
113
|
var _React$useState = React.useState(false),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
114
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
115
|
+
mobile = _React$useState2[0],
|
|
116
|
+
setMobile = _React$useState2[1];
|
|
158
117
|
React.useEffect(function () {
|
|
159
118
|
// Only update on the client side
|
|
160
119
|
setMobile((0, _isMobile.default)());
|
|
161
|
-
}, []);
|
|
162
|
-
|
|
120
|
+
}, []);
|
|
121
|
+
// ============================== Refs ==============================
|
|
163
122
|
var containerRef = React.useRef(null);
|
|
164
123
|
var selectorDomRef = React.useRef(null);
|
|
165
124
|
var triggerRef = React.useRef(null);
|
|
166
125
|
var selectorRef = React.useRef(null);
|
|
167
126
|
var listRef = React.useRef(null);
|
|
168
127
|
/** Used for component focused management */
|
|
169
|
-
|
|
170
128
|
var _useDelayReset = (0, _useDelayReset3.default)(),
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
129
|
+
_useDelayReset2 = _slicedToArray(_useDelayReset, 3),
|
|
130
|
+
mockFocused = _useDelayReset2[0],
|
|
131
|
+
setMockFocused = _useDelayReset2[1],
|
|
132
|
+
cancelSetMockFocused = _useDelayReset2[2];
|
|
133
|
+
// =========================== Imperative ===========================
|
|
177
134
|
React.useImperativeHandle(ref, function () {
|
|
178
135
|
var _selectorRef$current, _selectorRef$current2;
|
|
179
|
-
|
|
180
136
|
return {
|
|
181
137
|
focus: (_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.focus,
|
|
182
138
|
blur: (_selectorRef$current2 = selectorRef.current) === null || _selectorRef$current2 === void 0 ? void 0 : _selectorRef$current2.blur,
|
|
183
139
|
scrollTo: function scrollTo(arg) {
|
|
184
140
|
var _listRef$current;
|
|
185
|
-
|
|
186
141
|
return (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.scrollTo(arg);
|
|
187
142
|
}
|
|
188
143
|
};
|
|
189
|
-
});
|
|
190
|
-
|
|
144
|
+
});
|
|
145
|
+
// ========================== Search Value ==========================
|
|
191
146
|
var mergedSearchValue = React.useMemo(function () {
|
|
192
147
|
var _displayValues$;
|
|
193
|
-
|
|
194
148
|
if (mode !== 'combobox') {
|
|
195
149
|
return searchValue;
|
|
196
150
|
}
|
|
197
|
-
|
|
198
151
|
var val = (_displayValues$ = displayValues[0]) === null || _displayValues$ === void 0 ? void 0 : _displayValues$.value;
|
|
199
152
|
return typeof val === 'string' || typeof val === 'number' ? String(val) : '';
|
|
200
|
-
}, [searchValue, mode, displayValues]);
|
|
153
|
+
}, [searchValue, mode, displayValues]);
|
|
154
|
+
// ========================== Custom Input ==========================
|
|
201
155
|
// Only works in `combobox`
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
156
|
+
var customizeInputElement = mode === 'combobox' && typeof getInputElement === 'function' && getInputElement() || null;
|
|
157
|
+
// Used for customize replacement for `rc-cascader`
|
|
205
158
|
var customizeRawInputElement = typeof getRawInputElement === 'function' && getRawInputElement();
|
|
206
|
-
var customizeRawInputRef = (0, _ref2.useComposeRef)(selectorDomRef, customizeRawInputElement === null || customizeRawInputElement === void 0 ? void 0 : (_customizeRawInputEle = customizeRawInputElement.props) === null || _customizeRawInputEle === void 0 ? void 0 : _customizeRawInputEle.ref);
|
|
207
|
-
|
|
159
|
+
var customizeRawInputRef = (0, _ref2.useComposeRef)(selectorDomRef, customizeRawInputElement === null || customizeRawInputElement === void 0 ? void 0 : (_customizeRawInputEle = customizeRawInputElement.props) === null || _customizeRawInputEle === void 0 ? void 0 : _customizeRawInputEle.ref);
|
|
160
|
+
// ============================== Open ==============================
|
|
208
161
|
var _useMergedState = (0, _useMergedState3.default)(undefined, {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
162
|
+
defaultValue: defaultOpen,
|
|
163
|
+
value: open
|
|
164
|
+
}),
|
|
165
|
+
_useMergedState2 = _slicedToArray(_useMergedState, 2),
|
|
166
|
+
innerOpen = _useMergedState2[0],
|
|
167
|
+
setInnerOpen = _useMergedState2[1];
|
|
168
|
+
var mergedOpen = innerOpen;
|
|
169
|
+
// Not trigger `open` in `combobox` when `notFoundContent` is empty
|
|
218
170
|
var emptyListContent = !notFoundContent && emptyOptions;
|
|
219
|
-
|
|
220
171
|
if (disabled || emptyListContent && mergedOpen && mode === 'combobox') {
|
|
221
172
|
mergedOpen = false;
|
|
222
173
|
}
|
|
223
|
-
|
|
224
174
|
var triggerOpen = emptyListContent ? false : mergedOpen;
|
|
225
175
|
var onToggleOpen = React.useCallback(function (newOpen) {
|
|
226
176
|
var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;
|
|
227
|
-
|
|
228
177
|
if (mergedOpen !== nextOpen && !disabled) {
|
|
229
178
|
setInnerOpen(nextOpen);
|
|
230
179
|
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextOpen);
|
|
231
180
|
}
|
|
232
|
-
}, [disabled, mergedOpen, setInnerOpen, onDropdownVisibleChange]);
|
|
233
|
-
|
|
181
|
+
}, [disabled, mergedOpen, setInnerOpen, onDropdownVisibleChange]);
|
|
182
|
+
// ============================= Search =============================
|
|
234
183
|
var tokenWithEnter = React.useMemo(function () {
|
|
235
184
|
return (tokenSeparators || []).some(function (tokenSeparator) {
|
|
236
185
|
return ['\n', '\r\n'].includes(tokenSeparator);
|
|
237
186
|
});
|
|
238
187
|
}, [tokenSeparators]);
|
|
239
|
-
|
|
240
188
|
var onInternalSearch = function onInternalSearch(searchText, fromTyping, isCompositing) {
|
|
241
189
|
var ret = true;
|
|
242
190
|
var newSearchText = searchText;
|
|
243
|
-
onActiveValueChange === null || onActiveValueChange === void 0 ? void 0 : onActiveValueChange(null);
|
|
244
|
-
|
|
245
|
-
var patchLabels = isCompositing ? null : (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators);
|
|
246
|
-
|
|
191
|
+
onActiveValueChange === null || onActiveValueChange === void 0 ? void 0 : onActiveValueChange(null);
|
|
192
|
+
// Check if match the `tokenSeparators`
|
|
193
|
+
var patchLabels = isCompositing ? null : (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators);
|
|
194
|
+
// Ignore combobox since it's not split-able
|
|
247
195
|
if (mode !== 'combobox' && patchLabels) {
|
|
248
196
|
newSearchText = '';
|
|
249
|
-
onSearchSplit === null || onSearchSplit === void 0 ? void 0 : onSearchSplit(patchLabels);
|
|
250
|
-
|
|
251
|
-
onToggleOpen(false);
|
|
252
|
-
|
|
197
|
+
onSearchSplit === null || onSearchSplit === void 0 ? void 0 : onSearchSplit(patchLabels);
|
|
198
|
+
// Should close when paste finish
|
|
199
|
+
onToggleOpen(false);
|
|
200
|
+
// Tell Selector that break next actions
|
|
253
201
|
ret = false;
|
|
254
202
|
}
|
|
255
|
-
|
|
256
203
|
if (onSearch && mergedSearchValue !== newSearchText) {
|
|
257
204
|
onSearch(newSearchText, {
|
|
258
205
|
source: fromTyping ? 'typing' : 'effect'
|
|
259
206
|
});
|
|
260
207
|
}
|
|
261
|
-
|
|
262
208
|
return ret;
|
|
263
|
-
};
|
|
209
|
+
};
|
|
210
|
+
// Only triggered when menu is closed & mode is tags
|
|
264
211
|
// If menu is open, OptionList will take charge
|
|
265
212
|
// If mode isn't tags, press enter is not meaningful when you can't see any option
|
|
266
|
-
|
|
267
|
-
|
|
268
213
|
var onInternalSearchSubmit = function onInternalSearchSubmit(searchText) {
|
|
269
214
|
// prevent empty tags from appearing when you click the Enter button
|
|
270
215
|
if (!searchText || !searchText.trim()) {
|
|
271
216
|
return;
|
|
272
217
|
}
|
|
273
|
-
|
|
274
218
|
onSearch(searchText, {
|
|
275
219
|
source: 'submit'
|
|
276
220
|
});
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
|
|
221
|
+
};
|
|
222
|
+
// Close will clean up single mode search text
|
|
280
223
|
React.useEffect(function () {
|
|
281
224
|
if (!mergedOpen && !multiple && mode !== 'combobox') {
|
|
282
225
|
onInternalSearch('', false, false);
|
|
283
226
|
}
|
|
284
|
-
}, [mergedOpen]);
|
|
227
|
+
}, [mergedOpen]);
|
|
228
|
+
// ============================ Disabled ============================
|
|
285
229
|
// Close dropdown & remove focus state when disabled change
|
|
286
|
-
|
|
287
230
|
React.useEffect(function () {
|
|
288
231
|
if (innerOpen && disabled) {
|
|
289
232
|
setInnerOpen(false);
|
|
290
233
|
}
|
|
291
|
-
|
|
292
234
|
if (disabled) {
|
|
293
235
|
setMockFocused(false);
|
|
294
236
|
}
|
|
295
|
-
}, [disabled]);
|
|
296
|
-
|
|
237
|
+
}, [disabled]);
|
|
238
|
+
// ============================ Keyboard ============================
|
|
297
239
|
/**
|
|
298
240
|
* We record input value here to check if can press to clean up by backspace
|
|
299
241
|
* - null: Key is not down, this is reset by key up
|
|
300
242
|
* - true: Search text is empty when first time backspace down
|
|
301
243
|
* - false: Search text is not empty when first time backspace down
|
|
302
244
|
*/
|
|
303
|
-
|
|
304
245
|
var _useLock = (0, _useLock3.default)(),
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
246
|
+
_useLock2 = _slicedToArray(_useLock, 2),
|
|
247
|
+
getClearLock = _useLock2[0],
|
|
248
|
+
setClearLock = _useLock2[1];
|
|
249
|
+
// KeyDown
|
|
310
250
|
var onInternalKeyDown = function onInternalKeyDown(event) {
|
|
311
251
|
var clearLock = getClearLock();
|
|
312
252
|
var which = event.which;
|
|
313
|
-
|
|
314
253
|
if (which === _KeyCode.default.ENTER) {
|
|
315
254
|
// Do not submit form when type in the input
|
|
316
255
|
if (mode !== 'combobox') {
|
|
317
256
|
event.preventDefault();
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
|
|
257
|
+
}
|
|
258
|
+
// We only manage open state here, close logic should handle by list component
|
|
321
259
|
if (!mergedOpen) {
|
|
322
260
|
onToggleOpen(true);
|
|
323
261
|
}
|
|
324
262
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
263
|
+
setClearLock(!!mergedSearchValue);
|
|
264
|
+
// Remove value by `backspace`
|
|
328
265
|
if (which === _KeyCode.default.BACKSPACE && !clearLock && multiple && !mergedSearchValue && displayValues.length) {
|
|
329
266
|
var cloneDisplayValues = _toConsumableArray(displayValues);
|
|
330
|
-
|
|
331
267
|
var removedDisplayValue = null;
|
|
332
|
-
|
|
333
268
|
for (var i = cloneDisplayValues.length - 1; i >= 0; i -= 1) {
|
|
334
269
|
var current = cloneDisplayValues[i];
|
|
335
|
-
|
|
336
270
|
if (!current.disabled) {
|
|
337
271
|
cloneDisplayValues.splice(i, 1);
|
|
338
272
|
removedDisplayValue = current;
|
|
339
273
|
break;
|
|
340
274
|
}
|
|
341
275
|
}
|
|
342
|
-
|
|
343
276
|
if (removedDisplayValue) {
|
|
344
277
|
onDisplayValuesChange(cloneDisplayValues, {
|
|
345
278
|
type: 'remove',
|
|
@@ -347,36 +280,27 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
347
280
|
});
|
|
348
281
|
}
|
|
349
282
|
}
|
|
350
|
-
|
|
351
283
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
352
284
|
rest[_key - 1] = arguments[_key];
|
|
353
285
|
}
|
|
354
|
-
|
|
355
286
|
if (mergedOpen && listRef.current) {
|
|
356
287
|
var _listRef$current2;
|
|
357
|
-
|
|
358
288
|
(_listRef$current2 = listRef.current).onKeyDown.apply(_listRef$current2, [event].concat(rest));
|
|
359
289
|
}
|
|
360
|
-
|
|
361
290
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown.apply(void 0, [event].concat(rest));
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
|
|
291
|
+
};
|
|
292
|
+
// KeyUp
|
|
365
293
|
var onInternalKeyUp = function onInternalKeyUp(event) {
|
|
366
294
|
for (var _len2 = arguments.length, rest = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
367
295
|
rest[_key2 - 1] = arguments[_key2];
|
|
368
296
|
}
|
|
369
|
-
|
|
370
297
|
if (mergedOpen && listRef.current) {
|
|
371
298
|
var _listRef$current3;
|
|
372
|
-
|
|
373
299
|
(_listRef$current3 = listRef.current).onKeyUp.apply(_listRef$current3, [event].concat(rest));
|
|
374
300
|
}
|
|
375
|
-
|
|
376
301
|
onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp.apply(void 0, [event].concat(rest));
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
|
|
302
|
+
};
|
|
303
|
+
// ============================ Selector ============================
|
|
380
304
|
var onSelectorRemove = function onSelectorRemove(val) {
|
|
381
305
|
var newValues = displayValues.filter(function (i) {
|
|
382
306
|
return i !== val;
|
|
@@ -385,40 +309,31 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
385
309
|
type: 'remove',
|
|
386
310
|
values: [val]
|
|
387
311
|
});
|
|
388
|
-
};
|
|
389
|
-
|
|
312
|
+
};
|
|
313
|
+
// ========================== Focus / Blur ==========================
|
|
390
314
|
/** Record real focus status */
|
|
391
|
-
|
|
392
|
-
|
|
393
315
|
var focusRef = React.useRef(false);
|
|
394
|
-
|
|
395
316
|
var onContainerFocus = function onContainerFocus() {
|
|
396
317
|
setMockFocused(true);
|
|
397
|
-
|
|
398
318
|
if (!disabled) {
|
|
399
319
|
if (onFocus && !focusRef.current) {
|
|
400
320
|
onFocus.apply(void 0, arguments);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
321
|
+
}
|
|
322
|
+
// `showAction` should handle `focus` if set
|
|
404
323
|
if (showAction.includes('focus')) {
|
|
405
324
|
onToggleOpen(true);
|
|
406
325
|
}
|
|
407
326
|
}
|
|
408
|
-
|
|
409
327
|
focusRef.current = true;
|
|
410
328
|
};
|
|
411
|
-
|
|
412
329
|
var onContainerBlur = function onContainerBlur() {
|
|
413
330
|
setMockFocused(false, function () {
|
|
414
331
|
focusRef.current = false;
|
|
415
332
|
onToggleOpen(false);
|
|
416
333
|
});
|
|
417
|
-
|
|
418
334
|
if (disabled) {
|
|
419
335
|
return;
|
|
420
336
|
}
|
|
421
|
-
|
|
422
337
|
if (mergedSearchValue) {
|
|
423
338
|
// `tags` mode should move `searchValue` into values
|
|
424
339
|
if (mode === 'tags') {
|
|
@@ -432,13 +347,11 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
432
347
|
});
|
|
433
348
|
}
|
|
434
349
|
}
|
|
435
|
-
|
|
436
350
|
if (onBlur) {
|
|
437
351
|
onBlur.apply(void 0, arguments);
|
|
438
352
|
}
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
|
|
353
|
+
};
|
|
354
|
+
// Give focus back of Select
|
|
442
355
|
var activeTimeoutIds = [];
|
|
443
356
|
React.useEffect(function () {
|
|
444
357
|
return function () {
|
|
@@ -448,81 +361,64 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
448
361
|
activeTimeoutIds.splice(0, activeTimeoutIds.length);
|
|
449
362
|
};
|
|
450
363
|
}, []);
|
|
451
|
-
|
|
452
364
|
var onInternalMouseDown = function onInternalMouseDown(event) {
|
|
453
365
|
var _triggerRef$current;
|
|
454
|
-
|
|
455
366
|
var target = event.target;
|
|
456
|
-
var popupElement = (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getPopupElement();
|
|
457
|
-
|
|
367
|
+
var popupElement = (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.getPopupElement();
|
|
368
|
+
// We should give focus back to selector if clicked item is not focusable
|
|
458
369
|
if (popupElement && popupElement.contains(target)) {
|
|
459
370
|
var timeoutId = setTimeout(function () {
|
|
460
371
|
var index = activeTimeoutIds.indexOf(timeoutId);
|
|
461
|
-
|
|
462
372
|
if (index !== -1) {
|
|
463
373
|
activeTimeoutIds.splice(index, 1);
|
|
464
374
|
}
|
|
465
|
-
|
|
466
375
|
cancelSetMockFocused();
|
|
467
|
-
|
|
468
376
|
if (!mobile && !popupElement.contains(document.activeElement)) {
|
|
469
377
|
var _selectorRef$current3;
|
|
470
|
-
|
|
471
378
|
(_selectorRef$current3 = selectorRef.current) === null || _selectorRef$current3 === void 0 ? void 0 : _selectorRef$current3.focus();
|
|
472
379
|
}
|
|
473
380
|
});
|
|
474
381
|
activeTimeoutIds.push(timeoutId);
|
|
475
382
|
}
|
|
476
|
-
|
|
477
383
|
for (var _len3 = arguments.length, restArgs = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
478
384
|
restArgs[_key3 - 1] = arguments[_key3];
|
|
479
385
|
}
|
|
480
|
-
|
|
481
386
|
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown.apply(void 0, [event].concat(restArgs));
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
|
|
387
|
+
};
|
|
388
|
+
// ============================ Dropdown ============================
|
|
485
389
|
var _React$useState3 = React.useState(null),
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
390
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
391
|
+
containerWidth = _React$useState4[0],
|
|
392
|
+
setContainerWidth = _React$useState4[1];
|
|
490
393
|
var _React$useState5 = React.useState({}),
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
394
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
395
|
+
forceUpdate = _React$useState6[1];
|
|
396
|
+
// We need force update here since popup dom is render async
|
|
495
397
|
function onPopupMouseEnter() {
|
|
496
398
|
forceUpdate({});
|
|
497
399
|
}
|
|
498
|
-
|
|
499
400
|
(0, _useLayoutEffect.default)(function () {
|
|
500
401
|
if (triggerOpen) {
|
|
501
402
|
var _containerRef$current;
|
|
502
|
-
|
|
503
403
|
var newWidth = Math.ceil((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetWidth);
|
|
504
|
-
|
|
505
404
|
if (containerWidth !== newWidth && !Number.isNaN(newWidth)) {
|
|
506
405
|
setContainerWidth(newWidth);
|
|
507
406
|
}
|
|
508
407
|
}
|
|
509
|
-
}, [triggerOpen]);
|
|
510
|
-
|
|
408
|
+
}, [triggerOpen]);
|
|
409
|
+
// Used for raw custom input trigger
|
|
511
410
|
var onTriggerVisibleChange;
|
|
512
|
-
|
|
513
411
|
if (customizeRawInputElement) {
|
|
514
412
|
onTriggerVisibleChange = function onTriggerVisibleChange(newOpen) {
|
|
515
413
|
onToggleOpen(newOpen);
|
|
516
414
|
};
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
415
|
+
}
|
|
416
|
+
// Close when click on non-select element
|
|
520
417
|
(0, _useSelectTriggerControl.default)(function () {
|
|
521
418
|
var _triggerRef$current2;
|
|
522
|
-
|
|
523
419
|
return [containerRef.current, (_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : _triggerRef$current2.getPopupElement()];
|
|
524
|
-
}, triggerOpen, onToggleOpen, !!customizeRawInputElement);
|
|
525
|
-
|
|
420
|
+
}, triggerOpen, onToggleOpen, !!customizeRawInputElement);
|
|
421
|
+
// ============================ Context =============================
|
|
526
422
|
var baseSelectContext = React.useMemo(function () {
|
|
527
423
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
528
424
|
notFoundContent: notFoundContent,
|
|
@@ -533,14 +429,13 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
533
429
|
multiple: multiple,
|
|
534
430
|
toggleOpen: onToggleOpen
|
|
535
431
|
});
|
|
536
|
-
}, [props, notFoundContent, triggerOpen, mergedOpen, id, mergedShowSearch, multiple, onToggleOpen]);
|
|
432
|
+
}, [props, notFoundContent, triggerOpen, mergedOpen, id, mergedShowSearch, multiple, onToggleOpen]);
|
|
433
|
+
// ==================================================================
|
|
537
434
|
// == Render ==
|
|
538
435
|
// ==================================================================
|
|
539
436
|
// ============================= Arrow ==============================
|
|
540
|
-
|
|
541
437
|
var mergedShowArrow = showArrow !== undefined ? showArrow : loading || !multiple && mode !== 'combobox';
|
|
542
438
|
var arrowNode;
|
|
543
|
-
|
|
544
439
|
if (mergedShowArrow) {
|
|
545
440
|
arrowNode = /*#__PURE__*/React.createElement(_TransBtn.default, {
|
|
546
441
|
className: (0, _classnames.default)("".concat(prefixCls, "-arrow"), _defineProperty({}, "".concat(prefixCls, "-arrow-loading"), loading)),
|
|
@@ -553,11 +448,9 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
553
448
|
showSearch: mergedShowSearch
|
|
554
449
|
}
|
|
555
450
|
});
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
|
|
451
|
+
}
|
|
452
|
+
// ============================= Clear ==============================
|
|
559
453
|
var clearNode;
|
|
560
|
-
|
|
561
454
|
var onClearMouseDown = function onClearMouseDown() {
|
|
562
455
|
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
563
456
|
onDisplayValuesChange([], {
|
|
@@ -566,22 +459,20 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
566
459
|
});
|
|
567
460
|
onInternalSearch('', false, false);
|
|
568
461
|
};
|
|
569
|
-
|
|
570
462
|
if (!disabled && allowClear && (displayValues.length || mergedSearchValue)) {
|
|
571
463
|
clearNode = /*#__PURE__*/React.createElement(_TransBtn.default, {
|
|
572
464
|
className: "".concat(prefixCls, "-clear"),
|
|
573
465
|
onMouseDown: onClearMouseDown,
|
|
574
466
|
customizeIcon: clearIcon
|
|
575
467
|
}, "\xD7");
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
|
|
468
|
+
}
|
|
469
|
+
// =========================== OptionList ===========================
|
|
579
470
|
var optionList = /*#__PURE__*/React.createElement(OptionList, {
|
|
580
471
|
ref: listRef
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
var mergedClassName = (0, _classnames.default)(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-focused"), mockFocused), _defineProperty(_classNames2, "".concat(prefixCls, "-multiple"), multiple), _defineProperty(_classNames2, "".concat(prefixCls, "-single"), !multiple), _defineProperty(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), _defineProperty(_classNames2, "".concat(prefixCls, "-show-arrow"), mergedShowArrow), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-loading"), loading), _defineProperty(_classNames2, "".concat(prefixCls, "-open"), mergedOpen), _defineProperty(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), _defineProperty(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch), _classNames2));
|
|
584
|
-
|
|
472
|
+
});
|
|
473
|
+
// ============================= Select =============================
|
|
474
|
+
var mergedClassName = (0, _classnames.default)(prefixCls, className, (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-focused"), mockFocused), _defineProperty(_classNames2, "".concat(prefixCls, "-multiple"), multiple), _defineProperty(_classNames2, "".concat(prefixCls, "-single"), !multiple), _defineProperty(_classNames2, "".concat(prefixCls, "-allow-clear"), allowClear), _defineProperty(_classNames2, "".concat(prefixCls, "-show-arrow"), mergedShowArrow), _defineProperty(_classNames2, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames2, "".concat(prefixCls, "-loading"), loading), _defineProperty(_classNames2, "".concat(prefixCls, "-open"), mergedOpen), _defineProperty(_classNames2, "".concat(prefixCls, "-customize-input"), customizeInputElement), _defineProperty(_classNames2, "".concat(prefixCls, "-show-search"), mergedShowSearch), _classNames2));
|
|
475
|
+
// >>> Selector
|
|
585
476
|
var selectorNode = /*#__PURE__*/React.createElement(_SelectTrigger.default, {
|
|
586
477
|
ref: triggerRef,
|
|
587
478
|
disabled: disabled,
|
|
@@ -607,7 +498,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
607
498
|
onPopupMouseEnter: onPopupMouseEnter
|
|
608
499
|
}, customizeRawInputElement ? /*#__PURE__*/React.cloneElement(customizeRawInputElement, {
|
|
609
500
|
ref: customizeRawInputRef
|
|
610
|
-
}) : /*#__PURE__*/React.createElement(_Selector.default,
|
|
501
|
+
}) : /*#__PURE__*/React.createElement(_Selector.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
611
502
|
domRef: selectorDomRef,
|
|
612
503
|
prefixCls: prefixCls,
|
|
613
504
|
prefix: prefix,
|
|
@@ -627,16 +518,16 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
627
518
|
onSearchSubmit: onInternalSearchSubmit,
|
|
628
519
|
onRemove: onSelectorRemove,
|
|
629
520
|
tokenWithEnter: tokenWithEnter
|
|
630
|
-
})));
|
|
631
|
-
|
|
632
|
-
var renderNode;
|
|
633
|
-
|
|
521
|
+
})));
|
|
522
|
+
// >>> Render
|
|
523
|
+
var renderNode;
|
|
524
|
+
// Render raw
|
|
634
525
|
if (customizeRawInputElement) {
|
|
635
526
|
renderNode = selectorNode;
|
|
636
527
|
} else {
|
|
637
|
-
renderNode = /*#__PURE__*/React.createElement("div",
|
|
528
|
+
renderNode = /*#__PURE__*/React.createElement("div", _objectSpread(_objectSpread({
|
|
638
529
|
className: mergedClassName
|
|
639
|
-
}, domProps, {
|
|
530
|
+
}, domProps), {}, {
|
|
640
531
|
ref: containerRef,
|
|
641
532
|
onMouseDown: onInternalMouseDown,
|
|
642
533
|
onKeyDown: onInternalKeyDown,
|
|
@@ -654,19 +545,17 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
654
545
|
"aria-live": "polite"
|
|
655
546
|
}, "".concat(displayValues.map(function (_ref) {
|
|
656
547
|
var label = _ref.label,
|
|
657
|
-
|
|
548
|
+
value = _ref.value;
|
|
658
549
|
return ['number', 'string'].includes(_typeof(label)) ? label : value;
|
|
659
550
|
}).join(', '))), selectorNode, arrowNode, clearNode);
|
|
660
551
|
}
|
|
661
|
-
|
|
662
552
|
return /*#__PURE__*/React.createElement(_useBaseProps.BaseSelectContext.Provider, {
|
|
663
553
|
value: baseSelectContext
|
|
664
554
|
}, renderNode);
|
|
665
|
-
});
|
|
666
|
-
|
|
555
|
+
});
|
|
556
|
+
// Set display name for dev
|
|
667
557
|
if (process.env.NODE_ENV !== 'production') {
|
|
668
558
|
BaseSelect.displayName = 'BaseSelect';
|
|
669
559
|
}
|
|
670
|
-
|
|
671
560
|
var _default = BaseSelect;
|
|
672
561
|
exports.default = _default;
|