@toolbox-web/grid 2.4.1 → 2.6.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.js +2 -2
- package/all.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/types.d.ts +72 -30
- 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.map +1 -1
- package/lib/plugins/editing/index.js +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/internal/helpers.d.ts +17 -0
- 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/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/tooltip/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- 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/editing.umd.js +1 -1
- package/umd/plugins/editing.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/visibility.umd.js.map +1 -1
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
|
*
|
|
@@ -1262,6 +1234,32 @@ export interface ColumnEditorContext<TRow = any, TValue = any> {
|
|
|
1262
1234
|
* ```
|
|
1263
1235
|
*/
|
|
1264
1236
|
onValueChange?: (callback: (newValue: TValue) => void) => void;
|
|
1237
|
+
/**
|
|
1238
|
+
* The grid element that owns this editor.
|
|
1239
|
+
*
|
|
1240
|
+
* Use to access public grid API from custom editors — e.g.
|
|
1241
|
+
* `grid.registerExternalFocusContainer(panel)` so the grid treats focus
|
|
1242
|
+
* inside a portal-rendered overlay (Autocomplete, date picker, color
|
|
1243
|
+
* picker) as "still inside the editor" and does not exit row edit on
|
|
1244
|
+
* click. Mirrors {@link CellRenderContext.grid} for renderers.
|
|
1245
|
+
*
|
|
1246
|
+
* Always populated when the editor is mounted via the grid's editing
|
|
1247
|
+
* pipeline. Optional in the type for backwards compatibility with
|
|
1248
|
+
* factory functions written against the original signature.
|
|
1249
|
+
*
|
|
1250
|
+
* @example
|
|
1251
|
+
* ```typescript
|
|
1252
|
+
* const editor: ColumnEditorSpec = (ctx: ColumnEditorContext) => {
|
|
1253
|
+
* const panel = document.createElement('div');
|
|
1254
|
+
* document.body.appendChild(panel);
|
|
1255
|
+
* ctx.grid?.registerExternalFocusContainer(panel);
|
|
1256
|
+
* // ...
|
|
1257
|
+
* };
|
|
1258
|
+
* ```
|
|
1259
|
+
*
|
|
1260
|
+
* @see {@link CellRenderContext.grid}
|
|
1261
|
+
*/
|
|
1262
|
+
grid?: PublicGrid<TRow> & HTMLElement;
|
|
1265
1263
|
}
|
|
1266
1264
|
/**
|
|
1267
1265
|
* Context passed to custom view renderers (pure display – no commit helpers).
|
|
@@ -1317,7 +1315,7 @@ export interface CellRenderContext<TRow = any, TValue = any> {
|
|
|
1317
1315
|
* };
|
|
1318
1316
|
* ```
|
|
1319
1317
|
*/
|
|
1320
|
-
grid?:
|
|
1318
|
+
grid?: PublicGrid<TRow> & HTMLElement;
|
|
1321
1319
|
/**
|
|
1322
1320
|
* The cell DOM element being rendered into.
|
|
1323
1321
|
* Framework adapters can use this to cache per-cell state (e.g., React roots).
|
|
@@ -3550,6 +3548,34 @@ export interface ColumnResizeDetail {
|
|
|
3550
3548
|
/** New width in pixels. */
|
|
3551
3549
|
width: number;
|
|
3552
3550
|
}
|
|
3551
|
+
/**
|
|
3552
|
+
* Column resize-reset event detail.
|
|
3553
|
+
*
|
|
3554
|
+
* Fired when a user-resized column is restored to its original configured width
|
|
3555
|
+
* (e.g., via the column header context menu "Reset width" action). The `width`
|
|
3556
|
+
* field reflects the column's `__originalWidth` and may be `undefined` if the
|
|
3557
|
+
* column was originally auto-sized.
|
|
3558
|
+
*
|
|
3559
|
+
* @example
|
|
3560
|
+
* ```typescript
|
|
3561
|
+
* grid.on('column-resize-reset', ({ field, width }) => {
|
|
3562
|
+
* if (width === undefined) {
|
|
3563
|
+
* console.log(`Column ${field} restored to auto-size`);
|
|
3564
|
+
* } else {
|
|
3565
|
+
* console.log(`Column ${field} restored to ${width}px`);
|
|
3566
|
+
* }
|
|
3567
|
+
* });
|
|
3568
|
+
* ```
|
|
3569
|
+
*
|
|
3570
|
+
* @see {@link ColumnResizeDetail} for the resize-in-progress event
|
|
3571
|
+
* @category Events
|
|
3572
|
+
*/
|
|
3573
|
+
export interface ColumnResizeResetDetail {
|
|
3574
|
+
/** Reset column field key. */
|
|
3575
|
+
field: string;
|
|
3576
|
+
/** Original configured width in pixels, or `undefined` if auto-sized. */
|
|
3577
|
+
width: number | undefined;
|
|
3578
|
+
}
|
|
3553
3579
|
/**
|
|
3554
3580
|
* Trigger type for cell activation.
|
|
3555
3581
|
* - `'keyboard'`: Enter key pressed on focused cell
|
|
@@ -3688,7 +3714,6 @@ export interface ExternalMountEditorDetail<TRow = unknown> {
|
|
|
3688
3714
|
*
|
|
3689
3715
|
* @see {@link DataGridElement.on} for the recommended subscription API
|
|
3690
3716
|
* @see {@link DataGridCustomEvent} for typed CustomEvent wrapper
|
|
3691
|
-
* @see {@link DGEvents} for event name constants
|
|
3692
3717
|
* @category Events
|
|
3693
3718
|
*/
|
|
3694
3719
|
export interface DataGridEventMap<TRow = unknown> {
|
|
@@ -3905,6 +3930,23 @@ export interface DataGridEventMap<TRow = unknown> {
|
|
|
3905
3930
|
* @group Core Events
|
|
3906
3931
|
*/
|
|
3907
3932
|
'column-resize': ColumnResizeDetail;
|
|
3933
|
+
/**
|
|
3934
|
+
* Fired when a user-resized column is reset to its original configured width.
|
|
3935
|
+
* Triggered by the column header context menu "Reset width" action.
|
|
3936
|
+
*
|
|
3937
|
+
* @example
|
|
3938
|
+
* ```typescript
|
|
3939
|
+
* grid.on('column-resize-reset', ({ field, width }) => {
|
|
3940
|
+
* const widths = JSON.parse(localStorage.getItem('col-widths') ?? '{}');
|
|
3941
|
+
* delete widths[field];
|
|
3942
|
+
* localStorage.setItem('col-widths', JSON.stringify(widths));
|
|
3943
|
+
* });
|
|
3944
|
+
* ```
|
|
3945
|
+
*
|
|
3946
|
+
* @see {@link ColumnResizeResetDetail}
|
|
3947
|
+
* @group Core Events
|
|
3948
|
+
*/
|
|
3949
|
+
'column-resize-reset': ColumnResizeResetDetail;
|
|
3908
3950
|
/**
|
|
3909
3951
|
* Fired when column state changes — reordering, resizing, visibility toggle,
|
|
3910
3952
|
* or sort changes. Use with `getColumnState()` / `columnState` setter for
|