arthub-table 0.1.0-beta.2 → 0.1.0-beta.21
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.
- package/dist/arthub-table.common.js +1 -1
- package/dist/arthub-table.common.js.map +1 -1
- package/dist/arthub-table.umd.js +1 -1
- package/dist/arthub-table.umd.js.map +1 -1
- package/dist/arthub-table.umd.min.js +1 -1
- package/dist/arthub-table.umd.min.js.map +1 -1
- package/dist/types/adapters/DataGridIntegration.d.ts +128 -0
- package/dist/types/adapters/index.d.ts +2 -2
- package/dist/types/adapters/rowDataAdapter.d.ts +80 -47
- package/dist/types/adapters/styleAdapter.d.ts +2 -0
- package/dist/types/assets/icon/defaultAvatar.d.ts +1 -1
- package/dist/types/core/Body.d.ts +7 -1
- package/dist/types/core/Cell.d.ts +16 -3
- package/dist/types/core/ColumnHeader.d.ts +16 -0
- package/dist/types/core/DataGrid.d.ts +325 -3
- package/dist/types/core/Footer.d.ts +29 -2
- package/dist/types/core/GroupRow.d.ts +83 -12
- package/dist/types/core/Header.d.ts +9 -0
- package/dist/types/core/ImageManager.d.ts +23 -0
- package/dist/types/core/NestedGrid.d.ts +21 -0
- package/dist/types/core/Paint.d.ts +26 -0
- package/dist/types/core/Row.d.ts +2 -2
- package/dist/types/core/RowHeader.d.ts +37 -0
- package/dist/types/core/StyleManager.d.ts +20 -0
- package/dist/types/core/constants.d.ts +3 -2
- package/dist/types/core/types.d.ts +83 -3
- package/dist/types/core/viewers/BooleanViewer.d.ts +1 -0
- package/dist/types/core/viewers/FileViewer.d.ts +1 -0
- package/dist/types/core/viewers/GroupNameViewer.d.ts +56 -0
- package/dist/types/core/viewers/PersonViewer.d.ts +6 -0
- package/dist/types/core/viewers/PriorityTextViewer.d.ts +0 -4
- package/dist/types/core/viewers/TaskNodeViewer.d.ts +5 -1
- package/dist/types/core/viewers/TextViewerWithSwitcher.d.ts +15 -1
- package/dist/types/core/viewers/index.d.ts +3 -3
- package/dist/types/core/viewers/types.d.ts +83 -1
- package/dist/types/index.d.ts +4 -4
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ import Histories from "./History";
|
|
|
12
12
|
import { StyleManager, type TableTheme } from "./StyleManager";
|
|
13
13
|
import EdgeScroller from "./EdgeScroller";
|
|
14
14
|
import { type HeaderConfig } from "./util";
|
|
15
|
-
import { type FooterCellClickInfo, type FooterData, type FooterCellData, type GroupHeaderCellClickInfo } from "./types";
|
|
15
|
+
import { type FooterCellClickInfo, type FooterData, type FooterCellData, type GroupHeaderCellClickInfo, type FooterStatRefreshInfo, type GroupHeaderStatRefreshInfo } from "./types";
|
|
16
16
|
import { type PerformanceMonitor } from "./PerformanceMonitor";
|
|
17
17
|
interface Column extends HeaderConfig {
|
|
18
18
|
children?: Column[];
|
|
@@ -60,6 +60,10 @@ interface RowDragState {
|
|
|
60
60
|
isCtrlPressed: boolean;
|
|
61
61
|
isShiftPressed: boolean;
|
|
62
62
|
skipNextClick: boolean;
|
|
63
|
+
pendingCheckedRowDrag: boolean;
|
|
64
|
+
/** 当前鼠标位置(用于绘制拖拽幽灵元素) */
|
|
65
|
+
mouseX: number;
|
|
66
|
+
mouseY: number;
|
|
63
67
|
}
|
|
64
68
|
interface ColDragState {
|
|
65
69
|
isDragging: boolean;
|
|
@@ -132,6 +136,11 @@ export interface DataGridOptions {
|
|
|
132
136
|
borderWidth?: number;
|
|
133
137
|
showCheckbox?: boolean;
|
|
134
138
|
showTableIndex?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* 是否在表头左上角显示全选 checkbox
|
|
141
|
+
* 默认 false(不显示),设为 true 时表头左上角显示全选/半选 checkbox
|
|
142
|
+
*/
|
|
143
|
+
showHeaderCheckbox?: boolean;
|
|
135
144
|
/**
|
|
136
145
|
* 索引列模式:
|
|
137
146
|
* - 'auto':自动模式,行号 = rowIndex + 1(默认)
|
|
@@ -247,6 +256,49 @@ export interface DataGridOptions {
|
|
|
247
256
|
endRow: number;
|
|
248
257
|
endCol: number;
|
|
249
258
|
};
|
|
259
|
+
/** NestedGrid 实际渲染的数据数组(行索引与 autofillRange 完全一致) */
|
|
260
|
+
nestedGridData: any[];
|
|
261
|
+
}) => void;
|
|
262
|
+
/** 嵌套子表框选变化回调:选区跨子表或单子表变化时触发 */
|
|
263
|
+
onNestedSelectionChange?: (params: {
|
|
264
|
+
parentColKey: string;
|
|
265
|
+
selections: Array<{
|
|
266
|
+
parentRowData: any;
|
|
267
|
+
parentRowIndex: number;
|
|
268
|
+
parentColIndex: number;
|
|
269
|
+
selectionRange: {
|
|
270
|
+
startRow: number;
|
|
271
|
+
startCol: number;
|
|
272
|
+
endRow: number;
|
|
273
|
+
endCol: number;
|
|
274
|
+
};
|
|
275
|
+
}>;
|
|
276
|
+
}) => void;
|
|
277
|
+
/** 嵌套子表跨子表 autofill 结束回调 */
|
|
278
|
+
onNestedCrossAutofillEnd?: (params: {
|
|
279
|
+
parentColKey: string;
|
|
280
|
+
sourceSelections: Array<{
|
|
281
|
+
parentRowData: any;
|
|
282
|
+
parentRowIndex: number;
|
|
283
|
+
selectionRange: {
|
|
284
|
+
startRow: number;
|
|
285
|
+
startCol: number;
|
|
286
|
+
endRow: number;
|
|
287
|
+
endCol: number;
|
|
288
|
+
};
|
|
289
|
+
}>;
|
|
290
|
+
targetSelections: Array<{
|
|
291
|
+
parentRowData: any;
|
|
292
|
+
parentRowIndex: number;
|
|
293
|
+
autofillRange: {
|
|
294
|
+
startRow: number;
|
|
295
|
+
startCol: number;
|
|
296
|
+
endRow: number;
|
|
297
|
+
endCol: number;
|
|
298
|
+
};
|
|
299
|
+
/** NestedGrid 实际渲染的数据数组(行索引与 autofillRange 完全一致) */
|
|
300
|
+
nestedGridData: any[];
|
|
301
|
+
}>;
|
|
250
302
|
}) => void;
|
|
251
303
|
beforeCopy?: () => void;
|
|
252
304
|
afterCopy?: () => void;
|
|
@@ -264,8 +316,32 @@ export interface DataGridOptions {
|
|
|
264
316
|
* 默认 'controlled'
|
|
265
317
|
*/
|
|
266
318
|
groupToggleMode?: 'controlled' | 'uncontrolled';
|
|
319
|
+
/**
|
|
320
|
+
* 分组维度数(由外部传入,优先级高于行数据遍历推断)。
|
|
321
|
+
* - 0 = 无分组
|
|
322
|
+
* - 1 = 一维分组
|
|
323
|
+
* - 2 = 二维分组
|
|
324
|
+
* - 3 = 三维分组
|
|
325
|
+
* 未传入时退化为遍历行数据推断(旧逻辑)。
|
|
326
|
+
*/
|
|
327
|
+
groupDimension?: number;
|
|
267
328
|
/** 是否启用内置键盘快捷键(默认 false) */
|
|
268
329
|
enableKeyboardShortcuts?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Whether to disable DataGrid's built-in "click outside to close editing" behavior.
|
|
332
|
+
*
|
|
333
|
+
* When true, handleDocumentMouseDown will NOT execute:
|
|
334
|
+
* - doneEdit() (close internal editor)
|
|
335
|
+
* - clearSelectedCols() (clear column selection)
|
|
336
|
+
* - clearCellSelection() (clear cell selection)
|
|
337
|
+
* - afterSelectCell(null) (notify external to close editor panel)
|
|
338
|
+
*
|
|
339
|
+
* Use this when the host application (e.g. AssetMatrix) manages "click outside"
|
|
340
|
+
* via its own mechanism (e.g. v-click-outside) with finer-grained exclusion logic.
|
|
341
|
+
*
|
|
342
|
+
* Default: false (preserves existing behavior for backward compatibility).
|
|
343
|
+
*/
|
|
344
|
+
disableClickOutside?: boolean;
|
|
269
345
|
onTreeExpand?: (rowData: RowData, expanded: boolean) => void;
|
|
270
346
|
onCellTextClick?: (rowData: RowData, colId: string) => void;
|
|
271
347
|
onCellTotalNumClick?: (rowData: RowData, colId: string) => void;
|
|
@@ -323,12 +399,20 @@ export interface DataGridOptions {
|
|
|
323
399
|
debug?: boolean;
|
|
324
400
|
/** WfState Viewer 显示样式:'icon'=图标+文字(默认),'tag'=色块标签 */
|
|
325
401
|
wfStateStyle?: 'icon' | 'tag';
|
|
402
|
+
/** 列总宽小于表格可视区域宽度时,是否将剩余空间均分到每列(默认 false) */
|
|
403
|
+
autoFillTableWidth?: boolean;
|
|
326
404
|
/** 是否显示底部统计行 */
|
|
327
405
|
showFooter?: boolean;
|
|
406
|
+
/** 底部统计行高度(默认 FOOTER_HEIGHT = 36) */
|
|
407
|
+
footerHeight?: number;
|
|
328
408
|
/** Footer 单元格点击回调 */
|
|
329
409
|
onFooterCellClick?: (info: FooterCellClickInfo) => void;
|
|
330
410
|
/** 组头单元格点击回调 */
|
|
331
411
|
onGroupHeaderCellClick?: (info: GroupHeaderCellClickInfo) => void;
|
|
412
|
+
/** Footer 嵌套列统计刷新回调 */
|
|
413
|
+
onFooterStatRefresh?: (info: FooterStatRefreshInfo) => void;
|
|
414
|
+
/** 组头嵌套列统计刷新回调 */
|
|
415
|
+
onGroupHeaderStatRefresh?: (info: GroupHeaderStatRefreshInfo) => void;
|
|
332
416
|
/** Viewer 编辑图标点击回调(拦截内置编辑器,由外部处理编辑) */
|
|
333
417
|
onEditIconClick?: (info: {
|
|
334
418
|
rowData: RowData;
|
|
@@ -410,6 +494,24 @@ export interface DataGridOptions {
|
|
|
410
494
|
isNestedChild: boolean;
|
|
411
495
|
nestedChildOffset: number;
|
|
412
496
|
}) => void;
|
|
497
|
+
/** Cell hover 变化回调:当 hover 的单元格变化时通知外部(用于时间型字段 tooltip / 历史变更等) */
|
|
498
|
+
onCellHoverChange?: (info: {
|
|
499
|
+
show: boolean;
|
|
500
|
+
rowIndex: number;
|
|
501
|
+
colIndex: number;
|
|
502
|
+
colKey: string;
|
|
503
|
+
rowData: Record<string, any>;
|
|
504
|
+
position: {
|
|
505
|
+
x: number;
|
|
506
|
+
y: number;
|
|
507
|
+
width: number;
|
|
508
|
+
height: number;
|
|
509
|
+
};
|
|
510
|
+
canvasElement: HTMLCanvasElement;
|
|
511
|
+
displayText: string;
|
|
512
|
+
mouseX: number;
|
|
513
|
+
mouseY: number;
|
|
514
|
+
}) => void;
|
|
413
515
|
/** Error icon hover 回调:当鼠标悬停在 warning icon 上时触发(用于外部 AlarmPopper) */
|
|
414
516
|
onErrorIconHover?: (info: {
|
|
415
517
|
show: boolean;
|
|
@@ -474,6 +576,48 @@ export interface DataGridOptions {
|
|
|
474
576
|
onBeforeRowRender?: (rowIndex: number, rowData: RowData) => void;
|
|
475
577
|
/** 嵌套表格渲染前回调:每个嵌套表格格子绘制前触发,用于分组表格管线列渐进式加载 */
|
|
476
578
|
onBeforeNestedGridRender?: (rowIndex: number, rowData: RowData, colKey: string) => void;
|
|
579
|
+
/**
|
|
580
|
+
* 嵌套子表数据比对 key 列表(性能优化)。
|
|
581
|
+
* 在 loadData/refreshDataGrid 时,通过比较新旧嵌套数据中这些 key 的值来判断数据是否变化。
|
|
582
|
+
* 如果未变化,则复用旧的 NestedGrid 实例,跳过重建。
|
|
583
|
+
* 默认 ['id']——只比较子行 id 列表。
|
|
584
|
+
*
|
|
585
|
+
* 对应 DOM 版本的 REFRESH_TABLE_COMPARE_KEYS。
|
|
586
|
+
*/
|
|
587
|
+
nestedDataCompareKeys?: string[];
|
|
588
|
+
/**
|
|
589
|
+
* 嵌套子表强制刷新 key 列表(性能优化)。
|
|
590
|
+
* 当新嵌套数据中任意一行包含这些 key 且有值时,跳过数据比对,强制重建 NestedGrid。
|
|
591
|
+
* 默认 [](不强制刷新)。
|
|
592
|
+
*
|
|
593
|
+
* 对应 DOM 版本的 FORCE_REFRESH_KEYS。
|
|
594
|
+
*/
|
|
595
|
+
nestedForceRefreshKeys?: string[];
|
|
596
|
+
/** 普通行 checkbox 变更回调(受控模式下通知外部更新选中行列表) */
|
|
597
|
+
onRowCheckChange?: (info: {
|
|
598
|
+
rowId: string;
|
|
599
|
+
checked: boolean;
|
|
600
|
+
rowData: any;
|
|
601
|
+
selectedRowIds: string[];
|
|
602
|
+
event?: MouseEvent;
|
|
603
|
+
}) => void;
|
|
604
|
+
/** 组头 checkbox 变更回调(受控模式下通知外部更新组头选中状态) */
|
|
605
|
+
onGroupCheckboxChange?: (info: {
|
|
606
|
+
groupId: string | number;
|
|
607
|
+
checked: boolean;
|
|
608
|
+
data: any;
|
|
609
|
+
selectedRowIds: string[];
|
|
610
|
+
}) => void;
|
|
611
|
+
/**
|
|
612
|
+
* Cell value transformer callback.
|
|
613
|
+
* Called by Cell.drawWithViewer() before passing data to viewer.draw().
|
|
614
|
+
* Transforms raw cell values to display values (e.g. treeDropdown ID → display name + color).
|
|
615
|
+
* Return undefined to keep the original value.
|
|
616
|
+
*
|
|
617
|
+
* TODO: Migrate other viewer types (person, module, wf-state, task-node, dropdown, etc.)
|
|
618
|
+
* from transformCellValues to this callback for full decoupling.
|
|
619
|
+
*/
|
|
620
|
+
cellValueTransformer?: import('./viewers/types').CellValueTransformer;
|
|
477
621
|
}
|
|
478
622
|
declare class DataGrid {
|
|
479
623
|
target: HTMLCanvasElement;
|
|
@@ -519,6 +663,8 @@ declare class DataGrid {
|
|
|
519
663
|
borderWidth: number;
|
|
520
664
|
showCheckbox: boolean;
|
|
521
665
|
showTableIndex: boolean;
|
|
666
|
+
/** 是否在表头左上角显示全选 checkbox,默认 false */
|
|
667
|
+
showHeaderCheckbox: boolean;
|
|
522
668
|
/** 索引列模式:'auto' = rowIndex+1,'data' = 从行数据 _tableIndex 读取 */
|
|
523
669
|
tableIndexMode: 'auto' | 'data';
|
|
524
670
|
headerHeight: number;
|
|
@@ -567,6 +713,8 @@ declare class DataGrid {
|
|
|
567
713
|
onNestedAutofillStart?: DataGridOptions['onNestedAutofillStart'];
|
|
568
714
|
onNestedAutofillDragging?: DataGridOptions['onNestedAutofillDragging'];
|
|
569
715
|
onNestedAutofillEnd?: DataGridOptions['onNestedAutofillEnd'];
|
|
716
|
+
onNestedSelectionChange?: DataGridOptions['onNestedSelectionChange'];
|
|
717
|
+
onNestedCrossAutofillEnd?: DataGridOptions['onNestedCrossAutofillEnd'];
|
|
570
718
|
beforeCopy: () => void;
|
|
571
719
|
afterCopy: () => void;
|
|
572
720
|
beforePaste: () => void;
|
|
@@ -580,8 +728,13 @@ declare class DataGrid {
|
|
|
580
728
|
groupToggleMode: 'controlled' | 'uncontrolled';
|
|
581
729
|
/** 是否启用内置键盘快捷键 */
|
|
582
730
|
enableKeyboardShortcuts: boolean;
|
|
731
|
+
/** Whether to disable built-in "click outside to close editing" behavior */
|
|
732
|
+
disableClickOutside: boolean;
|
|
583
733
|
/** 非受控模式下的完整数据(包含所有分组的子行) */
|
|
584
734
|
private _fullData;
|
|
735
|
+
/** 双缓冲:离屏 canvas(避免每帧创建,懒初始化 + 复用) */
|
|
736
|
+
private _offscreenCanvas;
|
|
737
|
+
private _offscreenCtx;
|
|
585
738
|
onTreeExpand?: (rowData: RowData, expanded: boolean) => void;
|
|
586
739
|
onCellTextClick?: (rowData: RowData, colId: string) => void;
|
|
587
740
|
onCellTotalNumClick?: (rowData: RowData, colId: string) => void;
|
|
@@ -608,9 +761,27 @@ declare class DataGrid {
|
|
|
608
761
|
onScrollEnd?: () => void;
|
|
609
762
|
private scrollEndTimer;
|
|
610
763
|
private wasScrolling;
|
|
764
|
+
/** 列总宽小于表格可视区域宽度时,是否将剩余空间均分到每列(默认 false) */
|
|
765
|
+
autoFillTableWidth: boolean;
|
|
611
766
|
showFooter: boolean;
|
|
767
|
+
/** 用户自定义的 footer 行高度(默认 FOOTER_HEIGHT) */
|
|
768
|
+
_footerHeight: number;
|
|
612
769
|
onFooterCellClick?: (info: FooterCellClickInfo) => void;
|
|
613
770
|
onGroupHeaderCellClick?: (info: GroupHeaderCellClickInfo) => void;
|
|
771
|
+
onFooterStatRefresh?: (info: FooterStatRefreshInfo) => void;
|
|
772
|
+
onGroupHeaderStatRefresh?: (info: GroupHeaderStatRefreshInfo) => void;
|
|
773
|
+
/** Footer 弹窗激活的列标识 key(弹窗打开时设置,关闭时清除),保持该列的下拉箭头和刷新图标始终显示 */
|
|
774
|
+
footerPopoverActiveKey: string | null;
|
|
775
|
+
/** 组头弹窗激活的列标识 key(弹窗打开时设置,关闭时清除) */
|
|
776
|
+
groupHeaderPopoverActiveKey: string | null;
|
|
777
|
+
/** 普通行 checkbox 变更回调(受控模式) */
|
|
778
|
+
onRowCheckChange?: (info: {
|
|
779
|
+
rowId: string;
|
|
780
|
+
checked: boolean;
|
|
781
|
+
rowData: any;
|
|
782
|
+
selectedRowIds: string[];
|
|
783
|
+
event?: MouseEvent;
|
|
784
|
+
}) => void;
|
|
614
785
|
/** 组头 checkbox 变更回调(校验勾选) */
|
|
615
786
|
onGroupCheckboxChange?: (info: {
|
|
616
787
|
groupId: string | number;
|
|
@@ -653,11 +824,19 @@ declare class DataGrid {
|
|
|
653
824
|
onBeforeRowRender?: (rowIndex: number, rowData: RowData) => void;
|
|
654
825
|
/** 嵌套表格渲染前回调:每个嵌套表格格子绘制前触发,用于分组表格管线列渐进式加载 */
|
|
655
826
|
onBeforeNestedGridRender?: (rowIndex: number, rowData: RowData, colKey: string) => void;
|
|
827
|
+
/** Cell value transformer (see DataGridOptions.cellValueTransformer) */
|
|
828
|
+
cellValueTransformer?: import('./viewers/types').CellValueTransformer;
|
|
829
|
+
nestedDataCompareKeys: string[];
|
|
830
|
+
nestedForceRefreshKeys: string[];
|
|
656
831
|
range: RangeState;
|
|
657
832
|
columns: HeaderConfig[];
|
|
658
833
|
headers: HeaderConfig[];
|
|
659
834
|
columnsLength: number;
|
|
660
835
|
originFixedWidth: number;
|
|
836
|
+
/** Maximum group level in current data (-1=no groups, 0=1D, 1=2D, 2+=3D) */
|
|
837
|
+
maxGroupLevel: number;
|
|
838
|
+
/** Whether groupDimension was explicitly set from outside (disables auto-detection) */
|
|
839
|
+
private _groupDimensionFromOption;
|
|
661
840
|
containerOriginX: number;
|
|
662
841
|
containerOriginY: number;
|
|
663
842
|
width: number;
|
|
@@ -680,8 +859,15 @@ declare class DataGrid {
|
|
|
680
859
|
private loadingRotation;
|
|
681
860
|
private loadingImage;
|
|
682
861
|
private loadingAnimationId;
|
|
862
|
+
/** Footer/GroupRow 嵌套列刷新图标(预加载 SVG) */
|
|
863
|
+
private refreshIcon;
|
|
864
|
+
/** Footer/GroupRow loading 计数器(用于控制 loading 动画的启停) */
|
|
865
|
+
private footerLoadingCount;
|
|
683
866
|
colResizeIndicatorX: number;
|
|
684
867
|
private columnHighlightMap;
|
|
868
|
+
private headerTextColorMap;
|
|
869
|
+
private sortOrderMap;
|
|
870
|
+
private sortOrderCount;
|
|
685
871
|
private _searchMatchColors;
|
|
686
872
|
hoveredHeaderColId: string | null;
|
|
687
873
|
onHeaderSortClick?: (info: {
|
|
@@ -705,6 +891,23 @@ declare class DataGrid {
|
|
|
705
891
|
clientX: number;
|
|
706
892
|
clientY: number;
|
|
707
893
|
}) => void;
|
|
894
|
+
onCellHoverChange?: (info: {
|
|
895
|
+
show: boolean;
|
|
896
|
+
rowIndex: number;
|
|
897
|
+
colIndex: number;
|
|
898
|
+
colKey: string;
|
|
899
|
+
rowData: Record<string, any>;
|
|
900
|
+
position: {
|
|
901
|
+
x: number;
|
|
902
|
+
y: number;
|
|
903
|
+
width: number;
|
|
904
|
+
height: number;
|
|
905
|
+
};
|
|
906
|
+
canvasElement: HTMLCanvasElement;
|
|
907
|
+
displayText: string;
|
|
908
|
+
mouseX: number;
|
|
909
|
+
mouseY: number;
|
|
910
|
+
}) => void;
|
|
708
911
|
onErrorIconHover?: (info: {
|
|
709
912
|
show: boolean;
|
|
710
913
|
position: {
|
|
@@ -820,6 +1023,12 @@ declare class DataGrid {
|
|
|
820
1023
|
* 列总宽小于可视区域宽度时,需要补齐
|
|
821
1024
|
*/
|
|
822
1025
|
fillTableWidth(): void;
|
|
1026
|
+
/**
|
|
1027
|
+
* Clamp scrollX/scrollY to valid bounds after layout changes (column add/remove, resize, etc.).
|
|
1028
|
+
* Prevents white gaps when total content size shrinks below the current scroll offset.
|
|
1029
|
+
* Also updates scrollbar thumb positions.
|
|
1030
|
+
*/
|
|
1031
|
+
clampScrollPosition(): void;
|
|
823
1032
|
resize(): void;
|
|
824
1033
|
/**
|
|
825
1034
|
* Restore all column widths (leaf and nested children) to their saved base values.
|
|
@@ -837,6 +1046,7 @@ declare class DataGrid {
|
|
|
837
1046
|
* Shared by row-header drag-select and edge-scroll callback.
|
|
838
1047
|
*/
|
|
839
1048
|
selectRowRange(startIndex: number, endIndex: number): void;
|
|
1049
|
+
private _nestedDebugLogged;
|
|
840
1050
|
selectCell({ colIndex, rowIndex }: {
|
|
841
1051
|
colIndex: number;
|
|
842
1052
|
rowIndex: number;
|
|
@@ -883,6 +1093,15 @@ declare class DataGrid {
|
|
|
883
1093
|
* 清除列选中状态
|
|
884
1094
|
*/
|
|
885
1095
|
clearSelectedCols(): void;
|
|
1096
|
+
/**
|
|
1097
|
+
* Clear all row selection (checkbox) state.
|
|
1098
|
+
* Clears selectedRowIds, unchecks all rows, syncs group headers, and updates header indeterminate.
|
|
1099
|
+
*/
|
|
1100
|
+
clearRowSelection(): void;
|
|
1101
|
+
/**
|
|
1102
|
+
* Clear cell/multi-cell selection state (selector highlight and focus cell).
|
|
1103
|
+
*/
|
|
1104
|
+
clearCellSelection(): void;
|
|
886
1105
|
/**
|
|
887
1106
|
* 判断列是否被选中(通过uniqueColKey判断,不随列排序变化)
|
|
888
1107
|
*/
|
|
@@ -955,7 +1174,10 @@ declare class DataGrid {
|
|
|
955
1174
|
drawContainer(): void;
|
|
956
1175
|
draw(): void;
|
|
957
1176
|
/**
|
|
958
|
-
*
|
|
1177
|
+
* 绘制嵌套列的彩色垂直边框。
|
|
1178
|
+
* 在数据行(Row)、组头行(GroupRow)、加号行(AddTaskRow)和分隔行(SeparateRow)的 Y 范围内绘制。
|
|
1179
|
+
* 相邻行的范围会合并,确保竖线连续不断裂。
|
|
1180
|
+
* clip 到非冻结列区域,避免穿透到冻结列。
|
|
959
1181
|
*/
|
|
960
1182
|
drawNestedColumnBorders(): void;
|
|
961
1183
|
/**
|
|
@@ -982,7 +1204,19 @@ declare class DataGrid {
|
|
|
982
1204
|
refreshSelectorFromSelectedCols(): void;
|
|
983
1205
|
loadData(data: RowData[], options?: {
|
|
984
1206
|
preserveSelection?: boolean;
|
|
1207
|
+
groupDimension?: number;
|
|
985
1208
|
}): void;
|
|
1209
|
+
/**
|
|
1210
|
+
* 动态更新分组维度并触发完整重绘。
|
|
1211
|
+
*
|
|
1212
|
+
* 当外部分组方式变化(如从二维切到三维)时调用此方法,
|
|
1213
|
+
* 会更新 maxGroupLevel、originFixedWidth,清空行缓存,
|
|
1214
|
+
* 重建表头和表格尺寸,确保所有行(组头、数据行、+号行、分割行)
|
|
1215
|
+
* 都使用新的分组维度样式重新绘制。
|
|
1216
|
+
*
|
|
1217
|
+
* @param dimension - 分组维度数(0=无分组, 1=一维, 2=二维, 3=三维)
|
|
1218
|
+
*/
|
|
1219
|
+
setGroupDimension(dimension: number, skipRepaint?: boolean): void;
|
|
986
1220
|
/**
|
|
987
1221
|
* 增量刷新指定列的数据(不重建整张表)
|
|
988
1222
|
*
|
|
@@ -1142,6 +1376,16 @@ declare class DataGrid {
|
|
|
1142
1376
|
maxScrollX: number;
|
|
1143
1377
|
maxScrollY: number;
|
|
1144
1378
|
};
|
|
1379
|
+
/**
|
|
1380
|
+
* 滚动到最右边(水平方向)
|
|
1381
|
+
*/
|
|
1382
|
+
scrollToRight(): void;
|
|
1383
|
+
/**
|
|
1384
|
+
* 滚动到指定水平位置(使 left 位置出现在视口右边缘)
|
|
1385
|
+
* 与 DOM 版本 fattable.scrollLeftTo(left) 语义一致:scrollLeft = left - clientWidth
|
|
1386
|
+
* @param left 目标位置(正值,单位 px)
|
|
1387
|
+
*/
|
|
1388
|
+
scrollLeftTo(left: number): void;
|
|
1145
1389
|
/**
|
|
1146
1390
|
* 判断指定 rowIndex 的行是否完全在可见视口内
|
|
1147
1391
|
* @param rowIndex - data 数组中的行索引
|
|
@@ -1210,9 +1454,13 @@ declare class DataGrid {
|
|
|
1210
1454
|
*/
|
|
1211
1455
|
scrollCellIntoViewById(rowId: string | number, colIndex: number): void;
|
|
1212
1456
|
/**
|
|
1213
|
-
* 预加载 loading
|
|
1457
|
+
* 预加载 loading 图片和刷新图标
|
|
1214
1458
|
*/
|
|
1215
1459
|
private preloadLoadingImage;
|
|
1460
|
+
/**
|
|
1461
|
+
* 预加载刷新 SVG 图标(icon_backtodefault),转换为可绘制的 Image 对象
|
|
1462
|
+
*/
|
|
1463
|
+
private preloadRefreshIcon;
|
|
1216
1464
|
/**
|
|
1217
1465
|
* 显示指定单元格的 loading 状态
|
|
1218
1466
|
* @param rowIds 行的唯一标识数组(基于 rowKey 配置对应的行数据字段值)
|
|
@@ -1246,6 +1494,18 @@ declare class DataGrid {
|
|
|
1246
1494
|
* 获取预加载的 loading 图片
|
|
1247
1495
|
*/
|
|
1248
1496
|
getLoadingImage(): HTMLImageElement | null;
|
|
1497
|
+
/**
|
|
1498
|
+
* 获取预加载的刷新图标
|
|
1499
|
+
*/
|
|
1500
|
+
getRefreshIcon(): HTMLImageElement | null;
|
|
1501
|
+
/**
|
|
1502
|
+
* 增加 footer/groupRow loading 引用计数,确保动画持续运行
|
|
1503
|
+
*/
|
|
1504
|
+
addFooterLoading(): void;
|
|
1505
|
+
/**
|
|
1506
|
+
* 减少 footer/groupRow loading 引用计数
|
|
1507
|
+
*/
|
|
1508
|
+
removeFooterLoading(): void;
|
|
1249
1509
|
/**
|
|
1250
1510
|
* 启动 loading 动画循环(轻量级:仅更新角度 + markDirty)
|
|
1251
1511
|
*/
|
|
@@ -1275,6 +1535,39 @@ declare class DataGrid {
|
|
|
1275
1535
|
* @returns 高亮色字符串,未设置时返回空字符串
|
|
1276
1536
|
*/
|
|
1277
1537
|
getColumnHighlightColor(columnKey: string): string;
|
|
1538
|
+
/**
|
|
1539
|
+
* 批量设置表头文字颜色(用于新加入字段紫色高亮等场景)
|
|
1540
|
+
* @param colors 表头文字颜色映射对象:{ columnKey: color },color 为空字符串表示清除
|
|
1541
|
+
*/
|
|
1542
|
+
setHeaderTextColors(colors: Record<string, string>): void;
|
|
1543
|
+
/**
|
|
1544
|
+
* 获取指定列的表头文字颜色
|
|
1545
|
+
* @param columnKey 列的 key 标识
|
|
1546
|
+
* @returns 文字颜色字符串,未设置时返回空字符串
|
|
1547
|
+
*/
|
|
1548
|
+
getHeaderTextColor(columnKey: string): string;
|
|
1549
|
+
/**
|
|
1550
|
+
* 批量设置排序状态(替换所有排序)
|
|
1551
|
+
* @param orders 排序数组:[{ meta: string, type: 'asc'|'desc' }]
|
|
1552
|
+
* meta 对应列的 convertMeta,type 为排序方向
|
|
1553
|
+
*/
|
|
1554
|
+
setSortOrders(orders: Array<{
|
|
1555
|
+
meta: string;
|
|
1556
|
+
type: 'asc' | 'desc';
|
|
1557
|
+
}>): void;
|
|
1558
|
+
/**
|
|
1559
|
+
* 获取指定列的排序状态
|
|
1560
|
+
* @param convertMeta 列的 convertMeta 标识
|
|
1561
|
+
* @returns 排序状态对象,未排序时返回 null
|
|
1562
|
+
*/
|
|
1563
|
+
getSortOrder(convertMeta: string): {
|
|
1564
|
+
type: 'asc' | 'desc';
|
|
1565
|
+
index: number;
|
|
1566
|
+
} | null;
|
|
1567
|
+
/**
|
|
1568
|
+
* 获取当前排序列总数
|
|
1569
|
+
*/
|
|
1570
|
+
getSortOrderCount(): number;
|
|
1278
1571
|
/**
|
|
1279
1572
|
* 设置搜索匹配颜色
|
|
1280
1573
|
*/
|
|
@@ -1457,9 +1750,20 @@ declare class DataGrid {
|
|
|
1457
1750
|
* @returns Row index or -1 if not found
|
|
1458
1751
|
*/
|
|
1459
1752
|
private findRowIndexById;
|
|
1753
|
+
/**
|
|
1754
|
+
* 根据数据中最大 groupLevel 动态计算 originFixedWidth(index 列宽度)
|
|
1755
|
+
* 规则:
|
|
1756
|
+
* - 非分组/一维分组(maxLevel=0): 52px
|
|
1757
|
+
* - 二维分组(maxLevel=1): 62px
|
|
1758
|
+
* - 三维分组(maxLevel>=2): 72px
|
|
1759
|
+
* @param data 可选,如果不传则使用当前 this.data
|
|
1760
|
+
*/
|
|
1761
|
+
recalcOriginFixedWidth(data?: RowData[]): void;
|
|
1460
1762
|
/** 动态切换 footer 显示状态 */
|
|
1461
1763
|
setShowTableIndex(show: boolean): void;
|
|
1462
1764
|
setShowFooter(show: boolean): void;
|
|
1765
|
+
/** 动态设置 footer 行高度 */
|
|
1766
|
+
setFooterHeight(height: number): void;
|
|
1463
1767
|
/** 一次性设置所有列的 footer 统计数据 */
|
|
1464
1768
|
setFooterData(data: FooterData): void;
|
|
1465
1769
|
/** 设置单列的 footer 统计数据 */
|
|
@@ -1468,6 +1772,24 @@ declare class DataGrid {
|
|
|
1468
1772
|
setGroupHeaderStatData(groupId: string | number, data: FooterData): void;
|
|
1469
1773
|
/** 设置指定分组指定列的组头统计数据 */
|
|
1470
1774
|
setGroupHeaderStatCellData(groupId: string | number, columnKey: string, cellData: FooterCellData): void;
|
|
1775
|
+
/**
|
|
1776
|
+
* 设置所有组头行中指定列的 loading 状态
|
|
1777
|
+
* @param columnKey - 列标识 key(嵌套列格式为 "moduleColKey::childKey")
|
|
1778
|
+
* @param loading - 是否设为 loading 状态
|
|
1779
|
+
*/
|
|
1780
|
+
setGroupHeaderColumnLoading(columnKey: string, loading: boolean): void;
|
|
1781
|
+
/**
|
|
1782
|
+
* 设置 Footer 弹窗激活的列标识(弹窗打开时调用),
|
|
1783
|
+
* 使该列的下拉箭头和刷新图标在鼠标移开后仍保持显示。
|
|
1784
|
+
* 传 null 表示关闭弹窗、清除激活状态。
|
|
1785
|
+
*/
|
|
1786
|
+
setFooterPopoverActive(key: string | null): void;
|
|
1787
|
+
/**
|
|
1788
|
+
* 设置组头弹窗激活的列标识(弹窗打开时调用),
|
|
1789
|
+
* 使该列的下拉箭头和刷新图标在鼠标移开后仍保持显示。
|
|
1790
|
+
* 传 null 表示关闭弹窗、清除激活状态。
|
|
1791
|
+
*/
|
|
1792
|
+
setGroupHeaderPopoverActive(key: string | null): void;
|
|
1471
1793
|
/** 从 body.data 中查找指定 groupId 的 GroupRowData */
|
|
1472
1794
|
private findGroupRowData;
|
|
1473
1795
|
/**
|
|
@@ -4,8 +4,10 @@ declare class Footer {
|
|
|
4
4
|
grid: DataGrid;
|
|
5
5
|
footerData: FooterData;
|
|
6
6
|
hoverColIndex: number;
|
|
7
|
+
/** 当 hover 列为 nested 父列时,记录鼠标所在的子列偏移索引(-1 表示不在子列上) */
|
|
8
|
+
hoverSubColIndex: number;
|
|
7
9
|
constructor(grid: DataGrid);
|
|
8
|
-
/** Footer
|
|
10
|
+
/** Footer 行高度(从 DataGrid._footerHeight 读取,支持自定义) */
|
|
9
11
|
get height(): number;
|
|
10
12
|
/** Footer Y 坐标(固定在可视区域底部,水平滚动条上方) */
|
|
11
13
|
get y(): number;
|
|
@@ -17,20 +19,45 @@ declare class Footer {
|
|
|
17
19
|
cleanupFooterData(existingKeys: Set<string>): void;
|
|
18
20
|
/** 判断鼠标是否在 footer 区域内 */
|
|
19
21
|
isInFooterArea(x: number, y: number): boolean;
|
|
20
|
-
/**
|
|
22
|
+
/** 获取鼠标悬停所在的列索引(考虑固定列和滚动偏移),同时更新 hoverSubColIndex */
|
|
21
23
|
getHoverColumnIndex(mouseX: number): number;
|
|
24
|
+
/** 获取指定 nested 父列的所有子列列头 */
|
|
25
|
+
private getNestedChildHeaders;
|
|
26
|
+
/** 安全获取 canvas 元素的视口边界(测试环境中 target 可能不存在) */
|
|
27
|
+
private getCanvasRect;
|
|
22
28
|
/** 获取列在屏幕上的实际 X 坐标 */
|
|
23
29
|
private getColumnScreenX;
|
|
24
30
|
/** 处理鼠标单击事件 */
|
|
25
31
|
onClick(mouseX: number, mouseY: number, clientX: number, clientY: number): void;
|
|
32
|
+
/** 处理 nested 子列点击 */
|
|
33
|
+
private onNestedChildClick;
|
|
34
|
+
/**
|
|
35
|
+
* 检测鼠标是否在刷新图标区域内(嵌套子列的刷新按钮)
|
|
36
|
+
* 布局从右到左:[下拉箭头(ARROW_ICON_SIZE)] [刷新icon(REFRESH_ICON_PADDING + REFRESH_ICON_SIZE + REFRESH_ICON_PADDING)]
|
|
37
|
+
*/
|
|
38
|
+
private isInsideRefreshIcon;
|
|
26
39
|
/** 从列配置中查找指定索引的列 */
|
|
27
40
|
private findColumnConfig;
|
|
28
41
|
/** 绘制 footer */
|
|
29
42
|
draw(): void;
|
|
30
43
|
/** 绘制单个 footer 单元格 */
|
|
31
44
|
private drawFooterCell;
|
|
45
|
+
/** 绘制 nested 列的子单元格拆分渲染 */
|
|
46
|
+
private drawNestedFooterCell;
|
|
32
47
|
/** 绘制 "数据统计" 提示文字 */
|
|
33
48
|
private drawHintText;
|
|
49
|
+
/** 绘制 "数据统计" 提示文字(指定最大宽度) */
|
|
50
|
+
private drawHintTextWithMaxWidth;
|
|
51
|
+
/**
|
|
52
|
+
* 绘制刷新图标(icon_backtodefault)
|
|
53
|
+
* @param x 刷新图标区域左边界(包含 padding)
|
|
54
|
+
*/
|
|
55
|
+
private drawRefreshIcon;
|
|
56
|
+
/**
|
|
57
|
+
* 绘制 loading 旋转图标(替代刷新icon位置)
|
|
58
|
+
* @param x loading 图标区域左边界(包含 padding,与刷新icon位置对齐)
|
|
59
|
+
*/
|
|
60
|
+
private drawLoadingIcon;
|
|
34
61
|
/**
|
|
35
62
|
* 截断文字并添加省略号,不压缩文字宽度
|
|
36
63
|
*/
|