arthub-table 0.2.0-beta.8 → 0.2.1
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 +51 -0
- package/dist/types/adapters/columnAdapter.d.ts +7 -0
- package/dist/types/adapters/rowDataAdapter.d.ts +23 -0
- package/dist/types/core/ColumnHeader.d.ts +26 -0
- package/dist/types/core/DataGrid.d.ts +362 -4
- package/dist/types/core/Events.d.ts +0 -1
- package/dist/types/core/GroupRow.d.ts +46 -0
- package/dist/types/core/ImageManager.d.ts +21 -0
- package/dist/types/core/NestedGrid.d.ts +56 -1
- package/dist/types/core/StyleManager.d.ts +2 -0
- package/dist/types/core/constants.d.ts +1 -0
- package/dist/types/core/types.d.ts +14 -0
- package/dist/types/core/viewers/FileViewer.d.ts +3 -3
- package/dist/types/core/viewers/ImageViewer.d.ts +3 -3
- package/dist/types/core/viewers/ModuleViewer.d.ts +10 -9
- package/dist/types/core/viewers/PivotViewer.d.ts +42 -1
- package/dist/types/core/viewers/RelatedTaskViewer.d.ts +76 -0
- package/dist/types/core/viewers/TextViewerWithSwitcher.d.ts +22 -2
- package/dist/types/core/viewers/index.d.ts +3 -0
- package/dist/types/core/viewers/types.d.ts +115 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/testing/TestHooks.d.ts +187 -24
- package/dist/types/testing/index.d.ts +1 -1
- package/dist/types/testing/installTestHooks.d.ts +4 -4
- package/package.json +5 -1
|
@@ -213,6 +213,29 @@ export interface TestHooksAPI {
|
|
|
213
213
|
* @returns Row data object or null if not found
|
|
214
214
|
*/
|
|
215
215
|
getRowData: (rowId: string | number) => Record<string, any> | null;
|
|
216
|
+
/**
|
|
217
|
+
* 获取组头行搜索命中高亮状态。
|
|
218
|
+
*
|
|
219
|
+
* 返回值说明:
|
|
220
|
+
* - `matched`:组头行是否被搜索命中(searchMatchList 中存在 isGroupHeader: true 且 id 匹配的条目)
|
|
221
|
+
* - `currentHighlight`:是否是"当前高亮"项(命中条目中存在 highlight: true 的 field),为 true 时 GroupRow 会绘制 2px 橙色 inset 边框
|
|
222
|
+
*
|
|
223
|
+
* @param rowId - 组头行 id(分组模式下通常是 string)
|
|
224
|
+
* @returns 命中状态或 null(行不存在 / 非组头行)
|
|
225
|
+
*/
|
|
226
|
+
getGroupHeaderSearchMatchState: (rowId: string | number) => {
|
|
227
|
+
matched: boolean;
|
|
228
|
+
currentHighlight: boolean;
|
|
229
|
+
} | null;
|
|
230
|
+
/**
|
|
231
|
+
* 获取组头行搜索命中高亮的"首列左边框" x 坐标(canvas 相对坐标)。
|
|
232
|
+
*
|
|
233
|
+
* 用于验证多层分组(1D/2D/3D)下左边框贴合分组名称块左缘的正确性。
|
|
234
|
+
*
|
|
235
|
+
* @param rowId - 组头行 id
|
|
236
|
+
* @returns x 坐标或 null(行不存在 / 非组头行)
|
|
237
|
+
*/
|
|
238
|
+
getSearchHighlightFirstLeftBorderX: (rowId: string | number) => number | null;
|
|
216
239
|
/**
|
|
217
240
|
* Get the current scroll position.
|
|
218
241
|
* @returns ScrollPosition object
|
|
@@ -296,37 +319,29 @@ export interface TestHooksAPI {
|
|
|
296
319
|
canvasY: number;
|
|
297
320
|
} | null;
|
|
298
321
|
/**
|
|
299
|
-
* Get
|
|
322
|
+
* Get all interactive (clickable) areas within a specific cell.
|
|
323
|
+
* Returns canvas-relative coordinates for edit icon, link icon, error icon, etc.
|
|
324
|
+
* Used by Playwright to simulate clicks on specific cell regions.
|
|
300
325
|
*/
|
|
301
|
-
|
|
302
|
-
startRow: number;
|
|
303
|
-
startCol: number;
|
|
304
|
-
endRow: number;
|
|
305
|
-
endCol: number;
|
|
306
|
-
} | null;
|
|
326
|
+
getCellInteractiveAreas: (rowId: string | number, columnKey: string) => CellInteractiveAreas | null;
|
|
307
327
|
/**
|
|
308
|
-
* Get
|
|
328
|
+
* Get interactive areas within a column header.
|
|
329
|
+
* Returns sort/filter icon, resize handle, and settings icon bounds.
|
|
309
330
|
*/
|
|
310
|
-
|
|
311
|
-
isEditing: boolean;
|
|
312
|
-
value: any;
|
|
313
|
-
} | null;
|
|
331
|
+
getHeaderInteractiveAreas: (colIndex: number) => HeaderInteractiveAreas | null;
|
|
314
332
|
/**
|
|
315
|
-
* Get
|
|
333
|
+
* Get interactive areas within a group row header.
|
|
334
|
+
* Returns expand arrow and checkbox bounds.
|
|
316
335
|
*/
|
|
317
|
-
|
|
318
|
-
isDragging: boolean;
|
|
319
|
-
type: 'row' | 'column' | 'selection' | null;
|
|
320
|
-
sourceIds: string[];
|
|
321
|
-
targetId: string | null;
|
|
322
|
-
} | null;
|
|
336
|
+
getGroupRowAreas: (rowId: string) => GroupRowAreas | null;
|
|
323
337
|
/**
|
|
324
|
-
* Get
|
|
338
|
+
* Get all visible group rows with their expand/collapse state.
|
|
325
339
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
340
|
+
getVisibleGroupRows: () => VisibleGroupRowInfo[];
|
|
341
|
+
/**
|
|
342
|
+
* Get current selection, editing, and checked-row state.
|
|
343
|
+
*/
|
|
344
|
+
getSelectionState: () => SelectionState;
|
|
330
345
|
}
|
|
331
346
|
/**
|
|
332
347
|
* Test info for a single nested grid instance
|
|
@@ -382,11 +397,159 @@ export interface NestedGridTestInfo {
|
|
|
382
397
|
/** Row height */
|
|
383
398
|
rowHeight: number;
|
|
384
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Bounding box in canvas coordinates (can be converted to viewport coords)
|
|
402
|
+
*/
|
|
403
|
+
export interface AreaBounds {
|
|
404
|
+
/** Canvas-relative X coordinate */
|
|
405
|
+
canvasX: number;
|
|
406
|
+
/** Canvas-relative Y coordinate */
|
|
407
|
+
canvasY: number;
|
|
408
|
+
/** Width in pixels */
|
|
409
|
+
width: number;
|
|
410
|
+
/** Height in pixels */
|
|
411
|
+
height: number;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* A viewer-specific interactive area within a cell
|
|
415
|
+
*/
|
|
416
|
+
export interface ViewerArea {
|
|
417
|
+
/** Area type identifier */
|
|
418
|
+
type: string;
|
|
419
|
+
/** Area bounds */
|
|
420
|
+
bounds: AreaBounds;
|
|
421
|
+
/** Current value (e.g. boolean true/false, progress 0.75) */
|
|
422
|
+
value?: any;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* All interactive areas within a single cell.
|
|
426
|
+
* Used by Playwright to know WHERE to click for specific interactions.
|
|
427
|
+
*/
|
|
428
|
+
export interface CellInteractiveAreas {
|
|
429
|
+
/** Entire cell area */
|
|
430
|
+
cell: AreaBounds;
|
|
431
|
+
/** Edit icon (hover-triggered, top-right) — null if readonly/hideEditIcon/nestedGrid */
|
|
432
|
+
editIcon: AreaBounds | null;
|
|
433
|
+
/** Link icon — null if not a link column */
|
|
434
|
+
linkIcon: AreaBounds | null;
|
|
435
|
+
/** Error/warning icon — null if no error */
|
|
436
|
+
errorIcon: AreaBounds | null;
|
|
437
|
+
/** Reminder triangle (top-right corner) — null if no reminder */
|
|
438
|
+
reminderTriangle: AreaBounds | null;
|
|
439
|
+
/** Viewer-specific interactive areas */
|
|
440
|
+
viewerAreas: ViewerArea[];
|
|
441
|
+
/** Cell metadata */
|
|
442
|
+
meta: {
|
|
443
|
+
viewerType: string;
|
|
444
|
+
readonly: boolean;
|
|
445
|
+
isLink: boolean;
|
|
446
|
+
hasError: boolean;
|
|
447
|
+
hasReminder: boolean;
|
|
448
|
+
hasNestedGrid: boolean;
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Interactive areas within a column header
|
|
453
|
+
*/
|
|
454
|
+
export interface HeaderInteractiveAreas {
|
|
455
|
+
/** Entire header cell area */
|
|
456
|
+
header: AreaBounds;
|
|
457
|
+
/** Sort icon area (shown on hover, left of filter icon) — null for compound headers */
|
|
458
|
+
sortIcon: AreaBounds | null;
|
|
459
|
+
/** Filter icon area (shown on hover, rightmost) — null for compound headers */
|
|
460
|
+
filterIcon: AreaBounds | null;
|
|
461
|
+
/** Column resize handle (right edge ±6px) — null for compound headers */
|
|
462
|
+
resizeHandle: AreaBounds;
|
|
463
|
+
/** Settings icon (nested parent header only) */
|
|
464
|
+
settingsIcon: AreaBounds | null;
|
|
465
|
+
/** Metadata */
|
|
466
|
+
meta: {
|
|
467
|
+
colId: string;
|
|
468
|
+
columnKey: string;
|
|
469
|
+
colType: string;
|
|
470
|
+
index: number;
|
|
471
|
+
sortDisabled: boolean;
|
|
472
|
+
canDrag: boolean;
|
|
473
|
+
isNested: boolean;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Interactive areas within a group row header
|
|
478
|
+
*/
|
|
479
|
+
export interface GroupRowAreas {
|
|
480
|
+
/** Expand/collapse arrow */
|
|
481
|
+
expandArrow: AreaBounds;
|
|
482
|
+
/** Checkbox area — null if not a leaf group or no checkbox */
|
|
483
|
+
checkbox: AreaBounds | null;
|
|
484
|
+
/** Entire row area */
|
|
485
|
+
row: AreaBounds;
|
|
486
|
+
/** Metadata */
|
|
487
|
+
meta: {
|
|
488
|
+
expanded: boolean;
|
|
489
|
+
groupLevel: number;
|
|
490
|
+
groupName: string;
|
|
491
|
+
isLeafGroup: boolean;
|
|
492
|
+
rowId: string;
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Current selection/editing state of the table
|
|
497
|
+
*/
|
|
498
|
+
export interface SelectionState {
|
|
499
|
+
/** Selection range (null if nothing selected) */
|
|
500
|
+
range: {
|
|
501
|
+
startRow: number;
|
|
502
|
+
startCol: number;
|
|
503
|
+
endRow: number;
|
|
504
|
+
endCol: number;
|
|
505
|
+
} | null;
|
|
506
|
+
/** Active (focused) cell */
|
|
507
|
+
activeCell: {
|
|
508
|
+
rowIndex: number;
|
|
509
|
+
colIndex: number;
|
|
510
|
+
} | null;
|
|
511
|
+
/** IDs of checked (checkbox-selected) rows */
|
|
512
|
+
checkedRowIds: (string | number)[];
|
|
513
|
+
/** Editor state — null if editor is closed */
|
|
514
|
+
editor: {
|
|
515
|
+
show: boolean;
|
|
516
|
+
rowIndex: number;
|
|
517
|
+
colIndex: number;
|
|
518
|
+
} | null;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Visible group row info (for listing group rows in tests)
|
|
522
|
+
*/
|
|
523
|
+
export interface VisibleGroupRowInfo {
|
|
524
|
+
rowId: string;
|
|
525
|
+
rowIndex: number;
|
|
526
|
+
expanded: boolean;
|
|
527
|
+
groupName: string;
|
|
528
|
+
groupLevel: number;
|
|
529
|
+
isLeafGroup: boolean;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Registry for multiple DataGrid test hook instances.
|
|
533
|
+
* Supports one page having multiple DataGrid components.
|
|
534
|
+
*/
|
|
535
|
+
export interface TestHooksRegistry {
|
|
536
|
+
/** Register a grid's hooks (called by installTestHooks) */
|
|
537
|
+
register(canvasId: string, hooks: TestHooksAPI): void;
|
|
538
|
+
/** Unregister a grid's hooks (called on component destroy) */
|
|
539
|
+
unregister(canvasId: string): void;
|
|
540
|
+
/** Get hooks for a specific grid */
|
|
541
|
+
get(canvasId: string): TestHooksAPI | undefined;
|
|
542
|
+
/** Get the first registered grid's hooks (backward compat) */
|
|
543
|
+
getFirst(): TestHooksAPI | undefined;
|
|
544
|
+
/** List all registered canvas IDs */
|
|
545
|
+
list(): string[];
|
|
546
|
+
}
|
|
385
547
|
/**
|
|
386
548
|
* Global window augmentation for test hooks
|
|
387
549
|
*/
|
|
388
550
|
declare global {
|
|
389
551
|
interface Window {
|
|
390
552
|
__CANVAS_TABLE_TEST_HOOKS__?: TestHooksAPI;
|
|
553
|
+
__CANVAS_TABLE_TEST_HOOKS_REGISTRY__?: TestHooksRegistry;
|
|
391
554
|
}
|
|
392
555
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { CellLayout, VisibleCell, TestColumnConfig, ScrollPosition, TableDimensions, SnapshotDifference, SnapshotCompareResult, TableSnapshot, TestHooksAPI, } from './TestHooks';
|
|
1
|
+
export type { CellLayout, VisibleCell, TestColumnConfig, ScrollPosition, TableDimensions, SnapshotDifference, SnapshotCompareResult, TableSnapshot, TestHooksAPI, AreaBounds, ViewerArea, CellInteractiveAreas, HeaderInteractiveAreas, GroupRowAreas, SelectionState, VisibleGroupRowInfo, TestHooksRegistry, } from './TestHooks';
|
|
2
2
|
export { installTestHooks, removeTestHooks } from './installTestHooks';
|
|
3
3
|
export { SnapshotManager } from './SnapshotManager';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type DataGrid from '../core/DataGrid';
|
|
2
2
|
/**
|
|
3
|
-
* Install test hooks on window.__CANVAS_TABLE_TEST_HOOKS__
|
|
3
|
+
* Install test hooks on window.__CANVAS_TABLE_TEST_HOOKS__ and the registry.
|
|
4
4
|
* This should be called after DataGrid is fully initialized.
|
|
5
5
|
*
|
|
6
6
|
* In production builds, this function is a no-op and can be
|
|
@@ -10,7 +10,7 @@ import type DataGrid from '../core/DataGrid';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function installTestHooks(grid: DataGrid): void;
|
|
12
12
|
/**
|
|
13
|
-
* Remove test hooks from the
|
|
14
|
-
*
|
|
13
|
+
* Remove test hooks for a specific grid instance from the registry.
|
|
14
|
+
* @param canvasId - The canvas element ID to unregister
|
|
15
15
|
*/
|
|
16
|
-
export declare function removeTestHooks(): void;
|
|
16
|
+
export declare function removeTestHooks(canvasId?: string): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arthub-table",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
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",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"test:e2e:headed": "playwright test --headed",
|
|
62
62
|
"test:e2e:report": "playwright show-report test-results/html-report",
|
|
63
63
|
"setup-husky": "node scripts/setup-husky.js",
|
|
64
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
64
65
|
"lint": "vue-cli-service lint",
|
|
65
66
|
"predeploy": "npm run build:demo",
|
|
66
67
|
"deploy": "gh-pages -d dist",
|
|
@@ -119,6 +120,9 @@
|
|
|
119
120
|
"*.{js,jsx,vue,ts,tsx}": [
|
|
120
121
|
"npm run test:unit -- --passWithNoTests --findRelatedTests",
|
|
121
122
|
"vue-cli-service lint --fix"
|
|
123
|
+
],
|
|
124
|
+
"*.{ts,tsx}": [
|
|
125
|
+
"bash -c 'npm run typecheck'"
|
|
122
126
|
]
|
|
123
127
|
}
|
|
124
128
|
}
|