@toolbox-web/grid 2.9.0 → 2.11.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 -15
- package/all.js +2 -2
- package/all.js.map +1 -1
- package/custom-elements.json +10 -0
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +13 -2
- package/lib/core/internal/shell-controller.d.ts +9 -2
- package/lib/core/internal/shell.d.ts +10 -0
- package/lib/core/plugin/index.d.ts +1 -0
- package/lib/core/plugin/types.d.ts +65 -1
- package/lib/core/types.d.ts +58 -3
- 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.map +1 -1
- package/lib/plugins/export/index.js +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/export/types.d.ts +35 -5
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +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/index.js.map +1 -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 +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/export.umd.js +1 -1
- package/umd/plugins/export.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/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
package/lib/core/grid.d.ts
CHANGED
|
@@ -1372,15 +1372,26 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
1372
1372
|
* Each section can be expanded/collapsed independently.
|
|
1373
1373
|
*
|
|
1374
1374
|
* @group Tool Panel
|
|
1375
|
+
* @param panelId - Optional ID of the section to expand on open. When provided,
|
|
1376
|
+
* takes precedence over `shell.toolPanel.defaultOpen`. If the panel is already
|
|
1377
|
+
* open with a different section expanded, switches to the requested section.
|
|
1378
|
+
* If the panel ID is not registered, a warning is emitted and the call falls
|
|
1379
|
+
* back to default behavior (auto-expand `defaultOpen` or first registered panel).
|
|
1380
|
+
*
|
|
1375
1381
|
* @example
|
|
1376
1382
|
* ```typescript
|
|
1377
|
-
* // Open the tool panel
|
|
1383
|
+
* // Open the tool panel with the default / first section expanded.
|
|
1378
1384
|
* settingsButton.addEventListener('click', () => {
|
|
1379
1385
|
* grid.openToolPanel();
|
|
1380
1386
|
* });
|
|
1387
|
+
*
|
|
1388
|
+
* // Open the tool panel and jump straight to a specific section.
|
|
1389
|
+
* filtersButton.addEventListener('click', () => {
|
|
1390
|
+
* grid.openToolPanel('filters');
|
|
1391
|
+
* });
|
|
1381
1392
|
* ```
|
|
1382
1393
|
*/
|
|
1383
|
-
openToolPanel(): void;
|
|
1394
|
+
openToolPanel(panelId?: string): void;
|
|
1384
1395
|
/**
|
|
1385
1396
|
* Close the tool panel sidebar.
|
|
1386
1397
|
*
|
|
@@ -12,8 +12,15 @@ export interface ShellController {
|
|
|
12
12
|
readonly isPanelOpen: boolean;
|
|
13
13
|
/** Get IDs of expanded accordion sections */
|
|
14
14
|
readonly expandedSections: string[];
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Open the tool panel.
|
|
17
|
+
* @param panelId - Optional ID of the section to expand on open. When provided,
|
|
18
|
+
* takes precedence over `shell.toolPanel.defaultOpen`. If the panel is already
|
|
19
|
+
* open with a different section expanded, switches to the requested section.
|
|
20
|
+
* If the panel ID is not registered, a `TBW072` warning is emitted and the
|
|
21
|
+
* call falls back to default behavior (auto-expand `defaultOpen` or first by order).
|
|
22
|
+
*/
|
|
23
|
+
openToolPanel(panelId?: string): void;
|
|
17
24
|
/** Close the tool panel */
|
|
18
25
|
closeToolPanel(): void;
|
|
19
26
|
/** Toggle the tool panel */
|
|
@@ -21,6 +21,16 @@ export interface ShellState {
|
|
|
21
21
|
lightDomTitle: string | null;
|
|
22
22
|
/** IDs of tool panels registered from light DOM (to avoid re-parsing) */
|
|
23
23
|
lightDomToolPanelIds: Set<string>;
|
|
24
|
+
/**
|
|
25
|
+
* IDs of light DOM tool panels whose `render` has already been bound to a
|
|
26
|
+
* framework-adapter renderer. Used by `parseLightDomToolPanels` to detect
|
|
27
|
+
* the FIRST adapter attach (which legitimately needs to swap the vanilla
|
|
28
|
+
* fallback for the real adapter renderer and tear down any in-progress
|
|
29
|
+
* render) vs. subsequent re-parses (which must NOT tear down — doing so
|
|
30
|
+
* unmounts the user's React/Vue/Angular component, losing local state and
|
|
31
|
+
* resetting scroll position inside the panel).
|
|
32
|
+
*/
|
|
33
|
+
adapterBoundToolPanelIds: Set<string>;
|
|
24
34
|
/** IDs of toolbar content registered from light DOM (to avoid re-parsing) */
|
|
25
35
|
lightDomToolbarContentIds: Set<string>;
|
|
26
36
|
/** IDs of tool panels registered via registerToolPanel API */
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { BaseGridPlugin } from './base-plugin';
|
|
8
8
|
export type { AfterCellRenderContext, AfterRowRenderContext, CellClickEvent, CellCoords, CellEditor, CellMouseEvent, CellRenderer, ContextMenuItem, ContextMenuParams, GridElement, HeaderClickEvent, HeaderRenderer, KeyboardModifiers, PluginCellRenderContext, PluginHeaderRenderContext, PluginQuery, RowClickEvent, ScrollEvent, } from './base-plugin';
|
|
9
|
+
export type { CollectHeaderRowsContext, HeaderRowCell, HeaderRowContribution } from './types';
|
|
9
10
|
export { PluginManager } from './plugin-manager';
|
|
10
11
|
export type { EventDefinition, HookName, PluginConfigRule, PluginDependency, PluginIncompatibility, PluginManifest, PluginPropertyDefinition, QueryDefinition, } from './base-plugin';
|
|
11
12
|
export type { ColumnConfig } from '../types';
|
|
@@ -194,6 +194,67 @@ export interface PluginQuery<T = unknown> {
|
|
|
194
194
|
/** Query-specific context/parameters */
|
|
195
195
|
context: T;
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Context passed in {@link PluginQuery.context} for the `'collectHeaderRows'`
|
|
199
|
+
* query — used by consumers (e.g. the export plugin) to collect extra header
|
|
200
|
+
* rows that should sit **above** the leaf column-header row.
|
|
201
|
+
*
|
|
202
|
+
* Plugins that contribute header rows (e.g. `GroupingColumnsPlugin`) declare
|
|
203
|
+
* `{ type: 'collectHeaderRows' }` in their manifest and respond from
|
|
204
|
+
* `handleQuery` with a {@link HeaderRowContribution} — or an array of them
|
|
205
|
+
* for multi-row contributions (e.g. multi-level grouping). The consumer
|
|
206
|
+
* flattens array replies.
|
|
207
|
+
*
|
|
208
|
+
* The reply shape is intentionally generic — "here are some cells, each
|
|
209
|
+
* spanning N leaf columns" — so consumers don't need to know which plugin
|
|
210
|
+
* produced them. Responding plugins MUST align their contribution to the
|
|
211
|
+
* `columns` array on this context — `span` values are indices into it.
|
|
212
|
+
*
|
|
213
|
+
* @category Plugin Development
|
|
214
|
+
* @since 2.10.0
|
|
215
|
+
*/
|
|
216
|
+
export interface CollectHeaderRowsContext {
|
|
217
|
+
/** Resolved leaf columns (in display order) the consumer is about to emit. */
|
|
218
|
+
columns: ColumnConfig[];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Single cell in a contributed header row. `span` is the number of leaf
|
|
222
|
+
* columns this cell covers (always `>= 1`). The sum of `span` across all
|
|
223
|
+
* cells in a row MUST equal `context.columns.length`.
|
|
224
|
+
*
|
|
225
|
+
* `label === ''` is treated as a blank/dropped cell — consumers may still
|
|
226
|
+
* emit it (to preserve span alignment) or skip the entire row if every
|
|
227
|
+
* cell is blank.
|
|
228
|
+
*
|
|
229
|
+
* @category Plugin Development
|
|
230
|
+
* @since 2.10.0
|
|
231
|
+
*/
|
|
232
|
+
export interface HeaderRowCell {
|
|
233
|
+
/** Display label for this cell. Empty string = blank cell (span preserved). */
|
|
234
|
+
label: string;
|
|
235
|
+
/** Number of leaf columns covered. Always `>= 1`. */
|
|
236
|
+
span: number;
|
|
237
|
+
/** Optional plugin name (for debugging / `processHeaderRow` filtering). */
|
|
238
|
+
source?: string;
|
|
239
|
+
/** Optional opaque payload for consumers that need plugin-specific data. */
|
|
240
|
+
meta?: unknown;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* A single header row contributed by a plugin. Sits **above** the leaf
|
|
244
|
+
* column-header row in the visual / export output.
|
|
245
|
+
*
|
|
246
|
+
* Each contribution represents **one row**. A plugin needing multiple rows
|
|
247
|
+
* (e.g. multi-level grouping) returns `HeaderRowContribution[]` from
|
|
248
|
+
* `handleQuery`; the consumer flattens. Within each row, `cells` MUST
|
|
249
|
+
* independently sum to `context.columns.length`.
|
|
250
|
+
*
|
|
251
|
+
* @category Plugin Development
|
|
252
|
+
* @since 2.10.0
|
|
253
|
+
*/
|
|
254
|
+
export interface HeaderRowContribution {
|
|
255
|
+
/** Cells in this row, in left-to-right column order. */
|
|
256
|
+
cells: HeaderRowCell[];
|
|
257
|
+
}
|
|
197
258
|
/**
|
|
198
259
|
* Cell render context for plugin cell renderers.
|
|
199
260
|
* Provides full context including position and editing state.
|
|
@@ -414,8 +475,11 @@ export interface GridElementRef {
|
|
|
414
475
|
readonly expandedToolPanelSections: string[];
|
|
415
476
|
/**
|
|
416
477
|
* Open the tool panel sidebar (accordion view with all registered panels).
|
|
478
|
+
* @param panelId - Optional ID of the section to expand on open. Takes precedence
|
|
479
|
+
* over `shell.toolPanel.defaultOpen`. If the panel ID is unknown, the call
|
|
480
|
+
* falls back to default behavior with a `TBW072` warning.
|
|
417
481
|
*/
|
|
418
|
-
openToolPanel(): void;
|
|
482
|
+
openToolPanel(panelId?: string): void;
|
|
419
483
|
/**
|
|
420
484
|
* Close the tool panel sidebar.
|
|
421
485
|
*/
|
package/lib/core/types.d.ts
CHANGED
|
@@ -167,8 +167,11 @@ export interface PublicGrid<T = any> {
|
|
|
167
167
|
unregisterToolPanel?(panelId: string): void;
|
|
168
168
|
/**
|
|
169
169
|
* Open the tool panel sidebar.
|
|
170
|
+
* @param panelId - Optional ID of the section to expand on open. Takes precedence
|
|
171
|
+
* over `shell.toolPanel.defaultOpen`. Falls back to default behavior with a
|
|
172
|
+
* warning if the ID is not registered.
|
|
170
173
|
*/
|
|
171
|
-
openToolPanel?(): void;
|
|
174
|
+
openToolPanel?(panelId?: string): void;
|
|
172
175
|
/**
|
|
173
176
|
* Close the tool panel sidebar.
|
|
174
177
|
*/
|
|
@@ -3261,7 +3264,8 @@ export declare const DEFAULT_GRID_ICONS: Required<GridIcons>;
|
|
|
3261
3264
|
* },
|
|
3262
3265
|
* toolPanel: {
|
|
3263
3266
|
* position: 'right',
|
|
3264
|
-
*
|
|
3267
|
+
* initialState: 'open', // Sidebar open on load
|
|
3268
|
+
* defaultOpen: 'columns', // Auto-expand the "Columns" section
|
|
3265
3269
|
* },
|
|
3266
3270
|
* },
|
|
3267
3271
|
* plugins: [new VisibilityPlugin()], // Adds "Columns" panel
|
|
@@ -3343,8 +3347,59 @@ export interface ToolPanelConfig {
|
|
|
3343
3347
|
position?: 'left' | 'right';
|
|
3344
3348
|
/** Default panel width in pixels (default: 280) */
|
|
3345
3349
|
width?: number;
|
|
3346
|
-
/**
|
|
3350
|
+
/**
|
|
3351
|
+
* Accordion section to auto-expand the first time the tool panel opens.
|
|
3352
|
+
*
|
|
3353
|
+
* @deprecated **Behavior change planned for v3.0.0** — see [issue #259](https://github.com/OysteinAmundsen/toolbox/issues/259).
|
|
3354
|
+
*
|
|
3355
|
+
* Today (v2.x, kept for backward compatibility): setting `defaultOpen` also
|
|
3356
|
+
* **opens the sidebar** on grid load. This conflates "which section is
|
|
3357
|
+
* pre-selected" with "is the sidebar open", and there is no way to
|
|
3358
|
+
* pre-select a section without also forcing the sidebar open.
|
|
3359
|
+
*
|
|
3360
|
+
* In v3.0.0 (#259): `defaultOpen` will only pre-select which accordion
|
|
3361
|
+
* section auto-expands the first time the sidebar opens, and will no
|
|
3362
|
+
* longer open the sidebar by itself. Migrate by combining `defaultOpen`
|
|
3363
|
+
* with `initialState: 'open'` (or `locked: true`) when you want both
|
|
3364
|
+
* effects.
|
|
3365
|
+
*
|
|
3366
|
+
* Callers that want forward-compatible behavior today: prefer
|
|
3367
|
+
* `initialState` / `locked` for sidebar open state, and use `defaultOpen`
|
|
3368
|
+
* purely for section selection.
|
|
3369
|
+
*
|
|
3370
|
+
* @since 0.1.1
|
|
3371
|
+
*/
|
|
3347
3372
|
defaultOpen?: string;
|
|
3373
|
+
/**
|
|
3374
|
+
* Initial open state of the tool panel sidebar on grid load.
|
|
3375
|
+
*
|
|
3376
|
+
* - `'closed'` (default) — sidebar starts collapsed; user opens it via the
|
|
3377
|
+
* built-in toggle button or `grid.openToolPanel()`.
|
|
3378
|
+
* - `'open'` — sidebar starts open; the section named by {@link defaultOpen}
|
|
3379
|
+
* (or the first registered panel) is expanded.
|
|
3380
|
+
*
|
|
3381
|
+
* Takes precedence over the legacy v2 behavior of {@link defaultOpen}: if
|
|
3382
|
+
* `initialState` is set explicitly, it wins.
|
|
3383
|
+
*
|
|
3384
|
+
* @default 'closed'
|
|
3385
|
+
* @since 2.9.0
|
|
3386
|
+
*/
|
|
3387
|
+
initialState?: 'open' | 'closed';
|
|
3388
|
+
/**
|
|
3389
|
+
* When `true`, lock the tool panel sidebar in its open state.
|
|
3390
|
+
*
|
|
3391
|
+
* Effects:
|
|
3392
|
+
* - Implies `initialState: 'open'` — the sidebar is forced open on load.
|
|
3393
|
+
* - `grid.closeToolPanel()` / `grid.toggleToolPanel()` become no-ops while
|
|
3394
|
+
* locked (the panel cannot be closed by user or programmatic actions).
|
|
3395
|
+
* - Suppresses the built-in toolbar toggle button (same effect as
|
|
3396
|
+
* `shell.header.toolPanelToggle: false`) since toggling is disabled.
|
|
3397
|
+
* - Accordion sections inside the panel can still be expanded/collapsed.
|
|
3398
|
+
*
|
|
3399
|
+
* @default false
|
|
3400
|
+
* @since 2.9.0
|
|
3401
|
+
*/
|
|
3402
|
+
locked?: boolean;
|
|
3348
3403
|
/** Whether to persist open/closed state (requires Column State Events) */
|
|
3349
3404
|
persistState?: boolean;
|
|
3350
3405
|
/**
|