@zat-design/sisyphus-react 4.0.0-beta.8 → 4.0.0
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/babel.config.js.backup +13 -0
- package/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProAction/index.js +14 -4
- package/es/ProConfigProvider/index.js +11 -2
- package/es/ProDownload/index.js +16 -5
- package/es/ProDownload/utils.js +8 -3
- package/es/ProDrawerForm/components/ProDrawer/index.js +14 -4
- package/es/ProDrawerForm/components/ProModal/index.js +14 -4
- package/es/ProDrawerForm/index.js +13 -3
- package/es/ProEditLabel/components/RenderProForm.js +5 -1
- package/es/ProEditLabel/index.js +16 -5
- package/es/ProEditTable/components/ActionButton/index.js +5 -1
- package/es/ProEditTable/components/RcTable/BaseTable.js +13 -3
- package/es/ProEditTable/components/RcTable/DraggableTable.js +12 -5
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -2
- package/es/ProEditTable/components/RenderField/index.js +54 -29
- package/es/ProEditTable/components/RenderToolbar/index.js +10 -4
- package/es/ProEditTable/index.js +16 -5
- package/es/ProEditTable/propsType.d.ts +12 -6
- package/es/ProEditTable/style/index.less +30 -3
- package/es/ProEditTable/utils/config.js +8 -3
- package/es/ProEditTable/utils/index.js +13 -9
- package/es/ProEditTable/utils/tools.js +22 -10
- package/es/ProEditTable/utils/useEditTableError.js +6 -1
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +16 -7
- package/es/ProEnum/components/Group.js +6 -1
- package/es/ProEnum/components/Tag.js +6 -1
- package/es/ProEnum/hooks/useEnum.d.ts +8 -0
- package/es/ProEnum/hooks/useEnum.js +76 -4
- package/es/ProEnum/hooks/useEnumRequest.js +8 -3
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +8 -3
- package/es/ProEnum/index.js +25 -15
- package/es/ProEnum/utils/eventCenter.js +3 -1
- package/es/ProEnum/utils/frequentEnum.js +5 -1
- package/es/ProEnum/utils/index.js +2 -1
- package/es/ProForm/components/FormFooter/index.js +5 -1
- package/es/ProForm/components/base/Checkbox/index.js +7 -2
- package/es/ProForm/components/base/DatePicker/index.js +7 -2
- package/es/ProForm/components/base/DatePicker/useDateLimit.js +6 -1
- package/es/ProForm/components/base/Input/index.js +7 -2
- package/es/ProForm/components/base/InputNumber/index.js +13 -3
- package/es/ProForm/components/base/Radio/index.js +7 -2
- package/es/ProForm/components/base/RangePicker/index.d.ts +7 -1
- package/es/ProForm/components/base/RangePicker/index.js +50 -4
- package/es/ProForm/components/base/RangePicker/useDateRange.js +6 -1
- package/es/ProForm/components/base/Select/index.js +7 -2
- package/es/ProForm/components/base/Switch/index.js +7 -2
- package/es/ProForm/components/base/SwitchCheckbox/index.js +7 -2
- package/es/ProForm/components/base/TextArea/index.js +7 -2
- package/es/ProForm/components/base/TimePicker/index.js +7 -2
- package/es/ProForm/components/combination/Container/index.js +5 -1
- package/es/ProForm/components/combination/Container/style/index.less +5 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +94 -7
- package/es/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +63 -6
- package/es/ProForm/components/combination/FormList/components/Empty.js +14 -4
- package/es/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
- package/es/ProForm/components/combination/FormList/components/LineFields.js +9 -3
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +48 -13
- package/es/ProForm/components/combination/FormList/index.js +108 -61
- package/es/ProForm/components/combination/FormList/propsType.d.ts +7 -2
- package/es/ProForm/components/combination/FormList/style/index.less +41 -0
- package/es/ProForm/components/combination/FormList/utils.d.ts +6 -0
- package/es/ProForm/components/combination/FormList/utils.js +17 -0
- package/es/ProForm/components/combination/Group/component/ComRender.d.ts +3 -0
- package/es/ProForm/components/combination/Group/component/ComRender.js +70 -3
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +10 -0
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +351 -0
- package/es/ProForm/components/combination/Group/hooks/index.d.ts +16 -1
- package/es/ProForm/components/combination/Group/hooks/index.js +107 -4
- package/es/ProForm/components/combination/Group/index.d.ts +3 -4
- package/es/ProForm/components/combination/Group/index.js +108 -24
- package/es/ProForm/components/combination/Group/propsType.d.ts +44 -1
- package/es/ProForm/components/combination/Group/style/index.less +425 -3
- package/es/ProForm/components/combination/Group/utils/index.d.ts +154 -0
- package/es/ProForm/components/combination/Group/utils/index.js +428 -0
- package/es/ProForm/components/combination/ProCascader/index.js +13 -3
- package/es/ProForm/components/combination/ProCascader/utils/index.js +7 -2
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +14 -4
- package/es/ProForm/components/combination/ProModalSelect/index.js +16 -5
- package/es/ProForm/components/combination/ProNumberRange/index.js +24 -12
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +4 -0
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +14 -7
- package/es/ProForm/components/combination/ProRangeLimit/index.js +13 -3
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +6 -1
- package/es/ProForm/components/combination/ProTimeLimit/index.js +13 -3
- package/es/ProForm/components/render/ChangedWrapper.js +7 -2
- package/es/ProForm/components/render/ConfirmWrapper.js +10 -4
- package/es/ProForm/components/render/CustomComponentViewWrapper.d.ts +30 -0
- package/es/ProForm/components/render/CustomComponentViewWrapper.js +120 -0
- package/es/ProForm/components/render/Render.js +71 -16
- package/es/ProForm/components/render/RenderFields.js +7 -2
- package/es/ProForm/index.js +13 -3
- package/es/ProForm/propsType.d.ts +7 -0
- package/es/ProForm/style/index.less +11 -2
- package/es/ProForm/utils/index.js +7 -2
- package/es/ProForm/utils/rulesCreator.js +5 -1
- package/es/ProForm/utils/transformValue.js +5 -1
- package/es/ProForm/utils/useForm.js +15 -5
- package/es/ProForm/utils/useShouldUpdate.js +93 -35
- package/es/ProForm/utils/useWatch.js +9 -4
- package/es/ProForm/utils/valueType.js +11 -2
- package/es/ProIcon/index.js +13 -3
- package/es/ProIcon/utils/index.js +5 -1
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -14
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +6 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +48 -31
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +3 -12
- package/es/ProLayout/components/Layout/Notice/style/index.less +4 -0
- package/es/ProLayout/components/ProCollapse/index.js +5 -1
- package/es/ProLayout/components/ProCollapse/style/index.less +9 -9
- package/es/ProLayout/components/ProFooter/index.js +6 -2
- package/es/ProLayout/components/ProHeader/index.js +33 -19
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +7 -0
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +100 -0
- package/es/ProLayout/components/TabsManager/components/TabItem.d.ts +26 -0
- package/es/ProLayout/components/TabsManager/components/TabItem.js +61 -0
- package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +6 -0
- package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -0
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +6 -0
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +14 -0
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +18 -0
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +26 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +31 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +96 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +5 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +364 -0
- package/es/ProLayout/components/TabsManager/index.d.ts +8 -0
- package/es/ProLayout/components/TabsManager/index.js +180 -0
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +74 -0
- package/es/ProLayout/components/TabsManager/propTypes.js +16 -0
- package/es/ProLayout/components/TabsManager/style/index.less +179 -0
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +38 -0
- package/es/ProLayout/components/TabsManager/utils/index.js +106 -0
- package/es/ProLayout/index.d.ts +21 -4
- package/es/ProLayout/index.js +107 -14
- package/es/ProLayout/propTypes.d.ts +139 -1
- package/es/ProLayout/propTypes.js +37 -1
- package/es/ProLayout/utils/index.js +16 -7
- package/es/ProSelect/components/AdaptiveTooltip.js +6 -1
- package/es/ProSelect/index.js +13 -3
- package/es/ProSelect/utils/index.js +3 -1
- package/es/ProStep/components/Item/index.js +8 -2
- package/es/ProStep/components/Listener/index.js +10 -4
- package/es/ProStep/components/Step/index.js +11 -2
- package/es/ProStep/index.js +16 -5
- package/es/ProStep/utils/index.js +5 -1
- package/es/ProStepTab/index.js +19 -8
- package/es/ProTable/components/FormatColumn/index.js +7 -2
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +7 -2
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +10 -4
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +5 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +7 -2
- package/es/ProTable/components/RenderColumn/index.js +11 -2
- package/es/ProTable/components/RenderTabs/index.js +11 -2
- package/es/ProTable/components/TableResizable/index.js +13 -3
- package/es/ProTable/components/TooltipTitle/index.js +3 -5
- package/es/ProTable/hooks/useAntdTable.js +69 -35
- package/es/ProTable/index.js +16 -5
- package/es/ProTable/style/index.less +3 -0
- package/es/ProTable/utils/index.js +6 -1
- package/es/ProTabs/index.js +13 -3
- package/es/ProThemeTools/component/ProTools/index.js +11 -2
- package/es/ProThemeTools/context/ThemeContext.js +11 -2
- package/es/ProThemeTools/index.js +13 -3
- package/es/ProThemeTools/utils/index.js +5 -1
- package/es/ProTooltip/index.js +13 -3
- package/es/ProTree/components/CloseIcon.js +5 -1
- package/es/ProTree/components/List.js +7 -2
- package/es/ProTree/components/ProTree.js +16 -5
- package/es/ProTree/components/ProTreeSelect/index.js +119 -75
- package/es/ProTree/components/Tree.js +16 -5
- package/es/ProTree/index.js +5 -1
- package/es/ProTree/utils.js +8 -2
- package/es/ProTreeModal/components/Cascader.js +11 -2
- package/es/ProTreeModal/components/CloseIcon.js +5 -1
- package/es/ProTreeModal/components/List.js +6 -1
- package/es/ProTreeModal/components/SortableItem.js +5 -1
- package/es/ProTreeModal/components/Tree.js +13 -3
- package/es/ProTreeModal/components/Trigger.js +11 -2
- package/es/ProTreeModal/index.js +11 -2
- package/es/ProTreeModal/style/index.less +6 -0
- package/es/ProTreeModal/utils.js +8 -2
- package/es/ProUpload/components/ButtonRender.js +8 -3
- package/es/ProUpload/components/DragRender.d.ts +1 -0
- package/es/ProUpload/components/DragRender.js +10 -2
- package/es/ProUpload/components/DraggableUploadListItem.js +5 -1
- package/es/ProUpload/components/Example.js +11 -2
- package/es/ProUpload/components/ImageRender.js +14 -4
- package/es/ProUpload/index.js +17 -5
- package/es/ProUpload/propsType.d.ts +5 -0
- package/es/ProViewer/index.js +14 -4
- package/es/ProWaterMark/index.js +5 -1
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -0
- package/es/locale/en_US.d.ts +9 -0
- package/es/locale/en_US.js +9 -0
- package/es/locale/zh_CN.d.ts +9 -0
- package/es/locale/zh_CN.js +9 -0
- package/es/style/theme/antd.less +11 -35
- package/es/utils/index.js +6 -1
- package/jest.config.js +3 -1
- package/lib/FormsProvider/index.js +2 -1
- package/lib/ProAction/index.js +20 -10
- package/lib/ProConfigProvider/index.js +29 -19
- package/lib/ProDownload/index.js +29 -17
- package/lib/ProDownload/utils.js +14 -12
- package/lib/ProDrawerForm/components/ProDrawer/index.js +27 -16
- package/lib/ProDrawerForm/components/ProModal/index.js +21 -10
- package/lib/ProDrawerForm/components/index.js +2 -2
- package/lib/ProDrawerForm/index.js +20 -9
- package/lib/ProEditLabel/components/RenderProForm.js +9 -6
- package/lib/ProEditLabel/index.js +30 -18
- package/lib/ProEditTable/components/ActionButton/index.js +14 -11
- package/lib/ProEditTable/components/RcTable/BaseTable.js +19 -9
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +24 -16
- package/lib/ProEditTable/components/RcTable/index.js +2 -2
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +16 -10
- package/lib/ProEditTable/components/RenderField/index.js +76 -50
- package/lib/ProEditTable/components/RenderToolbar/index.js +18 -12
- package/lib/ProEditTable/components/index.js +2 -2
- package/lib/ProEditTable/index.js +33 -21
- package/lib/ProEditTable/propsType.d.ts +12 -6
- package/lib/ProEditTable/style/index.less +30 -3
- package/lib/ProEditTable/utils/config.js +20 -15
- package/lib/ProEditTable/utils/index.js +22 -18
- package/lib/ProEditTable/utils/tools.js +30 -21
- package/lib/ProEditTable/utils/useEditTableError.js +7 -3
- package/lib/ProEditTable/utils/useShouldUpdateForTable.js +17 -9
- package/lib/ProEnum/components/Group.js +8 -3
- package/lib/ProEnum/components/Tag.js +8 -3
- package/lib/ProEnum/hooks/useEnum.d.ts +8 -0
- package/lib/ProEnum/hooks/useEnum.js +76 -4
- package/lib/ProEnum/hooks/useEnumRequest.js +23 -18
- package/lib/ProEnum/hooks/useFrequentEnumRequest.js +12 -8
- package/lib/ProEnum/index.js +37 -26
- package/lib/ProEnum/utils/eventCenter.js +4 -3
- package/lib/ProEnum/utils/frequentEnum.js +6 -3
- package/lib/ProEnum/utils/index.js +3 -3
- package/lib/ProForm/components/Container.js +1 -1
- package/lib/ProForm/components/FormFooter/index.js +11 -6
- package/lib/ProForm/components/base/Checkbox/index.js +13 -7
- package/lib/ProForm/components/base/DatePicker/index.js +11 -6
- package/lib/ProForm/components/base/DatePicker/useDateLimit.js +7 -3
- package/lib/ProForm/components/base/Input/index.js +11 -6
- package/lib/ProForm/components/base/InputNumber/index.js +21 -10
- package/lib/ProForm/components/base/Radio/index.js +10 -5
- package/lib/ProForm/components/base/RangePicker/index.d.ts +7 -1
- package/lib/ProForm/components/base/RangePicker/index.js +55 -9
- package/lib/ProForm/components/base/RangePicker/useDateRange.js +7 -3
- package/lib/ProForm/components/base/Select/index.js +10 -5
- package/lib/ProForm/components/base/Switch/index.js +10 -5
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +12 -6
- package/lib/ProForm/components/base/TextArea/index.js +10 -5
- package/lib/ProForm/components/base/TimePicker/index.js +10 -5
- package/lib/ProForm/components/combination/Container/index.js +11 -6
- package/lib/ProForm/components/combination/Container/style/index.less +5 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +108 -20
- package/lib/ProForm/components/combination/FormList/components/BlockFields.d.ts +2 -0
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +65 -8
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/Empty.js +17 -7
- package/lib/ProForm/components/combination/FormList/components/LineFields.d.ts +1 -0
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +11 -5
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +58 -23
- package/lib/ProForm/components/combination/FormList/index.js +113 -65
- package/lib/ProForm/components/combination/FormList/propsType.d.ts +7 -2
- package/lib/ProForm/components/combination/FormList/style/index.less +41 -0
- package/lib/ProForm/components/combination/FormList/utils.d.ts +6 -0
- package/lib/ProForm/components/combination/FormList/utils.js +20 -2
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +1 -1
- package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +3 -0
- package/lib/ProForm/components/combination/Group/component/ComRender.js +79 -11
- package/lib/ProForm/components/combination/Group/component/FlexibleGroup.d.ts +10 -0
- package/lib/ProForm/components/combination/Group/component/FlexibleGroup.js +360 -0
- package/lib/ProForm/components/combination/Group/hooks/index.d.ts +16 -1
- package/lib/ProForm/components/combination/Group/hooks/index.js +111 -9
- package/lib/ProForm/components/combination/Group/index.d.ts +3 -4
- package/lib/ProForm/components/combination/Group/index.js +111 -27
- package/lib/ProForm/components/combination/Group/propsType.d.ts +44 -1
- package/lib/ProForm/components/combination/Group/style/index.less +425 -3
- package/lib/ProForm/components/combination/Group/utils/index.d.ts +154 -0
- package/lib/ProForm/components/combination/Group/utils/index.js +444 -0
- package/lib/ProForm/components/combination/ProCascader/index.js +20 -10
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +9 -5
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +25 -15
- package/lib/ProForm/components/combination/ProModalSelect/index.js +53 -41
- package/lib/ProForm/components/combination/ProNumberRange/index.js +28 -16
- package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +4 -0
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +14 -7
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +29 -18
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +8 -3
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +26 -15
- package/lib/ProForm/components/index.js +2 -2
- package/lib/ProForm/components/render/ChangedWrapper.js +16 -10
- package/lib/ProForm/components/render/ConfirmWrapper.js +19 -13
- package/lib/ProForm/components/render/CustomComponentViewWrapper.d.ts +30 -0
- package/lib/ProForm/components/render/CustomComponentViewWrapper.js +127 -0
- package/lib/ProForm/components/render/Render.js +93 -37
- package/lib/ProForm/components/render/RenderFields.js +15 -9
- package/lib/ProForm/index.js +23 -12
- package/lib/ProForm/propsType.d.ts +7 -0
- package/lib/ProForm/style/index.less +11 -2
- package/lib/ProForm/utils/index.js +12 -8
- package/lib/ProForm/utils/rulesCreator.js +8 -4
- package/lib/ProForm/utils/transformValue.js +6 -3
- package/lib/ProForm/utils/useFieldProps.js +2 -1
- package/lib/ProForm/utils/useForm.js +21 -12
- package/lib/ProForm/utils/useRules.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.js +94 -37
- package/lib/ProForm/utils/useWatch.js +11 -6
- package/lib/ProForm/utils/valueType.js +15 -6
- package/lib/ProIcon/index.js +26 -16
- package/lib/ProIcon/utils/index.js +7 -4
- package/lib/ProLayout/components/Layout/Header/index.js +1 -1
- package/lib/ProLayout/components/Layout/Icon/Icon.js +2 -1
- package/lib/ProLayout/components/Layout/Icon/index.js +1 -1
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +24 -19
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +6 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +50 -33
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +3 -12
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +1 -1
- package/lib/ProLayout/components/Layout/Menu/index.js +1 -1
- package/lib/ProLayout/components/Layout/Notice/index.js +1 -1
- package/lib/ProLayout/components/Layout/Notice/style/index.less +4 -0
- package/lib/ProLayout/components/Layout/index.js +2 -2
- package/lib/ProLayout/components/ProCollapse/index.js +10 -6
- package/lib/ProLayout/components/ProCollapse/style/index.less +9 -9
- package/lib/ProLayout/components/ProFooter/index.js +8 -4
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +1 -1
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +1 -1
- package/lib/ProLayout/components/ProHeader/components/index.js +2 -2
- package/lib/ProLayout/components/ProHeader/index.js +41 -27
- package/lib/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +7 -0
- package/lib/ProLayout/components/TabsManager/components/TabContextMenu.js +106 -0
- package/lib/ProLayout/components/TabsManager/components/TabItem.d.ts +26 -0
- package/lib/ProLayout/components/TabsManager/components/TabItem.js +67 -0
- package/lib/ProLayout/components/TabsManager/components/TabsContext.d.ts +6 -0
- package/lib/ProLayout/components/TabsManager/components/TabsContext.js +11 -0
- package/lib/ProLayout/components/TabsManager/hooks/useActiveTab.d.ts +6 -0
- package/lib/ProLayout/components/TabsManager/hooks/useActiveTab.js +20 -0
- package/lib/ProLayout/components/TabsManager/hooks/useProLayoutTabs.d.ts +18 -0
- package/lib/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +31 -0
- package/lib/ProLayout/components/TabsManager/hooks/useTabsCache.d.ts +31 -0
- package/lib/ProLayout/components/TabsManager/hooks/useTabsCache.js +103 -0
- package/lib/ProLayout/components/TabsManager/hooks/useTabsState.d.ts +5 -0
- package/lib/ProLayout/components/TabsManager/hooks/useTabsState.js +370 -0
- package/lib/ProLayout/components/TabsManager/index.d.ts +8 -0
- package/lib/ProLayout/components/TabsManager/index.js +183 -0
- package/lib/ProLayout/components/TabsManager/propTypes.d.ts +74 -0
- package/lib/ProLayout/components/TabsManager/propTypes.js +22 -0
- package/lib/ProLayout/components/TabsManager/style/index.less +179 -0
- package/lib/ProLayout/components/TabsManager/utils/index.d.ts +38 -0
- package/lib/ProLayout/components/TabsManager/utils/index.js +119 -0
- package/lib/ProLayout/components/index.js +2 -2
- package/lib/ProLayout/index.d.ts +21 -4
- package/lib/ProLayout/index.js +122 -21
- package/lib/ProLayout/propTypes.d.ts +139 -1
- package/lib/ProLayout/propTypes.js +40 -1
- package/lib/ProLayout/utils/index.js +18 -13
- package/lib/ProSelect/components/AdaptiveTooltip.js +7 -3
- package/lib/ProSelect/index.js +23 -12
- package/lib/ProSelect/utils/index.js +8 -8
- package/lib/ProStep/components/Anchor/index.js +1 -1
- package/lib/ProStep/components/Item/index.js +15 -9
- package/lib/ProStep/components/Listener/index.js +15 -9
- package/lib/ProStep/components/Step/index.js +17 -7
- package/lib/ProStep/index.js +30 -19
- package/lib/ProStep/utils/index.js +6 -3
- package/lib/ProStepTab/index.js +33 -22
- package/lib/ProTable/components/FormatColumn/index.js +22 -16
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +9 -5
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +22 -16
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +8 -5
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +11 -6
- package/lib/ProTable/components/RcTable/index.js +2 -2
- package/lib/ProTable/components/RenderColumn/index.js +17 -8
- package/lib/ProTable/components/RenderTabs/index.js +16 -7
- package/lib/ProTable/components/TableResizable/index.js +19 -9
- package/lib/ProTable/components/TooltipTitle/index.js +3 -6
- package/lib/ProTable/components/index.js +2 -2
- package/lib/ProTable/hooks/useAntdTable.js +94 -60
- package/lib/ProTable/index.js +41 -29
- package/lib/ProTable/style/index.less +3 -0
- package/lib/ProTable/utils/index.js +7 -3
- package/lib/ProTabs/components/index.js +2 -2
- package/lib/ProTabs/index.js +23 -12
- package/lib/ProThemeTools/component/ProTools/index.js +21 -11
- package/lib/ProThemeTools/component/index.js +2 -2
- package/lib/ProThemeTools/context/ThemeContext.js +20 -16
- package/lib/ProThemeTools/index.js +22 -12
- package/lib/ProThemeTools/utils/index.js +6 -3
- package/lib/ProTooltip/index.js +30 -20
- package/lib/ProTree/components/CloseIcon.js +6 -3
- package/lib/ProTree/components/List.js +10 -5
- package/lib/ProTree/components/ProTree.js +23 -12
- package/lib/ProTree/components/ProTreeSelect/index.js +138 -93
- package/lib/ProTree/components/SearchTitle.js +1 -1
- package/lib/ProTree/components/Tree.js +28 -16
- package/lib/ProTree/components/index.js +2 -2
- package/lib/ProTree/index.js +9 -5
- package/lib/ProTree/utils.js +16 -11
- package/lib/ProTreeModal/components/Cascader.js +14 -5
- package/lib/ProTreeModal/components/CloseIcon.js +6 -3
- package/lib/ProTreeModal/components/List.js +11 -7
- package/lib/ProTreeModal/components/SortableItem.js +10 -6
- package/lib/ProTreeModal/components/Tree.js +24 -13
- package/lib/ProTreeModal/components/Trigger.js +19 -9
- package/lib/ProTreeModal/components/index.js +2 -2
- package/lib/ProTreeModal/index.js +16 -6
- package/lib/ProTreeModal/style/index.less +6 -0
- package/lib/ProTreeModal/utils.js +17 -14
- package/lib/ProUpload/components/ButtonRender.js +14 -9
- package/lib/ProUpload/components/DragRender.d.ts +1 -0
- package/lib/ProUpload/components/DragRender.js +13 -5
- package/lib/ProUpload/components/DraggableUploadListItem.js +7 -3
- package/lib/ProUpload/components/Example.js +16 -6
- package/lib/ProUpload/components/FileItem.js +1 -1
- package/lib/ProUpload/components/ImageRender.js +20 -10
- package/lib/ProUpload/index.js +31 -18
- package/lib/ProUpload/propsType.d.ts +5 -0
- package/lib/ProViewer/index.js +22 -14
- package/lib/ProWaterMark/index.js +7 -3
- package/lib/index.d.ts +1 -2
- package/lib/index.js +4 -3
- package/lib/locale/en_US.d.ts +9 -0
- package/lib/locale/en_US.js +9 -0
- package/lib/locale/index.js +1 -1
- package/lib/locale/zh_CN.d.ts +9 -0
- package/lib/locale/zh_CN.js +9 -0
- package/lib/style/theme/antd.less +11 -35
- package/lib/utils/index.js +9 -4
- package/package.json +14 -17
- package/package.json.backup-antd5 +159 -0
- package/es/ProForm/components/combination/Group/utils.d.ts +0 -54
- package/es/ProForm/components/combination/Group/utils.js +0 -196
- package/es/assets/tip.svg +0 -1
- package/lib/ProForm/components/combination/Group/utils.d.ts +0 -54
- package/lib/ProForm/components/combination/Group/utils.js +0 -210
- package/lib/assets/tip.svg +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
5
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
import { useCallback, useMemo, forwardRef, useImperativeHandle, useState, useEffect } from 'react';
|
|
13
|
+
import { useTabsState } from "./hooks/useTabsState";
|
|
14
|
+
import { TabItemComponent } from "./components/TabItem";
|
|
15
|
+
import { TabsContext } from "./components/TabsContext";
|
|
16
|
+
import "./style/index.less";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 标签页管理器主组件
|
|
20
|
+
*/
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
var TabsManager = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
24
|
+
var config = _ref.config,
|
|
25
|
+
children = _ref.children,
|
|
26
|
+
dataSource = _ref.dataSource,
|
|
27
|
+
originalOnMenuClick = _ref.originalOnMenuClick;
|
|
28
|
+
// 使用标签页状态管理Hook
|
|
29
|
+
var _useTabsState = useTabsState({
|
|
30
|
+
config,
|
|
31
|
+
dataSource
|
|
32
|
+
}),
|
|
33
|
+
state = _useTabsState.state,
|
|
34
|
+
_addTab = _useTabsState.addTab,
|
|
35
|
+
removeTab = _useTabsState.removeTab,
|
|
36
|
+
switchTab = _useTabsState.switchTab,
|
|
37
|
+
closeOtherTabs = _useTabsState.closeOtherTabs,
|
|
38
|
+
closeRightTabs = _useTabsState.closeRightTabs,
|
|
39
|
+
closeAllTabs = _useTabsState.closeAllTabs;
|
|
40
|
+
|
|
41
|
+
// 记录已访问过的 Tab ID,用于懒加载
|
|
42
|
+
var _useState = useState(new Set()),
|
|
43
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
+
visitedTabIds = _useState2[0],
|
|
45
|
+
setVisitedTabIds = _useState2[1];
|
|
46
|
+
|
|
47
|
+
// 监听 activeKey 变化,更新 visitedTabIds
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (state.activeKey) {
|
|
50
|
+
setVisitedTabIds(prev => {
|
|
51
|
+
if (prev.has(state.activeKey)) return prev;
|
|
52
|
+
var newSet = new Set(prev);
|
|
53
|
+
newSet.add(state.activeKey);
|
|
54
|
+
return newSet;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [state.activeKey]);
|
|
58
|
+
|
|
59
|
+
// 处理菜单点击 - 拦截原有的菜单点击逻辑
|
|
60
|
+
var handleMenuClick = useCallback(params => {
|
|
61
|
+
if (params.item) {
|
|
62
|
+
// 添加到标签页
|
|
63
|
+
_addTab(params.item);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 如果有原始的菜单点击处理函数,也调用它
|
|
67
|
+
originalOnMenuClick === null || originalOnMenuClick === void 0 || originalOnMenuClick(params);
|
|
68
|
+
}, [_addTab, originalOnMenuClick]);
|
|
69
|
+
|
|
70
|
+
// 获取当前激活的标签页
|
|
71
|
+
var activeTabInfo = useMemo(() => {
|
|
72
|
+
return state.tabsList.find(tab => tab.id === state.activeKey);
|
|
73
|
+
}, [state.tabsList, state.activeKey]);
|
|
74
|
+
|
|
75
|
+
// 创建标签页实例 API
|
|
76
|
+
var tabsInstance = useMemo(() => ({
|
|
77
|
+
addTab: (params, options) => {
|
|
78
|
+
var code = params.code,
|
|
79
|
+
name = params.name,
|
|
80
|
+
extra = params.extra;
|
|
81
|
+
var menuItem = {
|
|
82
|
+
id: Date.now(),
|
|
83
|
+
// 生成临时 ID
|
|
84
|
+
code,
|
|
85
|
+
name,
|
|
86
|
+
url: `/${code}`,
|
|
87
|
+
// 生成 URL
|
|
88
|
+
extra
|
|
89
|
+
};
|
|
90
|
+
_addTab(menuItem, options);
|
|
91
|
+
},
|
|
92
|
+
removeTab,
|
|
93
|
+
getTabInfo: () => ({
|
|
94
|
+
tabsList: state.tabsList,
|
|
95
|
+
activeTabInfo: state.tabsList.find(tab => tab.id === state.activeKey),
|
|
96
|
+
activeComponent: state.activeComponent
|
|
97
|
+
})
|
|
98
|
+
}), [_addTab, removeTab, state.tabsList, state.activeKey, state.activeComponent]);
|
|
99
|
+
|
|
100
|
+
// 渲染标签页列表
|
|
101
|
+
var renderTabList = () => {
|
|
102
|
+
if (state.tabsList.length === 0) return null;
|
|
103
|
+
return /*#__PURE__*/_jsx("div", {
|
|
104
|
+
className: "pro-layout-tabs-header",
|
|
105
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
106
|
+
className: "pro-layout-tab-list",
|
|
107
|
+
children: state.tabsList.map(tab => /*#__PURE__*/_jsx(TabItemComponent, {
|
|
108
|
+
tab: tab,
|
|
109
|
+
active: tab.id === state.activeKey,
|
|
110
|
+
onClick: () => switchTab(tab.id),
|
|
111
|
+
onClose: () => removeTab(tab.id),
|
|
112
|
+
onCloseOthers: () => closeOtherTabs(tab.id),
|
|
113
|
+
onCloseRight: () => closeRightTabs(tab.id),
|
|
114
|
+
onCloseAll: closeAllTabs,
|
|
115
|
+
tabsList: state.tabsList,
|
|
116
|
+
menuItems: config === null || config === void 0 ? void 0 : config.menuItems,
|
|
117
|
+
tabMenuClick: config === null || config === void 0 ? void 0 : config.tabMenuClick
|
|
118
|
+
}, tab.id))
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// 从 config 中获取组件解析函数和空状态组件
|
|
124
|
+
var activeComponent = config === null || config === void 0 ? void 0 : config.activeComponent;
|
|
125
|
+
var emptyComponent = config === null || config === void 0 ? void 0 : config.empty;
|
|
126
|
+
|
|
127
|
+
// 渲染内容区域
|
|
128
|
+
var renderContent = () => {
|
|
129
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
130
|
+
className: "pro-layout-tabs-content",
|
|
131
|
+
children: [state.tabsList.map(tab => {
|
|
132
|
+
var _tab$menuItem;
|
|
133
|
+
var isActive = tab.id === state.activeKey;
|
|
134
|
+
var hasVisited = visitedTabIds.has(tab.id);
|
|
135
|
+
|
|
136
|
+
// 如果既不是当前激活,也没有访问过,则只渲染占位符(懒加载)
|
|
137
|
+
if (!isActive && !hasVisited) {
|
|
138
|
+
return /*#__PURE__*/_jsx("div", {
|
|
139
|
+
className: "tab-pane hidden",
|
|
140
|
+
"data-testid": `tab-pane-${tab.id}`
|
|
141
|
+
}, tab.id);
|
|
142
|
+
}
|
|
143
|
+
var content = children;
|
|
144
|
+
|
|
145
|
+
// 如果提供了组件解析函数,尝试解析组件
|
|
146
|
+
if (activeComponent && (_tab$menuItem = tab.menuItem) !== null && _tab$menuItem !== void 0 && _tab$menuItem.code) {
|
|
147
|
+
var ResolvedComponent = activeComponent(tab.menuItem.code);
|
|
148
|
+
if (ResolvedComponent) {
|
|
149
|
+
// 将 extra 中的所有属性作为 props 传递给组件
|
|
150
|
+
content = /*#__PURE__*/_jsx(ResolvedComponent, _objectSpread({}, tab.menuItem.extra || {}));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return /*#__PURE__*/_jsx("div", {
|
|
154
|
+
className: `tab-pane ${isActive ? '' : 'hidden'}`,
|
|
155
|
+
"data-testid": `tab-pane-${tab.id}`,
|
|
156
|
+
children: content
|
|
157
|
+
}, tab.id);
|
|
158
|
+
}), state.tabsList.length === 0 && /*#__PURE__*/_jsx("div", {
|
|
159
|
+
className: "tab-pane",
|
|
160
|
+
"data-testid": "default-content",
|
|
161
|
+
children: emptyComponent || children
|
|
162
|
+
})]
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// 暴露方法给父组件
|
|
167
|
+
useImperativeHandle(ref, () => ({
|
|
168
|
+
handleMenuClick
|
|
169
|
+
}), [handleMenuClick]);
|
|
170
|
+
return /*#__PURE__*/_jsx(TabsContext.Provider, {
|
|
171
|
+
value: tabsInstance,
|
|
172
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
173
|
+
className: "pro-layout-tabs",
|
|
174
|
+
"data-testid": "tabs-manager",
|
|
175
|
+
children: [renderTabList(), renderContent()]
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
TabsManager.displayName = 'TabsManager';
|
|
180
|
+
export default TabsManager;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { MenuProps } from 'antd';
|
|
3
|
+
import { TabsState, MenusType, DataSourceType, TabsConfig, AddTabOptions, TabItem } from '../../propTypes';
|
|
4
|
+
export interface TabsManagerProps {
|
|
5
|
+
/** 标签页配置 */
|
|
6
|
+
config: TabsConfig;
|
|
7
|
+
/** 子元素内容 */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** 菜单数据源 */
|
|
10
|
+
dataSource: DataSourceType | Partial<MenusType>;
|
|
11
|
+
/** 原始菜单点击处理 */
|
|
12
|
+
originalOnMenuClick?: (params: {
|
|
13
|
+
item: MenusType | null;
|
|
14
|
+
key: string;
|
|
15
|
+
keyPath: string[];
|
|
16
|
+
}) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface TabContextMenuProps {
|
|
19
|
+
tabId: string;
|
|
20
|
+
children: React.ReactElement;
|
|
21
|
+
closable?: boolean;
|
|
22
|
+
onClose: (tabId: string) => void;
|
|
23
|
+
onCloseOthers: (tabId: string) => void;
|
|
24
|
+
onCloseRight: (tabId: string) => void;
|
|
25
|
+
onCloseAll: () => void;
|
|
26
|
+
/** 自定义菜单项,会与默认菜单项合并 */
|
|
27
|
+
menuItems?: MenuProps['items'];
|
|
28
|
+
/** 自定义菜单项点击回调 */
|
|
29
|
+
tabMenuClick?: (params: {
|
|
30
|
+
key: string;
|
|
31
|
+
tab: TabItem;
|
|
32
|
+
tabs: TabItem[];
|
|
33
|
+
}) => void;
|
|
34
|
+
/** 当前标签页信息 */
|
|
35
|
+
tab?: TabItem;
|
|
36
|
+
/** 所有标签页列表 */
|
|
37
|
+
tabs?: TabItem[];
|
|
38
|
+
}
|
|
39
|
+
export interface UseTabsStateOptions {
|
|
40
|
+
/** 初始状态 */
|
|
41
|
+
initialState?: Partial<TabsState>;
|
|
42
|
+
/** 配置 */
|
|
43
|
+
config: TabsManagerProps['config'];
|
|
44
|
+
/** 数据源 */
|
|
45
|
+
dataSource?: TabsManagerProps['dataSource'];
|
|
46
|
+
}
|
|
47
|
+
export interface UseTabsStateReturn {
|
|
48
|
+
/** 当前状态 */
|
|
49
|
+
state: TabsState;
|
|
50
|
+
/** 添加标签页 */
|
|
51
|
+
addTab: (menuItem: MenusType, options?: AddTabOptions) => void;
|
|
52
|
+
/** 移除标签页 */
|
|
53
|
+
removeTab: (tabId: string) => void;
|
|
54
|
+
/** 切换标签页 */
|
|
55
|
+
switchTab: (tabId: string) => void;
|
|
56
|
+
/** 关闭其他标签页 */
|
|
57
|
+
closeOtherTabs: (currentTabId: string) => void;
|
|
58
|
+
/** 关闭右侧标签页 */
|
|
59
|
+
closeRightTabs: (currentTabId: string) => void;
|
|
60
|
+
/** 关闭全部标签页 */
|
|
61
|
+
closeAllTabs: () => void;
|
|
62
|
+
/** 重置状态 */
|
|
63
|
+
resetTabs: () => void;
|
|
64
|
+
}
|
|
65
|
+
export interface TabsCacheManager {
|
|
66
|
+
save: (state: TabsState) => void;
|
|
67
|
+
restore: () => TabsState | null;
|
|
68
|
+
clear: () => void;
|
|
69
|
+
}
|
|
70
|
+
export declare const DEFAULT_TABS_CONFIG: {
|
|
71
|
+
max: number;
|
|
72
|
+
storage: "localStorage";
|
|
73
|
+
cacheKey: string;
|
|
74
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
.pro-layout-tabs {
|
|
2
|
+
--pro-layout-tabs-primary: var(--ant-primary-color, #1677ff);
|
|
3
|
+
--pro-layout-tabs-active-bg: var(--ant-color-success, #00b578);
|
|
4
|
+
--pro-layout-tabs-text-color: var(--ant-color-text, #1f1f1f);
|
|
5
|
+
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
height: 100%;
|
|
9
|
+
|
|
10
|
+
&-header {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
min-height: 48px;
|
|
14
|
+
padding: 12px 0;
|
|
15
|
+
border-bottom: none;
|
|
16
|
+
|
|
17
|
+
.pro-layout-tab-list {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex: 1;
|
|
20
|
+
gap: 12px;
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
overflow-y: hidden;
|
|
23
|
+
|
|
24
|
+
&::-webkit-scrollbar {
|
|
25
|
+
height: 3px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&::-webkit-scrollbar-track {
|
|
29
|
+
background: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&::-webkit-scrollbar-thumb {
|
|
33
|
+
background: #d9d9d9;
|
|
34
|
+
border-radius: 3px;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
background: #bfbfbf;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&-extra {
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
padding: 0 16px;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&-content {
|
|
49
|
+
.tab-pane {
|
|
50
|
+
&.hidden {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.pro-layout-tab-item {
|
|
58
|
+
position: relative;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-shrink: 0;
|
|
61
|
+
align-items: center;
|
|
62
|
+
min-height: 36px;
|
|
63
|
+
padding: 0;
|
|
64
|
+
background: #ffffff;
|
|
65
|
+
border: 1px solid transparent;
|
|
66
|
+
border-radius: 8px;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
69
|
+
user-select: none;
|
|
70
|
+
|
|
71
|
+
&:hover {
|
|
72
|
+
background: #ffffff;
|
|
73
|
+
border-color: rgba(0, 0, 0, 0.06);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.active {
|
|
77
|
+
z-index: 2;
|
|
78
|
+
background: var(--zaui-primary);
|
|
79
|
+
border-color: transparent;
|
|
80
|
+
|
|
81
|
+
&::before {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.pro-layout-tab-content {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
min-width: 100px;
|
|
90
|
+
padding: 6px 12px;
|
|
91
|
+
text-align: left;
|
|
92
|
+
|
|
93
|
+
.pro-layout-tab-icon {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-shrink: 0;
|
|
96
|
+
align-items: center;
|
|
97
|
+
margin-right: 8px;
|
|
98
|
+
|
|
99
|
+
.iconfont {
|
|
100
|
+
color: inherit;
|
|
101
|
+
font-size: 14px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
img {
|
|
105
|
+
width: 16px;
|
|
106
|
+
height: 16px;
|
|
107
|
+
object-fit: contain;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.pro-layout-tab-title {
|
|
112
|
+
flex: 1;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
color: var(--pro-layout-tabs-text-color);
|
|
115
|
+
font-weight: 500;
|
|
116
|
+
font-size: 14px;
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
transition: color 0.3s;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.pro-layout-tab-close {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex-shrink: 0;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
margin-left: 8px;
|
|
128
|
+
padding: 3px;
|
|
129
|
+
color: rgba(0, 0, 0, 0.45);
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
opacity: 0.7;
|
|
132
|
+
transition: all 0.3s;
|
|
133
|
+
|
|
134
|
+
&:hover {
|
|
135
|
+
color: #ff4d4f;
|
|
136
|
+
background: rgba(255, 77, 79, 0.15);
|
|
137
|
+
opacity: 1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.active .pro-layout-tab-content {
|
|
143
|
+
.pro-layout-tab-title {
|
|
144
|
+
color: #ffffff;
|
|
145
|
+
font-weight: 600;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.pro-layout-tab-icon {
|
|
149
|
+
.iconfont {
|
|
150
|
+
color: #ffffff;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.pro-layout-tab-close {
|
|
155
|
+
color: #ffffff;
|
|
156
|
+
|
|
157
|
+
&:hover {
|
|
158
|
+
background: rgba(255, 255, 255, 0.2);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.pro-layout-dark .pro-layout-tabs {
|
|
165
|
+
--pro-layout-tabs-text-color: rgba(255, 255, 255, 0.85);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// 响应式适配
|
|
169
|
+
@media (max-width: 768px) {
|
|
170
|
+
.pro-layout-tab-item {
|
|
171
|
+
.pro-layout-tab-content {
|
|
172
|
+
padding: 6px 8px;
|
|
173
|
+
|
|
174
|
+
.pro-layout-tab-title {
|
|
175
|
+
max-width: 80px;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TabItem, MenusType } from '../../../propTypes';
|
|
2
|
+
/**
|
|
3
|
+
* 根据菜单项生成TabItem
|
|
4
|
+
*/
|
|
5
|
+
export declare const createTabFromMenu: (menuItem: MenusType, index?: number) => TabItem;
|
|
6
|
+
/**
|
|
7
|
+
* 生成唯一的tab ID
|
|
8
|
+
*/
|
|
9
|
+
export declare const generateTabId: (menuItem: MenusType, existingIds: string[]) => string;
|
|
10
|
+
/**
|
|
11
|
+
* 检查菜单项是否应该外部跳转
|
|
12
|
+
*/
|
|
13
|
+
export declare const shouldOpenExternal: (menuItem: MenusType, target?: string) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 处理外部跳转
|
|
16
|
+
*/
|
|
17
|
+
export declare const handleExternalOpen: (menuItem: MenusType) => void;
|
|
18
|
+
/**
|
|
19
|
+
* 检查是否超出最大标签页限制
|
|
20
|
+
*/
|
|
21
|
+
export declare const checkTabLimit: (currentTabs: TabItem[], maxTabs: number) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 移除最旧的标签页(根据访问时间或创建时间)
|
|
24
|
+
*/
|
|
25
|
+
export declare const removeOldestTab: (tabs: TabItem[]) => TabItem[];
|
|
26
|
+
/**
|
|
27
|
+
* 获取右侧标签页
|
|
28
|
+
*/
|
|
29
|
+
export declare const getRightTabs: (tabs: TabItem[], currentTabId: string) => TabItem[];
|
|
30
|
+
/**
|
|
31
|
+
* 扁平化菜单数据
|
|
32
|
+
*/
|
|
33
|
+
export declare const flattenMenuData: (menus?: MenusType[]) => MenusType[];
|
|
34
|
+
/**
|
|
35
|
+
* 判断菜单项是否为最后一级(叶子节点)
|
|
36
|
+
* 只有当菜单项没有子菜单或子菜单为空时,才认为是叶子节点
|
|
37
|
+
*/
|
|
38
|
+
export declare const isLeafMenuItem: (menuItem: MenusType) => boolean;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 根据菜单项生成TabItem
|
|
3
|
+
*/
|
|
4
|
+
export var createTabFromMenu = function createTabFromMenu(menuItem) {
|
|
5
|
+
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
6
|
+
return {
|
|
7
|
+
id: String(menuItem.id || menuItem.code || menuItem.url || index),
|
|
8
|
+
code: menuItem.code,
|
|
9
|
+
name: menuItem.name,
|
|
10
|
+
title: menuItem.name,
|
|
11
|
+
url: menuItem.url,
|
|
12
|
+
closable: true,
|
|
13
|
+
menuItem,
|
|
14
|
+
icon: menuItem.icon || menuItem.imgUrl
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 生成唯一的tab ID
|
|
20
|
+
*/
|
|
21
|
+
export var generateTabId = (menuItem, existingIds) => {
|
|
22
|
+
var baseId = String(menuItem.id || menuItem.code || menuItem.url);
|
|
23
|
+
var finalId = baseId;
|
|
24
|
+
var counter = 1;
|
|
25
|
+
|
|
26
|
+
// 如果ID已存在,则添加数字后缀
|
|
27
|
+
while (existingIds.includes(finalId)) {
|
|
28
|
+
finalId = `${baseId}_${counter}`;
|
|
29
|
+
counter += 1;
|
|
30
|
+
}
|
|
31
|
+
return finalId;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 检查菜单项是否应该外部跳转
|
|
36
|
+
*/
|
|
37
|
+
export var shouldOpenExternal = (menuItem, target) => {
|
|
38
|
+
return target === '_blank' || menuItem.redirectUrl && menuItem.redirectUrl !== menuItem.url || menuItem.type === 'EXTERNAL';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 处理外部跳转
|
|
43
|
+
*/
|
|
44
|
+
export var handleExternalOpen = menuItem => {
|
|
45
|
+
var url = menuItem.redirectUrl || menuItem.url;
|
|
46
|
+
if (url) {
|
|
47
|
+
window.open(url, '_blank');
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 检查是否超出最大标签页限制
|
|
53
|
+
*/
|
|
54
|
+
export var checkTabLimit = (currentTabs, maxTabs) => {
|
|
55
|
+
return currentTabs.length >= maxTabs;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 移除最旧的标签页(根据访问时间或创建时间)
|
|
60
|
+
*/
|
|
61
|
+
export var removeOldestTab = tabs => {
|
|
62
|
+
if (tabs.length === 0) return tabs;
|
|
63
|
+
|
|
64
|
+
// 找到可关闭的最旧标签页
|
|
65
|
+
var closableTabs = tabs.filter(tab => tab.closable);
|
|
66
|
+
if (closableTabs.length === 0) return tabs;
|
|
67
|
+
|
|
68
|
+
// 移除第一个可关闭的标签页
|
|
69
|
+
var oldestTab = closableTabs[0];
|
|
70
|
+
return tabs.filter(tab => tab.id !== oldestTab.id);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 获取右侧标签页
|
|
75
|
+
*/
|
|
76
|
+
export var getRightTabs = (tabs, currentTabId) => {
|
|
77
|
+
var currentIndex = tabs.findIndex(tab => tab.id === currentTabId);
|
|
78
|
+
if (currentIndex === -1) return [];
|
|
79
|
+
return tabs.slice(currentIndex + 1);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 扁平化菜单数据
|
|
84
|
+
*/
|
|
85
|
+
export var flattenMenuData = function flattenMenuData() {
|
|
86
|
+
var menus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
87
|
+
var flatMenus = [];
|
|
88
|
+
menus.forEach(item => {
|
|
89
|
+
flatMenus.push(item);
|
|
90
|
+
if (item.children) {
|
|
91
|
+
flatMenus = [...flatMenus, ...flattenMenuData(item.children)];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return flatMenus;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 判断菜单项是否为最后一级(叶子节点)
|
|
99
|
+
* 只有当菜单项没有子菜单或子菜单为空时,才认为是叶子节点
|
|
100
|
+
*/
|
|
101
|
+
export var isLeafMenuItem = menuItem => {
|
|
102
|
+
var _ref = menuItem || {},
|
|
103
|
+
children = _ref.children;
|
|
104
|
+
// 如果 children 不存在、为 null、为 undefined,或者为空数组,则认为是叶子节点
|
|
105
|
+
return !children || Array.isArray(children) && children.length === 0;
|
|
106
|
+
};
|
package/es/ProLayout/index.d.ts
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { ProLayoutType } from './propTypes';
|
|
3
|
-
|
|
2
|
+
import type { ProLayoutStatesType, ProLayoutType } from './propTypes';
|
|
3
|
+
import { useProLayoutTabs } from './components/TabsManager/hooks/useProLayoutTabs';
|
|
4
|
+
import { useActiveTab } from './components/TabsManager/hooks/useActiveTab';
|
|
5
|
+
interface LayoutContextValue {
|
|
4
6
|
selectedPath: string;
|
|
5
|
-
onSelected: (params:
|
|
7
|
+
onSelected: (params: Partial<ProLayoutStatesType>) => void;
|
|
6
8
|
target: '_blank' | '_parent' | '_self' | '_top';
|
|
7
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export declare const LayoutContext: import("react").Context<LayoutContextValue>;
|
|
8
11
|
declare const ProLayout: {
|
|
9
12
|
(props: ProLayoutType): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
defaultProps: {
|
|
14
|
+
menus: any[];
|
|
15
|
+
iconfontUrl: string;
|
|
16
|
+
title: string;
|
|
17
|
+
collapsed: boolean;
|
|
18
|
+
routerMatch: string;
|
|
19
|
+
pure: boolean;
|
|
20
|
+
theme: string;
|
|
21
|
+
headerHeight: number;
|
|
22
|
+
contentStyle: {};
|
|
23
|
+
};
|
|
10
24
|
ProCollapse: (props: import("./components/ProCollapse/PropTypes").ProCollapseType) => import("react/jsx-runtime").JSX.Element;
|
|
11
25
|
ProFooter: import("react").MemoExoticComponent<(props: import("./components/ProFooter/PropTypes").ProFooterType) => import("react/jsx-runtime").JSX.Element>;
|
|
12
26
|
ProHeader: import("react").MemoExoticComponent<(props: import("./components/ProHeader/PropTypes").ProHeaderType) => import("react/jsx-runtime").JSX.Element>;
|
|
27
|
+
useProLayoutTabs: typeof useProLayoutTabs;
|
|
28
|
+
useActiveTab: () => import("./propTypes").TabItem;
|
|
13
29
|
};
|
|
30
|
+
export { useProLayoutTabs, useActiveTab };
|
|
14
31
|
export default ProLayout;
|