zmdms-webui 2.2.2 → 2.2.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.
@@ -479,7 +479,7 @@ function useAutoMerge(dataSource, columns, _a) {
479
479
  * 处理合并后的加减和选择框
480
480
  */
481
481
  function useMergeAddAndDel(_a) {
482
- var addAndDelProps = _a.addAndDelProps, rowSelection = _a.rowSelection, columns = _a.columns, isAutoMerge = _a.isAutoMerge;
482
+ var addAndDelProps = _a.addAndDelProps, rowSelection = _a.rowSelection, columns = _a.columns, isAutoMerge = _a.isAutoMerge, isAutoMergeAddAndDel = _a.isAutoMergeAddAndDel;
483
483
  // 计算需要合并的字段key集合
484
484
  var mergeKeys = useMergeKeys(columns, isAutoMerge);
485
485
  var firstMergeKey = mergeKeys === null || mergeKeys === void 0 ? void 0 : mergeKeys[0];
@@ -489,7 +489,7 @@ function useMergeAddAndDel(_a) {
489
489
  * - 兼容原生rowSelection所有配置
490
490
  */
491
491
  var newRowSelection = useMemo(function () {
492
- if (isAutoMerge && rowSelection) {
492
+ if (isAutoMerge && rowSelection && isAutoMergeAddAndDel) {
493
493
  return __assign(__assign({}, rowSelection), {
494
494
  // 关键:合并行时,勾选框只显示在rowSpan>0的单元格
495
495
  renderCell: function (_v, record, _i, originNode) {
@@ -503,13 +503,13 @@ function useMergeAddAndDel(_a) {
503
503
  } });
504
504
  }
505
505
  return rowSelection;
506
- }, [rowSelection, isAutoMerge, firstMergeKey]);
506
+ }, [rowSelection, isAutoMerge, firstMergeKey, isAutoMergeAddAndDel]);
507
507
  /**
508
508
  * 增删行按钮配置优化
509
509
  * - 合并行时,按钮只显示在rowSpan>0的单元格
510
510
  */
511
511
  var newAddAndDelProps = useMemo(function () {
512
- if (isAutoMerge) {
512
+ if (isAutoMerge && isAutoMergeAddAndDel) {
513
513
  return __assign(__assign({}, addAndDelProps), { onCell: function (record) {
514
514
  var _a;
515
515
  return {
@@ -518,7 +518,7 @@ function useMergeAddAndDel(_a) {
518
518
  } });
519
519
  }
520
520
  return addAndDelProps;
521
- }, [addAndDelProps, isAutoMerge, firstMergeKey]);
521
+ }, [addAndDelProps, isAutoMerge, firstMergeKey, isAutoMergeAddAndDel]);
522
522
  return [newRowSelection, newAddAndDelProps];
523
523
  }
524
524
  /**
@@ -529,6 +529,10 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
529
529
  * 开启自动合并行
530
530
  */
531
531
  isAutoMerge?: boolean;
532
+ /**
533
+ * 开启自动合并后,但不需要合并选择行和新增行
534
+ */
535
+ isAutoMergeAddAndDel?: boolean;
532
536
  /**
533
537
  * 导出文件是否添加合计行
534
538
  */
@@ -567,9 +571,10 @@ interface IFields {
567
571
  /**
568
572
  * 对当前字段的值做最终处理,v 跟 showKey 或者 value的类型一一对应 如果传入的是数组 那么返回的即是数组
569
573
  * @param v 当前处理值
574
+ * @param summaryTotalObj 总结栏总对象
570
575
  * @returns
571
576
  */
572
- callback?: (v: any) => any;
577
+ callback?: (v: any, summaryTotalObj: any) => any;
573
578
  /** 对齐方式 */
574
579
  align?: "left" | "center" | "right";
575
580
  }
@@ -41,7 +41,7 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
41
41
  // completed: 实现从execl复制到表格中的功能
42
42
  var Table = function (props) {
43
43
  // 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, 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"]);
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
45
  var classes = classNames("ztxk-table", className, {
46
46
  "ztxk-table--flex": isFlex,
47
47
  });
@@ -174,6 +174,7 @@ var Table = function (props) {
174
174
  mode: mode,
175
175
  isAutoMerge: isAutoMerge,
176
176
  handleFilterConfigChange: handleFilterConfigChange,
177
+ isAutoMergeAddAndDel: isAutoMergeAddAndDel,
177
178
  }), _newColumns = _w.newColumns, newRowSelection = _w.rowSelection;
178
179
  // 处理表格合并和维度
179
180
  var _x = useAutoMerge(filterDataSource, _newColumns, {
@@ -26,15 +26,16 @@ import ModalComponent from '../modal/modal.js';
26
26
  function useColumns(columns, options) {
27
27
  var _this = this;
28
28
  var _a, _b;
29
- var dynamicKey = options.dynamicKey, isRemeberFilter = options.isRemeberFilter, hiddenDynamicIcon = options.hiddenDynamicIcon, currentDynamicList = options.currentDynamicList, dataSource = options.dataSource, dataSourceRef = options.dataSourceRef, onEditableSave = options.onEditableSave, isEdit = options.isEdit, isAdd = options.isAdd, isTheadTitleAdd = options.isTheadTitleAdd, isDel = options.isDel, delPopTitle = options.delPopTitle, dynamicSettingRef = options.dynamicSettingRef, onCurrentListChange = options.onCurrentListChange, onAddAndDel = options.onAddAndDel, getRefreshScuCell = options.getRefreshScuCell, isDelAll = options.isDelAll, currentPage = options.currentPage, onTableChange = options.onTableChange, order = options.order, setOrder = options.setOrder, customSortHandle = options.customSortHandle, isResizableColumn = options.isResizableColumn, isResizableTitleEllipsis = options.isResizableTitleEllipsis, isRealTimeValidate = options.isRealTimeValidate, hiddenDelBtnHandleRef = options.hiddenDelBtnHandleRef, hiddenAddBtnHandleRef = options.hiddenAddBtnHandleRef, rowKey = options.rowKey, filterConfigRef = options.filterConfigRef, rowSelection = options.rowSelection, addAndDelProps = options.addAndDelProps, headerAlign = options.headerAlign, mode = options.mode, isAutoMerge = options.isAutoMerge, handleFilterConfigChange = options.handleFilterConfigChange;
29
+ var dynamicKey = options.dynamicKey, isRemeberFilter = options.isRemeberFilter, hiddenDynamicIcon = options.hiddenDynamicIcon, currentDynamicList = options.currentDynamicList, dataSource = options.dataSource, dataSourceRef = options.dataSourceRef, onEditableSave = options.onEditableSave, isEdit = options.isEdit, isAdd = options.isAdd, isTheadTitleAdd = options.isTheadTitleAdd, isDel = options.isDel, delPopTitle = options.delPopTitle, dynamicSettingRef = options.dynamicSettingRef, onCurrentListChange = options.onCurrentListChange, onAddAndDel = options.onAddAndDel, getRefreshScuCell = options.getRefreshScuCell, isDelAll = options.isDelAll, currentPage = options.currentPage, onTableChange = options.onTableChange, order = options.order, setOrder = options.setOrder, customSortHandle = options.customSortHandle, isResizableColumn = options.isResizableColumn, isResizableTitleEllipsis = options.isResizableTitleEllipsis, isRealTimeValidate = options.isRealTimeValidate, hiddenDelBtnHandleRef = options.hiddenDelBtnHandleRef, hiddenAddBtnHandleRef = options.hiddenAddBtnHandleRef, rowKey = options.rowKey, filterConfigRef = options.filterConfigRef, rowSelection = options.rowSelection, addAndDelProps = options.addAndDelProps, headerAlign = options.headerAlign, mode = options.mode, isAutoMerge = options.isAutoMerge, handleFilterConfigChange = options.handleFilterConfigChange, _c = options.isAutoMergeAddAndDel, isAutoMergeAddAndDel = _c === void 0 ? true : _c;
30
30
  var newColumns = getTableColumns(columns, currentDynamicList).columns;
31
31
  // 处理自动合并的加减和选择框
32
- var _c = useMergeAddAndDel({
32
+ var _d = useMergeAddAndDel({
33
33
  rowSelection: rowSelection,
34
34
  addAndDelProps: addAndDelProps,
35
35
  columns: newColumns,
36
36
  isAutoMerge: isAutoMerge,
37
- }), newRowSelection = _c[0], newAddAndDelProps = _c[1];
37
+ isAutoMergeAddAndDel: isAutoMergeAddAndDel,
38
+ }), newRowSelection = _d[0], newAddAndDelProps = _d[1];
38
39
  // 表头过滤的一些配置(获取表头过滤的input的输入框的引用)
39
40
  var searchValueInputRef = useRef(null);
40
41
  // 记录表头过滤的一些配置(通过ref记录,key => filter) 复制整列时,需要先走过滤
@@ -231,7 +231,7 @@ function getSubtotalObj(fields, dataSource) {
231
231
  }
232
232
  // 如果数据还需要最终处理的话
233
233
  if (callback && index === dataSource.length - 1) {
234
- summaryTotalObj[key] = callback(summaryTotalObj[key]);
234
+ summaryTotalObj[key] = callback(summaryTotalObj[key], summaryTotalObj);
235
235
  }
236
236
  summaryTotalConfigObj[key] = {
237
237
  align: field === null || field === void 0 ? void 0 : field.align,
@@ -289,7 +289,7 @@ function getTotalObj(fields) {
289
289
  summaryTotalObj[key] = 0;
290
290
  }
291
291
  if (callback) {
292
- summaryTotalObj[key] = callback(summaryTotalObj[key]);
292
+ summaryTotalObj[key] = callback(summaryTotalObj[key], summaryTotalObj);
293
293
  }
294
294
  summaryTotalConfigObj[key] = {
295
295
  align: field === null || field === void 0 ? void 0 : field.align,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",