@zat-design/sisyphus-react 4.0.0-beta.4 → 4.0.0-beta.5
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/dist/index.esm.css +1 -0
- package/dist/index.min.js +1 -0
- package/dist/less.esm.css +1 -0
- package/dist/less.min.js +1 -0
- package/es/FormsProvider/index.js +5 -5
- package/es/ProAction/components/CheckModalContent/index.js +5 -7
- package/es/ProAction/index.js +16 -16
- package/es/ProConfigProvider/index.js +31 -17
- package/es/ProDownload/index.js +13 -12
- package/es/ProDownload/utils.js +15 -15
- package/es/ProDrawerForm/components/ProDrawer/index.js +22 -19
- package/es/ProDrawerForm/components/ProModal/index.js +14 -9
- package/es/ProDrawerForm/index.js +6 -10
- package/es/ProDrawerForm/utils/index.js +1 -1
- package/es/ProEditLabel/components/RenderProForm.js +10 -9
- package/es/ProEditLabel/index.js +36 -24
- package/es/ProEditLabel/utils/index.js +4 -3
- package/es/ProEditTable/components/ActionButton/index.js +58 -56
- package/es/ProEditTable/components/RcTable/BaseTable.js +21 -20
- package/es/ProEditTable/components/RcTable/DraggableTable.js +27 -34
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +40 -46
- package/es/ProEditTable/components/RenderField/index.js +98 -121
- package/es/ProEditTable/components/RenderToolbar/index.js +27 -33
- package/es/ProEditTable/components/Summary/index.js +16 -14
- package/es/ProEditTable/components/Validator/index.js +9 -6
- package/es/ProEditTable/index.js +130 -147
- package/es/ProEditTable/utils/config.js +29 -36
- package/es/ProEditTable/utils/diffOriginal.js +13 -13
- package/es/ProEditTable/utils/getDefaultProps.js +6 -7
- package/es/ProEditTable/utils/index.js +52 -58
- package/es/ProEditTable/utils/tools.js +32 -41
- package/es/ProEditTable/utils/transform.js +7 -11
- package/es/ProEditTable/utils/useEditTableError.js +10 -12
- package/es/ProEnum/components/Group.js +18 -22
- package/es/ProEnum/components/Tag.js +10 -14
- package/es/ProEnum/hooks/useEnum.js +6 -10
- package/es/ProEnum/hooks/useEnumRequest.js +23 -25
- package/es/ProEnum/hooks/useFrequentEnumRequest.d.ts +14 -0
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +76 -0
- package/es/ProEnum/index.js +50 -52
- package/es/ProEnum/propsType.d.ts +29 -0
- package/es/ProEnum/utils/eventCenter.js +20 -31
- package/es/ProEnum/utils/frequentEnum.d.ts +40 -0
- package/es/ProEnum/utils/frequentEnum.js +91 -0
- package/es/ProEnum/utils/getEnumLabel.js +8 -12
- package/es/ProEnum/utils/index.js +6 -6
- package/es/ProForm/components/Container.js +4 -3
- package/es/ProForm/components/FormFooter/index.js +16 -13
- package/es/ProForm/components/base/Checkbox/index.js +10 -11
- package/es/ProForm/components/base/DatePicker/index.js +8 -7
- package/es/ProForm/components/base/DatePicker/useDateLimit.js +2 -4
- package/es/ProForm/components/base/Input/index.js +24 -20
- package/es/ProForm/components/base/InputNumber/index.js +21 -18
- package/es/ProForm/components/base/Radio/index.js +11 -12
- package/es/ProForm/components/base/RangePicker/index.js +9 -12
- package/es/ProForm/components/base/RangePicker/useDateRange.js +3 -3
- package/es/ProForm/components/base/Select/index.js +9 -8
- package/es/ProForm/components/base/Switch/index.js +7 -6
- package/es/ProForm/components/base/SwitchCheckbox/index.js +7 -6
- package/es/ProForm/components/base/TextArea/index.js +9 -8
- package/es/ProForm/components/base/TimePicker/index.js +5 -4
- package/es/ProForm/components/combination/Container/index.js +12 -12
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +60 -70
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +11 -7
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/es/ProForm/components/combination/FormList/components/Empty.js +9 -10
- package/es/ProForm/components/combination/FormList/components/LineFields.js +10 -9
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +32 -36
- package/es/ProForm/components/combination/FormList/index.js +25 -33
- package/es/ProForm/components/combination/FormList/utils.js +5 -7
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +1 -1
- package/es/ProForm/components/combination/Group/component/ComRender.js +14 -14
- package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -1
- package/es/ProForm/components/combination/Group/hooks/index.js +30 -35
- package/es/ProForm/components/combination/Group/index.js +35 -29
- package/es/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/es/ProForm/components/combination/Group/style/index.less +7 -0
- package/es/ProForm/components/combination/Group/utils.d.ts +0 -1
- package/es/ProForm/components/combination/Group/utils.js +38 -39
- package/es/ProForm/components/combination/ProCascader/index.js +43 -52
- package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +16 -16
- package/es/ProForm/components/combination/ProModalSelect/index.js +102 -108
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +73 -47
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +3 -2
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +20 -18
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +3 -3
- package/es/ProForm/components/combination/ProTimeLimit/index.js +17 -15
- package/es/ProForm/components/render/ChangedWrapper.js +24 -26
- package/es/ProForm/components/render/ConfirmWrapper.js +10 -11
- package/es/ProForm/components/render/Render.js +107 -102
- package/es/ProForm/components/render/RenderFields.d.ts +0 -1
- package/es/ProForm/components/render/RenderFields.js +22 -24
- package/es/ProForm/index.js +44 -45
- package/es/ProForm/propsType.d.ts +1 -4
- package/es/ProForm/utils/diffOriginal.js +9 -9
- package/es/ProForm/utils/getDefaultProps.js +5 -5
- package/es/ProForm/utils/index.js +62 -90
- package/es/ProForm/utils/processDependencies.js +4 -5
- package/es/ProForm/utils/rulesCreator.js +12 -12
- package/es/ProForm/utils/transformNames.js +2 -2
- package/es/ProForm/utils/transformValue.js +6 -8
- package/es/ProForm/utils/useDeepCompareMemo.js +1 -1
- package/es/ProForm/utils/useFieldProps.js +1 -3
- package/es/ProForm/utils/useForm.js +19 -21
- package/es/ProForm/utils/useRules.js +17 -22
- package/es/ProForm/utils/useShouldUpdate.js +79 -83
- package/es/ProForm/utils/useWatch.js +12 -12
- package/es/ProForm/utils/valueType.js +46 -50
- package/es/ProIcon/index.js +30 -31
- package/es/ProIcon/utils/index.js +5 -5
- package/es/ProLayout/components/Layout/Header/index.js +1 -1
- package/es/ProLayout/components/Layout/Icon/Icon.js +4 -4
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -22
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +23 -30
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -3
- package/es/ProLayout/components/Layout/Menu/index.js +9 -9
- package/es/ProLayout/components/Layout/Notice/index.js +3 -3
- package/es/ProLayout/components/ProCollapse/index.js +23 -18
- package/es/ProLayout/components/ProFooter/index.js +13 -14
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +6 -5
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +6 -5
- package/es/ProLayout/components/ProHeader/index.js +68 -59
- package/es/ProLayout/components/ProHeader/utils/index.js +1 -1
- package/es/ProLayout/index.js +33 -32
- package/es/ProLayout/utils/index.js +17 -18
- package/es/ProSelect/components/AdaptiveTooltip.js +8 -9
- package/es/ProSelect/index.js +57 -64
- package/es/ProSelect/utils/index.js +17 -28
- package/es/ProStep/components/Anchor/index.js +10 -9
- package/es/ProStep/components/Item/index.js +11 -11
- package/es/ProStep/components/Listener/index.js +6 -10
- package/es/ProStep/components/Step/index.js +9 -11
- package/es/ProStep/index.js +24 -30
- package/es/ProStep/utils/index.js +8 -8
- package/es/ProStepTab/index.js +27 -28
- package/es/ProTable/components/FormatColumn/index.js +54 -59
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +6 -7
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +21 -37
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +16 -17
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +5 -6
- package/es/ProTable/components/RenderColumn/index.js +36 -35
- package/es/ProTable/components/RenderEmptyText/index.js +1 -1
- package/es/ProTable/components/RenderFooter/index.js +2 -2
- package/es/ProTable/components/RenderSummary/index.js +13 -12
- package/es/ProTable/components/RenderTableHeader/index.js +5 -4
- package/es/ProTable/components/RenderTabs/index.js +26 -29
- package/es/ProTable/components/TableResizable/index.js +8 -8
- package/es/ProTable/components/TooltipTitle/index.js +4 -3
- package/es/ProTable/hooks/useAntdTable.js +80 -95
- package/es/ProTable/index.js +110 -133
- package/es/ProTable/propsType.d.ts +9 -3
- package/es/ProTable/utils/index.js +13 -16
- package/es/ProTabs/components/Card/index.js +14 -8
- package/es/ProTabs/index.js +30 -20
- package/es/ProTabs/propType.d.ts +5 -0
- package/es/ProTabs/style/index.less +40 -3
- package/es/ProThemeTools/component/ProTools/index.js +46 -39
- package/es/ProThemeTools/context/ThemeContext.js +13 -13
- package/es/ProThemeTools/index.js +18 -19
- package/es/ProThemeTools/utils/index.js +14 -18
- package/es/ProTooltip/index.js +24 -27
- package/es/ProTree/components/AdaptiveTooltip.js +5 -6
- package/es/ProTree/components/List.js +10 -13
- package/es/ProTree/components/ProTree.js +47 -64
- package/es/ProTree/components/ProTreeSelect/index.js +77 -76
- package/es/ProTree/components/Tree.js +23 -22
- package/es/ProTree/index.js +1 -1
- package/es/ProTree/utils.js +14 -14
- package/es/ProTreeModal/components/Cascader.js +13 -16
- package/es/ProTreeModal/components/List.js +49 -70
- package/es/ProTreeModal/components/SortableItem.js +7 -8
- package/es/ProTreeModal/components/Tree.js +18 -23
- package/es/ProTreeModal/components/Trigger.js +15 -10
- package/es/ProTreeModal/index.js +98 -151
- package/es/ProTreeModal/utils.js +21 -21
- package/es/ProUpload/components/ButtonRender.js +11 -12
- package/es/ProUpload/components/DragRender.js +17 -20
- package/es/ProUpload/components/DraggableUploadListItem.js +2 -2
- package/es/ProUpload/components/Example.js +3 -3
- package/es/ProUpload/components/FileItem.js +30 -25
- package/es/ProUpload/components/ImageRender.js +29 -22
- package/es/ProUpload/index.js +55 -66
- package/es/ProUpload/uitls.js +2 -2
- package/es/ProUtils/utils/index.js +10 -14
- package/es/ProViewer/index.js +22 -19
- package/es/ProViewer/propsType.js +0 -3
- package/es/ProWaterMark/index.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/locale/index.js +2 -2
- package/es/style/index.less +1 -1
- package/es/style/theme/base.less +1 -0
- package/es/utils/index.js +11 -13
- package/lib/FormsProvider/index.js +30 -50
- package/lib/ProAction/components/CheckModalContent/index.js +31 -27
- package/lib/ProAction/index.js +194 -151
- package/lib/ProAction/propsType.js +4 -16
- package/lib/ProConfigProvider/index.js +136 -136
- package/lib/ProDownload/index.js +192 -124
- package/lib/ProDownload/propsType.js +4 -16
- package/lib/ProDownload/utils.js +189 -143
- package/lib/ProDrawerForm/components/ProDrawer/index.js +243 -169
- package/lib/ProDrawerForm/components/ProModal/index.js +194 -134
- package/lib/ProDrawerForm/components/index.js +17 -39
- package/lib/ProDrawerForm/index.js +79 -88
- package/lib/ProDrawerForm/propsType.js +4 -16
- package/lib/ProDrawerForm/utils/index.js +13 -30
- package/lib/ProEditLabel/components/RenderProForm.js +58 -57
- package/lib/ProEditLabel/index.js +251 -178
- package/lib/ProEditLabel/propsType.js +4 -16
- package/lib/ProEditLabel/utils/index.js +11 -26
- package/lib/ProEditTable/components/ActionButton/index.js +144 -155
- package/lib/ProEditTable/components/RcTable/BaseTable.js +97 -96
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +172 -151
- package/lib/ProEditTable/components/RcTable/index.js +17 -39
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +177 -176
- package/lib/ProEditTable/components/RenderField/index.js +628 -539
- package/lib/ProEditTable/components/RenderToolbar/index.js +119 -105
- package/lib/ProEditTable/components/Summary/index.js +70 -61
- package/lib/ProEditTable/components/Validator/index.js +30 -47
- package/lib/ProEditTable/components/index.js +38 -48
- package/lib/ProEditTable/index.js +379 -324
- package/lib/ProEditTable/propsType.js +4 -16
- package/lib/ProEditTable/utils/config.js +225 -170
- package/lib/ProEditTable/utils/diffOriginal.js +93 -80
- package/lib/ProEditTable/utils/getDefaultProps.js +26 -42
- package/lib/ProEditTable/utils/index.js +318 -244
- package/lib/ProEditTable/utils/tools.js +438 -243
- package/lib/ProEditTable/utils/transform.js +15 -28
- package/lib/ProEditTable/utils/useEditTableError.js +65 -54
- package/lib/ProEnum/components/Group.js +53 -81
- package/lib/ProEnum/components/Tag.js +37 -54
- package/lib/ProEnum/hooks/useEnum.js +72 -52
- package/lib/ProEnum/hooks/useEnumRequest.js +267 -194
- package/lib/ProEnum/hooks/useFrequentEnumRequest.d.ts +14 -0
- package/lib/ProEnum/hooks/useFrequentEnumRequest.js +83 -0
- package/lib/ProEnum/index.js +239 -234
- package/lib/ProEnum/propsType.d.ts +29 -0
- package/lib/ProEnum/propsType.js +4 -16
- package/lib/ProEnum/utils/eventCenter.js +15 -12
- package/lib/ProEnum/utils/frequentEnum.d.ts +40 -0
- package/lib/ProEnum/utils/frequentEnum.js +99 -0
- package/lib/ProEnum/utils/getEnumLabel.js +57 -65
- package/lib/ProEnum/utils/index.js +98 -68
- package/lib/ProForm/components/Container.js +35 -45
- package/lib/ProForm/components/FormFooter/index.js +67 -80
- package/lib/ProForm/components/FormFooter/propsType.js +4 -16
- package/lib/ProForm/components/base/Checkbox/index.js +67 -62
- package/lib/ProForm/components/base/DatePicker/index.js +63 -74
- package/lib/ProForm/components/base/DatePicker/useDateLimit.js +13 -29
- package/lib/ProForm/components/base/Input/index.js +65 -73
- package/lib/ProForm/components/base/Input/propsType.js +4 -16
- package/lib/ProForm/components/base/InputNumber/index.js +230 -176
- package/lib/ProForm/components/base/Radio/index.js +60 -69
- package/lib/ProForm/components/base/RangePicker/index.js +73 -88
- package/lib/ProForm/components/base/RangePicker/useDateRange.js +28 -45
- package/lib/ProForm/components/base/Select/index.js +63 -69
- package/lib/ProForm/components/base/Switch/index.js +43 -59
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +63 -62
- package/lib/ProForm/components/base/TextArea/index.js +52 -65
- package/lib/ProForm/components/base/TimePicker/index.js +45 -59
- package/lib/ProForm/components/combination/Container/index.js +58 -72
- package/lib/ProForm/components/combination/Container/propsType.js +4 -16
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +240 -195
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +85 -107
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +25 -44
- package/lib/ProForm/components/combination/FormList/components/Empty.js +92 -55
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +92 -117
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +133 -101
- package/lib/ProForm/components/combination/FormList/index.js +131 -164
- package/lib/ProForm/components/combination/FormList/propsType.js +4 -16
- package/lib/ProForm/components/combination/FormList/utils.js +32 -52
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +23 -38
- package/lib/ProForm/components/combination/Group/component/ComRender.js +78 -74
- package/lib/ProForm/components/combination/Group/hooks/index.d.ts +0 -1
- package/lib/ProForm/components/combination/Group/hooks/index.js +123 -123
- package/lib/ProForm/components/combination/Group/index.js +99 -104
- package/lib/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/propsType.js +4 -16
- package/lib/ProForm/components/combination/Group/style/index.less +7 -0
- package/lib/ProForm/components/combination/Group/utils.d.ts +0 -1
- package/lib/ProForm/components/combination/Group/utils.js +132 -104
- package/lib/ProForm/components/combination/ProCascader/index.js +271 -226
- package/lib/ProForm/components/combination/ProCascader/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +23 -33
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +113 -114
- package/lib/ProForm/components/combination/ProModalSelect/index.js +651 -472
- package/lib/ProForm/components/combination/ProModalSelect/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +21 -43
- package/lib/ProForm/components/combination/ProNumberRange/index.js +207 -160
- package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +169 -139
- package/lib/ProForm/components/combination/ProRangeLimit/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +28 -49
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +150 -127
- package/lib/ProForm/components/index.js +192 -115
- package/lib/ProForm/components/render/ChangedWrapper.js +130 -141
- package/lib/ProForm/components/render/ConfirmWrapper.js +120 -78
- package/lib/ProForm/components/render/Render.js +445 -346
- package/lib/ProForm/components/render/RenderFields.d.ts +0 -1
- package/lib/ProForm/components/render/RenderFields.js +195 -181
- package/lib/ProForm/components/render/propsType.js +31 -17
- package/lib/ProForm/index.js +282 -235
- package/lib/ProForm/propsType.d.ts +1 -4
- package/lib/ProForm/propsType.js +9 -38
- package/lib/ProForm/utils/diffOriginal.js +88 -81
- package/lib/ProForm/utils/getDefaultProps.js +26 -42
- package/lib/ProForm/utils/index.js +330 -254
- package/lib/ProForm/utils/processDependencies.js +61 -44
- package/lib/ProForm/utils/rulesCreator.js +58 -81
- package/lib/ProForm/utils/transformNames.js +26 -37
- package/lib/ProForm/utils/transformValue.js +47 -47
- package/lib/ProForm/utils/useDeepCompareMemo.js +15 -34
- package/lib/ProForm/utils/useFieldProps.js +10 -42
- package/lib/ProForm/utils/useForm.js +226 -118
- package/lib/ProForm/utils/useRules.js +50 -60
- package/lib/ProForm/utils/useShouldUpdate.js +233 -126
- package/lib/ProForm/utils/useWatch.js +122 -93
- package/lib/ProForm/utils/valueType.js +222 -155
- package/lib/ProIcon/config/index.js +278 -365
- package/lib/ProIcon/index.js +217 -184
- package/lib/ProIcon/propsTypes.js +4 -16
- package/lib/ProIcon/symbolIcon.js +30 -23
- package/lib/ProIcon/utils/index.js +53 -60
- package/lib/ProLayout/components/Layout/Header/index.js +42 -59
- package/lib/ProLayout/components/Layout/Icon/Icon.js +31 -49
- package/lib/ProLayout/components/Layout/Icon/index.js +7 -34
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +170 -139
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +135 -117
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +4 -16
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +44 -60
- package/lib/ProLayout/components/Layout/Menu/index.js +52 -71
- package/lib/ProLayout/components/Layout/Notice/index.js +31 -39
- package/lib/ProLayout/components/Layout/index.js +31 -45
- package/lib/ProLayout/components/ProCollapse/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProCollapse/index.js +159 -148
- package/lib/ProLayout/components/ProFooter/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProFooter/index.js +41 -56
- package/lib/ProLayout/components/ProHeader/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +26 -53
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +27 -48
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +4 -16
- package/lib/ProLayout/components/ProHeader/components/index.js +17 -39
- package/lib/ProLayout/components/ProHeader/index.js +466 -268
- package/lib/ProLayout/components/ProHeader/utils/index.js +14 -31
- package/lib/ProLayout/components/index.js +24 -42
- package/lib/ProLayout/index.js +139 -130
- package/lib/ProLayout/propTypes.js +4 -16
- package/lib/ProLayout/utils/index.js +120 -86
- package/lib/ProSelect/components/AdaptiveTooltip.js +38 -45
- package/lib/ProSelect/index.js +240 -213
- package/lib/ProSelect/propsType.js +4 -16
- package/lib/ProSelect/utils/index.js +114 -93
- package/lib/ProStep/components/Anchor/index.js +102 -107
- package/lib/ProStep/components/Item/index.js +71 -75
- package/lib/ProStep/components/Listener/index.js +69 -62
- package/lib/ProStep/components/Step/index.js +65 -75
- package/lib/ProStep/index.js +227 -165
- package/lib/ProStep/propsType.js +4 -16
- package/lib/ProStep/utils/index.js +54 -57
- package/lib/ProStepTab/index.js +307 -166
- package/lib/ProStepTab/propsType.js +4 -16
- package/lib/ProTable/components/FormatColumn/index.js +472 -425
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +39 -53
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +183 -135
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +85 -104
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +4 -16
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +58 -80
- package/lib/ProTable/components/RcTable/index.js +17 -39
- package/lib/ProTable/components/RenderColumn/index.js +203 -194
- package/lib/ProTable/components/RenderEmptyText/index.js +25 -27
- package/lib/ProTable/components/RenderFooter/index.js +17 -33
- package/lib/ProTable/components/RenderSummary/index.js +57 -46
- package/lib/ProTable/components/RenderTableHeader/index.js +62 -68
- package/lib/ProTable/components/RenderTabs/index.js +67 -80
- package/lib/ProTable/components/TableResizable/index.js +87 -87
- package/lib/ProTable/components/TooltipTitle/index.js +27 -40
- package/lib/ProTable/components/index.js +45 -51
- package/lib/ProTable/hooks/useAntdTable.js +351 -304
- package/lib/ProTable/index.js +354 -333
- package/lib/ProTable/propsType.d.ts +9 -3
- package/lib/ProTable/propsType.js +4 -16
- package/lib/ProTable/utils/index.js +89 -78
- package/lib/ProTabs/components/Card/index.js +57 -30
- package/lib/ProTabs/components/index.js +10 -36
- package/lib/ProTabs/index.js +94 -89
- package/lib/ProTabs/propType.d.ts +5 -0
- package/lib/ProTabs/propType.js +4 -16
- package/lib/ProTabs/style/index.less +40 -3
- package/lib/ProThemeTools/component/ProTools/index.js +246 -198
- package/lib/ProThemeTools/component/index.js +10 -36
- package/lib/ProThemeTools/context/ThemeContext.js +99 -89
- package/lib/ProThemeTools/index.js +207 -172
- package/lib/ProThemeTools/propsType.js +4 -16
- package/lib/ProThemeTools/utils/index.js +84 -80
- package/lib/ProTooltip/index.js +217 -214
- package/lib/ProTooltip/propsType.js +4 -16
- package/lib/ProTree/components/AdaptiveTooltip.js +22 -33
- package/lib/ProTree/components/CloseIcon.js +31 -36
- package/lib/ProTree/components/List.js +69 -68
- package/lib/ProTree/components/ProTree.js +346 -258
- package/lib/ProTree/components/ProTreeSelect/index.js +460 -336
- package/lib/ProTree/components/ProTreeSelect/propsType.js +4 -16
- package/lib/ProTree/components/SearchTitle.js +50 -47
- package/lib/ProTree/components/Tree.js +300 -227
- package/lib/ProTree/components/index.js +31 -45
- package/lib/ProTree/index.js +22 -45
- package/lib/ProTree/propsType.js +4 -16
- package/lib/ProTree/utils.js +140 -79
- package/lib/ProTreeModal/components/Cascader.js +90 -97
- package/lib/ProTreeModal/components/CloseIcon.js +31 -36
- package/lib/ProTreeModal/components/List.js +246 -192
- package/lib/ProTreeModal/components/SearchTitle.js +22 -30
- package/lib/ProTreeModal/components/SortableItem.js +59 -60
- package/lib/ProTreeModal/components/Tree.js +171 -157
- package/lib/ProTreeModal/components/Trigger.js +131 -108
- package/lib/ProTreeModal/components/index.js +45 -51
- package/lib/ProTreeModal/index.js +523 -448
- package/lib/ProTreeModal/propsType.js +4 -16
- package/lib/ProTreeModal/utils.js +160 -99
- package/lib/ProUpload/components/ButtonRender.js +106 -85
- package/lib/ProUpload/components/DragRender.js +167 -117
- package/lib/ProUpload/components/DraggableUploadListItem.js +32 -48
- package/lib/ProUpload/components/Example.js +39 -55
- package/lib/ProUpload/components/FileItem.js +215 -113
- package/lib/ProUpload/components/ImageRender.js +250 -175
- package/lib/ProUpload/index.js +185 -181
- package/lib/ProUpload/propsType.js +4 -16
- package/lib/ProUpload/uitls.js +9 -31
- package/lib/ProUtils/utils/index.js +20 -36
- package/lib/ProViewer/index.js +210 -175
- package/lib/ProViewer/propsType.js +1 -17
- package/lib/ProWaterMark/index.js +20 -38
- package/lib/ProWaterMark/propsType.js +4 -16
- package/lib/index.d.ts +1 -1
- package/lib/index.js +272 -123
- package/lib/locale/en_US.js +127 -145
- package/lib/locale/index.js +40 -55
- package/lib/locale/zh_CN.js +128 -146
- package/lib/style/index.less +1 -1
- package/lib/style/theme/base.less +1 -0
- package/lib/tokens.js +87 -103
- package/lib/utils/index.js +66 -88
- package/package.json +7 -7
- package/dist/esm/index.d.ts +0 -5
- package/dist/esm/index.js +0 -5
- package/dist/esm/regExp/index.d.ts +0 -19
- package/dist/esm/regExp/index.js +0 -73
- package/dist/esm/tools/calc/index.d.ts +0 -4
- package/dist/esm/tools/calc/index.js +0 -67
- package/dist/esm/tools/dateUtils.d.ts +0 -7
- package/dist/esm/tools/dateUtils.js +0 -23
- package/dist/esm/tools/disableDate/index.d.ts +0 -9
- package/dist/esm/tools/disableDate/index.js +0 -43
- package/dist/esm/tools/disableTimeRange/index.d.ts +0 -9
- package/dist/esm/tools/disableTimeRange/index.js +0 -121
- package/dist/esm/tools/formatAmount/index.d.ts +0 -7
- package/dist/esm/tools/formatAmount/index.js +0 -14
- package/dist/esm/tools/formatPerMill/index.d.ts +0 -7
- package/dist/esm/tools/formatPerMill/index.js +0 -11
- package/dist/esm/tools/formatPercent/index.d.ts +0 -7
- package/dist/esm/tools/formatPercent/index.js +0 -11
- package/dist/esm/tools/getDataByIdCard/index.d.ts +0 -16
- package/dist/esm/tools/getDataByIdCard/index.js +0 -65
- package/dist/esm/tools/index.d.ts +0 -12
- package/dist/esm/tools/index.js +0 -14
- package/dist/esm/tools/sumAmount/index.d.ts +0 -16
- package/dist/esm/tools/sumAmount/index.js +0 -40
- package/dist/esm/tools/toChineseNum/index.d.ts +0 -7
- package/dist/esm/tools/toChineseNum/index.js +0 -103
- package/dist/esm/tools/toFixed/index.d.ts +0 -2
- package/dist/esm/tools/toFixed/index.js +0 -5
- package/dist/esm/tools/transformDataName/index.d.ts +0 -12
- package/dist/esm/tools/transformDataName/index.js +0 -37
- package/dist/esm/transforms/dateTransformer/index.d.ts +0 -24
- package/dist/esm/transforms/dateTransformer/index.js +0 -67
- package/dist/esm/transforms/index.d.ts +0 -6
- package/dist/esm/transforms/index.js +0 -6
- package/dist/esm/transforms/propTypes.d.ts +0 -7
- package/dist/esm/transforms/propTypes.js +0 -1
- package/dist/esm/transforms/transformDate/index.d.ts +0 -21
- package/dist/esm/transforms/transformDate/index.js +0 -141
- package/dist/esm/transforms/transformDatePicker/index.d.ts +0 -12
- package/dist/esm/transforms/transformDatePicker/index.js +0 -24
- package/dist/esm/transforms/transformRangePicker/index.d.ts +0 -29
- package/dist/esm/transforms/transformRangePicker/index.js +0 -61
- package/dist/esm/transforms/transformSwitch/index.d.ts +0 -13
- package/dist/esm/transforms/transformSwitch/index.js +0 -35
- package/dist/esm/transforms/utils.d.ts +0 -2
- package/dist/esm/transforms/utils.js +0 -8
- package/dist/esm/validate/index.d.ts +0 -107
- package/dist/esm/validate/index.js +0 -284
- package/tests/__mocks__/fileMock.js +0 -1
- package/tests/__mocks__/zatUtils.js +0 -27
- package/tests/setup.ts +0 -484
- package/tests/test-utils.tsx +0 -81
package/lib/ProStepTab/index.js
CHANGED
@@ -1,199 +1,330 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
28
|
-
|
29
|
-
// src/ProStepTab/index.ts
|
30
|
-
var ProStepTab_exports = {};
|
31
|
-
__export(ProStepTab_exports, {
|
32
|
-
default: () => ProStepTab_default,
|
33
|
-
useStepTab: () => useStepTab,
|
34
|
-
useStepTabInstance: () => useStepTabInstance
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
35
7
|
});
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
var
|
8
|
+
exports.default = void 0;
|
9
|
+
exports.useStepTab = useStepTab;
|
10
|
+
exports.useStepTabInstance = useStepTabInstance;
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
13
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
17
|
+
var _lodash = require("lodash");
|
18
|
+
var _excluded = ["children"];
|
19
|
+
// 存储当前的 StepTab 实例
|
20
|
+
var StepTabInstanceContext = /*#__PURE__*/(0, _react.createContext)(null);
|
21
|
+
|
22
|
+
/**
|
23
|
+
* 使用原生 JS 获取 URL 搜索参数
|
24
|
+
* @returns 当前 URL 的搜索参数和路径
|
25
|
+
*/
|
40
26
|
var useNativeLocation = () => {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
27
|
+
var _useState = (0, _react.useState)({
|
28
|
+
search: window.location.search,
|
29
|
+
pathname: window.location.pathname
|
30
|
+
}),
|
31
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
32
|
+
location = _useState2[0],
|
33
|
+
setLocation = _useState2[1];
|
34
|
+
|
35
|
+
// 监听 popstate 事件,更新 location 状态
|
36
|
+
(0, _react.useEffect)(() => {
|
37
|
+
var handleLocationChange = () => {
|
47
38
|
setLocation({
|
48
39
|
search: window.location.search,
|
49
40
|
pathname: window.location.pathname
|
50
41
|
});
|
51
42
|
};
|
52
|
-
window.addEventListener(
|
43
|
+
window.addEventListener('popstate', handleLocationChange);
|
53
44
|
return () => {
|
54
|
-
window.removeEventListener(
|
45
|
+
window.removeEventListener('popstate', handleLocationChange);
|
55
46
|
};
|
56
47
|
}, []);
|
57
48
|
return location;
|
58
49
|
};
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
50
|
+
|
51
|
+
/**
|
52
|
+
* 步骤化Tab管理钩子,用于管理多步骤表单或流程的切换和验证
|
53
|
+
*
|
54
|
+
* @param {ProStepTabType} props 配置参数
|
55
|
+
* @returns {ProStepTabResultType} 返回步骤Tab相关方法和状态
|
56
|
+
*/
|
57
|
+
function useStepTab() {
|
58
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
59
|
+
var _props$routerKeep = props.routerKeep,
|
60
|
+
routerKeep = _props$routerKeep === void 0 ? false : _props$routerKeep,
|
61
|
+
_props$routerSearchKe = props.routerSearchKey,
|
62
|
+
routerSearchKey = _props$routerSearchKe === void 0 ? 'tab' : _props$routerSearchKe,
|
63
|
+
_props$validate = props.validate,
|
64
|
+
validate = _props$validate === void 0 ? true : _props$validate,
|
65
|
+
onBeforeChange = props.onBeforeChange,
|
66
|
+
onAfterChange = props.onAfterChange,
|
67
|
+
defaultActiveKey = props.defaultActiveKey,
|
68
|
+
_props$defaultStep = props.defaultStep,
|
69
|
+
defaultStep = _props$defaultStep === void 0 ? 1 : _props$defaultStep,
|
70
|
+
queueSteps = props.queueSteps,
|
71
|
+
_props$autoNext = props.autoNext,
|
72
|
+
autoNext = _props$autoNext === void 0 ? false : _props$autoNext;
|
73
|
+
|
74
|
+
// 内部状态,避免全局污染
|
75
|
+
var _useState3 = (0, _react.useState)({}),
|
76
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
77
|
+
handlesState = _useState4[0],
|
78
|
+
setHandlesState = _useState4[1];
|
79
|
+
var location = useNativeLocation();
|
80
|
+
|
81
|
+
// 获取初始激活的tab key
|
82
|
+
var getInitialActiveKey = (0, _react.useCallback)(() => {
|
74
83
|
if (routerKeep) {
|
75
|
-
|
76
|
-
|
84
|
+
var urlSearchParams = new URLSearchParams(location.search);
|
85
|
+
var tabValue = urlSearchParams.get(routerSearchKey);
|
77
86
|
if (tabValue) {
|
78
87
|
return tabValue;
|
79
88
|
}
|
80
89
|
}
|
81
|
-
return defaultActiveKey ||
|
90
|
+
return defaultActiveKey || '1';
|
82
91
|
}, [routerKeep, routerSearchKey, location.search, defaultActiveKey]);
|
83
|
-
|
92
|
+
|
93
|
+
// 获取初始激活的步骤
|
94
|
+
var getInitialStep = (0, _react.useCallback)(() => {
|
84
95
|
if (routerKeep) {
|
85
|
-
|
86
|
-
|
87
|
-
|
96
|
+
var urlSearchParams = new URLSearchParams(location.search);
|
97
|
+
var stepValue = urlSearchParams.get(routerSearchKey);
|
98
|
+
// 如果stepValue是数字,则返回数字
|
99
|
+
if (stepValue && !(0, _lodash.isNaN)(Number(stepValue))) {
|
88
100
|
return Number(stepValue);
|
89
101
|
}
|
90
102
|
}
|
91
103
|
return defaultStep;
|
92
104
|
}, [routerKeep, routerSearchKey, location.search, defaultStep]);
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
105
|
+
var _useState5 = (0, _react.useState)(getInitialActiveKey()),
|
106
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
107
|
+
activeKey = _useState6[0],
|
108
|
+
setActiveKeyState = _useState6[1];
|
109
|
+
var _useState7 = (0, _react.useState)(getInitialStep()),
|
110
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
111
|
+
step = _useState8[0],
|
112
|
+
setStepState = _useState8[1]; // 当前已激活步骤
|
113
|
+
var _useState9 = (0, _react.useState)(false),
|
114
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
115
|
+
loading = _useState10[0],
|
116
|
+
setLoading = _useState10[1];
|
117
|
+
|
118
|
+
// 同步URL参数
|
119
|
+
(0, _react.useEffect)(() => {
|
97
120
|
if (routerKeep && activeKey) {
|
98
|
-
|
121
|
+
// 更新URL参数
|
122
|
+
var urlSearchParams = new URLSearchParams(location.search);
|
99
123
|
urlSearchParams.set(routerSearchKey, activeKey);
|
100
|
-
|
101
|
-
|
124
|
+
|
125
|
+
// 使用原生 history API 更新 URL
|
126
|
+
var newUrl = `${location.pathname}?${urlSearchParams.toString()}`;
|
127
|
+
window.history.replaceState(null, '', newUrl);
|
102
128
|
}
|
103
129
|
}, [activeKey, routerKeep, routerSearchKey, location]);
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
130
|
+
|
131
|
+
// 创建一个包装函数,自动处理loading状态
|
132
|
+
var wrapHandleWithLoading = (0, _react.useCallback)(fn => {
|
133
|
+
return /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
134
|
+
var result;
|
135
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
136
|
+
while (1) switch (_context.prev = _context.next) {
|
137
|
+
case 0:
|
138
|
+
setLoading(true);
|
139
|
+
_context.prev = 1;
|
140
|
+
_context.next = 4;
|
141
|
+
return fn();
|
142
|
+
case 4:
|
143
|
+
result = _context.sent;
|
144
|
+
setLoading(false);
|
145
|
+
return _context.abrupt("return", result);
|
146
|
+
case 9:
|
147
|
+
_context.prev = 9;
|
148
|
+
_context.t0 = _context["catch"](1);
|
149
|
+
setLoading(false);
|
150
|
+
return _context.abrupt("return", false);
|
151
|
+
case 13:
|
152
|
+
case "end":
|
153
|
+
return _context.stop();
|
154
|
+
}
|
155
|
+
}, _callee, null, [[1, 9]]);
|
156
|
+
}));
|
116
157
|
}, []);
|
117
|
-
|
118
|
-
|
119
|
-
|
158
|
+
|
159
|
+
// 注册步骤处理函数
|
160
|
+
var registerHandle = (0, _react.useCallback)((key, handler) => {
|
161
|
+
// 使用wrapHandleWithLoading包装处理函数
|
162
|
+
setHandlesState(prev => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), {}, {
|
120
163
|
[key]: wrapHandleWithLoading(handler)
|
121
164
|
}));
|
122
165
|
}, [wrapHandleWithLoading]);
|
123
|
-
|
166
|
+
|
167
|
+
// 获取步骤处理函数
|
168
|
+
var getHandle = (0, _react.useCallback)(key => {
|
124
169
|
return handlesState[key];
|
125
170
|
}, [handlesState]);
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
171
|
+
|
172
|
+
// 处理表单验证和切换(内部使用)
|
173
|
+
var validateAndChange = (0, _react.useCallback)( /*#__PURE__*/function () {
|
174
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(targetKey) {
|
175
|
+
var currentHandler, handleResult, beforeResult;
|
176
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
177
|
+
while (1) switch (_context2.prev = _context2.next) {
|
178
|
+
case 0:
|
179
|
+
if (!(targetKey === activeKey)) {
|
180
|
+
_context2.next = 2;
|
181
|
+
break;
|
182
|
+
}
|
183
|
+
return _context2.abrupt("return", true);
|
184
|
+
case 2:
|
185
|
+
_context2.prev = 2;
|
186
|
+
// 执行当前步骤的保存处理, 如果validate为true,则执行验证
|
187
|
+
currentHandler = handlesState[activeKey];
|
188
|
+
if (!(currentHandler && validate)) {
|
189
|
+
_context2.next = 10;
|
190
|
+
break;
|
191
|
+
}
|
192
|
+
_context2.next = 7;
|
193
|
+
return currentHandler();
|
194
|
+
case 7:
|
195
|
+
handleResult = _context2.sent;
|
196
|
+
if (handleResult) {
|
197
|
+
_context2.next = 10;
|
198
|
+
break;
|
199
|
+
}
|
200
|
+
return _context2.abrupt("return", false);
|
201
|
+
case 10:
|
202
|
+
if (!onBeforeChange) {
|
203
|
+
_context2.next = 16;
|
204
|
+
break;
|
205
|
+
}
|
206
|
+
_context2.next = 13;
|
207
|
+
return onBeforeChange(activeKey, targetKey);
|
208
|
+
case 13:
|
209
|
+
beforeResult = _context2.sent;
|
210
|
+
if (!(beforeResult === false)) {
|
211
|
+
_context2.next = 16;
|
212
|
+
break;
|
213
|
+
}
|
214
|
+
return _context2.abrupt("return", false);
|
215
|
+
case 16:
|
216
|
+
// 更新激活的key
|
217
|
+
setActiveKeyState(targetKey);
|
218
|
+
|
219
|
+
// 执行切换后回调
|
220
|
+
if (onAfterChange) {
|
221
|
+
onAfterChange(targetKey);
|
222
|
+
}
|
223
|
+
return _context2.abrupt("return", true);
|
224
|
+
case 21:
|
225
|
+
_context2.prev = 21;
|
226
|
+
_context2.t0 = _context2["catch"](2);
|
227
|
+
// 验证失败
|
228
|
+
console.error('Tab切换验证失败:', _context2.t0);
|
229
|
+
return _context2.abrupt("return", false);
|
230
|
+
case 25:
|
231
|
+
case "end":
|
232
|
+
return _context2.stop();
|
143
233
|
}
|
144
|
-
|
145
|
-
|
146
|
-
|
234
|
+
}, _callee2, null, [[2, 21]]);
|
235
|
+
}));
|
236
|
+
return function (_x) {
|
237
|
+
return _ref2.apply(this, arguments);
|
238
|
+
};
|
239
|
+
}(), [activeKey, validate, onBeforeChange, onAfterChange, handlesState]);
|
240
|
+
|
241
|
+
// 设置激活的key
|
242
|
+
var setCheckActiveKey = (0, _react.useCallback)( /*#__PURE__*/function () {
|
243
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3(targetKey, validate) {
|
244
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
|
245
|
+
while (1) switch (_context3.prev = _context3.next) {
|
246
|
+
case 0:
|
247
|
+
if (!(validate === false)) {
|
248
|
+
_context3.next = 3;
|
249
|
+
break;
|
250
|
+
}
|
251
|
+
setActiveKeyState(targetKey);
|
252
|
+
return _context3.abrupt("return", true);
|
253
|
+
case 3:
|
254
|
+
return _context3.abrupt("return", validateAndChange(targetKey));
|
255
|
+
case 4:
|
256
|
+
case "end":
|
257
|
+
return _context3.stop();
|
147
258
|
}
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
259
|
+
}, _callee3);
|
260
|
+
}));
|
261
|
+
return function (_x2, _x3) {
|
262
|
+
return _ref3.apply(this, arguments);
|
263
|
+
};
|
264
|
+
}(), [validateAndChange]);
|
265
|
+
|
266
|
+
// 执行当前步骤处理函数
|
267
|
+
var saveHandle = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee4() {
|
268
|
+
var handler, result, currentKeyNum, nextKey;
|
269
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee4$(_context4) {
|
270
|
+
while (1) switch (_context4.prev = _context4.next) {
|
271
|
+
case 0:
|
272
|
+
handler = handlesState[activeKey];
|
273
|
+
if (!handler) {
|
274
|
+
_context4.next = 15;
|
275
|
+
break;
|
276
|
+
}
|
277
|
+
_context4.next = 4;
|
278
|
+
return handler();
|
279
|
+
case 4:
|
280
|
+
result = _context4.sent;
|
281
|
+
if (!(result && autoNext)) {
|
282
|
+
_context4.next = 12;
|
283
|
+
break;
|
284
|
+
}
|
285
|
+
// 只有当activeKey能转换为数字时才执行自动跳转
|
286
|
+
currentKeyNum = Number(activeKey);
|
287
|
+
if ((0, _lodash.isNaN)(currentKeyNum)) {
|
288
|
+
_context4.next = 12;
|
289
|
+
break;
|
290
|
+
}
|
291
|
+
nextKey = String(currentKeyNum + 1);
|
174
292
|
if (Number(nextKey) > queueSteps) {
|
175
293
|
nextKey = String(queueSteps);
|
176
294
|
}
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
295
|
+
// 自动跳转到下一个tab
|
296
|
+
_context4.next = 12;
|
297
|
+
return setCheckActiveKey(nextKey, false);
|
298
|
+
case 12:
|
299
|
+
if (!(result === false)) {
|
300
|
+
_context4.next = 14;
|
301
|
+
break;
|
302
|
+
}
|
303
|
+
return _context4.abrupt("return", Promise.reject());
|
304
|
+
case 14:
|
305
|
+
return _context4.abrupt("return", result);
|
306
|
+
case 15:
|
307
|
+
return _context4.abrupt("return", Promise.resolve(true));
|
308
|
+
case 16:
|
309
|
+
case "end":
|
310
|
+
return _context4.stop();
|
182
311
|
}
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
if (
|
312
|
+
}, _callee4);
|
313
|
+
})), [activeKey, handlesState, autoNext, queueSteps, setCheckActiveKey]);
|
314
|
+
|
315
|
+
// 拦截setStep, 最大值是queueSteps
|
316
|
+
var setStep = (0, _react.useCallback)(step => {
|
317
|
+
if (step > queueSteps) {
|
189
318
|
return;
|
190
319
|
}
|
191
|
-
setStepState(
|
320
|
+
setStepState(step);
|
192
321
|
}, [queueSteps]);
|
193
|
-
|
322
|
+
|
323
|
+
// 重置handles,用于清空或组件卸载时调用
|
324
|
+
var resetHandles = (0, _react.useCallback)(() => {
|
194
325
|
setHandlesState({});
|
195
326
|
}, []);
|
196
|
-
|
327
|
+
var stepTabInstance = {
|
197
328
|
activeKey,
|
198
329
|
setCheckActiveKey,
|
199
330
|
loading,
|
@@ -208,25 +339,35 @@ function useStepTab(props = {}) {
|
|
208
339
|
};
|
209
340
|
return stepTabInstance;
|
210
341
|
}
|
342
|
+
|
343
|
+
/**
|
344
|
+
* 在子组件中获取父级 StepTab 实例的钩子
|
345
|
+
* @returns {ProStepTabResultType} 步骤Tab实例
|
346
|
+
*/
|
211
347
|
function useStepTabInstance() {
|
212
|
-
|
348
|
+
var context = (0, _react.useContext)(StepTabInstanceContext);
|
213
349
|
if (context === null) {
|
214
|
-
throw new Error(
|
350
|
+
throw new Error('useStepTabInstance must be used inside a ProStepTab component');
|
215
351
|
}
|
216
352
|
return context;
|
217
353
|
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
354
|
+
|
355
|
+
// 扩展FC类型,添加静态方法
|
356
|
+
|
357
|
+
/**
|
358
|
+
* ProStepTab 组件
|
359
|
+
*/
|
360
|
+
var ProStepTab = _ref5 => {
|
361
|
+
var children = _ref5.children,
|
362
|
+
rest = (0, _objectWithoutProperties2.default)(_ref5, _excluded);
|
363
|
+
var stepTabInstance = useStepTab(rest);
|
364
|
+
return /*#__PURE__*/_react.default.createElement(StepTabInstanceContext.Provider, {
|
365
|
+
value: stepTabInstance
|
366
|
+
}, children);
|
225
367
|
};
|
368
|
+
|
369
|
+
// 将 useStepTabInstance 挂载到 ProStepTab 上作为静态方法
|
226
370
|
ProStepTab.useStepTabInstance = useStepTabInstance;
|
227
|
-
|
228
|
-
//
|
229
|
-
|
230
|
-
useStepTab,
|
231
|
-
useStepTabInstance
|
232
|
-
});
|
371
|
+
|
372
|
+
// 导出默认组件
|
373
|
+
var _default = exports.default = ProStepTab;
|
@@ -1,17 +1,5 @@
|
|
1
|
-
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
7
|
-
for (let key of __getOwnPropNames(from))
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
10
|
-
}
|
11
|
-
return to;
|
12
|
-
};
|
13
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
1
|
+
"use strict";
|
14
2
|
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|