@zat-design/sisyphus-react 4.0.0-beta.3 → 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/babel.config.js +7 -30
- package/dist/index.esm.css +1 -6445
- package/dist/index.min.js +1 -0
- package/dist/less.esm.css +1 -5871
- 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/ProAction/index.less +0 -2
- package/es/ProConfigProvider/index.d.ts +1 -0
- package/es/ProConfigProvider/index.js +34 -21
- package/es/ProDownload/index.js +13 -12
- package/es/ProDownload/style/index.less +0 -2
- 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 +39 -39
- package/es/ProDrawerForm/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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 +49 -43
- 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/propsType.d.ts +1 -1
- package/es/ProEditTable/style/index.less +2 -4
- package/es/ProEditTable/utils/config.js +29 -36
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/es/ProEditTable/utils/diffOriginal.js +76 -9
- 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 +11 -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/style/index.less +0 -2
- 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 +19 -16
- package/es/ProForm/components/base/Checkbox/index.js +10 -11
- package/es/ProForm/components/base/DatePicker/index.js +25 -39
- 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/SwitchCheckbox/style/index.less +0 -2
- package/es/ProForm/components/base/TextArea/index.js +9 -8
- package/es/ProForm/components/base/TextArea/index.less +0 -2
- package/es/ProForm/components/base/TimePicker/index.js +5 -4
- package/es/ProForm/components/base/TimePicker/style/index.less +0 -2
- package/es/ProForm/components/combination/Container/index.js +12 -12
- package/es/ProForm/components/combination/Container/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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 +22 -21
- package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -1
- package/es/ProForm/components/combination/Group/hooks/index.js +47 -39
- package/es/ProForm/components/combination/Group/index.d.ts +8 -2
- package/es/ProForm/components/combination/Group/index.js +42 -42
- 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 +139 -94
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/es/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +18 -20
- package/es/ProForm/components/combination/ProModalSelect/index.js +136 -168
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- 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 +4 -3
- 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/combination/ProTimeLimit/style/index.less +0 -2
- package/es/ProForm/components/render/ChangedWrapper.js +25 -27
- package/es/ProForm/components/render/ConfirmWrapper.js +10 -11
- package/es/ProForm/components/render/Render.js +118 -101
- package/es/ProForm/components/render/RenderFields.d.ts +1 -1
- package/es/ProForm/components/render/RenderFields.js +25 -25
- package/es/ProForm/components/render/propsType.d.ts +1 -0
- package/es/ProForm/index.d.ts +2 -2
- package/es/ProForm/index.js +47 -45
- package/es/ProForm/propsType.d.ts +3 -4
- package/es/ProForm/style/index.less +0 -2
- package/es/ProForm/utils/diffOriginal.d.ts +1 -0
- package/es/ProForm/utils/diffOriginal.js +70 -5
- package/es/ProForm/utils/getDefaultProps.js +5 -5
- package/es/ProForm/utils/index.js +63 -91
- 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.d.ts +1 -0
- package/es/ProForm/utils/useShouldUpdate.js +146 -64
- 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/style/index.less +0 -2
- 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 +68 -19
- package/es/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +44 -29
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +6 -4
- package/es/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Menu/index.js +13 -10
- package/es/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/es/ProLayout/components/Layout/Notice/index.js +3 -3
- package/es/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/es/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/es/ProLayout/components/ProCollapse/index.js +49 -20
- package/es/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/es/ProLayout/components/ProFooter/index.js +13 -14
- package/es/ProLayout/components/ProFooter/style/index.less +0 -2
- 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/components/ProBackBtn/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/index.js +68 -59
- package/es/ProLayout/components/ProHeader/style/index.less +0 -2
- package/es/ProLayout/components/ProHeader/utils/index.js +1 -1
- package/es/ProLayout/index.d.ts +0 -11
- package/es/ProLayout/index.js +73 -44
- package/es/ProLayout/propTypes.d.ts +9 -0
- package/es/ProLayout/style/index.less +0 -2
- package/es/ProLayout/utils/index.d.ts +7 -0
- package/es/ProLayout/utils/index.js +46 -17
- package/es/ProSelect/components/AdaptiveTooltip.js +8 -9
- package/es/ProSelect/index.js +57 -64
- package/es/ProSelect/index.less +0 -2
- package/es/ProSelect/utils/index.js +67 -17
- package/es/ProStep/components/Anchor/index.js +10 -9
- package/es/ProStep/components/Item/index.js +12 -13
- 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/style/index.less +0 -2
- 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.d.ts +3 -0
- package/es/ProTable/hooks/useAntdTable.js +164 -151
- package/es/ProTable/index.d.ts +3 -7
- package/es/ProTable/index.js +124 -147
- package/es/ProTable/propsType.d.ts +12 -5
- package/es/ProTable/style/index.less +4 -6
- 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 -5
- package/es/ProThemeTools/component/ProTools/index.js +46 -39
- package/es/ProThemeTools/context/ThemeContext.js +13 -13
- package/es/ProThemeTools/index.d.ts +0 -7
- package/es/ProThemeTools/index.js +28 -31
- package/es/ProThemeTools/style/index.less +0 -2
- package/es/ProThemeTools/utils/index.js +14 -18
- package/es/ProTooltip/index.js +24 -27
- package/es/ProTooltip/style/index.less +0 -2
- 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/ProTreeSelect/style/index.less +0 -2
- package/es/ProTree/components/Tree.js +23 -22
- package/es/ProTree/index.js +1 -1
- package/es/ProTree/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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/ProViewer/style/index.less +0 -2
- 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/antd.less +0 -2
- package/es/style/theme/base.less +1 -0
- package/es/utils/index.js +11 -13
- package/jest.config.js +46 -4
- 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/index.less +0 -2
- package/lib/ProAction/propsType.js +4 -16
- package/lib/ProConfigProvider/index.d.ts +1 -0
- package/lib/ProConfigProvider/index.js +137 -136
- package/lib/ProDownload/index.js +192 -124
- package/lib/ProDownload/propsType.js +4 -16
- package/lib/ProDownload/style/index.less +0 -2
- 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 +83 -95
- package/lib/ProDrawerForm/propsType.js +4 -16
- package/lib/ProDrawerForm/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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 +183 -174
- 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.d.ts +1 -1
- package/lib/ProEditTable/propsType.js +4 -16
- package/lib/ProEditTable/style/index.less +2 -4
- package/lib/ProEditTable/utils/config.js +225 -170
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -0
- package/lib/ProEditTable/utils/diffOriginal.js +112 -52
- 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 +74 -51
- 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/style/index.less +0 -2
- 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 +68 -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 +66 -89
- 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/SwitchCheckbox/style/index.less +0 -2
- package/lib/ProForm/components/base/TextArea/index.js +52 -65
- package/lib/ProForm/components/base/TextArea/index.less +0 -2
- package/lib/ProForm/components/base/TimePicker/index.js +45 -59
- package/lib/ProForm/components/base/TimePicker/style/index.less +0 -2
- 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/Container/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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 +79 -74
- package/lib/ProForm/components/combination/Group/hooks/index.d.ts +0 -1
- package/lib/ProForm/components/combination/Group/hooks/index.js +127 -121
- package/lib/ProForm/components/combination/Group/index.d.ts +8 -2
- package/lib/ProForm/components/combination/Group/index.js +100 -110
- 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 +289 -187
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +12 -4
- package/lib/ProForm/components/combination/ProCascader/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProCascader/style/index.less +1 -3
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +23 -33
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +115 -116
- package/lib/ProForm/components/combination/ProModalSelect/index.js +656 -503
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -3
- package/lib/ProForm/components/combination/ProModalSelect/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +1 -4
- 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 +4 -3
- 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/combination/ProTimeLimit/style/index.less +0 -2
- package/lib/ProForm/components/index.js +192 -115
- package/lib/ProForm/components/render/ChangedWrapper.js +132 -143
- package/lib/ProForm/components/render/ConfirmWrapper.js +120 -78
- package/lib/ProForm/components/render/Render.js +446 -339
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -1
- package/lib/ProForm/components/render/RenderFields.js +195 -179
- package/lib/ProForm/components/render/propsType.d.ts +1 -0
- package/lib/ProForm/components/render/propsType.js +31 -17
- package/lib/ProForm/index.d.ts +2 -2
- package/lib/ProForm/index.js +282 -233
- package/lib/ProForm/propsType.d.ts +3 -4
- package/lib/ProForm/propsType.js +9 -38
- package/lib/ProForm/style/index.less +0 -2
- package/lib/ProForm/utils/diffOriginal.d.ts +1 -0
- package/lib/ProForm/utils/diffOriginal.js +107 -53
- 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.d.ts +1 -0
- package/lib/ProForm/utils/useShouldUpdate.js +259 -103
- 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/style/index.less +0 -2
- 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 +173 -113
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +137 -114
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +4 -16
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +44 -59
- package/lib/ProLayout/components/Layout/Menu/SideMenu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Menu/index.js +52 -68
- package/lib/ProLayout/components/Layout/Menu/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/Notice/index.js +31 -39
- package/lib/ProLayout/components/Layout/Notice/style/index.less +0 -2
- package/lib/ProLayout/components/Layout/index.js +31 -45
- package/lib/ProLayout/components/ProCollapse/PropTypes.d.ts +8 -3
- package/lib/ProLayout/components/ProCollapse/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProCollapse/index.js +163 -128
- package/lib/ProLayout/components/ProCollapse/style/index.less +148 -4
- package/lib/ProLayout/components/ProFooter/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProFooter/index.js +41 -56
- package/lib/ProLayout/components/ProFooter/style/index.less +0 -2
- 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/ProBackBtn/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/components/index.js +17 -39
- package/lib/ProLayout/components/ProHeader/index.js +466 -268
- package/lib/ProLayout/components/ProHeader/style/index.less +0 -2
- package/lib/ProLayout/components/ProHeader/utils/index.js +14 -31
- package/lib/ProLayout/components/index.js +24 -42
- package/lib/ProLayout/index.d.ts +0 -11
- package/lib/ProLayout/index.js +166 -138
- package/lib/ProLayout/propTypes.d.ts +9 -0
- package/lib/ProLayout/propTypes.js +4 -16
- package/lib/ProLayout/style/index.less +0 -2
- package/lib/ProLayout/utils/index.d.ts +7 -0
- package/lib/ProLayout/utils/index.js +125 -76
- package/lib/ProSelect/components/AdaptiveTooltip.js +38 -45
- package/lib/ProSelect/index.js +240 -213
- package/lib/ProSelect/index.less +0 -2
- package/lib/ProSelect/propsType.js +4 -16
- package/lib/ProSelect/utils/index.js +123 -73
- package/lib/ProStep/components/Anchor/index.js +102 -107
- package/lib/ProStep/components/Item/index.js +71 -76
- 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/style/index.less +0 -2
- 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.d.ts +3 -0
- package/lib/ProTable/hooks/useAntdTable.js +373 -291
- package/lib/ProTable/index.d.ts +3 -7
- package/lib/ProTable/index.js +354 -338
- package/lib/ProTable/propsType.d.ts +12 -5
- package/lib/ProTable/propsType.js +4 -16
- package/lib/ProTable/style/index.less +4 -6
- 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 -5
- 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.d.ts +0 -7
- package/lib/ProThemeTools/index.js +207 -179
- package/lib/ProThemeTools/propsType.js +4 -16
- package/lib/ProThemeTools/style/index.less +0 -2
- package/lib/ProThemeTools/utils/index.js +84 -80
- package/lib/ProTooltip/index.js +217 -214
- package/lib/ProTooltip/propsType.js +4 -16
- package/lib/ProTooltip/style/index.less +0 -2
- 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/ProTreeSelect/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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/style/index.less +0 -2
- 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/ProViewer/style/index.less +0 -2
- 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/antd.less +0 -2
- package/lib/style/theme/base.less +1 -0
- package/lib/tokens.js +87 -103
- package/lib/utils/index.js +66 -88
- package/package.json +12 -11
- package/dist/index.esm.js +0 -3
- package/dist/less.esm.js +0 -3
@@ -12,7 +12,7 @@ import locale from "../../../locale";
|
|
12
12
|
import processDependencies from "../../utils/processDependencies";
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
14
14
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
15
|
-
var RenderFields =
|
15
|
+
var RenderFields = props => {
|
16
16
|
var isView = props.isView,
|
17
17
|
_props$columns = props.columns,
|
18
18
|
columns = _props$columns === void 0 ? [] : _props$columns,
|
@@ -29,27 +29,27 @@ var RenderFields = function RenderFields(props) {
|
|
29
29
|
required = props.required,
|
30
30
|
diffConfig = props.diffConfig,
|
31
31
|
globalControl = props.globalControl,
|
32
|
-
|
32
|
+
shouldUpdateDebounce = props.shouldUpdateDebounce;
|
33
33
|
|
34
34
|
// 是否包含隐藏字段
|
35
|
-
var hiddenData = columns.filter(
|
35
|
+
var hiddenData = columns.filter(item => {
|
36
36
|
return Array.isArray(item.hiddenNames);
|
37
37
|
}) || [];
|
38
38
|
|
39
39
|
// 创建hidden字段供表单收集
|
40
40
|
if (hiddenData.length) {
|
41
41
|
var hiddenArray = [];
|
42
|
-
hiddenData.forEach(
|
42
|
+
hiddenData.forEach(item => {
|
43
43
|
hiddenArray = hiddenArray.concat(item.hiddenNames);
|
44
44
|
});
|
45
|
-
hiddenArray.forEach(
|
45
|
+
hiddenArray.forEach(item => {
|
46
46
|
columns.push({
|
47
|
-
name: Array.isArray(item) ? item :
|
47
|
+
name: Array.isArray(item) ? item : `${item}`,
|
48
48
|
hidden: true
|
49
49
|
});
|
50
50
|
});
|
51
51
|
}
|
52
|
-
var comList = columns.flatMap(
|
52
|
+
var comList = columns.flatMap((column, index) => {
|
53
53
|
var _formItemProps$disabl;
|
54
54
|
if (!!expand && !openState) {
|
55
55
|
// expand为Number时 过滤掉大于expand 且 非fixed的column
|
@@ -90,7 +90,7 @@ var RenderFields = function RenderFields(props) {
|
|
90
90
|
// 允许formItem的属性放在column最外层 并优先级高于 formItemProps 内部参数
|
91
91
|
var _formItemProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultProps), formItemProps), otherFormItemProps), {}, {
|
92
92
|
required: columnRequired !== null && columnRequired !== void 0 ? columnRequired : required,
|
93
|
-
clearNotShow
|
93
|
+
clearNotShow,
|
94
94
|
dependencies: processedDeps
|
95
95
|
});
|
96
96
|
_formItemProps.labelWidth = _formItemProps.labelWidth || labelWidth; // 接收Form中的labelWidth
|
@@ -102,7 +102,7 @@ var RenderFields = function RenderFields(props) {
|
|
102
102
|
var TargetComponent;
|
103
103
|
|
104
104
|
// 查看高阶函数
|
105
|
-
var viewRenderHandle =
|
105
|
+
var viewRenderHandle = () => {
|
106
106
|
var _column$namePath;
|
107
107
|
var value = form.getFieldValue(column.name);
|
108
108
|
var record = form.getFieldsValue();
|
@@ -115,8 +115,8 @@ var RenderFields = function RenderFields(props) {
|
|
115
115
|
index = column === null || column === void 0 ? void 0 : column.index;
|
116
116
|
}
|
117
117
|
return viewRender ? viewRender(value, record, {
|
118
|
-
form
|
119
|
-
index
|
118
|
+
form,
|
119
|
+
index,
|
120
120
|
namePath: column === null || column === void 0 ? void 0 : column.namePath
|
121
121
|
}) || null : null;
|
122
122
|
};
|
@@ -145,13 +145,13 @@ var RenderFields = function RenderFields(props) {
|
|
145
145
|
|
146
146
|
// 当前组件是不是一个选择组件
|
147
147
|
var _isSelect = isSelect({
|
148
|
-
dataSource
|
148
|
+
dataSource,
|
149
149
|
type: _type
|
150
150
|
});
|
151
|
-
var placeholderHandle =
|
151
|
+
var placeholderHandle = () => {
|
152
152
|
var _label = isString(label) ? label : '';
|
153
153
|
var _formLabel = isString(formLabel) ? formLabel : '';
|
154
|
-
return placeholder ||
|
154
|
+
return placeholder || `${_isSelect ? `${locale.ProForm.selectPlaceHolder}` : `${locale.ProForm.inputPlaceholder}`}${_label || _formLabel || ''}`;
|
155
155
|
};
|
156
156
|
|
157
157
|
// 表单组件Props 兼容2.0版本
|
@@ -187,7 +187,7 @@ var RenderFields = function RenderFields(props) {
|
|
187
187
|
return [];
|
188
188
|
}
|
189
189
|
var _colProps = span ? {
|
190
|
-
span
|
190
|
+
span
|
191
191
|
} : _objectSpread(_objectSpread({}, defaultColProps), colProps);
|
192
192
|
|
193
193
|
// 其余参数收进对象里传给子组件 componentProps只包含子组件参数
|
@@ -196,21 +196,20 @@ var RenderFields = function RenderFields(props) {
|
|
196
196
|
name: _formItemProps.name,
|
197
197
|
disabled: comDisabled,
|
198
198
|
isView: _isView,
|
199
|
-
viewEmpty
|
200
|
-
valueType
|
201
|
-
viewType
|
199
|
+
viewEmpty,
|
200
|
+
valueType,
|
201
|
+
viewType,
|
202
202
|
names: _formItemProps.names,
|
203
|
-
form
|
203
|
+
form,
|
204
204
|
type: _type,
|
205
205
|
hiddenNames: column.hiddenNames,
|
206
206
|
colProps: _colProps,
|
207
207
|
mode: componentProps.mode,
|
208
208
|
namePath: column.namePath,
|
209
209
|
listName: column.listName,
|
210
|
-
globalControl
|
211
|
-
formDisabled
|
212
|
-
diffConfig
|
213
|
-
desensitizationKey: desensitizationKey
|
210
|
+
globalControl,
|
211
|
+
formDisabled,
|
212
|
+
diffConfig
|
214
213
|
};
|
215
214
|
return /*#__PURE__*/_jsx(FieldProvider, {
|
216
215
|
value: otherProps,
|
@@ -240,9 +239,10 @@ var RenderFields = function RenderFields(props) {
|
|
240
239
|
requiredOnView: requiredOnView,
|
241
240
|
globalControl: globalControl,
|
242
241
|
viewRender: viewRender,
|
243
|
-
desensitization: desensitization
|
242
|
+
desensitization: desensitization,
|
243
|
+
shouldUpdateDebounce: shouldUpdateDebounce
|
244
244
|
})
|
245
|
-
},
|
245
|
+
}, `${_formItemProps.name || _formItemProps.label}${index}`);
|
246
246
|
});
|
247
247
|
return /*#__PURE__*/_jsx(_Fragment, {
|
248
248
|
children: comList
|
package/es/ProForm/index.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { FormInstance } from 'antd';
|
2
|
-
import React
|
2
|
+
import React from 'react';
|
3
3
|
import { FormProviderProps } from 'antd/es/form/context';
|
4
4
|
import type { ProFormType } from './propsType';
|
5
5
|
import { useForm } from './utils/useForm';
|
6
6
|
import useWatch from './utils/useWatch';
|
7
7
|
import { useForms } from '../FormsProvider';
|
8
|
-
interface IProForm<T = any> extends
|
8
|
+
interface IProForm<T = any> extends React.ForwardRefExoticComponent<ProFormType<T> & React.RefAttributes<FormInstance<T>>> {
|
9
9
|
useForm: typeof useForm;
|
10
10
|
useWatch: typeof useWatch;
|
11
11
|
useFormInstances: typeof useForms;
|
package/es/ProForm/index.js
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
import "antd/es/form/style";
|
2
|
+
import _Form from "antd/es/form";
|
3
|
+
import "antd/es/row/style";
|
4
|
+
import _Row from "antd/es/row";
|
1
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import
|
3
|
-
import
|
6
|
+
import "antd/es/col/style";
|
7
|
+
import _Col from "antd/es/col";
|
8
|
+
import "antd/es/space/style";
|
9
|
+
import _Space from "antd/es/space";
|
4
10
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
6
|
-
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "
|
12
|
+
var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "stopOnFirstError", "shouldUpdateDebounce"];
|
7
13
|
import { DoubleLeftOutlined } from '@ant-design/icons';
|
8
|
-
import { Col, Form, Row, Space } from 'antd';
|
9
14
|
import classnames from 'classnames';
|
10
15
|
import React, { forwardRef, useImperativeHandle, useMemo, useEffect } from 'react';
|
11
16
|
import { isObject, merge, omit } from 'lodash';
|
@@ -22,7 +27,7 @@ import FormsProvider, { useContextForms, useForms } from "../FormsProvider";
|
|
22
27
|
import { useStep } from "../ProStep";
|
23
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
24
29
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
25
|
-
var ProForm =
|
30
|
+
var ProForm = (props, ref) => {
|
26
31
|
var _localStorage, _ref3;
|
27
32
|
var _props$mode = props.mode,
|
28
33
|
mode = _props$mode === void 0 ? 'search' : _props$mode,
|
@@ -65,10 +70,10 @@ var ProForm = function ProForm(props, ref) {
|
|
65
70
|
scrollToError = _props$scrollToError === void 0 ? true : _props$scrollToError,
|
66
71
|
_props$optimize = props.optimize,
|
67
72
|
optimize = _props$optimize === void 0 ? false : _props$optimize,
|
68
|
-
_props$desensitizatio = props.desensitizationKey,
|
69
|
-
desensitizationKey = _props$desensitizatio === void 0 ? 'zat-design-pro-component-desensitization' : _props$desensitizatio,
|
70
73
|
_props$stopOnFirstErr = props.stopOnFirstError,
|
71
74
|
stopOnFirstError = _props$stopOnFirstErr === void 0 ? false : _props$stopOnFirstErr,
|
75
|
+
_props$shouldUpdateDe = props.shouldUpdateDebounce,
|
76
|
+
shouldUpdateDebounce = _props$shouldUpdateDe === void 0 ? 500 : _props$shouldUpdateDe,
|
72
77
|
otherProps = _objectWithoutProperties(props, _excluded);
|
73
78
|
var config = useProConfig('ProForm');
|
74
79
|
// source: 用于区分是哪个组件调用,用于错误提示
|
@@ -80,16 +85,16 @@ var ProForm = function ProForm(props, ref) {
|
|
80
85
|
_ref2$source = _ref2.source,
|
81
86
|
stepSource = _ref2$source === void 0 ? '' : _ref2$source;
|
82
87
|
var _useForm = useForm(originForm, {
|
83
|
-
scrollToError
|
84
|
-
optimize
|
85
|
-
formKey
|
88
|
+
scrollToError,
|
89
|
+
optimize,
|
90
|
+
formKey,
|
86
91
|
source: source || stepSource || 'ProForm'
|
87
92
|
}),
|
88
93
|
_useForm2 = _slicedToArray(_useForm, 1),
|
89
94
|
form = _useForm2[0];
|
90
95
|
|
91
96
|
// 保存内部配置
|
92
|
-
useEffect(
|
97
|
+
useEffect(() => {
|
93
98
|
if (!form.__INTERNAL_CONFIG__) {
|
94
99
|
form.__INTERNAL_CONFIG__ = {};
|
95
100
|
}
|
@@ -104,8 +109,8 @@ var ProForm = function ProForm(props, ref) {
|
|
104
109
|
openState = _useControlled2[0],
|
105
110
|
setOpenState = _useControlled2[1];
|
106
111
|
var _getLayout = getLayout({
|
107
|
-
span
|
108
|
-
form
|
112
|
+
span,
|
113
|
+
form
|
109
114
|
}),
|
110
115
|
formProps = _getLayout.formProps,
|
111
116
|
colProps = _getLayout.colProps,
|
@@ -113,7 +118,7 @@ var ProForm = function ProForm(props, ref) {
|
|
113
118
|
_onCancel = _getLayout.onCancel;
|
114
119
|
|
115
120
|
// 初始值names转换
|
116
|
-
var _initialValues = useMemo(
|
121
|
+
var _initialValues = useMemo(() => {
|
117
122
|
var values = initialValuesToNames(initialValues, columns);
|
118
123
|
return values;
|
119
124
|
}, []);
|
@@ -121,19 +126,19 @@ var ProForm = function ProForm(props, ref) {
|
|
121
126
|
/**
|
122
127
|
* 展开&收起函数
|
123
128
|
*/
|
124
|
-
var expandHandle =
|
129
|
+
var expandHandle = () => {
|
125
130
|
setOpenState === null || setOpenState === void 0 || setOpenState(!openState);
|
126
131
|
};
|
127
|
-
var expandRender =
|
132
|
+
var expandRender = () => {
|
128
133
|
return !!expand && columns.length > Number(expand) && /*#__PURE__*/_jsx("div", {
|
129
134
|
className: "expand-button",
|
130
135
|
onClick: expandHandle,
|
131
|
-
children: !openState ? /*#__PURE__*/_jsxs(
|
136
|
+
children: !openState ? /*#__PURE__*/_jsxs(_Space, {
|
132
137
|
align: "center",
|
133
138
|
children: [locale.ProForm.unfold, /*#__PURE__*/_jsx(DoubleLeftOutlined, {
|
134
139
|
className: "rotate-to-bottom"
|
135
140
|
})]
|
136
|
-
}) : /*#__PURE__*/_jsxs(
|
141
|
+
}) : /*#__PURE__*/_jsxs(_Space, {
|
137
142
|
align: "center",
|
138
143
|
children: [locale.ProForm.packUp, /*#__PURE__*/_jsx(DoubleLeftOutlined, {
|
139
144
|
className: "rotate-to-top"
|
@@ -141,7 +146,7 @@ var ProForm = function ProForm(props, ref) {
|
|
141
146
|
})
|
142
147
|
});
|
143
148
|
};
|
144
|
-
var defaultFooter =
|
149
|
+
var defaultFooter = footerConfig => {
|
145
150
|
return /*#__PURE__*/_jsx(FormFooter, {
|
146
151
|
formId: formId,
|
147
152
|
onOk: onOk || _onOk,
|
@@ -155,12 +160,10 @@ var ProForm = function ProForm(props, ref) {
|
|
155
160
|
};
|
156
161
|
|
157
162
|
// 暴露form出去给类组件使用
|
158
|
-
useImperativeHandle(ref,
|
159
|
-
return form;
|
160
|
-
});
|
163
|
+
useImperativeHandle(ref, () => form);
|
161
164
|
|
162
165
|
// 解决平铺后的值拿不到的问题
|
163
|
-
var handleValuesChange =
|
166
|
+
var handleValuesChange = changedValue => {
|
164
167
|
if (!onValuesChange) return;
|
165
168
|
|
166
169
|
// 暂时通过'-'区分组合组件字段和普通字段
|
@@ -168,32 +171,31 @@ var ProForm = function ProForm(props, ref) {
|
|
168
171
|
if (!keys.length) {
|
169
172
|
onValuesChange(filterInternalFields(changedValue, optimize), form.getFieldsValue());
|
170
173
|
} else {
|
171
|
-
var values = keys.map(
|
174
|
+
var values = keys.map(key => {
|
172
175
|
if (key.includes('-')) {
|
173
176
|
var comKeys = [];
|
174
|
-
comKeys = key.split('-').map(
|
175
|
-
return keyStr.split('_');
|
176
|
-
});
|
177
|
+
comKeys = key.split('-').map(keyStr => keyStr.split('_'));
|
177
178
|
return form.getFieldsValue(comKeys);
|
178
179
|
}
|
179
180
|
return {};
|
180
181
|
});
|
181
|
-
onValuesChange(filterInternalFields(merge
|
182
|
+
onValuesChange(filterInternalFields(merge(changedValue, ...values), optimize), form.getFieldsValue());
|
182
183
|
}
|
183
184
|
};
|
184
185
|
|
185
186
|
// 包装一层兼容 names 改变
|
186
|
-
var handleFinish =
|
187
|
+
var handleFinish = () => {
|
187
188
|
onFinish === null || onFinish === void 0 || onFinish(form.getFieldsValue());
|
188
189
|
};
|
189
|
-
var cls = classnames(
|
190
|
+
var cls = classnames({
|
190
191
|
'pro-form': true,
|
191
|
-
'pro-form-view': isView
|
192
|
-
|
192
|
+
'pro-form-view': isView,
|
193
|
+
[className]: className
|
194
|
+
});
|
193
195
|
var footerCls = classnames({
|
194
196
|
'pro-form-custom-footer': true
|
195
197
|
});
|
196
|
-
var footerRender =
|
198
|
+
var footerRender = () => {
|
197
199
|
var footerEle = null;
|
198
200
|
if (isView || disabled) {
|
199
201
|
// 查看或禁用模式
|
@@ -209,9 +211,9 @@ var ProForm = function ProForm(props, ref) {
|
|
209
211
|
// 展开折叠按钮
|
210
212
|
var expandEle = expandRender();
|
211
213
|
var hasElement = footerEle || expandEle;
|
212
|
-
return hasElement ? /*#__PURE__*/_jsx(
|
214
|
+
return hasElement ? /*#__PURE__*/_jsx(_Col, _objectSpread(_objectSpread({}, colProps), {}, {
|
213
215
|
className: footerCls,
|
214
|
-
children: /*#__PURE__*/_jsxs(
|
216
|
+
children: /*#__PURE__*/_jsxs(_Space, {
|
215
217
|
align: "center",
|
216
218
|
children: [footerEle, expandEle]
|
217
219
|
})
|
@@ -228,8 +230,8 @@ var ProForm = function ProForm(props, ref) {
|
|
228
230
|
otherProps.layout = otherProps.layout || 'vertical';
|
229
231
|
}
|
230
232
|
}
|
231
|
-
return /*#__PURE__*/_jsxs(
|
232
|
-
onKeyPress:
|
233
|
+
return /*#__PURE__*/_jsxs(_Form, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
234
|
+
onKeyPress: event => {
|
233
235
|
if (!submitOnEnter) return;
|
234
236
|
if (event.key === 'Enter') {
|
235
237
|
form.submit();
|
@@ -242,7 +244,7 @@ var ProForm = function ProForm(props, ref) {
|
|
242
244
|
onValuesChange: handleValuesChange,
|
243
245
|
onFinish: handleFinish,
|
244
246
|
initialValues: _initialValues,
|
245
|
-
children: [/*#__PURE__*/_jsxs(
|
247
|
+
children: [/*#__PURE__*/_jsxs(_Row, _objectSpread(_objectSpread({
|
246
248
|
gutter: 24
|
247
249
|
}, rowProps), {}, {
|
248
250
|
children: [/*#__PURE__*/_jsx(RenderFields, {
|
@@ -262,7 +264,7 @@ var ProForm = function ProForm(props, ref) {
|
|
262
264
|
requiredOnView: requiredOnView,
|
263
265
|
required: required,
|
264
266
|
globalControl: globalControl,
|
265
|
-
|
267
|
+
shouldUpdateDebounce: shouldUpdateDebounce
|
266
268
|
}), footerRender()]
|
267
269
|
})), children]
|
268
270
|
}));
|
@@ -272,13 +274,13 @@ var ProForm = function ProForm(props, ref) {
|
|
272
274
|
var ProFormForward = /*#__PURE__*/forwardRef(ProForm);
|
273
275
|
ProFormForward.useForm = useForm;
|
274
276
|
ProFormForward.useWatch = useWatch;
|
275
|
-
export var ProFormProvider =
|
277
|
+
export var ProFormProvider = props => {
|
276
278
|
var onFormChange = props.onFormChange,
|
277
279
|
onFormFinish = props.onFormFinish,
|
278
280
|
children = props.children;
|
279
|
-
var handleFormChange =
|
281
|
+
var handleFormChange = (formName, info) => {
|
280
282
|
var changedFields = info.changedFields;
|
281
|
-
var _changedFields = changedFields.flatMap(
|
283
|
+
var _changedFields = changedFields.flatMap(item => {
|
282
284
|
var _item$value = item.value,
|
283
285
|
value = _item$value === void 0 ? [] : _item$value;
|
284
286
|
var name = item.name;
|
@@ -291,9 +293,9 @@ export var ProFormProvider = function ProFormProvider(props) {
|
|
291
293
|
var namesList = splitNameStr(String(namesStr)); // 拆解出name列表
|
292
294
|
|
293
295
|
var prefix = name.slice(0, name.length - 1);
|
294
|
-
return namesList.map(
|
296
|
+
return namesList.map((nameItem, index) => {
|
295
297
|
return _objectSpread(_objectSpread({}, item), {}, {
|
296
|
-
name: [
|
298
|
+
name: [...prefix, ...nameItem],
|
297
299
|
// 拼接前缀 组成完整name
|
298
300
|
value: value[index]
|
299
301
|
});
|
@@ -304,7 +306,7 @@ export var ProFormProvider = function ProFormProvider(props) {
|
|
304
306
|
// @ts-ignore
|
305
307
|
onFormChange(formName, info);
|
306
308
|
};
|
307
|
-
return /*#__PURE__*/_jsx(
|
309
|
+
return /*#__PURE__*/_jsx(_Form.Provider, {
|
308
310
|
onFormChange: onFormChange ? handleFormChange : undefined,
|
309
311
|
onFormFinish: onFormFinish,
|
310
312
|
children: children
|
@@ -5,7 +5,7 @@ import { StoreValue, Store } from 'rc-field-form/es/interface.d';
|
|
5
5
|
import { ShouldUpdate } from 'rc-field-form/es/Field.d';
|
6
6
|
import React, { ReactNode } from 'react';
|
7
7
|
import type { ProFormColumnType, ViewType } from './components/render/propsType';
|
8
|
-
import type { ProFormComponentType } from './components
|
8
|
+
import type { ProFormComponentType } from './components';
|
9
9
|
export interface ButtonType extends ButtonProps {
|
10
10
|
children?: any;
|
11
11
|
}
|
@@ -46,7 +46,6 @@ export interface ProFormOtherType {
|
|
46
46
|
formDisabled?: boolean;
|
47
47
|
isDiffChange?: boolean;
|
48
48
|
diffConfig?: DiffConfigType;
|
49
|
-
desensitizationKey?: string;
|
50
49
|
}
|
51
50
|
export interface DiffConfigType<Values = any> {
|
52
51
|
/** 比对原始数据源 */
|
@@ -99,10 +98,10 @@ export interface ProFormType<Values = any> extends FormProps<Values> {
|
|
99
98
|
* 1. 开启不过滤names的中间态值
|
100
99
|
*/
|
101
100
|
optimize?: boolean;
|
102
|
-
/** 全局脱敏开关的key、默认 zat-design-pro-component-desensitization */
|
103
|
-
desensitizationKey?: string;
|
104
101
|
/** 是否在遇到第一个错误时停止验证 */
|
105
102
|
stopOnFirstError?: boolean;
|
103
|
+
/** shouldUpdate防抖延迟时间,默认500ms,设置为0则不防抖 */
|
104
|
+
shouldUpdateDebounce?: number;
|
106
105
|
}
|
107
106
|
export interface TransformType<T = any> {
|
108
107
|
normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
|
@@ -1,5 +1,3 @@
|
|
1
|
-
/* @root-entry-name: 'default'; */
|
2
|
-
/* @import (reference) '~antd/es/style/themes/index.less'; */
|
3
1
|
@import '../components/base/SwitchCheckbox/style/index.less';
|
4
2
|
@import '../components/base/TimePicker/style/index.less';
|
5
3
|
@import '../components/base/TextArea/index.less';
|
@@ -1,15 +1,73 @@
|
|
1
1
|
import { isEqual, isFunction, isObject } from 'lodash';
|
2
2
|
import { isEmpty } from "../../utils";
|
3
|
+
|
4
|
+
// 比较策略接口
|
5
|
+
|
6
|
+
// 数字类型标准化函数
|
7
|
+
var normalizeNumberValue = value => {
|
8
|
+
if (value === null || value === undefined || value === '') return null;
|
9
|
+
var num = Number(value);
|
10
|
+
return Number.isNaN(num) ? null : num;
|
11
|
+
};
|
12
|
+
|
13
|
+
// InputNumber 比较策略
|
14
|
+
var inputNumberStrategy = {
|
15
|
+
compare: (val1, val2) => {
|
16
|
+
var num1 = normalizeNumberValue(val1);
|
17
|
+
var num2 = normalizeNumberValue(val2);
|
18
|
+
return num1 === num2;
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
// ProNumberRange 比较策略
|
23
|
+
var proNumberRangeStrategy = {
|
24
|
+
compare: (val1, val2) => {
|
25
|
+
if (!Array.isArray(val1) || !Array.isArray(val2)) return false;
|
26
|
+
if (val1.length !== val2.length) return false;
|
27
|
+
return val1.every((item, index) => {
|
28
|
+
var num1 = normalizeNumberValue(item);
|
29
|
+
var num2 = normalizeNumberValue(val2[index]);
|
30
|
+
return num1 === num2;
|
31
|
+
});
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
// 数字类型处理函数
|
36
|
+
var handleNumberTypeDiff = params => {
|
37
|
+
var originalValue = params.originalValue,
|
38
|
+
value = params.value,
|
39
|
+
type = params.type;
|
40
|
+
var isEmptyVal = isEmpty(value);
|
41
|
+
var isEmptyOrg = isEmpty(originalValue);
|
42
|
+
|
43
|
+
// 都为空视为相等
|
44
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
45
|
+
|
46
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
47
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
48
|
+
|
49
|
+
// 根据类型选择对应的比较策略
|
50
|
+
var compareStrategy;
|
51
|
+
if (type === 'InputNumber') {
|
52
|
+
compareStrategy = inputNumberStrategy;
|
53
|
+
} else if (type === 'ProNumberRange') {
|
54
|
+
compareStrategy = proNumberRangeStrategy;
|
55
|
+
} else {
|
56
|
+
return 'changed'; // 未知类型视为已改变
|
57
|
+
}
|
58
|
+
return compareStrategy.compare(value, originalValue) ? 'same' : 'changed';
|
59
|
+
};
|
60
|
+
|
3
61
|
// 过滤对象中undefined字段
|
4
62
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
5
|
-
var filterObject =
|
63
|
+
var filterObject = data => {
|
6
64
|
if (!isObject(data) || data === null) return data;
|
7
65
|
|
8
66
|
// ['1', undefined] ['1', ''] 视为相等
|
9
67
|
if (Array.isArray(data)) {
|
10
68
|
// 数组中全是empty值的话 视为null
|
11
69
|
var isFillNull = true;
|
12
|
-
var arr = data.map(
|
70
|
+
var arr = data.map(item => {
|
13
71
|
if (isEmpty(item)) {
|
14
72
|
return null;
|
15
73
|
}
|
@@ -19,7 +77,7 @@ var filterObject = function filterObject(data) {
|
|
19
77
|
return isFillNull ? null : arr;
|
20
78
|
}
|
21
79
|
var resData = {};
|
22
|
-
Object.keys(data).forEach(
|
80
|
+
Object.keys(data).forEach(key => {
|
23
81
|
if (!isEmpty(data[key])) {
|
24
82
|
resData[key] = data[key];
|
25
83
|
}
|
@@ -29,10 +87,12 @@ var filterObject = function filterObject(data) {
|
|
29
87
|
if (!Object.keys(resData).length) return null;
|
30
88
|
return resData;
|
31
89
|
};
|
32
|
-
export var diffOriginal =
|
90
|
+
export var diffOriginal = params => {
|
33
91
|
var originalValue = params.originalValue,
|
34
92
|
value = params.value,
|
35
|
-
onDiff = params.onDiff
|
93
|
+
onDiff = params.onDiff,
|
94
|
+
type = params.type;
|
95
|
+
|
36
96
|
// 支持传入自定义比较事件
|
37
97
|
if (isFunction(onDiff)) {
|
38
98
|
var diffRes = onDiff(originalValue, value);
|
@@ -44,6 +104,11 @@ export var diffOriginal = function diffOriginal(params) {
|
|
44
104
|
return diffRes;
|
45
105
|
}
|
46
106
|
}
|
107
|
+
if (['InputNumber', 'ProNumberRange'].includes(type)) {
|
108
|
+
return handleNumberTypeDiff(params);
|
109
|
+
}
|
110
|
+
|
111
|
+
// 其他类型使用原有逻辑
|
47
112
|
var _value = filterObject(value);
|
48
113
|
var _originalValue = filterObject(originalValue);
|
49
114
|
var isEmptyVal = isEmpty(_value);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { get, isEqual } from 'lodash';
|
2
2
|
var defaultPropsMap = {
|
3
|
-
ProSelect:
|
3
|
+
ProSelect: props => {
|
4
4
|
var fieldProps = props.fieldProps,
|
5
5
|
name = props.name,
|
6
6
|
namePath = props.namePath;
|
@@ -12,11 +12,11 @@ var defaultPropsMap = {
|
|
12
12
|
if (filterInList && namePath && name) {
|
13
13
|
var _listName = namePath.slice(0, -1);
|
14
14
|
var _namePath = name.slice(1);
|
15
|
-
defaultProps.shouldUpdate =
|
16
|
-
var preListValue = get(preValues, _listName).map(
|
15
|
+
defaultProps.shouldUpdate = (preValues, curValues) => {
|
16
|
+
var preListValue = get(preValues, _listName).map(item => {
|
17
17
|
return get(item, _namePath);
|
18
18
|
});
|
19
|
-
var curListValue = get(curValues, _listName).map(
|
19
|
+
var curListValue = get(curValues, _listName).map(item => {
|
20
20
|
return get(item, _namePath);
|
21
21
|
});
|
22
22
|
return !isEqual(preListValue, curListValue);
|
@@ -25,7 +25,7 @@ var defaultPropsMap = {
|
|
25
25
|
return defaultProps;
|
26
26
|
}
|
27
27
|
};
|
28
|
-
export var getDefaultProps =
|
28
|
+
export var getDefaultProps = props => {
|
29
29
|
var _defaultPropsMap$type;
|
30
30
|
var type = props.type;
|
31
31
|
return (_defaultPropsMap$type = defaultPropsMap[type]) === null || _defaultPropsMap$type === void 0 ? void 0 : _defaultPropsMap$type.call(defaultPropsMap, props);
|