@ornery/ui-grid-vanilla 1.0.5 → 1.0.7
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 +75 -11
- package/demo/main.ts +1 -2
- package/dist/browser/ui-grid-element.js +9586 -0
- package/dist/index.d.mts +43 -2
- package/dist/index.d.ts +43 -2
- package/dist/index.js +281 -100
- package/dist/index.mjs +283 -102
- package/package.json +14 -6
- package/src/browser.test.ts +9 -0
- package/src/browser.ts +8 -0
- package/src/cell-state-management.test.ts +419 -0
- package/src/events.ts +77 -26
- package/src/framework-slots.ts +18 -0
- package/src/grid-controller.ts +166 -98
- package/src/index.integration.test.ts +51 -8
- package/src/index.test.ts +0 -4
- package/src/index.ts +6 -9
- package/src/keyboard-navigation.test.ts +1 -7
- package/src/patch.ts +118 -1
- package/src/row-edit.test.ts +1 -1
- package/src/ui-grid-standalone.element.ts +79 -1
- package/tsup.config.ts +22 -7
- package/vitest.config.ts +30 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridCellTemplateContext, GridLabels, GridExpandableTemplateContext, GridColumnDef, GridHeaderTemplateContext, GridRow, GroupItem, GridOptions, PipelineResult, SortState, PinnedColumnState, GridCellPosition, UiGridApi, GridRecord, DisplayItem, SortDirection, PinDirection, GridSelectionState, resolveGridSelectionOptions, GridInfiniteScrollState, GridValidatorRegistry
|
|
1
|
+
import { GridCellTemplateContext, GridLabels, GridExpandableTemplateContext, GridColumnDef, GridHeaderTemplateContext, GridRow, GroupItem, GridOptions, PipelineResult, SortState, PinnedColumnState, GridCellPosition, UiGridApi, GridRecord, DisplayItem, SortDirection, PinDirection, GridSelectionState, resolveGridSelectionOptions, GridBenchmarkResult, GridInfiniteScrollState, GridValidatorRegistry } from '@ornery/ui-grid-core';
|
|
2
2
|
export { GridOptions, UiGridApi } from '@ornery/ui-grid-core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -127,6 +127,17 @@ declare class FrameworkSlotBridge {
|
|
|
127
127
|
hasExpandableRow(): boolean;
|
|
128
128
|
hasEmptyState(): boolean;
|
|
129
129
|
stageCell(column: GridColumnDef, row: GridRow, rowIndex: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Carry forward every previously-known cell slot for `rowId` into the
|
|
132
|
+
* current pending set. Used by the structural patch path when a row's
|
|
133
|
+
* fingerprint matches the previous render's: `stageCell` would normally
|
|
134
|
+
* re-record the slot during cell rendering, but the fingerprint
|
|
135
|
+
* short-circuit skips the render pass for unchanged rows. Without this,
|
|
136
|
+
* `flush()` would diff pending (missing the row's slots) against last
|
|
137
|
+
* (containing them) and emit a spurious `removed` for every cell of the
|
|
138
|
+
* unchanged row, destroying the framework wrappers' projected content.
|
|
139
|
+
*/
|
|
140
|
+
carryRowCells(rowId: string): void;
|
|
130
141
|
stageExpandableRow(row: GridRow, rowIndex: number): void;
|
|
131
142
|
stageGroupRow(group: GroupItem): void;
|
|
132
143
|
stageHeader(column: GridColumnDef): void;
|
|
@@ -280,6 +291,8 @@ declare class VanillaGridController {
|
|
|
280
291
|
private labels;
|
|
281
292
|
private visibleColumns;
|
|
282
293
|
private apiRegistered;
|
|
294
|
+
private disposed;
|
|
295
|
+
private wasmEngineInitRequested;
|
|
283
296
|
private readonly subscribers;
|
|
284
297
|
readonly gridApi: UiGridApi;
|
|
285
298
|
constructor(options: GridOptions);
|
|
@@ -390,6 +403,11 @@ declare class VanillaGridController {
|
|
|
390
403
|
* bring the viewport back to 0. Keeps the controller DOM-free. */
|
|
391
404
|
private infiniteScrollScrollToTopRequest;
|
|
392
405
|
setInfiniteScrollResetHandler(handler: (() => void) | null): void;
|
|
406
|
+
/** Element-owned render benchmark. When present, `core.benchmark()`
|
|
407
|
+
* measures the actual render path instead of the controller-only
|
|
408
|
+
* pipeline builder. */
|
|
409
|
+
private benchmarkRequest;
|
|
410
|
+
setBenchmarkHandler(handler: ((iterations?: number) => Promise<GridBenchmarkResult>) | null): void;
|
|
393
411
|
getInfiniteScrollState(): Readonly<GridInfiniteScrollState>;
|
|
394
412
|
canResizeColumns(): boolean;
|
|
395
413
|
setViewportWidth(width: number): void;
|
|
@@ -438,6 +456,10 @@ declare class VanillaGridController {
|
|
|
438
456
|
expandToggleLabel(row: GridRow): string;
|
|
439
457
|
editorInputType(column: GridColumnDef): string;
|
|
440
458
|
isEditingCell(rowId: string, columnName: string): boolean;
|
|
459
|
+
/** Compact key for the editing cell, or null when no edit is in flight.
|
|
460
|
+
* Used by the patch path to detect when the editing position moves so it
|
|
461
|
+
* can force the affected cells through the slow rebuild path. */
|
|
462
|
+
getEditingCellKey(): string | null;
|
|
441
463
|
/**
|
|
442
464
|
* Serialise the current grid state. Mirrors `ui.grid.saveState.save`:
|
|
443
465
|
* every field is gated by an `options.save*` flag with the old grid's
|
|
@@ -459,6 +481,7 @@ declare class VanillaGridController {
|
|
|
459
481
|
scrollLeft: number;
|
|
460
482
|
}) | null, restore: ((scrollTop: number, scrollLeft: number) => void) | null): void;
|
|
461
483
|
private refresh;
|
|
484
|
+
private maybeEnableWasmEngine;
|
|
462
485
|
private emit;
|
|
463
486
|
private findRowById;
|
|
464
487
|
private buildRowsFromData;
|
|
@@ -547,6 +570,12 @@ type VanillaUiGridElement = HTMLElement & {
|
|
|
547
570
|
* remains completely smooth while data ticks in the background.
|
|
548
571
|
*/
|
|
549
572
|
setData(rows: GridRecord[]): void;
|
|
573
|
+
/**
|
|
574
|
+
* Declare which slots the grid should emit as `<slot>` placeholders for a
|
|
575
|
+
* framework wrapper to project into. See `FrameworkSlotBridge` for the
|
|
576
|
+
* full contract.
|
|
577
|
+
*/
|
|
578
|
+
setFrameworkRenderedSlots(config: FrameworkRenderedSlotsConfig): void;
|
|
550
579
|
};
|
|
551
580
|
type VanillaGridOptions = GridOptions & {
|
|
552
581
|
iconOverrides?: UiGridIconOverrides;
|
|
@@ -598,6 +627,18 @@ declare class UiGridStandaloneElement extends HTMLElement {
|
|
|
598
627
|
/** @internal */ lastItemsFingerprint: string | null;
|
|
599
628
|
/** @internal */ lastVirtualOffset: number;
|
|
600
629
|
/** @internal */ lastTotalVirtualHeight: number;
|
|
630
|
+
/**
|
|
631
|
+
* @internal Per-row visual-state fingerprint from the previous patch pass.
|
|
632
|
+
* The patch path uses this to skip cells whose row state hasn't changed
|
|
633
|
+
* (selection, expand, dirty/saving/error flags) when the structure
|
|
634
|
+
* fingerprint matches. Cleared on full re-render.
|
|
635
|
+
*/
|
|
636
|
+
lastRowStateFingerprints: Map<string, {
|
|
637
|
+
fingerprint: string;
|
|
638
|
+
entity: unknown;
|
|
639
|
+
}>;
|
|
640
|
+
/** @internal */ lastEditingCellKey: string | null;
|
|
641
|
+
/** @internal */ lastFocusedCellKey: string | null;
|
|
601
642
|
/**
|
|
602
643
|
* @internal Framework-rendered slot bridge. See `./framework-slots.ts`.
|
|
603
644
|
*/
|
|
@@ -717,6 +758,7 @@ declare class UiGridStandaloneElement extends HTMLElement {
|
|
|
717
758
|
private patchCells;
|
|
718
759
|
connectedCallback(): void;
|
|
719
760
|
disconnectedCallback(): void;
|
|
761
|
+
private benchmarkRender;
|
|
720
762
|
/** @internal */
|
|
721
763
|
ensureShadowRoot(): ShadowRoot;
|
|
722
764
|
/** @internal */
|
|
@@ -854,7 +896,6 @@ declare class UIGridTemplate extends HTMLTemplateElement {
|
|
|
854
896
|
|
|
855
897
|
interface UiGridRustWebModule {
|
|
856
898
|
default(input?: unknown): Promise<unknown>;
|
|
857
|
-
build_pipeline_js(context: BuildGridPipelineContext): PipelineResult;
|
|
858
899
|
}
|
|
859
900
|
|
|
860
901
|
declare function registerVanillaUiGridRustModule(module: UiGridRustWebModule, input?: unknown): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridCellTemplateContext, GridLabels, GridExpandableTemplateContext, GridColumnDef, GridHeaderTemplateContext, GridRow, GroupItem, GridOptions, PipelineResult, SortState, PinnedColumnState, GridCellPosition, UiGridApi, GridRecord, DisplayItem, SortDirection, PinDirection, GridSelectionState, resolveGridSelectionOptions, GridInfiniteScrollState, GridValidatorRegistry
|
|
1
|
+
import { GridCellTemplateContext, GridLabels, GridExpandableTemplateContext, GridColumnDef, GridHeaderTemplateContext, GridRow, GroupItem, GridOptions, PipelineResult, SortState, PinnedColumnState, GridCellPosition, UiGridApi, GridRecord, DisplayItem, SortDirection, PinDirection, GridSelectionState, resolveGridSelectionOptions, GridBenchmarkResult, GridInfiniteScrollState, GridValidatorRegistry } from '@ornery/ui-grid-core';
|
|
2
2
|
export { GridOptions, UiGridApi } from '@ornery/ui-grid-core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -127,6 +127,17 @@ declare class FrameworkSlotBridge {
|
|
|
127
127
|
hasExpandableRow(): boolean;
|
|
128
128
|
hasEmptyState(): boolean;
|
|
129
129
|
stageCell(column: GridColumnDef, row: GridRow, rowIndex: number): void;
|
|
130
|
+
/**
|
|
131
|
+
* Carry forward every previously-known cell slot for `rowId` into the
|
|
132
|
+
* current pending set. Used by the structural patch path when a row's
|
|
133
|
+
* fingerprint matches the previous render's: `stageCell` would normally
|
|
134
|
+
* re-record the slot during cell rendering, but the fingerprint
|
|
135
|
+
* short-circuit skips the render pass for unchanged rows. Without this,
|
|
136
|
+
* `flush()` would diff pending (missing the row's slots) against last
|
|
137
|
+
* (containing them) and emit a spurious `removed` for every cell of the
|
|
138
|
+
* unchanged row, destroying the framework wrappers' projected content.
|
|
139
|
+
*/
|
|
140
|
+
carryRowCells(rowId: string): void;
|
|
130
141
|
stageExpandableRow(row: GridRow, rowIndex: number): void;
|
|
131
142
|
stageGroupRow(group: GroupItem): void;
|
|
132
143
|
stageHeader(column: GridColumnDef): void;
|
|
@@ -280,6 +291,8 @@ declare class VanillaGridController {
|
|
|
280
291
|
private labels;
|
|
281
292
|
private visibleColumns;
|
|
282
293
|
private apiRegistered;
|
|
294
|
+
private disposed;
|
|
295
|
+
private wasmEngineInitRequested;
|
|
283
296
|
private readonly subscribers;
|
|
284
297
|
readonly gridApi: UiGridApi;
|
|
285
298
|
constructor(options: GridOptions);
|
|
@@ -390,6 +403,11 @@ declare class VanillaGridController {
|
|
|
390
403
|
* bring the viewport back to 0. Keeps the controller DOM-free. */
|
|
391
404
|
private infiniteScrollScrollToTopRequest;
|
|
392
405
|
setInfiniteScrollResetHandler(handler: (() => void) | null): void;
|
|
406
|
+
/** Element-owned render benchmark. When present, `core.benchmark()`
|
|
407
|
+
* measures the actual render path instead of the controller-only
|
|
408
|
+
* pipeline builder. */
|
|
409
|
+
private benchmarkRequest;
|
|
410
|
+
setBenchmarkHandler(handler: ((iterations?: number) => Promise<GridBenchmarkResult>) | null): void;
|
|
393
411
|
getInfiniteScrollState(): Readonly<GridInfiniteScrollState>;
|
|
394
412
|
canResizeColumns(): boolean;
|
|
395
413
|
setViewportWidth(width: number): void;
|
|
@@ -438,6 +456,10 @@ declare class VanillaGridController {
|
|
|
438
456
|
expandToggleLabel(row: GridRow): string;
|
|
439
457
|
editorInputType(column: GridColumnDef): string;
|
|
440
458
|
isEditingCell(rowId: string, columnName: string): boolean;
|
|
459
|
+
/** Compact key for the editing cell, or null when no edit is in flight.
|
|
460
|
+
* Used by the patch path to detect when the editing position moves so it
|
|
461
|
+
* can force the affected cells through the slow rebuild path. */
|
|
462
|
+
getEditingCellKey(): string | null;
|
|
441
463
|
/**
|
|
442
464
|
* Serialise the current grid state. Mirrors `ui.grid.saveState.save`:
|
|
443
465
|
* every field is gated by an `options.save*` flag with the old grid's
|
|
@@ -459,6 +481,7 @@ declare class VanillaGridController {
|
|
|
459
481
|
scrollLeft: number;
|
|
460
482
|
}) | null, restore: ((scrollTop: number, scrollLeft: number) => void) | null): void;
|
|
461
483
|
private refresh;
|
|
484
|
+
private maybeEnableWasmEngine;
|
|
462
485
|
private emit;
|
|
463
486
|
private findRowById;
|
|
464
487
|
private buildRowsFromData;
|
|
@@ -547,6 +570,12 @@ type VanillaUiGridElement = HTMLElement & {
|
|
|
547
570
|
* remains completely smooth while data ticks in the background.
|
|
548
571
|
*/
|
|
549
572
|
setData(rows: GridRecord[]): void;
|
|
573
|
+
/**
|
|
574
|
+
* Declare which slots the grid should emit as `<slot>` placeholders for a
|
|
575
|
+
* framework wrapper to project into. See `FrameworkSlotBridge` for the
|
|
576
|
+
* full contract.
|
|
577
|
+
*/
|
|
578
|
+
setFrameworkRenderedSlots(config: FrameworkRenderedSlotsConfig): void;
|
|
550
579
|
};
|
|
551
580
|
type VanillaGridOptions = GridOptions & {
|
|
552
581
|
iconOverrides?: UiGridIconOverrides;
|
|
@@ -598,6 +627,18 @@ declare class UiGridStandaloneElement extends HTMLElement {
|
|
|
598
627
|
/** @internal */ lastItemsFingerprint: string | null;
|
|
599
628
|
/** @internal */ lastVirtualOffset: number;
|
|
600
629
|
/** @internal */ lastTotalVirtualHeight: number;
|
|
630
|
+
/**
|
|
631
|
+
* @internal Per-row visual-state fingerprint from the previous patch pass.
|
|
632
|
+
* The patch path uses this to skip cells whose row state hasn't changed
|
|
633
|
+
* (selection, expand, dirty/saving/error flags) when the structure
|
|
634
|
+
* fingerprint matches. Cleared on full re-render.
|
|
635
|
+
*/
|
|
636
|
+
lastRowStateFingerprints: Map<string, {
|
|
637
|
+
fingerprint: string;
|
|
638
|
+
entity: unknown;
|
|
639
|
+
}>;
|
|
640
|
+
/** @internal */ lastEditingCellKey: string | null;
|
|
641
|
+
/** @internal */ lastFocusedCellKey: string | null;
|
|
601
642
|
/**
|
|
602
643
|
* @internal Framework-rendered slot bridge. See `./framework-slots.ts`.
|
|
603
644
|
*/
|
|
@@ -717,6 +758,7 @@ declare class UiGridStandaloneElement extends HTMLElement {
|
|
|
717
758
|
private patchCells;
|
|
718
759
|
connectedCallback(): void;
|
|
719
760
|
disconnectedCallback(): void;
|
|
761
|
+
private benchmarkRender;
|
|
720
762
|
/** @internal */
|
|
721
763
|
ensureShadowRoot(): ShadowRoot;
|
|
722
764
|
/** @internal */
|
|
@@ -854,7 +896,6 @@ declare class UIGridTemplate extends HTMLTemplateElement {
|
|
|
854
896
|
|
|
855
897
|
interface UiGridRustWebModule {
|
|
856
898
|
default(input?: unknown): Promise<unknown>;
|
|
857
|
-
build_pipeline_js(context: BuildGridPipelineContext): PipelineResult;
|
|
858
899
|
}
|
|
859
900
|
|
|
860
901
|
declare function registerVanillaUiGridRustModule(module: UiGridRustWebModule, input?: unknown): Promise<void>;
|