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