@toolbox-web/grid 0.1.1 → 0.2.2

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.
Files changed (69) hide show
  1. package/README.md +50 -59
  2. package/all.d.ts +9 -47
  3. package/all.js +1853 -1366
  4. package/all.js.map +1 -1
  5. package/index.d.ts +5 -210
  6. package/index.js +822 -1346
  7. package/index.js.map +1 -1
  8. package/lib/plugins/clipboard/index.js +11 -5
  9. package/lib/plugins/clipboard/index.js.map +1 -1
  10. package/lib/plugins/column-virtualization/index.js +9 -4
  11. package/lib/plugins/column-virtualization/index.js.map +1 -1
  12. package/lib/plugins/context-menu/index.js +11 -5
  13. package/lib/plugins/context-menu/index.js.map +1 -1
  14. package/lib/plugins/export/index.js +7 -3
  15. package/lib/plugins/export/index.js.map +1 -1
  16. package/lib/plugins/filtering/index.js +16 -149
  17. package/lib/plugins/filtering/index.js.map +1 -1
  18. package/lib/plugins/grouping-columns/index.js +13 -6
  19. package/lib/plugins/grouping-columns/index.js.map +1 -1
  20. package/lib/plugins/grouping-rows/index.js +13 -6
  21. package/lib/plugins/grouping-rows/index.js.map +1 -1
  22. package/lib/plugins/master-detail/index.js +11 -5
  23. package/lib/plugins/master-detail/index.js.map +1 -1
  24. package/lib/plugins/multi-sort/index.js +13 -6
  25. package/lib/plugins/multi-sort/index.js.map +1 -1
  26. package/lib/plugins/pinned-columns/index.js +11 -5
  27. package/lib/plugins/pinned-columns/index.js.map +1 -1
  28. package/lib/plugins/pinned-rows/index.js +13 -6
  29. package/lib/plugins/pinned-rows/index.js.map +1 -1
  30. package/lib/plugins/pivot/index.js +19 -9
  31. package/lib/plugins/pivot/index.js.map +1 -1
  32. package/lib/plugins/reorder/index.js +11 -5
  33. package/lib/plugins/reorder/index.js.map +1 -1
  34. package/lib/plugins/selection/index.js +61 -56
  35. package/lib/plugins/selection/index.js.map +1 -1
  36. package/lib/plugins/server-side/index.js +11 -5
  37. package/lib/plugins/server-side/index.js.map +1 -1
  38. package/lib/plugins/tree/index.js +15 -7
  39. package/lib/plugins/tree/index.js.map +1 -1
  40. package/lib/plugins/undo-redo/index.js +3 -1
  41. package/lib/plugins/undo-redo/index.js.map +1 -1
  42. package/lib/plugins/visibility/index.js +13 -6
  43. package/lib/plugins/visibility/index.js.map +1 -1
  44. package/package.json +1 -1
  45. package/umd/grid.all.umd.js +16 -157
  46. package/umd/grid.all.umd.js.map +1 -1
  47. package/umd/grid.umd.js +13 -13
  48. package/umd/grid.umd.js.map +1 -1
  49. package/umd/plugins/clipboard.umd.js.map +1 -1
  50. package/umd/plugins/column-virtualization.umd.js.map +1 -1
  51. package/umd/plugins/context-menu.umd.js.map +1 -1
  52. package/umd/plugins/export.umd.js.map +1 -1
  53. package/umd/plugins/filtering.umd.js +1 -142
  54. package/umd/plugins/filtering.umd.js.map +1 -1
  55. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  56. package/umd/plugins/grouping-rows.umd.js.map +1 -1
  57. package/umd/plugins/master-detail.umd.js.map +1 -1
  58. package/umd/plugins/multi-sort.umd.js.map +1 -1
  59. package/umd/plugins/pinned-columns.umd.js.map +1 -1
  60. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  61. package/umd/plugins/pivot.umd.js.map +1 -1
  62. package/umd/plugins/reorder.umd.js.map +1 -1
  63. package/umd/plugins/selection.umd.js +1 -1
  64. package/umd/plugins/selection.umd.js.map +1 -1
  65. package/umd/plugins/server-side.umd.js.map +1 -1
  66. package/umd/plugins/tree.umd.js.map +1 -1
  67. package/umd/plugins/undo-redo.umd.js.map +1 -1
  68. package/umd/plugins/visibility.umd.js.map +1 -1
  69. package/custom-elements.json +0 -1934
package/index.d.ts CHANGED
@@ -941,56 +941,10 @@ export declare interface ContextMenuParams {
941
941
 
942
942
  export declare type DataGridCustomEvent<K extends keyof DataGridEventMap<any>, TRow = any> = CustomEvent<DataGridEventMap<TRow>[K]>;
943
943
 
944
- /**
945
- * High-performance data grid web component.
946
- * During migration, uses tbw-grid tag to avoid conflicts with existing datagrid.
947
- * Will be renamed back to data-grid when migration is complete.
948
- *
949
- * ## Configuration Architecture
950
- *
951
- * The grid follows a **single source of truth** pattern where all configuration
952
- * converges into `#effectiveConfig`. Users can set configuration via multiple inputs:
953
- *
954
- * **Input Sources (precedence low → high):**
955
- * 1. `gridConfig` property - base configuration object
956
- * 2. Light DOM elements:
957
- * - `<tbw-grid-column>` → `effectiveConfig.columns`
958
- * - `<tbw-grid-header title="...">` → `effectiveConfig.shell.header.title`
959
- * - `<tbw-grid-header-content>` → `effectiveConfig.shell.header.content`
960
- * 3. `columns` property → merged into `effectiveConfig.columns`
961
- * 4. `fitMode` property → merged into `effectiveConfig.fitMode`
962
- * 5. `editOn` property → merged into `effectiveConfig.editOn`
963
- * 6. Column inference from first row (if no columns defined)
964
- *
965
- * **Derived State:**
966
- * - `_columns` - processed columns from `effectiveConfig.columns` after plugin hooks
967
- * - `_rows` - processed rows after plugin hooks (grouping, filtering, etc.)
968
- *
969
- * The `#mergeEffectiveConfig()` method is the single place where all inputs converge.
970
- * All rendering and logic should read from `effectiveConfig` or derived state.
971
- *
972
- * @element tbw-grid
973
- *
974
- * @csspart container - The main grid container
975
- * @csspart header - The header row container
976
- * @csspart body - The body/rows container
977
- *
978
- * @fires cell-commit - Fired when a cell value is committed
979
- * @fires row-commit - Fired when a bulk row edit session commits
980
- * @fires changed-rows-reset - Fired after resetChangedRows() unless silent
981
- * @fires mount-external-view - Fired to request mounting of an external view renderer
982
- * @fires mount-external-editor - Fired to request mounting of an external editor renderer
983
- * @fires sort-change - Fired when sort state changes for a column
984
- * @fires column-resize - Fired after a column resize drag completes
985
- * @fires activate-cell - Fired when a cell activation intent occurs
986
- * @fires group-toggle - Fired when a group row is toggled
987
- *
988
- * @cssprop --tbw-color-bg - Background color
989
- * @cssprop --tbw-color-fg - Foreground/text color
990
- */
991
944
  export declare class DataGridElement<T = any> extends HTMLElement implements InternalGrid<T> {
992
945
  #private;
993
946
  static readonly tagName = "tbw-grid";
947
+ static readonly version: string;
994
948
  _rows: T[];
995
949
  get _columns(): ColumnInternal<T>[];
996
950
  set _columns(value: ColumnInternal<T>[]);
@@ -1427,22 +1381,6 @@ export declare const FitModeEnum: {
1427
1381
  readonly FIXED: "fixed";
1428
1382
  };
1429
1383
 
1430
- /** A flattened tree row with hierarchy metadata */
1431
- declare interface FlattenedTreeRow {
1432
- /** Unique key identifying this row */
1433
- key: string;
1434
- /** Original row data */
1435
- data: any;
1436
- /** Depth level in the tree (0 = root) */
1437
- depth: number;
1438
- /** Whether this row has children */
1439
- hasChildren: boolean;
1440
- /** Whether this row is currently expanded */
1441
- isExpanded: boolean;
1442
- /** Key of the parent row, or null for root level */
1443
- parentKey: string | null;
1444
- }
1445
-
1446
1384
  export declare const getAggregator: (ref: AggregatorRef_2 | undefined) => AggregatorFn | undefined;
1447
1385
 
1448
1386
  export declare interface GetRowsParams {
@@ -1636,6 +1574,10 @@ export declare interface GridElement {
1636
1574
  rows: any[];
1637
1575
  columns: ColumnConfig[];
1638
1576
  gridConfig: any;
1577
+ /** Current focused row index */
1578
+ focusRow: number;
1579
+ /** Current focused column index */
1580
+ focusCol: number;
1639
1581
  /** AbortSignal that is aborted when the grid disconnects from the DOM */
1640
1582
  disconnectSignal: AbortSignal;
1641
1583
  requestRender(): void;
@@ -2272,79 +2214,6 @@ export declare interface SelectionConfig {
2272
2214
  declare type SelectionMode_2 = 'cell' | 'row' | 'range';
2273
2215
  export { SelectionMode_2 as SelectionMode }
2274
2216
 
2275
- /**
2276
- * Selection Plugin for tbw-grid
2277
- *
2278
- * @example
2279
- * ```ts
2280
- * new SelectionPlugin({ mode: 'range' })
2281
- * ```
2282
- */
2283
- export declare class SelectionPlugin extends BaseGridPlugin<SelectionConfig> {
2284
- #private;
2285
- readonly name = "selection";
2286
- readonly version = "1.0.0";
2287
- protected get defaultConfig(): Partial<SelectionConfig>;
2288
- /** Row selection state (row mode) */
2289
- private selected;
2290
- private lastSelected;
2291
- private anchor;
2292
- /** Range selection state (range mode) */
2293
- private ranges;
2294
- private activeRange;
2295
- private cellAnchor;
2296
- private isDragging;
2297
- /** Cell selection state (cell mode) */
2298
- private selectedCell;
2299
- detach(): void;
2300
- onCellClick(event: CellClickEvent): boolean;
2301
- onKeyDown(event: KeyboardEvent): boolean;
2302
- onCellMouseDown(event: CellMouseEvent): boolean | void;
2303
- onCellMouseMove(event: CellMouseEvent): boolean | void;
2304
- onCellMouseUp(_event: CellMouseEvent): boolean | void;
2305
- afterRender(): void;
2306
- /**
2307
- * Called after scroll-triggered row rendering.
2308
- * Reapplies selection classes to recycled DOM elements.
2309
- */
2310
- onScrollRender(): void;
2311
- /**
2312
- * Get the selected cell (cell mode only).
2313
- */
2314
- getSelectedCell(): {
2315
- row: number;
2316
- col: number;
2317
- } | null;
2318
- /**
2319
- * Get all selected row indices (row mode).
2320
- */
2321
- getSelectedRows(): number[];
2322
- /**
2323
- * Get all selected cell ranges in public format.
2324
- */
2325
- getRanges(): CellRange[];
2326
- /**
2327
- * Get all selected cells across all ranges.
2328
- */
2329
- getSelectedCells(): Array<{
2330
- row: number;
2331
- col: number;
2332
- }>;
2333
- /**
2334
- * Check if a specific cell is in range selection.
2335
- */
2336
- isCellSelected(row: number, col: number): boolean;
2337
- /**
2338
- * Clear all selection.
2339
- */
2340
- clearSelection(): void;
2341
- /**
2342
- * Set selected ranges programmatically.
2343
- */
2344
- setRanges(ranges: CellRange[]): void;
2345
- readonly styles: string;
2346
- }
2347
-
2348
2217
  export declare interface ServerSideDataSource {
2349
2218
  getRows(params: GetRowsParams): Promise<GetRowsResult>;
2350
2219
  }
@@ -2501,80 +2370,6 @@ export declare interface TreeExpandDetail {
2501
2370
  depth: number;
2502
2371
  }
2503
2372
 
2504
- /**
2505
- * Tree Data Plugin for tbw-grid
2506
- *
2507
- * Provides hierarchical tree data display with expand/collapse functionality.
2508
- *
2509
- * @example
2510
- * ```ts
2511
- * new TreePlugin({ defaultExpanded: true, indentWidth: 24 })
2512
- * ```
2513
- */
2514
- export declare class TreePlugin extends BaseGridPlugin<TreeConfig> {
2515
- readonly name = "tree";
2516
- readonly version = "1.0.0";
2517
- protected get defaultConfig(): Partial<TreeConfig>;
2518
- /** Set of expanded row keys */
2519
- private expandedKeys;
2520
- /** Whether initial expansion (based on defaultExpanded config) has been applied */
2521
- private initialExpansionDone;
2522
- /** Flattened tree rows for rendering */
2523
- private flattenedRows;
2524
- /** Map from key to flattened row for quick lookup */
2525
- private rowKeyMap;
2526
- detach(): void;
2527
- /**
2528
- * Detects if tree functionality should be enabled based on data structure.
2529
- * Called by the grid during plugin initialization.
2530
- */
2531
- detect(rows: readonly unknown[]): boolean;
2532
- processRows(rows: readonly unknown[]): any[];
2533
- processColumns(columns: readonly ColumnConfig[]): ColumnConfig[];
2534
- onCellClick(event: CellClickEvent): boolean;
2535
- /**
2536
- * Expand a specific node by key.
2537
- */
2538
- expand(key: string): void;
2539
- /**
2540
- * Collapse a specific node by key.
2541
- */
2542
- collapse(key: string): void;
2543
- /**
2544
- * Toggle the expansion state of a node.
2545
- */
2546
- toggle(key: string): void;
2547
- /**
2548
- * Expand all nodes in the tree.
2549
- */
2550
- expandAll(): void;
2551
- /**
2552
- * Collapse all nodes in the tree.
2553
- */
2554
- collapseAll(): void;
2555
- /**
2556
- * Check if a node is currently expanded.
2557
- */
2558
- isExpanded(key: string): boolean;
2559
- /**
2560
- * Get all currently expanded keys.
2561
- */
2562
- getExpandedKeys(): string[];
2563
- /**
2564
- * Get the flattened tree rows with metadata.
2565
- */
2566
- getFlattenedRows(): FlattenedTreeRow[];
2567
- /**
2568
- * Get a row's original data by its key.
2569
- */
2570
- getRowByKey(key: string): any | undefined;
2571
- /**
2572
- * Expand all ancestors of a node to make it visible.
2573
- */
2574
- expandToKey(key: string): void;
2575
- readonly styles: string;
2576
- }
2577
-
2578
2373
  export declare const unregisterAggregator: (name: string) => void;
2579
2374
 
2580
2375
  export declare type ValueAggregatorFn = (values: number[]) => number;