@zat-design/sisyphus-react 3.13.19-beta.1 → 3.13.19-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +1 -6344
- package/dist/index.min.js +1 -0
- package/dist/less.esm.css +1 -5768
- package/dist/less.min.js +1 -0
- package/es/FormsProvider/index.js +9 -7
- package/es/ProAction/components/CheckModalContent/index.js +14 -14
- package/es/ProAction/index.js +46 -47
- package/es/ProConfigProvider/index.js +26 -20
- package/es/ProDownload/index.js +66 -73
- package/es/ProDownload/utils.js +26 -23
- package/es/ProDrawerForm/components/ProDrawer/index.js +43 -39
- package/es/ProDrawerForm/components/ProModal/index.js +25 -23
- package/es/ProDrawerForm/components/index.js +2 -2
- package/es/ProDrawerForm/index.js +19 -21
- package/es/ProDrawerForm/utils/index.js +1 -1
- package/es/ProEditLabel/components/RenderProForm.js +30 -26
- package/es/ProEditLabel/index.js +49 -36
- package/es/ProEditLabel/utils/index.js +4 -3
- package/es/ProEditTable/components/ActionButton/index.js +83 -76
- package/es/ProEditTable/components/RcTable/BaseTable.js +24 -24
- package/es/ProEditTable/components/RcTable/DraggableTable.js +34 -41
- package/es/ProEditTable/components/RcTable/VirtualTable.js +4 -3
- package/es/ProEditTable/components/RcTable/index.js +3 -3
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +61 -57
- package/es/ProEditTable/components/RenderField/index.js +151 -145
- package/es/ProEditTable/components/RenderToolbar/index.js +37 -42
- package/es/ProEditTable/components/Summary/index.js +22 -21
- package/es/ProEditTable/components/Validator/index.js +11 -10
- package/es/ProEditTable/components/index.js +5 -5
- package/es/ProEditTable/index.d.ts +1 -1
- package/es/ProEditTable/index.js +170 -173
- package/es/ProEditTable/utils/config.js +42 -46
- package/es/ProEditTable/utils/diffOriginal.js +34 -19
- package/es/ProEditTable/utils/getDefaultProps.js +12 -13
- package/es/ProEditTable/utils/index.js +102 -99
- package/es/ProEditTable/utils/tools.js +88 -91
- package/es/ProEditTable/utils/transform.js +7 -11
- package/es/ProEditTable/utils/useEditTableError.js +22 -13
- package/es/ProEnum/components/Group.js +23 -27
- package/es/ProEnum/components/Tag.js +14 -16
- package/es/ProEnum/hooks/useEnum.js +32 -14
- package/es/ProEnum/hooks/useEnumRequest.js +42 -42
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +17 -19
- package/es/ProEnum/index.js +80 -89
- package/es/ProEnum/utils/eventCenter.js +23 -32
- package/es/ProEnum/utils/frequentEnum.js +16 -4
- package/es/ProEnum/utils/getEnumLabel.js +16 -21
- package/es/ProEnum/utils/index.js +12 -7
- package/es/ProForm/components/Container.js +8 -6
- package/es/ProForm/components/FormFooter/index.js +21 -19
- package/es/ProForm/components/base/Checkbox/index.js +16 -15
- package/es/ProForm/components/base/DatePicker/index.js +23 -20
- package/es/ProForm/components/base/Input/index.js +20 -18
- package/es/ProForm/components/base/InputNumber/index.js +57 -53
- package/es/ProForm/components/base/Radio/index.js +15 -15
- package/es/ProForm/components/base/RangePicker/index.js +24 -29
- package/es/ProForm/components/base/RangePicker/useDateRange.js +3 -3
- package/es/ProForm/components/base/Select/index.js +17 -15
- package/es/ProForm/components/base/Switch/index.js +16 -15
- package/es/ProForm/components/base/SwitchCheckbox/index.js +19 -18
- package/es/ProForm/components/base/TextArea/index.js +18 -17
- package/es/ProForm/components/base/TimePicker/index.js +10 -9
- package/es/ProForm/components/combination/Container/index.js +25 -23
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +80 -92
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +21 -19
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +7 -7
- package/es/ProForm/components/combination/FormList/components/Empty.js +21 -20
- package/es/ProForm/components/combination/FormList/components/LineFields.js +19 -18
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +45 -51
- package/es/ProForm/components/combination/FormList/index.js +43 -51
- package/es/ProForm/components/combination/FormList/utils.js +9 -9
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +8 -6
- package/es/ProForm/components/combination/Group/component/ComRender.js +33 -29
- package/es/ProForm/components/combination/Group/hooks/index.js +49 -47
- package/es/ProForm/components/combination/Group/index.js +38 -37
- package/es/ProForm/components/combination/Group/utils.js +56 -50
- package/es/ProForm/components/combination/ProCascader/index.js +81 -85
- package/es/ProForm/components/combination/ProCascader/utils/index.js +6 -6
- package/es/ProForm/components/combination/ProCombination/index.js +41 -37
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +31 -25
- package/es/ProForm/components/combination/ProModalSelect/index.js +166 -173
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +46 -51
- package/es/ProForm/components/combination/ProRangeLimit/index.js +39 -39
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +3 -3
- package/es/ProForm/components/combination/ProTimeLimit/index.js +43 -40
- package/es/ProForm/components/index.d.ts +1 -0
- package/es/ProForm/components/index.js +40 -35
- package/es/ProForm/components/old/EnumSelect/hooks/useRequestList.js +30 -28
- package/es/ProForm/components/old/EnumSelect/index.js +55 -62
- package/es/ProForm/components/old/InputRange/index.js +17 -16
- package/es/ProForm/components/old/InputWithSuffix/index.js +6 -5
- package/es/ProForm/components/old/ProAddress/index.js +53 -75
- package/es/ProForm/components/old/ProCertNo/index.js +17 -17
- package/es/ProForm/components/old/ProCertValidity/index.js +19 -21
- package/es/ProForm/components/old/ProRangeBox/index.js +25 -24
- package/es/ProForm/components/render/ChangedWrapper.js +34 -33
- package/es/ProForm/components/render/ConfirmWrapper.js +16 -18
- package/es/ProForm/components/render/Render.js +150 -135
- package/es/ProForm/components/render/RenderFields.js +65 -50
- package/es/ProForm/components/render/propsType.js +25 -0
- package/es/ProForm/index.js +83 -70
- package/es/ProForm/propsType.d.ts +1 -1
- package/es/ProForm/propsType.js +5 -1
- package/es/ProForm/utils/diffOriginal.js +30 -16
- package/es/ProForm/utils/getDefaultProps.js +10 -10
- package/es/ProForm/utils/index.js +105 -110
- package/es/ProForm/utils/processDependencies.js +15 -5
- package/es/ProForm/utils/rulesCreator.js +21 -22
- package/es/ProForm/utils/transformNames.js +7 -6
- package/es/ProForm/utils/transformValue.js +16 -13
- package/es/ProForm/utils/useDeepCompareMemo.js +6 -4
- package/es/ProForm/utils/useFieldProps.js +1 -3
- package/es/ProForm/utils/useForm.js +36 -34
- package/es/ProForm/utils/useRules.js +28 -31
- package/es/ProForm/utils/useShouldUpdate.js +83 -86
- package/es/ProForm/utils/useWatch.js +36 -14
- package/es/ProForm/utils/valueType.js +51 -52
- package/es/ProIcon/config/index.js +2 -0
- package/es/ProIcon/index.js +53 -49
- package/es/ProIcon/utils/index.js +8 -9
- package/es/ProLayout/components/Layout/Header/index.js +13 -11
- package/es/ProLayout/components/Layout/Icon/Icon.js +7 -7
- package/es/ProLayout/components/Layout/Icon/index.js +1 -1
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +42 -40
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +51 -52
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +10 -9
- package/es/ProLayout/components/Layout/Menu/index.js +20 -18
- package/es/ProLayout/components/Layout/Notice/index.js +12 -11
- package/es/ProLayout/components/Layout/index.js +4 -4
- package/es/ProLayout/components/ProCollapse/index.js +35 -32
- package/es/ProLayout/components/ProFooter/index.js +13 -15
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +9 -9
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +8 -7
- package/es/ProLayout/components/ProHeader/components/index.js +2 -2
- package/es/ProLayout/components/ProHeader/index.js +129 -118
- package/es/ProLayout/components/ProHeader/utils/index.js +1 -1
- package/es/ProLayout/components/index.js +3 -3
- package/es/ProLayout/index.d.ts +1 -1
- package/es/ProLayout/index.js +28 -25
- package/es/ProLayout/utils/index.js +37 -35
- package/es/ProSelect/components/AdaptiveTooltip.js +10 -11
- package/es/ProSelect/index.js +87 -99
- package/es/ProSelect/utils/index.js +27 -33
- package/es/ProStep/components/Anchor/index.d.ts +1 -0
- package/es/ProStep/components/Anchor/index.js +26 -25
- package/es/ProStep/components/Item/index.d.ts +1 -0
- package/es/ProStep/components/Item/index.js +26 -22
- package/es/ProStep/components/Listener/index.js +11 -15
- package/es/ProStep/components/Step/index.js +24 -25
- package/es/ProStep/index.js +51 -53
- package/es/ProStep/utils/index.js +13 -12
- package/es/ProStepTab/index.js +59 -37
- package/es/ProTable/components/FormatColumn/index.js +106 -110
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +7 -9
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +36 -50
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +24 -24
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +8 -10
- package/es/ProTable/components/RcTable/index.js +2 -2
- package/es/ProTable/components/RenderColumn/index.js +51 -51
- package/es/ProTable/components/RenderEmptyText/index.js +8 -7
- package/es/ProTable/components/RenderFooter/index.js +3 -3
- package/es/ProTable/components/RenderSummary/index.js +13 -13
- package/es/ProTable/components/RenderTableHeader/index.js +16 -14
- package/es/ProTable/components/RenderTabs/index.js +28 -33
- package/es/ProTable/components/TableResizable/index.js +17 -16
- package/es/ProTable/components/TooltipTitle/index.js +7 -6
- package/es/ProTable/components/index.js +11 -6
- package/es/ProTable/hooks/useAntdTable.js +106 -119
- package/es/ProTable/index.js +158 -176
- package/es/ProTable/utils/index.js +25 -21
- package/es/ProTabs/components/Card/index.js +15 -14
- package/es/ProTabs/components/index.js +1 -1
- package/es/ProTabs/index.js +24 -25
- package/es/ProThemeTools/component/ProTools/index.js +69 -68
- package/es/ProThemeTools/component/index.js +1 -1
- package/es/ProThemeTools/index.js +47 -33
- package/es/ProThemeTools/utils/index.js +20 -17
- package/es/ProTooltip/index.js +44 -46
- package/es/ProTree/components/AdaptiveTooltip.js +5 -7
- package/es/ProTree/components/CloseIcon.js +5 -5
- package/es/ProTree/components/List.js +22 -24
- package/es/ProTree/components/ProTree.js +84 -102
- package/es/ProTree/components/ProTreeSelect/index.js +128 -119
- package/es/ProTree/components/SearchTitle.js +10 -9
- package/es/ProTree/components/Tree.js +57 -58
- package/es/ProTree/components/index.js +4 -4
- package/es/ProTree/index.js +6 -6
- package/es/ProTree/utils.js +29 -22
- package/es/ProTreeModal/components/Cascader.js +31 -33
- package/es/ProTreeModal/components/CloseIcon.js +5 -5
- package/es/ProTreeModal/components/List.js +74 -93
- package/es/ProTreeModal/components/SearchTitle.js +5 -4
- package/es/ProTreeModal/components/SortableItem.js +14 -14
- package/es/ProTreeModal/components/Tree.js +49 -53
- package/es/ProTreeModal/components/Trigger.js +29 -28
- package/es/ProTreeModal/components/index.js +6 -6
- package/es/ProTreeModal/index.js +166 -206
- package/es/ProTreeModal/utils.js +37 -33
- package/es/ProUpload/components/ButtonRender.js +33 -36
- package/es/ProUpload/components/DragRender.js +54 -51
- package/es/ProUpload/components/DraggableUploadListItem.js +5 -4
- package/es/ProUpload/components/Example.js +13 -12
- package/es/ProUpload/components/FileItem.js +63 -58
- package/es/ProUpload/components/ImageRender.js +98 -100
- package/es/ProUpload/index.js +75 -82
- package/es/ProUpload/uitls.js +3 -3
- package/es/ProUtils/utils/index.js +10 -14
- package/es/ProViewer/index.js +29 -25
- package/es/ProViewer/propsType.js +0 -1
- package/es/ProWaterMark/index.js +5 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +38 -29
- package/es/locale/index.js +7 -4
- package/es/old/ProCertValidity/index.js +19 -21
- package/es/old/ProEditableTable/index.js +156 -156
- package/es/old/ProEditableTable/utils.js +61 -63
- package/es/tokens.js +1 -0
- package/es/utils/index.js +12 -12
- package/lib/FormsProvider/index.js +11 -7
- package/lib/ProAction/components/CheckModalContent/index.js +11 -13
- package/lib/ProAction/index.js +40 -43
- package/lib/ProConfigProvider/index.js +24 -17
- package/lib/ProDownload/index.js +65 -71
- package/lib/ProDownload/utils.js +25 -22
- package/lib/ProDrawerForm/components/ProDrawer/index.js +39 -38
- package/lib/ProDrawerForm/components/ProModal/index.js +23 -22
- package/lib/ProDrawerForm/index.js +18 -18
- package/lib/ProDrawerForm/utils/index.js +3 -2
- package/lib/ProEditLabel/components/RenderProForm.js +26 -24
- package/lib/ProEditLabel/index.js +46 -35
- package/lib/ProEditLabel/utils/index.js +6 -5
- package/lib/ProEditTable/components/ActionButton/index.js +79 -74
- package/lib/ProEditTable/components/RcTable/BaseTable.js +21 -23
- package/lib/ProEditTable/components/RcTable/DraggableTable.js +32 -40
- package/lib/ProEditTable/components/RcTable/VirtualTable.js +3 -3
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +62 -59
- package/lib/ProEditTable/components/RenderField/index.js +137 -132
- package/lib/ProEditTable/components/RenderToolbar/index.js +34 -41
- package/lib/ProEditTable/components/Summary/index.js +20 -20
- package/lib/ProEditTable/components/Validator/index.js +10 -10
- package/lib/ProEditTable/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +159 -164
- package/lib/ProEditTable/utils/config.js +40 -44
- package/lib/ProEditTable/utils/diffOriginal.js +36 -21
- package/lib/ProEditTable/utils/getDefaultProps.js +14 -15
- package/lib/ProEditTable/utils/index.js +97 -97
- package/lib/ProEditTable/utils/tools.js +96 -91
- package/lib/ProEditTable/utils/transform.js +7 -11
- package/lib/ProEditTable/utils/useEditTableError.js +22 -13
- package/lib/ProEnum/components/Group.js +23 -27
- package/lib/ProEnum/components/Tag.js +14 -16
- package/lib/ProEnum/hooks/useEnum.js +30 -12
- package/lib/ProEnum/hooks/useEnumRequest.js +39 -39
- package/lib/ProEnum/hooks/useFrequentEnumRequest.js +16 -18
- package/lib/ProEnum/index.js +68 -78
- package/lib/ProEnum/utils/eventCenter.js +23 -32
- package/lib/ProEnum/utils/frequentEnum.js +14 -3
- package/lib/ProEnum/utils/getEnumLabel.js +15 -21
- package/lib/ProEnum/utils/index.js +12 -7
- package/lib/ProForm/components/Container.js +7 -5
- package/lib/ProForm/components/FormFooter/index.js +19 -17
- package/lib/ProForm/components/base/Checkbox/index.js +14 -13
- package/lib/ProForm/components/base/DatePicker/index.js +20 -17
- package/lib/ProForm/components/base/Input/index.js +15 -15
- package/lib/ProForm/components/base/InputNumber/index.js +51 -48
- package/lib/ProForm/components/base/Radio/index.js +13 -13
- package/lib/ProForm/components/base/RangePicker/index.js +19 -22
- package/lib/ProForm/components/base/RangePicker/useDateRange.js +5 -4
- package/lib/ProForm/components/base/Select/index.js +14 -12
- package/lib/ProForm/components/base/Switch/index.js +11 -11
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +16 -15
- package/lib/ProForm/components/base/TextArea/index.js +14 -13
- package/lib/ProForm/components/base/TimePicker/index.js +6 -5
- package/lib/ProForm/components/combination/Container/index.js +22 -21
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +77 -89
- package/lib/ProForm/components/combination/FormList/components/BlockFields.js +17 -15
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +7 -7
- package/lib/ProForm/components/combination/FormList/components/Empty.js +17 -18
- package/lib/ProForm/components/combination/FormList/components/LineFields.js +14 -14
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +43 -48
- package/lib/ProForm/components/combination/FormList/index.js +35 -43
- package/lib/ProForm/components/combination/FormList/utils.js +11 -10
- package/lib/ProForm/components/combination/Group/component/AddonWrapper/index.js +7 -5
- package/lib/ProForm/components/combination/Group/component/ComRender.js +30 -28
- package/lib/ProForm/components/combination/Group/hooks/index.js +48 -45
- package/lib/ProForm/components/combination/Group/index.js +34 -35
- package/lib/ProForm/components/combination/Group/utils.js +62 -50
- package/lib/ProForm/components/combination/ProCascader/index.js +75 -80
- package/lib/ProForm/components/combination/ProCascader/utils/index.js +8 -7
- package/lib/ProForm/components/combination/ProCombination/index.js +35 -31
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +30 -24
- package/lib/ProForm/components/combination/ProModalSelect/index.js +171 -180
- package/lib/ProForm/components/combination/ProModalSelect/utils/index.js +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/index.js +42 -48
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +35 -35
- package/lib/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +3 -3
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +37 -34
- package/lib/ProForm/components/index.d.ts +1 -0
- package/lib/ProForm/components/old/EnumSelect/hooks/useRequestList.js +35 -33
- package/lib/ProForm/components/old/EnumSelect/index.js +50 -58
- package/lib/ProForm/components/old/InputRange/index.js +16 -16
- package/lib/ProForm/components/old/InputWithSuffix/index.js +4 -4
- package/lib/ProForm/components/old/ProAddress/index.js +53 -75
- package/lib/ProForm/components/old/ProCertNo/index.js +16 -17
- package/lib/ProForm/components/old/ProCertValidity/index.js +17 -18
- package/lib/ProForm/components/old/ProRangeBox/index.js +24 -24
- package/lib/ProForm/components/render/ChangedWrapper.js +35 -35
- package/lib/ProForm/components/render/ConfirmWrapper.js +14 -17
- package/lib/ProForm/components/render/Render.js +138 -125
- package/lib/ProForm/components/render/RenderFields.js +57 -43
- package/lib/ProForm/components/render/propsType.js +26 -1
- package/lib/ProForm/index.js +74 -61
- package/lib/ProForm/propsType.d.ts +1 -1
- package/lib/ProForm/propsType.js +5 -1
- package/lib/ProForm/utils/diffOriginal.js +30 -17
- package/lib/ProForm/utils/getDefaultProps.js +12 -12
- package/lib/ProForm/utils/index.js +127 -106
- package/lib/ProForm/utils/processDependencies.js +15 -6
- package/lib/ProForm/utils/rulesCreator.js +21 -21
- package/lib/ProForm/utils/transformNames.js +6 -6
- package/lib/ProForm/utils/transformValue.js +14 -11
- package/lib/ProForm/utils/useDeepCompareMemo.js +7 -6
- package/lib/ProForm/utils/useFieldProps.js +2 -3
- package/lib/ProForm/utils/useForm.js +33 -31
- package/lib/ProForm/utils/useRules.js +25 -28
- package/lib/ProForm/utils/useShouldUpdate.js +82 -85
- package/lib/ProForm/utils/useWatch.js +36 -14
- package/lib/ProForm/utils/valueType.js +52 -52
- package/lib/ProIcon/config/index.js +2 -0
- package/lib/ProIcon/index.js +47 -44
- package/lib/ProIcon/utils/index.js +10 -8
- package/lib/ProLayout/components/Layout/Header/index.js +10 -10
- package/lib/ProLayout/components/Layout/Icon/Icon.js +8 -7
- package/lib/ProLayout/components/Layout/Menu/FoldMenu/index.js +37 -36
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +49 -52
- package/lib/ProLayout/components/Layout/Menu/SideMenu/index.js +8 -8
- package/lib/ProLayout/components/Layout/Menu/index.js +17 -16
- package/lib/ProLayout/components/Layout/Notice/index.js +8 -8
- package/lib/ProLayout/components/ProCollapse/index.js +32 -30
- package/lib/ProLayout/components/ProFooter/index.js +14 -16
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +7 -7
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/index.js +6 -7
- package/lib/ProLayout/components/ProHeader/index.js +131 -120
- package/lib/ProLayout/components/ProHeader/utils/index.js +3 -2
- package/lib/ProLayout/index.d.ts +1 -1
- package/lib/ProLayout/index.js +22 -21
- package/lib/ProLayout/utils/index.js +42 -33
- package/lib/ProSelect/components/AdaptiveTooltip.js +9 -11
- package/lib/ProSelect/index.js +82 -93
- package/lib/ProSelect/utils/index.js +29 -34
- package/lib/ProStep/components/Anchor/index.d.ts +1 -0
- package/lib/ProStep/components/Anchor/index.js +25 -24
- package/lib/ProStep/components/Item/index.d.ts +1 -0
- package/lib/ProStep/components/Item/index.js +24 -20
- package/lib/ProStep/components/Listener/index.js +9 -13
- package/lib/ProStep/components/Step/index.js +20 -21
- package/lib/ProStep/index.js +45 -49
- package/lib/ProStep/utils/index.js +16 -12
- package/lib/ProStepTab/index.js +60 -38
- package/lib/ProTable/components/FormatColumn/index.js +100 -104
- package/lib/ProTable/components/RcTable/components/BaseTable/index.js +5 -7
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +34 -48
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +25 -23
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.js +5 -7
- package/lib/ProTable/components/RenderColumn/index.js +46 -48
- package/lib/ProTable/components/RenderEmptyText/index.js +6 -6
- package/lib/ProTable/components/RenderFooter/index.js +3 -3
- package/lib/ProTable/components/RenderSummary/index.js +11 -12
- package/lib/ProTable/components/RenderTableHeader/index.js +14 -13
- package/lib/ProTable/components/RenderTabs/index.js +27 -32
- package/lib/ProTable/components/TableResizable/index.js +16 -15
- package/lib/ProTable/components/TooltipTitle/index.js +5 -5
- package/lib/ProTable/hooks/useAntdTable.js +103 -116
- package/lib/ProTable/index.js +149 -169
- package/lib/ProTable/utils/index.js +33 -22
- package/lib/ProTabs/components/Card/index.js +14 -14
- package/lib/ProTabs/index.js +24 -24
- package/lib/ProThemeTools/component/ProTools/index.js +66 -65
- package/lib/ProThemeTools/index.js +43 -29
- package/lib/ProThemeTools/utils/index.js +25 -18
- package/lib/ProTooltip/index.js +44 -46
- package/lib/ProTree/components/AdaptiveTooltip.js +5 -7
- package/lib/ProTree/components/CloseIcon.js +5 -5
- package/lib/ProTree/components/List.js +18 -22
- package/lib/ProTree/components/ProTree.js +77 -96
- package/lib/ProTree/components/ProTreeSelect/index.js +126 -116
- package/lib/ProTree/components/SearchTitle.js +8 -8
- package/lib/ProTree/components/Tree.js +53 -55
- package/lib/ProTree/index.js +4 -4
- package/lib/ProTree/utils.js +34 -25
- package/lib/ProTreeModal/components/Cascader.js +28 -32
- package/lib/ProTreeModal/components/CloseIcon.js +5 -5
- package/lib/ProTreeModal/components/List.js +69 -89
- package/lib/ProTreeModal/components/SearchTitle.js +4 -4
- package/lib/ProTreeModal/components/SortableItem.js +11 -12
- package/lib/ProTreeModal/components/Tree.js +44 -49
- package/lib/ProTreeModal/components/Trigger.js +26 -26
- package/lib/ProTreeModal/index.js +157 -199
- package/lib/ProTreeModal/utils.js +43 -35
- package/lib/ProUpload/components/ButtonRender.js +29 -33
- package/lib/ProUpload/components/DragRender.js +50 -48
- package/lib/ProUpload/components/DraggableUploadListItem.js +7 -5
- package/lib/ProUpload/components/Example.js +13 -11
- package/lib/ProUpload/components/FileItem.js +58 -50
- package/lib/ProUpload/components/ImageRender.js +89 -93
- package/lib/ProUpload/index.js +68 -76
- package/lib/ProUpload/uitls.js +5 -3
- package/lib/ProUtils/utils/index.js +10 -14
- package/lib/ProViewer/index.js +26 -24
- package/lib/ProViewer/propsType.js +1 -5
- package/lib/ProWaterMark/index.js +5 -4
- package/lib/index.d.ts +1 -1
- package/lib/locale/index.js +6 -2
- package/lib/old/ProCertValidity/index.js +17 -18
- package/lib/old/ProEditableTable/index.js +153 -156
- package/lib/old/ProEditableTable/utils.js +61 -62
- package/lib/tokens.js +1 -0
- package/lib/utils/index.js +16 -13
- package/package.json +8 -8
- package/dist/index.esm.js +0 -3
- package/dist/less.esm.js +0 -3
package/es/ProEnum/index.js
CHANGED
@@ -6,34 +6,28 @@ import "antd/es/radio/style";
|
|
6
6
|
import _Radio from "antd/es/radio";
|
7
7
|
import "antd/es/message/style";
|
8
8
|
import _message from "antd/es/message";
|
9
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
10
9
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
11
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
12
10
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
13
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
14
|
-
import _isNumber from "lodash/isNumber";
|
15
|
-
import _omit from "lodash/omit";
|
16
|
-
import _isArray from "lodash/isArray";
|
17
|
-
import _isString from "lodash/isString";
|
18
|
-
import _isFunction from "lodash/isFunction";
|
19
|
-
import _cloneDeep from "lodash/cloneDeep";
|
20
12
|
var _excluded = ["code", "type", "dataSource", "useRequest", "value", "component", "onChange", "transformResponse", "otherProps", "isView"],
|
21
13
|
_excluded2 = ["fieldNames", "clear", "storage", "cacheKey", "showCodeName", "useRequest", "transformResponse"];
|
22
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
23
14
|
import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
|
24
15
|
import React, { useState, useEffect, useMemo } from 'react';
|
25
|
-
import
|
26
|
-
import
|
27
|
-
import
|
28
|
-
import
|
29
|
-
import
|
30
|
-
import
|
31
|
-
import
|
32
|
-
import
|
33
|
-
import
|
34
|
-
import
|
35
|
-
import
|
36
|
-
|
16
|
+
import { cloneDeep, isFunction, isString, isArray, omit, isNumber } from 'lodash';
|
17
|
+
import ProSelect from "../ProSelect";
|
18
|
+
import { useProConfig } from "../ProConfigProvider";
|
19
|
+
import ProEnumTag from "./components/Tag";
|
20
|
+
import ProEnumGroup from "./components/Group";
|
21
|
+
import Container from "../ProForm/components/Container";
|
22
|
+
import { isObject, getEnumData } from "./utils";
|
23
|
+
import getEnumLabel from "./utils/getEnumLabel";
|
24
|
+
import useEnum from "./hooks/useEnum";
|
25
|
+
import locale from "../locale";
|
26
|
+
import "./style/index.less";
|
27
|
+
import { useFieldProps } from "../ProForm/utils/useFieldProps";
|
28
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
29
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
30
|
+
var ProEnum = props => {
|
37
31
|
var _otherProps$isView, _enumProps$showCodeNa;
|
38
32
|
var code = props.code,
|
39
33
|
_props$type = props.type,
|
@@ -64,6 +58,7 @@ var ProEnum = function ProEnum(props) {
|
|
64
58
|
configUseRequest = _ref2.useRequest,
|
65
59
|
configTransformResponse = _ref2.transformResponse,
|
66
60
|
resProps = _objectWithoutProperties(_ref2, _excluded2);
|
61
|
+
|
67
62
|
// 优先使用props中的配置,如果没有则使用全局配置
|
68
63
|
var finalUseRequest = useRequest || configUseRequest;
|
69
64
|
var finalTransformResponse = transformResponse || configTransformResponse;
|
@@ -76,27 +71,28 @@ var ProEnum = function ProEnum(props) {
|
|
76
71
|
_useState2 = _slicedToArray(_useState, 2),
|
77
72
|
dataList = _useState2[0],
|
78
73
|
setData = _useState2[1];
|
79
|
-
useEffect(
|
80
|
-
(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) && setData(
|
74
|
+
useEffect(() => {
|
75
|
+
(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) && setData([...dataSource]);
|
81
76
|
}, [dataSource]);
|
82
77
|
if (fieldNames && Object.keys(fieldNames).length) {
|
83
|
-
if (fieldNames
|
84
|
-
if (fieldNames
|
78
|
+
if (fieldNames !== null && fieldNames !== void 0 && fieldNames.label) label = fieldNames.label;
|
79
|
+
if (fieldNames !== null && fieldNames !== void 0 && fieldNames.value) fieldValue = fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value;
|
85
80
|
}
|
86
81
|
if (props.fieldNames && Object.keys(props.fieldNames).length) {
|
87
82
|
var _props$fieldNames, _props$fieldNames2, _props$fieldNames3, _props$fieldNames4;
|
88
|
-
if (props
|
89
|
-
if (props
|
83
|
+
if (props !== null && props !== void 0 && (_props$fieldNames = props.fieldNames) !== null && _props$fieldNames !== void 0 && _props$fieldNames.label) label = (_props$fieldNames2 = props.fieldNames) === null || _props$fieldNames2 === void 0 ? void 0 : _props$fieldNames2.label;
|
84
|
+
if (props !== null && props !== void 0 && (_props$fieldNames3 = props.fieldNames) !== null && _props$fieldNames3 !== void 0 && _props$fieldNames3.value) fieldValue = (_props$fieldNames4 = props.fieldNames) === null || _props$fieldNames4 === void 0 ? void 0 : _props$fieldNames4.value;
|
90
85
|
}
|
91
86
|
if (clear) {
|
92
87
|
label = 'label';
|
93
88
|
fieldValue = 'value';
|
94
89
|
}
|
90
|
+
|
95
91
|
// 这种时候优先级最高、完全走自定义
|
96
|
-
if (
|
92
|
+
if (finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service && props.fieldNames) {
|
97
93
|
var _props$fieldNames5, _props$fieldNames6;
|
98
|
-
if ((_props$fieldNames5 = props.fieldNames)
|
99
|
-
if ((_props$fieldNames6 = props.fieldNames)
|
94
|
+
if ((_props$fieldNames5 = props.fieldNames) !== null && _props$fieldNames5 !== void 0 && _props$fieldNames5.label) label = props.fieldNames.label;
|
95
|
+
if ((_props$fieldNames6 = props.fieldNames) !== null && _props$fieldNames6 !== void 0 && _props$fieldNames6.value) fieldValue = props.fieldNames.value;
|
100
96
|
}
|
101
97
|
var _useProConfig = useProConfig('ProEnum'),
|
102
98
|
_useProConfig$dics = _useProConfig.dics,
|
@@ -105,10 +101,10 @@ var ProEnum = function ProEnum(props) {
|
|
105
101
|
manual: true,
|
106
102
|
cacheTime: -1
|
107
103
|
}, finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options), {}, {
|
108
|
-
onSuccess:
|
104
|
+
onSuccess: res => {
|
109
105
|
if (finalTransformResponse && typeof finalTransformResponse === 'function') {
|
110
106
|
var responseData = finalTransformResponse(res);
|
111
|
-
if (
|
107
|
+
if (typeof responseData !== 'object') {
|
112
108
|
var _locale$ProEnum;
|
113
109
|
return _message.error((_locale$ProEnum = locale.ProEnum) === null || _locale$ProEnum === void 0 ? void 0 : _locale$ProEnum.errorMessage);
|
114
110
|
}
|
@@ -119,14 +115,14 @@ var ProEnum = function ProEnum(props) {
|
|
119
115
|
msg = res.message,
|
120
116
|
data = res.data;
|
121
117
|
if (status === 200) {
|
122
|
-
if (
|
118
|
+
if (typeof data !== 'object') {
|
123
119
|
var _locale$ProEnum2;
|
124
120
|
return _message.error((_locale$ProEnum2 = locale.ProEnum) === null || _locale$ProEnum2 === void 0 ? void 0 : _locale$ProEnum2.errorMessage);
|
125
121
|
}
|
126
122
|
if (Array.isArray(data)) {
|
127
|
-
setData(
|
123
|
+
setData([...data]);
|
128
124
|
}
|
129
|
-
if (isObject(data) &&
|
125
|
+
if (isObject(data) && isString(code)) {
|
130
126
|
setData(data[code]);
|
131
127
|
}
|
132
128
|
} else {
|
@@ -136,35 +132,36 @@ var ProEnum = function ProEnum(props) {
|
|
136
132
|
}
|
137
133
|
})),
|
138
134
|
run = _useRequestFunc.run;
|
135
|
+
|
139
136
|
// 自定义请求
|
140
|
-
useDeepCompareEffect(
|
137
|
+
useDeepCompareEffect(() => {
|
141
138
|
var _ref3 = (finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options) || {},
|
142
139
|
defaultParams = _ref3.defaultParams;
|
143
140
|
var params = Array.isArray(defaultParams) ? defaultParams === null || defaultParams === void 0 ? void 0 : defaultParams[0] : defaultParams || {};
|
144
141
|
// 如果缓存数据存在,则不请求
|
145
|
-
if (
|
142
|
+
if (finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service && (!Object.keys(cacheData).length || cacheData !== null && cacheData !== void 0 && cacheData.data && !Object.keys(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data).length)) {
|
146
143
|
run(params);
|
147
144
|
}
|
148
145
|
}, [finalUseRequest === null || finalUseRequest === void 0 ? void 0 : finalUseRequest.options]);
|
149
|
-
var enumLists = useMemo(
|
146
|
+
var enumLists = useMemo(() => {
|
150
147
|
var lists = [];
|
151
|
-
if (
|
148
|
+
if (isString(code)) {
|
152
149
|
lists = (dics === null || dics === void 0 ? void 0 : dics[code]) || [];
|
153
150
|
}
|
154
|
-
if (
|
155
|
-
code.forEach(
|
156
|
-
|
157
|
-
_isArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]) && (_lists = lists).push.apply(_lists, _toConsumableArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]));
|
151
|
+
if (isArray(code)) {
|
152
|
+
code.forEach(enumCode => {
|
153
|
+
isArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]) && lists.push(...(dics === null || dics === void 0 ? void 0 : dics[enumCode]));
|
158
154
|
});
|
159
155
|
}
|
160
156
|
return lists;
|
161
157
|
}, [dics, code]);
|
162
|
-
var renderComponent =
|
158
|
+
var renderComponent = () => {
|
163
159
|
var list = [];
|
160
|
+
|
164
161
|
// 优先使用组件内部自己传入的数据源或者请求得到的数据
|
165
|
-
list =
|
162
|
+
list = cloneDeep(dataList && dataList.length ? dataList : enumLists);
|
166
163
|
// 对数据进行一系列的过滤等操作
|
167
|
-
if (!(finalUseRequest
|
164
|
+
if (!(finalUseRequest !== null && finalUseRequest !== void 0 && finalUseRequest.service) && finalTransformResponse) {
|
168
165
|
list = finalTransformResponse(list);
|
169
166
|
if (!Array.isArray(list)) {
|
170
167
|
var _locale$ProEnum3;
|
@@ -172,12 +169,12 @@ var ProEnum = function ProEnum(props) {
|
|
172
169
|
list = [];
|
173
170
|
}
|
174
171
|
}
|
175
|
-
if (/*#__PURE__*/React.isValidElement(component)) {
|
172
|
+
if ( /*#__PURE__*/React.isValidElement(component)) {
|
176
173
|
var Component = component;
|
177
|
-
return _jsx(Component, _objectSpread(_objectSpread({}, enumProps), {}, {
|
174
|
+
return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, enumProps), {}, {
|
178
175
|
dataSource: list,
|
179
176
|
fieldNames: {
|
180
|
-
label
|
177
|
+
label,
|
181
178
|
value: fieldValue
|
182
179
|
},
|
183
180
|
value: value,
|
@@ -186,44 +183,40 @@ var ProEnum = function ProEnum(props) {
|
|
186
183
|
}
|
187
184
|
switch (type) {
|
188
185
|
case 'ProSelect':
|
189
|
-
return _jsx(ProSelect, _objectSpread(_objectSpread({}, enumProps), {}, {
|
186
|
+
return /*#__PURE__*/_jsx(ProSelect, _objectSpread(_objectSpread({}, enumProps), {}, {
|
190
187
|
otherProps: otherProps,
|
191
188
|
dataSource: list,
|
192
189
|
fieldNames: {
|
193
|
-
label
|
190
|
+
label,
|
194
191
|
value: fieldValue
|
195
192
|
},
|
196
193
|
value: value,
|
197
194
|
onChange: onChange
|
198
195
|
}));
|
199
196
|
case 'Radio':
|
200
|
-
return _jsx(_Radio.Group, _objectSpread(_objectSpread({},
|
197
|
+
return /*#__PURE__*/_jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames', 'showCodeName'])), {}, {
|
201
198
|
options: list,
|
202
199
|
value: value,
|
203
200
|
onChange: onChange,
|
204
|
-
children: list.map(
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
}, item[fieldValue]);
|
210
|
-
})
|
201
|
+
children: list.map(item => /*#__PURE__*/_jsx(_Radio, {
|
202
|
+
value: item[fieldValue],
|
203
|
+
disabled: !!item.disabled,
|
204
|
+
children: item[label]
|
205
|
+
}, item[fieldValue]))
|
211
206
|
}));
|
212
207
|
case 'Checkbox':
|
213
|
-
return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({},
|
208
|
+
return /*#__PURE__*/_jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames', 'showCodeName'])), {}, {
|
214
209
|
options: list,
|
215
210
|
value: value,
|
216
211
|
onChange: onChange,
|
217
|
-
children: list.map(
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
}, item[fieldValue]);
|
223
|
-
})
|
212
|
+
children: list.map(item => /*#__PURE__*/_jsx(_Checkbox, {
|
213
|
+
value: item[fieldValue],
|
214
|
+
disabled: !!item.disabled,
|
215
|
+
children: item[label]
|
216
|
+
}, item[fieldValue]))
|
224
217
|
}));
|
225
218
|
case 'Tag':
|
226
|
-
return _jsx(ProEnumTag, {
|
219
|
+
return /*#__PURE__*/_jsx(ProEnumTag, {
|
227
220
|
id: enumProps.id,
|
228
221
|
value: value,
|
229
222
|
onChange: onChange,
|
@@ -232,7 +225,7 @@ var ProEnum = function ProEnum(props) {
|
|
232
225
|
dataSource: list
|
233
226
|
});
|
234
227
|
case 'Group':
|
235
|
-
return _jsx(ProEnumGroup, _objectSpread(_objectSpread({},
|
228
|
+
return /*#__PURE__*/_jsx(ProEnumGroup, _objectSpread(_objectSpread({}, omit(enumProps, ['showCodeName'])), {}, {
|
236
229
|
value: value,
|
237
230
|
onChange: onChange,
|
238
231
|
fieldLabel: label,
|
@@ -245,15 +238,15 @@ var ProEnum = function ProEnum(props) {
|
|
245
238
|
};
|
246
239
|
if (!code && !dataSource && !useRequest) {
|
247
240
|
var _locale$ProEnum4;
|
248
|
-
_message.error(
|
241
|
+
_message.error(`${otherProps === null || otherProps === void 0 ? void 0 : otherProps.label}-${otherProps === null || otherProps === void 0 ? void 0 : otherProps.name}-${locale === null || locale === void 0 || (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType}`);
|
249
242
|
}
|
250
|
-
var transToLabel =
|
243
|
+
var transToLabel = value => {
|
251
244
|
var list = dataList && dataList.length ? dataList : enumLists;
|
252
245
|
if (!Array.isArray(list) || !list.length) {
|
253
246
|
return viewEmpty;
|
254
247
|
}
|
255
|
-
var labelList = value.map(
|
256
|
-
var option = list.find(
|
248
|
+
var labelList = value.map(v => {
|
249
|
+
var option = list.find(item => {
|
257
250
|
if (enumProps.labelInValue) {
|
258
251
|
return item[fieldValue] === (v === null || v === void 0 ? void 0 : v[fieldValue]);
|
259
252
|
}
|
@@ -262,49 +255,47 @@ var ProEnum = function ProEnum(props) {
|
|
262
255
|
if (!option) {
|
263
256
|
return '';
|
264
257
|
}
|
265
|
-
return enumProps.showCodeName ?
|
258
|
+
return enumProps.showCodeName ? `${option === null || option === void 0 ? void 0 : option[fieldValue]}-${option === null || option === void 0 ? void 0 : option[label]}` : option === null || option === void 0 ? void 0 : option[label];
|
266
259
|
});
|
267
|
-
var record = value.map(
|
268
|
-
return list.find(
|
260
|
+
var record = value.map(v => {
|
261
|
+
return list.find(item => {
|
269
262
|
return item[fieldValue] === v;
|
270
263
|
});
|
271
264
|
});
|
272
265
|
// 自定义option时,默认取optionRender的值
|
273
|
-
var _optionRender =
|
266
|
+
var _optionRender = () => {
|
274
267
|
if (!record.length) {
|
275
268
|
return viewEmpty;
|
276
269
|
}
|
277
270
|
var arr = [];
|
278
|
-
record.forEach(
|
271
|
+
record.forEach(item => {
|
279
272
|
arr.push(props.optionRender(item));
|
280
273
|
});
|
281
|
-
return _jsx(_Space, {
|
274
|
+
return /*#__PURE__*/_jsx(_Space, {
|
282
275
|
direction: "vertical",
|
283
276
|
size: 4,
|
284
|
-
children: arr.map(
|
285
|
-
|
286
|
-
|
287
|
-
}, item);
|
288
|
-
})
|
277
|
+
children: arr.map(item => /*#__PURE__*/_jsx(React.Fragment, {
|
278
|
+
children: item
|
279
|
+
}, item))
|
289
280
|
});
|
290
281
|
};
|
291
|
-
return
|
282
|
+
return isFunction(props.optionRender) && record.length ? _optionRender() : labelList === null || labelList === void 0 ? void 0 : labelList.join(',');
|
292
283
|
};
|
293
284
|
if (_isView) {
|
294
285
|
var __value = value || _defalutValue;
|
295
286
|
if (Array.isArray(__value)) {
|
296
|
-
return _jsx(Container, {
|
287
|
+
return /*#__PURE__*/_jsx(Container, {
|
297
288
|
tooltip: true,
|
298
289
|
viewEmpty: viewEmpty,
|
299
290
|
children: transToLabel(__value)
|
300
291
|
});
|
301
292
|
}
|
302
|
-
return _jsx(Container, {
|
293
|
+
return /*#__PURE__*/_jsx(Container, {
|
303
294
|
viewEmpty: viewEmpty,
|
304
|
-
children: __value ||
|
295
|
+
children: __value || isNumber(__value) ? transToLabel([__value]) : null
|
305
296
|
});
|
306
297
|
}
|
307
|
-
return _jsx(_Fragment, {
|
298
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
308
299
|
children: renderComponent()
|
309
300
|
});
|
310
301
|
};
|
@@ -1,38 +1,29 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
_classCallCheck(this, SimpleEventCenter);
|
7
|
-
this.events = void 0;
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
+
import { isFunction } from 'lodash';
|
3
|
+
class SimpleEventCenter {
|
4
|
+
constructor() {
|
5
|
+
_defineProperty(this, "events", void 0);
|
8
6
|
this.events = new Map();
|
9
7
|
}
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
if (!this.events.has(eventName)) {
|
14
|
-
this.events.set(eventName, []);
|
15
|
-
}
|
16
|
-
this.events.get(eventName).push(callback);
|
8
|
+
subscribe(eventName, callback) {
|
9
|
+
if (!this.events.has(eventName)) {
|
10
|
+
this.events.set(eventName, []);
|
17
11
|
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
12
|
+
this.events.get(eventName).push(callback);
|
13
|
+
}
|
14
|
+
publish(eventName, data) {
|
15
|
+
if (this.events.has(eventName)) {
|
16
|
+
this.events.get(eventName).forEach(callback => {
|
17
|
+
isFunction(callback) && (callback === null || callback === void 0 ? void 0 : callback(data));
|
18
|
+
});
|
26
19
|
}
|
27
|
-
}
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
this.events.set(eventName, this.events.get(eventName).filter(function (cb) {
|
32
|
-
return cb !== callback;
|
33
|
-
}));
|
34
|
-
}
|
20
|
+
}
|
21
|
+
unsubscribe(eventName, callback) {
|
22
|
+
if (this.events.has(eventName)) {
|
23
|
+
this.events.set(eventName, this.events.get(eventName).filter(cb => cb !== callback));
|
35
24
|
}
|
36
|
-
}
|
37
|
-
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
// 将 eventCenter 实例添加到 window 对象上
|
38
29
|
window.eventCenter = new SimpleEventCenter();
|
@@ -1,5 +1,10 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import { getEnumData, setEnumData, cacheFieldNames } from
|
2
|
+
import { getEnumData, setEnumData, cacheFieldNames } from "./index";
|
3
|
+
|
4
|
+
/**
|
5
|
+
* 替换频繁枚举缓存数据的参数接口
|
6
|
+
*/
|
7
|
+
|
3
8
|
/**
|
4
9
|
* 替换频繁枚举缓存数据
|
5
10
|
* @param params 参数对象
|
@@ -22,6 +27,7 @@ export function replaceFrequentEnumCache(params) {
|
|
22
27
|
} : _params$fieldNames,
|
23
28
|
_params$clear = params.clear,
|
24
29
|
clear = _params$clear === void 0 ? true : _params$clear;
|
30
|
+
|
25
31
|
// 参数验证
|
26
32
|
if (!storage || !cacheKey) {
|
27
33
|
console.warn('ProEnum: storage and cacheKey are required for replaceFrequentEnumCache');
|
@@ -38,26 +44,31 @@ export function replaceFrequentEnumCache(params) {
|
|
38
44
|
var cacheData = getEnumData(storage, cacheKey) || {
|
39
45
|
data: {}
|
40
46
|
};
|
47
|
+
|
41
48
|
// 确保cacheData.data存在
|
42
49
|
if (!cacheData.data) {
|
43
50
|
cacheData.data = {};
|
44
51
|
}
|
52
|
+
|
45
53
|
// 只替换指定的枚举
|
46
|
-
enums.forEach(
|
54
|
+
enums.forEach(code => {
|
47
55
|
if (newData[code]) {
|
48
56
|
var processedData = newData[code];
|
57
|
+
|
49
58
|
// 应用数据清洗逻辑
|
50
59
|
if (clear && Array.isArray(processedData)) {
|
51
|
-
processedData = processedData.map(
|
60
|
+
processedData = processedData.map(item => {
|
52
61
|
return cacheFieldNames(fieldNames, item);
|
53
62
|
});
|
54
63
|
}
|
55
64
|
cacheData.data[code] = processedData;
|
65
|
+
cacheData.time = Date.now();
|
56
66
|
}
|
57
67
|
});
|
58
68
|
setEnumData(storage, cacheKey, cacheData);
|
59
69
|
return cacheData;
|
60
70
|
}
|
71
|
+
|
61
72
|
/**
|
62
73
|
* 验证频繁枚举配置
|
63
74
|
* @param config 频繁枚举配置
|
@@ -65,8 +76,9 @@ export function replaceFrequentEnumCache(params) {
|
|
65
76
|
*/
|
66
77
|
export function validateFrequentEnumConfig(config) {
|
67
78
|
var _config$enums;
|
68
|
-
return !!(
|
79
|
+
return !!(config !== null && config !== void 0 && (_config$enums = config.enums) !== null && _config$enums !== void 0 && _config$enums.length && config !== null && config !== void 0 && config.service);
|
69
80
|
}
|
81
|
+
|
70
82
|
/**
|
71
83
|
* 合并频繁枚举数据到全局状态
|
72
84
|
* @param cacheData 缓存数据
|
@@ -1,10 +1,8 @@
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
-
import _isString from "lodash/isString";
|
3
|
-
import _isArray from "lodash/isArray";
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
5
1
|
import { useMemo } from 'react';
|
6
|
-
import {
|
7
|
-
|
2
|
+
import { isArray, isString } from 'lodash';
|
3
|
+
import { useProConfig } from "../../ProConfigProvider";
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
5
|
+
var EnumLabel = props => {
|
8
6
|
var fieldNameLabel = '';
|
9
7
|
var fieldNameValue = '';
|
10
8
|
var _ref = useProConfig('ProEnum') || {},
|
@@ -27,30 +25,27 @@ var EnumLabel = function EnumLabel(props) {
|
|
27
25
|
var _useProConfig = useProConfig('ProEnum'),
|
28
26
|
_useProConfig$dics = _useProConfig.dics,
|
29
27
|
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
30
|
-
var enumLists = useMemo(
|
28
|
+
var enumLists = useMemo(() => {
|
31
29
|
var lists = [];
|
32
|
-
if (
|
30
|
+
if (isString(code)) {
|
33
31
|
lists = (dics === null || dics === void 0 ? void 0 : dics[code]) || [];
|
34
32
|
}
|
35
|
-
if (
|
36
|
-
code.forEach(
|
37
|
-
|
38
|
-
_isArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]) && (_lists = lists).push.apply(_lists, _toConsumableArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]));
|
33
|
+
if (isArray(code)) {
|
34
|
+
code.forEach(enumCode => {
|
35
|
+
isArray(dics === null || dics === void 0 ? void 0 : dics[enumCode]) && lists.push(...(dics === null || dics === void 0 ? void 0 : dics[enumCode]));
|
39
36
|
});
|
40
37
|
}
|
41
38
|
return lists;
|
42
39
|
}, [dics, code]);
|
43
|
-
var transToLabel =
|
44
|
-
var labelList = value.map(
|
45
|
-
var option = enumLists.find(
|
46
|
-
return option[fieldNameValue] === v;
|
47
|
-
});
|
40
|
+
var transToLabel = value => {
|
41
|
+
var labelList = value.map(v => {
|
42
|
+
var option = enumLists.find(option => option[fieldNameValue] === v);
|
48
43
|
if (option && option[fieldNameLabel]) {
|
49
|
-
return compose ?
|
44
|
+
return compose ? `${value}-${option[fieldNameLabel]}` : option[fieldNameLabel];
|
50
45
|
}
|
51
46
|
return '';
|
52
47
|
});
|
53
|
-
return _jsx("span", {
|
48
|
+
return /*#__PURE__*/_jsx("span", {
|
54
49
|
children: labelList.join(',') || '-'
|
55
50
|
});
|
56
51
|
};
|
@@ -60,7 +55,7 @@ var EnumLabel = function EnumLabel(props) {
|
|
60
55
|
}
|
61
56
|
return transToLabel([value]);
|
62
57
|
}
|
63
|
-
return _jsx("span", {
|
58
|
+
return /*#__PURE__*/_jsx("span", {
|
64
59
|
children: "-"
|
65
60
|
});
|
66
61
|
};
|
@@ -71,7 +66,7 @@ var getEnumLabel = function getEnumLabel(code, value) {
|
|
71
66
|
if (!code) {
|
72
67
|
return null;
|
73
68
|
}
|
74
|
-
return _jsx(EnumLabel, {
|
69
|
+
return /*#__PURE__*/_jsx(EnumLabel, {
|
75
70
|
code: code,
|
76
71
|
value: value,
|
77
72
|
compose: compose,
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
-
import _isUndefined from "lodash/isUndefined";
|
3
|
-
import _isNull from "lodash/isNull";
|
4
2
|
var _excluded = ["children"];
|
3
|
+
import { isNull, isUndefined } from 'lodash';
|
5
4
|
/**
|
6
5
|
* 获取枚举数据
|
7
6
|
* @param storage
|
@@ -25,6 +24,7 @@ export function getEnumData(storage, cacheKey, baseEnumStorage) {
|
|
25
24
|
return JSON.parse(window.sessionStorage.getItem(cacheKey) || '{}');
|
26
25
|
}
|
27
26
|
}
|
27
|
+
|
28
28
|
/**
|
29
29
|
* 设置枚举数据
|
30
30
|
* @param storage
|
@@ -33,7 +33,7 @@ export function getEnumData(storage, cacheKey, baseEnumStorage) {
|
|
33
33
|
*/
|
34
34
|
export function setEnumData(storage, cacheKey, data) {
|
35
35
|
var _Object$keys;
|
36
|
-
if (!((_Object$keys = Object.keys(data === null || data === void 0 ? void 0 : data.data))
|
36
|
+
if (!((_Object$keys = Object.keys(data === null || data === void 0 ? void 0 : data.data)) !== null && _Object$keys !== void 0 && _Object$keys.length)) {
|
37
37
|
return false;
|
38
38
|
}
|
39
39
|
if (storage === 'localStorage') {
|
@@ -42,6 +42,7 @@ export function setEnumData(storage, cacheKey, data) {
|
|
42
42
|
window.sessionStorage.setItem(cacheKey, JSON.stringify(data));
|
43
43
|
}
|
44
44
|
}
|
45
|
+
|
45
46
|
/**
|
46
47
|
* 判断枚举列表是否存在
|
47
48
|
* @param storage
|
@@ -54,6 +55,7 @@ export function hasEnumList(storage, cacheKey, code) {
|
|
54
55
|
var enumList = (res === null || res === void 0 ? void 0 : res.data) || {};
|
55
56
|
return enumList === null || enumList === void 0 ? void 0 : enumList[code];
|
56
57
|
}
|
58
|
+
|
57
59
|
/**
|
58
60
|
* 判断是否是对象
|
59
61
|
* @param obj
|
@@ -62,6 +64,7 @@ export function hasEnumList(storage, cacheKey, code) {
|
|
62
64
|
export function isObject(obj) {
|
63
65
|
return Object.prototype.toString.call(obj) === '[object Object]';
|
64
66
|
}
|
67
|
+
|
65
68
|
/**
|
66
69
|
* 合并枚举数据
|
67
70
|
* @param storage
|
@@ -77,8 +80,9 @@ export function mergeCacheData(storage, code, cacheKey, responseData) {
|
|
77
80
|
if (cacheData && cacheData.data) {
|
78
81
|
cacheData.data[code] = responseData;
|
79
82
|
}
|
80
|
-
(_window2 = window) === null || _window2 === void 0
|
83
|
+
(_window2 = window) === null || _window2 === void 0 || _window2[cacheStorage].setItem(cacheKey, JSON.stringify(cacheData));
|
81
84
|
}
|
85
|
+
|
82
86
|
/**
|
83
87
|
* diff code 差异
|
84
88
|
* @param cacheCodes
|
@@ -98,6 +102,7 @@ export function diffCode(cacheCodes, codes) {
|
|
98
102
|
}
|
99
103
|
return diff;
|
100
104
|
}
|
105
|
+
|
101
106
|
/**
|
102
107
|
* 缓存fieldNames制定的值
|
103
108
|
* @param fieldNames 保留映射值
|
@@ -108,15 +113,15 @@ export function cacheFieldNames(fieldNames, dataSource) {
|
|
108
113
|
var children = fieldNames.children,
|
109
114
|
restFieldNames = _objectWithoutProperties(fieldNames, _excluded);
|
110
115
|
var result = {};
|
111
|
-
Object.keys(restFieldNames).forEach(
|
116
|
+
Object.keys(restFieldNames).forEach(key => {
|
112
117
|
var value = dataSource[restFieldNames[key]] ? dataSource[restFieldNames[key]] : dataSource[key];
|
113
|
-
if (!(
|
118
|
+
if (!(isUndefined(value) || isNull(value))) {
|
114
119
|
result[key] = dataSource[restFieldNames[key]] ? dataSource[restFieldNames[key]] : dataSource[key];
|
115
120
|
}
|
116
121
|
});
|
117
122
|
// 递归去对数据进行清洗
|
118
123
|
if (children && Array.isArray(dataSource[children])) {
|
119
|
-
result.children = dataSource[children].map(
|
124
|
+
result.children = dataSource[children].map(item => {
|
120
125
|
return cacheFieldNames(fieldNames, item);
|
121
126
|
});
|
122
127
|
}
|