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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canvas-table - High-performance canvas-based table/grid component for Vue 3
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { default as DataGrid } from './components/index.vue';
|
|
7
|
+
export type { CellData, CellStyle, RowData, ColData, DataGridOptions, Position, Size, Rect, Range, CellRange, HistoryItem, ValidatorRule, ColumnType, ColumnConfig, SelectorState, EditorState, AutofillState, RangeState, DrawOptions, TextOptions, ClipboardState, EventHandlers, Direction, ScrollDirection, GroupLevel, SeparateLevel, BaseGroupedRowData, GroupRowData, SeparateRowData, NormalRowData, GroupedTableRowData, GroupRowStyle, SeparatorRowStyle, StatisticOption, FooterCellData, FooterData, FooterCellClickInfo, } from './core/types';
|
|
8
|
+
export { isGroupRow, isSeparateRow, isNormalRow, GROUP_TABLE_CONSTANTS, DEFAULT_GROUP_STYLES, DEFAULT_SEPARATOR_STYLES, } from './core/types';
|
|
9
|
+
export type { CellBounds, ViewerRenderContext, ViewerDragState, CellViewer, CellViewerData, ViewerOption, ViewerStyle, TextViewerData, SelectViewerData, ImageViewerData, PersonViewerData, PersonInfo, ProgressViewerData, DatetimeViewerData, BooleanViewerData, StatusViewerData, StatusOption, GroupHeaderViewerData, SeparatorRowViewerData, PunchViewerData, PunchValue, ModuleInfo, ModuleViewerData, TextViewerWithSwitcherData, FileItem, FileViewerData, HyperlinkTextViewerData, IUpstreamModule, IUpstreamReminderProperties, IUpstreamSyncProperty, IUpstreamFieldViewItem, UpstreamViewerData, TaskNodeItem, TaskNodeViewerData, NestedGridViewerData, NestedColumnConfig, ViewerConstructor, ViewerFactory, ViewerTypeMap, ViewerType, TypedCellData, TableActionButtonOption, TableActionButtonViewerData, } from './core/viewers/types';
|
|
10
|
+
export { isTextViewerData, isSelectViewerData, isPersonViewerData, isProgressViewerData, isNestedGridViewerData, } from './core/viewers/types';
|
|
11
|
+
export { default as ViewerRegistry, getViewerRegistry, } from './core/viewers/ViewerRegistry';
|
|
12
|
+
export { registerDefaultViewers, defaultViewers } from './core/viewers/index';
|
|
13
|
+
export { default as TextViewer } from './core/viewers/TextViewer';
|
|
14
|
+
export { default as SelectViewer } from './core/viewers/SelectViewer';
|
|
15
|
+
export { default as ImageViewer } from './core/viewers/ImageViewer';
|
|
16
|
+
export { default as PersonViewer } from './core/viewers/PersonViewer';
|
|
17
|
+
export { default as ProgressViewer } from './core/viewers/ProgressViewer';
|
|
18
|
+
export { default as DatetimeViewer } from './core/viewers/DatetimeViewer';
|
|
19
|
+
export { default as BooleanViewer } from './core/viewers/BooleanViewer';
|
|
20
|
+
export { default as StatusViewer } from './core/viewers/StatusViewer';
|
|
21
|
+
export { default as GroupHeaderViewer } from './core/viewers/GroupHeaderViewer';
|
|
22
|
+
export { default as SeparatorRowViewer } from './core/viewers/SeparatorRowViewer';
|
|
23
|
+
export { default as NestedGridViewer } from './core/viewers/NestedGridViewer';
|
|
24
|
+
export { default as PunchViewer } from './core/viewers/PunchViewer';
|
|
25
|
+
export { default as HyperlinkTextViewer } from './core/viewers/HyperlinkTextViewer';
|
|
26
|
+
export { default as FileViewer } from './core/viewers/FileViewer';
|
|
27
|
+
export { default as TaskNodeViewer } from './core/viewers/TaskNodeViewer';
|
|
28
|
+
export { default as ModuleViewer } from './core/viewers/ModuleViewer';
|
|
29
|
+
export { default as TextViewerWithSwitcher } from './core/viewers/TextViewerWithSwitcher';
|
|
30
|
+
export { default as UpstreamViewer } from './core/viewers/UpstreamViewer';
|
|
31
|
+
export { TableActionButtonViewer } from './core/viewers/TableActionButtonViewer';
|
|
32
|
+
export type { HeaderConfig } from './core/util';
|
|
33
|
+
export { toLeaf, getMaxRow, calCrossSpan, getIcon, getIconByFileStatus, } from './core/util';
|
|
34
|
+
export type { LogLevel, PerformanceMonitorConfig, } from './core/PerformanceMonitor';
|
|
35
|
+
export { PerformanceMonitor, getPerformanceMonitor, } from './core/PerformanceMonitor';
|
|
36
|
+
export { CSS_PREFIX, HEADER_HEIGHT, ROW_INDEX_WIDTH, CHECK_BOX_WIDTH, CELL_HEIGHT, MIN_CELL_WIDTH, MIN_CELL_HEIGHT, SCROLLER_TRACK_SIZE, SCROLLER_SIZE, SCROLLER_COLOR, SCROLLER_FOCUS_COLOR, SELECT_BORDER_COLOR, SELECT_AREA_COLOR, SELECT_BG_COLOR, READONLY_COLOR, READONLY_TEXT_COLOR, ERROR_TIP_COLOR, EMPTY_VALUE, DATE_DISPLAY_TYPE, SIZE_MAP, VALIDATOR_TYPES, FILE_TYPE_FIELDS, FOOTER_HEIGHT, } from './core/constants';
|
|
37
|
+
export { getFieldStatisticTypes } from './core/footer/utils';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type DataGrid from '../core/DataGrid';
|
|
2
|
+
import type { TableSnapshot, SnapshotCompareResult } from './TestHooks';
|
|
3
|
+
/**
|
|
4
|
+
* Manages table state snapshots for regression testing.
|
|
5
|
+
* Snapshots capture the complete visual state of the table
|
|
6
|
+
* (visible cells, column configs, scroll position, dimensions)
|
|
7
|
+
* and can be compared against the current state to detect layout regressions.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SnapshotManager {
|
|
10
|
+
private grid;
|
|
11
|
+
private snapshots;
|
|
12
|
+
constructor(grid: DataGrid);
|
|
13
|
+
/**
|
|
14
|
+
* Create a snapshot of the current table state.
|
|
15
|
+
* @param name - Unique snapshot identifier
|
|
16
|
+
* @returns The created TableSnapshot
|
|
17
|
+
*/
|
|
18
|
+
createSnapshot(name: string): TableSnapshot;
|
|
19
|
+
/**
|
|
20
|
+
* Compare the current table state against a previously saved snapshot.
|
|
21
|
+
* @param name - Snapshot name to compare against
|
|
22
|
+
* @param tolerance - Pixel tolerance for coordinate comparisons (default: 1)
|
|
23
|
+
* @returns SnapshotCompareResult with list of differences
|
|
24
|
+
*/
|
|
25
|
+
compareSnapshot(name: string, tolerance?: number): SnapshotCompareResult;
|
|
26
|
+
/**
|
|
27
|
+
* Get a previously saved snapshot by name.
|
|
28
|
+
* @param name - Snapshot identifier
|
|
29
|
+
* @returns Deep copy of the snapshot or null
|
|
30
|
+
*/
|
|
31
|
+
getSnapshot(name: string): TableSnapshot | null;
|
|
32
|
+
/**
|
|
33
|
+
* Export a snapshot as a JSON string for saving to a file.
|
|
34
|
+
* @param name - Snapshot identifier
|
|
35
|
+
* @returns JSON string or null if not found
|
|
36
|
+
*/
|
|
37
|
+
exportSnapshot(name: string): string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Import a snapshot from a JSON string.
|
|
40
|
+
* @param json - JSON string representing a TableSnapshot
|
|
41
|
+
*/
|
|
42
|
+
importSnapshot(json: string): void;
|
|
43
|
+
private captureVisibleCells;
|
|
44
|
+
private captureColumnConfigs;
|
|
45
|
+
private captureScrollPosition;
|
|
46
|
+
private captureDimensions;
|
|
47
|
+
private compareDimensions;
|
|
48
|
+
private compareScrollPosition;
|
|
49
|
+
private compareColumns;
|
|
50
|
+
private compareVisibleCells;
|
|
51
|
+
/**
|
|
52
|
+
* Check if two numeric values are within a given tolerance.
|
|
53
|
+
*/
|
|
54
|
+
private isWithinTolerance;
|
|
55
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout information for a single cell
|
|
3
|
+
*/
|
|
4
|
+
export interface CellLayout {
|
|
5
|
+
/** Cell left-edge X coordinate (relative to canvas) */
|
|
6
|
+
x: number;
|
|
7
|
+
/** Cell top-edge Y coordinate (relative to canvas) */
|
|
8
|
+
y: number;
|
|
9
|
+
/** Cell width in pixels */
|
|
10
|
+
width: number;
|
|
11
|
+
/** Cell height in pixels */
|
|
12
|
+
height: number;
|
|
13
|
+
/** Whether the cell is within the visible viewport */
|
|
14
|
+
visible: boolean;
|
|
15
|
+
/** Column key */
|
|
16
|
+
columnKey: string;
|
|
17
|
+
/** Row ID (number for normal/viewer mode, string for grouped mode) */
|
|
18
|
+
rowId: string | number;
|
|
19
|
+
/** Column index */
|
|
20
|
+
colIndex: number;
|
|
21
|
+
/** Row index */
|
|
22
|
+
rowIndex: number;
|
|
23
|
+
/** Whether this is a fixed column ('left' | 'right' | '') */
|
|
24
|
+
fixed: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A visible cell in the viewport with its layout info
|
|
28
|
+
*/
|
|
29
|
+
export interface VisibleCell extends CellLayout {
|
|
30
|
+
/** Cell display value */
|
|
31
|
+
value: any;
|
|
32
|
+
/** Cell display label (for select-type columns, etc.) */
|
|
33
|
+
label: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Column configuration exposed to tests
|
|
37
|
+
*/
|
|
38
|
+
export interface TestColumnConfig {
|
|
39
|
+
/** Column unique key */
|
|
40
|
+
key: string;
|
|
41
|
+
/** Column display title */
|
|
42
|
+
title: string;
|
|
43
|
+
/** Column width in pixels */
|
|
44
|
+
width: number;
|
|
45
|
+
/** Whether this column is fixed ('left' | 'right' | '') */
|
|
46
|
+
fixed: string;
|
|
47
|
+
/** Whether this column is visible on screen */
|
|
48
|
+
visible: boolean;
|
|
49
|
+
/** Column index in the header */
|
|
50
|
+
index: number;
|
|
51
|
+
/** Column level (0 = top-level, 1 = nested child) */
|
|
52
|
+
level: number;
|
|
53
|
+
/** Column type */
|
|
54
|
+
type: string;
|
|
55
|
+
/** Nested child columns (if this is a parent column with nested sub-columns) */
|
|
56
|
+
children: TestColumnConfig[] | null;
|
|
57
|
+
/** Number of columns this header spans */
|
|
58
|
+
colspan: number;
|
|
59
|
+
/** Number of rows this header spans */
|
|
60
|
+
rowspan: number;
|
|
61
|
+
/** Parent column key (for nested child columns) */
|
|
62
|
+
parentKey: string | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Current scroll position of the table
|
|
66
|
+
*/
|
|
67
|
+
export interface ScrollPosition {
|
|
68
|
+
/** Horizontal scroll offset (negative value, 0 = no scroll) */
|
|
69
|
+
scrollX: number;
|
|
70
|
+
/** Vertical scroll offset (negative value, 0 = no scroll) */
|
|
71
|
+
scrollY: number;
|
|
72
|
+
/** Maximum horizontal scroll distance */
|
|
73
|
+
maxScrollX: number;
|
|
74
|
+
/** Maximum vertical scroll distance */
|
|
75
|
+
maxScrollY: number;
|
|
76
|
+
/** Whether a horizontal scrollbar is present */
|
|
77
|
+
hasHorizontalScrollbar: boolean;
|
|
78
|
+
/** Whether a vertical scrollbar is present */
|
|
79
|
+
hasVerticalScrollbar: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Overall table dimension information
|
|
83
|
+
*/
|
|
84
|
+
export interface TableDimensions {
|
|
85
|
+
/** Container (canvas) width in pixels */
|
|
86
|
+
containerWidth: number;
|
|
87
|
+
/** Container (canvas) height in pixels */
|
|
88
|
+
containerHeight: number;
|
|
89
|
+
/** Total table content width (sum of all column widths) */
|
|
90
|
+
tableWidth: number;
|
|
91
|
+
/** Total table content height (sum of all row heights) */
|
|
92
|
+
tableHeight: number;
|
|
93
|
+
/** Header area height in pixels */
|
|
94
|
+
headerHeight: number;
|
|
95
|
+
/** Default row height in pixels */
|
|
96
|
+
rowHeight: number;
|
|
97
|
+
/** Fixed left columns total width */
|
|
98
|
+
fixedLeftWidth: number;
|
|
99
|
+
/** Fixed right columns total width */
|
|
100
|
+
fixedRightWidth: number;
|
|
101
|
+
/** Total number of data rows */
|
|
102
|
+
totalRows: number;
|
|
103
|
+
/** Total number of leaf columns */
|
|
104
|
+
totalColumns: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A single difference found during snapshot comparison
|
|
108
|
+
*/
|
|
109
|
+
export interface SnapshotDifference {
|
|
110
|
+
/** Difference category */
|
|
111
|
+
type: 'cellLayout' | 'columnConfig' | 'scroll' | 'dimensions';
|
|
112
|
+
/** JSON path to the differing value (e.g. "cells[0].x") */
|
|
113
|
+
path: string;
|
|
114
|
+
/** Expected value from the saved snapshot */
|
|
115
|
+
expected: any;
|
|
116
|
+
/** Actual current value */
|
|
117
|
+
actual: any;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Result of comparing the current state against a saved snapshot
|
|
121
|
+
*/
|
|
122
|
+
export interface SnapshotCompareResult {
|
|
123
|
+
/** Whether the current state matches the snapshot (within tolerance) */
|
|
124
|
+
isEqual: boolean;
|
|
125
|
+
/** List of differences found */
|
|
126
|
+
differences: SnapshotDifference[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* A complete table state snapshot
|
|
130
|
+
*/
|
|
131
|
+
export interface TableSnapshot {
|
|
132
|
+
/** Snapshot identifier */
|
|
133
|
+
name: string;
|
|
134
|
+
/** Timestamp when the snapshot was created */
|
|
135
|
+
timestamp: number;
|
|
136
|
+
/** All visible cells at the time of snapshot */
|
|
137
|
+
visibleCells: VisibleCell[];
|
|
138
|
+
/** All column configurations */
|
|
139
|
+
columns: TestColumnConfig[];
|
|
140
|
+
/** Scroll position */
|
|
141
|
+
scrollPosition: ScrollPosition;
|
|
142
|
+
/** Table dimensions */
|
|
143
|
+
dimensions: TableDimensions;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Per-column header vs body width comparison result
|
|
147
|
+
*/
|
|
148
|
+
export interface HeaderBodyWidthComparison {
|
|
149
|
+
colIndex: number;
|
|
150
|
+
columnKey: string;
|
|
151
|
+
headerWidth: number;
|
|
152
|
+
bodyCellWidth: number;
|
|
153
|
+
isNested: boolean;
|
|
154
|
+
match: boolean;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Main Test Hooks API exposed on window.__CANVAS_TABLE_TEST_HOOKS__
|
|
158
|
+
*
|
|
159
|
+
* All methods return deep copies of internal state to prevent
|
|
160
|
+
* accidental mutation from test code.
|
|
161
|
+
*/
|
|
162
|
+
export interface TestHooksAPI {
|
|
163
|
+
/**
|
|
164
|
+
* Get layout information for a specific cell.
|
|
165
|
+
* @param rowId - Row identifier (number for normal/viewer, string for grouped)
|
|
166
|
+
* @param columnKey - Column key string
|
|
167
|
+
* @returns CellLayout or null if the cell does not exist
|
|
168
|
+
*/
|
|
169
|
+
getCellLayout: (rowId: string | number, columnKey: string) => CellLayout | null;
|
|
170
|
+
/**
|
|
171
|
+
* Get all cells currently visible in the viewport.
|
|
172
|
+
* Only returns cells that are rendered by the virtual scroll engine.
|
|
173
|
+
* @returns Array of VisibleCell objects
|
|
174
|
+
*/
|
|
175
|
+
getAllVisibleCells: () => VisibleCell[];
|
|
176
|
+
/**
|
|
177
|
+
* Get configuration for a specific column.
|
|
178
|
+
* Supports both top-level and nested child columns.
|
|
179
|
+
* @param columnKey - Column key string
|
|
180
|
+
* @returns TestColumnConfig or null if column not found
|
|
181
|
+
*/
|
|
182
|
+
getColumnConfig: (columnKey: string) => TestColumnConfig | null;
|
|
183
|
+
/**
|
|
184
|
+
* Get data for a specific row.
|
|
185
|
+
* @param rowId - Row identifier
|
|
186
|
+
* @returns Row data object or null if not found
|
|
187
|
+
*/
|
|
188
|
+
getRowData: (rowId: string | number) => Record<string, any> | null;
|
|
189
|
+
/**
|
|
190
|
+
* Get the current scroll position.
|
|
191
|
+
* @returns ScrollPosition object
|
|
192
|
+
*/
|
|
193
|
+
getScrollPosition: () => ScrollPosition;
|
|
194
|
+
/**
|
|
195
|
+
* Get overall table dimensions.
|
|
196
|
+
* @returns TableDimensions object
|
|
197
|
+
*/
|
|
198
|
+
getTableDimensions: () => TableDimensions;
|
|
199
|
+
/**
|
|
200
|
+
* Create a snapshot of the current table state.
|
|
201
|
+
* @param name - Snapshot identifier
|
|
202
|
+
* @returns The created TableSnapshot
|
|
203
|
+
*/
|
|
204
|
+
createSnapshot: (name: string) => TableSnapshot;
|
|
205
|
+
/**
|
|
206
|
+
* Compare the current table state against a previously saved snapshot.
|
|
207
|
+
* @param name - Name of the snapshot to compare against
|
|
208
|
+
* @param tolerance - Pixel tolerance for coordinate comparisons (default: 1)
|
|
209
|
+
* @returns SnapshotCompareResult with differences
|
|
210
|
+
*/
|
|
211
|
+
compareSnapshot: (name: string, tolerance?: number) => SnapshotCompareResult;
|
|
212
|
+
/**
|
|
213
|
+
* Get a previously saved snapshot by name.
|
|
214
|
+
* @param name - Snapshot identifier
|
|
215
|
+
* @returns TableSnapshot or null if not found
|
|
216
|
+
*/
|
|
217
|
+
getSnapshot: (name: string) => TableSnapshot | null;
|
|
218
|
+
/**
|
|
219
|
+
* Export a snapshot as a JSON string (for saving to file).
|
|
220
|
+
* @param name - Snapshot identifier
|
|
221
|
+
* @returns JSON string or null if snapshot not found
|
|
222
|
+
*/
|
|
223
|
+
exportSnapshot: (name: string) => string | null;
|
|
224
|
+
/**
|
|
225
|
+
* Import a snapshot from a JSON string.
|
|
226
|
+
* @param json - JSON string of a TableSnapshot
|
|
227
|
+
*/
|
|
228
|
+
importSnapshot: (json: string) => void;
|
|
229
|
+
/**
|
|
230
|
+
* Compare header column widths with body cell widths.
|
|
231
|
+
* Detects header/body width mismatches, especially for nested columns.
|
|
232
|
+
* @returns Per-column comparison results
|
|
233
|
+
*/
|
|
234
|
+
getHeaderBodyWidthComparison: () => HeaderBodyWidthComparison[];
|
|
235
|
+
/**
|
|
236
|
+
* Get current selection range. (Phase 2)
|
|
237
|
+
*/
|
|
238
|
+
getSelectionRange?: () => {
|
|
239
|
+
startRow: number;
|
|
240
|
+
startCol: number;
|
|
241
|
+
endRow: number;
|
|
242
|
+
endCol: number;
|
|
243
|
+
} | null;
|
|
244
|
+
/**
|
|
245
|
+
* Get edit state for a specific cell. (Phase 2)
|
|
246
|
+
*/
|
|
247
|
+
getCellEditState?: (rowId: string | number, columnKey: string) => {
|
|
248
|
+
isEditing: boolean;
|
|
249
|
+
value: any;
|
|
250
|
+
} | null;
|
|
251
|
+
/**
|
|
252
|
+
* Get current drag operation state. (Phase 2)
|
|
253
|
+
*/
|
|
254
|
+
getDragState?: () => {
|
|
255
|
+
isDragging: boolean;
|
|
256
|
+
type: 'row' | 'column' | 'selection' | null;
|
|
257
|
+
sourceIds: string[];
|
|
258
|
+
targetId: string | null;
|
|
259
|
+
} | null;
|
|
260
|
+
/**
|
|
261
|
+
* Get cells that are currently in loading state. (Phase 2)
|
|
262
|
+
*/
|
|
263
|
+
getLoadingCells?: () => Array<{
|
|
264
|
+
rowId: string | number;
|
|
265
|
+
columnKey: string;
|
|
266
|
+
}>;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Global window augmentation for test hooks
|
|
270
|
+
*/
|
|
271
|
+
declare global {
|
|
272
|
+
interface Window {
|
|
273
|
+
__CANVAS_TABLE_TEST_HOOKS__?: TestHooksAPI;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { CellLayout, VisibleCell, TestColumnConfig, ScrollPosition, TableDimensions, SnapshotDifference, SnapshotCompareResult, TableSnapshot, TestHooksAPI, } from './TestHooks';
|
|
2
|
+
export { installTestHooks, removeTestHooks } from './installTestHooks';
|
|
3
|
+
export { SnapshotManager } from './SnapshotManager';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type DataGrid from '../core/DataGrid';
|
|
2
|
+
/**
|
|
3
|
+
* Install test hooks on window.__CANVAS_TABLE_TEST_HOOKS__
|
|
4
|
+
* This should be called after DataGrid is fully initialized.
|
|
5
|
+
*
|
|
6
|
+
* In production builds, this function is a no-op and can be
|
|
7
|
+
* tree-shaken by the bundler.
|
|
8
|
+
*
|
|
9
|
+
* @param grid - The DataGrid instance to expose hooks for
|
|
10
|
+
*/
|
|
11
|
+
export declare function installTestHooks(grid: DataGrid): void;
|
|
12
|
+
/**
|
|
13
|
+
* Remove test hooks from the global window object.
|
|
14
|
+
* Called when the DataGrid is destroyed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function removeTestHooks(): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "arthub-table",
|
|
3
|
+
"version": "0.0.3",
|
|
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
|
+
"main": "dist/arthub-table.common.js",
|
|
6
|
+
"module": "dist/arthub-table.umd.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"CHANGELOG.md"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": ""
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": ""
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"canvas",
|
|
24
|
+
"table",
|
|
25
|
+
"grid",
|
|
26
|
+
"spreadtable",
|
|
27
|
+
"vue",
|
|
28
|
+
"vue3",
|
|
29
|
+
"typescript",
|
|
30
|
+
"virtual-scroll",
|
|
31
|
+
"data-grid",
|
|
32
|
+
"cell-viewer"
|
|
33
|
+
],
|
|
34
|
+
"author": "",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=14.0.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": [
|
|
43
|
+
"*.css",
|
|
44
|
+
"*.scss",
|
|
45
|
+
"*.less",
|
|
46
|
+
"*.vue"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"serve": "vue-cli-service serve",
|
|
50
|
+
"build": "npm run build:lib && npm run build:types",
|
|
51
|
+
"build:lib": "vue-cli-service build --target lib --name arthub-table --dest dist src/index.ts",
|
|
52
|
+
"build:demo": "vue-cli-service build",
|
|
53
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
54
|
+
"build:analyze": "cross-env ANALYZE=true npm run build:lib",
|
|
55
|
+
"test:unit": "jest",
|
|
56
|
+
"test:watch": "jest --watch",
|
|
57
|
+
"test:coverage": "jest --coverage",
|
|
58
|
+
"test:changed": "jest --onlyChanged",
|
|
59
|
+
"test:e2e": "playwright test",
|
|
60
|
+
"test:e2e:chromium": "playwright test --project=chromium",
|
|
61
|
+
"test:e2e:headed": "playwright test --headed",
|
|
62
|
+
"test:e2e:report": "playwright show-report test-results/html-report",
|
|
63
|
+
"setup-husky": "node scripts/setup-husky.js",
|
|
64
|
+
"lint": "vue-cli-service lint",
|
|
65
|
+
"predeploy": "npm run build:demo",
|
|
66
|
+
"deploy": "gh-pages -d dist",
|
|
67
|
+
"prepare": "husky",
|
|
68
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
69
|
+
"version": "git add package.json",
|
|
70
|
+
"release": "bash build/release.sh"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"vue": "^3.0.0"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"axios": "^1.6.0",
|
|
77
|
+
"core-js": "^3.35.0",
|
|
78
|
+
"element-plus": "^2.4.4",
|
|
79
|
+
"gifuct-js": "^2.1.2",
|
|
80
|
+
"loadsh": "^0.0.4"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@playwright/test": "^1.58.2",
|
|
84
|
+
"@types/jest": "^29.5.11",
|
|
85
|
+
"@types/node": "^20.10.0",
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
87
|
+
"@typescript-eslint/parser": "^6.15.0",
|
|
88
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
89
|
+
"@vue/cli-plugin-babel": "~5.0.8",
|
|
90
|
+
"@vue/cli-plugin-eslint": "~5.0.8",
|
|
91
|
+
"@vue/cli-plugin-typescript": "~5.0.8",
|
|
92
|
+
"@vue/cli-plugin-unit-jest": "^5.0.9",
|
|
93
|
+
"@vue/cli-service": "~5.0.8",
|
|
94
|
+
"@vue/eslint-config-prettier": "^9.0.0",
|
|
95
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
96
|
+
"@vue/test-utils": "^2.4.3",
|
|
97
|
+
"chai": "^4.3.10",
|
|
98
|
+
"cross-env": "^7.0.3",
|
|
99
|
+
"eslint": "^8.56.0",
|
|
100
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
101
|
+
"eslint-plugin-vue": "^9.19.2",
|
|
102
|
+
"gh-pages": "^6.1.0",
|
|
103
|
+
"husky": "^9.1.7",
|
|
104
|
+
"jest": "^27.5.1",
|
|
105
|
+
"jest-environment-jsdom": "^27.5.1",
|
|
106
|
+
"lint-staged": "^15.2.0",
|
|
107
|
+
"prettier": "^3.1.1",
|
|
108
|
+
"sass": "^1.69.5",
|
|
109
|
+
"sass-loader": "^13.3.3",
|
|
110
|
+
"ts-jest": "^27.1.5",
|
|
111
|
+
"typescript": "~5.3.3",
|
|
112
|
+
"unplugin-auto-import": "^0.17.2",
|
|
113
|
+
"unplugin-vue-components": "^0.26.0",
|
|
114
|
+
"vue": "^3.3.13",
|
|
115
|
+
"webpack-bundle-analyzer": "^4.10.2"
|
|
116
|
+
},
|
|
117
|
+
"gitHooks": {
|
|
118
|
+
"pre-commit": "lint-staged"
|
|
119
|
+
},
|
|
120
|
+
"lint-staged": {
|
|
121
|
+
"*.{js,jsx,vue,ts,tsx}": [
|
|
122
|
+
"npm run test:unit -- --findRelatedTests",
|
|
123
|
+
"vue-cli-service lint --fix"
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
}
|