arthub-table 0.2.23 → 0.2.25-next.0
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/README.md +0 -13
- 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/core/Body.d.ts +7 -0
- package/dist/types/core/DataGrid.d.ts +158 -3
- package/dist/types/core/Events.d.ts +5 -0
- package/dist/types/core/GroupRow.d.ts +13 -0
- package/dist/types/core/Row.d.ts +1 -1
- package/dist/types/core/types.d.ts +7 -0
- package/dist/types/core/util.d.ts +17 -1
- package/dist/types/core/viewers/ImageViewer.d.ts +11 -0
- package/dist/types/core/viewers/types.d.ts +38 -0
- package/dist/types/testing/TestHooks.d.ts +42 -0
- package/package.json +1 -1
|
@@ -154,6 +154,13 @@ declare class Body {
|
|
|
154
154
|
* 如果为 undefined,则从 this.data 中直接读取(适用于外部已直接修改 data 数组的场景)
|
|
155
155
|
*/
|
|
156
156
|
refreshColumnData(colKeys: string[], newDataByKey?: Record<string, any>[]): void;
|
|
157
|
+
/**
|
|
158
|
+
* 图片列专用脏检查:提取实际 URL 比较,忽略 string↔object 类型震荡
|
|
159
|
+
* 和对象引用差异(每次 refreshColumnData 传入新对象但内容相同)。
|
|
160
|
+
*/
|
|
161
|
+
private _imageValueChanged;
|
|
162
|
+
/** 从 value 中提取图片 URL 数组 */
|
|
163
|
+
private _extractImageUrls;
|
|
157
164
|
updateCellData(_colIndex: number): void;
|
|
158
165
|
/**
|
|
159
166
|
* 获取所有选中的行对象(返回Row对象而不是RowData)
|
|
@@ -143,8 +143,6 @@ interface RowContextMenuInfo {
|
|
|
143
143
|
_isRowChecked?: boolean;
|
|
144
144
|
/** 当前选中行总数 */
|
|
145
145
|
_selectedRowCount?: number;
|
|
146
|
-
/** Row 对象内部的 _rowId,和 selectedRowIds 中的 key 格式一致 */
|
|
147
|
-
_internalRowId?: string;
|
|
148
146
|
}
|
|
149
147
|
export interface DataGridOptions {
|
|
150
148
|
width?: number | string;
|
|
@@ -759,6 +757,44 @@ export interface DataGridOptions {
|
|
|
759
757
|
* will be paused to prevent the browser from freezing.
|
|
760
758
|
*/
|
|
761
759
|
onRenderError?: (error: unknown, consecutiveErrorCount: number) => void;
|
|
760
|
+
/**
|
|
761
|
+
* 外部 OS 文件拖入 cell 时的 4 个回调(仅响应 dataTransfer.types includes 'Files')。
|
|
762
|
+
* - DragEnter / DragOver / DragLeave 仅做选中态/视觉提示;选中已由 DataGrid 内部 selectCell 完成。
|
|
763
|
+
* - Drop 真正触发上传流程(业务侧 controller 接管:插占位 + 调 graph.addFile / addFileOnNonFileNode)。
|
|
764
|
+
*/
|
|
765
|
+
onExternalFileDragEnter?: (info: {
|
|
766
|
+
rowIndex: number;
|
|
767
|
+
colIndex: number;
|
|
768
|
+
columnKey: string;
|
|
769
|
+
}) => void;
|
|
770
|
+
onExternalFileDragOver?: (info: {
|
|
771
|
+
rowIndex: number;
|
|
772
|
+
colIndex: number;
|
|
773
|
+
columnKey: string;
|
|
774
|
+
} | null) => void;
|
|
775
|
+
onExternalFileDragLeave?: (info: {
|
|
776
|
+
rowIndex: number;
|
|
777
|
+
colIndex: number;
|
|
778
|
+
columnKey: string;
|
|
779
|
+
} | null) => void;
|
|
780
|
+
onExternalFileDrop?: (info: {
|
|
781
|
+
rowIndex: number;
|
|
782
|
+
colIndex: number;
|
|
783
|
+
columnKey: string;
|
|
784
|
+
files: File[];
|
|
785
|
+
e?: DragEvent;
|
|
786
|
+
}) => void;
|
|
787
|
+
/**
|
|
788
|
+
* 外部 OS 文件粘贴(Ctrl/Cmd+V 把剪贴板里的文件追加到当前选中 cell)回调。
|
|
789
|
+
* 与 onExternalFileDrop 形参对称,但语义为"追加上传"——业务侧不应清掉 cell 现有文件。
|
|
790
|
+
*/
|
|
791
|
+
onExternalFilePaste?: (info: {
|
|
792
|
+
rowIndex: number;
|
|
793
|
+
colIndex: number;
|
|
794
|
+
columnKey: string;
|
|
795
|
+
files: File[];
|
|
796
|
+
e?: ClipboardEvent;
|
|
797
|
+
}) => void;
|
|
762
798
|
}
|
|
763
799
|
declare class DataGrid {
|
|
764
800
|
target: HTMLCanvasElement;
|
|
@@ -804,6 +840,7 @@ declare class DataGrid {
|
|
|
804
840
|
rowIdMap: Map<string, number>;
|
|
805
841
|
selectedRowIds: Set<string>;
|
|
806
842
|
selectedGroupIds: Set<string>;
|
|
843
|
+
_groupSelectedRowIds: Map<string, string[]>;
|
|
807
844
|
lastSelectedRowIndex: number;
|
|
808
845
|
/** Footer 行高度(showFooter 为 false 时返回 0) */
|
|
809
846
|
get footerHeight(): number;
|
|
@@ -1024,6 +1061,28 @@ declare class DataGrid {
|
|
|
1024
1061
|
cellValueTransformer?: import('./viewers/types').CellValueTransformer;
|
|
1025
1062
|
/** Render error callback (see DataGridOptions.onRenderError) */
|
|
1026
1063
|
onRenderError?: (error: unknown, consecutiveErrorCount: number) => void;
|
|
1064
|
+
/** 外部 OS 文件拖入 cell 时的 4 个回调(详见 DataGridOptions.onExternalFileDrag*) */
|
|
1065
|
+
onExternalFileDragEnter?: DataGridOptions['onExternalFileDragEnter'];
|
|
1066
|
+
onExternalFileDragOver?: DataGridOptions['onExternalFileDragOver'];
|
|
1067
|
+
onExternalFileDragLeave?: DataGridOptions['onExternalFileDragLeave'];
|
|
1068
|
+
onExternalFileDrop?: DataGridOptions['onExternalFileDrop'];
|
|
1069
|
+
onExternalFilePaste?: DataGridOptions['onExternalFilePaste'];
|
|
1070
|
+
/**
|
|
1071
|
+
* 外部 OS 文件拖拽状态机。
|
|
1072
|
+
* - activeCell:当前 hover 的 image/file cell(已被 selectCell 选中)
|
|
1073
|
+
* - previousFocusCell:拖拽开始前的原 focusCell,用于拖拽离开 / drop 完成后还原选区
|
|
1074
|
+
*/
|
|
1075
|
+
externalFileDrag: {
|
|
1076
|
+
activeCell: {
|
|
1077
|
+
rowIndex: number;
|
|
1078
|
+
colIndex: number;
|
|
1079
|
+
columnKey: string;
|
|
1080
|
+
} | null;
|
|
1081
|
+
previousFocusCell: {
|
|
1082
|
+
rowIndex: number;
|
|
1083
|
+
colIndex: number;
|
|
1084
|
+
} | null;
|
|
1085
|
+
};
|
|
1027
1086
|
nestedDataCompareKeys: string[];
|
|
1028
1087
|
nestedForceRefreshKeys: string[];
|
|
1029
1088
|
range: RangeState;
|
|
@@ -1053,6 +1112,8 @@ declare class DataGrid {
|
|
|
1053
1112
|
private isDirty;
|
|
1054
1113
|
private lastScrollX;
|
|
1055
1114
|
private lastScrollY;
|
|
1115
|
+
/** [FLICKER-DEBUG] draw 日志节流时间戳 */
|
|
1116
|
+
_lastDrawLogTime: number;
|
|
1056
1117
|
private _afterRenderListeners;
|
|
1057
1118
|
private _renderErrorCount;
|
|
1058
1119
|
private _renderPaused;
|
|
@@ -1601,7 +1662,7 @@ declare class DataGrid {
|
|
|
1601
1662
|
isRowCheckedByIndex(rowIndex: number): boolean | undefined;
|
|
1602
1663
|
/**
|
|
1603
1664
|
* 获取全量数据(非受控模式下包含折叠隐藏的行)
|
|
1604
|
-
*
|
|
1665
|
+
* 用于 GroupRow.selectGroupRows 遍历所有子行(包括折叠不可见的)
|
|
1605
1666
|
*/
|
|
1606
1667
|
getFullData(): RowData[];
|
|
1607
1668
|
getChangedRows(): RowData[];
|
|
@@ -1841,6 +1902,94 @@ declare class DataGrid {
|
|
|
1841
1902
|
width: number;
|
|
1842
1903
|
height: number;
|
|
1843
1904
|
} | null;
|
|
1905
|
+
/**
|
|
1906
|
+
* 根据 canvas 局部坐标命中可见 cell(外部文件拖拽 hit-test 入口)。
|
|
1907
|
+
*
|
|
1908
|
+
* 复用既有 `Body.rows[].cells[].isInsideHorizontalBodyBoundary` /
|
|
1909
|
+
* `isInsideFixedHorizontalBodyBoundary` / 行级 `isInsideVerticaBodyBoundary`,
|
|
1910
|
+
* 不重写坐标转换公式,保证与 mousedown/mousemove/click 路径完全一致
|
|
1911
|
+
* (遵守 canvas-table-event-management SKILL §"Coordinate Systems")。
|
|
1912
|
+
*
|
|
1913
|
+
* 嵌套子表(NestedGrid):当命中的主表 cell 持有 nestedGrid 实例且 NestedGrid
|
|
1914
|
+
* 也实现了 getCellAtPoint 时,递归命中子格子;否则返回主表 cell。
|
|
1915
|
+
* 若嵌套表 hit-test 当前未实现(NestedGrid 没有 getCellAtPoint),fallback
|
|
1916
|
+
* 到主表 cell(保证主表场景永不退化),后续 iter 在 NestedGrid 上补该方法即可。
|
|
1917
|
+
*
|
|
1918
|
+
* @param x canvas 局部 X(不含 dpr 缩放)
|
|
1919
|
+
* @param y canvas 局部 Y
|
|
1920
|
+
* @returns 命中的 cell 信息,或 null
|
|
1921
|
+
*/
|
|
1922
|
+
getCellAtPoint(x: number, y: number): {
|
|
1923
|
+
rowIndex: number;
|
|
1924
|
+
colIndex: number;
|
|
1925
|
+
columnKey: string;
|
|
1926
|
+
column: any;
|
|
1927
|
+
cell: any;
|
|
1928
|
+
bounds: {
|
|
1929
|
+
x: number;
|
|
1930
|
+
y: number;
|
|
1931
|
+
width: number;
|
|
1932
|
+
height: number;
|
|
1933
|
+
};
|
|
1934
|
+
} | null;
|
|
1935
|
+
/**
|
|
1936
|
+
* 判断列是否接受外部 OS 文件 drop。
|
|
1937
|
+
* 规则(按优先级):
|
|
1938
|
+
* 1. column.acceptExternalFileDrop === false → 显式禁用,永远 false
|
|
1939
|
+
* 2. column.readonly === true → 禁用
|
|
1940
|
+
* 3. column.acceptExternalFileDrop === true → 显式启用
|
|
1941
|
+
* 4. column.type === 'image' | 'file'(或 viewerType 等价)→ 默认启用
|
|
1942
|
+
* 5. 其它 → false
|
|
1943
|
+
*/
|
|
1944
|
+
isColumnAcceptingExternalFileDrop(column: any): boolean;
|
|
1945
|
+
/**
|
|
1946
|
+
* 外部文件拖拽:命中 cell 后的核心状态机。
|
|
1947
|
+
* - 命中 image/file(且 acceptExternalFileDrop 不为 false):
|
|
1948
|
+
* 1) 首次进入:暂存 previousFocusCell;
|
|
1949
|
+
* 2) 切换 cell:调 selectCell 把高亮迁移;
|
|
1950
|
+
* 3) 同 cell:no-op,避免每帧重复 selectCell。
|
|
1951
|
+
* - 命中非 image/file 列 or 命中失败:调 clearExternalFileDragHover 清状态。
|
|
1952
|
+
*/
|
|
1953
|
+
handleExternalFileHit(cellInfo: {
|
|
1954
|
+
rowIndex: number;
|
|
1955
|
+
colIndex: number;
|
|
1956
|
+
columnKey: string;
|
|
1957
|
+
column: any;
|
|
1958
|
+
cell: any;
|
|
1959
|
+
bounds: {
|
|
1960
|
+
x: number;
|
|
1961
|
+
y: number;
|
|
1962
|
+
width: number;
|
|
1963
|
+
height: number;
|
|
1964
|
+
};
|
|
1965
|
+
} | null): void;
|
|
1966
|
+
/**
|
|
1967
|
+
* 清掉外部文件拖拽的视觉状态:
|
|
1968
|
+
* - 还原拖拽前的 focusCell(若存在),否则 clearMultiSelect 清空选区;
|
|
1969
|
+
* - 触发 onExternalFileDragLeave 回调(带最后一个 active cell 信息);
|
|
1970
|
+
* - 重置内部 externalFileDrag 状态机。
|
|
1971
|
+
*
|
|
1972
|
+
* 2026-05-25 修复(task=27c2d1ef e2e iter9 后真实使用反馈):
|
|
1973
|
+
* drop 之后 cell 形成"从 dragenter cell 一直延展到鼠标当前位置"的 rectangle 框选,
|
|
1974
|
+
* 必须用户再 mousedown 一次才恢复。根因:dragenter 期间调 `selectCell` 把
|
|
1975
|
+
* `selector.isSelected = true`(L1721 进入"多选 latch"状态),后续 mousemove
|
|
1976
|
+
* 会扩展 selector.xArr/yArr。但 drop 是 native drag 事件,不会触发 mouseup,
|
|
1977
|
+
* `endMultiSelect()` 永不调用 → `isSelected` 永远 latched 为 true。
|
|
1978
|
+
* 修法:在拖拽视觉清理末尾显式把 `selector.isSelected = false`(等价于一次
|
|
1979
|
+
* 合成的 mouseup),同时 `edgeScroller.stop()` 防止边缘自动滚动状态残留
|
|
1980
|
+
* (endMultiSelect 也会调)。
|
|
1981
|
+
*
|
|
1982
|
+
* 2026-05-26 修复:drop 命中目标 cell 后,UX 预期是\"被上传的那个 cell 保持选中\"
|
|
1983
|
+
* 而不是回退到拖拽前的 focusCell(直觉上正在动作的对象该有焦点)。
|
|
1984
|
+
* 增加可选参数 `dropTarget`:drop 命中且 callback 调通时,由 Events 层传入
|
|
1985
|
+
* 目标 cell;本方法优先 selectCell(dropTarget),并跳过 previousFocusCell 还原。
|
|
1986
|
+
* - dragleave 路径不传 dropTarget → 走原 prev 还原逻辑(保留旧行为)
|
|
1987
|
+
* - drop 未命中(空白处 / 列不接受)路径 Events 层也不传 dropTarget → 同样还原 prev
|
|
1988
|
+
*/
|
|
1989
|
+
clearExternalFileDragHover(dropTarget?: {
|
|
1990
|
+
rowIndex: number;
|
|
1991
|
+
colIndex: number;
|
|
1992
|
+
}): void;
|
|
1844
1993
|
/**
|
|
1845
1994
|
* 将指定单元格滚动到可见区域内(同时处理垂直和水平方向)
|
|
1846
1995
|
* - 垂直方向:确保行在视口内
|
|
@@ -2295,6 +2444,12 @@ declare class DataGrid {
|
|
|
2295
2444
|
*/
|
|
2296
2445
|
private ensureRowIds;
|
|
2297
2446
|
syncGroupCheckedState(): void;
|
|
2447
|
+
/**
|
|
2448
|
+
* 受控模式下:计算组头应有的 checked 状态,如果与当前不一致则通过回调通知外部修改。
|
|
2449
|
+
* 逻辑与 syncGroupCheckedState 的计算一致,但不直接修改 data.checked 和 selectedGroupIds,
|
|
2450
|
+
* 而是通过 onGroupCheckboxChange 回调让外部决定是否更新。
|
|
2451
|
+
*/
|
|
2452
|
+
private _notifyGroupCheckedChanges;
|
|
2298
2453
|
/**
|
|
2299
2454
|
* 折叠所有任务(受控模式下触发 onCollapseAll 回调,由外部操作 tableTaskList 后刷新)
|
|
2300
2455
|
*/
|
|
@@ -13,6 +13,11 @@ interface EventTasks {
|
|
|
13
13
|
cancel?: () => void;
|
|
14
14
|
};
|
|
15
15
|
documentMousedown: (e: MouseEvent) => void;
|
|
16
|
+
externalDragEnter: (e: DragEvent) => void;
|
|
17
|
+
externalDragOver: (e: DragEvent) => void;
|
|
18
|
+
externalDragLeave: (e: DragEvent) => void;
|
|
19
|
+
externalDrop: (e: DragEvent) => void;
|
|
20
|
+
externalPaste: (e: ClipboardEvent) => void;
|
|
16
21
|
}
|
|
17
22
|
declare class Events {
|
|
18
23
|
grid: DataGrid;
|
|
@@ -280,6 +280,19 @@ declare class GroupRow extends Context {
|
|
|
280
280
|
* Handle click on group row
|
|
281
281
|
*/
|
|
282
282
|
handleClick(mouseX: number, mouseY: number): boolean;
|
|
283
|
+
/**
|
|
284
|
+
* 选中/取消选中该组下的所有子行(包括子分组及其子行)
|
|
285
|
+
*
|
|
286
|
+
* 使用全量数据(_fullData)而非 body.data,确保收起的组也能正确选中/取消选中。
|
|
287
|
+
* 从当前组头在全量数据中的位置开始,往后遍历,直到遇到同级或更高级的分组行为止,
|
|
288
|
+
* 期间所有的普通数据行都属于该组。
|
|
289
|
+
* 对可见行通过 Row 对象调用 handleCheck,对不可见行直接操作 selectedRowIds。
|
|
290
|
+
*
|
|
291
|
+
* @param groupId - 组头行的 ID
|
|
292
|
+
* @param checked - 目标选中状态
|
|
293
|
+
* @returns 变更后该组内所有行的 rowId 数组
|
|
294
|
+
*/
|
|
295
|
+
private selectGroupRows;
|
|
283
296
|
/**
|
|
284
297
|
* 计算该组下将新增的选中行数(不含已选中的行)
|
|
285
298
|
* 用于 maxSelectedRows 前置校验
|
package/dist/types/core/Row.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare class Row extends Context {
|
|
|
16
16
|
rowHeader: RowHeader;
|
|
17
17
|
constructor(grid: DataGrid, rowIndex: number, x: number, y: number, height: number, data: RowData);
|
|
18
18
|
isInVerticalAutofill(mouseX: number, mouseY: number): boolean;
|
|
19
|
-
handleCheck(checked?: boolean, event?: MouseEvent
|
|
19
|
+
handleCheck(checked?: boolean, event?: MouseEvent): void;
|
|
20
20
|
mouseDown(x: number, y: number): void;
|
|
21
21
|
mouseMove(mouseX: number, mouseY: number): void;
|
|
22
22
|
handleAutofill(x: number, y: number): void;
|
|
@@ -130,6 +130,13 @@ export interface ColumnConfig {
|
|
|
130
130
|
showFilterIcon?: boolean;
|
|
131
131
|
/** 筛选命中该列时为 true:筛选图标常驻显示且显示激活色 */
|
|
132
132
|
filterIconActive?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* 是否接受外部 OS 文件 drop(从浏览器外拖文件到本列的 cell)。
|
|
135
|
+
* - 默认 undefined:由 DataGrid 内部判断 column.type === 'image' | 'file' 决定。
|
|
136
|
+
* - 显式 false:完全禁用该列的外部 drop(即便列类型是 image/file 也不响应)。
|
|
137
|
+
* - 显式 true:与 image/file 类型守卫一致,由业务层(columnAdapter)显式开启。
|
|
138
|
+
*/
|
|
139
|
+
acceptExternalFileDrop?: boolean;
|
|
133
140
|
[key: string]: any;
|
|
134
141
|
}
|
|
135
142
|
export interface SelectorState {
|
|
@@ -14,4 +14,20 @@ declare function getIcon(type: string): string;
|
|
|
14
14
|
*/
|
|
15
15
|
declare function getIconByFileStatus(fileStatus: string | number | undefined, format?: string): any;
|
|
16
16
|
export type { HeaderConfig };
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* 在 canvas 中心绘制圆形进度环(背景圆 + 前景弧)。
|
|
19
|
+
* - 视觉与 AssetMatrix 的 SVG `PercentRing.vue` 1:1 对齐:
|
|
20
|
+
* 背景灰圆 + 蓝色前景弧,从 -π/2 起顺时针扫过 percent/100 圈。
|
|
21
|
+
* - 用于 ImageViewer / FileViewer 渲染 uploading 占位的进度反馈,
|
|
22
|
+
* 严禁用 SVG / DOM 元素叠加(必须画在 canvas 内)。
|
|
23
|
+
*
|
|
24
|
+
* @param ctx canvas 2d context
|
|
25
|
+
* @param cx, cy 圆心
|
|
26
|
+
* @param r 半径
|
|
27
|
+
* @param sw 线宽(背景与前景一致)
|
|
28
|
+
* @param percent 0-100,超出范围会自动 clamp
|
|
29
|
+
* @param fg 前景(已上传部分)颜色,默认 '#3F9EFF'
|
|
30
|
+
* @param bg 背景圆颜色,默认 'rgba(0,0,0,0.25)'
|
|
31
|
+
*/
|
|
32
|
+
declare function drawProgressRing(ctx: CanvasRenderingContext2D, cx: number, cy: number, r: number, sw: number, percent: number, fg?: string, bg?: string): void;
|
|
33
|
+
export { toLeaf, getMaxRow, calCrossSpan, getIcon, getIconByFileStatus, drawProgressRing, };
|
|
@@ -52,6 +52,10 @@ declare class ImageViewer implements CellViewer<ImageViewerData> {
|
|
|
52
52
|
* 绘制多张图片左对齐并排排列在单元格内
|
|
53
53
|
* 与 DOM multiImageViewer 的 renderImg 行为一致:所有图片都展示
|
|
54
54
|
* 如果所有图片按行高等比缩放后总宽度超出可用宽度,则等分可用宽度
|
|
55
|
+
*
|
|
56
|
+
* 当 data.uploadingItems 非空时(外部文件 drop 触发上传),
|
|
57
|
+
* 占位 slot 排在 url 数组之前(与 FileEditor.unshift 行为对齐),
|
|
58
|
+
* 每个占位 slot 渲染灰底 + 中央 canvas 进度环。
|
|
55
59
|
*/
|
|
56
60
|
private drawMultipleImages;
|
|
57
61
|
/**
|
|
@@ -62,6 +66,13 @@ declare class ImageViewer implements CellViewer<ImageViewerData> {
|
|
|
62
66
|
* 为单张未加载的图片绘制占位
|
|
63
67
|
*/
|
|
64
68
|
private drawSinglePlaceholder;
|
|
69
|
+
/**
|
|
70
|
+
* 为外部 OS 文件 drop 触发的「上传中」占位 slot 绘制:
|
|
71
|
+
* - 灰底矩形
|
|
72
|
+
* - 中央 canvas 进度环(与 FileEditor.PercentRing 视觉对齐:背景灰圆 + 蓝色前景弧)
|
|
73
|
+
* 不使用 SVG / DOM 元素叠加(用户明确要求 loading 必须画在 canvas 里)。
|
|
74
|
+
*/
|
|
75
|
+
private drawUploadingPlaceholder;
|
|
65
76
|
/**
|
|
66
77
|
* 绘制交付物角标(右下角圆形图标)
|
|
67
78
|
* 与 DOM .mark-icon iconfont 图标对齐:
|
|
@@ -307,6 +307,21 @@ export interface ImageViewerData extends CellViewerData {
|
|
|
307
307
|
onImgMouseIn?: (url: string, virtualAnchor: any) => void;
|
|
308
308
|
/** 鼠标移出图片回调(用于隐藏大图预览) */
|
|
309
309
|
onImgMouseOut?: () => void;
|
|
310
|
+
/**
|
|
311
|
+
* 正在上传中的占位项(外部 OS 文件 drop 触发上传时由业务层 unshift 进来)。
|
|
312
|
+
* - id:业务层生成的占位 id(如 `uploading-${rowId}-${ts}-${idx}`),用于进度回写匹配
|
|
313
|
+
* - name:可选文件名(用于占位 hover 提示,目前 ImageViewer 不显示)
|
|
314
|
+
* - previewUrl:可选 URL.createObjectURL 本地预览图(image 列)
|
|
315
|
+
* - progress:0-100,由 EVENTHUB_TYPE.UpdateFileNodeProgress 回调写回
|
|
316
|
+
* 渲染规则:在 value 数组前面追加占位 slot(占位灰底 + 居中 canvas 进度环),
|
|
317
|
+
* 上传完成后业务层从 uploadingItems 移除并在 value 头部插入真实 URL。
|
|
318
|
+
*/
|
|
319
|
+
uploadingItems?: Array<{
|
|
320
|
+
id: string;
|
|
321
|
+
name?: string;
|
|
322
|
+
previewUrl?: string;
|
|
323
|
+
progress?: number;
|
|
324
|
+
}>;
|
|
310
325
|
}
|
|
311
326
|
/**
|
|
312
327
|
* Person/User viewer data
|
|
@@ -665,6 +680,16 @@ export interface FileItem {
|
|
|
665
680
|
status?: number;
|
|
666
681
|
/** 交付物角标标记(如 'ah-icon_finish1' / 'ah-icon_help2') */
|
|
667
682
|
mark?: string;
|
|
683
|
+
/**
|
|
684
|
+
* 是否是外部 OS 文件 drop 触发的上传中占位项。
|
|
685
|
+
* 为 true 时 viewer 会画占位 + canvas 进度环(不走真实 thumbnail / status 路径)。
|
|
686
|
+
* 由 FileViewer.draw 在合并 uploadingItems → files 时打上,业务层一般不直接设置。
|
|
687
|
+
*/
|
|
688
|
+
_uploading?: boolean;
|
|
689
|
+
/** 上传进度 0-100(仅当 _uploading=true 时有意义) */
|
|
690
|
+
progress?: number;
|
|
691
|
+
/** 占位 id,用于外部进度事件回写匹配 */
|
|
692
|
+
uploadingId?: string;
|
|
668
693
|
}
|
|
669
694
|
/**
|
|
670
695
|
* 文件 Viewer 数据接口
|
|
@@ -708,6 +733,19 @@ export interface FileViewerData extends CellViewerData {
|
|
|
708
733
|
id?: string | number;
|
|
709
734
|
ids?: number[];
|
|
710
735
|
}, data: FileViewerData) => void;
|
|
736
|
+
/**
|
|
737
|
+
* 正在上传中的占位项(外部 OS 文件 drop 触发上传时由业务层 unshift 进来)。
|
|
738
|
+
* 渲染规则:在 value 数组前面追加占位 file 项(占位文件图标 + 文件名 + 居中 canvas 进度环),
|
|
739
|
+
* 上传完成后业务层从 uploadingItems 移除并把真实数据 push 到 value。
|
|
740
|
+
* 字段语义与 ImageViewerData.uploadingItems 一致,详见那里说明。
|
|
741
|
+
*/
|
|
742
|
+
uploadingItems?: Array<{
|
|
743
|
+
id: string;
|
|
744
|
+
name?: string;
|
|
745
|
+
fileFormat?: string;
|
|
746
|
+
previewUrl?: string;
|
|
747
|
+
progress?: number;
|
|
748
|
+
}>;
|
|
711
749
|
}
|
|
712
750
|
/**
|
|
713
751
|
* HyperLink text viewer data (超链接文本)
|
|
@@ -673,6 +673,48 @@ export interface TestHooksAPI {
|
|
|
673
673
|
};
|
|
674
674
|
} | null;
|
|
675
675
|
};
|
|
676
|
+
/**
|
|
677
|
+
* 直接驱动 onExternalFileDrop callback,绕过浏览器 native HTML5 DataTransfer。
|
|
678
|
+
*
|
|
679
|
+
* 背景:Playwright 的 DataTransfer 对 file payload 历来不稳(`AmE2ETest` 既有
|
|
680
|
+
* `deliverable-upload-download.spec.ts` L760+ 已经因此改成 `setInputFiles`)。
|
|
681
|
+
* 这里给 e2e 一条**和真实 drop 完全等价**的入口:与 EventManager.handleExternalFileDrop
|
|
682
|
+
* 调用同一个 callback,能跑通业务侧 onCanvasExternalFileDrop 的全链路。
|
|
683
|
+
*
|
|
684
|
+
* 参数:
|
|
685
|
+
* - rowId : 行的用户 id(与 getRowData 入参一致)
|
|
686
|
+
* - columnKey : 列 key(与 getColumnConfig / getCellLayout 入参一致)
|
|
687
|
+
* - files : 浏览器侧构造的 File[](spec 用 `new File([bytes], name, {type})`)
|
|
688
|
+
*
|
|
689
|
+
* 返回:
|
|
690
|
+
* - true : 命中 row + col 且 onExternalFileDrop callback 已被触发
|
|
691
|
+
* - false : row 或 column 找不到 / callback 未注册(spec 应当判 false=失败)
|
|
692
|
+
*/
|
|
693
|
+
simulateExternalFileDrop: (rowId: string | number, columnKey: string, files: File[]) => boolean;
|
|
694
|
+
/**
|
|
695
|
+
* 与 simulateExternalFileDrop 对称:直接驱动 onExternalFilePaste callback,
|
|
696
|
+
* 绕过浏览器 native ClipboardEvent。语义为"追加上传",不清除 cell 现有文件。
|
|
697
|
+
* 返回 true=callback 已触发,false=row/col 找不到或 callback 未注册。
|
|
698
|
+
*/
|
|
699
|
+
simulateExternalFilePaste: (rowId: string | number, columnKey: string, files: File[]) => boolean;
|
|
700
|
+
/**
|
|
701
|
+
* 读取指定 cell 当前传给 viewer.draw 的 data 对象的浅拷贝(含 uploadingItems)。
|
|
702
|
+
*
|
|
703
|
+
* 用于 e2e 断言上传占位是否成功插入 / 进度环渲染数据是否回写到位。
|
|
704
|
+
* 仅暴露 viewer 渲染相关的几个字段,避免把整个内部对象 dump 到 spec 端。
|
|
705
|
+
*
|
|
706
|
+
* 返回:null 表示 row 或 column 找不到 / cell 还没绘制过。
|
|
707
|
+
*/
|
|
708
|
+
getCellViewerData: (rowId: string | number, columnKey: string) => {
|
|
709
|
+
value: any;
|
|
710
|
+
uploadingItems: Array<{
|
|
711
|
+
id: string;
|
|
712
|
+
name?: string;
|
|
713
|
+
previewUrl?: string;
|
|
714
|
+
progress?: number;
|
|
715
|
+
}> | undefined;
|
|
716
|
+
status: any;
|
|
717
|
+
} | null;
|
|
676
718
|
}
|
|
677
719
|
/**
|
|
678
720
|
* Test info for a single nested grid instance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arthub-table",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25-next.0",
|
|
4
4
|
"description": "High-performance canvas-based table/grid component for Vue 3 with TypeScript support, featuring virtual scrolling, cell viewers, grouped rows, and nested grids.",
|
|
5
5
|
"main": "dist/arthub-table.common.js",
|
|
6
6
|
"module": "dist/arthub-table.umd.min.js",
|