zmdms-webui 1.7.9 → 1.8.1

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.
@@ -335,9 +335,9 @@ function useCalcScrollY(isAutoScrollY, subHeight, id) {
335
335
  var useMergeKeys = function (columns, isAutoMerge) {
336
336
  var mergeKeys = useMemo(function () {
337
337
  if (isAutoMerge) {
338
- return columns
338
+ return Array.from(new Set(columns
339
339
  .filter(function (item) { return item.isMerge && item.key !== MERGE_INDEX; })
340
- .map(function (item) { return item.key; });
340
+ .map(function (item) { return item.mergeKey || item.key; })));
341
341
  }
342
342
  return undefined;
343
343
  }, [isAutoMerge, columns]);
@@ -407,7 +407,7 @@ function useAutoMerge(dataSource, columns, _a) {
407
407
  if (isAutoMerge && item.isMerge) {
408
408
  item.onCell = function (record) {
409
409
  var _a;
410
- var key = item.key;
410
+ var key = item.mergeKey || item.key;
411
411
  if (item.key === MERGE_INDEX) {
412
412
  key = firstMergeKey;
413
413
  }
@@ -215,6 +215,10 @@ interface IColumnType<RecordType> extends Omit<ColumnType<RecordType>, "render">
215
215
  * 开启合计
216
216
  */
217
217
  isSummary?: boolean;
218
+ /**
219
+ * 开启合并的字段,按其他字段维度合并
220
+ */
221
+ mergeKey?: string;
218
222
  }
219
223
  interface IRenderOptions {
220
224
  insertTableFromClipboard: IFuncInsertTableFromClipboard;
@@ -235,9 +239,9 @@ interface IFuncInsertTableFromClipboard {
235
239
  (e: any, options: IInserTableFromClipboard): Promise<IFuncInsertTableFromClipboardReturn>;
236
240
  }
237
241
  interface IColumnGroupType<RecordType> extends Omit<IColumnType<RecordType>, "dataIndex"> {
238
- children: IColumnsType<RecordType>;
242
+ children?: IColumnsType<RecordType>;
239
243
  }
240
- type IColumnsTypeProp<RecordType> = IColumnGroupType<RecordType> | IColumnType<RecordType>;
244
+ type IColumnsTypeProp<RecordType> = IColumnGroupType<RecordType>;
241
245
  declare type IColumnsType<RecordType = unknown> = IColumnsTypeProp<RecordType>[];
242
246
  interface ITableRefHandel {
243
247
  /**
@@ -1,3 +1,4 @@
1
+ import { __assign } from '../_virtual/_tslib.js';
1
2
  import { useMemo } from 'react';
2
3
 
3
4
  /**
@@ -8,7 +9,11 @@ function useParseColumns(columns) {
8
9
  return useMemo(function () {
9
10
  var newColumns = [];
10
11
  if (columns) {
11
- columns === null || columns === void 0 ? void 0 : columns.forEach(function (item) {
12
+ columns === null || columns === void 0 ? void 0 : columns.forEach(function (_item) {
13
+ var item = __assign({}, _item);
14
+ if (item.children) {
15
+ item.children = item.children.filter(function (child) { return child.isDisplay !== false; });
16
+ }
12
17
  if (item.isDisplay !== false) {
13
18
  newColumns.push(item);
14
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "1.7.9",
3
+ "version": "1.8.1",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",