@omnigrid/core 0.1.22 → 0.1.24
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/dist/grid.d.ts +21 -1
- package/dist/grid.js +142 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +77 -0
- package/dist/virtualizer.js +7 -1
- package/package.json +1 -1
package/dist/grid.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FilterCondition, FilterModel } from "./filtering";
|
|
|
2
2
|
import type { UIPopupAnchor, UIPopupDescriptor } from "./ui";
|
|
3
3
|
import { IconRegistry } from "./icons";
|
|
4
4
|
import { SlotManager } from "./slots";
|
|
5
|
-
import type { ColumnLeafDef, DataProcessor, GridApi, GridEvents, GridOptions, GridPlugin, GridState, RowClickEvent, RowHeightUpdateOptions, RowHoverEvent, RowId, RowSpanLayout, ScrollPosition, SlotMount, SlotName, ViewportData, ViewportState } from "./types";
|
|
5
|
+
import type { ColumnLeafDef, DataProcessor, GridApi, GridEvents, GridOptions, GridPlugin, GridState, RowClickEvent, RowHeightUpdateOptions, RowHoverEvent, RowId, RowSpanLayout, ScrollPosition, SlotMount, SlotName, TransactionResult, RowTransaction, ViewportData, ViewportState } from "./types";
|
|
6
6
|
import type { OverlayOptions, OverlayState } from "./overlays";
|
|
7
7
|
export declare class Grid<T> implements GridApi<T> {
|
|
8
8
|
private readonly store;
|
|
@@ -37,6 +37,10 @@ export declare class Grid<T> implements GridApi<T> {
|
|
|
37
37
|
private overlayManual;
|
|
38
38
|
/** Grid-level `wrapText` flag — applied to every column without an explicit one. */
|
|
39
39
|
private wrapTextAll;
|
|
40
|
+
/** Normalized cell flash configuration. `false` when disabled. */
|
|
41
|
+
private cellFlash;
|
|
42
|
+
/** Cells currently flashed: key `${rowId}:${columnId}` → expiry timestamp. */
|
|
43
|
+
private flashedCells;
|
|
40
44
|
/**
|
|
41
45
|
* Separate ephemeral scroll position that is NOT stored in the Store.
|
|
42
46
|
*
|
|
@@ -190,6 +194,22 @@ export declare class Grid<T> implements GridApi<T> {
|
|
|
190
194
|
* missing `rows`.
|
|
191
195
|
*/
|
|
192
196
|
appendData(rows: T[] | null | undefined): void;
|
|
197
|
+
/**
|
|
198
|
+
* Applies a targeted row transaction (add / update / remove) to the State
|
|
199
|
+
* Store without recreating the whole data array.
|
|
200
|
+
*
|
|
201
|
+
* Rows are matched by their stable id (`getRowId`). The pipeline caches
|
|
202
|
+
* (filtered / processed data) are invalidated and the virtualizer's
|
|
203
|
+
* row-height cache is reset only for the affected rows (or fully when the
|
|
204
|
+
* dataset size changes), avoiding heavy recomputation.
|
|
205
|
+
*
|
|
206
|
+
* Emits a single `dataChange` with the resulting dataset and bumps the
|
|
207
|
+
* grid revision.
|
|
208
|
+
* @param transaction - The rows to add, update and/or remove.
|
|
209
|
+
* @returns The added, updated and removed rows with resolved ids/indexes.
|
|
210
|
+
* @api
|
|
211
|
+
*/
|
|
212
|
+
applyTransaction(transaction: RowTransaction<T>): TransactionResult<T>;
|
|
193
213
|
setViewport(viewport: Partial<ViewportState>): void;
|
|
194
214
|
/**
|
|
195
215
|
* Repaints the current viewport: notifies Store subscribers that
|
package/dist/grid.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applyWrapText, flattenColumns, getColumnGroups, getRowSpans, resolveColSpan } from "./columns";
|
|
1
|
+
import { applyWrapText, flattenColumns, getColumnGroups, getCellValue, getRowSpans, resolveColSpan } from "./columns";
|
|
2
2
|
import { EventBus } from "./events";
|
|
3
3
|
import { applyFilterModel, applyQuickFilter, isActiveCondition } from "./filtering";
|
|
4
4
|
import { PopupManager } from "./ui";
|
|
@@ -26,6 +26,10 @@ export class Grid {
|
|
|
26
26
|
this.hasData = true;
|
|
27
27
|
this.overlayState = { type: null };
|
|
28
28
|
this.overlayManual = false;
|
|
29
|
+
/** Normalized cell flash configuration. `false` when disabled. */
|
|
30
|
+
this.cellFlash = false;
|
|
31
|
+
/** Cells currently flashed: key `${rowId}:${columnId}` → expiry timestamp. */
|
|
32
|
+
this.flashedCells = new Map();
|
|
29
33
|
/**
|
|
30
34
|
* Separate ephemeral scroll position that is NOT stored in the Store.
|
|
31
35
|
*
|
|
@@ -42,6 +46,7 @@ export class Grid {
|
|
|
42
46
|
rowHeight: options.rowHeight ?? 32,
|
|
43
47
|
rowOverscan: options.rowOverscan ?? 5,
|
|
44
48
|
columnOverscan: options.columnOverscan ?? 2,
|
|
49
|
+
flashedCells: new Map(),
|
|
45
50
|
overlay: { type: null },
|
|
46
51
|
quickFilter: options.quickFilter ?? "",
|
|
47
52
|
};
|
|
@@ -51,6 +56,13 @@ export class Grid {
|
|
|
51
56
|
this.loading = options.loading ?? false;
|
|
52
57
|
this.hasData = options.data !== undefined && options.data !== null;
|
|
53
58
|
this.wrapTextAll = options.wrapText;
|
|
59
|
+
const raw = options.cellFlash;
|
|
60
|
+
this.cellFlash =
|
|
61
|
+
raw === true
|
|
62
|
+
? { enabled: true, durationMs: 1000 }
|
|
63
|
+
: typeof raw === "number" && raw > 0
|
|
64
|
+
? { enabled: true, durationMs: raw }
|
|
65
|
+
: false;
|
|
54
66
|
if (options.filterModel)
|
|
55
67
|
this.filterModel = Grid.cloneFilterModel(options.filterModel);
|
|
56
68
|
this.virtualizer = new Virtualizer({
|
|
@@ -567,6 +579,134 @@ export class Grid {
|
|
|
567
579
|
this.events.emit("dataChange", nextData);
|
|
568
580
|
this.recomputeOverlay();
|
|
569
581
|
}
|
|
582
|
+
/**
|
|
583
|
+
* Applies a targeted row transaction (add / update / remove) to the State
|
|
584
|
+
* Store without recreating the whole data array.
|
|
585
|
+
*
|
|
586
|
+
* Rows are matched by their stable id (`getRowId`). The pipeline caches
|
|
587
|
+
* (filtered / processed data) are invalidated and the virtualizer's
|
|
588
|
+
* row-height cache is reset only for the affected rows (or fully when the
|
|
589
|
+
* dataset size changes), avoiding heavy recomputation.
|
|
590
|
+
*
|
|
591
|
+
* Emits a single `dataChange` with the resulting dataset and bumps the
|
|
592
|
+
* grid revision.
|
|
593
|
+
* @param transaction - The rows to add, update and/or remove.
|
|
594
|
+
* @returns The added, updated and removed rows with resolved ids/indexes.
|
|
595
|
+
* @api
|
|
596
|
+
*/
|
|
597
|
+
applyTransaction(transaction) {
|
|
598
|
+
this.assertActive();
|
|
599
|
+
const currentData = this.store.getState().data;
|
|
600
|
+
const added = [];
|
|
601
|
+
const updated = [];
|
|
602
|
+
const removed = [];
|
|
603
|
+
// Row indexes whose measured height must be discarded because the row
|
|
604
|
+
// content changed (update) or the dataset size changed (add / remove).
|
|
605
|
+
const affectedIndexes = new Set();
|
|
606
|
+
let structuralChange = false;
|
|
607
|
+
// Resolves the id of a row object, preferring its current position so
|
|
608
|
+
// index-based `getRowId` implementations keep matching existing rows.
|
|
609
|
+
const resolveIdOf = (row) => {
|
|
610
|
+
const index = currentData.indexOf(row);
|
|
611
|
+
return this.resolveRowId(row, index >= 0 ? index : -1);
|
|
612
|
+
};
|
|
613
|
+
// ---------- removals ----------
|
|
614
|
+
const removeIds = new Set();
|
|
615
|
+
if (transaction.remove) {
|
|
616
|
+
for (const item of transaction.remove) {
|
|
617
|
+
removeIds.add(typeof item === "object" && item !== null ? resolveIdOf(item) : item);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const afterRemove = [];
|
|
621
|
+
currentData.forEach((row, index) => {
|
|
622
|
+
const id = this.resolveRowId(row, index);
|
|
623
|
+
if (removeIds.has(id)) {
|
|
624
|
+
removed.push({ id, index, data: row });
|
|
625
|
+
affectedIndexes.add(index);
|
|
626
|
+
}
|
|
627
|
+
else {
|
|
628
|
+
afterRemove.push(row);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
// ---------- updates ----------
|
|
632
|
+
let nextData = afterRemove;
|
|
633
|
+
if (transaction.update) {
|
|
634
|
+
const updateIdToIndex = new Map();
|
|
635
|
+
afterRemove.forEach((row, index) => updateIdToIndex.set(this.resolveRowId(row, index), index));
|
|
636
|
+
nextData = [...afterRemove];
|
|
637
|
+
for (const row of transaction.update) {
|
|
638
|
+
const id = resolveIdOf(row);
|
|
639
|
+
const index = updateIdToIndex.get(id);
|
|
640
|
+
if (index === undefined)
|
|
641
|
+
continue;
|
|
642
|
+
nextData[index] = row;
|
|
643
|
+
updated.push({ id, index, data: row });
|
|
644
|
+
affectedIndexes.add(index);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
// ---------- cell flash on update ----------
|
|
648
|
+
if (this.cellFlash !== false && updated.length > 0) {
|
|
649
|
+
const state = this.store.getState();
|
|
650
|
+
const leafColumns = flattenColumns(state.columns).filter((column) => column.field !== undefined);
|
|
651
|
+
// Lazy cleanup: drop entries older than the flash duration so the map
|
|
652
|
+
// doesn't grow unboundedly and cells can re-flash later.
|
|
653
|
+
const cutoff = Date.now() - this.cellFlash.durationMs;
|
|
654
|
+
for (const [key, ts] of this.flashedCells) {
|
|
655
|
+
if (ts < cutoff) {
|
|
656
|
+
this.flashedCells.delete(key);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
const now = Date.now();
|
|
660
|
+
for (const { id, index, data: newRow } of updated) {
|
|
661
|
+
const oldRow = currentData[index];
|
|
662
|
+
if (oldRow === undefined)
|
|
663
|
+
continue;
|
|
664
|
+
for (const column of leafColumns) {
|
|
665
|
+
const oldValue = getCellValue(oldRow, column);
|
|
666
|
+
const newValue = getCellValue(newRow, column);
|
|
667
|
+
if (oldValue !== newValue) {
|
|
668
|
+
this.flashedCells.set(`${id}:${column.id}`, now);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
this.store.setState({ flashedCells: new Map(this.flashedCells) });
|
|
673
|
+
}
|
|
674
|
+
// ---------- adds ----------
|
|
675
|
+
const insertAt = Math.min(Math.max(transaction.addIndex ?? nextData.length, 0), nextData.length);
|
|
676
|
+
if (transaction.add) {
|
|
677
|
+
transaction.add.forEach((row, position) => {
|
|
678
|
+
const index = insertAt + position;
|
|
679
|
+
const id = this.resolveRowId(row, index);
|
|
680
|
+
nextData.splice(index, 0, row);
|
|
681
|
+
added.push({ id, index, data: row });
|
|
682
|
+
affectedIndexes.add(index);
|
|
683
|
+
});
|
|
684
|
+
structuralChange = true;
|
|
685
|
+
}
|
|
686
|
+
if (removed.length > 0)
|
|
687
|
+
structuralChange = true;
|
|
688
|
+
const changed = added.length > 0 || updated.length > 0 || removed.length > 0;
|
|
689
|
+
if (!changed) {
|
|
690
|
+
return { added, updated, removed };
|
|
691
|
+
}
|
|
692
|
+
// ---------- invalidate caches & patch the store ----------
|
|
693
|
+
if (structuralChange) {
|
|
694
|
+
// Adding or removing rows shifts every subsequent index, so the
|
|
695
|
+
// index-based row-height registry can no longer be trusted row by row.
|
|
696
|
+
this.virtualizer.resetAllRowHeights();
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
// Pure update: only the affected rows may have changed height.
|
|
700
|
+
affectedIndexes.forEach((index) => this.virtualizer.rowHeights.reset(index));
|
|
701
|
+
}
|
|
702
|
+
this.filteredDataCache = null;
|
|
703
|
+
this.processedDataCache = null;
|
|
704
|
+
this.revision += 1;
|
|
705
|
+
this.store.setState({ data: nextData });
|
|
706
|
+
this.events.emit("dataChange", nextData);
|
|
707
|
+
this.recomputeOverlay();
|
|
708
|
+
return { added, updated, removed };
|
|
709
|
+
}
|
|
570
710
|
setViewport(viewport) {
|
|
571
711
|
this.assertActive();
|
|
572
712
|
const state = this.store.getState();
|
|
@@ -787,6 +927,7 @@ export class Grid {
|
|
|
787
927
|
destroy() {
|
|
788
928
|
if (this.destroyed)
|
|
789
929
|
return;
|
|
930
|
+
this.flashedCells.clear();
|
|
790
931
|
this.cleanupPlugins.forEach((cleanup) => cleanup());
|
|
791
932
|
this.cleanupPlugins.clear();
|
|
792
933
|
this.dataProcessors.clear();
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ export { applyFilterModel, applyQuickFilter, isActiveCondition, isFilterModelAct
|
|
|
11
11
|
export type { ColumnFilterModel, FilterCondition, FilterModel, FilterOperator } from "./filtering";
|
|
12
12
|
export type { UIButtonControl, UICheckboxDescriptor, UIControlBase, UIControlDescriptor, UIGroupControl, UIInputControl, UIPopupAnchor, UIPopupDescriptor, UISelectControl, UISelectOption, UITextBlockControl, UIMultiSelectControl, UIMultiSelectOption, } from "./ui";
|
|
13
13
|
export type { OverlayOptions, OverlayScope, OverlayState, OverlayType } from "./overlays";
|
|
14
|
-
export type { BlockConfig, CellAlign, CellRenderParams, CellClassRules, CellSpan, CellSpanningParams, CheckboxControl, CheckboxRenderParams, ColSpanDef, ColumnClassRules, ColumnDataType, ColumnFilterType, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, ColumnStyle, ColumnStyleParams, DataProcessor, DomPoolBindings, DomPoolUpdate, DomPoolUpdateOptions, GridApi, GridEvents, GridOptions, GridPlugin, GridState, HeaderClassRules, HeaderGroupClassRules, HeaderGroupRenderParams, HeaderRenderParams, HeaderStyle, OverlayComponent, OverlayComponentProps, PooledRow, Range, RowClassRules, RowClickEvent, RowHeightUpdateOptions, RowHost, RowHoverEvent, RowId, RowNode, RowRenderParams, RowSpanLayout, RowStyle, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, ViewportData, ViewportState, VirtualItem, } from "./types";
|
|
14
|
+
export type { BlockConfig, CellAlign, CellRenderParams, CellClassRules, CellSpan, CellSpanningParams, CheckboxControl, CheckboxRenderParams, ColSpanDef, ColumnClassRules, ColumnDataType, ColumnFilterType, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, ColumnStyle, ColumnStyleParams, DataProcessor, DomPoolBindings, DomPoolUpdate, DomPoolUpdateOptions, GridApi, GridEvents, GridOptions, GridPlugin, GridState, HeaderClassRules, HeaderGroupClassRules, HeaderGroupRenderParams, HeaderRenderParams, HeaderStyle, OverlayComponent, OverlayComponentProps, PooledRow, Range, RowClassRules, RowClickEvent, RowHeightUpdateOptions, RowHost, RowHoverEvent, RowId, RowNode, RowRenderParams, RowSpanLayout, RowStyle, RowTransaction, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, TransactionResult, ViewportData, ViewportState, VirtualItem, } from "./types";
|
|
15
15
|
export { getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf, getCellValue, getCellSpanningParams, resolveColSpan, getRowSpans } from "./columns";
|
|
16
16
|
export { Virtualizer, RowHeightRegistry } from "./virtualizer";
|
package/dist/types.d.ts
CHANGED
|
@@ -143,6 +143,10 @@ export interface CellRenderParams<T> {
|
|
|
143
143
|
data: T;
|
|
144
144
|
column: ColumnLeafDef<T>;
|
|
145
145
|
value?: unknown;
|
|
146
|
+
/** Whether the cell was recently updated and is currently flashing. */
|
|
147
|
+
isFlashed?: boolean;
|
|
148
|
+
/** Timestamp (ms) when the flash started; used by adapters to restart CSS animation on re-flash. */
|
|
149
|
+
flashTimestamp?: number;
|
|
146
150
|
}
|
|
147
151
|
export type CellClassRules<T> = Record<string, (params: CellRenderParams<T>) => boolean>;
|
|
148
152
|
/**
|
|
@@ -465,6 +469,16 @@ export interface GridOptions<T> {
|
|
|
465
469
|
/** Columns to render beyond the visible viewport (left + right buffer). @default 2 */
|
|
466
470
|
columnOverscan?: number;
|
|
467
471
|
suppressRowHoverHighlight?: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Enables automatic cell flashing when data is mutated via
|
|
474
|
+
* `grid.applyTransaction()`. Cells whose values changed are highlighted
|
|
475
|
+
* with a CSS transition that fades out automatically. Pass `true` for the
|
|
476
|
+
* default duration (1000ms), or a number for a custom duration in
|
|
477
|
+
* milliseconds. `false` / `0` / `undefined` disables the feature.
|
|
478
|
+
* @default false
|
|
479
|
+
* @api
|
|
480
|
+
*/
|
|
481
|
+
cellFlash?: boolean | number;
|
|
468
482
|
rowStyle?: RowStyle;
|
|
469
483
|
getRowStyle?: (params: RowRenderParams<T>) => RowStyle | undefined;
|
|
470
484
|
rowClass?: string | ((params: RowRenderParams<T>) => string | undefined);
|
|
@@ -641,6 +655,8 @@ export interface GridState<T> {
|
|
|
641
655
|
rowHeight: number;
|
|
642
656
|
rowOverscan: number;
|
|
643
657
|
columnOverscan: number;
|
|
658
|
+
/** Cells currently flashed, keyed by `${rowId}:${columnId}` → expiry timestamp. */
|
|
659
|
+
flashedCells: Map<string, number>;
|
|
644
660
|
/** Active overlay state — updated automatically by the grid's overlay manager. */
|
|
645
661
|
overlay: OverlayState;
|
|
646
662
|
/**
|
|
@@ -805,6 +821,51 @@ export interface GridPlugin<T> {
|
|
|
805
821
|
getRowClass?(params: RowRenderParams<T>): string | undefined;
|
|
806
822
|
getRowStyle?(params: RowRenderParams<T>): RowStyle | undefined;
|
|
807
823
|
}
|
|
824
|
+
/**
|
|
825
|
+
* A single targeted row transaction: add, update, or remove rows by their
|
|
826
|
+
* stable identifier (`getRowId`) without recreating the whole data array.
|
|
827
|
+
*
|
|
828
|
+
* Rows are matched against the current dataset by their row id. `add`
|
|
829
|
+
* appends new rows (optionally at `addIndex`), `update` replaces existing
|
|
830
|
+
* rows matched by id, and `remove` drops rows matched by id or by row object
|
|
831
|
+
* reference. Use a stable `getRowId` (a business key, not the row index) so
|
|
832
|
+
* row identity survives reordering and transactions.
|
|
833
|
+
*
|
|
834
|
+
* @api
|
|
835
|
+
*/
|
|
836
|
+
export interface RowTransaction<T> {
|
|
837
|
+
/** Rows to add. Each row receives a stable id via `getRowId`. */
|
|
838
|
+
add?: T[];
|
|
839
|
+
/**
|
|
840
|
+
* Zero-based index at which added rows are inserted.
|
|
841
|
+
* Defaults to appending at the end of the dataset.
|
|
842
|
+
* @default dataset length
|
|
843
|
+
* @api
|
|
844
|
+
*/
|
|
845
|
+
addIndex?: number;
|
|
846
|
+
/** Rows to update. Each row is matched by id and replaced with the new data. */
|
|
847
|
+
update?: T[];
|
|
848
|
+
/**
|
|
849
|
+
* Rows to remove, given either as row objects (matched by id/reference)
|
|
850
|
+
* or as raw row ids.
|
|
851
|
+
* @api
|
|
852
|
+
*/
|
|
853
|
+
remove?: Array<T | RowId>;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Outcome of `Grid.applyTransaction`: the added, updated and removed rows
|
|
857
|
+
* with their resolved ids and indexes in the dataset.
|
|
858
|
+
*
|
|
859
|
+
* @api
|
|
860
|
+
*/
|
|
861
|
+
export interface TransactionResult<T> {
|
|
862
|
+
/** Rows that were added, with their resolved id and index. */
|
|
863
|
+
added: RowNode<T>[];
|
|
864
|
+
/** Rows that were updated, with their resolved id and index. */
|
|
865
|
+
updated: RowNode<T>[];
|
|
866
|
+
/** Rows that were removed, with their resolved id and previous index. */
|
|
867
|
+
removed: RowNode<T>[];
|
|
868
|
+
}
|
|
808
869
|
export type SlotName = "top" | "bottom" | "left" | "right" | "bodyTop" | "bodyBottom" | "down";
|
|
809
870
|
export type SlotPosition = "start" | "center" | "end";
|
|
810
871
|
/**
|
|
@@ -946,6 +1007,22 @@ export interface GridApi<T> {
|
|
|
946
1007
|
* @api
|
|
947
1008
|
*/
|
|
948
1009
|
appendData(rows: T[] | null | undefined): void;
|
|
1010
|
+
/**
|
|
1011
|
+
* Applies a targeted row transaction (add / update / remove) to the State
|
|
1012
|
+
* Store without recreating the whole data array.
|
|
1013
|
+
*
|
|
1014
|
+
* Rows are matched by their stable id (`getRowId`). The pipeline caches
|
|
1015
|
+
* (filtered / processed data) are invalidated and the virtualizer's
|
|
1016
|
+
* row-height cache is reset only for the affected rows (or fully when the
|
|
1017
|
+
* dataset size changes), avoiding heavy recomputation.
|
|
1018
|
+
*
|
|
1019
|
+
* Emits a single `dataChange` with the resulting dataset and bumps the
|
|
1020
|
+
* grid revision.
|
|
1021
|
+
* @param transaction - The rows to add, update and/or remove.
|
|
1022
|
+
* @returns The added, updated and removed rows with resolved ids/indexes.
|
|
1023
|
+
* @api
|
|
1024
|
+
*/
|
|
1025
|
+
applyTransaction(transaction: RowTransaction<T>): TransactionResult<T>;
|
|
949
1026
|
/**
|
|
950
1027
|
* Records the measured DOM height of a row (variable-height mode).
|
|
951
1028
|
* Heights below 1px delta are ignored to prevent feedback loops between
|
package/dist/virtualizer.js
CHANGED
|
@@ -463,7 +463,13 @@ export class Virtualizer {
|
|
|
463
463
|
getColumnRange(columns, scrollLeft, viewportWidth, offsets) {
|
|
464
464
|
const computed = offsets ?? this.getColumnOffsets(columns, viewportWidth);
|
|
465
465
|
const start = this.findStart(computed, scrollLeft);
|
|
466
|
-
|
|
466
|
+
// When the viewport width is unknown (0 on first paint), we cannot
|
|
467
|
+
// determine how many columns fit. Return all columns so none are
|
|
468
|
+
// missing from the initial render — they will be resized correctly
|
|
469
|
+
// once measureViewport() sets the real width.
|
|
470
|
+
const end = viewportWidth === 0
|
|
471
|
+
? columns.length
|
|
472
|
+
: this.findEnd(computed, scrollLeft + viewportWidth);
|
|
467
473
|
return {
|
|
468
474
|
start: Math.max(0, start - this.options.columnOverscan),
|
|
469
475
|
end: Math.min(columns.length, end + 1 + this.options.columnOverscan),
|