@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,44 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import Menu from './components/Menu';
|
|
4
|
+
|
|
5
|
+
function Navigator(props) {
|
|
6
|
+
var menuList = props.menuList,
|
|
7
|
+
selectedKey = props.selectedKey,
|
|
8
|
+
logoSrc = props.logoSrc,
|
|
9
|
+
_props$footer = props.footer,
|
|
10
|
+
footer = _props$footer === void 0 ? null : _props$footer,
|
|
11
|
+
onLogoClick = props.onLogoClick,
|
|
12
|
+
onMenuSelect = props.onMenuSelect;
|
|
13
|
+
var renderMenu = useCallback(function () {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
15
|
+
menuList: menuList,
|
|
16
|
+
selectedKey: selectedKey,
|
|
17
|
+
onMenuSelect: onMenuSelect
|
|
18
|
+
});
|
|
19
|
+
}, [selectedKey, menuList, onMenuSelect]);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: classNames('ald-nav')
|
|
22
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: classNames('ald-nav-logo', {
|
|
24
|
+
'ald-nav-logo-able-click': onLogoClick
|
|
25
|
+
})
|
|
26
|
+
}, logoSrc && /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
onClick: onLogoClick,
|
|
28
|
+
className: "ald-nav-logo-wrap"
|
|
29
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
30
|
+
src: logoSrc,
|
|
31
|
+
alt: "",
|
|
32
|
+
draggable: false
|
|
33
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: classNames('ald-nav-menu', {
|
|
35
|
+
'ald-nav-menu-has-footer': !!footer
|
|
36
|
+
})
|
|
37
|
+
}, renderMenu()), footer && /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "ald-nav-footer"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: "ald-nav-footer-wrap"
|
|
41
|
+
}, footer)));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default Navigator;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
@import '../../style/index.less';
|
|
2
|
+
@import '../../Icon/index.less';
|
|
3
|
+
|
|
4
|
+
/* stylelint-disable */
|
|
5
|
+
|
|
6
|
+
@ald-prefix:ant;
|
|
7
|
+
|
|
8
|
+
.supTitle() {
|
|
9
|
+
font-family: 'PingFang SC';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
font-size: 14px;
|
|
13
|
+
line-height: 20px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.subTitle() {
|
|
17
|
+
font-family: 'PingFang SC';
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
line-height: 16px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.ald-nav {
|
|
25
|
+
width: 216px;
|
|
26
|
+
background-color: @BBG15;
|
|
27
|
+
height: 100%;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
user-select: none;
|
|
32
|
+
|
|
33
|
+
&-logo {
|
|
34
|
+
height: 72px;
|
|
35
|
+
padding: 24px;
|
|
36
|
+
width: 100%;
|
|
37
|
+
|
|
38
|
+
&-able-click {
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&-menu-icon-right.anticon {
|
|
44
|
+
color: @ND60;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-menu {
|
|
48
|
+
flex: 1;
|
|
49
|
+
overflow-y: auto;
|
|
50
|
+
overflow-x: hidden;
|
|
51
|
+
|
|
52
|
+
.ant-menu-sub.ant-menu-inline {
|
|
53
|
+
background-color: unset;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.anticon.ant-menu-item-icon {
|
|
57
|
+
font-size: 20px !important;
|
|
58
|
+
width: 20px !important;
|
|
59
|
+
height: 20px !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&::-webkit-scrollbar-thumb {
|
|
63
|
+
border-radius: 6px;
|
|
64
|
+
background: @ND90;
|
|
65
|
+
border: 3px solid transparent;
|
|
66
|
+
background-clip: padding-box;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&::-webkit-scrollbar {
|
|
70
|
+
background-color: transparent;
|
|
71
|
+
width: 12px;
|
|
72
|
+
height: 12px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ant-menu-inline,
|
|
76
|
+
.ant-menu-vertical,
|
|
77
|
+
.ant-menu-vertical-left {
|
|
78
|
+
border-right: unset;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ant-menu {
|
|
82
|
+
background: @BBG15;
|
|
83
|
+
color: @ND0;
|
|
84
|
+
|
|
85
|
+
&.ant-menu-root {
|
|
86
|
+
|
|
87
|
+
.ant-menu-item {
|
|
88
|
+
margin-bottom: 16px;
|
|
89
|
+
padding: 0 12px !important;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
li:nth-last-child(1) {
|
|
93
|
+
margin-bottom: 0;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.ant-menu-sub {
|
|
98
|
+
.ant-menu-item {
|
|
99
|
+
margin-top: 4px;
|
|
100
|
+
margin-bottom: 0;
|
|
101
|
+
padding: 0 12px 0 44px!important;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 只有子级菜单相关颜色操作
|
|
106
|
+
.ant-menu-item-only-child {
|
|
107
|
+
color: @ND30;
|
|
108
|
+
height: 32px !important;
|
|
109
|
+
line-height: 32px !important;
|
|
110
|
+
font-size: 12px !important;
|
|
111
|
+
.subTitle();
|
|
112
|
+
|
|
113
|
+
&:hover {
|
|
114
|
+
color: @ND30 !important;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&.ant-menu-item-selected {
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
|
|
120
|
+
&:hover {
|
|
121
|
+
color: @ND0 !important;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ant-menu-item {
|
|
127
|
+
height: 40px;
|
|
128
|
+
width: 100%;
|
|
129
|
+
border-radius: 8px;
|
|
130
|
+
.supTitle();
|
|
131
|
+
|
|
132
|
+
::before {
|
|
133
|
+
width: 4px;
|
|
134
|
+
content: '';
|
|
135
|
+
background: transparent;
|
|
136
|
+
height: 100%;
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 0;
|
|
139
|
+
left: -12px;
|
|
140
|
+
border-radius: 1px;
|
|
141
|
+
transition: all .3s;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&-selected {
|
|
145
|
+
background-color: @BBG20 !important;
|
|
146
|
+
color: @ND0;
|
|
147
|
+
position: relative;
|
|
148
|
+
overflow: unset;
|
|
149
|
+
|
|
150
|
+
::before {
|
|
151
|
+
background: @B40;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&::after {
|
|
156
|
+
display: none !important;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ant-menu-submenu {
|
|
161
|
+
margin-bottom: 16px;
|
|
162
|
+
|
|
163
|
+
.ant-menu-submenu-title {
|
|
164
|
+
padding: 0 12px !important;
|
|
165
|
+
height: 40px;
|
|
166
|
+
line-height: 40px;
|
|
167
|
+
.supTitle();
|
|
168
|
+
|
|
169
|
+
&:hover {
|
|
170
|
+
color: @ND0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&-selected {
|
|
175
|
+
color: @ND0;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&-active {
|
|
179
|
+
color: @ND0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 修改icon和文字的margin
|
|
184
|
+
.ant-menu-item .ant-menu-item-icon + span,
|
|
185
|
+
.ant-menu-submenu-title .ant-menu-item-icon + span,
|
|
186
|
+
.ant-menu-item .anticon + span,
|
|
187
|
+
.ant-menu-submenu-title .anticon + span {
|
|
188
|
+
margin-left: 12px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 取消item点击时的高亮背景色
|
|
192
|
+
.ant-menu-item:active,
|
|
193
|
+
.ant-menu-submenu-title:active {
|
|
194
|
+
background: unset;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.ant-menu-inline .ant-menu-item,
|
|
198
|
+
.ant-menu-inline .ant-menu-submenu-title {
|
|
199
|
+
width: 100% !important;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 删除右侧的高亮
|
|
203
|
+
.ant-menu-vertical .ant-menu-item::after,
|
|
204
|
+
.ant-menu-vertical-left .ant-menu-item::after,
|
|
205
|
+
.ant-menu-vertical-right .ant-menu-item::after,
|
|
206
|
+
.ant-menu-inline .ant-menu-item::after {
|
|
207
|
+
display: none;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.ant-menu-light .ant-menu-item:hover,
|
|
212
|
+
.ant-menu-light .ant-menu-item-active,
|
|
213
|
+
.ant-menu-light .ant-menu:not(.ant-menu-inline) .ant-menu-submenu-open,
|
|
214
|
+
.ant-menu-light .ant-menu-submenu-active,
|
|
215
|
+
.ant-menu-light .ant-menu-submenu-title:hover {
|
|
216
|
+
color: unset;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&-footer {
|
|
221
|
+
height: 72px;
|
|
222
|
+
|
|
223
|
+
&-wrap {
|
|
224
|
+
color: @ND0;
|
|
225
|
+
height: 100%;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ISelectProps as SelectProps } from './interface';
|
|
3
|
+
export declare const Select: (props: SelectProps, ref: React.MutableRefObject<HTMLDivElement>) => JSX.Element;
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
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."); }
|
|
4
|
+
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
|
|
11
|
+
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."); }
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
|
|
21
|
+
import React, { useState, useMemo, useRef, useEffect } from 'react';
|
|
22
|
+
import classnames from 'classnames';
|
|
23
|
+
import { filter, isNil, without } from 'lodash';
|
|
24
|
+
import Selector from './Selector';
|
|
25
|
+
import OptionsList from './OptionsList';
|
|
26
|
+
import usePrefixCls from '../_utils/hooks/usePrefixCls';
|
|
27
|
+
import Trigger from 'rc-trigger';
|
|
28
|
+
import { convertChildrenToData, handleOptions, defaultLabelRenderer, defaultSearchPredicate, defaultOptionLabelRenderer, getFlattenOptions } from './utils';
|
|
29
|
+
import useCacheOptions from './hooks/useCacheOption';
|
|
30
|
+
import useControlledState from '../_utils/hooks/useControlledState';
|
|
31
|
+
var DEFAULT_LIST_HEIGHT = 256;
|
|
32
|
+
var DEFAULT_ACTIVE_INDEX = -1;
|
|
33
|
+
var ZERO = 0;
|
|
34
|
+
export var Select = function Select(props, ref) {
|
|
35
|
+
var _props$size = props.size,
|
|
36
|
+
size = _props$size === void 0 ? 'default' : _props$size,
|
|
37
|
+
_props$options = props.options,
|
|
38
|
+
options = _props$options === void 0 ? [] : _props$options,
|
|
39
|
+
_props$defaultValue = props.defaultValue,
|
|
40
|
+
defaultValue = _props$defaultValue === void 0 ? null : _props$defaultValue,
|
|
41
|
+
controlledValue = props.value,
|
|
42
|
+
_props$multiple = props.multiple,
|
|
43
|
+
multiple = _props$multiple === void 0 ? false : _props$multiple,
|
|
44
|
+
placeholder = props.placeholder,
|
|
45
|
+
_props$disabled = props.disabled,
|
|
46
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
47
|
+
customizePrefixCls = props.customizePrefixCls,
|
|
48
|
+
label = props.label,
|
|
49
|
+
className = props.className,
|
|
50
|
+
style = props.style,
|
|
51
|
+
optionStyle = props.optionStyle,
|
|
52
|
+
groupStyle = props.groupStyle,
|
|
53
|
+
_props$allowClear = props.allowClear,
|
|
54
|
+
allowClear = _props$allowClear === void 0 ? false : _props$allowClear,
|
|
55
|
+
_props$listHeight = props.listHeight,
|
|
56
|
+
listHeight = _props$listHeight === void 0 ? DEFAULT_LIST_HEIGHT : _props$listHeight,
|
|
57
|
+
listRowHeight = props.listRowHeight,
|
|
58
|
+
_props$labelRenderer = props.labelRenderer,
|
|
59
|
+
labelRenderer = _props$labelRenderer === void 0 ? defaultLabelRenderer : _props$labelRenderer,
|
|
60
|
+
_props$searchPredicat = props.searchPredicate,
|
|
61
|
+
searchPredicate = _props$searchPredicat === void 0 ? defaultSearchPredicate : _props$searchPredicat,
|
|
62
|
+
_props$optionLabelRen = props.optionLabelRenderer,
|
|
63
|
+
optionLabelRenderer = _props$optionLabelRen === void 0 ? defaultOptionLabelRenderer : _props$optionLabelRen,
|
|
64
|
+
onChange = props.onChange,
|
|
65
|
+
onSelect = props.onSelect,
|
|
66
|
+
onClear = props.onClear,
|
|
67
|
+
getContainer = props.getContainer,
|
|
68
|
+
open = props.open,
|
|
69
|
+
_props$defaultOpen = props.defaultOpen,
|
|
70
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
71
|
+
onDropDownVisibleChange = props.onDropDownVisibleChange,
|
|
72
|
+
dropDownClassName = props.dropDownClassName,
|
|
73
|
+
dropDownStyle = props.dropDownStyle,
|
|
74
|
+
_props$dropdownMatchS = props.dropdownMatchSelectWidth,
|
|
75
|
+
dropdownMatchSelectWidth = _props$dropdownMatchS === void 0 ? 'width' : _props$dropdownMatchS,
|
|
76
|
+
children = props.children;
|
|
77
|
+
var prefix = usePrefixCls('select-legacy', customizePrefixCls);
|
|
78
|
+
|
|
79
|
+
var _useControlledState = useControlledState(controlledValue, defaultValue),
|
|
80
|
+
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
81
|
+
value = _useControlledState2[0],
|
|
82
|
+
setSelectValue = _useControlledState2[1];
|
|
83
|
+
|
|
84
|
+
var _useState = useState([]),
|
|
85
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
86
|
+
tempValue = _useState2[0],
|
|
87
|
+
setTempValue = _useState2[1];
|
|
88
|
+
|
|
89
|
+
var _useState3 = useState(false),
|
|
90
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
91
|
+
isFocused = _useState4[0],
|
|
92
|
+
setFocused = _useState4[1];
|
|
93
|
+
|
|
94
|
+
var _useState5 = useState(defaultOpen),
|
|
95
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
96
|
+
_visible = _useState6[0],
|
|
97
|
+
_setVisible = _useState6[1];
|
|
98
|
+
|
|
99
|
+
var visible = isNil(open) ? _visible : open;
|
|
100
|
+
var setVisible = isNil(onDropDownVisibleChange) ? _setVisible : onDropDownVisibleChange;
|
|
101
|
+
|
|
102
|
+
var _useState7 = useState(''),
|
|
103
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
104
|
+
input = _useState8[0],
|
|
105
|
+
setInput = _useState8[1];
|
|
106
|
+
|
|
107
|
+
var selectRef = useRef(null);
|
|
108
|
+
var optionListRef = useRef(null);
|
|
109
|
+
var selectorRef = ref || selectRef; // empty
|
|
110
|
+
// keydown
|
|
111
|
+
|
|
112
|
+
var _useState9 = useState(DEFAULT_ACTIVE_INDEX),
|
|
113
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
114
|
+
activeIndex = _useState10[0],
|
|
115
|
+
setActiveIndex = _useState10[1];
|
|
116
|
+
|
|
117
|
+
var _useState11 = useState([]),
|
|
118
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
119
|
+
optionChecked = _useState12[0],
|
|
120
|
+
setOptionChecked = _useState12[1]; // Exhibition value (tempvalue + value);
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
var selectorValue = useMemo(function () {
|
|
124
|
+
if (Array.isArray(value)) {
|
|
125
|
+
// filter: if v in value and tempValue no Exhibition
|
|
126
|
+
return value.concat(tempValue).filter(function (v) {
|
|
127
|
+
return !value.includes(v) || !tempValue.includes(v);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (multiple) {
|
|
132
|
+
return tempValue;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return value;
|
|
136
|
+
}, [value, multiple, tempValue]);
|
|
137
|
+
useEffect(function () {
|
|
138
|
+
if (!disabled) {
|
|
139
|
+
if (visible) {
|
|
140
|
+
var _selectorRef$current;
|
|
141
|
+
|
|
142
|
+
selectorRef === null || selectorRef === void 0 ? void 0 : (_selectorRef$current = selectorRef.current) === null || _selectorRef$current === void 0 ? void 0 : _selectorRef$current.focus();
|
|
143
|
+
setFocused(visible);
|
|
144
|
+
} else {
|
|
145
|
+
var _optionListRef$curren;
|
|
146
|
+
|
|
147
|
+
setActiveIndex(DEFAULT_ACTIVE_INDEX);
|
|
148
|
+
setFocused(visible); // @ts-ignore
|
|
149
|
+
|
|
150
|
+
optionListRef === null || optionListRef === void 0 ? void 0 : (_optionListRef$curren = optionListRef.current) === null || _optionListRef$curren === void 0 ? void 0 : _optionListRef$curren.onBlur();
|
|
151
|
+
}
|
|
152
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
153
|
+
|
|
154
|
+
}, [visible, disabled]);
|
|
155
|
+
/** merge Option & nodeOption & mergedOptionsMap */
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
|
|
158
|
+
var nodesToOptions = useMemo(function () {
|
|
159
|
+
return convertChildrenToData(children);
|
|
160
|
+
}, [children]);
|
|
161
|
+
|
|
162
|
+
var _useCacheOptions = useCacheOptions(),
|
|
163
|
+
setCacheOptions = _useCacheOptions.setCacheOptions,
|
|
164
|
+
getOptionByValue = _useCacheOptions.getOptionByValue,
|
|
165
|
+
getOptionsByValue = _useCacheOptions.getOptionsByValue,
|
|
166
|
+
updateGroup = _useCacheOptions.updateGroup,
|
|
167
|
+
hasGroup = _useCacheOptions.hasGroup;
|
|
168
|
+
|
|
169
|
+
var _useMemo = useMemo( // @ts-ignore
|
|
170
|
+
function () {
|
|
171
|
+
return handleOptions([].concat(_toConsumableArray(options), _toConsumableArray(nodesToOptions)), setCacheOptions, updateGroup);
|
|
172
|
+
}, [nodesToOptions, options, setCacheOptions, updateGroup]),
|
|
173
|
+
mergedFlattenOPtions = _useMemo.flattenOptions; // input change
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
var onInputChange = function onInputChange(_value) {
|
|
177
|
+
setInput(_value);
|
|
178
|
+
}; // clear
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
var clearInput = function clearInput() {
|
|
182
|
+
return setInput('');
|
|
183
|
+
}; // dropdown visible
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
var onVisibleChange = function onVisibleChange(optVisible) {
|
|
187
|
+
if (!disabled) {
|
|
188
|
+
setVisible(optVisible);
|
|
189
|
+
|
|
190
|
+
if (!optVisible) {
|
|
191
|
+
var _selectorRef$current2;
|
|
192
|
+
|
|
193
|
+
setTimeout(clearInput, ZERO);
|
|
194
|
+
(_selectorRef$current2 = selectorRef.current) === null || _selectorRef$current2 === void 0 ? void 0 : _selectorRef$current2.blur();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}; // tempValue change methods
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
var onTempValueChange = function onTempValueChange(values) {
|
|
201
|
+
// value is array
|
|
202
|
+
var concatValue = isNil(value) ? values : values.concat(value).filter(function (v) {
|
|
203
|
+
return !(value === null || value === void 0 ? void 0 : value.includes(v)) || !(values === null || values === void 0 ? void 0 : values.includes(v));
|
|
204
|
+
});
|
|
205
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(concatValue, getOptionsByValue(concatValue));
|
|
206
|
+
onVisibleChange(false);
|
|
207
|
+
setSelectValue(concatValue); // clear tempValue
|
|
208
|
+
|
|
209
|
+
setTempValue([]);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
var deleteValue = function deleteValue(optValue, v) {
|
|
213
|
+
return tempValue.includes(v) ? onTempValueChange(without(optValue || [], v)) : onValueChange(without(optValue || [], v));
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
var setTempValueFC = function setTempValueFC(tempvalues) {
|
|
217
|
+
setTempValue(tempvalues);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
var onListSelect = function onListSelect(selectedValue, option) {
|
|
221
|
+
if (!multiple) {
|
|
222
|
+
var _selectorRef$current3;
|
|
223
|
+
|
|
224
|
+
(_selectorRef$current3 = selectorRef.current) === null || _selectorRef$current3 === void 0 ? void 0 : _selectorRef$current3.blur();
|
|
225
|
+
} else {
|
|
226
|
+
var _selectorRef$current4;
|
|
227
|
+
|
|
228
|
+
(_selectorRef$current4 = selectorRef.current) === null || _selectorRef$current4 === void 0 ? void 0 : _selectorRef$current4.focus();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedValue, option);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
var onAllowClearClick = function onAllowClearClick() {
|
|
235
|
+
if (input) {
|
|
236
|
+
clearInput();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
onValueChange(!multiple ? null : []);
|
|
240
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
241
|
+
}; // 选项点击
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
var onOptionClick = function onOptionClick(selectValue) {
|
|
245
|
+
var selectedOption = getOptionByValue(selectValue);
|
|
246
|
+
var isTempSelected = tempValue.includes(selectValue);
|
|
247
|
+
var isSelected = !Array.isArray(value) ? value === selectValue : value.includes(selectValue);
|
|
248
|
+
var isOptionChecked = optionChecked.includes(selectValue);
|
|
249
|
+
|
|
250
|
+
if (!multiple) {
|
|
251
|
+
onVisibleChange(false);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (isTempSelected) {
|
|
255
|
+
setTempValue(function (tempvalues) {
|
|
256
|
+
return without(tempvalues, selectValue);
|
|
257
|
+
});
|
|
258
|
+
return;
|
|
259
|
+
} // 点击的时候已经是被选中
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
if (isSelected) {
|
|
263
|
+
if (isOptionChecked) {
|
|
264
|
+
onValueChange(Array.isArray(value) ? without(value || [], selectValue) : null);
|
|
265
|
+
setOptionChecked(without(value || [], selectValue));
|
|
266
|
+
} else {
|
|
267
|
+
onValueChange(Array.isArray(value) ? [].concat(_toConsumableArray(optionChecked), [selectValue]) : null);
|
|
268
|
+
setOptionChecked([].concat(_toConsumableArray(optionChecked), [selectValue]));
|
|
269
|
+
}
|
|
270
|
+
} else {
|
|
271
|
+
onListSelect(selectValue, selectedOption);
|
|
272
|
+
|
|
273
|
+
if (Array.isArray(value)) {
|
|
274
|
+
onValueChange([].concat(_toConsumableArray(value), [selectValue]));
|
|
275
|
+
setOptionChecked([].concat(_toConsumableArray(value), [selectValue]));
|
|
276
|
+
} else {
|
|
277
|
+
onValueChange(!multiple ? selectValue : [selectValue]);
|
|
278
|
+
setOptionChecked([selectValue]);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}; // search filter InputValue // match input(label === input)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
var filteredOptions = useMemo(function () {
|
|
285
|
+
return filter(mergedFlattenOPtions, searchPredicate(input));
|
|
286
|
+
}, [mergedFlattenOPtions, searchPredicate, input]);
|
|
287
|
+
var flattenOptions = useMemo(function () {
|
|
288
|
+
return getFlattenOptions(filteredOptions, false);
|
|
289
|
+
}, [filteredOptions]); // value other methods
|
|
290
|
+
|
|
291
|
+
var onValueChange = function onValueChange(optValue) {
|
|
292
|
+
setSelectValue(optValue);
|
|
293
|
+
|
|
294
|
+
if (Array.isArray(optValue) && flattenOptions.length === optValue.length) {
|
|
295
|
+
setOptionChecked([]);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (isNil(optValue)) {
|
|
299
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null, null);
|
|
300
|
+
} else {
|
|
301
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(optValue, getOptionsByValue(optValue));
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
var realSize = useMemo(function () {
|
|
306
|
+
return ['small', 'default', 'large'].includes(size) ? size : 'default';
|
|
307
|
+
}, [size]);
|
|
308
|
+
var list = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(OptionsList, {
|
|
309
|
+
ref: optionListRef,
|
|
310
|
+
multiple: multiple,
|
|
311
|
+
prefixCls: prefix,
|
|
312
|
+
selected: selectorValue,
|
|
313
|
+
optionChecked: optionChecked,
|
|
314
|
+
visible: visible,
|
|
315
|
+
hasGroup: hasGroup,
|
|
316
|
+
groupStyle: groupStyle,
|
|
317
|
+
optionStyle: optionStyle,
|
|
318
|
+
searchType: "no-search",
|
|
319
|
+
placeholder: placeholder,
|
|
320
|
+
data: flattenOptions,
|
|
321
|
+
labelRenderer: labelRenderer(input, prefix),
|
|
322
|
+
value: value,
|
|
323
|
+
tempValue: tempValue,
|
|
324
|
+
onOptionClick: onOptionClick,
|
|
325
|
+
onValueChange: onValueChange,
|
|
326
|
+
onTempValueChange: onTempValueChange,
|
|
327
|
+
setTempValue: setTempValueFC,
|
|
328
|
+
onInputChange: onInputChange,
|
|
329
|
+
input: input,
|
|
330
|
+
height: listHeight,
|
|
331
|
+
getContainer: getContainer,
|
|
332
|
+
itemHeight: listRowHeight,
|
|
333
|
+
activeIndex: activeIndex,
|
|
334
|
+
setActiveIndex: setActiveIndex
|
|
335
|
+
}));
|
|
336
|
+
return /*#__PURE__*/React.createElement(Trigger, {
|
|
337
|
+
popupVisible: visible,
|
|
338
|
+
onPopupVisibleChange: onVisibleChange,
|
|
339
|
+
action: ['click'],
|
|
340
|
+
popupPlacement: "bottomLeft",
|
|
341
|
+
popup: list,
|
|
342
|
+
prefixCls: prefix,
|
|
343
|
+
popupClassName: classnames("".concat(prefix, "-dropdown"), dropDownClassName),
|
|
344
|
+
popupStyle: dropDownStyle,
|
|
345
|
+
getPopupContainer: getContainer,
|
|
346
|
+
stretch: dropdownMatchSelectWidth ? 'width' : 'minWidth',
|
|
347
|
+
zIndex: 100,
|
|
348
|
+
builtinPlacements: {
|
|
349
|
+
left: {
|
|
350
|
+
points: ['cr', 'cl']
|
|
351
|
+
},
|
|
352
|
+
right: {
|
|
353
|
+
points: ['cl', 'cr']
|
|
354
|
+
},
|
|
355
|
+
top: {
|
|
356
|
+
points: ['bc', 'tc']
|
|
357
|
+
},
|
|
358
|
+
bottom: {
|
|
359
|
+
points: ['tc', 'bc']
|
|
360
|
+
},
|
|
361
|
+
topLeft: {
|
|
362
|
+
points: ['bl', 'tl']
|
|
363
|
+
},
|
|
364
|
+
topRight: {
|
|
365
|
+
points: ['br', 'tr']
|
|
366
|
+
},
|
|
367
|
+
bottomRight: {
|
|
368
|
+
points: ['tr', 'br']
|
|
369
|
+
},
|
|
370
|
+
bottomLeft: {
|
|
371
|
+
points: ['tl', 'bl']
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}, /*#__PURE__*/React.createElement(Selector, {
|
|
375
|
+
size: realSize,
|
|
376
|
+
input: input,
|
|
377
|
+
disabled: disabled,
|
|
378
|
+
prefix: prefix,
|
|
379
|
+
multiple: multiple,
|
|
380
|
+
bordered: true,
|
|
381
|
+
isFocused: isFocused,
|
|
382
|
+
className: className,
|
|
383
|
+
visible: visible,
|
|
384
|
+
label: label,
|
|
385
|
+
ref: selectorRef,
|
|
386
|
+
style: style,
|
|
387
|
+
allowClear: allowClear,
|
|
388
|
+
value: selectorValue,
|
|
389
|
+
filteredOptions: filteredOptions,
|
|
390
|
+
searchType: "no-search",
|
|
391
|
+
placeholder: placeholder,
|
|
392
|
+
deleteValue: deleteValue,
|
|
393
|
+
onAllowClear: onAllowClearClick,
|
|
394
|
+
optionLabelRenderer: optionLabelRenderer,
|
|
395
|
+
getOptionByValue: getOptionByValue,
|
|
396
|
+
onInputChange: onInputChange
|
|
397
|
+
}));
|
|
398
|
+
}; // @ts-ignore
|
|
399
|
+
|
|
400
|
+
export default /*#__PURE__*/React.forwardRef(Select);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IOptGroupProps } from '../interface';
|
|
3
|
-
|
|
4
3
|
export interface IOptionGroupFC extends React.FC<IOptGroupProps> {
|
|
5
|
-
|
|
4
|
+
isSelectOptGroup: boolean;
|
|
6
5
|
}
|
|
7
|
-
const OptGroup: IOptionGroupFC
|
|
8
|
-
OptGroup.isSelectOptGroup = true;
|
|
6
|
+
declare const OptGroup: IOptionGroupFC;
|
|
9
7
|
export default OptGroup;
|