tntd 2.0.12 → 2.0.13
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 +4 -8
- 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 -14
- package/es/empty/empty.js.map +1 -1
- 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/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.js +6 -16
- 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.d.ts.map +1 -1
- package/lib/empty/empty.js +14 -31
- package/lib/empty/empty.js.map +1 -1
- 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.js +4 -11
- 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 +7 -4
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import "antd/es/icon/style";
|
|
2
2
|
import _Icon from "antd/es/icon";
|
|
3
|
-
|
|
4
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
5
4
|
var t = {};
|
|
6
|
-
|
|
7
5
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
8
|
-
|
|
9
6
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
10
7
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
11
8
|
}
|
|
12
9
|
return t;
|
|
13
10
|
};
|
|
14
|
-
|
|
15
11
|
import classNames from 'classnames';
|
|
16
12
|
import RcCascader from '../rc-cascader';
|
|
17
13
|
import omit from 'rc-util/lib/omit';
|
|
@@ -31,7 +27,6 @@ const {
|
|
|
31
27
|
SHOW_CHILD,
|
|
32
28
|
SHOW_PARENT
|
|
33
29
|
} = RcCascader;
|
|
34
|
-
|
|
35
30
|
function highlightKeyword(str, lowerKeyword, prefixCls) {
|
|
36
31
|
const cells = str.toLowerCase().split(lowerKeyword).reduce((list, cur, index) => index === 0 ? [cur] : [...list, lowerKeyword, cur], []);
|
|
37
32
|
const fillCells = [];
|
|
@@ -40,125 +35,113 @@ function highlightKeyword(str, lowerKeyword, prefixCls) {
|
|
|
40
35
|
const end = start + cell.length;
|
|
41
36
|
let originWorld = str.slice(start, end);
|
|
42
37
|
start = end;
|
|
43
|
-
|
|
44
38
|
if (index % 2 === 1) {
|
|
45
39
|
originWorld = React.createElement("span", {
|
|
46
40
|
className: `${prefixCls}-menu-item-keyword`,
|
|
47
41
|
key: `seperator-${index}`
|
|
48
42
|
}, originWorld);
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
fillCells.push(originWorld);
|
|
52
45
|
});
|
|
53
46
|
return fillCells;
|
|
54
47
|
}
|
|
55
|
-
|
|
56
48
|
const defaultSearchRender = (inputValue, path, prefixCls, fieldNames) => {
|
|
57
|
-
const optionList = [];
|
|
58
|
-
|
|
49
|
+
const optionList = [];
|
|
50
|
+
// We do lower here to save perf
|
|
59
51
|
const lower = inputValue.toLowerCase();
|
|
60
52
|
path.forEach((node, index) => {
|
|
61
53
|
if (index !== 0) {
|
|
62
54
|
optionList.push(' / ');
|
|
63
55
|
}
|
|
64
|
-
|
|
65
56
|
let label = node[fieldNames.label];
|
|
66
57
|
const type = typeof label;
|
|
67
|
-
|
|
68
58
|
if (type === 'string' || type === 'number') {
|
|
69
59
|
label = highlightKeyword(String(label), lower, prefixCls);
|
|
70
60
|
}
|
|
71
|
-
|
|
72
61
|
optionList.push(label);
|
|
73
62
|
});
|
|
74
63
|
return optionList;
|
|
75
64
|
};
|
|
76
|
-
|
|
77
65
|
const Cascader = React.forwardRef((props, ref) => {
|
|
78
66
|
const {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
67
|
+
prefixCls: customizePrefixCls,
|
|
68
|
+
size: customizeSize,
|
|
69
|
+
disabled: customDisabled,
|
|
70
|
+
className,
|
|
71
|
+
multiple,
|
|
72
|
+
bordered = true,
|
|
73
|
+
transitionName,
|
|
74
|
+
choiceTransitionName = '',
|
|
75
|
+
popupClassName,
|
|
76
|
+
dropdownClassName,
|
|
77
|
+
expandIcon,
|
|
78
|
+
placement,
|
|
79
|
+
showSearch,
|
|
80
|
+
allowClear = true,
|
|
81
|
+
notFoundContent,
|
|
82
|
+
direction,
|
|
83
|
+
getPopupContainer,
|
|
84
|
+
status: customStatus,
|
|
85
|
+
showArrow
|
|
86
|
+
} = props,
|
|
87
|
+
rest = __rest(props, ["prefixCls", "size", "disabled", "className", "multiple", "bordered", "transitionName", "choiceTransitionName", "popupClassName", "dropdownClassName", "expandIcon", "placement", "showSearch", "allowClear", "notFoundContent", "direction", "getPopupContainer", "status", "showArrow"]);
|
|
101
88
|
const restProps = omit(rest, ['suffixIcon']);
|
|
102
89
|
const {
|
|
103
90
|
getPopupContainer: getContextPopupContainer,
|
|
104
91
|
getPrefixCls,
|
|
105
92
|
renderEmpty,
|
|
106
|
-
direction: rootDirection
|
|
93
|
+
direction: rootDirection
|
|
94
|
+
// virtual,
|
|
107
95
|
// dropdownMatchSelectWidth,
|
|
108
|
-
|
|
109
96
|
} = useContext(ConfigContext);
|
|
110
97
|
const mergedDirection = direction || rootDirection;
|
|
111
|
-
const isRtl = mergedDirection === 'rtl';
|
|
112
|
-
|
|
98
|
+
const isRtl = mergedDirection === 'rtl';
|
|
99
|
+
// =================== Form =====================
|
|
113
100
|
const {
|
|
114
101
|
status: contextStatus,
|
|
115
102
|
hasFeedback,
|
|
116
103
|
isFormItemInput,
|
|
117
104
|
feedbackIcon
|
|
118
105
|
} = useContext(FormItemInputContext);
|
|
119
|
-
const mergedStatus = getMergedStatus(contextStatus, customStatus);
|
|
120
|
-
|
|
106
|
+
const mergedStatus = getMergedStatus(contextStatus, customStatus);
|
|
107
|
+
// =================== Warning =====================
|
|
121
108
|
warning(!dropdownClassName, 'Cascader', '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.');
|
|
122
|
-
warning(!multiple || !props.displayRender, 'Cascader', '`displayRender` not work on `multiple`. Please use `tagRender` instead.');
|
|
123
|
-
|
|
124
|
-
const mergedNotFoundContent = notFoundContent || (renderEmpty || defaultRenderEmpty)('Cascader');
|
|
125
|
-
|
|
109
|
+
warning(!multiple || !props.displayRender, 'Cascader', '`displayRender` not work on `multiple`. Please use `tagRender` instead.');
|
|
110
|
+
// =================== No Found ====================
|
|
111
|
+
const mergedNotFoundContent = notFoundContent || (renderEmpty || defaultRenderEmpty)('Cascader');
|
|
112
|
+
// ==================== Prefix =====================
|
|
126
113
|
const rootPrefixCls = getPrefixCls();
|
|
127
114
|
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
128
115
|
const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
|
|
129
116
|
const {
|
|
130
117
|
compactSize,
|
|
131
118
|
compactItemClassnames
|
|
132
|
-
} = useCompactItemContext(prefixCls, direction);
|
|
133
|
-
|
|
119
|
+
} = useCompactItemContext(prefixCls, direction);
|
|
120
|
+
// =================== Dropdown ====================
|
|
134
121
|
const mergedDropdownClassName = classNames(popupClassName || dropdownClassName, `${cascaderPrefixCls}-dropdown`, {
|
|
135
122
|
[`${cascaderPrefixCls}-dropdown-rtl`]: mergedDirection === 'rtl'
|
|
136
|
-
});
|
|
137
|
-
|
|
123
|
+
});
|
|
124
|
+
// ==================== Search =====================
|
|
138
125
|
const mergedShowSearch = React.useMemo(() => {
|
|
139
126
|
if (!showSearch) {
|
|
140
127
|
return showSearch;
|
|
141
128
|
}
|
|
142
|
-
|
|
143
129
|
let searchConfig = {
|
|
144
130
|
render: defaultSearchRender
|
|
145
131
|
};
|
|
146
|
-
|
|
147
132
|
if (typeof showSearch === 'object') {
|
|
148
133
|
searchConfig = Object.assign(Object.assign({}, searchConfig), showSearch);
|
|
149
134
|
}
|
|
150
|
-
|
|
151
135
|
return searchConfig;
|
|
152
|
-
}, [showSearch]);
|
|
153
|
-
|
|
136
|
+
}, [showSearch]);
|
|
137
|
+
// ===================== Size ======================
|
|
154
138
|
const size = React.useContext(SizeContext);
|
|
155
|
-
const mergedSize = compactSize || customizeSize || size;
|
|
156
|
-
|
|
139
|
+
const mergedSize = compactSize || customizeSize || size;
|
|
140
|
+
// ===================== Disabled =====================
|
|
157
141
|
const disabled = React.useContext(DisabledContext);
|
|
158
|
-
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
159
|
-
|
|
142
|
+
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
143
|
+
// ===================== Icon ======================
|
|
160
144
|
let mergedExpandIcon = expandIcon;
|
|
161
|
-
|
|
162
145
|
if (!expandIcon) {
|
|
163
146
|
mergedExpandIcon = isRtl ? React.createElement(_Icon, {
|
|
164
147
|
type: "left"
|
|
@@ -166,17 +149,16 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
166
149
|
type: "right"
|
|
167
150
|
});
|
|
168
151
|
}
|
|
169
|
-
|
|
170
152
|
const loadingIcon = React.createElement("span", {
|
|
171
153
|
className: `${prefixCls}-menu-item-loading-icon`
|
|
172
154
|
}, React.createElement(_Icon, {
|
|
173
155
|
type: "loading"
|
|
174
|
-
}));
|
|
175
|
-
|
|
156
|
+
}));
|
|
157
|
+
// =================== Multiple ====================
|
|
176
158
|
const checkable = React.useMemo(() => multiple ? React.createElement("span", {
|
|
177
159
|
className: `${cascaderPrefixCls}-checkbox-inner`
|
|
178
|
-
}) : false, [multiple]);
|
|
179
|
-
|
|
160
|
+
}) : false, [multiple]);
|
|
161
|
+
// ===================== Icons =====================
|
|
180
162
|
const mergedShowArrow = showArrow !== undefined ? showArrow : props.loading || !multiple;
|
|
181
163
|
const {
|
|
182
164
|
suffixIcon,
|
|
@@ -188,17 +170,15 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
188
170
|
showArrow: mergedShowArrow,
|
|
189
171
|
multiple,
|
|
190
172
|
prefixCls
|
|
191
|
-
}));
|
|
192
|
-
|
|
173
|
+
}));
|
|
174
|
+
// ===================== Placement =====================
|
|
193
175
|
const getPlacement = () => {
|
|
194
176
|
if (placement !== undefined) {
|
|
195
177
|
return placement;
|
|
196
178
|
}
|
|
197
|
-
|
|
198
179
|
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
|
|
180
|
+
};
|
|
181
|
+
// ==================== Render =====================
|
|
202
182
|
return React.createElement(RcCascader, Object.assign({
|
|
203
183
|
prefixCls: prefixCls,
|
|
204
184
|
className: classNames(!customizePrefixCls && cascaderPrefixCls, {
|
|
@@ -230,11 +210,9 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
230
210
|
showArrow: hasFeedback || showArrow
|
|
231
211
|
}));
|
|
232
212
|
});
|
|
233
|
-
|
|
234
213
|
if (process.env.NODE_ENV !== 'production') {
|
|
235
214
|
Cascader.displayName = 'Cascader';
|
|
236
215
|
}
|
|
237
|
-
|
|
238
216
|
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
239
217
|
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
240
218
|
export default Cascader;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
var __rest = this && this.__rest || function (s, e) {
|
|
2
2
|
var t = {};
|
|
3
|
-
|
|
4
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
5
|
-
|
|
6
4
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
5
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
6
|
}
|
|
9
7
|
return t;
|
|
10
8
|
};
|
|
11
|
-
|
|
12
9
|
import { BaseSelect } from 'rc-select';
|
|
13
10
|
import useId from 'rc-select/lib/hooks/useId';
|
|
14
11
|
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
|
|
@@ -27,87 +24,78 @@ import { formatStrategyValues, toPathOptions } from './utils/treeUtil';
|
|
|
27
24
|
import warningProps, { warningNullOptions } from './utils/warningPropsUtil';
|
|
28
25
|
import './context';
|
|
29
26
|
import './index.less';
|
|
30
|
-
|
|
31
27
|
function isMultipleValue(value) {
|
|
32
28
|
return Array.isArray(value) && Array.isArray(value[0]);
|
|
33
29
|
}
|
|
34
|
-
|
|
35
30
|
function toRawValues(value) {
|
|
36
31
|
if (!value) {
|
|
37
32
|
return [];
|
|
38
33
|
}
|
|
39
|
-
|
|
40
34
|
if (isMultipleValue(value)) {
|
|
41
35
|
return value;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
return (value.length === 0 ? [] : [value]).map(val => Array.isArray(val) ? val : [val]);
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
const Cascader = React.forwardRef((props, ref) => {
|
|
48
40
|
const {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
41
|
+
// MISC
|
|
42
|
+
id,
|
|
43
|
+
prefixCls = 'rc-cascader',
|
|
44
|
+
fieldNames,
|
|
45
|
+
// Value
|
|
46
|
+
defaultValue,
|
|
47
|
+
value,
|
|
48
|
+
changeOnSelect,
|
|
49
|
+
onChange,
|
|
50
|
+
displayRender,
|
|
51
|
+
checkable,
|
|
52
|
+
// Search
|
|
53
|
+
searchValue,
|
|
54
|
+
onSearch,
|
|
55
|
+
showSearch,
|
|
56
|
+
// Trigger
|
|
57
|
+
expandTrigger,
|
|
58
|
+
// Options
|
|
59
|
+
options,
|
|
60
|
+
dropdownPrefixCls,
|
|
61
|
+
loadData,
|
|
62
|
+
// Open
|
|
63
|
+
popupVisible,
|
|
64
|
+
open,
|
|
65
|
+
popupClassName,
|
|
66
|
+
dropdownClassName,
|
|
67
|
+
dropdownMenuColumnStyle,
|
|
68
|
+
popupPlacement,
|
|
69
|
+
placement,
|
|
70
|
+
onDropdownVisibleChange,
|
|
71
|
+
onPopupVisibleChange,
|
|
72
|
+
renderItem,
|
|
73
|
+
// Icon
|
|
74
|
+
expandIcon = '>',
|
|
75
|
+
loadingIcon,
|
|
76
|
+
// Children
|
|
77
|
+
children,
|
|
78
|
+
dropdownMatchSelectWidth = false,
|
|
79
|
+
showCheckedStrategy = SHOW_PARENT
|
|
80
|
+
} = props,
|
|
81
|
+
restProps = __rest(props, ["id", "prefixCls", "fieldNames", "defaultValue", "value", "changeOnSelect", "onChange", "displayRender", "checkable", "searchValue", "onSearch", "showSearch", "expandTrigger", "options", "dropdownPrefixCls", "loadData", "popupVisible", "open", "popupClassName", "dropdownClassName", "dropdownMenuColumnStyle", "popupPlacement", "placement", "onDropdownVisibleChange", "onPopupVisibleChange", "renderItem", "expandIcon", "loadingIcon", "children", "dropdownMatchSelectWidth", "showCheckedStrategy"]);
|
|
91
82
|
const mergedId = useId(id);
|
|
92
83
|
const multiple = !!checkable;
|
|
93
|
-
const [dropdownVisible, setDropdownVisible] = React.useState(false);
|
|
94
|
-
|
|
84
|
+
const [dropdownVisible, setDropdownVisible] = React.useState(false);
|
|
85
|
+
// =========================== Values ===========================
|
|
95
86
|
const [rawValues, setRawValues] = useMergedState(defaultValue, {
|
|
96
87
|
value,
|
|
97
88
|
postState: toRawValues
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames),
|
|
101
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
89
|
+
});
|
|
90
|
+
// ========================= FieldNames =========================
|
|
91
|
+
const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames), /* eslint-disable react-hooks/exhaustive-deps */
|
|
102
92
|
[JSON.stringify(fieldNames)]
|
|
103
|
-
/* eslint-enable react-hooks/exhaustive-deps */
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
/* eslint-enable react-hooks/exhaustive-deps */);
|
|
94
|
+
// =========================== Option ===========================
|
|
95
|
+
const mergedOptions = React.useMemo(() => options || [], [options]);
|
|
96
|
+
// Only used in multiple mode, this fn will not call in single mode
|
|
108
97
|
const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
|
|
109
98
|
/** Convert path key back to value format */
|
|
110
|
-
|
|
111
99
|
const getValueByKeyPath = React.useCallback(pathKeys => {
|
|
112
100
|
const keyPathEntities = getPathKeyEntities();
|
|
113
101
|
return pathKeys.map(pathKey => {
|
|
@@ -116,40 +104,35 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
116
104
|
} = keyPathEntities[pathKey];
|
|
117
105
|
return nodes.map(node => node[mergedFieldNames.value]);
|
|
118
106
|
});
|
|
119
|
-
}, [getPathKeyEntities, mergedFieldNames]);
|
|
120
|
-
|
|
107
|
+
}, [getPathKeyEntities, mergedFieldNames]);
|
|
108
|
+
// =========================== Search ===========================
|
|
121
109
|
const [mergedSearchValue, setSearchValue] = useMergedState('', {
|
|
122
110
|
value: searchValue,
|
|
123
111
|
postState: search => search || ''
|
|
124
112
|
});
|
|
125
|
-
|
|
126
113
|
const onInternalSearch = (searchText, info) => {
|
|
127
114
|
setSearchValue(searchText);
|
|
128
|
-
|
|
129
115
|
if (info.source !== 'blur' && onSearch) {
|
|
130
116
|
onSearch(searchText);
|
|
131
117
|
}
|
|
132
118
|
};
|
|
133
|
-
|
|
134
119
|
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch);
|
|
135
|
-
const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect);
|
|
136
|
-
|
|
137
|
-
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
138
|
-
|
|
120
|
+
const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect);
|
|
121
|
+
// =========================== Values ===========================
|
|
122
|
+
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
123
|
+
// Fill `rawValues` with checked conduction values
|
|
139
124
|
const [checkedValues, halfCheckedValues, missingCheckedValues] = React.useMemo(() => {
|
|
140
125
|
const [existValues, missingValues] = getMissingValues(rawValues);
|
|
141
|
-
|
|
142
126
|
if (!multiple || !rawValues.length) {
|
|
143
127
|
return [existValues, [], missingValues];
|
|
144
128
|
}
|
|
145
|
-
|
|
146
129
|
const keyPathValues = toPathKeys(existValues);
|
|
147
130
|
const keyPathEntities = getPathKeyEntities();
|
|
148
131
|
const {
|
|
149
132
|
checkedKeys,
|
|
150
133
|
halfCheckedKeys
|
|
151
|
-
} = conductCheck(keyPathValues, true, keyPathEntities);
|
|
152
|
-
|
|
134
|
+
} = conductCheck(keyPathValues, true, keyPathEntities);
|
|
135
|
+
// Convert key back to value cells
|
|
153
136
|
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
|
|
154
137
|
}, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
|
|
155
138
|
const deDuplicatedValues = React.useMemo(() => {
|
|
@@ -157,11 +140,11 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
157
140
|
const deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
158
141
|
return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];
|
|
159
142
|
}, [checkedValues, getPathKeyEntities, getValueByKeyPath, missingCheckedValues, showCheckedStrategy]);
|
|
160
|
-
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
|
|
161
|
-
|
|
143
|
+
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
|
|
144
|
+
// =========================== Change ===========================
|
|
162
145
|
const triggerChange = useRefFunc(nextValues => {
|
|
163
|
-
setRawValues(nextValues);
|
|
164
|
-
|
|
146
|
+
setRawValues(nextValues);
|
|
147
|
+
// Save perf if no need trigger event
|
|
165
148
|
if (onChange) {
|
|
166
149
|
const nextRawValues = toRawValues(nextValues);
|
|
167
150
|
const valueOptions = nextRawValues.map(valueCells => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(valueOpt => valueOpt.option));
|
|
@@ -169,11 +152,10 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
169
152
|
const triggerOptions = multiple ? valueOptions : valueOptions[0];
|
|
170
153
|
onChange(triggerValues, triggerOptions);
|
|
171
154
|
}
|
|
172
|
-
});
|
|
173
|
-
|
|
155
|
+
});
|
|
156
|
+
// =========================== Select ===========================
|
|
174
157
|
const onInternalSelect = useRefFunc(valuePath => {
|
|
175
158
|
setSearchValue('');
|
|
176
|
-
|
|
177
159
|
if (!multiple) {
|
|
178
160
|
triggerChange(valuePath);
|
|
179
161
|
} else {
|
|
@@ -182,21 +164,19 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
182
164
|
const checkedPathKeys = toPathKeys(checkedValues);
|
|
183
165
|
const halfCheckedPathKeys = toPathKeys(halfCheckedValues);
|
|
184
166
|
const existInChecked = checkedPathKeys.includes(pathKey);
|
|
185
|
-
const existInMissing = missingCheckedValues.some(valueCells => toPathKey(valueCells) === pathKey);
|
|
186
|
-
|
|
167
|
+
const existInMissing = missingCheckedValues.some(valueCells => toPathKey(valueCells) === pathKey);
|
|
168
|
+
// Do update
|
|
187
169
|
let nextCheckedValues = checkedValues;
|
|
188
170
|
let nextMissingValues = missingCheckedValues;
|
|
189
|
-
|
|
190
171
|
if (existInMissing && !existInChecked) {
|
|
191
172
|
// Missing value only do filter
|
|
192
173
|
nextMissingValues = missingCheckedValues.filter(valueCells => toPathKey(valueCells) !== pathKey);
|
|
193
174
|
} else {
|
|
194
175
|
// Update checked key first
|
|
195
176
|
const nextRawCheckedKeys = existInChecked ? checkedPathKeys.filter(key => key !== pathKey) : [...checkedPathKeys, pathKey];
|
|
196
|
-
const pathKeyEntities = getPathKeyEntities();
|
|
197
|
-
|
|
177
|
+
const pathKeyEntities = getPathKeyEntities();
|
|
178
|
+
// Conduction by selected or not
|
|
198
179
|
let checkedKeys;
|
|
199
|
-
|
|
200
180
|
if (existInChecked) {
|
|
201
181
|
;
|
|
202
182
|
({
|
|
@@ -210,48 +190,41 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
210
190
|
({
|
|
211
191
|
checkedKeys
|
|
212
192
|
} = conductCheck(nextRawCheckedKeys, true, pathKeyEntities));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
193
|
+
}
|
|
194
|
+
// Roll up to parent level keys
|
|
216
195
|
const deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
217
196
|
nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
|
|
218
197
|
}
|
|
219
|
-
|
|
220
198
|
triggerChange([...nextMissingValues, ...nextCheckedValues]);
|
|
221
199
|
}
|
|
222
|
-
});
|
|
223
|
-
|
|
200
|
+
});
|
|
201
|
+
// Display Value change logic
|
|
224
202
|
const onDisplayValuesChange = (_, info) => {
|
|
225
203
|
if (info.type === 'clear') {
|
|
226
204
|
triggerChange([]);
|
|
227
205
|
return;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
206
|
+
}
|
|
207
|
+
// Cascader do not support `add` type. Only support `remove`
|
|
231
208
|
const {
|
|
232
209
|
valueCells
|
|
233
210
|
} = info.values[0];
|
|
234
211
|
onInternalSelect(valueCells);
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
|
|
212
|
+
};
|
|
213
|
+
// ============================ Open ============================
|
|
238
214
|
const mergedOpen = open !== undefined ? open : popupVisible;
|
|
239
215
|
const mergedDropdownClassName = dropdownClassName || popupClassName;
|
|
240
216
|
const mergedPlacement = placement || popupPlacement;
|
|
241
|
-
|
|
242
217
|
const onInternalDropdownVisibleChange = nextVisible => {
|
|
243
218
|
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
|
|
244
219
|
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
|
|
245
220
|
setDropdownVisible(nextVisible);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
|
|
221
|
+
};
|
|
222
|
+
// ========================== Warning ===========================
|
|
249
223
|
if (process.env.NODE_ENV !== 'production') {
|
|
250
224
|
warningProps(props);
|
|
251
225
|
warningNullOptions(mergedOptions, mergedFieldNames);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
226
|
+
}
|
|
227
|
+
// ========================== Context ===========================
|
|
255
228
|
const cascaderContext = React.useMemo(() => ({
|
|
256
229
|
options: mergedOptions,
|
|
257
230
|
fieldNames: mergedFieldNames,
|
|
@@ -269,13 +242,15 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
269
242
|
dropdownMenuColumnStyle,
|
|
270
243
|
renderItem,
|
|
271
244
|
dropdownVisible
|
|
272
|
-
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, renderItem, dropdownVisible]);
|
|
245
|
+
}), [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, changeOnSelect, onInternalSelect, checkable, searchOptions, dropdownPrefixCls, loadData, expandTrigger, expandIcon, loadingIcon, dropdownMenuColumnStyle, renderItem, dropdownVisible]);
|
|
246
|
+
// ==============================================================
|
|
273
247
|
// == Render ==
|
|
274
248
|
// ==============================================================
|
|
275
|
-
|
|
276
249
|
const emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;
|
|
277
|
-
const dropdownStyle =
|
|
278
|
-
|
|
250
|
+
const dropdownStyle =
|
|
251
|
+
// Search to match width
|
|
252
|
+
mergedSearchValue && searchConfig.matchInputWidth ||
|
|
253
|
+
// Empty keep the width
|
|
279
254
|
emptyOptions ? {} : {
|
|
280
255
|
minWidth: 'auto'
|
|
281
256
|
};
|
|
@@ -308,11 +283,9 @@ const Cascader = React.forwardRef((props, ref) => {
|
|
|
308
283
|
getRawInputElement: () => children
|
|
309
284
|
})));
|
|
310
285
|
});
|
|
311
|
-
|
|
312
286
|
if (process.env.NODE_ENV !== 'production') {
|
|
313
287
|
Cascader.displayName = 'Cascader';
|
|
314
288
|
}
|
|
315
|
-
|
|
316
289
|
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
317
290
|
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
318
291
|
export default Cascader;
|