@zat-design/sisyphus-react 4.0.0-beta.9 → 4.0.1
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/README.md +1 -1
- 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 +7 -2
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +16 -7
- package/es/ProEditTable/components/RenderField/index.js +54 -29
- package/es/ProEditTable/components/RenderToolbar/index.js +10 -4
- package/es/ProEditTable/index.js +16 -10
- package/es/ProEditTable/propsType.d.ts +12 -6
- package/es/ProEditTable/style/index.less +22 -1
- package/es/ProEditTable/utils/config.js +8 -3
- package/es/ProEditTable/utils/index.js +14 -10
- 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.js +10 -4
- package/es/ProForm/components/combination/FormList/components/Empty.js +3 -2
- package/es/ProForm/components/combination/FormList/components/LineFields.js +5 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +10 -4
- package/es/ProForm/components/combination/FormList/index.js +41 -4
- package/es/ProForm/components/combination/FormList/style/index.less +1 -1
- 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 +17 -4
- 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 +6 -1
- 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 +28 -35
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +6 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +54 -35
- 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 +14 -4
- 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 +10 -4
- package/es/ProLayout/index.js +100 -16
- 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 +17 -6
- 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 +122 -76
- 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 +19 -13
- package/lib/ProEditTable/components/RcTable/index.js +2 -2
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +21 -11
- 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 -26
- package/lib/ProEditTable/propsType.d.ts +12 -6
- package/lib/ProEditTable/style/index.less +22 -1
- package/lib/ProEditTable/utils/config.js +20 -15
- package/lib/ProEditTable/utils/index.js +23 -19
- 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.js +26 -19
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +3 -2
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/Empty.js +6 -5
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +7 -3
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +20 -14
- package/lib/ProForm/components/combination/FormList/index.js +48 -10
- package/lib/ProForm/components/combination/FormList/style/index.less +1 -1
- 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 +27 -13
- 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 +8 -3
- 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 +31 -38
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +6 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +55 -36
- 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 +22 -12
- 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 +10 -4
- package/lib/ProLayout/index.js +115 -23
- 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 +42 -31
- 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 +141 -94
- 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 +13 -16
- 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,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _antd = require("antd");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _lodash = require("lodash");
|
|
11
|
+
var _useFieldProps = require("../../../../utils/useFieldProps");
|
|
12
|
+
var _ProForm = _interopRequireDefault(require("../../../../../ProForm"));
|
|
13
|
+
var _Render = _interopRequireDefault(require("../../../render/Render"));
|
|
14
|
+
var componentMap = _interopRequireWildcard(require("../../../../../index"));
|
|
15
|
+
var utils = _interopRequireWildcard(require("../utils"));
|
|
16
|
+
var _hooks = require("../hooks");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
var _excluded = ["width"];
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
24
|
+
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; }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
28
|
+
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); }
|
|
29
|
+
/**
|
|
30
|
+
* 错误提示组件
|
|
31
|
+
*/
|
|
32
|
+
var ErrorTip = () => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
33
|
+
className: "pro-group-error-tip",
|
|
34
|
+
children: "Group\u914D\u7F6E\u9519\u8BEF\uFF0C\u8BF7\u68C0\u67E5\u63A7\u5236\u53F0\u8B66\u544A\u4FE1\u606F"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* FlexibleGroup渲染组件
|
|
39
|
+
*/
|
|
40
|
+
var FlexibleGroupRender = props => {
|
|
41
|
+
var _fieldProps, _ref;
|
|
42
|
+
var propsChildren = props.children,
|
|
43
|
+
_props$space = props.space,
|
|
44
|
+
space = _props$space === void 0 ? {
|
|
45
|
+
size: 12
|
|
46
|
+
} : _props$space,
|
|
47
|
+
className = props.className,
|
|
48
|
+
isParentView = props.isView,
|
|
49
|
+
separator = props.separator,
|
|
50
|
+
split = props.split,
|
|
51
|
+
groupDisabled = props.disabled,
|
|
52
|
+
otherProps = props.otherProps,
|
|
53
|
+
id = props.id;
|
|
54
|
+
|
|
55
|
+
// children可能在props.children或props.fieldProps.children中
|
|
56
|
+
var children = propsChildren || ((_fieldProps = props.fieldProps) === null || _fieldProps === void 0 ? void 0 : _fieldProps.children) || [];
|
|
57
|
+
|
|
58
|
+
// 向后兼容处理:优先使用 separator,如果没有则使用 split,最后使用默认值
|
|
59
|
+
var finalSeparator = (_ref = separator !== null && separator !== void 0 ? separator : split) !== null && _ref !== void 0 ? _ref : '/';
|
|
60
|
+
var contextProps = _ProForm.default.useFieldProps() || {};
|
|
61
|
+
var form = contextProps.form,
|
|
62
|
+
contextIsView = contextProps.isView;
|
|
63
|
+
var isView = isParentView || contextIsView || (otherProps === null || otherProps === void 0 ? void 0 : otherProps.isView);
|
|
64
|
+
|
|
65
|
+
// 使用 hook 处理 ProEditTable 场景下的字段重置逻辑
|
|
66
|
+
(0, _hooks.useResetProEditTable)({
|
|
67
|
+
children,
|
|
68
|
+
form,
|
|
69
|
+
namePath: contextProps.namePath,
|
|
70
|
+
source: otherProps === null || otherProps === void 0 ? void 0 : otherProps.source
|
|
71
|
+
});
|
|
72
|
+
var renderFormItem = (child, index) => {
|
|
73
|
+
var _child$fieldProps, _child$fieldProps2;
|
|
74
|
+
// 计算样式(宽度处理)
|
|
75
|
+
var childWidth = (_child$fieldProps = child.fieldProps) === null || _child$fieldProps === void 0 || (_child$fieldProps = _child$fieldProps.style) === null || _child$fieldProps === void 0 ? void 0 : _child$fieldProps.width;
|
|
76
|
+
var formItemStyle = childWidth ? {
|
|
77
|
+
width: childWidth
|
|
78
|
+
} : undefined;
|
|
79
|
+
var formItemClassName = childWidth ? 'pro-group-form-item pro-group-form-item-has-width' : 'pro-group-form-item';
|
|
80
|
+
|
|
81
|
+
// 如果子组件有自定义宽度,从 fieldProps.style 中移除 width,让组件保持默认宽度
|
|
82
|
+
// 宽度只应用到 Form.Item,不透传到组件本身
|
|
83
|
+
var adjustedFieldProps = childWidth && (_child$fieldProps2 = child.fieldProps) !== null && _child$fieldProps2 !== void 0 && _child$fieldProps2.style ? _objectSpread(_objectSpread({}, child.fieldProps), {}, {
|
|
84
|
+
style: (() => {
|
|
85
|
+
var _child$fieldProps$sty = child.fieldProps.style,
|
|
86
|
+
width = _child$fieldProps$sty.width,
|
|
87
|
+
restStyle = _objectWithoutProperties(_child$fieldProps$sty, _excluded);
|
|
88
|
+
return restStyle;
|
|
89
|
+
})()
|
|
90
|
+
}) : child.fieldProps;
|
|
91
|
+
|
|
92
|
+
// 检查 child 是否来自 FormList 的处理(已有处理过的参数)
|
|
93
|
+
var isFromFormList = (child === null || child === void 0 ? void 0 : child.source) === 'FormList';
|
|
94
|
+
var childNamePath = child.namePath || contextProps.namePath;
|
|
95
|
+
var childIndex = child.index;
|
|
96
|
+
var childListName = child.listName;
|
|
97
|
+
|
|
98
|
+
// 需要判断childNamePath来源是FormList还是ProEditTable
|
|
99
|
+
var fullName = (() => {
|
|
100
|
+
if (isFromFormList) {
|
|
101
|
+
return child.name;
|
|
102
|
+
}
|
|
103
|
+
if (childNamePath && Array.isArray(child.name) && child.name.length > 1) {
|
|
104
|
+
return [...childNamePath, ...child.name];
|
|
105
|
+
}
|
|
106
|
+
if (childNamePath) {
|
|
107
|
+
return [...childNamePath, child.name];
|
|
108
|
+
}
|
|
109
|
+
return child.name;
|
|
110
|
+
})();
|
|
111
|
+
|
|
112
|
+
// 处理依赖关系 - 支持相对路径和绝对路径
|
|
113
|
+
var safeDependencies = Array.isArray(child.dependencies) ? child.dependencies : [];
|
|
114
|
+
var processedDependencies = safeDependencies.map(dep => {
|
|
115
|
+
if (typeof dep === 'string') {
|
|
116
|
+
// 相对路径:同Group内的其他字段
|
|
117
|
+
return childNamePath ? [...childNamePath, dep] : dep;
|
|
118
|
+
}
|
|
119
|
+
return dep; // 绝对路径保持不变
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// 获取组件类型
|
|
123
|
+
var type = child.type || 'Input';
|
|
124
|
+
var TargetComponent = componentMap[type];
|
|
125
|
+
|
|
126
|
+
// 处理 disabled(可能是函数)
|
|
127
|
+
var childDisabled = typeof child.disabled === 'function' ? false : child.disabled;
|
|
128
|
+
var finalDisabled = groupDisabled || childDisabled;
|
|
129
|
+
|
|
130
|
+
// 构建 formItemProps
|
|
131
|
+
var formItemProps = {
|
|
132
|
+
name: fullName,
|
|
133
|
+
label: child.label,
|
|
134
|
+
rules: child.rules,
|
|
135
|
+
dependencies: processedDependencies,
|
|
136
|
+
extra: child.extra,
|
|
137
|
+
before: child.before,
|
|
138
|
+
after: child.after,
|
|
139
|
+
required: child.required,
|
|
140
|
+
disabled: finalDisabled,
|
|
141
|
+
validateFirst: child.validateFirst
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// 如果 child 来自 FormList 的处理,传递 index、namePath、listName
|
|
145
|
+
if (childIndex !== undefined) {
|
|
146
|
+
formItemProps.index = childIndex;
|
|
147
|
+
}
|
|
148
|
+
if (childNamePath) {
|
|
149
|
+
formItemProps.namePath = childNamePath;
|
|
150
|
+
}
|
|
151
|
+
if (childListName) {
|
|
152
|
+
formItemProps.listName = childListName;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// 处理 tooltip(类型兼容)
|
|
156
|
+
if (child.tooltip) {
|
|
157
|
+
formItemProps.tooltip = child.tooltip;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 构建 otherProps
|
|
161
|
+
var renderOtherProps = {
|
|
162
|
+
label: child.label,
|
|
163
|
+
name: fullName,
|
|
164
|
+
disabled: finalDisabled,
|
|
165
|
+
isView,
|
|
166
|
+
viewEmpty: otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewEmpty,
|
|
167
|
+
valueType: child.valueType,
|
|
168
|
+
form,
|
|
169
|
+
type,
|
|
170
|
+
colProps: {
|
|
171
|
+
span: 24
|
|
172
|
+
},
|
|
173
|
+
// 灵活模式不需要 Col,但需要传递 colProps
|
|
174
|
+
namePath: childNamePath || contextProps.namePath,
|
|
175
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
176
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
177
|
+
// 灵活模式样式属性
|
|
178
|
+
flexibleGroupProps: {
|
|
179
|
+
className: formItemClassName,
|
|
180
|
+
style: formItemStyle
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// 如果 child 来自 FormList 的处理,传递 listName
|
|
185
|
+
if (childListName) {
|
|
186
|
+
renderOtherProps.listName = childListName;
|
|
187
|
+
}
|
|
188
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
|
189
|
+
value: renderOtherProps,
|
|
190
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Render.default, {
|
|
191
|
+
show: child.show,
|
|
192
|
+
form: form,
|
|
193
|
+
disabled: child.disabled,
|
|
194
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
195
|
+
type: type,
|
|
196
|
+
originComponent: child.component,
|
|
197
|
+
component: TargetComponent,
|
|
198
|
+
formItemProps: formItemProps,
|
|
199
|
+
confirm: child.confirm,
|
|
200
|
+
colProps: {
|
|
201
|
+
span: 24
|
|
202
|
+
},
|
|
203
|
+
componentProps: adjustedFieldProps || {},
|
|
204
|
+
otherProps: renderOtherProps,
|
|
205
|
+
fieldProps: child.fieldProps,
|
|
206
|
+
isSelect: false // 由 Render 内部计算
|
|
207
|
+
,
|
|
208
|
+
diffConfig: otherProps === null || otherProps === void 0 ? void 0 : otherProps.diffConfig,
|
|
209
|
+
requiredOnView: otherProps === null || otherProps === void 0 ? void 0 : otherProps.requiredOnView,
|
|
210
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
211
|
+
viewRender: child.viewRender,
|
|
212
|
+
shouldUpdateDebounce: otherProps === null || otherProps === void 0 ? void 0 : otherProps.shouldUpdateDebounce
|
|
213
|
+
})
|
|
214
|
+
}, child.name || `item-${index}`);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// 非compact模式:正常的表单项渲染
|
|
218
|
+
var renderChildren = () => {
|
|
219
|
+
var elements = [];
|
|
220
|
+
var visibleChildren = [];
|
|
221
|
+
|
|
222
|
+
// 先过滤出可见的子项
|
|
223
|
+
children.forEach(child => {
|
|
224
|
+
var childNamePath = child.namePath || contextProps.namePath;
|
|
225
|
+
var childIndex = child.index;
|
|
226
|
+
if ((0, _hooks.checkShouldShow)(child, form, childNamePath, childIndex)) {
|
|
227
|
+
visibleChildren.push(child);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// 只渲染可见的子项
|
|
232
|
+
visibleChildren.forEach((child, index) => {
|
|
233
|
+
// 找到原始索引,用于获取正确的 child 对象和分隔符索引计算
|
|
234
|
+
var originalIndex = children.findIndex(c => c === child);
|
|
235
|
+
|
|
236
|
+
// 渲染表单项
|
|
237
|
+
var formElement = renderFormItem(child, originalIndex);
|
|
238
|
+
elements.push(formElement);
|
|
239
|
+
|
|
240
|
+
// 添加分隔符(除最后一个元素外)
|
|
241
|
+
if (index < visibleChildren.length - 1 && space !== null && space !== void 0 && space.separator) {
|
|
242
|
+
// 检查是否在指定位置添加分隔符
|
|
243
|
+
var shouldAddSeparator = space.separatorIndex ? Array.isArray(space.separatorIndex) ? space.separatorIndex.includes(originalIndex) : space.separatorIndex === originalIndex : true; // 默认每个元素后都加分隔符
|
|
244
|
+
|
|
245
|
+
if (shouldAddSeparator) {
|
|
246
|
+
elements.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
247
|
+
className: "pro-group-separator-space",
|
|
248
|
+
children: space.separator
|
|
249
|
+
}, child.name ? `separator-${child.name}` : `separator-${originalIndex}`));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
return elements;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// compact模式专用:为每个字段创建可见的Form.Item,并使用CSS实现compact视觉效果
|
|
257
|
+
var renderCompactFormItems = () => {
|
|
258
|
+
var elements = [];
|
|
259
|
+
var visibleChildren = [];
|
|
260
|
+
|
|
261
|
+
// 先过滤出可见的子项
|
|
262
|
+
children.forEach(child => {
|
|
263
|
+
var childNamePath = child.namePath || contextProps.namePath;
|
|
264
|
+
var childIndex = child.index;
|
|
265
|
+
if ((0, _hooks.checkShouldShow)(child, form, childNamePath, childIndex)) {
|
|
266
|
+
visibleChildren.push(child);
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// 只渲染可见的子项
|
|
271
|
+
visibleChildren.forEach((child, index) => {
|
|
272
|
+
// 找到原始索引,用于获取正确的 child 对象和分隔符索引计算
|
|
273
|
+
var originalIndex = children.findIndex(c => c === child);
|
|
274
|
+
|
|
275
|
+
// 为每个字段创建独立的Form.Item,确保表单校验正常工作
|
|
276
|
+
var formElement = renderFormItem(child, originalIndex);
|
|
277
|
+
elements.push(formElement);
|
|
278
|
+
|
|
279
|
+
// 添加分隔符
|
|
280
|
+
if (index < visibleChildren.length - 1 && space !== null && space !== void 0 && space.separator) {
|
|
281
|
+
var shouldAddSeparator = space.separatorIndex ? Array.isArray(space.separatorIndex) ? space.separatorIndex.includes(originalIndex) : space.separatorIndex === originalIndex : true;
|
|
282
|
+
if (shouldAddSeparator) {
|
|
283
|
+
elements.push( /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
284
|
+
className: "pro-group-separator-compact",
|
|
285
|
+
children: space.separator
|
|
286
|
+
}, child.name ? `separator-${child.name}` : `separator-${originalIndex}`));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
291
|
+
className: "ant-space ant-space-horizontal ant-space-compact pro-group-compact-container",
|
|
292
|
+
children: elements
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
var nextClassName = (0, _classnames.default)({
|
|
296
|
+
'pro-group': true,
|
|
297
|
+
'pro-group-flexible': true,
|
|
298
|
+
'pro-group-diy-width': children.some(item => {
|
|
299
|
+
var _item$fieldProps;
|
|
300
|
+
return item === null || item === void 0 || (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 || (_item$fieldProps = _item$fieldProps.style) === null || _item$fieldProps === void 0 ? void 0 : _item$fieldProps.width;
|
|
301
|
+
}),
|
|
302
|
+
'pro-group-width-auto': children.some(item => ['Radio', 'Checkbox', 'Switch'].includes(item.type)),
|
|
303
|
+
'pro-group-view': isView,
|
|
304
|
+
[`${className}`]: className
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
// 检查是否有子项包含 show 函数,如果有则需要响应式更新
|
|
308
|
+
var hasShowFunction = children.some(child => (0, _lodash.isFunction)(child.show));
|
|
309
|
+
|
|
310
|
+
// 查看模式下空值处理
|
|
311
|
+
if (isView && (0, _lodash.isEmpty)(children)) {
|
|
312
|
+
return (otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewEmpty) || '-';
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// 渲染内容
|
|
316
|
+
var renderContent = () => {
|
|
317
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
318
|
+
className: nextClassName,
|
|
319
|
+
id: id,
|
|
320
|
+
children: space.compact ?
|
|
321
|
+
// compact模式:使用Form.Item确保表单校验正常工作
|
|
322
|
+
renderCompactFormItems() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Space, {
|
|
323
|
+
align: "start",
|
|
324
|
+
size: space.size || 12,
|
|
325
|
+
separator: isView ? finalSeparator : null,
|
|
326
|
+
children: renderChildren()
|
|
327
|
+
})
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// 如果有 show 函数,使用 Form.Item 的 shouldUpdate 来监听表单值变化
|
|
332
|
+
if (hasShowFunction && form) {
|
|
333
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Form.Item, {
|
|
334
|
+
shouldUpdate: () => true,
|
|
335
|
+
noStyle: true,
|
|
336
|
+
children: renderContent
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
return renderContent();
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* FlexibleGroup主组件
|
|
344
|
+
*/
|
|
345
|
+
var FlexibleGroup = props => {
|
|
346
|
+
var _fieldProps2;
|
|
347
|
+
var propsChildren = props.children;
|
|
348
|
+
|
|
349
|
+
// children可能在props.children或props.fieldProps.children中
|
|
350
|
+
var children = propsChildren || ((_fieldProps2 = props.fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.children) || [];
|
|
351
|
+
|
|
352
|
+
// 配置验证
|
|
353
|
+
if (!utils.validateChildren(children)) {
|
|
354
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorTip, {});
|
|
355
|
+
}
|
|
356
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FlexibleGroupRender, _objectSpread(_objectSpread({}, props), {}, {
|
|
357
|
+
children: children
|
|
358
|
+
}));
|
|
359
|
+
};
|
|
360
|
+
var _default = exports.default = FlexibleGroup;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
|
|
2
2
|
import { FormInstance } from 'antd';
|
|
3
|
-
import type { GroupColumnType, GroupType } from '../propsType';
|
|
3
|
+
import type { GroupColumnType, GroupType, FlexibleGroupColumnType } from '../propsType';
|
|
4
4
|
export type EventArgs = any[];
|
|
5
5
|
interface ColumnsTransformerParams {
|
|
6
6
|
columns: GroupColumnType[];
|
|
@@ -16,4 +16,19 @@ interface ColumnsTransformerParams {
|
|
|
16
16
|
}
|
|
17
17
|
/** 转换columns */
|
|
18
18
|
export declare const useTransformColumns: (params: ColumnsTransformerParams) => any[];
|
|
19
|
+
/**
|
|
20
|
+
* 检查子项是否应该显示(纯函数,不执行副作用)
|
|
21
|
+
*/
|
|
22
|
+
export declare const checkShouldShow: (child: FlexibleGroupColumnType, form: FormInstance, namePath?: NamePath, index?: number) => boolean;
|
|
23
|
+
interface UseResetProEditTableParams {
|
|
24
|
+
children: FlexibleGroupColumnType[];
|
|
25
|
+
form: FormInstance;
|
|
26
|
+
namePath?: NamePath;
|
|
27
|
+
source?: 'FormList' | 'ProEditTable';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* ProEditTable 场景下,当字段的 show 从 true 变为 false 时,自动重置字段值
|
|
31
|
+
* 使用 useEffect 在副作用中执行重置,避免在渲染过程中调用 setState
|
|
32
|
+
*/
|
|
33
|
+
export declare const useResetProEditTable: (params: UseResetProEditTableParams) => void;
|
|
19
34
|
export {};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports.useTransformColumns = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
6
|
+
exports.useTransformColumns = exports.useResetProEditTable = exports.checkShouldShow = void 0;
|
|
9
7
|
var _react = require("react");
|
|
10
8
|
var _lodash = require("lodash");
|
|
11
9
|
var _useDeepCompareMemo = require("../../../../utils/useDeepCompareMemo");
|
|
12
10
|
var _tools = require("../../../../../ProEditTable/utils/tools");
|
|
13
11
|
var _utils = require("../utils");
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
16
|
+
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); } /* eslint-disable no-lonely-if */
|
|
16
17
|
/** 转换columns */
|
|
17
18
|
var useTransformColumns = params => {
|
|
18
19
|
var form = params.form,
|
|
@@ -131,7 +132,6 @@ var useTransformColumns = params => {
|
|
|
131
132
|
form,
|
|
132
133
|
option: args === null || args === void 0 ? void 0 : args[1]
|
|
133
134
|
});
|
|
134
|
-
|
|
135
135
|
// 如果是在可编辑表格或formList内部, 储存当前行的值, 并在变更后更新到表单里
|
|
136
136
|
if (namePath !== null && namePath !== void 0 && namePath.length && !(0, _lodash.isEqual)(originRow, values)) {
|
|
137
137
|
var _Object$keys, _Object$keys$map;
|
|
@@ -166,12 +166,12 @@ var useTransformColumns = params => {
|
|
|
166
166
|
}
|
|
167
167
|
return reactiveProps.disabled || groupProps.disabled;
|
|
168
168
|
};
|
|
169
|
-
return (
|
|
169
|
+
return _objectSpread(_objectSpread(_objectSpread({}, column), {}, {
|
|
170
170
|
name: columnName
|
|
171
171
|
}, reactiveProps), {}, {
|
|
172
172
|
disabled: getLastDisabled(),
|
|
173
173
|
getValueProps: transform === null || transform === void 0 ? void 0 : transform.getValueProps,
|
|
174
|
-
fieldProps: (
|
|
174
|
+
fieldProps: _objectSpread(_objectSpread(_objectSpread({}, column === null || column === void 0 ? void 0 : column.fieldProps), reactiveProps === null || reactiveProps === void 0 ? void 0 : reactiveProps.fieldProps), {}, {
|
|
175
175
|
onChange: handleChange,
|
|
176
176
|
onBlur: handleBlur,
|
|
177
177
|
value: value === null || value === void 0 ? void 0 : value[index]
|
|
@@ -179,4 +179,106 @@ var useTransformColumns = params => {
|
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
|
-
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 检查子项是否应该显示(纯函数,不执行副作用)
|
|
185
|
+
*/
|
|
186
|
+
exports.useTransformColumns = useTransformColumns;
|
|
187
|
+
var checkShouldShow = (child, form, namePath, index) => {
|
|
188
|
+
var show = child.show;
|
|
189
|
+
|
|
190
|
+
// 如果没有配置 show,默认显示
|
|
191
|
+
if (show === undefined || show === true) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// 如果 show 是 false,不显示
|
|
196
|
+
if (show === false) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// 如果 show 是函数,需要获取表单值来评估
|
|
201
|
+
if ((0, _lodash.isFunction)(show)) {
|
|
202
|
+
var values = {};
|
|
203
|
+
if (namePath) {
|
|
204
|
+
// FormList 场景:取当前行数据
|
|
205
|
+
values = form.getFieldValue(namePath) || {};
|
|
206
|
+
} else {
|
|
207
|
+
// 普通场景:取整个表单值
|
|
208
|
+
values = form.getFieldsValue(true);
|
|
209
|
+
}
|
|
210
|
+
return Boolean(show(values, {
|
|
211
|
+
form,
|
|
212
|
+
index,
|
|
213
|
+
namePath
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
return true;
|
|
217
|
+
};
|
|
218
|
+
exports.checkShouldShow = checkShouldShow;
|
|
219
|
+
/**
|
|
220
|
+
* ProEditTable 场景下,当字段的 show 从 true 变为 false 时,自动重置字段值
|
|
221
|
+
* 使用 useEffect 在副作用中执行重置,避免在渲染过程中调用 setState
|
|
222
|
+
*/
|
|
223
|
+
var useResetProEditTable = params => {
|
|
224
|
+
var children = params.children,
|
|
225
|
+
form = params.form,
|
|
226
|
+
namePath = params.namePath,
|
|
227
|
+
source = params.source;
|
|
228
|
+
|
|
229
|
+
// 用于跟踪每个子项的显示状态
|
|
230
|
+
var showStateRef = (0, _react.useRef)(new Map());
|
|
231
|
+
// 用于存储重置定时器
|
|
232
|
+
var resetTimersRef = (0, _react.useRef)(new Map());
|
|
233
|
+
(0, _react.useEffect)(() => {
|
|
234
|
+
// 只在 ProEditTable 场景下执行重置逻辑
|
|
235
|
+
if (source !== 'ProEditTable') {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 检查每个子项的显示状态
|
|
240
|
+
children.forEach(child => {
|
|
241
|
+
var childNamePath = child.namePath || namePath;
|
|
242
|
+
var childIndex = child.index;
|
|
243
|
+
|
|
244
|
+
// 生成唯一 key 用于跟踪状态
|
|
245
|
+
var childKey = child.name ? Array.isArray(child.name) ? `${JSON.stringify(childNamePath)}-${JSON.stringify(child.name)}` : `${JSON.stringify(childNamePath)}-${child.name}` : `child-${children.indexOf(child)}`;
|
|
246
|
+
|
|
247
|
+
// 计算当前显示状态
|
|
248
|
+
var currentShow = checkShouldShow(child, form, childNamePath, childIndex);
|
|
249
|
+
var previousShow = showStateRef.current.get(childKey);
|
|
250
|
+
|
|
251
|
+
// 如果状态发生变化,且从显示变为隐藏,执行重置
|
|
252
|
+
if (previousShow !== undefined && previousShow === true && currentShow === false) {
|
|
253
|
+
// 清除之前的定时器
|
|
254
|
+
var existingTimer = resetTimersRef.current.get(childKey);
|
|
255
|
+
if (existingTimer) {
|
|
256
|
+
clearTimeout(existingTimer);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 延迟执行重置,避免在渲染过程中调用
|
|
260
|
+
var timer = setTimeout(() => {
|
|
261
|
+
if (Array.isArray(child.name)) {
|
|
262
|
+
form.resetFields([[...childNamePath, ...child.name]]);
|
|
263
|
+
} else {
|
|
264
|
+
form.resetFields([[...childNamePath, child.name]]);
|
|
265
|
+
}
|
|
266
|
+
resetTimersRef.current.delete(childKey);
|
|
267
|
+
}, 300);
|
|
268
|
+
resetTimersRef.current.set(childKey, timer);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// 更新显示状态
|
|
272
|
+
showStateRef.current.set(childKey, currentShow);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// 清理函数:组件卸载时清除所有定时器
|
|
276
|
+
return () => {
|
|
277
|
+
resetTimersRef.current.forEach(timer => {
|
|
278
|
+
clearTimeout(timer);
|
|
279
|
+
});
|
|
280
|
+
resetTimersRef.current.clear();
|
|
281
|
+
};
|
|
282
|
+
}, [children, namePath, source, form]);
|
|
283
|
+
};
|
|
284
|
+
exports.useResetProEditTable = useResetProEditTable;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { GroupType } from './propsType';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* render内部能力 show, component, value, onChange, disabled, clearNotShow, fieldProps
|
|
4
|
+
* Group组件 - 支持传统模式和灵活模式
|
|
5
|
+
* - 有names属性 → 传统数组模式(保持向后兼容)
|
|
6
|
+
* - 无names属性 → 新的灵活模式(子组件必须配置name)
|
|
8
7
|
*/
|
|
9
8
|
declare const Group: React.FC<GroupType>;
|
|
10
9
|
export default Group;
|