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