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