@toolbox-web/grid 2.9.0 → 2.10.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/plugin/index.d.ts +1 -0
- package/lib/core/plugin/types.d.ts +61 -0
- package/lib/core/types.d.ts +54 -2
- 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.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
|
@@ -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.
|
package/lib/core/types.d.ts
CHANGED
|
@@ -3261,7 +3261,8 @@ export declare const DEFAULT_GRID_ICONS: Required<GridIcons>;
|
|
|
3261
3261
|
* },
|
|
3262
3262
|
* toolPanel: {
|
|
3263
3263
|
* position: 'right',
|
|
3264
|
-
*
|
|
3264
|
+
* initialState: 'open', // Sidebar open on load
|
|
3265
|
+
* defaultOpen: 'columns', // Auto-expand the "Columns" section
|
|
3265
3266
|
* },
|
|
3266
3267
|
* },
|
|
3267
3268
|
* plugins: [new VisibilityPlugin()], // Adds "Columns" panel
|
|
@@ -3343,8 +3344,59 @@ export interface ToolPanelConfig {
|
|
|
3343
3344
|
position?: 'left' | 'right';
|
|
3344
3345
|
/** Default panel width in pixels (default: 280) */
|
|
3345
3346
|
width?: number;
|
|
3346
|
-
/**
|
|
3347
|
+
/**
|
|
3348
|
+
* Accordion section to auto-expand the first time the tool panel opens.
|
|
3349
|
+
*
|
|
3350
|
+
* @deprecated **Behavior change planned for v3.0.0** — see [issue #259](https://github.com/OysteinAmundsen/toolbox/issues/259).
|
|
3351
|
+
*
|
|
3352
|
+
* Today (v2.x, kept for backward compatibility): setting `defaultOpen` also
|
|
3353
|
+
* **opens the sidebar** on grid load. This conflates "which section is
|
|
3354
|
+
* pre-selected" with "is the sidebar open", and there is no way to
|
|
3355
|
+
* pre-select a section without also forcing the sidebar open.
|
|
3356
|
+
*
|
|
3357
|
+
* In v3.0.0 (#259): `defaultOpen` will only pre-select which accordion
|
|
3358
|
+
* section auto-expands the first time the sidebar opens, and will no
|
|
3359
|
+
* longer open the sidebar by itself. Migrate by combining `defaultOpen`
|
|
3360
|
+
* with `initialState: 'open'` (or `locked: true`) when you want both
|
|
3361
|
+
* effects.
|
|
3362
|
+
*
|
|
3363
|
+
* Callers that want forward-compatible behavior today: prefer
|
|
3364
|
+
* `initialState` / `locked` for sidebar open state, and use `defaultOpen`
|
|
3365
|
+
* purely for section selection.
|
|
3366
|
+
*
|
|
3367
|
+
* @since 0.1.1
|
|
3368
|
+
*/
|
|
3347
3369
|
defaultOpen?: string;
|
|
3370
|
+
/**
|
|
3371
|
+
* Initial open state of the tool panel sidebar on grid load.
|
|
3372
|
+
*
|
|
3373
|
+
* - `'closed'` (default) — sidebar starts collapsed; user opens it via the
|
|
3374
|
+
* built-in toggle button or `grid.openToolPanel()`.
|
|
3375
|
+
* - `'open'` — sidebar starts open; the section named by {@link defaultOpen}
|
|
3376
|
+
* (or the first registered panel) is expanded.
|
|
3377
|
+
*
|
|
3378
|
+
* Takes precedence over the legacy v2 behavior of {@link defaultOpen}: if
|
|
3379
|
+
* `initialState` is set explicitly, it wins.
|
|
3380
|
+
*
|
|
3381
|
+
* @default 'closed'
|
|
3382
|
+
* @since 2.9.0
|
|
3383
|
+
*/
|
|
3384
|
+
initialState?: 'open' | 'closed';
|
|
3385
|
+
/**
|
|
3386
|
+
* When `true`, lock the tool panel sidebar in its open state.
|
|
3387
|
+
*
|
|
3388
|
+
* Effects:
|
|
3389
|
+
* - Implies `initialState: 'open'` — the sidebar is forced open on load.
|
|
3390
|
+
* - `grid.closeToolPanel()` / `grid.toggleToolPanel()` become no-ops while
|
|
3391
|
+
* locked (the panel cannot be closed by user or programmatic actions).
|
|
3392
|
+
* - Suppresses the built-in toolbar toggle button (same effect as
|
|
3393
|
+
* `shell.header.toolPanelToggle: false`) since toggling is disabled.
|
|
3394
|
+
* - Accordion sections inside the panel can still be expanded/collapsed.
|
|
3395
|
+
*
|
|
3396
|
+
* @default false
|
|
3397
|
+
* @since 2.9.0
|
|
3398
|
+
*/
|
|
3399
|
+
locked?: boolean;
|
|
3348
3400
|
/** Whether to persist open/closed state (requires Column State Events) */
|
|
3349
3401
|
persistState?: boolean;
|
|
3350
3402
|
/**
|