arthub-table 0.0.3
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/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +257 -0
- package/dist/arthub-table.common.js +2 -0
- package/dist/arthub-table.common.js.map +1 -0
- package/dist/arthub-table.css +1 -0
- package/dist/arthub-table.umd.js +2 -0
- package/dist/arthub-table.umd.js.map +1 -0
- package/dist/arthub-table.umd.min.js +2 -0
- package/dist/arthub-table.umd.min.js.map +1 -0
- package/dist/demo.html +1 -0
- package/dist/img/ah-icon_audio_pause.55c06fbf.svg +3 -0
- package/dist/img/ah-icon_closeshape.82e52181.svg +3 -0
- package/dist/img/icon_attachment.724d33ba.svg +3 -0
- package/dist/img/icon_default.9ef1a394.svg +5 -0
- package/dist/img/icon_edit.9966e699.svg +3 -0
- package/dist/img/icon_error_dark.2a057cdd.svg +17 -0
- package/dist/img/icon_error_light.ac6763e9.svg +17 -0
- package/dist/img/icon_failure_dark.f68723a7.svg +25 -0
- package/dist/img/icon_failure_light.489a7167.svg +25 -0
- package/dist/img/icon_folder.ea3efcce.svg +11 -0
- package/dist/img/icon_netdisc.d8bbe2e0.svg +4 -0
- package/dist/img/icon_singlearrowright.6adcd336.svg +4 -0
- package/dist/img/icon_totalNum.23a86d16.svg +3 -0
- package/dist/img/icon_transform_dark.033764ea.svg +26 -0
- package/dist/img/icon_transform_light.fa9fbcbd.svg +26 -0
- package/dist/img/img_3d.39b27128.svg +14 -0
- package/dist/img/img_aep.a898e3e7.svg +8 -0
- package/dist/img/img_ai.61f08a0a.svg +8 -0
- package/dist/img/img_audio.e4ada65c.svg +5 -0
- package/dist/img/img_enf.ad88f95d.svg +28 -0
- package/dist/img/img_excel.56663d85.svg +30 -0
- package/dist/img/img_exe.5e3fc198.svg +27 -0
- package/dist/img/img_img.ac2e0d0c.svg +8 -0
- package/dist/img/img_mcp.393ef169.svg +28 -0
- package/dist/img/img_pdf.f4da9922.svg +7 -0
- package/dist/img/img_ppt.d172780f.svg +26 -0
- package/dist/img/img_pxcook.7e9fce57.svg +18 -0
- package/dist/img/img_rarzip7z.e3b1de82.svg +28 -0
- package/dist/img/img_sketch.d49a9bd4.svg +32 -0
- package/dist/img/img_video.b6ac6198.svg +7 -0
- package/dist/img/img_word.0c1d3c88.svg +31 -0
- package/dist/img/img_x2d.6acc94f6.svg +28 -0
- package/dist/img/img_xd.cc23d09a.svg +28 -0
- package/dist/img/matrix-icon_finish.617f5d3e.svg +3 -0
- package/dist/img/matrix-icon_inprogress.3781156a.svg +3 -0
- package/dist/img/matrix-icon_supervise.edae43f0.svg +3 -0
- package/dist/types/assets/icon/iconBase64.d.ts +3 -0
- package/dist/types/components/Icon/index.d.ts +2 -0
- package/dist/types/components/clickoutside.d.ts +3 -0
- package/dist/types/core/Body.d.ts +142 -0
- package/dist/types/core/Cell.d.ts +94 -0
- package/dist/types/core/Clipboard.d.ts +16 -0
- package/dist/types/core/ColumnHeader.d.ts +24 -0
- package/dist/types/core/Context.d.ts +24 -0
- package/dist/types/core/DataGrid.d.ts +749 -0
- package/dist/types/core/EdgeScroller.d.ts +75 -0
- package/dist/types/core/Editor.d.ts +33 -0
- package/dist/types/core/Events.d.ts +25 -0
- package/dist/types/core/Footer.d.ts +37 -0
- package/dist/types/core/GifAnimationManager.d.ts +69 -0
- package/dist/types/core/GifOverlay.d.ts +33 -0
- package/dist/types/core/GroupRow.d.ts +80 -0
- package/dist/types/core/Header.d.ts +40 -0
- package/dist/types/core/History.d.ts +27 -0
- package/dist/types/core/ImageManager.d.ts +94 -0
- package/dist/types/core/NestedGrid.d.ts +177 -0
- package/dist/types/core/Paint.d.ts +101 -0
- package/dist/types/core/PerformanceMonitor.d.ts +96 -0
- package/dist/types/core/Row.d.ts +31 -0
- package/dist/types/core/RowHeader.d.ts +22 -0
- package/dist/types/core/Scroller.d.ts +33 -0
- package/dist/types/core/Selector.d.ts +9 -0
- package/dist/types/core/StyleManager.d.ts +108 -0
- package/dist/types/core/Tooltip.d.ts +28 -0
- package/dist/types/core/Validator.d.ts +26 -0
- package/dist/types/core/config.d.ts +5 -0
- package/dist/types/core/constants.d.ts +39 -0
- package/dist/types/core/element.d.ts +36 -0
- package/dist/types/core/extension-type-mapping.d.ts +5 -0
- package/dist/types/core/footer/utils.d.ts +7 -0
- package/dist/types/core/types.d.ts +399 -0
- package/dist/types/core/util.d.ts +17 -0
- package/dist/types/core/viewers/BooleanViewer.d.ts +46 -0
- package/dist/types/core/viewers/DatetimeViewer.d.ts +33 -0
- package/dist/types/core/viewers/DeliverableReviewViewer.d.ts +87 -0
- package/dist/types/core/viewers/FileStorageSpecViewer.d.ts +37 -0
- package/dist/types/core/viewers/FileViewer.d.ts +118 -0
- package/dist/types/core/viewers/GroupHeaderViewer.d.ts +73 -0
- package/dist/types/core/viewers/HyperlinkTextViewer.d.ts +80 -0
- package/dist/types/core/viewers/ImageViewer.d.ts +31 -0
- package/dist/types/core/viewers/ItfsPathViewer.d.ts +58 -0
- package/dist/types/core/viewers/ModuleViewer.d.ts +53 -0
- package/dist/types/core/viewers/NestedGridViewer.d.ts +47 -0
- package/dist/types/core/viewers/PersonViewer.d.ts +61 -0
- package/dist/types/core/viewers/PivotViewer.d.ts +43 -0
- package/dist/types/core/viewers/PriorityTextViewer.d.ts +35 -0
- package/dist/types/core/viewers/ProgressViewer.d.ts +68 -0
- package/dist/types/core/viewers/PunchTimingViewer.d.ts +42 -0
- package/dist/types/core/viewers/PunchViewer.d.ts +116 -0
- package/dist/types/core/viewers/RichTextViewer.d.ts +83 -0
- package/dist/types/core/viewers/SelectViewer.d.ts +57 -0
- package/dist/types/core/viewers/SeparatorRowViewer.d.ts +25 -0
- package/dist/types/core/viewers/StatusTextViewer.d.ts +40 -0
- package/dist/types/core/viewers/StatusViewer.d.ts +53 -0
- package/dist/types/core/viewers/TableActionButtonViewer.d.ts +77 -0
- package/dist/types/core/viewers/TaskNodeViewer.d.ts +106 -0
- package/dist/types/core/viewers/TextViewer.d.ts +37 -0
- package/dist/types/core/viewers/TextViewerWithSwitcher.d.ts +112 -0
- package/dist/types/core/viewers/ThemeViewer.d.ts +36 -0
- package/dist/types/core/viewers/TreeDropdownViewer.d.ts +55 -0
- package/dist/types/core/viewers/UpstreamViewer.d.ts +79 -0
- package/dist/types/core/viewers/ViewerRegistry.d.ts +76 -0
- package/dist/types/core/viewers/WfStateViewer.d.ts +76 -0
- package/dist/types/core/viewers/WorkflowViewer.d.ts +37 -0
- package/dist/types/core/viewers/index.d.ts +114 -0
- package/dist/types/core/viewers/types.d.ts +1097 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/testing/SnapshotManager.d.ts +55 -0
- package/dist/types/testing/TestHooks.d.ts +275 -0
- package/dist/types/testing/index.d.ts +3 -0
- package/dist/types/testing/installTestHooks.d.ts +16 -0
- package/package.json +126 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type DataGrid from "./DataGrid";
|
|
2
|
+
/**
|
|
3
|
+
* EdgeScroller — manages continuous auto-scrolling when dragging near viewport edges.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* 1. Call `start(onScroll)` when a drag operation begins
|
|
7
|
+
* 2. Call `update(mouseX, mouseY)` on every mousemove during drag
|
|
8
|
+
* 3. Call `stop()` when the drag operation ends
|
|
9
|
+
*
|
|
10
|
+
* The scroller uses requestAnimationFrame for smooth, continuous scrolling.
|
|
11
|
+
* Speed increases as the mouse gets closer to the edge.
|
|
12
|
+
*/
|
|
13
|
+
/** Axis constraint for edge scrolling */
|
|
14
|
+
type ScrollAxis = 'both' | 'horizontal' | 'vertical';
|
|
15
|
+
declare class EdgeScroller {
|
|
16
|
+
private grid;
|
|
17
|
+
private animationId;
|
|
18
|
+
private dirX;
|
|
19
|
+
private dirY;
|
|
20
|
+
private speedX;
|
|
21
|
+
private speedY;
|
|
22
|
+
private isActive;
|
|
23
|
+
private onScrollCallback;
|
|
24
|
+
private _lastMouseX;
|
|
25
|
+
private _lastMouseY;
|
|
26
|
+
private scrollAxis;
|
|
27
|
+
/** Last known mouse X position during drag (read-only) */
|
|
28
|
+
get lastMouseX(): number;
|
|
29
|
+
/** Last known mouse Y position during drag (read-only) */
|
|
30
|
+
get lastMouseY(): number;
|
|
31
|
+
constructor(grid: DataGrid);
|
|
32
|
+
/**
|
|
33
|
+
* Start edge scrolling for a drag operation.
|
|
34
|
+
* @param onScroll Callback invoked after each scroll tick (e.g., to update drag indicators)
|
|
35
|
+
* @param initialX Optional initial mouse X (avoids stale lastMouseX before first update)
|
|
36
|
+
* @param initialY Optional initial mouse Y (avoids stale lastMouseY before first update)
|
|
37
|
+
* @param axis Scroll axis constraint: 'horizontal' for col drag, 'vertical' for row drag, 'both' for selection
|
|
38
|
+
*/
|
|
39
|
+
start(onScroll?: () => void, initialX?: number, initialY?: number, axis?: ScrollAxis): void;
|
|
40
|
+
/**
|
|
41
|
+
* Update mouse position. Call on every mousemove during drag.
|
|
42
|
+
* Detects edge proximity and starts/stops/adjusts the scroll animation.
|
|
43
|
+
*/
|
|
44
|
+
update(mouseX: number, mouseY: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Stop edge scrolling. Call when the drag operation ends.
|
|
47
|
+
*/
|
|
48
|
+
stop(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Destroy the edge scroller, releasing all references.
|
|
51
|
+
* Call when the parent DataGrid is destroyed.
|
|
52
|
+
*/
|
|
53
|
+
destroy(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Compute the scrollable viewport bounds, accounting for fixed columns, header, and scrollbars.
|
|
56
|
+
*/
|
|
57
|
+
private getViewport;
|
|
58
|
+
/**
|
|
59
|
+
* Detect if the mouse is in an edge zone and compute scroll direction + speed.
|
|
60
|
+
*/
|
|
61
|
+
private detectEdge;
|
|
62
|
+
/**
|
|
63
|
+
* Start the RAF animation loop (idempotent — won't start if already running).
|
|
64
|
+
*/
|
|
65
|
+
private startAnimation;
|
|
66
|
+
/**
|
|
67
|
+
* Stop the RAF animation loop.
|
|
68
|
+
*/
|
|
69
|
+
private stopAnimation;
|
|
70
|
+
/**
|
|
71
|
+
* Apply one frame of scrolling, clamped to valid bounds.
|
|
72
|
+
*/
|
|
73
|
+
private applyScroll;
|
|
74
|
+
}
|
|
75
|
+
export default EdgeScroller;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type DataGrid from "./DataGrid";
|
|
2
|
+
interface Cell {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
editable?: boolean;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
declare class Editor {
|
|
11
|
+
grid: DataGrid;
|
|
12
|
+
areaEl: any;
|
|
13
|
+
textEl: any;
|
|
14
|
+
el: any;
|
|
15
|
+
type: string;
|
|
16
|
+
fixed: boolean;
|
|
17
|
+
selectOptions: any[];
|
|
18
|
+
editorXIndex: number;
|
|
19
|
+
editorYIndex: number;
|
|
20
|
+
xIndex: number;
|
|
21
|
+
yIndex: number;
|
|
22
|
+
show: boolean;
|
|
23
|
+
value: string;
|
|
24
|
+
cell: Cell | null;
|
|
25
|
+
suggest?: any;
|
|
26
|
+
validator?: any;
|
|
27
|
+
constructor(grid: DataGrid);
|
|
28
|
+
fire(cell: Cell): void;
|
|
29
|
+
hide(): void;
|
|
30
|
+
setData(val: string): void;
|
|
31
|
+
setoffset(): void;
|
|
32
|
+
}
|
|
33
|
+
export default Editor;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type DataGrid from "./DataGrid";
|
|
2
|
+
interface EventTasks {
|
|
3
|
+
clickoutside: (e: Event) => void;
|
|
4
|
+
mousedown: (e: MouseEvent) => void;
|
|
5
|
+
mousemove: (e: MouseEvent) => void;
|
|
6
|
+
mouseup: (e: MouseEvent) => void;
|
|
7
|
+
click: (e: MouseEvent) => void;
|
|
8
|
+
dblclick: (e: MouseEvent) => void;
|
|
9
|
+
contextmenu: (e: MouseEvent) => void;
|
|
10
|
+
mousewheel: (e: WheelEvent) => void;
|
|
11
|
+
keydown: (e: KeyboardEvent) => void;
|
|
12
|
+
resize: (() => void) & {
|
|
13
|
+
cancel?: () => void;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare class Events {
|
|
17
|
+
grid: DataGrid;
|
|
18
|
+
el: HTMLCanvasElement;
|
|
19
|
+
isFirefox: boolean;
|
|
20
|
+
eventTasks: EventTasks;
|
|
21
|
+
constructor(grid: DataGrid, el: HTMLCanvasElement);
|
|
22
|
+
init(): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
}
|
|
25
|
+
export default Events;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type DataGrid from './DataGrid';
|
|
2
|
+
import type { FooterData, FooterCellData } from './types';
|
|
3
|
+
declare class Footer {
|
|
4
|
+
grid: DataGrid;
|
|
5
|
+
footerData: FooterData;
|
|
6
|
+
hoverColIndex: number;
|
|
7
|
+
constructor(grid: DataGrid);
|
|
8
|
+
/** Footer 行高度 */
|
|
9
|
+
get height(): number;
|
|
10
|
+
/** Footer Y 坐标(固定在可视区域底部,水平滚动条上方) */
|
|
11
|
+
get y(): number;
|
|
12
|
+
/** 一次性设置所有列的统计数据 */
|
|
13
|
+
setFooterData(data: FooterData): void;
|
|
14
|
+
/** 设置单列的统计数据 */
|
|
15
|
+
setFooterCellData(columnKey: string, data: FooterCellData): void;
|
|
16
|
+
/** 当列结构变化时,清理已不存在列的 footer 数据 */
|
|
17
|
+
cleanupFooterData(existingKeys: Set<string>): void;
|
|
18
|
+
/** 判断鼠标是否在 footer 区域内 */
|
|
19
|
+
isInFooterArea(x: number, y: number): boolean;
|
|
20
|
+
/** 获取鼠标悬停所在的列索引(考虑固定列和滚动偏移) */
|
|
21
|
+
getHoverColumnIndex(mouseX: number): number;
|
|
22
|
+
/** 获取列在屏幕上的实际 X 坐标 */
|
|
23
|
+
private getColumnScreenX;
|
|
24
|
+
/** 处理鼠标单击事件 */
|
|
25
|
+
onClick(mouseX: number, mouseY: number, clientX: number, clientY: number): void;
|
|
26
|
+
/** 从列配置中查找指定索引的列 */
|
|
27
|
+
private findColumnConfig;
|
|
28
|
+
/** 绘制 footer */
|
|
29
|
+
draw(): void;
|
|
30
|
+
/** 绘制单个 footer 单元格 */
|
|
31
|
+
private drawFooterCell;
|
|
32
|
+
/** 绘制 "数据统计" 提示文字 */
|
|
33
|
+
private drawHintText;
|
|
34
|
+
/** 绘制下拉箭头图标 */
|
|
35
|
+
private drawArrowIcon;
|
|
36
|
+
}
|
|
37
|
+
export default Footer;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GIF 动画管理器
|
|
3
|
+
* 使用 gifuct-js 解析 GIF 并逐帧绘制
|
|
4
|
+
*/
|
|
5
|
+
export default class GifAnimationManager {
|
|
6
|
+
private static instance;
|
|
7
|
+
private gifs;
|
|
8
|
+
private animationFrameId;
|
|
9
|
+
private isAnimating;
|
|
10
|
+
private enabled;
|
|
11
|
+
private constructor();
|
|
12
|
+
static getInstance(): GifAnimationManager;
|
|
13
|
+
/**
|
|
14
|
+
* 加载并解析 GIF
|
|
15
|
+
*/
|
|
16
|
+
loadGif(url: string): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* 渲染指定帧
|
|
19
|
+
*/
|
|
20
|
+
private renderFrame;
|
|
21
|
+
/**
|
|
22
|
+
* 启动动画循环
|
|
23
|
+
*/
|
|
24
|
+
private startAnimation;
|
|
25
|
+
/**
|
|
26
|
+
* 动画循环
|
|
27
|
+
*/
|
|
28
|
+
private animate;
|
|
29
|
+
/**
|
|
30
|
+
* 停止动画循环
|
|
31
|
+
*/
|
|
32
|
+
stopAnimation(): void;
|
|
33
|
+
/**
|
|
34
|
+
* 获取 GIF 的当前帧 Canvas
|
|
35
|
+
*/
|
|
36
|
+
getGifCanvas(url: string): HTMLCanvasElement | null;
|
|
37
|
+
/**
|
|
38
|
+
* 检查 GIF 是否已加载
|
|
39
|
+
*/
|
|
40
|
+
isGifLoaded(url: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 卸载 GIF
|
|
43
|
+
*/
|
|
44
|
+
unloadGif(url: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* 清空所有 GIF
|
|
47
|
+
*/
|
|
48
|
+
clear(): void;
|
|
49
|
+
/**
|
|
50
|
+
* 获取已加载的 GIF 数量
|
|
51
|
+
*/
|
|
52
|
+
getLoadedGifCount(): number;
|
|
53
|
+
/**
|
|
54
|
+
* 暂停所有 GIF 动画
|
|
55
|
+
*/
|
|
56
|
+
pause(): void;
|
|
57
|
+
/**
|
|
58
|
+
* 恢复所有 GIF 动画
|
|
59
|
+
*/
|
|
60
|
+
resume(): void;
|
|
61
|
+
/**
|
|
62
|
+
* 切换 GIF 动画播放状态
|
|
63
|
+
*/
|
|
64
|
+
toggle(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 获取当前播放状态
|
|
67
|
+
*/
|
|
68
|
+
isEnabled(): boolean;
|
|
69
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type DataGrid from "./DataGrid";
|
|
2
|
+
interface GifElement {
|
|
3
|
+
url: string;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export default class GifOverlay {
|
|
10
|
+
private grid;
|
|
11
|
+
private container;
|
|
12
|
+
private gifElements;
|
|
13
|
+
private imageManager;
|
|
14
|
+
constructor(grid: DataGrid);
|
|
15
|
+
/**
|
|
16
|
+
* 获取容器元素
|
|
17
|
+
*/
|
|
18
|
+
get el(): HTMLDivElement;
|
|
19
|
+
/**
|
|
20
|
+
* 更新GIF显示
|
|
21
|
+
* @param gifs GIF元素数组
|
|
22
|
+
*/
|
|
23
|
+
update(gifs: GifElement[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* 清空所有GIF
|
|
26
|
+
*/
|
|
27
|
+
clear(): void;
|
|
28
|
+
/**
|
|
29
|
+
* 销�?
|
|
30
|
+
*/
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GroupRow - Special row type for grouped table rendering
|
|
3
|
+
* Handles rendering of group header rows and separator rows
|
|
4
|
+
*/
|
|
5
|
+
import Context from './Context';
|
|
6
|
+
import type DataGrid from './DataGrid';
|
|
7
|
+
import { type GroupedTableRowData } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* GroupRow class for rendering group headers and separators
|
|
10
|
+
*/
|
|
11
|
+
declare class GroupRow extends Context {
|
|
12
|
+
data: GroupedTableRowData;
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
_rowId: string;
|
|
15
|
+
isGroupHeader: boolean;
|
|
16
|
+
isSeparator: boolean;
|
|
17
|
+
constructor(grid: DataGrid, rowIndex: number, x: number, y: number, height: number, data: GroupedTableRowData);
|
|
18
|
+
/**
|
|
19
|
+
* Draw the group row
|
|
20
|
+
*/
|
|
21
|
+
draw(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Draw group header row
|
|
24
|
+
*/
|
|
25
|
+
private drawGroupHeader;
|
|
26
|
+
/**
|
|
27
|
+
* Draw expand/collapse arrow
|
|
28
|
+
*/
|
|
29
|
+
private drawExpandArrow;
|
|
30
|
+
/**
|
|
31
|
+
* Draw group name (supports string or array)
|
|
32
|
+
*/
|
|
33
|
+
private drawGroupName;
|
|
34
|
+
/**
|
|
35
|
+
* Draw count badge
|
|
36
|
+
*/
|
|
37
|
+
private drawCountBadge;
|
|
38
|
+
/**
|
|
39
|
+
* Draw separator row
|
|
40
|
+
*/
|
|
41
|
+
private drawSeparator;
|
|
42
|
+
/**
|
|
43
|
+
* Check if point is inside the expand arrow area
|
|
44
|
+
*/
|
|
45
|
+
isInsideExpandArrow(mouseX: number, mouseY: number): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Check if this row is visible in the viewport
|
|
48
|
+
*/
|
|
49
|
+
isVerticalVisibleOnBody(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Check if mouse is inside vertical body boundary
|
|
52
|
+
*/
|
|
53
|
+
isInsideVerticaBodyBoundary(mouseX: number, mouseY: number): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Handle click on group row
|
|
56
|
+
*/
|
|
57
|
+
handleClick(mouseX: number, mouseY: number): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Placeholder methods for compatibility with Row interface
|
|
60
|
+
*/
|
|
61
|
+
rePaint(): void;
|
|
62
|
+
resizeColumn(_colIndex: number, _diffWidth: number): void;
|
|
63
|
+
checked: boolean;
|
|
64
|
+
handleCheck(_checked?: boolean): void;
|
|
65
|
+
isInVerticalAutofill(_mouseX: number, _mouseY: number): boolean;
|
|
66
|
+
handleAutofill(_x: number, _y: number): void;
|
|
67
|
+
handleStartAutofill(_x: number, _y: number): void;
|
|
68
|
+
isInsideVerticaTableBoundary(mouseX: number, mouseY: number): boolean;
|
|
69
|
+
mouseMove(_x: number, _y: number): void;
|
|
70
|
+
mouseDown(_x: number, _y: number): void;
|
|
71
|
+
click(x: number, y: number): void;
|
|
72
|
+
dbClick(_x: number, _y: number): void;
|
|
73
|
+
rowHeader: {
|
|
74
|
+
handleCheck: (_val: boolean) => void;
|
|
75
|
+
};
|
|
76
|
+
allCells: any[];
|
|
77
|
+
cells: any[];
|
|
78
|
+
fixedCells: any[];
|
|
79
|
+
}
|
|
80
|
+
export default GroupRow;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Context from "./Context";
|
|
2
|
+
import ColumnHeader from "./ColumnHeader";
|
|
3
|
+
import type DataGrid from "./DataGrid";
|
|
4
|
+
interface CheckOption {
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare class Header extends Context {
|
|
9
|
+
checked: boolean;
|
|
10
|
+
indeterminate: boolean;
|
|
11
|
+
allColumnHeaders: ColumnHeader[];
|
|
12
|
+
fixedColumnHeaders: ColumnHeader[];
|
|
13
|
+
columnHeaders: ColumnHeader[];
|
|
14
|
+
resizeTarget: ColumnHeader | null;
|
|
15
|
+
resizeOriginalX: number;
|
|
16
|
+
resizeOriginalWidth: number;
|
|
17
|
+
isResizing: boolean;
|
|
18
|
+
constructor(grid: DataGrid, x: number, y: number);
|
|
19
|
+
paint(): void;
|
|
20
|
+
mouseDown(x: number, y: number, e?: {
|
|
21
|
+
ctrlKey?: boolean;
|
|
22
|
+
metaKey?: boolean;
|
|
23
|
+
shiftKey?: boolean;
|
|
24
|
+
}): void;
|
|
25
|
+
resizing(x: number, _y: number): void;
|
|
26
|
+
endResize(): void;
|
|
27
|
+
/**
|
|
28
|
+
* 根据鼠标X坐标和Y坐标查找对应的列头
|
|
29
|
+
* 支持嵌套子列:如果鼠标在子表头行,返回子表头;否则返回父表头或普通列
|
|
30
|
+
* @param mouseX 鼠标X坐标
|
|
31
|
+
* @param mouseY 可选的鼠标Y坐标,用于精确匹配嵌套子列行
|
|
32
|
+
* @param topLevelOnly 是否只返回顶层列头(普通列和嵌套父列),用于跨列拖拽
|
|
33
|
+
*/
|
|
34
|
+
getColAtPosition(mouseX: number, mouseY?: number, topLevelOnly?: boolean): ColumnHeader | null;
|
|
35
|
+
handleCheck(opt?: CheckOption): void;
|
|
36
|
+
resizeColumn(colIndex: number, diffWidth: number): void;
|
|
37
|
+
resizeAllColumn(fellWidth: number): void;
|
|
38
|
+
draw(): void;
|
|
39
|
+
}
|
|
40
|
+
export default Header;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 数据历史堆栈
|
|
3
|
+
*/
|
|
4
|
+
import type DataGrid from "./DataGrid";
|
|
5
|
+
interface HistoryData {
|
|
6
|
+
before: {
|
|
7
|
+
colIndex: number;
|
|
8
|
+
rowIndex: number;
|
|
9
|
+
value: any;
|
|
10
|
+
};
|
|
11
|
+
after: {
|
|
12
|
+
colIndex: number;
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
value: any;
|
|
15
|
+
};
|
|
16
|
+
type: "single" | "multiple";
|
|
17
|
+
}
|
|
18
|
+
declare class Histories {
|
|
19
|
+
grid: DataGrid;
|
|
20
|
+
history: HistoryData[];
|
|
21
|
+
historyIndex: number;
|
|
22
|
+
constructor(grid: DataGrid);
|
|
23
|
+
pushState(data: HistoryData): void;
|
|
24
|
+
backState(): void;
|
|
25
|
+
forwardState(): void;
|
|
26
|
+
}
|
|
27
|
+
export default Histories;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import GifAnimationManager from './GifAnimationManager';
|
|
2
|
+
/**
|
|
3
|
+
* Image Manager - 管理图片加载和缓存
|
|
4
|
+
*/
|
|
5
|
+
declare class ImageManager {
|
|
6
|
+
private static instance;
|
|
7
|
+
private imageCache;
|
|
8
|
+
private loadingImages;
|
|
9
|
+
private gifImages;
|
|
10
|
+
private gifAnimationManager;
|
|
11
|
+
private redrawCallbacks;
|
|
12
|
+
private editIcon;
|
|
13
|
+
private constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Load edit icon
|
|
16
|
+
*/
|
|
17
|
+
private loadEditIcon;
|
|
18
|
+
/**
|
|
19
|
+
* Get edit icon
|
|
20
|
+
* @returns HTMLImageElement or null if not loaded
|
|
21
|
+
*/
|
|
22
|
+
getEditIcon(): HTMLImageElement | null;
|
|
23
|
+
static getInstance(): ImageManager;
|
|
24
|
+
/**
|
|
25
|
+
* Load image with caching
|
|
26
|
+
* @param src Image source URL
|
|
27
|
+
* @returns Promise that resolves to HTMLImageElement
|
|
28
|
+
*/
|
|
29
|
+
loadImage(src: string): Promise<HTMLImageElement>;
|
|
30
|
+
/**
|
|
31
|
+
* Get cached image synchronously
|
|
32
|
+
* @param src Image source URL
|
|
33
|
+
* @returns HTMLImageElement or null if not cached
|
|
34
|
+
*/
|
|
35
|
+
getCachedImage(src: string): HTMLImageElement | null;
|
|
36
|
+
/**
|
|
37
|
+
* Check if image is cached
|
|
38
|
+
* @param src Image source URL
|
|
39
|
+
* @returns true if image is cached
|
|
40
|
+
*/
|
|
41
|
+
isCached(src: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Clear all cached images
|
|
44
|
+
*/
|
|
45
|
+
clearCache(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Remove specific image from cache
|
|
48
|
+
* @param src Image source URL
|
|
49
|
+
*/
|
|
50
|
+
removeFromCache(src: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Check if image is GIF format
|
|
53
|
+
* @param src Image source URL
|
|
54
|
+
* @returns true if image is GIF
|
|
55
|
+
*/
|
|
56
|
+
private isGif;
|
|
57
|
+
/**
|
|
58
|
+
* Get GIF canvas for drawing
|
|
59
|
+
* @param src Image source URL
|
|
60
|
+
* @returns Canvas element with current GIF frame or null
|
|
61
|
+
*/
|
|
62
|
+
getGifCanvas(src: string): HTMLCanvasElement | null;
|
|
63
|
+
/**
|
|
64
|
+
* Check if image is animated GIF
|
|
65
|
+
* @param src Image source URL
|
|
66
|
+
* @returns true if image is GIF
|
|
67
|
+
*/
|
|
68
|
+
isAnimatedImage(src: string): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Check if there are any GIF images loaded
|
|
71
|
+
* @returns true if there are GIF images
|
|
72
|
+
*/
|
|
73
|
+
hasGifImages(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Register a callback to be called when GIF frames update
|
|
76
|
+
* @param callback Function to call on animation frame
|
|
77
|
+
*/
|
|
78
|
+
onAnimationFrame(callback: () => void): void;
|
|
79
|
+
/**
|
|
80
|
+
* Unregister animation frame callback
|
|
81
|
+
* @param callback Function to remove
|
|
82
|
+
*/
|
|
83
|
+
offAnimationFrame(callback: () => void): void;
|
|
84
|
+
/**
|
|
85
|
+
* Trigger redraw callbacks
|
|
86
|
+
*/
|
|
87
|
+
private triggerRedraw;
|
|
88
|
+
/**
|
|
89
|
+
* Get GIF animation manager instance
|
|
90
|
+
* @returns GifAnimationManager instance
|
|
91
|
+
*/
|
|
92
|
+
getGifManager(): GifAnimationManager;
|
|
93
|
+
}
|
|
94
|
+
export default ImageManager;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NestedGrid - 嵌套表格类
|
|
3
|
+
* 用于在单元格内渲染子表格
|
|
4
|
+
*/
|
|
5
|
+
import type DataGrid from "./DataGrid";
|
|
6
|
+
import Paint from "./Paint";
|
|
7
|
+
interface NestedColumn {
|
|
8
|
+
title: string;
|
|
9
|
+
key: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
align?: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
options?: any[];
|
|
14
|
+
}
|
|
15
|
+
interface NestedData {
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
interface NestedGridOptions {
|
|
19
|
+
columns: NestedColumn[];
|
|
20
|
+
data: NestedData[];
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
parentGrid: DataGrid;
|
|
26
|
+
parentCell: any;
|
|
27
|
+
displayRows?: number;
|
|
28
|
+
}
|
|
29
|
+
declare class NestedGrid {
|
|
30
|
+
columns: NestedColumn[];
|
|
31
|
+
data: NestedData[];
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
parentGrid: DataGrid;
|
|
37
|
+
parentCell: any;
|
|
38
|
+
painter: Paint;
|
|
39
|
+
rowHeight: number;
|
|
40
|
+
scrollY: number;
|
|
41
|
+
hoveredCell: {
|
|
42
|
+
col: number;
|
|
43
|
+
row: number;
|
|
44
|
+
} | null;
|
|
45
|
+
hoverRowIndex: number;
|
|
46
|
+
selectedCell: {
|
|
47
|
+
col: number;
|
|
48
|
+
row: number;
|
|
49
|
+
} | null;
|
|
50
|
+
editingCell: {
|
|
51
|
+
col: number;
|
|
52
|
+
row: number;
|
|
53
|
+
} | null;
|
|
54
|
+
displayRows?: number;
|
|
55
|
+
expanded: boolean;
|
|
56
|
+
expandButtonHeight: number;
|
|
57
|
+
expandButtonHovered: boolean;
|
|
58
|
+
private redrawScheduled;
|
|
59
|
+
private redrawTimer;
|
|
60
|
+
private offscreenCanvas;
|
|
61
|
+
private offscreenCtx;
|
|
62
|
+
private cacheValid;
|
|
63
|
+
private lastDataHash;
|
|
64
|
+
progressDrag: {
|
|
65
|
+
isDragging: boolean;
|
|
66
|
+
cell: {
|
|
67
|
+
col: number;
|
|
68
|
+
row: number;
|
|
69
|
+
} | null;
|
|
70
|
+
startValue: number;
|
|
71
|
+
currentValue: number;
|
|
72
|
+
};
|
|
73
|
+
constructor(options: NestedGridOptions);
|
|
74
|
+
getColumnWidth(index: number): number;
|
|
75
|
+
getCellBounds(colIndex: number, rowIndex: number): {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
};
|
|
81
|
+
getRequiredHeight(): number;
|
|
82
|
+
getVisibleRowCount(): number;
|
|
83
|
+
needExpandButton(): boolean;
|
|
84
|
+
isMouseInsideAbsolute(mouseX: number, mouseY: number): boolean;
|
|
85
|
+
isMouseInside(mouseX: number, mouseY: number): boolean;
|
|
86
|
+
isMouseOnExpandButton(mouseX: number, mouseY: number): boolean;
|
|
87
|
+
getCellAtPosition(mouseX: number, mouseY: number): {
|
|
88
|
+
col: number;
|
|
89
|
+
row: number;
|
|
90
|
+
} | null;
|
|
91
|
+
handleMouseMove(mouseX: number, mouseY: number): boolean;
|
|
92
|
+
private isProgressCell;
|
|
93
|
+
private isMouseOnProgressBar;
|
|
94
|
+
handleMouseDown(mouseX: number, mouseY: number): boolean;
|
|
95
|
+
private handleProgressDragMove;
|
|
96
|
+
handleMouseUp(_mouseX: number, _mouseY: number): boolean;
|
|
97
|
+
isMouseOnEditIcon(mouseX: number, mouseY: number, cell: {
|
|
98
|
+
col: number;
|
|
99
|
+
row: number;
|
|
100
|
+
}): boolean;
|
|
101
|
+
isCellEditable(colIndex: number): boolean;
|
|
102
|
+
getSelectLabel(colIndex: number, value: any): string;
|
|
103
|
+
/**
|
|
104
|
+
* 处理点击事件,返回点击信息
|
|
105
|
+
* @param mouseX 鼠标相对于嵌套表格的 X 坐标
|
|
106
|
+
* @param mouseY 鼠标相对于嵌套表格的 Y 坐标
|
|
107
|
+
* @returns 点击信息对象,如果没有点击到有效区域则返回 null
|
|
108
|
+
*/
|
|
109
|
+
handleClick(mouseX: number, mouseY: number): {
|
|
110
|
+
type: 'expand' | 'cell' | 'editIcon' | 'booleanToggle';
|
|
111
|
+
cell?: {
|
|
112
|
+
row: number;
|
|
113
|
+
col: number;
|
|
114
|
+
};
|
|
115
|
+
needsRedraw?: boolean;
|
|
116
|
+
} | null;
|
|
117
|
+
/**
|
|
118
|
+
* Check if mouse is on the boolean checkbox area within a cell
|
|
119
|
+
*/
|
|
120
|
+
private isMouseOnBooleanCheckbox;
|
|
121
|
+
/**
|
|
122
|
+
* 获取单元格的编辑信息
|
|
123
|
+
* @param colIndex 列索引
|
|
124
|
+
* @param rowIndex 行索引
|
|
125
|
+
* @returns 单元格编辑信息
|
|
126
|
+
*/
|
|
127
|
+
getCellEditInfo(colIndex: number, rowIndex: number): {
|
|
128
|
+
bounds: {
|
|
129
|
+
x: number;
|
|
130
|
+
y: number;
|
|
131
|
+
width: number;
|
|
132
|
+
height: number;
|
|
133
|
+
};
|
|
134
|
+
column: NestedColumn;
|
|
135
|
+
value: any;
|
|
136
|
+
displayValue: string;
|
|
137
|
+
rowData: NestedData;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* 启动编辑(已废弃,编辑器启动逻辑已移至 Events.ts)
|
|
141
|
+
* 保留此方法是为了兼容性
|
|
142
|
+
*/
|
|
143
|
+
startEdit(colIndex: number, rowIndex: number): void;
|
|
144
|
+
updateParentRowHeight(): void;
|
|
145
|
+
updateRowHeight(newRowHeight: number): void;
|
|
146
|
+
finishEdit(value: any): void;
|
|
147
|
+
cancelEdit(): void;
|
|
148
|
+
draw(): void;
|
|
149
|
+
clearOtherNestedGridsSelection(): void;
|
|
150
|
+
/**
|
|
151
|
+
* 性能优化:确保离屏 Canvas 存在且尺寸正确
|
|
152
|
+
*/
|
|
153
|
+
private ensureOffscreenCanvas;
|
|
154
|
+
/**
|
|
155
|
+
* 性能优化:计算数据哈希,用于检测数据变化
|
|
156
|
+
* 使用简化的哈希方法,避免深度比较的性能开销
|
|
157
|
+
*/
|
|
158
|
+
private computeDataHash;
|
|
159
|
+
/**
|
|
160
|
+
* 使缓存失效(数据变化时调用)
|
|
161
|
+
*/
|
|
162
|
+
invalidateCache(): void;
|
|
163
|
+
private getDisplayValue;
|
|
164
|
+
private drawPersonCell;
|
|
165
|
+
private drawStatusCell;
|
|
166
|
+
private drawProgressCell;
|
|
167
|
+
private drawDatetimeCell;
|
|
168
|
+
private drawBooleanCell;
|
|
169
|
+
private drawPlaceholderText;
|
|
170
|
+
private drawRoundedRect;
|
|
171
|
+
private truncateText;
|
|
172
|
+
private getPersonInitial;
|
|
173
|
+
private hashString;
|
|
174
|
+
private scheduleRedraw;
|
|
175
|
+
updatePosition(x: number, y: number): void;
|
|
176
|
+
}
|
|
177
|
+
export default NestedGrid;
|