zmdms-webui 2.9.8 → 3.0.0

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.
@@ -41,7 +41,7 @@ import DynamicSetting from '../dynamicsetting/dynamicSetting.js';
41
41
 
42
42
  function CanvasTable(props) {
43
43
  var _a;
44
- var _b = props.dataSource, dataSource = _b === void 0 ? [] : _b, _c = props.columns, columns = _c === void 0 ? [] : _c, _d = props.rowKey, rowKey = _d === void 0 ? "id" : _d, _e = props.height, height = _e === void 0 ? 600 : _e, width = props.width, _f = props.rowHeight, rowHeight = _f === void 0 ? 36 : _f, _g = props.headerHeight, headerHeight = _g === void 0 ? 36 : _g, rowSelection = props.rowSelection, onSortChange = props.onSortChange, onFilterChange = props.onFilterChange, onScroll = props.onScroll, onRowClick = props.onRowClick, onColumnResize = props.onColumnResize, _h = props.bordered, bordered = _h === void 0 ? true : _h, _j = props.striped, striped = _j === void 0 ? false : _j, _k = props.emptyText, emptyText = _k === void 0 ? "暂无数据" : _k, style = props.style, className = props.className, _l = props.loading, loading = _l === void 0 ? false : _l, _m = props.isContextMenu, isContextMenu = _m === void 0 ? true : _m, isFullscreenHandle = props.isFullscreenHandle, mode = props.mode, dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, customDynamicListHandle = props.customDynamicListHandle, isDimensionDynamic = props.isDimensionDynamic, dimensionCustomSumKeys = props.dimensionCustomSumKeys, isAutoMerge = props.isAutoMerge, _o = props.isIndexMerge, isIndexMerge = _o === void 0 ? true : _o, _p = props.isSelectionMerge, isSelectionMerge = _p === void 0 ? false : _p, _q = props.renderMode, renderMode = _q === void 0 ? "object" : _q, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, _r = props.summaryFixed, summaryFixed = _r === void 0 ? false : _r, _s = props.isAutoScrollY, isAutoScrollY = _s === void 0 ? false : _s, _t = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _t === void 0 ? 65 : _t, canvasTableId = props.canvasTableId, headerWrap = props.headerWrap, _u = props.headerAlign, headerAlign = _u === void 0 ? "center" : _u, tableRefHandle = props.tableRefHandle, exportExcelConfig = props.exportExcelConfig, _v = props.maxHeight, maxHeight = _v === void 0 ? 3000 : _v, expandable = props.expandable;
44
+ var _b = props.dataSource, dataSource = _b === void 0 ? [] : _b, _c = props.columns, columns = _c === void 0 ? [] : _c, _d = props.rowKey, rowKey = _d === void 0 ? "id" : _d, _e = props.height, height = _e === void 0 ? 600 : _e, width = props.width, _f = props.rowHeight, rowHeight = _f === void 0 ? 36 : _f, _g = props.headerHeight, headerHeight = _g === void 0 ? 36 : _g, rowSelection = props.rowSelection, onSortChange = props.onSortChange, onFilterChange = props.onFilterChange, onScroll = props.onScroll, onRowClick = props.onRowClick, onColumnResize = props.onColumnResize, _h = props.bordered, bordered = _h === void 0 ? true : _h, _j = props.striped, striped = _j === void 0 ? false : _j, _k = props.emptyText, emptyText = _k === void 0 ? "暂无数据" : _k, style = props.style, className = props.className, _l = props.loading, loading = _l === void 0 ? false : _l, _m = props.isContextMenu, isContextMenu = _m === void 0 ? true : _m, isFullscreenHandle = props.isFullscreenHandle, mode = props.mode, dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, customDynamicListHandle = props.customDynamicListHandle, isDimensionDynamic = props.isDimensionDynamic, _o = props.isDimensionMergeChildren, isDimensionMergeChildren = _o === void 0 ? true : _o, dimensionCustomSumKeys = props.dimensionCustomSumKeys, isAutoMerge = props.isAutoMerge, _p = props.isIndexMerge, isIndexMerge = _p === void 0 ? true : _p, _q = props.isSelectionMerge, isSelectionMerge = _q === void 0 ? false : _q, _r = props.renderMode, renderMode = _r === void 0 ? "object" : _r, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, _s = props.summaryFixed, summaryFixed = _s === void 0 ? false : _s, _t = props.isAutoScrollY, isAutoScrollY = _t === void 0 ? false : _t, _u = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _u === void 0 ? 65 : _u, canvasTableId = props.canvasTableId, headerWrap = props.headerWrap, _v = props.headerAlign, headerAlign = _v === void 0 ? "center" : _v, tableRefHandle = props.tableRefHandle, exportExcelConfig = props.exportExcelConfig, _w = props.maxHeight, maxHeight = _w === void 0 ? 3000 : _w, expandable = props.expandable;
45
45
  var actualMode = "mode" in props ? mode : "index";
46
46
  var canvasRef = useRef(null);
47
47
  var containerRef = useRef(null);
@@ -64,17 +64,17 @@ function CanvasTable(props) {
64
64
  return String((_a = record[rowKey]) !== null && _a !== void 0 ? _a : index);
65
65
  }, [rowKey]);
66
66
  // 动态列配置
67
- var _w = useDynamicListByColumns(columns, {
67
+ var _x = useDynamicListByColumns(columns, {
68
68
  dynamicKey: dynamicKey,
69
69
  dynamicVersion: dynamicVersion,
70
70
  customDynamicListHandle: customDynamicListHandle,
71
- }), defaultDynamicList = _w.defaultDynamicList, currentDynamicList = _w.currentDynamicList, onCurrentListChange = _w.onCurrentListChange, dynamicSettingRef = _w.dynamicSettingRef;
71
+ }), defaultDynamicList = _x.defaultDynamicList, currentDynamicList = _x.currentDynamicList, onCurrentListChange = _x.onCurrentListChange, dynamicSettingRef = _x.dynamicSettingRef;
72
72
  // 根据动态列配置处理columns
73
73
  var dynamicColumns = useMemo(function () { return getTableColumns(columns, currentDynamicList); }, [columns, currentDynamicList]).columns;
74
74
  // 内部列宽状态(未开启动态配置时使用)
75
- var _x = useState({}), internalColumnWidths = _x[0], setInternalColumnWidths = _x[1];
75
+ var _y = useState({}), internalColumnWidths = _y[0], setInternalColumnWidths = _y[1];
76
76
  // 跟踪用户手动调整过宽度的列(用于排除自动宽度分配)
77
- var _y = useState(new Set()), manuallyResizedColumnKeys = _y[0], setManuallyResizedColumnKeys = _y[1];
77
+ var _z = useState(new Set()), manuallyResizedColumnKeys = _z[0], setManuallyResizedColumnKeys = _z[1];
78
78
  // 处理选中框列、序号列等
79
79
  var processedColumnsOld = useProcessedColumns({
80
80
  columns: columns,
@@ -89,30 +89,31 @@ function CanvasTable(props) {
89
89
  headerAlign: headerAlign,
90
90
  });
91
91
  // 表格状态管理
92
- var _z = useTableState({
92
+ var _0 = useTableState({
93
93
  dataSource: dataSource,
94
94
  columns: processedColumnsOld,
95
95
  rowSelection: rowSelection,
96
96
  onFilterChange: onFilterChange,
97
97
  isAutoMerge: isAutoMerge,
98
- }), state = _z.state, setState = _z.setState, processedDataSource = _z.processedDataSource, handleFilterChange = _z.handleFilterChange, closeFilterPopover = _z.closeFilterPopover, autoGeneratedFilters = _z.autoGeneratedFilters;
98
+ }), state = _0.state, setState = _0.setState, processedDataSource = _0.processedDataSource, handleFilterChange = _0.handleFilterChange, closeFilterPopover = _0.closeFilterPopover, autoGeneratedFilters = _0.autoGeneratedFilters;
99
99
  // 树形展开管理
100
- var _0 = useExpandable({
100
+ var _1 = useExpandable({
101
101
  dataSource: dataSource,
102
102
  expandable: expandable,
103
103
  rowKey: rowKey,
104
- }), expandedKeys = _0.expandedKeys, flattenedData = _0.flattenedData, toggleExpand = _0.toggleExpand, expandRow = _0.expandRow, collapseRow = _0.collapseRow, setExpandedRowKeys = _0.setExpandedRowKeys, hasExpandable = _0.hasExpandable;
104
+ }), expandedKeys = _1.expandedKeys, flattenedData = _1.flattenedData, toggleExpand = _1.toggleExpand, expandRow = _1.expandRow, collapseRow = _1.collapseRow, setExpandedRowKeys = _1.setExpandedRowKeys, hasExpandable = _1.hasExpandable;
105
105
  var order = useMemo(function () {
106
106
  return state.sortOrder && state.sortField
107
107
  ? { field: state.sortField, order: state.sortOrder }
108
108
  : undefined;
109
109
  }, [state.sortOrder, state.sortField]);
110
- var _1 = useAutoMerge(processedDataSource, processedColumnsOld, {
110
+ var _2 = useAutoMerge(processedDataSource, processedColumnsOld, {
111
111
  isAutoMerge: isAutoMerge,
112
112
  isDimensionDynamic: isDimensionDynamic,
113
+ isDimensionMergeChildren: isDimensionMergeChildren,
113
114
  order: order,
114
115
  dimensionCustomSumKeys: dimensionCustomSumKeys,
115
- }), newDataSource = _1[0], processedColumns = _1[1];
116
+ }), newDataSource = _2[0], processedColumns = _2[1];
116
117
  // 如果开启了树形展开,使用扁平化后的数据源
117
118
  var expandedDataSource = useMemo(function () {
118
119
  if (hasExpandable) {
@@ -121,14 +122,14 @@ function CanvasTable(props) {
121
122
  return newDataSource;
122
123
  }, [hasExpandable, flattenedData, newDataSource]);
123
124
  // 生成合计行和最终数据源
124
- var _2 = useSummaryRow({
125
+ var _3 = useSummaryRow({
125
126
  columns: processedColumns,
126
127
  dataSource: expandedDataSource,
127
- }), finalDataSource = _2.finalDataSource, hasSummaryRow = _2.hasSummaryRow;
128
+ }), finalDataSource = _3.finalDataSource, hasSummaryRow = _3.hasSummaryRow;
128
129
  // 用于存储计算后的表头高度(用于自动高度的精确计算)
129
- var _3 = useState(undefined), preciseHeaderHeight = _3[0], setPreciseHeaderHeight = _3[1];
130
+ var _4 = useState(undefined), preciseHeaderHeight = _4[0], setPreciseHeaderHeight = _4[1];
130
131
  // 用于存储是否需要横向滚动条(用于自动高度的精确计算)
131
- var _4 = useState(false), needHorizontalScrollbar = _4[0], setNeedHorizontalScrollbar = _4[1];
132
+ var _5 = useState(false), needHorizontalScrollbar = _5[0], setNeedHorizontalScrollbar = _5[1];
132
133
  // 自动高度计算(需要在容器尺寸计算之前)
133
134
  var autoHeight = useCanvasTableAutoHeight(isAutoScrollY, autoScrollYMarginBottom, canvasTableId, finalDataSource.length, // 数据行数(用于 content 模式)
134
135
  headerHeight, // 表头基础高度(用于 content 模式的初始计算)
@@ -195,7 +196,7 @@ function CanvasTable(props) {
195
196
  return calculateTotalHeight(calculatedHeaderHeight, finalDataSource.length, rowHeight);
196
197
  }, [calculatedHeaderHeight, finalDataSource.length, rowHeight]);
197
198
  // 计算滚动条指标
198
- var _5 = useScrollbarMetrics({
199
+ var _6 = useScrollbarMetrics({
199
200
  containerWidth: containerWidth,
200
201
  containerHeight: containerHeight,
201
202
  totalWidth: totalWidth,
@@ -203,14 +204,14 @@ function CanvasTable(props) {
203
204
  headerHeight: calculatedHeaderHeight,
204
205
  scrollTop: 0,
205
206
  scrollLeft: 0,
206
- }), maxScrollTop = _5.maxScrollTop, maxScrollLeft = _5.maxScrollLeft;
207
+ }), maxScrollTop = _6.maxScrollTop, maxScrollLeft = _6.maxScrollLeft;
207
208
  // 滚动管理(使用预先计算的maxScrollTop和maxScrollLeft)
208
- var _6 = useTableScroll({
209
+ var _7 = useTableScroll({
209
210
  containerRef: containerRef,
210
211
  maxScrollTop: maxScrollTop,
211
212
  maxScrollLeft: maxScrollLeft,
212
213
  onScroll: onScroll,
213
- }), scrollState = _6.scrollState, setScrollState = _6.setScrollState;
214
+ }), scrollState = _7.scrollState, setScrollState = _7.setScrollState;
214
215
  // 使用 ref 保存最新的滚动位置,确保在组件卸载过程中仍能访问
215
216
  var scrollPositionRef = useRef({ x: 0, y: 0 });
216
217
  useEffect(function () {
@@ -254,12 +255,12 @@ function CanvasTable(props) {
254
255
  needHorizontalScrollbar,
255
256
  ]);
256
257
  // 单元格框选
257
- var _7 = useTableSelection({
258
+ var _8 = useTableSelection({
258
259
  state: state,
259
260
  setState: setState,
260
261
  }),
261
262
  // selectionStartRef,
262
- startSelection = _7.startSelection, updateSelection = _7.updateSelection, extendSelection = _7.extendSelection;
263
+ startSelection = _8.startSelection, updateSelection = _8.updateSelection, extendSelection = _8.extendSelection;
263
264
  // 处理列宽调整
264
265
  var handleColumnResize = useCallback(function (columnKey, newWidth) {
265
266
  var _a;
@@ -314,20 +315,20 @@ function CanvasTable(props) {
314
315
  onCurrentListChange,
315
316
  ]);
316
317
  // 列宽调整
317
- var _8 = useColumnResize({
318
+ var _9 = useColumnResize({
318
319
  columnRenderInfos: columnRenderInfos,
319
320
  containerWidth: containerWidth,
320
321
  headerHeight: calculatedHeaderHeight,
321
322
  scrollLeft: scrollState.scrollLeft,
322
323
  onColumnResize: handleColumnResize,
323
- }), resizeState = _8.resizeState, checkResizeHandle = _8.checkResizeHandle, startResize = _8.startResize, updateResize = _8.updateResize, endResize = _8.endResize, setHoverResizeColumn = _8.setHoverResizeColumn, getColumnWidth = _8.getColumnWidth, RESIZE_HANDLE_WIDTH = _8.RESIZE_HANDLE_WIDTH;
324
+ }), resizeState = _9.resizeState, checkResizeHandle = _9.checkResizeHandle, startResize = _9.startResize, updateResize = _9.updateResize, endResize = _9.endResize, setHoverResizeColumn = _9.setHoverResizeColumn, getColumnWidth = _9.getColumnWidth, RESIZE_HANDLE_WIDTH = _9.RESIZE_HANDLE_WIDTH;
324
325
  // 复制到剪贴板
325
- var _9 = useCopyToClipboard({
326
+ var _10 = useCopyToClipboard({
326
327
  cellSelection: state.cellSelection,
327
328
  processedDataSource: finalDataSource,
328
329
  columns: processedColumns,
329
330
  containerRef: containerRef,
330
- }), getSelectedCellsText = _9.getSelectedCellsText, copyToClipboard = _9.copyToClipboard;
331
+ }), getSelectedCellsText = _10.getSelectedCellsText, copyToClipboard = _10.copyToClipboard;
331
332
  // 处理右键菜单的复制操作
332
333
  var handleCopy = useCallback(function () {
333
334
  var text = getSelectedCellsText();
@@ -347,7 +348,7 @@ function CanvasTable(props) {
347
348
  childrenColumnName: (_a = props.expandable) === null || _a === void 0 ? void 0 : _a.childrenColumnName,
348
349
  });
349
350
  // 交互事件处理(使用baseScrollbarMetrics的maxScrollTop/maxScrollLeft以保持稳定)
350
- var _10 = useTableInteraction({
351
+ var _11 = useTableInteraction({
351
352
  state: state,
352
353
  setState: setState,
353
354
  scrollState: scrollState,
@@ -397,7 +398,7 @@ function CanvasTable(props) {
397
398
  fixedRowsCount: fixedRowsCount,
398
399
  fixedRowsConfig: fixedRowsConfig,
399
400
  summaryFixed: summaryFixed,
400
- }), handleCanvasMouseDown = _10.handleCanvasMouseDown, handleCanvasMouseMove = _10.handleCanvasMouseMove, handleCanvasMouseUp = _10.handleCanvasMouseUp, handleCanvasMouseLeave = _10.handleCanvasMouseLeave, handleCanvasContextMenu = _10.handleCanvasContextMenu;
401
+ }), handleCanvasMouseDown = _11.handleCanvasMouseDown, handleCanvasMouseMove = _11.handleCanvasMouseMove, handleCanvasMouseUp = _11.handleCanvasMouseUp, handleCanvasMouseLeave = _11.handleCanvasMouseLeave, handleCanvasContextMenu = _11.handleCanvasContextMenu;
401
402
  // 渲染表格
402
403
  useTableRender(__assign(__assign({ canvasRef: canvasRef, processedDataSource: finalDataSource, columnRenderInfos: columnRenderInfos, columns: processedColumns, // 传递原始columns用于渲染多级表头
403
404
  state: state, scrollState: scrollState, rowSelection: rowSelection, containerWidth: containerWidth, containerHeight: containerHeight, headerHeight: calculatedHeaderHeight, baseHeaderHeight: headerHeight, // 传入原始基础高度用于计算每层高度
@@ -48,17 +48,17 @@ function useCanvasTableAutoHeight(isAutoScrollY, marginBottom, canvasTableId, da
48
48
  return;
49
49
  }
50
50
  // 视口模式:根据页面位置计算高度
51
+ // 构建表格选择器
52
+ var tableSelector = canvasTableId
53
+ ? "#".concat(CSS.escape(canvasTableId), " .canvas-table-container")
54
+ : ".canvas-table-container";
51
55
  var calculateHeight = function () {
52
- var _a, _b;
53
- // 查找容器元素
54
- var containerRect = (_a = document
55
- .querySelector(".ztxk-container")) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
56
56
  // 查找CanvasTable元素
57
- var tableSelector = canvasTableId
58
- ? "#".concat(CSS.escape(canvasTableId), " .canvas-table-container")
59
- : ".canvas-table-container";
60
- var tableRect = (_b = document
61
- .querySelector(tableSelector)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
57
+ var tableElement = document.querySelector(tableSelector);
58
+ var tableRect = tableElement === null || tableElement === void 0 ? void 0 : tableElement.getBoundingClientRect();
59
+ // 通过表格元素向上查找包含它的 .ztxk-container 容器
60
+ var containerElement = tableElement === null || tableElement === void 0 ? void 0 : tableElement.closest(".ztxk-container");
61
+ var containerRect = containerElement === null || containerElement === void 0 ? void 0 : containerElement.getBoundingClientRect();
62
62
  if (containerRect && tableRect) {
63
63
  var calculatedHeight = containerRect.height +
64
64
  containerRect.top -
@@ -80,7 +80,9 @@ function useCanvasTableAutoHeight(isAutoScrollY, marginBottom, canvasTableId, da
80
80
  var observer = new MutationObserver(function () {
81
81
  calculateHeight();
82
82
  });
83
- var container = document.querySelector(".ztxk-container");
83
+ // 找到包含目标表格的容器
84
+ var tableElement = document.querySelector(tableSelector);
85
+ var container = tableElement === null || tableElement === void 0 ? void 0 : tableElement.closest(".ztxk-container");
84
86
  if (container) {
85
87
  observer.observe(container, {
86
88
  childList: true,
@@ -403,6 +403,10 @@ interface ICanvasTableProps<RecordType = any> {
403
403
  * 开启维度自定义(需配合 isAutoMerge 使用)
404
404
  */
405
405
  isDimensionDynamic?: boolean;
406
+ /**
407
+ * 开启维度自定义后,是否合并子数据。默认为true,会将相同维度组合的子数据合并为一行;为false时保留所有原始记录
408
+ */
409
+ isDimensionMergeChildren?: boolean;
406
410
  /**
407
411
  * 开启维度自定义后,开启维度合计的字段
408
412
  */
@@ -8,6 +8,30 @@
8
8
  */
9
9
  function getFinalValue(globalDefault, componentValue) {
10
10
  return componentValue !== null && componentValue !== void 0 ? componentValue : globalDefault;
11
+ }
12
+ /**
13
+ * 访问对象值 path可能是数组或字符串。
14
+ * @param obj 目标对象
15
+ * @param path 访问路径
16
+ * @returns 访问到的值
17
+ * @example
18
+ * accessObjValue({ a: { b: { c: 1 } } }, "a.b.c"); // 1
19
+ * accessObjValue({ a: { b: { c: 1 } } }, ["a", "b", "c"]); // 1
20
+ */
21
+ function accessObjValue(obj, path) {
22
+ if (!obj) {
23
+ return undefined;
24
+ }
25
+ var pathArr = Array.isArray(path) ? path : path.split(".");
26
+ var result = obj;
27
+ for (var _i = 0, pathArr_1 = pathArr; _i < pathArr_1.length; _i++) {
28
+ var key = pathArr_1[_i];
29
+ result = result[key];
30
+ if (!result) {
31
+ return undefined;
32
+ }
33
+ }
34
+ return result;
11
35
  }
12
36
 
13
- export { getFinalValue };
37
+ export { accessObjValue, getFinalValue };
@@ -76,13 +76,16 @@ var Form = function (props, ref) {
76
76
  if (items) {
77
77
  for (var i = 0; i < items.length; i++) {
78
78
  var item = items[i];
79
- if (typeof item.name === "string" &&
79
+ if ((typeof item.name === "string" || Array.isArray(item.name)) &&
80
80
  item.shouldUpdateNames &&
81
81
  item.shouldUpdateClear) {
82
82
  var keys = typeof item.shouldUpdateClear === "boolean"
83
83
  ? item.shouldUpdateNames
84
84
  : item.shouldUpdateClear;
85
- result[item.name] = {
85
+ var nameKey = Array.isArray(item.name)
86
+ ? item.name.join(".")
87
+ : item.name;
88
+ result[nameKey] = {
86
89
  keys: keys,
87
90
  isDisplay: item.isDisplay,
88
91
  };
@@ -96,6 +99,42 @@ var Form = function (props, ref) {
96
99
  if (changedValues) {
97
100
  var keys = Object.keys(changedValues);
98
101
  var nameKeys_1 = Object.keys(itemsShouldUpdate);
102
+ // 支持name传入数组的情况。
103
+ // 如果清空状态里面,有数组的话,可以继续查找
104
+ var isInClear_1 = function (shouldUpdateClear, key) {
105
+ // 遍历name,查找changedValues是否跟key匹配
106
+ var isFindName = function (name, obj, firstKey) {
107
+ var formNameKey = firstKey.split(".");
108
+ if (formNameKey.length > 1) {
109
+ return name.join(".") === firstKey;
110
+ }
111
+ var currentObj = obj;
112
+ var isFind = true;
113
+ for (var i = 0; i < name.length; i++) {
114
+ var nameKey = name[i];
115
+ if (i === 0 && nameKey !== firstKey) {
116
+ isFind = false;
117
+ break;
118
+ }
119
+ if (!currentObj.hasOwnProperty(nameKey)) {
120
+ isFind = false;
121
+ break;
122
+ }
123
+ currentObj = currentObj[nameKey];
124
+ }
125
+ return isFind;
126
+ };
127
+ for (var i = 0; i < shouldUpdateClear.length; i++) {
128
+ var name_1 = shouldUpdateClear[i];
129
+ if (typeof name_1 === "string" && name_1 === key) {
130
+ return true;
131
+ }
132
+ if (Array.isArray(name_1) && isFindName(name_1, changedValues, key)) {
133
+ return true;
134
+ }
135
+ }
136
+ return false;
137
+ };
99
138
  var changeKeys_1 = [];
100
139
  var clearHandler_1 = function (keys) {
101
140
  changeKeys_1 = [];
@@ -105,13 +144,15 @@ var Form = function (props, ref) {
105
144
  var shouldUpdateClear = itemsShouldUpdate[nameKey]
106
145
  ? (_a = itemsShouldUpdate[nameKey]) === null || _a === void 0 ? void 0 : _a.keys
107
146
  : [];
108
- if (keys.find(function (key) { return shouldUpdateClear.includes(key); })) {
147
+ // if (keys.find((key) => shouldUpdateClear.includes(key))) {
148
+ if (keys.find(function (key) { return isInClear_1(shouldUpdateClear, key); })) {
109
149
  // 这里用undefined当清空值得话,会有点问题。
110
150
  // https://github.com/react-component/select/commit/305b3dcfe627482686055a1ec9c34705623d807f
111
151
  // 对于下拉框来说 会报这个警告 `label` of `value` is not same as `label` in Select options.
112
152
  // 暂时不知道如何消除这个警告 用 null 和 "" 都可以
113
153
  // TODO: 暂时改成null
114
- (_b = form === null || form === void 0 ? void 0 : form.setFieldValue) === null || _b === void 0 ? void 0 : _b.call(form, nameKey, null);
154
+ var formNameKey = nameKey.split(".");
155
+ (_b = form === null || form === void 0 ? void 0 : form.setFieldValue) === null || _b === void 0 ? void 0 : _b.call(form, formNameKey.length === 1 ? nameKey : formNameKey, null);
115
156
  changeKeys_1.push(nameKey);
116
157
  // form?.setFieldsValue?.({
117
158
  // [nameKey]: undefined,
@@ -120,6 +161,7 @@ var Form = function (props, ref) {
120
161
  });
121
162
  }
122
163
  // 增加递归逻辑,可能字段之间有依赖联系
164
+ // B字段依赖A字段,C字段依赖B字段。那么清空A字段时,需要判断是否清空B字段和C字段
123
165
  if (changeKeys_1.length > 0) {
124
166
  clearHandler_1(changeKeys_1);
125
167
  }
@@ -71,11 +71,11 @@ interface IFormItem extends Omit<FormItemProps, "label"> {
71
71
  /**
72
72
  * 控制依赖关系
73
73
  */
74
- shouldUpdateNames?: string[];
74
+ shouldUpdateNames?: (string[] | string)[];
75
75
  /**
76
76
  * 依赖关系发生改变是否需要清空 当前item
77
77
  */
78
- shouldUpdateClear?: boolean | string[];
78
+ shouldUpdateClear?: boolean | (string[] | string)[];
79
79
  /**
80
80
  * 是否需要外部参数判断是否渲染组件,编写高性能表单时,可能会用到这个配置
81
81
  * 什么场景下需要开启这个配置:
@@ -6,6 +6,7 @@ import classNames from '../node_modules/classnames/index.js';
6
6
  import '../config/ZtxkContext.js';
7
7
  import isEqual from '../config/isEqual.js';
8
8
  import '../config/MyStorage.js';
9
+ import { accessObjValue } from '../config/utils.js';
9
10
  import QuestionCircleOutlined from '../node_modules/@ant-design/icons/es/icons/QuestionCircleOutlined.js';
10
11
 
11
12
  var hiddenLabelCol = { span: 0 };
@@ -93,7 +94,8 @@ var FormItem = function (props) {
93
94
  ? function (prevValues, curValues, info) {
94
95
  for (var i = 0; i < shouldUpdateNames.length; i++) {
95
96
  var shouldUpdateName = shouldUpdateNames[i];
96
- if (prevValues[shouldUpdateName] !== curValues[shouldUpdateName]) {
97
+ if (accessObjValue(prevValues, shouldUpdateName) !==
98
+ accessObjValue(curValues, shouldUpdateName)) {
97
99
  return true;
98
100
  }
99
101
  }
@@ -432,7 +432,7 @@ var useDateKeys = function (columns) {
432
432
  * 自动合并的一些处理
433
433
  */
434
434
  function useAutoMerge(dataSource, columns, _a) {
435
- var isAutoMerge = _a.isAutoMerge, isDimensionDynamic = _a.isDimensionDynamic, order = _a.order, dimensionCustomSumKeys = _a.dimensionCustomSumKeys;
435
+ var isAutoMerge = _a.isAutoMerge, isDimensionDynamic = _a.isDimensionDynamic, _b = _a.isDimensionMergeChildren, isDimensionMergeChildren = _b === void 0 ? true : _b, order = _a.order, dimensionCustomSumKeys = _a.dimensionCustomSumKeys;
436
436
  // 计算需要合并的字段key集合
437
437
  var mergeKeys = useMergeKeys(columns, isAutoMerge);
438
438
  var firstMergeKey = mergeKeys === null || mergeKeys === void 0 ? void 0 : mergeKeys[0];
@@ -473,7 +473,8 @@ function useAutoMerge(dataSource, columns, _a) {
473
473
  }
474
474
  }
475
475
  var startTime = performance.now();
476
- var result = flattenRecordsOptimized(__spreadArray([], sourceData, true), mergeKeysParam, dimensionSummaryKeys, summaryKeys, isDimensionDynamic, order, dimensionCustomSumKeys, columns // 添加 columns 参数,支持自定义排序
476
+ var result = flattenRecordsOptimized(__spreadArray([], sourceData, true), mergeKeysParam, dimensionSummaryKeys, summaryKeys, isDimensionDynamic, order, dimensionCustomSumKeys, columns, // 添加 columns 参数,支持自定义排序
477
+ isDimensionMergeChildren // 是否合并子数据
477
478
  );
478
479
  var endTime = performance.now();
479
480
  var duration = endTime - startTime;
@@ -497,6 +498,7 @@ function useAutoMerge(dataSource, columns, _a) {
497
498
  dimensionSummaryKeys,
498
499
  summaryKeys,
499
500
  isDimensionDynamic,
501
+ isDimensionMergeChildren,
500
502
  order,
501
503
  dimensionCustomSumKeys,
502
504
  columns,
@@ -536,6 +536,10 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
536
536
  * 开启维度自定义。开启后,会根据columns中的isDimension属性来是否开启维度自定义,需要合并行时,需要开启这个属性isAutoMerge
537
537
  */
538
538
  isDimensionDynamic?: boolean;
539
+ /**
540
+ * 开启维度自定义后,是否合并子数据。默认为true,会将相同维度组合的子数据合并为一行;为false时保留所有原始记录
541
+ */
542
+ isDimensionMergeChildren?: boolean;
539
543
  /**
540
544
  * 开启维度自定义后,开启维度合计的字段,与column中的isSummary相同,主要用于自定义合计字段
541
545
  */
@@ -48,8 +48,8 @@ import DynamicSetting from '../dynamicsetting/dynamicSetting.js';
48
48
  var Table = function (props) {
49
49
  var _a;
50
50
  // console.log("表格渲染");
51
- var className = props.className, _b = props.bordered, bordered = _b === void 0 ? true : _b, _c = props.pagination, pagination = _c === void 0 ? false : _c, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, customDynamicListHandle = props.customDynamicListHandle, isRemeberFilter = props.isRemeberFilter, _d = props.isOrderUpdateData, isOrderUpdateData = _d === void 0 ? true : _d, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _e = props.isTheadTitleAdd, isTheadTitleAdd = _e === void 0 ? true : _e, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _f = props.isDelAll, isDelAll = _f === void 0 ? true : _f, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _g = props.summaryFixed, summaryFixed = _g === void 0 ? true : _g, isInnerPagination = props.isInnerPagination, _h = props.innerPaginationPageSize, innerPaginationPageSize = _h === void 0 ? 30 : _h, _j = props.innerPaginationPosition, innerPaginationPosition = _j === void 0 ? INNER_TABLE_PAGINATION_POSITION : _j, _k = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _k === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _k, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _l = props.isResizableColumn, isResizableColumn = _l === void 0 ? true : _l, _m = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _m === void 0 ? true : _m, _o = props.isRealTimeValidate, isRealTimeValidate = _o === void 0 ? true : _o, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _p = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _p === void 0 ? 65 : _p, _q = props.isAutoScrollY, isAutoScrollY = _q === void 0 ? false : _q, tableId = props.tableId, extraOnRow = props.onRow, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, headerAlign = props.headerAlign, isDimensionDynamic = props.isDimensionDynamic, dimensionCustomSumKeys = props.dimensionCustomSumKeys, isAutoMerge = props.isAutoMerge, mode = props.mode, rowSelection = props.rowSelection, isContextMenu = props.isContextMenu, isFullscreenHandle = props.isFullscreenHandle, _r = props.isExportSummary, isExportSummary = _r === void 0 ? true : _r, isAutoMergeAddAndDel = props.isAutoMergeAddAndDel, isDynamicColumnText = props.isDynamicColumnText, isTableSummaryCollapse = props.isTableSummaryCollapse, isTableSummaryDefaultExpand = props.isTableSummaryDefaultExpand, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "customDynamicListHandle", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId", "onRow", "fixedRowsCount", "fixedRowsConfig", "headerAlign", "isDimensionDynamic", "dimensionCustomSumKeys", "isAutoMerge", "mode", "rowSelection", "isContextMenu", "isFullscreenHandle", "isExportSummary", "isAutoMergeAddAndDel", "isDynamicColumnText", "isTableSummaryCollapse", "isTableSummaryDefaultExpand"]);
52
- var _s = useBaseContext(), enableDynamicColumnText = _s.enableDynamicColumnText, enableTableSummaryCollapse = _s.enableTableSummaryCollapse, enableTableSummaryDefaultExpand = _s.enableTableSummaryDefaultExpand;
51
+ var className = props.className, _b = props.bordered, bordered = _b === void 0 ? true : _b, _c = props.pagination, pagination = _c === void 0 ? false : _c, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, customDynamicListHandle = props.customDynamicListHandle, isRemeberFilter = props.isRemeberFilter, _d = props.isOrderUpdateData, isOrderUpdateData = _d === void 0 ? true : _d, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _e = props.isTheadTitleAdd, isTheadTitleAdd = _e === void 0 ? true : _e, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _f = props.isDelAll, isDelAll = _f === void 0 ? true : _f, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _g = props.summaryFixed, summaryFixed = _g === void 0 ? true : _g, isInnerPagination = props.isInnerPagination, _h = props.innerPaginationPageSize, innerPaginationPageSize = _h === void 0 ? 30 : _h, _j = props.innerPaginationPosition, innerPaginationPosition = _j === void 0 ? INNER_TABLE_PAGINATION_POSITION : _j, _k = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _k === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _k, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _l = props.isResizableColumn, isResizableColumn = _l === void 0 ? true : _l, _m = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _m === void 0 ? true : _m, _o = props.isRealTimeValidate, isRealTimeValidate = _o === void 0 ? true : _o, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _p = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _p === void 0 ? 65 : _p, _q = props.isAutoScrollY, isAutoScrollY = _q === void 0 ? false : _q, tableId = props.tableId, extraOnRow = props.onRow, fixedRowsCount = props.fixedRowsCount, fixedRowsConfig = props.fixedRowsConfig, headerAlign = props.headerAlign, isDimensionDynamic = props.isDimensionDynamic, _r = props.isDimensionMergeChildren, isDimensionMergeChildren = _r === void 0 ? true : _r, dimensionCustomSumKeys = props.dimensionCustomSumKeys, isAutoMerge = props.isAutoMerge, mode = props.mode, rowSelection = props.rowSelection, isContextMenu = props.isContextMenu, isFullscreenHandle = props.isFullscreenHandle, _s = props.isExportSummary, isExportSummary = _s === void 0 ? true : _s, isAutoMergeAddAndDel = props.isAutoMergeAddAndDel, isDynamicColumnText = props.isDynamicColumnText, isTableSummaryCollapse = props.isTableSummaryCollapse, isTableSummaryDefaultExpand = props.isTableSummaryDefaultExpand, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "customDynamicListHandle", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "addAndDelProps", "autoScrollYMarginBottom", "isAutoScrollY", "tableId", "onRow", "fixedRowsCount", "fixedRowsConfig", "headerAlign", "isDimensionDynamic", "isDimensionMergeChildren", "dimensionCustomSumKeys", "isAutoMerge", "mode", "rowSelection", "isContextMenu", "isFullscreenHandle", "isExportSummary", "isAutoMergeAddAndDel", "isDynamicColumnText", "isTableSummaryCollapse", "isTableSummaryDefaultExpand"]);
52
+ var _t = useBaseContext(), enableDynamicColumnText = _t.enableDynamicColumnText, enableTableSummaryCollapse = _t.enableTableSummaryCollapse, enableTableSummaryDefaultExpand = _t.enableTableSummaryDefaultExpand;
53
53
  // 表格动态列配置是否显示文字
54
54
  var isDynamicColumnTextEnable = getFinalValue(enableDynamicColumnText, isDynamicColumnText);
55
55
  // 表格合计是否可以展开收起
@@ -67,25 +67,25 @@ var Table = function (props) {
67
67
  id: menuId,
68
68
  }).show;
69
69
  // 针对SCU和增减行 做特殊处理
70
- var _t = useScuRfresh(), refreshScuCell = _t.refreshScuCell, getRefreshScuCell = _t.getRefreshScuCell;
70
+ var _u = useScuRfresh(), refreshScuCell = _u.refreshScuCell, getRefreshScuCell = _u.getRefreshScuCell;
71
71
  // 做一些前置处理
72
72
  // 比如过滤某些列 不做展示
73
73
  var columns = useParseColumns(_columns);
74
74
  // 得到动态列配置信息
75
- var _u = useDynamicListByColumns(columns, {
75
+ var _v = useDynamicListByColumns(columns, {
76
76
  dynamicKey: dynamicKey,
77
77
  dynamicVersion: dynamicVersion,
78
78
  customDynamicListHandle: customDynamicListHandle,
79
- }), defaultDynamicList = _u.defaultDynamicList, onCurrentListChange = _u.onCurrentListChange, currentDynamicList = _u.currentDynamicList, dynamicSettingRef = _u.dynamicSettingRef;
79
+ }), defaultDynamicList = _v.defaultDynamicList, onCurrentListChange = _v.onCurrentListChange, currentDynamicList = _v.currentDynamicList, dynamicSettingRef = _v.dynamicSettingRef;
80
80
  // 因为内部分页需要知晓当前页面的数据展示,要不然数据排序就跟内部分页没关系了
81
81
  // 自定义排序方法
82
- var _v = useCustomSort(dataSource, onTableChange, {
82
+ var _w = useCustomSort(dataSource, onTableChange, {
83
83
  refreshScuCell: refreshScuCell,
84
84
  rowKey: props === null || props === void 0 ? void 0 : props.rowKey,
85
85
  serviceOrder: serviceOrder,
86
86
  isOrderUpdateData: isOrderUpdateData,
87
87
  isAutoMerge: isAutoMerge,
88
- }), order = _v.order, setOrder = _v.setOrder, customSortHandle = _v.customSortHandle, sortDataSource = _v.sortDataSource;
88
+ }), order = _w.order, setOrder = _w.setOrder, customSortHandle = _w.customSortHandle, sortDataSource = _w.sortDataSource;
89
89
  // 当前表格展示的数据
90
90
  // 如果开启了前端排序的话,排序后的数据,可能会影响到很多地方。
91
91
  // 所以后续操作的数据 应该用
@@ -112,12 +112,12 @@ var Table = function (props) {
112
112
  return scroll || {};
113
113
  }, [scroll, currentTableDataSource, virtualKey, scrolly, isAutoScrollY]);
114
114
  // 内部分页相关配置
115
- var _w = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
115
+ var _x = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
116
116
  innerPaginationPosition: innerPaginationPosition,
117
117
  innerPaginationPageSizeOptions: innerPaginationPageSizeOptions,
118
118
  innerPaginationConfig: innerPaginationConfig,
119
119
  dataSource: currentTableDataSource,
120
- }), paginationConfig = _w.paginationConfig, currentPage = _w.currentPage, setCurrent = _w.setCurrent, pageSize = _w.pageSize;
120
+ }), paginationConfig = _x.paginationConfig, currentPage = _x.currentPage, setCurrent = _x.setCurrent, pageSize = _x.pageSize;
121
121
  // 内部表格编辑事件
122
122
  var onEditableSave = useEditChange(dataSourceRef, onTableChange);
123
123
  // 记录表头过滤的一些配置(通过ref记录,key => filter) 复制整列、过滤后修改数据,需要先走过滤
@@ -145,9 +145,9 @@ var Table = function (props) {
145
145
  filterConfigRef: filterConfigRef,
146
146
  });
147
147
  // 表格内部自定义处理过滤,不走antd内部
148
- var _x = useCustomFilter(currentTableDataSource, columns), filterDataSource = _x[0], handleFilterConfigChange = _x[1];
148
+ var _y = useCustomFilter(currentTableDataSource, columns), filterDataSource = _y[0], handleFilterConfigChange = _y[1];
149
149
  // 处理列配置信息 得到新的列配置信息
150
- var _y = useColumns(columns, {
150
+ var _z = useColumns(columns, {
151
151
  // 动态列配置相关信息
152
152
  dynamicKey: dynamicKey,
153
153
  isRemeberFilter: isRemeberFilter,
@@ -191,18 +191,19 @@ var Table = function (props) {
191
191
  handleFilterConfigChange: handleFilterConfigChange,
192
192
  isAutoMergeAddAndDel: isAutoMergeAddAndDel,
193
193
  isDynamicColumnTextEnable: isDynamicColumnTextEnable,
194
- }), _newColumns = _y.newColumns, newRowSelection = _y.rowSelection;
194
+ }), _newColumns = _z.newColumns, newRowSelection = _z.rowSelection;
195
195
  // 处理表格合并和维度
196
- var _z = useAutoMerge(filterDataSource, _newColumns, {
196
+ var _0 = useAutoMerge(filterDataSource, _newColumns, {
197
197
  isAutoMerge: isAutoMerge,
198
198
  isDimensionDynamic: isDimensionDynamic,
199
+ isDimensionMergeChildren: isDimensionMergeChildren,
199
200
  order: order,
200
201
  dimensionCustomSumKeys: dimensionCustomSumKeys,
201
- }), newDataSource = _z[0], newColumns = _z[1];
202
+ }), newDataSource = _0[0], newColumns = _0[1];
202
203
  // 表格验证
203
- var _0 = useTableValidate(), tableRef = _0.tableRef, getCurrentTable = _0.getCurrentTable, clearErrorClass = _0.clearErrorClass;
204
+ var _1 = useTableValidate(), tableRef = _1.tableRef, getCurrentTable = _1.getCurrentTable, clearErrorClass = _1.clearErrorClass;
204
205
  // 内部表格总结栏
205
- var _1 = useTableSummaryCollapse(tableRef, isTableSummaryDefaultExpandEnable, isTableSummaryCollapseEnable), showSummary = _1.showSummary, renderTableSummaryCollapse = _1.renderTableSummaryCollapse;
206
+ var _2 = useTableSummaryCollapse(tableRef, isTableSummaryDefaultExpandEnable, isTableSummaryCollapseEnable), showSummary = _2.showSummary, renderTableSummaryCollapse = _2.renderTableSummaryCollapse;
206
207
  var getSummaryHandle = useSummary(summaryConfig, newColumns, {
207
208
  summaryFixed: summaryFixed,
208
209
  rowSelection: props.rowSelection,
@@ -423,7 +424,7 @@ var Table = function (props) {
423
424
  };
424
425
  });
425
426
  // 全屏的一些方法
426
- var _2 = useState(false), isFull = _2[0], setIsFull = _2[1];
427
+ var _3 = useState(false), isFull = _3[0], setIsFull = _3[1];
427
428
  var fullscreenHandle = useMemoizedFn(function (isFull) {
428
429
  isFullscreenHandle === null || isFullscreenHandle === void 0 ? void 0 : isFullscreenHandle(isFull);
429
430
  setIsFull(isFull);
@@ -448,9 +448,14 @@ function startColumnInsertTableData(options) {
448
448
  * @param dimensionSummaryKeys 维度合计字段
449
449
  * @param summaryKeys 合计字段
450
450
  * @param isDimensionDynamic 维度合并
451
+ * @param order 排序配置
452
+ * @param dimensionCustomSumKeys 自定义合计字段
453
+ * @param columns 列配置
454
+ * @param isDimensionMergeChildren 是否合并子数据,默认为true
451
455
  */
452
- function flattenRecordsOptimized(records, mergeKeys, dimensionSummaryKeys, summaryKeys, isDimensionDynamic, order, dimensionCustomSumKeys, columns) {
456
+ function flattenRecordsOptimized(records, mergeKeys, dimensionSummaryKeys, summaryKeys, isDimensionDynamic, order, dimensionCustomSumKeys, columns, isDimensionMergeChildren) {
453
457
  var _a;
458
+ if (isDimensionMergeChildren === void 0) { isDimensionMergeChildren = true; }
454
459
  if (!records ||
455
460
  records.length === 0 ||
456
461
  !mergeKeys ||
@@ -468,7 +473,7 @@ function flattenRecordsOptimized(records, mergeKeys, dimensionSummaryKeys, summa
468
473
  result = __spreadArray([], records, true);
469
474
  }
470
475
  // 1. 如果开启了维度合并,按所有 mergeKeys 的组合来计算合计值
471
- if (isDimensionDynamic && mergeKeys.length > 0) {
476
+ if (isDimensionDynamic && isDimensionMergeChildren && mergeKeys.length > 0) {
472
477
  var groupedResult = groupByLastMergeKey(result, mergeKeys, summaryKeys, dimensionCustomSumKeys);
473
478
  result = groupedResult;
474
479
  }
@@ -941,6 +946,7 @@ function hasParentGroupChanged(records, currentIndex, mergeKeys, currentKeyIndex
941
946
  /**
942
947
  * 按所有合并键的组合进行分组并计算合计值
943
948
  * 确保相同维度组合的记录被正确分组
949
+ * @param isDimensionMergeChildren 是否合并子数据,默认为true。为false时返回所有原始记录
944
950
  */
945
951
  function groupByLastMergeKey(records, mergeKeys, // 改为传入所有合并键
946
952
  summaryKeys, dimensionCustomSumKeys) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.9.8",
3
+ "version": "3.0.0",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",