zmdms-webui 2.9.7 → 2.9.9

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.
@@ -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);
@@ -34,9 +34,10 @@ function useTableSummaryCollapse(tableRef, isDefaultShow, isCollapseEnable) {
34
34
  }
35
35
  var tableWidth = tableWidthRef.current || window.innerWidth;
36
36
  return (jsx(Table.Summary.Row, __assign({ className: "ztxk-table-summary-collapse",
37
- // 这里不能设置高度,当表格属性 有 tableLayout: 'auto'时,宽度会有问题
37
+ // 这里不能设置宽度,当表格属性 有 tableLayout: 'auto'时,宽度会有问题
38
+ // 使用sticky定位在safari浏览器下会有问题
38
39
  // style={{ width: `${tableWidth - 15}px` }}
39
- style: { left: tableWidth / 2 - 80 } }, { children: jsx("td", __assign({ style: { height: "20px", border: "none" } }, { children: jsxs("div", __assign({ className: "ztxk-table-summary-collapse-title", onClick: function () {
40
+ style: { left: tableWidth / 2 - 38 } }, { children: jsx("td", __assign({ style: { height: "20px", border: "none" } }, { children: jsxs("div", __assign({ className: "ztxk-table-summary-collapse-title", onClick: function () {
40
41
  setShowSummary(!showSummary);
41
42
  } }, { children: ["\u7EDF\u8BA1", jsx(IconFont, { type: "icon-a-lujingbiankuang", style: {
42
43
  fontSize: 14,
@@ -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) {