tntd 3.0.35-beta.5 → 3.0.35-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/_util/context.js +13 -6
- package/es/_util/defaultRenderEmpty.js +35 -23
- package/es/_util/hooks/useFlexGapSupport.js +25 -7
- package/es/_util/hooks/useForceUpdate.js +22 -3
- package/es/_util/motion.js +31 -22
- package/es/_util/reactNode.js +17 -7
- package/es/_util/responsiveObserve.js +40 -29
- package/es/_util/styleChecker.js +21 -7
- package/es/_util/type.js +18 -2
- package/es/_util/warning.js +19 -5
- package/es/actions/index.js +29 -22
- package/es/affix/index.js +24 -4
- package/es/affix/style/index.js +4 -2
- package/es/alert/alert.js +49 -27
- package/es/alert/index.js +23 -4
- package/es/alert/style/index.js +4 -2
- package/es/anchor/index.js +24 -4
- package/es/anchor/style/index.js +5 -4
- package/es/array-input/index.js +232 -181
- package/es/auth-context/index.js +10 -2
- package/es/auto-complete/index.js +24 -4
- package/es/auto-complete/style/index.js +6 -5
- package/es/avatar/index.js +24 -4
- package/es/avatar/style/index.js +4 -2
- package/es/back-top/index.js +24 -4
- package/es/back-top/style/index.js +4 -2
- package/es/badge/index.js +24 -4
- package/es/badge/style/index.js +4 -2
- package/es/breadcrumb/index.js +24 -4
- package/es/breadcrumb/style/index.js +6 -4
- package/es/button/button.js +55 -39
- package/es/button/index.js +22 -5
- package/es/button/style/index.js +4 -2
- package/es/calendar/index.js +24 -4
- package/es/calendar/style/index.js +6 -5
- package/es/card/card.js +36 -17
- package/es/card/index.js +21 -4
- package/es/card/style/index.js +7 -6
- package/es/carousel/index.js +24 -4
- package/es/carousel/style/index.js +4 -2
- package/es/cascader/cascader.js +37 -18
- package/es/cascader/index.js +25 -5
- package/es/cascader/style/index.js +6 -5
- package/es/check-card/group.js +125 -91
- package/es/check-card/index.js +95 -84
- package/es/checkbox/checkbox.js +48 -31
- package/es/checkbox/index.js +25 -5
- package/es/checkbox/style/index.js +4 -2
- package/es/col/index.js +24 -4
- package/es/col/style/index.js +4 -4
- package/es/collapse/index.js +25 -5
- package/es/collapse/style/index.js +4 -2
- package/es/color-picker/ColorPicker.js +109 -87
- package/es/color-picker/index.js +16 -9
- package/es/columns/index.js +61 -54
- package/es/comment/index.js +24 -4
- package/es/comment/style/index.js +4 -2
- package/es/config-provider/DisabledContext.js +16 -8
- package/es/config-provider/SizeContext.js +21 -9
- package/es/config-provider/config-provider.js +13 -2
- package/es/config-provider/index.js +36 -5
- package/es/config-provider/style/index.js +3 -1
- package/es/connect/index.js +33 -18
- package/es/date-picker/DatePicker.js +92 -65
- package/es/date-picker/index.js +16 -10
- package/es/date-picker/style/index.js +7 -7
- package/es/descriptions/descriptions.js +96 -76
- package/es/descriptions/index.js +22 -5
- package/es/descriptions/style/index.js +4 -2
- package/es/development-login/LoginModal.js +66 -43
- package/es/development-login/index.js +38 -14
- package/es/divider/index.js +24 -4
- package/es/divider/style/index.js +4 -2
- package/es/drawer/drawer.js +88 -74
- package/es/drawer/index.js +23 -5
- package/es/drawer/style/index.js +5 -4
- package/es/dropdown/index.js +24 -4
- package/es/dropdown/style/index.js +5 -4
- package/es/ellipsis/Svg/CopySVG.js +23 -16
- package/es/ellipsis/Svg/TickSVG.js +18 -11
- package/es/ellipsis/index.js +103 -71
- package/es/empty/empty.js +64 -42
- package/es/empty/empty.stories.js +18 -11
- package/es/empty/index.js +22 -5
- package/es/empty/style/index.js +4 -2
- package/es/exception/exception.js +35 -27
- package/es/exception/index.js +21 -4
- package/es/form/form.js +80 -58
- package/es/form/index.js +21 -4
- package/es/form/style/index.js +5 -4
- package/es/grid/index.js +24 -4
- package/es/grid/style/index.js +4 -2
- package/es/grid-v4/RowContext.js +9 -3
- package/es/grid-v4/col.js +52 -55
- package/es/grid-v4/hooks/useBreakpoint.js +20 -10
- package/es/grid-v4/index.js +26 -10
- package/es/grid-v4/row.js +113 -84
- package/es/grid-v4/style/index.js +3 -2
- package/es/handle/index.js +100 -73
- package/es/handle-icon/index.js +123 -103
- package/es/icon/IconFont.js +26 -18
- package/es/icon/components/Icon.js +110 -73
- package/es/icon/components/index.js +13 -1
- package/es/icon/components/utils.js +83 -44
- package/es/icon/index.js +81 -69
- package/es/icon/style/index.js +5 -3
- package/es/icon/twoTonePrimaryColor.js +14 -6
- package/es/icon/utils.js +25 -14
- package/es/icon-list/index.js +7 -1
- package/es/icon-old/index.js +24 -4
- package/es/icon-old/style/index.js +4 -2
- package/es/img/Contain.js +35 -29
- package/es/img/Cover.js +66 -51
- package/es/img/index.js +57 -34
- package/es/index.js +734 -111
- package/es/input/index.js +22 -5
- package/es/input/input.js +72 -80
- package/es/input/style/index.js +5 -4
- package/es/input-number/index.js +25 -5
- package/es/input-number/inputNumber.js +40 -20
- package/es/input-number/style/index.js +4 -2
- package/es/label/index.js +68 -65
- package/es/layout/index.js +24 -4
- package/es/layout/style/index.js +4 -2
- package/es/list/index.js +24 -4
- package/es/list/style/index.js +8 -7
- package/es/loading-button/index.js +40 -17
- package/es/locale/default.js +12 -5
- package/es/locale/en_US.js +12 -4
- package/es/locale/index.js +38 -3
- package/es/locale/zh_CN.js +11 -4
- package/es/locale-provider/index.js +27 -7
- package/es/locale-provider/style/index.js +3 -1
- package/es/mentions/index.js +24 -4
- package/es/mentions/style/index.js +5 -4
- package/es/menu/index.js +24 -4
- package/es/menu/style/index.js +5 -5
- package/es/message/index.js +25 -5
- package/es/message/style/index.js +4 -2
- package/es/modal/index.js +21 -4
- package/es/modal/modal.js +81 -73
- package/es/modal/style/index.js +6 -5
- package/es/notification/assets/index.js +20 -2
- package/es/notification/assets/svg-error-tip.js +13 -4
- package/es/notification/assets/svg-success-tip.js +13 -4
- package/es/notification/index.js +23 -4
- package/es/notification/notification.js +73 -48
- package/es/notification/style/index.js +4 -2
- package/es/page/Box.js +37 -25
- package/es/page/index.js +96 -78
- package/es/page/utils.js +18 -8
- package/es/page-container/index.js +22 -13
- package/es/page-header/index.js +24 -4
- package/es/page-header/style/index.js +5 -4
- package/es/page-loading/index.js +23 -18
- package/es/pagination/index.js +24 -4
- package/es/pagination/style/index.js +5 -4
- package/es/popconfirm/index.js +24 -4
- package/es/popconfirm/popconfirm.js +39 -21
- package/es/popconfirm/style/index.js +6 -6
- package/es/popover/index.js +24 -4
- package/es/popover/popover.js +43 -22
- package/es/popover/style/index.js +5 -5
- package/es/prev-locale.js +22 -10
- package/es/preview-text/index.js +176 -165
- package/es/progress/index.js +24 -4
- package/es/progress/progress.js +101 -85
- package/es/progress/style/index.js +4 -2
- package/es/query-form/Field/Checkbox.js +17 -12
- package/es/query-form/Field/Composition/FieldPopover.js +192 -153
- package/es/query-form/Field/Composition/Select.js +84 -60
- package/es/query-form/Field/Composition/ValueTag.js +95 -61
- package/es/query-form/Field/Composition/index.js +173 -128
- package/es/query-form/Field/Composition/utils.js +87 -71
- package/es/query-form/Field/Select.js +55 -34
- package/es/query-form/Field/SelectInput.js +65 -54
- package/es/query-form/Field/fieldsMap.js +30 -25
- package/es/query-form/Field/index.js +122 -92
- package/es/query-form/createActions.js +28 -21
- package/es/query-form/index.js +148 -116
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/useForm.js +11 -4
- package/es/query-list-scene/List.js +261 -231
- package/es/query-list-scene/QueryForm.js +127 -105
- package/es/query-list-scene/QueryForm.js.map +1 -1
- package/es/query-list-scene/QueryListScene.js +63 -34
- package/es/query-list-scene/Title.js +15 -7
- package/es/query-list-scene/Toolbar.js +22 -15
- package/es/query-list-scene/createActions.js +51 -32
- package/es/query-list-scene/index.js +27 -20
- package/es/query-list-scene/useActions.js +11 -4
- package/es/radio/index.js +25 -5
- package/es/radio/radio.js +50 -32
- package/es/radio/style/index.js +4 -2
- package/es/rate/index.js +24 -4
- package/es/rate/style/index.js +5 -4
- package/es/render-empty/index.js +8 -2
- package/es/render-empty/render-empty.js +31 -22
- package/es/result/index.js +24 -4
- package/es/result/style/index.js +4 -2
- package/es/row/index.js +24 -4
- package/es/row/style/index.js +4 -4
- package/es/scroll-bar/Bar.js +67 -32
- package/es/scroll-bar/Context.js +10 -3
- package/es/scroll-bar/ScrollBar.js +49 -38
- package/es/scroll-bar/Thumb.js +54 -34
- package/es/scroll-bar/index.js +10 -3
- package/es/scroll-bar/util.js +18 -10
- package/es/segmented/index.js +52 -43
- package/es/select/index.js +23 -5
- package/es/select/select.js +49 -42
- package/es/select/style/index.js +5 -4
- package/es/skeleton/index.js +24 -4
- package/es/skeleton/style/index.js +4 -2
- package/es/slider/index.js +24 -4
- package/es/slider/style/index.js +5 -4
- package/es/spin/index.js +22 -5
- package/es/spin/spin.js +23 -15
- package/es/spin/style/index.js +4 -2
- package/es/statistic/index.js +24 -4
- package/es/statistic/style/index.js +4 -2
- package/es/steps/index.js +22 -5
- package/es/steps/steps.js +67 -50
- package/es/steps/style/index.js +4 -10
- package/es/style/index.js +3 -1
- package/es/style/v2-compatible-reset.js +3 -1
- package/es/svg-components/illustration-403.js +13 -4
- package/es/svg-components/illustration-404.js +13 -4
- package/es/svg-components/illustration-500.js +13 -4
- package/es/svg-components/illustration-empty.js +13 -4
- package/es/svg-components/illustration-failure.js +13 -4
- package/es/svg-components/illustration-no-access.js +13 -4
- package/es/svg-components/illustration-no-chart.js +13 -4
- package/es/svg-components/illustration-no-result.js +13 -4
- package/es/svg-components/illustration-offline.js +13 -4
- package/es/svg-components/illustration-success.js +13 -4
- package/es/svg-components/index.js +76 -10
- package/es/switch/index.js +23 -3
- package/es/switch/style/index.js +5 -3
- package/es/switch/switch.js +53 -31
- package/es/table/assets/image-loading-background.js +13 -4
- package/es/table/assets/image-loading.js +13 -4
- package/es/table/constants.js +7 -1
- package/es/table/context.js +8 -2
- package/es/table/hooks/index.js +27 -2
- package/es/table/hooks/use-column-setting.js +31 -8
- package/es/table/hooks/use-expand-fixed.js +77 -47
- package/es/table/index.js +23 -6
- package/es/table/resizableTable/index.js +80 -57
- package/es/table/style/index.js +10 -10
- package/es/table/table-hoc.js +19 -14
- package/es/table/table.js +139 -120
- package/es/table/table.stories.js +130 -97
- package/es/table/utils.js +22 -13
- package/es/table-container/index.js +25 -15
- package/es/tabs/index.js +22 -5
- package/es/tabs/style/index.js +4 -2
- package/es/tabs/tabs.js +58 -35
- package/es/tabs-container/index.js +22 -13
- package/es/tag/index.js +22 -5
- package/es/tag/style/index.js +4 -2
- package/es/tag/tag.js +93 -81
- package/es/time-picker/TimePicker.js +40 -21
- package/es/time-picker/index.js +13 -6
- package/es/time-picker/style/index.js +4 -2
- package/es/timeline/index.js +24 -4
- package/es/timeline/style/index.js +4 -2
- package/es/title/index.js +40 -32
- package/es/tntd-action/Action.js +87 -63
- package/es/tntd-action/index.js +61 -45
- package/es/tntd-cascader/AntdCascader/component/DisabledContext.js +16 -8
- package/es/tntd-cascader/AntdCascader/component/FormItemInputContext.js +11 -2
- package/es/tntd-cascader/AntdCascader/component/SizeContext.js +11 -2
- package/es/tntd-cascader/AntdCascader/component/context.js +13 -6
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +30 -18
- package/es/tntd-cascader/AntdCascader/component/getIcons.js +38 -28
- package/es/tntd-cascader/AntdCascader/component/useCompactItemContext.js +25 -19
- package/es/tntd-cascader/AntdCascader/config/utils.js +24 -15
- package/es/tntd-cascader/AntdCascader/config/warning.js +15 -6
- package/es/tntd-cascader/AntdCascader/index.js +136 -128
- package/es/tntd-cascader/AntdCascader/interface.js +15 -4
- package/es/tntd-cascader/index.js +13 -1
- package/es/tntd-cascader/rc-cascader/Cascader.js +220 -171
- package/es/tntd-cascader/rc-cascader/OptionList/Checkbox.js +26 -19
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js +125 -110
- package/es/tntd-cascader/rc-cascader/OptionList/index.js +140 -106
- package/es/tntd-cascader/rc-cascader/OptionList/useActive.js +32 -16
- package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +150 -118
- package/es/tntd-cascader/rc-cascader/context.js +12 -3
- package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +45 -29
- package/es/tntd-cascader/rc-cascader/hooks/useEntities.js +27 -14
- package/es/tntd-cascader/rc-cascader/hooks/useMissingValues.js +21 -10
- package/es/tntd-cascader/rc-cascader/hooks/useRefFunc.js +15 -5
- package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +17 -8
- package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +47 -24
- package/es/tntd-cascader/rc-cascader/index.js +9 -2
- package/es/tntd-cascader/rc-cascader/utils/commonUtil.js +28 -17
- package/es/tntd-cascader/rc-cascader/utils/treeUtil.js +30 -19
- package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +26 -19
- package/es/tntd-form/ErrorList.js +75 -58
- package/es/tntd-form/Form.js +120 -83
- package/es/tntd-form/FormItem/ItemHolder.js +96 -80
- package/es/tntd-form/FormItem/index.js +152 -115
- package/es/tntd-form/FormItemInput.js +56 -44
- package/es/tntd-form/FormItemLabel.js +58 -54
- package/es/tntd-form/FormList.js +42 -29
- package/es/tntd-form/context.js +29 -20
- package/es/tntd-form/hooks/useDebounce.js +24 -6
- package/es/tntd-form/hooks/useForm.js +55 -32
- package/es/tntd-form/hooks/useFormInstance.js +11 -6
- package/es/tntd-form/hooks/useFormItemStatus.js +16 -10
- package/es/tntd-form/hooks/useFrameState.js +34 -15
- package/es/tntd-form/hooks/useItemRef.js +19 -11
- package/es/tntd-form/index.js +26 -16
- package/es/tntd-form/interface.js +7 -2
- package/es/tntd-form/style/index.js +6 -5
- package/es/tntd-form/util.js +15 -8
- package/es/tntd-form/validateMessagesContext.js +8 -2
- package/es/tntd-icon/fonts/iconfont.js +7 -7
- package/es/tntd-icon/index.js +30 -17
- package/es/tntd-layout/ActionsContext.js +8 -2
- package/es/tntd-layout/AppList.js +107 -189
- package/es/tntd-layout/Application.js +74 -96
- package/es/tntd-layout/Avatar.js +72 -118
- package/es/tntd-layout/CompatibleLanguage.js +99 -161
- package/es/tntd-layout/EnterpriseLayout/Avatar.js +84 -132
- package/es/tntd-layout/EnterpriseLayout/Language.js +58 -70
- package/es/tntd-layout/EnterpriseLayout/Theme.js +53 -80
- package/es/tntd-layout/EnterpriseLayout/index.js +22 -15
- package/es/tntd-layout/GlobalNavigation/NavigationPopup.js +196 -221
- package/es/tntd-layout/GlobalNavigation/index.js +82 -96
- package/es/tntd-layout/Header.js +59 -120
- package/es/tntd-layout/HeaderActions.js +70 -95
- package/es/tntd-layout/HeaderNavs.js +64 -79
- package/es/tntd-layout/HeaderTabs.js +146 -249
- package/es/tntd-layout/Iconfont.js +12 -3
- package/es/tntd-layout/Language.js +55 -57
- package/es/tntd-layout/Layout.js +129 -157
- package/es/tntd-layout/Logo.js +52 -108
- package/es/tntd-layout/OrgAppList.js +107 -299
- package/es/tntd-layout/SideMenu.js +191 -375
- package/es/tntd-layout/Theme.js +64 -73
- package/es/tntd-layout/createActions.js +33 -17
- package/es/tntd-layout/images/index.js +63 -57
- package/es/tntd-layout/index.js +78 -51
- package/es/tntd-layout/paaslayout/CompactSideMenu.js +97 -165
- package/es/tntd-layout/paaslayout/Header.js +38 -58
- package/es/tntd-layout/paaslayout/Logo.js +16 -22
- package/es/tntd-layout/paaslayout/SideMenu.js +100 -135
- package/es/tntd-layout/paaslayout/index.js +137 -126
- package/es/tntd-layout/storage.js +47 -20
- package/es/tntd-modal/index.js +61 -42
- package/es/tntd-rc-select/_util/DisabledContext.js +16 -8
- package/es/tntd-rc-select/_util/FormItemInputContext.js +11 -2
- package/es/tntd-rc-select/_util/PurePanel.js +52 -28
- package/es/tntd-rc-select/_util/SizeContext.js +11 -2
- package/es/tntd-rc-select/_util/context.js +13 -6
- package/es/tntd-rc-select/_util/defaultRenderEmpty.js +35 -23
- package/es/tntd-rc-select/_util/getIcons.js +39 -29
- package/es/tntd-rc-select/_util/interface.js +15 -4
- package/es/tntd-rc-select/_util/motion.js +31 -22
- package/es/tntd-rc-select/_util/type.js +18 -2
- package/es/tntd-rc-select/_util/useCompactItemContext.js +25 -19
- package/es/tntd-rc-select/_util/warning.js +15 -6
- package/es/tntd-rc-select/index.js +98 -99
- package/es/tntd-reference/AHref/index.js +18 -13
- package/es/tntd-reference/ReferenceBatchCheck/index.js +85 -73
- package/es/tntd-reference/ReferenceBatchDrawer/index.js +78 -54
- package/es/tntd-reference/ReferenceCheck/index.js +69 -60
- package/es/tntd-reference/ReferenceDrawer/index.js +59 -35
- package/es/tntd-reference/ReferenceInfo/index.js +73 -59
- package/es/tntd-reference/index.js +19 -12
- package/es/tntd-second-page/index.js +41 -31
- package/es/tntd-select/DropDownWrap.js +86 -60
- package/es/tntd-select/index.js +418 -384
- package/es/tntd-virtual-tree/index.js +160 -123
- package/es/tntd-virtual-tree/utils.js +155 -98
- package/es/tntd-virtual-tree-select/index.js +108 -80
- package/es/tntd-virtual-tree-select/utils.js +43 -23
- package/es/tooltip/index.js +25 -5
- package/es/tooltip/style/index.js +5 -3
- package/es/tooltip/tooltip.js +41 -21
- package/es/transfer/index.js +24 -4
- package/es/transfer/style/index.js +8 -7
- package/es/tree/index.js +24 -4
- package/es/tree/style/index.js +4 -2
- package/es/tree-select/index.js +30 -8
- package/es/tree-select/style/index.js +6 -6
- package/es/typography/index.js +24 -4
- package/es/typography/style/index.js +6 -5
- package/es/upload/index.js +129 -89
- package/es/upload/style/index.js +6 -5
- package/es/upload/svg/UploadSVG.js +19 -12
- package/es/utils/checkAuth.js +24 -14
- package/es/utils/findMenuInfoByPath.js +22 -16
- package/es/utils/index.js +93 -32
- package/es/utils/lang.js +27 -17
- package/es/version/index.js +24 -4
- package/es/version/style/index.js +3 -2
- package/es/water-mark/index.js +85 -55
- package/lib/_util/context.js +5 -1
- package/lib/_util/defaultRenderEmpty.js +39 -4
- package/lib/_util/hooks/useFlexGapSupport.js +82 -9
- package/lib/_util/hooks/useForceUpdate.js +82 -9
- package/lib/_util/reactNode.js +34 -3
- package/lib/_util/responsiveObserve.js +31 -4
- package/lib/_util/styleChecker.js +5 -1
- package/lib/_util/warning.js +34 -3
- package/lib/actions/index.js +5 -1
- package/lib/affix/index.js +34 -3
- package/lib/alert/alert.js +61 -7
- package/lib/alert/index.js +5 -1
- package/lib/anchor/index.js +34 -3
- package/lib/array-input/index.js +121 -17
- package/lib/auto-complete/index.js +34 -3
- package/lib/avatar/index.js +34 -3
- package/lib/back-top/index.js +34 -3
- package/lib/badge/index.js +34 -3
- package/lib/breadcrumb/index.js +34 -3
- package/lib/button/button.js +61 -7
- package/lib/calendar/index.js +34 -3
- package/lib/card/card.js +34 -3
- package/lib/carousel/index.js +34 -3
- package/lib/cascader/cascader.js +39 -4
- package/lib/cascader/index.js +34 -3
- package/lib/check-card/group.js +99 -14
- package/lib/check-card/index.js +109 -13
- package/lib/checkbox/checkbox.js +39 -4
- package/lib/checkbox/index.js +34 -3
- package/lib/col/index.js +34 -3
- package/lib/collapse/index.js +34 -3
- package/lib/color-picker/ColorPicker.js +109 -13
- package/lib/color-picker/index.js +5 -1
- package/lib/columns/index.js +5 -1
- package/lib/comment/index.js +34 -3
- package/lib/config-provider/DisabledContext.js +34 -3
- package/lib/config-provider/SizeContext.js +34 -3
- package/lib/config-provider/config-provider.js +5 -1
- package/lib/config-provider/index.js +34 -3
- package/lib/date-picker/DatePicker.js +39 -4
- package/lib/descriptions/descriptions.js +61 -7
- package/lib/development-login/LoginModal.js +109 -13
- package/lib/development-login/index.js +84 -11
- package/lib/divider/index.js +34 -3
- package/lib/drawer/drawer.js +61 -7
- package/lib/dropdown/index.js +34 -3
- package/lib/ellipsis/Svg/CopySVG.js +5 -1
- package/lib/ellipsis/Svg/TickSVG.js +5 -1
- package/lib/ellipsis/index.js +91 -14
- package/lib/empty/empty.js +61 -7
- package/lib/empty/empty.stories.js +12 -2
- package/lib/exception/exception.js +5 -1
- package/lib/form/form.js +61 -7
- package/lib/grid/index.js +34 -3
- package/lib/grid-v4/col.js +61 -7
- package/lib/grid-v4/hooks/useBreakpoint.js +5 -1
- package/lib/grid-v4/index.js +5 -1
- package/lib/grid-v4/row.js +109 -13
- package/lib/handle/index.js +39 -5
- package/lib/handle-icon/index.js +5 -1
- package/lib/icon/IconFont.js +39 -4
- package/lib/icon/components/Icon.js +112 -16
- package/lib/icon/components/index.js +5 -1
- package/lib/icon/components/utils.js +62 -8
- package/lib/icon/index.js +85 -13
- package/lib/icon/twoTonePrimaryColor.js +5 -1
- package/lib/icon/utils.js +5 -1
- package/lib/icon-old/index.js +34 -3
- package/lib/img/Contain.js +5 -1
- package/lib/img/Cover.js +87 -10
- package/lib/img/index.js +87 -10
- package/lib/index.js +5 -1
- package/lib/input/input.js +61 -7
- package/lib/input-number/index.js +34 -3
- package/lib/input-number/inputNumber.js +39 -4
- package/lib/label/index.js +61 -7
- package/lib/layout/index.js +34 -3
- package/lib/list/index.js +34 -3
- package/lib/loading-button/index.js +87 -10
- package/lib/locale/default.js +5 -1
- package/lib/locale/en_US.js +5 -1
- package/lib/locale/zh_CN.js +5 -1
- package/lib/locale-provider/index.js +34 -3
- package/lib/mentions/index.js +34 -3
- package/lib/menu/index.js +34 -3
- package/lib/message/index.js +34 -3
- package/lib/modal/modal.js +39 -4
- package/lib/notification/assets/index.js +5 -1
- package/lib/notification/assets/svg-error-tip.js +34 -3
- package/lib/notification/assets/svg-success-tip.js +34 -3
- package/lib/notification/index.js +5 -1
- package/lib/notification/notification.js +39 -4
- package/lib/page/Box.js +5 -1
- package/lib/page/index.js +60 -11
- package/lib/page-container/index.js +5 -1
- package/lib/page-header/index.js +34 -3
- package/lib/page-loading/index.js +5 -1
- package/lib/pagination/index.js +34 -3
- package/lib/popconfirm/index.js +34 -3
- package/lib/popconfirm/popconfirm.js +39 -4
- package/lib/popover/index.js +34 -3
- package/lib/popover/popover.js +39 -4
- package/lib/preview-text/index.js +39 -4
- package/lib/progress/index.js +34 -3
- package/lib/progress/progress.js +36 -5
- package/lib/query-form/Field/Checkbox.js +5 -1
- package/lib/query-form/Field/Composition/FieldPopover.js +87 -10
- package/lib/query-form/Field/Composition/Select.js +109 -13
- package/lib/query-form/Field/Composition/ValueTag.js +87 -10
- package/lib/query-form/Field/Composition/index.js +121 -17
- package/lib/query-form/Field/Composition/utils.js +5 -1
- package/lib/query-form/Field/Select.js +109 -13
- package/lib/query-form/Field/SelectInput.js +109 -13
- package/lib/query-form/Field/fieldsMap.js +5 -1
- package/lib/query-form/Field/index.js +117 -17
- package/lib/query-form/createActions.js +5 -1
- package/lib/query-form/index.js +113 -18
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/useForm.js +5 -1
- package/lib/query-list-scene/List.js +109 -16
- package/lib/query-list-scene/QueryForm.js +85 -15
- package/lib/query-list-scene/QueryForm.js.map +1 -1
- package/lib/query-list-scene/QueryListScene.js +92 -15
- package/lib/query-list-scene/Title.js +5 -1
- package/lib/query-list-scene/Toolbar.js +36 -5
- package/lib/query-list-scene/createActions.js +5 -1
- package/lib/query-list-scene/index.js +5 -1
- package/lib/query-list-scene/useActions.js +5 -1
- package/lib/radio/index.js +34 -3
- package/lib/radio/radio.js +39 -4
- package/lib/rate/index.js +34 -3
- package/lib/render-empty/render-empty.js +5 -1
- package/lib/result/index.js +34 -3
- package/lib/row/index.js +34 -3
- package/lib/scroll-bar/Bar.js +87 -10
- package/lib/scroll-bar/Context.js +5 -1
- package/lib/scroll-bar/ScrollBar.js +39 -4
- package/lib/scroll-bar/Thumb.js +87 -10
- package/lib/scroll-bar/index.js +5 -1
- package/lib/scroll-bar/util.js +31 -4
- package/lib/segmented/index.js +61 -7
- package/lib/select/select.js +61 -7
- package/lib/skeleton/index.js +34 -3
- package/lib/slider/index.js +34 -3
- package/lib/spin/spin.js +39 -4
- package/lib/statistic/index.js +34 -3
- package/lib/steps/steps.js +61 -7
- package/lib/svg-components/illustration-403.js +34 -3
- package/lib/svg-components/illustration-404.js +34 -3
- package/lib/svg-components/illustration-500.js +34 -3
- package/lib/svg-components/illustration-empty.js +34 -3
- package/lib/svg-components/illustration-failure.js +34 -3
- package/lib/svg-components/illustration-no-access.js +34 -3
- package/lib/svg-components/illustration-no-chart.js +34 -3
- package/lib/svg-components/illustration-no-result.js +34 -3
- package/lib/svg-components/illustration-offline.js +34 -3
- package/lib/svg-components/illustration-success.js +34 -3
- package/lib/svg-components/index.js +5 -1
- package/lib/switch/index.js +34 -3
- package/lib/switch/switch.js +34 -3
- package/lib/table/assets/image-loading-background.js +34 -3
- package/lib/table/assets/image-loading.js +34 -3
- package/lib/table/hooks/use-column-setting.js +48 -6
- package/lib/table/hooks/use-expand-fixed.js +386 -10
- package/lib/table/resizableTable/index.js +109 -13
- package/lib/table/table-hoc.js +5 -1
- package/lib/table/table.js +109 -13
- package/lib/table/table.stories.js +36 -5
- package/lib/table/utils.js +5 -1
- package/lib/table-container/index.js +5 -1
- package/lib/tabs/tabs.js +61 -7
- package/lib/tabs-container/index.js +5 -1
- package/lib/tag/tag.js +61 -7
- package/lib/time-picker/TimePicker.js +39 -4
- package/lib/time-picker/index.js +5 -1
- package/lib/timeline/index.js +34 -3
- package/lib/title/index.js +5 -1
- package/lib/tntd-action/Action.js +87 -10
- package/lib/tntd-action/index.js +87 -10
- package/lib/tntd-cascader/AntdCascader/component/DisabledContext.js +34 -3
- package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.js +34 -3
- package/lib/tntd-cascader/AntdCascader/component/SizeContext.js +34 -3
- package/lib/tntd-cascader/AntdCascader/component/context.js +5 -1
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +39 -4
- package/lib/tntd-cascader/AntdCascader/component/getIcons.js +39 -4
- package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js +61 -7
- package/lib/tntd-cascader/AntdCascader/config/utils.js +36 -5
- package/lib/tntd-cascader/AntdCascader/config/warning.js +34 -3
- package/lib/tntd-cascader/AntdCascader/index.js +85 -13
- package/lib/tntd-cascader/index.js +5 -1
- package/lib/tntd-cascader/rc-cascader/Cascader.js +99 -14
- package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js +61 -7
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +85 -13
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js +121 -17
- package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js +87 -10
- package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +99 -14
- package/lib/tntd-cascader/rc-cascader/context.js +34 -3
- package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +58 -9
- package/lib/tntd-cascader/rc-cascader/hooks/useEntities.js +34 -3
- package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.js +34 -3
- package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.js +34 -3
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +39 -4
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +80 -12
- package/lib/tntd-cascader/rc-cascader/index.js +5 -1
- package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +5 -1
- package/lib/tntd-form/ErrorList.js +85 -13
- package/lib/tntd-form/Form.js +109 -13
- package/lib/tntd-form/FormItem/ItemHolder.js +109 -13
- package/lib/tntd-form/FormItem/index.js +99 -14
- package/lib/tntd-form/FormItemInput.js +39 -4
- package/lib/tntd-form/FormItemLabel.js +61 -7
- package/lib/tntd-form/FormList.js +39 -4
- package/lib/tntd-form/context.js +39 -4
- package/lib/tntd-form/hooks/useDebounce.js +82 -9
- package/lib/tntd-form/hooks/useForm.js +87 -10
- package/lib/tntd-form/hooks/useFormItemStatus.js +5 -1
- package/lib/tntd-form/hooks/useFrameState.js +87 -10
- package/lib/tntd-form/hooks/useItemRef.js +34 -3
- package/lib/tntd-form/index.js +39 -4
- package/lib/tntd-icon/index.js +5 -1
- package/lib/tntd-layout/AppList.js +94 -11
- package/lib/tntd-layout/Application.js +94 -11
- package/lib/tntd-layout/Avatar.js +46 -5
- package/lib/tntd-layout/CompatibleLanguage.js +94 -11
- package/lib/tntd-layout/EnterpriseLayout/Avatar.js +46 -5
- package/lib/tntd-layout/EnterpriseLayout/Language.js +94 -11
- package/lib/tntd-layout/EnterpriseLayout/Theme.js +94 -11
- package/lib/tntd-layout/EnterpriseLayout/index.js +5 -1
- package/lib/tntd-layout/GlobalNavigation/NavigationPopup.js +94 -11
- package/lib/tntd-layout/GlobalNavigation/index.js +106 -15
- package/lib/tntd-layout/Header.js +46 -5
- package/lib/tntd-layout/HeaderActions.js +46 -5
- package/lib/tntd-layout/HeaderNavs.js +94 -11
- package/lib/tntd-layout/HeaderTabs.js +116 -14
- package/lib/tntd-layout/Iconfont.js +5 -1
- package/lib/tntd-layout/Language.js +94 -11
- package/lib/tntd-layout/Layout.js +94 -11
- package/lib/tntd-layout/Logo.js +46 -5
- package/lib/tntd-layout/OrgAppList.js +94 -11
- package/lib/tntd-layout/SideMenu.js +94 -11
- package/lib/tntd-layout/Theme.js +94 -11
- package/lib/tntd-layout/createActions.js +5 -1
- package/lib/tntd-layout/images/index.js +5 -1
- package/lib/tntd-layout/index.js +39 -4
- package/lib/tntd-layout/paaslayout/CompactSideMenu.js +94 -11
- package/lib/tntd-layout/paaslayout/Header.js +46 -5
- package/lib/tntd-layout/paaslayout/Logo.js +12 -2
- package/lib/tntd-layout/paaslayout/SideMenu.js +94 -11
- package/lib/tntd-layout/paaslayout/index.js +94 -11
- package/lib/tntd-layout/storage.js +5 -1
- package/lib/tntd-modal/index.js +109 -13
- package/lib/tntd-rc-select/_util/DisabledContext.js +34 -3
- package/lib/tntd-rc-select/_util/FormItemInputContext.js +34 -3
- package/lib/tntd-rc-select/_util/PurePanel.js +87 -10
- package/lib/tntd-rc-select/_util/SizeContext.js +34 -3
- package/lib/tntd-rc-select/_util/context.js +5 -1
- package/lib/tntd-rc-select/_util/defaultRenderEmpty.js +39 -4
- package/lib/tntd-rc-select/_util/getIcons.js +39 -4
- package/lib/tntd-rc-select/_util/useCompactItemContext.js +61 -7
- package/lib/tntd-rc-select/_util/warning.js +34 -3
- package/lib/tntd-rc-select/index.js +61 -7
- package/lib/tntd-reference/AHref/index.js +5 -1
- package/lib/tntd-reference/ReferenceBatchCheck/index.js +5 -1
- package/lib/tntd-reference/ReferenceBatchDrawer/index.js +87 -10
- package/lib/tntd-reference/ReferenceCheck/index.js +5 -1
- package/lib/tntd-reference/ReferenceDrawer/index.js +87 -10
- package/lib/tntd-reference/ReferenceInfo/index.js +5 -1
- package/lib/tntd-reference/index.js +5 -1
- package/lib/tntd-second-page/index.js +5 -1
- package/lib/tntd-select/DropDownWrap.js +104 -15
- package/lib/tntd-select/index.js +112 -17
- package/lib/tntd-virtual-tree/index.js +105 -20
- package/lib/tntd-virtual-tree/utils.js +72 -7
- package/lib/tntd-virtual-tree-select/index.js +87 -10
- package/lib/tntd-virtual-tree-select/utils.js +24 -6
- package/lib/tooltip/index.js +34 -3
- package/lib/tooltip/tooltip.js +39 -4
- package/lib/transfer/index.js +34 -3
- package/lib/tree/index.js +34 -3
- package/lib/tree-select/index.js +34 -3
- package/lib/typography/index.js +34 -3
- package/lib/upload/index.js +135 -11
- package/lib/upload/svg/UploadSVG.js +5 -1
- package/lib/utils/checkAuth.js +5 -1
- package/lib/utils/index.js +24 -6
- package/lib/utils/lang.js +5 -1
- package/lib/version/index.js +34 -3
- package/lib/water-mark/index.js +87 -10
- package/package.json +2 -2
package/es/tntd-select/index.js
CHANGED
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _configProvider = require("../config-provider");
|
|
10
|
+
var _select = _interopRequireDefault(require("../select"));
|
|
11
|
+
var _empty = _interopRequireDefault(require("../empty"));
|
|
12
|
+
var _spin = _interopRequireDefault(require("../spin"));
|
|
13
|
+
var _utils = require("../utils");
|
|
14
|
+
var _DropDownWrap = _interopRequireDefault(require("./DropDownWrap"));
|
|
15
|
+
var _prevLocale = require("../prev-locale");
|
|
16
|
+
require("./index.less");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
20
|
+
function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
|
|
21
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
22
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
23
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
27
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
28
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
29
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
30
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
31
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
32
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
33
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
2
34
|
var t = {};
|
|
3
35
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4
36
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
@@ -6,44 +38,37 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
6
38
|
}
|
|
7
39
|
return t;
|
|
8
40
|
};
|
|
9
|
-
|
|
10
|
-
import { ConfigConsumer } from '../config-provider';
|
|
11
|
-
import Select from '../select';
|
|
12
|
-
import Empty from '../empty';
|
|
13
|
-
import Spin from '../spin';
|
|
14
|
-
import { capitalizeFirstLetter } from '../utils';
|
|
15
|
-
import DropDownWrap from './DropDownWrap';
|
|
16
|
-
import { getLanguage, getText } from '../prev-locale';
|
|
17
|
-
import './index.less';
|
|
18
|
-
const defaultPlaceholder = getText('select', getLanguage());
|
|
41
|
+
var defaultPlaceholder = (0, _prevLocale.getText)('select', (0, _prevLocale.getLanguage)());
|
|
19
42
|
// 页面实际渲染的下拉菜单数量,实际为 2 * ITEM_ELEMENT_NUMBER
|
|
20
|
-
|
|
43
|
+
var ITEM_ELEMENT_NUMBER = 30;
|
|
21
44
|
// Select size 配置
|
|
22
|
-
|
|
45
|
+
var ITEM_HEIGHT_CFG = {
|
|
23
46
|
small: 24,
|
|
24
47
|
large: 40,
|
|
25
|
-
default: 32
|
|
48
|
+
"default": 32
|
|
26
49
|
};
|
|
27
|
-
|
|
50
|
+
var ARROW_CODE = {
|
|
28
51
|
40: 'down',
|
|
29
52
|
38: 'up'
|
|
30
53
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
var DROPDOWN_HEIGHT = 224;
|
|
55
|
+
var Option = _select["default"].Option;
|
|
56
|
+
var SuperSelect = /*#__PURE__*/function (_PureComponent) {
|
|
57
|
+
function SuperSelect(props) {
|
|
58
|
+
var _this;
|
|
59
|
+
_classCallCheck(this, SuperSelect);
|
|
60
|
+
_this = _callSuper(this, SuperSelect, [props]);
|
|
61
|
+
Object.defineProperty(_this, "turnChildren", {
|
|
37
62
|
enumerable: true,
|
|
38
63
|
configurable: true,
|
|
39
64
|
writable: true,
|
|
40
|
-
value: children
|
|
65
|
+
value: function value(children) {
|
|
41
66
|
if (!children) return [];
|
|
42
|
-
|
|
67
|
+
var arr = [];
|
|
43
68
|
if (children && children.props) {
|
|
44
69
|
arr.push(children);
|
|
45
70
|
} else {
|
|
46
|
-
children.forEach(item
|
|
71
|
+
children.forEach(function (item) {
|
|
47
72
|
if (item) {
|
|
48
73
|
if (item instanceof Array) {
|
|
49
74
|
arr = arr.concat(item);
|
|
@@ -56,412 +81,414 @@ class SuperSelect extends PureComponent {
|
|
|
56
81
|
return arr;
|
|
57
82
|
}
|
|
58
83
|
});
|
|
59
|
-
Object.defineProperty(
|
|
84
|
+
Object.defineProperty(_this, "formulaWidth", {
|
|
60
85
|
enumerable: true,
|
|
61
86
|
configurable: true,
|
|
62
87
|
writable: true,
|
|
63
|
-
value: ()
|
|
88
|
+
value: function value() {
|
|
64
89
|
// 获取dom设置宽度
|
|
65
|
-
|
|
66
|
-
children
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
var _this$props = _this.props,
|
|
91
|
+
arr2 = _this$props.children,
|
|
92
|
+
_this$props$dropdownM = _this$props.dropdownMatchSelectWidth,
|
|
93
|
+
dropdownMatchSelectWidth = _this$props$dropdownM === void 0 ? true : _this$props$dropdownM,
|
|
94
|
+
maxWidth = _this$props.maxWidth;
|
|
95
|
+
var selectDom = document.getElementById(_this.id);
|
|
96
|
+
var selectWidth;
|
|
72
97
|
if (selectDom) {
|
|
73
98
|
selectWidth = selectDom.clientWidth || selectDom.offsetWidth;
|
|
74
99
|
}
|
|
75
|
-
|
|
76
|
-
|
|
100
|
+
var arr = [];
|
|
101
|
+
var formulaMaxWidth = 10;
|
|
77
102
|
if (!dropdownMatchSelectWidth) {
|
|
78
103
|
formulaMaxWidth = maxWidth || 10;
|
|
79
104
|
}
|
|
80
105
|
if (!dropdownMatchSelectWidth && !maxWidth) {
|
|
81
|
-
|
|
82
|
-
for (
|
|
83
|
-
|
|
84
|
-
|
|
106
|
+
var _children = _this.turnChildren(arr2);
|
|
107
|
+
for (var i = 0; i < _children.length; i++) {
|
|
108
|
+
var val = _children[i].props.children;
|
|
109
|
+
var textWidth = _this.getTextPixelWith(val);
|
|
85
110
|
arr.push(textWidth.toFixed(2));
|
|
86
111
|
}
|
|
87
112
|
if (arr.length > 0) {
|
|
88
|
-
formulaMaxWidth = Math.max(
|
|
113
|
+
formulaMaxWidth = Math.max.apply(Math, arr);
|
|
89
114
|
}
|
|
90
115
|
}
|
|
91
|
-
|
|
92
|
-
selectWidth,
|
|
116
|
+
_this.setState({
|
|
117
|
+
selectWidth: selectWidth,
|
|
93
118
|
maxWidth: formulaMaxWidth
|
|
94
119
|
});
|
|
95
120
|
}
|
|
96
121
|
});
|
|
97
122
|
// 获取单行文本的像素宽度
|
|
98
|
-
Object.defineProperty(
|
|
123
|
+
Object.defineProperty(_this, "getTextPixelWith", {
|
|
99
124
|
enumerable: true,
|
|
100
125
|
configurable: true,
|
|
101
126
|
writable: true,
|
|
102
|
-
value: (text
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
value: function value(text) {
|
|
128
|
+
var fontStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '14px';
|
|
129
|
+
var canvas = document.createElement('canvas'); // 创建 canvas 画布
|
|
130
|
+
var context = canvas.getContext('2d'); // 获取 canvas 绘图上下文环境
|
|
105
131
|
context.font = fontStyle; // 设置字体样式,使用前设置好对应的 font 样式才能准确获取文字的像素长度
|
|
106
|
-
|
|
132
|
+
var dimension = context.measureText(text); // 测量文字
|
|
107
133
|
return dimension.width;
|
|
108
134
|
}
|
|
109
135
|
});
|
|
110
|
-
Object.defineProperty(
|
|
136
|
+
Object.defineProperty(_this, "getItemStyle", {
|
|
111
137
|
enumerable: true,
|
|
112
138
|
configurable: true,
|
|
113
139
|
writable: true,
|
|
114
|
-
value: i
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
140
|
+
value: function value(i) {
|
|
141
|
+
return {
|
|
142
|
+
position: 'absolute',
|
|
143
|
+
top: _this.ITEM_HEIGHT * i,
|
|
144
|
+
width: '100%',
|
|
145
|
+
height: _this.ITEM_HEIGHT
|
|
146
|
+
};
|
|
147
|
+
}
|
|
120
148
|
});
|
|
121
|
-
Object.defineProperty(
|
|
149
|
+
Object.defineProperty(_this, "preventEvent", {
|
|
122
150
|
enumerable: true,
|
|
123
151
|
configurable: true,
|
|
124
152
|
writable: true,
|
|
125
|
-
value: e
|
|
153
|
+
value: function value(e) {
|
|
126
154
|
e.preventDefault();
|
|
127
155
|
}
|
|
128
156
|
});
|
|
129
|
-
Object.defineProperty(
|
|
157
|
+
Object.defineProperty(_this, "addEvent", {
|
|
130
158
|
enumerable: true,
|
|
131
159
|
configurable: true,
|
|
132
160
|
writable: true,
|
|
133
|
-
value: ()
|
|
134
|
-
|
|
161
|
+
value: function value() {
|
|
162
|
+
_this.scrollEle = document.querySelector(".".concat(_this.dropdownClassName));
|
|
135
163
|
// 下拉菜单未展开时元素不存在
|
|
136
|
-
if (!
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (!
|
|
141
|
-
|
|
164
|
+
if (!_this.scrollEle) return;
|
|
165
|
+
_this.scrollEle.addEventListener('mousedown', _this.preventEvent, false);
|
|
166
|
+
_this.scrollEle.addEventListener('scroll', _this.onScroll, false);
|
|
167
|
+
_this.inputEle = document.querySelector("#".concat(_this.id));
|
|
168
|
+
if (!_this.inputEle) return;
|
|
169
|
+
_this.inputEle.addEventListener('keydown', _this.onKeyDown, false);
|
|
142
170
|
}
|
|
143
171
|
});
|
|
144
172
|
// 模拟 antd select 按下 上下箭头 键时滚动列表
|
|
145
|
-
Object.defineProperty(
|
|
173
|
+
Object.defineProperty(_this, "onKeyDown", {
|
|
146
174
|
enumerable: true,
|
|
147
175
|
configurable: true,
|
|
148
176
|
writable: true,
|
|
149
|
-
value: e
|
|
150
|
-
|
|
151
|
-
keyCode
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const activeItem = document.querySelector(`.${this.dropdownClassName} .ant-select-dropdown-menu-item-active`);
|
|
177
|
+
value: function value(e) {
|
|
178
|
+
var _ref = e || {},
|
|
179
|
+
keyCode = _ref.keyCode;
|
|
180
|
+
setTimeout(function () {
|
|
181
|
+
var activeItem = document.querySelector(".".concat(_this.dropdownClassName, " .ant-select-dropdown-menu-item-active"));
|
|
155
182
|
if (!activeItem) return;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const isUp = ARROW_CODE[keyCode] === 'up';
|
|
160
|
-
const isDown = ARROW_CODE[keyCode] === 'down';
|
|
183
|
+
var offsetTop = activeItem.offsetTop;
|
|
184
|
+
var isUp = ARROW_CODE[keyCode] === 'up';
|
|
185
|
+
var isDown = ARROW_CODE[keyCode] === 'down';
|
|
161
186
|
// 在所有列表第一行按上键
|
|
162
|
-
if (offsetTop -
|
|
163
|
-
|
|
164
|
-
|
|
187
|
+
if (offsetTop - _this.prevTop > DROPDOWN_HEIGHT && isUp && _this.scrollEle) {
|
|
188
|
+
_this.scrollEle.scrollTo(0, _this.allHeight - DROPDOWN_HEIGHT);
|
|
189
|
+
_this.prevTop = _this.allHeight;
|
|
165
190
|
return;
|
|
166
191
|
}
|
|
167
192
|
// 在所有列表中最后一行按下键
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
193
|
+
if (_this.prevTop > offsetTop + DROPDOWN_HEIGHT && isDown && _this.scrollEle) {
|
|
194
|
+
_this.scrollEle.scrollTo(0, 0);
|
|
195
|
+
_this.prevTop = 0;
|
|
171
196
|
return;
|
|
172
197
|
}
|
|
173
|
-
|
|
198
|
+
_this.prevTop = offsetTop;
|
|
174
199
|
// 向下滚动到下拉框最后一行时,向下滚动一行的高度
|
|
175
|
-
if (offsetTop >
|
|
176
|
-
|
|
200
|
+
if (offsetTop > _this.scrollEle.scrollTop + DROPDOWN_HEIGHT - _this.ITEM_HEIGHT + 10 && isDown) {
|
|
201
|
+
_this.scrollEle.scrollTo(0, _this.scrollTop + _this.ITEM_HEIGHT);
|
|
177
202
|
return;
|
|
178
203
|
}
|
|
179
204
|
// 向上滚动到下拉框第一一行时,向上滚动一行的高度
|
|
180
|
-
if (offsetTop <
|
|
181
|
-
|
|
205
|
+
if (offsetTop < _this.scrollEle.scrollTop && isUp) {
|
|
206
|
+
_this.scrollEle.scrollTo(0, _this.scrollTop - _this.ITEM_HEIGHT);
|
|
182
207
|
}
|
|
183
208
|
}, 100);
|
|
184
209
|
}
|
|
185
210
|
});
|
|
186
|
-
Object.defineProperty(
|
|
211
|
+
Object.defineProperty(_this, "onScroll", {
|
|
187
212
|
enumerable: true,
|
|
188
213
|
configurable: true,
|
|
189
214
|
writable: true,
|
|
190
|
-
value: ()
|
|
215
|
+
value: function value() {
|
|
216
|
+
return _this.throttleByHeight(_this.onScrollReal);
|
|
217
|
+
}
|
|
191
218
|
});
|
|
192
|
-
Object.defineProperty(
|
|
219
|
+
Object.defineProperty(_this, "onScrollReal", {
|
|
193
220
|
enumerable: true,
|
|
194
221
|
configurable: true,
|
|
195
222
|
writable: true,
|
|
196
|
-
value: ()
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
startIndex,
|
|
200
|
-
endIndex
|
|
201
|
-
|
|
202
|
-
this.prevScrollTop = this.scrollTop;
|
|
223
|
+
value: function value() {
|
|
224
|
+
_this.allList = _this.getUseChildrenList();
|
|
225
|
+
var _this$getStartAndEndI = _this.getStartAndEndIndex(),
|
|
226
|
+
startIndex = _this$getStartAndEndI.startIndex,
|
|
227
|
+
endIndex = _this$getStartAndEndI.endIndex;
|
|
228
|
+
_this.prevScrollTop = _this.scrollTop;
|
|
203
229
|
// 重新渲染列表组件 Wrap
|
|
204
|
-
|
|
205
|
-
|
|
230
|
+
var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
|
|
231
|
+
_this.wrap.reactList(allHeight, startIndex, endIndex);
|
|
206
232
|
}
|
|
207
233
|
});
|
|
208
|
-
Object.defineProperty(
|
|
234
|
+
Object.defineProperty(_this, "throttleByHeight", {
|
|
209
235
|
enumerable: true,
|
|
210
236
|
configurable: true,
|
|
211
237
|
writable: true,
|
|
212
|
-
value: ()
|
|
213
|
-
|
|
238
|
+
value: function value() {
|
|
239
|
+
_this.scrollTop = _this.scrollEle.scrollTop;
|
|
214
240
|
// 滚动的高度
|
|
215
|
-
|
|
241
|
+
var delta = _this.prevScrollTop - _this.scrollTop;
|
|
216
242
|
delta = delta < 0 ? 0 - delta : delta;
|
|
217
|
-
delta >
|
|
243
|
+
delta > _this.reactDelta && _this.onScrollReal();
|
|
218
244
|
}
|
|
219
245
|
});
|
|
220
246
|
// 列表可展示所有 children
|
|
221
|
-
Object.defineProperty(
|
|
247
|
+
Object.defineProperty(_this, "getUseChildrenList", {
|
|
222
248
|
enumerable: true,
|
|
223
249
|
configurable: true,
|
|
224
250
|
writable: true,
|
|
225
|
-
value: ()
|
|
251
|
+
value: function value() {
|
|
252
|
+
return _this.state.filterChildren || _this.state.children;
|
|
253
|
+
}
|
|
226
254
|
});
|
|
227
|
-
Object.defineProperty(
|
|
255
|
+
Object.defineProperty(_this, "getStartAndEndIndex", {
|
|
228
256
|
enumerable: true,
|
|
229
257
|
configurable: true,
|
|
230
258
|
writable: true,
|
|
231
|
-
value: ()
|
|
259
|
+
value: function value() {
|
|
232
260
|
// 滚动后显示在列表可视区中的第一个 item 的 index
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
261
|
+
var showIndex = Number((_this.scrollTop / _this.ITEM_HEIGHT).toFixed(0));
|
|
262
|
+
var startIndex = showIndex - ITEM_ELEMENT_NUMBER < 0 ? 0 : showIndex - ITEM_ELEMENT_NUMBER / 2;
|
|
263
|
+
var endIndex = showIndex + ITEM_ELEMENT_NUMBER;
|
|
236
264
|
return {
|
|
237
|
-
startIndex,
|
|
238
|
-
endIndex
|
|
265
|
+
startIndex: startIndex,
|
|
266
|
+
endIndex: endIndex
|
|
239
267
|
};
|
|
240
268
|
}
|
|
241
269
|
});
|
|
242
270
|
// 须使用 setTimeout 确保在 dom 加载完成之后添加事件
|
|
243
|
-
Object.defineProperty(
|
|
271
|
+
Object.defineProperty(_this, "setSuperDropDownMenu", {
|
|
244
272
|
enumerable: true,
|
|
245
273
|
configurable: true,
|
|
246
274
|
writable: true,
|
|
247
|
-
value: visible
|
|
275
|
+
value: function value(visible) {
|
|
248
276
|
if (!visible) return;
|
|
249
|
-
|
|
250
|
-
if (!
|
|
251
|
-
|
|
277
|
+
_this.allList = _this.getUseChildrenList();
|
|
278
|
+
if (!_this.eventTimer || !_this.scrollEle) {
|
|
279
|
+
_this.eventTimer = setTimeout(function () {
|
|
280
|
+
return _this.addEvent();
|
|
281
|
+
}, 0);
|
|
252
282
|
} else {
|
|
253
|
-
|
|
283
|
+
var allHeight = _this.allList.length * _this.ITEM_HEIGHT || 100;
|
|
254
284
|
// 下拉列表单独重新渲染
|
|
255
|
-
|
|
256
|
-
startIndex,
|
|
257
|
-
endIndex
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this.wrap && this.wrap.reactList(allHeight, startIndex, endIndex);
|
|
285
|
+
var _this$getStartAndEndI2 = _this.getStartAndEndIndex(),
|
|
286
|
+
startIndex = _this$getStartAndEndI2.startIndex,
|
|
287
|
+
endIndex = _this$getStartAndEndI2.endIndex;
|
|
288
|
+
setTimeout(function () {
|
|
289
|
+
_this.wrap && _this.wrap.reactList(allHeight, startIndex, endIndex);
|
|
261
290
|
}, 0);
|
|
262
291
|
}
|
|
263
292
|
}
|
|
264
293
|
});
|
|
265
|
-
Object.defineProperty(
|
|
294
|
+
Object.defineProperty(_this, "onDropdownVisibleChange", {
|
|
266
295
|
enumerable: true,
|
|
267
296
|
configurable: true,
|
|
268
297
|
writable: true,
|
|
269
|
-
value: visible
|
|
270
|
-
|
|
271
|
-
onDropdownVisibleChange
|
|
272
|
-
} = this.props;
|
|
298
|
+
value: function value(visible) {
|
|
299
|
+
var onDropdownVisibleChange = _this.props.onDropdownVisibleChange;
|
|
273
300
|
onDropdownVisibleChange && onDropdownVisibleChange(visible);
|
|
274
|
-
|
|
275
|
-
value,
|
|
276
|
-
children
|
|
277
|
-
} = this.state;
|
|
301
|
+
var _this$state = _this.state,
|
|
302
|
+
value = _this$state.value,
|
|
303
|
+
children = _this$state.children;
|
|
278
304
|
// 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
|
|
279
305
|
if (!visible) {
|
|
280
306
|
// 定时器确保关闭后再设置 filterChildren,防止列表刷新闪烁
|
|
281
|
-
setTimeout(()
|
|
282
|
-
|
|
307
|
+
setTimeout(function () {
|
|
308
|
+
_this.setState({
|
|
283
309
|
filterChildren: null
|
|
284
310
|
});
|
|
285
|
-
|
|
311
|
+
_this.setDefaultScrollTop(value);
|
|
286
312
|
}, 100);
|
|
287
313
|
// this.removeEvent();
|
|
288
314
|
} else {
|
|
289
315
|
// this.addEvent();
|
|
290
316
|
if (value) {
|
|
291
317
|
// 如果已有 value, 设置默认滚动位置
|
|
292
|
-
|
|
318
|
+
_this.setDefaultScrollTop();
|
|
293
319
|
// 设置下拉列表显示数据
|
|
294
|
-
|
|
320
|
+
_this.setSuperDropDownMenu(visible);
|
|
295
321
|
} else if (!value && value !== 0 && children && children.length > 0) {
|
|
296
322
|
// 无数据时,下拉回归至第一个
|
|
297
|
-
|
|
298
|
-
|
|
323
|
+
var val = children[0].props.value;
|
|
324
|
+
_this.setDefaultScrollTop(val);
|
|
299
325
|
}
|
|
300
326
|
}
|
|
301
327
|
}
|
|
302
328
|
});
|
|
303
|
-
Object.defineProperty(
|
|
329
|
+
Object.defineProperty(_this, "onDeselect", {
|
|
304
330
|
enumerable: true,
|
|
305
331
|
configurable: true,
|
|
306
332
|
writable: true,
|
|
307
|
-
value: value
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
} = this.props;
|
|
311
|
-
onDeselect && onDeselect(value);
|
|
333
|
+
value: function value(_value) {
|
|
334
|
+
var onDeselect = _this.props.onDeselect;
|
|
335
|
+
onDeselect && onDeselect(_value);
|
|
312
336
|
}
|
|
313
337
|
});
|
|
314
338
|
// 在搜索重新计算下拉滚动条高度
|
|
315
|
-
Object.defineProperty(
|
|
339
|
+
Object.defineProperty(_this, "onChange", {
|
|
316
340
|
enumerable: true,
|
|
317
341
|
configurable: true,
|
|
318
342
|
writable: true,
|
|
319
|
-
value: (
|
|
320
|
-
|
|
321
|
-
showSearch,
|
|
322
|
-
onChange,
|
|
323
|
-
autoClearSearchValue,
|
|
324
|
-
maxCount,
|
|
325
|
-
mode
|
|
326
|
-
|
|
327
|
-
if (showSearch || this.isMultiple) {
|
|
343
|
+
value: function value(_value2, opt) {
|
|
344
|
+
var _this$props2 = _this.props,
|
|
345
|
+
showSearch = _this$props2.showSearch,
|
|
346
|
+
onChange = _this$props2.onChange,
|
|
347
|
+
autoClearSearchValue = _this$props2.autoClearSearchValue,
|
|
348
|
+
maxCount = _this$props2.maxCount,
|
|
349
|
+
mode = _this$props2.mode;
|
|
350
|
+
if (showSearch || _this.isMultiple) {
|
|
328
351
|
// 搜索模式下选择后是否需要重置搜索状态
|
|
329
352
|
if (autoClearSearchValue !== false) {
|
|
330
|
-
|
|
353
|
+
_this.setState({
|
|
331
354
|
filterChildren: null
|
|
332
|
-
}, ()
|
|
355
|
+
}, function () {
|
|
333
356
|
// 搜索成功后重新设置列表的总高度
|
|
334
|
-
|
|
357
|
+
_this.setSuperDropDownMenu(true);
|
|
335
358
|
});
|
|
336
359
|
}
|
|
337
360
|
}
|
|
338
361
|
if (mode === 'multiple') {
|
|
339
|
-
if (
|
|
340
|
-
|
|
341
|
-
value
|
|
362
|
+
if (_value2.length <= maxCount) {
|
|
363
|
+
_this.setState({
|
|
364
|
+
value: _value2
|
|
342
365
|
});
|
|
343
366
|
}
|
|
344
367
|
} else {
|
|
345
|
-
|
|
346
|
-
value
|
|
368
|
+
_this.setState({
|
|
369
|
+
value: _value2
|
|
347
370
|
});
|
|
348
371
|
}
|
|
349
|
-
onChange && onChange(
|
|
372
|
+
onChange && onChange(_value2, opt);
|
|
350
373
|
if (mode !== 'multiple') {
|
|
351
|
-
|
|
374
|
+
_this.select && _this.select.blur();
|
|
352
375
|
}
|
|
353
376
|
}
|
|
354
377
|
});
|
|
355
|
-
Object.defineProperty(
|
|
378
|
+
Object.defineProperty(_this, "onSearch", {
|
|
356
379
|
enumerable: true,
|
|
357
380
|
configurable: true,
|
|
358
381
|
writable: true,
|
|
359
|
-
value: v
|
|
360
|
-
|
|
361
|
-
showSearch,
|
|
362
|
-
onSearch,
|
|
363
|
-
filterOption,
|
|
364
|
-
children
|
|
365
|
-
|
|
366
|
-
let children = this.turnChildren(arr);
|
|
382
|
+
value: function value(v) {
|
|
383
|
+
var _this$props3 = _this.props,
|
|
384
|
+
showSearch = _this$props3.showSearch,
|
|
385
|
+
onSearch = _this$props3.onSearch,
|
|
386
|
+
filterOption = _this$props3.filterOption,
|
|
387
|
+
arr = _this$props3.children;
|
|
388
|
+
var children = _this.turnChildren(arr);
|
|
367
389
|
if (showSearch && filterOption !== false) {
|
|
368
390
|
// 须根据 filterOption(如有该自定义函数)手动 filter 搜索匹配的列表
|
|
369
|
-
|
|
391
|
+
var filterChildren = null;
|
|
370
392
|
if (typeof filterOption === 'function') {
|
|
371
|
-
filterChildren = children.filter(
|
|
393
|
+
filterChildren = children.filter(function (item) {
|
|
394
|
+
return filterOption(v, item);
|
|
395
|
+
});
|
|
372
396
|
} else if (filterOption === undefined) {
|
|
373
|
-
filterChildren = children.filter(
|
|
397
|
+
filterChildren = children.filter(function (item) {
|
|
398
|
+
return _this.filterOption(v, item);
|
|
399
|
+
});
|
|
374
400
|
}
|
|
375
401
|
// 搜索框有值,去除disabled=true的children
|
|
376
|
-
|
|
377
|
-
filterChildren && filterChildren.forEach((item, index)
|
|
402
|
+
var newFilterChild = [];
|
|
403
|
+
filterChildren && filterChildren.forEach(function (item, index) {
|
|
378
404
|
if (!item.props.disabled) {
|
|
379
405
|
newFilterChild.push(item);
|
|
380
406
|
}
|
|
381
407
|
});
|
|
382
408
|
filterChildren = newFilterChild;
|
|
383
409
|
// 设置下拉列表显示数据
|
|
384
|
-
|
|
410
|
+
_this.setState({
|
|
385
411
|
filterChildren: v === '' ? null : filterChildren
|
|
386
|
-
}, ()
|
|
387
|
-
setTimeout(()
|
|
412
|
+
}, function () {
|
|
413
|
+
setTimeout(function () {
|
|
388
414
|
// 搜索后需要重置滚动位置到0,防止上次 scrollTop 位置无数据
|
|
389
|
-
if (filterChildren &&
|
|
390
|
-
|
|
391
|
-
|
|
415
|
+
if (filterChildren && _this.scrollEle) {
|
|
416
|
+
_this.scrollTop = 0;
|
|
417
|
+
_this.scrollEle.scrollTo(0, 0);
|
|
392
418
|
}
|
|
393
419
|
// 搜索成功后需要重新设置列表的总高度
|
|
394
|
-
|
|
420
|
+
_this.setSuperDropDownMenu(true);
|
|
395
421
|
}, 0);
|
|
396
422
|
});
|
|
397
423
|
}
|
|
398
424
|
onSearch && onSearch(v);
|
|
399
425
|
}
|
|
400
426
|
});
|
|
401
|
-
Object.defineProperty(
|
|
427
|
+
Object.defineProperty(_this, "filterOption", {
|
|
402
428
|
enumerable: true,
|
|
403
429
|
configurable: true,
|
|
404
430
|
writable: true,
|
|
405
|
-
value: (v, option)
|
|
431
|
+
value: function value(v, option) {
|
|
406
432
|
// 自定义过滤对应的 option 属性配置
|
|
407
|
-
|
|
408
|
-
return
|
|
433
|
+
var filterProps = _this.props.optionFilterProp || 'value';
|
|
434
|
+
return "".concat(option.props[filterProps]).indexOf(v) >= 0;
|
|
409
435
|
}
|
|
410
436
|
});
|
|
411
|
-
Object.defineProperty(
|
|
437
|
+
Object.defineProperty(_this, "setDefaultScrollTop", {
|
|
412
438
|
enumerable: true,
|
|
413
439
|
configurable: true,
|
|
414
440
|
writable: true,
|
|
415
|
-
value: data
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
441
|
+
value: function value(data) {
|
|
442
|
+
var value = _this.state.value;
|
|
443
|
+
var arr = _this.props.children;
|
|
444
|
+
var children = _this.turnChildren(arr);
|
|
445
|
+
var val = data || data === 0 ? data : value;
|
|
446
|
+
var _loop = function _loop() {
|
|
447
|
+
var item = children[i];
|
|
448
|
+
var itemValue = item.props.value;
|
|
449
|
+
if (itemValue === val || Array.isArray(val) && val.includes(itemValue)) {
|
|
450
|
+
var targetScrollTop = i * _this.ITEM_HEIGHT;
|
|
451
|
+
setTimeout(function () {
|
|
452
|
+
if (!_this.scrollEle) {
|
|
453
|
+
_this.addEvent();
|
|
454
|
+
}
|
|
455
|
+
_this.scrollEle && _this.scrollEle.scrollTo(0, targetScrollTop);
|
|
456
|
+
}, 100);
|
|
457
|
+
return {
|
|
458
|
+
v: void 0
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
_ret;
|
|
463
|
+
for (var i = 0; i < children.length; i++) {
|
|
464
|
+
_ret = _loop();
|
|
465
|
+
if (_ret) return _ret.v;
|
|
437
466
|
}
|
|
438
467
|
}
|
|
439
468
|
});
|
|
440
|
-
Object.defineProperty(
|
|
469
|
+
Object.defineProperty(_this, "removeEvent", {
|
|
441
470
|
enumerable: true,
|
|
442
471
|
configurable: true,
|
|
443
472
|
writable: true,
|
|
444
|
-
value: ()
|
|
445
|
-
if (!
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
if (!
|
|
449
|
-
|
|
473
|
+
value: function value() {
|
|
474
|
+
if (!_this.scrollEle) return;
|
|
475
|
+
_this.scrollEle.removeEventListener('mousedown', _this.preventEvent, false);
|
|
476
|
+
_this.scrollEle.removeEventListener('scroll', _this.onScroll, false);
|
|
477
|
+
if (!_this.inputEle) return;
|
|
478
|
+
_this.inputEle.removeEventListener('keydown', _this.onKeyDown, false);
|
|
450
479
|
}
|
|
451
480
|
});
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
this.isMultiple = ['tags', 'multiple'].includes(mode);
|
|
460
|
-
const children = this.turnChildren(arr);
|
|
481
|
+
var mode = props.mode,
|
|
482
|
+
defaultValue = props.defaultValue,
|
|
483
|
+
value = props.value,
|
|
484
|
+
optionHeight = props.optionHeight,
|
|
485
|
+
arr = props.children;
|
|
486
|
+
_this.isMultiple = ['tags', 'multiple'].includes(mode);
|
|
487
|
+
var children = _this.turnChildren(arr);
|
|
461
488
|
// 设置默认 value
|
|
462
|
-
|
|
489
|
+
var defaultV = _this.isMultiple ? [] : '';
|
|
463
490
|
defaultV = value || defaultValue || defaultV;
|
|
464
|
-
|
|
491
|
+
_this.state = {
|
|
465
492
|
children: children || [],
|
|
466
493
|
filterChildren: null,
|
|
467
494
|
value: defaultV,
|
|
@@ -469,172 +496,179 @@ class SuperSelect extends PureComponent {
|
|
|
469
496
|
selectWidth: null
|
|
470
497
|
};
|
|
471
498
|
// 下拉菜单项行高
|
|
472
|
-
|
|
499
|
+
_this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
|
|
473
500
|
// 可视区 dom 高度
|
|
474
|
-
|
|
501
|
+
_this.visibleDomHeight = _this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
|
|
475
502
|
// 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
|
|
476
|
-
|
|
503
|
+
_this.reactDelta = _this.visibleDomHeight / 3;
|
|
477
504
|
// 是否拖动滚动条快速滚动状态
|
|
478
|
-
|
|
505
|
+
_this.isStopReact = false;
|
|
479
506
|
// 上一次滚动的 scrollTop 值
|
|
480
|
-
|
|
507
|
+
_this.prevScrollTop = 0;
|
|
481
508
|
// 上一次按下方向键时 scrollTop 值
|
|
482
|
-
|
|
483
|
-
|
|
509
|
+
_this.prevTop = 0;
|
|
510
|
+
_this.scrollTop = 0;
|
|
484
511
|
// className
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
componentDidMount() {
|
|
489
|
-
// defaultOpens=true 时添加滚动事件
|
|
490
|
-
setTimeout(() => {
|
|
491
|
-
this.addEvent();
|
|
492
|
-
}, 500);
|
|
493
|
-
const {
|
|
494
|
-
children: arr
|
|
495
|
-
} = this.props;
|
|
496
|
-
const children = this.turnChildren(arr);
|
|
497
|
-
// if (children && children.length > 0) {
|
|
498
|
-
this.formulaWidth();
|
|
499
|
-
// }
|
|
512
|
+
_this.dropdownClassName = "dc".concat(+new Date());
|
|
513
|
+
_this.id = "sid".concat(+new Date());
|
|
514
|
+
return _this;
|
|
500
515
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
this.
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
if (arr && arr.length > 0) {
|
|
516
|
-
// 设置下拉列表显示数据
|
|
517
|
-
if (!value) {
|
|
518
|
-
this.scrollTop = 0;
|
|
519
|
-
this.scrollEle && this.scrollEle.scrollTo(0, 0);
|
|
520
|
-
this.setSuperDropDownMenu(true);
|
|
521
|
-
}
|
|
522
|
-
this.formulaWidth();
|
|
523
|
-
if (!this.inputEle) {
|
|
524
|
-
this.removeEvent();
|
|
525
|
-
this.addEvent();
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
if (prevProps.value !== value) {
|
|
531
|
-
// 更新时设置默认 value
|
|
532
|
-
let defaultV = this.isMultiple ? [] : '';
|
|
533
|
-
defaultV = value || defaultValue || defaultV;
|
|
534
|
-
this.setState({
|
|
535
|
-
value: defaultV
|
|
536
|
-
});
|
|
516
|
+
_inherits(SuperSelect, _PureComponent);
|
|
517
|
+
return _createClass(SuperSelect, [{
|
|
518
|
+
key: "componentDidMount",
|
|
519
|
+
value: function componentDidMount() {
|
|
520
|
+
var _this2 = this;
|
|
521
|
+
// defaultOpens=true 时添加滚动事件
|
|
522
|
+
setTimeout(function () {
|
|
523
|
+
_this2.addEvent();
|
|
524
|
+
}, 500);
|
|
525
|
+
var arr = this.props.children;
|
|
526
|
+
var children = this.turnChildren(arr);
|
|
527
|
+
// if (children && children.length > 0) {
|
|
528
|
+
this.formulaWidth();
|
|
529
|
+
// }
|
|
537
530
|
}
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
{
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
531
|
+
}, {
|
|
532
|
+
key: "componentDidUpdate",
|
|
533
|
+
value: function componentDidUpdate(prevProps) {
|
|
534
|
+
var _this3 = this;
|
|
535
|
+
var _this$props4 = this.props,
|
|
536
|
+
mode = _this$props4.mode,
|
|
537
|
+
defaultValue = _this$props4.defaultValue,
|
|
538
|
+
value = _this$props4.value,
|
|
539
|
+
children = _this$props4.children;
|
|
540
|
+
var arr = this.turnChildren(children);
|
|
541
|
+
if (prevProps.children !== children) {
|
|
542
|
+
this.isMultiple = ['tags', 'multiple'].includes(mode);
|
|
543
|
+
this.setState({
|
|
544
|
+
children: arr || [],
|
|
545
|
+
filterChildren: null
|
|
546
|
+
}, function () {
|
|
547
|
+
if (arr && arr.length > 0) {
|
|
548
|
+
// 设置下拉列表显示数据
|
|
549
|
+
if (!value) {
|
|
550
|
+
_this3.scrollTop = 0;
|
|
551
|
+
_this3.scrollEle && _this3.scrollEle.scrollTo(0, 0);
|
|
552
|
+
_this3.setSuperDropDownMenu(true);
|
|
553
|
+
}
|
|
554
|
+
_this3.formulaWidth();
|
|
555
|
+
if (!_this3.inputEle) {
|
|
556
|
+
_this3.removeEvent();
|
|
557
|
+
_this3.addEvent();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
if (prevProps.value !== value) {
|
|
563
|
+
// 更新时设置默认 value
|
|
564
|
+
var defaultV = this.isMultiple ? [] : '';
|
|
565
|
+
defaultV = value || defaultValue || defaultV;
|
|
566
|
+
this.setState({
|
|
567
|
+
value: defaultV
|
|
568
|
+
});
|
|
569
|
+
}
|
|
566
570
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
position: 'relative',
|
|
572
|
-
maxWidth: dynamicWidth
|
|
573
|
-
});
|
|
574
|
-
const {
|
|
575
|
-
value
|
|
576
|
-
} = this.state;
|
|
577
|
-
// 判断处于 antd Form 中时不自动设置 value
|
|
578
|
-
const _props = Object.assign({}, props);
|
|
579
|
-
// 先删除 value,再手动赋值,防止空 value 影响 placeholder
|
|
580
|
-
delete _props.value;
|
|
581
|
-
// value 为空字符会隐藏 placeholder,改为 undefined
|
|
582
|
-
if (typeof value === 'string' && !value) {
|
|
583
|
-
_props.value = undefined;
|
|
584
|
-
} else {
|
|
585
|
-
_props.value = value;
|
|
571
|
+
}, {
|
|
572
|
+
key: "componentWillUnmount",
|
|
573
|
+
value: function componentWillUnmount() {
|
|
574
|
+
this.removeEvent();
|
|
586
575
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
576
|
+
}, {
|
|
577
|
+
key: "render",
|
|
578
|
+
value: function render() {
|
|
579
|
+
var _this4 = this;
|
|
580
|
+
var _this$state2 = this.state,
|
|
581
|
+
maxWidth = _this$state2.maxWidth,
|
|
582
|
+
selectWidth = _this$state2.selectWidth;
|
|
583
|
+
var _a = this.props,
|
|
584
|
+
dropdownStyle = _a.dropdownStyle,
|
|
585
|
+
optionLabelProp = _a.optionLabelProp,
|
|
586
|
+
dropdownClassName = _a.dropdownClassName,
|
|
587
|
+
_a$placeholder = _a.placeholder,
|
|
588
|
+
placeholder = _a$placeholder === void 0 ? defaultPlaceholder : _a$placeholder,
|
|
589
|
+
capitalize = _a.capitalize,
|
|
590
|
+
renderEmpty = _a.renderEmpty,
|
|
591
|
+
props = __rest(_a, ["dropdownStyle", "optionLabelProp", "dropdownClassName", "placeholder", "capitalize", "renderEmpty"]);
|
|
592
|
+
this.allList = this.getUseChildrenList();
|
|
593
|
+
this.allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
|
|
594
|
+
var _this$getStartAndEndI3 = this.getStartAndEndIndex(),
|
|
595
|
+
startIndex = _this$getStartAndEndI3.startIndex,
|
|
596
|
+
endIndex = _this$getStartAndEndI3.endIndex;
|
|
597
|
+
var dynamicWidth = maxWidth;
|
|
598
|
+
if (this.allList.length === 0 || maxWidth < selectWidth) {
|
|
599
|
+
dynamicWidth = selectWidth;
|
|
600
|
+
}
|
|
601
|
+
dropdownStyle = Object.assign(Object.assign({
|
|
602
|
+
maxHeight: "".concat(DROPDOWN_HEIGHT, "px")
|
|
603
|
+
}, dropdownStyle), {
|
|
604
|
+
overflow: 'auto',
|
|
605
|
+
position: 'relative',
|
|
606
|
+
maxWidth: dynamicWidth
|
|
607
|
+
});
|
|
608
|
+
var value = this.state.value;
|
|
609
|
+
// 判断处于 antd Form 中时不自动设置 value
|
|
610
|
+
var _props = Object.assign({}, props);
|
|
611
|
+
// 先删除 value,再手动赋值,防止空 value 影响 placeholder
|
|
612
|
+
delete _props.value;
|
|
613
|
+
// value 为空字符会隐藏 placeholder,改为 undefined
|
|
614
|
+
if (typeof value === 'string' && !value) {
|
|
615
|
+
_props.value = undefined;
|
|
616
|
+
} else {
|
|
617
|
+
_props.value = value;
|
|
618
|
+
}
|
|
619
|
+
optionLabelProp = optionLabelProp || 'children';
|
|
620
|
+
return _react["default"].createElement(_select["default"], Object.assign({}, _props, {
|
|
621
|
+
id: this.id,
|
|
622
|
+
placeholder: (0, _utils.capitalizeFirstLetter)(placeholder, capitalize),
|
|
623
|
+
onSearch: this.onSearch,
|
|
624
|
+
onChange: this.onChange,
|
|
625
|
+
dropdownClassName: "".concat(this.dropdownClassName, " ").concat(dropdownClassName || ''),
|
|
626
|
+
optionLabelProp: optionLabelProp,
|
|
627
|
+
dropdownStyle: dropdownStyle,
|
|
628
|
+
onDropdownVisibleChange: this.onDropdownVisibleChange,
|
|
629
|
+
onDeselect: this.onDeselect,
|
|
630
|
+
ref: function ref(ele) {
|
|
631
|
+
return _this4.select = ele;
|
|
632
|
+
},
|
|
633
|
+
dropdownRender: function dropdownRender(menu, props) {
|
|
634
|
+
if (_props.loading) {
|
|
635
|
+
return _react["default"].createElement(_spin["default"], {
|
|
636
|
+
size: "small",
|
|
637
|
+
style: {
|
|
638
|
+
marginLeft: 8
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
if (_this4.allList.length === 0) {
|
|
643
|
+
return _react["default"].createElement("div", {
|
|
644
|
+
className: "tntd-select-empty-container"
|
|
645
|
+
}, renderEmpty ? renderEmpty('Select') : _react["default"].createElement(_empty["default"], {
|
|
646
|
+
image: _empty["default"].PRESENTED_IMAGE_SIMPLE
|
|
647
|
+
}));
|
|
648
|
+
}
|
|
649
|
+
return _react["default"].createElement(_DropDownWrap["default"], Object.assign({}, {
|
|
650
|
+
startIndex: startIndex,
|
|
651
|
+
endIndex: endIndex,
|
|
652
|
+
allHeight: _this4.allHeight,
|
|
653
|
+
menu: menu,
|
|
654
|
+
itemHeight: _this4.ITEM_HEIGHT
|
|
655
|
+
}, {
|
|
656
|
+
ref: function ref(ele) {
|
|
657
|
+
_this4.wrap = ele;
|
|
605
658
|
}
|
|
606
|
-
});
|
|
607
|
-
}
|
|
608
|
-
if (this.allList.length === 0) {
|
|
609
|
-
return React.createElement("div", {
|
|
610
|
-
className: "tntd-select-empty-container"
|
|
611
|
-
}, renderEmpty ? renderEmpty('Select') : React.createElement(Empty, {
|
|
612
|
-
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
613
659
|
}));
|
|
614
660
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
menu,
|
|
620
|
-
itemHeight: this.ITEM_HEIGHT
|
|
621
|
-
}, {
|
|
622
|
-
ref: ele => {
|
|
623
|
-
this.wrap = ele;
|
|
624
|
-
}
|
|
625
|
-
}));
|
|
626
|
-
}
|
|
627
|
-
}), this.allList);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
661
|
+
}), this.allList);
|
|
662
|
+
}
|
|
663
|
+
}]);
|
|
664
|
+
}(_react.PureComponent);
|
|
630
665
|
function TntdSelect(props) {
|
|
631
|
-
return
|
|
632
|
-
renderEmpty
|
|
633
|
-
|
|
634
|
-
return React.createElement(SuperSelect, Object.assign({}, props, {
|
|
666
|
+
return _react["default"].createElement(_configProvider.ConfigConsumer, null, function (_ref2) {
|
|
667
|
+
var renderEmpty = _ref2.renderEmpty;
|
|
668
|
+
return _react["default"].createElement(SuperSelect, Object.assign({}, props, {
|
|
635
669
|
renderEmpty: renderEmpty
|
|
636
670
|
}));
|
|
637
671
|
});
|
|
638
672
|
}
|
|
639
673
|
TntdSelect.Option = Option;
|
|
640
|
-
|
|
674
|
+
var _default = exports["default"] = TntdSelect;
|