@toolbox-web/grid 2.5.0 → 2.7.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 +15 -3
- package/all.d.ts +1 -0
- package/all.js +2 -2
- package/all.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/internal/aria.d.ts +4 -0
- package/lib/core/types.d.ts +90 -31
- package/lib/features/sticky-rows.d.ts +9 -0
- package/lib/features/sticky-rows.js +2 -0
- package/lib/features/sticky-rows.js.map +1 -0
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +15 -0
- package/lib/plugins/grouping-rows/index.js +2 -2
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +28 -4
- package/lib/plugins/pinned-rows/index.d.ts +3 -2
- package/lib/plugins/pinned-rows/index.js +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pinned-rows/pinned-rows.d.ts +29 -1
- package/lib/plugins/pinned-rows/types.d.ts +96 -9
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder-columns/index.js.map +1 -1
- package/lib/plugins/reorder-rows/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-drag-drop/index.js.map +1 -1
- package/lib/plugins/row-drag-drop/types.d.ts +7 -0
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/sticky-rows/StickyRowsPlugin.d.ts +114 -0
- package/lib/plugins/sticky-rows/index.d.ts +7 -0
- package/lib/plugins/sticky-rows/index.js +2 -0
- package/lib/plugins/sticky-rows/index.js.map +1 -0
- package/lib/plugins/sticky-rows/types.d.ts +67 -0
- package/lib/plugins/tooltip/index.js.map +1 -1
- package/lib/plugins/tree/index.js +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/types.d.ts +4 -0
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +0 -11
- package/lib/plugins/visibility/index.d.ts +1 -2
- package/lib/plugins/visibility/index.js.map +1 -1
- package/lib/plugins/visibility/types.d.ts +32 -0
- package/package.json +1 -1
- package/public.d.ts +28 -67
- package/umd/grid.all.umd.js +1 -1
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +1 -1
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/sticky-rows.umd.js +2 -0
- package/umd/plugins/sticky-rows.umd.js.map +1 -0
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
|
@@ -10,8 +10,12 @@ export interface AriaState {
|
|
|
10
10
|
colCount: number;
|
|
11
11
|
/** Last set aria-label */
|
|
12
12
|
ariaLabel: string | undefined;
|
|
13
|
+
/** Last set aria-labelledby */
|
|
14
|
+
ariaLabelledBy: string | undefined;
|
|
13
15
|
/** Last set aria-describedby */
|
|
14
16
|
ariaDescribedBy: string | undefined;
|
|
17
|
+
/** Last set aria-roledescription */
|
|
18
|
+
ariaRoleDescription: string | undefined;
|
|
15
19
|
/** Last source row count announced via `dataLoaded`; used to suppress duplicate announcements */
|
|
16
20
|
lastAnnouncedSourceCount: number;
|
|
17
21
|
}
|
package/lib/core/types.d.ts
CHANGED
|
@@ -12,34 +12,6 @@ import { AfterCellRenderContext, AfterRowRenderContext, CellMouseEvent } from '.
|
|
|
12
12
|
* @category Plugin Development
|
|
13
13
|
*/
|
|
14
14
|
export type RowPositionEntry = RowPosition;
|
|
15
|
-
/**
|
|
16
|
-
* The compiled web component interface for DataGrid.
|
|
17
|
-
*
|
|
18
|
-
* This interface represents the `<tbw-grid>` custom element, combining
|
|
19
|
-
* the public grid API with standard HTMLElement functionality.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* // Query existing grid with type safety
|
|
24
|
-
* import { queryGrid } from '@toolbox-web/grid';
|
|
25
|
-
* const grid = queryGrid<Employee>('tbw-grid');
|
|
26
|
-
* grid.rows = employees;
|
|
27
|
-
* grid.on('cell-click', (detail) => console.log(detail));
|
|
28
|
-
*
|
|
29
|
-
* // Create grid programmatically
|
|
30
|
-
* import { createGrid } from '@toolbox-web/grid';
|
|
31
|
-
* const grid = createGrid<Employee>({
|
|
32
|
-
* columns: [{ field: 'name' }, { field: 'email' }],
|
|
33
|
-
* });
|
|
34
|
-
* document.body.appendChild(grid);
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @see {@link PublicGrid} for the public API methods and properties
|
|
38
|
-
* @see {@link createGrid} for typed grid creation
|
|
39
|
-
* @see {@link queryGrid} for typed grid querying
|
|
40
|
-
*/
|
|
41
|
-
export interface DataGridElement extends PublicGrid, HTMLElement {
|
|
42
|
-
}
|
|
43
15
|
/**
|
|
44
16
|
* Options for the {@link PublicGrid.scrollToRow} method.
|
|
45
17
|
*
|
|
@@ -1287,7 +1259,7 @@ export interface ColumnEditorContext<TRow = any, TValue = any> {
|
|
|
1287
1259
|
*
|
|
1288
1260
|
* @see {@link CellRenderContext.grid}
|
|
1289
1261
|
*/
|
|
1290
|
-
grid?:
|
|
1262
|
+
grid?: PublicGrid<TRow> & HTMLElement;
|
|
1291
1263
|
}
|
|
1292
1264
|
/**
|
|
1293
1265
|
* Context passed to custom view renderers (pure display – no commit helpers).
|
|
@@ -1343,7 +1315,7 @@ export interface CellRenderContext<TRow = any, TValue = any> {
|
|
|
1343
1315
|
* };
|
|
1344
1316
|
* ```
|
|
1345
1317
|
*/
|
|
1346
|
-
grid?:
|
|
1318
|
+
grid?: PublicGrid<TRow> & HTMLElement;
|
|
1347
1319
|
/**
|
|
1348
1320
|
* The cell DOM element being rendered into.
|
|
1349
1321
|
* Framework adapters can use this to cache per-cell state (e.g., React roots).
|
|
@@ -2521,12 +2493,36 @@ export interface GridConfig<TRow = any> {
|
|
|
2521
2493
|
*
|
|
2522
2494
|
* If not provided and `shell.header.title` is set, the title is used automatically.
|
|
2523
2495
|
*
|
|
2496
|
+
* If [`gridAriaLabelledBy`](#gridarialabelledby) is also set, `aria-labelledby`
|
|
2497
|
+
* takes precedence per WAI-ARIA accessible-name computation and `aria-label`
|
|
2498
|
+
* is omitted.
|
|
2499
|
+
*
|
|
2524
2500
|
* @example
|
|
2525
2501
|
* ```ts
|
|
2526
2502
|
* gridConfig = { gridAriaLabel: 'Employee data' };
|
|
2527
2503
|
* ```
|
|
2528
2504
|
*/
|
|
2529
2505
|
gridAriaLabel?: string;
|
|
2506
|
+
/**
|
|
2507
|
+
* ID of an element that labels the grid.
|
|
2508
|
+
* Sets `aria-labelledby` on the grid's internal table element so screen
|
|
2509
|
+
* readers can use the referenced element's text as the accessible name —
|
|
2510
|
+
* useful when the grid already sits next to a heading.
|
|
2511
|
+
*
|
|
2512
|
+
* Per WAI-ARIA accessible-name precedence, `aria-labelledby` takes priority
|
|
2513
|
+
* over `aria-label` and over the auto-derived shell title. When this option
|
|
2514
|
+
* is set, the grid omits `aria-label` to avoid conflicting names.
|
|
2515
|
+
*
|
|
2516
|
+
* @example
|
|
2517
|
+
* ```html
|
|
2518
|
+
* <h2 id="grid-heading">Employees</h2>
|
|
2519
|
+
* <tbw-grid></tbw-grid>
|
|
2520
|
+
* ```
|
|
2521
|
+
* ```ts
|
|
2522
|
+
* gridConfig = { gridAriaLabelledBy: 'grid-heading' };
|
|
2523
|
+
* ```
|
|
2524
|
+
*/
|
|
2525
|
+
gridAriaLabelledBy?: string;
|
|
2530
2526
|
/**
|
|
2531
2527
|
* ID of an element that describes the grid.
|
|
2532
2528
|
* Sets `aria-describedby` on the grid's internal table element.
|
|
@@ -2541,6 +2537,25 @@ export interface GridConfig<TRow = any> {
|
|
|
2541
2537
|
* ```
|
|
2542
2538
|
*/
|
|
2543
2539
|
gridAriaDescribedBy?: string;
|
|
2540
|
+
/**
|
|
2541
|
+
* Override the screen-reader-announced role name for the grid via
|
|
2542
|
+
* `aria-roledescription`. Useful for localization (e.g. `"Tabell"` in
|
|
2543
|
+
* Norwegian) or domain-specific naming (e.g. `"Employee table"`).
|
|
2544
|
+
*
|
|
2545
|
+
* :::caution
|
|
2546
|
+
* Per [WAI-ARIA 1.2](https://www.w3.org/TR/wai-aria-1.2/#aria-roledescription),
|
|
2547
|
+
* the value should still describe a grid-like widget. Overriding with an
|
|
2548
|
+
* unrelated label confuses assistive-technology users about the available
|
|
2549
|
+
* interactions (cell navigation, sort, etc.). Leave unset to use the
|
|
2550
|
+
* default role name announced by the AT.
|
|
2551
|
+
* :::
|
|
2552
|
+
*
|
|
2553
|
+
* @example
|
|
2554
|
+
* ```ts
|
|
2555
|
+
* gridConfig = { gridAriaRoleDescription: 'Employee table' };
|
|
2556
|
+
* ```
|
|
2557
|
+
*/
|
|
2558
|
+
gridAriaRoleDescription?: string;
|
|
2544
2559
|
/**
|
|
2545
2560
|
* Accessibility configuration for screen reader announcements.
|
|
2546
2561
|
*
|
|
@@ -3576,6 +3591,34 @@ export interface ColumnResizeDetail {
|
|
|
3576
3591
|
/** New width in pixels. */
|
|
3577
3592
|
width: number;
|
|
3578
3593
|
}
|
|
3594
|
+
/**
|
|
3595
|
+
* Column resize-reset event detail.
|
|
3596
|
+
*
|
|
3597
|
+
* Fired when a user-resized column is restored to its original configured width
|
|
3598
|
+
* (e.g., via the column header context menu "Reset width" action). The `width`
|
|
3599
|
+
* field reflects the column's `__originalWidth` and may be `undefined` if the
|
|
3600
|
+
* column was originally auto-sized.
|
|
3601
|
+
*
|
|
3602
|
+
* @example
|
|
3603
|
+
* ```typescript
|
|
3604
|
+
* grid.on('column-resize-reset', ({ field, width }) => {
|
|
3605
|
+
* if (width === undefined) {
|
|
3606
|
+
* console.log(`Column ${field} restored to auto-size`);
|
|
3607
|
+
* } else {
|
|
3608
|
+
* console.log(`Column ${field} restored to ${width}px`);
|
|
3609
|
+
* }
|
|
3610
|
+
* });
|
|
3611
|
+
* ```
|
|
3612
|
+
*
|
|
3613
|
+
* @see {@link ColumnResizeDetail} for the resize-in-progress event
|
|
3614
|
+
* @category Events
|
|
3615
|
+
*/
|
|
3616
|
+
export interface ColumnResizeResetDetail {
|
|
3617
|
+
/** Reset column field key. */
|
|
3618
|
+
field: string;
|
|
3619
|
+
/** Original configured width in pixels, or `undefined` if auto-sized. */
|
|
3620
|
+
width: number | undefined;
|
|
3621
|
+
}
|
|
3579
3622
|
/**
|
|
3580
3623
|
* Trigger type for cell activation.
|
|
3581
3624
|
* - `'keyboard'`: Enter key pressed on focused cell
|
|
@@ -3714,7 +3757,6 @@ export interface ExternalMountEditorDetail<TRow = unknown> {
|
|
|
3714
3757
|
*
|
|
3715
3758
|
* @see {@link DataGridElement.on} for the recommended subscription API
|
|
3716
3759
|
* @see {@link DataGridCustomEvent} for typed CustomEvent wrapper
|
|
3717
|
-
* @see {@link DGEvents} for event name constants
|
|
3718
3760
|
* @category Events
|
|
3719
3761
|
*/
|
|
3720
3762
|
export interface DataGridEventMap<TRow = unknown> {
|
|
@@ -3931,6 +3973,23 @@ export interface DataGridEventMap<TRow = unknown> {
|
|
|
3931
3973
|
* @group Core Events
|
|
3932
3974
|
*/
|
|
3933
3975
|
'column-resize': ColumnResizeDetail;
|
|
3976
|
+
/**
|
|
3977
|
+
* Fired when a user-resized column is reset to its original configured width.
|
|
3978
|
+
* Triggered by the column header context menu "Reset width" action.
|
|
3979
|
+
*
|
|
3980
|
+
* @example
|
|
3981
|
+
* ```typescript
|
|
3982
|
+
* grid.on('column-resize-reset', ({ field, width }) => {
|
|
3983
|
+
* const widths = JSON.parse(localStorage.getItem('col-widths') ?? '{}');
|
|
3984
|
+
* delete widths[field];
|
|
3985
|
+
* localStorage.setItem('col-widths', JSON.stringify(widths));
|
|
3986
|
+
* });
|
|
3987
|
+
* ```
|
|
3988
|
+
*
|
|
3989
|
+
* @see {@link ColumnResizeResetDetail}
|
|
3990
|
+
* @group Core Events
|
|
3991
|
+
*/
|
|
3992
|
+
'column-resize-reset': ColumnResizeResetDetail;
|
|
3934
3993
|
/**
|
|
3935
3994
|
* Fired when column state changes — reordering, resizing, visibility toggle,
|
|
3936
3995
|
* or sort changes. Use with `getColumnState()` / `columnState` setter for
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StickyRowsConfig } from '../plugins/sticky-rows';
|
|
2
|
+
declare module '../core/types' {
|
|
3
|
+
interface FeatureConfig {
|
|
4
|
+
/** Pin selected data rows below the header as the user scrolls past them. */
|
|
5
|
+
stickyRows?: StickyRowsConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** @internal Type anchor — forces bundlers to preserve this module's FeatureConfig augmentation when re-exported. */
|
|
9
|
+
export type _Augmentation = true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticky-rows.js","sources":["../../../../../libs/grid/src/lib/features/sticky-rows.ts"],"sourcesContent":["/**\n * Sticky Rows feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/sticky-rows';\n *\n * grid.gridConfig = { features: { stickyRows: { isSticky: 'isSection' } } };\n * ```\n */\n\nimport { StickyRowsPlugin, type StickyRowsConfig } from '../plugins/sticky-rows';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Pin selected data rows below the header as the user scrolls past them. */\n stickyRows?: StickyRowsConfig;\n }\n}\n\nregisterFeature('stickyRows', (config) => {\n // `stickyRows` requires an `isSticky` value — `boolean` shorthand is not\n // meaningful. The TS type prevents `true`/`false` callers from compiling;\n // at runtime we coerce to a no-op predicate for safety.\n const options = (config as StickyRowsConfig | undefined) ?? { isSticky: () => false };\n return new StickyRowsPlugin(options);\n});\n\n/** @internal Type anchor — forces bundlers to preserve this module's FeatureConfig augmentation when re-exported. */\nexport type _Augmentation = true;\n"],"names":["registerFeature","config","StickyRowsPlugin","isSticky"],"mappings":"+IAqBAA,EAAgB,aAAeC,GAKtB,IAAIC,EADMD,GAA2C,CAAEE,SAAU,KAAM"}
|