@toolbox-web/grid 2.14.1 → 2.15.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/all.js +2 -2
- package/all.js.map +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/constants.d.ts +6 -6
- package/lib/core/plugin/base-plugin.d.ts +1 -1
- package/lib/core/types.d.ts +125 -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.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 +13 -0
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +22 -2
- package/lib/plugins/filtering/index.js +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 +8 -0
- 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 +7 -1
- 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.map +1 -1
- package/lib/plugins/row-drag-drop/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/sticky-rows/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/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- 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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.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/lib/core/constants.d.ts
CHANGED
|
@@ -30,9 +30,9 @@ export declare const GridClasses: {
|
|
|
30
30
|
readonly ROWS_VIEWPORT: "rows-viewport";
|
|
31
31
|
readonly ROWS_SPACER: "rows-spacer";
|
|
32
32
|
readonly ROWS_CONTAINER: "rows";
|
|
33
|
-
readonly DATA_ROW: "data-row";
|
|
33
|
+
readonly DATA_ROW: "data-grid-row";
|
|
34
34
|
readonly GROUP_ROW: "group-row";
|
|
35
|
-
readonly DATA_CELL: "
|
|
35
|
+
readonly DATA_CELL: "cell";
|
|
36
36
|
readonly SELECTED: "selected";
|
|
37
37
|
readonly FOCUSED: "focused";
|
|
38
38
|
readonly EDITING: "editing";
|
|
@@ -81,12 +81,12 @@ export declare const GridSelectors: {
|
|
|
81
81
|
readonly HEADER_CELL: ".header-cell";
|
|
82
82
|
readonly ROWS_VIEWPORT: ".rows-viewport";
|
|
83
83
|
readonly ROWS_CONTAINER: ".rows";
|
|
84
|
-
readonly DATA_ROW: ".data-row";
|
|
85
|
-
readonly DATA_CELL: ".
|
|
84
|
+
readonly DATA_ROW: ".data-grid-row";
|
|
85
|
+
readonly DATA_CELL: ".cell";
|
|
86
86
|
readonly GROUP_ROW: ".group-row";
|
|
87
87
|
readonly CELL_BY_FIELD: (field: string) => string;
|
|
88
|
-
readonly SELECTED_ROWS: ".data-row.selected";
|
|
89
|
-
readonly EDITING_CELL: ".
|
|
88
|
+
readonly SELECTED_ROWS: ".data-grid-row.selected";
|
|
89
|
+
readonly EDITING_CELL: ".cell.editing";
|
|
90
90
|
};
|
|
91
91
|
/**
|
|
92
92
|
* CSS custom property names for theming.
|
|
@@ -785,7 +785,7 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
|
|
|
785
785
|
* ```ts
|
|
786
786
|
* afterRender(): void {
|
|
787
787
|
* // Apply selection styling to rendered rows
|
|
788
|
-
* const rows = this.gridElement?.querySelectorAll('.data-row');
|
|
788
|
+
* const rows = this.gridElement?.querySelectorAll('.data-grid-row');
|
|
789
789
|
* rows?.forEach((row, i) => {
|
|
790
790
|
* row.classList.toggle('selected', this.selectedRows.has(i));
|
|
791
791
|
* });
|
package/lib/core/types.d.ts
CHANGED
|
@@ -1568,6 +1568,41 @@ export interface FrameworkAdapter {
|
|
|
1568
1568
|
* to use its default built-in editors.
|
|
1569
1569
|
*/
|
|
1570
1570
|
createEditor<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnEditorSpec<TRow, TValue> | undefined;
|
|
1571
|
+
/**
|
|
1572
|
+
* Creates a header cell renderer from a light DOM element (e.g. a slot or
|
|
1573
|
+
* template on a `<tbw-grid-column>`). Receives `HeaderCellContext` and
|
|
1574
|
+
* returns DOM / string for the entire header cell — the user is
|
|
1575
|
+
* responsible for sort icons and filter buttons (use
|
|
1576
|
+
* `ctx.renderSortIcon()` / `ctx.renderFilterButton()` helpers).
|
|
1577
|
+
*
|
|
1578
|
+
* Resize handles are appended automatically by the grid for resizable
|
|
1579
|
+
* columns regardless of which renderer path is active; do not render one
|
|
1580
|
+
* yourself.
|
|
1581
|
+
*
|
|
1582
|
+
* Returns undefined when the adapter has no header renderer registered
|
|
1583
|
+
* for this element, letting the grid fall back to its built-in header.
|
|
1584
|
+
*
|
|
1585
|
+
* Mirrors `headerRenderer` from `BaseColumnConfig`. Optional on the
|
|
1586
|
+
* adapter — adapters that don't expose a slot/template surface for
|
|
1587
|
+
* full-header customization can omit it; callers must null-check.
|
|
1588
|
+
*
|
|
1589
|
+
* @since 2.15.0
|
|
1590
|
+
*/
|
|
1591
|
+
createHeaderRenderer?<TRow = unknown>(element: HTMLElement): HeaderRenderer<TRow> | undefined;
|
|
1592
|
+
/**
|
|
1593
|
+
* Creates a header *label* renderer from a light DOM element. The grid
|
|
1594
|
+
* keeps ownership of the sort icon, filter button, and resize handle;
|
|
1595
|
+
* the returned function only customizes the label content.
|
|
1596
|
+
*
|
|
1597
|
+
* Returns undefined when the adapter has no header label renderer
|
|
1598
|
+
* registered for this element.
|
|
1599
|
+
*
|
|
1600
|
+
* Mirrors `headerLabelRenderer` from `BaseColumnConfig`. Optional on
|
|
1601
|
+
* the adapter — see `createHeaderRenderer` for rationale.
|
|
1602
|
+
*
|
|
1603
|
+
* @since 2.15.0
|
|
1604
|
+
*/
|
|
1605
|
+
createHeaderLabelRenderer?<TRow = unknown>(element: HTMLElement): HeaderLabelRenderer<TRow> | undefined;
|
|
1571
1606
|
/**
|
|
1572
1607
|
* Creates a tool panel renderer from a light DOM element.
|
|
1573
1608
|
* The renderer receives a container element and optionally returns a cleanup function.
|
|
@@ -3766,6 +3801,62 @@ export interface GridColumnState {
|
|
|
3766
3801
|
/** Array of column states. */
|
|
3767
3802
|
columns: ColumnState[];
|
|
3768
3803
|
}
|
|
3804
|
+
/**
|
|
3805
|
+
* Detail for the {@link DataGridEventMap.render | `render`} event.
|
|
3806
|
+
*
|
|
3807
|
+
* Fired once at the end of every render cycle (the single RAF flush in the
|
|
3808
|
+
* render scheduler), after all plugin `afterRender` hooks have run and after
|
|
3809
|
+
* `grid.ready()` has resolved.
|
|
3810
|
+
*
|
|
3811
|
+
* Use this when you need to act on the rendered DOM (e.g. focus the first
|
|
3812
|
+
* input of a freshly added row when `editing.mode === 'grid'`) without
|
|
3813
|
+
* resorting to `setTimeout` or double-`requestAnimationFrame` hacks.
|
|
3814
|
+
*
|
|
3815
|
+
* @example
|
|
3816
|
+
* ```typescript
|
|
3817
|
+
* // Focus the first cell's input after adding a row in full-grid edit mode
|
|
3818
|
+
* function addEmployee() {
|
|
3819
|
+
* grid.addRow({ id: crypto.randomUUID(), name: '', email: '' });
|
|
3820
|
+
* grid.addEventListener(
|
|
3821
|
+
* 'render',
|
|
3822
|
+
* () => {
|
|
3823
|
+
* const input = grid.querySelector<HTMLInputElement>(
|
|
3824
|
+
* '[data-row="0"][data-col="0"] input',
|
|
3825
|
+
* );
|
|
3826
|
+
* input?.focus();
|
|
3827
|
+
* },
|
|
3828
|
+
* { once: true },
|
|
3829
|
+
* );
|
|
3830
|
+
* }
|
|
3831
|
+
* ```
|
|
3832
|
+
*
|
|
3833
|
+
* @category Events
|
|
3834
|
+
* @since 2.15.0
|
|
3835
|
+
*/
|
|
3836
|
+
export interface RenderDetail {
|
|
3837
|
+
/**
|
|
3838
|
+
* The highest render phase that executed this cycle (see {@link RenderPhase}).
|
|
3839
|
+
* Use this to skip cheap scroll-only renders (`phase < RenderPhase.ROWS`)
|
|
3840
|
+
* if you only care about row/column model changes.
|
|
3841
|
+
*/
|
|
3842
|
+
phase: RenderPhase;
|
|
3843
|
+
/** `true` only for the very first render after the grid was connected. */
|
|
3844
|
+
initial: boolean;
|
|
3845
|
+
/** Number of rows in the effective row model after plugin `processRows` hooks ran. */
|
|
3846
|
+
rowCount: number;
|
|
3847
|
+
/**
|
|
3848
|
+
* The visible virtual window — `start` inclusive, `end` exclusive — or `null`
|
|
3849
|
+
* when virtualization is disabled (small datasets below the bypass threshold).
|
|
3850
|
+
*
|
|
3851
|
+
* When virtualization is enabled but no rows are visible (e.g. empty dataset)
|
|
3852
|
+
* this is `{ start: 0, end: 0 }`, NOT `null` — that lets consumers distinguish
|
|
3853
|
+
* "virtualization disabled" from "enabled but currently empty".
|
|
3854
|
+
*/
|
|
3855
|
+
visibleRange: {
|
|
3856
|
+
start: number;
|
|
3857
|
+
end: number;
|
|
3858
|
+
} | null;
|
|
3859
|
+
}
|
|
3769
3860
|
/**
|
|
3770
3861
|
* Detail for a cell click event.
|
|
3771
3862
|
* Provides full context about the clicked cell including row data.
|
|
@@ -4313,6 +4404,40 @@ export interface DataGridEventMap<TRow = unknown> {
|
|
|
4313
4404
|
* @group Core Events
|
|
4314
4405
|
*/
|
|
4315
4406
|
'column-state-change': GridColumnState;
|
|
4407
|
+
/**
|
|
4408
|
+
* Fired once at the end of every render cycle, after all plugin
|
|
4409
|
+
* `afterRender` hooks have run and `ready()` has resolved.
|
|
4410
|
+
*
|
|
4411
|
+
* This is the canonical post-render hook for consumers. Use it instead of
|
|
4412
|
+
* `setTimeout` / double-`requestAnimationFrame` to act on the rendered DOM
|
|
4413
|
+
* after a programmatic mutation.
|
|
4414
|
+
*
|
|
4415
|
+
* Note: `ready()` only resolves once (after the first render). The `render`
|
|
4416
|
+
* event fires on every flush — including scroll-driven virtual-window
|
|
4417
|
+
* updates — so prefer `{ once: true }` (or check `detail.phase`) when you
|
|
4418
|
+
* want to act on a specific mutation.
|
|
4419
|
+
*
|
|
4420
|
+
* @example
|
|
4421
|
+
* ```typescript
|
|
4422
|
+
* // Focus the first cell's input after addRow in full-grid edit mode
|
|
4423
|
+
* grid.addRow({ id: crypto.randomUUID(), name: '', email: '' });
|
|
4424
|
+
* grid.addEventListener(
|
|
4425
|
+
* 'render',
|
|
4426
|
+
* () => {
|
|
4427
|
+
* const input = grid.querySelector<HTMLInputElement>(
|
|
4428
|
+
* '[data-row="0"][data-col="0"] input',
|
|
4429
|
+
* );
|
|
4430
|
+
* input?.focus();
|
|
4431
|
+
* },
|
|
4432
|
+
* { once: true },
|
|
4433
|
+
* );
|
|
4434
|
+
* ```
|
|
4435
|
+
*
|
|
4436
|
+
* @see {@link RenderDetail}
|
|
4437
|
+
* @group Core Events
|
|
4438
|
+
* @since 2.15.0
|
|
4439
|
+
*/
|
|
4440
|
+
render: RenderDetail;
|
|
4316
4441
|
}
|
|
4317
4442
|
/**
|
|
4318
4443
|
* Extracts the event detail type for a given event name.
|