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