@zat-design/sisyphus-react 4.0.0-beta.4 → 4.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +1 -0
- package/dist/index.min.js +1 -0
- package/dist/less.esm.css +1 -0
- package/dist/less.min.js +1 -0
- package/es/FormsProvider/index.js +5 -5
- package/es/ProAction/components/CheckModalContent/index.js +5 -7
- package/es/ProAction/index.js +16 -16
- package/es/ProConfigProvider/index.js +31 -17
- package/es/ProDownload/index.js +13 -12
- package/es/ProDownload/utils.js +15 -15
- package/es/ProDrawerForm/components/ProDrawer/index.js +22 -19
- package/es/ProDrawerForm/components/ProModal/index.js +14 -9
- package/es/ProDrawerForm/index.js +6 -10
- package/es/ProDrawerForm/utils/index.js +1 -1
- package/es/ProEditLabel/components/RenderProForm.js +10 -9
- package/es/ProEditLabel/index.js +36 -24
- package/es/ProEditLabel/utils/index.js +4 -3
- package/es/ProEditTable/components/ActionButton/index.js +58 -56
- package/es/ProEditTable/components/RcTable/BaseTable.js +21 -20
- package/es/ProEditTable/components/RcTable/DraggableTable.js +27 -34
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +40 -46
- package/es/ProEditTable/components/RenderField/index.js +98 -121
- package/es/ProEditTable/components/RenderToolbar/index.js +27 -33
- package/es/ProEditTable/components/Summary/index.js +16 -14
- package/es/ProEditTable/components/Validator/index.js +9 -6
- package/es/ProEditTable/index.js +130 -147
- package/es/ProEditTable/utils/config.js +29 -36
- package/es/ProEditTable/utils/diffOriginal.js +13 -13
- package/es/ProEditTable/utils/getDefaultProps.js +6 -7
- package/es/ProEditTable/utils/index.js +52 -58
- package/es/ProEditTable/utils/tools.js +32 -41
- package/es/ProEditTable/utils/transform.js +7 -11
- package/es/ProEditTable/utils/useEditTableError.js +10 -12
- package/es/ProEnum/components/Group.js +18 -22
- package/es/ProEnum/components/Tag.js +10 -14
- package/es/ProEnum/hooks/useEnum.js +6 -10
- package/es/ProEnum/hooks/useEnumRequest.js +23 -25
- package/es/ProEnum/hooks/useFrequentEnumRequest.d.ts +14 -0
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +76 -0
- package/es/ProEnum/index.js +50 -52
- package/es/ProEnum/propsType.d.ts +29 -0
- package/es/ProEnum/utils/eventCenter.js +20 -31
- package/es/ProEnum/utils/frequentEnum.d.ts +40 -0
- package/es/ProEnum/utils/frequentEnum.js +91 -0
- package/es/ProEnum/utils/getEnumLabel.js +8 -12
- package/es/ProEnum/utils/index.js +6 -6
- package/es/ProForm/components/Container.js +4 -3
- package/es/ProForm/components/FormFooter/index.js +16 -13
- package/es/ProForm/components/base/Checkbox/index.js +10 -11
- package/es/ProForm/components/base/DatePicker/index.js +8 -7
- package/es/ProForm/components/base/DatePicker/useDateLimit.js +2 -4
- package/es/ProForm/components/base/Input/index.js +24 -20
- package/es/ProForm/components/base/InputNumber/index.js +21 -18
- package/es/ProForm/components/base/Radio/index.js +11 -12
- package/es/ProForm/components/base/RangePicker/index.js +9 -12
- package/es/ProForm/components/base/RangePicker/useDateRange.js +3 -3
- package/es/ProForm/components/base/Select/index.js +9 -8
- package/es/ProForm/components/base/Switch/index.js +7 -6
- package/es/ProForm/components/base/SwitchCheckbox/index.js +7 -6
- package/es/ProForm/components/base/TextArea/index.js +9 -8
- package/es/ProForm/components/base/TimePicker/index.js +5 -4
- package/es/ProForm/components/combination/Container/index.js +12 -12
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +60 -70
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +11 -7
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/es/ProForm/components/combination/FormList/components/Empty.js +9 -10
- package/es/ProForm/components/combination/FormList/components/LineFields.js +10 -9
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +32 -36
- package/es/ProForm/components/combination/FormList/index.js +25 -33
- package/es/ProForm/components/combination/FormList/utils.js +5 -7
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +1 -1
- package/es/ProForm/components/combination/Group/component/ComRender.js +14 -14
- package/es/ProForm/components/combination/Group/hooks/index.d.ts +0 -1
- package/es/ProForm/components/combination/Group/hooks/index.js +30 -35
- package/es/ProForm/components/combination/Group/index.js +35 -29
- package/es/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/es/ProForm/components/combination/Group/style/index.less +7 -0
- package/es/ProForm/components/combination/Group/utils.d.ts +0 -1
- package/es/ProForm/components/combination/Group/utils.js +38 -39
- package/es/ProForm/components/combination/ProCascader/index.js +43 -52
- package/es/ProForm/components/combination/ProCascader/utils/index.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +16 -16
- package/es/ProForm/components/combination/ProModalSelect/index.js +102 -108
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +73 -47
- package/es/ProForm/components/combination/ProNumberRange/propsType.d.ts +3 -2
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +20 -18
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +3 -3
- package/es/ProForm/components/combination/ProTimeLimit/index.js +17 -15
- package/es/ProForm/components/render/ChangedWrapper.js +24 -26
- package/es/ProForm/components/render/ConfirmWrapper.js +10 -11
- package/es/ProForm/components/render/Render.js +107 -102
- package/es/ProForm/components/render/RenderFields.d.ts +0 -1
- package/es/ProForm/components/render/RenderFields.js +22 -24
- package/es/ProForm/index.js +44 -45
- package/es/ProForm/propsType.d.ts +1 -4
- package/es/ProForm/utils/diffOriginal.js +9 -9
- package/es/ProForm/utils/getDefaultProps.js +5 -5
- package/es/ProForm/utils/index.js +62 -90
- package/es/ProForm/utils/processDependencies.js +4 -5
- package/es/ProForm/utils/rulesCreator.js +12 -12
- package/es/ProForm/utils/transformNames.js +2 -2
- package/es/ProForm/utils/transformValue.js +6 -8
- package/es/ProForm/utils/useDeepCompareMemo.js +1 -1
- package/es/ProForm/utils/useFieldProps.js +1 -3
- package/es/ProForm/utils/useForm.js +19 -21
- package/es/ProForm/utils/useRules.js +17 -22
- package/es/ProForm/utils/useShouldUpdate.js +79 -83
- package/es/ProForm/utils/useWatch.js +12 -12
- package/es/ProForm/utils/valueType.js +46 -50
- package/es/ProIcon/index.js +30 -31
- package/es/ProIcon/utils/index.js +5 -5
- package/es/ProLayout/components/Layout/Header/index.js +1 -1
- package/es/ProLayout/components/Layout/Icon/Icon.js +4 -4
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +19 -22
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +23 -30
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +3 -3
- package/es/ProLayout/components/Layout/Menu/index.js +9 -9
- package/es/ProLayout/components/Layout/Notice/index.js +3 -3
- package/es/ProLayout/components/ProCollapse/index.js +23 -18
- package/es/ProLayout/components/ProFooter/index.js +13 -14
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +6 -5
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +6 -5
- package/es/ProLayout/components/ProHeader/index.js +68 -59
- package/es/ProLayout/components/ProHeader/utils/index.js +1 -1
- package/es/ProLayout/index.js +33 -32
- package/es/ProLayout/utils/index.js +17 -18
- package/es/ProSelect/components/AdaptiveTooltip.js +8 -9
- package/es/ProSelect/index.js +57 -64
- package/es/ProSelect/utils/index.js +17 -28
- package/es/ProStep/components/Anchor/index.js +10 -9
- package/es/ProStep/components/Item/index.js +11 -11
- package/es/ProStep/components/Listener/index.js +6 -10
- package/es/ProStep/components/Step/index.js +9 -11
- package/es/ProStep/index.js +24 -30
- package/es/ProStep/utils/index.js +8 -8
- package/es/ProStepTab/index.js +27 -28
- package/es/ProTable/components/FormatColumn/index.js +54 -59
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +6 -7
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +21 -37
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +16 -17
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +5 -6
- package/es/ProTable/components/RenderColumn/index.js +36 -35
- package/es/ProTable/components/RenderEmptyText/index.js +1 -1
- package/es/ProTable/components/RenderFooter/index.js +2 -2
- package/es/ProTable/components/RenderSummary/index.js +13 -12
- package/es/ProTable/components/RenderTableHeader/index.js +5 -4
- package/es/ProTable/components/RenderTabs/index.js +26 -29
- package/es/ProTable/components/TableResizable/index.js +8 -8
- package/es/ProTable/components/TooltipTitle/index.js +4 -3
- package/es/ProTable/hooks/useAntdTable.js +80 -95
- package/es/ProTable/index.js +110 -133
- package/es/ProTable/propsType.d.ts +9 -3
- package/es/ProTable/utils/index.js +13 -16
- package/es/ProTabs/components/Card/index.js +14 -8
- package/es/ProTabs/index.js +30 -20
- package/es/ProTabs/propType.d.ts +5 -0
- package/es/ProTabs/style/index.less +40 -3
- package/es/ProThemeTools/component/ProTools/index.js +46 -39
- package/es/ProThemeTools/context/ThemeContext.js +13 -13
- package/es/ProThemeTools/index.js +18 -19
- package/es/ProThemeTools/utils/index.js +14 -18
- package/es/ProTooltip/index.js +24 -27
- package/es/ProTree/components/AdaptiveTooltip.js +5 -6
- package/es/ProTree/components/List.js +10 -13
- package/es/ProTree/components/ProTree.js +47 -64
- package/es/ProTree/components/ProTreeSelect/index.js +77 -76
- package/es/ProTree/components/Tree.js +23 -22
- package/es/ProTree/index.js +1 -1
- package/es/ProTree/utils.js +14 -14
- package/es/ProTreeModal/components/Cascader.js +13 -16
- package/es/ProTreeModal/components/List.js +49 -70
- package/es/ProTreeModal/components/SortableItem.js +7 -8
- package/es/ProTreeModal/components/Tree.js +18 -23
- package/es/ProTreeModal/components/Trigger.js +15 -10
- package/es/ProTreeModal/index.js +98 -151
- package/es/ProTreeModal/utils.js +21 -21
- package/es/ProUpload/components/ButtonRender.js +11 -12
- package/es/ProUpload/components/DragRender.js +17 -20
- package/es/ProUpload/components/DraggableUploadListItem.js +2 -2
- package/es/ProUpload/components/Example.js +3 -3
- package/es/ProUpload/components/FileItem.js +30 -25
- package/es/ProUpload/components/ImageRender.js +29 -22
- package/es/ProUpload/index.js +55 -66
- package/es/ProUpload/uitls.js +2 -2
- package/es/ProUtils/utils/index.js +10 -14
- package/es/ProViewer/index.js +22 -19
- package/es/ProViewer/propsType.js +0 -3
- package/es/ProWaterMark/index.js +4 -3
- package/es/index.d.ts +1 -1
- package/es/locale/index.js +2 -2
- package/es/style/index.less +1 -1
- package/es/style/theme/base.less +1 -0
- package/es/utils/index.js +11 -13
- package/lib/FormsProvider/index.js +30 -50
- package/lib/ProAction/components/CheckModalContent/index.js +31 -27
- package/lib/ProAction/index.js +194 -151
- package/lib/ProAction/propsType.js +4 -16
- package/lib/ProConfigProvider/index.js +136 -136
- package/lib/ProDownload/index.js +192 -124
- package/lib/ProDownload/propsType.js +4 -16
- package/lib/ProDownload/utils.js +189 -143
- package/lib/ProDrawerForm/components/ProDrawer/index.js +243 -169
- package/lib/ProDrawerForm/components/ProModal/index.js +194 -134
- package/lib/ProDrawerForm/components/index.js +17 -39
- package/lib/ProDrawerForm/index.js +79 -88
- package/lib/ProDrawerForm/propsType.js +4 -16
- package/lib/ProDrawerForm/utils/index.js +13 -30
- package/lib/ProEditLabel/components/RenderProForm.js +58 -57
- package/lib/ProEditLabel/index.js +251 -178
- package/lib/ProEditLabel/propsType.js +4 -16
- package/lib/ProEditLabel/utils/index.js +11 -26
- package/lib/ProEditTable/components/ActionButton/index.js +144 -155
- package/lib/ProEditTable/components/RcTable/BaseTable.js +97 -96
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +172 -151
- package/lib/ProEditTable/components/RcTable/index.js +17 -39
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +177 -176
- package/lib/ProEditTable/components/RenderField/index.js +628 -539
- package/lib/ProEditTable/components/RenderToolbar/index.js +119 -105
- package/lib/ProEditTable/components/Summary/index.js +70 -61
- package/lib/ProEditTable/components/Validator/index.js +30 -47
- package/lib/ProEditTable/components/index.js +38 -48
- package/lib/ProEditTable/index.js +379 -324
- package/lib/ProEditTable/propsType.js +4 -16
- package/lib/ProEditTable/utils/config.js +225 -170
- package/lib/ProEditTable/utils/diffOriginal.js +93 -80
- package/lib/ProEditTable/utils/getDefaultProps.js +26 -42
- package/lib/ProEditTable/utils/index.js +318 -244
- package/lib/ProEditTable/utils/tools.js +438 -243
- package/lib/ProEditTable/utils/transform.js +15 -28
- package/lib/ProEditTable/utils/useEditTableError.js +65 -54
- package/lib/ProEnum/components/Group.js +53 -81
- package/lib/ProEnum/components/Tag.js +37 -54
- package/lib/ProEnum/hooks/useEnum.js +72 -52
- package/lib/ProEnum/hooks/useEnumRequest.js +267 -194
- package/lib/ProEnum/hooks/useFrequentEnumRequest.d.ts +14 -0
- package/lib/ProEnum/hooks/useFrequentEnumRequest.js +83 -0
- package/lib/ProEnum/index.js +239 -234
- package/lib/ProEnum/propsType.d.ts +29 -0
- package/lib/ProEnum/propsType.js +4 -16
- package/lib/ProEnum/utils/eventCenter.js +15 -12
- package/lib/ProEnum/utils/frequentEnum.d.ts +40 -0
- package/lib/ProEnum/utils/frequentEnum.js +99 -0
- package/lib/ProEnum/utils/getEnumLabel.js +57 -65
- package/lib/ProEnum/utils/index.js +98 -68
- package/lib/ProForm/components/Container.js +35 -45
- package/lib/ProForm/components/FormFooter/index.js +67 -80
- package/lib/ProForm/components/FormFooter/propsType.js +4 -16
- package/lib/ProForm/components/base/Checkbox/index.js +67 -62
- package/lib/ProForm/components/base/DatePicker/index.js +63 -74
- package/lib/ProForm/components/base/DatePicker/useDateLimit.js +13 -29
- package/lib/ProForm/components/base/Input/index.js +65 -73
- package/lib/ProForm/components/base/Input/propsType.js +4 -16
- package/lib/ProForm/components/base/InputNumber/index.js +230 -176
- package/lib/ProForm/components/base/Radio/index.js +60 -69
- package/lib/ProForm/components/base/RangePicker/index.js +73 -88
- package/lib/ProForm/components/base/RangePicker/useDateRange.js +28 -45
- package/lib/ProForm/components/base/Select/index.js +63 -69
- package/lib/ProForm/components/base/Switch/index.js +43 -59
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +63 -62
- package/lib/ProForm/components/base/TextArea/index.js +52 -65
- package/lib/ProForm/components/base/TimePicker/index.js +45 -59
- package/lib/ProForm/components/combination/Container/index.js +58 -72
- package/lib/ProForm/components/combination/Container/propsType.js +4 -16
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +240 -195
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +85 -107
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +25 -44
- package/lib/ProForm/components/combination/FormList/components/Empty.js +92 -55
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +92 -117
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +133 -101
- package/lib/ProForm/components/combination/FormList/index.js +131 -164
- package/lib/ProForm/components/combination/FormList/propsType.js +4 -16
- package/lib/ProForm/components/combination/FormList/utils.js +32 -52
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +23 -38
- package/lib/ProForm/components/combination/Group/component/ComRender.js +78 -74
- package/lib/ProForm/components/combination/Group/hooks/index.d.ts +0 -1
- package/lib/ProForm/components/combination/Group/hooks/index.js +123 -123
- package/lib/ProForm/components/combination/Group/index.js +99 -104
- package/lib/ProForm/components/combination/Group/propsType.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/propsType.js +4 -16
- package/lib/ProForm/components/combination/Group/style/index.less +7 -0
- package/lib/ProForm/components/combination/Group/utils.d.ts +0 -1
- package/lib/ProForm/components/combination/Group/utils.js +132 -104
- package/lib/ProForm/components/combination/ProCascader/index.js +271 -226
- package/lib/ProForm/components/combination/ProCascader/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +23 -33
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +113 -114
- package/lib/ProForm/components/combination/ProModalSelect/index.js +651 -472
- package/lib/ProForm/components/combination/ProModalSelect/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +21 -43
- package/lib/ProForm/components/combination/ProNumberRange/index.js +207 -160
- package/lib/ProForm/components/combination/ProNumberRange/propsType.d.ts +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +169 -139
- package/lib/ProForm/components/combination/ProRangeLimit/propsType.js +4 -16
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +28 -49
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +150 -127
- package/lib/ProForm/components/index.js +192 -115
- package/lib/ProForm/components/render/ChangedWrapper.js +130 -141
- package/lib/ProForm/components/render/ConfirmWrapper.js +120 -78
- package/lib/ProForm/components/render/Render.js +445 -346
- package/lib/ProForm/components/render/RenderFields.d.ts +0 -1
- package/lib/ProForm/components/render/RenderFields.js +195 -181
- package/lib/ProForm/components/render/propsType.js +31 -17
- package/lib/ProForm/index.js +282 -235
- package/lib/ProForm/propsType.d.ts +1 -4
- package/lib/ProForm/propsType.js +9 -38
- package/lib/ProForm/utils/diffOriginal.js +88 -81
- package/lib/ProForm/utils/getDefaultProps.js +26 -42
- package/lib/ProForm/utils/index.js +330 -254
- package/lib/ProForm/utils/processDependencies.js +61 -44
- package/lib/ProForm/utils/rulesCreator.js +58 -81
- package/lib/ProForm/utils/transformNames.js +26 -37
- package/lib/ProForm/utils/transformValue.js +47 -47
- package/lib/ProForm/utils/useDeepCompareMemo.js +15 -34
- package/lib/ProForm/utils/useFieldProps.js +10 -42
- package/lib/ProForm/utils/useForm.js +226 -118
- package/lib/ProForm/utils/useRules.js +50 -60
- package/lib/ProForm/utils/useShouldUpdate.js +233 -126
- package/lib/ProForm/utils/useWatch.js +122 -93
- package/lib/ProForm/utils/valueType.js +222 -155
- package/lib/ProIcon/config/index.js +278 -365
- package/lib/ProIcon/index.js +217 -184
- package/lib/ProIcon/propsTypes.js +4 -16
- package/lib/ProIcon/symbolIcon.js +30 -23
- package/lib/ProIcon/utils/index.js +53 -60
- package/lib/ProLayout/components/Layout/Header/index.js +42 -59
- package/lib/ProLayout/components/Layout/Icon/Icon.js +31 -49
- package/lib/ProLayout/components/Layout/Icon/index.js +7 -34
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +170 -139
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +135 -117
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +4 -16
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +44 -60
- package/lib/ProLayout/components/Layout/Menu/index.js +52 -71
- package/lib/ProLayout/components/Layout/Notice/index.js +31 -39
- package/lib/ProLayout/components/Layout/index.js +31 -45
- package/lib/ProLayout/components/ProCollapse/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProCollapse/index.js +159 -148
- package/lib/ProLayout/components/ProFooter/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProFooter/index.js +41 -56
- package/lib/ProLayout/components/ProHeader/PropTypes.js +4 -16
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +26 -53
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +27 -48
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +4 -16
- package/lib/ProLayout/components/ProHeader/components/index.js +17 -39
- package/lib/ProLayout/components/ProHeader/index.js +466 -268
- package/lib/ProLayout/components/ProHeader/utils/index.js +14 -31
- package/lib/ProLayout/components/index.js +24 -42
- package/lib/ProLayout/index.js +139 -130
- package/lib/ProLayout/propTypes.js +4 -16
- package/lib/ProLayout/utils/index.js +120 -86
- package/lib/ProSelect/components/AdaptiveTooltip.js +38 -45
- package/lib/ProSelect/index.js +240 -213
- package/lib/ProSelect/propsType.js +4 -16
- package/lib/ProSelect/utils/index.js +114 -93
- package/lib/ProStep/components/Anchor/index.js +102 -107
- package/lib/ProStep/components/Item/index.js +71 -75
- package/lib/ProStep/components/Listener/index.js +69 -62
- package/lib/ProStep/components/Step/index.js +65 -75
- package/lib/ProStep/index.js +227 -165
- package/lib/ProStep/propsType.js +4 -16
- package/lib/ProStep/utils/index.js +54 -57
- package/lib/ProStepTab/index.js +307 -166
- package/lib/ProStepTab/propsType.js +4 -16
- package/lib/ProTable/components/FormatColumn/index.js +472 -425
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +39 -53
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +183 -135
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +85 -104
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +4 -16
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +58 -80
- package/lib/ProTable/components/RcTable/index.js +17 -39
- package/lib/ProTable/components/RenderColumn/index.js +203 -194
- package/lib/ProTable/components/RenderEmptyText/index.js +25 -27
- package/lib/ProTable/components/RenderFooter/index.js +17 -33
- package/lib/ProTable/components/RenderSummary/index.js +57 -46
- package/lib/ProTable/components/RenderTableHeader/index.js +62 -68
- package/lib/ProTable/components/RenderTabs/index.js +67 -80
- package/lib/ProTable/components/TableResizable/index.js +87 -87
- package/lib/ProTable/components/TooltipTitle/index.js +27 -40
- package/lib/ProTable/components/index.js +45 -51
- package/lib/ProTable/hooks/useAntdTable.js +351 -304
- package/lib/ProTable/index.js +354 -333
- package/lib/ProTable/propsType.d.ts +9 -3
- package/lib/ProTable/propsType.js +4 -16
- package/lib/ProTable/utils/index.js +89 -78
- package/lib/ProTabs/components/Card/index.js +57 -30
- package/lib/ProTabs/components/index.js +10 -36
- package/lib/ProTabs/index.js +94 -89
- package/lib/ProTabs/propType.d.ts +5 -0
- package/lib/ProTabs/propType.js +4 -16
- package/lib/ProTabs/style/index.less +40 -3
- package/lib/ProThemeTools/component/ProTools/index.js +246 -198
- package/lib/ProThemeTools/component/index.js +10 -36
- package/lib/ProThemeTools/context/ThemeContext.js +99 -89
- package/lib/ProThemeTools/index.js +207 -172
- package/lib/ProThemeTools/propsType.js +4 -16
- package/lib/ProThemeTools/utils/index.js +84 -80
- package/lib/ProTooltip/index.js +217 -214
- package/lib/ProTooltip/propsType.js +4 -16
- package/lib/ProTree/components/AdaptiveTooltip.js +22 -33
- package/lib/ProTree/components/CloseIcon.js +31 -36
- package/lib/ProTree/components/List.js +69 -68
- package/lib/ProTree/components/ProTree.js +346 -258
- package/lib/ProTree/components/ProTreeSelect/index.js +460 -336
- package/lib/ProTree/components/ProTreeSelect/propsType.js +4 -16
- package/lib/ProTree/components/SearchTitle.js +50 -47
- package/lib/ProTree/components/Tree.js +300 -227
- package/lib/ProTree/components/index.js +31 -45
- package/lib/ProTree/index.js +22 -45
- package/lib/ProTree/propsType.js +4 -16
- package/lib/ProTree/utils.js +140 -79
- package/lib/ProTreeModal/components/Cascader.js +90 -97
- package/lib/ProTreeModal/components/CloseIcon.js +31 -36
- package/lib/ProTreeModal/components/List.js +246 -192
- package/lib/ProTreeModal/components/SearchTitle.js +22 -30
- package/lib/ProTreeModal/components/SortableItem.js +59 -60
- package/lib/ProTreeModal/components/Tree.js +171 -157
- package/lib/ProTreeModal/components/Trigger.js +131 -108
- package/lib/ProTreeModal/components/index.js +45 -51
- package/lib/ProTreeModal/index.js +523 -448
- package/lib/ProTreeModal/propsType.js +4 -16
- package/lib/ProTreeModal/utils.js +160 -99
- package/lib/ProUpload/components/ButtonRender.js +106 -85
- package/lib/ProUpload/components/DragRender.js +167 -117
- package/lib/ProUpload/components/DraggableUploadListItem.js +32 -48
- package/lib/ProUpload/components/Example.js +39 -55
- package/lib/ProUpload/components/FileItem.js +215 -113
- package/lib/ProUpload/components/ImageRender.js +250 -175
- package/lib/ProUpload/index.js +185 -181
- package/lib/ProUpload/propsType.js +4 -16
- package/lib/ProUpload/uitls.js +9 -31
- package/lib/ProUtils/utils/index.js +20 -36
- package/lib/ProViewer/index.js +210 -175
- package/lib/ProViewer/propsType.js +1 -17
- package/lib/ProWaterMark/index.js +20 -38
- package/lib/ProWaterMark/propsType.js +4 -16
- package/lib/index.d.ts +1 -1
- package/lib/index.js +272 -123
- package/lib/locale/en_US.js +127 -145
- package/lib/locale/index.js +40 -55
- package/lib/locale/zh_CN.js +128 -146
- package/lib/style/index.less +1 -1
- package/lib/style/theme/base.less +1 -0
- package/lib/tokens.js +87 -103
- package/lib/utils/index.js +66 -88
- package/package.json +7 -7
- package/dist/esm/index.d.ts +0 -5
- package/dist/esm/index.js +0 -5
- package/dist/esm/regExp/index.d.ts +0 -19
- package/dist/esm/regExp/index.js +0 -73
- package/dist/esm/tools/calc/index.d.ts +0 -4
- package/dist/esm/tools/calc/index.js +0 -67
- package/dist/esm/tools/dateUtils.d.ts +0 -7
- package/dist/esm/tools/dateUtils.js +0 -23
- package/dist/esm/tools/disableDate/index.d.ts +0 -9
- package/dist/esm/tools/disableDate/index.js +0 -43
- package/dist/esm/tools/disableTimeRange/index.d.ts +0 -9
- package/dist/esm/tools/disableTimeRange/index.js +0 -121
- package/dist/esm/tools/formatAmount/index.d.ts +0 -7
- package/dist/esm/tools/formatAmount/index.js +0 -14
- package/dist/esm/tools/formatPerMill/index.d.ts +0 -7
- package/dist/esm/tools/formatPerMill/index.js +0 -11
- package/dist/esm/tools/formatPercent/index.d.ts +0 -7
- package/dist/esm/tools/formatPercent/index.js +0 -11
- package/dist/esm/tools/getDataByIdCard/index.d.ts +0 -16
- package/dist/esm/tools/getDataByIdCard/index.js +0 -65
- package/dist/esm/tools/index.d.ts +0 -12
- package/dist/esm/tools/index.js +0 -14
- package/dist/esm/tools/sumAmount/index.d.ts +0 -16
- package/dist/esm/tools/sumAmount/index.js +0 -40
- package/dist/esm/tools/toChineseNum/index.d.ts +0 -7
- package/dist/esm/tools/toChineseNum/index.js +0 -103
- package/dist/esm/tools/toFixed/index.d.ts +0 -2
- package/dist/esm/tools/toFixed/index.js +0 -5
- package/dist/esm/tools/transformDataName/index.d.ts +0 -12
- package/dist/esm/tools/transformDataName/index.js +0 -37
- package/dist/esm/transforms/dateTransformer/index.d.ts +0 -24
- package/dist/esm/transforms/dateTransformer/index.js +0 -67
- package/dist/esm/transforms/index.d.ts +0 -6
- package/dist/esm/transforms/index.js +0 -6
- package/dist/esm/transforms/propTypes.d.ts +0 -7
- package/dist/esm/transforms/propTypes.js +0 -1
- package/dist/esm/transforms/transformDate/index.d.ts +0 -21
- package/dist/esm/transforms/transformDate/index.js +0 -141
- package/dist/esm/transforms/transformDatePicker/index.d.ts +0 -12
- package/dist/esm/transforms/transformDatePicker/index.js +0 -24
- package/dist/esm/transforms/transformRangePicker/index.d.ts +0 -29
- package/dist/esm/transforms/transformRangePicker/index.js +0 -61
- package/dist/esm/transforms/transformSwitch/index.d.ts +0 -13
- package/dist/esm/transforms/transformSwitch/index.js +0 -35
- package/dist/esm/transforms/utils.d.ts +0 -2
- package/dist/esm/transforms/utils.js +0 -8
- package/dist/esm/validate/index.d.ts +0 -107
- package/dist/esm/validate/index.js +0 -284
- package/tests/__mocks__/fileMock.js +0 -1
- package/tests/__mocks__/zatUtils.js +0 -27
- package/tests/setup.ts +0 -484
- package/tests/test-utils.tsx +0 -81
@@ -1,210 +1,212 @@
|
|
1
|
-
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
-
var __export = (target, all) => {
|
8
|
-
for (var name in all)
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
10
|
-
};
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
13
|
-
for (let key of __getOwnPropNames(from))
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
16
|
-
}
|
17
|
-
return to;
|
18
|
-
};
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
25
|
-
mod
|
26
|
-
));
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
1
|
+
"use strict";
|
28
2
|
|
29
|
-
|
30
|
-
var
|
31
|
-
|
32
|
-
|
33
|
-
default: () => ProTreeModal_default
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
34
7
|
});
|
35
|
-
|
36
|
-
|
37
|
-
var
|
38
|
-
|
39
|
-
var
|
40
|
-
|
41
|
-
var
|
42
|
-
|
43
|
-
var
|
44
|
-
var
|
45
|
-
var
|
46
|
-
var
|
47
|
-
var
|
48
|
-
var
|
49
|
-
var
|
50
|
-
var
|
51
|
-
var
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
8
|
+
exports.default = exports.CASCADER = void 0;
|
9
|
+
require("antd/es/button/style");
|
10
|
+
var _button = _interopRequireDefault(require("antd/es/button"));
|
11
|
+
require("antd/es/input/style");
|
12
|
+
var _input = _interopRequireDefault(require("antd/es/input"));
|
13
|
+
require("antd/es/checkbox/style");
|
14
|
+
var _checkbox = _interopRequireDefault(require("antd/es/checkbox"));
|
15
|
+
require("antd/es/message/style");
|
16
|
+
var _message2 = _interopRequireDefault(require("antd/es/message"));
|
17
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
18
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
20
|
+
var _ahooks = require("ahooks");
|
21
|
+
var _lodash = require("lodash");
|
22
|
+
var _reactSvg = require("react-svg");
|
23
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
24
|
+
var _index = require("../index");
|
25
|
+
var _components = require("./components");
|
26
|
+
var _utils = require("./utils");
|
27
|
+
var _index2 = require("../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index");
|
28
|
+
var _inputSearch = _interopRequireDefault(require("../assets/input-search.svg"));
|
29
|
+
var _locale = _interopRequireWildcard(require("../locale"));
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
31
|
+
var LIST = 'LIST';
|
32
|
+
var TREE = 'TREE';
|
33
|
+
var CASCADER = exports.CASCADER = 'CASCADER';
|
34
|
+
var ProTreeModal = props => {
|
35
|
+
var _locale$ProTreeModal, _props$otherProps, _props$otherProps2, _locale$ProTreeModal9, _locale$ProTreeModal10, _locale$ProTreeModal11, _locale$ProTreeModal12;
|
36
|
+
var _useProConfig = (0, _index.useProConfig)('ProEnum'),
|
37
|
+
_useProConfig$dics = _useProConfig.dics,
|
38
|
+
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
39
|
+
var listRef = (0, _react.useRef)(null);
|
40
|
+
var open = props.open,
|
41
|
+
value = props.value,
|
42
|
+
onChange = props.onChange,
|
43
|
+
dataSource = props.dataSource,
|
44
|
+
trigger = props.trigger,
|
45
|
+
_props$mode = props.mode,
|
46
|
+
mode = _props$mode === void 0 ? 'tree' : _props$mode,
|
47
|
+
enumCode = props.code,
|
48
|
+
_props$title = props.title,
|
49
|
+
title = _props$title === void 0 ? _locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal = _locale.default.ProTreeModal) === null || _locale$ProTreeModal === void 0 ? void 0 : _locale$ProTreeModal.select : _props$title,
|
50
|
+
useRequest = props.useRequest,
|
51
|
+
_props$showCodeName = props.showCodeName,
|
52
|
+
showCodeName = _props$showCodeName === void 0 ? false : _props$showCodeName,
|
53
|
+
_props$checkStrictly = props.checkStrictly,
|
54
|
+
checkStrictly = _props$checkStrictly === void 0 ? false : _props$checkStrictly,
|
55
|
+
tags = props.tags,
|
56
|
+
placeholder = props.placeholder,
|
57
|
+
_props$labelInValue = props.labelInValue,
|
58
|
+
labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
|
59
|
+
_props$style = props.style,
|
60
|
+
style = _props$style === void 0 ? {} : _props$style,
|
61
|
+
min = props.min,
|
62
|
+
max = props.max,
|
63
|
+
draggable = props.draggable,
|
64
|
+
span = props.span,
|
65
|
+
appoint = props.appoint,
|
66
|
+
appointProps = props.appointProps,
|
67
|
+
_props$fieldNames = props.fieldNames,
|
68
|
+
fieldNames = _props$fieldNames === void 0 ? {
|
69
|
+
label: 'label',
|
70
|
+
value: 'value',
|
71
|
+
children: 'children'
|
72
|
+
} : _props$fieldNames,
|
73
|
+
_props$disabled = props.disabled,
|
74
|
+
disabled = _props$disabled === void 0 ? props.disabled || props.isView || (props === null || props === void 0 || (_props$otherProps = props.otherProps) === null || _props$otherProps === void 0 ? void 0 : _props$otherProps.isView) || false : _props$disabled,
|
75
|
+
_props$isView = props.isView,
|
76
|
+
isView = _props$isView === void 0 ? props.isView || (props === null || props === void 0 || (_props$otherProps2 = props.otherProps) === null || _props$otherProps2 === void 0 ? void 0 : _props$otherProps2.isView) || false : _props$isView,
|
77
|
+
transformResponse = props.transformResponse,
|
78
|
+
optionRender = props.optionRender,
|
79
|
+
openChange = props.openChange,
|
80
|
+
maxMessage = props.maxMessage;
|
81
|
+
var allValue = props.allValue;
|
82
|
+
var modeType = mode.toUpperCase();
|
83
|
+
var fieldNameLabel = fieldNames.label;
|
84
|
+
var fieldNameValue = fieldNames.value;
|
93
85
|
if (appoint && !allValue) {
|
94
|
-
console.error(
|
95
|
-
allValue =
|
86
|
+
console.error('allValue must be input');
|
87
|
+
allValue = 'all';
|
96
88
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
89
|
+
var _useSetState = (0, _ahooks.useSetState)({
|
90
|
+
open: false,
|
91
|
+
checkedValues: [],
|
92
|
+
beforeClearAllValues: [],
|
93
|
+
// 点击清空全部并点击关闭、此时数据回显示不正确
|
94
|
+
treeData: [],
|
95
|
+
treeViewData: [],
|
96
|
+
originalTreeData: [],
|
97
|
+
flatTreeData: [],
|
98
|
+
searchStr: '',
|
99
|
+
checkAll: false,
|
100
|
+
allKeys: [],
|
101
|
+
transformedTree: []
|
102
|
+
}),
|
103
|
+
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
104
|
+
state = _useSetState2[0],
|
105
|
+
setState = _useSetState2[1];
|
106
|
+
var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)({
|
112
107
|
manual: true,
|
113
|
-
onSuccess:
|
114
|
-
|
115
|
-
|
116
|
-
|
108
|
+
onSuccess: res => {
|
109
|
+
var _res$status = res.status,
|
110
|
+
status = _res$status === void 0 ? 200 : _res$status,
|
111
|
+
msg = res.message;
|
112
|
+
var responseData = res === null || res === void 0 ? void 0 : res.data;
|
113
|
+
if (transformResponse && typeof transformResponse === 'function') {
|
117
114
|
responseData = transformResponse(res);
|
118
115
|
}
|
119
116
|
if (status !== 200) {
|
120
|
-
|
117
|
+
_message2.default.error(msg);
|
121
118
|
return;
|
122
119
|
}
|
123
120
|
setState({
|
124
121
|
treeData: responseData,
|
125
122
|
originalTreeData: responseData,
|
126
|
-
flatTreeData: (0,
|
127
|
-
allKeys: (0,
|
123
|
+
flatTreeData: (0, _utils.getFlatTreeData)(responseData, fieldNames, modeType),
|
124
|
+
allKeys: (0, _utils.getAllKeys)(responseData, fieldNames)
|
128
125
|
});
|
129
126
|
},
|
130
|
-
debounceWait: 300
|
131
|
-
|
132
|
-
|
133
|
-
(0, import_ahooks.useDeepCompareEffect)(() => {
|
134
|
-
var _a2, _b2;
|
127
|
+
debounceWait: 300
|
128
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
129
|
+
(0, _ahooks.useDeepCompareEffect)(() => {
|
135
130
|
if (dataSource && dataSource.length) {
|
136
131
|
setState({
|
137
132
|
treeData: dataSource,
|
138
|
-
originalTreeData: (0,
|
139
|
-
flatTreeData: (0,
|
140
|
-
allKeys: (0,
|
133
|
+
originalTreeData: (0, _lodash.cloneDeep)(dataSource),
|
134
|
+
flatTreeData: (0, _utils.getFlatTreeData)(dataSource, fieldNames),
|
135
|
+
allKeys: (0, _utils.getAllKeys)(dataSource, fieldNames)
|
141
136
|
});
|
142
137
|
} else if (enumCode) {
|
143
|
-
|
144
|
-
|
138
|
+
var dictEnum = dics[enumCode] || [];
|
139
|
+
// transform dictEnum
|
140
|
+
if (transformResponse && (0, _lodash.isFunction)(transformResponse)) {
|
145
141
|
dictEnum = transformResponse(dictEnum);
|
146
142
|
}
|
143
|
+
// check dictEnum isArray
|
147
144
|
if (!dictEnum || !Array.isArray(dictEnum)) {
|
148
|
-
|
145
|
+
var _locale$ProTreeModal2;
|
146
|
+
console.error(_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal2 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal2 === void 0 ? void 0 : _locale$ProTreeModal2.errorArrayMessage);
|
149
147
|
dictEnum = [];
|
150
148
|
}
|
151
149
|
setState({
|
152
150
|
treeData: dictEnum,
|
153
|
-
originalTreeData: (0,
|
154
|
-
flatTreeData: (0,
|
155
|
-
allKeys: (0,
|
151
|
+
originalTreeData: (0, _lodash.cloneDeep)(dictEnum),
|
152
|
+
flatTreeData: (0, _utils.getFlatTreeData)(dictEnum, fieldNames),
|
153
|
+
allKeys: (0, _utils.getAllKeys)(dictEnum, fieldNames)
|
156
154
|
});
|
157
155
|
}
|
158
156
|
}, [dataSource, enumCode]);
|
159
|
-
(0,
|
157
|
+
(0, _ahooks.useDeepCompareEffect)(() => {
|
160
158
|
if (enumCode) {
|
161
|
-
return
|
159
|
+
return undefined;
|
162
160
|
}
|
163
161
|
if (dataSource) {
|
164
|
-
return
|
162
|
+
return undefined;
|
165
163
|
}
|
166
|
-
|
167
|
-
|
164
|
+
var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
165
|
+
defaultParams = _ref.defaultParams,
|
166
|
+
manual = _ref.manual;
|
167
|
+
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
168
168
|
if (manual) {
|
169
169
|
return;
|
170
170
|
}
|
171
|
+
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
171
172
|
fetchFunction.run(params);
|
172
|
-
}, [useRequest
|
173
|
-
(0,
|
173
|
+
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
174
|
+
(0, _react.useEffect)(() => {
|
174
175
|
setState({
|
175
176
|
open
|
176
177
|
});
|
177
178
|
}, [open]);
|
178
|
-
(0,
|
179
|
+
(0, _react.useEffect)(() => {
|
179
180
|
if (value) {
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
var checkedValues = [];
|
182
|
+
var treeData = state.treeData,
|
183
|
+
allKeys = state.allKeys,
|
184
|
+
originalTreeData = state.originalTreeData;
|
185
|
+
var treeViewData = [];
|
186
|
+
if (allValue && typeof value === 'string' && allValue === value) {
|
184
187
|
if (modeType === LIST) {
|
185
|
-
checkedValues = treeData.map(
|
188
|
+
checkedValues = treeData.map(item => item[fieldNameValue]) || [];
|
186
189
|
} else if (modeType === TREE) {
|
187
190
|
checkedValues = allKeys;
|
188
191
|
}
|
189
192
|
} else {
|
190
193
|
if (!Array.isArray(value)) {
|
191
|
-
console.error(
|
194
|
+
console.error('Please pass in the array');
|
192
195
|
return;
|
193
196
|
}
|
197
|
+
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
194
198
|
if (labelInValue) {
|
195
|
-
|
196
|
-
(element) => typeof element === "object" && element !== null
|
197
|
-
);
|
199
|
+
var isObjectArray = value.every(element => typeof element === 'object' && element !== null);
|
198
200
|
if (!isObjectArray) {
|
199
|
-
console.error(
|
201
|
+
console.error('Please enter an array object');
|
200
202
|
checkedValues = [];
|
201
203
|
}
|
202
|
-
checkedValues = value.map(
|
204
|
+
checkedValues = value.map(item => item[fieldNameValue]);
|
203
205
|
} else {
|
204
206
|
checkedValues = value;
|
205
207
|
}
|
206
208
|
}
|
207
|
-
treeViewData = (0,
|
209
|
+
treeViewData = (0, _utils.filterCheckedNodes)(originalTreeData, checkedValues, '', fieldNames);
|
208
210
|
setState({
|
209
211
|
checkedValues,
|
210
212
|
checkAll: checkedValues.length === allKeys.length,
|
@@ -213,34 +215,41 @@ var ProTreeModal = (props) => {
|
|
213
215
|
});
|
214
216
|
}
|
215
217
|
}, [value, state.allKeys, state.open]);
|
216
|
-
(0,
|
217
|
-
|
218
|
+
(0, _ahooks.useDeepCompareEffect)(() => {
|
219
|
+
var transformedTree = (0, _utils.addLevelAndParentId)(state.treeData, fieldNames);
|
218
220
|
setState({
|
219
221
|
transformedTree
|
220
222
|
});
|
221
223
|
}, [state.treeData]);
|
222
|
-
|
224
|
+
var handleClick = () => {
|
223
225
|
setState({
|
224
226
|
open: true
|
225
227
|
});
|
226
|
-
openChange
|
228
|
+
openChange === null || openChange === void 0 || openChange(true);
|
227
229
|
};
|
228
|
-
|
229
|
-
|
230
|
-
|
230
|
+
|
231
|
+
/**
|
232
|
+
* close Drawer and onChange(values)
|
233
|
+
*/
|
234
|
+
var handleFinish = () => {
|
235
|
+
// 全选的时候返回 allValue 标记即可
|
236
|
+
// 3.3.2 版本全选的时候返回所有值的合集 list
|
237
|
+
if (allValue !== undefined && state.checkAll && !draggable) {
|
231
238
|
if (labelInValue) {
|
232
|
-
onChange
|
239
|
+
onChange === null || onChange === void 0 || onChange(state.flatTreeData);
|
233
240
|
} else {
|
234
|
-
onChange
|
241
|
+
onChange === null || onChange === void 0 || onChange(state.flatTreeData.map(item => item[fieldNameValue]));
|
235
242
|
}
|
236
243
|
} else if (draggable && span) {
|
237
|
-
|
244
|
+
var _listRef$current;
|
245
|
+
// 开启 draggable 使用拖拽后的顺序
|
246
|
+
var checkedList = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.onChange();
|
238
247
|
onChange(checkedList);
|
239
248
|
} else {
|
240
|
-
|
249
|
+
var values = [];
|
241
250
|
if (labelInValue) {
|
242
|
-
state.checkedValues.forEach(
|
243
|
-
|
251
|
+
state.checkedValues.forEach(val => {
|
252
|
+
var option = state.flatTreeData.find(item => item[fieldNameValue] === val);
|
244
253
|
option && values.push(option);
|
245
254
|
});
|
246
255
|
} else {
|
@@ -248,25 +257,34 @@ var ProTreeModal = (props) => {
|
|
248
257
|
}
|
249
258
|
if (min) {
|
250
259
|
if (values.length < min) {
|
251
|
-
|
260
|
+
var _locale$ProTreeModal3;
|
261
|
+
_message2.default.error((0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal3 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal3 === void 0 ? void 0 : _locale$ProTreeModal3.selectMin, {
|
262
|
+
min
|
263
|
+
}));
|
252
264
|
return;
|
253
265
|
}
|
254
266
|
}
|
255
|
-
onChange
|
267
|
+
onChange === null || onChange === void 0 || onChange(values);
|
256
268
|
}
|
257
|
-
|
269
|
+
// fix: 当有 openChange 时候、点击确定应该由关闭 openChange 控制
|
270
|
+
if (!openChange || open === undefined) {
|
258
271
|
setState({
|
259
272
|
open: false
|
260
273
|
});
|
261
|
-
openChange
|
274
|
+
openChange === null || openChange === void 0 || openChange(false);
|
262
275
|
}
|
263
|
-
if (openChange && open !==
|
264
|
-
openChange
|
276
|
+
if (openChange && open !== undefined) {
|
277
|
+
openChange === null || openChange === void 0 || openChange(true);
|
265
278
|
}
|
266
279
|
};
|
267
|
-
|
268
|
-
|
269
|
-
|
280
|
+
|
281
|
+
/**
|
282
|
+
* clear all checked
|
283
|
+
*/
|
284
|
+
var handleClearAll = () => {
|
285
|
+
var _state$flatTreeData$f;
|
286
|
+
// 处理 ProTable 场景下 disabled 的不需要被清理
|
287
|
+
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]) : [];
|
270
288
|
setState({
|
271
289
|
checkedValues: _checkedValues,
|
272
290
|
beforeClearAllValues: state.checkedValues,
|
@@ -275,23 +293,32 @@ var ProTreeModal = (props) => {
|
|
275
293
|
checkAll: false
|
276
294
|
});
|
277
295
|
};
|
278
|
-
|
296
|
+
|
297
|
+
/**
|
298
|
+
* Drawer close
|
299
|
+
*/
|
300
|
+
var handleClose = () => {
|
279
301
|
setState({
|
280
302
|
open: false,
|
281
303
|
checkedValues: state.beforeClearAllValues,
|
282
304
|
beforeClearAllValues: []
|
283
305
|
});
|
284
|
-
openChange
|
306
|
+
openChange === null || openChange === void 0 || openChange(false);
|
285
307
|
};
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
308
|
+
|
309
|
+
/**
|
310
|
+
* checkbox/list selected change values
|
311
|
+
* @param values
|
312
|
+
*/
|
313
|
+
var handleListCheckChange = (e, code) => {
|
314
|
+
var checkedValues = [...state.checkedValues];
|
315
|
+
var checked = e.target.checked;
|
290
316
|
if (!checked) {
|
291
|
-
checkedValues = checkedValues.filter(
|
317
|
+
checkedValues = checkedValues.filter(value => value !== code);
|
292
318
|
} else if (draggable && span) {
|
293
|
-
|
294
|
-
|
319
|
+
// 固定在右侧的情况
|
320
|
+
var fixedOption = state.flatTreeData.find(item => item.fixed === 'right') || {};
|
321
|
+
var fixedIdx = checkedValues.findIndex(value => value === fixedOption[fieldNameValue]);
|
295
322
|
if (fixedIdx >= 0) {
|
296
323
|
checkedValues.splice(fixedIdx, 0, code);
|
297
324
|
} else {
|
@@ -301,9 +328,12 @@ var ProTreeModal = (props) => {
|
|
301
328
|
checkedValues.push(code);
|
302
329
|
}
|
303
330
|
if (max && checkedValues.length > max) {
|
304
|
-
|
305
|
-
|
306
|
-
|
331
|
+
var _locale$ProTreeModal4;
|
332
|
+
_message2.default.error(maxMessage ? (0, _utils.transformMessage)({
|
333
|
+
max
|
334
|
+
}, maxMessage) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal4 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal4 === void 0 ? void 0 : _locale$ProTreeModal4.selectMax, {
|
335
|
+
max
|
336
|
+
}));
|
307
337
|
return;
|
308
338
|
}
|
309
339
|
setState({
|
@@ -311,46 +341,45 @@ var ProTreeModal = (props) => {
|
|
311
341
|
checkAll: checkedValues.length === state.flatTreeData.length
|
312
342
|
});
|
313
343
|
};
|
314
|
-
|
344
|
+
var handleDragEndChange = checkedValues => {
|
315
345
|
setState({
|
316
346
|
checkedValues
|
317
347
|
});
|
318
348
|
};
|
319
|
-
|
320
|
-
var
|
321
|
-
|
322
|
-
|
349
|
+
var onCheck = (checkedKeys, info) => {
|
350
|
+
var checkedValues = [...state.checkedValues];
|
351
|
+
var originalTreeData = state.originalTreeData;
|
352
|
+
|
353
|
+
// 如果有检索则自管理
|
323
354
|
if (state.searchStr) {
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
);
|
332
|
-
const allChildren = (_a2 = (0, import_utils2.transformTreeToArray)([activeNode], {
|
355
|
+
var _transformTreeToArray;
|
356
|
+
var node = info.node;
|
357
|
+
// 从完整树中找到当前节点
|
358
|
+
var activeNode = (0, _index2.treeNodeFind)(state.transformedTree, t => t[fieldNameValue] === node[fieldNameValue], {
|
359
|
+
childrenKey: fieldNames.children
|
360
|
+
});
|
361
|
+
var allChildren = (_transformTreeToArray = (0, _index2.transformTreeToArray)([activeNode], {
|
333
362
|
childrenKey: fieldNames.children
|
334
|
-
}))
|
363
|
+
})) === null || _transformTreeToArray === void 0 ? void 0 : _transformTreeToArray.map(item => item[fieldNameValue]);
|
364
|
+
// 子项合并勾选
|
335
365
|
checkedValues = checkedValues.concat(allChildren);
|
336
|
-
|
337
|
-
|
366
|
+
// 从完整树中拿到父节点 只要存在父节点,那么就判断当前children是否全被勾选 若全被勾选就合并当前key到勾选队列
|
367
|
+
var _recourse = findNode => {
|
338
368
|
if (findNode.parentId) {
|
339
|
-
|
340
|
-
|
341
|
-
(t) => t[fieldNameValue] === findNode.parentId,
|
342
|
-
{
|
343
|
-
childrenKey: fieldNames.children
|
344
|
-
}
|
345
|
-
);
|
346
|
-
const parentChildrenKeys = (_a3 = (0, import_utils2.transformTreeToArray)([parentNode], {
|
369
|
+
var _transformTreeToArray2;
|
370
|
+
var parentNode = (0, _index2.treeNodeFind)(state.transformedTree, t => t[fieldNameValue] === findNode.parentId, {
|
347
371
|
childrenKey: fieldNames.children
|
348
|
-
})
|
349
|
-
|
372
|
+
});
|
373
|
+
var parentChildrenKeys = (_transformTreeToArray2 = (0, _index2.transformTreeToArray)([parentNode], {
|
374
|
+
childrenKey: fieldNames.children
|
375
|
+
})) === null || _transformTreeToArray2 === void 0 ? void 0 : _transformTreeToArray2.map(item => item[fieldNameValue]);
|
376
|
+
var parentChildrenAllChecked = parentChildrenKeys.every(key => {
|
350
377
|
return checkedValues.includes(key);
|
351
378
|
});
|
352
379
|
if (parentChildrenAllChecked) {
|
380
|
+
// 把当前父节点追加进来
|
353
381
|
checkedValues = checkedValues.concat([parentNode[fieldNameValue]]);
|
382
|
+
// 继续向上查找
|
354
383
|
if (parentNode.parentId) {
|
355
384
|
_recourse(parentNode);
|
356
385
|
}
|
@@ -359,43 +388,52 @@ var ProTreeModal = (props) => {
|
|
359
388
|
};
|
360
389
|
_recourse(activeNode);
|
361
390
|
}
|
362
|
-
|
391
|
+
var _checkStrictly = state.searchStr ? true : checkStrictly;
|
392
|
+
|
393
|
+
// 此时应该取消掉自身并包含它所有的子集
|
363
394
|
if (!info.checked && !_checkStrictly) {
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
);
|
372
|
-
|
395
|
+
// 1. 取消自身
|
396
|
+
// 2. 把所有的子节点也要取消
|
397
|
+
var childrenkeys = [];
|
398
|
+
(0, _utils.getChildrenKeys)(info.node, childrenkeys, fieldNames, 'treeCheck');
|
399
|
+
checkedValues = checkedValues.filter(key => !childrenkeys.includes(key));
|
400
|
+
|
401
|
+
// 3. 取消父节点
|
402
|
+
var parentNodes = (0, _utils.findTreeNodeByKey)(originalTreeData, info.node.key, fieldNames);
|
403
|
+
var parentKeys = parentNodes.reduce((prev, curr) => prev.concat(curr[fieldNameValue]), []);
|
404
|
+
checkedValues = checkedValues.filter(key => !parentKeys.includes(key));
|
373
405
|
} else {
|
406
|
+
// _checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
|
374
407
|
if (_checkStrictly) {
|
375
408
|
if (!info.checked) {
|
376
|
-
checkedValues = checkedValues.filter(
|
409
|
+
checkedValues = checkedValues.filter(key => key !== info.node.key);
|
377
410
|
}
|
378
411
|
checkedKeys = checkedKeys.checked || [];
|
379
412
|
}
|
380
|
-
checkedKeys.forEach(
|
381
|
-
|
413
|
+
checkedKeys.forEach(key => {
|
414
|
+
var exist = checkedValues.includes(key);
|
382
415
|
if (info.checked && !exist) {
|
383
416
|
checkedValues.push(key);
|
384
417
|
}
|
385
418
|
});
|
386
419
|
}
|
387
|
-
|
420
|
+
|
421
|
+
// 根据选中的筛选出 viewTreeData
|
422
|
+
var treeViewData = [];
|
388
423
|
if (!checkStrictly) {
|
389
|
-
treeViewData = (0,
|
424
|
+
treeViewData = (0, _utils.filterCheckedNodes)(originalTreeData, checkedValues, '', fieldNames);
|
390
425
|
} else {
|
391
|
-
treeViewData = state.flatTreeData.filter(
|
426
|
+
treeViewData = state.flatTreeData.filter(item => {
|
392
427
|
return checkedValues.includes(item[fieldNameValue]);
|
393
428
|
});
|
394
429
|
}
|
395
430
|
if (max && checkedValues.length > max) {
|
396
|
-
|
397
|
-
|
398
|
-
|
431
|
+
var _locale$ProTreeModal5;
|
432
|
+
_message2.default.error(maxMessage ? (0, _utils.transformMessage)({
|
433
|
+
max
|
434
|
+
}, maxMessage) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal5 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal5 === void 0 ? void 0 : _locale$ProTreeModal5.selectMax, {
|
435
|
+
max
|
436
|
+
}));
|
399
437
|
return;
|
400
438
|
}
|
401
439
|
setState({
|
@@ -404,33 +442,48 @@ var ProTreeModal = (props) => {
|
|
404
442
|
checkAll: state.allKeys.length === checkedValues.length
|
405
443
|
});
|
406
444
|
};
|
407
|
-
|
445
|
+
|
446
|
+
/**
|
447
|
+
* filter checkbox by fileNameValue
|
448
|
+
* @param fileNameValue
|
449
|
+
*/
|
450
|
+
var handleFilterClose = fileNameValue => {
|
408
451
|
setState({
|
409
|
-
checkedValues: state.checkedValues.filter(
|
452
|
+
checkedValues: state.checkedValues.filter(value => value !== fileNameValue),
|
410
453
|
checkAll: false
|
411
454
|
});
|
412
455
|
};
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
456
|
+
|
457
|
+
/**
|
458
|
+
* tree close
|
459
|
+
* @param fileNamekey
|
460
|
+
* @param node
|
461
|
+
*/
|
462
|
+
var treeFilterClose = (fileNamekey, node) => {
|
463
|
+
var checkedValues = [...state.checkedValues];
|
464
|
+
var treeViewData = [];
|
465
|
+
var originalTreeData = state.originalTreeData;
|
417
466
|
if (checkStrictly) {
|
418
|
-
checkedValues = checkedValues.filter(
|
419
|
-
|
467
|
+
checkedValues = checkedValues.filter(key => key !== fileNamekey);
|
468
|
+
// handleFilterClose
|
469
|
+
treeViewData = state.flatTreeData.filter(item => {
|
420
470
|
return checkedValues.includes(item[fieldNameValue]);
|
421
471
|
});
|
422
472
|
} else {
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
);
|
432
|
-
|
433
|
-
|
473
|
+
// 1. 取消自身
|
474
|
+
checkedValues = checkedValues.filter(key => key !== fileNamekey);
|
475
|
+
// 2. 把所有的子节点也要取消
|
476
|
+
var childrenkeys = [];
|
477
|
+
(0, _utils.getChildrenKeys)(node, childrenkeys, fieldNames, 'treeClose');
|
478
|
+
checkedValues = checkedValues.filter(key => !childrenkeys.includes(key));
|
479
|
+
|
480
|
+
// 3. 取消父节点
|
481
|
+
var parentNodes = (0, _utils.findTreeNodeByKey)(originalTreeData, fileNamekey, fieldNames);
|
482
|
+
var parentKeys = parentNodes.reduce((prev, curr) => prev.concat(curr[fieldNames.value]), []);
|
483
|
+
checkedValues = checkedValues.filter(key => !parentKeys.includes(key));
|
484
|
+
|
485
|
+
// 根据选中的筛选出 viewTreeData
|
486
|
+
treeViewData = (0, _utils.filterCheckedNodes)(originalTreeData, checkedValues, '', fieldNames);
|
434
487
|
}
|
435
488
|
setState({
|
436
489
|
checkedValues,
|
@@ -438,80 +491,93 @@ var ProTreeModal = (props) => {
|
|
438
491
|
checkAll: false
|
439
492
|
});
|
440
493
|
};
|
441
|
-
|
442
|
-
(str) => {
|
494
|
+
var _useDebounceFn = (0, _ahooks.useDebounceFn)(str => {
|
443
495
|
if (modeType === LIST || modeType === CASCADER) {
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
return
|
496
|
+
var isCASCADER = modeType === CASCADER;
|
497
|
+
var data = state.flatTreeData.filter(item => {
|
498
|
+
var title = isCASCADER ? item === null || item === void 0 ? void 0 : item.title : item[fieldNameLabel];
|
499
|
+
return title.includes(str);
|
448
500
|
});
|
449
501
|
setState({
|
450
502
|
treeData: !str ? state.originalTreeData : data
|
451
503
|
});
|
452
504
|
}
|
453
|
-
},
|
454
|
-
{
|
505
|
+
}, {
|
455
506
|
wait: 0
|
456
|
-
}
|
457
|
-
|
458
|
-
|
507
|
+
}),
|
508
|
+
onSearch = _useDebounceFn.run;
|
509
|
+
var handleSetSearchStr = str => {
|
459
510
|
setState({
|
460
511
|
searchStr: str
|
461
512
|
});
|
462
513
|
onSearch(str);
|
463
514
|
};
|
464
|
-
|
465
|
-
|
466
|
-
|
515
|
+
|
516
|
+
/**
|
517
|
+
* 指定模式下的操作
|
518
|
+
* @param appoint
|
519
|
+
*/
|
520
|
+
var appointChange = appoint => {
|
521
|
+
if (appoint) {
|
522
|
+
onChange === null || onChange === void 0 || onChange(allValue);
|
467
523
|
setState({
|
468
524
|
checkAll: true
|
469
525
|
});
|
470
526
|
} else {
|
471
|
-
onChange
|
527
|
+
onChange === null || onChange === void 0 || onChange([]);
|
472
528
|
setState({
|
473
529
|
checkAll: false,
|
474
530
|
open: true
|
475
531
|
});
|
476
|
-
if (
|
477
|
-
openChange
|
532
|
+
if (appoint) {
|
533
|
+
openChange === null || openChange === void 0 || openChange(true);
|
478
534
|
}
|
479
535
|
}
|
480
536
|
};
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
537
|
+
|
538
|
+
/**
|
539
|
+
* Trigger the container opened by Drawer
|
540
|
+
* default example and you can customize trigger={<Button>打开</Button>}
|
541
|
+
* @returns
|
542
|
+
*/
|
543
|
+
var TriggerComponent = (0, _react.useMemo)(() => {
|
544
|
+
var _props$otherProps3;
|
545
|
+
if (trigger && /*#__PURE__*/_react.default.isValidElement(trigger)) {
|
546
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
547
|
+
onClick: handleClick,
|
548
|
+
children: trigger
|
549
|
+
});
|
485
550
|
}
|
486
|
-
return
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
appointProps
|
502
|
-
}
|
503
|
-
);
|
551
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Trigger, {
|
552
|
+
checkedValues: state.checkedValues,
|
553
|
+
value: value,
|
554
|
+
checkAll: state.checkAll,
|
555
|
+
triggerStyle: style,
|
556
|
+
disabled: disabled,
|
557
|
+
isView: isView,
|
558
|
+
appoint: appoint,
|
559
|
+
allValue: allValue,
|
560
|
+
label: props === null || props === void 0 || (_props$otherProps3 = props.otherProps) === null || _props$otherProps3 === void 0 ? void 0 : _props$otherProps3.label,
|
561
|
+
handleClick: handleClick,
|
562
|
+
handleClearAll: handleClearAll,
|
563
|
+
appointChange: appointChange,
|
564
|
+
appointProps: appointProps
|
565
|
+
});
|
504
566
|
}, [state.checkedValues, state.checkAll, style, disabled, isView, value]);
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
567
|
+
|
568
|
+
/**
|
569
|
+
* 全选操作
|
570
|
+
*/
|
571
|
+
var handleAllCheck = e => {
|
572
|
+
var checked = e.target.checked;
|
573
|
+
var checkedValues = [];
|
574
|
+
var treeViewData = [];
|
510
575
|
if (modeType === LIST || modeType === CASCADER) {
|
511
576
|
if (checked) {
|
512
|
-
checkedValues = state.flatTreeData.map(
|
577
|
+
checkedValues = state.flatTreeData.map(item => item[fieldNameValue]);
|
513
578
|
} else if (!checked && span) {
|
514
|
-
|
579
|
+
// ProTable 场景下 disabled 不取消掉
|
580
|
+
checkedValues = state.flatTreeData.filter(item => item.disabled).map(item => item[fieldNameValue]);
|
515
581
|
} else if (!checked) {
|
516
582
|
checkedValues = [];
|
517
583
|
}
|
@@ -520,13 +586,16 @@ var ProTreeModal = (props) => {
|
|
520
586
|
if (checkStrictly) {
|
521
587
|
treeViewData = [...state.flatTreeData];
|
522
588
|
} else {
|
523
|
-
treeViewData = (0,
|
589
|
+
treeViewData = (0, _utils.filterCheckedNodes)(state.originalTreeData, checkedValues, '', fieldNames);
|
524
590
|
}
|
525
591
|
}
|
526
592
|
if (max && checkedValues.length > max) {
|
527
|
-
|
528
|
-
|
529
|
-
|
593
|
+
var _locale$ProTreeModal6;
|
594
|
+
_message2.default.error(maxMessage ? (0, _utils.transformMessage)({
|
595
|
+
max
|
596
|
+
}, maxMessage) : (0, _locale.formatMessage)(_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal6 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal6 === void 0 ? void 0 : _locale$ProTreeModal6.selectMax, {
|
597
|
+
max
|
598
|
+
}));
|
530
599
|
return;
|
531
600
|
}
|
532
601
|
setState({
|
@@ -535,185 +604,191 @@ var ProTreeModal = (props) => {
|
|
535
604
|
treeViewData
|
536
605
|
});
|
537
606
|
};
|
538
|
-
|
539
|
-
|
607
|
+
|
608
|
+
/**
|
609
|
+
* 左侧容器、分为三种 list、tree、Cascader
|
610
|
+
* @returns
|
611
|
+
*/
|
612
|
+
var renderContainer = () => {
|
540
613
|
if (state.treeData.length === 0 && state.searchStr) {
|
541
|
-
|
614
|
+
var _locale$ProTreeModal7;
|
615
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
616
|
+
className: "pro-tree-modal-no-checks",
|
617
|
+
children: _locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal7 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal7 === void 0 ? void 0 : _locale$ProTreeModal7.noFinal
|
618
|
+
});
|
542
619
|
}
|
543
620
|
switch (modeType) {
|
544
621
|
case LIST:
|
545
|
-
return
|
546
|
-
|
547
|
-
|
622
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ListView, {
|
623
|
+
treeData: state.treeData,
|
624
|
+
optionRender: optionRender,
|
625
|
+
checkedValues: state.checkedValues,
|
626
|
+
handleOnChange: handleListCheckChange,
|
627
|
+
searchStr: state.searchStr,
|
628
|
+
showCodeName: showCodeName,
|
629
|
+
disabled: disabled || isView,
|
630
|
+
fieldNames: fieldNames,
|
631
|
+
span: span
|
632
|
+
});
|
633
|
+
case TREE:
|
634
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TreeView, {
|
635
|
+
treeData: state.transformedTree,
|
636
|
+
originalTreeData: state.originalTreeData,
|
637
|
+
flatTreeData: state.flatTreeData,
|
638
|
+
checkedValues: state.checkedValues,
|
639
|
+
onCheck: onCheck,
|
640
|
+
optionRender: optionRender,
|
641
|
+
searchStr: state.searchStr,
|
642
|
+
showCodeName: showCodeName,
|
643
|
+
disabled: disabled || isView,
|
644
|
+
checkStrictly: checkStrictly,
|
645
|
+
tags: tags,
|
646
|
+
fieldNames: fieldNames
|
647
|
+
});
|
648
|
+
case CASCADER:
|
649
|
+
if (state.searchStr && state.treeData.length) {
|
650
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ListView, {
|
548
651
|
treeData: state.treeData,
|
549
|
-
|
652
|
+
modeType: CASCADER,
|
653
|
+
optionRender: optionRender,
|
550
654
|
checkedValues: state.checkedValues,
|
551
655
|
handleOnChange: handleListCheckChange,
|
552
656
|
searchStr: state.searchStr,
|
553
|
-
showCodeName,
|
657
|
+
showCodeName: showCodeName,
|
554
658
|
disabled: disabled || isView,
|
555
|
-
fieldNames
|
556
|
-
|
557
|
-
}
|
558
|
-
);
|
559
|
-
case TREE:
|
560
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
561
|
-
import_components.TreeView,
|
562
|
-
{
|
563
|
-
treeData: state.transformedTree,
|
564
|
-
originalTreeData: state.originalTreeData,
|
565
|
-
flatTreeData: state.flatTreeData,
|
566
|
-
checkedValues: state.checkedValues,
|
567
|
-
onCheck,
|
568
|
-
optionRender,
|
569
|
-
searchStr: state.searchStr,
|
570
|
-
showCodeName,
|
571
|
-
disabled: disabled || isView,
|
572
|
-
checkStrictly,
|
573
|
-
tags,
|
574
|
-
fieldNames
|
575
|
-
}
|
576
|
-
);
|
577
|
-
case CASCADER:
|
578
|
-
if (state.searchStr && state.treeData.length) {
|
579
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
580
|
-
import_components.ListView,
|
581
|
-
{
|
582
|
-
treeData: state.treeData,
|
583
|
-
modeType: CASCADER,
|
584
|
-
optionRender,
|
585
|
-
checkedValues: state.checkedValues,
|
586
|
-
handleOnChange: handleListCheckChange,
|
587
|
-
searchStr: state.searchStr,
|
588
|
-
showCodeName,
|
589
|
-
disabled: disabled || isView,
|
590
|
-
fieldNames
|
591
|
-
}
|
592
|
-
);
|
659
|
+
fieldNames: fieldNames
|
660
|
+
});
|
593
661
|
}
|
594
|
-
return
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
optionRender
|
604
|
-
}
|
605
|
-
);
|
662
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Cascader, {
|
663
|
+
dataSource: state.treeData,
|
664
|
+
fieldNames: fieldNames,
|
665
|
+
checkedValues: state.checkedValues,
|
666
|
+
searchStr: state.searchStr,
|
667
|
+
showCodeName: showCodeName,
|
668
|
+
handleOnChange: handleListCheckChange,
|
669
|
+
optionRender: optionRender
|
670
|
+
});
|
606
671
|
default:
|
607
672
|
break;
|
608
673
|
}
|
609
674
|
};
|
610
|
-
|
611
|
-
|
612
|
-
state.checkedValues.forEach(
|
613
|
-
|
675
|
+
var listTreeData = (0, _react.useMemo)(() => {
|
676
|
+
var checkListOptions = [];
|
677
|
+
state.checkedValues.forEach(key => {
|
678
|
+
var option = state.flatTreeData.find(item => item[fieldNameValue] === key);
|
614
679
|
if (option) {
|
615
680
|
checkListOptions.push(option);
|
616
681
|
}
|
617
682
|
});
|
618
683
|
return checkListOptions;
|
619
684
|
}, [state.checkedValues, state.flatTreeData]);
|
620
|
-
|
621
|
-
|
685
|
+
|
686
|
+
/**
|
687
|
+
* 勾选后的右侧展示
|
688
|
+
* @returns
|
689
|
+
*/
|
690
|
+
var renderView = () => {
|
622
691
|
if (state.checkedValues.length === 0) {
|
623
|
-
|
692
|
+
var _locale$ProTreeModal8;
|
693
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
694
|
+
className: "pro-tree-modal-no-checks",
|
695
|
+
children: _locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal8 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal8 === void 0 ? void 0 : _locale$ProTreeModal8.noCheck
|
696
|
+
});
|
624
697
|
}
|
625
698
|
switch (modeType) {
|
626
699
|
case LIST:
|
627
700
|
case CASCADER:
|
628
|
-
return
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
handleDragEndChange
|
643
|
-
}
|
644
|
-
);
|
701
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ListView, {
|
702
|
+
mode: "view",
|
703
|
+
showCodeName: showCodeName,
|
704
|
+
treeData: listTreeData,
|
705
|
+
fieldNames: fieldNames,
|
706
|
+
disabled: disabled || isView,
|
707
|
+
draggable: draggable,
|
708
|
+
flatTreeData: state.flatTreeData,
|
709
|
+
span: span,
|
710
|
+
ref: listRef,
|
711
|
+
optionRender: optionRender,
|
712
|
+
handleFilterClose: handleFilterClose,
|
713
|
+
handleDragEndChange: handleDragEndChange
|
714
|
+
});
|
645
715
|
case TREE:
|
646
|
-
return
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
handleDragEndChange
|
663
|
-
}
|
664
|
-
);
|
716
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TreeView, {
|
717
|
+
mode: "view",
|
718
|
+
checkStrictly: checkStrictly,
|
719
|
+
showCodeName: showCodeName,
|
720
|
+
treeData: checkStrictly ? listTreeData : state.treeViewData,
|
721
|
+
tags: tags,
|
722
|
+
fieldNames: fieldNames,
|
723
|
+
disabled: disabled || isView,
|
724
|
+
draggable: draggable,
|
725
|
+
min: min,
|
726
|
+
max: max,
|
727
|
+
ref: listRef,
|
728
|
+
handleFilterClose: treeFilterClose,
|
729
|
+
optionRender: optionRender,
|
730
|
+
handleDragEndChange: handleDragEndChange
|
731
|
+
});
|
665
732
|
default:
|
666
733
|
break;
|
667
734
|
}
|
668
735
|
};
|
669
|
-
return
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
736
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
737
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
738
|
+
className: "pro-tree-modal",
|
739
|
+
children: [open === undefined && TriggerComponent, /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ProDrawerForm, {
|
740
|
+
onOk: handleFinish,
|
741
|
+
onCancel: handleClose,
|
742
|
+
okDisabled: disabled,
|
743
|
+
open: state.open,
|
744
|
+
title: title,
|
745
|
+
showType: "Modal",
|
746
|
+
className: "pro-tree-modal-container",
|
747
|
+
extraLeft: allValue !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.default, {
|
748
|
+
checked: state.checkAll,
|
749
|
+
disabled: disabled,
|
750
|
+
onChange: handleAllCheck,
|
751
|
+
children: _locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal9 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal9 === void 0 ? void 0 : _locale$ProTreeModal9.checkAll
|
752
|
+
}) : null,
|
753
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
754
|
+
className: "pro-tree-modal-content",
|
755
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
756
|
+
className: (0, _classnames.default)('pro-tree-modal-box', modeType === CASCADER || modeType === LIST && span ? 'pro-tree-modal-cascader-box' : ''),
|
757
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_input.default, {
|
758
|
+
disabled: disabled,
|
759
|
+
allowClear: true,
|
760
|
+
value: state.searchStr,
|
761
|
+
placeholder: placeholder || (_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal10 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal10 === void 0 ? void 0 : _locale$ProTreeModal10.input),
|
762
|
+
className: "pro-tree-modal-search",
|
763
|
+
onChange: e => handleSetSearchStr(e.target.value),
|
764
|
+
prefix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
765
|
+
className: "pro-tree-modal-search-svg",
|
766
|
+
src: _inputSearch.default
|
767
|
+
})
|
768
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
769
|
+
className: "pro-tree-modal-tree-warp",
|
770
|
+
children: renderContainer()
|
771
|
+
})]
|
772
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
773
|
+
className: (0, _classnames.default)('pro-tree-modal-box', modeType === CASCADER || modeType === LIST && span ? 'pro-tree-modal-cascader-box-view' : ''),
|
774
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
775
|
+
className: "pro-tree-modal-box-header",
|
776
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
777
|
+
children: [_locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal11 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal11 === void 0 ? void 0 : _locale$ProTreeModal11.check, " (", state.checkedValues.length, "/", max || state.flatTreeData.length, ")"]
|
778
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.default, {
|
779
|
+
disabled: disabled,
|
780
|
+
type: "link",
|
781
|
+
onClick: handleClearAll,
|
782
|
+
children: _locale.default === null || _locale.default === void 0 || (_locale$ProTreeModal12 = _locale.default.ProTreeModal) === null || _locale$ProTreeModal12 === void 0 ? void 0 : _locale$ProTreeModal12.clearAll
|
783
|
+
})]
|
784
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
785
|
+
className: "pro-tree-modal-tree-warp pro-transfer-right",
|
786
|
+
children: renderView()
|
787
|
+
})]
|
788
|
+
})]
|
789
|
+
})
|
790
|
+
})]
|
791
|
+
})
|
792
|
+
});
|
714
793
|
};
|
715
|
-
var
|
716
|
-
// Annotate the CommonJS export names for ESM import in node:
|
717
|
-
0 && (module.exports = {
|
718
|
-
CASCADER
|
719
|
-
});
|
794
|
+
var _default = exports.default = ProTreeModal;
|