@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
@@ -1,29 +1,34 @@
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
|
-
import
|
3
|
+
import "antd/es/message/style";
|
4
|
+
import _message from "antd/es/message";
|
4
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
6
|
+
import "antd/es/form/style";
|
7
|
+
import _Form from "antd/es/form";
|
5
8
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
6
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
10
|
var _excluded = ["page", "filters", "sorter"];
|
8
11
|
import { useEffect, useMemo, useState } from 'react';
|
9
12
|
import { useRequest, useSetState, useDeepCompareEffect, usePrevious } from 'ahooks';
|
10
13
|
import { pickBy, isObject, merge, set, isEqual, omit } from 'lodash';
|
11
|
-
import { Form, message } from 'antd';
|
12
14
|
import { defaultPage } from "../index";
|
13
15
|
import { isListResult, removeEmptyKeys, isNonEmptyObject } from "../utils";
|
14
16
|
import locale, { formatMessage } from "../../locale";
|
15
|
-
var useDefaultOptions =
|
17
|
+
var useDefaultOptions = options => {
|
16
18
|
var _useState = useState((options === null || options === void 0 ? void 0 : options.page) || defaultPage),
|
17
19
|
_useState2 = _slicedToArray(_useState, 2),
|
18
20
|
page = _useState2[0],
|
19
21
|
onPageChange = _useState2[1];
|
20
22
|
return _objectSpread(_objectSpread({}, options), {}, {
|
21
23
|
rowSelectType: (options === null || options === void 0 ? void 0 : options.rowSelectType) || 'checkbox',
|
22
|
-
page
|
24
|
+
page,
|
23
25
|
onPageChange: (options === null || options === void 0 ? void 0 : options.onPageChange) || onPageChange
|
24
26
|
});
|
25
27
|
};
|
26
28
|
var previousSearchValues = null;
|
29
|
+
export var SELECTION_ALL = 'SELECTION_ALL';
|
30
|
+
export var CURRENT_PAGE = 'CURRENT_PAGE';
|
31
|
+
export var UNCHECK_ALL = 'UNCHECK_ALL';
|
27
32
|
function useAntdTable(service, options, useRequestOptions) {
|
28
33
|
var _locale$ProTable2, _locale$ProTable3, _locale$ProTable4, _locale$ProTable5, _result$params, _form$getFieldsValue3;
|
29
34
|
var _useSetState = useSetState({
|
@@ -65,7 +70,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
65
70
|
transformParams = _useDefaultOptions.transformParams,
|
66
71
|
transformResponse = _useDefaultOptions.transformResponse,
|
67
72
|
disabled = _useDefaultOptions.disabled;
|
68
|
-
var _Form$useForm =
|
73
|
+
var _Form$useForm = _Form.useForm(_form),
|
69
74
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
70
75
|
form = _Form$useForm2[0];
|
71
76
|
var _ref = useRequestOptions || {},
|
@@ -73,7 +78,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
73
78
|
var defaultParam = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
74
79
|
var initPage = (options === null || options === void 0 ? void 0 : options.page) || defaultPage;
|
75
80
|
var previousPage = usePrevious(page || defaultPage);
|
76
|
-
var getTransformParams =
|
81
|
+
var getTransformParams = params => {
|
77
82
|
var _pickBy;
|
78
83
|
var realParams = _objectSpread(_objectSpread(_objectSpread({}, defaultParam), extraParams), params);
|
79
84
|
var _realParams$page = realParams.page,
|
@@ -86,18 +91,17 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
86
91
|
sorter: JSON.stringify(sorter) === '{}' ? undefined : sorter
|
87
92
|
}, otherParams);
|
88
93
|
var requestParams = _objectSpread(_objectSpread({}, page), {}, {
|
89
|
-
queryBean: (_pickBy = pickBy(queryBean,
|
90
|
-
return item !== undefined;
|
91
|
-
})) !== null && _pickBy !== void 0 ? _pickBy : {}
|
94
|
+
queryBean: (_pickBy = pickBy(queryBean, item => item !== undefined)) !== null && _pickBy !== void 0 ? _pickBy : {}
|
92
95
|
});
|
93
96
|
if (transformParams) {
|
94
|
-
|
97
|
+
var mergedParams = _objectSpread(_objectSpread({}, realParams), requestParams);
|
98
|
+
return transformParams(mergedParams);
|
95
99
|
}
|
96
100
|
return requestParams;
|
97
101
|
};
|
98
102
|
|
99
103
|
// 仅清数据源相关,查询相关
|
100
|
-
var handleSetStateCallback =
|
104
|
+
var handleSetStateCallback = values => {
|
101
105
|
setState(_objectSpread({
|
102
106
|
data: [],
|
103
107
|
total: 0,
|
@@ -106,10 +110,8 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
106
110
|
allSelected: false
|
107
111
|
}, values));
|
108
112
|
};
|
109
|
-
var curService = useMemo(
|
110
|
-
|
111
|
-
}, [service]);
|
112
|
-
var curExtraParams = useMemo(function () {
|
113
|
+
var curService = useMemo(() => service.toString(), [service]);
|
114
|
+
var curExtraParams = useMemo(() => {
|
113
115
|
return extraParams ? JSON.stringify(extraParams) : extraParams;
|
114
116
|
}, [extraParams]);
|
115
117
|
|
@@ -118,7 +120,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
118
120
|
debounceWait: 300
|
119
121
|
}, useRequestOptions), {}, {
|
120
122
|
defaultParams: [getTransformParams()],
|
121
|
-
onSuccess:
|
123
|
+
onSuccess: (res, params) => {
|
122
124
|
var transformResult = transformResponse ? transformResponse(res) : res || {};
|
123
125
|
var _ref2 = isListResult(transformResult) ? transformResult : (transformResult === null || transformResult === void 0 ? void 0 : transformResult.data) || {},
|
124
126
|
_ref2$list = _ref2.list,
|
@@ -127,10 +129,10 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
127
129
|
total = _ref2$total === void 0 ? 0 : _ref2$total;
|
128
130
|
if (list !== null && !Array.isArray(list)) {
|
129
131
|
var _locale$ProTable;
|
130
|
-
return
|
132
|
+
return _message.error(locale === null || locale === void 0 || (_locale$ProTable = locale.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.transformResponseMsg);
|
131
133
|
}
|
132
134
|
setState({
|
133
|
-
total
|
135
|
+
total,
|
134
136
|
data: list || []
|
135
137
|
});
|
136
138
|
if (useRequestOptions !== null && useRequestOptions !== void 0 && useRequestOptions.onSuccess) {
|
@@ -143,7 +145,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
143
145
|
|
144
146
|
// service变化时触发 (禁止掉防止service变更时导致的死循环)
|
145
147
|
|
146
|
-
var clearSelected =
|
148
|
+
var clearSelected = () => {
|
147
149
|
setState({
|
148
150
|
allSelected: false,
|
149
151
|
selectedRecords: [],
|
@@ -154,31 +156,27 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
154
156
|
/**
|
155
157
|
* 手动触发时,手动调用run
|
156
158
|
*/
|
157
|
-
useEffect(
|
159
|
+
useEffect(() => {
|
158
160
|
if (!(useRequestOptions !== null && useRequestOptions !== void 0 && useRequestOptions.manual)) {
|
159
161
|
run(getTransformParams());
|
160
162
|
}
|
161
163
|
}, [useRequestOptions === null || useRequestOptions === void 0 ? void 0 : useRequestOptions.manual, curExtraParams, curService]);
|
162
|
-
useDeepCompareEffect(
|
164
|
+
useDeepCompareEffect(() => {
|
163
165
|
if (allSelected) {
|
164
|
-
var filterList = data.filter(
|
165
|
-
return !selectedRowKeys.includes(item === null || item === void 0 ? void 0 : item[rowKey]);
|
166
|
-
});
|
166
|
+
var filterList = data.filter(item => !selectedRowKeys.includes(item === null || item === void 0 ? void 0 : item[rowKey]));
|
167
167
|
var nextObject = {
|
168
|
-
selectedRecords: [
|
169
|
-
selectedRowKeys: [
|
170
|
-
return item === null || item === void 0 ? void 0 : item[rowKey];
|
171
|
-
})))
|
168
|
+
selectedRecords: [...selectedRecords, ...filterList],
|
169
|
+
selectedRowKeys: [...selectedRowKeys, ...(filterList === null || filterList === void 0 ? void 0 : filterList.map(item => item === null || item === void 0 ? void 0 : item[rowKey]))]
|
172
170
|
};
|
173
171
|
if (typeof disabled === 'function') {
|
174
172
|
var _selectedRecords$filt, _nextSelectRecords$ma;
|
175
173
|
var _nextObject = nextObject,
|
176
174
|
_selectedRecords = _nextObject.selectedRecords;
|
177
|
-
var nextSelectRecords = (_selectedRecords$filt = _selectedRecords.filter(
|
175
|
+
var nextSelectRecords = (_selectedRecords$filt = _selectedRecords.filter(item => {
|
178
176
|
// 去掉禁用的
|
179
177
|
return !disabled(item);
|
180
178
|
})) !== null && _selectedRecords$filt !== void 0 ? _selectedRecords$filt : [];
|
181
|
-
var nextSelectedRowKeys = (_nextSelectRecords$ma = nextSelectRecords.map(
|
179
|
+
var nextSelectedRowKeys = (_nextSelectRecords$ma = nextSelectRecords.map(item => {
|
182
180
|
return item === null || item === void 0 ? void 0 : item[rowKey];
|
183
181
|
})) !== null && _nextSelectRecords$ma !== void 0 ? _nextSelectRecords$ma : [];
|
184
182
|
nextObject = {
|
@@ -191,18 +189,18 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
191
189
|
}, [allSelected, data]);
|
192
190
|
|
193
191
|
// 释放
|
194
|
-
useEffect(
|
195
|
-
return
|
192
|
+
useEffect(() => {
|
193
|
+
return () => {
|
196
194
|
previousSearchValues = null;
|
197
195
|
};
|
198
196
|
}, []);
|
199
197
|
|
200
198
|
// 分页变更
|
201
|
-
var handlePageChange =
|
199
|
+
var handlePageChange = (current, pageSize) => {
|
202
200
|
var _form$getFieldsValue;
|
203
201
|
var page = {
|
204
202
|
pageNum: current,
|
205
|
-
pageSize
|
203
|
+
pageSize
|
206
204
|
};
|
207
205
|
onPageChange(page);
|
208
206
|
if (!rowSelections && !crossPageSelect) {
|
@@ -214,10 +212,10 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
214
212
|
var newValues = (_form$getFieldsValue = form.getFieldsValue()) !== null && _form$getFieldsValue !== void 0 ? _form$getFieldsValue : {};
|
215
213
|
var nextValues = removeEmptyKeys(newValues);
|
216
214
|
run(getTransformParams(_objectSpread(_objectSpread({
|
217
|
-
page
|
215
|
+
page
|
218
216
|
}, nextValues), extraFilter)));
|
219
217
|
};
|
220
|
-
var handleTableChange =
|
218
|
+
var handleTableChange = (pagination, filters, sorter, extra) => {
|
221
219
|
var _form$getFieldsValue2;
|
222
220
|
// 跳过分页改变,使用pagination的onChange
|
223
221
|
if (extra.action === 'paginate') {
|
@@ -232,19 +230,19 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
232
230
|
selectedRecords: [],
|
233
231
|
selectedRowKeys: [],
|
234
232
|
extraFilter: {
|
235
|
-
filters
|
236
|
-
sorter
|
233
|
+
filters,
|
234
|
+
sorter
|
237
235
|
}
|
238
236
|
});
|
239
237
|
var _values = (_form$getFieldsValue2 = form === null || form === void 0 ? void 0 : form.getFieldsValue()) !== null && _form$getFieldsValue2 !== void 0 ? _form$getFieldsValue2 : {};
|
240
238
|
run(getTransformParams(_objectSpread(_objectSpread({
|
241
|
-
page
|
239
|
+
page
|
242
240
|
}, _values), {}, {
|
243
|
-
filters
|
244
|
-
sorter
|
241
|
+
filters,
|
242
|
+
sorter
|
245
243
|
})));
|
246
244
|
};
|
247
|
-
var onSearch =
|
245
|
+
var onSearch = values => {
|
248
246
|
var newPage = {
|
249
247
|
pageNum: 1,
|
250
248
|
pageSize: page.pageSize
|
@@ -270,7 +268,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
270
268
|
page: newPage
|
271
269
|
}, extraFilter), _values)));
|
272
270
|
};
|
273
|
-
var resetParams =
|
271
|
+
var resetParams = page => {
|
274
272
|
setState({
|
275
273
|
searchValues: {},
|
276
274
|
allSelected: false,
|
@@ -284,7 +282,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
284
282
|
};
|
285
283
|
|
286
284
|
// 重置查询条件: 页码还原、勾选清空
|
287
|
-
var onReset =
|
285
|
+
var onReset = () => {
|
288
286
|
form === null || form === void 0 || form.resetFields();
|
289
287
|
var newPage = {
|
290
288
|
pageNum: 1,
|
@@ -298,7 +296,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
298
296
|
}));
|
299
297
|
}
|
300
298
|
};
|
301
|
-
var refreshPage =
|
299
|
+
var refreshPage = res => {
|
302
300
|
var transformResult = transformResponse ? transformResponse(res) : res || {};
|
303
301
|
var _ref3 = isListResult(transformResult) ? transformResult : (transformResult === null || transformResult === void 0 ? void 0 : transformResult.data) || {},
|
304
302
|
_ref3$total = _ref3.total,
|
@@ -341,30 +339,109 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
341
339
|
return _ref4.apply(this, arguments);
|
342
340
|
};
|
343
341
|
}();
|
342
|
+
|
343
|
+
// 内置选择下拉
|
344
|
+
var defaultSelections = [{
|
345
|
+
key: 'currentPage',
|
346
|
+
text: formatMessage(locale === null || locale === void 0 || (_locale$ProTable2 = locale.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
|
347
|
+
total: (data === null || data === void 0 ? void 0 : data.length) || 0
|
348
|
+
}),
|
349
|
+
onSelect: changeableRowKeys => {
|
350
|
+
setState({
|
351
|
+
allSelected: false,
|
352
|
+
selectedRecords: [...data],
|
353
|
+
selectedRowKeys: changeableRowKeys
|
354
|
+
});
|
355
|
+
}
|
356
|
+
}, {
|
357
|
+
key: 'all',
|
358
|
+
text: formatMessage(locale === null || locale === void 0 || (_locale$ProTable3 = locale.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
|
359
|
+
total
|
360
|
+
}),
|
361
|
+
onSelect: function () {
|
362
|
+
var _onSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(changeableRowKeys) {
|
363
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
364
|
+
while (1) switch (_context2.prev = _context2.next) {
|
365
|
+
case 0:
|
366
|
+
setState({
|
367
|
+
allSelected: true,
|
368
|
+
selectedRecords: [...data],
|
369
|
+
selectedRowKeys: changeableRowKeys
|
370
|
+
});
|
371
|
+
case 1:
|
372
|
+
case "end":
|
373
|
+
return _context2.stop();
|
374
|
+
}
|
375
|
+
}, _callee2);
|
376
|
+
}));
|
377
|
+
function onSelect(_x) {
|
378
|
+
return _onSelect.apply(this, arguments);
|
379
|
+
}
|
380
|
+
return onSelect;
|
381
|
+
}()
|
382
|
+
}, {
|
383
|
+
key: 'uncheckAll',
|
384
|
+
text: locale === null || locale === void 0 || (_locale$ProTable4 = locale.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
|
385
|
+
onSelect: function () {
|
386
|
+
var _onSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
387
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
388
|
+
while (1) switch (_context3.prev = _context3.next) {
|
389
|
+
case 0:
|
390
|
+
setState({
|
391
|
+
allSelected: false,
|
392
|
+
selectedRecords: [],
|
393
|
+
selectedRowKeys: []
|
394
|
+
});
|
395
|
+
case 1:
|
396
|
+
case "end":
|
397
|
+
return _context3.stop();
|
398
|
+
}
|
399
|
+
}, _callee3);
|
400
|
+
}));
|
401
|
+
function onSelect() {
|
402
|
+
return _onSelect2.apply(this, arguments);
|
403
|
+
}
|
404
|
+
return onSelect;
|
405
|
+
}()
|
406
|
+
}];
|
407
|
+
var selections = useMemo(() => {
|
408
|
+
if (rowSelections === true) {
|
409
|
+
return defaultSelections;
|
410
|
+
}
|
411
|
+
if (Array.isArray(rowSelections)) {
|
412
|
+
return rowSelections.map(item => {
|
413
|
+
if (typeof item === 'string') {
|
414
|
+
if (item === CURRENT_PAGE) {
|
415
|
+
return defaultSelections[0];
|
416
|
+
}
|
417
|
+
if (item === SELECTION_ALL) {
|
418
|
+
return defaultSelections[1];
|
419
|
+
}
|
420
|
+
if (item === UNCHECK_ALL) {
|
421
|
+
return defaultSelections[2];
|
422
|
+
}
|
423
|
+
}
|
424
|
+
return item;
|
425
|
+
});
|
426
|
+
}
|
427
|
+
return false;
|
428
|
+
}, [rowSelections]);
|
344
429
|
var _rowSelection = {
|
345
430
|
fixed: true,
|
346
431
|
type: rowSelectType,
|
347
432
|
columnWidth: rowSelections ? 64 : undefined,
|
348
|
-
selectedRowKeys
|
349
|
-
onChange
|
433
|
+
selectedRowKeys,
|
434
|
+
onChange(rowKeys, rows) {
|
350
435
|
if (crossPageSelect) {
|
351
436
|
var _data$map, _Array$from, _ref5;
|
352
|
-
var removeKeys = data === null || data === void 0 || (_data$map = data.map(
|
353
|
-
|
354
|
-
|
355
|
-
return !rowKeys.includes(key);
|
356
|
-
});
|
357
|
-
var newSelectedKeys = (_Array$from = Array.from(new Set([].concat(_toConsumableArray(selectedRowKeys), _toConsumableArray(rowKeys))))) === null || _Array$from === void 0 ? void 0 : _Array$from.filter(function (item) {
|
358
|
-
return !removeKeys.includes(item);
|
359
|
-
});
|
360
|
-
var selectedRecordObj = (_ref5 = [].concat(_toConsumableArray(selectedRecords), _toConsumableArray(rows))) === null || _ref5 === void 0 ? void 0 : _ref5.reduce(function (acc, cur) {
|
437
|
+
var removeKeys = data === null || data === void 0 || (_data$map = data.map(item => item === null || item === void 0 ? void 0 : item[rowKey])) === null || _data$map === void 0 ? void 0 : _data$map.filter(key => !rowKeys.includes(key));
|
438
|
+
var newSelectedKeys = (_Array$from = Array.from(new Set([...selectedRowKeys, ...rowKeys]))) === null || _Array$from === void 0 ? void 0 : _Array$from.filter(item => !removeKeys.includes(item));
|
439
|
+
var selectedRecordObj = (_ref5 = [...selectedRecords, ...rows]) === null || _ref5 === void 0 ? void 0 : _ref5.reduce((acc, cur) => {
|
361
440
|
acc[cur === null || cur === void 0 ? void 0 : cur[rowKey]] = cur;
|
362
441
|
return acc;
|
363
442
|
}, {});
|
364
443
|
setState({
|
365
|
-
selectedRecords: newSelectedKeys === null || newSelectedKeys === void 0 ? void 0 : newSelectedKeys.map(
|
366
|
-
return selectedRecordObj === null || selectedRecordObj === void 0 ? void 0 : selectedRecordObj[item];
|
367
|
-
}),
|
444
|
+
selectedRecords: newSelectedKeys === null || newSelectedKeys === void 0 ? void 0 : newSelectedKeys.map(item => selectedRecordObj === null || selectedRecordObj === void 0 ? void 0 : selectedRecordObj[String(item)]),
|
368
445
|
selectedRowKeys: newSelectedKeys
|
369
446
|
});
|
370
447
|
} else {
|
@@ -374,7 +451,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
374
451
|
});
|
375
452
|
}
|
376
453
|
},
|
377
|
-
onSelectAll:
|
454
|
+
onSelectAll: selected => {
|
378
455
|
if (rowSelections && allSelected && !selected) {
|
379
456
|
setState({
|
380
457
|
allSelected: false,
|
@@ -383,81 +460,17 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
383
460
|
});
|
384
461
|
}
|
385
462
|
},
|
386
|
-
getCheckboxProps:
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
},
|
391
|
-
selections: rowSelections ? [{
|
392
|
-
key: 'currentPage',
|
393
|
-
text: formatMessage(locale === null || locale === void 0 || (_locale$ProTable2 = locale.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
|
394
|
-
total: (data === null || data === void 0 ? void 0 : data.length) || 0
|
395
|
-
}),
|
396
|
-
onSelect: function onSelect(changeableRowKeys) {
|
397
|
-
setState({
|
398
|
-
allSelected: false,
|
399
|
-
selectedRecords: _toConsumableArray(data),
|
400
|
-
selectedRowKeys: changeableRowKeys
|
401
|
-
});
|
402
|
-
}
|
403
|
-
}, {
|
404
|
-
key: 'all',
|
405
|
-
text: formatMessage(locale === null || locale === void 0 || (_locale$ProTable3 = locale.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
|
406
|
-
total: total
|
407
|
-
}),
|
408
|
-
onSelect: function () {
|
409
|
-
var _onSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(changeableRowKeys) {
|
410
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
411
|
-
while (1) switch (_context2.prev = _context2.next) {
|
412
|
-
case 0:
|
413
|
-
setState({
|
414
|
-
allSelected: true,
|
415
|
-
selectedRecords: _toConsumableArray(data),
|
416
|
-
selectedRowKeys: changeableRowKeys
|
417
|
-
});
|
418
|
-
case 1:
|
419
|
-
case "end":
|
420
|
-
return _context2.stop();
|
421
|
-
}
|
422
|
-
}, _callee2);
|
423
|
-
}));
|
424
|
-
function onSelect(_x) {
|
425
|
-
return _onSelect.apply(this, arguments);
|
426
|
-
}
|
427
|
-
return onSelect;
|
428
|
-
}()
|
429
|
-
}, {
|
430
|
-
key: 'uncheckAll',
|
431
|
-
text: locale === null || locale === void 0 || (_locale$ProTable4 = locale.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
|
432
|
-
onSelect: function () {
|
433
|
-
var _onSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
434
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
435
|
-
while (1) switch (_context3.prev = _context3.next) {
|
436
|
-
case 0:
|
437
|
-
setState({
|
438
|
-
allSelected: false,
|
439
|
-
selectedRecords: [],
|
440
|
-
selectedRowKeys: []
|
441
|
-
});
|
442
|
-
case 1:
|
443
|
-
case "end":
|
444
|
-
return _context3.stop();
|
445
|
-
}
|
446
|
-
}, _callee3);
|
447
|
-
}));
|
448
|
-
function onSelect() {
|
449
|
-
return _onSelect2.apply(this, arguments);
|
450
|
-
}
|
451
|
-
return onSelect;
|
452
|
-
}()
|
453
|
-
}] : false
|
463
|
+
getCheckboxProps: record => ({
|
464
|
+
className: allSelected && rowSelections ? 'checkbox-disabled' : ''
|
465
|
+
}),
|
466
|
+
selections
|
454
467
|
};
|
455
468
|
var rowSelection = isObject(returnRowSelection) ? merge(_rowSelection, returnRowSelection) : _rowSelection;
|
456
469
|
if (isObject(returnRowSelection) && !isEqual(rowSelection, _rowSelection)) {
|
457
470
|
// getCheckboxProps需要特殊兼容原有的逻辑,特殊处理
|
458
471
|
var isHasGetCheckboxProps = Reflect.ownKeys(returnRowSelection).includes('getCheckboxProps');
|
459
472
|
if (isHasGetCheckboxProps) {
|
460
|
-
set(rowSelection, 'getCheckboxProps',
|
473
|
+
set(rowSelection, 'getCheckboxProps', record => {
|
461
474
|
var _rowSelection$getChec;
|
462
475
|
var passReturnObjects = (_rowSelection$getChec = rowSelection.getCheckboxProps(record)) !== null && _rowSelection$getChec !== void 0 ? _rowSelection$getChec : {};
|
463
476
|
return _objectSpread({
|
@@ -475,54 +488,54 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
475
488
|
showSizeChanger: true,
|
476
489
|
showQuickJumper: true,
|
477
490
|
onPaginationChange: true,
|
478
|
-
total
|
479
|
-
showTotal:
|
491
|
+
total,
|
492
|
+
showTotal: total => {
|
480
493
|
var _locale$ProTable6;
|
481
494
|
if (!total) return;
|
482
495
|
return formatMessage(locale === null || locale === void 0 || (_locale$ProTable6 = locale.ProTable) === null || _locale$ProTable6 === void 0 ? void 0 : _locale$ProTable6.total, {
|
483
|
-
total
|
496
|
+
total
|
484
497
|
});
|
485
498
|
},
|
486
499
|
onShowSizeChange: handlePageChange,
|
487
500
|
onChange: handlePageChange
|
488
501
|
};
|
489
502
|
var useAntdTableProps = _objectSpread(_objectSpread({}, result), {}, {
|
490
|
-
form
|
491
|
-
data
|
503
|
+
form,
|
504
|
+
data,
|
492
505
|
params: (result === null || result === void 0 || (_result$params = result.params) === null || _result$params === void 0 ? void 0 : _result$params[0]) || {},
|
493
|
-
rowSelection
|
506
|
+
rowSelection,
|
494
507
|
searchValues: (_form$getFieldsValue3 = form === null || form === void 0 ? void 0 : form.getFieldsValue()) !== null && _form$getFieldsValue3 !== void 0 ? _form$getFieldsValue3 : {},
|
495
|
-
allSelected
|
496
|
-
selectedTip
|
497
|
-
selectedRowKeys
|
498
|
-
selectedRecords
|
499
|
-
clearSelected
|
500
|
-
setSelectedRowKeys:
|
508
|
+
allSelected,
|
509
|
+
selectedTip,
|
510
|
+
selectedRowKeys,
|
511
|
+
selectedRecords,
|
512
|
+
clearSelected,
|
513
|
+
setSelectedRowKeys: selectedRowKeys => {
|
501
514
|
setState({
|
502
|
-
selectedRowKeys
|
515
|
+
selectedRowKeys
|
503
516
|
});
|
504
517
|
},
|
505
|
-
setSelectedRecords:
|
518
|
+
setSelectedRecords: selectedRecords => {
|
506
519
|
setState({
|
507
|
-
selectedRecords
|
520
|
+
selectedRecords
|
508
521
|
});
|
509
522
|
},
|
510
|
-
pagination
|
511
|
-
onReset
|
512
|
-
onSearch
|
523
|
+
pagination,
|
524
|
+
onReset,
|
525
|
+
onSearch,
|
513
526
|
refresh: handleRefresh,
|
514
527
|
tableProps: {
|
515
|
-
rowKey
|
528
|
+
rowKey,
|
516
529
|
loading: result.loading,
|
517
530
|
dataSource: data,
|
518
531
|
rowSelection: returnRowSelection || rowSelections ? rowSelection : undefined,
|
519
|
-
pagination
|
532
|
+
pagination,
|
520
533
|
onChange: handleTableChange
|
521
534
|
},
|
522
|
-
handleSetStateCallback
|
535
|
+
handleSetStateCallback
|
523
536
|
});
|
524
537
|
useAntdTableProps.tableProps.formTableProps = _objectSpread(_objectSpread({}, omit(useAntdTableProps, 'tableProps')), {}, {
|
525
|
-
form
|
538
|
+
form
|
526
539
|
});
|
527
540
|
return useAntdTableProps;
|
528
541
|
}
|
package/es/ProTable/index.d.ts
CHANGED
@@ -8,13 +8,9 @@ export declare const defaultPage: {
|
|
8
8
|
};
|
9
9
|
declare const ProTable: {
|
10
10
|
(props: ProTableType): import("react/jsx-runtime").JSX.Element;
|
11
|
-
defaultProps: {
|
12
|
-
quickConfig: boolean;
|
13
|
-
stripe: boolean;
|
14
|
-
draggable: boolean;
|
15
|
-
disabled: boolean;
|
16
|
-
isView: boolean;
|
17
|
-
};
|
18
11
|
useAntdTable: typeof useAntdTable;
|
12
|
+
SELECTION_ALL: string;
|
13
|
+
CURRENT_PAGE: string;
|
14
|
+
UNCHECK_ALL: string;
|
19
15
|
};
|
20
16
|
export default ProTable;
|