@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,224 +1,207 @@
|
|
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/ProForm/components/combination/ProModalSelect/index.tsx
|
30
|
+
var ProModalSelect_exports = {};
|
31
|
+
__export(ProModalSelect_exports, {
|
32
|
+
default: () => ProModalSelect_default
|
7
33
|
});
|
8
|
-
exports
|
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
|
-
|
25
|
-
|
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
|
-
optionRender = props.optionRender,
|
53
|
-
customRender = props.customRender,
|
54
|
-
style = props.style,
|
55
|
-
className = props.className,
|
56
|
-
beforeOpen = props.beforeOpen,
|
57
|
-
afterOpen = props.afterOpen,
|
58
|
-
isTooltip = props.isTooltip,
|
59
|
-
searchForm = props.searchForm,
|
60
|
-
searchKey = props.searchKey,
|
61
|
-
defaultOne = props.defaultOne,
|
62
|
-
otherProps = props.otherProps,
|
63
|
-
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
64
|
-
var contentForm = _antd.Form.useFormInstance();
|
65
|
-
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
66
|
-
throw new Error('error: 请检查枚举选择弹框的配置项【configOption】');
|
34
|
+
module.exports = __toCommonJS(ProModalSelect_exports);
|
35
|
+
var import_icons = require("@ant-design/icons");
|
36
|
+
var import_ahooks = require("ahooks");
|
37
|
+
var import_antd = require("antd");
|
38
|
+
var import_lodash = require("lodash");
|
39
|
+
var import_classnames = __toESM(require("classnames"));
|
40
|
+
var import_react_svg = require("react-svg");
|
41
|
+
var import_react = __toESM(require("react"));
|
42
|
+
var import__ = require("../../../../index");
|
43
|
+
var import_Container = __toESM(require("../../Container"));
|
44
|
+
var import_view = __toESM(require("../../../../assets/view.svg"));
|
45
|
+
var import_useRequestList = __toESM(require("./hooks/useRequestList"));
|
46
|
+
var import_locale = __toESM(require("../../../../locale"));
|
47
|
+
var import_utils = require("./utils");
|
48
|
+
var ProModalSelect = (props, ref) => {
|
49
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
50
|
+
const {
|
51
|
+
value,
|
52
|
+
onChange,
|
53
|
+
disabled,
|
54
|
+
labelInValue = false,
|
55
|
+
fieldNames,
|
56
|
+
readOnly = true,
|
57
|
+
addonAfter,
|
58
|
+
configOption,
|
59
|
+
title,
|
60
|
+
onFormat,
|
61
|
+
showCodeName,
|
62
|
+
optionRender,
|
63
|
+
customRender,
|
64
|
+
style,
|
65
|
+
className,
|
66
|
+
beforeOpen,
|
67
|
+
afterOpen,
|
68
|
+
isTooltip,
|
69
|
+
searchForm,
|
70
|
+
searchKey,
|
71
|
+
defaultOne,
|
72
|
+
otherProps,
|
73
|
+
...restProps
|
74
|
+
} = props;
|
75
|
+
const contentForm = import_antd.Form.useFormInstance();
|
76
|
+
if (!configOption || Object.prototype.toString.call(configOption) !== "[object Object]") {
|
77
|
+
throw new Error("error: 请检查枚举选择弹框的配置项【configOption】");
|
67
78
|
}
|
68
|
-
|
69
|
-
type =
|
70
|
-
useRequest
|
71
|
-
transformParams
|
72
|
-
transformResponse
|
73
|
-
formColumns
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
var isMultiple = type === 'checkbox';
|
87
|
-
// 生成一个唯一id,用于满足tooltip功能
|
88
|
-
var uuid = Math.random().toString(36).slice(-6);
|
89
|
-
// 全局配置fieldNames指定 value与label的key
|
90
|
-
var _ref3 = (0, _index.useProConfig)('ProModalSelect') || {},
|
91
|
-
_ref3$fieldNames = _ref3.fieldNames,
|
92
|
-
proModalSelectFieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames;
|
93
|
-
var labelKey = 'label';
|
94
|
-
var valueKey = 'value';
|
79
|
+
const {
|
80
|
+
type = "radio",
|
81
|
+
useRequest,
|
82
|
+
transformParams,
|
83
|
+
transformResponse,
|
84
|
+
formColumns,
|
85
|
+
withPagination = true,
|
86
|
+
modalProps,
|
87
|
+
tableProps
|
88
|
+
} = configOption;
|
89
|
+
const { onOk, ...restModalProps } = modalProps || {};
|
90
|
+
const { isView: isViewCon, viewEmpty } = import__.ProForm.useFieldProps() || {};
|
91
|
+
const isView = typeof props.isView === "boolean" ? props.isView : isViewCon;
|
92
|
+
const isMultiple = type === "checkbox";
|
93
|
+
const uuid = Math.random().toString(36).slice(-6);
|
94
|
+
const { fieldNames: proModalSelectFieldNames = {} } = (0, import__.useProConfig)("ProModalSelect") || {};
|
95
|
+
let labelKey = "label";
|
96
|
+
let valueKey = "value";
|
95
97
|
if (proModalSelectFieldNames && Object.keys(proModalSelectFieldNames).length) {
|
96
98
|
labelKey = proModalSelectFieldNames.label;
|
97
99
|
valueKey = proModalSelectFieldNames.value;
|
98
100
|
}
|
99
|
-
// 表单上配置的权重大于全局配置
|
100
101
|
if (fieldNames && Object.keys(fieldNames).length) {
|
101
102
|
labelKey = fieldNames.label;
|
102
103
|
valueKey = fieldNames.value;
|
103
104
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
transformParams: transformParams,
|
142
|
-
transformResponse: transformResponse
|
143
|
-
}, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
105
|
+
const { rowKey = valueKey, columns, rowSelection, ...restTableProps } = tableProps || {};
|
106
|
+
const preValue = (0, import_react.useRef)(value);
|
107
|
+
const fieldRef = (0, import_react.useRef)(null);
|
108
|
+
const defaultParams = Array.isArray((_a = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a.defaultParams) ? (_c = (_b = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _b.defaultParams) == null ? void 0 : _c[0] : ((_d = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _d.defaultParams) || {};
|
109
|
+
const defaultParamsRef = (0, import_react.useRef)(defaultParams);
|
110
|
+
const [
|
111
|
+
{
|
112
|
+
_value,
|
113
|
+
isInit,
|
114
|
+
onOff,
|
115
|
+
open,
|
116
|
+
options,
|
117
|
+
selectedRows: _selectedRows,
|
118
|
+
selectedRowKeys: _selectedRowKeys
|
119
|
+
},
|
120
|
+
setState
|
121
|
+
] = (0, import_ahooks.useSetState)({
|
122
|
+
_value: value,
|
123
|
+
isInit: true,
|
124
|
+
onOff: false,
|
125
|
+
open: false,
|
126
|
+
options: (tableProps == null ? void 0 : tableProps.dataSource) || [],
|
127
|
+
selectedRows: [],
|
128
|
+
selectedRowKeys: []
|
129
|
+
});
|
130
|
+
const [form] = import_antd.Form.useForm(searchForm);
|
131
|
+
const selectedRows = (rowSelection == null ? void 0 : rowSelection.selectedRows) || _selectedRows;
|
132
|
+
const selectedRowKeys = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || _selectedRowKeys;
|
133
|
+
const { run, loading: selectLoading } = (0, import_useRequestList.default)(
|
134
|
+
useRequest == null ? void 0 : useRequest.service,
|
135
|
+
{
|
136
|
+
withPagination,
|
137
|
+
transformParams,
|
138
|
+
transformResponse
|
139
|
+
},
|
140
|
+
{
|
141
|
+
...useRequest == null ? void 0 : useRequest.options,
|
144
142
|
manual: true,
|
145
|
-
onSuccess
|
146
|
-
var
|
147
|
-
|
143
|
+
onSuccess(res) {
|
144
|
+
var _a2;
|
145
|
+
const list = withPagination ? (_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.list : res == null ? void 0 : res.data;
|
148
146
|
setState({
|
149
|
-
options: (
|
147
|
+
options: (transformResponse ? transformResponse(res == null ? void 0 : res.data) : list) ?? []
|
150
148
|
});
|
151
149
|
}
|
152
|
-
}
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
if (typeof (useRequest
|
158
|
-
|
159
|
-
nextInitParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField = contentForm.getFieldsValue) === null || _contentForm$getField === void 0 ? void 0 : _contentForm$getField.call(contentForm));
|
150
|
+
}
|
151
|
+
);
|
152
|
+
const initParams = (0, import_react.useMemo)(() => {
|
153
|
+
var _a2;
|
154
|
+
let nextInitParams = useRequest == null ? void 0 : useRequest.initParams;
|
155
|
+
if (typeof (useRequest == null ? void 0 : useRequest.initParams) === "function") {
|
156
|
+
nextInitParams = useRequest == null ? void 0 : useRequest.initParams(value, (_a2 = contentForm == null ? void 0 : contentForm.getFieldsValue) == null ? void 0 : _a2.call(contentForm));
|
160
157
|
}
|
161
158
|
return nextInitParams;
|
162
159
|
}, [value]);
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
160
|
+
const { data, loading, pagination, onSearch, onReset, runAsync, mutate } = (0, import_useRequestList.default)(
|
161
|
+
useRequest == null ? void 0 : useRequest.service,
|
162
|
+
{
|
163
|
+
withPagination,
|
164
|
+
transformParams,
|
165
|
+
transformResponse
|
166
|
+
},
|
167
|
+
{
|
168
168
|
manual: true,
|
169
|
-
ready: (initParams || defaultOne) && !readOnly || open
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
onReset = _useRequestList2.onReset,
|
176
|
-
runAsync = _useRequestList2.runAsync,
|
177
|
-
mutate = _useRequestList2.mutate;
|
178
|
-
var defaultOptionRender = function defaultOptionRender(rowData) {
|
179
|
-
return rowData === null || rowData === void 0 ? void 0 : rowData[labelKey];
|
180
|
-
};
|
181
|
-
var handleFormat = onFormat || defaultOptionRender;
|
169
|
+
ready: (initParams || defaultOne) && !readOnly || open,
|
170
|
+
...useRequest == null ? void 0 : useRequest.options
|
171
|
+
}
|
172
|
+
);
|
173
|
+
const defaultOptionRender = (rowData) => rowData == null ? void 0 : rowData[labelKey];
|
174
|
+
let handleFormat = onFormat || defaultOptionRender;
|
182
175
|
if (showCodeName) {
|
183
|
-
handleFormat =
|
184
|
-
var value = _ref6.value,
|
185
|
-
label = _ref6.label;
|
186
|
-
return "".concat(value, "-").concat(label);
|
187
|
-
};
|
176
|
+
handleFormat = ({ value: value2, label }) => `${value2}-${label}`;
|
188
177
|
}
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
* @returns {any}
|
194
|
-
*/
|
195
|
-
var formatValue = function formatValue(data) {
|
196
|
-
var _data$map;
|
197
|
-
if (typeof data === 'string' || typeof data === 'number') {
|
198
|
-
return data;
|
178
|
+
const formatValue = (data2) => {
|
179
|
+
var _a2;
|
180
|
+
if (typeof data2 === "string" || typeof data2 === "number") {
|
181
|
+
return data2;
|
199
182
|
}
|
200
|
-
if (Object.prototype.toString.call(
|
201
|
-
return handleFormat(
|
202
|
-
|
203
|
-
|
204
|
-
|
183
|
+
if (Object.prototype.toString.call(data2) === "[object Object]") {
|
184
|
+
return handleFormat({
|
185
|
+
...data2,
|
186
|
+
value: data2[valueKey],
|
187
|
+
label: data2[labelKey]
|
188
|
+
});
|
205
189
|
}
|
206
|
-
return (0,
|
207
|
-
return handleFormat(
|
190
|
+
return (0, import_lodash.isArray)(data2) ? (_a2 = data2 == null ? void 0 : data2.map((item) => {
|
191
|
+
return handleFormat({
|
192
|
+
...item,
|
208
193
|
value: item[valueKey],
|
209
194
|
label: item[labelKey]
|
210
|
-
})
|
211
|
-
}))
|
195
|
+
});
|
196
|
+
})) == null ? void 0 : _a2.join(",") : "";
|
212
197
|
};
|
213
|
-
|
214
|
-
var
|
198
|
+
const viewText = (0, import_react.useMemo)(() => {
|
199
|
+
var _a2;
|
200
|
+
let nextValue = labelInValue ? value : _value;
|
215
201
|
if (labelInValue) {
|
216
202
|
nextValue = value;
|
217
203
|
} else {
|
218
|
-
|
219
|
-
var optionDTO = options === null || options === void 0 ? void 0 : (_options$find = options.find) === null || _options$find === void 0 ? void 0 : _options$find.call(options, function (item) {
|
220
|
-
return item[valueKey] === value;
|
221
|
-
});
|
204
|
+
const optionDTO = (_a2 = options == null ? void 0 : options.find) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === value);
|
222
205
|
if (optionDTO) {
|
223
206
|
nextValue = optionDTO;
|
224
207
|
} else {
|
@@ -227,33 +210,19 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
227
210
|
}
|
228
211
|
return formatValue(nextValue);
|
229
212
|
}, [value, _value, options]);
|
230
|
-
|
231
|
-
|
232
|
-
* @date 2023-02-16
|
233
|
-
* @param {any} record 表格行数据
|
234
|
-
* @returns {any}
|
235
|
-
*/
|
236
|
-
var getRowKey = function getRowKey(record) {
|
237
|
-
if (typeof rowKey === 'function') {
|
213
|
+
const getRowKey = (record) => {
|
214
|
+
if (typeof rowKey === "function") {
|
238
215
|
return rowKey(record);
|
239
216
|
}
|
240
217
|
return record[rowKey];
|
241
218
|
};
|
242
|
-
|
243
|
-
* 执行onChange暴露出来的第一个参数取数方法
|
244
|
-
* @date 2023-02-16
|
245
|
-
* @param {any} selectedRows 选中行数据
|
246
|
-
* @returns {any}
|
247
|
-
*/
|
248
|
-
var getNextValues = function getNextValues(selectedRows) {
|
219
|
+
const getNextValues = (selectedRows2) => {
|
249
220
|
if (isMultiple) {
|
250
|
-
return
|
251
|
-
return item === null || item === void 0 ? void 0 : item[valueKey];
|
252
|
-
});
|
221
|
+
return selectedRows2.map((item) => item == null ? void 0 : item[valueKey]);
|
253
222
|
}
|
254
|
-
return
|
223
|
+
return selectedRows2 == null ? void 0 : selectedRows2[valueKey];
|
255
224
|
};
|
256
|
-
|
225
|
+
const handleChangeValue = (e) => {
|
257
226
|
onChange(e.target.value);
|
258
227
|
preValue.current = e.target.value;
|
259
228
|
if (!readOnly) {
|
@@ -262,196 +231,108 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
262
231
|
});
|
263
232
|
}
|
264
233
|
};
|
265
|
-
|
234
|
+
const handleSelectValue = (val, option) => {
|
266
235
|
onChange(val, option);
|
267
236
|
preValue.current = val;
|
268
237
|
};
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
break;
|
287
|
-
}
|
288
|
-
_t = _yield$beforeOpen !== void 0;
|
289
|
-
case 2:
|
290
|
-
if (!_t) {
|
291
|
-
_context.n = 3;
|
292
|
-
break;
|
293
|
-
}
|
294
|
-
_t3 = _yield$beforeOpen;
|
295
|
-
_context.n = 4;
|
296
|
-
break;
|
297
|
-
case 3:
|
298
|
-
_t3 = true;
|
299
|
-
case 4:
|
300
|
-
res = _t3;
|
301
|
-
if (res) {
|
302
|
-
setState({
|
303
|
-
onOff: true
|
304
|
-
});
|
305
|
-
setTimeout(function () {
|
306
|
-
afterOpen === null || afterOpen === void 0 ? void 0 : afterOpen({
|
307
|
-
setInnerState: setState
|
308
|
-
});
|
309
|
-
}, 100);
|
310
|
-
}
|
311
|
-
case 5:
|
312
|
-
return _context.a(2);
|
313
|
-
}
|
314
|
-
}, _callee);
|
315
|
-
}));
|
316
|
-
return function handleClick() {
|
317
|
-
return _ref7.apply(this, arguments);
|
318
|
-
};
|
319
|
-
}();
|
320
|
-
var handleClose = function handleClose() {
|
321
|
-
var _useRequest$options4;
|
238
|
+
const handleClick = async () => {
|
239
|
+
if (!disabled) {
|
240
|
+
const res = await (beforeOpen == null ? void 0 : beforeOpen()) ?? true;
|
241
|
+
if (res) {
|
242
|
+
setState({
|
243
|
+
onOff: true
|
244
|
+
});
|
245
|
+
setTimeout(() => {
|
246
|
+
afterOpen == null ? void 0 : afterOpen({
|
247
|
+
setInnerState: setState
|
248
|
+
});
|
249
|
+
}, 100);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
};
|
253
|
+
const handleClose = () => {
|
254
|
+
var _a2;
|
322
255
|
form.resetFields();
|
323
256
|
setState({
|
324
257
|
onOff: false,
|
325
258
|
open: false,
|
326
259
|
isInit: false
|
327
260
|
});
|
328
|
-
|
329
|
-
|
330
|
-
mutate(function () {
|
331
|
-
return [];
|
332
|
-
});
|
261
|
+
if ((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.manual) {
|
262
|
+
mutate(() => []);
|
333
263
|
}
|
334
264
|
};
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
record = isMultiple ? nextSelectedRows : (_nextSelectedRows2 = nextSelectedRows) === null || _nextSelectedRows2 === void 0 ? void 0 : _nextSelectedRows2[0];
|
356
|
-
if (!isMultiple) {
|
357
|
-
// @ts-ignore
|
358
|
-
record.value = record[valueKey];
|
359
|
-
// @ts-ignore
|
360
|
-
record.label = record[labelKey];
|
361
|
-
}
|
362
|
-
flag = true;
|
363
|
-
if (!onOk) {
|
364
|
-
_context2.n = 3;
|
365
|
-
break;
|
366
|
-
}
|
367
|
-
_context2.n = 2;
|
368
|
-
return onOk(record);
|
369
|
-
case 2:
|
370
|
-
res = _context2.v;
|
371
|
-
if (res !== null && res !== undefined) {
|
372
|
-
// @ts-ignore
|
373
|
-
flag = res;
|
374
|
-
}
|
375
|
-
case 3:
|
376
|
-
if (flag) {
|
377
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
378
|
-
preValue.current = labelInValue ? record : getNextValues(record);
|
379
|
-
// 更新内部展示值
|
380
|
-
setState({
|
381
|
-
_value: record,
|
382
|
-
options: (0, _isArray2.default)(record) ? record : [record]
|
383
|
-
});
|
384
|
-
handleClose();
|
385
|
-
}
|
386
|
-
return _context2.a(2, flag);
|
387
|
-
case 4:
|
388
|
-
_context2.p = 4;
|
389
|
-
_t4 = _context2.v;
|
390
|
-
console.warn('error', _t4);
|
391
|
-
case 5:
|
392
|
-
return _context2.a(2);
|
393
|
-
}
|
394
|
-
}, _callee2, null, [[0, 4]]);
|
395
|
-
}));
|
396
|
-
return function handleFinish() {
|
397
|
-
return _ref8.apply(this, arguments);
|
398
|
-
};
|
399
|
-
}();
|
400
|
-
var handleSearch = /*#__PURE__*/function () {
|
401
|
-
var _ref9 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator().m(function _callee3() {
|
402
|
-
var values;
|
403
|
-
return _regenerator().w(function (_context3) {
|
404
|
-
while (1) switch (_context3.n) {
|
405
|
-
case 0:
|
406
|
-
_context3.n = 1;
|
407
|
-
return form.validateFields();
|
408
|
-
case 1:
|
409
|
-
values = _context3.v;
|
410
|
-
onSearch((0, _objectSpread5.default)((0, _objectSpread5.default)({}, values), {}, {
|
411
|
-
d: Date.now()
|
412
|
-
}));
|
413
|
-
case 2:
|
414
|
-
return _context3.a(2);
|
265
|
+
const handleFinish = async () => {
|
266
|
+
try {
|
267
|
+
if (!(selectedRowKeys == null ? void 0 : selectedRowKeys.length) || !(selectedRows == null ? void 0 : selectedRows.length)) {
|
268
|
+
import_antd.message.error(import_locale.default.ProModalSelect.checkMsg);
|
269
|
+
return false;
|
270
|
+
}
|
271
|
+
let nextSelectedRows = selectedRows;
|
272
|
+
if (!(nextSelectedRows == null ? void 0 : nextSelectedRows[0])) {
|
273
|
+
nextSelectedRows = data.filter((item) => selectedRowKeys.includes(item[valueKey]));
|
274
|
+
}
|
275
|
+
const record = isMultiple ? nextSelectedRows : nextSelectedRows == null ? void 0 : nextSelectedRows[0];
|
276
|
+
if (!isMultiple) {
|
277
|
+
record.value = record[valueKey];
|
278
|
+
record.label = record[labelKey];
|
279
|
+
}
|
280
|
+
let flag = true;
|
281
|
+
if (onOk) {
|
282
|
+
const res = await onOk(record);
|
283
|
+
if (res !== null && res !== void 0) {
|
284
|
+
flag = res;
|
415
285
|
}
|
416
|
-
}
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
286
|
+
}
|
287
|
+
if (flag) {
|
288
|
+
onChange == null ? void 0 : onChange(labelInValue ? record : getNextValues(record), record);
|
289
|
+
preValue.current = labelInValue ? record : getNextValues(record);
|
290
|
+
setState({
|
291
|
+
_value: record,
|
292
|
+
options: (0, import_lodash.isArray)(record) ? record : [record]
|
293
|
+
});
|
294
|
+
handleClose();
|
295
|
+
}
|
296
|
+
return flag;
|
297
|
+
} catch (error) {
|
298
|
+
console.warn("error", error);
|
299
|
+
}
|
300
|
+
};
|
301
|
+
const handleSearch = async () => {
|
302
|
+
const values = await form.validateFields();
|
303
|
+
onSearch({
|
304
|
+
...values,
|
305
|
+
d: Date.now()
|
306
|
+
});
|
307
|
+
};
|
308
|
+
const _rowSelection = {
|
309
|
+
type,
|
310
|
+
onChange: (rowKeys, rows) => {
|
425
311
|
setState({
|
426
312
|
selectedRowKeys: rowKeys,
|
427
313
|
selectedRows: rows
|
428
314
|
});
|
429
315
|
},
|
430
|
-
getCheckboxProps:
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
var _rowSelection$getChec, _rowSelection$getChec2;
|
441
|
-
if (_rowSelection === null || _rowSelection === void 0 ? void 0 : (_rowSelection$getChec = _rowSelection.getCheckboxProps) === null || _rowSelection$getChec === void 0 ? void 0 : (_rowSelection$getChec2 = _rowSelection$getChec.call(_rowSelection, record)) === null || _rowSelection$getChec2 === void 0 ? void 0 : _rowSelection$getChec2.disabled) {
|
316
|
+
getCheckboxProps: (record) => ({
|
317
|
+
disabled: record == null ? void 0 : record.disabled
|
318
|
+
}),
|
319
|
+
selectedRowKeys,
|
320
|
+
selectedRows,
|
321
|
+
...rowSelection
|
322
|
+
};
|
323
|
+
const handleClickRow = (record) => {
|
324
|
+
var _a2, _b2;
|
325
|
+
if ((_b2 = (_a2 = _rowSelection == null ? void 0 : _rowSelection.getCheckboxProps) == null ? void 0 : _a2.call(_rowSelection, record)) == null ? void 0 : _b2.disabled) {
|
442
326
|
return;
|
443
327
|
}
|
444
|
-
if (record
|
445
|
-
|
446
|
-
|
447
|
-
|
328
|
+
if (record == null ? void 0 : record.disabled)
|
329
|
+
return;
|
330
|
+
const selectedValue = getRowKey(record);
|
331
|
+
let tempSelectedRows = [...selectedRows];
|
332
|
+
let tempSelectedRowKeys = [...selectedRowKeys];
|
448
333
|
if (isMultiple) {
|
449
|
-
|
450
|
-
|
451
|
-
});
|
452
|
-
var rowKeyIndex = tempSelectedRowKeys.findIndex(function (item) {
|
453
|
-
return item === selectedValue;
|
454
|
-
});
|
334
|
+
const rowIndex = tempSelectedRows.findIndex((item) => getRowKey(item) === selectedValue);
|
335
|
+
const rowKeyIndex = tempSelectedRowKeys.findIndex((item) => item === selectedValue);
|
455
336
|
if (rowKeyIndex > -1) {
|
456
337
|
tempSelectedRows.splice(rowIndex, 1);
|
457
338
|
tempSelectedRowKeys.splice(rowKeyIndex, 1);
|
@@ -468,143 +349,108 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
468
349
|
selectedRowKeys: tempSelectedRowKeys
|
469
350
|
});
|
470
351
|
};
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
case 1:
|
494
|
-
res = _context4.v;
|
495
|
-
if (res === null || res === void 0 ? void 0 : res.data) {
|
496
|
-
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
497
|
-
if (transformResponse) {
|
498
|
-
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
499
|
-
}
|
500
|
-
_data = isMultiple ? list : (_list = list) === null || _list === void 0 ? void 0 : _list[0];
|
501
|
-
if (_data) {
|
502
|
-
nextSelectRowKeys = isMultiple ? value : [value];
|
503
|
-
if (labelInValue) {
|
504
|
-
onChange(_data);
|
505
|
-
preValue.current = _data;
|
506
|
-
}
|
507
|
-
// 更新内部展示值
|
508
|
-
setState({
|
509
|
-
_value: _data,
|
510
|
-
isInit: false,
|
511
|
-
selectedRows: list,
|
512
|
-
selectedRowKeys: nextSelectRowKeys
|
513
|
-
});
|
514
|
-
} else if (!readOnly) {
|
515
|
-
// 当传入initParams且文本框非只读时,不调用接口获取初始化数据
|
516
|
-
setState({
|
517
|
-
_value: value,
|
518
|
-
isInit: false
|
519
|
-
});
|
520
|
-
}
|
521
|
-
}
|
522
|
-
case 2:
|
523
|
-
return _context4.a(2);
|
352
|
+
const getInitValues = async () => {
|
353
|
+
var _a2, _b2;
|
354
|
+
if (initParams || defaultOne) {
|
355
|
+
const queryBean = {
|
356
|
+
...defaultParams,
|
357
|
+
...initParams || {}
|
358
|
+
};
|
359
|
+
const page = {
|
360
|
+
pageNum: 1,
|
361
|
+
pageSize: 10,
|
362
|
+
...(_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.page
|
363
|
+
};
|
364
|
+
let params = withPagination ? {
|
365
|
+
...page,
|
366
|
+
queryBean: queryBean ?? {}
|
367
|
+
} : queryBean;
|
368
|
+
params = transformParams ? transformParams(params) : params;
|
369
|
+
const res = await runAsync(params);
|
370
|
+
if (res == null ? void 0 : res.data) {
|
371
|
+
let list = withPagination ? (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list : res == null ? void 0 : res.data;
|
372
|
+
if (transformResponse) {
|
373
|
+
list = transformResponse(res == null ? void 0 : res.data);
|
524
374
|
}
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.page);
|
544
|
-
params = withPagination ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, page), {}, {
|
545
|
-
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
546
|
-
}) : queryBean;
|
547
|
-
params = transformParams ? transformParams(params) : params;
|
548
|
-
_context5.n = 1;
|
549
|
-
return runAsync(params);
|
550
|
-
case 1:
|
551
|
-
res = _context5.v;
|
552
|
-
if (res === null || res === void 0 ? void 0 : res.data) {
|
553
|
-
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.list : res === null || res === void 0 ? void 0 : res.data;
|
554
|
-
if (transformResponse) {
|
555
|
-
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
556
|
-
}
|
557
|
-
_data2 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
|
558
|
-
nextSelectRowKeys = isMultiple ? value : [value];
|
559
|
-
if (labelInValue) {
|
560
|
-
onChange(_data2);
|
561
|
-
preValue.current = _data2;
|
562
|
-
} else {
|
563
|
-
onChange(isMultiple ? _data2.map(function (item) {
|
564
|
-
return item[valueKey];
|
565
|
-
}) : _data2[valueKey]);
|
566
|
-
preValue.current = isMultiple ? _data2.map(function (item) {
|
567
|
-
return item[valueKey];
|
568
|
-
}) : _data2[valueKey];
|
569
|
-
}
|
570
|
-
// 更新内部展示值
|
571
|
-
setState({
|
572
|
-
_value: _data2,
|
573
|
-
isInit: false,
|
574
|
-
selectedRows: list,
|
575
|
-
selectedRowKeys: nextSelectRowKeys
|
576
|
-
});
|
577
|
-
}
|
578
|
-
case 2:
|
579
|
-
return _context5.a(2);
|
375
|
+
const data2 = isMultiple ? list : list == null ? void 0 : list[0];
|
376
|
+
if (data2) {
|
377
|
+
const nextSelectRowKeys = isMultiple ? value : [value];
|
378
|
+
if (labelInValue) {
|
379
|
+
onChange(data2);
|
380
|
+
preValue.current = data2;
|
381
|
+
}
|
382
|
+
setState({
|
383
|
+
_value: data2,
|
384
|
+
isInit: false,
|
385
|
+
selectedRows: list,
|
386
|
+
selectedRowKeys: nextSelectRowKeys
|
387
|
+
});
|
388
|
+
} else if (!readOnly) {
|
389
|
+
setState({
|
390
|
+
_value: value,
|
391
|
+
isInit: false
|
392
|
+
});
|
580
393
|
}
|
581
|
-
}
|
582
|
-
}
|
583
|
-
|
584
|
-
|
394
|
+
}
|
395
|
+
}
|
396
|
+
};
|
397
|
+
const getDefaultOneValues = async () => {
|
398
|
+
var _a2, _b2;
|
399
|
+
const queryBean = {
|
400
|
+
...defaultParams
|
585
401
|
};
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
handleSearch: handleSearch
|
402
|
+
const page = {
|
403
|
+
pageNum: 1,
|
404
|
+
pageSize: 10,
|
405
|
+
...(_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.page
|
591
406
|
};
|
592
|
-
|
593
|
-
|
407
|
+
let params = withPagination ? {
|
408
|
+
...page,
|
409
|
+
queryBean: queryBean ?? {}
|
410
|
+
} : queryBean;
|
411
|
+
params = transformParams ? transformParams(params) : params;
|
412
|
+
const res = await runAsync(params);
|
413
|
+
if (res == null ? void 0 : res.data) {
|
414
|
+
let list = withPagination ? (_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list : res == null ? void 0 : res.data;
|
415
|
+
if (transformResponse) {
|
416
|
+
list = transformResponse(res == null ? void 0 : res.data);
|
417
|
+
}
|
418
|
+
const data2 = isMultiple ? list : list == null ? void 0 : list[0];
|
419
|
+
const nextSelectRowKeys = isMultiple ? value : [value];
|
420
|
+
if (labelInValue) {
|
421
|
+
onChange(data2);
|
422
|
+
preValue.current = data2;
|
423
|
+
} else {
|
424
|
+
onChange(isMultiple ? data2.map((item) => item[valueKey]) : data2[valueKey]);
|
425
|
+
preValue.current = isMultiple ? data2.map((item) => item[valueKey]) : data2[valueKey];
|
426
|
+
}
|
427
|
+
setState({
|
428
|
+
_value: data2,
|
429
|
+
isInit: false,
|
430
|
+
selectedRows: list,
|
431
|
+
selectedRowKeys: nextSelectRowKeys
|
432
|
+
});
|
433
|
+
}
|
434
|
+
};
|
435
|
+
(0, import_react.useImperativeHandle)(ref, () => ({
|
436
|
+
handleClick,
|
437
|
+
handleSearch
|
438
|
+
}));
|
439
|
+
(0, import_ahooks.useMount)(() => {
|
594
440
|
if (!value) {
|
595
441
|
setState({
|
596
|
-
selectedRowKeys: (rowSelection
|
597
|
-
selectedRows: (rowSelection
|
598
|
-
_value:
|
442
|
+
selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || [],
|
443
|
+
selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || [],
|
444
|
+
_value: void 0
|
599
445
|
});
|
600
|
-
} else if (Object.prototype.toString.call(value) ===
|
446
|
+
} else if (Object.prototype.toString.call(value) === "[object Array]") {
|
601
447
|
setState({
|
602
|
-
selectedRowKeys: (rowSelection
|
603
|
-
selectedRows: (rowSelection
|
448
|
+
selectedRowKeys: (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) || value,
|
449
|
+
selectedRows: (rowSelection == null ? void 0 : rowSelection.selectedRows) || value,
|
604
450
|
_value: value
|
605
451
|
});
|
606
|
-
} else if (Object.prototype.toString.call(value) ===
|
607
|
-
|
452
|
+
} else if (Object.prototype.toString.call(value) === "[object Object]") {
|
453
|
+
const initialValue = { [valueKey]: value[valueKey], [labelKey]: value[labelKey] };
|
608
454
|
setState({
|
609
455
|
selectedRowKeys: [value],
|
610
456
|
selectedRows: [initialValue],
|
@@ -612,13 +458,13 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
612
458
|
});
|
613
459
|
}
|
614
460
|
});
|
615
|
-
(0,
|
461
|
+
(0, import_react.useEffect)(() => {
|
462
|
+
var _a2, _b2;
|
616
463
|
if (onOff && !open) {
|
617
|
-
|
618
|
-
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options7 = useRequest.options) === null || _useRequest$options7 === void 0 ? void 0 : _useRequest$options7.manual) !== true) {
|
464
|
+
if (((_a2 = useRequest == null ? void 0 : useRequest.options) == null ? void 0 : _a2.manual) !== true) {
|
619
465
|
onReset();
|
620
466
|
}
|
621
|
-
|
467
|
+
const nextState = {
|
622
468
|
open: true
|
623
469
|
};
|
624
470
|
if (labelInValue) {
|
@@ -626,113 +472,123 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
626
472
|
nextState.selectedRowKeys = [];
|
627
473
|
nextState.selectedRows = [];
|
628
474
|
}
|
629
|
-
if (Object.prototype.toString.call(value) ===
|
475
|
+
if (Object.prototype.toString.call(value) === "[object Object]") {
|
630
476
|
nextState.selectedRowKeys = [getRowKey(value)];
|
631
477
|
nextState.selectedRows = [value];
|
632
478
|
}
|
633
|
-
if ((0,
|
634
|
-
nextState.selectedRowKeys = value.map(
|
635
|
-
return getRowKey(item);
|
636
|
-
});
|
479
|
+
if ((0, import_lodash.isArray)(value)) {
|
480
|
+
nextState.selectedRowKeys = value.map((item) => getRowKey(item));
|
637
481
|
nextState.selectedRows = value;
|
638
482
|
}
|
639
483
|
} else if (value) {
|
640
|
-
|
641
|
-
var nextSelectedRowKeys = isMultiple ? value : [value];
|
484
|
+
const nextSelectedRowKeys = isMultiple ? value : [value];
|
642
485
|
nextState.selectedRowKeys = nextSelectedRowKeys;
|
643
|
-
|
644
|
-
nextState.selectedRows =
|
486
|
+
const list = options ?? data;
|
487
|
+
nextState.selectedRows = (_b2 = list == null ? void 0 : list.filter) == null ? void 0 : _b2.call(list, (item) => {
|
645
488
|
return nextSelectedRowKeys.includes(item[valueKey]);
|
646
489
|
});
|
647
490
|
}
|
648
491
|
setState(nextState);
|
649
492
|
}
|
650
493
|
}, [onOff, open, JSON.stringify(value)]);
|
651
|
-
(0,
|
652
|
-
(0,
|
494
|
+
(0, import_react.useEffect)(() => {
|
495
|
+
(0, import_utils.hideTooltipIfOpen)(fieldRef.current, open);
|
653
496
|
}, [open]);
|
654
|
-
(0,
|
497
|
+
(0, import_react.useEffect)(() => {
|
655
498
|
if (value && !open && isInit && !readOnly) {
|
656
499
|
getInitValues();
|
657
500
|
}
|
658
501
|
}, [JSON.stringify(value), open, isInit]);
|
659
|
-
(0,
|
660
|
-
|
661
|
-
|
502
|
+
(0, import_ahooks.useDebounceEffect)(() => {
|
503
|
+
var _a2;
|
504
|
+
if (value && !open && readOnly && (!(0, import_lodash.isEqual)(value, preValue.current) || (options == null ? void 0 : options.length) === 0)) {
|
662
505
|
preValue.current = value;
|
663
|
-
|
664
|
-
|
665
|
-
return item[valueKey] === _data3;
|
666
|
-
});
|
506
|
+
const data2 = labelInValue ? value[valueKey] : value;
|
507
|
+
const isHasValue = (_a2 = options == null ? void 0 : options.some) == null ? void 0 : _a2.call(options, (item) => item[valueKey] === data2);
|
667
508
|
if (isHasValue) {
|
668
509
|
return;
|
669
510
|
}
|
670
511
|
if (useRequest) {
|
671
|
-
|
672
|
-
|
673
|
-
var params = withPagination ? {
|
512
|
+
setTimeout(() => {
|
513
|
+
const params = withPagination ? {
|
674
514
|
pageNum: 1,
|
675
515
|
pageSize: 50,
|
676
|
-
queryBean:
|
677
|
-
|
678
|
-
|
516
|
+
queryBean: {
|
517
|
+
...defaultParams,
|
518
|
+
...initParams,
|
519
|
+
[searchKey ?? valueKey]: data2
|
520
|
+
}
|
521
|
+
} : {
|
522
|
+
...defaultParams,
|
523
|
+
...initParams,
|
524
|
+
[searchKey ?? valueKey]: data2
|
525
|
+
};
|
526
|
+
const nextParams = transformParams ? transformParams(params) : params;
|
679
527
|
run(nextParams);
|
680
528
|
}, 300);
|
681
529
|
}
|
682
530
|
}
|
683
|
-
}, [
|
684
|
-
|
531
|
+
}, [
|
532
|
+
JSON.stringify(value),
|
533
|
+
open,
|
534
|
+
JSON.stringify(defaultParams),
|
535
|
+
JSON.stringify(initParams),
|
536
|
+
options == null ? void 0 : options.length
|
537
|
+
]);
|
538
|
+
const handleSelectFocus = () => {
|
685
539
|
if (useRequest) {
|
686
|
-
|
687
|
-
|
540
|
+
const queryBean = defaultParams || {};
|
541
|
+
const params = withPagination ? {
|
688
542
|
pageNum: 1,
|
689
543
|
pageSize: 50,
|
690
|
-
queryBean
|
544
|
+
queryBean
|
691
545
|
} : queryBean;
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
defaultParamsRef.current = queryBean; // 更新缓存
|
546
|
+
const nextParams = transformParams ? transformParams(params) : params;
|
547
|
+
if (!(0, import_lodash.isEqual)(queryBean, defaultParamsRef.current) || !(options == null ? void 0 : options.length)) {
|
548
|
+
run(nextParams);
|
549
|
+
defaultParamsRef.current = queryBean;
|
697
550
|
}
|
698
551
|
setState({
|
699
552
|
isInit: false
|
700
553
|
});
|
701
554
|
}
|
702
555
|
};
|
703
|
-
|
556
|
+
const handleSelectSearch = (0, import_lodash.debounce)((val) => {
|
704
557
|
if (useRequest) {
|
705
|
-
|
706
|
-
|
558
|
+
const queryBean = {
|
559
|
+
...defaultParams,
|
560
|
+
[searchKey ?? labelKey]: val
|
561
|
+
};
|
562
|
+
const params = withPagination ? {
|
707
563
|
pageNum: 1,
|
708
564
|
pageSize: 50,
|
709
|
-
queryBean
|
565
|
+
queryBean
|
710
566
|
} : queryBean;
|
711
|
-
|
567
|
+
const nextParams = transformParams ? transformParams(params) : params;
|
712
568
|
run(nextParams);
|
713
569
|
}
|
714
|
-
},
|
715
|
-
(0,
|
570
|
+
}, 1e3);
|
571
|
+
(0, import_ahooks.useDebounceEffect)(() => {
|
716
572
|
if (!value) {
|
717
573
|
if (defaultOne) {
|
718
574
|
getDefaultOneValues();
|
719
575
|
} else {
|
720
576
|
setState({
|
721
|
-
_value:
|
577
|
+
_value: void 0,
|
722
578
|
selectedRowKeys: [],
|
723
579
|
selectedRows: []
|
724
580
|
});
|
725
581
|
}
|
726
582
|
}
|
727
583
|
if (!readOnly) {
|
728
|
-
if (labelInValue && _value && !(0,
|
584
|
+
if (labelInValue && _value && !(0, import_lodash.isEqual)(value, _value)) {
|
729
585
|
setState({
|
730
586
|
_value: value,
|
731
587
|
selectedRowKeys: [],
|
732
588
|
selectedRows: []
|
733
589
|
});
|
734
590
|
}
|
735
|
-
if (!labelInValue && !(0,
|
591
|
+
if (!labelInValue && !(0, import_lodash.isEqual)(value, _value == null ? void 0 : _value[valueKey])) {
|
736
592
|
setState({
|
737
593
|
_value: value,
|
738
594
|
selectedRowKeys: [],
|
@@ -741,79 +597,66 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
741
597
|
}
|
742
598
|
}
|
743
599
|
}, [value, _value]);
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
},
|
749
|
-
block: true,
|
750
|
-
children: [readOnly ? (0, _jsxRuntime.jsx)(_index.ProSelect, (0, _objectSpread5.default)({
|
751
|
-
value: value,
|
600
|
+
let initRender = /* @__PURE__ */ import_react.default.createElement(import_antd.Space.Compact, { style: { width: "100%" }, block: true }, readOnly ? /* @__PURE__ */ import_react.default.createElement(
|
601
|
+
import__.ProSelect,
|
602
|
+
{
|
603
|
+
value,
|
752
604
|
onChange: handleSelectValue,
|
753
|
-
disabled
|
754
|
-
fieldNames
|
755
|
-
showCodeName
|
756
|
-
labelInValue
|
605
|
+
disabled,
|
606
|
+
fieldNames,
|
607
|
+
showCodeName,
|
608
|
+
labelInValue,
|
757
609
|
dataSource: options,
|
758
|
-
optionRender
|
610
|
+
optionRender,
|
759
611
|
scrollFollowParent: false,
|
760
|
-
mode: isMultiple ?
|
761
|
-
notFoundContent: selectLoading ?
|
762
|
-
size: "small"
|
763
|
-
}) : null,
|
612
|
+
mode: isMultiple ? "multiple" : void 0,
|
613
|
+
notFoundContent: selectLoading ? /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { size: "small" }) : null,
|
764
614
|
onFocus: handleSelectFocus,
|
765
615
|
onSearch: handleSelectSearch,
|
766
|
-
style: {
|
767
|
-
|
768
|
-
|
769
|
-
|
616
|
+
style: { width: isView || disabled ? "100%" : "calc(100% - 30px)" },
|
617
|
+
...restProps
|
618
|
+
}
|
619
|
+
) : /* @__PURE__ */ import_react.default.createElement(
|
620
|
+
import_antd.Input,
|
621
|
+
{
|
770
622
|
value: viewText,
|
771
623
|
onChange: handleChangeValue,
|
772
|
-
disabled
|
624
|
+
disabled,
|
773
625
|
autoComplete: "off",
|
774
|
-
allowClear: true
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
})
|
781
|
-
})]
|
782
|
-
});
|
783
|
-
if (customRender && /*#__PURE__*/_react.default.isValidElement(customRender)) {
|
784
|
-
initRender = (0, _jsxRuntime.jsx)("div", {
|
785
|
-
className: "pro-modal-select-init",
|
786
|
-
onClick: handleClick,
|
787
|
-
children: customRender
|
788
|
-
});
|
626
|
+
allowClear: true,
|
627
|
+
...restProps
|
628
|
+
}
|
629
|
+
), isView || disabled ? null : /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleClick, icon: /* @__PURE__ */ import_react.default.createElement(import_react_svg.ReactSVG, { className: "viewSvg", src: import_view.default }) }));
|
630
|
+
if (customRender && import_react.default.isValidElement(customRender)) {
|
631
|
+
initRender = /* @__PURE__ */ import_react.default.createElement("div", { className: "pro-modal-select-init", onClick: handleClick }, customRender);
|
789
632
|
}
|
790
|
-
(0,
|
633
|
+
(0, import_ahooks.useDeepCompareEffect)(() => {
|
791
634
|
if (isTooltip && value) {
|
792
|
-
|
793
|
-
dom.addEventListener(
|
794
|
-
if (value && e.target.tagName ===
|
635
|
+
const dom = document.getElementById(uuid);
|
636
|
+
dom.addEventListener("mouseover", (e) => {
|
637
|
+
if (value && e.target.tagName === "INPUT") {
|
795
638
|
setState({
|
796
639
|
open: true
|
797
640
|
});
|
798
641
|
}
|
799
642
|
});
|
800
|
-
dom.addEventListener(
|
801
|
-
if (e.target.tagName ===
|
643
|
+
dom.addEventListener("mouseout", (e) => {
|
644
|
+
if (e.target.tagName === "INPUT") {
|
802
645
|
setState({
|
803
646
|
open: false
|
804
647
|
});
|
805
648
|
}
|
806
649
|
});
|
807
|
-
return
|
808
|
-
dom.removeEventListener(
|
809
|
-
if (value && e.target.tagName ===
|
650
|
+
return () => {
|
651
|
+
dom.removeEventListener("mouseover", (e) => {
|
652
|
+
if (value && e.target.tagName === "INPUT") {
|
810
653
|
setState({
|
811
654
|
open: true
|
812
655
|
});
|
813
656
|
}
|
814
657
|
});
|
815
|
-
dom.removeEventListener(
|
816
|
-
if (e.target.tagName ===
|
658
|
+
dom.removeEventListener("mouseout", (e) => {
|
659
|
+
if (e.target.tagName === "INPUT") {
|
817
660
|
setState({
|
818
661
|
open: false
|
819
662
|
});
|
@@ -822,80 +665,68 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
822
665
|
};
|
823
666
|
}
|
824
667
|
}, [value, isTooltip]);
|
825
|
-
(0,
|
668
|
+
(0, import_ahooks.useDeepCompareEffect)(() => {
|
826
669
|
setState({
|
827
|
-
options: (tableProps
|
670
|
+
options: (tableProps == null ? void 0 : tableProps.dataSource) || []
|
828
671
|
});
|
829
|
-
}, [tableProps
|
830
|
-
|
831
|
-
|
832
|
-
var _formColumns$2, _formColumns$3, _formColumns$3$fieldP;
|
833
|
-
if (!((_formColumns$2 = formColumns[0]) === null || _formColumns$2 === void 0 ? void 0 : _formColumns$2.fieldProps)) {
|
672
|
+
}, [tableProps == null ? void 0 : tableProps.dataSource]);
|
673
|
+
if ((formColumns == null ? void 0 : formColumns.length) === 1 && ((_e = formColumns == null ? void 0 : formColumns[0]) == null ? void 0 : _e.type) === "Input") {
|
674
|
+
if (!((_f = formColumns[0]) == null ? void 0 : _f.fieldProps)) {
|
834
675
|
formColumns[0].fieldProps = {};
|
835
676
|
}
|
836
|
-
if (!(0,
|
837
|
-
formColumns[0].fieldProps.suffix =
|
838
|
-
onClick: handleSearch
|
839
|
-
});
|
677
|
+
if (!(0, import_lodash.isFunction)(formColumns[0].fieldProps) && !((_h = (_g = formColumns == null ? void 0 : formColumns[0]) == null ? void 0 : _g.fieldProps) == null ? void 0 : _h.suffix)) {
|
678
|
+
formColumns[0].fieldProps.suffix = /* @__PURE__ */ import_react.default.createElement(import_icons.SearchOutlined, { onClick: handleSearch });
|
840
679
|
}
|
841
680
|
}
|
842
681
|
if (isView) {
|
843
682
|
if (!value) {
|
844
|
-
return
|
845
|
-
children: viewEmpty
|
846
|
-
});
|
683
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, viewEmpty);
|
847
684
|
}
|
848
|
-
return
|
849
|
-
viewEmpty: viewEmpty,
|
850
|
-
children: "".concat(viewText)
|
851
|
-
});
|
685
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Container.default, { viewEmpty }, `${viewText}`);
|
852
686
|
}
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
ref: fieldRef,
|
862
|
-
children: isTooltip && viewText ? (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
863
|
-
placement: "topLeft",
|
864
|
-
open: open,
|
865
|
-
title: viewText,
|
866
|
-
children: initRender
|
867
|
-
}) : initRender
|
868
|
-
}), (0, _jsxRuntime.jsxs)(_index.ProDrawerForm, (0, _objectSpread5.default)((0, _objectSpread5.default)({
|
687
|
+
const _className = (0, import_classnames.default)({
|
688
|
+
"pro-modal-select": true,
|
689
|
+
[props.className]: props.className,
|
690
|
+
"pro-modal-select-open": open
|
691
|
+
});
|
692
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { id: uuid, className: _className, style, ref: fieldRef }, isTooltip && viewText ? /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { placement: "topLeft", open, title: viewText }, initRender) : initRender), /* @__PURE__ */ import_react.default.createElement(
|
693
|
+
import__.ProDrawerForm,
|
694
|
+
{
|
869
695
|
showType: "Modal",
|
870
|
-
title
|
696
|
+
title,
|
871
697
|
onOk: handleFinish,
|
872
|
-
// @ts-ignore
|
873
698
|
onCancel: handleClose,
|
874
|
-
open
|
875
|
-
|
876
|
-
|
699
|
+
open,
|
700
|
+
...restModalProps
|
701
|
+
},
|
702
|
+
/* @__PURE__ */ import_react.default.createElement(
|
703
|
+
import__.ProForm,
|
704
|
+
{
|
877
705
|
submitOnEnter: true,
|
878
|
-
form
|
706
|
+
form,
|
879
707
|
columns: formColumns,
|
880
708
|
onFinish: handleSearch,
|
881
709
|
confirmLoading: loading,
|
882
|
-
footer: (formColumns
|
883
|
-
}
|
884
|
-
|
710
|
+
footer: (formColumns == null ? void 0 : formColumns.length) > 1
|
711
|
+
}
|
712
|
+
),
|
713
|
+
/* @__PURE__ */ import_react.default.createElement(
|
714
|
+
import__.ProTable,
|
715
|
+
{
|
716
|
+
onRow: (record) => {
|
885
717
|
return {
|
886
|
-
onClick:
|
887
|
-
return handleClickRow(record);
|
888
|
-
}
|
718
|
+
onClick: () => handleClickRow(record)
|
889
719
|
};
|
890
720
|
},
|
891
|
-
rowKey
|
892
|
-
loading
|
721
|
+
rowKey,
|
722
|
+
loading,
|
893
723
|
rowSelection: _rowSelection,
|
894
|
-
columns
|
724
|
+
columns,
|
895
725
|
dataSource: data,
|
896
|
-
pagination: withPagination ? pagination : false
|
897
|
-
|
898
|
-
|
899
|
-
|
726
|
+
pagination: withPagination ? pagination : false,
|
727
|
+
...restTableProps
|
728
|
+
}
|
729
|
+
)
|
730
|
+
));
|
900
731
|
};
|
901
|
-
var
|
732
|
+
var ProModalSelect_default = (0, import_react.forwardRef)(ProModalSelect);
|