@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
package/es/ProTreeModal/index.js
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import "antd/es/button/style";
|
2
|
+
import _Button from "antd/es/button";
|
3
|
+
import "antd/es/input/style";
|
4
|
+
import _Input from "antd/es/input";
|
5
|
+
import "antd/es/checkbox/style";
|
6
|
+
import _Checkbox from "antd/es/checkbox";
|
7
|
+
import "antd/es/message/style";
|
8
|
+
import _message from "antd/es/message";
|
3
9
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
4
10
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
11
|
import React, { useEffect, useMemo, useRef } from 'react';
|
6
12
|
import { useDeepCompareEffect, useSetState, useRequest as useRequestFunc, useDebounceFn } from 'ahooks';
|
7
|
-
import { Button, Checkbox, Input, message } from 'antd';
|
8
13
|
import { cloneDeep, isFunction } from 'lodash';
|
9
14
|
import { ReactSVG } from 'react-svg';
|
10
15
|
import classNames from 'classnames';
|
@@ -20,7 +25,7 @@ import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
25
|
var LIST = 'LIST';
|
21
26
|
var TREE = 'TREE';
|
22
27
|
export var CASCADER = 'CASCADER';
|
23
|
-
var ProTreeModal =
|
28
|
+
var ProTreeModal = props => {
|
24
29
|
var _locale$ProTreeModal, _props$otherProps, _props$otherProps2, _locale$ProTreeModal9, _locale$ProTreeModal10, _locale$ProTreeModal11, _locale$ProTreeModal12;
|
25
30
|
var _useProConfig = useProConfig('ProEnum'),
|
26
31
|
_useProConfig$dics = _useProConfig.dics,
|
@@ -94,7 +99,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
94
99
|
setState = _useSetState2[1];
|
95
100
|
var fetchFunction = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread({
|
96
101
|
manual: true,
|
97
|
-
onSuccess:
|
102
|
+
onSuccess: res => {
|
98
103
|
var _res$status = res.status,
|
99
104
|
status = _res$status === void 0 ? 200 : _res$status,
|
100
105
|
msg = res.message;
|
@@ -103,7 +108,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
103
108
|
responseData = transformResponse(res);
|
104
109
|
}
|
105
110
|
if (status !== 200) {
|
106
|
-
|
111
|
+
_message.error(msg);
|
107
112
|
return;
|
108
113
|
}
|
109
114
|
setState({
|
@@ -115,7 +120,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
115
120
|
},
|
116
121
|
debounceWait: 300
|
117
122
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
118
|
-
useDeepCompareEffect(
|
123
|
+
useDeepCompareEffect(() => {
|
119
124
|
if (dataSource && dataSource.length) {
|
120
125
|
setState({
|
121
126
|
treeData: dataSource,
|
@@ -143,7 +148,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
143
148
|
});
|
144
149
|
}
|
145
150
|
}, [dataSource, enumCode]);
|
146
|
-
useDeepCompareEffect(
|
151
|
+
useDeepCompareEffect(() => {
|
147
152
|
if (enumCode) {
|
148
153
|
return undefined;
|
149
154
|
}
|
@@ -160,12 +165,12 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
160
165
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
161
166
|
fetchFunction.run(params);
|
162
167
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
163
|
-
useEffect(
|
168
|
+
useEffect(() => {
|
164
169
|
setState({
|
165
|
-
open
|
170
|
+
open
|
166
171
|
});
|
167
172
|
}, [open]);
|
168
|
-
useEffect(
|
173
|
+
useEffect(() => {
|
169
174
|
if (value) {
|
170
175
|
var checkedValues = [];
|
171
176
|
var treeData = state.treeData,
|
@@ -174,9 +179,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
174
179
|
var treeViewData = [];
|
175
180
|
if (allValue && typeof value === 'string' && allValue === value) {
|
176
181
|
if (modeType === LIST) {
|
177
|
-
checkedValues = treeData.map(
|
178
|
-
return item[fieldNameValue];
|
179
|
-
}) || [];
|
182
|
+
checkedValues = treeData.map(item => item[fieldNameValue]) || [];
|
180
183
|
} else if (modeType === TREE) {
|
181
184
|
checkedValues = allKeys;
|
182
185
|
}
|
@@ -187,36 +190,32 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
187
190
|
}
|
188
191
|
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
189
192
|
if (labelInValue) {
|
190
|
-
var isObjectArray = value.every(
|
191
|
-
return _typeof(element) === 'object' && element !== null;
|
192
|
-
});
|
193
|
+
var isObjectArray = value.every(element => typeof element === 'object' && element !== null);
|
193
194
|
if (!isObjectArray) {
|
194
195
|
console.error('Please enter an array object');
|
195
196
|
checkedValues = [];
|
196
197
|
}
|
197
|
-
checkedValues = value.map(
|
198
|
-
return item[fieldNameValue];
|
199
|
-
});
|
198
|
+
checkedValues = value.map(item => item[fieldNameValue]);
|
200
199
|
} else {
|
201
200
|
checkedValues = value;
|
202
201
|
}
|
203
202
|
}
|
204
203
|
treeViewData = filterCheckedNodes(originalTreeData, checkedValues, '', fieldNames);
|
205
204
|
setState({
|
206
|
-
checkedValues
|
205
|
+
checkedValues,
|
207
206
|
checkAll: checkedValues.length === allKeys.length,
|
208
|
-
treeViewData
|
207
|
+
treeViewData,
|
209
208
|
beforeClearAllValues: checkedValues
|
210
209
|
});
|
211
210
|
}
|
212
211
|
}, [value, state.allKeys, state.open]);
|
213
|
-
useDeepCompareEffect(
|
212
|
+
useDeepCompareEffect(() => {
|
214
213
|
var transformedTree = addLevelAndParentId(state.treeData, fieldNames);
|
215
214
|
setState({
|
216
|
-
transformedTree
|
215
|
+
transformedTree
|
217
216
|
});
|
218
217
|
}, [state.treeData]);
|
219
|
-
var handleClick =
|
218
|
+
var handleClick = () => {
|
220
219
|
setState({
|
221
220
|
open: true
|
222
221
|
});
|
@@ -226,16 +225,14 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
226
225
|
/**
|
227
226
|
* close Drawer and onChange(values)
|
228
227
|
*/
|
229
|
-
var handleFinish =
|
228
|
+
var handleFinish = () => {
|
230
229
|
// 全选的时候返回 allValue 标记即可
|
231
230
|
// 3.3.2 版本全选的时候返回所有值的合集 list
|
232
231
|
if (allValue !== undefined && state.checkAll && !draggable) {
|
233
232
|
if (labelInValue) {
|
234
233
|
onChange === null || onChange === void 0 || onChange(state.flatTreeData);
|
235
234
|
} else {
|
236
|
-
onChange === null || onChange === void 0 || onChange(state.flatTreeData.map(
|
237
|
-
return item[fieldNameValue];
|
238
|
-
}));
|
235
|
+
onChange === null || onChange === void 0 || onChange(state.flatTreeData.map(item => item[fieldNameValue]));
|
239
236
|
}
|
240
237
|
} else if (draggable && span) {
|
241
238
|
var _listRef$current;
|
@@ -245,10 +242,8 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
245
242
|
} else {
|
246
243
|
var values = [];
|
247
244
|
if (labelInValue) {
|
248
|
-
state.checkedValues.forEach(
|
249
|
-
var option = state.flatTreeData.find(
|
250
|
-
return item[fieldNameValue] === val;
|
251
|
-
});
|
245
|
+
state.checkedValues.forEach(val => {
|
246
|
+
var option = state.flatTreeData.find(item => item[fieldNameValue] === val);
|
252
247
|
option && values.push(option);
|
253
248
|
});
|
254
249
|
} else {
|
@@ -257,8 +252,8 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
257
252
|
if (min) {
|
258
253
|
if (values.length < min) {
|
259
254
|
var _locale$ProTreeModal3;
|
260
|
-
|
261
|
-
min
|
255
|
+
_message.error(formatMessage(locale === null || locale === void 0 || (_locale$ProTreeModal3 = locale.ProTreeModal) === null || _locale$ProTreeModal3 === void 0 ? void 0 : _locale$ProTreeModal3.selectMin, {
|
256
|
+
min
|
262
257
|
}));
|
263
258
|
return;
|
264
259
|
}
|
@@ -280,14 +275,10 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
280
275
|
/**
|
281
276
|
* clear all checked
|
282
277
|
*/
|
283
|
-
var handleClearAll =
|
278
|
+
var handleClearAll = () => {
|
284
279
|
var _state$flatTreeData$f;
|
285
280
|
// 处理 ProTable 场景下 disabled 的不需要被清理
|
286
|
-
var _checkedValues = span ? (_state$flatTreeData$f = state.flatTreeData.filter(
|
287
|
-
return item.disabled;
|
288
|
-
})) === null || _state$flatTreeData$f === void 0 ? void 0 : _state$flatTreeData$f.map(function (item) {
|
289
|
-
return item[fieldNameValue];
|
290
|
-
}) : [];
|
281
|
+
var _checkedValues = span ? (_state$flatTreeData$f = state.flatTreeData.filter(item => item.disabled)) === null || _state$flatTreeData$f === void 0 ? void 0 : _state$flatTreeData$f.map(item => item[fieldNameValue]) : [];
|
291
282
|
setState({
|
292
283
|
checkedValues: _checkedValues,
|
293
284
|
beforeClearAllValues: state.checkedValues,
|
@@ -300,7 +291,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
300
291
|
/**
|
301
292
|
* Drawer close
|
302
293
|
*/
|
303
|
-
var handleClose =
|
294
|
+
var handleClose = () => {
|
304
295
|
setState({
|
305
296
|
open: false,
|
306
297
|
checkedValues: state.beforeClearAllValues,
|
@@ -313,21 +304,15 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
313
304
|
* checkbox/list selected change values
|
314
305
|
* @param values
|
315
306
|
*/
|
316
|
-
var handleListCheckChange =
|
317
|
-
var checkedValues =
|
307
|
+
var handleListCheckChange = (e, code) => {
|
308
|
+
var checkedValues = [...state.checkedValues];
|
318
309
|
var checked = e.target.checked;
|
319
310
|
if (!checked) {
|
320
|
-
checkedValues = checkedValues.filter(
|
321
|
-
return value !== code;
|
322
|
-
});
|
311
|
+
checkedValues = checkedValues.filter(value => value !== code);
|
323
312
|
} else if (draggable && span) {
|
324
313
|
// 固定在右侧的情况
|
325
|
-
var fixedOption = state.flatTreeData.find(
|
326
|
-
|
327
|
-
}) || {};
|
328
|
-
var fixedIdx = checkedValues.findIndex(function (value) {
|
329
|
-
return value === fixedOption[fieldNameValue];
|
330
|
-
});
|
314
|
+
var fixedOption = state.flatTreeData.find(item => item.fixed === 'right') || {};
|
315
|
+
var fixedIdx = checkedValues.findIndex(value => value === fixedOption[fieldNameValue]);
|
331
316
|
if (fixedIdx >= 0) {
|
332
317
|
checkedValues.splice(fixedIdx, 0, code);
|
333
318
|
} else {
|
@@ -338,25 +323,25 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
338
323
|
}
|
339
324
|
if (max && checkedValues.length > max) {
|
340
325
|
var _locale$ProTreeModal4;
|
341
|
-
|
342
|
-
max
|
326
|
+
_message.error(maxMessage ? transformMessage({
|
327
|
+
max
|
343
328
|
}, maxMessage) : formatMessage(locale === null || locale === void 0 || (_locale$ProTreeModal4 = locale.ProTreeModal) === null || _locale$ProTreeModal4 === void 0 ? void 0 : _locale$ProTreeModal4.selectMax, {
|
344
|
-
max
|
329
|
+
max
|
345
330
|
}));
|
346
331
|
return;
|
347
332
|
}
|
348
333
|
setState({
|
349
|
-
checkedValues
|
334
|
+
checkedValues,
|
350
335
|
checkAll: checkedValues.length === state.flatTreeData.length
|
351
336
|
});
|
352
337
|
};
|
353
|
-
var handleDragEndChange =
|
338
|
+
var handleDragEndChange = checkedValues => {
|
354
339
|
setState({
|
355
|
-
checkedValues
|
340
|
+
checkedValues
|
356
341
|
});
|
357
342
|
};
|
358
|
-
var onCheck =
|
359
|
-
var checkedValues =
|
343
|
+
var onCheck = (checkedKeys, info) => {
|
344
|
+
var checkedValues = [...state.checkedValues];
|
360
345
|
var originalTreeData = state.originalTreeData;
|
361
346
|
|
362
347
|
// 如果有检索则自管理
|
@@ -364,33 +349,25 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
364
349
|
var _transformTreeToArray;
|
365
350
|
var node = info.node;
|
366
351
|
// 从完整树中找到当前节点
|
367
|
-
var activeNode = treeNodeFind(state.transformedTree,
|
368
|
-
return t[fieldNameValue] === node[fieldNameValue];
|
369
|
-
}, {
|
352
|
+
var activeNode = treeNodeFind(state.transformedTree, t => t[fieldNameValue] === node[fieldNameValue], {
|
370
353
|
childrenKey: fieldNames.children
|
371
354
|
});
|
372
355
|
var allChildren = (_transformTreeToArray = transformTreeToArray([activeNode], {
|
373
356
|
childrenKey: fieldNames.children
|
374
|
-
})) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(
|
375
|
-
return item[fieldNameValue];
|
376
|
-
});
|
357
|
+
})) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(item => item[fieldNameValue]);
|
377
358
|
// 子项合并勾选
|
378
359
|
checkedValues = checkedValues.concat(allChildren);
|
379
360
|
// 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
|
380
|
-
var _recourse =
|
361
|
+
var _recourse = findNode => {
|
381
362
|
if (findNode.parentId) {
|
382
363
|
var _transformTreeToArray2;
|
383
|
-
var parentNode = treeNodeFind(state.transformedTree,
|
384
|
-
return t[fieldNameValue] === findNode.parentId;
|
385
|
-
}, {
|
364
|
+
var parentNode = treeNodeFind(state.transformedTree, t => t[fieldNameValue] === findNode.parentId, {
|
386
365
|
childrenKey: fieldNames.children
|
387
366
|
});
|
388
367
|
var parentChildrenKeys = (_transformTreeToArray2 = transformTreeToArray([parentNode], {
|
389
368
|
childrenKey: fieldNames.children
|
390
|
-
})) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(
|
391
|
-
|
392
|
-
});
|
393
|
-
var parentChildrenAllChecked = parentChildrenKeys.every(function (key) {
|
369
|
+
})) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(item => item[fieldNameValue]);
|
370
|
+
var parentChildrenAllChecked = parentChildrenKeys.every(key => {
|
394
371
|
return checkedValues.includes(key);
|
395
372
|
});
|
396
373
|
if (parentChildrenAllChecked) {
|
@@ -413,29 +390,21 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
413
390
|
// 2. 把所有的子节点也要取消
|
414
391
|
var childrenkeys = [];
|
415
392
|
getChildrenKeys(info.node, childrenkeys, fieldNames, 'treeCheck');
|
416
|
-
checkedValues = checkedValues.filter(
|
417
|
-
return !childrenkeys.includes(key);
|
418
|
-
});
|
393
|
+
checkedValues = checkedValues.filter(key => !childrenkeys.includes(key));
|
419
394
|
|
420
395
|
// 3. 取消父节点
|
421
396
|
var parentNodes = findTreeNodeByKey(originalTreeData, info.node.key, fieldNames);
|
422
|
-
var parentKeys = parentNodes.reduce(
|
423
|
-
|
424
|
-
}, []);
|
425
|
-
checkedValues = checkedValues.filter(function (key) {
|
426
|
-
return !parentKeys.includes(key);
|
427
|
-
});
|
397
|
+
var parentKeys = parentNodes.reduce((prev, curr) => prev.concat(curr[fieldNameValue]), []);
|
398
|
+
checkedValues = checkedValues.filter(key => !parentKeys.includes(key));
|
428
399
|
} else {
|
429
400
|
// _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
|
430
401
|
if (_checkStrictly) {
|
431
402
|
if (!info.checked) {
|
432
|
-
checkedValues = checkedValues.filter(
|
433
|
-
return key !== info.node.key;
|
434
|
-
});
|
403
|
+
checkedValues = checkedValues.filter(key => key !== info.node.key);
|
435
404
|
}
|
436
405
|
checkedKeys = checkedKeys.checked || [];
|
437
406
|
}
|
438
|
-
checkedKeys.forEach(
|
407
|
+
checkedKeys.forEach(key => {
|
439
408
|
var exist = checkedValues.includes(key);
|
440
409
|
if (info.checked && !exist) {
|
441
410
|
checkedValues.push(key);
|
@@ -448,22 +417,22 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
448
417
|
if (!checkStrictly) {
|
449
418
|
treeViewData = filterCheckedNodes(originalTreeData, checkedValues, '', fieldNames);
|
450
419
|
} else {
|
451
|
-
treeViewData = state.flatTreeData.filter(
|
420
|
+
treeViewData = state.flatTreeData.filter(item => {
|
452
421
|
return checkedValues.includes(item[fieldNameValue]);
|
453
422
|
});
|
454
423
|
}
|
455
424
|
if (max && checkedValues.length > max) {
|
456
425
|
var _locale$ProTreeModal5;
|
457
|
-
|
458
|
-
max
|
426
|
+
_message.error(maxMessage ? transformMessage({
|
427
|
+
max
|
459
428
|
}, maxMessage) : formatMessage(locale === null || locale === void 0 || (_locale$ProTreeModal5 = locale.ProTreeModal) === null || _locale$ProTreeModal5 === void 0 ? void 0 : _locale$ProTreeModal5.selectMax, {
|
460
|
-
max
|
429
|
+
max
|
461
430
|
}));
|
462
431
|
return;
|
463
432
|
}
|
464
433
|
setState({
|
465
|
-
checkedValues
|
466
|
-
treeViewData
|
434
|
+
checkedValues,
|
435
|
+
treeViewData,
|
467
436
|
checkAll: state.allKeys.length === checkedValues.length
|
468
437
|
});
|
469
438
|
};
|
@@ -472,11 +441,9 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
472
441
|
* filter checkbox by fileNameValue
|
473
442
|
* @param fileNameValue
|
474
443
|
*/
|
475
|
-
var handleFilterClose =
|
444
|
+
var handleFilterClose = fileNameValue => {
|
476
445
|
setState({
|
477
|
-
checkedValues: state.checkedValues.filter(
|
478
|
-
return value !== fileNameValue;
|
479
|
-
}),
|
446
|
+
checkedValues: state.checkedValues.filter(value => value !== fileNameValue),
|
480
447
|
checkAll: false
|
481
448
|
});
|
482
449
|
};
|
@@ -486,52 +453,42 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
486
453
|
* @param fileNamekey
|
487
454
|
* @param node
|
488
455
|
*/
|
489
|
-
var treeFilterClose =
|
490
|
-
var checkedValues =
|
456
|
+
var treeFilterClose = (fileNamekey, node) => {
|
457
|
+
var checkedValues = [...state.checkedValues];
|
491
458
|
var treeViewData = [];
|
492
459
|
var originalTreeData = state.originalTreeData;
|
493
460
|
if (checkStrictly) {
|
494
|
-
checkedValues = checkedValues.filter(
|
495
|
-
return key !== fileNamekey;
|
496
|
-
});
|
461
|
+
checkedValues = checkedValues.filter(key => key !== fileNamekey);
|
497
462
|
// handleFilterClose
|
498
|
-
treeViewData = state.flatTreeData.filter(
|
463
|
+
treeViewData = state.flatTreeData.filter(item => {
|
499
464
|
return checkedValues.includes(item[fieldNameValue]);
|
500
465
|
});
|
501
466
|
} else {
|
502
467
|
// 1. 取消自身
|
503
|
-
checkedValues = checkedValues.filter(
|
504
|
-
return key !== fileNamekey;
|
505
|
-
});
|
468
|
+
checkedValues = checkedValues.filter(key => key !== fileNamekey);
|
506
469
|
// 2. 把所有的子节点也要取消
|
507
470
|
var childrenkeys = [];
|
508
471
|
getChildrenKeys(node, childrenkeys, fieldNames, 'treeClose');
|
509
|
-
checkedValues = checkedValues.filter(
|
510
|
-
return !childrenkeys.includes(key);
|
511
|
-
});
|
472
|
+
checkedValues = checkedValues.filter(key => !childrenkeys.includes(key));
|
512
473
|
|
513
474
|
// 3. 取消父节点
|
514
475
|
var parentNodes = findTreeNodeByKey(originalTreeData, fileNamekey, fieldNames);
|
515
|
-
var parentKeys = parentNodes.reduce(
|
516
|
-
|
517
|
-
}, []);
|
518
|
-
checkedValues = checkedValues.filter(function (key) {
|
519
|
-
return !parentKeys.includes(key);
|
520
|
-
});
|
476
|
+
var parentKeys = parentNodes.reduce((prev, curr) => prev.concat(curr[fieldNames.value]), []);
|
477
|
+
checkedValues = checkedValues.filter(key => !parentKeys.includes(key));
|
521
478
|
|
522
479
|
// 根据选中的筛选出 viewTreeData
|
523
480
|
treeViewData = filterCheckedNodes(originalTreeData, checkedValues, '', fieldNames);
|
524
481
|
}
|
525
482
|
setState({
|
526
|
-
checkedValues
|
527
|
-
treeViewData
|
483
|
+
checkedValues,
|
484
|
+
treeViewData,
|
528
485
|
checkAll: false
|
529
486
|
});
|
530
487
|
};
|
531
|
-
var _useDebounceFn = useDebounceFn(
|
488
|
+
var _useDebounceFn = useDebounceFn(str => {
|
532
489
|
if (modeType === LIST || modeType === CASCADER) {
|
533
490
|
var isCASCADER = modeType === CASCADER;
|
534
|
-
var data = state.flatTreeData.filter(
|
491
|
+
var data = state.flatTreeData.filter(item => {
|
535
492
|
var title = isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel];
|
536
493
|
return title.includes(str);
|
537
494
|
});
|
@@ -543,7 +500,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
543
500
|
wait: 0
|
544
501
|
}),
|
545
502
|
onSearch = _useDebounceFn.run;
|
546
|
-
var handleSetSearchStr =
|
503
|
+
var handleSetSearchStr = str => {
|
547
504
|
setState({
|
548
505
|
searchStr: str
|
549
506
|
});
|
@@ -554,7 +511,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
554
511
|
* 指定模式下的操作
|
555
512
|
* @param appoint
|
556
513
|
*/
|
557
|
-
var appointChange =
|
514
|
+
var appointChange = appoint => {
|
558
515
|
if (appoint) {
|
559
516
|
onChange === null || onChange === void 0 || onChange(allValue);
|
560
517
|
setState({
|
@@ -577,7 +534,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
577
534
|
* default example and you can customize trigger={<Button>打开</Button>}
|
578
535
|
* @returns
|
579
536
|
*/
|
580
|
-
var TriggerComponent = useMemo(
|
537
|
+
var TriggerComponent = useMemo(() => {
|
581
538
|
var _props$otherProps3;
|
582
539
|
if (trigger && /*#__PURE__*/React.isValidElement(trigger)) {
|
583
540
|
return /*#__PURE__*/_jsx("div", {
|
@@ -605,46 +562,40 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
605
562
|
/**
|
606
563
|
* 全选操作
|
607
564
|
*/
|
608
|
-
var handleAllCheck =
|
565
|
+
var handleAllCheck = e => {
|
609
566
|
var checked = e.target.checked;
|
610
567
|
var checkedValues = [];
|
611
568
|
var treeViewData = [];
|
612
569
|
if (modeType === LIST || modeType === CASCADER) {
|
613
570
|
if (checked) {
|
614
|
-
checkedValues = state.flatTreeData.map(
|
615
|
-
return item[fieldNameValue];
|
616
|
-
});
|
571
|
+
checkedValues = state.flatTreeData.map(item => item[fieldNameValue]);
|
617
572
|
} else if (!checked && span) {
|
618
573
|
// ProTable 场景下 disabled 不取消掉
|
619
|
-
checkedValues = state.flatTreeData.filter(
|
620
|
-
return item.disabled;
|
621
|
-
}).map(function (item) {
|
622
|
-
return item[fieldNameValue];
|
623
|
-
});
|
574
|
+
checkedValues = state.flatTreeData.filter(item => item.disabled).map(item => item[fieldNameValue]);
|
624
575
|
} else if (!checked) {
|
625
576
|
checkedValues = [];
|
626
577
|
}
|
627
578
|
} else if (modeType === TREE) {
|
628
579
|
checkedValues = checked ? state.allKeys : [];
|
629
580
|
if (checkStrictly) {
|
630
|
-
treeViewData =
|
581
|
+
treeViewData = [...state.flatTreeData];
|
631
582
|
} else {
|
632
583
|
treeViewData = filterCheckedNodes(state.originalTreeData, checkedValues, '', fieldNames);
|
633
584
|
}
|
634
585
|
}
|
635
586
|
if (max && checkedValues.length > max) {
|
636
587
|
var _locale$ProTreeModal6;
|
637
|
-
|
638
|
-
max
|
588
|
+
_message.error(maxMessage ? transformMessage({
|
589
|
+
max
|
639
590
|
}, maxMessage) : formatMessage(locale === null || locale === void 0 || (_locale$ProTreeModal6 = locale.ProTreeModal) === null || _locale$ProTreeModal6 === void 0 ? void 0 : _locale$ProTreeModal6.selectMax, {
|
640
|
-
max
|
591
|
+
max
|
641
592
|
}));
|
642
593
|
return;
|
643
594
|
}
|
644
595
|
setState({
|
645
|
-
checkedValues
|
596
|
+
checkedValues,
|
646
597
|
checkAll: checked,
|
647
|
-
treeViewData
|
598
|
+
treeViewData
|
648
599
|
});
|
649
600
|
};
|
650
601
|
|
@@ -652,7 +603,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
652
603
|
* 左侧容器、分为三种 list、tree、Cascader
|
653
604
|
* @returns
|
654
605
|
*/
|
655
|
-
var renderContainer =
|
606
|
+
var renderContainer = () => {
|
656
607
|
if (state.treeData.length === 0 && state.searchStr) {
|
657
608
|
var _locale$ProTreeModal7;
|
658
609
|
return /*#__PURE__*/_jsx("div", {
|
@@ -715,12 +666,10 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
715
666
|
break;
|
716
667
|
}
|
717
668
|
};
|
718
|
-
var listTreeData = useMemo(
|
669
|
+
var listTreeData = useMemo(() => {
|
719
670
|
var checkListOptions = [];
|
720
|
-
state.checkedValues.forEach(
|
721
|
-
var option = state.flatTreeData.find(
|
722
|
-
return item[fieldNameValue] === key;
|
723
|
-
});
|
671
|
+
state.checkedValues.forEach(key => {
|
672
|
+
var option = state.flatTreeData.find(item => item[fieldNameValue] === key);
|
724
673
|
if (option) {
|
725
674
|
checkListOptions.push(option);
|
726
675
|
}
|
@@ -732,7 +681,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
732
681
|
* 勾选后的右侧展示
|
733
682
|
* @returns
|
734
683
|
*/
|
735
|
-
var renderView =
|
684
|
+
var renderView = () => {
|
736
685
|
if (state.checkedValues.length === 0) {
|
737
686
|
var _locale$ProTreeModal8;
|
738
687
|
return /*#__PURE__*/_jsx("div", {
|
@@ -789,7 +738,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
789
738
|
title: title,
|
790
739
|
showType: "Modal",
|
791
740
|
className: "pro-tree-modal-container",
|
792
|
-
extraLeft: allValue !== undefined ? /*#__PURE__*/_jsx(
|
741
|
+
extraLeft: allValue !== undefined ? /*#__PURE__*/_jsx(_Checkbox, {
|
793
742
|
checked: state.checkAll,
|
794
743
|
disabled: disabled,
|
795
744
|
onChange: handleAllCheck,
|
@@ -799,15 +748,13 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
799
748
|
className: "pro-tree-modal-content",
|
800
749
|
children: [/*#__PURE__*/_jsxs("div", {
|
801
750
|
className: classNames('pro-tree-modal-box', modeType === CASCADER || modeType === LIST && span ? 'pro-tree-modal-cascader-box' : ''),
|
802
|
-
children: [/*#__PURE__*/_jsx(
|
751
|
+
children: [/*#__PURE__*/_jsx(_Input, {
|
803
752
|
disabled: disabled,
|
804
753
|
allowClear: true,
|
805
754
|
value: state.searchStr,
|
806
755
|
placeholder: placeholder || (locale === null || locale === void 0 || (_locale$ProTreeModal10 = locale.ProTreeModal) === null || _locale$ProTreeModal10 === void 0 ? void 0 : _locale$ProTreeModal10.input),
|
807
756
|
className: "pro-tree-modal-search",
|
808
|
-
onChange:
|
809
|
-
return handleSetSearchStr(e.target.value);
|
810
|
-
},
|
757
|
+
onChange: e => handleSetSearchStr(e.target.value),
|
811
758
|
prefix: /*#__PURE__*/_jsx(ReactSVG, {
|
812
759
|
className: "pro-tree-modal-search-svg",
|
813
760
|
src: searchSVG
|
@@ -822,7 +769,7 @@ var ProTreeModal = function ProTreeModal(props) {
|
|
822
769
|
className: "pro-tree-modal-box-header",
|
823
770
|
children: [/*#__PURE__*/_jsxs("span", {
|
824
771
|
children: [locale === null || locale === void 0 || (_locale$ProTreeModal11 = locale.ProTreeModal) === null || _locale$ProTreeModal11 === void 0 ? void 0 : _locale$ProTreeModal11.check, " (", state.checkedValues.length, "/", max || state.flatTreeData.length, ")"]
|
825
|
-
}), /*#__PURE__*/_jsx(
|
772
|
+
}), /*#__PURE__*/_jsx(_Button, {
|
826
773
|
disabled: disabled,
|
827
774
|
type: "link",
|
828
775
|
onClick: handleClearAll,
|