@aloudata/aloudata-design 0.2.5 → 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 +158 -125
- 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 +0 -1
- 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 -162
- 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 +66 -176
- 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 +1 -0
- 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 +1 -1
- 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 +158 -125
- 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 +0 -1
- 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 -162
- 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 +66 -176
- 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 +1 -0
- 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 +1 -1
- 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,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ScrollConfig } from 'rc-virtual-list/lib/List';
|
|
3
|
+
export declare type OptionListProps = Record<string, never>;
|
|
4
|
+
export interface RefOptionListProps {
|
|
5
|
+
onKeyDown: React.KeyboardEventHandler;
|
|
6
|
+
onKeyUp: React.KeyboardEventHandler;
|
|
7
|
+
scrollTo?: (args: number | ScrollConfig) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const RefOptionList: React.ForwardRefExoticComponent<Pick<Record<string, never>, string> & React.RefAttributes<RefOptionListProps>>;
|
|
10
|
+
export default RefOptionList;
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
var _excluded = ["disabled", "title", "children", "style", "className"];
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
+
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
+
|
|
19
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
+
|
|
21
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
+
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
|
|
25
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
26
|
+
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
|
|
29
|
+
// @ts-nocheck
|
|
30
|
+
import * as React from 'react';
|
|
31
|
+
import { useEffect } from 'react';
|
|
32
|
+
import KeyCode from 'rc-util/lib/KeyCode';
|
|
33
|
+
import omit from 'rc-util/lib/omit';
|
|
34
|
+
import pickAttrs from 'rc-util/lib/pickAttrs';
|
|
35
|
+
import useMemo from 'rc-util/lib/hooks/useMemo';
|
|
36
|
+
import classNames from 'classnames';
|
|
37
|
+
import List from 'rc-virtual-list';
|
|
38
|
+
import { isPlatformMac } from './utils/platformUtil';
|
|
39
|
+
import useBaseProps from './hooks/useBaseProps';
|
|
40
|
+
import SelectContext from './SelectContext';
|
|
41
|
+
import Checkbox from '../../Checkbox';
|
|
42
|
+
import Icon from '../../Icon';
|
|
43
|
+
import colors from '../../style/themes/default/themeColor.module.less';
|
|
44
|
+
|
|
45
|
+
function isTitleType(content) {
|
|
46
|
+
return typeof content === 'string' || typeof content === 'number';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Using virtual list of option display.
|
|
50
|
+
* Will fallback to dom if use customize render.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
var OptionList = function OptionList(_, ref) {
|
|
55
|
+
var _useBaseProps = useBaseProps(),
|
|
56
|
+
prefixCls = _useBaseProps.prefixCls,
|
|
57
|
+
id = _useBaseProps.id,
|
|
58
|
+
open = _useBaseProps.open,
|
|
59
|
+
multiple = _useBaseProps.multiple,
|
|
60
|
+
mode = _useBaseProps.mode,
|
|
61
|
+
searchValue = _useBaseProps.searchValue,
|
|
62
|
+
toggleOpen = _useBaseProps.toggleOpen,
|
|
63
|
+
notFoundContent = _useBaseProps.notFoundContent,
|
|
64
|
+
onPopupScroll = _useBaseProps.onPopupScroll;
|
|
65
|
+
|
|
66
|
+
var _React$useContext = React.useContext(SelectContext),
|
|
67
|
+
flattenOptions = _React$useContext.flattenOptions,
|
|
68
|
+
onActiveValue = _React$useContext.onActiveValue,
|
|
69
|
+
defaultActiveFirstOption = _React$useContext.defaultActiveFirstOption,
|
|
70
|
+
onSelect = _React$useContext.onSelect,
|
|
71
|
+
menuItemSelectedIcon = _React$useContext.menuItemSelectedIcon,
|
|
72
|
+
rawValues = _React$useContext.rawValues,
|
|
73
|
+
fieldNames = _React$useContext.fieldNames,
|
|
74
|
+
virtual = _React$useContext.virtual,
|
|
75
|
+
listHeight = _React$useContext.listHeight,
|
|
76
|
+
listItemHeight = _React$useContext.listItemHeight;
|
|
77
|
+
|
|
78
|
+
var itemPrefixCls = "".concat(prefixCls, "-item");
|
|
79
|
+
var memoFlattenOptions = useMemo(function () {
|
|
80
|
+
return flattenOptions;
|
|
81
|
+
}, [open, flattenOptions], function (prev, next) {
|
|
82
|
+
return next[0] && prev[1] !== next[1];
|
|
83
|
+
}); // =========================== List ===========================
|
|
84
|
+
|
|
85
|
+
var listRef = React.useRef(null);
|
|
86
|
+
|
|
87
|
+
var onListMouseDown = function onListMouseDown(event) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var scrollIntoView = function scrollIntoView(args) {
|
|
92
|
+
if (listRef.current) {
|
|
93
|
+
listRef.current.scrollTo(typeof args === 'number' ? {
|
|
94
|
+
index: args
|
|
95
|
+
} : args);
|
|
96
|
+
}
|
|
97
|
+
}; // ========================== Active ==========================
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
var getEnabledActiveIndex = function getEnabledActiveIndex(index) {
|
|
101
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
102
|
+
var len = memoFlattenOptions.length;
|
|
103
|
+
|
|
104
|
+
for (var i = 0; i < len; i += 1) {
|
|
105
|
+
var current = (index + i * offset + len) % len;
|
|
106
|
+
var _memoFlattenOptions$c = memoFlattenOptions[current],
|
|
107
|
+
group = _memoFlattenOptions$c.group,
|
|
108
|
+
data = _memoFlattenOptions$c.data;
|
|
109
|
+
|
|
110
|
+
if (!group && !data.disabled) {
|
|
111
|
+
return current;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return -1;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
var _React$useState = React.useState(function () {
|
|
119
|
+
return getEnabledActiveIndex(0);
|
|
120
|
+
}),
|
|
121
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
122
|
+
activeIndex = _React$useState2[0],
|
|
123
|
+
setActiveIndex = _React$useState2[1];
|
|
124
|
+
|
|
125
|
+
var setActive = function setActive(index) {
|
|
126
|
+
var fromKeyboard = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
127
|
+
setActiveIndex(index);
|
|
128
|
+
var info = {
|
|
129
|
+
source: fromKeyboard ? 'keyboard' : 'mouse'
|
|
130
|
+
}; // Trigger active event
|
|
131
|
+
|
|
132
|
+
var flattenItem = memoFlattenOptions[index];
|
|
133
|
+
|
|
134
|
+
if (!flattenItem) {
|
|
135
|
+
onActiveValue(null, -1, info);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
onActiveValue(flattenItem.value, index, info);
|
|
140
|
+
}; // Auto active first item when list length or searchValue changed
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1);
|
|
145
|
+
}, [memoFlattenOptions.length, searchValue]); // https://github.com/ant-design/ant-design/issues/34975
|
|
146
|
+
|
|
147
|
+
var isSelected = React.useCallback(function (value) {
|
|
148
|
+
return rawValues.has(value) && mode !== 'combobox';
|
|
149
|
+
}, [mode, _toConsumableArray(rawValues).toString()]); // Auto scroll to item position in single mode
|
|
150
|
+
|
|
151
|
+
useEffect(function () {
|
|
152
|
+
/**
|
|
153
|
+
* React will skip `onChange` when component update.
|
|
154
|
+
* `setActive` function will call root accessibility state update which makes re-render.
|
|
155
|
+
* So we need to delay to let Input component trigger onChange first.
|
|
156
|
+
*/
|
|
157
|
+
var timeoutId = setTimeout(function () {
|
|
158
|
+
if (!multiple && open && rawValues.size === 1) {
|
|
159
|
+
var value = Array.from(rawValues)[0];
|
|
160
|
+
var index = memoFlattenOptions.findIndex(function (_ref) {
|
|
161
|
+
var data = _ref.data;
|
|
162
|
+
return data.value === value;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
if (index !== -1) {
|
|
166
|
+
setActive(index);
|
|
167
|
+
scrollIntoView(index);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}); // Force trigger scrollbar visible when open
|
|
171
|
+
|
|
172
|
+
if (open) {
|
|
173
|
+
var _listRef$current;
|
|
174
|
+
|
|
175
|
+
(_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.scrollTo(undefined);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return function () {
|
|
179
|
+
return clearTimeout(timeoutId);
|
|
180
|
+
};
|
|
181
|
+
}, [open, searchValue]); // ========================== Values ==========================
|
|
182
|
+
|
|
183
|
+
var onSelectValue = function onSelectValue(value) {
|
|
184
|
+
if (value !== undefined) {
|
|
185
|
+
onSelect(value, {
|
|
186
|
+
selected: !rawValues.has(value)
|
|
187
|
+
});
|
|
188
|
+
} // Single mode should always close by select
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
if (!multiple) {
|
|
192
|
+
toggleOpen(false);
|
|
193
|
+
}
|
|
194
|
+
}; // ========================= Keyboard =========================
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
React.useImperativeHandle(ref, function () {
|
|
198
|
+
return {
|
|
199
|
+
onKeyDown: function onKeyDown(event) {
|
|
200
|
+
var which = event.which,
|
|
201
|
+
ctrlKey = event.ctrlKey;
|
|
202
|
+
|
|
203
|
+
switch (which) {
|
|
204
|
+
// >>> Arrow keys & ctrl + n/p on Mac
|
|
205
|
+
case KeyCode.N:
|
|
206
|
+
case KeyCode.P:
|
|
207
|
+
case KeyCode.UP:
|
|
208
|
+
case KeyCode.DOWN:
|
|
209
|
+
{
|
|
210
|
+
var offset = 0;
|
|
211
|
+
|
|
212
|
+
if (which === KeyCode.UP) {
|
|
213
|
+
offset = -1;
|
|
214
|
+
} else if (which === KeyCode.DOWN) {
|
|
215
|
+
offset = 1;
|
|
216
|
+
} else if (isPlatformMac() && ctrlKey) {
|
|
217
|
+
if (which === KeyCode.N) {
|
|
218
|
+
offset = 1;
|
|
219
|
+
} else if (which === KeyCode.P) {
|
|
220
|
+
offset = -1;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (offset !== 0) {
|
|
225
|
+
var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset);
|
|
226
|
+
scrollIntoView(nextActiveIndex);
|
|
227
|
+
setActive(nextActiveIndex, true);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
// >>> Select
|
|
233
|
+
|
|
234
|
+
case KeyCode.ENTER:
|
|
235
|
+
{
|
|
236
|
+
// value
|
|
237
|
+
var item = memoFlattenOptions[activeIndex];
|
|
238
|
+
|
|
239
|
+
if (item && !item.data.disabled) {
|
|
240
|
+
onSelectValue(item.value);
|
|
241
|
+
} else {
|
|
242
|
+
onSelectValue(undefined);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (open) {
|
|
246
|
+
event.preventDefault();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
// >>> Close
|
|
252
|
+
|
|
253
|
+
case KeyCode.ESC:
|
|
254
|
+
{
|
|
255
|
+
toggleOpen(false);
|
|
256
|
+
|
|
257
|
+
if (open) {
|
|
258
|
+
event.stopPropagation();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
onKeyUp: function onKeyUp() {},
|
|
264
|
+
scrollTo: function scrollTo(index) {
|
|
265
|
+
scrollIntoView(index);
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}); // ========================== Render ==========================
|
|
269
|
+
|
|
270
|
+
if (memoFlattenOptions.length === 0) {
|
|
271
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
272
|
+
role: "listbox",
|
|
273
|
+
id: "".concat(id, "_list"),
|
|
274
|
+
className: "".concat(itemPrefixCls, "-empty"),
|
|
275
|
+
onMouseDown: onListMouseDown
|
|
276
|
+
}, notFoundContent);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
var omitFieldNameList = Object.keys(fieldNames).map(function (key) {
|
|
280
|
+
return fieldNames[key];
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
var getLabel = function getLabel(item) {
|
|
284
|
+
return item.label;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
var renderItem = function renderItem(index) {
|
|
288
|
+
var item = memoFlattenOptions[index];
|
|
289
|
+
if (!item) return null;
|
|
290
|
+
var itemData = item.data || {};
|
|
291
|
+
var value = itemData.value;
|
|
292
|
+
var group = item.group;
|
|
293
|
+
var attrs = pickAttrs(itemData, true);
|
|
294
|
+
var mergedLabel = getLabel(item);
|
|
295
|
+
return item ? /*#__PURE__*/React.createElement("div", Object.assign({
|
|
296
|
+
"aria-label": typeof mergedLabel === 'string' && !group ? mergedLabel : null
|
|
297
|
+
}, attrs, {
|
|
298
|
+
key: index,
|
|
299
|
+
role: group ? 'presentation' : 'option',
|
|
300
|
+
id: "".concat(id, "_list_").concat(index),
|
|
301
|
+
"aria-selected": isSelected(value)
|
|
302
|
+
}), value) : null;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
306
|
+
role: "listbox",
|
|
307
|
+
id: "".concat(id, "_list"),
|
|
308
|
+
style: {
|
|
309
|
+
height: 0,
|
|
310
|
+
width: 0,
|
|
311
|
+
overflow: 'hidden'
|
|
312
|
+
}
|
|
313
|
+
}, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), /*#__PURE__*/React.createElement(List, {
|
|
314
|
+
itemKey: "key",
|
|
315
|
+
ref: listRef,
|
|
316
|
+
data: memoFlattenOptions,
|
|
317
|
+
height: listHeight,
|
|
318
|
+
itemHeight: listItemHeight,
|
|
319
|
+
fullHeight: false,
|
|
320
|
+
onMouseDown: onListMouseDown,
|
|
321
|
+
onScroll: onPopupScroll,
|
|
322
|
+
virtual: virtual
|
|
323
|
+
}, function (item, itemIndex) {
|
|
324
|
+
var _classNames;
|
|
325
|
+
|
|
326
|
+
var group = item.group,
|
|
327
|
+
groupOption = item.groupOption,
|
|
328
|
+
data = item.data,
|
|
329
|
+
label = item.label,
|
|
330
|
+
value = item.value;
|
|
331
|
+
var key = data.key; // Group
|
|
332
|
+
|
|
333
|
+
if (group) {
|
|
334
|
+
var _data$title;
|
|
335
|
+
|
|
336
|
+
var groupTitle = (_data$title = data.title) !== null && _data$title !== void 0 ? _data$title : isTitleType(label) ? label.toString() : undefined;
|
|
337
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
338
|
+
className: classNames(itemPrefixCls, "".concat(itemPrefixCls, "-group")),
|
|
339
|
+
title: groupTitle
|
|
340
|
+
}, label !== undefined ? label : key);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var disabled = data.disabled,
|
|
344
|
+
title = data.title,
|
|
345
|
+
children = data.children,
|
|
346
|
+
style = data.style,
|
|
347
|
+
className = data.className,
|
|
348
|
+
otherProps = _objectWithoutProperties(data, _excluded);
|
|
349
|
+
|
|
350
|
+
var passedProps = omit(otherProps, omitFieldNameList); // Option
|
|
351
|
+
|
|
352
|
+
var selected = isSelected(value);
|
|
353
|
+
var optionPrefixCls = "".concat(itemPrefixCls, "-option");
|
|
354
|
+
var optionClassName = classNames(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), _defineProperty(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames));
|
|
355
|
+
var mergedLabel = getLabel(item);
|
|
356
|
+
var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected; // https://github.com/ant-design/ant-design/issues/34145
|
|
357
|
+
|
|
358
|
+
var content = typeof mergedLabel === 'number' ? mergedLabel : mergedLabel || value; // https://github.com/ant-design/ant-design/issues/26717
|
|
359
|
+
|
|
360
|
+
var optionTitle = isTitleType(content) ? content.toString() : undefined;
|
|
361
|
+
|
|
362
|
+
if (title !== undefined) {
|
|
363
|
+
optionTitle = title;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, pickAttrs(passedProps), {
|
|
367
|
+
"aria-selected": selected,
|
|
368
|
+
className: classNames(optionClassName, 'ald-select-item'),
|
|
369
|
+
title: optionTitle,
|
|
370
|
+
onMouseMove: function onMouseMove() {
|
|
371
|
+
if (activeIndex === itemIndex || disabled) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
setActive(itemIndex);
|
|
376
|
+
},
|
|
377
|
+
onClick: function onClick() {
|
|
378
|
+
if (!disabled) {
|
|
379
|
+
onSelectValue(value);
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
style: style
|
|
383
|
+
}), !multiple && /*#__PURE__*/React.createElement("div", {
|
|
384
|
+
className: 'ald-select-single-check'
|
|
385
|
+
}, selected && /*#__PURE__*/React.createElement(Icon, {
|
|
386
|
+
color: colors.B60,
|
|
387
|
+
size: '1em',
|
|
388
|
+
type: "check"
|
|
389
|
+
})), multiple && /*#__PURE__*/React.createElement(Checkbox, {
|
|
390
|
+
className: 'ald-select-multiple-checkbox',
|
|
391
|
+
checked: selected,
|
|
392
|
+
disabled: disabled
|
|
393
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
394
|
+
className: "".concat(optionPrefixCls, "-content")
|
|
395
|
+
}, content), /*#__PURE__*/React.isValidElement(menuItemSelectedIcon) || selected);
|
|
396
|
+
}));
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
var RefOptionList = /*#__PURE__*/React.forwardRef(OptionList);
|
|
400
|
+
RefOptionList.displayName = 'OptionList';
|
|
401
|
+
export default RefOptionList;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* To match accessibility requirement, we always provide an input in the component.
|
|
3
|
+
* Other element will not set `tabIndex` to avoid `onBlur` sequence problem.
|
|
4
|
+
* For focused select, we set `aria-live="polite"` to update the accessibility content.
|
|
5
|
+
*
|
|
6
|
+
* ref:
|
|
7
|
+
* - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions
|
|
8
|
+
*
|
|
9
|
+
* New api:
|
|
10
|
+
* - listHeight
|
|
11
|
+
* - listItemHeight
|
|
12
|
+
* - component
|
|
13
|
+
*
|
|
14
|
+
* Remove deprecated api:
|
|
15
|
+
* - multiple
|
|
16
|
+
* - tags
|
|
17
|
+
* - combobox
|
|
18
|
+
* - firstActiveValue
|
|
19
|
+
* - dropdownMenuStyle
|
|
20
|
+
* - openClassName (Not list in api)
|
|
21
|
+
*
|
|
22
|
+
* Update:
|
|
23
|
+
* - `backfill` only support `combobox` mode
|
|
24
|
+
* - `combobox` mode not support `labelInValue` since it's meaningless
|
|
25
|
+
* - `getInputElement` only support `combobox` mode
|
|
26
|
+
* - `onChange` return OptionData instead of ReactNode
|
|
27
|
+
* - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode
|
|
28
|
+
* - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option
|
|
29
|
+
* - `combobox` mode not support `optionLabelProp`
|
|
30
|
+
*/
|
|
31
|
+
import * as React from 'react';
|
|
32
|
+
import type { DisplayValueType, RenderNode } from './BaseSelect';
|
|
33
|
+
import Option from './Option';
|
|
34
|
+
import OptGroup from './OptGroup';
|
|
35
|
+
import type { BaseSelectRef, BaseSelectPropsWithoutPrivate } from './BaseSelect';
|
|
36
|
+
export declare type OnActiveValue = (active: RawValueType, index: number, info?: {
|
|
37
|
+
source?: 'keyboard' | 'mouse';
|
|
38
|
+
}) => void;
|
|
39
|
+
export declare type OnInternalSelect = (value: RawValueType, info: {
|
|
40
|
+
selected: boolean;
|
|
41
|
+
}) => void;
|
|
42
|
+
export declare type RawValueType = string | number;
|
|
43
|
+
export interface LabelInValueType {
|
|
44
|
+
label: React.ReactNode;
|
|
45
|
+
value: RawValueType;
|
|
46
|
+
/** @deprecated `key` is useless since it should always same as `value` */
|
|
47
|
+
key?: React.Key;
|
|
48
|
+
}
|
|
49
|
+
export declare type DraftValueType = RawValueType | LabelInValueType | DisplayValueType | (RawValueType | LabelInValueType | DisplayValueType)[];
|
|
50
|
+
export declare type FilterFunc<OptionType> = (inputValue: string, option?: OptionType) => boolean;
|
|
51
|
+
export interface FieldNames {
|
|
52
|
+
value?: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
options?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface BaseOptionType {
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
[name: string]: any;
|
|
59
|
+
}
|
|
60
|
+
export interface DefaultOptionType extends BaseOptionType {
|
|
61
|
+
label: React.ReactNode;
|
|
62
|
+
value?: string | number | null;
|
|
63
|
+
children?: Omit<DefaultOptionType, 'children'>[];
|
|
64
|
+
}
|
|
65
|
+
export declare type SelectHandler<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> = ((value: RawValueType | LabelInValueType, option: OptionType) => void) | ((value: ValueType, option: OptionType) => void);
|
|
66
|
+
declare type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
67
|
+
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType = DefaultOptionType> extends BaseSelectPropsWithoutPrivate {
|
|
68
|
+
prefixCls?: string;
|
|
69
|
+
id?: string;
|
|
70
|
+
backfill?: boolean;
|
|
71
|
+
fieldNames?: FieldNames;
|
|
72
|
+
/** @deprecated Use `searchValue` instead */
|
|
73
|
+
inputValue?: string;
|
|
74
|
+
searchValue?: string;
|
|
75
|
+
onSearch?: (value: string) => void;
|
|
76
|
+
autoClearSearchValue?: boolean;
|
|
77
|
+
onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
78
|
+
onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
79
|
+
/**
|
|
80
|
+
* In Select, `false` means do nothing.
|
|
81
|
+
* In TreeSelect, `false` will highlight match item.
|
|
82
|
+
* It's by design.
|
|
83
|
+
*/
|
|
84
|
+
filterOption?: boolean | FilterFunc<OptionType>;
|
|
85
|
+
filterSort?: (optionA: OptionType, optionB: OptionType) => number;
|
|
86
|
+
optionFilterProp?: string;
|
|
87
|
+
optionLabelProp?: string;
|
|
88
|
+
children?: React.ReactNode;
|
|
89
|
+
options?: OptionType[];
|
|
90
|
+
defaultActiveFirstOption?: boolean;
|
|
91
|
+
virtual?: boolean;
|
|
92
|
+
listHeight?: number;
|
|
93
|
+
listItemHeight?: number;
|
|
94
|
+
menuItemSelectedIcon?: RenderNode;
|
|
95
|
+
mode?: 'combobox' | 'multiple' | 'tags';
|
|
96
|
+
labelInValue?: boolean;
|
|
97
|
+
value?: ValueType | null;
|
|
98
|
+
defaultValue?: ValueType | null;
|
|
99
|
+
onChange?: (value: ValueType, option: OptionType | OptionType[]) => void;
|
|
100
|
+
}
|
|
101
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
|
|
102
|
+
children?: React.ReactNode;
|
|
103
|
+
} & {
|
|
104
|
+
ref?: ((instance: BaseSelectRef | null) => void) | React.RefObject<BaseSelectRef> | null | undefined;
|
|
105
|
+
}) => React.ReactElement) & {
|
|
106
|
+
Option: typeof Option;
|
|
107
|
+
OptGroup: typeof OptGroup;
|
|
108
|
+
};
|
|
109
|
+
export default TypedSelect;
|