@zat-design/sisyphus-react 4.5.9 → 4.5.10-beta.2
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 -1
- package/dist/less.esm.css +1 -1
- package/es/FormsProvider/index.js +14 -21
- package/es/ProAction/components/CheckModalContent/index.js +12 -26
- package/es/ProAction/index.js +79 -83
- package/es/ProAction/propsType.js +0 -1
- package/es/ProConfigProvider/index.js +63 -110
- package/es/ProConfigProvider/propsType.js +0 -1
- package/es/ProDownload/index.d.ts +2 -1
- package/es/ProDownload/index.js +74 -69
- package/es/ProDownload/propsType.js +0 -1
- package/es/ProDownload/utils.d.ts +10 -5
- package/es/ProDownload/utils.js +63 -95
- package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
- package/es/ProDrawerForm/components/ProModal/index.js +77 -108
- package/es/ProDrawerForm/components/index.js +6 -2
- package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
- package/es/ProDrawerForm/index.js +29 -38
- package/es/ProDrawerForm/propsType.js +0 -1
- package/es/ProDrawerForm/utils/index.js +18 -36
- package/es/ProEditLabel/components/RenderProForm.js +45 -49
- package/es/ProEditLabel/index.js +126 -163
- package/es/ProEditLabel/propsType.js +0 -1
- package/es/ProEditLabel/utils/index.js +5 -8
- package/es/ProEditTable/components/ActionButton/index.js +111 -119
- package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
- package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
- package/es/ProEditTable/components/RcTable/index.js +6 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
- package/es/ProEditTable/components/RenderField/index.js +490 -587
- package/es/ProEditTable/components/RenderField/propsType.js +0 -1
- package/es/ProEditTable/components/RenderField/tools.js +115 -112
- package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
- package/es/ProEditTable/components/Summary/index.js +38 -64
- package/es/ProEditTable/components/Validator/index.js +46 -46
- package/es/ProEditTable/components/index.js +12 -5
- package/es/ProEditTable/index.js +456 -378
- package/es/ProEditTable/propsType.js +0 -1
- package/es/ProEditTable/utils/config.js +60 -122
- package/es/ProEditTable/utils/diffOriginal.js +45 -82
- package/es/ProEditTable/utils/getDefaultProps.js +19 -24
- package/es/ProEditTable/utils/index.js +154 -235
- package/es/ProEditTable/utils/tools.js +149 -286
- package/es/ProEditTable/utils/transform.js +25 -30
- package/es/ProEditTable/utils/useEditTableError.js +30 -43
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
- package/es/ProEditTable/utils/validateAll.js +87 -154
- package/es/ProEnum/components/Group.js +38 -30
- package/es/ProEnum/components/Tag.js +22 -26
- package/es/ProEnum/hooks/useEnum.js +48 -116
- package/es/ProEnum/hooks/useEnumRequest.js +182 -212
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
- package/es/ProEnum/index.js +162 -172
- package/es/ProEnum/propsType.js +0 -1
- package/es/ProEnum/utils/eventCenter.js +10 -12
- package/es/ProEnum/utils/frequentEnum.js +35 -92
- package/es/ProEnum/utils/getEnum.js +32 -90
- package/es/ProEnum/utils/getEnumLabel.js +44 -49
- package/es/ProEnum/utils/index.js +93 -207
- package/es/ProForm/components/Container.js +13 -28
- package/es/ProForm/components/FormFooter/index.js +36 -44
- package/es/ProForm/components/FormFooter/propsType.js +0 -1
- package/es/ProForm/components/base/Checkbox/index.js +32 -59
- package/es/ProForm/components/base/DatePicker/index.js +49 -71
- package/es/ProForm/components/base/Input/index.js +63 -97
- package/es/ProForm/components/base/Input/propsType.js +0 -1
- package/es/ProForm/components/base/InputNumber/index.js +118 -172
- package/es/ProForm/components/base/Radio/index.js +39 -52
- package/es/ProForm/components/base/RangePicker/index.js +109 -127
- package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
- package/es/ProForm/components/base/Select/index.js +63 -89
- package/es/ProForm/components/base/Switch/index.js +27 -35
- package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
- package/es/ProForm/components/base/TextArea/index.js +30 -41
- package/es/ProForm/components/base/TimePicker/index.js +27 -37
- package/es/ProForm/components/combination/Container/index.js +37 -47
- package/es/ProForm/components/combination/Container/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
- package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
- package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
- package/es/ProForm/components/combination/FormList/index.js +151 -161
- package/es/ProForm/components/combination/FormList/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/style/index.less +6 -0
- package/es/ProForm/components/combination/FormList/utils.js +22 -38
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
- package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
- package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
- package/es/ProForm/components/combination/Group/index.js +87 -126
- package/es/ProForm/components/combination/Group/propsType.js +0 -1
- package/es/ProForm/components/combination/Group/utils/index.js +124 -239
- package/es/ProForm/components/combination/ProCascader/index.js +156 -199
- package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
- package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
- package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
- package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
- package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
- package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
- package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
- package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
- package/es/ProForm/components/index.js +56 -34
- package/es/ProForm/components/render/ChangedWrapper.js +85 -94
- package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
- package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
- package/es/ProForm/components/render/Render.js +223 -329
- package/es/ProForm/components/render/RenderFields.js +76 -113
- package/es/ProForm/components/render/propsType.js +0 -1
- package/es/ProForm/hooks/useControlled.js +8 -10
- package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
- package/es/ProForm/hooks/useFieldProps.js +8 -4
- package/es/ProForm/hooks/useForm.js +50 -110
- package/es/ProForm/hooks/useRules.js +17 -33
- package/es/ProForm/hooks/useShouldUpdate.js +77 -152
- package/es/ProForm/hooks/useWatch.js +62 -134
- package/es/ProForm/index.js +157 -194
- package/es/ProForm/propsType.js +15 -7
- package/es/ProForm/utils/buildFormItemProps.js +51 -58
- package/es/ProForm/utils/diffOriginal.js +43 -73
- package/es/ProForm/utils/getDefaultProps.js +18 -24
- package/es/ProForm/utils/index.js +160 -235
- package/es/ProForm/utils/processDependencies.js +21 -60
- package/es/ProForm/utils/reactiveValues.js +20 -34
- package/es/ProForm/utils/rulesCreator.js +42 -40
- package/es/ProForm/utils/transformNames.js +10 -13
- package/es/ProForm/utils/transformValue.js +16 -29
- package/es/ProForm/utils/valueType.js +96 -178
- package/es/ProIcon/config/index.js +340 -274
- package/es/ProIcon/index.js +135 -209
- package/es/ProIcon/propsTypes.js +0 -1
- package/es/ProIcon/utils/index.js +24 -39
- package/es/ProLayout/components/Layout/Header/index.js +108 -141
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
- package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
- package/es/ProLayout/components/Layout/Menu/index.js +92 -89
- package/es/ProLayout/components/Layout/Notice/index.js +13 -27
- package/es/ProLayout/components/Layout/index.js +8 -3
- package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
- package/es/ProLayout/components/ProCollapse/index.js +89 -111
- package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
- package/es/ProLayout/components/ProFooter/index.js +27 -24
- package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
- package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
- package/es/ProLayout/components/ProHeader/components/index.js +6 -2
- package/es/ProLayout/components/ProHeader/index.js +216 -356
- package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
- package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
- package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
- package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
- package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
- package/es/ProLayout/components/TabsManager/index.js +407 -351
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
- package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
- package/es/ProLayout/components/TabsManager/style/index.less +1 -1
- package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
- package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
- package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
- package/es/ProLayout/components/index.js +8 -3
- package/es/ProLayout/index.js +173 -228
- package/es/ProLayout/propTypes.d.ts +28 -1
- package/es/ProLayout/propTypes.js +12 -52
- package/es/ProLayout/utils/index.js +48 -128
- package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
- package/es/ProSelect/index.js +187 -223
- package/es/ProSelect/propsType.js +0 -1
- package/es/ProSelect/style/index.less +13 -0
- package/es/ProSelect/utils/index.js +100 -146
- package/es/ProStep/components/Anchor/index.js +71 -82
- package/es/ProStep/components/Item/index.js +49 -56
- package/es/ProStep/components/LazyLoad/index.js +23 -29
- package/es/ProStep/components/Listener/index.js +20 -33
- package/es/ProStep/components/Step/index.js +31 -38
- package/es/ProStep/constants.js +4 -1
- package/es/ProStep/index.js +166 -153
- package/es/ProStep/propsType.js +0 -1
- package/es/ProStep/style/index.less +1 -1
- package/es/ProStep/utils/index.js +29 -55
- package/es/ProStepTab/index.js +83 -138
- package/es/ProStepTab/propsType.js +0 -1
- package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
- package/es/ProTable/components/EditableCell/index.js +37 -71
- package/es/ProTable/components/EditableCell/propsType.js +0 -1
- package/es/ProTable/components/FormatColumn/index.js +209 -340
- package/es/ProTable/components/FormatColumn/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
- package/es/ProTable/components/RcTable/index.js +6 -4
- package/es/ProTable/components/RenderColumn/index.js +158 -186
- package/es/ProTable/components/RenderEmptyText/index.js +12 -21
- package/es/ProTable/components/RenderFooter/index.js +15 -15
- package/es/ProTable/components/RenderSummary/index.js +33 -50
- package/es/ProTable/components/RenderTableHeader/index.js +44 -46
- package/es/ProTable/components/RenderTabs/index.js +47 -51
- package/es/ProTable/components/TableResizable/index.js +56 -72
- package/es/ProTable/components/TooltipTitle/index.js +13 -21
- package/es/ProTable/components/index.js +16 -36
- package/es/ProTable/hooks/useAntdTable.js +191 -224
- package/es/ProTable/index.js +232 -249
- package/es/ProTable/propsType.js +0 -1
- package/es/ProTable/utils/columnStorage.js +63 -88
- package/es/ProTable/utils/index.js +57 -90
- package/es/ProTabs/components/Card/index.js +20 -48
- package/es/ProTabs/components/index.js +4 -1
- package/es/ProTabs/index.js +41 -58
- package/es/ProTabs/propType.js +0 -1
- package/es/ProThemeTools/component/ProTools/index.js +106 -158
- package/es/ProThemeTools/component/index.js +4 -1
- package/es/ProThemeTools/context/ThemeContext.js +67 -146
- package/es/ProThemeTools/index.js +103 -156
- package/es/ProThemeTools/propsType.js +0 -1
- package/es/ProThemeTools/utils/index.js +60 -109
- package/es/ProTooltip/index.js +132 -168
- package/es/ProTooltip/propsType.js +0 -1
- package/es/ProTree/components/AdaptiveTooltip.js +15 -17
- package/es/ProTree/components/CloseIcon.js +18 -26
- package/es/ProTree/components/List.js +28 -47
- package/es/ProTree/components/ProTree.js +152 -211
- package/es/ProTree/components/ProTreeSelect/index.js +255 -459
- package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
- package/es/ProTree/components/SearchTitle.js +23 -42
- package/es/ProTree/components/Tree.js +147 -195
- package/es/ProTree/components/index.js +10 -5
- package/es/ProTree/index.js +12 -16
- package/es/ProTree/propsType.js +0 -1
- package/es/ProTree/utils.js +46 -118
- package/es/ProTreeModal/components/Cascader.js +56 -64
- package/es/ProTreeModal/components/CloseIcon.js +18 -26
- package/es/ProTreeModal/components/List.js +114 -180
- package/es/ProTreeModal/components/SearchTitle.js +15 -18
- package/es/ProTreeModal/components/SortableItem.js +29 -58
- package/es/ProTreeModal/components/Tree.js +99 -113
- package/es/ProTreeModal/components/Trigger.js +87 -121
- package/es/ProTreeModal/components/index.js +14 -6
- package/es/ProTreeModal/index.js +397 -438
- package/es/ProTreeModal/propsType.js +0 -1
- package/es/ProTreeModal/utils.js +52 -95
- package/es/ProUpload/components/ButtonRender.js +44 -54
- package/es/ProUpload/components/DragRender.js +94 -148
- package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
- package/es/ProUpload/components/Example.js +27 -31
- package/es/ProUpload/components/FileItem.js +69 -163
- package/es/ProUpload/components/ImageRender.js +134 -170
- package/es/ProUpload/index.js +68 -100
- package/es/ProUpload/propsType.js +0 -1
- package/es/ProUpload/uitls.js +8 -4
- package/es/ProUtils/utils/index.js +17 -13
- package/es/ProViewer/index.js +154 -175
- package/es/ProViewer/propsType.js +0 -5
- package/es/ProWaterMark/index.js +9 -16
- package/es/ProWaterMark/propsType.js +0 -1
- package/es/hooks/useDraggableRow.js +25 -53
- package/es/index.js +57 -77
- package/es/locale/en_US.js +153 -142
- package/es/locale/index.js +23 -36
- package/es/locale/zh_CN.js +145 -142
- package/es/tokens.js +84 -83
- package/es/utils/index.js +24 -51
- package/package.json +4 -2
- package/es/ProConfigProvider/demo/locale.js +0 -58
package/es/ProEnum/index.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDeepCompareEffect, useRequest as useRequestFunc } from "ahooks";
|
|
3
|
+
import {
|
|
4
|
+
message,
|
|
5
|
+
Radio,
|
|
6
|
+
Checkbox,
|
|
7
|
+
Space,
|
|
8
|
+
Segmented
|
|
9
|
+
} from "antd";
|
|
10
|
+
import React, { useState, useEffect, useMemo } from "react";
|
|
11
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
12
|
+
import isFunction from "lodash/isFunction";
|
|
13
|
+
import isString from "lodash/isString";
|
|
14
|
+
import isArray from "lodash/isArray";
|
|
15
|
+
import omit from "lodash/omit";
|
|
9
16
|
import ProSelect from "../ProSelect";
|
|
10
17
|
import { useProConfig } from "../ProConfigProvider";
|
|
11
18
|
import ProEnumTag from "./components/Tag";
|
|
@@ -17,11 +24,11 @@ import useEnum from "./hooks/useEnum";
|
|
|
17
24
|
import getEnum from "./utils/getEnum";
|
|
18
25
|
import locale from "../locale";
|
|
19
26
|
import { useFieldProps } from "../ProForm/hooks/useFieldProps";
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
const ProEnum = (props) => {
|
|
28
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22
29
|
const {
|
|
23
30
|
code,
|
|
24
|
-
type =
|
|
31
|
+
type = "ProSelect",
|
|
25
32
|
dataSource,
|
|
26
33
|
useRequest,
|
|
27
34
|
value,
|
|
@@ -32,76 +39,69 @@ const ProEnum = props => {
|
|
|
32
39
|
isView,
|
|
33
40
|
...enumProps
|
|
34
41
|
} = props;
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
} =
|
|
38
|
-
const _defaultValue = props?.defaultValue;
|
|
39
|
-
const {
|
|
40
|
-
isView: configIsView
|
|
41
|
-
} = useFieldProps() || {};
|
|
42
|
+
const { viewEmpty } = otherProps || {};
|
|
43
|
+
const _defaultValue = props == null ? void 0 : props.defaultValue;
|
|
44
|
+
const { isView: configIsView } = useFieldProps() || {};
|
|
42
45
|
const {
|
|
43
46
|
fieldNames,
|
|
44
47
|
clear = true,
|
|
45
48
|
cacheKey = baseCacheKey,
|
|
46
49
|
showCodeName,
|
|
47
50
|
...resProps
|
|
48
|
-
} = useProConfig(
|
|
49
|
-
const _isView = isView !==
|
|
51
|
+
} = useProConfig("ProEnum") || {};
|
|
52
|
+
const _isView = isView !== void 0 && isView !== null ? isView : (otherProps == null ? void 0 : otherProps.isView) ?? configIsView;
|
|
50
53
|
enumProps.showCodeName = enumProps.showCodeName ?? showCodeName;
|
|
51
|
-
let label =
|
|
52
|
-
let fieldValue =
|
|
54
|
+
let label = "label";
|
|
55
|
+
let fieldValue = "value";
|
|
53
56
|
const [dataList, setData] = useState(dataSource || []);
|
|
54
57
|
useEffect(() => {
|
|
55
|
-
dataSource
|
|
58
|
+
(dataSource == null ? void 0 : dataSource.length) && setData([...dataSource]);
|
|
56
59
|
}, [dataSource]);
|
|
57
60
|
if (fieldNames && Object.keys(fieldNames).length) {
|
|
58
|
-
if (fieldNames
|
|
59
|
-
|
|
61
|
+
if (fieldNames == null ? void 0 : fieldNames.label)
|
|
62
|
+
label = fieldNames.label;
|
|
63
|
+
if (fieldNames == null ? void 0 : fieldNames.value)
|
|
64
|
+
fieldValue = fieldNames == null ? void 0 : fieldNames.value;
|
|
60
65
|
}
|
|
61
66
|
if (props.fieldNames && Object.keys(props.fieldNames).length) {
|
|
62
|
-
if (props
|
|
63
|
-
|
|
67
|
+
if ((_a = props == null ? void 0 : props.fieldNames) == null ? void 0 : _a.label)
|
|
68
|
+
label = (_b = props.fieldNames) == null ? void 0 : _b.label;
|
|
69
|
+
if ((_c = props == null ? void 0 : props.fieldNames) == null ? void 0 : _c.value)
|
|
70
|
+
fieldValue = (_d = props.fieldNames) == null ? void 0 : _d.value;
|
|
64
71
|
}
|
|
65
72
|
if (clear) {
|
|
66
|
-
label =
|
|
67
|
-
fieldValue =
|
|
73
|
+
label = "label";
|
|
74
|
+
fieldValue = "value";
|
|
68
75
|
}
|
|
69
|
-
|
|
70
|
-
// 组件显式传入 fieldNames 时优先级最高,必须覆盖 clear 默认映射
|
|
71
76
|
if (props.fieldNames && Object.keys(props.fieldNames).length) {
|
|
72
|
-
if (props.fieldNames
|
|
73
|
-
|
|
77
|
+
if ((_e = props.fieldNames) == null ? void 0 : _e.label)
|
|
78
|
+
label = props.fieldNames.label;
|
|
79
|
+
if ((_f = props.fieldNames) == null ? void 0 : _f.value)
|
|
80
|
+
fieldValue = props.fieldNames.value;
|
|
74
81
|
}
|
|
75
|
-
const {
|
|
76
|
-
|
|
77
|
-
} = useProConfig('ProEnum');
|
|
78
|
-
const {
|
|
79
|
-
run
|
|
80
|
-
} = useRequestFunc(useRequest?.service, {
|
|
82
|
+
const { dics = {} } = useProConfig("ProEnum");
|
|
83
|
+
const { run } = useRequestFunc(useRequest == null ? void 0 : useRequest.service, {
|
|
81
84
|
manual: true,
|
|
82
85
|
cacheTime: -1,
|
|
83
|
-
...useRequest
|
|
84
|
-
onSuccess: res => {
|
|
85
|
-
|
|
86
|
+
...useRequest == null ? void 0 : useRequest.options,
|
|
87
|
+
onSuccess: (res) => {
|
|
88
|
+
var _a2, _b2;
|
|
89
|
+
if (transformResponse && typeof transformResponse === "function") {
|
|
86
90
|
const responseData = transformResponse(res);
|
|
87
|
-
if (typeof responseData !==
|
|
88
|
-
return message.error(locale.ProEnum
|
|
91
|
+
if (typeof responseData !== "object") {
|
|
92
|
+
return message.error((_a2 = locale.ProEnum) == null ? void 0 : _a2.errorMessage);
|
|
89
93
|
}
|
|
90
94
|
setData(responseData);
|
|
91
95
|
} else {
|
|
92
|
-
const {
|
|
93
|
-
status = 200,
|
|
94
|
-
message: msg,
|
|
95
|
-
data
|
|
96
|
-
} = res;
|
|
96
|
+
const { status = 200, message: msg, data } = res;
|
|
97
97
|
if (status === 200) {
|
|
98
|
-
if (typeof data !==
|
|
99
|
-
return message.error(locale.ProEnum
|
|
98
|
+
if (typeof data !== "object") {
|
|
99
|
+
return message.error((_b2 = locale.ProEnum) == null ? void 0 : _b2.errorMessage);
|
|
100
100
|
}
|
|
101
101
|
if (Array.isArray(data)) {
|
|
102
102
|
setData([...data]);
|
|
103
103
|
}
|
|
104
|
-
if (isObject(data) &&
|
|
104
|
+
if (isObject(data) && isString(code)) {
|
|
105
105
|
setData(data[code]);
|
|
106
106
|
}
|
|
107
107
|
} else {
|
|
@@ -110,47 +110,40 @@ const ProEnum = props => {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
-
|
|
114
|
-
// 自定义请求
|
|
115
113
|
useDeepCompareEffect(() => {
|
|
116
|
-
const {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const params = Array.isArray(defaultParams) ? defaultParams?.[0] : defaultParams || {};
|
|
120
|
-
if (useRequest?.service) {
|
|
114
|
+
const { defaultParams } = (useRequest == null ? void 0 : useRequest.options) || {};
|
|
115
|
+
const params = Array.isArray(defaultParams) ? defaultParams == null ? void 0 : defaultParams[0] : defaultParams || {};
|
|
116
|
+
if (useRequest == null ? void 0 : useRequest.service) {
|
|
121
117
|
run(params);
|
|
122
118
|
}
|
|
123
|
-
}, [useRequest
|
|
119
|
+
}, [useRequest == null ? void 0 : useRequest.options]);
|
|
124
120
|
const enumLists = useMemo(() => {
|
|
125
121
|
let lists = [];
|
|
126
|
-
if (
|
|
127
|
-
lists = dics
|
|
122
|
+
if (isString(code)) {
|
|
123
|
+
lists = (dics == null ? void 0 : dics[code]) || [];
|
|
128
124
|
}
|
|
129
|
-
if (
|
|
130
|
-
code.forEach(enumCode => {
|
|
131
|
-
|
|
125
|
+
if (isArray(code)) {
|
|
126
|
+
code.forEach((enumCode) => {
|
|
127
|
+
isArray(dics == null ? void 0 : dics[enumCode]) && lists.push(...dics == null ? void 0 : dics[enumCode]);
|
|
132
128
|
});
|
|
133
129
|
}
|
|
134
130
|
return lists;
|
|
135
131
|
}, [dics, code]);
|
|
136
132
|
const renderComponent = () => {
|
|
133
|
+
var _a2;
|
|
137
134
|
let list = [];
|
|
138
|
-
|
|
139
|
-
// 优先使用组件内部自己传入的数据源或者请求得到的数据
|
|
140
135
|
const sourceList = dataList && dataList.length ? dataList : enumLists;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (!useRequest?.service && transformResponse) {
|
|
144
|
-
list = transformResponse(_cloneDeep(sourceList));
|
|
136
|
+
if (!(useRequest == null ? void 0 : useRequest.service) && transformResponse) {
|
|
137
|
+
list = transformResponse(cloneDeep(sourceList));
|
|
145
138
|
if (!Array.isArray(list)) {
|
|
146
|
-
console.error(locale.ProEnum
|
|
139
|
+
console.error((_a2 = locale.ProEnum) == null ? void 0 : _a2.errorArrayMessage);
|
|
147
140
|
list = [];
|
|
148
141
|
}
|
|
149
142
|
} else {
|
|
150
143
|
list = sourceList;
|
|
151
144
|
}
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
145
|
+
if (React.isValidElement(component)) {
|
|
146
|
+
return React.cloneElement(component, {
|
|
154
147
|
...enumProps,
|
|
155
148
|
dataSource: list,
|
|
156
149
|
fieldNames: {
|
|
@@ -162,139 +155,136 @@ const ProEnum = props => {
|
|
|
162
155
|
});
|
|
163
156
|
}
|
|
164
157
|
switch (type) {
|
|
165
|
-
case
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
158
|
+
case "ProSelect":
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
ProSelect,
|
|
161
|
+
{
|
|
162
|
+
...omit(enumProps, ["ref"]),
|
|
163
|
+
otherProps,
|
|
164
|
+
dataSource: list,
|
|
165
|
+
fieldNames: {
|
|
166
|
+
label,
|
|
167
|
+
value: fieldValue
|
|
168
|
+
},
|
|
169
|
+
value,
|
|
170
|
+
onChange
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
case "Radio":
|
|
174
|
+
return /* @__PURE__ */ jsx(
|
|
175
|
+
Radio.Group,
|
|
176
|
+
{
|
|
177
|
+
...omit(enumProps, ["fieldNames", "showCodeName"]),
|
|
178
|
+
options: list,
|
|
179
|
+
value,
|
|
180
|
+
onChange,
|
|
181
|
+
children: list.map((item) => /* @__PURE__ */ jsx(Radio, { value: item[fieldValue], disabled: !!item.disabled, children: item[label] }, item[fieldValue]))
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
case "Checkbox":
|
|
185
|
+
return /* @__PURE__ */ jsx(
|
|
186
|
+
Checkbox.Group,
|
|
187
|
+
{
|
|
188
|
+
...omit(enumProps, ["fieldNames", "showCodeName"]),
|
|
189
|
+
options: list,
|
|
190
|
+
value,
|
|
191
|
+
onChange,
|
|
192
|
+
children: list.map((item) => /* @__PURE__ */ jsx(Checkbox, { value: item[fieldValue], disabled: !!item.disabled, children: item[label] }, item[fieldValue]))
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
case "Tag":
|
|
196
|
+
return /* @__PURE__ */ jsx(
|
|
197
|
+
ProEnumTag,
|
|
198
|
+
{
|
|
199
|
+
id: enumProps.id,
|
|
200
|
+
value,
|
|
201
|
+
onChange,
|
|
202
|
+
fieldLabel: label,
|
|
203
|
+
fieldValue,
|
|
204
|
+
dataSource: list
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
case "Group":
|
|
208
|
+
return /* @__PURE__ */ jsx(
|
|
209
|
+
ProEnumGroup,
|
|
210
|
+
{
|
|
211
|
+
...omit(enumProps, ["showCodeName"]),
|
|
212
|
+
value,
|
|
213
|
+
onChange,
|
|
214
|
+
fieldLabel: label,
|
|
215
|
+
fieldValue,
|
|
216
|
+
dataSource: list
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
case "Segmented":
|
|
220
|
+
return /* @__PURE__ */ jsx(
|
|
221
|
+
Segmented,
|
|
222
|
+
{
|
|
223
|
+
...omit(enumProps, ["fieldNames", "showCodeName"]),
|
|
224
|
+
options: list.map((item) => ({
|
|
225
|
+
label: item[label],
|
|
226
|
+
value: item[fieldValue],
|
|
227
|
+
disabled: !!item.disabled
|
|
228
|
+
})),
|
|
229
|
+
value,
|
|
230
|
+
onChange
|
|
231
|
+
}
|
|
232
|
+
);
|
|
230
233
|
default:
|
|
231
234
|
return null;
|
|
232
235
|
}
|
|
233
236
|
};
|
|
234
237
|
if (!code && !dataSource && !useRequest) {
|
|
235
|
-
message.error(`${otherProps
|
|
238
|
+
message.error(`${otherProps == null ? void 0 : otherProps.label}-${otherProps == null ? void 0 : otherProps.name}-${(_h = (_g = locale) == null ? void 0 : _g.ProEnum) == null ? void 0 : _h.errorNoEnumType}`);
|
|
236
239
|
}
|
|
237
|
-
const transToLabel =
|
|
240
|
+
const transToLabel = (value2) => {
|
|
238
241
|
const list = dataList && dataList.length ? dataList : enumLists;
|
|
239
242
|
if (!Array.isArray(list) || !list.length) {
|
|
240
243
|
return viewEmpty;
|
|
241
244
|
}
|
|
242
|
-
const labelList =
|
|
243
|
-
const option = list.find(item => {
|
|
245
|
+
const labelList = value2.map((v) => {
|
|
246
|
+
const option = list.find((item) => {
|
|
244
247
|
if (enumProps.labelInValue) {
|
|
245
|
-
return item[fieldValue] === v
|
|
248
|
+
return item[fieldValue] === (v == null ? void 0 : v[fieldValue]);
|
|
246
249
|
}
|
|
247
250
|
return item[fieldValue] === v;
|
|
248
251
|
}) || {};
|
|
249
252
|
if (!option) {
|
|
250
|
-
return
|
|
253
|
+
return "";
|
|
251
254
|
}
|
|
252
|
-
return enumProps.showCodeName ? `${option
|
|
255
|
+
return enumProps.showCodeName ? `${option == null ? void 0 : option[fieldValue]}-${option == null ? void 0 : option[label]}` : option == null ? void 0 : option[label];
|
|
253
256
|
});
|
|
254
|
-
const record =
|
|
255
|
-
return list.find(item => {
|
|
257
|
+
const record = value2.map((v) => {
|
|
258
|
+
return list.find((item) => {
|
|
256
259
|
return item[fieldValue] === v;
|
|
257
260
|
});
|
|
258
261
|
});
|
|
259
|
-
// 自定义option时,默认取optionRender的值
|
|
260
262
|
const _optionRender = () => {
|
|
261
263
|
if (!record.length) {
|
|
262
264
|
return viewEmpty;
|
|
263
265
|
}
|
|
264
266
|
const arr = [];
|
|
265
|
-
record.forEach(item => {
|
|
267
|
+
record.forEach((item) => {
|
|
266
268
|
arr.push(props.optionRender(item));
|
|
267
269
|
});
|
|
268
|
-
return
|
|
269
|
-
orientation: "vertical",
|
|
270
|
-
size: 4,
|
|
271
|
-
children: arr.map(item => /*#__PURE__*/_jsx(React.Fragment, {
|
|
272
|
-
children: item
|
|
273
|
-
}, item))
|
|
274
|
-
});
|
|
270
|
+
return /* @__PURE__ */ jsx(Space, { orientation: "vertical", size: 4, children: arr.map((item) => /* @__PURE__ */ jsx(React.Fragment, { children: item }, item)) });
|
|
275
271
|
};
|
|
276
|
-
const filteredLabelList = labelList
|
|
277
|
-
return
|
|
272
|
+
const filteredLabelList = labelList == null ? void 0 : labelList.filter((item) => item != null && item !== "");
|
|
273
|
+
return isFunction(props.optionRender) && record.length ? _optionRender() : (filteredLabelList == null ? void 0 : filteredLabelList.length) ? filteredLabelList.join("、") : null;
|
|
278
274
|
};
|
|
279
275
|
if (_isView) {
|
|
280
276
|
const __value = value ?? _defaultValue;
|
|
281
277
|
if (Array.isArray(__value)) {
|
|
282
|
-
return
|
|
283
|
-
tooltip: true,
|
|
284
|
-
viewEmpty: viewEmpty,
|
|
285
|
-
children: transToLabel(__value)
|
|
286
|
-
});
|
|
278
|
+
return /* @__PURE__ */ jsx(Container, { tooltip: true, viewEmpty, children: transToLabel(__value) });
|
|
287
279
|
}
|
|
288
|
-
return
|
|
289
|
-
viewEmpty: viewEmpty,
|
|
290
|
-
children: __value != null ? transToLabel([__value]) : null
|
|
291
|
-
});
|
|
280
|
+
return /* @__PURE__ */ jsx(Container, { viewEmpty, children: __value != null ? transToLabel([__value]) : null });
|
|
292
281
|
}
|
|
293
|
-
return
|
|
294
|
-
children: renderComponent()
|
|
295
|
-
});
|
|
282
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderComponent() });
|
|
296
283
|
};
|
|
297
284
|
ProEnum.getEnumLabel = getEnumLabel;
|
|
298
285
|
ProEnum.useEnum = useEnum;
|
|
299
286
|
ProEnum.getEnum = getEnum;
|
|
300
|
-
|
|
287
|
+
var ProEnum_default = ProEnum;
|
|
288
|
+
export {
|
|
289
|
+
ProEnum_default as default
|
|
290
|
+
};
|
package/es/ProEnum/propsType.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
4
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
|
+
import isFunction from "lodash/isFunction";
|
|
5
2
|
class SimpleEventCenter {
|
|
3
|
+
events;
|
|
6
4
|
constructor() {
|
|
7
|
-
|
|
8
|
-
this.events = new Map();
|
|
5
|
+
this.events = /* @__PURE__ */ new Map();
|
|
9
6
|
}
|
|
10
7
|
subscribe(eventName, callback) {
|
|
11
8
|
if (!this.events.has(eventName)) {
|
|
@@ -15,17 +12,18 @@ class SimpleEventCenter {
|
|
|
15
12
|
}
|
|
16
13
|
publish(eventName, data) {
|
|
17
14
|
if (this.events.has(eventName)) {
|
|
18
|
-
this.events.get(eventName).forEach(callback => {
|
|
19
|
-
|
|
15
|
+
this.events.get(eventName).forEach((callback) => {
|
|
16
|
+
isFunction(callback) && (callback == null ? void 0 : callback(data));
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
20
|
unsubscribe(eventName, callback) {
|
|
24
21
|
if (this.events.has(eventName)) {
|
|
25
|
-
this.events.set(
|
|
22
|
+
this.events.set(
|
|
23
|
+
eventName,
|
|
24
|
+
this.events.get(eventName).filter((cb) => cb !== callback)
|
|
25
|
+
);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
// 将 eventCenter 实例添加到 window 对象上
|
|
31
|
-
window.eventCenter = new SimpleEventCenter();
|
|
29
|
+
window.eventCenter = new SimpleEventCenter();
|
|
@@ -1,38 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* IndexedDB 异步版本的替换频繁枚举缓存数据
|
|
9
|
-
*/
|
|
1
|
+
import {
|
|
2
|
+
getEnumData,
|
|
3
|
+
setEnumData,
|
|
4
|
+
cacheFieldNames,
|
|
5
|
+
baseCacheKey,
|
|
6
|
+
normalizeEnumCacheData
|
|
7
|
+
} from "./index";
|
|
10
8
|
async function replaceFrequentEnumCacheAsync(params) {
|
|
11
|
-
const {
|
|
12
|
-
|
|
13
|
-
cacheKey
|
|
14
|
-
|
|
15
|
-
newData,
|
|
16
|
-
fieldNames,
|
|
17
|
-
clear
|
|
18
|
-
} = params;
|
|
19
|
-
const cacheData = normalizeEnumCacheData(await Promise.resolve(getEnumData(storage, cacheKey) || {
|
|
20
|
-
data: {}
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
// 确保cacheData.data存在
|
|
9
|
+
const { storage, cacheKey, enums, newData, fieldNames, clear } = params;
|
|
10
|
+
const cacheData = normalizeEnumCacheData(
|
|
11
|
+
await Promise.resolve(getEnumData(storage, cacheKey) || { data: {} })
|
|
12
|
+
);
|
|
24
13
|
if (!cacheData.data) {
|
|
25
14
|
cacheData.data = {};
|
|
26
15
|
}
|
|
27
|
-
|
|
28
|
-
// 只替换指定的枚举
|
|
29
|
-
enums.forEach(code => {
|
|
16
|
+
enums.forEach((code) => {
|
|
30
17
|
if (newData[code]) {
|
|
31
18
|
let processedData = newData[code];
|
|
32
|
-
|
|
33
|
-
// 应用数据清洗逻辑
|
|
34
19
|
if (clear && Array.isArray(processedData)) {
|
|
35
|
-
processedData = processedData.map(item => {
|
|
20
|
+
processedData = processedData.map((item) => {
|
|
36
21
|
return cacheFieldNames(fieldNames, item);
|
|
37
22
|
});
|
|
38
23
|
}
|
|
@@ -44,66 +29,36 @@ async function replaceFrequentEnumCacheAsync(params) {
|
|
|
44
29
|
await Promise.resolve(setEnumData(storage, cacheKey, normalizedCacheData));
|
|
45
30
|
return normalizedCacheData;
|
|
46
31
|
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 替换频繁枚举缓存数据
|
|
50
|
-
* @param params 参数对象
|
|
51
|
-
* @returns 更新后的缓存数据
|
|
52
|
-
*/
|
|
53
|
-
export function replaceFrequentEnumCache(params) {
|
|
32
|
+
function replaceFrequentEnumCache(params) {
|
|
54
33
|
const {
|
|
55
|
-
storage =
|
|
34
|
+
storage = "localStorage",
|
|
56
35
|
cacheKey = baseCacheKey,
|
|
57
36
|
enums = [],
|
|
58
37
|
newData = {},
|
|
59
|
-
fieldNames = {
|
|
60
|
-
label: 'label',
|
|
61
|
-
value: 'value',
|
|
62
|
-
children: 'children'
|
|
63
|
-
},
|
|
38
|
+
fieldNames = { label: "label", value: "value", children: "children" },
|
|
64
39
|
clear = true
|
|
65
40
|
} = params;
|
|
66
|
-
|
|
67
|
-
// 参数验证
|
|
68
41
|
if (!storage || !cacheKey) {
|
|
69
|
-
console.warn(
|
|
70
|
-
return {
|
|
71
|
-
data: {}
|
|
72
|
-
};
|
|
42
|
+
console.warn("ProEnum: storage and cacheKey are required for replaceFrequentEnumCache");
|
|
43
|
+
return { data: {} };
|
|
73
44
|
}
|
|
74
45
|
if (!enums.length) {
|
|
75
|
-
console.warn(
|
|
76
|
-
return {
|
|
77
|
-
data: {}
|
|
78
|
-
};
|
|
46
|
+
console.warn("ProEnum: enums array is empty, no data to replace");
|
|
47
|
+
return { data: {} };
|
|
79
48
|
}
|
|
80
|
-
|
|
81
|
-
// IndexedDB 异步处理
|
|
82
|
-
if (storage === 'indexedDB') {
|
|
49
|
+
if (storage === "indexedDB") {
|
|
83
50
|
return replaceFrequentEnumCacheAsync(params);
|
|
84
51
|
}
|
|
85
|
-
|
|
86
|
-
// localStorage/sessionStorage 同步处理(保持原逻辑)
|
|
87
52
|
const cacheDataResult = getEnumData(storage, cacheKey);
|
|
88
|
-
|
|
89
|
-
// 这里 storage 不是 indexedDB,所以是同步值
|
|
90
|
-
const cacheData = normalizeEnumCacheData(cacheDataResult || {
|
|
91
|
-
data: {}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
// 确保cacheData.data存在
|
|
53
|
+
const cacheData = normalizeEnumCacheData(cacheDataResult || { data: {} });
|
|
95
54
|
if (!cacheData.data) {
|
|
96
55
|
cacheData.data = {};
|
|
97
56
|
}
|
|
98
|
-
|
|
99
|
-
// 只替换指定的枚举
|
|
100
|
-
enums.forEach(code => {
|
|
57
|
+
enums.forEach((code) => {
|
|
101
58
|
if (newData[code]) {
|
|
102
59
|
let processedData = newData[code];
|
|
103
|
-
|
|
104
|
-
// 应用数据清洗逻辑
|
|
105
60
|
if (clear && Array.isArray(processedData)) {
|
|
106
|
-
processedData = processedData.map(item => {
|
|
61
|
+
processedData = processedData.map((item) => {
|
|
107
62
|
return cacheFieldNames(fieldNames, item);
|
|
108
63
|
});
|
|
109
64
|
}
|
|
@@ -115,27 +70,15 @@ export function replaceFrequentEnumCache(params) {
|
|
|
115
70
|
setEnumData(storage, cacheKey, normalizedCacheData);
|
|
116
71
|
return normalizedCacheData;
|
|
117
72
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
export function validateFrequentEnumConfig(config) {
|
|
125
|
-
return !!(config?.enums?.length && config?.service);
|
|
73
|
+
function validateFrequentEnumConfig(config) {
|
|
74
|
+
var _a;
|
|
75
|
+
return !!(((_a = config == null ? void 0 : config.enums) == null ? void 0 : _a.length) && (config == null ? void 0 : config.service));
|
|
76
|
+
}
|
|
77
|
+
function mergeFrequentEnumData(cacheData, dics, dataSource) {
|
|
78
|
+
return { ...dics, ...dataSource, ...cacheData.data };
|
|
126
79
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
* @param dataSource 数据源
|
|
133
|
-
* @returns 合并后的数据
|
|
134
|
-
*/
|
|
135
|
-
export function mergeFrequentEnumData(cacheData, dics, dataSource) {
|
|
136
|
-
return {
|
|
137
|
-
...dics,
|
|
138
|
-
...dataSource,
|
|
139
|
-
...cacheData.data
|
|
140
|
-
};
|
|
141
|
-
}
|
|
80
|
+
export {
|
|
81
|
+
mergeFrequentEnumData,
|
|
82
|
+
replaceFrequentEnumCache,
|
|
83
|
+
validateFrequentEnumConfig
|
|
84
|
+
};
|