zmdms-webui 2.6.7 → 2.6.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.
@@ -1,6 +1,7 @@
1
1
  import { __assign } from '../_virtual/_tslib.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import React__default, { useState, useRef, useCallback } from 'react';
3
+ import React__default, { useState, useRef } from 'react';
4
+ import { useMemoizedFn } from 'ahooks';
4
5
 
5
6
  var useResizable = function (options) {
6
7
  var isResize = options.isResize, _a = options.minWidth, minWidth = _a === void 0 ? 100 : _a, _b = options.minHeight, minHeight = _b === void 0 ? 100 : _b, maxWidth = options.maxWidth, maxHeight = options.maxHeight, _c = options.defaultWidth, defaultWidth = _c === void 0 ? "70%" : _c, _d = options.defaultHeight, defaultHeight = _d === void 0 ? "auto" : _d;
@@ -17,7 +18,7 @@ var useResizable = function (options) {
17
18
  startHeight: 0,
18
19
  });
19
20
  // 开始调整大小
20
- var onResizeStart = useCallback(function (direction, e) {
21
+ var onResizeStart = useMemoizedFn(function (direction, e) {
21
22
  var _a;
22
23
  if (!isResize) {
23
24
  return;
@@ -42,9 +43,9 @@ var useResizable = function (options) {
42
43
  document.body.style.cursor = getCursor(direction);
43
44
  document.body.style.userSelect = "none";
44
45
  document.body.classList.add("ztxk-modal-resizing");
45
- }, [isResize]);
46
+ });
46
47
  // 调整大小中
47
- var onResizeMove = useCallback(function (e) {
48
+ var onResizeMove = useMemoizedFn(function (e) {
48
49
  var _a = resizingRef.current, direction = _a.direction, startX = _a.startX, startY = _a.startY, startWidth = _a.startWidth, startHeight = _a.startHeight;
49
50
  if (!direction) {
50
51
  return;
@@ -79,16 +80,16 @@ var useResizable = function (options) {
79
80
  width: newWidth,
80
81
  height: newHeight,
81
82
  });
82
- }, [minWidth, minHeight, maxWidth, maxHeight]);
83
+ });
83
84
  // 结束调整大小
84
- var onResizeEnd = useCallback(function () {
85
+ var onResizeEnd = useMemoizedFn(function () {
85
86
  resizingRef.current.direction = null;
86
87
  document.removeEventListener("mousemove", onResizeMove);
87
88
  document.removeEventListener("mouseup", onResizeEnd);
88
89
  document.body.style.cursor = "";
89
90
  document.body.style.userSelect = "";
90
91
  document.body.classList.remove("ztxk-modal-resizing");
91
- }, [onResizeMove]);
92
+ });
92
93
  // 获取鼠标样式
93
94
  var getCursor = function (direction) {
94
95
  var cursorMap = {
@@ -3,7 +3,7 @@ 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';
5
5
  import { IS_SUMMARY, MERGE_ROW_SPANS } from './constant.js';
6
- import { exactRound } from 'zmdms-utils';
6
+ import { plus, exactRound } from 'zmdms-utils';
7
7
  import dayjs from 'dayjs';
8
8
 
9
9
  // 内部常量,用于标记父数据
@@ -73,6 +73,7 @@ function exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys,
73
73
  excelData.leafColumns.forEach(function (col, colIndex) {
74
74
  var key = col.dataIndex;
75
75
  if (col.isSummary) {
76
+ // 默认计算逻辑:数值求和
76
77
  var total = 0;
77
78
  for (var i = 0; i < processedData.length; i++) {
78
79
  if (processedData[i][IS_SUMMARY])
@@ -80,7 +81,7 @@ function exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys,
80
81
  var v = processedData[i][key];
81
82
  var n = typeof v === "number" ? v : Number(v);
82
83
  if (!isNaN(n))
83
- total += n;
84
+ total = plus(total, n);
84
85
  }
85
86
  sumsByKey_1[key] = total;
86
87
  }
@@ -90,6 +91,9 @@ function exportToExcelWithMergeAndComments(records, columns, mergeKeys, numKeys,
90
91
  return "合计";
91
92
  var key = col.dataIndex;
92
93
  if (col.isSummary && sumsByKey_1[key] !== undefined) {
94
+ if (col.totalCalcCallback) {
95
+ return col.totalCalcCallback(sumsByKey_1, processedData);
96
+ }
93
97
  return sumsByKey_1[key];
94
98
  }
95
99
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",