@omnigrid/core 0.1.37 → 0.1.38

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/dom-pool.js CHANGED
@@ -47,6 +47,7 @@ export class DomPool {
47
47
  * report describing the update.
48
48
  */
49
49
  update(viewport) {
50
+ performance.mark("omnigrid.domPool.update.start");
50
51
  this.assertActive();
51
52
  const { data, rowRange, rowHeight, rowOffsets, rowHeights, visibleRowRange, rowWidth, skipBind } = viewport;
52
53
  if (data !== this.lastData) {
@@ -206,6 +207,8 @@ export class DomPool {
206
207
  recycled.push(host);
207
208
  }
208
209
  this.forceRebind = false;
210
+ performance.mark("omnigrid.domPool.update.end");
211
+ performance.measure("OmniGrid DomPool.update", "omnigrid.domPool.update.start", "omnigrid.domPool.update.end");
209
212
  return {
210
213
  windowStart: range.start,
211
214
  windowEnd: range.end,
package/dist/grid.d.ts CHANGED
@@ -4,7 +4,7 @@ import type { OverlayOptions, OverlayState } from "./overlays.js";
4
4
  import { DataPipeline } from "./pipeline.js";
5
5
  import { SlotManager } from "./slots.js";
6
6
  import { type StateUpdater } from "./store.js";
7
- import type { AggregationFunc, ColumnHeaderExtension, ColumnHeaderExtensionPosition, ColumnLeafDef, DataProcessor, DefaultColumnDef, GridApi, GridEvents, GridOptions, GridPlugin, GridState, RowClickEvent, RowHeightUpdateOptions, RowHierarchy, RowHoverEvent, RowId, RowSpanLayout, RowTransaction, ScrollPosition, GridStateUpdateOptions, SlotMount, SlotName, TransactionResult, TreeRowNode, ViewportData, ViewportState } from "./types.js";
7
+ import type { AggregationFunc, ColumnHeaderExtension, ColumnHeaderExtensionPosition, ColumnLeafDef, DataProcessor, DefaultColumnDef, GridApi, GridEvents, GridMetrics, GridOptions, GridPlugin, GridState, RowClickEvent, RowHeightUpdateOptions, RowHierarchy, RowHoverEvent, RowId, RowSpanLayout, RowTransaction, ScrollPosition, GridStateUpdateOptions, SlotMount, SlotName, TransactionResult, TreeRowNode, ViewportData, ViewportState } from "./types.js";
8
8
  import type { UIPopupAnchor, UIPopupDescriptor } from "./ui.js";
9
9
  export declare class Grid<T> implements GridApi<T> {
10
10
  private readonly store;
@@ -282,6 +282,14 @@ export declare class Grid<T> implements GridApi<T> {
282
282
  resetRowHeight(rowIndex: number, options?: RowHeightUpdateOptions): number;
283
283
  /** Removes all measured row heights (e.g. after `setColumns`). @api */
284
284
  resetAllRowHeights(): void;
285
+ /**
286
+ * Updates structural grid metrics at runtime (e.g. the base row height when
287
+ * a theme scales the whole grid). Recomputes the virtualizer geometry and
288
+ * notifies Store subscribers so the host re-renders with the new layout.
289
+ * @param metrics - Metrics to apply; omitted fields are left unchanged.
290
+ * @api
291
+ */
292
+ setMetrics(metrics: GridMetrics): void;
285
293
  /**
286
294
  * Returns the absolute vertical offset (px) of the top of a row,
287
295
  * accounting for variable heights. Falls back to `index * rowHeight`
package/dist/grid.js CHANGED
@@ -89,12 +89,14 @@ export class Grid {
89
89
  this.autoColumnsPending = options.columns === undefined && (options.data?.length ?? 0) === 0;
90
90
  this.autoColumnHeaderMode = options.autoColumnHeaderMode;
91
91
  this.getColumnHeader = options.getColumnHeader;
92
+ const scale = options.scale ?? 1;
92
93
  const state = {
93
94
  data: options.data ?? [],
94
95
  columns: applyWrapText(applyDefaultColumnDef(options.columns ??
95
96
  inferColumns(options.data, options.getColumnHeader, options.autoColumnHeaderMode), options.defaultColumnDef), options.wrapText),
96
97
  viewport: { width: 0, height: 0, scrollTop: 0, scrollLeft: 0 },
97
- rowHeight: options.rowHeight ?? 32,
98
+ rowHeight: options.rowHeight ?? Math.round(32 * scale),
99
+ scale,
98
100
  groupBy: [],
99
101
  expandedGroups: {},
100
102
  groupColumnMode: "single",
@@ -528,11 +530,14 @@ export class Grid {
528
530
  // optimization for DOM Pool operation with large row counts.
529
531
  if (this.processedDataCache !== null)
530
532
  return this.processedDataCache;
533
+ performance.mark("omnigrid.processedData.start");
531
534
  const state = this.getState();
532
535
  const filtered = this.getFilteredData();
533
536
  const legacyProcessed = [...this.dataProcessors].reduce((data, processor) => processor(data), filtered);
534
537
  const result = this.pipeline.process(legacyProcessed, state);
535
538
  this.processedDataCache = result;
539
+ performance.mark("omnigrid.processedData.end");
540
+ performance.measure("OmniGrid getProcessedData pipeline", "omnigrid.processedData.start", "omnigrid.processedData.end");
536
541
  return result;
537
542
  }
538
543
  /**
@@ -926,6 +931,38 @@ export class Grid {
926
931
  this.revision += 1;
927
932
  this.store.setState({}, { force: true });
928
933
  }
934
+ /**
935
+ * Updates structural grid metrics at runtime (e.g. the base row height when
936
+ * a theme scales the whole grid). Recomputes the virtualizer geometry and
937
+ * notifies Store subscribers so the host re-renders with the new layout.
938
+ * @param metrics - Metrics to apply; omitted fields are left unchanged.
939
+ * @api
940
+ */
941
+ setMetrics(metrics) {
942
+ this.assertActive();
943
+ const nextScale = metrics.scale;
944
+ const nextRowHeight = metrics.rowHeight;
945
+ let resolvedScale = nextScale;
946
+ let resolvedRowHeight = nextRowHeight;
947
+ if (nextScale !== undefined && Number.isFinite(nextScale) && nextScale > 0) {
948
+ resolvedScale = nextScale;
949
+ if (nextRowHeight === undefined) {
950
+ resolvedRowHeight = Math.round(32 * nextScale);
951
+ }
952
+ }
953
+ const state = this.getState();
954
+ const scaleChanged = resolvedScale !== undefined && resolvedScale !== state.scale;
955
+ const rowHeightChanged = resolvedRowHeight !== undefined && resolvedRowHeight !== state.rowHeight;
956
+ if (!scaleChanged && !rowHeightChanged)
957
+ return;
958
+ if (scaleChanged || rowHeightChanged) {
959
+ this.virtualizer.setBaseRowHeight(resolvedRowHeight ?? state.rowHeight);
960
+ }
961
+ this.store.setState({
962
+ ...(resolvedScale !== undefined ? { scale: resolvedScale } : {}),
963
+ ...(resolvedRowHeight !== undefined ? { rowHeight: resolvedRowHeight } : {}),
964
+ });
965
+ }
929
966
  /**
930
967
  * Returns the absolute vertical offset (px) of the top of a row,
931
968
  * accounting for variable heights. Falls back to `index * rowHeight`
@@ -1426,12 +1463,21 @@ export class Grid {
1426
1463
  if (this.overlayManual)
1427
1464
  return;
1428
1465
  const state = this.store.getState();
1429
- const processedData = this.getProcessedData();
1466
+ const loading = this.loading || !this.hasData;
1467
+ let processedData;
1468
+ if (!loading && this.loadError === undefined) {
1469
+ if (state.data.length === 0) {
1470
+ processedData = [];
1471
+ }
1472
+ else {
1473
+ processedData = this.getProcessedData();
1474
+ }
1475
+ }
1430
1476
  const type = evaluateAutoOverlay({
1431
- loading: this.loading || !this.hasData,
1477
+ loading,
1432
1478
  error: this.loadError,
1433
1479
  rawData: state.data,
1434
- processedData,
1480
+ processedData: processedData ?? [],
1435
1481
  });
1436
1482
  const next = type
1437
1483
  ? {
package/dist/icons.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { SlotNodeContent } from "./types.js";
2
- export type IconName = "chevron-left" | "chevron-right" | "chevron-up" | "chevron-down" | "chevron-first" | "chevron-last" | "arrow-up" | "arrow-down" | "arrow-up-down" | "filter" | "search";
2
+ export type IconName = "chevron-left" | "chevron-right" | "chevron-up" | "chevron-down" | "chevron-first" | "chevron-last" | "arrow-up" | "arrow-down" | "arrow-up-down" | "filter" | "search" | "calendar";
3
3
  export type IconDefinition<T> = SlotNodeContent<T> | (() => SlotNodeContent<T>);
4
4
  /** Framework-agnostic registry of declarative SVG slot nodes. */
5
5
  export declare class IconRegistry<T> {
package/dist/icons.js CHANGED
@@ -30,6 +30,12 @@ const DEFAULT_ICON_PATHS = {
30
30
  { tag: "circle", attrs: { cx: "11", cy: "11", r: "8" } },
31
31
  { tag: "path", attrs: { d: "m21 21-4.3-4.3" } },
32
32
  ],
33
+ "calendar": [
34
+ { tag: "rect", attrs: { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" } },
35
+ { tag: "line", attrs: { x1: "16", y1: "2", x2: "16", y2: "6" } },
36
+ { tag: "line", attrs: { x1: "8", y1: "2", x2: "8", y2: "6" } },
37
+ { tag: "line", attrs: { x1: "3", y1: "10", x2: "21", y2: "10" } },
38
+ ],
33
39
  };
34
40
  function createSvgIcon(name, paths) {
35
41
  return {
package/dist/index.d.ts CHANGED
@@ -12,8 +12,8 @@ export { DataPipeline, PIPELINE_STAGE_ORDER } from "./pipeline.js";
12
12
  export type { PipelineProcessor, PipelineStage } from "./pipeline.js";
13
13
  export { applyFilterModel, applyQuickFilter, isActiveCondition, isFilterModelActive, matchesColumnFilter, } from "./filtering.js";
14
14
  export type { ColumnFilterModel, FilterCondition, FilterModel, FilterOperator } from "./filtering.js";
15
- export type { UIButtonControl, UICheckboxDescriptor, UIControlBase, UIControlDescriptor, UIGroupControl, UIInputControl, UIPopupAnchor, UIPopupDescriptor, UISelectControl, UISelectOption, UITextBlockControl, UIMultiSelectControl, UIMultiSelectOption, } from "./ui.js";
15
+ export type { UIButtonControl, UICheckboxDescriptor, UIControlBase, UIControlDescriptor, UIGroupControl, UIIconControl, UIInputBase, UIInputControl, UIDateInputControl, UIDateLocaleStrings, UINumberInputControl, UITextInputControl, UIPopupAnchor, UIPopupDescriptor, UIRadioControl, UIRadioOption, UISelectControl, UISeparatorControl, UISelectOption, UITextBlockControl, UIMultiSelectControl, UIMultiSelectOption, } from "./ui.js";
16
16
  export type { OverlayOptions, OverlayScope, OverlayState, OverlayType } from "./overlays.js";
17
- export type { BlockConfig, CellAlign, AggregationFunc, AutoColumnHeaderMode, ColumnHeaderExtension, ColumnHeaderExtensionPosition, CellRenderParams, CellClassRules, CellSpan, CellSpanningParams, CheckboxControl, CheckboxRenderParams, ColSpanDef, ColumnClassRules, ColumnDataType, ColumnDropPosition, DefaultColumnDef, ColumnFilterType, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, ColumnStyle, ColumnStyleParams, DataProcessor, DataRowNode, DomPoolBindings, DomPoolUpdate, DomPoolUpdateOptions, GroupRowNode, GroupRowRenderParams, GroupRowRenderer, CoreGridApi, CoreGridState, GridStateUpdateOptions, GridApi, GridEvents, GridOptions, GridPlugin, GridState, PluginApiExtensions, PluginStateExtensions, ResolvedAggregationFunc, HeaderClassRules, HeaderGroupClassRules, HeaderGroupRenderParams, HeaderRenderParams, HeaderStyle, OverlayComponent, OverlayComponentProps, PooledRow, Range, RowClassRules, RowClickEvent, RowHeightUpdateOptions, RowHost, RowHoverEvent, RowId, RowHierarchy, RowHierarchyScope, RowGroupContext, RowGroupContextChild, RowNode, RowRenderParams, RowSpanLayout, RowStyle, RowTransaction, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, TransactionResult, TreeRowNode, ViewportData, ViewportState, VirtualItem, } from "./types.js";
17
+ export type { BlockConfig, CellAlign, AggregationFunc, AutoColumnHeaderMode, ColumnHeaderExtension, ColumnHeaderExtensionPosition, CellRenderParams, CellClassRules, CellSpan, CellSpanningParams, CheckboxControl, CheckboxRenderParams, ColSpanDef, ColumnClassRules, ColumnDataType, ColumnDropPosition, DefaultColumnDef, ColumnFilterType, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, ColumnStyle, ColumnStyleParams, DataProcessor, DataRowNode, DomPoolBindings, DomPoolUpdate, DomPoolUpdateOptions, GroupRowNode, GroupRowRenderParams, GroupRowRenderer, CoreGridApi, CoreGridState, GridStateUpdateOptions, GridApi, GridEvents, GridMetrics, GridOptions, GridPlugin, GridState, PluginApiExtensions, PluginStateExtensions, ResolvedAggregationFunc, HeaderClassRules, HeaderGroupClassRules, HeaderGroupRenderParams, HeaderRenderParams, HeaderStyle, OverlayComponent, OverlayComponentProps, PooledRow, Range, RowClassRules, RowClickEvent, RowHeightUpdateOptions, RowHost, RowHoverEvent, RowId, RowHierarchy, RowHierarchyScope, RowGroupContext, RowGroupContextChild, RowNode, RowRenderParams, RowSpanLayout, RowStyle, RowTransaction, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, TransactionResult, TreeRowNode, ViewportData, ViewportState, VirtualItem, } from "./types.js";
18
18
  export { applyDefaultColumnDef, getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf, getCellValue, getCellSpanningParams, resolveColSpan, getRowSpans, inferColumns, } from "./columns.js";
19
19
  export { Virtualizer, RowHeightRegistry } from "./virtualizer.js";
package/dist/types.d.ts CHANGED
@@ -613,6 +613,31 @@ export interface RowHeightUpdateOptions {
613
613
  */
614
614
  notify?: boolean;
615
615
  }
616
+ /**
617
+ * Structural grid metrics that can be updated at runtime.
618
+ *
619
+ * These drive both the virtualizer geometry (row height, total scroll height)
620
+ * and the rendered layout, so a single update keeps the scroll math and the
621
+ * DOM in sync — e.g. when a theme scales the whole grid proportionally.
622
+ *
623
+ * @api
624
+ */
625
+ export interface GridMetrics {
626
+ /**
627
+ * Base row height (px) for fixed-height grids. Scaled/derived values
628
+ * (font size, paddings) live in CSS via `--omnigrid-scale`; this is the
629
+ * single source of truth the virtualizer uses for row geometry.
630
+ */
631
+ rowHeight?: number;
632
+ /**
633
+ * Theme scale coefficient (1 = 100%). Core stores it and derives
634
+ * `rowHeight = Math.round(baseRowHeight * scale)` so the virtualizer
635
+ * geometry and the CSS tokens stay consistent. Each grid instance owns
636
+ * its own scale — it does not leak to other grids on the page.
637
+ * @default 1
638
+ */
639
+ scale?: number;
640
+ }
616
641
  /**
617
642
  * Built-in formatting modes for headers inferred from row fields.
618
643
  * @api
@@ -648,6 +673,14 @@ export interface GridOptions<T> {
648
673
  /** Returns a stable row ID; defaults to the row's current index. Use a stable ID to preserve row identity when rows are reordered. */
649
674
  getRowId?: (row: T, index: number) => RowId;
650
675
  rowHeight?: number;
676
+ /**
677
+ * Theme scale coefficient applied to the base row height (`rowHeight =
678
+ * Math.round(baseRowHeight * scale)`). `1` means 100%. Each grid instance
679
+ * owns its own scale — it does not leak to other grids on the page.
680
+ * @default 1
681
+ * @api
682
+ */
683
+ scale?: number;
651
684
  /** Enables automatic text wrapping for all cells. @default false @api */
652
685
  wrapText?: boolean;
653
686
  /**
@@ -893,6 +926,8 @@ export interface CoreGridState<T> {
893
926
  columns: ColumnDef<T>[];
894
927
  viewport: ViewportState;
895
928
  rowHeight: number;
929
+ /** Theme scale coefficient (1 = 100%). Drives rowHeight geometry. */
930
+ scale: number;
896
931
  rowOverscan: number;
897
932
  columnOverscan: number;
898
933
  /** Cells currently flashed, keyed by `${rowId}:${columnId}` → expiry timestamp. */
@@ -1401,6 +1436,14 @@ export interface CoreGridApi<T> {
1401
1436
  * @api
1402
1437
  */
1403
1438
  setRowHeight(rowIndex: number, height: number, options?: RowHeightUpdateOptions): number;
1439
+ /**
1440
+ * Updates structural grid metrics at runtime (e.g. the base row height when
1441
+ * a theme scales the grid). Recomputes the virtualizer geometry and notifies
1442
+ * Store subscribers so the host re-renders with the new layout.
1443
+ * @param metrics - Metrics to apply; omitted fields are left unchanged.
1444
+ * @api
1445
+ */
1446
+ setMetrics(metrics: GridMetrics): void;
1404
1447
  /**
1405
1448
  * Removes a measured row height (e.g. when row content collapses back to
1406
1449
  * the estimate). Returns the scrollTop correction like `setRowHeight`.
package/dist/ui.d.ts CHANGED
@@ -36,9 +36,8 @@ export interface UIControlBase {
36
36
  /** Extra CSS class names. */
37
37
  className?: string;
38
38
  }
39
- /** Single-line text, number or date input. @api */
40
- export interface UIInputControl extends UIControlBase {
41
- type: "text" | "number" | "date";
39
+ /** Properties shared by all input controls. @api */
40
+ export interface UIInputBase extends UIControlBase {
42
41
  /** Current value. */
43
42
  value: string;
44
43
  /** Placeholder text. */
@@ -50,6 +49,47 @@ export interface UIInputControl extends UIControlBase {
50
49
  /** Called when the user presses Enter while the input is focused. */
51
50
  onEnter?: () => void;
52
51
  }
52
+ /** Single-line text input. @api */
53
+ export interface UITextInputControl extends UIInputBase {
54
+ type: "text";
55
+ /** Maximum number of characters. */
56
+ maxLength?: number;
57
+ }
58
+ /** Numeric input. @api */
59
+ export interface UINumberInputControl extends UIInputBase {
60
+ type: "number";
61
+ /** Minimum allowed value. */
62
+ min?: number;
63
+ /** Maximum allowed value. */
64
+ max?: number;
65
+ /** Step increment. */
66
+ step?: number;
67
+ }
68
+ /** Localized strings for a date input. @api */
69
+ export interface UIDateLocaleStrings {
70
+ /** Month names (12). */
71
+ months?: readonly string[];
72
+ /** Short weekday names (7). */
73
+ weekdaysShort?: readonly string[];
74
+ /** Label for "today". */
75
+ todayLabel?: string;
76
+ /** Label for "clear". */
77
+ clearLabel?: string;
78
+ }
79
+ /** Date input. @api */
80
+ export interface UIDateInputControl extends UIInputBase {
81
+ type: "date";
82
+ /** Minimum selectable date (ISO `YYYY-MM-DD`). */
83
+ minDate?: string;
84
+ /** Maximum selectable date (ISO `YYYY-MM-DD`). */
85
+ maxDate?: string;
86
+ /** Display format. */
87
+ dateFormat?: string;
88
+ /** Per-control locale override. */
89
+ locale?: UIDateLocaleStrings;
90
+ }
91
+ /** Single-line text, number or date input. @api */
92
+ export type UIInputControl = UITextInputControl | UINumberInputControl | UIDateInputControl;
53
93
  /** Drop-down select. @api */
54
94
  export interface UISelectControl extends UIControlBase {
55
95
  type: "select";
@@ -68,13 +108,36 @@ export interface UICheckboxDescriptor extends UIControlBase {
68
108
  /** Called with the new checked state. */
69
109
  onChange: (checked: boolean) => void;
70
110
  }
111
+ /** Radio option. @api */
112
+ export interface UIRadioOption {
113
+ /** Value of the item. */
114
+ value: string;
115
+ /** Human-readable label. */
116
+ label: string;
117
+ }
118
+ /** Radio button group. @api */
119
+ export interface UIRadioControl extends UIControlBase {
120
+ type: "radio";
121
+ /** Layout direction of the options. @default "row" */
122
+ direction?: "row" | "column";
123
+ /** Available options. */
124
+ options: UIRadioOption[];
125
+ /** Currently selected value. */
126
+ value: string;
127
+ /** Called with the newly selected value. */
128
+ onChange: (value: string) => void;
129
+ }
71
130
  /** Push button. @api */
72
131
  export interface UIButtonControl extends UIControlBase {
73
132
  type: "button";
74
133
  /** Button caption. */
75
- text: string;
134
+ text?: string;
135
+ /** Icon name rendered inside the button. */
136
+ icon?: string;
76
137
  /** Visual emphasis. @default "secondary" */
77
- variant?: "primary" | "secondary";
138
+ variant?: "primary" | "secondary" | "ghost";
139
+ /** CSS width; when omitted the button stretches to full parent width. */
140
+ width?: string;
78
141
  /** Called when the button is clicked. */
79
142
  onClick: () => void;
80
143
  }
@@ -106,13 +169,27 @@ export interface UIMultiSelectControl extends UIControlBase {
106
169
  /** Container laying out child controls. @api */
107
170
  export interface UIGroupControl extends UIControlBase {
108
171
  type: "group";
109
- /** Layout direction. @default "column" */
172
+ /** Layout direction. @default "row" */
110
173
  direction?: "row" | "column";
174
+ /** Gap between child controls. @default "var(--omnigrid-control-gap, 8px)" */
175
+ gap?: string;
111
176
  /** Nested controls. */
112
177
  children: UIControlDescriptor[];
113
178
  }
179
+ /** Renders a monochrome icon resolved through the grid's icon registry. @api */
180
+ export interface UIIconControl extends UIControlBase {
181
+ type: "icon";
182
+ /** Icon name resolved through {@link GridApi.icons}. */
183
+ name: string;
184
+ }
185
+ /** Visual separator. @api */
186
+ export interface UISeparatorControl extends UIControlBase {
187
+ type: "separator";
188
+ /** Orientation. @default "horizontal" */
189
+ orientation?: "horizontal" | "vertical";
190
+ }
114
191
  /** Any declarative control. @api */
115
- export type UIControlDescriptor = UIInputControl | UISelectControl | UICheckboxDescriptor | UIButtonControl | UITextBlockControl | UIMultiSelectControl | UIGroupControl;
192
+ export type UIControlDescriptor = UIInputControl | UISelectControl | UICheckboxDescriptor | UIRadioControl | UIButtonControl | UITextBlockControl | UIMultiSelectControl | UIGroupControl | UIIconControl | UISeparatorControl;
116
193
  /** Viewport-relative anchor rectangle (CSS pixels) a popup is positioned against. @api */
117
194
  export interface UIPopupAnchor {
118
195
  x: number;
@@ -104,6 +104,12 @@ export declare class Virtualizer<T> {
104
104
  constructor(options: VirtualizerOptions);
105
105
  /** Dynamic height registry backing variable-height mode. @api */
106
106
  get rowHeights(): RowHeightRegistry;
107
+ /**
108
+ * Updates the base row height used for fixed-height grids and invalidates
109
+ * the memoized row range (its cache key does not include the row height).
110
+ * @api
111
+ */
112
+ setBaseRowHeight(height: number): void;
107
113
  /** Estimated height used for rows without a measurement. @api */
108
114
  get estimatedRowHeight(): number;
109
115
  /** Whether any variable-height input exists (resolver counts or measured heights exist). @api */
@@ -248,6 +248,21 @@ export class Virtualizer {
248
248
  get rowHeights() {
249
249
  return this.heights;
250
250
  }
251
+ /**
252
+ * Updates the base row height used for fixed-height grids and invalidates
253
+ * the memoized row range (its cache key does not include the row height).
254
+ * @api
255
+ */
256
+ setBaseRowHeight(height) {
257
+ if (!Number.isFinite(height) || height <= 0)
258
+ return;
259
+ const rounded = Math.round(height);
260
+ if (this.options.rowHeight === rounded)
261
+ return;
262
+ this.options.rowHeight = rounded;
263
+ this.lastScrollTop = null;
264
+ this.lastRowRange = null;
265
+ }
251
266
  /** Estimated height used for rows without a measurement. @api */
252
267
  get estimatedRowHeight() {
253
268
  return this.options.estimatedRowHeight ?? this.options.rowHeight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/core",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Framework-agnostic core engine for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",