@zat-design/sisyphus-react 3.13.19-beta.6 → 3.13.19-beta.8
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/.claude/settings.local.json +9 -0
- package/PROJECT_GUIDE.md +250 -0
- package/dist/sisyphus-react.min.css +2 -0
- package/dist/sisyphus-react.min.js +1 -0
- package/es/FormsProvider/index.js +9 -7
- package/es/ProAction/components/CheckModalContent/index.js +14 -14
- package/es/ProAction/index.js +46 -47
- package/es/ProConfigProvider/index.js +25 -19
- package/es/ProDownload/index.js +66 -73
- package/es/ProDownload/utils.js +26 -23
- package/es/ProDrawerForm/components/ProDrawer/index.js +43 -39
- package/es/ProDrawerForm/components/ProModal/index.js +25 -23
- package/es/ProDrawerForm/components/index.js +2 -2
- package/es/ProDrawerForm/index.js +19 -21
- package/es/ProDrawerForm/utils/index.js +1 -1
- package/es/ProEditLabel/components/RenderProForm.js +30 -26
- package/es/ProEditLabel/index.js +49 -36
- package/es/ProEditLabel/utils/index.js +4 -3
- package/es/ProEditTable/components/ActionButton/index.js +83 -76
- package/es/ProEditTable/components/RcTable/BaseTable.js +24 -24
- package/es/ProEditTable/components/RcTable/DraggableTable.js +34 -41
- package/es/ProEditTable/components/RcTable/VirtualTable.js +4 -3
- package/es/ProEditTable/components/RcTable/index.js +3 -3
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +61 -57
- package/es/ProEditTable/components/RenderField/index.js +151 -145
- package/es/ProEditTable/components/RenderToolbar/index.js +37 -42
- package/es/ProEditTable/components/Summary/index.js +22 -21
- package/es/ProEditTable/components/Validator/index.js +11 -10
- package/es/ProEditTable/components/index.js +5 -5
- package/es/ProEditTable/index.d.ts +1 -1
- package/es/ProEditTable/index.js +170 -173
- package/es/ProEditTable/utils/config.js +42 -46
- package/es/ProEditTable/utils/diffOriginal.js +34 -19
- package/es/ProEditTable/utils/getDefaultProps.js +12 -13
- package/es/ProEditTable/utils/index.js +102 -99
- package/es/ProEditTable/utils/tools.js +88 -91
- package/es/ProEditTable/utils/transform.js +7 -11
- package/es/ProEditTable/utils/useEditTableError.js +22 -13
- package/es/ProEnum/components/Group.js +23 -27
- package/es/ProEnum/components/Tag.js +14 -16
- package/es/ProEnum/hooks/useEnum.js +32 -14
- package/es/ProEnum/hooks/useEnumRequest.js +42 -42
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +16 -16
- package/es/ProEnum/index.js +80 -89
- package/es/ProEnum/utils/eventCenter.js +23 -32
- package/es/ProEnum/utils/frequentEnum.js +15 -4
- package/es/ProEnum/utils/getEnumLabel.js +16 -21
- package/es/ProEnum/utils/index.js +12 -7
- package/es/ProForm/components/Container.js +8 -6
- package/es/ProForm/components/FormFooter/index.js +21 -19
- package/es/ProForm/components/base/Checkbox/index.js +16 -15
- package/es/ProForm/components/base/DatePicker/index.js +23 -20
- package/es/ProForm/components/base/Input/index.js +20 -18
- package/es/ProForm/components/base/InputNumber/index.js +57 -53
- package/es/ProForm/components/base/Radio/index.js +15 -15
- package/es/ProForm/components/base/RangePicker/index.js +24 -29
- package/es/ProForm/components/base/RangePicker/useDateRange.js +3 -3
- package/es/ProForm/components/base/Select/index.js +17 -15
- package/es/ProForm/components/base/Switch/index.js +16 -15
- package/es/ProForm/components/base/SwitchCheckbox/index.js +19 -18
- package/es/ProForm/components/base/TextArea/index.js +18 -17
- package/es/ProForm/components/base/TimePicker/index.js +10 -9
- package/es/ProForm/components/combination/Container/index.js +25 -23
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +80 -92
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +21 -19
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +7 -7
- package/es/ProForm/components/combination/FormList/components/Empty.js +21 -20
- package/es/ProForm/components/combination/FormList/components/LineFields.js +19 -18
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +45 -51
- package/es/ProForm/components/combination/FormList/index.js +43 -51
- package/es/ProForm/components/combination/FormList/utils.js +9 -9
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +8 -6
- package/es/ProForm/components/combination/Group/component/ComRender.js +33 -29
- package/es/ProForm/components/combination/Group/hooks/index.js +49 -47
- package/es/ProForm/components/combination/Group/index.js +38 -37
- package/es/ProForm/components/combination/Group/utils.js +56 -50
- package/es/ProForm/components/combination/ProCascader/index.js +81 -85
- package/es/ProForm/components/combination/ProCascader/utils/index.js +6 -6
- package/es/ProForm/components/combination/ProCombination/index.js +41 -37
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +31 -25
- package/es/ProForm/components/combination/ProModalSelect/index.js +166 -173
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +46 -51
- package/es/ProForm/components/combination/ProRangeLimit/index.js +39 -39
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +3 -3
- package/es/ProForm/components/combination/ProTimeLimit/index.js +43 -40
- package/es/ProForm/components/index.d.ts +1 -0
- package/es/ProForm/components/index.js +40 -35
- package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.js +30 -28
- package/es/ProForm/components/old/EnumSelect/index.js +55 -62
- package/es/ProForm/components/old/InputRange/index.js +17 -16
- package/es/ProForm/components/old/InputWithSuffix/index.js +6 -5
- package/es/ProForm/components/old/ProAddress/index.js +53 -75
- package/es/ProForm/components/old/ProCertNo/index.js +17 -17
- package/es/ProForm/components/old/ProCertValidity/index.js +19 -21
- package/es/ProForm/components/old/ProRangeBox/index.js +25 -24
- package/es/ProForm/components/render/ChangedWrapper.js +34 -33
- package/es/ProForm/components/render/ConfirmWrapper.js +16 -18
- package/es/ProForm/components/render/Render.js +150 -135
- package/es/ProForm/components/render/RenderFields.js +65 -50
- package/es/ProForm/components/render/propsType.js +25 -0
- package/es/ProForm/index.js +83 -70
- package/es/ProForm/propsType.d.ts +1 -1
- package/es/ProForm/propsType.js +5 -1
- package/es/ProForm/utils/diffOriginal.js +30 -16
- package/es/ProForm/utils/getDefaultProps.js +10 -10
- package/es/ProForm/utils/index.js +105 -110
- package/es/ProForm/utils/processDependencies.js +15 -5
- package/es/ProForm/utils/rulesCreator.js +21 -22
- package/es/ProForm/utils/transformNames.js +7 -6
- package/es/ProForm/utils/transformValue.js +16 -13
- package/es/ProForm/utils/useDeepCompareMemo.js +6 -4
- package/es/ProForm/utils/useFieldProps.js +1 -3
- package/es/ProForm/utils/useForm.js +36 -34
- package/es/ProForm/utils/useRules.js +28 -31
- package/es/ProForm/utils/useShouldUpdate.js +83 -86
- package/es/ProForm/utils/useWatch.js +36 -14
- package/es/ProForm/utils/valueType.js +51 -52
- package/es/ProIcon/config/index.js +2 -0
- package/es/ProIcon/index.js +53 -49
- package/es/ProIcon/utils/index.js +8 -9
- package/es/ProLayout/components/Layout/Header/index.js +13 -11
- package/es/ProLayout/components/Layout/Icon/Icon.js +7 -7
- package/es/ProLayout/components/Layout/Icon/index.js +1 -1
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +42 -40
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +51 -52
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +10 -9
- package/es/ProLayout/components/Layout/Menu/index.js +20 -18
- package/es/ProLayout/components/Layout/Notice/index.js +12 -11
- package/es/ProLayout/components/Layout/index.js +4 -4
- package/es/ProLayout/components/ProCollapse/index.js +35 -32
- package/es/ProLayout/components/ProFooter/index.js +13 -15
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +9 -9
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +8 -7
- package/es/ProLayout/components/ProHeader/components/index.js +2 -2
- package/es/ProLayout/components/ProHeader/index.js +129 -118
- package/es/ProLayout/components/ProHeader/utils/index.js +1 -1
- package/es/ProLayout/components/index.js +3 -3
- package/es/ProLayout/index.d.ts +1 -1
- package/es/ProLayout/index.js +28 -25
- package/es/ProLayout/utils/index.js +37 -35
- package/es/ProSelect/components/AdaptiveTooltip.js +10 -11
- package/es/ProSelect/index.js +87 -99
- package/es/ProSelect/utils/index.js +27 -33
- package/es/ProStep/components/Anchor/index.d.ts +1 -0
- package/es/ProStep/components/Anchor/index.js +26 -25
- package/es/ProStep/components/Item/index.d.ts +1 -0
- package/es/ProStep/components/Item/index.js +26 -22
- package/es/ProStep/components/Listener/index.js +11 -15
- package/es/ProStep/components/Step/index.js +24 -25
- package/es/ProStep/index.js +51 -53
- package/es/ProStep/utils/index.js +13 -12
- package/es/ProStepTab/index.js +59 -37
- package/es/ProTable/components/FormatColumn/index.js +106 -110
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +7 -9
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -50
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +24 -24
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +8 -10
- package/es/ProTable/components/RcTable/index.js +2 -2
- package/es/ProTable/components/RenderColumn/index.js +51 -51
- package/es/ProTable/components/RenderEmptyText/index.js +8 -7
- package/es/ProTable/components/RenderFooter/index.js +3 -3
- package/es/ProTable/components/RenderSummary/index.js +13 -13
- package/es/ProTable/components/RenderTableHeader/index.js +16 -14
- package/es/ProTable/components/RenderTabs/index.js +28 -33
- package/es/ProTable/components/TableResizable/index.js +17 -16
- package/es/ProTable/components/TooltipTitle/index.js +7 -6
- package/es/ProTable/components/index.js +11 -6
- package/es/ProTable/hooks/useAntdTable.js +106 -119
- package/es/ProTable/index.js +158 -176
- package/es/ProTable/utils/index.js +25 -21
- package/es/ProTabs/components/Card/index.js +15 -14
- package/es/ProTabs/components/index.js +1 -1
- package/es/ProTabs/index.js +24 -25
- package/es/ProThemeTools/component/ProTools/index.js +69 -68
- package/es/ProThemeTools/component/index.js +1 -1
- package/es/ProThemeTools/index.js +47 -33
- package/es/ProThemeTools/utils/index.js +20 -17
- package/es/ProTooltip/index.js +44 -46
- package/es/ProTree/components/AdaptiveTooltip.js +5 -7
- package/es/ProTree/components/CloseIcon.js +5 -5
- package/es/ProTree/components/List.js +22 -24
- package/es/ProTree/components/ProTree.js +84 -102
- package/es/ProTree/components/ProTreeSelect/index.js +128 -119
- package/es/ProTree/components/SearchTitle.js +10 -9
- package/es/ProTree/components/Tree.js +57 -58
- package/es/ProTree/components/index.js +4 -4
- package/es/ProTree/index.js +6 -6
- package/es/ProTree/utils.js +29 -22
- package/es/ProTreeModal/components/Cascader.js +31 -33
- package/es/ProTreeModal/components/CloseIcon.js +5 -5
- package/es/ProTreeModal/components/List.js +74 -93
- package/es/ProTreeModal/components/SearchTitle.js +5 -4
- package/es/ProTreeModal/components/SortableItem.js +14 -14
- package/es/ProTreeModal/components/Tree.js +49 -53
- package/es/ProTreeModal/components/Trigger.js +29 -28
- package/es/ProTreeModal/components/index.js +6 -6
- package/es/ProTreeModal/index.js +166 -206
- package/es/ProTreeModal/utils.js +37 -33
- package/es/ProUpload/components/ButtonRender.js +33 -36
- package/es/ProUpload/components/DragRender.js +54 -51
- package/es/ProUpload/components/DraggableUploadListItem.js +5 -4
- package/es/ProUpload/components/Example.js +13 -12
- package/es/ProUpload/components/FileItem.js +63 -58
- package/es/ProUpload/components/ImageRender.js +98 -100
- package/es/ProUpload/index.js +75 -82
- package/es/ProUpload/uitls.js +3 -3
- package/es/ProUtils/utils/index.js +10 -14
- package/es/ProViewer/index.js +29 -25
- package/es/ProViewer/propsType.js +0 -1
- package/es/ProWaterMark/index.js +5 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +38 -29
- package/es/locale/index.js +7 -4
- package/es/old/ProCertValidity/index.js +19 -21
- package/es/old/ProEditableTable/index.js +156 -156
- package/es/old/ProEditableTable/utils.js +61 -63
- package/es/tokens.js +1 -0
- package/es/utils/index.js +12 -12
- package/lib/FormsProvider/index.js +11 -7
- package/lib/ProAction/components/CheckModalContent/index.js +11 -13
- package/lib/ProAction/index.js +40 -43
- package/lib/ProConfigProvider/index.js +23 -16
- package/lib/ProDownload/index.js +65 -71
- package/lib/ProDownload/utils.js +25 -22
- package/lib/ProDrawerForm/components/ProDrawer/index.js +39 -38
- package/lib/ProDrawerForm/components/ProModal/index.js +23 -22
- package/lib/ProDrawerForm/index.js +18 -18
- package/lib/ProDrawerForm/utils/index.js +3 -2
- package/lib/ProEditLabel/components/RenderProForm.js +26 -24
- package/lib/ProEditLabel/index.js +46 -35
- package/lib/ProEditLabel/utils/index.js +6 -5
- package/lib/ProEditTable/components/ActionButton/index.js +79 -74
- package/lib/ProEditTable/components/RcTable/BaseTable.js +21 -23
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +32 -40
- package/lib/ProEditTable/components/RcTable/VirtualTable.js +3 -3
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +62 -59
- package/lib/ProEditTable/components/RenderField/index.js +137 -132
- package/lib/ProEditTable/components/RenderToolbar/index.js +34 -41
- package/lib/ProEditTable/components/Summary/index.js +20 -20
- package/lib/ProEditTable/components/Validator/index.js +10 -10
- package/lib/ProEditTable/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +159 -164
- package/lib/ProEditTable/utils/config.js +40 -44
- package/lib/ProEditTable/utils/diffOriginal.js +36 -21
- package/lib/ProEditTable/utils/getDefaultProps.js +14 -15
- package/lib/ProEditTable/utils/index.js +97 -97
- package/lib/ProEditTable/utils/tools.js +96 -91
- package/lib/ProEditTable/utils/transform.js +7 -11
- package/lib/ProEditTable/utils/useEditTableError.js +22 -13
- package/lib/ProEnum/components/Group.js +23 -27
- package/lib/ProEnum/components/Tag.js +14 -16
- package/lib/ProEnum/hooks/useEnum.js +30 -12
- package/lib/ProEnum/hooks/useEnumRequest.js +39 -39
- package/lib/ProEnum/hooks/useFrequentEnumRequest.js +15 -15
- package/lib/ProEnum/index.js +68 -78
- package/lib/ProEnum/utils/eventCenter.js +23 -32
- package/lib/ProEnum/utils/frequentEnum.js +13 -3
- package/lib/ProEnum/utils/getEnumLabel.js +15 -21
- package/lib/ProEnum/utils/index.js +12 -7
- package/lib/ProForm/components/Container.js +7 -5
- package/lib/ProForm/components/FormFooter/index.js +19 -17
- package/lib/ProForm/components/base/Checkbox/index.js +14 -13
- package/lib/ProForm/components/base/DatePicker/index.js +20 -17
- package/lib/ProForm/components/base/Input/index.js +15 -15
- package/lib/ProForm/components/base/InputNumber/index.js +51 -48
- package/lib/ProForm/components/base/Radio/index.js +13 -13
- package/lib/ProForm/components/base/RangePicker/index.js +19 -22
- package/lib/ProForm/components/base/RangePicker/useDateRange.js +5 -4
- package/lib/ProForm/components/base/Select/index.js +14 -12
- package/lib/ProForm/components/base/Switch/index.js +11 -11
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +16 -15
- package/lib/ProForm/components/base/TextArea/index.js +14 -13
- package/lib/ProForm/components/base/TimePicker/index.js +6 -5
- package/lib/ProForm/components/combination/Container/index.js +22 -21
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +77 -89
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +17 -15
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +7 -7
- package/lib/ProForm/components/combination/FormList/components/Empty.js +17 -18
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +14 -14
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +43 -48
- package/lib/ProForm/components/combination/FormList/index.js +35 -43
- package/lib/ProForm/components/combination/FormList/utils.js +11 -10
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +7 -5
- package/lib/ProForm/components/combination/Group/component/ComRender.js +30 -28
- package/lib/ProForm/components/combination/Group/hooks/index.js +48 -45
- package/lib/ProForm/components/combination/Group/index.js +34 -35
- package/lib/ProForm/components/combination/Group/utils.js +62 -50
- package/lib/ProForm/components/combination/ProCascader/index.js +75 -80
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +8 -7
- package/lib/ProForm/components/combination/ProCombination/index.js +35 -31
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +30 -24
- package/lib/ProForm/components/combination/ProModalSelect/index.js +171 -180
- package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/index.js +42 -48
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +35 -35
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +3 -3
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +37 -34
- package/lib/ProForm/components/index.d.ts +1 -0
- package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.js +35 -33
- package/lib/ProForm/components/old/EnumSelect/index.js +50 -58
- package/lib/ProForm/components/old/InputRange/index.js +16 -16
- package/lib/ProForm/components/old/InputWithSuffix/index.js +4 -4
- package/lib/ProForm/components/old/ProAddress/index.js +53 -75
- package/lib/ProForm/components/old/ProCertNo/index.js +16 -17
- package/lib/ProForm/components/old/ProCertValidity/index.js +17 -18
- package/lib/ProForm/components/old/ProRangeBox/index.js +24 -24
- package/lib/ProForm/components/render/ChangedWrapper.js +35 -35
- package/lib/ProForm/components/render/ConfirmWrapper.js +14 -17
- package/lib/ProForm/components/render/Render.js +138 -125
- package/lib/ProForm/components/render/RenderFields.js +57 -43
- package/lib/ProForm/components/render/propsType.js +26 -1
- package/lib/ProForm/index.js +74 -61
- package/lib/ProForm/propsType.d.ts +1 -1
- package/lib/ProForm/propsType.js +5 -1
- package/lib/ProForm/utils/diffOriginal.js +30 -17
- package/lib/ProForm/utils/getDefaultProps.js +12 -12
- package/lib/ProForm/utils/index.js +127 -106
- package/lib/ProForm/utils/processDependencies.js +15 -6
- package/lib/ProForm/utils/rulesCreator.js +21 -21
- package/lib/ProForm/utils/transformNames.js +6 -6
- package/lib/ProForm/utils/transformValue.js +14 -11
- package/lib/ProForm/utils/useDeepCompareMemo.js +7 -6
- package/lib/ProForm/utils/useFieldProps.js +2 -3
- package/lib/ProForm/utils/useForm.js +33 -31
- package/lib/ProForm/utils/useRules.js +25 -28
- package/lib/ProForm/utils/useShouldUpdate.js +82 -85
- package/lib/ProForm/utils/useWatch.js +36 -14
- package/lib/ProForm/utils/valueType.js +52 -52
- package/lib/ProIcon/config/index.js +2 -0
- package/lib/ProIcon/index.js +47 -44
- package/lib/ProIcon/utils/index.js +10 -8
- package/lib/ProLayout/components/Layout/Header/index.js +10 -10
- package/lib/ProLayout/components/Layout/Icon/Icon.js +8 -7
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +37 -36
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +49 -52
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +8 -8
- package/lib/ProLayout/components/Layout/Menu/index.js +17 -16
- package/lib/ProLayout/components/Layout/Notice/index.js +8 -8
- package/lib/ProLayout/components/ProCollapse/index.js +32 -30
- package/lib/ProLayout/components/ProFooter/index.js +14 -16
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +7 -7
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +6 -7
- package/lib/ProLayout/components/ProHeader/index.js +131 -120
- package/lib/ProLayout/components/ProHeader/utils/index.js +3 -2
- package/lib/ProLayout/index.d.ts +1 -1
- package/lib/ProLayout/index.js +22 -21
- package/lib/ProLayout/utils/index.js +42 -33
- package/lib/ProSelect/components/AdaptiveTooltip.js +9 -11
- package/lib/ProSelect/index.js +82 -93
- package/lib/ProSelect/utils/index.js +29 -34
- package/lib/ProStep/components/Anchor/index.d.ts +1 -0
- package/lib/ProStep/components/Anchor/index.js +25 -24
- package/lib/ProStep/components/Item/index.d.ts +1 -0
- package/lib/ProStep/components/Item/index.js +24 -20
- package/lib/ProStep/components/Listener/index.js +9 -13
- package/lib/ProStep/components/Step/index.js +20 -21
- package/lib/ProStep/index.js +45 -49
- package/lib/ProStep/utils/index.js +16 -12
- package/lib/ProStepTab/index.js +60 -38
- package/lib/ProTable/components/FormatColumn/index.js +100 -104
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +5 -7
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +34 -48
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +25 -23
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +5 -7
- package/lib/ProTable/components/RenderColumn/index.js +46 -48
- package/lib/ProTable/components/RenderEmptyText/index.js +6 -6
- package/lib/ProTable/components/RenderFooter/index.js +3 -3
- package/lib/ProTable/components/RenderSummary/index.js +11 -12
- package/lib/ProTable/components/RenderTableHeader/index.js +14 -13
- package/lib/ProTable/components/RenderTabs/index.js +27 -32
- package/lib/ProTable/components/TableResizable/index.js +16 -15
- package/lib/ProTable/components/TooltipTitle/index.js +5 -5
- package/lib/ProTable/hooks/useAntdTable.js +103 -116
- package/lib/ProTable/index.js +149 -169
- package/lib/ProTable/utils/index.js +33 -22
- package/lib/ProTabs/components/Card/index.js +14 -14
- package/lib/ProTabs/index.js +24 -24
- package/lib/ProThemeTools/component/ProTools/index.js +66 -65
- package/lib/ProThemeTools/index.js +43 -29
- package/lib/ProThemeTools/utils/index.js +25 -18
- package/lib/ProTooltip/index.js +44 -46
- package/lib/ProTree/components/AdaptiveTooltip.js +5 -7
- package/lib/ProTree/components/CloseIcon.js +5 -5
- package/lib/ProTree/components/List.js +18 -22
- package/lib/ProTree/components/ProTree.js +77 -96
- package/lib/ProTree/components/ProTreeSelect/index.js +126 -116
- package/lib/ProTree/components/SearchTitle.js +8 -8
- package/lib/ProTree/components/Tree.js +53 -55
- package/lib/ProTree/index.js +4 -4
- package/lib/ProTree/utils.js +34 -25
- package/lib/ProTreeModal/components/Cascader.js +28 -32
- package/lib/ProTreeModal/components/CloseIcon.js +5 -5
- package/lib/ProTreeModal/components/List.js +69 -89
- package/lib/ProTreeModal/components/SearchTitle.js +4 -4
- package/lib/ProTreeModal/components/SortableItem.js +11 -12
- package/lib/ProTreeModal/components/Tree.js +44 -49
- package/lib/ProTreeModal/components/Trigger.js +26 -26
- package/lib/ProTreeModal/index.js +157 -199
- package/lib/ProTreeModal/utils.js +43 -35
- package/lib/ProUpload/components/ButtonRender.js +29 -33
- package/lib/ProUpload/components/DragRender.js +50 -48
- package/lib/ProUpload/components/DraggableUploadListItem.js +7 -5
- package/lib/ProUpload/components/Example.js +13 -11
- package/lib/ProUpload/components/FileItem.js +58 -50
- package/lib/ProUpload/components/ImageRender.js +89 -93
- package/lib/ProUpload/index.js +68 -76
- package/lib/ProUpload/uitls.js +5 -3
- package/lib/ProUtils/utils/index.js +10 -14
- package/lib/ProViewer/index.js +26 -24
- package/lib/ProViewer/propsType.js +1 -5
- package/lib/ProWaterMark/index.js +5 -4
- package/lib/index.d.ts +1 -1
- package/lib/locale/index.js +6 -2
- package/lib/old/ProCertValidity/index.js +17 -18
- package/lib/old/ProEditableTable/index.js +153 -156
- package/lib/old/ProEditableTable/utils.js +61 -62
- package/lib/tokens.js +1 -0
- package/lib/utils/index.js +16 -13
- package/package.json +6 -8
- package/dist/index.esm.css +0 -6344
- package/dist/index.esm.js +0 -3
- package/dist/less.esm.css +0 -5768
- package/dist/less.esm.js +0 -3
@@ -1,42 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.default = void 0;
|
8
|
-
require("antd/es/table/style");
|
9
|
-
var _table = _interopRequireDefault(require("antd/es/table"));
|
10
9
|
require("antd/es/config-provider/style");
|
11
10
|
var _configProvider = _interopRequireDefault(require("antd/es/config-provider"));
|
12
|
-
require("antd/es/
|
13
|
-
var
|
14
|
-
require("antd/es/popconfirm/style");
|
15
|
-
var _popconfirm = _interopRequireDefault(require("antd/es/popconfirm"));
|
11
|
+
require("antd/es/table/style");
|
12
|
+
var _table = _interopRequireDefault(require("antd/es/table"));
|
16
13
|
require("antd/es/space/style");
|
17
14
|
var _space = _interopRequireDefault(require("antd/es/space"));
|
15
|
+
require("antd/es/popconfirm/style");
|
16
|
+
var _popconfirm = _interopRequireDefault(require("antd/es/popconfirm"));
|
17
|
+
require("antd/es/button/style");
|
18
|
+
var _button = _interopRequireDefault(require("antd/es/button"));
|
18
19
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
19
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
20
20
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
21
21
|
require("antd/es/message/style");
|
22
22
|
var _message2 = _interopRequireDefault(require("antd/es/message"));
|
23
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
24
23
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
25
24
|
require("antd/es/form/style");
|
26
25
|
var _form = _interopRequireDefault(require("antd/es/form"));
|
27
26
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
28
27
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
29
|
-
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
30
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
31
28
|
var _icons = require("@ant-design/icons");
|
32
29
|
var _ahooks = require("ahooks");
|
33
|
-
var
|
30
|
+
var _lodash = require("lodash");
|
31
|
+
var _react = _interopRequireWildcard(require("react"));
|
34
32
|
var _empty = _interopRequireDefault(require("../../assets/empty.png"));
|
35
33
|
var _utils = require("./utils");
|
34
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
36
35
|
var _excluded = ["form", "dataSource", "setDataSource", "columns", "actionRef", "addButtonProps", "pagination", "editType", "onlyOneLineEditorAlertMessage", "noSaveAlertMessage", "mulDeletePoconfirmMsg", "name", "disabled", "formProps"],
|
37
|
-
_excluded2 = ["isCanAdd", "isCanMultipleDelete", "multipleDeleteModalProps", "position", "buttonText", "emptyButtonText", "insertType", "onlyAddOneLineAlertMessage"];
|
38
|
-
|
39
|
-
var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
36
|
+
_excluded2 = ["isCanAdd", "isCanMultipleDelete", "multipleDeleteModalProps", "position", "buttonText", "emptyButtonText", "insertType", "onlyAddOneLineAlertMessage"]; // 1、保证再去取dataSource数据纯净 table里面用list进行处理
|
37
|
+
var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
40
38
|
var originForm = props.form,
|
41
39
|
dataSource = props.dataSource,
|
42
40
|
setDataSource = props.setDataSource,
|
@@ -57,6 +55,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
57
55
|
var _Form$useForm = _form.default.useForm(originForm),
|
58
56
|
_Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
|
59
57
|
form = _Form$useForm2[0];
|
58
|
+
|
60
59
|
// table实例
|
61
60
|
var tableRef = (0, _react.useRef)();
|
62
61
|
var _useState = (0, _react.useState)(dataSource),
|
@@ -93,12 +92,11 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
93
92
|
_ref$onlyAddOneLineAl = _ref.onlyAddOneLineAlertMessage,
|
94
93
|
onlyAddOneLineAlertMessage = _ref$onlyAddOneLineAl === void 0 ? '只能新增一行' : _ref$onlyAddOneLineAl,
|
95
94
|
antButtonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
|
95
|
+
|
96
96
|
// 获取key
|
97
|
-
var getRowKey =
|
98
|
-
return record.rowKey;
|
99
|
-
};
|
97
|
+
var getRowKey = record => record.rowKey;
|
100
98
|
var rowSelection = {
|
101
|
-
onChange:
|
99
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
102
100
|
setSelectedRows(selectedRows);
|
103
101
|
setSelectedRowKeys(selectedRowKeys);
|
104
102
|
}
|
@@ -106,85 +104,86 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
106
104
|
// disabled: !getRowKey(record) || String(getRowKey(record)).startsWith('&&'), // 新增的虚拟行不可选中
|
107
105
|
// }),
|
108
106
|
};
|
107
|
+
|
109
108
|
/**
|
110
109
|
* 监听行数据变化同步list
|
111
110
|
* @param {number} rowIndex 修改行的index
|
112
111
|
* @param {any} values 需要更新的数据
|
113
112
|
* @returns {promise}
|
114
113
|
*/
|
115
|
-
var onUpdateRowData =
|
116
|
-
var nextList = (0,
|
114
|
+
var onUpdateRowData = (rowIndex, values) => {
|
115
|
+
var nextList = (0, _lodash.cloneDeep)(list);
|
117
116
|
nextList[rowIndex] = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, nextList[rowIndex]), values);
|
118
|
-
setDataSource ? setDataSource(nextList) : setList(
|
117
|
+
setDataSource ? setDataSource(nextList) : setList([...nextList]);
|
119
118
|
return Promise.resolve({
|
120
|
-
rowIndex
|
121
|
-
nextList
|
119
|
+
rowIndex,
|
120
|
+
nextList,
|
122
121
|
list: (0, _utils.formatList)(nextList),
|
123
122
|
rowData: nextList[rowIndex]
|
124
123
|
});
|
125
124
|
};
|
126
|
-
var handleMulResetForm =
|
125
|
+
var handleMulResetForm = () => {
|
127
126
|
var values = form.getFieldsValue();
|
128
127
|
var tempValues = {};
|
129
|
-
Object.keys(values).forEach(
|
128
|
+
Object.keys(values).forEach(index => {
|
130
129
|
tempValues[+index + 1] = values[index];
|
131
130
|
});
|
132
131
|
form.resetFields([0]);
|
133
132
|
form.setFieldsValue((0, _objectSpread2.default)({}, tempValues));
|
134
133
|
};
|
134
|
+
|
135
135
|
/**
|
136
136
|
* 新增行
|
137
137
|
* @param {IRowDataPropsType} rowData 初始化数据
|
138
138
|
* @param {IAddOptionsPropsType} options 新增配置选项
|
139
139
|
* @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
|
140
140
|
*/
|
141
|
-
var onAdd =
|
141
|
+
var onAdd = rowData => {
|
142
142
|
if (isSingle) {
|
143
143
|
var _list$filter;
|
144
|
-
var isOneEditing = ((_list$filter = list.filter(
|
145
|
-
return item.editable;
|
146
|
-
})) === null || _list$filter === void 0 ? void 0 : _list$filter.length) >= 1;
|
144
|
+
var isOneEditing = ((_list$filter = list.filter(item => item.editable)) === null || _list$filter === void 0 ? void 0 : _list$filter.length) >= 1;
|
147
145
|
if (isOneEditing) {
|
148
146
|
_message2.default.warning(onlyAddOneLineAlertMessage);
|
149
147
|
return Promise.reject(onlyAddOneLineAlertMessage);
|
150
148
|
}
|
151
149
|
}
|
152
150
|
var rowIndex = 0;
|
153
|
-
var nextList = (0,
|
151
|
+
var nextList = (0, _lodash.cloneDeep)(list);
|
154
152
|
if (insertType === 'before') {
|
155
153
|
handleMulResetForm();
|
156
154
|
nextList.unshift((0, _objectSpread2.default)((0, _objectSpread2.default)({}, rowData), {}, {
|
157
155
|
editable: true,
|
158
156
|
isFirst: true,
|
159
|
-
rowKey:
|
157
|
+
rowKey: `&&${(0, _utils.getRandom)()}`
|
160
158
|
}));
|
161
159
|
} else if (insertType === 'after') {
|
162
160
|
nextList.push((0, _objectSpread2.default)((0, _objectSpread2.default)({}, rowData), {}, {
|
163
161
|
editable: true,
|
164
162
|
isFirst: true,
|
165
|
-
rowKey:
|
163
|
+
rowKey: `&&${(0, _utils.getRandom)()}`
|
166
164
|
}));
|
167
165
|
rowIndex = list.length;
|
168
166
|
}
|
169
|
-
setDataSource ? setDataSource(nextList) : setList(
|
167
|
+
setDataSource ? setDataSource(nextList) : setList([...nextList]);
|
170
168
|
return Promise.resolve({
|
171
|
-
rowIndex
|
172
|
-
nextList
|
169
|
+
rowIndex,
|
170
|
+
nextList,
|
173
171
|
list: (0, _utils.formatList)(nextList),
|
174
172
|
rowData: nextList[rowIndex]
|
175
173
|
});
|
176
174
|
};
|
175
|
+
|
177
176
|
/**
|
178
177
|
* 删除多行
|
179
178
|
* @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
|
180
179
|
*/
|
181
180
|
var onMultipleDelete = /*#__PURE__*/function () {
|
182
|
-
var _ref2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
181
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
183
182
|
var res, values, nextList, resetFieldsIndex;
|
184
183
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
185
184
|
while (1) switch (_context.prev = _context.next) {
|
186
185
|
case 0:
|
187
|
-
if (!(addButtonProps
|
186
|
+
if (!(addButtonProps !== null && addButtonProps !== void 0 && addButtonProps.onMultipleDelete)) {
|
188
187
|
_context.next = 6;
|
189
188
|
break;
|
190
189
|
}
|
@@ -202,13 +201,11 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
202
201
|
_context.next = 20;
|
203
202
|
break;
|
204
203
|
}
|
205
|
-
values = (0,
|
206
|
-
nextList = (0,
|
207
|
-
nextList = nextList.filter(
|
208
|
-
return !selectedRowKeys.includes(getRowKey(item));
|
209
|
-
});
|
204
|
+
values = (0, _lodash.cloneDeep)(form.getFieldsValue(true));
|
205
|
+
nextList = (0, _lodash.cloneDeep)(list);
|
206
|
+
nextList = nextList.filter(item => !selectedRowKeys.includes(getRowKey(item)));
|
210
207
|
resetFieldsIndex = [];
|
211
|
-
Object.keys(values).forEach(
|
208
|
+
Object.keys(values).forEach(key => {
|
212
209
|
// eslint-disable-next-line no-restricted-globals
|
213
210
|
if (!isNaN(Number(key))) {
|
214
211
|
resetFieldsIndex.push(key);
|
@@ -216,18 +213,21 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
216
213
|
});
|
217
214
|
setSelectedRows([]);
|
218
215
|
setSelectedRowKeys([]);
|
216
|
+
|
219
217
|
// 清空删除后最后一条formItem状态
|
220
218
|
form.resetFields(resetFieldsIndex);
|
221
|
-
nextList.forEach(
|
219
|
+
nextList.forEach((item, index) => {
|
222
220
|
// 可编辑状态默认给表单回填数据
|
223
221
|
if (item.editable) {
|
224
|
-
form.setFieldsValue(
|
222
|
+
form.setFieldsValue({
|
223
|
+
[index]: item
|
224
|
+
});
|
225
225
|
}
|
226
226
|
});
|
227
|
-
setDataSource ? setDataSource(nextList) : setList(
|
227
|
+
setDataSource ? setDataSource(nextList) : setList([...nextList]);
|
228
228
|
return _context.abrupt("return", Promise.resolve({
|
229
229
|
rowIndex: 0,
|
230
|
-
nextList
|
230
|
+
nextList,
|
231
231
|
list: (0, _utils.formatList)(nextList),
|
232
232
|
rowData: nextList[0]
|
233
233
|
}));
|
@@ -241,21 +241,22 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
241
241
|
return _ref2.apply(this, arguments);
|
242
242
|
};
|
243
243
|
}();
|
244
|
+
|
244
245
|
/**
|
245
246
|
* 删除行
|
246
247
|
* @param {number} rowIndex 当前删除行的下标
|
247
248
|
* @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
|
248
249
|
*/
|
249
|
-
var onDelete =
|
250
|
-
var values = (0,
|
250
|
+
var onDelete = rowIndex => {
|
251
|
+
var values = (0, _lodash.cloneDeep)(form.getFieldsValue(true));
|
251
252
|
var lastIndex = list.length - 1;
|
252
253
|
form.resetFields([rowIndex]);
|
253
|
-
var nextList = (0,
|
254
|
-
setSelectedRows(selectedRows.filter(
|
254
|
+
var nextList = (0, _lodash.cloneDeep)(list);
|
255
|
+
setSelectedRows(selectedRows.filter(item => {
|
255
256
|
var _nextList$rowIndex;
|
256
257
|
return item.rowKey !== ((_nextList$rowIndex = nextList[rowIndex]) === null || _nextList$rowIndex === void 0 ? void 0 : _nextList$rowIndex.rowKey);
|
257
258
|
}));
|
258
|
-
setSelectedRowKeys(selectedRowKeys.filter(
|
259
|
+
setSelectedRowKeys(selectedRowKeys.filter(key => {
|
259
260
|
var _nextList$rowIndex2;
|
260
261
|
return key !== ((_nextList$rowIndex2 = nextList[rowIndex]) === null || _nextList$rowIndex2 === void 0 ? void 0 : _nextList$rowIndex2.rowKey);
|
261
262
|
}));
|
@@ -265,27 +266,29 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
265
266
|
editable = _nextList$i.editable,
|
266
267
|
isFirst = _nextList$i.isFirst;
|
267
268
|
nextList[i] = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, nextList[i]), values[i + 1]), {}, {
|
268
|
-
editable
|
269
|
-
isFirst
|
269
|
+
editable,
|
270
|
+
isFirst
|
270
271
|
});
|
271
272
|
}
|
273
|
+
|
272
274
|
// 清空删除后最后一条formItem状态
|
273
275
|
form.resetFields([lastIndex]);
|
274
|
-
setDataSource ? setDataSource(nextList) : setList(
|
276
|
+
setDataSource ? setDataSource(nextList) : setList([...nextList]);
|
275
277
|
return Promise.resolve({
|
276
|
-
rowIndex
|
277
|
-
nextList
|
278
|
+
rowIndex,
|
279
|
+
nextList,
|
278
280
|
list: (0, _utils.formatList)(nextList),
|
279
281
|
rowData: nextList[rowIndex]
|
280
282
|
});
|
281
283
|
};
|
284
|
+
|
282
285
|
/**
|
283
286
|
* 保存行
|
284
287
|
* @param {number} rowIndex 当前保存行的下标
|
285
288
|
* @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
|
286
289
|
*/
|
287
290
|
var onSave = /*#__PURE__*/function () {
|
288
|
-
var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(rowIndex, callback) {
|
291
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(rowIndex, callback) {
|
289
292
|
var _form$getFieldsValue$, _form$getFieldsValue, nextValues, res, values;
|
290
293
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
291
294
|
while (1) switch (_context2.prev = _context2.next) {
|
@@ -299,7 +302,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
299
302
|
_context2.next = 5;
|
300
303
|
return callback({
|
301
304
|
preValues: originRowData[rowIndex],
|
302
|
-
nextValues
|
305
|
+
nextValues
|
303
306
|
});
|
304
307
|
case 5:
|
305
308
|
_context2.t0 = _context2.sent;
|
@@ -338,29 +341,33 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
338
341
|
return _ref3.apply(this, arguments);
|
339
342
|
};
|
340
343
|
}();
|
344
|
+
|
341
345
|
/**
|
342
346
|
* 编辑行
|
343
347
|
* @param {number}} rowIndex 当前保存行的下标
|
344
348
|
* @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
|
345
349
|
*/
|
346
|
-
var onEdit =
|
350
|
+
var onEdit = rowIndex => {
|
347
351
|
if (isSingle) {
|
348
352
|
var _list$filter2;
|
349
|
-
var isOneEditing = ((_list$filter2 = list.filter(
|
350
|
-
return item.editable;
|
351
|
-
})) === null || _list$filter2 === void 0 ? void 0 : _list$filter2.length) >= 1;
|
353
|
+
var isOneEditing = ((_list$filter2 = list.filter(item => item.editable)) === null || _list$filter2 === void 0 ? void 0 : _list$filter2.length) >= 1;
|
352
354
|
if (isOneEditing) {
|
353
355
|
_message2.default.warning(onlyOneLineEditorAlertMessage);
|
354
356
|
return Promise.reject(onlyOneLineEditorAlertMessage);
|
355
357
|
}
|
356
358
|
}
|
357
|
-
setOriginRowData(
|
358
|
-
|
359
|
+
setOriginRowData({
|
360
|
+
[rowIndex]: list[rowIndex]
|
361
|
+
});
|
362
|
+
form.setFieldsValue({
|
363
|
+
[rowIndex]: list[rowIndex]
|
364
|
+
});
|
359
365
|
return onUpdateRowData(rowIndex, {
|
360
366
|
editable: true,
|
361
367
|
isFirst: false
|
362
368
|
});
|
363
369
|
};
|
370
|
+
|
364
371
|
/**
|
365
372
|
* 取消行
|
366
373
|
* 第一次新增删除当前行 当点过编辑或者保存后,重置isFirst为false
|
@@ -368,7 +375,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
368
375
|
* @param {number}} rowIndex 当前保存行的下标
|
369
376
|
* @returns {Promise<{nextList: IRowDataPropsType[], list: IRowDataPropsType[], rowData: IRowDataPropsType, rowIndex: number}>}
|
370
377
|
*/
|
371
|
-
var onCancel =
|
378
|
+
var onCancel = (rowData, rowIndex) => {
|
372
379
|
if (rowData.isFirst) {
|
373
380
|
return onDelete(rowIndex);
|
374
381
|
}
|
@@ -377,46 +384,47 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
377
384
|
isFirst: false
|
378
385
|
}, originRowData[rowIndex]));
|
379
386
|
};
|
387
|
+
|
380
388
|
// 渲染新增按钮
|
381
|
-
var renderAddButton =
|
389
|
+
var renderAddButton = () => {
|
382
390
|
if (disabled || list.length === 0 || isCanAdd === false) {
|
383
391
|
return null;
|
384
392
|
}
|
385
|
-
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
386
|
-
children: buttonText !== false ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
387
|
-
children: typeof buttonText === 'string' ? (0, _jsxRuntime.jsxs)(_space.default, {
|
393
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
394
|
+
children: buttonText !== false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
395
|
+
children: typeof buttonText === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_space.default, {
|
388
396
|
style: {
|
389
397
|
display: 'flex',
|
390
398
|
justifyContent: ['topLeft', 'bottomLeft'].includes(position) ? 'flex-start' : 'flex-end',
|
391
399
|
margin: ['topLeft', 'topRight'].includes(position) ? '0 0 16px 0' : '16px 0 0 0'
|
392
400
|
},
|
393
|
-
children: [isCanMultipleDelete ? (0, _jsxRuntime.jsx)(_popconfirm.default, {
|
401
|
+
children: [isCanMultipleDelete ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_popconfirm.default, {
|
394
402
|
placement: "top",
|
395
403
|
title: mulDeletePoconfirmMsg,
|
396
404
|
onConfirm: onMultipleDelete,
|
397
405
|
okText: "\u786E\u5B9A",
|
398
406
|
cancelText: "\u53D6\u6D88",
|
399
|
-
disabled: !(selectedRowKeys
|
400
|
-
children: (0, _jsxRuntime.jsx)(_button.default, {
|
401
|
-
disabled: !(selectedRowKeys
|
407
|
+
disabled: !(selectedRowKeys !== null && selectedRowKeys !== void 0 && selectedRowKeys.length),
|
408
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
|
409
|
+
disabled: !(selectedRowKeys !== null && selectedRowKeys !== void 0 && selectedRowKeys.length),
|
402
410
|
type: "link",
|
403
411
|
children: "\u5220\u9664"
|
404
412
|
})
|
405
|
-
}) : null, (0, _jsxRuntime.jsx)(_button.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
413
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
406
414
|
type: "link",
|
407
|
-
icon: (0, _jsxRuntime.jsx)(_icons.PlusOutlined, {}),
|
408
|
-
onClick:
|
415
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlusOutlined, {}),
|
416
|
+
onClick: () => {
|
409
417
|
onAdd();
|
410
418
|
}
|
411
419
|
}, antButtonProps), {}, {
|
412
420
|
children: buttonText
|
413
421
|
}))]
|
414
|
-
}) : (/*#__PURE__*/(0, _react.cloneElement)(buttonText, antButtonProps))
|
422
|
+
}) : ( /*#__PURE__*/(0, _react.cloneElement)(buttonText, antButtonProps))
|
415
423
|
}) : null
|
416
424
|
});
|
417
425
|
};
|
418
426
|
var validateFields = /*#__PURE__*/function () {
|
419
|
-
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
|
427
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee3() {
|
420
428
|
var values, nextValues, nextList, isEditing;
|
421
429
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee3$(_context3) {
|
422
430
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -427,7 +435,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
427
435
|
values = _context3.sent;
|
428
436
|
nextValues = {};
|
429
437
|
nextList = [];
|
430
|
-
Object.keys(values).forEach(
|
438
|
+
Object.keys(values).forEach(key => {
|
431
439
|
if (Number.isNaN(Number(key))) {
|
432
440
|
nextValues[key] = values[key];
|
433
441
|
} else {
|
@@ -435,9 +443,7 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
435
443
|
}
|
436
444
|
});
|
437
445
|
nextValues[name] = nextList;
|
438
|
-
isEditing = list.find(
|
439
|
-
return item.editable;
|
440
|
-
});
|
446
|
+
isEditing = list.find(item => item.editable);
|
441
447
|
if (!(isSingle && isEditing)) {
|
442
448
|
_context3.next = 11;
|
443
449
|
break;
|
@@ -457,41 +463,36 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
457
463
|
return _ref4.apply(this, arguments);
|
458
464
|
};
|
459
465
|
}();
|
460
|
-
var newColumns = (0, _react.useMemo)(
|
466
|
+
var newColumns = (0, _react.useMemo)(() => {
|
461
467
|
return (0, _utils.transformColumns)(columns, form, disabled);
|
462
468
|
}, [columns, form, disabled]);
|
463
|
-
(0, _react.useImperativeHandle)(actionRef,
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
setDataSource: setList
|
484
|
-
};
|
485
|
-
});
|
469
|
+
(0, _react.useImperativeHandle)(actionRef, () => ({
|
470
|
+
/** 暴露出当前table节点 * */
|
471
|
+
tableNode: tableRef.current,
|
472
|
+
data: list,
|
473
|
+
getPureDataSource: () => (0, _utils.formatList)(list),
|
474
|
+
selectedRows,
|
475
|
+
selectedRowKeys,
|
476
|
+
setSelectedRowKeys,
|
477
|
+
setSelectedRows,
|
478
|
+
onUpdateRowData,
|
479
|
+
onMultipleDelete,
|
480
|
+
onAdd,
|
481
|
+
onDelete,
|
482
|
+
onEdit,
|
483
|
+
onSave,
|
484
|
+
onCancel,
|
485
|
+
validateFields,
|
486
|
+
setDataSource: setList
|
487
|
+
}));
|
488
|
+
|
486
489
|
// 实时同步外部dataSource (useDeepCompareEffect无法察觉dataSource的变更)
|
487
|
-
(0, _ahooks.useDeepCompareEffect)(
|
490
|
+
(0, _ahooks.useDeepCompareEffect)(() => {
|
488
491
|
var nextList = [];
|
489
492
|
if (dataSource.length) {
|
490
|
-
dataSource.forEach(
|
491
|
-
var key = getRowKey(item) ||
|
492
|
-
var innerItem = list.find(
|
493
|
-
return getRowKey(child) === key;
|
494
|
-
});
|
493
|
+
dataSource.forEach((item, index) => {
|
494
|
+
var key = getRowKey(item) || `&&${(0, _utils.getRandom)()}`;
|
495
|
+
var innerItem = list.find(child => getRowKey(child) === key);
|
495
496
|
var nextItem = innerItem ? (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
496
497
|
editable: !isSingle
|
497
498
|
}, innerItem), item), {}, {
|
@@ -508,13 +509,15 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
508
509
|
setList([]);
|
509
510
|
}
|
510
511
|
}, [dataSource]);
|
511
|
-
(0, _ahooks.useDeepCompareEffect)(
|
512
|
+
(0, _ahooks.useDeepCompareEffect)(() => {
|
512
513
|
try {
|
513
|
-
if (list
|
514
|
-
list.forEach(
|
514
|
+
if (list !== null && list !== void 0 && list.length) {
|
515
|
+
list.forEach((item, index) => {
|
515
516
|
// 可编辑状态默认给表单回填数据
|
516
517
|
if (item.editable) {
|
517
|
-
form.setFieldsValue(
|
518
|
+
form.setFieldsValue({
|
519
|
+
[index]: item
|
520
|
+
});
|
518
521
|
}
|
519
522
|
});
|
520
523
|
}
|
@@ -522,61 +525,55 @@ var ProEditableTable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
|
|
522
525
|
console.error('error', error);
|
523
526
|
}
|
524
527
|
}, [list]);
|
525
|
-
var empty =
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
550
|
-
children: [['topLeft', 'topRight'].includes(position) && renderAddButton(), (0, _jsxRuntime.jsx)(_form.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
528
|
+
var empty = () =>
|
529
|
+
/*#__PURE__*/
|
530
|
+
// 这里面就是我们自己定义的空状态
|
531
|
+
(0, _jsxRuntime.jsxs)("div", {
|
532
|
+
className: "com-empty",
|
533
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
534
|
+
className: "empty-img",
|
535
|
+
src: _empty.default
|
536
|
+
}), !disabled && isCanAdd ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
537
|
+
className: "empty-text",
|
538
|
+
children: ["\u6682\u65E0\u6570\u636E\uFF0C", /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
539
|
+
type: "link",
|
540
|
+
onClick: () => {
|
541
|
+
onAdd();
|
542
|
+
}
|
543
|
+
}, antButtonProps), {}, {
|
544
|
+
children: emptyButtonText
|
545
|
+
}))]
|
546
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
547
|
+
children: "\u6682\u65E0\u6570\u636E"
|
548
|
+
})]
|
549
|
+
});
|
550
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
551
|
+
children: [['topLeft', 'topRight'].includes(position) && renderAddButton(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
551
552
|
form: form,
|
552
553
|
className: "proEditable pro-editable"
|
553
554
|
}, formProps), {}, {
|
554
|
-
children: name ? (0, _jsxRuntime.jsx)(_form.default.Item, {
|
555
|
+
children: name ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_form.default.Item, {
|
555
556
|
name: name,
|
556
|
-
children: (0, _jsxRuntime.jsx)(_configProvider.default, {
|
557
|
-
renderEmpty:
|
558
|
-
children: (0, _jsxRuntime.jsx)(_table.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
557
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_configProvider.default, {
|
558
|
+
renderEmpty: list !== null && list !== void 0 && list.length ? undefined : empty,
|
559
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_table.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
559
560
|
dataSource: list,
|
560
561
|
columns: newColumns,
|
561
562
|
pagination: pagination,
|
562
563
|
rowSelection: isCanMultipleDelete && !disabled ? rowSelection : undefined,
|
563
|
-
ref:
|
564
|
-
return tableRef.current = node;
|
565
|
-
}
|
564
|
+
ref: node => tableRef.current = node
|
566
565
|
}, otherProps), {}, {
|
567
566
|
rowKey: getRowKey
|
568
567
|
}))
|
569
568
|
})
|
570
|
-
}) : (0, _jsxRuntime.jsx)(_configProvider.default, {
|
571
|
-
renderEmpty:
|
572
|
-
children: (0, _jsxRuntime.jsx)(_table.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
569
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_configProvider.default, {
|
570
|
+
renderEmpty: list !== null && list !== void 0 && list.length ? undefined : empty,
|
571
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_table.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
573
572
|
dataSource: list,
|
574
573
|
columns: newColumns,
|
575
574
|
pagination: pagination,
|
576
575
|
rowSelection: isCanMultipleDelete && !disabled ? rowSelection : undefined,
|
577
|
-
ref:
|
578
|
-
return tableRef.current = node;
|
579
|
-
}
|
576
|
+
ref: node => tableRef.current = node
|
580
577
|
}, otherProps), {}, {
|
581
578
|
rowKey: getRowKey
|
582
579
|
}))
|