zmdms-webui 2.6.2 → 2.6.4

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.
@@ -228,6 +228,52 @@ interface ICanvasRowSelection<RecordType = any> {
228
228
  */
229
229
  fixed?: boolean;
230
230
  }
231
+ interface IExpandable<RecordType = any> {
232
+ /**
233
+ * 展开的keys集合
234
+ */
235
+ expandedRowKeys?: React__default.Key[];
236
+ /**
237
+ * 默认展开的keys集合
238
+ */
239
+ defaultExpandedRowKeys?: React__default.Key[];
240
+ /**
241
+ * 展开状态改变时的回调
242
+ */
243
+ onExpandedRowsChange?: (expandedKeys: React__default.Key[], row: RecordType, action: 'expand' | 'collapse') => void;
244
+ /**
245
+ * 是否默认展开所有行
246
+ */
247
+ defaultExpandAllRows?: boolean;
248
+ /**
249
+ * 展开图标的列索引(默认0,第一列)
250
+ */
251
+ expandIconColumnIndex?: number;
252
+ /**
253
+ * 自定义展开图标
254
+ */
255
+ expandIcon?: (params: {
256
+ expanded: boolean;
257
+ record: RecordType;
258
+ onExpand: (record: RecordType, expanded: boolean) => void;
259
+ }) => React__default.ReactNode;
260
+ /**
261
+ * 展开行的自定义渲染
262
+ */
263
+ expandedRowRender?: (params: {
264
+ record: RecordType;
265
+ index: number;
266
+ expanded: boolean;
267
+ }) => React__default.ReactNode;
268
+ /**
269
+ * 展开行的类名
270
+ */
271
+ expandedRowClassName?: (record: RecordType, index: number) => string;
272
+ /**
273
+ * 子节点数据的字段名(默认为'children')
274
+ */
275
+ childrenColumnName?: string;
276
+ }
231
277
  interface ICanvasTableProps<RecordType = any> {
232
278
  /**
233
279
  * 数据源
@@ -273,6 +319,10 @@ interface ICanvasTableProps<RecordType = any> {
273
319
  * 勾选配置
274
320
  */
275
321
  rowSelection?: ICanvasRowSelection<RecordType>;
322
+ /**
323
+ * 树形展开配置
324
+ */
325
+ expandable?: IExpandable<RecordType>;
276
326
  /**
277
327
  * 排序改变回调
278
328
  */
@@ -473,6 +523,26 @@ interface ICanvasTableRefHandle {
473
523
  * 设置选中的行keys
474
524
  */
475
525
  setSelectedRowKeys: (keys: React__default.Key[]) => void;
526
+ /**
527
+ * 获取展开的keys
528
+ */
529
+ getExpandedRowKeys: () => React__default.Key[];
530
+ /**
531
+ * 设置展开的keys
532
+ */
533
+ setExpandedRowKeys: (keys: React__default.Key[]) => void;
534
+ /**
535
+ * 展开指定行
536
+ */
537
+ expandRow: (key: React__default.Key) => void;
538
+ /**
539
+ * 收起指定行
540
+ */
541
+ collapseRow: (key: React__default.Key) => void;
542
+ /**
543
+ * 切换指定行展开状态
544
+ */
545
+ toggleExpandRow: (key: React__default.Key) => void;
476
546
  /**
477
547
  * 滚动到指定位置
478
548
  */
@@ -511,4 +581,4 @@ interface ICanvasTableRefHandle {
511
581
  clearFilter: () => void;
512
582
  }
513
583
 
514
- export { ColumnDataType, FilterConfig, IBadgeProps, ICanvasColumnType, ICanvasColumnsType, ICanvasRowSelection, ICanvasTableProps, ICanvasTableRefHandle, SortOrder };
584
+ export { ColumnDataType, FilterConfig, IBadgeProps, ICanvasColumnType, ICanvasColumnsType, ICanvasRowSelection, ICanvasTableProps, ICanvasTableRefHandle, IExpandable, SortOrder };
@@ -0,0 +1,118 @@
1
+ import { TEXT_PADDING, COLORS } from './constants.js';
2
+
3
+ /**
4
+ * 渲染辅助工具函数
5
+ * 提供通用的渲染计算和绘制功能
6
+ */
7
+ /**
8
+ * 计算文本X坐标(根据对齐方式)
9
+ */
10
+ var calculateTextX = function (drawX, actualWidth, align, padding) {
11
+ if (align === void 0) { align = "left"; }
12
+ if (padding === void 0) { padding = TEXT_PADDING; }
13
+ if (align === "center") {
14
+ return drawX + actualWidth / 2;
15
+ }
16
+ else if (align === "right") {
17
+ return drawX + actualWidth - padding;
18
+ }
19
+ return drawX + padding;
20
+ };
21
+ /**
22
+ * 设置Canvas文本对齐方式
23
+ */
24
+ var setTextAlign = function (ctx, align) {
25
+ if (align === void 0) { align = "left"; }
26
+ ctx.textAlign = align;
27
+ };
28
+ /**
29
+ * 计算固定列的右边界
30
+ */
31
+ var calculateFixedColumnsRightEdge = function (columnRenderInfos, getColumnWidth) {
32
+ var rightEdge = 0;
33
+ columnRenderInfos.forEach(function (info, index) {
34
+ if (info.fixed) {
35
+ var actualWidth = getColumnWidth ? getColumnWidth(index) : info.width;
36
+ rightEdge = Math.max(rightEdge, info.fixedLeft + actualWidth);
37
+ }
38
+ });
39
+ return rightEdge;
40
+ };
41
+ /**
42
+ * 判断是否应该在Canvas中渲染
43
+ * 检查render函数的返回值类型
44
+ */
45
+ var shouldRenderInCanvas = function (renderFn, cellValue, record, rowIndex, isSummaryRow) {
46
+ if (isSummaryRow === void 0) { isSummaryRow = false; }
47
+ // 合计行不应用 render 函数
48
+ if (isSummaryRow) {
49
+ return true;
50
+ }
51
+ // 如果没有 render 函数,在 Canvas 中渲染
52
+ if (!renderFn) {
53
+ return true;
54
+ }
55
+ var rendered = renderFn(cellValue, record, rowIndex);
56
+ // 如果返回的是字符串或数字,在 Canvas 中渲染
57
+ if (typeof rendered === "string" ||
58
+ typeof rendered === "number" ||
59
+ rendered === null ||
60
+ rendered === undefined) {
61
+ return true;
62
+ }
63
+ // 否则是自定义组件,应该在覆盖层渲染
64
+ return false;
65
+ };
66
+ var setupCellClip = function (params) {
67
+ var ctx = params.ctx, drawX = params.drawX, y = params.y, width = params.width, cellHeight = params.cellHeight, headerHeight = params.headerHeight, effectiveHeight = params.effectiveHeight, _a = params.fixedColumnsRightEdge, fixedColumnsRightEdge = _a === void 0 ? 0 : _a, isFixed = params.isFixed;
68
+ // 裁剪区域:确保不覆盖表头,从 headerHeight 开始
69
+ var clipY = Math.max(y, headerHeight);
70
+ // 计算单元格实际底部位置,并限制在可视区域内
71
+ var cellBottom = Math.min(y + cellHeight, effectiveHeight);
72
+ // 裁剪高度 = 单元格可见底部 - 裁剪起始位置
73
+ var clipHeight = Math.max(0, cellBottom - clipY);
74
+ // 对于非fixed列,还需要裁剪掉被fixed列遮挡的部分
75
+ var clipX = drawX;
76
+ var clipWidth = width;
77
+ if (!isFixed && fixedColumnsRightEdge > 0 && drawX < fixedColumnsRightEdge) {
78
+ // 调整裁剪区域,去掉被fixed列遮挡的部分
79
+ var overlap = fixedColumnsRightEdge - drawX;
80
+ if (overlap < width) {
81
+ clipX = fixedColumnsRightEdge;
82
+ clipWidth = width - overlap;
83
+ }
84
+ }
85
+ ctx.beginPath();
86
+ ctx.rect(clipX, clipY, clipWidth, clipHeight);
87
+ ctx.clip();
88
+ return { clipX: clipX, clipY: clipY, clipWidth: clipWidth, clipHeight: clipHeight };
89
+ };
90
+ var drawCellBackground = function (params) {
91
+ var ctx = params.ctx, clipX = params.clipX, clipY = params.clipY, clipWidth = params.clipWidth, clipHeight = params.clipHeight, isSelected = params.isSelected, isHover = params.isHover, isSummaryRow = params.isSummaryRow, isStriped = params.isStriped, rowIndex = params.rowIndex, customBgColor = params.customBgColor;
92
+ if (clipHeight > 0 && clipWidth > 0) {
93
+ var bgColor = void 0;
94
+ if (customBgColor) {
95
+ bgColor = customBgColor;
96
+ }
97
+ else if (isSelected) {
98
+ bgColor = COLORS.selectedBg;
99
+ }
100
+ else if (isSummaryRow) {
101
+ // 合计行使用表头背景色
102
+ bgColor = COLORS.headerBg;
103
+ }
104
+ else if (isHover) {
105
+ bgColor = COLORS.hoverBg;
106
+ }
107
+ else if (isStriped && rowIndex % 2 === 1) {
108
+ bgColor = COLORS.stripedBg;
109
+ }
110
+ else {
111
+ bgColor = COLORS.white;
112
+ }
113
+ ctx.fillStyle = bgColor;
114
+ ctx.fillRect(clipX, clipY, clipWidth, clipHeight);
115
+ }
116
+ };
117
+
118
+ export { calculateFixedColumnsRightEdge, calculateTextX, drawCellBackground, setTextAlign, setupCellClip, shouldRenderInCanvas };
@@ -1,4 +1,4 @@
1
- import { __spreadArray, __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
1
+ import { __spreadArray, __assign, __awaiter, __generator, __rest } from '../_virtual/_tslib.js';
2
2
  import ExcelJS from '../node_modules/exceljs/dist/exceljs.min.js';
3
3
  import { useMergeKeys, useNumKeys, useDateKeys } from './hooks.js';
4
4
  import { useMemoizedFn } from 'ahooks';
@@ -6,19 +6,61 @@ import { IS_SUMMARY, MERGE_ROW_SPANS } from './constant.js';
6
6
  import { exactRound } from 'zmdms-utils';
7
7
  import dayjs from 'dayjs';
8
8
 
9
+ // 内部常量,用于标记父数据
10
+ var IS_PARENT = "__is_parent__";
11
+ var PARENT_LEVEL = "__parent_level__";
12
+ /**
13
+ * 扁平化树形数据
14
+ * @param records 原始数据数组
15
+ * @param childrenColumnName 子节点字段名,默认为 'children'
16
+ * @returns 扁平化后的数据数组
17
+ */
18
+ function flattenTreeData(records, childrenColumnName) {
19
+ if (childrenColumnName === void 0) { childrenColumnName = "children"; }
20
+ if (!Array.isArray(records) || records.length === 0) {
21
+ return records;
22
+ }
23
+ var result = [];
24
+ var flatten = function (items, level) {
25
+ if (level === void 0) { level = 0; }
26
+ items.forEach(function (item) {
27
+ var _a, _b;
28
+ var hasChildren = item[childrenColumnName] &&
29
+ Array.isArray(item[childrenColumnName]) &&
30
+ item[childrenColumnName].length > 0;
31
+ // 创建当前项的副本(不包含 children)
32
+ var _c = item, _d = childrenColumnName, children = _c[_d], itemWithoutChildren = __rest(_c, [typeof _d === "symbol" ? _d : _d + ""]);
33
+ if (hasChildren) {
34
+ // 这是父数据,添加标记
35
+ result.push(__assign(__assign({}, itemWithoutChildren), (_a = {}, _a[IS_PARENT] = true, _a[PARENT_LEVEL] = level, _a)));
36
+ // 递归处理子数据
37
+ flatten(children, level + 1);
38
+ }
39
+ else {
40
+ // 这是叶子节点或没有子节点的数据
41
+ result.push(__assign(__assign({}, itemWithoutChildren), (_b = {}, _b[IS_PARENT] = false, _b[PARENT_LEVEL] = level, _b)));
42
+ }
43
+ });
44
+ };
45
+ flatten(records, 0);
46
+ return result;
47
+ }
9
48
  /**
10
49
  * 使用 ExcelJS + 后处理添加批注
11
50
  * 导出Excel,支持维度合并和小计,以及批注功能
12
51
  */
13
- function exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys, dateKeys, fileName, sheetName, columnHeaders, summaryConfig, topDescription, topDescriptionRowHeight) {
52
+ function exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys, dateKeys, fileName, sheetName, columnHeaders, summaryConfig, topDescription, topDescriptionRowHeight, childrenColumnName) {
14
53
  var _a;
15
54
  var _this = this;
16
55
  if (fileName === void 0) { fileName = "export.xlsx"; }
17
56
  if (sheetName === void 0) { sheetName = "Sheet1"; }
57
+ if (childrenColumnName === void 0) { childrenColumnName = "children"; }
18
58
  if (!records || records.length === 0) {
19
59
  throw new Error("没有数据可导出");
20
60
  }
21
- var processedData = applyPrecisionToRecords(records, columns);
61
+ // 扁平化树形数据
62
+ var flattenedRecords = flattenTreeData(records, childrenColumnName);
63
+ var processedData = applyPrecisionToRecords(flattenedRecords, columns);
22
64
  // 准备Excel数据
23
65
  var excelData = prepareExcelData(processedData, columns, columnHeaders, topDescription);
24
66
  // 创建工作簿
@@ -361,6 +403,9 @@ function createWorksheetWithMerge(workbook, excelData, mergeKeys, sheetName) {
361
403
  return "continue";
362
404
  for (var rowIndex = 0; rowIndex < data.length; rowIndex++) {
363
405
  var rowData = data[rowIndex];
406
+ // 跳过父数据的合并,父数据不参与列合并
407
+ if (rowData[IS_PARENT])
408
+ continue;
364
409
  var spanCount = (_a = rowData[MERGE_ROW_SPANS]) === null || _a === void 0 ? void 0 : _a[mergeKey];
365
410
  if (spanCount && spanCount > 1) {
366
411
  var startRow = headerRowCount + rowIndex + 1;
@@ -500,9 +545,15 @@ function applyExcelStyles(worksheet, data, numKeys, dateKeys, columns, headerRow
500
545
  for (var rowIndex = 0; rowIndex < data.length; rowIndex++) {
501
546
  var rowData = data[rowIndex];
502
547
  var isSubtotal = rowData.__is_summary__;
548
+ var isParent = rowData[IS_PARENT];
503
549
  for (var c = 1; c <= totalCols; c++) {
504
550
  var cell = worksheet.getCell(headerRowCount + rowIndex + 1, c);
505
- var base = isSubtotal ? summaryStyle : normalStyle;
551
+ // 优先级:小计行 > 父数据 > 普通数据
552
+ var base = isSubtotal
553
+ ? summaryStyle
554
+ : isParent
555
+ ? summaryStyle
556
+ : normalStyle;
506
557
  var columnAlign = columns && Array.isArray(columns)
507
558
  ? (_c = columns[c - 1]) === null || _c === void 0 ? void 0 : _c.align
508
559
  : undefined;
@@ -551,7 +602,7 @@ function applyExcelStyles(worksheet, data, numKeys, dateKeys, columns, headerRow
551
602
  var cellValue = rowData[dateKey.dataIndex];
552
603
  if (cellValue) {
553
604
  try {
554
- var date = dayjs(cellValue).toDate();
605
+ var date = dayjs(String(cellValue)).toDate();
555
606
  cell.value = date;
556
607
  cell.numFmt = columns[colIndex].dateFormat;
557
608
  }
@@ -570,22 +621,23 @@ function applyExcelStyles(worksheet, data, numKeys, dateKeys, columns, headerRow
570
621
  /**
571
622
  * 主要的导出函数,使用改进的批注功能
572
623
  */
573
- function exportToExcelWithMerge(records, columns, mergeKeys, numKeys, dateKeys, fileName, sheetName, columnHeaders, summaryConfig, topDescription, topDescriptionRowHeight) {
624
+ function exportToExcelWithMerge(records, columns, mergeKeys, numKeys, dateKeys, fileName, sheetName, columnHeaders, summaryConfig, topDescription, topDescriptionRowHeight, childrenColumnName) {
574
625
  if (fileName === void 0) { fileName = "export.xlsx"; }
575
626
  if (sheetName === void 0) { sheetName = "Sheet1"; }
576
- return exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys, dateKeys, fileName, sheetName, columnHeaders, summaryConfig, topDescription, topDescriptionRowHeight);
627
+ if (childrenColumnName === void 0) { childrenColumnName = "children"; }
628
+ return exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys, dateKeys, fileName, sheetName, columnHeaders, summaryConfig, topDescription, topDescriptionRowHeight, childrenColumnName);
577
629
  }
578
630
  /**
579
631
  * 简化版本的导出函数
580
632
  */
581
633
  function exportToExcelSimple(records, config) {
582
- return exportToExcelWithMerge(records, config.columns || [], config.mergeKeys, config.numKeys || [], config.dateKeys, config.fileName || "export.xlsx", config.sheetName || "Sheet1", config.columnHeaders, config.summaryConfig, config.topDescription, config.topDescriptionRowHeight);
634
+ return exportToExcelWithMerge(records, config.columns || [], config.mergeKeys, config.numKeys || [], config.dateKeys, config.fileName || "export.xlsx", config.sheetName || "Sheet1", config.columnHeaders, config.summaryConfig, config.topDescription, config.topDescriptionRowHeight, config.childrenColumnName || "children");
583
635
  }
584
636
  /**
585
637
  * Hook 版本,支持选择导出方式
586
638
  */
587
639
  function useExcelExport(records, config) {
588
- var columns = config.columns, isAutoMerge = config.isAutoMerge, columnHeaders = config.columnHeaders, summaryConfig = config.summaryConfig;
640
+ var columns = config.columns, isAutoMerge = config.isAutoMerge, columnHeaders = config.columnHeaders, summaryConfig = config.summaryConfig, childrenColumnName = config.childrenColumnName;
589
641
  var mergeKeys = useMergeKeys(columns, isAutoMerge);
590
642
  var numKeys = useNumKeys(columns);
591
643
  var dateKeys = useDateKeys(columns);
@@ -607,6 +659,7 @@ function useExcelExport(records, config) {
607
659
  summaryConfig: summaryConfig,
608
660
  topDescription: topDescription,
609
661
  topDescriptionRowHeight: topDescriptionRowHeight,
662
+ childrenColumnName: childrenColumnName,
610
663
  });
611
664
  });
612
665
  return exportFunction;
@@ -40,8 +40,9 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
40
40
  // completed: 过滤功能
41
41
  // completed: 实现从execl复制到表格中的功能
42
42
  var Table = function (props) {
43
+ var _a;
43
44
  // console.log("表格渲染");
44
- var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, customDynamicListHandle = props.customDynamicListHandle, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, addAndDelProps = props.addAndDelProps, _o = props.autoScrollYMarginBottom, autoScrollYMarginBottom = _o === void 0 ? 65 : _o, _p = props.isAutoScrollY, isAutoScrollY = _p === void 0 ? false : _p, 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, _q = props.isExportSummary, isExportSummary = _q === void 0 ? true : _q, isAutoMergeAddAndDel = props.isAutoMergeAddAndDel, 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"]);
45
+ 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, 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"]);
45
46
  var classes = classNames("ztxk-table", className, {
46
47
  "ztxk-table--flex": isFlex,
47
48
  });
@@ -53,25 +54,25 @@ var Table = function (props) {
53
54
  id: menuId,
54
55
  }).show;
55
56
  // 针对SCU和增减行 做特殊处理
56
- var _r = useScuRfresh(), refreshScuCell = _r.refreshScuCell, getRefreshScuCell = _r.getRefreshScuCell;
57
+ var _s = useScuRfresh(), refreshScuCell = _s.refreshScuCell, getRefreshScuCell = _s.getRefreshScuCell;
57
58
  // 做一些前置处理
58
59
  // 比如过滤某些列 不做展示
59
60
  var columns = useParseColumns(_columns);
60
61
  // 得到动态列配置信息
61
- var _s = useDynamicListByColumns(columns, {
62
+ var _t = useDynamicListByColumns(columns, {
62
63
  dynamicKey: dynamicKey,
63
64
  dynamicVersion: dynamicVersion,
64
65
  customDynamicListHandle: customDynamicListHandle,
65
- }), defaultDynamicList = _s.defaultDynamicList, onCurrentListChange = _s.onCurrentListChange, currentDynamicList = _s.currentDynamicList, dynamicSettingRef = _s.dynamicSettingRef;
66
+ }), defaultDynamicList = _t.defaultDynamicList, onCurrentListChange = _t.onCurrentListChange, currentDynamicList = _t.currentDynamicList, dynamicSettingRef = _t.dynamicSettingRef;
66
67
  // 因为内部分页需要知晓当前页面的数据展示,要不然数据排序就跟内部分页没关系了
67
68
  // 自定义排序方法
68
- var _t = useCustomSort(dataSource, onTableChange, {
69
+ var _u = useCustomSort(dataSource, onTableChange, {
69
70
  refreshScuCell: refreshScuCell,
70
71
  rowKey: props === null || props === void 0 ? void 0 : props.rowKey,
71
72
  serviceOrder: serviceOrder,
72
73
  isOrderUpdateData: isOrderUpdateData,
73
74
  isAutoMerge: isAutoMerge,
74
- }), order = _t.order, setOrder = _t.setOrder, customSortHandle = _t.customSortHandle, sortDataSource = _t.sortDataSource;
75
+ }), order = _u.order, setOrder = _u.setOrder, customSortHandle = _u.customSortHandle, sortDataSource = _u.sortDataSource;
75
76
  // 当前表格展示的数据
76
77
  // 如果开启了前端排序的话,排序后的数据,可能会影响到很多地方。
77
78
  // 所以后续操作的数据 应该用
@@ -98,12 +99,12 @@ var Table = function (props) {
98
99
  return scroll || {};
99
100
  }, [scroll, currentTableDataSource, virtualKey, scrolly, isAutoScrollY]);
100
101
  // 内部分页相关配置
101
- var _u = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
102
+ var _v = useInnerPagination(isInnerPagination, innerPaginationPageSize, {
102
103
  innerPaginationPosition: innerPaginationPosition,
103
104
  innerPaginationPageSizeOptions: innerPaginationPageSizeOptions,
104
105
  innerPaginationConfig: innerPaginationConfig,
105
106
  dataSource: currentTableDataSource,
106
- }), paginationConfig = _u.paginationConfig, currentPage = _u.currentPage, setCurrent = _u.setCurrent, pageSize = _u.pageSize;
107
+ }), paginationConfig = _v.paginationConfig, currentPage = _v.currentPage, setCurrent = _v.setCurrent, pageSize = _v.pageSize;
107
108
  // 内部表格编辑事件
108
109
  var onEditableSave = useEditChange(dataSourceRef, onTableChange);
109
110
  // 记录表头过滤的一些配置(通过ref记录,key => filter) 复制整列、过滤后修改数据,需要先走过滤
@@ -131,9 +132,9 @@ var Table = function (props) {
131
132
  filterConfigRef: filterConfigRef,
132
133
  });
133
134
  // 表格内部自定义处理过滤,不走antd内部
134
- var _v = useCustomFilter(currentTableDataSource), filterDataSource = _v[0], handleFilterConfigChange = _v[1];
135
+ var _w = useCustomFilter(currentTableDataSource), filterDataSource = _w[0], handleFilterConfigChange = _w[1];
135
136
  // 处理列配置信息 得到新的列配置信息
136
- var _w = useColumns(columns, {
137
+ var _x = useColumns(columns, {
137
138
  // 动态列配置相关信息
138
139
  dynamicKey: dynamicKey,
139
140
  isRemeberFilter: isRemeberFilter,
@@ -176,14 +177,14 @@ var Table = function (props) {
176
177
  isAutoMerge: isAutoMerge,
177
178
  handleFilterConfigChange: handleFilterConfigChange,
178
179
  isAutoMergeAddAndDel: isAutoMergeAddAndDel,
179
- }), _newColumns = _w.newColumns, newRowSelection = _w.rowSelection;
180
+ }), _newColumns = _x.newColumns, newRowSelection = _x.rowSelection;
180
181
  // 处理表格合并和维度
181
- var _x = useAutoMerge(filterDataSource, _newColumns, {
182
+ var _y = useAutoMerge(filterDataSource, _newColumns, {
182
183
  isAutoMerge: isAutoMerge,
183
184
  isDimensionDynamic: isDimensionDynamic,
184
185
  order: order,
185
186
  dimensionCustomSumKeys: dimensionCustomSumKeys,
186
- }), newDataSource = _x[0], newColumns = _x[1];
187
+ }), newDataSource = _y[0], newColumns = _y[1];
187
188
  // 内部表格总结栏
188
189
  var getSummaryHandle = useSummary(summaryConfig, newColumns, {
189
190
  summaryFixed: summaryFixed,
@@ -193,7 +194,7 @@ var Table = function (props) {
193
194
  isDel: isDel,
194
195
  });
195
196
  // 表格验证
196
- var _y = useTableValidate(), tableRef = _y.tableRef, getCurrentTable = _y.getCurrentTable, clearErrorClass = _y.clearErrorClass;
197
+ var _z = useTableValidate(), tableRef = _z.tableRef, getCurrentTable = _z.getCurrentTable, clearErrorClass = _z.clearErrorClass;
197
198
  // 使用 ref 缓存最新的滚动位置,确保在组件卸载过程中仍能访问
198
199
  var scrollPositionRef = useRef({ x: 0, y: 0 });
199
200
  // 滚动条控制方法
@@ -326,6 +327,7 @@ var Table = function (props) {
326
327
  columns: newColumns,
327
328
  isAutoMerge: isAutoMerge,
328
329
  summaryConfig: isExportSummary ? summaryConfig : undefined,
330
+ childrenColumnName: (_a = props.expandable) === null || _a === void 0 ? void 0 : _a.childrenColumnName,
329
331
  });
330
332
  // 暴露给外部一些方法
331
333
  useImperativeHandle(tableRefHandle, function () {
@@ -398,7 +400,7 @@ var Table = function (props) {
398
400
  };
399
401
  });
400
402
  // 全屏的一些方法
401
- var _z = useState(false), isFull = _z[0], setIsFull = _z[1];
403
+ var _0 = useState(false), isFull = _0[0], setIsFull = _0[1];
402
404
  var fullscreenHandle = useMemoizedFn(function (isFull) {
403
405
  isFullscreenHandle === null || isFullscreenHandle === void 0 ? void 0 : isFullscreenHandle(isFull);
404
406
  setIsFull(isFull);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -41,7 +41,8 @@
41
41
  "test": "craco test",
42
42
  "eject": "craco eject",
43
43
  "storybook": "storybook dev -p 6006",
44
- "build-storybook": "storybook build"
44
+ "build-storybook": "storybook build",
45
+ "publish:npm": "node publish.cjs"
45
46
  },
46
47
  "eslintConfig": {
47
48
  "extends": [