@aloudata/aloudata-design 0.1.0-beta1 → 0.2.0-beta.11
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/README.md +22 -13
- package/es/Button/index.d.ts +49 -0
- package/es/Button/index.js +107 -0
- package/es/Button/style/index.d.ts +2 -0
- package/es/Button/style/index.js +2 -0
- package/{src → es}/Button/style/index.less +29 -18
- package/es/Dropdown/Button.d.ts +69 -0
- package/es/Dropdown/Button.js +39 -0
- package/es/Dropdown/index.d.ts +59 -0
- package/es/Dropdown/index.js +32 -0
- package/es/Dropdown/style/index.d.ts +3 -0
- package/es/Dropdown/style/index.js +3 -0
- package/{src → es}/Dropdown/style/index.less +0 -0
- package/es/Empty/index.d.ts +7 -0
- package/es/Empty/index.js +56 -0
- package/es/Empty/style/index.d.ts +1 -0
- package/es/Empty/style/index.js +1 -0
- package/es/Empty/style/index.less +24 -0
- package/{src → es}/Icon/iconfont/demo.css +0 -0
- package/{src → es}/Icon/iconfont/demo_index.html +95 -3
- package/es/Icon/iconfont/iconfont.css +109 -0
- package/es/Icon/iconfont/iconfont.js +46 -0
- package/{src → es}/Icon/iconfont/iconfont.json +28 -0
- package/es/Icon/iconfont/iconfont.ttf +0 -0
- package/es/Icon/iconfont/iconfont.woff +0 -0
- package/es/Icon/iconfont/iconfont.woff2 +0 -0
- package/es/Icon/index.d.ts +11 -0
- package/es/Icon/index.js +44 -0
- package/{src → es}/Icon/index.less +3 -3
- package/es/Input/components/Group/index.d.ts +15 -0
- package/es/Input/components/Group/index.js +12 -0
- package/es/Input/components/Input/index.d.ts +61 -0
- package/es/Input/components/Input/index.js +37 -0
- package/es/Input/components/Password/index.d.ts +11 -0
- package/es/Input/components/Password/index.js +21 -0
- package/es/Input/components/TextArea/index.d.ts +58 -0
- package/es/Input/components/TextArea/index.js +24 -0
- package/es/Input/index.d.ts +16 -0
- package/es/Input/index.js +9 -0
- package/es/Input/style/index.d.ts +3 -0
- package/es/Input/style/index.js +3 -0
- package/{src → es}/Input/style/index.less +9 -4
- package/es/Menu/Divider.d.ts +4 -0
- package/es/Menu/Divider.js +14 -0
- package/es/Menu/MenuItem.d.ts +23 -0
- package/es/Menu/MenuItem.js +14 -0
- package/es/Menu/SubMenu.d.ts +25 -0
- package/es/Menu/SubMenu.js +28 -0
- package/es/Menu/index.d.ts +20 -0
- package/es/Menu/index.js +30 -0
- package/es/Menu/style/index.d.ts +3 -0
- package/es/Menu/style/index.js +3 -0
- package/{src → es}/Menu/style/index.less +4 -0
- package/es/Navigator/components/Menu/index.d.ts +19 -0
- package/es/Navigator/components/Menu/index.js +187 -0
- package/es/Navigator/index.d.ts +40 -0
- package/es/Navigator/index.js +44 -0
- package/es/Navigator/style/index.d.ts +2 -0
- package/es/Navigator/style/index.js +2 -0
- package/es/Navigator/style/index.less +228 -0
- package/es/Select/BaseSelect.d.ts +5 -0
- package/es/Select/BaseSelect.js +400 -0
- package/{src/Select/OptionsList/OptGroup.tsx → es/Select/OptionsList/OptGroup.d.ts} +2 -4
- package/es/Select/OptionsList/OptGroup.js +6 -0
- package/es/Select/OptionsList/OptionItem/RenderGroup.d.ts +9 -0
- package/es/Select/OptionsList/OptionItem/RenderGroup.js +16 -0
- package/es/Select/OptionsList/OptionItem/RenderLabelIcon.d.ts +8 -0
- package/es/Select/OptionsList/OptionItem/RenderLabelIcon.js +44 -0
- package/es/Select/OptionsList/OptionItem/RenderOption.d.ts +16 -0
- package/es/Select/OptionsList/OptionItem/RenderOption.js +79 -0
- package/es/Select/OptionsList/OptionItem/RenderTooltip.d.ts +8 -0
- package/es/Select/OptionsList/OptionItem/RenderTooltip.js +25 -0
- package/es/Select/OptionsList/OptionItem.d.ts +4 -0
- package/es/Select/OptionsList/OptionItem.js +4 -0
- package/es/Select/OptionsList/Options.d.ts +7 -0
- package/es/Select/OptionsList/Options.js +6 -0
- package/es/Select/OptionsList/index.d.ts +4 -0
- package/es/Select/OptionsList/index.js +187 -0
- package/es/Select/Selector/index.d.ts +4 -0
- package/es/Select/Selector/index.js +252 -0
- package/es/Select/VirtualList.d.ts +5 -0
- package/es/Select/VirtualList.js +29 -0
- package/es/Select/hooks/useCacheOption.d.ts +9 -0
- package/es/Select/hooks/useCacheOption.js +107 -0
- package/es/Select/index.d.ts +11 -0
- package/es/Select/index.js +8 -0
- package/es/Select/interface.d.ts +227 -0
- package/es/Select/interface.js +1 -0
- package/es/Select/style/index.d.ts +2 -0
- package/es/Select/style/index.js +2 -0
- package/{src → es}/Select/style/index.less +3 -10
- package/es/Select/utils.d.ts +21 -0
- package/es/Select/utils.js +193 -0
- package/es/Table/index.d.ts +4 -0
- package/es/Table/index.js +369 -0
- package/es/Table/interface.d.ts +35 -0
- package/es/Table/interface.js +1 -0
- package/es/Table/react-table-config.d.ts +122 -0
- package/es/Table/style/index.d.ts +2 -0
- package/es/Table/style/index.js +2 -0
- package/es/Table/style/index.less +175 -0
- package/es/Tabs/TabPane.d.ts +21 -0
- package/es/Tabs/TabPane.js +12 -0
- package/es/Tabs/index.d.ts +41 -0
- package/es/Tabs/index.js +43 -0
- package/es/Tabs/style/index.d.ts +3 -0
- package/es/Tabs/style/index.js +3 -0
- package/{src → es}/Tabs/style/index.less +0 -0
- package/es/Tooltip/index.d.ts +63 -0
- package/es/Tooltip/index.js +32 -0
- package/es/Tooltip/style/index.d.ts +2 -0
- package/es/Tooltip/style/index.js +2 -0
- package/{src → es}/Tooltip/style/index.less +0 -0
- package/es/_utils/hooks/useControlledState.d.ts +2 -0
- package/{lib/Button/demo/loading/index.js → es/_utils/hooks/useControlledState.js} +40 -37
- package/es/_utils/hooks/usePrefixCls.d.ts +2 -0
- package/es/_utils/hooks/usePrefixCls.js +14 -0
- package/es/index.d.ts +20 -0
- package/{src/index.ts → es/index.js} +3 -1
- package/es/style/index.d.ts +2 -0
- package/es/style/index.js +2 -0
- package/{src → es}/style/index.less +0 -0
- package/{lib/Button/demo/disable → es/style/mixins}/index.less +0 -0
- package/{src → es}/style/themes/default/index.less +2 -2
- package/{lib/style/themes/default/themeColor.less → es/style/themes/default/themeColor.module.less} +0 -0
- package/es/style/themes/default/themeColor.module.less.d.ts +108 -0
- package/lib/Button/index.d.ts +0 -1
- package/lib/Button/index.js +2 -4
- package/lib/Button/style/index.less +29 -18
- package/lib/Dropdown/Button.d.ts +1 -1
- package/lib/Dropdown/Button.js +2 -2
- package/lib/Dropdown/index.d.ts +1 -1
- package/lib/Dropdown/index.js +0 -2
- package/lib/Dropdown/style/index.d.ts +1 -0
- package/lib/Dropdown/style/index.js +2 -0
- package/lib/Empty/index.d.ts +7 -0
- package/lib/Empty/index.js +69 -0
- package/lib/Empty/style/index.d.ts +1 -0
- package/lib/Empty/style/index.js +3 -0
- package/lib/Empty/style/index.less +24 -0
- package/lib/Icon/iconfont/demo_index.html +95 -3
- package/lib/Icon/iconfont/iconfont.css +19 -3
- package/lib/Icon/iconfont/iconfont.js +5 -5
- package/lib/Icon/iconfont/iconfont.json +28 -0
- package/lib/Icon/iconfont/iconfont.ttf +0 -0
- package/lib/Icon/iconfont/iconfont.woff +0 -0
- package/lib/Icon/iconfont/iconfont.woff2 +0 -0
- package/lib/Icon/index.js +5 -3
- package/lib/Icon/index.less +3 -3
- package/lib/Input/components/Group/index.d.ts +2 -2
- package/lib/Input/components/Input/index.d.ts +61 -0
- package/lib/Input/components/Input/index.js +50 -0
- package/lib/Input/components/Password/index.d.ts +5 -4
- package/lib/Input/components/Password/index.js +10 -8
- package/lib/Input/components/TextArea/index.d.ts +10 -4
- package/lib/Input/components/TextArea/index.js +18 -7
- package/lib/Input/index.d.ts +14 -63
- package/lib/Input/index.js +4 -44
- package/lib/Input/style/index.d.ts +1 -0
- package/lib/Input/style/index.js +2 -0
- package/lib/Input/style/index.less +9 -4
- package/lib/Menu/Divider.d.ts +0 -1
- package/lib/Menu/Divider.js +0 -2
- package/lib/Menu/MenuItem.d.ts +7 -1
- package/lib/Menu/MenuItem.js +0 -2
- package/lib/Menu/SubMenu.d.ts +0 -1
- package/lib/Menu/SubMenu.js +0 -2
- package/lib/Menu/index.d.ts +1 -1
- package/lib/Menu/index.js +0 -2
- package/lib/Menu/style/index.d.ts +1 -0
- package/lib/Menu/style/index.js +2 -0
- package/lib/Menu/style/index.less +4 -0
- package/lib/Navigator/components/Menu/index.d.ts +19 -0
- package/lib/Navigator/components/Menu/index.js +205 -0
- package/lib/Navigator/index.d.ts +40 -0
- package/lib/Navigator/index.js +62 -0
- package/lib/Navigator/style/index.d.ts +2 -0
- package/lib/Navigator/style/index.js +5 -0
- package/lib/Navigator/style/index.less +228 -0
- package/lib/Select/OptionsList/OptionItem/RenderGroup.d.ts +9 -0
- package/lib/Select/OptionsList/OptionItem/RenderGroup.js +27 -0
- package/lib/Select/OptionsList/OptionItem/RenderLabelIcon.d.ts +8 -0
- package/lib/Select/OptionsList/OptionItem/RenderLabelIcon.js +58 -0
- package/lib/Select/OptionsList/OptionItem/RenderOption.d.ts +16 -0
- package/lib/Select/OptionsList/OptionItem/RenderOption.js +94 -0
- package/lib/Select/OptionsList/OptionItem/RenderTooltip.d.ts +8 -0
- package/lib/Select/OptionsList/OptionItem/RenderTooltip.js +37 -0
- package/lib/Select/OptionsList/OptionItem.d.ts +4 -35
- package/lib/Select/OptionsList/OptionItem.js +26 -172
- package/lib/Select/OptionsList/Options.d.ts +2 -2
- package/lib/Select/OptionsList/index.js +1 -1
- package/lib/Select/Selector/index.d.ts +2 -2
- package/lib/Select/Selector/index.js +13 -10
- package/lib/Select/index.d.ts +0 -1
- package/lib/Select/index.js +0 -2
- package/lib/Select/interface.d.ts +8 -2
- package/lib/Select/style/index.less +3 -10
- package/lib/Table/index.d.ts +4 -0
- package/lib/Table/index.js +394 -0
- package/lib/Table/interface.d.ts +35 -0
- package/lib/Table/interface.js +5 -0
- package/lib/Table/react-table-config.d.ts +122 -0
- package/lib/Table/style/index.d.ts +2 -0
- package/lib/Table/style/index.js +5 -0
- package/lib/Table/style/index.less +175 -0
- package/lib/Tabs/index.d.ts +1 -1
- package/lib/Tabs/index.js +4 -4
- package/lib/Tabs/style/index.d.ts +1 -0
- package/lib/Tabs/style/index.js +2 -0
- package/lib/Tooltip/index.d.ts +1 -1
- package/lib/Tooltip/index.js +3 -3
- package/lib/index.d.ts +12 -0
- package/lib/index.js +16 -0
- package/lib/style/index.d.ts +1 -1
- package/lib/style/index.js +1 -1
- package/lib/style/themes/default/index.less +2 -2
- package/{src/style/themes/default/themeColor.less → lib/style/themes/default/themeColor.module.less} +0 -0
- package/lib/style/themes/default/themeColor.module.less.d.ts +108 -0
- package/package.json +33 -8
- package/.editorconfig +0 -16
- package/.eslintrc.js +0 -43
- package/.fatherrc.ts +0 -16
- package/.prettierignore +0 -7
- package/.prettierrc.js +0 -1
- package/.stylelintrc.json +0 -36
- package/.umirc.ts +0 -15
- package/commitlint.config.js +0 -21
- package/docs/index.md +0 -21
- package/jest/setupTests.js +0 -1
- package/lib/Button/demo/Icon/index.d.ts +0 -3
- package/lib/Button/demo/Icon/index.js +0 -82
- package/lib/Button/demo/Icon/index.less +0 -6
- package/lib/Button/demo/basic/index.d.ts +0 -4
- package/lib/Button/demo/basic/index.js +0 -73
- package/lib/Button/demo/basic/index.less +0 -7
- package/lib/Button/demo/disable/index.d.ts +0 -3
- package/lib/Button/demo/disable/index.js +0 -37
- package/lib/Button/demo/href/index.d.ts +0 -2
- package/lib/Button/demo/href/index.js +0 -30
- package/lib/Button/demo/loading/index.d.ts +0 -3
- package/lib/Button/demo/loading/index.less +0 -6
- package/lib/Dropdown/demo/basic/index.d.ts +0 -4
- package/lib/Dropdown/demo/basic/index.js +0 -35
- package/lib/Dropdown/demo/button/index.d.ts +0 -3
- package/lib/Dropdown/demo/button/index.js +0 -182
- package/lib/Dropdown/demo/button/index.less +0 -9
- package/lib/Dropdown/demo/placement/index.d.ts +0 -2
- package/lib/Dropdown/demo/placement/index.js +0 -56
- package/lib/Dropdown/demo/subMenu/index.d.ts +0 -2
- package/lib/Dropdown/demo/subMenu/index.js +0 -59
- package/lib/Dropdown/demo/trigger/index.d.ts +0 -2
- package/lib/Dropdown/demo/trigger/index.js +0 -32
- package/lib/Input/demo/allowClear/index.d.ts +0 -3
- package/lib/Input/demo/allowClear/index.js +0 -25
- package/lib/Input/demo/allowClear/index.less +0 -0
- package/lib/Input/demo/basic/index.d.ts +0 -4
- package/lib/Input/demo/basic/index.js +0 -80
- package/lib/Input/demo/basic/index.less +0 -6
- package/lib/Input/demo/gourp/index.d.ts +0 -2
- package/lib/Input/demo/gourp/index.js +0 -81
- package/lib/Input/demo/password/index.d.ts +0 -3
- package/lib/Input/demo/password/index.js +0 -35
- package/lib/Input/demo/password/index.less +0 -0
- package/lib/Input/demo/prefix/index.d.ts +0 -3
- package/lib/Input/demo/prefix/index.js +0 -32
- package/lib/Input/demo/prefix/index.less +0 -0
- package/lib/Input/demo/showCount/index.d.ts +0 -3
- package/lib/Input/demo/showCount/index.js +0 -31
- package/lib/Input/demo/showCount/index.less +0 -0
- package/lib/Input/demo/textArea/autoSize.d.ts +0 -2
- package/lib/Input/demo/textArea/autoSize.js +0 -63
- package/lib/Select/demo/disabled/index.d.ts +0 -2
- package/lib/Select/demo/disabled/index.js +0 -64
- package/lib/Select/demo/multiple/index.d.ts +0 -2
- package/lib/Select/demo/multiple/index.js +0 -154
- package/lib/Select/demo/options/index.d.ts +0 -2
- package/lib/Select/demo/options/index.js +0 -69
- package/lib/Select/demo/single/index.d.ts +0 -2
- package/lib/Select/demo/single/index.js +0 -99
- package/lib/Tabs/demo/adaptHeight/index.d.ts +0 -3
- package/lib/Tabs/demo/adaptHeight/index.js +0 -34
- package/lib/Tabs/demo/adaptHeight/index.less +0 -3
- package/lib/Tabs/demo/basic/index.d.ts +0 -4
- package/lib/Tabs/demo/basic/index.js +0 -67
- package/lib/Tabs/demo/basic/index.less +0 -5
- package/lib/Tabs/demo/horizontalScroll/index.d.ts +0 -3
- package/lib/Tabs/demo/horizontalScroll/index.js +0 -45
- package/lib/Tabs/demo/horizontalScroll/index.less +0 -3
- package/lib/Tooltip/demo/basic/index.d.ts +0 -2
- package/lib/Tooltip/demo/basic/index.js +0 -20
- package/lib/Tooltip/demo/overflow/index.d.ts +0 -2
- package/lib/Tooltip/demo/overflow/index.js +0 -20
- package/lib/Tooltip/demo/placement/index.d.ts +0 -6
- package/lib/Tooltip/demo/placement/index.js +0 -86
- package/lib/Tooltip/demo/placement/index.less +0 -7
- package/lib/Tooltip/demo/trigger/index.d.ts +0 -3
- package/lib/Tooltip/demo/trigger/index.js +0 -34
- package/lib/Tooltip/demo/trigger/index.less +0 -5
- package/public/favicon.ico +0 -0
- package/src/Button/demo/Icon/index.less +0 -6
- package/src/Button/demo/Icon/index.tsx +0 -41
- package/src/Button/demo/basic/index.less +0 -7
- package/src/Button/demo/basic/index.tsx +0 -26
- package/src/Button/demo/disable/index.less +0 -0
- package/src/Button/demo/disable/index.tsx +0 -16
- package/src/Button/demo/href/index.tsx +0 -14
- package/src/Button/demo/loading/index.less +0 -6
- package/src/Button/demo/loading/index.tsx +0 -21
- package/src/Button/index.md +0 -25
- package/src/Button/index.test.tsx +0 -58
- package/src/Button/index.tsx +0 -136
- package/src/Button/style/index.ts +0 -2
- package/src/Dropdown/Button.tsx +0 -93
- package/src/Dropdown/demo/basic/index.tsx +0 -20
- package/src/Dropdown/demo/button/index.less +0 -9
- package/src/Dropdown/demo/button/index.tsx +0 -98
- package/src/Dropdown/demo/placement/index.tsx +0 -47
- package/src/Dropdown/demo/subMenu/index.tsx +0 -35
- package/src/Dropdown/demo/trigger/index.tsx +0 -19
- package/src/Dropdown/index.md +0 -35
- package/src/Dropdown/index.test.tsx +0 -185
- package/src/Dropdown/index.tsx +0 -71
- package/src/Dropdown/style/index.ts +0 -2
- package/src/Icon/iconfont/iconfont.css +0 -93
- package/src/Icon/iconfont/iconfont.js +0 -1
- package/src/Icon/iconfont/iconfont.ttf +0 -0
- package/src/Icon/iconfont/iconfont.woff +0 -0
- package/src/Icon/iconfont/iconfont.woff2 +0 -0
- package/src/Icon/index.tsx +0 -38
- package/src/Input/components/Group/index.tsx +0 -21
- package/src/Input/components/Password/index.tsx +0 -23
- package/src/Input/components/TextArea/index.tsx +0 -57
- package/src/Input/demo/allowClear/index.less +0 -0
- package/src/Input/demo/allowClear/index.tsx +0 -10
- package/src/Input/demo/basic/index.less +0 -6
- package/src/Input/demo/basic/index.tsx +0 -25
- package/src/Input/demo/gourp/index.tsx +0 -30
- package/src/Input/demo/password/index.less +0 -0
- package/src/Input/demo/password/index.tsx +0 -11
- package/src/Input/demo/prefix/index.less +0 -0
- package/src/Input/demo/prefix/index.tsx +0 -13
- package/src/Input/demo/showCount/index.less +0 -0
- package/src/Input/demo/showCount/index.tsx +0 -16
- package/src/Input/demo/textArea/autoSize.tsx +0 -21
- package/src/Input/index.md +0 -37
- package/src/Input/index.test.tsx +0 -78
- package/src/Input/index.tsx +0 -91
- package/src/Input/style/index.ts +0 -2
- package/src/Menu/Divider.tsx +0 -12
- package/src/Menu/MenuItem.tsx +0 -24
- package/src/Menu/SubMenu.tsx +0 -37
- package/src/Menu/index.md +0 -36
- package/src/Menu/index.test.tsx +0 -144
- package/src/Menu/index.tsx +0 -27
- package/src/Menu/style/index.ts +0 -2
- package/src/Select/BaseSelect.tsx +0 -321
- package/src/Select/OptionsList/OptionItem.tsx +0 -151
- package/src/Select/OptionsList/Options.tsx +0 -11
- package/src/Select/OptionsList/index.tsx +0 -169
- package/src/Select/Selector/index.tsx +0 -211
- package/src/Select/VirtualList.tsx +0 -36
- package/src/Select/demo/disabled/index.tsx +0 -44
- package/src/Select/demo/multiple/index.tsx +0 -77
- package/src/Select/demo/options/index.tsx +0 -63
- package/src/Select/demo/single/index.tsx +0 -50
- package/src/Select/hooks/useCacheOption.ts +0 -67
- package/src/Select/index.md +0 -72
- package/src/Select/index.tsx +0 -23
- package/src/Select/interface.ts +0 -231
- package/src/Select/style/index.ts +0 -2
- package/src/Select/utils.tsx +0 -133
- package/src/Tabs/TabPane.tsx +0 -28
- package/src/Tabs/demo/adaptHeight/index.less +0 -3
- package/src/Tabs/demo/adaptHeight/index.tsx +0 -33
- package/src/Tabs/demo/basic/index.less +0 -5
- package/src/Tabs/demo/basic/index.tsx +0 -30
- package/src/Tabs/demo/horizontalScroll/index.less +0 -3
- package/src/Tabs/demo/horizontalScroll/index.tsx +0 -36
- package/src/Tabs/index.md +0 -30
- package/src/Tabs/index.test.tsx +0 -100
- package/src/Tabs/index.tsx +0 -64
- package/src/Tabs/style/index.ts +0 -2
- package/src/Tooltip/demo/basic/index.tsx +0 -10
- package/src/Tooltip/demo/overflow/index.tsx +0 -10
- package/src/Tooltip/demo/placement/index.less +0 -7
- package/src/Tooltip/demo/placement/index.tsx +0 -60
- package/src/Tooltip/demo/trigger/index.less +0 -5
- package/src/Tooltip/demo/trigger/index.tsx +0 -22
- package/src/Tooltip/index.md +0 -28
- package/src/Tooltip/index.test.tsx +0 -152
- package/src/Tooltip/index.tsx +0 -113
- package/src/Tooltip/style/index.ts +0 -2
- package/src/_utils/hooks/useControlledState.ts +0 -39
- package/src/_utils/hooks/usePrefixCls.ts +0 -11
- package/src/style/index.ts +0 -2
- package/src/style/mixins/index.less +0 -0
- package/tsconfig.json +0 -13
- package/typings.d.ts +0 -3
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
var _excluded = ["input", "disabled", "prefix", "size", "multiple", "bordered", "isFocused", "className", "visible", "style", "allowClear", "label", "mode", "value", "searchType", "arrowComponent", "closeComponent", "placeholder", "deleteValue", "optionLabelRenderer", "getOptionByValue", "onInputChange", "onAllowClear", "filteredOptions"];
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
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
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
30
|
+
|
|
31
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
|
+
|
|
33
|
+
import Icon from '../../Icon';
|
|
34
|
+
import classnames from 'classnames';
|
|
35
|
+
import { isEmpty, isNil } from 'lodash';
|
|
36
|
+
import React, { useRef, useState, useImperativeHandle, useMemo } from 'react';
|
|
37
|
+
import Tooltip from '../../Tooltip';
|
|
38
|
+
import OverFLow from 'rc-overflow';
|
|
39
|
+
import color from '../../style/themes/default/themeColor.module.less';
|
|
40
|
+
var ZERO = 0;
|
|
41
|
+
var ICON_LARGE_SIZE = 20;
|
|
42
|
+
var ICON_SMALL_SIZE = 16;
|
|
43
|
+
|
|
44
|
+
var defaultArrowComponent = function defaultArrowComponent(prefix, size) {
|
|
45
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
46
|
+
className: "".concat(prefix, "-icon-arrow"),
|
|
47
|
+
size: size === 'large' ? ICON_LARGE_SIZE : ICON_SMALL_SIZE,
|
|
48
|
+
type: "expand_more1",
|
|
49
|
+
color: color.NL40
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var defaultCloseComponent = function defaultCloseComponent(prefix, size) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
55
|
+
className: "".concat(prefix, "-icon-close"),
|
|
56
|
+
size: size === 'large' ? ICON_LARGE_SIZE : ICON_SMALL_SIZE,
|
|
57
|
+
type: "cancel",
|
|
58
|
+
color: color.NL40
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var Selector = function Selector(props, ref) {
|
|
63
|
+
var _classnames;
|
|
64
|
+
|
|
65
|
+
var input = props.input,
|
|
66
|
+
disabled = props.disabled,
|
|
67
|
+
prefix = props.prefix,
|
|
68
|
+
size = props.size,
|
|
69
|
+
multiple = props.multiple,
|
|
70
|
+
bordered = props.bordered,
|
|
71
|
+
isFocused = props.isFocused,
|
|
72
|
+
className = props.className,
|
|
73
|
+
visible = props.visible,
|
|
74
|
+
style = props.style,
|
|
75
|
+
allowClear = props.allowClear,
|
|
76
|
+
label = props.label,
|
|
77
|
+
mode = props.mode,
|
|
78
|
+
value = props.value,
|
|
79
|
+
searchType = props.searchType,
|
|
80
|
+
arrowComponent = props.arrowComponent,
|
|
81
|
+
closeComponent = props.closeComponent,
|
|
82
|
+
placeholder = props.placeholder,
|
|
83
|
+
deleteValue = props.deleteValue,
|
|
84
|
+
optionLabelRenderer = props.optionLabelRenderer,
|
|
85
|
+
getOptionByValue = props.getOptionByValue,
|
|
86
|
+
onInputChange = props.onInputChange,
|
|
87
|
+
onAllowClear = props.onAllowClear,
|
|
88
|
+
filteredOptions = props.filteredOptions,
|
|
89
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
90
|
+
|
|
91
|
+
var inputRef = useRef(null);
|
|
92
|
+
var selectorRef = useRef(null);
|
|
93
|
+
var selectorAllRef = useRef(null);
|
|
94
|
+
var selectValuesRef = useRef(null);
|
|
95
|
+
|
|
96
|
+
var _useState = useState(false),
|
|
97
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
98
|
+
isHovered = _useState2[0],
|
|
99
|
+
setIsHovered = _useState2[1];
|
|
100
|
+
|
|
101
|
+
var isEmptyValue = useMemo(function () {
|
|
102
|
+
return !isEmpty(value);
|
|
103
|
+
}, [value]);
|
|
104
|
+
var showClose = allowClear && (isEmptyValue || input) && isHovered && !disabled;
|
|
105
|
+
useImperativeHandle(ref, function () {
|
|
106
|
+
var _selectorRef$current;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
clientWidth: selectorRef === null || selectorRef === void 0 ? void 0 : (_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.clientWidth,
|
|
110
|
+
focus: function focus() {
|
|
111
|
+
var _inputRef$current;
|
|
112
|
+
|
|
113
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
114
|
+
},
|
|
115
|
+
blur: function blur() {
|
|
116
|
+
var _inputRef$current2;
|
|
117
|
+
|
|
118
|
+
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.blur();
|
|
119
|
+
},
|
|
120
|
+
onBlur: function onBlur() {
|
|
121
|
+
var _selectorRef$current2;
|
|
122
|
+
|
|
123
|
+
selectorRef === null || selectorRef === void 0 ? void 0 : (_selectorRef$current2 = selectorRef.current) === null || _selectorRef$current2 === void 0 ? void 0 : _selectorRef$current2.blur();
|
|
124
|
+
},
|
|
125
|
+
onFocus: function onFocus() {
|
|
126
|
+
var _selectorRef$current3;
|
|
127
|
+
|
|
128
|
+
selectorRef === null || selectorRef === void 0 ? void 0 : (_selectorRef$current3 = selectorRef.current) === null || _selectorRef$current3 === void 0 ? void 0 : _selectorRef$current3.focus();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var onMouseEnter = function onMouseEnter() {
|
|
134
|
+
if (allowClear) {
|
|
135
|
+
setIsHovered(true);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
var onMouseLeave = function onMouseLeave() {
|
|
140
|
+
if (allowClear) {
|
|
141
|
+
setIsHovered(false);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var onAllClearClick = function onAllClearClick(e) {
|
|
146
|
+
e.stopPropagation();
|
|
147
|
+
|
|
148
|
+
if (allowClear) {
|
|
149
|
+
onAllowClear();
|
|
150
|
+
}
|
|
151
|
+
}; // ========================== render =======================
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
var renderPlaceHolder = function renderPlaceHolder() {
|
|
155
|
+
if (isEmpty(value) && !input && placeholder) {
|
|
156
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
157
|
+
className: "".concat(prefix, "-item ").concat(prefix, "-placeholder")
|
|
158
|
+
}, placeholder);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return null;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
var renderMultipleValue = function renderMultipleValue() {
|
|
165
|
+
// @ts-ignore
|
|
166
|
+
var allValueLabel = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
|
|
167
|
+
var item = getOptionByValue(curr);
|
|
168
|
+
|
|
169
|
+
if (item) {
|
|
170
|
+
return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.label)]);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return [].concat(_toConsumableArray(prev), [curr]);
|
|
174
|
+
}, []);
|
|
175
|
+
|
|
176
|
+
if (Array.isArray(value) && value.length === filteredOptions.length) {
|
|
177
|
+
return /*#__PURE__*/React.createElement("span", null, "\u5168\u90E8");
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
var renderItem = function renderItem(valueItem) {
|
|
181
|
+
return /*#__PURE__*/React.createElement("span", null, optionLabelRenderer(valueItem, getOptionByValue(valueItem)));
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
var renderRest = function renderRest(valueItems) {
|
|
185
|
+
return /*#__PURE__*/React.createElement("span", null, "\u7B49", valueItems.length, "\u9879");
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
return !input && !isNil(value) ? /*#__PURE__*/React.createElement(Tooltip // @ts-ignore
|
|
189
|
+
, {
|
|
190
|
+
// @ts-ignore
|
|
191
|
+
title: allValueLabel === null || allValueLabel === void 0 ? void 0 : allValueLabel.join(','),
|
|
192
|
+
placement: "top",
|
|
193
|
+
getTooltipContainer: function getTooltipContainer() {
|
|
194
|
+
var _selectorRef$current4;
|
|
195
|
+
|
|
196
|
+
return (selectorRef === null || selectorRef === void 0 ? void 0 : (_selectorRef$current4 = selectorRef.current) === null || _selectorRef$current4 === void 0 ? void 0 : _selectorRef$current4.parentElement) || document.body;
|
|
197
|
+
}
|
|
198
|
+
}, /*#__PURE__*/React.createElement(OverFLow, {
|
|
199
|
+
className: "".concat(prefix, "-item-all"),
|
|
200
|
+
prefixCls: "".concat(prefix, "-overflow"),
|
|
201
|
+
data: value,
|
|
202
|
+
renderItem: renderItem,
|
|
203
|
+
renderRest: renderRest,
|
|
204
|
+
maxCount: "responsive"
|
|
205
|
+
})) : null;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
var renderSingleValue = function renderSingleValue() {
|
|
209
|
+
var text = optionLabelRenderer(value, getOptionByValue(value));
|
|
210
|
+
return !input && (typeof value === 'string' || typeof value === 'number') ?
|
|
211
|
+
/*#__PURE__*/
|
|
212
|
+
// <Text>
|
|
213
|
+
React.createElement("div", {
|
|
214
|
+
className: classnames("".concat(prefix, "-item"))
|
|
215
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
216
|
+
ref: selectorAllRef,
|
|
217
|
+
className: classnames("".concat(prefix, "-item-text"))
|
|
218
|
+
}, text)) // </Text>
|
|
219
|
+
: null;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return /*#__PURE__*/React.createElement("div", _objectSpread({
|
|
223
|
+
role: disabled ? undefined : 'combobox',
|
|
224
|
+
"aria-expanded": visible,
|
|
225
|
+
"aria-controls": "expandable",
|
|
226
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
227
|
+
tabIndex: ZERO,
|
|
228
|
+
className: classnames("".concat(prefix), "".concat(prefix, "-").concat(size), (_classnames = {}, _defineProperty(_classnames, "".concat(prefix, "-single"), !multiple), _defineProperty(_classnames, "".concat(prefix, "-bordered"), bordered), _defineProperty(_classnames, "".concat(prefix, "-focused"), isFocused), _defineProperty(_classnames, "".concat(prefix, "-disabled"), disabled), _classnames), className),
|
|
229
|
+
"aria-disabled": disabled,
|
|
230
|
+
"aria-hidden": "true",
|
|
231
|
+
style: style,
|
|
232
|
+
ref: selectorRef
|
|
233
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
234
|
+
className: "".concat(prefix, "-selector-wrap"),
|
|
235
|
+
onMouseEnter: onMouseEnter,
|
|
236
|
+
onMouseLeave: onMouseLeave
|
|
237
|
+
}, label && /*#__PURE__*/React.createElement("div", {
|
|
238
|
+
className: "".concat(prefix, "-selector-label")
|
|
239
|
+
}, label), /*#__PURE__*/React.createElement("div", {
|
|
240
|
+
className: "".concat(prefix, "-selector")
|
|
241
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: classnames("".concat(prefix, "-values-wrapper")),
|
|
243
|
+
ref: selectValuesRef
|
|
244
|
+
}, multiple ? renderMultipleValue() : renderSingleValue(), renderPlaceHolder())), /*#__PURE__*/React.createElement("div", {
|
|
245
|
+
"aria-hidden": "true",
|
|
246
|
+
className: classnames("".concat(prefix, "-arrow"), _defineProperty({}, "".concat(prefix, "-arrow-focused"), visible)),
|
|
247
|
+
onClick: showClose ? onAllClearClick : undefined
|
|
248
|
+
}, showClose ? closeComponent || defaultCloseComponent(prefix, size) : arrowComponent || defaultArrowComponent(prefix, size))));
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
var ForwardSelector = /*#__PURE__*/React.forwardRef(Selector);
|
|
252
|
+
export default ForwardSelector;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ListRef, ListProps } from 'rc-virtual-list';
|
|
3
|
+
import { IOption } from './interface';
|
|
4
|
+
declare const RefVirtualList: React.ForwardRefExoticComponent<ListProps<IOption> & React.RefAttributes<ListRef>>;
|
|
5
|
+
export default RefVirtualList;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import List from 'rc-virtual-list';
|
|
3
|
+
var defaultListRowHeight = 44;
|
|
4
|
+
var defaultListHeight = 520;
|
|
5
|
+
|
|
6
|
+
var VirtualList = function VirtualList(props, ref) {
|
|
7
|
+
var _props$itemHeight = props.itemHeight,
|
|
8
|
+
itemHeight = _props$itemHeight === void 0 ? defaultListRowHeight : _props$itemHeight,
|
|
9
|
+
_props$height = props.height,
|
|
10
|
+
height = _props$height === void 0 ? defaultListHeight : _props$height,
|
|
11
|
+
prefixCls = props.prefixCls,
|
|
12
|
+
children = props.children,
|
|
13
|
+
data = props.data,
|
|
14
|
+
virtual = props.virtual,
|
|
15
|
+
itemKey = props.itemKey;
|
|
16
|
+
return /*#__PURE__*/React.createElement(List, {
|
|
17
|
+
itemKey: itemKey,
|
|
18
|
+
ref: ref,
|
|
19
|
+
itemHeight: itemHeight,
|
|
20
|
+
height: height,
|
|
21
|
+
data: data,
|
|
22
|
+
virtual: virtual,
|
|
23
|
+
prefixCls: "".concat(prefixCls, "-virtual-list"),
|
|
24
|
+
fullHeight: false
|
|
25
|
+
}, children);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var RefVirtualList = /*#__PURE__*/React.forwardRef(VirtualList);
|
|
29
|
+
export default RefVirtualList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TMaybeArray, IOption } from '../interface';
|
|
2
|
+
export default function useCacheOptions(): {
|
|
3
|
+
setCacheOptions: (options: IOption[]) => void;
|
|
4
|
+
getOptionByValue: (optValue: string | number) => IOption;
|
|
5
|
+
getOptionsByValue: (optValue: TMaybeArray<string | number>) => TMaybeArray<IOption>;
|
|
6
|
+
updateGroup: (value: boolean) => void;
|
|
7
|
+
cacheOptionsMap: Map<any, any>;
|
|
8
|
+
hasGroup: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var _excluded = ["options"];
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
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."); }
|
|
6
|
+
|
|
7
|
+
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); }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
26
|
+
import { useCallback, useRef, useState } from 'react';
|
|
27
|
+
|
|
28
|
+
var optionSet = function optionSet(map, key, value) {
|
|
29
|
+
map.set(key, value);
|
|
30
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var groupOptionSet = function groupOptionSet(map, key, option) {
|
|
34
|
+
if (map.get(key)) {
|
|
35
|
+
var _map$get = map.get(key),
|
|
36
|
+
_map$get$options = _map$get.options,
|
|
37
|
+
groupOptions = _map$get$options === void 0 ? new Map() : _map$get$options,
|
|
38
|
+
rest = _objectWithoutProperties(_map$get, _excluded);
|
|
39
|
+
|
|
40
|
+
map.set(key, _objectSpread({
|
|
41
|
+
options: groupOptions.set(option.value, option)
|
|
42
|
+
}, rest));
|
|
43
|
+
} else {
|
|
44
|
+
map.set(key, {
|
|
45
|
+
label: option.groupLabel,
|
|
46
|
+
value: option.groupValue,
|
|
47
|
+
isSelectOptGroup: true,
|
|
48
|
+
options: new Map([[option.value, option]])
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
map.set(option.value, option);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default function useCacheOptions() {
|
|
56
|
+
var cacheOptions = useRef(new Map());
|
|
57
|
+
var cacheOptionsMap = cacheOptions.current;
|
|
58
|
+
|
|
59
|
+
var _useState = useState(false),
|
|
60
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
61
|
+
isGroup = _useState2[0],
|
|
62
|
+
setIsGroup = _useState2[1];
|
|
63
|
+
|
|
64
|
+
var setCacheOptions = function setCacheOptions(options) {
|
|
65
|
+
if (!isGroup) {
|
|
66
|
+
options.forEach(function (option) {
|
|
67
|
+
return optionSet(cacheOptionsMap, option.value, option);
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
options.forEach(function (option) {
|
|
71
|
+
return groupOptionSet(cacheOptionsMap, option.groupValue, option);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var updateGroup = function updateGroup(value) {
|
|
77
|
+
if (value !== isGroup) {
|
|
78
|
+
setIsGroup(value);
|
|
79
|
+
}
|
|
80
|
+
}; // value to option || options
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var getOptionByValue = useCallback(function (optValue) {
|
|
84
|
+
return cacheOptionsMap.get(optValue);
|
|
85
|
+
}, [cacheOptionsMap]);
|
|
86
|
+
|
|
87
|
+
var getOptionsByValue = function getOptionsByValue(optValue) {
|
|
88
|
+
return Array.isArray(optValue) ? optValue.reduce(function (prev, v) {
|
|
89
|
+
var op = getOptionByValue(v);
|
|
90
|
+
|
|
91
|
+
if (op) {
|
|
92
|
+
prev.push(op);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return prev;
|
|
96
|
+
}, []) : getOptionByValue(optValue);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
setCacheOptions: setCacheOptions,
|
|
101
|
+
getOptionByValue: getOptionByValue,
|
|
102
|
+
getOptionsByValue: getOptionsByValue,
|
|
103
|
+
updateGroup: updateGroup,
|
|
104
|
+
cacheOptionsMap: cacheOptionsMap,
|
|
105
|
+
hasGroup: isGroup
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import BaseSelect from './BaseSelect';
|
|
2
|
+
import { IOption as Option, ISelectProps as SelectProps, IOptGroupProps as OptGroupProps, IOptionProps as OptionProps } from './interface';
|
|
3
|
+
import Options from './OptionsList/Options';
|
|
4
|
+
import OptGroup from './OptionsList/OptGroup';
|
|
5
|
+
export declare type TSelect = typeof BaseSelect & {
|
|
6
|
+
Group: typeof OptGroup;
|
|
7
|
+
Option: typeof Options;
|
|
8
|
+
};
|
|
9
|
+
declare const Select: TSelect;
|
|
10
|
+
export { Options as Option, OptGroup as Group, SelectProps, OptionProps, Option as SelectOptions, OptGroupProps as GroupProps, };
|
|
11
|
+
export default Select;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import BaseSelect from './BaseSelect';
|
|
2
|
+
import Options from './OptionsList/Options';
|
|
3
|
+
import OptGroup from './OptionsList/OptGroup';
|
|
4
|
+
var Select = BaseSelect;
|
|
5
|
+
Select.Option = Options;
|
|
6
|
+
Select.Group = OptGroup;
|
|
7
|
+
export { Options as Option, OptGroup as Group };
|
|
8
|
+
export default Select;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare type TSize = 'small' | 'default' | 'large';
|
|
4
|
+
export declare type TMaybeArray<T> = T | T[];
|
|
5
|
+
export declare type modeType = 'string' | 'tags' | undefined;
|
|
6
|
+
export declare type searchType = 'normal' | 'inner' | 'no-search';
|
|
7
|
+
export interface IOption {
|
|
8
|
+
/**
|
|
9
|
+
列表单项主要文字
|
|
10
|
+
*/
|
|
11
|
+
label?: string | React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
作为列表的 `key` 来使用
|
|
14
|
+
*/
|
|
15
|
+
value: string | number;
|
|
16
|
+
/**
|
|
17
|
+
列表次要文字
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
是否禁用
|
|
21
|
+
*/
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 选中该 Option 后,Select 的 title
|
|
25
|
+
*/
|
|
26
|
+
title?: string;
|
|
27
|
+
/**
|
|
28
|
+
`tooltip` 描述
|
|
29
|
+
*/
|
|
30
|
+
tooltip?: string;
|
|
31
|
+
/**
|
|
32
|
+
分组的 `key` ,与 `groupLabel` 一起使用
|
|
33
|
+
*/
|
|
34
|
+
groupValue?: string;
|
|
35
|
+
/**
|
|
36
|
+
分组的标题
|
|
37
|
+
*/
|
|
38
|
+
groupLabel?: string;
|
|
39
|
+
options?: Map<string | number, IOption>;
|
|
40
|
+
isSelectOptGroup?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface IOptGroupProps {
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
label: string | React.ReactNode;
|
|
45
|
+
value: string | number;
|
|
46
|
+
}
|
|
47
|
+
export interface IOptionProps {
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* @description 默认根据次属性值进行筛选
|
|
51
|
+
*/
|
|
52
|
+
value: string | number;
|
|
53
|
+
/**
|
|
54
|
+
* @description 是否禁用
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
title?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ISelectProps {
|
|
61
|
+
/**
|
|
62
|
+
* @description 输入框尺寸
|
|
63
|
+
* @default default
|
|
64
|
+
* @type 'small' | 'default' | 'large';
|
|
65
|
+
*/
|
|
66
|
+
size?: TSize;
|
|
67
|
+
customizePrefixCls?: string;
|
|
68
|
+
/**
|
|
69
|
+
* @description 多选模式
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
multiple?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* @description 选择框默认文本
|
|
75
|
+
*/
|
|
76
|
+
placeholder?: string;
|
|
77
|
+
/**
|
|
78
|
+
* @description 是否禁用
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
disabled?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* @description 是否默认展开下拉菜单
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
defaultOpen?: boolean;
|
|
87
|
+
className?: string;
|
|
88
|
+
/**
|
|
89
|
+
* @description 下拉菜单的 className 属性
|
|
90
|
+
*/
|
|
91
|
+
dropDownClassName?: string;
|
|
92
|
+
style?: React.CSSProperties;
|
|
93
|
+
groupStyle?: React.CSSProperties;
|
|
94
|
+
optionStyle?: React.CSSProperties;
|
|
95
|
+
/**
|
|
96
|
+
* @description 下拉菜单的 style 属性
|
|
97
|
+
*/
|
|
98
|
+
dropDownStyle?: React.CSSProperties;
|
|
99
|
+
/**
|
|
100
|
+
* @description 指定默认选中的条目
|
|
101
|
+
*/
|
|
102
|
+
defaultValue?: TMaybeArray<string | number> | null;
|
|
103
|
+
/**
|
|
104
|
+
* @description 指定当前选中的条目,多选时为一个数组。
|
|
105
|
+
*/
|
|
106
|
+
value?: TMaybeArray<string | number> | null;
|
|
107
|
+
/**
|
|
108
|
+
* @description 数据化配置选项内容,相比 jsx 定义会获得更好的渲染性能
|
|
109
|
+
*/
|
|
110
|
+
options?: IOption[];
|
|
111
|
+
/**
|
|
112
|
+
* @description 设置弹窗滚动高度
|
|
113
|
+
* @default 256
|
|
114
|
+
*/
|
|
115
|
+
listHeight?: number;
|
|
116
|
+
listRowHeight?: number;
|
|
117
|
+
labelRenderer?: (input: string) => (option: IOption, isGroup: boolean) => React.ReactNode;
|
|
118
|
+
searchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
|
|
119
|
+
matchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
|
|
120
|
+
optionLabelRenderer?: (value: string | number, option?: IOption) => React.ReactNode;
|
|
121
|
+
/**
|
|
122
|
+
* @description 选中值改变时的回调
|
|
123
|
+
*/
|
|
124
|
+
onChange?: (value: TMaybeArray<string | number> | null, options?: TMaybeArray<IOption> | null) => void;
|
|
125
|
+
/**
|
|
126
|
+
* @description 被选中时调用,参数为选中项的 value
|
|
127
|
+
*/
|
|
128
|
+
onSelect?: (value: string | number, option: IOption) => void;
|
|
129
|
+
/**
|
|
130
|
+
* @description 开启清除功能
|
|
131
|
+
*/
|
|
132
|
+
allowClear?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* @description 清除的回调
|
|
135
|
+
*/
|
|
136
|
+
onClear?: () => void;
|
|
137
|
+
/**
|
|
138
|
+
* 浮层渲染父节点,默认渲染到 body 上
|
|
139
|
+
*/
|
|
140
|
+
getContainer?: (node: HTMLElement) => HTMLElement;
|
|
141
|
+
/**
|
|
142
|
+
* @description 是否展开下拉菜单
|
|
143
|
+
*/
|
|
144
|
+
open?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* dropdown visible 值改变时的回调
|
|
147
|
+
*/
|
|
148
|
+
onDropDownVisibleChange?: (visible: boolean) => void;
|
|
149
|
+
/** *
|
|
150
|
+
* @description 下拉菜单和选择器同宽
|
|
151
|
+
* @default true
|
|
152
|
+
*/
|
|
153
|
+
dropdownMatchSelectWidth?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* @description 下拉菜单内置标签
|
|
156
|
+
*/
|
|
157
|
+
label?: React.ReactNode;
|
|
158
|
+
children?: React.ReactNode[] | React.ReactNode;
|
|
159
|
+
}
|
|
160
|
+
export interface ISelectorProps {
|
|
161
|
+
input: string;
|
|
162
|
+
disabled: boolean;
|
|
163
|
+
prefix: string;
|
|
164
|
+
size: 'small' | 'default' | 'large';
|
|
165
|
+
multiple: boolean;
|
|
166
|
+
bordered: boolean;
|
|
167
|
+
isFocused: boolean;
|
|
168
|
+
className?: string | undefined;
|
|
169
|
+
visible: boolean;
|
|
170
|
+
style?: React.CSSProperties | undefined;
|
|
171
|
+
allowClear: boolean;
|
|
172
|
+
mode?: modeType;
|
|
173
|
+
label?: React.ReactNode;
|
|
174
|
+
value?: TMaybeArray<string | number> | undefined | null;
|
|
175
|
+
filteredOptions: IOption[];
|
|
176
|
+
searchType: searchType;
|
|
177
|
+
placeholder?: string;
|
|
178
|
+
optionLabelRenderer: (value: string | number, option?: IOption) => React.ReactNode;
|
|
179
|
+
getOptionByValue: (optValue: string | number) => IOption;
|
|
180
|
+
onInputChange: (value: string) => void;
|
|
181
|
+
onAllowClear: () => void;
|
|
182
|
+
deleteValue: (value: React.ReactText[], v: string | number) => void;
|
|
183
|
+
arrowComponent?: React.ReactElement | undefined;
|
|
184
|
+
closeComponent?: React.ReactElement | undefined;
|
|
185
|
+
}
|
|
186
|
+
export interface IVirtualListProps {
|
|
187
|
+
itemHeight?: number;
|
|
188
|
+
height?: number;
|
|
189
|
+
prefixCls?: string;
|
|
190
|
+
children: React.ReactNode;
|
|
191
|
+
data: IOption[];
|
|
192
|
+
virtual?: boolean;
|
|
193
|
+
itemKey: string | number | ((item: never) => React.ReactText);
|
|
194
|
+
}
|
|
195
|
+
export interface IOptionsListProps {
|
|
196
|
+
style?: React.CSSProperties;
|
|
197
|
+
input: string;
|
|
198
|
+
prefixCls: string;
|
|
199
|
+
groupStyle?: React.CSSProperties;
|
|
200
|
+
optionStyle?: React.CSSProperties;
|
|
201
|
+
selected?: TMaybeArray<React.ReactText> | null;
|
|
202
|
+
multiple: boolean;
|
|
203
|
+
isMode?: boolean;
|
|
204
|
+
optionChecked?: TMaybeArray<React.ReactText>;
|
|
205
|
+
visible?: boolean;
|
|
206
|
+
isUseAll?: boolean;
|
|
207
|
+
data: IOption[];
|
|
208
|
+
hasGroup: boolean;
|
|
209
|
+
searchType: searchType;
|
|
210
|
+
placeholder?: string;
|
|
211
|
+
notFoundContent?: React.ReactElement;
|
|
212
|
+
onTempValueChange: (tempValue: React.ReactText[]) => void;
|
|
213
|
+
setTempValue: (values: React.ReactText[]) => void;
|
|
214
|
+
value?: TMaybeArray<React.ReactText> | null;
|
|
215
|
+
tempValue: React.ReactText[];
|
|
216
|
+
isFooter?: boolean;
|
|
217
|
+
labelRenderer: (option: IOption, isGruop: false) => React.ReactNode;
|
|
218
|
+
onOptionClick: (selectedValue: string | number) => void;
|
|
219
|
+
getContainer?: (node: HTMLElement) => HTMLElement;
|
|
220
|
+
onValueChange?: (optionValues: TMaybeArray<string | number> | null) => void;
|
|
221
|
+
onInputChange: (value: string) => void;
|
|
222
|
+
height?: number | undefined;
|
|
223
|
+
itemHeight?: number | undefined;
|
|
224
|
+
activeIndex: number;
|
|
225
|
+
setActiveIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
226
|
+
}
|
|
227
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|