@toolbox-web/grid 1.28.2 → 1.29.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/custom-elements.json +43 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/constants.d.ts +1 -7
- package/lib/core/grid.d.ts +40 -3
- package/lib/core/internal/render-scheduler.d.ts +3 -1
- package/lib/core/plugin/base-plugin.d.ts +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +2 -0
- package/lib/core/types.d.ts +53 -0
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +0 -21
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -16
- 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/export/ExportPlugin.d.ts +0 -18
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +0 -21
- package/lib/plugins/filtering/filter-model.d.ts +8 -1
- package/lib/plugins/filtering/index.js +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +0 -16
- package/lib/plugins/grouping-columns/grouping-columns.d.ts +23 -3
- package/lib/plugins/grouping-columns/index.js +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +0 -23
- package/lib/plugins/grouping-rows/index.js +2 -2
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +0 -22
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +0 -18
- package/lib/plugins/multi-sort/index.js +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/multi-sort/multi-sort.d.ts +7 -0
- package/lib/plugins/pinned-columns/index.js +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +0 -11
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +0 -24
- package/lib/plugins/pivot/index.js +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts +2 -21
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder-columns/ReorderPlugin.d.ts +0 -7
- package/lib/plugins/reorder-columns/index.js +1 -1
- package/lib/plugins/reorder-columns/index.js.map +1 -1
- package/lib/plugins/reorder-rows/RowReorderPlugin.d.ts +1 -13
- package/lib/plugins/reorder-rows/index.js +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/selection/index.js +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -16
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tooltip/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +0 -22
- package/lib/plugins/tree/index.js +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +0 -19
- package/lib/plugins/undo-redo/index.js +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +0 -16
- package/lib/plugins/visibility/index.js +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/themes/dg-theme-material.css +5 -0
- 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/clipboard.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +1 -1
- package/umd/plugins/export.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/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.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/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
- package/umd/plugins/reorder-columns.umd.js +1 -1
- package/umd/plugins/reorder-columns.umd.js.map +1 -1
- package/umd/plugins/reorder-rows.umd.js +1 -1
- package/umd/plugins/reorder-rows.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/server-side.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
package/lib/core/constants.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* See each plugin's index.ts for plugin-specific exports.
|
|
13
13
|
*/
|
|
14
14
|
/**
|
|
15
|
-
* CSS class names used in the grid's
|
|
15
|
+
* CSS class names used in the grid's DOM.
|
|
16
16
|
* Use these when adding/removing classes or querying elements.
|
|
17
17
|
*
|
|
18
18
|
* Classes are organized by:
|
|
@@ -62,12 +62,8 @@ export declare const GridClasses: {
|
|
|
62
62
|
* @category Plugin Development
|
|
63
63
|
*/
|
|
64
64
|
export declare const GridDataAttrs: {
|
|
65
|
-
readonly ROW_INDEX: "data-row-index";
|
|
66
|
-
readonly COL_INDEX: "data-col-index";
|
|
67
65
|
readonly FIELD: "data-field";
|
|
68
66
|
readonly GROUP_KEY: "data-group-key";
|
|
69
|
-
readonly TREE_LEVEL: "data-tree-level";
|
|
70
|
-
readonly STICKY: "data-sticky";
|
|
71
67
|
};
|
|
72
68
|
/**
|
|
73
69
|
* Common CSS selectors for querying grid elements.
|
|
@@ -85,9 +81,7 @@ export declare const GridSelectors: {
|
|
|
85
81
|
readonly DATA_ROW: ".data-row";
|
|
86
82
|
readonly DATA_CELL: ".data-cell";
|
|
87
83
|
readonly GROUP_ROW: ".group-row";
|
|
88
|
-
readonly ROW_BY_INDEX: (index: number) => string;
|
|
89
84
|
readonly CELL_BY_FIELD: (field: string) => string;
|
|
90
|
-
readonly CELL_AT: (row: number, col: number) => string;
|
|
91
85
|
readonly SELECTED_ROWS: ".data-row.selected";
|
|
92
86
|
readonly EDITING_CELL: ".data-cell.editing";
|
|
93
87
|
};
|
package/lib/core/grid.d.ts
CHANGED
|
@@ -551,7 +551,7 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
551
551
|
/** @internal Apply animation configuration to host element. */
|
|
552
552
|
_applyAnimationConfig(config: GridConfig<T>): void;
|
|
553
553
|
/**
|
|
554
|
-
* Find the header row element
|
|
554
|
+
* Find the header row element.
|
|
555
555
|
* Used by plugins that need to access header cells for styling or measurement.
|
|
556
556
|
* @group DOM Access
|
|
557
557
|
* @internal Plugin API
|
|
@@ -1272,6 +1272,43 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
1272
1272
|
* @group State Persistence
|
|
1273
1273
|
*/
|
|
1274
1274
|
get columnState(): GridColumnState | undefined;
|
|
1275
|
+
/**
|
|
1276
|
+
* Get the current single-column sort state.
|
|
1277
|
+
*
|
|
1278
|
+
* Returns `null` when no sort is active.
|
|
1279
|
+
*
|
|
1280
|
+
* @group Sorting
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
* ```typescript
|
|
1284
|
+
* const sort = grid.sortModel;
|
|
1285
|
+
* // { field: 'name', direction: 'desc' } | null
|
|
1286
|
+
* ```
|
|
1287
|
+
*/
|
|
1288
|
+
get sortModel(): {
|
|
1289
|
+
field: string;
|
|
1290
|
+
direction: 'asc' | 'desc';
|
|
1291
|
+
} | null;
|
|
1292
|
+
/**
|
|
1293
|
+
* Sort by a column, toggle a column's sort direction, or clear sorting.
|
|
1294
|
+
*
|
|
1295
|
+
* - `sort('id', 'desc')` — apply sort with explicit direction
|
|
1296
|
+
* - `sort('id')` — toggle: none → asc → desc → none
|
|
1297
|
+
* - `sort(null)` — clear sort, restore original row order
|
|
1298
|
+
*
|
|
1299
|
+
* @param field - Column field to sort by, or `null` to clear
|
|
1300
|
+
* @param direction - Explicit direction; omit to toggle
|
|
1301
|
+
*
|
|
1302
|
+
* @group Sorting
|
|
1303
|
+
*
|
|
1304
|
+
* @example
|
|
1305
|
+
* ```typescript
|
|
1306
|
+
* grid.sort('id', 'desc'); // sort descending
|
|
1307
|
+
* grid.sort('price'); // toggle sort on price
|
|
1308
|
+
* grid.sort(null); // clear sort
|
|
1309
|
+
* ```
|
|
1310
|
+
*/
|
|
1311
|
+
sort(field: string | null, direction?: 'asc' | 'desc'): void;
|
|
1275
1312
|
/**
|
|
1276
1313
|
* Request a state change event to be emitted.
|
|
1277
1314
|
* Called internally after resize, reorder, visibility, or sort changes.
|
|
@@ -1600,10 +1637,10 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
1600
1637
|
*/
|
|
1601
1638
|
refreshShellHeader(): void;
|
|
1602
1639
|
/**
|
|
1603
|
-
* Register custom CSS styles
|
|
1640
|
+
* Register custom CSS styles via `document.adoptedStyleSheets`.
|
|
1604
1641
|
* Use this to style custom cell renderers, editors, or detail panels.
|
|
1605
1642
|
*
|
|
1606
|
-
* Uses adoptedStyleSheets for efficiency - styles survive
|
|
1643
|
+
* Uses adoptedStyleSheets for efficiency - styles survive DOM rebuilds.
|
|
1607
1644
|
*
|
|
1608
1645
|
* @group Custom Styles
|
|
1609
1646
|
* @param id - Unique identifier for the style block (for removal/updates)
|
|
@@ -56,7 +56,9 @@ export declare class RenderScheduler {
|
|
|
56
56
|
*/
|
|
57
57
|
get isPending(): boolean;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* The current pending phase (0 if nothing is pending).
|
|
60
|
+
* Used by `forceLayout()` to flush at the correct phase
|
|
61
|
+
* without unnecessarily escalating to FULL.
|
|
60
62
|
*/
|
|
61
63
|
get pendingPhase(): RenderPhase | 0;
|
|
62
64
|
}
|
|
@@ -334,7 +334,7 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
|
|
|
334
334
|
* Third-party plugins can override with their own semver.
|
|
335
335
|
*/
|
|
336
336
|
readonly version: string;
|
|
337
|
-
/** CSS styles to inject
|
|
337
|
+
/** CSS styles to inject via `document.adoptedStyleSheets` */
|
|
338
338
|
readonly styles?: string;
|
|
339
339
|
/** Custom cell renderers keyed by type name */
|
|
340
340
|
readonly cellRenderers?: Record<string, CellRenderer>;
|
|
@@ -24,6 +24,7 @@ export declare class PluginManager {
|
|
|
24
24
|
/** Cached hook presence flags — invalidated on plugin attach/detach */
|
|
25
25
|
private _hasAfterCellRender;
|
|
26
26
|
private _hasAfterRowRender;
|
|
27
|
+
private _hasProcessRows;
|
|
27
28
|
/**
|
|
28
29
|
* Event listeners indexed by event type.
|
|
29
30
|
* Maps event type → Map<plugin instance → callback>.
|
|
@@ -108,6 +109,7 @@ export declare class PluginManager {
|
|
|
108
109
|
}>;
|
|
109
110
|
/**
|
|
110
111
|
* Execute processRows hook on all plugins.
|
|
112
|
+
* Returns a mutable copy only when at least one plugin transforms rows.
|
|
111
113
|
*/
|
|
112
114
|
processRows(rows: readonly any[]): any[];
|
|
113
115
|
/**
|
package/lib/core/types.d.ts
CHANGED
|
@@ -232,6 +232,39 @@ export interface PublicGrid<T = any> {
|
|
|
232
232
|
* ```
|
|
233
233
|
*/
|
|
234
234
|
columnState?: GridColumnState;
|
|
235
|
+
/**
|
|
236
|
+
* Get the current sort state.
|
|
237
|
+
*
|
|
238
|
+
* Returns `null` when no sort is active.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const sort = grid.sortModel;
|
|
243
|
+
* // { field: 'id', direction: 'desc' } | null
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
readonly sortModel?: {
|
|
247
|
+
field: string;
|
|
248
|
+
direction: 'asc' | 'desc';
|
|
249
|
+
} | null;
|
|
250
|
+
/**
|
|
251
|
+
* Sort by a column, toggle a column's sort direction, or clear sorting.
|
|
252
|
+
*
|
|
253
|
+
* - `sort('id', 'desc')` — apply sort with explicit direction
|
|
254
|
+
* - `sort('id')` — toggle: none → asc → desc → none
|
|
255
|
+
* - `sort(null)` — clear sort, restore original row order
|
|
256
|
+
*
|
|
257
|
+
* @param field - Column field to sort by, or `null` to clear
|
|
258
|
+
* @param direction - Explicit direction; omit to toggle
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```typescript
|
|
262
|
+
* grid.sort('id', 'desc'); // sort descending
|
|
263
|
+
* grid.sort('price'); // toggle sort on price
|
|
264
|
+
* grid.sort(null); // clear sort
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
sort?(field: string | null, direction?: 'asc' | 'desc'): void;
|
|
235
268
|
/**
|
|
236
269
|
* Whether the grid is currently in a loading state.
|
|
237
270
|
* When true, displays a loading overlay with spinner.
|
|
@@ -2159,6 +2192,26 @@ export interface GridConfig<TRow = any> {
|
|
|
2159
2192
|
* ```
|
|
2160
2193
|
*/
|
|
2161
2194
|
sortHandler?: SortHandler<TRow>;
|
|
2195
|
+
/**
|
|
2196
|
+
* Initial sort state applied when the grid first renders.
|
|
2197
|
+
*
|
|
2198
|
+
* Equivalent to calling `grid.sort(field, direction)` after the grid is created,
|
|
2199
|
+
* but avoids the imperative call and extra render cycle.
|
|
2200
|
+
*
|
|
2201
|
+
* @example
|
|
2202
|
+
* ```ts
|
|
2203
|
+
* gridConfig = {
|
|
2204
|
+
* initialSort: { field: 'salary', direction: 'desc' },
|
|
2205
|
+
* };
|
|
2206
|
+
* ```
|
|
2207
|
+
*
|
|
2208
|
+
* @see {@link DataGrid.sort} for runtime sorting
|
|
2209
|
+
* @see {@link DataGrid.sortModel} for reading current sort state
|
|
2210
|
+
*/
|
|
2211
|
+
initialSort?: {
|
|
2212
|
+
field: string;
|
|
2213
|
+
direction: 'asc' | 'desc';
|
|
2214
|
+
};
|
|
2162
2215
|
/**
|
|
2163
2216
|
* Function to extract a unique identifier from a row.
|
|
2164
2217
|
* Used by `updateRow()`, `getRow()`, and ID-based tracking.
|
|
@@ -16,17 +16,6 @@ import { ClipboardConfig, CopyOptions } from './types';
|
|
|
16
16
|
* import { ClipboardPlugin } from '@toolbox-web/grid/plugins/clipboard';
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
-
* ## Configuration Options
|
|
20
|
-
*
|
|
21
|
-
* | Option | Type | Default | Description |
|
|
22
|
-
* |--------|------|---------|-------------|
|
|
23
|
-
* | `includeHeaders` | `boolean` | `false` | Include column headers in copied data |
|
|
24
|
-
* | `delimiter` | `string` | `'\t'` | Column delimiter (tab for Excel compatibility) |
|
|
25
|
-
* | `newline` | `string` | `'\n'` | Row delimiter |
|
|
26
|
-
* | `quoteStrings` | `boolean` | `false` | Wrap string values in quotes |
|
|
27
|
-
* | `processCell` | `(value, field, row) => string` | - | Custom cell value processor (overrides copy-what-you-see) |
|
|
28
|
-
* | `pasteHandler` | `PasteHandler \| null` | `defaultPasteHandler` | Custom paste handler |
|
|
29
|
-
*
|
|
30
19
|
* ## Keyboard Shortcuts
|
|
31
20
|
*
|
|
32
21
|
* | Shortcut | Action |
|
|
@@ -44,16 +33,6 @@ import { ClipboardConfig, CopyOptions } from './types';
|
|
|
44
33
|
* | Row selection | Paste is clipped to the selected rows |
|
|
45
34
|
* | No selection | Paste starts at row 0, column 0 |
|
|
46
35
|
*
|
|
47
|
-
* ## Programmatic API
|
|
48
|
-
*
|
|
49
|
-
* | Method | Signature | Description |
|
|
50
|
-
* |--------|-----------|-------------|
|
|
51
|
-
* | `copy` | `(options?: CopyOptions) => Promise<string>` | Copy to clipboard with optional column/row control |
|
|
52
|
-
* | `copyRows` | `(indices, options?) => Promise<string>` | Copy specific rows to clipboard |
|
|
53
|
-
* | `paste` | `() => Promise<string[][] \| null>` | Read and parse clipboard content |
|
|
54
|
-
* | `getSelectionAsText` | `(options?: CopyOptions) => string` | Get clipboard text without writing to clipboard |
|
|
55
|
-
* | `getLastCopied` | `() => { text, timestamp } \| null` | Get info about last copy operation |
|
|
56
|
-
*
|
|
57
36
|
* @example Basic Usage with Excel Compatibility
|
|
58
37
|
* ```ts
|
|
59
38
|
* import '@toolbox-web/grid';
|