tntd 2.0.1 → 2.0.3
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/ellipsis/index.js +1 -1
- package/es/ellipsis/index.js.map +1 -1
- package/es/exception/exception.js +34 -0
- package/es/exception/exception.js.map +1 -0
- package/es/exception/exception.less +29 -0
- package/es/exception/index.js +5 -0
- package/es/exception/index.js.map +1 -0
- package/es/handle/index.js +52 -33
- package/es/handle/index.js.map +1 -1
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/es/locale/default.js +3 -2
- package/es/locale/default.js.map +1 -1
- package/es/locale/en_US.js +13 -1
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +13 -1
- package/es/locale/zh_CN.js.map +1 -1
- package/es/page/index.js +1 -1
- package/es/page/index.js.map +1 -1
- package/es/prev-locale.js +7 -1
- package/es/prev-locale.js.map +1 -1
- package/es/steps/index.js +3 -2
- package/es/steps/index.js.map +1 -1
- package/es/steps/steps.js +46 -0
- package/es/steps/steps.js.map +1 -0
- package/es/steps/style/index.less +11 -0
- package/es/steps/style/nav.less +273 -0
- package/es/steps/style/small.less +5 -0
- package/es/tntd-cascader/AntdCascader/component/DisabledContext.js +8 -0
- package/es/tntd-cascader/AntdCascader/component/DisabledContext.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/component/FormItemInputContext.js +3 -0
- package/es/tntd-cascader/AntdCascader/component/FormItemInputContext.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/component/SizeContext.js +3 -0
- package/es/tntd-cascader/AntdCascader/component/SizeContext.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/component/context.js +14 -0
- package/es/tntd-cascader/AntdCascader/component/context.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +20 -0
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/component/getIcons.js +52 -0
- package/es/tntd-cascader/AntdCascader/component/getIcons.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/component/useCompactItemContext.js +24 -0
- package/es/tntd-cascader/AntdCascader/component/useCompactItemContext.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/config/utils.js +24 -0
- package/es/tntd-cascader/AntdCascader/config/utils.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/config/warning.js +15 -0
- package/es/tntd-cascader/AntdCascader/config/warning.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/index.css +2327 -0
- package/es/tntd-cascader/AntdCascader/index.js +149 -0
- package/es/tntd-cascader/AntdCascader/index.js.map +1 -0
- package/es/tntd-cascader/AntdCascader/interface.js +5 -0
- package/es/tntd-cascader/AntdCascader/interface.js.map +1 -0
- package/es/tntd-cascader/img/no-data-s.png +0 -0
- package/es/tntd-cascader/index.js +2 -0
- package/es/tntd-cascader/index.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/Cascader.js +270 -0
- package/es/tntd-cascader/rc-cascader/Cascader.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/Checkbox.js +14 -0
- package/es/tntd-cascader/rc-cascader/OptionList/Checkbox.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js +126 -0
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/index.js +140 -0
- package/es/tntd-cascader/rc-cascader/OptionList/index.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/useActive.js +24 -0
- package/es/tntd-cascader/rc-cascader/OptionList/useActive.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +145 -0
- package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/context.js +4 -0
- package/es/tntd-cascader/rc-cascader/context.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +41 -0
- package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/hooks/useEntities.js +30 -0
- package/es/tntd-cascader/rc-cascader/hooks/useEntities.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/hooks/useMissingValues.js +19 -0
- package/es/tntd-cascader/rc-cascader/hooks/useMissingValues.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/hooks/useRefFunc.js +15 -0
- package/es/tntd-cascader/rc-cascader/hooks/useRefFunc.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +26 -0
- package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +46 -0
- package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/index.js +3 -0
- package/es/tntd-cascader/rc-cascader/index.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/index.less +19 -0
- package/es/tntd-cascader/rc-cascader/utils/commonUtil.js +41 -0
- package/es/tntd-cascader/rc-cascader/utils/commonUtil.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/utils/treeUtil.js +37 -0
- package/es/tntd-cascader/rc-cascader/utils/treeUtil.js.map +1 -0
- package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +30 -0
- package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js.map +1 -0
- package/es/tntd-layout/Avatar.js +25 -19
- package/es/tntd-layout/Avatar.js.map +1 -1
- package/es/tntd-layout/EnterpriseLayout/Avatar.js +10 -8
- package/es/tntd-layout/EnterpriseLayout/Avatar.js.map +1 -1
- package/es/tntd-layout/EnterpriseLayout/Language.js +5 -4
- package/es/tntd-layout/EnterpriseLayout/Language.js.map +1 -1
- package/es/tntd-layout/EnterpriseLayout/Theme.js +7 -6
- package/es/tntd-layout/EnterpriseLayout/Theme.js.map +1 -1
- package/es/tntd-layout/HeaderActions.js +5 -4
- package/es/tntd-layout/HeaderActions.js.map +1 -1
- package/es/tntd-layout/Layout.js +2 -2
- package/es/tntd-layout/Layout.js.map +1 -1
- package/es/tntd-layout/SideMenu.js.map +1 -1
- package/es/tntd-layout/index.js +2 -2
- package/es/tntd-layout/index.js.map +1 -1
- package/es/tntd-layout/storage.js +10 -2
- package/es/tntd-layout/storage.js.map +1 -1
- package/lib/ellipsis/index.js +1 -1
- package/lib/ellipsis/index.js.map +1 -1
- package/lib/exception/exception.d.ts +16 -0
- package/lib/exception/exception.d.ts.map +1 -0
- package/lib/exception/exception.js +41 -0
- package/lib/exception/exception.js.map +1 -0
- package/lib/exception/exception.less +29 -0
- package/lib/exception/index.d.ts +5 -0
- package/lib/exception/index.d.ts.map +1 -0
- package/lib/exception/index.js +21 -0
- package/lib/exception/index.js.map +1 -0
- package/lib/handle/index.d.ts.map +1 -1
- package/lib/handle/index.js +52 -33
- package/lib/handle/index.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/locale/default.d.ts +13 -1
- package/lib/locale/default.d.ts.map +1 -1
- package/lib/locale/default.js +3 -3
- package/lib/locale/default.js.map +1 -1
- package/lib/locale/en_US.d.ts +13 -1
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js +13 -2
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts +13 -1
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js +13 -2
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/page/index.js +1 -1
- package/lib/page/index.js.map +1 -1
- package/lib/prev-locale.d.ts +6 -0
- package/lib/prev-locale.d.ts.map +1 -1
- package/lib/prev-locale.js +7 -1
- package/lib/prev-locale.js.map +1 -1
- package/lib/steps/index.d.ts +3 -2
- package/lib/steps/index.d.ts.map +1 -1
- package/lib/steps/index.js +4 -6
- package/lib/steps/index.js.map +1 -1
- package/lib/steps/steps.d.ts +12 -0
- package/lib/steps/steps.d.ts.map +1 -0
- package/lib/steps/steps.js +67 -0
- package/lib/steps/steps.js.map +1 -0
- package/lib/steps/style/index.less +11 -0
- package/lib/steps/style/nav.less +273 -0
- package/lib/steps/style/small.less +5 -0
- package/lib/tntd-cascader/AntdCascader/component/DisabledContext.d.ts +10 -0
- package/lib/tntd-cascader/AntdCascader/component/DisabledContext.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/DisabledContext.js +35 -0
- package/lib/tntd-cascader/AntdCascader/component/DisabledContext.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.d.ts +4 -0
- package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.js +29 -0
- package/lib/tntd-cascader/AntdCascader/component/FormItemInputContext.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/SizeContext.d.ts +4 -0
- package/lib/tntd-cascader/AntdCascader/component/SizeContext.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/SizeContext.js +29 -0
- package/lib/tntd-cascader/AntdCascader/component/SizeContext.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/context.d.ts +42 -0
- package/lib/tntd-cascader/AntdCascader/component/context.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/context.js +20 -0
- package/lib/tntd-cascader/AntdCascader/component/context.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.d.ts +5 -0
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +48 -0
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/getIcons.d.ts +25 -0
- package/lib/tntd-cascader/AntdCascader/component/getIcons.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/getIcons.js +78 -0
- package/lib/tntd-cascader/AntdCascader/component/getIcons.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.d.ts +9 -0
- package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js +54 -0
- package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/config/utils.d.ts +6 -0
- package/lib/tntd-cascader/AntdCascader/config/utils.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/config/utils.js +34 -0
- package/lib/tntd-cascader/AntdCascader/config/utils.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/config/warning.d.ts +4 -0
- package/lib/tntd-cascader/AntdCascader/config/warning.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/config/warning.js +40 -0
- package/lib/tntd-cascader/AntdCascader/config/warning.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/index.css +2327 -0
- package/lib/tntd-cascader/AntdCascader/index.d.ts +44 -0
- package/lib/tntd-cascader/AntdCascader/index.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/index.js +177 -0
- package/lib/tntd-cascader/AntdCascader/index.js.map +1 -0
- package/lib/tntd-cascader/AntdCascader/interface.d.ts +25 -0
- package/lib/tntd-cascader/AntdCascader/interface.d.ts.map +1 -0
- package/lib/tntd-cascader/AntdCascader/interface.js +9 -0
- package/lib/tntd-cascader/AntdCascader/interface.js.map +1 -0
- package/lib/tntd-cascader/img/no-data-s.png +0 -0
- package/lib/tntd-cascader/index.d.ts +2 -0
- package/lib/tntd-cascader/index.d.ts.map +1 -0
- package/lib/tntd-cascader/index.js +9 -0
- package/lib/tntd-cascader/index.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/Cascader.d.ts +92 -0
- package/lib/tntd-cascader/rc-cascader/Cascader.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/Cascader.js +298 -0
- package/lib/tntd-cascader/rc-cascader/Cascader.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.d.ts +10 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js +43 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.d.ts +26 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +156 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/index.d.ts +5 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/index.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js +168 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useActive.d.ts +7 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useActive.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js +52 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.d.ts +6 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +173 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/context.d.ts +26 -0
- package/lib/tntd-cascader/rc-cascader/context.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/context.js +29 -0
- package/lib/tntd-cascader/rc-cascader/context.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.d.ts +11 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +66 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useEntities.d.ts +11 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useEntities.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useEntities.js +55 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useEntities.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.d.ts +4 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.js +44 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useMissingValues.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.d.ts +6 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.js +41 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useRefFunc.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.d.ts +3 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +55 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.d.ts +5 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +72 -0
- package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/index.d.ts +4 -0
- package/lib/tntd-cascader/rc-cascader/index.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/index.js +8 -0
- package/lib/tntd-cascader/rc-cascader/index.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/index.less +19 -0
- package/lib/tntd-cascader/rc-cascader/utils/commonUtil.d.ts +11 -0
- package/lib/tntd-cascader/rc-cascader/utils/commonUtil.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/utils/commonUtil.js +50 -0
- package/lib/tntd-cascader/rc-cascader/utils/commonUtil.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/utils/treeUtil.d.ts +10 -0
- package/lib/tntd-cascader/rc-cascader/utils/treeUtil.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/utils/treeUtil.js +42 -0
- package/lib/tntd-cascader/rc-cascader/utils/treeUtil.js.map +1 -0
- package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.d.ts +5 -0
- package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.d.ts.map +1 -0
- package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +37 -0
- package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js.map +1 -0
- package/lib/tntd-layout/Avatar.d.ts.map +1 -1
- package/lib/tntd-layout/Avatar.js +25 -19
- package/lib/tntd-layout/Avatar.js.map +1 -1
- package/lib/tntd-layout/EnterpriseLayout/Avatar.d.ts.map +1 -1
- package/lib/tntd-layout/EnterpriseLayout/Avatar.js +10 -8
- package/lib/tntd-layout/EnterpriseLayout/Avatar.js.map +1 -1
- package/lib/tntd-layout/EnterpriseLayout/Language.js +4 -3
- package/lib/tntd-layout/EnterpriseLayout/Language.js.map +1 -1
- package/lib/tntd-layout/EnterpriseLayout/Theme.js +6 -5
- package/lib/tntd-layout/EnterpriseLayout/Theme.js.map +1 -1
- package/lib/tntd-layout/HeaderActions.js +5 -4
- package/lib/tntd-layout/HeaderActions.js.map +1 -1
- package/lib/tntd-layout/Layout.js +2 -2
- package/lib/tntd-layout/Layout.js.map +1 -1
- package/lib/tntd-layout/SideMenu.js.map +1 -1
- package/lib/tntd-layout/index.d.ts.map +1 -1
- package/lib/tntd-layout/index.js +2 -2
- package/lib/tntd-layout/index.js.map +1 -1
- package/lib/tntd-layout/storage.d.ts +3 -2
- package/lib/tntd-layout/storage.d.ts.map +1 -1
- package/lib/tntd-layout/storage.js +15 -3
- package/lib/tntd-layout/storage.js.map +1 -1
- package/package.json +11 -2
- package/es/array-input/style/index.js +0 -2
- package/es/array-input/style/index.js.map +0 -1
- package/es/auth-context/style/index.js +0 -2
- package/es/auth-context/style/index.js.map +0 -1
- package/es/development-login/style/index.js +0 -2
- package/es/development-login/style/index.js.map +0 -1
- package/es/ellipsis/style/index.js +0 -2
- package/es/ellipsis/style/index.js.map +0 -1
- package/es/empty/render-empty.js +0 -19
- package/es/empty/render-empty.js.map +0 -1
- package/es/empty/style/index.js +0 -3
- package/es/empty/style/index.js.map +0 -1
- package/es/handle/style/index.js +0 -2
- package/es/handle/style/index.js.map +0 -1
- package/es/icon-list/style/index.js +0 -120
- package/es/icon-list/style/index.js.map +0 -1
- package/es/img/style/index.js +0 -2
- package/es/img/style/index.js.map +0 -1
- package/es/loading-button/style/index.js +0 -2
- package/es/loading-button/style/index.js.map +0 -1
- package/es/page/style/index.js +0 -2
- package/es/page/style/index.js.map +0 -1
- package/es/query-form/style/index.js +0 -2
- package/es/query-form/style/index.js.map +0 -1
- package/es/query-list-scene/style/index.js +0 -2
- package/es/query-list-scene/style/index.js.map +0 -1
- package/es/render-empty/style/index.js +0 -2
- package/es/render-empty/style/index.js.map +0 -1
- package/es/table/style/index.js +0 -3
- package/es/table/style/index.js.map +0 -1
- package/es/title/style/index.js +0 -2
- package/es/title/style/index.js.map +0 -1
- package/es/tntd-icon/style/index.js +0 -2
- package/es/tntd-icon/style/index.js.map +0 -1
- package/es/tntd-layout/style/index.js +0 -2
- package/es/tntd-layout/style/index.js.map +0 -1
- package/es/tntd-modal/style/index.js +0 -2
- package/es/tntd-modal/style/index.js.map +0 -1
- package/es/tntd-select/style/index.js +0 -2
- package/es/tntd-select/style/index.js.map +0 -1
- package/lib/array-input/style/index.d.ts +0 -1
- package/lib/array-input/style/index.d.ts.map +0 -1
- package/lib/array-input/style/index.js +0 -2
- package/lib/array-input/style/index.js.map +0 -1
- package/lib/auth-context/style/index.d.ts +0 -1
- package/lib/auth-context/style/index.d.ts.map +0 -1
- package/lib/auth-context/style/index.js +0 -2
- package/lib/auth-context/style/index.js.map +0 -1
- package/lib/development-login/style/index.d.ts +0 -1
- package/lib/development-login/style/index.d.ts.map +0 -1
- package/lib/development-login/style/index.js +0 -2
- package/lib/development-login/style/index.js.map +0 -1
- package/lib/ellipsis/style/index.d.ts +0 -1
- package/lib/ellipsis/style/index.d.ts.map +0 -1
- package/lib/ellipsis/style/index.js +0 -2
- package/lib/ellipsis/style/index.js.map +0 -1
- package/lib/empty/render-empty.d.ts +0 -3
- package/lib/empty/render-empty.d.ts.map +0 -1
- package/lib/empty/render-empty.js +0 -26
- package/lib/empty/render-empty.js.map +0 -1
- package/lib/empty/style/index.d.ts +0 -3
- package/lib/empty/style/index.d.ts.map +0 -1
- package/lib/empty/style/index.js +0 -5
- package/lib/empty/style/index.js.map +0 -1
- package/lib/handle/style/index.d.ts +0 -1
- package/lib/handle/style/index.d.ts.map +0 -1
- package/lib/handle/style/index.js +0 -2
- package/lib/handle/style/index.js.map +0 -1
- package/lib/icon-list/style/index.d.ts +0 -3
- package/lib/icon-list/style/index.d.ts.map +0 -1
- package/lib/icon-list/style/index.js +0 -122
- package/lib/icon-list/style/index.js.map +0 -1
- package/lib/img/style/index.d.ts +0 -1
- package/lib/img/style/index.d.ts.map +0 -1
- package/lib/img/style/index.js +0 -2
- package/lib/img/style/index.js.map +0 -1
- package/lib/loading-button/style/index.d.ts +0 -1
- package/lib/loading-button/style/index.d.ts.map +0 -1
- package/lib/loading-button/style/index.js +0 -2
- package/lib/loading-button/style/index.js.map +0 -1
- package/lib/page/style/index.d.ts +0 -1
- package/lib/page/style/index.d.ts.map +0 -1
- package/lib/page/style/index.js +0 -2
- package/lib/page/style/index.js.map +0 -1
- package/lib/query-form/style/index.d.ts +0 -1
- package/lib/query-form/style/index.d.ts.map +0 -1
- package/lib/query-form/style/index.js +0 -2
- package/lib/query-form/style/index.js.map +0 -1
- package/lib/query-list-scene/style/index.d.ts +0 -1
- package/lib/query-list-scene/style/index.d.ts.map +0 -1
- package/lib/query-list-scene/style/index.js +0 -2
- package/lib/query-list-scene/style/index.js.map +0 -1
- package/lib/render-empty/style/index.d.ts +0 -2
- package/lib/render-empty/style/index.d.ts.map +0 -1
- package/lib/render-empty/style/index.js +0 -4
- package/lib/render-empty/style/index.js.map +0 -1
- package/lib/table/style/index.d.ts +0 -3
- package/lib/table/style/index.d.ts.map +0 -1
- package/lib/table/style/index.js +0 -5
- package/lib/table/style/index.js.map +0 -1
- package/lib/title/style/index.d.ts +0 -1
- package/lib/title/style/index.d.ts.map +0 -1
- package/lib/title/style/index.js +0 -2
- package/lib/title/style/index.js.map +0 -1
- package/lib/tntd-icon/style/index.d.ts +0 -1
- package/lib/tntd-icon/style/index.d.ts.map +0 -1
- package/lib/tntd-icon/style/index.js +0 -2
- package/lib/tntd-icon/style/index.js.map +0 -1
- package/lib/tntd-layout/style/index.d.ts +0 -1
- package/lib/tntd-layout/style/index.d.ts.map +0 -1
- package/lib/tntd-layout/style/index.js +0 -2
- package/lib/tntd-layout/style/index.js.map +0 -1
- package/lib/tntd-modal/style/index.d.ts +0 -1
- package/lib/tntd-modal/style/index.d.ts.map +0 -1
- package/lib/tntd-modal/style/index.js +0 -2
- package/lib/tntd-modal/style/index.js.map +0 -1
- package/lib/tntd-select/style/index.d.ts +0 -1
- package/lib/tntd-select/style/index.d.ts.map +0 -1
- package/lib/tntd-select/style/index.js +0 -2
- package/lib/tntd-select/style/index.js.map +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { Icon } from 'antd';
|
|
13
|
+
import classNames from 'classnames';
|
|
14
|
+
import RcCascader from '../rc-cascader';
|
|
15
|
+
import omit from 'rc-util/lib/omit';
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import { useContext } from 'react';
|
|
18
|
+
import { ConfigContext } from './component/context';
|
|
19
|
+
import defaultRenderEmpty from './component/defaultRenderEmpty';
|
|
20
|
+
import DisabledContext from './component/DisabledContext';
|
|
21
|
+
import { SizeContext } from './component/SizeContext';
|
|
22
|
+
import { useCompactItemContext } from './component/useCompactItemContext';
|
|
23
|
+
import { FormItemInputContext } from './component/FormItemInputContext';
|
|
24
|
+
import getIcons from './component/getIcons';
|
|
25
|
+
import { getTransitionDirection, getTransitionName, getMergedStatus, getStatusClassNames, } from './config/utils';
|
|
26
|
+
import warning from './config/warning';
|
|
27
|
+
import './index.css';
|
|
28
|
+
const { SHOW_CHILD, SHOW_PARENT } = RcCascader;
|
|
29
|
+
function highlightKeyword(str, lowerKeyword, prefixCls) {
|
|
30
|
+
const cells = str
|
|
31
|
+
.toLowerCase()
|
|
32
|
+
.split(lowerKeyword)
|
|
33
|
+
.reduce((list, cur, index) => (index === 0 ? [cur] : [...list, lowerKeyword, cur]), []);
|
|
34
|
+
const fillCells = [];
|
|
35
|
+
let start = 0;
|
|
36
|
+
cells.forEach((cell, index) => {
|
|
37
|
+
const end = start + cell.length;
|
|
38
|
+
let originWorld = str.slice(start, end);
|
|
39
|
+
start = end;
|
|
40
|
+
if (index % 2 === 1) {
|
|
41
|
+
originWorld = (
|
|
42
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
43
|
+
React.createElement("span", { className: `${prefixCls}-menu-item-keyword`, key: `seperator-${index}` }, originWorld));
|
|
44
|
+
}
|
|
45
|
+
fillCells.push(originWorld);
|
|
46
|
+
});
|
|
47
|
+
return fillCells;
|
|
48
|
+
}
|
|
49
|
+
const defaultSearchRender = (inputValue, path, prefixCls, fieldNames) => {
|
|
50
|
+
const optionList = [];
|
|
51
|
+
// We do lower here to save perf
|
|
52
|
+
const lower = inputValue.toLowerCase();
|
|
53
|
+
path.forEach((node, index) => {
|
|
54
|
+
if (index !== 0) {
|
|
55
|
+
optionList.push(' / ');
|
|
56
|
+
}
|
|
57
|
+
let label = node[fieldNames.label];
|
|
58
|
+
const type = typeof label;
|
|
59
|
+
if (type === 'string' || type === 'number') {
|
|
60
|
+
label = highlightKeyword(String(label), lower, prefixCls);
|
|
61
|
+
}
|
|
62
|
+
optionList.push(label);
|
|
63
|
+
});
|
|
64
|
+
return optionList;
|
|
65
|
+
};
|
|
66
|
+
const Cascader = React.forwardRef((props, ref) => {
|
|
67
|
+
const { prefixCls: customizePrefixCls, size: customizeSize, disabled: customDisabled, className, multiple, bordered = true, transitionName, choiceTransitionName = '', popupClassName, dropdownClassName, expandIcon, placement, showSearch, allowClear = true, notFoundContent, direction, getPopupContainer, status: customStatus, showArrow } = props, rest = __rest(props, ["prefixCls", "size", "disabled", "className", "multiple", "bordered", "transitionName", "choiceTransitionName", "popupClassName", "dropdownClassName", "expandIcon", "placement", "showSearch", "allowClear", "notFoundContent", "direction", "getPopupContainer", "status", "showArrow"]);
|
|
68
|
+
const restProps = omit(rest, ['suffixIcon']);
|
|
69
|
+
const { getPopupContainer: getContextPopupContainer, getPrefixCls, renderEmpty, direction: rootDirection,
|
|
70
|
+
// virtual,
|
|
71
|
+
// dropdownMatchSelectWidth,
|
|
72
|
+
} = useContext(ConfigContext);
|
|
73
|
+
const mergedDirection = direction || rootDirection;
|
|
74
|
+
const isRtl = mergedDirection === 'rtl';
|
|
75
|
+
// =================== Form =====================
|
|
76
|
+
const { status: contextStatus, hasFeedback, isFormItemInput, feedbackIcon, } = useContext(FormItemInputContext);
|
|
77
|
+
const mergedStatus = getMergedStatus(contextStatus, customStatus);
|
|
78
|
+
// =================== Warning =====================
|
|
79
|
+
warning(!dropdownClassName, 'Cascader', '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.');
|
|
80
|
+
warning(!multiple || !props.displayRender, 'Cascader', '`displayRender` not work on `multiple`. Please use `tagRender` instead.');
|
|
81
|
+
// =================== No Found ====================
|
|
82
|
+
const mergedNotFoundContent = notFoundContent || (renderEmpty || defaultRenderEmpty)('Cascader');
|
|
83
|
+
// ==================== Prefix =====================
|
|
84
|
+
const rootPrefixCls = getPrefixCls();
|
|
85
|
+
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
86
|
+
const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);
|
|
87
|
+
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
|
|
88
|
+
// =================== Dropdown ====================
|
|
89
|
+
const mergedDropdownClassName = classNames(popupClassName || dropdownClassName, `${cascaderPrefixCls}-dropdown`, {
|
|
90
|
+
[`${cascaderPrefixCls}-dropdown-rtl`]: mergedDirection === 'rtl',
|
|
91
|
+
});
|
|
92
|
+
// ==================== Search =====================
|
|
93
|
+
const mergedShowSearch = React.useMemo(() => {
|
|
94
|
+
if (!showSearch) {
|
|
95
|
+
return showSearch;
|
|
96
|
+
}
|
|
97
|
+
let searchConfig = {
|
|
98
|
+
render: defaultSearchRender,
|
|
99
|
+
};
|
|
100
|
+
if (typeof showSearch === 'object') {
|
|
101
|
+
searchConfig = Object.assign(Object.assign({}, searchConfig), showSearch);
|
|
102
|
+
}
|
|
103
|
+
return searchConfig;
|
|
104
|
+
}, [showSearch]);
|
|
105
|
+
// ===================== Size ======================
|
|
106
|
+
const size = React.useContext(SizeContext);
|
|
107
|
+
const mergedSize = compactSize || customizeSize || size;
|
|
108
|
+
// ===================== Disabled =====================
|
|
109
|
+
const disabled = React.useContext(DisabledContext);
|
|
110
|
+
const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
|
|
111
|
+
// ===================== Icon ======================
|
|
112
|
+
let mergedExpandIcon = expandIcon;
|
|
113
|
+
if (!expandIcon) {
|
|
114
|
+
mergedExpandIcon = isRtl ? React.createElement(Icon, { type: "left" }) : React.createElement(Icon, { type: "right" });
|
|
115
|
+
}
|
|
116
|
+
const loadingIcon = (React.createElement("span", { className: `${prefixCls}-menu-item-loading-icon` },
|
|
117
|
+
React.createElement(Icon, { type: "loading" })));
|
|
118
|
+
// =================== Multiple ====================
|
|
119
|
+
const checkable = React.useMemo(() => (multiple ? React.createElement("span", { className: `${cascaderPrefixCls}-checkbox-inner` }) : false), [multiple]);
|
|
120
|
+
// ===================== Icons =====================
|
|
121
|
+
const mergedShowArrow = showArrow !== undefined ? showArrow : props.loading || !multiple;
|
|
122
|
+
const { suffixIcon, removeIcon, clearIcon } = getIcons(Object.assign(Object.assign({}, props), { hasFeedback,
|
|
123
|
+
feedbackIcon, showArrow: mergedShowArrow, multiple,
|
|
124
|
+
prefixCls }));
|
|
125
|
+
// ===================== Placement =====================
|
|
126
|
+
const getPlacement = () => {
|
|
127
|
+
if (placement !== undefined) {
|
|
128
|
+
return placement;
|
|
129
|
+
}
|
|
130
|
+
return direction === 'rtl'
|
|
131
|
+
? 'bottomRight'
|
|
132
|
+
: 'bottomLeft';
|
|
133
|
+
};
|
|
134
|
+
// ==================== Render =====================
|
|
135
|
+
return (React.createElement(RcCascader, Object.assign({ prefixCls: prefixCls, className: classNames(!customizePrefixCls && cascaderPrefixCls, {
|
|
136
|
+
[`${prefixCls}-lg`]: mergedSize === 'large',
|
|
137
|
+
[`${prefixCls}-sm`]: mergedSize === 'small',
|
|
138
|
+
[`${prefixCls}-rtl`]: isRtl,
|
|
139
|
+
[`${prefixCls}-borderless`]: !bordered,
|
|
140
|
+
[`${prefixCls}-in-form-item`]: isFormItemInput,
|
|
141
|
+
}, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), compactItemClassnames, className), disabled: mergedDisabled }, restProps, { direction: mergedDirection, placement: getPlacement(), notFoundContent: mergedNotFoundContent, allowClear: allowClear, showSearch: mergedShowSearch, expandIcon: mergedExpandIcon, inputIcon: suffixIcon, removeIcon: removeIcon, clearIcon: clearIcon, loadingIcon: loadingIcon, checkable: checkable, dropdownClassName: mergedDropdownClassName, dropdownPrefixCls: customizePrefixCls || cascaderPrefixCls, choiceTransitionName: getTransitionName(rootPrefixCls, '', choiceTransitionName), transitionName: getTransitionName(rootPrefixCls, getTransitionDirection(placement), transitionName), getPopupContainer: getPopupContainer || getContextPopupContainer, ref: ref, showArrow: hasFeedback || showArrow })));
|
|
142
|
+
});
|
|
143
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
144
|
+
Cascader.displayName = 'Cascader';
|
|
145
|
+
}
|
|
146
|
+
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
147
|
+
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
148
|
+
export default Cascader;
|
|
149
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tntd-cascader/AntdCascader/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AASpC,OAAO,UAAU,MAAM,gBAAgB,CAAC;AACxC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,kBAAk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CAAC,EAAE,eAAe;SAC/C,EACD,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,EACzD,qBAAqB,EACrB,SAAS,CACV,EACD,QAAQ,EAAE,cAAc,IACnB,SAAiB,IACtB,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,YAAY,EAAE,EACzB,eAAe,EAAE,qBAAqB,EACtC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,gBAAgB,EAC5B,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,uBAAuB,EAC1C,iBAAiB,EAAE,kBAAkB,IAAI,iBAAiB,EAC1D,oBAAoB,EAAE,iBAAiB,CAAC,aAAa,EAAE,EAAE,EAAE,oBAAoB,CAAC,EAChF,cAAc,EAAE,iBAAiB,CAC/B,aAAa,EACb,sBAAsB,CAAC,SAAS,CAAC,EACjC,cAAc,CACf,EACD,iBAAiB,EAAE,iBAAiB,IAAI,wBAAwB,EAChE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,WAAW,IAAI,SAAS,IACnC,CACH,CAAC;AACJ,CAAC,CAMA,CAAC;AACF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;CACnC;AACD,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;AACnC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;AAEjC,eAAe,QAAQ,CAAC","sourcesContent":["import { Icon } from 'antd';\nimport classNames from 'classnames';\nimport type {\n BaseOptionType,\n DefaultOptionType,\n FieldNames,\n MultipleCascaderProps as RcMultipleCascaderProps,\n ShowSearchType,\n SingleCascaderProps as RcSingleCascaderProps,\n} from '../rc-cascader';\nimport RcCascader from '../rc-cascader';\nimport omit from 'rc-util/lib/omit';\nimport * as React from 'react';\nimport { useContext } from 'react';\nimport { ConfigContext } from './component/context';\nimport defaultRenderEmpty from './component/defaultRenderEmpty';\nimport DisabledContext from './component/DisabledContext';\nimport type { SizeType } from './interface';\nimport { SizeContext } from './component/SizeContext';\nimport { useCompactItemContext } from './component/useCompactItemContext';\nimport { FormItemInputContext } from './component/FormItemInputContext';\nimport getIcons from './component/getIcons';\nimport type { SelectCommonPlacement } from './interface';\nimport {\n getTransitionDirection,\n getTransitionName,\n getMergedStatus,\n getStatusClassNames,\n} from './config/utils';\nimport type { InputStatus } from './interface';\nimport warning from './config/warning';\nimport './index.css';\n\n// Align the design since we use `rc-select` in root. This help:\n// - List search content will show all content\n// - Hover opacity style\n// - Search filter match case\n\nexport { BaseOptionType, DefaultOptionType };\n\nexport type FieldNamesType = FieldNames;\n\nexport type FilledFieldNamesType = Required<FieldNamesType>;\n\nconst { SHOW_CHILD, SHOW_PARENT } = RcCascader;\n\nfunction highlightKeyword(str: string, lowerKeyword: string, prefixCls: string | undefined) {\n const cells = str\n .toLowerCase()\n .split(lowerKeyword)\n .reduce(\n (list, cur, index) => (index === 0 ? [cur] : [...list, lowerKeyword, cur]),\n [] as string[],\n );\n const fillCells: React.ReactNode[] = [];\n let start = 0;\n\n cells.forEach((cell: string, index: number) => {\n const end = start + cell.length;\n let originWorld: React.ReactNode = str.slice(start, end);\n start = end;\n\n if (index % 2 === 1) {\n originWorld = (\n // eslint-disable-next-line react/no-array-index-key\n <span className={`${prefixCls}-menu-item-keyword`} key={`seperator-${index}`}>\n {originWorld}\n </span>\n );\n }\n\n fillCells.push(originWorld);\n });\n\n return fillCells;\n}\n\nconst defaultSearchRender: ShowSearchType['render'] = (inputValue, path, prefixCls, fieldNames) => {\n const optionList: React.ReactNode[] = [];\n\n // We do lower here to save perf\n const lower = inputValue.toLowerCase();\n\n path.forEach((node, index) => {\n if (index !== 0) {\n optionList.push(' / ');\n }\n\n let label = (node as any)[fieldNames.label!];\n const type = typeof label;\n if (type === 'string' || type === 'number') {\n label = highlightKeyword(String(label), lower, prefixCls);\n }\n\n optionList.push(label);\n });\n return optionList;\n};\n\ntype SingleCascaderProps = Omit<RcSingleCascaderProps, 'checkable' | 'options'> & {\n multiple?: false;\n};\ntype MultipleCascaderProps = Omit<RcMultipleCascaderProps, 'checkable' | 'options'> & {\n multiple: true;\n};\n\ntype UnionCascaderProps = SingleCascaderProps | MultipleCascaderProps;\n\nexport type CascaderProps<DataNodeType> = UnionCascaderProps & {\n multiple?: boolean;\n size?: SizeType;\n disabled?: boolean;\n bordered?: boolean;\n placement?: SelectCommonPlacement;\n suffixIcon?: React.ReactNode;\n options?: DataNodeType[];\n status?: InputStatus;\n /**\n * @deprecated `dropdownClassName` is deprecated which will be removed in next major\n * version.Please use `popupClassName` instead.\n */\n dropdownClassName?: string;\n};\n\nexport interface CascaderRef {\n focus: () => void;\n blur: () => void;\n}\n\nconst Cascader = React.forwardRef((props: CascaderProps<any>, ref: React.Ref<CascaderRef>) => {\n const {\n prefixCls: customizePrefixCls,\n size: customizeSize,\n disabled: customDisabled,\n className,\n multiple,\n bordered = true,\n transitionName,\n choiceTransitionName = '',\n popupClassName,\n dropdownClassName,\n expandIcon,\n placement,\n showSearch,\n allowClear = true,\n notFoundContent,\n direction,\n getPopupContainer,\n status: customStatus,\n showArrow,\n ...rest\n } = props;\n\n const restProps = omit(rest, ['suffixIcon' as any]);\n\n const {\n getPopupContainer: getContextPopupContainer,\n getPrefixCls,\n renderEmpty,\n direction: rootDirection,\n // virtual,\n // dropdownMatchSelectWidth,\n } = useContext(ConfigContext);\n\n const mergedDirection = direction || rootDirection;\n const isRtl = mergedDirection === 'rtl';\n\n // =================== Form =====================\n const {\n status: contextStatus,\n hasFeedback,\n isFormItemInput,\n feedbackIcon,\n } = useContext(FormItemInputContext);\n const mergedStatus = getMergedStatus(contextStatus, customStatus);\n\n // =================== Warning =====================\n warning(\n !dropdownClassName,\n 'Cascader',\n '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',\n );\n\n warning(\n !multiple || !props.displayRender,\n 'Cascader',\n '`displayRender` not work on `multiple`. Please use `tagRender` instead.',\n );\n\n // =================== No Found ====================\n const mergedNotFoundContent = notFoundContent || (renderEmpty || defaultRenderEmpty)('Cascader');\n\n // ==================== Prefix =====================\n const rootPrefixCls = getPrefixCls();\n const prefixCls = getPrefixCls('select', customizePrefixCls);\n const cascaderPrefixCls = getPrefixCls('cascader', customizePrefixCls);\n const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);\n // =================== Dropdown ====================\n const mergedDropdownClassName = classNames(\n popupClassName || dropdownClassName,\n `${cascaderPrefixCls}-dropdown`,\n {\n [`${cascaderPrefixCls}-dropdown-rtl`]: mergedDirection === 'rtl',\n },\n );\n\n // ==================== Search =====================\n const mergedShowSearch = React.useMemo(() => {\n if (!showSearch) {\n return showSearch;\n }\n\n let searchConfig: ShowSearchType = {\n render: defaultSearchRender,\n };\n\n if (typeof showSearch === 'object') {\n searchConfig = {\n ...searchConfig,\n ...showSearch,\n };\n }\n\n return searchConfig;\n }, [showSearch]);\n\n // ===================== Size ======================\n const size = React.useContext(SizeContext);\n const mergedSize = compactSize || customizeSize || size;\n\n // ===================== Disabled =====================\n const disabled = React.useContext(DisabledContext);\n const mergedDisabled = customDisabled ?? disabled;\n\n // ===================== Icon ======================\n let mergedExpandIcon = expandIcon;\n if (!expandIcon) {\n mergedExpandIcon = isRtl ? <Icon type=\"left\" /> : <Icon type=\"right\" />;\n }\n\n const loadingIcon = (\n <span className={`${prefixCls}-menu-item-loading-icon`}>\n <Icon type=\"loading\" />\n </span>\n );\n\n // =================== Multiple ====================\n const checkable = React.useMemo(\n () => (multiple ? <span className={`${cascaderPrefixCls}-checkbox-inner`} /> : false),\n [multiple],\n );\n\n // ===================== Icons =====================\n const mergedShowArrow = showArrow !== undefined ? showArrow : props.loading || !multiple;\n const { suffixIcon, removeIcon, clearIcon } = getIcons({\n ...props,\n hasFeedback,\n feedbackIcon,\n showArrow: mergedShowArrow,\n multiple,\n prefixCls,\n });\n\n // ===================== Placement =====================\n const getPlacement = () => {\n if (placement !== undefined) {\n return placement;\n }\n return direction === 'rtl'\n ? ('bottomRight' as SelectCommonPlacement)\n : ('bottomLeft' as SelectCommonPlacement);\n };\n\n // ==================== Render =====================\n return (\n <RcCascader\n prefixCls={prefixCls}\n className={classNames(\n !customizePrefixCls && cascaderPrefixCls,\n {\n [`${prefixCls}-lg`]: mergedSize === 'large',\n [`${prefixCls}-sm`]: mergedSize === 'small',\n [`${prefixCls}-rtl`]: isRtl,\n [`${prefixCls}-borderless`]: !bordered,\n [`${prefixCls}-in-form-item`]: isFormItemInput,\n },\n getStatusClassNames(prefixCls, mergedStatus, hasFeedback),\n compactItemClassnames,\n className,\n )}\n disabled={mergedDisabled}\n {...(restProps as any)}\n direction={mergedDirection}\n placement={getPlacement()}\n notFoundContent={mergedNotFoundContent}\n allowClear={allowClear}\n showSearch={mergedShowSearch}\n expandIcon={mergedExpandIcon}\n inputIcon={suffixIcon}\n removeIcon={removeIcon}\n clearIcon={clearIcon}\n loadingIcon={loadingIcon}\n checkable={checkable}\n dropdownClassName={mergedDropdownClassName}\n dropdownPrefixCls={customizePrefixCls || cascaderPrefixCls}\n choiceTransitionName={getTransitionName(rootPrefixCls, '', choiceTransitionName)}\n transitionName={getTransitionName(\n rootPrefixCls,\n getTransitionDirection(placement),\n transitionName,\n )}\n getPopupContainer={getPopupContainer || getContextPopupContainer}\n ref={ref}\n showArrow={hasFeedback || showArrow}\n />\n );\n}) as unknown as (<OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(\n props: React.PropsWithChildren<CascaderProps<OptionType>> & { ref?: React.Ref<CascaderRef> },\n) => React.ReactElement) & {\n displayName: string;\n SHOW_PARENT: typeof SHOW_PARENT;\n SHOW_CHILD: typeof SHOW_CHILD;\n};\nif (process.env.NODE_ENV !== 'production') {\n Cascader.displayName = 'Cascader';\n}\nCascader.SHOW_PARENT = SHOW_PARENT;\nCascader.SHOW_CHILD = SHOW_CHILD;\n\nexport default Cascader;\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const tuple = (...args) => args;
|
|
2
|
+
const ValidateStatuses = tuple('success', 'warning', 'error', 'validating', '');
|
|
3
|
+
const SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight');
|
|
4
|
+
const InputStatuses = tuple('warning', 'error', '');
|
|
5
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../src/tntd-cascader/AntdCascader/interface.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAqB,GAAG,IAAO,EAAE,EAAE,CAAC,IAAI,CAAC;AAE9D,MAAM,gBAAgB,GAAG,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;AAIhF,MAAM,gBAAgB,GAAG,KAAK,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAInF,MAAM,aAAa,GAAG,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import type { ReactElement, JSXElementConstructor } from 'react';\n\nexport type SizeType = 'small' | 'middle' | 'large' | undefined;\n\nexport type DirectionType = 'ltr' | 'rtl' | undefined;\n\nexport const tuple = <T extends string[]>(...args: T) => args;\n\nconst ValidateStatuses = tuple('success', 'warning', 'error', 'validating', '');\n\nexport type ValidateStatus = typeof ValidateStatuses[number];\n\nconst SelectPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight');\n\nexport type SelectCommonPlacement = typeof SelectPlacements[number];\n\nconst InputStatuses = tuple('warning', 'error', '');\n\nexport type InputStatus = typeof InputStatuses[number];\n\nexport interface SpaceCompactItemContextType {\n compactSize?: SizeType;\n compactDirection?: 'horizontal' | 'vertical';\n isFirstItem?: boolean;\n isLastItem?: boolean;\n}\n\nexport interface FormItemStatusContextProps {\n isFormItemInput?: boolean;\n status?: ValidateStatus;\n hasFeedback?: boolean;\n feedbackIcon?: React.ReactNode;\n}\n\nexport type DropdownRender = (\n menu: ReactElement<any, string | JSXElementConstructor<any>>,\n) => ReactElement<any, string | JSXElementConstructor<any>>;\n"]}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tntd-cascader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './AntdCascader';\n"]}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { BaseSelect } from 'rc-select';
|
|
13
|
+
import useId from 'rc-select/lib/hooks/useId';
|
|
14
|
+
import { conductCheck } from 'rc-tree/lib/utils/conductUtil';
|
|
15
|
+
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
16
|
+
import * as React from 'react';
|
|
17
|
+
import CascaderContext from './context';
|
|
18
|
+
import useDisplayValues from './hooks/useDisplayValues';
|
|
19
|
+
import useEntities from './hooks/useEntities';
|
|
20
|
+
import useMissingValues from './hooks/useMissingValues';
|
|
21
|
+
import useRefFunc from './hooks/useRefFunc';
|
|
22
|
+
import useSearchConfig from './hooks/useSearchConfig';
|
|
23
|
+
import useSearchOptions from './hooks/useSearchOptions';
|
|
24
|
+
import OptionList from './OptionList';
|
|
25
|
+
import { fillFieldNames, SHOW_CHILD, SHOW_PARENT, toPathKey, toPathKeys } from './utils/commonUtil';
|
|
26
|
+
import { formatStrategyValues, toPathOptions } from './utils/treeUtil';
|
|
27
|
+
import warningProps, { warningNullOptions } from './utils/warningPropsUtil';
|
|
28
|
+
import './context';
|
|
29
|
+
import './index.less';
|
|
30
|
+
function isMultipleValue(value) {
|
|
31
|
+
return Array.isArray(value) && Array.isArray(value[0]);
|
|
32
|
+
}
|
|
33
|
+
function toRawValues(value) {
|
|
34
|
+
if (!value) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
if (isMultipleValue(value)) {
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
return (value.length === 0 ? [] : [value]).map((val) => (Array.isArray(val) ? val : [val]));
|
|
41
|
+
}
|
|
42
|
+
const Cascader = React.forwardRef((props, ref) => {
|
|
43
|
+
const {
|
|
44
|
+
// MISC
|
|
45
|
+
id, prefixCls = 'rc-cascader', fieldNames,
|
|
46
|
+
// Value
|
|
47
|
+
defaultValue, value, changeOnSelect, onChange, displayRender, checkable,
|
|
48
|
+
// Search
|
|
49
|
+
searchValue, onSearch, showSearch,
|
|
50
|
+
// Trigger
|
|
51
|
+
expandTrigger,
|
|
52
|
+
// Options
|
|
53
|
+
options, dropdownPrefixCls, loadData,
|
|
54
|
+
// Open
|
|
55
|
+
popupVisible, open, popupClassName, dropdownClassName, dropdownMenuColumnStyle, popupPlacement, placement, onDropdownVisibleChange, onPopupVisibleChange, renderItem,
|
|
56
|
+
// Icon
|
|
57
|
+
expandIcon = '>', loadingIcon,
|
|
58
|
+
// Children
|
|
59
|
+
children, dropdownMatchSelectWidth = false, showCheckedStrategy = SHOW_PARENT } = props, 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"]);
|
|
60
|
+
const mergedId = useId(id);
|
|
61
|
+
const multiple = !!checkable;
|
|
62
|
+
const [dropdownVisible, setDropdownVisible] = React.useState(false);
|
|
63
|
+
// =========================== Values ===========================
|
|
64
|
+
const [rawValues, setRawValues] = useMergedState(defaultValue, {
|
|
65
|
+
value,
|
|
66
|
+
postState: toRawValues,
|
|
67
|
+
});
|
|
68
|
+
// ========================= FieldNames =========================
|
|
69
|
+
const mergedFieldNames = React.useMemo(() => fillFieldNames(fieldNames),
|
|
70
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
71
|
+
[JSON.stringify(fieldNames)]);
|
|
72
|
+
// =========================== Option ===========================
|
|
73
|
+
const mergedOptions = React.useMemo(() => options || [], [options]);
|
|
74
|
+
// Only used in multiple mode, this fn will not call in single mode
|
|
75
|
+
const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);
|
|
76
|
+
/** Convert path key back to value format */
|
|
77
|
+
const getValueByKeyPath = React.useCallback((pathKeys) => {
|
|
78
|
+
const keyPathEntities = getPathKeyEntities();
|
|
79
|
+
return pathKeys.map((pathKey) => {
|
|
80
|
+
const { nodes } = keyPathEntities[pathKey];
|
|
81
|
+
return nodes.map((node) => node[mergedFieldNames.value]);
|
|
82
|
+
});
|
|
83
|
+
}, [getPathKeyEntities, mergedFieldNames]);
|
|
84
|
+
// =========================== Search ===========================
|
|
85
|
+
const [mergedSearchValue, setSearchValue] = useMergedState('', {
|
|
86
|
+
value: searchValue,
|
|
87
|
+
postState: (search) => search || '',
|
|
88
|
+
});
|
|
89
|
+
const onInternalSearch = (searchText, info) => {
|
|
90
|
+
setSearchValue(searchText);
|
|
91
|
+
if (info.source !== 'blur' && onSearch) {
|
|
92
|
+
onSearch(searchText);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch);
|
|
96
|
+
const searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, changeOnSelect);
|
|
97
|
+
// =========================== Values ===========================
|
|
98
|
+
const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
99
|
+
// Fill `rawValues` with checked conduction values
|
|
100
|
+
const [checkedValues, halfCheckedValues, missingCheckedValues] = React.useMemo(() => {
|
|
101
|
+
const [existValues, missingValues] = getMissingValues(rawValues);
|
|
102
|
+
if (!multiple || !rawValues.length) {
|
|
103
|
+
return [existValues, [], missingValues];
|
|
104
|
+
}
|
|
105
|
+
const keyPathValues = toPathKeys(existValues);
|
|
106
|
+
const keyPathEntities = getPathKeyEntities();
|
|
107
|
+
const { checkedKeys, halfCheckedKeys } = conductCheck(keyPathValues, true, keyPathEntities);
|
|
108
|
+
// Convert key back to value cells
|
|
109
|
+
return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];
|
|
110
|
+
}, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);
|
|
111
|
+
const deDuplicatedValues = React.useMemo(() => {
|
|
112
|
+
const checkedKeys = toPathKeys(checkedValues);
|
|
113
|
+
const deduplicateKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
114
|
+
return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];
|
|
115
|
+
}, [
|
|
116
|
+
checkedValues,
|
|
117
|
+
getPathKeyEntities,
|
|
118
|
+
getValueByKeyPath,
|
|
119
|
+
missingCheckedValues,
|
|
120
|
+
showCheckedStrategy,
|
|
121
|
+
]);
|
|
122
|
+
const displayValues = useDisplayValues(deDuplicatedValues, mergedOptions, mergedFieldNames, multiple, displayRender);
|
|
123
|
+
// =========================== Change ===========================
|
|
124
|
+
const triggerChange = useRefFunc((nextValues) => {
|
|
125
|
+
setRawValues(nextValues);
|
|
126
|
+
// Save perf if no need trigger event
|
|
127
|
+
if (onChange) {
|
|
128
|
+
const nextRawValues = toRawValues(nextValues);
|
|
129
|
+
const valueOptions = nextRawValues.map((valueCells) => toPathOptions(valueCells, mergedOptions, mergedFieldNames).map((valueOpt) => valueOpt.option));
|
|
130
|
+
const triggerValues = multiple ? nextRawValues : nextRawValues[0];
|
|
131
|
+
const triggerOptions = multiple ? valueOptions : valueOptions[0];
|
|
132
|
+
onChange(triggerValues, triggerOptions);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// =========================== Select ===========================
|
|
136
|
+
const onInternalSelect = useRefFunc((valuePath) => {
|
|
137
|
+
setSearchValue('');
|
|
138
|
+
if (!multiple) {
|
|
139
|
+
triggerChange(valuePath);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Prepare conduct required info
|
|
143
|
+
const pathKey = toPathKey(valuePath);
|
|
144
|
+
const checkedPathKeys = toPathKeys(checkedValues);
|
|
145
|
+
const halfCheckedPathKeys = toPathKeys(halfCheckedValues);
|
|
146
|
+
const existInChecked = checkedPathKeys.includes(pathKey);
|
|
147
|
+
const existInMissing = missingCheckedValues.some((valueCells) => toPathKey(valueCells) === pathKey);
|
|
148
|
+
// Do update
|
|
149
|
+
let nextCheckedValues = checkedValues;
|
|
150
|
+
let nextMissingValues = missingCheckedValues;
|
|
151
|
+
if (existInMissing && !existInChecked) {
|
|
152
|
+
// Missing value only do filter
|
|
153
|
+
nextMissingValues = missingCheckedValues.filter((valueCells) => toPathKey(valueCells) !== pathKey);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
// Update checked key first
|
|
157
|
+
const nextRawCheckedKeys = existInChecked
|
|
158
|
+
? checkedPathKeys.filter((key) => key !== pathKey)
|
|
159
|
+
: [...checkedPathKeys, pathKey];
|
|
160
|
+
const pathKeyEntities = getPathKeyEntities();
|
|
161
|
+
// Conduction by selected or not
|
|
162
|
+
let checkedKeys;
|
|
163
|
+
if (existInChecked) {
|
|
164
|
+
({ checkedKeys } = conductCheck(nextRawCheckedKeys, { checked: false, halfCheckedKeys: halfCheckedPathKeys }, pathKeyEntities));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
({ checkedKeys } = conductCheck(nextRawCheckedKeys, true, pathKeyEntities));
|
|
168
|
+
}
|
|
169
|
+
// Roll up to parent level keys
|
|
170
|
+
const deDuplicatedKeys = formatStrategyValues(checkedKeys, getPathKeyEntities, showCheckedStrategy);
|
|
171
|
+
nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);
|
|
172
|
+
}
|
|
173
|
+
triggerChange([...nextMissingValues, ...nextCheckedValues]);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
// Display Value change logic
|
|
177
|
+
const onDisplayValuesChange = (_, info) => {
|
|
178
|
+
if (info.type === 'clear') {
|
|
179
|
+
triggerChange([]);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
// Cascader do not support `add` type. Only support `remove`
|
|
183
|
+
const { valueCells } = info.values[0];
|
|
184
|
+
onInternalSelect(valueCells);
|
|
185
|
+
};
|
|
186
|
+
// ============================ Open ============================
|
|
187
|
+
const mergedOpen = open !== undefined ? open : popupVisible;
|
|
188
|
+
const mergedDropdownClassName = dropdownClassName || popupClassName;
|
|
189
|
+
const mergedPlacement = placement || popupPlacement;
|
|
190
|
+
const onInternalDropdownVisibleChange = (nextVisible) => {
|
|
191
|
+
onDropdownVisibleChange === null || onDropdownVisibleChange === void 0 ? void 0 : onDropdownVisibleChange(nextVisible);
|
|
192
|
+
onPopupVisibleChange === null || onPopupVisibleChange === void 0 ? void 0 : onPopupVisibleChange(nextVisible);
|
|
193
|
+
setDropdownVisible(nextVisible);
|
|
194
|
+
};
|
|
195
|
+
// ========================== Warning ===========================
|
|
196
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
197
|
+
warningProps(props);
|
|
198
|
+
warningNullOptions(mergedOptions, mergedFieldNames);
|
|
199
|
+
}
|
|
200
|
+
// ========================== Context ===========================
|
|
201
|
+
const cascaderContext = React.useMemo(() => ({
|
|
202
|
+
options: mergedOptions,
|
|
203
|
+
fieldNames: mergedFieldNames,
|
|
204
|
+
values: checkedValues,
|
|
205
|
+
halfValues: halfCheckedValues,
|
|
206
|
+
changeOnSelect,
|
|
207
|
+
onSelect: onInternalSelect,
|
|
208
|
+
checkable,
|
|
209
|
+
searchOptions,
|
|
210
|
+
dropdownPrefixCls,
|
|
211
|
+
loadData,
|
|
212
|
+
expandTrigger,
|
|
213
|
+
expandIcon,
|
|
214
|
+
loadingIcon,
|
|
215
|
+
dropdownMenuColumnStyle,
|
|
216
|
+
renderItem,
|
|
217
|
+
dropdownVisible,
|
|
218
|
+
}), [
|
|
219
|
+
mergedOptions,
|
|
220
|
+
mergedFieldNames,
|
|
221
|
+
checkedValues,
|
|
222
|
+
halfCheckedValues,
|
|
223
|
+
changeOnSelect,
|
|
224
|
+
onInternalSelect,
|
|
225
|
+
checkable,
|
|
226
|
+
searchOptions,
|
|
227
|
+
dropdownPrefixCls,
|
|
228
|
+
loadData,
|
|
229
|
+
expandTrigger,
|
|
230
|
+
expandIcon,
|
|
231
|
+
loadingIcon,
|
|
232
|
+
dropdownMenuColumnStyle,
|
|
233
|
+
renderItem,
|
|
234
|
+
dropdownVisible,
|
|
235
|
+
]);
|
|
236
|
+
// ==============================================================
|
|
237
|
+
// == Render ==
|
|
238
|
+
// ==============================================================
|
|
239
|
+
const emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;
|
|
240
|
+
const dropdownStyle =
|
|
241
|
+
// Search to match width
|
|
242
|
+
(mergedSearchValue && searchConfig.matchInputWidth) ||
|
|
243
|
+
// Empty keep the width
|
|
244
|
+
emptyOptions
|
|
245
|
+
? {}
|
|
246
|
+
: {
|
|
247
|
+
minWidth: 'auto',
|
|
248
|
+
};
|
|
249
|
+
return (React.createElement(CascaderContext.Provider, { value: cascaderContext },
|
|
250
|
+
React.createElement(BaseSelect, Object.assign({}, restProps, {
|
|
251
|
+
// MISC
|
|
252
|
+
ref: ref, id: mergedId, prefixCls: prefixCls, dropdownMatchSelectWidth: dropdownMatchSelectWidth, dropdownStyle: dropdownStyle,
|
|
253
|
+
// Value
|
|
254
|
+
displayValues: displayValues, onDisplayValuesChange: onDisplayValuesChange, mode: multiple ? 'multiple' : undefined,
|
|
255
|
+
// Search
|
|
256
|
+
searchValue: mergedSearchValue, onSearch: onInternalSearch, showSearch: mergedShowSearch,
|
|
257
|
+
// Options
|
|
258
|
+
OptionList: OptionList, emptyOptions: emptyOptions,
|
|
259
|
+
// Open
|
|
260
|
+
open: mergedOpen, dropdownClassName: mergedDropdownClassName, placement: mergedPlacement, onDropdownVisibleChange: onInternalDropdownVisibleChange,
|
|
261
|
+
// Children
|
|
262
|
+
getRawInputElement: () => children }))));
|
|
263
|
+
});
|
|
264
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
265
|
+
Cascader.displayName = 'Cascader';
|
|
266
|
+
}
|
|
267
|
+
Cascader.SHOW_PARENT = SHOW_PARENT;
|
|
268
|
+
Cascader.SHOW_CHILD = SHOW_CHILD;
|
|
269
|
+
export default Cascader;
|
|
270
|
+
//# sourceMappingURL=Cascader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cascader.js","sourceRoot":"","sources":["../../../src/tntd-cascader/rc-cascader/Cascader.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,MAAM,2BAA2B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,eA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U,EAAE,gBAAgB;YAC5B,UAAU;YACV,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY;YAC1B,OAAO;YACP,IAAI,EAAE,UAAU,EAChB,iBAAiB,EAAE,uBAAuB,EAC1C,SAAS,EAAE,eAAe,EAC1B,uBAAuB,EAAE,+BAA+B;YACxD,WAAW;YACX,kBAAkB,EAAE,GAAG,EAAE,CAAC,QAAQ,IAClC,CACuB,CAC5B,CAAC;AACJ,CAAC,CAQA,CAAC;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;CACnC;AAED,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;AACnC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;AACjC,eAAe,QAAQ,CAAC","sourcesContent":["// @ts-nocheck\nimport type { BaseSelectProps, BaseSelectPropsWithoutPrivate, BaseSelectRef } from 'rc-select';\nimport { BaseSelect } from 'rc-select';\nimport type { DisplayValueType, Placement } from 'rc-select/lib/BaseSelect';\nimport useId from 'rc-select/lib/hooks/useId';\nimport { conductCheck } from 'rc-tree/lib/utils/conductUtil';\nimport useMergedState from 'rc-util/lib/hooks/useMergedState';\nimport * as React from 'react';\nimport CascaderContext from './context';\nimport useDisplayValues from './hooks/useDisplayValues';\nimport useEntities from './hooks/useEntities';\nimport useMissingValues from './hooks/useMissingValues';\nimport useRefFunc from './hooks/useRefFunc';\nimport useSearchConfig from './hooks/useSearchConfig';\nimport useSearchOptions from './hooks/useSearchOptions';\nimport OptionList from './OptionList';\nimport { fillFieldNames, SHOW_CHILD, SHOW_PARENT, toPathKey, toPathKeys } from './utils/commonUtil';\nimport { formatStrategyValues, toPathOptions } from './utils/treeUtil';\nimport warningProps, { warningNullOptions } from './utils/warningPropsUtil';\nimport { RenderItem } from './context';\nimport './index.less';\n\nexport interface ShowSearchType<OptionType extends BaseOptionType = DefaultOptionType> {\n filter?: (inputValue: string, options: OptionType[], fieldNames: FieldNames) => boolean;\n render?: (\n inputValue: string,\n path: OptionType[],\n prefixCls: string,\n fieldNames: FieldNames,\n ) => React.ReactNode;\n sort?: (a: OptionType[], b: OptionType[], inputValue: string, fieldNames: FieldNames) => number;\n matchInputWidth?: boolean;\n limit?: number | false;\n}\n\nexport interface FieldNames {\n label?: string;\n value?: string;\n children?: string;\n}\n\nexport interface InternalFieldNames extends Required<FieldNames> {\n key: string;\n}\n\nexport type SingleValueType = (string | number)[];\n\nexport type ValueType = SingleValueType | SingleValueType[];\nexport type ShowCheckedStrategy = typeof SHOW_PARENT | typeof SHOW_CHILD;\n\nexport interface BaseOptionType {\n disabled?: boolean;\n [name: string]: any;\n}\nexport interface DefaultOptionType extends BaseOptionType {\n label: React.ReactNode;\n value?: string | number | null;\n children?: DefaultOptionType[];\n}\n\ninterface BaseCascaderProps<OptionType extends BaseOptionType = DefaultOptionType>\n extends Omit<\n BaseSelectPropsWithoutPrivate,\n 'tokenSeparators' | 'labelInValue' | 'mode' | 'showSearch'\n > {\n // MISC\n id?: string;\n prefixCls?: string;\n fieldNames?: FieldNames;\n children?: React.ReactElement;\n\n // Value\n value?: ValueType;\n defaultValue?: ValueType;\n changeOnSelect?: boolean;\n displayRender?: (label: string[], selectedOptions?: OptionType[]) => React.ReactNode;\n checkable?: boolean | React.ReactNode;\n showCheckedStrategy?: ShowCheckedStrategy;\n\n // Search\n showSearch?: boolean | ShowSearchType<OptionType>;\n searchValue?: string;\n onSearch?: (value: string) => void;\n\n // Trigger\n expandTrigger?: 'hover' | 'click';\n\n // Options\n options?: OptionType[];\n /** @private Internal usage. Do not use in your production. */\n dropdownPrefixCls?: string;\n loadData?: (selectOptions: OptionType[]) => void;\n\n // Open\n /** @deprecated Use `open` instead */\n popupVisible?: boolean;\n\n /** @deprecated Use `dropdownClassName` instead */\n popupClassName?: string;\n dropdownClassName?: string;\n dropdownMenuColumnStyle?: React.CSSProperties;\n\n /** @deprecated Use `placement` instead */\n popupPlacement?: Placement;\n placement?: Placement;\n\n /** @deprecated Use `onDropdownVisibleChange` instead */\n onPopupVisibleChange?: (open: boolean) => void;\n onDropdownVisibleChange?: (open: boolean) => void;\n renderItem?: (item: RenderItem) => React.ReactNode;\n\n // Icon\n expandIcon?: React.ReactNode;\n loadingIcon?: React.ReactNode;\n}\n\ntype OnSingleChange<OptionType> = (value: SingleValueType, selectOptions: OptionType[]) => void;\ntype OnMultipleChange<OptionType> = (\n value: SingleValueType[],\n selectOptions: OptionType[][],\n) => void;\n\nexport interface SingleCascaderProps<OptionType extends BaseOptionType = DefaultOptionType>\n extends BaseCascaderProps<OptionType> {\n checkable?: false;\n\n onChange?: OnSingleChange<OptionType>;\n}\n\nexport interface MultipleCascaderProps<OptionType extends BaseOptionType = DefaultOptionType>\n extends BaseCascaderProps<OptionType> {\n checkable: true | React.ReactNode;\n\n onChange?: OnMultipleChange<OptionType>;\n}\n\nexport type CascaderProps<OptionType extends BaseOptionType = DefaultOptionType> =\n | SingleCascaderProps<OptionType>\n | MultipleCascaderProps<OptionType>;\n\nexport type InternalCascaderProps<OptionType extends BaseOptionType = DefaultOptionType> = Omit<\n SingleCascaderProps<OptionType> | MultipleCascaderProps<OptionType>,\n 'onChange'\n> & {\n onChange?: (\n value: SingleValueType | SingleValueType[],\n selectOptions: OptionType[] | OptionType[][],\n ) => void;\n};\n\nexport type CascaderRef = Omit<BaseSelectRef, 'scrollTo'>;\n\nfunction isMultipleValue(value: ValueType): value is SingleValueType[] {\n return Array.isArray(value) && Array.isArray(value[0]);\n}\n\nfunction toRawValues(value: ValueType): SingleValueType[] {\n if (!value) {\n return [];\n }\n\n if (isMultipleValue(value)) {\n return value;\n }\n\n return (value.length === 0 ? [] : [value]).map((val) => (Array.isArray(val) ? val : [val]));\n}\n\nconst Cascader = React.forwardRef<CascaderRef, InternalCascaderProps>((props, ref) => {\n const {\n // MISC\n id,\n prefixCls = 'rc-cascader',\n fieldNames,\n\n // Value\n defaultValue,\n value,\n changeOnSelect,\n onChange,\n displayRender,\n checkable,\n\n // Search\n searchValue,\n onSearch,\n showSearch,\n\n // Trigger\n expandTrigger,\n\n // Options\n options,\n dropdownPrefixCls,\n loadData,\n\n // Open\n popupVisible,\n open,\n\n popupClassName,\n dropdownClassName,\n dropdownMenuColumnStyle,\n\n popupPlacement,\n placement,\n\n onDropdownVisibleChange,\n onPopupVisibleChange,\n renderItem,\n\n // Icon\n expandIcon = '>',\n loadingIcon,\n\n // Children\n children,\n dropdownMatchSelectWidth = false,\n showCheckedStrategy = SHOW_PARENT,\n ...restProps\n } = props;\n\n const mergedId = useId(id);\n const multiple = !!checkable;\n const [dropdownVisible, setDropdownVisible] = React.useState(false);\n\n // =========================== Values ===========================\n const [rawValues, setRawValues] = useMergedState<ValueType, SingleValueType[]>(defaultValue, {\n value,\n postState: toRawValues,\n });\n\n // ========================= FieldNames =========================\n const mergedFieldNames = React.useMemo(\n () => fillFieldNames(fieldNames),\n /* eslint-disable react-hooks/exhaustive-deps */\n [JSON.stringify(fieldNames)],\n /* eslint-enable react-hooks/exhaustive-deps */\n );\n\n // =========================== Option ===========================\n const mergedOptions = React.useMemo(() => options || [], [options]);\n\n // Only used in multiple mode, this fn will not call in single mode\n const getPathKeyEntities = useEntities(mergedOptions, mergedFieldNames);\n\n /** Convert path key back to value format */\n const getValueByKeyPath = React.useCallback(\n (pathKeys: React.Key[]): SingleValueType[] => {\n const keyPathEntities = getPathKeyEntities();\n\n return pathKeys.map((pathKey) => {\n const { nodes } = keyPathEntities[pathKey];\n\n return nodes.map((node) => node[mergedFieldNames.value]);\n });\n },\n [getPathKeyEntities, mergedFieldNames],\n );\n\n // =========================== Search ===========================\n const [mergedSearchValue, setSearchValue] = useMergedState('', {\n value: searchValue,\n postState: (search) => search || '',\n });\n\n const onInternalSearch: BaseSelectProps['onSearch'] = (searchText, info) => {\n setSearchValue(searchText);\n\n if (info.source !== 'blur' && onSearch) {\n onSearch(searchText);\n }\n };\n\n const [mergedShowSearch, searchConfig] = useSearchConfig(showSearch);\n\n const searchOptions = useSearchOptions(\n mergedSearchValue,\n mergedOptions,\n mergedFieldNames,\n dropdownPrefixCls || prefixCls,\n searchConfig,\n changeOnSelect,\n );\n\n // =========================== Values ===========================\n const getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);\n\n // Fill `rawValues` with checked conduction values\n const [checkedValues, halfCheckedValues, missingCheckedValues] = React.useMemo(() => {\n const [existValues, missingValues] = getMissingValues(rawValues);\n\n if (!multiple || !rawValues.length) {\n return [existValues, [], missingValues];\n }\n\n const keyPathValues = toPathKeys(existValues);\n const keyPathEntities = getPathKeyEntities();\n\n const { checkedKeys, halfCheckedKeys } = conductCheck(keyPathValues, true, keyPathEntities);\n\n // Convert key back to value cells\n return [getValueByKeyPath(checkedKeys), getValueByKeyPath(halfCheckedKeys), missingValues];\n }, [multiple, rawValues, getPathKeyEntities, getValueByKeyPath, getMissingValues]);\n\n const deDuplicatedValues = React.useMemo(() => {\n const checkedKeys = toPathKeys(checkedValues);\n const deduplicateKeys = formatStrategyValues(\n checkedKeys,\n getPathKeyEntities,\n showCheckedStrategy,\n );\n\n return [...missingCheckedValues, ...getValueByKeyPath(deduplicateKeys)];\n }, [\n checkedValues,\n getPathKeyEntities,\n getValueByKeyPath,\n missingCheckedValues,\n showCheckedStrategy,\n ]);\n\n const displayValues = useDisplayValues(\n deDuplicatedValues,\n mergedOptions,\n mergedFieldNames,\n multiple,\n displayRender,\n );\n\n // =========================== Change ===========================\n const triggerChange = useRefFunc((nextValues: ValueType) => {\n setRawValues(nextValues);\n\n // Save perf if no need trigger event\n if (onChange) {\n const nextRawValues = toRawValues(nextValues);\n\n const valueOptions = nextRawValues.map((valueCells) =>\n toPathOptions(valueCells, mergedOptions, mergedFieldNames).map(\n (valueOpt) => valueOpt.option,\n ),\n );\n\n const triggerValues = multiple ? nextRawValues : nextRawValues[0];\n const triggerOptions = multiple ? valueOptions : valueOptions[0];\n\n onChange(triggerValues, triggerOptions);\n }\n });\n\n // =========================== Select ===========================\n const onInternalSelect = useRefFunc((valuePath: SingleValueType) => {\n setSearchValue('');\n if (!multiple) {\n triggerChange(valuePath);\n } else {\n // Prepare conduct required info\n const pathKey = toPathKey(valuePath);\n const checkedPathKeys = toPathKeys(checkedValues);\n const halfCheckedPathKeys = toPathKeys(halfCheckedValues);\n\n const existInChecked = checkedPathKeys.includes(pathKey);\n const existInMissing = missingCheckedValues.some(\n (valueCells) => toPathKey(valueCells) === pathKey,\n );\n\n // Do update\n let nextCheckedValues = checkedValues;\n let nextMissingValues = missingCheckedValues;\n\n if (existInMissing && !existInChecked) {\n // Missing value only do filter\n nextMissingValues = missingCheckedValues.filter(\n (valueCells) => toPathKey(valueCells) !== pathKey,\n );\n } else {\n // Update checked key first\n const nextRawCheckedKeys = existInChecked\n ? checkedPathKeys.filter((key) => key !== pathKey)\n : [...checkedPathKeys, pathKey];\n\n const pathKeyEntities = getPathKeyEntities();\n\n // Conduction by selected or not\n let checkedKeys: React.Key[];\n if (existInChecked) {\n ({ checkedKeys } = conductCheck(\n nextRawCheckedKeys,\n { checked: false, halfCheckedKeys: halfCheckedPathKeys },\n pathKeyEntities,\n ));\n } else {\n ({ checkedKeys } = conductCheck(nextRawCheckedKeys, true, pathKeyEntities));\n }\n\n // Roll up to parent level keys\n const deDuplicatedKeys = formatStrategyValues(\n checkedKeys,\n getPathKeyEntities,\n showCheckedStrategy,\n );\n nextCheckedValues = getValueByKeyPath(deDuplicatedKeys);\n }\n\n triggerChange([...nextMissingValues, ...nextCheckedValues]);\n }\n });\n\n // Display Value change logic\n const onDisplayValuesChange: BaseSelectProps['onDisplayValuesChange'] = (_, info) => {\n if (info.type === 'clear') {\n triggerChange([]);\n return;\n }\n\n // Cascader do not support `add` type. Only support `remove`\n const { valueCells } = info.values[0] as DisplayValueType & { valueCells: SingleValueType };\n onInternalSelect(valueCells);\n };\n\n // ============================ Open ============================\n const mergedOpen = open !== undefined ? open : popupVisible;\n\n const mergedDropdownClassName = dropdownClassName || popupClassName;\n\n const mergedPlacement = placement || popupPlacement;\n\n const onInternalDropdownVisibleChange = (nextVisible: boolean) => {\n onDropdownVisibleChange?.(nextVisible);\n onPopupVisibleChange?.(nextVisible);\n setDropdownVisible(nextVisible);\n };\n\n // ========================== Warning ===========================\n if (process.env.NODE_ENV !== 'production') {\n warningProps(props);\n warningNullOptions(mergedOptions, mergedFieldNames);\n }\n\n // ========================== Context ===========================\n const cascaderContext = React.useMemo(\n () => ({\n options: mergedOptions,\n fieldNames: mergedFieldNames,\n values: checkedValues,\n halfValues: halfCheckedValues,\n changeOnSelect,\n onSelect: onInternalSelect,\n checkable,\n searchOptions,\n dropdownPrefixCls,\n loadData,\n expandTrigger,\n expandIcon,\n loadingIcon,\n dropdownMenuColumnStyle,\n renderItem,\n dropdownVisible,\n }),\n [\n mergedOptions,\n mergedFieldNames,\n checkedValues,\n halfCheckedValues,\n changeOnSelect,\n onInternalSelect,\n checkable,\n searchOptions,\n dropdownPrefixCls,\n loadData,\n expandTrigger,\n expandIcon,\n loadingIcon,\n dropdownMenuColumnStyle,\n renderItem,\n dropdownVisible,\n ],\n );\n\n // ==============================================================\n // == Render ==\n // ==============================================================\n const emptyOptions = !(mergedSearchValue ? searchOptions : mergedOptions).length;\n\n const dropdownStyle: React.CSSProperties =\n // Search to match width\n (mergedSearchValue && searchConfig.matchInputWidth) ||\n // Empty keep the width\n emptyOptions\n ? {}\n : {\n minWidth: 'auto',\n };\n return (\n <CascaderContext.Provider value={cascaderContext}>\n <BaseSelect\n {...restProps}\n // MISC\n ref={ref as any}\n id={mergedId}\n prefixCls={prefixCls}\n dropdownMatchSelectWidth={dropdownMatchSelectWidth}\n dropdownStyle={dropdownStyle}\n // Value\n displayValues={displayValues}\n onDisplayValuesChange={onDisplayValuesChange}\n mode={multiple ? 'multiple' : undefined}\n // Search\n searchValue={mergedSearchValue}\n onSearch={onInternalSearch}\n showSearch={mergedShowSearch}\n // Options\n OptionList={OptionList}\n emptyOptions={emptyOptions}\n // Open\n open={mergedOpen}\n dropdownClassName={mergedDropdownClassName}\n placement={mergedPlacement}\n onDropdownVisibleChange={onInternalDropdownVisibleChange}\n // Children\n getRawInputElement={() => children}\n />\n </CascaderContext.Provider>\n );\n}) as unknown as (<OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(\n props: React.PropsWithChildren<CascaderProps<OptionType>> & {\n ref?: React.Ref<BaseSelectRef>;\n },\n) => React.ReactElement) & {\n displayName?: string;\n SHOW_PARENT: typeof SHOW_PARENT;\n SHOW_CHILD: typeof SHOW_CHILD;\n};\n\nif (process.env.NODE_ENV !== 'production') {\n Cascader.displayName = 'Cascader';\n}\n\nCascader.SHOW_PARENT = SHOW_PARENT;\nCascader.SHOW_CHILD = SHOW_CHILD;\nexport default Cascader;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import CascaderContext from '../context';
|
|
4
|
+
export default function Checkbox({ prefixCls, checked, halfChecked, disabled, onClick, }) {
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
const { checkable } = React.useContext(CascaderContext);
|
|
7
|
+
const customCheckbox = typeof checkable !== 'boolean' ? checkable : null;
|
|
8
|
+
return (React.createElement("span", { className: classNames(`${prefixCls}`, {
|
|
9
|
+
[`${prefixCls}-checked`]: checked,
|
|
10
|
+
[`${prefixCls}-indeterminate`]: !checked && halfChecked,
|
|
11
|
+
[`${prefixCls}-disabled`]: disabled,
|
|
12
|
+
}), onClick: onClick }, customCheckbox));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../../src/tntd-cascader/rc-cascader/OptionList/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,eAAe,MAAM,YAAY,CAAC;AAUzC,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,SAAS,EACT,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,GACO;IACd,aAAa;IACb,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAExD,MAAM,cAAc,GAAG,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;IAEzE,OAAO,CACL,8BACE,SAAS,EAAE,UAAU,CAAC,GAAG,SAAS,EAAE,EAAE;YACpC,CAAC,GAAG,SAAS,UAAU,CAAC,EAAE,OAAO;YACjC,CAAC,GAAG,SAAS,gBAAgB,CAAC,EAAE,CAAC,OAAO,IAAI,WAAW;YACvD,CAAC,GAAG,SAAS,WAAW,CAAC,EAAE,QAAQ;SACpC,CAAC,EACF,OAAO,EAAE,OAAO,IAEf,cAAc,CACV,CACR,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport classNames from 'classnames';\nimport CascaderContext from '../context';\n\nexport interface CheckboxProps {\n prefixCls: string;\n checked?: boolean;\n halfChecked?: boolean;\n disabled?: boolean;\n onClick?: React.MouseEventHandler;\n}\n\nexport default function Checkbox({\n prefixCls,\n checked,\n halfChecked,\n disabled,\n onClick,\n}: CheckboxProps) {\n // @ts-ignore\n const { checkable } = React.useContext(CascaderContext);\n\n const customCheckbox = typeof checkable !== 'boolean' ? checkable : null;\n\n return (\n <span\n className={classNames(`${prefixCls}`, {\n [`${prefixCls}-checked`]: checked,\n [`${prefixCls}-indeterminate`]: !checked && halfChecked,\n [`${prefixCls}-disabled`]: disabled,\n })}\n onClick={onClick}\n >\n {customCheckbox}\n </span>\n );\n}\n"]}
|