zmdms-webui 2.4.3 → 2.4.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.
@@ -249,21 +249,19 @@ function CanvasTable(props) {
249
249
  onColumnResize: handleColumnResize,
250
250
  }), resizeState = _3.resizeState, checkResizeHandle = _3.checkResizeHandle, startResize = _3.startResize, updateResize = _3.updateResize, endResize = _3.endResize, setHoverResizeColumn = _3.setHoverResizeColumn, getColumnWidth = _3.getColumnWidth, RESIZE_HANDLE_WIDTH = _3.RESIZE_HANDLE_WIDTH;
251
251
  // 复制到剪贴板
252
- var getSelectedCellsText = useCopyToClipboard({
252
+ var _4 = useCopyToClipboard({
253
253
  cellSelection: state.cellSelection,
254
254
  processedDataSource: finalDataSource,
255
255
  columns: processedColumns,
256
256
  containerRef: containerRef,
257
- }).getSelectedCellsText;
257
+ }), getSelectedCellsText = _4.getSelectedCellsText, copyToClipboard = _4.copyToClipboard;
258
258
  // 处理右键菜单的复制操作
259
259
  var handleCopy = useCallback(function () {
260
260
  var text = getSelectedCellsText();
261
- if (text && navigator.clipboard) {
262
- navigator.clipboard.writeText(text).catch(function (err) {
263
- console.error("Failed to copy:", err);
264
- });
261
+ if (text) {
262
+ copyToClipboard(text);
265
263
  }
266
- }, [getSelectedCellsText]);
264
+ }, [getSelectedCellsText, copyToClipboard]);
267
265
  // 过滤勾选框和index行给导出用
268
266
  var exportColumns = useMemo(function () {
269
267
  return processedColumns.filter(function (item) { return !item.key.includes("__"); });
@@ -272,10 +270,10 @@ function CanvasTable(props) {
272
270
  var exportExcel = useExcelExport(newDataSource, {
273
271
  columns: exportColumns,
274
272
  isAutoMerge: isAutoMerge,
275
- summaryConfig: [],
273
+ summaryConfig: (exportExcelConfig === null || exportExcelConfig === void 0 ? void 0 : exportExcelConfig.isExportNoSummary) ? undefined : [],
276
274
  });
277
275
  // 交互事件处理(使用baseScrollbarMetrics的maxScrollTop/maxScrollLeft以保持稳定)
278
- var _4 = useTableInteraction({
276
+ var _5 = useTableInteraction({
279
277
  state: state,
280
278
  setState: setState,
281
279
  scrollState: scrollState,
@@ -322,7 +320,7 @@ function CanvasTable(props) {
322
320
  fixedRowsCount: fixedRowsCount,
323
321
  fixedRowsConfig: fixedRowsConfig,
324
322
  summaryFixed: summaryFixed,
325
- }), handleCanvasMouseDown = _4.handleCanvasMouseDown, handleCanvasMouseMove = _4.handleCanvasMouseMove, handleCanvasMouseUp = _4.handleCanvasMouseUp, handleCanvasMouseLeave = _4.handleCanvasMouseLeave, handleCanvasContextMenu = _4.handleCanvasContextMenu;
323
+ }), handleCanvasMouseDown = _5.handleCanvasMouseDown, handleCanvasMouseMove = _5.handleCanvasMouseMove, handleCanvasMouseUp = _5.handleCanvasMouseUp, handleCanvasMouseLeave = _5.handleCanvasMouseLeave, handleCanvasContextMenu = _5.handleCanvasContextMenu;
326
324
  // 渲染表格
327
325
  useTableRender(__assign(__assign({ canvasRef: canvasRef, processedDataSource: finalDataSource, columnRenderInfos: columnRenderInfos, columns: processedColumns, // 传递原始columns用于渲染多级表头
328
326
  state: state, scrollState: scrollState, rowSelection: rowSelection, containerWidth: containerWidth, containerHeight: containerHeight, headerHeight: calculatedHeaderHeight, baseHeaderHeight: headerHeight, // 传入原始基础高度用于计算每层高度
@@ -421,6 +419,13 @@ function CanvasTable(props) {
421
419
  scrollTo: function (params) {
422
420
  setScrollState(function (prev) { return (__assign(__assign({}, prev), { scrollLeft: params.x !== undefined ? params.x : prev.scrollLeft, scrollTop: params.y !== undefined ? params.y : prev.scrollTop })); });
423
421
  },
422
+ /** 获取滚动条位置信息 */
423
+ getScrollPosition: function () {
424
+ return {
425
+ x: scrollState.scrollLeft,
426
+ y: scrollState.scrollTop,
427
+ };
428
+ },
424
429
  /** 获取当前排序状态 */
425
430
  getSortState: function () {
426
431
  return {
@@ -450,6 +455,8 @@ function CanvasTable(props) {
450
455
  state.filters,
451
456
  setState,
452
457
  setScrollState,
458
+ scrollState.scrollLeft,
459
+ scrollState.scrollTop,
453
460
  ]);
454
461
  return (jsx(Spin, __assign({ spinning: loading }, { children: jsxs("div", __assign({ ref: containerRef, id: canvasTableId, className: "canvas-table-container ".concat(className || ""), tabIndex: 0, style: __assign(__assign({}, style), { position: "relative", width: width || "100%", height: containerHeight, overflow: "hidden", touchAction: "none", outline: "none" }) }, { children: [jsx("canvas", { ref: canvasRef, onMouseDown: handleCanvasMouseDown, onMouseMove: handleCanvasMouseMove, onMouseUp: handleCanvasMouseUp, onMouseLeave: handleCanvasMouseLeave, onContextMenu: handleCanvasContextMenu, style: {
455
462
  display: "block",
@@ -173,6 +173,10 @@ interface ICanvasColumnType<RecordType = any> {
173
173
  * 是否加上千分符
174
174
  */
175
175
  thousand?: boolean;
176
+ /**
177
+ * 空值时显示的文本,默认为 "—"
178
+ */
179
+ emptyText?: string;
176
180
  /**
177
181
  * 设置单元格属性(用于合并单元格等)
178
182
  * 参考 antd table 的 onCell 用法
@@ -414,6 +418,7 @@ interface ICanvasTableProps<RecordType = any> {
414
418
  time?: string;
415
419
  topDescriptionRowHeight?: number;
416
420
  fileName: string;
421
+ isExportNoSummary?: boolean;
417
422
  };
418
423
  }
419
424
  /**
@@ -463,6 +468,16 @@ interface ICanvasTableRefHandle {
463
468
  x?: number;
464
469
  y?: number;
465
470
  }) => void;
471
+ /**
472
+ * 获取滚动条位置信息
473
+ * @returns 包含 x(水平) 和 y(垂直) 滚动位置的对象
474
+ */
475
+ getScrollPosition: () => {
476
+ /** 水平滚动位置 */
477
+ x: number;
478
+ /** 垂直滚动位置 */
479
+ y: number;
480
+ };
466
481
  /**
467
482
  * 获取当前排序状态
468
483
  */
@@ -18,8 +18,10 @@ var formatDate = function (value, format) {
18
18
  * 格式化单元格值
19
19
  */
20
20
  var formatCellValue = function (value, column) {
21
- if (value === null || value === undefined)
22
- return "";
21
+ // 空值处理:nullundefined、空字符串
22
+ if (value === null || value === undefined || value === "") {
23
+ return column.emptyText !== undefined ? column.emptyText : "— —";
24
+ }
23
25
  var formattedValue = value;
24
26
  // 日期格式化
25
27
  if (column.dateFormat) {
@@ -245,6 +245,10 @@ interface IColumnType<RecordType> extends Omit<ColumnType<RecordType>, "render">
245
245
  dateFormat?: string;
246
246
  precision?: number;
247
247
  thousand?: boolean;
248
+ /**
249
+ * 空值时显示的文本,默认为 "—"
250
+ */
251
+ emptyText?: string;
248
252
  }
249
253
  interface IRenderOptions {
250
254
  insertTableFromClipboard: IFuncInsertTableFromClipboard;
@@ -305,6 +309,16 @@ interface ITableRefHandel {
305
309
  vid?: string;
306
310
  index?: number;
307
311
  }) => void;
312
+ /**
313
+ * 获取滚动条位置信息
314
+ * @returns 包含 x(水平) 和 y(垂直) 滚动位置的对象
315
+ */
316
+ getScrollPosition?: () => {
317
+ /** 水平滚动位置 */
318
+ x: number;
319
+ /** 垂直滚动位置 */
320
+ y: number;
321
+ };
308
322
  /**
309
323
  * 重置
310
324
  */
@@ -230,6 +230,21 @@ var Table = function (props) {
230
230
  }
231
231
  }
232
232
  });
233
+ // 获取滚动条位置
234
+ var getScrollPosition = useMemoizedFn(function () {
235
+ var _a;
236
+ var tableBody = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(".ant-table-body");
237
+ if (tableBody) {
238
+ return {
239
+ x: tableBody.scrollLeft,
240
+ y: tableBody.scrollTop,
241
+ };
242
+ }
243
+ return {
244
+ x: 0,
245
+ y: 0,
246
+ };
247
+ });
233
248
  // 虚拟滚动选项
234
249
  var vComponents = useMemo(function () {
235
250
  if (virtualKey) {
@@ -352,6 +367,13 @@ var Table = function (props) {
352
367
  scrollTo: function (options) {
353
368
  scrollToPosition(options);
354
369
  },
370
+ /**
371
+ * 获取滚动条位置信息
372
+ * @returns 包含滚动位置和容器尺寸的对象
373
+ */
374
+ getScrollPosition: function () {
375
+ return getScrollPosition();
376
+ },
355
377
  /** 动态列配置重置 */
356
378
  onResetDynamicList: function () {
357
379
  var _a, _b;
@@ -324,8 +324,10 @@ function useColumns(columns, options) {
324
324
  if (typeof text === "object") {
325
325
  return PLACEHOLDER_NULL;
326
326
  }
327
- if (text == null || text === "")
328
- return PLACEHOLDER_NULL;
327
+ // 空值处理:null、undefined、空字符串
328
+ if (text == null || text === "") {
329
+ return _column.emptyText !== undefined ? _column.emptyText : "—";
330
+ }
329
331
  if (_column.dateFormat)
330
332
  return dayjs(text).format(_column.dateFormat);
331
333
  if (_column.precision)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",