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/es/tntd-select/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
var __rest = this && this.__rest || function (s, e) {
|
|
2
2
|
var t = {};
|
|
3
|
+
|
|
3
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
5
|
+
|
|
4
6
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5
7
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
6
8
|
}
|
|
7
9
|
return t;
|
|
8
10
|
};
|
|
11
|
+
|
|
9
12
|
import React, { PureComponent } from 'react';
|
|
10
13
|
import Select from '../select';
|
|
11
14
|
import Empty from '../empty';
|
|
12
|
-
import DropDownWrap from './DropDownWrap';
|
|
13
|
-
|
|
14
|
-
const ITEM_ELEMENT_NUMBER = 30;
|
|
15
|
-
|
|
15
|
+
import DropDownWrap from './DropDownWrap'; // 页面实际渲染的下拉菜单数量,实际为 2 * ITEM_ELEMENT_NUMBER
|
|
16
|
+
|
|
17
|
+
const ITEM_ELEMENT_NUMBER = 30; // Select size 配置
|
|
18
|
+
|
|
16
19
|
const ITEM_HEIGHT_CFG = {
|
|
17
20
|
small: 24,
|
|
18
21
|
large: 40,
|
|
@@ -24,6 +27,7 @@ const ARROW_CODE = {
|
|
|
24
27
|
};
|
|
25
28
|
const DROPDOWN_HEIGHT = 224;
|
|
26
29
|
const Option = Select.Option;
|
|
30
|
+
|
|
27
31
|
class SuperSelect extends PureComponent {
|
|
28
32
|
constructor(props) {
|
|
29
33
|
super(props);
|
|
@@ -34,6 +38,7 @@ class SuperSelect extends PureComponent {
|
|
|
34
38
|
value: children => {
|
|
35
39
|
if (!children) return [];
|
|
36
40
|
let arr = [];
|
|
41
|
+
|
|
37
42
|
if (children && children.props) {
|
|
38
43
|
arr.push(children);
|
|
39
44
|
} else {
|
|
@@ -47,6 +52,7 @@ class SuperSelect extends PureComponent {
|
|
|
47
52
|
}
|
|
48
53
|
});
|
|
49
54
|
}
|
|
55
|
+
|
|
50
56
|
return arr;
|
|
51
57
|
}
|
|
52
58
|
});
|
|
@@ -65,36 +71,45 @@ class SuperSelect extends PureComponent {
|
|
|
65
71
|
const selectWidth = selectDom.clientWidth || selectDom.offsetWidth;
|
|
66
72
|
let arr = [];
|
|
67
73
|
let formulaMaxWidth = 10;
|
|
74
|
+
|
|
68
75
|
if (!dropdownMatchSelectWidth) {
|
|
69
76
|
formulaMaxWidth = maxWidth || 10;
|
|
70
77
|
}
|
|
78
|
+
|
|
71
79
|
if (!dropdownMatchSelectWidth && !maxWidth) {
|
|
72
80
|
const children = this.turnChildren(arr2);
|
|
81
|
+
|
|
73
82
|
for (let i = 0; i < children.length; i++) {
|
|
74
83
|
const val = children[i].props.children;
|
|
75
84
|
const textWidth = this.getTextPixelWith(val);
|
|
76
85
|
arr.push(textWidth.toFixed(2));
|
|
77
86
|
}
|
|
87
|
+
|
|
78
88
|
if (arr.length > 0) {
|
|
79
89
|
formulaMaxWidth = Math.max(...arr);
|
|
80
90
|
}
|
|
81
91
|
}
|
|
92
|
+
|
|
82
93
|
this.setState({
|
|
83
94
|
selectWidth,
|
|
84
95
|
maxWidth: formulaMaxWidth
|
|
85
96
|
});
|
|
86
97
|
}
|
|
87
|
-
});
|
|
88
|
-
|
|
98
|
+
}); // 获取单行文本的像素宽度
|
|
99
|
+
|
|
89
100
|
Object.defineProperty(this, "getTextPixelWith", {
|
|
90
101
|
enumerable: true,
|
|
91
102
|
configurable: true,
|
|
92
103
|
writable: true,
|
|
93
104
|
value: (text, fontStyle = '14px') => {
|
|
94
105
|
let canvas = document.createElement('canvas'); // 创建 canvas 画布
|
|
106
|
+
|
|
95
107
|
let context = canvas.getContext('2d'); // 获取 canvas 绘图上下文环境
|
|
108
|
+
|
|
96
109
|
context.font = fontStyle; // 设置字体样式,使用前设置好对应的 font 样式才能准确获取文字的像素长度
|
|
110
|
+
|
|
97
111
|
let dimension = context.measureText(text); // 测量文字
|
|
112
|
+
|
|
98
113
|
return dimension.width;
|
|
99
114
|
}
|
|
100
115
|
});
|
|
@@ -114,16 +129,16 @@ class SuperSelect extends PureComponent {
|
|
|
114
129
|
configurable: true,
|
|
115
130
|
writable: true,
|
|
116
131
|
value: () => {
|
|
117
|
-
this.scrollEle = document.querySelector(`.${this.dropdownClassName}`);
|
|
118
|
-
|
|
132
|
+
this.scrollEle = document.querySelector(`.${this.dropdownClassName}`); // 下拉菜单未展开时元素不存在
|
|
133
|
+
|
|
119
134
|
if (!this.scrollEle) return;
|
|
120
135
|
this.scrollEle.addEventListener('scroll', this.onScroll, false);
|
|
121
136
|
this.inputEle = document.querySelector(`#${this.id}`);
|
|
122
137
|
if (!this.inputEle) return;
|
|
123
138
|
this.inputEle.addEventListener('keydown', this.onKeyDown, false);
|
|
124
139
|
}
|
|
125
|
-
});
|
|
126
|
-
|
|
140
|
+
}); // 模拟 antd select 按下 上下箭头 键时滚动列表
|
|
141
|
+
|
|
127
142
|
Object.defineProperty(this, "onKeyDown", {
|
|
128
143
|
enumerable: true,
|
|
129
144
|
configurable: true,
|
|
@@ -139,26 +154,29 @@ class SuperSelect extends PureComponent {
|
|
|
139
154
|
offsetTop
|
|
140
155
|
} = activeItem;
|
|
141
156
|
const isUp = ARROW_CODE[keyCode] === 'up';
|
|
142
|
-
const isDown = ARROW_CODE[keyCode] === 'down';
|
|
143
|
-
|
|
157
|
+
const isDown = ARROW_CODE[keyCode] === 'down'; // 在所有列表第一行按上键
|
|
158
|
+
|
|
144
159
|
if (offsetTop - this.prevTop > DROPDOWN_HEIGHT && isUp) {
|
|
145
160
|
this.scrollEle.scrollTo(0, this.allHeight - DROPDOWN_HEIGHT);
|
|
146
161
|
this.prevTop = this.allHeight;
|
|
147
162
|
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
163
|
+
} // 在所有列表中最后一行按下键
|
|
164
|
+
|
|
165
|
+
|
|
150
166
|
if (this.prevTop > offsetTop + DROPDOWN_HEIGHT && isDown) {
|
|
151
167
|
this.scrollEle.scrollTo(0, 0);
|
|
152
168
|
this.prevTop = 0;
|
|
153
169
|
return;
|
|
154
170
|
}
|
|
155
|
-
|
|
156
|
-
// 向下滚动到下拉框最后一行时,向下滚动一行的高度
|
|
171
|
+
|
|
172
|
+
this.prevTop = offsetTop; // 向下滚动到下拉框最后一行时,向下滚动一行的高度
|
|
173
|
+
|
|
157
174
|
if (offsetTop > this.scrollEle.scrollTop + DROPDOWN_HEIGHT - this.ITEM_HEIGHT + 10 && isDown) {
|
|
158
175
|
this.scrollEle.scrollTo(0, this.scrollTop + this.ITEM_HEIGHT);
|
|
159
176
|
return;
|
|
160
|
-
}
|
|
161
|
-
|
|
177
|
+
} // 向上滚动到下拉框第一一行时,向上滚动一行的高度
|
|
178
|
+
|
|
179
|
+
|
|
162
180
|
if (offsetTop < this.scrollEle.scrollTop && isUp) {
|
|
163
181
|
this.scrollEle.scrollTo(0, this.scrollTop - this.ITEM_HEIGHT);
|
|
164
182
|
}
|
|
@@ -181,8 +199,8 @@ class SuperSelect extends PureComponent {
|
|
|
181
199
|
startIndex,
|
|
182
200
|
endIndex
|
|
183
201
|
} = this.getStartAndEndIndex();
|
|
184
|
-
this.prevScrollTop = this.scrollTop;
|
|
185
|
-
|
|
202
|
+
this.prevScrollTop = this.scrollTop; // 重新渲染列表组件 Wrap
|
|
203
|
+
|
|
186
204
|
const allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
|
|
187
205
|
this.wrap.reactList(allHeight, startIndex, endIndex);
|
|
188
206
|
}
|
|
@@ -192,14 +210,14 @@ class SuperSelect extends PureComponent {
|
|
|
192
210
|
configurable: true,
|
|
193
211
|
writable: true,
|
|
194
212
|
value: () => {
|
|
195
|
-
this.scrollTop = this.scrollEle.scrollTop;
|
|
196
|
-
|
|
213
|
+
this.scrollTop = this.scrollEle.scrollTop; // 滚动的高度
|
|
214
|
+
|
|
197
215
|
let delta = this.prevScrollTop - this.scrollTop;
|
|
198
216
|
delta = delta < 0 ? 0 - delta : delta;
|
|
199
217
|
delta > this.reactDelta && this.onScrollReal();
|
|
200
218
|
}
|
|
201
|
-
});
|
|
202
|
-
|
|
219
|
+
}); // 列表可展示所有 children
|
|
220
|
+
|
|
203
221
|
Object.defineProperty(this, "getUseChildrenList", {
|
|
204
222
|
enumerable: true,
|
|
205
223
|
configurable: true,
|
|
@@ -220,8 +238,8 @@ class SuperSelect extends PureComponent {
|
|
|
220
238
|
endIndex
|
|
221
239
|
};
|
|
222
240
|
}
|
|
223
|
-
});
|
|
224
|
-
|
|
241
|
+
}); // 须使用 setTimeout 确保在 dom 加载完成之后添加事件
|
|
242
|
+
|
|
225
243
|
Object.defineProperty(this, "setSuperDrowDownMenu", {
|
|
226
244
|
enumerable: true,
|
|
227
245
|
configurable: true,
|
|
@@ -229,11 +247,12 @@ class SuperSelect extends PureComponent {
|
|
|
229
247
|
value: visible => {
|
|
230
248
|
if (!visible) return;
|
|
231
249
|
this.allList = this.getUseChildrenList();
|
|
250
|
+
|
|
232
251
|
if (!this.eventTimer || !this.scrollEle) {
|
|
233
252
|
this.eventTimer = setTimeout(() => this.addEvent(), 0);
|
|
234
253
|
} else {
|
|
235
|
-
const allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
|
|
236
|
-
|
|
254
|
+
const allHeight = this.allList.length * this.ITEM_HEIGHT || 100; // 下拉列表单独重新渲染
|
|
255
|
+
|
|
237
256
|
const {
|
|
238
257
|
startIndex,
|
|
239
258
|
endIndex
|
|
@@ -256,8 +275,8 @@ class SuperSelect extends PureComponent {
|
|
|
256
275
|
const {
|
|
257
276
|
value,
|
|
258
277
|
children
|
|
259
|
-
} = this.state;
|
|
260
|
-
|
|
278
|
+
} = this.state; // 关闭下拉框前清空筛选条件,防止下次打开任然显示筛选后的 options
|
|
279
|
+
|
|
261
280
|
if (!visible) {
|
|
262
281
|
// 定时器确保关闭后再设置 filterChildren,防止列表刷新闪烁
|
|
263
282
|
setTimeout(() => {
|
|
@@ -265,14 +284,13 @@ class SuperSelect extends PureComponent {
|
|
|
265
284
|
filterChildren: null
|
|
266
285
|
});
|
|
267
286
|
this.setDefaultScrollTop(value);
|
|
268
|
-
}, 100);
|
|
269
|
-
// this.removeEvent();
|
|
287
|
+
}, 100); // this.removeEvent();
|
|
270
288
|
} else {
|
|
271
289
|
// this.addEvent();
|
|
272
290
|
if (value) {
|
|
273
291
|
// 如果已有 value, 设置默认滚动位置
|
|
274
|
-
this.setDefaultScrollTop();
|
|
275
|
-
|
|
292
|
+
this.setDefaultScrollTop(); // 设置下拉列表显示数据
|
|
293
|
+
|
|
276
294
|
this.setSuperDrowDownMenu(visible);
|
|
277
295
|
} else if (!value && value !== 0 && children && children.length > 0) {
|
|
278
296
|
// 无数据时,下拉回归至第一个
|
|
@@ -292,8 +310,8 @@ class SuperSelect extends PureComponent {
|
|
|
292
310
|
} = this.props;
|
|
293
311
|
onDeselect && onDeselect(value);
|
|
294
312
|
}
|
|
295
|
-
});
|
|
296
|
-
|
|
313
|
+
}); // 在搜索重新计算下拉滚动条高度
|
|
314
|
+
|
|
297
315
|
Object.defineProperty(this, "onChange", {
|
|
298
316
|
enumerable: true,
|
|
299
317
|
configurable: true,
|
|
@@ -306,6 +324,7 @@ class SuperSelect extends PureComponent {
|
|
|
306
324
|
maxCount,
|
|
307
325
|
mode
|
|
308
326
|
} = this.props;
|
|
327
|
+
|
|
309
328
|
if (showSearch || this.isMultiple) {
|
|
310
329
|
// 搜索模式下选择后是否需要重置搜索状态
|
|
311
330
|
if (autoClearSearchValue !== false) {
|
|
@@ -317,6 +336,7 @@ class SuperSelect extends PureComponent {
|
|
|
317
336
|
});
|
|
318
337
|
}
|
|
319
338
|
}
|
|
339
|
+
|
|
320
340
|
if (mode === 'multiple') {
|
|
321
341
|
if (value.length <= maxCount) {
|
|
322
342
|
this.setState({
|
|
@@ -328,7 +348,9 @@ class SuperSelect extends PureComponent {
|
|
|
328
348
|
value
|
|
329
349
|
});
|
|
330
350
|
}
|
|
351
|
+
|
|
331
352
|
onChange && onChange(value, opt);
|
|
353
|
+
|
|
332
354
|
if (mode !== 'multiple') {
|
|
333
355
|
this.select && this.select.blur();
|
|
334
356
|
}
|
|
@@ -346,23 +368,26 @@ class SuperSelect extends PureComponent {
|
|
|
346
368
|
children: arr
|
|
347
369
|
} = this.props;
|
|
348
370
|
let children = this.turnChildren(arr);
|
|
371
|
+
|
|
349
372
|
if (showSearch && filterOption !== false) {
|
|
350
373
|
// 须根据 filterOption(如有该自定义函数)手动 filter 搜索匹配的列表
|
|
351
374
|
let filterChildren = null;
|
|
375
|
+
|
|
352
376
|
if (typeof filterOption === 'function') {
|
|
353
377
|
filterChildren = children.filter(item => filterOption(v, item));
|
|
354
378
|
} else if (filterOption === undefined) {
|
|
355
379
|
filterChildren = children.filter(item => this.filterOption(v, item));
|
|
356
|
-
}
|
|
357
|
-
|
|
380
|
+
} // 搜索框有值,去除disabled=true的children
|
|
381
|
+
|
|
382
|
+
|
|
358
383
|
let newFilterChild = [];
|
|
359
384
|
filterChildren && filterChildren.forEach((item, index) => {
|
|
360
385
|
if (!item.props.disabled) {
|
|
361
386
|
newFilterChild.push(item);
|
|
362
387
|
}
|
|
363
388
|
});
|
|
364
|
-
filterChildren = newFilterChild;
|
|
365
|
-
|
|
389
|
+
filterChildren = newFilterChild; // 设置下拉列表显示数据
|
|
390
|
+
|
|
366
391
|
this.setState({
|
|
367
392
|
filterChildren: v === '' ? null : filterChildren
|
|
368
393
|
}, () => {
|
|
@@ -371,12 +396,14 @@ class SuperSelect extends PureComponent {
|
|
|
371
396
|
if (filterChildren) {
|
|
372
397
|
this.scrollTop = 0;
|
|
373
398
|
this.scrollEle.scrollTo(0, 0);
|
|
374
|
-
}
|
|
375
|
-
|
|
399
|
+
} // 搜索成功后需要重新设置列表的总高度
|
|
400
|
+
|
|
401
|
+
|
|
376
402
|
this.setSuperDrowDownMenu(true);
|
|
377
403
|
}, 0);
|
|
378
404
|
});
|
|
379
405
|
}
|
|
406
|
+
|
|
380
407
|
onSearch && onSearch(v);
|
|
381
408
|
}
|
|
382
409
|
});
|
|
@@ -403,15 +430,18 @@ class SuperSelect extends PureComponent {
|
|
|
403
430
|
} = this.props;
|
|
404
431
|
const children = this.turnChildren(arr);
|
|
405
432
|
let val = data || data === 0 ? data : value;
|
|
433
|
+
|
|
406
434
|
for (let i = 0; i < children.length; i++) {
|
|
407
435
|
const item = children[i];
|
|
408
436
|
const itemValue = item.props.value;
|
|
437
|
+
|
|
409
438
|
if (itemValue === val || Array.isArray(val) && val.includes(itemValue)) {
|
|
410
439
|
const targetScrollTop = i * this.ITEM_HEIGHT;
|
|
411
440
|
setTimeout(() => {
|
|
412
441
|
if (!this.scrollEle) {
|
|
413
442
|
this.addEvent();
|
|
414
443
|
}
|
|
444
|
+
|
|
415
445
|
this.scrollEle && this.scrollEle.scrollTo(0, targetScrollTop);
|
|
416
446
|
}, 100);
|
|
417
447
|
return;
|
|
@@ -438,8 +468,8 @@ class SuperSelect extends PureComponent {
|
|
|
438
468
|
children: arr
|
|
439
469
|
} = props;
|
|
440
470
|
this.isMultiple = ['tags', 'multiple'].includes(mode);
|
|
441
|
-
const children = this.turnChildren(arr);
|
|
442
|
-
|
|
471
|
+
const children = this.turnChildren(arr); // 设置默认 value
|
|
472
|
+
|
|
443
473
|
let defaultV = this.isMultiple ? [] : '';
|
|
444
474
|
defaultV = value || defaultValue || defaultV;
|
|
445
475
|
this.state = {
|
|
@@ -448,24 +478,25 @@ class SuperSelect extends PureComponent {
|
|
|
448
478
|
value: defaultV,
|
|
449
479
|
maxWidth: null,
|
|
450
480
|
selectWidth: null
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default'];
|
|
454
|
-
|
|
455
|
-
this.visibleDomHeight = this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER;
|
|
456
|
-
|
|
457
|
-
this.reactDelta = this.visibleDomHeight / 3;
|
|
458
|
-
|
|
459
|
-
this.isStopReact = false;
|
|
460
|
-
|
|
461
|
-
this.prevScrollTop = 0;
|
|
462
|
-
|
|
481
|
+
}; // 下拉菜单项行高
|
|
482
|
+
|
|
483
|
+
this.ITEM_HEIGHT = optionHeight || ITEM_HEIGHT_CFG[props.size || 'default']; // 可视区 dom 高度
|
|
484
|
+
|
|
485
|
+
this.visibleDomHeight = this.ITEM_HEIGHT * ITEM_ELEMENT_NUMBER; // 滚动时重新渲染的 scrollTop 判断值,大于 reactDelta 则刷新下拉列表
|
|
486
|
+
|
|
487
|
+
this.reactDelta = this.visibleDomHeight / 3; // 是否拖动滚动条快速滚动状态
|
|
488
|
+
|
|
489
|
+
this.isStopReact = false; // 上一次滚动的 scrollTop 值
|
|
490
|
+
|
|
491
|
+
this.prevScrollTop = 0; // 上一次按下方向键时 scrollTop 值
|
|
492
|
+
|
|
463
493
|
this.prevTop = 0;
|
|
464
|
-
this.scrollTop = 0;
|
|
465
|
-
|
|
494
|
+
this.scrollTop = 0; // className
|
|
495
|
+
|
|
466
496
|
this.dropdownClassName = `dc${+new Date()}`;
|
|
467
497
|
this.id = `sid${+new Date()}`;
|
|
468
498
|
}
|
|
499
|
+
|
|
469
500
|
componentDidMount() {
|
|
470
501
|
// defaultOpens=true 时添加滚动事件
|
|
471
502
|
setTimeout(() => {
|
|
@@ -474,10 +505,9 @@ class SuperSelect extends PureComponent {
|
|
|
474
505
|
const {
|
|
475
506
|
children: arr
|
|
476
507
|
} = this.props;
|
|
477
|
-
const children = this.turnChildren(arr);
|
|
478
|
-
|
|
479
|
-
this.formulaWidth();
|
|
480
|
-
// }
|
|
508
|
+
const children = this.turnChildren(arr); // if (children && children.length > 0) {
|
|
509
|
+
|
|
510
|
+
this.formulaWidth(); // }
|
|
481
511
|
}
|
|
482
512
|
|
|
483
513
|
componentDidUpdate(prevProps) {
|
|
@@ -488,16 +518,19 @@ class SuperSelect extends PureComponent {
|
|
|
488
518
|
children
|
|
489
519
|
} = this.props;
|
|
490
520
|
let arr = this.turnChildren(children);
|
|
521
|
+
|
|
491
522
|
if (prevProps.children !== children) {
|
|
492
523
|
this.isMultiple = ['tags', 'multiple'].includes(mode);
|
|
493
524
|
this.setState({
|
|
494
525
|
children: arr || [],
|
|
495
526
|
filterChildren: null
|
|
496
527
|
});
|
|
528
|
+
|
|
497
529
|
if (arr && arr.length > 0) {
|
|
498
530
|
this.formulaWidth();
|
|
499
531
|
}
|
|
500
532
|
}
|
|
533
|
+
|
|
501
534
|
if (prevProps.value !== value) {
|
|
502
535
|
// 更新时设置默认 value
|
|
503
536
|
let defaultV = this.isMultiple ? [] : '';
|
|
@@ -507,21 +540,25 @@ class SuperSelect extends PureComponent {
|
|
|
507
540
|
});
|
|
508
541
|
}
|
|
509
542
|
}
|
|
543
|
+
|
|
510
544
|
componentWillUnmount() {
|
|
511
545
|
this.removeEvent();
|
|
512
546
|
}
|
|
547
|
+
|
|
513
548
|
render() {
|
|
514
549
|
const {
|
|
515
550
|
maxWidth,
|
|
516
551
|
selectWidth
|
|
517
552
|
} = this.state;
|
|
553
|
+
|
|
518
554
|
let _a = this.props,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
555
|
+
{
|
|
556
|
+
dropdownStyle,
|
|
557
|
+
optionLabelProp,
|
|
558
|
+
dropdownClassName
|
|
559
|
+
} = _a,
|
|
560
|
+
props = __rest(_a, ["dropdownStyle", "optionLabelProp", "dropdownClassName"]);
|
|
561
|
+
|
|
525
562
|
this.allList = this.getUseChildrenList();
|
|
526
563
|
this.allHeight = this.allList.length * this.ITEM_HEIGHT || 100;
|
|
527
564
|
const {
|
|
@@ -529,9 +566,11 @@ class SuperSelect extends PureComponent {
|
|
|
529
566
|
endIndex
|
|
530
567
|
} = this.getStartAndEndIndex();
|
|
531
568
|
let dynamicWidth = maxWidth;
|
|
569
|
+
|
|
532
570
|
if (this.allList.length === 0 || maxWidth < selectWidth) {
|
|
533
571
|
dynamicWidth = selectWidth;
|
|
534
572
|
}
|
|
573
|
+
|
|
535
574
|
dropdownStyle = Object.assign(Object.assign({
|
|
536
575
|
maxHeight: `${DROPDOWN_HEIGHT}px`
|
|
537
576
|
}, dropdownStyle), {
|
|
@@ -541,17 +580,19 @@ class SuperSelect extends PureComponent {
|
|
|
541
580
|
});
|
|
542
581
|
const {
|
|
543
582
|
value
|
|
544
|
-
} = this.state;
|
|
545
|
-
|
|
546
|
-
const _props = Object.assign({}, props);
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
// value 为空字符会隐藏 placeholder,改为 undefined
|
|
583
|
+
} = this.state; // 判断处于 antd Form 中时不自动设置 value
|
|
584
|
+
|
|
585
|
+
const _props = Object.assign({}, props); // 先删除 value,再手动赋值,防止空 value 影响 placeholder
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
delete _props.value; // value 为空字符会隐藏 placeholder,改为 undefined
|
|
589
|
+
|
|
550
590
|
if (typeof value === 'string' && !value) {
|
|
551
591
|
_props.value = undefined;
|
|
552
592
|
} else {
|
|
553
593
|
_props.value = value;
|
|
554
594
|
}
|
|
595
|
+
|
|
555
596
|
optionLabelProp = optionLabelProp || 'children';
|
|
556
597
|
return React.createElement(Select, Object.assign({}, _props, {
|
|
557
598
|
id: this.id,
|
|
@@ -573,6 +614,7 @@ class SuperSelect extends PureComponent {
|
|
|
573
614
|
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
574
615
|
}));
|
|
575
616
|
}
|
|
617
|
+
|
|
576
618
|
return React.createElement(DropDownWrap, Object.assign({}, {
|
|
577
619
|
startIndex,
|
|
578
620
|
endIndex,
|
|
@@ -587,6 +629,8 @@ class SuperSelect extends PureComponent {
|
|
|
587
629
|
}
|
|
588
630
|
}), this.allList);
|
|
589
631
|
}
|
|
632
|
+
|
|
590
633
|
}
|
|
634
|
+
|
|
591
635
|
SuperSelect.Option = Option;
|
|
592
636
|
export default SuperSelect;
|
package/es/utils/checkAuth.js
CHANGED
|
@@ -4,6 +4,7 @@ export const findMenuInfoByPath = (menuTree, path, matchFunc) => {
|
|
|
4
4
|
let subMenu;
|
|
5
5
|
let matchedSubMenu;
|
|
6
6
|
let parentMenus;
|
|
7
|
+
|
|
7
8
|
if (path) {
|
|
8
9
|
traverseTree(menuTree, (menu, pnode, pnodes) => {
|
|
9
10
|
if (!isGroupMenu(menu)) {
|
|
@@ -13,6 +14,7 @@ export const findMenuInfoByPath = (menuTree, path, matchFunc) => {
|
|
|
13
14
|
parentMenus = pnodes;
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
17
|
+
|
|
16
18
|
if (!matchedSubMenu && matchFunc && matchFunc(menu)) {
|
|
17
19
|
matchedSubMenu = menu;
|
|
18
20
|
menu = pnode;
|
|
@@ -27,6 +29,7 @@ export const findMenuInfoByPath = (menuTree, path, matchFunc) => {
|
|
|
27
29
|
parentMenus
|
|
28
30
|
};
|
|
29
31
|
}
|
|
32
|
+
|
|
30
33
|
return {
|
|
31
34
|
subMenu,
|
|
32
35
|
menu,
|
package/es/utils/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export const getSelectedMenuInfo = (selectedKey, menus = []) => {
|
|
|
5
5
|
let subMenu;
|
|
6
6
|
let menu;
|
|
7
7
|
let parentMenus = [];
|
|
8
|
+
|
|
8
9
|
if (selectedKey) {
|
|
9
10
|
traverseTree(menus, (node, pnode, pnodes) => {
|
|
10
11
|
if (!isGroupMenu(node) && node.code === selectedKey) {
|
|
@@ -25,6 +26,7 @@ export const getSelectedMenuInfo = (selectedKey, menus = []) => {
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
}
|
|
29
|
+
|
|
28
30
|
return {
|
|
29
31
|
subMenu,
|
|
30
32
|
menu,
|
|
@@ -34,8 +36,10 @@ export const getSelectedMenuInfo = (selectedKey, menus = []) => {
|
|
|
34
36
|
export const hasLevel3 = menus => {
|
|
35
37
|
return menus === null || menus === void 0 ? void 0 : menus.some(menu => {
|
|
36
38
|
var _a;
|
|
39
|
+
|
|
37
40
|
return (_a = menu === null || menu === void 0 ? void 0 : menu.children) === null || _a === void 0 ? void 0 : _a.some(item => {
|
|
38
41
|
var _a;
|
|
42
|
+
|
|
39
43
|
return (_a = item === null || item === void 0 ? void 0 : item.children) === null || _a === void 0 ? void 0 : _a.length;
|
|
40
44
|
});
|
|
41
45
|
});
|
|
@@ -54,24 +58,29 @@ export const traverseTree = (treeData, callback, pnode, pnodes = []) => {
|
|
|
54
58
|
;
|
|
55
59
|
(treeData || []).every((node, index) => {
|
|
56
60
|
let result;
|
|
61
|
+
|
|
57
62
|
if (callback) {
|
|
58
63
|
result = callback(node, pnode, (pnodes === null || pnodes === void 0 ? void 0 : pnodes.length) ? pnodes : [pnode].filter(item => !!item), index);
|
|
59
|
-
}
|
|
60
|
-
|
|
64
|
+
} // 回调函数返回false则终止遍历
|
|
65
|
+
|
|
66
|
+
|
|
61
67
|
if (result !== false) {
|
|
62
68
|
node && traverseTree(node.children || [], callback, node, [node, ...pnodes]);
|
|
63
69
|
}
|
|
70
|
+
|
|
64
71
|
return result !== false;
|
|
65
72
|
});
|
|
66
73
|
return treeData;
|
|
67
74
|
};
|
|
68
75
|
export const safeParseJSON = (str, defaultObj) => {
|
|
69
76
|
let result;
|
|
77
|
+
|
|
70
78
|
try {
|
|
71
79
|
result = JSON.parse(str);
|
|
72
80
|
} catch (err) {
|
|
73
81
|
console.warn('json parse error:', err);
|
|
74
82
|
result = typeof defaultObj === 'undefined' ? str : defaultObj;
|
|
75
83
|
}
|
|
84
|
+
|
|
76
85
|
return result || defaultObj;
|
|
77
86
|
};
|
package/lib/affix/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) {
|
|
3
|
+
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); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
var _exportNames = {};
|
|
8
9
|
exports["default"] = void 0;
|
|
10
|
+
|
|
9
11
|
var _affix = _interopRequireWildcard(require("antd/lib/affix"));
|
|
12
|
+
|
|
10
13
|
Object.keys(_affix).forEach(function (key) {
|
|
11
14
|
if (key === "default" || key === "__esModule") return;
|
|
12
15
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
|
-
if (key in exports && exports[key] === _affix[key]) return;
|
|
14
16
|
Object.defineProperty(exports, key, {
|
|
15
17
|
enumerable: true,
|
|
16
18
|
get: function get() {
|
|
@@ -18,8 +20,12 @@ Object.keys(_affix).forEach(function (key) {
|
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
});
|
|
23
|
+
|
|
21
24
|
require("antd/lib/affix/style");
|
|
22
|
-
|
|
23
|
-
function
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
24
30
|
var _default = _affix["default"];
|
|
25
31
|
exports["default"] = _default;
|
package/lib/alert/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) {
|
|
3
|
+
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); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
var _exportNames = {};
|
|
8
9
|
exports["default"] = void 0;
|
|
10
|
+
|
|
9
11
|
var _alert = _interopRequireWildcard(require("antd/lib/alert"));
|
|
12
|
+
|
|
10
13
|
Object.keys(_alert).forEach(function (key) {
|
|
11
14
|
if (key === "default" || key === "__esModule") return;
|
|
12
15
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
|
-
if (key in exports && exports[key] === _alert[key]) return;
|
|
14
16
|
Object.defineProperty(exports, key, {
|
|
15
17
|
enumerable: true,
|
|
16
18
|
get: function get() {
|
|
@@ -18,8 +20,12 @@ Object.keys(_alert).forEach(function (key) {
|
|
|
18
20
|
}
|
|
19
21
|
});
|
|
20
22
|
});
|
|
23
|
+
|
|
21
24
|
require("antd/lib/alert/style");
|
|
22
|
-
|
|
23
|
-
function
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
24
30
|
var _default = _alert["default"];
|
|
25
31
|
exports["default"] = _default;
|