@zat-design/sisyphus-react 4.5.10-beta.1 → 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/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.js +55 -65
- package/es/ProDownload/propsType.js +0 -1
- package/es/ProDownload/utils.js +61 -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 +150 -236
- 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 +128 -179
- 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 -103
- package/es/ProForm/components/combination/FormList/components/Empty.js +27 -54
- 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/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 +105 -206
- package/es/ProForm/components/combination/Group/hooks/index.js +68 -128
- 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 +63 -75
- package/es/ProForm/components/combination/ProModalSelect/index.js +290 -348
- 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 +58 -129
- 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 +159 -234
- 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 +111 -137
- 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 -25
- 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 -86
- 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 -64
- 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 +290 -408
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +132 -95
- package/es/ProLayout/components/TabsManager/index.js +406 -390
- package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
- package/es/ProLayout/components/TabsManager/utils/historyObserver.js +26 -23
- package/es/ProLayout/components/TabsManager/utils/index.js +127 -184
- package/es/ProLayout/components/index.js +8 -3
- package/es/ProLayout/index.js +171 -229
- 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 +184 -229
- package/es/ProSelect/propsType.js +0 -1
- 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/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 +185 -219
- 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 +39 -56
- 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 -165
- 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 +254 -458
- 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 -435
- 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 -134
- 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 -3
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import get from "lodash/get";
|
|
2
|
+
import isEqual from "lodash/isEqual";
|
|
3
|
+
import isEqualWith from "lodash/isEqualWith";
|
|
4
|
+
import isFunction from "lodash/isFunction";
|
|
5
5
|
import { customEqualForFunction } from "../../../utils";
|
|
6
6
|
import { getNamePath, isRecordShallowEqual } from "../../utils/tools";
|
|
7
|
-
const ROW_FUNCTION_DEPENDENCY_KEYS = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const ROW_FUNCTION_DEPENDENCY_KEYS = [
|
|
8
|
+
"component",
|
|
9
|
+
"editRender",
|
|
10
|
+
"fieldProps",
|
|
11
|
+
"rules",
|
|
12
|
+
"required",
|
|
13
|
+
"disabled",
|
|
14
|
+
"isEditable",
|
|
15
|
+
"valueType",
|
|
16
|
+
"viewRender"
|
|
17
|
+
];
|
|
18
|
+
const hasRowFunctionDependency = (column) => ROW_FUNCTION_DEPENDENCY_KEYS.some((key) => isFunction(column == null ? void 0 : column[key]));
|
|
19
|
+
const mergeOnFieldChangeRow = (beforeRow, mutatedRow, latestStoreRow) => {
|
|
17
20
|
const before = beforeRow || {};
|
|
18
21
|
const mutated = mutatedRow || {};
|
|
19
22
|
const latest = latestStoreRow || {};
|
|
20
|
-
const changedKeys = Array.from(new Set([...Object.keys(before), ...Object.keys(mutated)])).filter(
|
|
23
|
+
const changedKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(mutated)])).filter(
|
|
24
|
+
(key) => !isEqual(before[key], mutated[key])
|
|
25
|
+
);
|
|
21
26
|
let nextRow = latest;
|
|
22
|
-
changedKeys.forEach(key => {
|
|
23
|
-
const storeChangedExplicitly = !
|
|
27
|
+
changedKeys.forEach((key) => {
|
|
28
|
+
const storeChangedExplicitly = !isEqual(latest[key], before[key]) && !isEqual(latest[key], mutated[key]);
|
|
24
29
|
if (!storeChangedExplicitly) {
|
|
25
30
|
nextRow = {
|
|
26
31
|
...nextRow,
|
|
@@ -30,25 +35,38 @@ export const mergeOnFieldChangeRow = (beforeRow, mutatedRow, latestStoreRow) =>
|
|
|
30
35
|
});
|
|
31
36
|
return nextRow;
|
|
32
37
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
const OMIT_FORM_ITEM_AND_DOM_KEYS = [
|
|
39
|
+
"format",
|
|
40
|
+
"toISOString",
|
|
41
|
+
"toCSTString",
|
|
42
|
+
"switchValue",
|
|
43
|
+
"precision",
|
|
44
|
+
"clearNotShow",
|
|
45
|
+
"dependNames",
|
|
46
|
+
"shouldCellUpdate"
|
|
47
|
+
// 表格内部性能优化属性,不应传递给 Form.Item
|
|
48
|
+
];
|
|
49
|
+
const OMIT_FROM_DOM_KEYS = [
|
|
50
|
+
"disabled",
|
|
51
|
+
// div 不支持 disabled,且值可能非 string/number
|
|
52
|
+
"toCSTString",
|
|
53
|
+
"toISOString",
|
|
54
|
+
"format",
|
|
55
|
+
"switchValue",
|
|
56
|
+
"precision",
|
|
57
|
+
"clearNotShow",
|
|
58
|
+
"dependNames"
|
|
36
59
|
];
|
|
37
|
-
|
|
38
|
-
/** 克隆子元素时需从 props 中剔除,避免透传到 div 等 DOM 导致 React 警告 */
|
|
39
|
-
export const OMIT_FROM_DOM_KEYS = ['disabled',
|
|
40
|
-
// div 不支持 disabled,且值可能非 string/number
|
|
41
|
-
'toCSTString', 'toISOString', 'format', 'switchValue', 'precision', 'clearNotShow', 'dependNames'];
|
|
42
|
-
export const toNamePath = name => {
|
|
60
|
+
const toNamePath = (name) => {
|
|
43
61
|
if (Array.isArray(name)) {
|
|
44
62
|
return name;
|
|
45
63
|
}
|
|
46
64
|
return [name];
|
|
47
65
|
};
|
|
48
|
-
|
|
49
|
-
return names.map(name => toNamePath(name));
|
|
66
|
+
const toNamePaths = (names) => {
|
|
67
|
+
return names.map((name) => toNamePath(name));
|
|
50
68
|
};
|
|
51
|
-
|
|
69
|
+
const getOriginalValue = ({
|
|
52
70
|
namePath,
|
|
53
71
|
originalName,
|
|
54
72
|
originalNames,
|
|
@@ -57,32 +75,31 @@ export const getOriginalValue = ({
|
|
|
57
75
|
form
|
|
58
76
|
}) => {
|
|
59
77
|
if (!originalValues) {
|
|
60
|
-
return
|
|
78
|
+
return void 0;
|
|
61
79
|
}
|
|
62
80
|
let originRecord;
|
|
63
81
|
if (rowKeyPath) {
|
|
64
|
-
const rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1);
|
|
65
|
-
const rowKeyName = rowKeyPath[rowKeyPath.length - 1];
|
|
66
|
-
|
|
82
|
+
const rowValueNamePath = namePath.slice(0, rowKeyPath.length - 1);
|
|
83
|
+
const rowKeyName = rowKeyPath[rowKeyPath.length - 1];
|
|
67
84
|
const rowValue = form.getFieldValue(rowValueNamePath);
|
|
68
|
-
if (!rowValue)
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
if (!rowValue)
|
|
86
|
+
return void 0;
|
|
87
|
+
const keyValue = rowValue[rowKeyName];
|
|
88
|
+
if (!keyValue)
|
|
89
|
+
return void 0;
|
|
90
|
+
const originalValueList = get(originalValues, originalName.slice(0, rowKeyPath.length - 2));
|
|
91
|
+
originRecord = originalValueList == null ? void 0 : originalValueList.find((item) => {
|
|
73
92
|
return item[rowKeyPath[rowKeyPath.length - 1]] === keyValue;
|
|
74
93
|
});
|
|
75
94
|
let originalValue;
|
|
76
|
-
if (originalNames
|
|
77
|
-
const originalNamesValue = originalNames.map(
|
|
78
|
-
return
|
|
95
|
+
if (originalNames == null ? void 0 : originalNames.length) {
|
|
96
|
+
const originalNamesValue = originalNames.map((originalName2) => {
|
|
97
|
+
return get(originRecord, originalName2.slice(rowKeyPath.length - 1));
|
|
79
98
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const fillUndefined = originalNamesValue.every(valItem => valItem === undefined);
|
|
83
|
-
originalValue = fillUndefined ? undefined : originalNamesValue;
|
|
99
|
+
const fillUndefined = originalNamesValue.every((valItem) => valItem === void 0);
|
|
100
|
+
originalValue = fillUndefined ? void 0 : originalNamesValue;
|
|
84
101
|
} else {
|
|
85
|
-
originalValue =
|
|
102
|
+
originalValue = get(originRecord, originalName.slice(rowKeyPath.length - 1));
|
|
86
103
|
}
|
|
87
104
|
return {
|
|
88
105
|
originalValue,
|
|
@@ -90,19 +107,12 @@ export const getOriginalValue = ({
|
|
|
90
107
|
record: rowValue
|
|
91
108
|
};
|
|
92
109
|
}
|
|
93
|
-
|
|
94
|
-
// 这个方法是给editTable专用的 暂时不存在不传rowKey的情况
|
|
95
110
|
return {
|
|
96
|
-
originalValue: originalNames
|
|
111
|
+
originalValue: (originalNames == null ? void 0 : originalNames.length) ? originalNames.map((originalName2) => get(originalValues, originalName2)) : get(originalValues, originalName),
|
|
97
112
|
originRecord
|
|
98
113
|
};
|
|
99
114
|
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* memo 自定义比较函数:只有关键 props 变化时才重新渲染。
|
|
103
|
-
* 从 RenderField 拆出,行为与原内联实现保持一致。
|
|
104
|
-
*/
|
|
105
|
-
export const arePropsEqual = (prevProps, nextProps) => {
|
|
115
|
+
const arePropsEqual = (prevProps, nextProps) => {
|
|
106
116
|
const {
|
|
107
117
|
text: prevText,
|
|
108
118
|
record: prevRecord,
|
|
@@ -117,106 +127,99 @@ export const arePropsEqual = (prevProps, nextProps) => {
|
|
|
117
127
|
column: nextColumn,
|
|
118
128
|
config: nextConfig
|
|
119
129
|
} = nextProps;
|
|
120
|
-
|
|
121
|
-
// 函数型动态属性(component/editRender/fieldProps/rules/required/disabled/isEditable/valueType/viewRender)
|
|
122
|
-
// 可能依赖行内兄弟字段;行对象为同引用(原地修改)时,浅比较无法区分,需强制重渲染
|
|
123
130
|
const hasFunctionDependency = hasRowFunctionDependency(prevColumn) || hasRowFunctionDependency(nextColumn);
|
|
124
131
|
if (hasFunctionDependency && prevRecord === nextRecord) {
|
|
125
132
|
return false;
|
|
126
133
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const prevNamePath = getNamePath(prevConfig?.name, prevConfig?.virtualKey);
|
|
130
|
-
const nextNamePath = getNamePath(nextConfig?.name, nextConfig?.virtualKey);
|
|
134
|
+
const prevNamePath = getNamePath(prevConfig == null ? void 0 : prevConfig.name, prevConfig == null ? void 0 : prevConfig.virtualKey);
|
|
135
|
+
const nextNamePath = getNamePath(nextConfig == null ? void 0 : nextConfig.name, nextConfig == null ? void 0 : nextConfig.virtualKey);
|
|
131
136
|
const prevReactiveParams = {
|
|
132
|
-
form: prevConfig
|
|
137
|
+
form: prevConfig == null ? void 0 : prevConfig.form,
|
|
133
138
|
index: prevIndex,
|
|
134
139
|
namePath: [...prevNamePath, prevIndex]
|
|
135
140
|
};
|
|
136
141
|
const nextReactiveParams = {
|
|
137
|
-
form: nextConfig
|
|
142
|
+
form: nextConfig == null ? void 0 : nextConfig.form,
|
|
138
143
|
index: nextIndex,
|
|
139
144
|
namePath: [...nextNamePath, nextIndex]
|
|
140
145
|
};
|
|
141
|
-
if (
|
|
142
|
-
if (prevColumn
|
|
146
|
+
if (isFunction(prevColumn == null ? void 0 : prevColumn.disabled) && isFunction(nextColumn == null ? void 0 : nextColumn.disabled)) {
|
|
147
|
+
if ((prevColumn == null ? void 0 : prevColumn.disabled(prevRecord, prevReactiveParams)) !== (nextColumn == null ? void 0 : nextColumn.disabled(nextRecord, nextReactiveParams))) {
|
|
143
148
|
return false;
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
|
-
|
|
147
|
-
// fieldProps 函数化直接更新,无法比对返回值是否一致
|
|
148
|
-
// 优化:不直接调用函数,而是比较输入参数(record 和 reactiveParams)
|
|
149
|
-
// 如果输入参数相同,fieldProps 的返回值应该相同(纯函数假设)
|
|
150
|
-
if (_isFunction(prevColumn?.fieldProps) && _isFunction(nextColumn?.fieldProps)) {
|
|
151
|
-
// 比较 record 数据是否变化(浅比较,虚拟滚动性能优化)
|
|
151
|
+
if (isFunction(prevColumn == null ? void 0 : prevColumn.fieldProps) && isFunction(nextColumn == null ? void 0 : nextColumn.fieldProps)) {
|
|
152
152
|
if (!isRecordShallowEqual(prevRecord, nextRecord)) {
|
|
153
153
|
return false;
|
|
154
154
|
}
|
|
155
|
-
// reactiveParams 中的 form、index、namePath 已经在外层比较过了,无需重复比较
|
|
156
155
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
156
|
+
if (!isFunction(prevColumn == null ? void 0 : prevColumn.fieldProps) && !isFunction(nextColumn == null ? void 0 : nextColumn.fieldProps)) {
|
|
157
|
+
const isFieldPropsEqual = isEqualWith(
|
|
158
|
+
prevColumn == null ? void 0 : prevColumn.fieldProps,
|
|
159
|
+
nextColumn == null ? void 0 : nextColumn.fieldProps,
|
|
160
|
+
customEqualForFunction
|
|
161
|
+
);
|
|
160
162
|
if (!isFieldPropsEqual) {
|
|
161
163
|
return false;
|
|
162
164
|
}
|
|
163
165
|
}
|
|
164
|
-
|
|
165
|
-
// 通用函数比较方法
|
|
166
|
-
// 优化:不直接调用函数,而是比较函数引用和输入参数
|
|
167
166
|
const compareFunctionResult = (prevCol, nextCol, prevValues, nextValues, _prevReactiveParams, _nextReactiveParams, functionName) => {
|
|
168
|
-
const prevFunc = prevCol
|
|
169
|
-
const nextFunc = nextCol
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// 同引用函数,比较输入参数(纯函数假设:输入相同则输出相同)
|
|
167
|
+
const prevFunc = prevCol == null ? void 0 : prevCol[functionName];
|
|
168
|
+
const nextFunc = nextCol == null ? void 0 : nextCol[functionName];
|
|
169
|
+
if (isFunction(prevFunc) && isFunction(nextFunc)) {
|
|
170
|
+
if (prevFunc !== nextFunc)
|
|
171
|
+
return false;
|
|
174
172
|
return isRecordShallowEqual(prevValues, nextValues);
|
|
175
173
|
}
|
|
176
|
-
return true;
|
|
174
|
+
return true;
|
|
177
175
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
const functionFields = ["rules", "component", "desensitization", "isEditable", "required"];
|
|
177
|
+
if (functionFields.some(
|
|
178
|
+
(field) => !compareFunctionResult(
|
|
179
|
+
prevColumn,
|
|
180
|
+
nextColumn,
|
|
181
|
+
prevRecord,
|
|
182
|
+
nextRecord,
|
|
183
|
+
prevReactiveParams,
|
|
184
|
+
nextReactiveParams,
|
|
185
|
+
field
|
|
186
|
+
)
|
|
187
|
+
)) {
|
|
182
188
|
return false;
|
|
183
189
|
}
|
|
184
|
-
|
|
185
|
-
// 基本props比较
|
|
186
|
-
if (!_isEqual(prevText, nextText) || prevIndex !== nextIndex) {
|
|
190
|
+
if (!isEqual(prevText, nextText) || prevIndex !== nextIndex) {
|
|
187
191
|
return false;
|
|
188
192
|
}
|
|
189
|
-
|
|
190
|
-
// 记录关键字段比较(避免完整对象比较的性能开销)
|
|
191
|
-
if (prevRecord?.rowKey !== nextRecord?.rowKey || prevRecord?._addFlag !== nextRecord?._addFlag) {
|
|
193
|
+
if ((prevRecord == null ? void 0 : prevRecord.rowKey) !== (nextRecord == null ? void 0 : nextRecord.rowKey) || (prevRecord == null ? void 0 : prevRecord._addFlag) !== (nextRecord == null ? void 0 : nextRecord._addFlag)) {
|
|
192
194
|
return false;
|
|
193
195
|
}
|
|
194
|
-
|
|
195
|
-
// 列配置比较(只比较关键字段),required,disabled为函数时,需要重新计算
|
|
196
|
-
if (prevColumn?.dataIndex !== nextColumn?.dataIndex || prevColumn?.type !== nextColumn?.type || prevColumn?.name !== nextColumn?.name) {
|
|
196
|
+
if ((prevColumn == null ? void 0 : prevColumn.dataIndex) !== (nextColumn == null ? void 0 : nextColumn.dataIndex) || (prevColumn == null ? void 0 : prevColumn.type) !== (nextColumn == null ? void 0 : nextColumn.type) || (prevColumn == null ? void 0 : prevColumn.name) !== (nextColumn == null ? void 0 : nextColumn.name)) {
|
|
197
197
|
return false;
|
|
198
198
|
}
|
|
199
|
-
|
|
200
|
-
// config中关键字段比较
|
|
201
|
-
if (prevConfig?._isEditing !== nextConfig?._isEditing || prevConfig?.mode !== nextConfig?.mode) {
|
|
199
|
+
if ((prevConfig == null ? void 0 : prevConfig._isEditing) !== (nextConfig == null ? void 0 : nextConfig._isEditing) || (prevConfig == null ? void 0 : prevConfig.mode) !== (nextConfig == null ? void 0 : nextConfig.mode)) {
|
|
202
200
|
return false;
|
|
203
201
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const prevDataIndex = prevColumn?.dataIndex;
|
|
207
|
-
const nextDataIndex = nextColumn?.dataIndex;
|
|
202
|
+
const prevDataIndex = prevColumn == null ? void 0 : prevColumn.dataIndex;
|
|
203
|
+
const nextDataIndex = nextColumn == null ? void 0 : nextColumn.dataIndex;
|
|
208
204
|
if (prevDataIndex && nextDataIndex && prevDataIndex === nextDataIndex) {
|
|
209
|
-
if (prevRecord
|
|
205
|
+
if ((prevRecord == null ? void 0 : prevRecord[prevDataIndex]) !== (nextRecord == null ? void 0 : nextRecord[nextDataIndex])) {
|
|
210
206
|
return false;
|
|
211
207
|
}
|
|
212
208
|
}
|
|
213
|
-
|
|
214
|
-
// 特殊处理:当使用自定义 component 函数时,比较整个 record 对象
|
|
215
|
-
// 因为自定义组件可能依赖 record 中的其他字段(不只是当前列的 dataIndex)
|
|
216
|
-
if (_isFunction(prevColumn?.component) || _isFunction(nextColumn?.component)) {
|
|
209
|
+
if (isFunction(prevColumn == null ? void 0 : prevColumn.component) || isFunction(nextColumn == null ? void 0 : nextColumn.component)) {
|
|
217
210
|
if (!isRecordShallowEqual(prevRecord, nextRecord)) {
|
|
218
211
|
return false;
|
|
219
212
|
}
|
|
220
213
|
}
|
|
221
214
|
return true;
|
|
222
|
-
};
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
OMIT_FORM_ITEM_AND_DOM_KEYS,
|
|
218
|
+
OMIT_FROM_DOM_KEYS,
|
|
219
|
+
arePropsEqual,
|
|
220
|
+
getOriginalValue,
|
|
221
|
+
hasRowFunctionDependency,
|
|
222
|
+
mergeOnFieldChangeRow,
|
|
223
|
+
toNamePath,
|
|
224
|
+
toNamePaths
|
|
225
|
+
};
|
|
@@ -1,38 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Space } from "antd";
|
|
3
4
|
import { actions, defaultBtnNameMap, defaultToolbarKeys } from "../../utils/config";
|
|
4
5
|
import ActionButton from "../ActionButton";
|
|
5
6
|
import { getNamePath } from "../../utils/tools";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const RenderToolbar = config => {
|
|
10
|
-
const {
|
|
11
|
-
emptyBtnText,
|
|
12
|
-
toolbarProps,
|
|
13
|
-
name,
|
|
14
|
-
virtualKey,
|
|
15
|
-
disabled,
|
|
16
|
-
tableLength
|
|
17
|
-
} = config;
|
|
7
|
+
const RenderToolbar = (config) => {
|
|
8
|
+
const { emptyBtnText, toolbarProps, name, virtualKey, disabled, tableLength } = config;
|
|
18
9
|
const virtualName = getNamePath(name, virtualKey);
|
|
19
|
-
// toolbarProps配置为false 默认不插入
|
|
20
10
|
if (toolbarProps === false || disabled) {
|
|
21
11
|
return null;
|
|
22
12
|
}
|
|
23
13
|
let nextToolbarProps = [...toolbarProps];
|
|
24
14
|
if (tableLength) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
type: key
|
|
30
|
-
};
|
|
15
|
+
if (!(toolbarProps == null ? void 0 : toolbarProps.length)) {
|
|
16
|
+
nextToolbarProps = defaultToolbarKeys.map((key) => {
|
|
17
|
+
return { type: key };
|
|
31
18
|
});
|
|
32
19
|
} else {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (!toolbarProps.find(action => action.type === key)) {
|
|
20
|
+
defaultToolbarKeys.forEach((key) => {
|
|
21
|
+
if (!toolbarProps.find((action) => action.type === key)) {
|
|
36
22
|
nextToolbarProps.push({
|
|
37
23
|
type: key
|
|
38
24
|
});
|
|
@@ -40,62 +26,46 @@ const RenderToolbar = config => {
|
|
|
40
26
|
});
|
|
41
27
|
}
|
|
42
28
|
} else {
|
|
43
|
-
const addConfig = toolbarProps.find(action => action.type ===
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
const addConfig = toolbarProps.find((action) => action.type === "add");
|
|
30
|
+
const persistenceToolBar = toolbarProps.filter((action) => action == null ? void 0 : action.persistence);
|
|
31
|
+
nextToolbarProps = [
|
|
32
|
+
{
|
|
33
|
+
...addConfig,
|
|
34
|
+
type: "add",
|
|
35
|
+
label: (addConfig == null ? void 0 : addConfig.isSelectModal) ? addConfig.label : emptyBtnText,
|
|
36
|
+
icon: false
|
|
37
|
+
},
|
|
38
|
+
...persistenceToolBar
|
|
39
|
+
];
|
|
52
40
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const toolbarBtns = nextToolbarProps.map(toolbar => {
|
|
56
|
-
const {
|
|
57
|
-
type,
|
|
58
|
-
label,
|
|
59
|
-
show,
|
|
60
|
-
onHandle,
|
|
61
|
-
needConfirm,
|
|
62
|
-
onClick,
|
|
63
|
-
isSelectModal,
|
|
64
|
-
...buttonProps
|
|
65
|
-
} = toolbar;
|
|
41
|
+
const toolbarBtns = nextToolbarProps.map((toolbar) => {
|
|
42
|
+
const { type, label, show, onHandle, needConfirm, onClick, isSelectModal, ...buttonProps } = toolbar;
|
|
66
43
|
toolbar.isEditable = false;
|
|
67
44
|
toolbar.label = label ?? defaultBtnNameMap[type];
|
|
68
45
|
toolbar.show = show ?? true;
|
|
69
46
|
toolbar.needConfirm = needConfirm ?? true;
|
|
70
|
-
toolbar.onEvent = async (record, {
|
|
71
|
-
index,
|
|
72
|
-
form,
|
|
73
|
-
name,
|
|
74
|
-
namePath,
|
|
75
|
-
tableLength,
|
|
76
|
-
selectedRows
|
|
77
|
-
}) => {
|
|
47
|
+
toolbar.onEvent = async (record, { index, form, name: name2, namePath, tableLength: tableLength2, selectedRows }) => {
|
|
78
48
|
const onEvent = onClick || onHandle;
|
|
79
49
|
let result;
|
|
80
50
|
if (!onEvent) {
|
|
81
51
|
result = true;
|
|
82
52
|
} else {
|
|
83
|
-
result = await onEvent
|
|
53
|
+
result = await (onEvent == null ? void 0 : onEvent(record, {
|
|
84
54
|
index,
|
|
85
55
|
form,
|
|
86
|
-
name,
|
|
56
|
+
name: name2,
|
|
87
57
|
namePath,
|
|
88
|
-
tableLength,
|
|
58
|
+
tableLength: tableLength2,
|
|
89
59
|
selectedRows
|
|
90
|
-
});
|
|
60
|
+
}));
|
|
91
61
|
}
|
|
92
|
-
if (result !== false && type !==
|
|
62
|
+
if (result !== false && type !== "custom") {
|
|
93
63
|
const actionHandler = actions[type];
|
|
94
64
|
actionHandler({
|
|
95
65
|
...config,
|
|
96
66
|
index,
|
|
97
67
|
record,
|
|
98
|
-
name,
|
|
68
|
+
name: name2,
|
|
99
69
|
result,
|
|
100
70
|
virtualName
|
|
101
71
|
});
|
|
@@ -105,20 +75,24 @@ const RenderToolbar = config => {
|
|
|
105
75
|
return toolbar;
|
|
106
76
|
});
|
|
107
77
|
const renderToolbarBtns = () => {
|
|
108
|
-
return toolbarBtns.map(btnConfig => {
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
78
|
+
return toolbarBtns.map((btnConfig) => {
|
|
79
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsx(
|
|
80
|
+
ActionButton,
|
|
81
|
+
{
|
|
82
|
+
...{
|
|
83
|
+
config,
|
|
84
|
+
btnConfig: {
|
|
85
|
+
...btnConfig,
|
|
86
|
+
editingKeys: []
|
|
87
|
+
}
|
|
115
88
|
}
|
|
116
|
-
}
|
|
117
|
-
}, `${btnConfig
|
|
89
|
+
}
|
|
90
|
+
) }, `${btnConfig == null ? void 0 : btnConfig.label}${btnConfig == null ? void 0 : btnConfig.type}`);
|
|
118
91
|
});
|
|
119
92
|
};
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
|
|
93
|
+
return /* @__PURE__ */ jsx(Space, { children: renderToolbarBtns() });
|
|
94
|
+
};
|
|
95
|
+
var RenderToolbar_default = RenderToolbar;
|
|
96
|
+
export {
|
|
97
|
+
RenderToolbar_default as default
|
|
123
98
|
};
|
|
124
|
-
export default RenderToolbar;
|
|
@@ -1,89 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Table, Space } from "antd";
|
|
3
|
+
import { tools } from "@zat-design/utils";
|
|
3
4
|
import { valueTypeRender } from "../../../ProUtils/utils";
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
calc
|
|
7
|
-
} = tools;
|
|
8
|
-
const formatSummaryColumns = (columns, {
|
|
9
|
-
rowSelection
|
|
10
|
-
}) => {
|
|
5
|
+
const { calc } = tools;
|
|
6
|
+
const formatSummaryColumns = (columns, { rowSelection }) => {
|
|
11
7
|
const nextColumns = [...columns];
|
|
12
8
|
if (!rowSelection) {
|
|
13
|
-
nextColumns.forEach(column => {
|
|
14
|
-
column.index = calc(column.index ?? 0,
|
|
9
|
+
nextColumns.forEach((column) => {
|
|
10
|
+
column.index = calc(column.index ?? 0, "-", 1);
|
|
15
11
|
});
|
|
16
12
|
}
|
|
17
|
-
const {
|
|
18
|
-
index: firstIndex
|
|
19
|
-
} = nextColumns?.[0] || {};
|
|
13
|
+
const { index: firstIndex } = (nextColumns == null ? void 0 : nextColumns[0]) || {};
|
|
20
14
|
if (firstIndex !== 0) {
|
|
21
|
-
const colSpan = calc(firstIndex ?? 0,
|
|
15
|
+
const colSpan = calc(firstIndex ?? 0, "-", 1);
|
|
22
16
|
nextColumns.unshift({
|
|
23
17
|
index: 0,
|
|
24
|
-
colSpan: colSpan === 0 ?
|
|
18
|
+
colSpan: colSpan === 0 ? void 0 : colSpan
|
|
25
19
|
});
|
|
26
20
|
}
|
|
27
21
|
return nextColumns;
|
|
28
22
|
};
|
|
29
|
-
const Summary = ({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
columns,
|
|
36
|
-
total = true,
|
|
37
|
-
fixed = true
|
|
38
|
-
} = summary || {};
|
|
39
|
-
const nextColumns = formatSummaryColumns(columns, {
|
|
40
|
-
rowSelection
|
|
41
|
-
});
|
|
42
|
-
const renderCell = item => {
|
|
43
|
-
const {
|
|
44
|
-
key,
|
|
45
|
-
title,
|
|
46
|
-
precision,
|
|
47
|
-
valueType
|
|
48
|
-
} = item;
|
|
23
|
+
const Summary = ({ data, summary, rowSelection }) => {
|
|
24
|
+
const { columns, total = true, fixed = true } = summary || {};
|
|
25
|
+
const nextColumns = formatSummaryColumns(columns, { rowSelection });
|
|
26
|
+
const renderCell = (item) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const { key, title, precision, valueType } = item;
|
|
49
29
|
if (title) {
|
|
50
30
|
return title;
|
|
51
31
|
}
|
|
52
32
|
if (total && key) {
|
|
53
|
-
const format = valueTypeRender
|
|
54
|
-
const sum = data
|
|
55
|
-
return calc(pre,
|
|
33
|
+
const format = (_a = valueTypeRender) == null ? void 0 : _a[valueType];
|
|
34
|
+
const sum = (_b = data == null ? void 0 : data.reduce) == null ? void 0 : _b.call(data, (pre, cur) => {
|
|
35
|
+
return calc(pre, "+", cur[key] ?? 0);
|
|
56
36
|
}, 0);
|
|
57
37
|
return format ? format(sum, precision ?? 2) : sum;
|
|
58
38
|
}
|
|
59
39
|
return null;
|
|
60
40
|
};
|
|
61
|
-
|
|
62
|
-
// 当编辑列表没有数据时,不展示底部合计栏
|
|
63
|
-
if (!data?.length) {
|
|
41
|
+
if (!(data == null ? void 0 : data.length)) {
|
|
64
42
|
return null;
|
|
65
43
|
}
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
44
|
+
return /* @__PURE__ */ jsx(Table.Summary, { fixed, children: /* @__PURE__ */ jsx(Table.Summary.Row, { children: nextColumns.map((item) => {
|
|
45
|
+
const { index, colSpan, prefix, key: columnKey } = item;
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
Table.Summary.Cell,
|
|
48
|
+
{
|
|
49
|
+
index,
|
|
50
|
+
colSpan,
|
|
51
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
73
52
|
prefix,
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, columnKey ?? `summary-col-${index}`);
|
|
85
|
-
})
|
|
86
|
-
})
|
|
87
|
-
});
|
|
53
|
+
/* @__PURE__ */ jsx("span", { children: renderCell(item) })
|
|
54
|
+
] })
|
|
55
|
+
},
|
|
56
|
+
columnKey ?? `summary-col-${index}`
|
|
57
|
+
);
|
|
58
|
+
}) }) });
|
|
59
|
+
};
|
|
60
|
+
var Summary_default = Summary;
|
|
61
|
+
export {
|
|
62
|
+
Summary_default as default
|
|
88
63
|
};
|
|
89
|
-
export default Summary;
|