ztxkui 4.2.23-630 → 4.2.23-631

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.
Files changed (28) hide show
  1. package/dist/components/CanvasTable/draw/canvas.js +50 -35
  2. package/dist/components/CanvasTable/draw/primitives.d.ts +2 -0
  3. package/dist/components/CanvasTable/draw/primitives.js +28 -0
  4. package/dist/components/CanvasTable/draw/scene.d.ts +28 -2
  5. package/dist/components/CanvasTable/draw/scene.js +68 -14
  6. package/dist/components/CanvasTable/hooks/useCopy.js +16 -0
  7. package/dist/components/CanvasTable/hooks/useInteractions.d.ts +13 -0
  8. package/dist/components/CanvasTable/hooks/useInteractions.js +73 -24
  9. package/dist/components/CanvasTable/index.d.ts +2 -0
  10. package/dist/components/CanvasTable/index.js +80 -63
  11. package/dist/components/CanvasTable/interface.d.ts +69 -5
  12. package/dist/components/CanvasTable/utils/canvasAtom.d.ts +35 -0
  13. package/dist/components/CanvasTable/utils/canvasAtom.js +153 -0
  14. package/dist/components/CanvasTable/utils/canvasCells.d.ts +15 -0
  15. package/dist/components/CanvasTable/utils/canvasCells.js +118 -0
  16. package/dist/components/CanvasTable/utils/hitTest.d.ts +2 -2
  17. package/dist/components/CanvasTable/utils/hitTest.js +7 -6
  18. package/dist/components/CanvasTable/utils/index.d.ts +1 -0
  19. package/dist/components/CanvasTable/utils/index.js +1 -0
  20. package/dist/components/CanvasTable/utils/layout.d.ts +1 -3
  21. package/dist/components/CanvasTable/utils/layout.js +8 -15
  22. package/dist/components/CanvasTable/utils/rowHeights.d.ts +3 -2
  23. package/dist/components/CanvasTable/utils/rowHeights.js +44 -9
  24. package/dist/components/business/OperationBtnGroup/index.d.ts +16 -0
  25. package/dist/components/business/OperationBtnGroup/index.js +38 -0
  26. package/dist/index.build.d.ts +2 -2
  27. package/dist/index.build.js +1 -1
  28. package/package.json +1 -1
@@ -1,7 +1,8 @@
1
1
  import { COLORS, FONT_FAMILY, FONT_SIZE, FONT_WEIGHT, TEXT_PADDING, RESIZE_HANDLE_WIDTH, SCROLLBAR_SIZE, } from '../constants';
2
2
  import { truncateText, wrapText } from '../utils/text';
3
+ import { drawAtomsCell } from '../utils/canvasAtom';
3
4
  import { SPECIAL_KEYS } from '../utils/layout';
4
- import { drawCheckbox, drawSortIcon, drawFilterIcon, drawExpandIcon, drawBadgeTriangle, } from './primitives';
5
+ import { drawCheckbox, drawRadio, drawSortIcon, drawFilterIcon, drawExpandIcon, drawBadgeTriangle, } from './primitives';
5
6
  function applyFont(ctx) {
6
7
  ctx.font = FONT_WEIGHT + " " + FONT_SIZE + "px " + FONT_FAMILY;
7
8
  ctx.textBaseline = 'middle';
@@ -161,7 +162,7 @@ export function drawScene(ctx, scene) {
161
162
  }
162
163
  }
163
164
  // ---- 数据区 ----
164
- var dataBottom = metrics.needH ? height - SCROLLBAR_SIZE : height;
165
+ var dataBottom = height;
165
166
  var _loop_1 = function (cell) {
166
167
  var layout = layouts[cell.col];
167
168
  if (!layout)
@@ -182,9 +183,7 @@ export function drawScene(ctx, scene) {
182
183
  var clipYBottom = cell.y + cell.height;
183
184
  if (!inFixedTop && !inFixedBottom) {
184
185
  clipYTop = Math.max(clipYTop, headerHeight + scene.fixedTopRows * rowHeight);
185
- clipYBottom = Math.min(clipYBottom, height -
186
- (metrics.needH ? SCROLLBAR_SIZE : 0) -
187
- scene.fixedBottomRows * rowHeight);
186
+ clipYBottom = Math.min(clipYBottom, height - scene.fixedBottomRows * rowHeight);
188
187
  }
189
188
  else if (inFixedBottom) {
190
189
  clipYBottom = Math.min(clipYBottom, dataBottom);
@@ -223,7 +222,12 @@ export function drawScene(ctx, scene) {
223
222
  }
224
223
  // 内容
225
224
  if (cell.kind === 'checkbox') {
226
- drawCheckbox(ctx, cell.x + cell.width / 2, cell.y + cell.height / 2, !!cell.checked, !!cell.disabled);
225
+ if (cell.radio) {
226
+ drawRadio(ctx, cell.x + cell.width / 2, cell.y + cell.height / 2, !!cell.checked, !!cell.disabled);
227
+ }
228
+ else {
229
+ drawCheckbox(ctx, cell.x + cell.width / 2, cell.y + cell.height / 2, !!cell.checked, !!cell.disabled);
230
+ }
227
231
  }
228
232
  else if (cell.kind === 'empty') {
229
233
  // 合计行的勾选/序号等留空单元格
@@ -263,21 +267,34 @@ export function drawScene(ctx, scene) {
263
267
  drawTextCell(ctx, cell, false);
264
268
  }
265
269
  }
270
+ else if (cell.kind === 'atoms' && cell.atoms) {
271
+ // renderToCanvas 协议:canvas 直绘原子(链接/文本/状态点)
272
+ var ha = scene.hoverAtom;
273
+ var isHoverCell = !!ha && ha.row === cell.row && ha.col === cell.col;
274
+ drawAtomsCell(ctx, cell.atoms.layout, cell.x, cell.y, cell.width, cell.height, isHoverCell ? ha.index : -1, isHoverCell);
275
+ }
266
276
  // overlay 单元格不绘制,交给 DOM 覆盖层
267
277
  // 角标
268
278
  if (cell.badge) {
269
279
  drawBadgeTriangle(ctx, cell.x, cell.y, cell.width, cell.height, cell.badge.position, cell.badge.color);
270
280
  }
271
- // 单元格边框
281
+ // 单元格边框(fillRect 1px 精确画法,避免缩放屏抗锯齿发深)
272
282
  if (scene.bordered) {
273
- ctx.strokeStyle = COLORS.border;
274
- ctx.lineWidth = 1;
275
- ctx.beginPath();
276
- ctx.moveTo(cell.x + cell.width, cell.y);
277
- ctx.lineTo(cell.x + cell.width, cell.y + cell.height);
278
- ctx.moveTo(cell.x, cell.y + cell.height);
279
- ctx.lineTo(cell.x + cell.width, cell.y + cell.height);
280
- ctx.stroke();
283
+ // 悬浮横向滚动条覆盖区内不画底边框(避免滚动条上方露出一条边线)
284
+ var cellBottom = cell.y + cell.height;
285
+ var hbarTop = height -
286
+ (metrics.needH ? SCROLLBAR_SIZE : 0) -
287
+ scene.fixedBottomRows * rowHeight;
288
+ var isFixedBottomRow = cell.row >= scene.dataLength - scene.fixedBottomRows;
289
+ var inFloatingStrip = metrics.needH &&
290
+ !isFixedBottomRow &&
291
+ cellBottom > hbarTop &&
292
+ cellBottom <= hbarTop + SCROLLBAR_SIZE + 1;
293
+ ctx.fillStyle = COLORS.border;
294
+ ctx.fillRect(cell.x + cell.width - 1, cell.y, 1, cell.height);
295
+ if (!inFloatingStrip) {
296
+ ctx.fillRect(cell.x, cellBottom - 1, cell.width, 1);
297
+ }
281
298
  }
282
299
  ctx.restore();
283
300
  };
@@ -298,10 +315,8 @@ export function drawScene(ctx, scene) {
298
315
  ctx.stroke();
299
316
  }
300
317
  if (scene.fixedBottomRows > 0) {
301
- var y = height -
302
- (metrics.needH ? SCROLLBAR_SIZE : 0) -
303
- scene.fixedBottomRows * rowHeight +
304
- 0.5;
318
+ // 分界线贴小计/合计行顶部(悬浮滚动条在其上方 12px,不压线)
319
+ var y = height - scene.fixedBottomRows * rowHeight + 0.5;
305
320
  ctx.strokeStyle = COLORS.fixedEdge;
306
321
  ctx.lineWidth = 1;
307
322
  ctx.beginPath();
@@ -401,25 +416,25 @@ export function drawScene(ctx, scene) {
401
416
  }
402
417
  }
403
418
  }
404
- // ---- 固定列阴影 ----
405
- if (fixedLeftRightEdge > 0 && scrollLeft > 0) {
406
- var gradient = ctx.createLinearGradient(fixedLeftRightEdge, 0, fixedLeftRightEdge + 12, 0);
407
- gradient.addColorStop(0, COLORS.shadow);
419
+ // ---- 固定列阴影(常显,antd 风格 inset 渐变)----
420
+ var drawFixedShadow = function (edgeX, dir) {
421
+ var gradient = ctx.createLinearGradient(edgeX, 0, edgeX + dir * 20, 0);
422
+ gradient.addColorStop(0, 'rgba(0, 0, 0, 0.08)');
408
423
  gradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
409
424
  ctx.fillStyle = gradient;
410
- ctx.fillRect(fixedLeftRightEdge, 0, 12, height);
411
- ctx.fillStyle = COLORS.fixedEdge;
412
- ctx.fillRect(fixedLeftRightEdge - 1, 0, 1, height);
425
+ ctx.fillRect(Math.min(edgeX, edgeX + dir * 20), 0, 20, height);
426
+ };
427
+ if (fixedLeftRightEdge > 0) {
428
+ drawFixedShadow(fixedLeftRightEdge, 1);
413
429
  }
414
- // 右固定区左缘阴影(横向滚动中)
415
- if (fixedRightZoneLeft !== Infinity && scrollLeft > 0) {
416
- var gradient = ctx.createLinearGradient(fixedRightZoneLeft, 0, fixedRightZoneLeft - 12, 0);
417
- gradient.addColorStop(0, COLORS.shadow);
418
- gradient.addColorStop(1, 'rgba(0, 0, 0, 0)');
419
- ctx.fillStyle = gradient;
420
- ctx.fillRect(fixedRightZoneLeft - 12, 0, 12, height);
421
- ctx.fillStyle = COLORS.fixedEdge;
422
- ctx.fillRect(fixedRightZoneLeft, 0, 1, height);
430
+ if (fixedRightZoneLeft !== Infinity) {
431
+ drawFixedShadow(fixedRightZoneLeft, -1);
432
+ }
433
+ // ---- 最外层边框(bordered)----
434
+ if (scene.bordered) {
435
+ ctx.strokeStyle = COLORS.border;
436
+ ctx.lineWidth = 1;
437
+ ctx.strokeRect(0.5, 0.5, width - 1, height - 1);
423
438
  }
424
439
  // 滚动条由 DOM 层渲染(支持显隐过渡动画),canvas 不再绘制
425
440
  }
@@ -1,4 +1,6 @@
1
1
  import { SortOrder } from '../interface';
2
+ /** radio 单选圈(对齐 antd Radio 视觉:圆圈 + 选中实心圆点) */
3
+ export declare function drawRadio(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, checked: boolean, disabled: boolean): void;
2
4
  export declare function drawCheckbox(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, checked: boolean, disabled: boolean, indeterminate?: boolean): void;
3
5
  export declare function drawSortIcon(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, order: SortOrder, hoverPart?: 'up' | 'down'): void;
4
6
  export declare function drawFilterIcon(ctx: CanvasRenderingContext2D, centerX: number, centerY: number, active: boolean): void;
@@ -1,4 +1,32 @@
1
1
  import { COLORS, CHECKBOX_SIZE, SORT_ICON_SIZE, ICON_SPACING, } from '../constants';
2
+ /** radio 单选圈(对齐 antd Radio 视觉:圆圈 + 选中实心圆点) */
3
+ export function drawRadio(ctx, centerX, centerY, checked, disabled) {
4
+ var size = CHECKBOX_SIZE;
5
+ var r = size / 2;
6
+ if (disabled) {
7
+ ctx.strokeStyle = COLORS.checkboxBorder;
8
+ ctx.fillStyle = checked ? '#f5f5f5' : COLORS.white;
9
+ }
10
+ else if (checked) {
11
+ ctx.strokeStyle = COLORS.primary;
12
+ ctx.fillStyle = COLORS.white;
13
+ }
14
+ else {
15
+ ctx.strokeStyle = COLORS.checkboxBorder;
16
+ ctx.fillStyle = COLORS.white;
17
+ }
18
+ ctx.lineWidth = 1;
19
+ ctx.beginPath();
20
+ ctx.arc(centerX, centerY, r, 0, Math.PI * 2);
21
+ ctx.fill();
22
+ ctx.stroke();
23
+ if (checked) {
24
+ ctx.fillStyle = disabled ? COLORS.checkboxBorder : COLORS.primary;
25
+ ctx.beginPath();
26
+ ctx.arc(centerX, centerY, r / 2, 0, Math.PI * 2);
27
+ ctx.fill();
28
+ }
29
+ }
2
30
  export function drawCheckbox(ctx, centerX, centerY, checked, disabled, indeterminate) {
3
31
  if (indeterminate === void 0) { indeterminate = false; }
4
32
  var size = CHECKBOX_SIZE;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import { IColumnType, ICellSelection, IBadgeProps, SortOrder } from '../interface';
2
+ import { IColumnType, ICellSelection, IBadgeProps, ICanvasAtom, SortOrder } from '../interface';
3
3
  import { ColumnLayout, ScrollbarMetrics } from '../utils/layout';
4
4
  import { HeaderCellInfo } from '../utils/multiHeader';
5
5
  import { MergeCellMap } from '../utils/merge';
6
6
  import { RowMetrics, createRowAccessor } from '../utils/rowHeights';
7
7
  import type { ISummaryData } from '../../Table/table-summary';
8
+ import { AtomsLayout } from '../utils/canvasAtom';
8
9
  import { FlatRowMeta } from '../hooks/useExpandable';
9
10
  export interface RenderCacheEntry {
10
11
  renderFn: IColumnType['render'];
@@ -12,7 +13,7 @@ export interface RenderCacheEntry {
12
13
  index: number;
13
14
  node: React.ReactNode;
14
15
  }
15
- export declare type CellKind = 'text' | 'overlay' | 'checkbox' | 'index' | 'empty';
16
+ export declare type CellKind = 'text' | 'overlay' | 'checkbox' | 'index' | 'atoms' | 'empty';
16
17
  export interface SceneCell {
17
18
  row: number;
18
19
  col: number;
@@ -30,6 +31,8 @@ export interface SceneCell {
30
31
  node?: React.ReactNode;
31
32
  /** checkbox 状态 */
32
33
  checked?: boolean;
34
+ /** radio 单选圈(rowSelection.type = radio 时勾选格绘制为圆圈) */
35
+ radio?: boolean;
33
36
  disabled?: boolean;
34
37
  indeterminate?: boolean;
35
38
  /** 表头功能图标(仅最末级表头) */
@@ -53,6 +56,13 @@ export interface SceneCell {
53
56
  wrap?: boolean;
54
57
  /** 合计行单元格点击回调(summaryConfig.onClickHandle) */
55
58
  summaryOnClick?: () => void;
59
+ /** renderToCanvas 协议内容(布局随列宽在场景构建时计算) */
60
+ atoms?: {
61
+ atoms: ICanvasAtom[];
62
+ layout: AtomsLayout;
63
+ record: any;
64
+ index: number;
65
+ };
56
66
  /** DOM 覆盖层的裁剪路径(overlayCells 计算时填充) */
57
67
  clipPath?: string;
58
68
  }
@@ -96,6 +106,14 @@ export interface Scene<RecordType = any> {
96
106
  summaryStartIndex: number | null;
97
107
  /** summaryConfig 生成的合计行元数据(与 summaryStartIndex 起的行一一对应) */
98
108
  summaryRows: ISummaryData[] | null;
109
+ /** 当前悬停的协议链接(hover 下划线) */
110
+ hoverAtom: {
111
+ row: number;
112
+ col: number;
113
+ index: number;
114
+ } | null;
115
+ /** 行选择模式 */
116
+ selectionType: 'checkbox' | 'radio';
99
117
  /** 数据总行数 */
100
118
  dataLength: number;
101
119
  mergeMap: MergeCellMap;
@@ -146,11 +164,19 @@ export interface BuildSceneParams<RecordType = any> {
146
164
  getCheckboxProps?: (record: RecordType) => {
147
165
  disabled?: boolean;
148
166
  };
167
+ /** 行选择模式 */
168
+ selectionType?: 'checkbox' | 'radio';
149
169
  summaryStartIndex: number | null;
150
170
  /** summaryConfig 生成的合计行元数据(与 summaryStartIndex 起的行一一对应) */
151
171
  summaryRows?: ISummaryData[] | null;
152
172
  /** render 结果缓存(index.tsx 持有,跨滚动帧复用 render 输出引用) */
153
173
  renderCache?: Map<string, RenderCacheEntry>;
174
+ /** 当前悬停的协议链接(hover 下划线用) */
175
+ hoverAtom?: {
176
+ row: number;
177
+ col: number;
178
+ index: number;
179
+ } | null;
154
180
  mergeMap: MergeCellMap;
155
181
  /** rowKey → 树形层级信息(按 key 映射,过滤/排序后依然稳定) */
156
182
  expandMetaByKey: Map<string, FlatRowMeta> | null;
@@ -4,7 +4,9 @@ import { createRowAccessor } from '../utils/rowHeights';
4
4
  import { isSummaryRow } from '../utils/summary';
5
5
  import { formatCellValue, formatSummaryValue } from '../utils/format';
6
6
  import { measureText } from '../utils/text';
7
- import { TEXT_PADDING, SCROLLBAR_SIZE } from '../constants';
7
+ import { layoutAtoms, ATOM_CELL_PADDING, } from '../utils/canvasAtom';
8
+ import { getCanvasCell } from '../utils/canvasCells';
9
+ import { TEXT_PADDING } from '../constants';
8
10
  /**
9
11
  * render 结果缓存:renderFn/record/index 全一致才复用。
10
12
  * 滚动帧拿到稳定引用,React 跳过内容子树 diff;业务更新 columns 或
@@ -47,7 +49,7 @@ function computeLayerHeight(headerHeight, maxDepth) {
47
49
  */
48
50
  export function buildScene(params) {
49
51
  var _a, _b, _c, _d;
50
- var dataSource = params.dataSource, layouts = params.layouts, headerRows = params.headerRows, getRowKey = params.getRowKey, containerWidth = params.containerWidth, containerHeight = params.containerHeight, headerHeight = params.headerHeight, rowHeight = params.rowHeight, scrollTop = params.scrollTop, scrollLeft = params.scrollLeft, hoverRow = params.hoverRow, sortField = params.sortField, sortOrder = params.sortOrder, filters = params.filters, selectedRowKeys = params.selectedRowKeys, striped = params.striped, bordered = params.bordered, cellSelection = params.cellSelection, resizeHoverIndex = params.resizeHoverIndex, resizeActiveIndex = params.resizeActiveIndex, getCheckboxProps = params.getCheckboxProps, summaryStartIndex = params.summaryStartIndex, _e = params.summaryRows, summaryRows = _e === void 0 ? null : _e, renderCache = params.renderCache, mergeMap = params.mergeMap, expandMetaByKey = params.expandMetaByKey, expandColumnLayoutIndex = params.expandColumnLayoutIndex, expandIndentColumnLayoutIndex = params.expandIndentColumnLayoutIndex, indentSize = params.indentSize, fixedTopRowsParam = params.fixedTopRows, fixedBottomRowsParam = params.fixedBottomRows, globalHeaderAlign = params.globalHeaderAlign, dynamicButtonColumnIndex = params.dynamicButtonColumnIndex, scrollbarVisible = params.scrollbarVisible, headerWrapParam = params.headerWrap, rowMetrics = params.rowMetrics;
52
+ var dataSource = params.dataSource, layouts = params.layouts, headerRows = params.headerRows, getRowKey = params.getRowKey, containerWidth = params.containerWidth, containerHeight = params.containerHeight, headerHeight = params.headerHeight, rowHeight = params.rowHeight, scrollTop = params.scrollTop, scrollLeft = params.scrollLeft, hoverRow = params.hoverRow, sortField = params.sortField, sortOrder = params.sortOrder, filters = params.filters, selectedRowKeys = params.selectedRowKeys, striped = params.striped, bordered = params.bordered, cellSelection = params.cellSelection, resizeHoverIndex = params.resizeHoverIndex, resizeActiveIndex = params.resizeActiveIndex, getCheckboxProps = params.getCheckboxProps, _e = params.selectionType, selectionType = _e === void 0 ? 'checkbox' : _e, summaryStartIndex = params.summaryStartIndex, _f = params.summaryRows, summaryRows = _f === void 0 ? null : _f, renderCache = params.renderCache, _g = params.hoverAtom, hoverAtom = _g === void 0 ? null : _g, mergeMap = params.mergeMap, expandMetaByKey = params.expandMetaByKey, expandColumnLayoutIndex = params.expandColumnLayoutIndex, expandIndentColumnLayoutIndex = params.expandIndentColumnLayoutIndex, indentSize = params.indentSize, fixedTopRowsParam = params.fixedTopRows, fixedBottomRowsParam = params.fixedBottomRows, globalHeaderAlign = params.globalHeaderAlign, dynamicButtonColumnIndex = params.dynamicButtonColumnIndex, scrollbarVisible = params.scrollbarVisible, headerWrapParam = params.headerWrap, rowMetrics = params.rowMetrics;
51
53
  var headerWrap = headerWrapParam;
52
54
  var maxDepth = Math.max(1, headerRows.length);
53
55
  var layerHeight = computeLayerHeight(headerHeight, maxDepth);
@@ -75,11 +77,11 @@ export function buildScene(params) {
75
77
  fixedBottomRows: fixedBottomRowsParam,
76
78
  });
77
79
  // 固定行几何:顶区 [header, header+top*rowH),底区 [height - hBar - bottom*rowH, height - hBar)
78
- var hScrollbarHeight = metrics.needH ? SCROLLBAR_SIZE : 0;
79
80
  var fixedTop = Math.min(fixedTopRowsParam, dataSource.length);
80
81
  var fixedBottom = Math.min(fixedBottomRowsParam, dataSource.length - fixedTop);
81
82
  var topAreaEnd = headerHeight + fixedTop * rowHeight;
82
- var bottomAreaTop = containerHeight - hScrollbarHeight - fixedBottom * rowHeight;
83
+ // 小计/合计行贴底,横向滚动条移至其上方
84
+ var bottomAreaTop = containerHeight - fixedBottom * rowHeight;
83
85
  /** 数据行视口 y;不可见(滚动区外)返回 null */
84
86
  var rowViewportY = function (row) {
85
87
  if (row < 0 || row >= dataSource.length)
@@ -127,8 +129,8 @@ export function buildScene(params) {
127
129
  var headerCells = [];
128
130
  for (var _i = 0, headerRows_1 = headerRows; _i < headerRows_1.length; _i++) {
129
131
  var headerRow = headerRows_1[_i];
130
- for (var _f = 0, headerRow_1 = headerRow; _f < headerRow_1.length; _f++) {
131
- var info = headerRow_1[_f];
132
+ for (var _h = 0, headerRow_1 = headerRow; _h < headerRow_1.length; _h++) {
133
+ var info = headerRow_1[_h];
132
134
  var column = info.column, colIndex = info.colIndex, colSpan = info.colSpan, rowSpan = info.rowSpan, depth = info.depth, isLeaf = info.isLeaf;
133
135
  var first = layouts[colIndex];
134
136
  if (!first)
@@ -165,7 +167,11 @@ export function buildScene(params) {
165
167
  y: depth * layerHeight,
166
168
  width: width,
167
169
  height: rowSpan * layerHeight,
168
- kind: isSelection ? 'checkbox' : 'text',
170
+ kind: isSelection && selectionType === 'radio'
171
+ ? 'empty'
172
+ : isSelection
173
+ ? 'checkbox'
174
+ : 'text',
169
175
  align: 'center',
170
176
  headerAlign: headerAlign,
171
177
  checked: false,
@@ -174,7 +180,7 @@ export function buildScene(params) {
174
180
  !isSelection &&
175
181
  !isIndex &&
176
182
  !isDynamicButton &&
177
- !!column.sorter,
183
+ column.sorter !== false,
178
184
  hasFilter: isLeaf && !isSelection && !isIndex && !isDynamicButton,
179
185
  sortState: column.key === sortField ? sortOrder : null,
180
186
  filterActive: !!(filters[column.key] && filters[column.key].length > 0),
@@ -196,8 +202,8 @@ export function buildScene(params) {
196
202
  var dataCells = [];
197
203
  var visibleData = [];
198
204
  var firstRegularLeafIndex = -1;
199
- for (var _g = 0, layouts_1 = layouts; _g < layouts_1.length; _g++) {
200
- var layout = layouts_1[_g];
205
+ for (var _j = 0, layouts_1 = layouts; _j < layouts_1.length; _j++) {
206
+ var layout = layouts_1[_j];
201
207
  if (layout.column.key !== SPECIAL_KEYS.selection &&
202
208
  layout.column.key !== SPECIAL_KEYS.index) {
203
209
  firstRegularLeafIndex = layout.index;
@@ -216,8 +222,8 @@ export function buildScene(params) {
216
222
  to: dataSource.length,
217
223
  });
218
224
  }
219
- for (var _h = 0, rowSegments_1 = rowSegments; _h < rowSegments_1.length; _h++) {
220
- var segment = rowSegments_1[_h];
225
+ for (var _k = 0, rowSegments_1 = rowSegments; _k < rowSegments_1.length; _k++) {
226
+ var segment = rowSegments_1[_k];
221
227
  for (var rowIndex = segment.from; rowIndex < segment.to; rowIndex++) {
222
228
  var record = dataSource[rowIndex];
223
229
  if (!record)
@@ -314,10 +320,56 @@ export function buildScene(params) {
314
320
  else if (isSelection) {
315
321
  cell.checked = selectedKeys.has(key);
316
322
  cell.disabled = !!((_d = getCheckboxProps === null || getCheckboxProps === void 0 ? void 0 : getCheckboxProps(record)) === null || _d === void 0 ? void 0 : _d.disabled);
323
+ cell.radio = selectionType === 'radio';
317
324
  }
318
325
  else if (isIndex) {
319
326
  cell.text = String(rowIndex + 1);
320
327
  }
328
+ else if (column.renderToCanvas) {
329
+ try {
330
+ var atoms = column.renderToCanvas({ value: value, record: record, index: rowIndex }) || [];
331
+ var atomsLayout = layoutAtoms(atoms, layout.width - ATOM_CELL_PADDING * 2);
332
+ cell.kind = 'atoms';
333
+ cell.atoms = {
334
+ atoms: atoms,
335
+ layout: atomsLayout,
336
+ record: record,
337
+ index: rowIndex,
338
+ };
339
+ }
340
+ catch (e) {
341
+ cell.kind = 'empty';
342
+ }
343
+ }
344
+ else if (column.cell) {
345
+ var cellFn = getCanvasCell(column.cell.type);
346
+ if (cellFn) {
347
+ try {
348
+ var atoms = cellFn({
349
+ value: value,
350
+ record: record,
351
+ index: rowIndex,
352
+ column: column,
353
+ cell: column.cell,
354
+ }) || [];
355
+ var atomsLayout = layoutAtoms(atoms, layout.width - ATOM_CELL_PADDING * 2);
356
+ cell.kind = 'atoms';
357
+ cell.atoms = {
358
+ atoms: atoms,
359
+ layout: atomsLayout,
360
+ record: record,
361
+ index: rowIndex,
362
+ };
363
+ }
364
+ catch (e) {
365
+ cell.kind = 'empty';
366
+ }
367
+ }
368
+ else {
369
+ // cell.type 未注册:回退普通文本列
370
+ cell.text = formatCellValue(value, column);
371
+ }
372
+ }
321
373
  else if (column.render) {
322
374
  var rendered = resolveRendered(renderCache, column, value, record, rowIndex, key + '|' + column.key);
323
375
  if (typeof rendered === 'string' || typeof rendered === 'number') {
@@ -375,8 +427,8 @@ export function buildScene(params) {
375
427
  }
376
428
  dataCells.push(cell);
377
429
  };
378
- for (var _j = 0, layouts_2 = layouts; _j < layouts_2.length; _j++) {
379
- var layout = layouts_2[_j];
430
+ for (var _l = 0, layouts_2 = layouts; _l < layouts_2.length; _l++) {
431
+ var layout = layouts_2[_l];
380
432
  _loop_1(layout);
381
433
  }
382
434
  }
@@ -407,6 +459,8 @@ export function buildScene(params) {
407
459
  resizeActiveIndex: resizeActiveIndex,
408
460
  summaryStartIndex: summaryStartIndex,
409
461
  summaryRows: summaryRows,
462
+ hoverAtom: hoverAtom,
463
+ selectionType: selectionType,
410
464
  dataLength: dataSource.length,
411
465
  mergeMap: mergeMap,
412
466
  expandMetaByKey: expandMetaByKey,
@@ -1,6 +1,22 @@
1
1
  import { useCallback, useEffect } from 'react';
2
2
  import { formatCellValue } from '../utils/format';
3
3
  function extractText(column, record, index) {
4
+ if (column.renderToCanvas) {
5
+ try {
6
+ var atoms = column.renderToCanvas({
7
+ value: record[column.dataIndex || column.key],
8
+ record: record,
9
+ index: index,
10
+ }) || [];
11
+ return atoms
12
+ .map(function (a) { return a.text || ''; })
13
+ .filter(Boolean)
14
+ .join(' ');
15
+ }
16
+ catch (e) {
17
+ return '';
18
+ }
19
+ }
4
20
  if (!record)
5
21
  return '';
6
22
  var dataIndex = column.dataIndex || column.key;
@@ -31,6 +31,19 @@ export declare function useInteractions<T = any>(params: {
31
31
  left: number;
32
32
  top: number;
33
33
  }) => void;
34
+ /** renderToCanvas 链接 hover(下划线重绘) */
35
+ setHoverAtom: (a: {
36
+ row: number;
37
+ col: number;
38
+ index: number;
39
+ } | null) => void;
40
+ hoverAtomRef: React.MutableRefObject<{
41
+ row: number;
42
+ col: number;
43
+ index: number;
44
+ } | null>;
45
+ /** 非受控模式的内部勾选 keys(rowSelection 未传 selectedRowKeys 时以它为准) */
46
+ internalKeysRef: React.MutableRefObject<React.Key[]>;
34
47
  setHoverRow: (row: number | null) => void;
35
48
  setTooltip: (tip: {
36
49
  visible: boolean;