@toolbox-web/grid 1.31.2 → 2.0.0-alpha
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 +0 -11
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +1 -29
- package/lib/core/internal/aggregators.bench.d.ts +1 -0
- package/lib/core/internal/aggregators.d.ts +0 -5
- package/lib/core/internal/aria.d.ts +13 -1
- package/lib/core/internal/config.bench.d.ts +1 -0
- package/lib/core/internal/diagnostics.d.ts +1 -3
- package/lib/core/internal/render-pipeline.bench.d.ts +9 -0
- package/lib/core/internal/shell.d.ts +0 -2
- package/lib/core/internal/sorting.bench.d.ts +1 -0
- package/lib/core/internal/virtualization.bench.d.ts +1 -0
- package/lib/core/plugin/base-plugin.d.ts +0 -116
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +0 -25
- package/lib/core/plugin/types.d.ts +0 -35
- package/lib/core/styles/index.d.ts +0 -1
- package/lib/core/types.d.ts +93 -25
- package/lib/features/multi-sort.d.ts +0 -2
- package/lib/features/multi-sort.js.map +1 -1
- package/lib/features/registry.d.ts +0 -1
- package/lib/features/registry.js +1 -1
- package/lib/features/registry.js.map +1 -1
- package/lib/features/reorder-columns.d.ts +0 -2
- package/lib/features/reorder-columns.js +1 -1
- package/lib/features/reorder-columns.js.map +1 -1
- package/lib/features/reorder-rows.d.ts +0 -2
- package/lib/features/reorder-rows.js +1 -1
- package/lib/features/reorder-rows.js.map +1 -1
- package/lib/plugins/clipboard/index.js +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/column-virtualization.bench.d.ts +1 -0
- package/lib/plugins/column-virtualization/index.js +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.d.ts +1 -1
- package/lib/plugins/editing/index.js +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/editing/types.d.ts +0 -9
- package/lib/plugins/export/index.js +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/filter-model.bench.d.ts +1 -0
- package/lib/plugins/filtering/index.js +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/grouping-columns.bench.d.ts +1 -0
- package/lib/plugins/grouping-columns/index.js +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/grouping-rows.bench.d.ts +1 -0
- package/lib/plugins/grouping-rows/grouping-rows.d.ts +3 -3
- package/lib/plugins/grouping-rows/index.js +2 -2
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/grouping-rows/types.d.ts +0 -2
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +0 -14
- package/lib/plugins/master-detail/index.js +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/master-detail/master-detail.bench.d.ts +1 -0
- package/lib/plugins/master-detail/master-detail.d.ts +3 -3
- package/lib/plugins/multi-sort/index.js +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.d.ts +1 -1
- package/lib/plugins/pinned-columns/index.js +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.bench.d.ts +1 -0
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +3 -6
- package/lib/plugins/pinned-columns/types.d.ts +0 -12
- 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 +0 -1
- package/lib/plugins/pivot/index.js +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/pivot/pivot-engine.bench.d.ts +1 -0
- package/lib/plugins/pivot/pivot-engine.d.ts +1 -4
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder-columns/index.js +1 -1
- package/lib/plugins/reorder-columns/index.js.map +1 -1
- package/lib/plugins/reorder-columns/types.d.ts +0 -4
- package/lib/plugins/reorder-rows/index.js +1 -1
- package/lib/plugins/reorder-rows/index.js.map +1 -1
- package/lib/plugins/reorder-rows/types.d.ts +0 -4
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +0 -23
- package/lib/plugins/responsive/index.js +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +2 -0
- package/lib/plugins/selection/index.js +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/datasource.bench.d.ts +1 -0
- package/lib/plugins/server-side/index.js +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tooltip/index.js +1 -1
- package/lib/plugins/tooltip/index.js.map +1 -1
- package/lib/plugins/tree/index.js +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/tree-data.bench.d.ts +1 -0
- package/lib/plugins/undo-redo/index.js +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 +3 -6
- 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/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +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 +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/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
package/lib/core/grid.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ShellState } from './internal/shell';
|
|
2
2
|
import { AfterCellRenderContext, AfterRowRenderContext, CellMouseEvent } from './plugin';
|
|
3
|
-
import { BaseGridPlugin
|
|
3
|
+
import { BaseGridPlugin } from './plugin/base-plugin';
|
|
4
4
|
import { PluginManager } from './plugin/plugin-manager';
|
|
5
5
|
import { ColumnConfig, ColumnConfigMap, ColumnInternal, DataGridEventMap, FitMode, FrameworkAdapter, GridColumnState, GridConfig, HeaderContentDefinition, IconValue, InternalGrid, PluginNameMap, ResizeController, RowAnimationType, RowElementInternal, RowTransaction, ScrollToRowOptions, ToolbarContentDefinition, ToolPanelDefinition, TransactionResult, UpdateSource, VirtualState } from './types';
|
|
6
6
|
export declare class DataGridElement<T = any> extends HTMLElement implements InternalGrid<T> {
|
|
@@ -512,12 +512,8 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
512
512
|
_updateAriaCounts(rowCount: number, colCount: number): void;
|
|
513
513
|
/** @internal Request a render at the given phase through the scheduler. */
|
|
514
514
|
_requestSchedulerPhase(phase: number, source: string): void;
|
|
515
|
-
/** @internal Plugin extra height for spacer calculation. */
|
|
516
|
-
_getPluginExtraHeight(): number;
|
|
517
515
|
/** @internal Plugin-specific row height override. */
|
|
518
516
|
_getPluginRowHeight(row: T, index: number): number | undefined;
|
|
519
|
-
/** @internal Plugin extra height before a given row index. */
|
|
520
|
-
_getPluginExtraHeightBefore(start: number): number;
|
|
521
517
|
/** @internal Let plugins adjust the virtual start index backwards. */
|
|
522
518
|
_adjustPluginVirtualStart(start: number, scrollTop: number, rowHeight: number): number | undefined;
|
|
523
519
|
/** @internal Run plugin afterRender hooks. */
|
|
@@ -612,20 +608,6 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
612
608
|
right: number;
|
|
613
609
|
skipScroll?: boolean;
|
|
614
610
|
};
|
|
615
|
-
/**
|
|
616
|
-
* Query all plugins with a generic query and collect responses.
|
|
617
|
-
* This enables inter-plugin communication without the core knowing plugin-specific concepts.
|
|
618
|
-
* @group Plugin Communication
|
|
619
|
-
* @internal Plugin API
|
|
620
|
-
*
|
|
621
|
-
* @example
|
|
622
|
-
* // Check if any plugin vetoes moving a column
|
|
623
|
-
* const responses = grid.queryPlugins<boolean>({ type: 'canMoveColumn', context: column });
|
|
624
|
-
* const canMove = !responses.includes(false);
|
|
625
|
-
*
|
|
626
|
-
* @deprecated Use the simplified `query<T>(type, context)` method instead. Will be removed in v2.
|
|
627
|
-
*/
|
|
628
|
-
queryPlugins<T>(query: PluginQuery): T[];
|
|
629
611
|
/**
|
|
630
612
|
* Query plugins with a simplified API.
|
|
631
613
|
* This is a convenience wrapper around `queryPlugins` that uses a flat signature.
|
|
@@ -1019,16 +1001,6 @@ export declare class DataGridElement<T = any> extends HTMLElement implements Int
|
|
|
1019
1001
|
* ```
|
|
1020
1002
|
*/
|
|
1021
1003
|
applyTransactionAsync(transaction: RowTransaction<T>): Promise<TransactionResult<T>>;
|
|
1022
|
-
/**
|
|
1023
|
-
* Suspend row processing for the next rows update.
|
|
1024
|
-
*
|
|
1025
|
-
* @deprecated This method is a no-op. Use {@link insertRow} or {@link removeRow}
|
|
1026
|
-
* instead, which correctly preserve the current sort/filter view while adding
|
|
1027
|
-
* or removing individual rows. Will be removed in v2.
|
|
1028
|
-
*
|
|
1029
|
-
* @group Lifecycle
|
|
1030
|
-
*/
|
|
1031
|
-
suspendProcessing(): void;
|
|
1032
1004
|
/**
|
|
1033
1005
|
* Move focus to a specific cell.
|
|
1034
1006
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -59,8 +59,3 @@ export declare function getValueAggregator(aggFunc: string): ValueAggregatorFn;
|
|
|
59
59
|
* @returns Aggregated result
|
|
60
60
|
*/
|
|
61
61
|
export declare function runValueAggregator(aggFunc: string, values: number[]): number;
|
|
62
|
-
export declare const registerAggregator: (name: string, fn: AggregatorFn) => void;
|
|
63
|
-
export declare const unregisterAggregator: (name: string) => void;
|
|
64
|
-
export declare const getAggregator: (ref: AggregatorRef | undefined) => AggregatorFn | undefined;
|
|
65
|
-
export declare const runAggregator: (ref: AggregatorRef | undefined, rows: any[], field: string, column?: any) => any;
|
|
66
|
-
export declare const listAggregators: () => string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridConfig } from '../types';
|
|
1
|
+
import { A11yMessages, GridConfig } from '../types';
|
|
2
2
|
import { ShellState } from './shell';
|
|
3
3
|
/**
|
|
4
4
|
* State for caching ARIA attributes to avoid redundant DOM writes.
|
|
@@ -53,7 +53,19 @@ export declare function updateAriaLabels<T>(state: AriaState, rowsBodyEl: HTMLEl
|
|
|
53
53
|
* Announce a message to screen readers via the grid's aria-live region.
|
|
54
54
|
* Clears then sets text to ensure repeated messages are re-announced.
|
|
55
55
|
*
|
|
56
|
+
* Respects `effectiveConfig.a11y.announcements` — if set to `false`,
|
|
57
|
+
* the announcement is silently skipped.
|
|
58
|
+
*
|
|
56
59
|
* @param gridEl - The grid host element (or any ancestor containing `.tbw-sr-only`)
|
|
57
60
|
* @param message - The message to announce
|
|
58
61
|
*/
|
|
59
62
|
export declare function announce(gridEl: HTMLElement, message: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Get an announcement message, preferring custom overrides from config.
|
|
65
|
+
* Falls back to default English messages when no override is provided.
|
|
66
|
+
*
|
|
67
|
+
* @param gridEl - The grid host element
|
|
68
|
+
* @param key - The message key from A11yMessages
|
|
69
|
+
* @param args - Arguments to pass to the message function
|
|
70
|
+
*/
|
|
71
|
+
export declare function getA11yMessage<K extends keyof A11yMessages>(gridEl: HTMLElement, key: K, ...args: Parameters<A11yMessages[K]>): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -64,8 +64,6 @@ export declare const MISSING_DEPENDENCY: "TBW020";
|
|
|
64
64
|
export declare const OPTIONAL_DEPENDENCY: "TBW021";
|
|
65
65
|
/** Two loaded plugins are incompatible. */
|
|
66
66
|
export declare const INCOMPATIBLE_PLUGINS: "TBW022";
|
|
67
|
-
/** Plugin uses deprecated hooks. */
|
|
68
|
-
export declare const DEPRECATED_HOOK: "TBW023";
|
|
69
67
|
/** Error thrown inside a plugin event handler. */
|
|
70
68
|
export declare const PLUGIN_EVENT_ERROR: "TBW024";
|
|
71
69
|
/** Feature was re-registered (overwritten). */
|
|
@@ -130,7 +128,7 @@ export declare const STYLE_EXTRACT_FAILED: "TBW120";
|
|
|
130
128
|
export declare const STYLE_NOT_FOUND: "TBW121";
|
|
131
129
|
/** Invalid JSON in an HTML attribute. */
|
|
132
130
|
export declare const INVALID_ATTRIBUTE_JSON: "TBW130";
|
|
133
|
-
export type DiagnosticCode = typeof MISSING_PLUGIN | typeof MISSING_PLUGIN_CONFIG | typeof CONFIG_RULE_ERROR | typeof CONFIG_RULE_WARN | typeof MISSING_DEPENDENCY | typeof OPTIONAL_DEPENDENCY | typeof INCOMPATIBLE_PLUGINS | typeof
|
|
131
|
+
export type DiagnosticCode = typeof MISSING_PLUGIN | typeof MISSING_PLUGIN_CONFIG | typeof CONFIG_RULE_ERROR | typeof CONFIG_RULE_WARN | typeof MISSING_DEPENDENCY | typeof OPTIONAL_DEPENDENCY | typeof INCOMPATIBLE_PLUGINS | typeof PLUGIN_EVENT_ERROR | typeof FEATURE_REREGISTERED | typeof FEATURE_NOT_IMPORTED | typeof FEATURE_MISSING_DEP | typeof MISSING_ROW_ID | typeof ROW_NOT_FOUND | typeof INVALID_COLUMN_WIDTH | typeof ROW_CLASS_ERROR | typeof CELL_CLASS_ERROR | typeof FORMAT_ERROR | typeof VIEW_MOUNT_ERROR | typeof VIEW_DISPATCH_ERROR | typeof TOOL_PANEL_MISSING_ATTR | typeof NO_TOOL_PANELS | typeof TOOL_PANEL_NOT_FOUND | typeof TOOL_PANEL_DUPLICATE | typeof HEADER_CONTENT_DUPLICATE | typeof TOOLBAR_CONTENT_DUPLICATE | typeof EDITOR_MOUNT_ERROR | typeof PRINT_IN_PROGRESS | typeof PRINT_NO_GRID | typeof PRINT_FAILED | typeof PRINT_DUPLICATE_ID | typeof CLIPBOARD_FAILED | typeof MISSING_BREAKPOINT | typeof TRANSACTION_IN_PROGRESS | typeof NO_TRANSACTION | typeof COLUMN_GROUP_NO_ID | typeof COLUMN_GROUPS_CONFLICT | typeof STYLE_EXTRACT_FAILED | typeof STYLE_NOT_FOUND | typeof INVALID_ATTRIBUTE_JSON;
|
|
134
132
|
/**
|
|
135
133
|
* Format a diagnostic message with prefix, code, and docs link.
|
|
136
134
|
*
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render Pipeline Benchmarks
|
|
3
|
+
*
|
|
4
|
+
* Measures the combined cost of operations that the render scheduler
|
|
5
|
+
* executes per flush cycle: sorting → processRows plugins → processColumns
|
|
6
|
+
* plugins → virtualization. This catches regressions from plugin
|
|
7
|
+
* composition overhead that per-function benchmarks miss.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
@@ -226,8 +226,6 @@ export interface ShellController {
|
|
|
226
226
|
setInitialized(value: boolean): void;
|
|
227
227
|
/** Whether the tool panel is currently open */
|
|
228
228
|
readonly isPanelOpen: boolean;
|
|
229
|
-
/** Get the currently active panel ID (deprecated) */
|
|
230
|
-
readonly activePanel: string | null;
|
|
231
229
|
/** Get IDs of expanded accordion sections */
|
|
232
230
|
readonly expandedSections: string[];
|
|
233
231
|
/** Open the tool panel */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DiagnosticCode } from '../internal/diagnostics';
|
|
2
2
|
import { ColumnConfig, ColumnState, GridIcons, GridPlugin, HeaderContentDefinition, IconValue, PluginNameMap, ToolPanelDefinition } from '../types';
|
|
3
3
|
import { AfterCellRenderContext, AfterRowRenderContext, CellClickEvent, CellEditor, CellMouseEvent, CellRenderer, GridElementRef, HeaderClickEvent, HeaderRenderer, PluginQuery, RowClickEvent, ScrollEvent } from './types';
|
|
4
|
-
export { PLUGIN_QUERIES } from './types';
|
|
5
4
|
export type { AfterCellRenderContext, AfterRowRenderContext, CellClickEvent, CellCoords, CellEditor, CellMouseEvent, CellRenderer, ContextMenuItem, ContextMenuParams, GridElementRef, HeaderClickEvent, HeaderRenderer, KeyboardModifiers, PluginCellRenderContext, PluginQuery, RowClickEvent, ScrollEvent, } from './types';
|
|
6
5
|
/**
|
|
7
6
|
* Grid element interface for plugins.
|
|
@@ -607,16 +606,6 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
|
|
|
607
606
|
* ```
|
|
608
607
|
*/
|
|
609
608
|
protected get animationDuration(): number;
|
|
610
|
-
/**
|
|
611
|
-
* Resolve an icon value to string or HTMLElement.
|
|
612
|
-
* Checks plugin config first, then grid-level icons, then defaults.
|
|
613
|
-
*
|
|
614
|
-
* @deprecated Use `setIcon(element, iconKey)` instead. Will be removed in v2.0.0.
|
|
615
|
-
* @param iconKey - The icon key in GridIcons (e.g., 'expand', 'collapse')
|
|
616
|
-
* @param pluginOverride - Optional plugin-level override
|
|
617
|
-
* @returns The resolved icon value
|
|
618
|
-
*/
|
|
619
|
-
protected resolveIcon(iconKey: keyof GridIcons, pluginOverride?: IconValue): IconValue;
|
|
620
609
|
/**
|
|
621
610
|
* Set an icon on an element using the CSS-first hybrid approach.
|
|
622
611
|
*
|
|
@@ -823,68 +812,6 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
|
|
|
823
812
|
* ```
|
|
824
813
|
*/
|
|
825
814
|
onScrollRender?(): void;
|
|
826
|
-
/**
|
|
827
|
-
* Return extra height contributed by this plugin (e.g., expanded detail rows).
|
|
828
|
-
* Used to adjust scrollbar height calculations for virtualization.
|
|
829
|
-
*
|
|
830
|
-
* @returns Total extra height in pixels
|
|
831
|
-
*
|
|
832
|
-
* @deprecated Use {@link getRowHeight} instead. This hook will be removed in v2.0.
|
|
833
|
-
* The new `getRowHeight(row, index)` hook provides per-row height information which
|
|
834
|
-
* enables better position caching and variable row height support.
|
|
835
|
-
*
|
|
836
|
-
* @example
|
|
837
|
-
* ```ts
|
|
838
|
-
* // OLD (deprecated):
|
|
839
|
-
* getExtraHeight(): number {
|
|
840
|
-
* return this.expandedRows.size * this.detailHeight;
|
|
841
|
-
* }
|
|
842
|
-
*
|
|
843
|
-
* // NEW (preferred):
|
|
844
|
-
* getRowHeight(row: unknown, index: number): number | undefined {
|
|
845
|
-
* if (this.isExpanded(row)) {
|
|
846
|
-
* return this.baseRowHeight + this.getDetailHeight(row);
|
|
847
|
-
* }
|
|
848
|
-
* return undefined;
|
|
849
|
-
* }
|
|
850
|
-
* ```
|
|
851
|
-
*/
|
|
852
|
-
getExtraHeight?(): number;
|
|
853
|
-
/**
|
|
854
|
-
* Return extra height that appears before a given row index.
|
|
855
|
-
* Used by virtualization to correctly calculate scroll positions when
|
|
856
|
-
* there's variable height content (like expanded detail rows) above the viewport.
|
|
857
|
-
*
|
|
858
|
-
* @param beforeRowIndex - The row index to calculate extra height before
|
|
859
|
-
* @returns Extra height in pixels that appears before this row
|
|
860
|
-
*
|
|
861
|
-
* @deprecated Use {@link getRowHeight} instead. This hook will be removed in v2.0.
|
|
862
|
-
* The new `getRowHeight(row, index)` hook provides per-row height information which
|
|
863
|
-
* enables better position caching and variable row height support.
|
|
864
|
-
*
|
|
865
|
-
* @example
|
|
866
|
-
* ```ts
|
|
867
|
-
* // OLD (deprecated):
|
|
868
|
-
* getExtraHeightBefore(beforeRowIndex: number): number {
|
|
869
|
-
* let height = 0;
|
|
870
|
-
* for (const expandedRowIndex of this.expandedRowIndices) {
|
|
871
|
-
* if (expandedRowIndex < beforeRowIndex) {
|
|
872
|
-
* height += this.getDetailHeight(expandedRowIndex);
|
|
873
|
-
* }
|
|
874
|
-
* }
|
|
875
|
-
* return height;
|
|
876
|
-
* }
|
|
877
|
-
*
|
|
878
|
-
* // NEW (preferred):
|
|
879
|
-
* getRowHeight(row: unknown, index: number): number | undefined {
|
|
880
|
-
* if (this.isExpanded(row)) {
|
|
881
|
-
* return this.baseRowHeight + this.getDetailHeight(row);
|
|
882
|
-
* }
|
|
883
|
-
* return undefined;
|
|
884
|
-
* }
|
|
885
|
-
* ```
|
|
886
|
-
*/
|
|
887
|
-
getExtraHeightBefore?(beforeRowIndex: number): number;
|
|
888
815
|
/**
|
|
889
816
|
* Get the height of a specific row.
|
|
890
817
|
* Used for synthetic rows (group headers, detail panels, etc.) that have fixed heights.
|
|
@@ -896,17 +823,6 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
|
|
|
896
823
|
* @param row - The row data
|
|
897
824
|
* @param index - The row index in the processed rows array
|
|
898
825
|
* @returns The row height in pixels, or undefined if not managed by this plugin
|
|
899
|
-
*
|
|
900
|
-
* @example
|
|
901
|
-
* ```ts
|
|
902
|
-
* getRowHeight(row: unknown, index: number): number | undefined {
|
|
903
|
-
* // Group headers have a fixed height
|
|
904
|
-
* if (this.isGroupHeader(row)) {
|
|
905
|
-
* return 32;
|
|
906
|
-
* }
|
|
907
|
-
* return undefined; // Let grid use default/measured height
|
|
908
|
-
* }
|
|
909
|
-
* ```
|
|
910
826
|
*/
|
|
911
827
|
getRowHeight?(row: unknown, index: number): number | undefined;
|
|
912
828
|
/**
|
|
@@ -956,38 +872,6 @@ export declare abstract class BaseGridPlugin<TConfig = unknown> implements GridP
|
|
|
956
872
|
* ```
|
|
957
873
|
*/
|
|
958
874
|
renderRow?(row: any, rowEl: HTMLElement, rowIndex: number): boolean | void;
|
|
959
|
-
/**
|
|
960
|
-
* Handle queries from other plugins.
|
|
961
|
-
* This is the generic mechanism for inter-plugin communication.
|
|
962
|
-
* Plugins can respond to well-known query types or define their own.
|
|
963
|
-
*
|
|
964
|
-
* **Prefer `handleQuery` for new plugins** - it has the same signature but
|
|
965
|
-
* a clearer name. `onPluginQuery` is kept for backwards compatibility.
|
|
966
|
-
*
|
|
967
|
-
* @category Plugin Development
|
|
968
|
-
* @param query - The query object with type and context
|
|
969
|
-
* @returns Query-specific response, or undefined if not handling this query
|
|
970
|
-
*
|
|
971
|
-
* @example
|
|
972
|
-
* ```ts
|
|
973
|
-
* onPluginQuery(query: PluginQuery): unknown {
|
|
974
|
-
* switch (query.type) {
|
|
975
|
-
* case PLUGIN_QUERIES.CAN_MOVE_COLUMN:
|
|
976
|
-
* // Prevent moving pinned columns
|
|
977
|
-
* const column = query.context as ColumnConfig;
|
|
978
|
-
* if (column.sticky === 'left' || column.sticky === 'right') {
|
|
979
|
-
* return false;
|
|
980
|
-
* }
|
|
981
|
-
* break;
|
|
982
|
-
* case PLUGIN_QUERIES.GET_CONTEXT_MENU_ITEMS:
|
|
983
|
-
* const params = query.context as ContextMenuParams;
|
|
984
|
-
* return [{ id: 'my-action', label: 'My Action', action: () => {} }];
|
|
985
|
-
* }
|
|
986
|
-
* }
|
|
987
|
-
* ```
|
|
988
|
-
* @deprecated Use `handleQuery` instead for new plugins. Will be removed in v2.
|
|
989
|
-
*/
|
|
990
|
-
onPluginQuery?(query: PluginQuery): unknown;
|
|
991
875
|
/**
|
|
992
876
|
* Handle queries from other plugins or the grid.
|
|
993
877
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Public API for the plugin infrastructure.
|
|
5
5
|
* All plugins extend BaseGridPlugin and are attached to grids via PluginManager.
|
|
6
6
|
*/
|
|
7
|
-
export { BaseGridPlugin
|
|
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
9
|
export { PluginManager } from './plugin-manager';
|
|
10
10
|
export type { EventDefinition, HookName, PluginConfigRule, PluginDependency, PluginIncompatibility, PluginManifest, PluginPropertyDefinition, QueryDefinition, } from './base-plugin';
|
|
@@ -37,8 +37,6 @@ export declare class PluginManager {
|
|
|
37
37
|
* Built from manifest.queries during plugin attach.
|
|
38
38
|
*/
|
|
39
39
|
private queryHandlers;
|
|
40
|
-
/** Set of plugin constructors that have been warned about deprecated hooks */
|
|
41
|
-
private static deprecationWarned;
|
|
42
40
|
constructor(grid: GridElement);
|
|
43
41
|
/**
|
|
44
42
|
* Attach all plugins from the config.
|
|
@@ -53,11 +51,6 @@ export declare class PluginManager {
|
|
|
53
51
|
* Register query handlers from a plugin's manifest.
|
|
54
52
|
*/
|
|
55
53
|
private registerQueryHandlers;
|
|
56
|
-
/**
|
|
57
|
-
* Warn about deprecated plugin hooks.
|
|
58
|
-
* Only warns once per plugin class, only in development environments.
|
|
59
|
-
*/
|
|
60
|
-
private warnDeprecatedHooks;
|
|
61
54
|
/**
|
|
62
55
|
* Unregister query handlers for a plugin.
|
|
63
56
|
*/
|
|
@@ -153,22 +146,6 @@ export declare class PluginManager {
|
|
|
153
146
|
* Called after scroll-triggered row rendering for lightweight visual state updates.
|
|
154
147
|
*/
|
|
155
148
|
onScrollRender(): void;
|
|
156
|
-
/**
|
|
157
|
-
* Get total extra height contributed by plugins (e.g., expanded detail rows).
|
|
158
|
-
* Used to adjust scrollbar height calculations.
|
|
159
|
-
*/
|
|
160
|
-
getExtraHeight(): number;
|
|
161
|
-
/**
|
|
162
|
-
* Check if any plugin is contributing extra height.
|
|
163
|
-
* When true, plugins are managing variable row heights and the grid should
|
|
164
|
-
* not override the base row height via #measureRowHeight().
|
|
165
|
-
*/
|
|
166
|
-
hasExtraHeight(): boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Get extra height from plugins that appears before a given row index.
|
|
169
|
-
* Used by virtualization to correctly position the scroll window.
|
|
170
|
-
*/
|
|
171
|
-
getExtraHeightBefore(beforeRowIndex: number): number;
|
|
172
149
|
/**
|
|
173
150
|
* Get the height of a specific row from plugins.
|
|
174
151
|
* Used for synthetic rows (group headers, etc.) that have fixed heights.
|
|
@@ -198,8 +175,6 @@ export declare class PluginManager {
|
|
|
198
175
|
* the query type in their `manifest.queries` are invoked. Falls back to querying
|
|
199
176
|
* all plugins for backwards compatibility with legacy plugins.
|
|
200
177
|
*
|
|
201
|
-
* Checks both `handleQuery` (preferred) and `onPluginQuery` (legacy) hooks.
|
|
202
|
-
*
|
|
203
178
|
* @param query - The query object containing type and context
|
|
204
179
|
* @returns Array of non-undefined responses from plugins
|
|
205
180
|
*/
|
|
@@ -190,28 +190,6 @@ export interface PluginQuery<T = unknown> {
|
|
|
190
190
|
/** Query-specific context/parameters */
|
|
191
191
|
context: T;
|
|
192
192
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Well-known plugin query types.
|
|
195
|
-
* Plugins can define additional query types beyond these.
|
|
196
|
-
*
|
|
197
|
-
* @deprecated Use string literals with `grid.query()` instead. Query types should
|
|
198
|
-
* be declared in the responding plugin's `manifest.queries` for automatic routing.
|
|
199
|
-
* This constant will be removed in v2.0.
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* // Before (deprecated):
|
|
203
|
-
* import { PLUGIN_QUERIES } from '@toolbox-web/grid';
|
|
204
|
-
* const responses = grid.queryPlugins({ type: PLUGIN_QUERIES.CAN_MOVE_COLUMN, context: column });
|
|
205
|
-
*
|
|
206
|
-
* // After (recommended):
|
|
207
|
-
* const responses = grid.query<boolean>('canMoveColumn', column);
|
|
208
|
-
*/
|
|
209
|
-
export declare const PLUGIN_QUERIES: {
|
|
210
|
-
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
211
|
-
readonly CAN_MOVE_COLUMN: "canMoveColumn";
|
|
212
|
-
/** Get context menu items. Context: ContextMenuParams. Response: ContextMenuItem[] */
|
|
213
|
-
readonly GET_CONTEXT_MENU_ITEMS: "getContextMenuItems";
|
|
214
|
-
};
|
|
215
193
|
/**
|
|
216
194
|
* Cell render context for plugin cell renderers.
|
|
217
195
|
* Provides full context including position and editing state.
|
|
@@ -352,19 +330,6 @@ export interface GridElementRef {
|
|
|
352
330
|
unsubscribe(plugin: unknown, eventType: string): void;
|
|
353
331
|
emitPluginEvent<T>(eventType: string, detail: T): void;
|
|
354
332
|
};
|
|
355
|
-
/**
|
|
356
|
-
* Query all plugins with a generic query and collect responses.
|
|
357
|
-
* Used for inter-plugin communication (e.g., asking PinnedColumnsPlugin
|
|
358
|
-
* if a column can be moved).
|
|
359
|
-
*
|
|
360
|
-
* @example
|
|
361
|
-
* const responses = grid.queryPlugins<boolean>({
|
|
362
|
-
* type: PLUGIN_QUERIES.CAN_MOVE_COLUMN,
|
|
363
|
-
* context: column
|
|
364
|
-
* });
|
|
365
|
-
* const canMove = !responses.includes(false);
|
|
366
|
-
*/
|
|
367
|
-
queryPlugins<T>(query: PluginQuery): T[];
|
|
368
333
|
/**
|
|
369
334
|
* Query plugins with a simplified API.
|
|
370
335
|
* Convenience wrapper that uses a flat signature.
|
package/lib/core/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ShellState } from './internal/shell';
|
|
2
2
|
import { RowPosition } from './internal/virtualization';
|
|
3
|
-
import { PluginQuery } from './plugin/base-plugin';
|
|
4
3
|
import { AfterCellRenderContext, AfterRowRenderContext, CellMouseEvent } from './plugin/types';
|
|
5
4
|
/**
|
|
6
5
|
* Position entry for a single row in the position cache.
|
|
@@ -535,8 +534,6 @@ export interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
|
|
|
535
534
|
right: number;
|
|
536
535
|
skipScroll?: boolean;
|
|
537
536
|
};
|
|
538
|
-
/** Query all plugins with a generic query and collect responses */
|
|
539
|
-
queryPlugins?: <T>(query: PluginQuery) => T[];
|
|
540
537
|
/** Request emission of column-state-change event (debounced) */
|
|
541
538
|
requestStateChange?: () => void;
|
|
542
539
|
/** @internal Clear the cached _visibleColumns array so the next read recomputes from _columns. */
|
|
@@ -546,9 +543,7 @@ export interface InternalGrid<T = any> extends PublicGrid<T>, GridConfig<T> {
|
|
|
546
543
|
/** @internal */ _requestSchedulerPhase(phase: number, source: string): void;
|
|
547
544
|
/** @internal */ _rebuildRowIdMap(): void;
|
|
548
545
|
/** @internal */ _emitDataChange(): void;
|
|
549
|
-
/** @internal */ _getPluginExtraHeight(): number;
|
|
550
546
|
/** @internal */ _getPluginRowHeight(row: T, index: number): number | undefined;
|
|
551
|
-
/** @internal */ _getPluginExtraHeightBefore(start: number): number;
|
|
552
547
|
/** @internal */ _adjustPluginVirtualStart(start: number, scrollTop: number, rowHeight: number): number | undefined;
|
|
553
548
|
/** @internal */ _afterPluginRender(): void;
|
|
554
549
|
/** @internal */ _emitPluginEvent(event: string, detail: unknown): void;
|
|
@@ -1967,6 +1962,74 @@ export interface FeatureConfig<TRow = unknown> {
|
|
|
1967
1962
|
*/
|
|
1968
1963
|
__brand?: never;
|
|
1969
1964
|
}
|
|
1965
|
+
/**
|
|
1966
|
+
* Default announcement messages for screen reader live regions.
|
|
1967
|
+
* Each function returns a localized string for a specific state change.
|
|
1968
|
+
* Override individual messages via {@link A11yConfig.messages} for i18n.
|
|
1969
|
+
*
|
|
1970
|
+
* @group Accessibility
|
|
1971
|
+
*/
|
|
1972
|
+
export interface A11yMessages {
|
|
1973
|
+
/** Announced when sorting is applied. */
|
|
1974
|
+
sortApplied: (column: string, direction: string) => string;
|
|
1975
|
+
/** Announced when sorting is cleared. */
|
|
1976
|
+
sortCleared: () => string;
|
|
1977
|
+
/** Announced when a filter is applied. */
|
|
1978
|
+
filterApplied: (column: string) => string;
|
|
1979
|
+
/** Announced when a filter is cleared from a column. */
|
|
1980
|
+
filterCleared: (column: string) => string;
|
|
1981
|
+
/** Announced when all filters are cleared. */
|
|
1982
|
+
allFiltersCleared: () => string;
|
|
1983
|
+
/** Announced when a group row is expanded. */
|
|
1984
|
+
groupExpanded: (name: string, count: number) => string;
|
|
1985
|
+
/** Announced when a group row is collapsed. */
|
|
1986
|
+
groupCollapsed: (name: string) => string;
|
|
1987
|
+
/** Announced when row selection changes. */
|
|
1988
|
+
selectionChanged: (count: number) => string;
|
|
1989
|
+
/** Announced when row editing starts. */
|
|
1990
|
+
editingStarted: (rowIndex: number) => string;
|
|
1991
|
+
/** Announced when row editing is committed. */
|
|
1992
|
+
editingCommitted: (rowIndex: number) => string;
|
|
1993
|
+
/** Announced when data is loaded. */
|
|
1994
|
+
dataLoaded: (count: number) => string;
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Accessibility configuration for controlling screen reader announcements.
|
|
1998
|
+
*
|
|
1999
|
+
* @group Accessibility
|
|
2000
|
+
*
|
|
2001
|
+
* @example
|
|
2002
|
+
* ```ts
|
|
2003
|
+
* // Disable all live announcements
|
|
2004
|
+
* a11y: { announcements: false }
|
|
2005
|
+
*
|
|
2006
|
+
* // Override specific messages for French locale
|
|
2007
|
+
* a11y: {
|
|
2008
|
+
* messages: {
|
|
2009
|
+
* sortApplied: (col, dir) => `Trié par ${col}, ${dir}`,
|
|
2010
|
+
* sortCleared: () => 'Tri effacé',
|
|
2011
|
+
* },
|
|
2012
|
+
* }
|
|
2013
|
+
* ```
|
|
2014
|
+
*/
|
|
2015
|
+
export interface A11yConfig {
|
|
2016
|
+
/**
|
|
2017
|
+
* Enable or disable live region announcements.
|
|
2018
|
+
* When `false`, the `aria-live` region remains in the DOM but no messages are set.
|
|
2019
|
+
* @defaultValue `true`
|
|
2020
|
+
*/
|
|
2021
|
+
announcements?: boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Custom announcement text overrides for internationalization.
|
|
2024
|
+
* Partial — only override the messages you need; defaults are used for the rest.
|
|
2025
|
+
*/
|
|
2026
|
+
messages?: Partial<A11yMessages>;
|
|
2027
|
+
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Default English announcement messages.
|
|
2030
|
+
* Used when no custom messages are provided via {@link A11yConfig.messages}.
|
|
2031
|
+
*/
|
|
2032
|
+
export declare const DEFAULT_A11Y_MESSAGES: A11yMessages;
|
|
1970
2033
|
/**
|
|
1971
2034
|
* Grid configuration object - the **single source of truth** for grid behavior.
|
|
1972
2035
|
*
|
|
@@ -2298,6 +2361,30 @@ export interface GridConfig<TRow = any> {
|
|
|
2298
2361
|
* ```
|
|
2299
2362
|
*/
|
|
2300
2363
|
gridAriaDescribedBy?: string;
|
|
2364
|
+
/**
|
|
2365
|
+
* Accessibility configuration for screen reader announcements.
|
|
2366
|
+
*
|
|
2367
|
+
* The grid automatically announces state changes (sort, filter, selection, etc.)
|
|
2368
|
+
* via an `aria-live` region. Use this config to toggle announcements or override
|
|
2369
|
+
* message text for internationalization.
|
|
2370
|
+
*
|
|
2371
|
+
* @example
|
|
2372
|
+
* ```ts
|
|
2373
|
+
* // Disable all announcements
|
|
2374
|
+
* gridConfig = { a11y: { announcements: false } };
|
|
2375
|
+
*
|
|
2376
|
+
* // Custom messages for i18n
|
|
2377
|
+
* gridConfig = {
|
|
2378
|
+
* a11y: {
|
|
2379
|
+
* messages: {
|
|
2380
|
+
* sortApplied: (col, dir) => `Trié par ${col}, ${dir}`,
|
|
2381
|
+
* filterApplied: (col) => `Filtre appliqué sur ${col}`,
|
|
2382
|
+
* },
|
|
2383
|
+
* },
|
|
2384
|
+
* };
|
|
2385
|
+
* ```
|
|
2386
|
+
*/
|
|
2387
|
+
a11y?: A11yConfig;
|
|
2301
2388
|
/**
|
|
2302
2389
|
* Custom renderer for the loading overlay.
|
|
2303
2390
|
*
|
|
@@ -3329,18 +3416,6 @@ export interface CellActivateDetail<TRow = unknown> {
|
|
|
3329
3416
|
/** The original event (KeyboardEvent for keyboard, MouseEvent/PointerEvent for pointer). */
|
|
3330
3417
|
originalEvent: KeyboardEvent | MouseEvent | PointerEvent;
|
|
3331
3418
|
}
|
|
3332
|
-
/**
|
|
3333
|
-
* @deprecated Use `CellActivateDetail` instead. Will be removed in next major version.
|
|
3334
|
-
* Kept for backwards compatibility. Will be removed in v2.
|
|
3335
|
-
*
|
|
3336
|
-
* @category Events
|
|
3337
|
-
*/
|
|
3338
|
-
export interface ActivateCellDetail {
|
|
3339
|
-
/** Zero-based row index now focused. */
|
|
3340
|
-
row: number;
|
|
3341
|
-
/** Zero-based column index now focused. */
|
|
3342
|
-
col: number;
|
|
3343
|
-
}
|
|
3344
3419
|
/**
|
|
3345
3420
|
* Event detail for mounting external view renderers.
|
|
3346
3421
|
*
|
|
@@ -3471,8 +3546,7 @@ export interface DataGridEventMap<TRow = unknown> {
|
|
|
3471
3546
|
'row-click': RowClickDetail<TRow>;
|
|
3472
3547
|
/**
|
|
3473
3548
|
* Fired when a cell is activated by Enter key or pointer click.
|
|
3474
|
-
* Unified event for both keyboard and pointer activation
|
|
3475
|
-
* instead of the deprecated `activate-cell`.
|
|
3549
|
+
* Unified event for both keyboard and pointer activation.
|
|
3476
3550
|
*
|
|
3477
3551
|
* Call `event.preventDefault()` to suppress default behavior (e.g., inline editing).
|
|
3478
3552
|
*
|
|
@@ -3617,12 +3691,6 @@ export interface DataGridEventMap<TRow = unknown> {
|
|
|
3617
3691
|
* @group Core Events
|
|
3618
3692
|
*/
|
|
3619
3693
|
'column-resize': ColumnResizeDetail;
|
|
3620
|
-
/**
|
|
3621
|
-
* @deprecated Use `cell-activate` instead. Will be removed in v2.
|
|
3622
|
-
* @see {@link ActivateCellDetail}
|
|
3623
|
-
* @group Core Events
|
|
3624
|
-
*/
|
|
3625
|
-
'activate-cell': ActivateCellDetail;
|
|
3626
3694
|
/**
|
|
3627
3695
|
* Fired when column state changes — reordering, resizing, visibility toggle,
|
|
3628
3696
|
* or sort changes. Use with `getColumnState()` / `columnState` setter for
|
|
@@ -3,8 +3,6 @@ declare module '../core/types' {
|
|
|
3
3
|
interface FeatureConfig {
|
|
4
4
|
/** Enable multi-column sorting. */
|
|
5
5
|
multiSort?: boolean | 'single' | 'multi' | MultiSortConfig;
|
|
6
|
-
/** @deprecated Use `multiSort` instead. Will be removed in v2.*/
|
|
7
|
-
sorting?: boolean | 'single' | 'multi' | MultiSortConfig;
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
8
|
/** @internal Type anchor — forces bundlers to preserve this module's FeatureConfig augmentation when re-exported. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-sort.js","sources":["../../../../../libs/grid/src/lib/features/multi-sort.ts"],"sourcesContent":["/**\n * Multi-sort feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/multi-sort';\n *\n * grid.gridConfig = { features: { multiSort: true } };\n * ```\n */\n\nimport { MultiSortPlugin, type MultiSortConfig } from '../plugins/multi-sort';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable multi-column sorting. */\n multiSort?: boolean | 'single' | 'multi' | MultiSortConfig;\n
|
|
1
|
+
{"version":3,"file":"multi-sort.js","sources":["../../../../../libs/grid/src/lib/features/multi-sort.ts"],"sourcesContent":["/**\n * Multi-sort feature for @toolbox-web/grid\n *\n * @example\n * ```typescript\n * import '@toolbox-web/grid/features/multi-sort';\n *\n * grid.gridConfig = { features: { multiSort: true } };\n * ```\n */\n\nimport { MultiSortPlugin, type MultiSortConfig } from '../plugins/multi-sort';\nimport { registerFeature } from './registry';\n\ndeclare module '../core/types' {\n interface FeatureConfig {\n /** Enable multi-column sorting. */\n multiSort?: boolean | 'single' | 'multi' | MultiSortConfig;\n }\n}\n\nregisterFeature('multiSort', (config) => {\n if (config === true || config === 'multi') {\n return new MultiSortPlugin();\n }\n if (config === 'single') {\n return new MultiSortPlugin({ maxSortColumns: 1 });\n }\n return new MultiSortPlugin(config as MultiSortConfig);\n});\n\n/** @internal Type anchor — forces bundlers to preserve this module's FeatureConfig augmentation when re-exported. */\nexport type _Augmentation = true;\n"],"names":["registerFeature","config","MultiSortPlugin","maxSortColumns"],"mappings":"6IAqBAA,EAAgB,YAAcC,IACb,IAAXA,GAA8B,UAAXA,EACd,IAAIC,EAGJ,IAAIA,EADE,WAAXD,EACyB,CAAEE,eAAgB,GAEpBF"}
|
|
@@ -33,7 +33,6 @@ export declare function createPluginFromFeature(name: string, config: unknown):
|
|
|
33
33
|
* Create plugin instances from a features configuration object.
|
|
34
34
|
*
|
|
35
35
|
* Handles:
|
|
36
|
-
* - Deprecated alias resolution (sorting → multiSort, etc.)
|
|
37
36
|
* - Dependency validation (clipboard needs selection)
|
|
38
37
|
* - Dependency ordering (selection before clipboard)
|
|
39
38
|
* - Skipping false/undefined values
|
package/lib/features/registry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{setFeatureResolver as o}from"@toolbox-web/grid";function
|
|
1
|
+
import{setFeatureResolver as o}from"@toolbox-web/grid";function t(o,t,n,e){console.warn(function(o,t){return`[tbw-grid] ${o}: ${t}\n\n → More info: ${function(o){return`https://toolboxjs.com/grid/errors#${o.toLowerCase()}`}(o)}`}(o,t))}const n=/* @__PURE__ */new Map,e=/* @__PURE__ */new Set,r=()=>"undefined"!=typeof window&&("localhost"===window.location?.hostname||"127.0.0.1"===window.location?.hostname);function i(o,e){r()&&n.has(o)&&t("TBW030",`Feature "${o}" was re-registered. Previous registration overwritten.`),n.set(o,{factory:e,name:o})}function s(o){return n.has(o)}function c(o){return n.get(o)?.factory}function f(){return Array.from(n.keys())}const u={undoRedo:["editing"],clipboard:["selection"]};function a(o,i){const s=n.get(o);if(s)return s.factory(i);if(r()&&!e.has(o)){e.add(o);const n=o.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();t("TBW031",`Feature "${o}" is configured but not registered.\nAdd this import to enable it:\n\n import '@toolbox-web/grid/features/${n}';\n`)}}function d(o){const n=[],e=[];for(const[t,r]of Object.entries(o))void 0!==r&&!1!==r&&e.push(t);!function(o){const n=new Set(o);for(const e of o){const o=u[e];if(o)for(const i of o)n.has(i)||r()&&t("TBW032",`Feature "${e}" requires "${i}" to be enabled. Add "${i}" to your features configuration.`)}}(e);const i=["selection","editing",...e.filter(o=>"selection"!==o&&"editing"!==o)],s=[...new Set(i)].filter(o=>e.includes(o));for(const t of s){const e=o[t];if(void 0===e||!1===e)continue;const r=a(t,e);r&&n.push(r)}return n}function l(){n.clear(),e.clear()}o(d);export{l as clearFeatureRegistry,a as createPluginFromFeature,d as createPluginsFromFeatures,c as getFeatureFactory,f as getRegisteredFeatures,s as isFeatureRegistered,i as registerFeature};
|
|
2
2
|
//# sourceMappingURL=registry.js.map
|