@omnigrid/core 0.1.6 → 0.1.8

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import { IconRegistry } from "./icons";
2
2
  import { SlotManager } from "./slots";
3
3
  import type { DataProcessor, GridApi, GridEvents, GridOptions, GridPlugin, GridState, RowClickEvent, RowHoverEvent, RowId, ScrollPosition, SlotMount, SlotName, ViewportData, ViewportState } from "./types";
4
+ import type { OverlayState, OverlayType } from "./overlays";
4
5
  export declare class Grid<T> implements GridApi<T> {
5
6
  private readonly store;
6
7
  private readonly events;
@@ -13,6 +14,16 @@ export declare class Grid<T> implements GridApi<T> {
13
14
  private processedDataCache;
14
15
  private revision;
15
16
  private destroyed;
17
+ /**
18
+ * Overlay management state:
19
+ * - `loading`: whether the grid is fetching data (set via setLoading / options.loading)
20
+ * - `overlayState`: the current active overlay (type + payload)
21
+ * - `overlayManual`: whether the overlay was set manually (showOverlay), which
22
+ * disables auto-evaluation until hideOverlay re-enables it.
23
+ */
24
+ private loading;
25
+ private overlayState;
26
+ private overlayManual;
16
27
  /**
17
28
  * Separate ephemeral scroll position that is NOT stored in the Store.
18
29
  *
@@ -23,6 +34,8 @@ export declare class Grid<T> implements GridApi<T> {
23
34
  */
24
35
  private scrollPosition;
25
36
  constructor(options: GridOptions<T>);
37
+ /** Returns the calculated width for a visible column, including off-screen columns. */
38
+ getColumnWidth(columnId: string): number | undefined;
26
39
  getState(): GridState<T>;
27
40
  /** Returns the current ephemeral scroll position (not part of Store state). */
28
41
  getScrollPosition(): ScrollPosition;
@@ -48,6 +61,18 @@ export declare class Grid<T> implements GridApi<T> {
48
61
  emit<EventName extends keyof GridEvents<T>>(event: EventName, payload: GridEvents<T>[EventName]): void;
49
62
  registerPlugin(plugin: GridPlugin<T>): () => void;
50
63
  getSlotMounts(slot: SlotName): SlotMount<T>[];
64
+ showOverlay(type: OverlayType, payload?: unknown): void;
65
+ hideOverlay(): void;
66
+ getOverlayState(): OverlayState;
67
+ setLoading(isLoading: boolean): void;
68
+ /**
69
+ * Re-evaluates the overlay based on the current Data Pipeline state.
70
+ *
71
+ * Skipped when a manual overlay is active (set via `showOverlay`). The
72
+ * Store is only updated when the overlay type actually changes — identical
73
+ * evaluations are a no-op to avoid spurious React re-renders.
74
+ */
75
+ private recomputeOverlay;
51
76
  /** Monotonic counter for structural changes (refresh / data / columns). */
52
77
  getRevision(): number;
53
78
  destroy(): void;
package/dist/grid.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { flattenColumns, getColumnGroups } from "./columns";
2
2
  import { EventBus } from "./events";
3
+ import { evaluateAutoOverlay } from "./overlays";
3
4
  import { IconRegistry } from "./icons";
4
5
  import { SlotManager } from "./slots";
5
6
  import { Store } from "./store";
@@ -13,6 +14,16 @@ export class Grid {
13
14
  this.processedDataCache = null;
14
15
  this.revision = 0;
15
16
  this.destroyed = false;
17
+ /**
18
+ * Overlay management state:
19
+ * - `loading`: whether the grid is fetching data (set via setLoading / options.loading)
20
+ * - `overlayState`: the current active overlay (type + payload)
21
+ * - `overlayManual`: whether the overlay was set manually (showOverlay), which
22
+ * disables auto-evaluation until hideOverlay re-enables it.
23
+ */
24
+ this.loading = false;
25
+ this.overlayState = { type: null };
26
+ this.overlayManual = false;
16
27
  /**
17
28
  * Separate ephemeral scroll position that is NOT stored in the Store.
18
29
  *
@@ -29,9 +40,11 @@ export class Grid {
29
40
  rowHeight: options.rowHeight ?? 32,
30
41
  rowOverscan: options.rowOverscan ?? 5,
31
42
  columnOverscan: options.columnOverscan ?? 2,
43
+ overlay: { type: null },
32
44
  };
33
45
  this.store = new Store(state);
34
46
  this.resolveRowId = options.getRowId ?? ((_row, index) => index);
47
+ this.loading = options.loading ?? false;
35
48
  this.virtualizer = new Virtualizer({
36
49
  rowHeight: state.rowHeight,
37
50
  rowOverscan: state.rowOverscan,
@@ -45,6 +58,31 @@ export class Grid {
45
58
  });
46
59
  this.store.subscribe(() => this.events.emit("stateChange", this.store.getState()));
47
60
  options.plugins?.forEach((plugin) => this.registerPlugin(plugin));
61
+ this.recomputeOverlay();
62
+ }
63
+ /** Returns the calculated width for a visible column, including off-screen columns. */
64
+ getColumnWidth(columnId) {
65
+ const state = this.getState();
66
+ const visibleColumns = flattenColumns(state.columns).filter((column) => !column.hidden);
67
+ if (!visibleColumns.some((column) => column.id === columnId))
68
+ return undefined;
69
+ const pinnedLeft = visibleColumns.filter((column) => column.pinned === "left");
70
+ const scrollable = visibleColumns.filter((column) => !column.pinned);
71
+ const pinnedRight = visibleColumns.filter((column) => column.pinned === "right");
72
+ const pinnedLeftOffsets = this.virtualizer.getColumnOffsets(pinnedLeft, state.viewport.width);
73
+ const pinnedRightOffsets = this.virtualizer.getColumnOffsets(pinnedRight, state.viewport.width);
74
+ const pinnedLeftWidth = pinnedLeftOffsets.reduce((sum, item) => sum + item.size, 0);
75
+ const pinnedRightWidth = pinnedRightOffsets.reduce((sum, item) => sum + item.size, 0);
76
+ const scrollableWidth = Math.max(0, state.viewport.width - pinnedLeftWidth - pinnedRightWidth);
77
+ const scrollableOffsets = this.virtualizer.getColumnOffsets(scrollable, scrollableWidth);
78
+ const pinnedLeftIndex = pinnedLeft.findIndex((column) => column.id === columnId);
79
+ if (pinnedLeftIndex >= 0)
80
+ return pinnedLeftOffsets[pinnedLeftIndex].size;
81
+ const pinnedRightIndex = pinnedRight.findIndex((column) => column.id === columnId);
82
+ if (pinnedRightIndex >= 0)
83
+ return pinnedRightOffsets[pinnedRightIndex].size;
84
+ const scrollableIndex = scrollable.findIndex((column) => column.id === columnId);
85
+ return scrollableOffsets[scrollableIndex]?.size;
48
86
  }
49
87
  getState() {
50
88
  return this.store.getState();
@@ -160,6 +198,7 @@ export class Grid {
160
198
  this.revision += 1;
161
199
  this.store.setState({ data });
162
200
  this.events.emit("dataChange", data);
201
+ this.recomputeOverlay();
163
202
  }
164
203
  setViewport(viewport) {
165
204
  this.assertActive();
@@ -221,14 +260,18 @@ export class Grid {
221
260
  this.processedDataCache = null;
222
261
  this.revision += 1;
223
262
  this.store.setState({ columns });
263
+ this.recomputeOverlay();
224
264
  }
225
265
  registerDataProcessor(processor) {
226
266
  this.assertActive();
227
267
  this.dataProcessors.add(processor);
228
268
  this.processedDataCache = null;
269
+ this.recomputeOverlay();
229
270
  const unregister = () => {
230
271
  this.dataProcessors.delete(processor);
231
272
  this.processedDataCache = null;
273
+ if (!this.destroyed)
274
+ this.recomputeOverlay();
232
275
  };
233
276
  return unregister;
234
277
  }
@@ -270,6 +313,54 @@ export class Grid {
270
313
  getSlotMounts(slot) {
271
314
  return this.slots.getMounts(slot);
272
315
  }
316
+ showOverlay(type, payload) {
317
+ this.assertActive();
318
+ this.overlayManual = true;
319
+ this.overlayState = { type, payload };
320
+ this.store.setState({ overlay: { ...this.overlayState } });
321
+ this.events.emit("overlayChange", { ...this.overlayState });
322
+ }
323
+ hideOverlay() {
324
+ this.assertActive();
325
+ this.overlayManual = false;
326
+ this.recomputeOverlay();
327
+ }
328
+ getOverlayState() {
329
+ return { ...this.overlayState };
330
+ }
331
+ setLoading(isLoading) {
332
+ this.assertActive();
333
+ if (this.loading === isLoading)
334
+ return;
335
+ this.loading = isLoading;
336
+ this.recomputeOverlay();
337
+ }
338
+ /**
339
+ * Re-evaluates the overlay based on the current Data Pipeline state.
340
+ *
341
+ * Skipped when a manual overlay is active (set via `showOverlay`). The
342
+ * Store is only updated when the overlay type actually changes — identical
343
+ * evaluations are a no-op to avoid spurious React re-renders.
344
+ */
345
+ recomputeOverlay() {
346
+ if (this.destroyed)
347
+ return;
348
+ if (this.overlayManual)
349
+ return;
350
+ const state = this.store.getState();
351
+ const processedData = this.getProcessedData();
352
+ const type = evaluateAutoOverlay({
353
+ loading: this.loading,
354
+ rawData: state.data,
355
+ processedData,
356
+ });
357
+ const next = { type };
358
+ if (next.type !== this.overlayState.type || next.payload !== this.overlayState.payload) {
359
+ this.overlayState = next;
360
+ this.store.setState({ overlay: { ...next } });
361
+ this.events.emit("overlayChange", { ...next });
362
+ }
363
+ }
273
364
  /** Monotonic counter for structural changes (refresh / data / columns). */
274
365
  getRevision() {
275
366
  return this.revision;
@@ -281,6 +372,8 @@ export class Grid {
281
372
  this.cleanupPlugins.clear();
282
373
  this.dataProcessors.clear();
283
374
  this.processedDataCache = null;
375
+ this.overlayState = { type: null };
376
+ this.overlayManual = false;
284
377
  this.slots.clear();
285
378
  this.store.clear();
286
379
  this.events.clear();
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  export { DomPool } from "./dom-pool";
2
2
  export { EventBus } from "./events";
3
+ export { evaluateAutoOverlay } from "./overlays";
3
4
  export { IconRegistry } from "./icons";
4
5
  export type { IconDefinition, IconName } from "./icons";
5
6
  export { Grid } from "./grid";
6
7
  export { Grid as GridCore } from "./grid";
7
8
  export { SlotManager } from "./slots";
8
9
  export { Store } from "./store";
10
+ export type { OverlayState, OverlayType } from "./overlays";
9
11
  export type { BlockConfig, CellAlign, CellRenderParams, CellClassRules, CheckboxControl, CheckboxRenderParams, ColumnDef, ColumnGroupDef, ColumnGroupViewport, ColumnLeafDef, DataProcessor, DomPoolBindings, DomPoolUpdate, GridApi, GridEvents, GridOptions, GridPlugin, GridState, PooledRow, Range, RowClassRules, RowClickEvent, RowHost, RowHoverEvent, RowId, RowRenderParams, RowStyle, ScrollPosition, SlotComponentContent, SlotContent, SlotHtmlContent, SlotMount, SlotMountOptions, SlotName, SlotNodeContent, SlotNodeEvent, SlotNodeEventName, SlotPosition, SlotProvider, SlotRenderContext, SortDirection, ViewportData, ViewportState, VirtualItem, } from "./types";
10
12
  export { getColumnGroups, flattenColumns, isColumnGroup, isColumnLeaf } from "./columns";
11
13
  export { Virtualizer } from "./virtualizer";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { DomPool } from "./dom-pool";
2
2
  export { EventBus } from "./events";
3
+ export { evaluateAutoOverlay } from "./overlays";
3
4
  export { IconRegistry } from "./icons";
4
5
  export { Grid } from "./grid";
5
6
  export { Grid as GridCore } from "./grid";
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @file Core overlay management types and evaluation logic.
3
+ *
4
+ * Overlays are full-body UI states shown over the grid's data viewport
5
+ * (below the sticky header). They communicate transient states to the user:
6
+ * data fetching, empty results, errors, and arbitrary custom content.
7
+ */
8
+ /**
9
+ * Supported overlay types shown over the grid body viewport.
10
+ *
11
+ * @api
12
+ */
13
+ export type OverlayType = "loading" | "noRows" | "noMatchingRows" | "error" | "custom";
14
+ /**
15
+ * Ephemeral overlay state — which overlay (if any) is active and its payload.
16
+ *
17
+ * @api
18
+ */
19
+ export interface OverlayState {
20
+ /** Active overlay type, or null when no overlay is shown. */
21
+ type: OverlayType | null;
22
+ /** Optional payload (e.g. error details, or data for a custom overlay). */
23
+ payload?: unknown;
24
+ }
25
+ interface EvaluateAutoOverlayParams<T> {
26
+ /** Whether the grid is currently fetching / loading data. */
27
+ loading: boolean;
28
+ /** The raw data array held by the grid (before pipeline processors). */
29
+ rawData: T[];
30
+ /** The data array after all pipeline processors (sorting, filtering, pagination). */
31
+ processedData: T[];
32
+ }
33
+ /**
34
+ * Evaluates which overlay should be automatically shown based on Data Pipeline state.
35
+ *
36
+ * Priority order:
37
+ * 1. `loading` → `"loading"` (fetch in progress, shown regardless of data)
38
+ * 2. `processedData` empty + `rawData` empty → `"noRows"` (no data at all)
39
+ * 3. `processedData` empty + `rawData` non-empty → `"noMatchingRows"` (filters excluded everything)
40
+ * 4. otherwise → `null` (no overlay)
41
+ *
42
+ * @param params - The current pipeline state.
43
+ * @returns The overlay type to show, or null when no overlay is needed.
44
+ * @internal
45
+ */
46
+ export declare function evaluateAutoOverlay<T>(params: EvaluateAutoOverlayParams<T>): OverlayType | null;
47
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @file Core overlay management types and evaluation logic.
3
+ *
4
+ * Overlays are full-body UI states shown over the grid's data viewport
5
+ * (below the sticky header). They communicate transient states to the user:
6
+ * data fetching, empty results, errors, and arbitrary custom content.
7
+ */
8
+ /**
9
+ * Evaluates which overlay should be automatically shown based on Data Pipeline state.
10
+ *
11
+ * Priority order:
12
+ * 1. `loading` → `"loading"` (fetch in progress, shown regardless of data)
13
+ * 2. `processedData` empty + `rawData` empty → `"noRows"` (no data at all)
14
+ * 3. `processedData` empty + `rawData` non-empty → `"noMatchingRows"` (filters excluded everything)
15
+ * 4. otherwise → `null` (no overlay)
16
+ *
17
+ * @param params - The current pipeline state.
18
+ * @returns The overlay type to show, or null when no overlay is needed.
19
+ * @internal
20
+ */
21
+ export function evaluateAutoOverlay(params) {
22
+ if (params.loading)
23
+ return "loading";
24
+ if (params.processedData.length === 0) {
25
+ return params.rawData.length === 0 ? "noRows" : "noMatchingRows";
26
+ }
27
+ return null;
28
+ }
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { OverlayState, OverlayType } from "./overlays";
1
2
  import type { SlotManager } from "./slots";
2
3
  import type { IconRegistry } from "./icons";
3
4
  export type RowId = string | number;
@@ -52,41 +53,70 @@ export interface CheckboxControl extends CheckboxRenderParams {
52
53
  type: "@omnigrid/checkbox";
53
54
  }
54
55
  interface BaseColumnDef<T> {
56
+ /** Stable identifier used by the grid and plugins. */
55
57
  id: string;
58
+ /** Text displayed in the column header. */
56
59
  header: string;
60
+ /** Pins the column to a horizontal edge of the grid. */
57
61
  pinned?: "left" | "right";
62
+ /** Whether this column may be resized by the resize plugin. */
63
+ resizable?: boolean;
64
+ /** Custom renderer for this column's header. */
58
65
  headerRenderer?: (column: ColumnDef<T>) => unknown;
59
66
  }
60
67
  export interface ColumnLeafDef<T> extends BaseColumnDef<T> {
68
+ /** Row property used as the cell value source. */
61
69
  field?: keyof T | string;
70
+ /** Hides this column without removing it from the column definitions. */
62
71
  hidden?: boolean;
72
+ /** Relative width factor used to distribute available space. */
63
73
  flex?: number;
74
+ /** Fixed column width in pixels. */
64
75
  width?: number;
76
+ /** Minimum column width in pixels. */
65
77
  minWidth?: number;
78
+ /** Maximum column width in pixels. */
66
79
  maxWidth?: number;
80
+ /** Whether this column can be sorted. */
67
81
  sortable?: boolean;
82
+ /** Horizontal alignment of cell content. */
68
83
  align?: CellAlign;
84
+ /** Initial sort direction used by SortingPlugin. */
69
85
  sortState?: SortDirection;
70
86
  /** 1-based sort priority, set only while multiple columns are sorted. */
71
87
  sortIndex?: number;
72
88
  /** Compares values for this column, overriding the sorting plugin default. */
73
89
  comparator?: (left: unknown, right: unknown, column: ColumnLeafDef<T>) => number;
90
+ /** Prevents clicks in this column's cells from triggering row-click behavior. */
74
91
  stopRowClick?: boolean;
92
+ /** Prevents clicks on this column's header from triggering header-click behavior. */
75
93
  stopHeaderClick?: boolean;
94
+ /** Computes the cell value from the row; takes precedence over `field`. */
76
95
  valueGetter?: (row: T) => unknown;
96
+ /** Formats the raw cell value for display. */
77
97
  valueFormatter?: (value: unknown) => string;
98
+ /** Replaces the default cell content with custom content. */
78
99
  cellRenderer?: (params: CellRenderParams<T>) => unknown;
100
+ /** Static inline styles applied to cells in this column. */
79
101
  cellStyle?: RowStyle;
102
+ /** Computes inline styles for each rendered cell. */
80
103
  getCellStyle?: (params: CellRenderParams<T>) => RowStyle | undefined;
104
+ /** Static CSS class applied to cells in this column. */
81
105
  cellClass?: string | ((params: CellRenderParams<T>) => string | undefined);
106
+ /** Computes a CSS class for each rendered cell. */
82
107
  getCellClass?: (params: CellRenderParams<T>) => string | undefined;
108
+ /** Maps CSS class names to predicates evaluated for each rendered cell. */
83
109
  cellClassRules?: CellClassRules<T>;
84
110
  }
85
111
  export interface ColumnGroupDef<T> extends BaseColumnDef<T> {
112
+ /** Child column definitions nested under this group. */
86
113
  children: ColumnDef<T>[];
114
+ /** Allows users to collapse and expand this group. */
87
115
  collapsible?: boolean;
116
+ /** Whether this group starts expanded when it is collapsible. */
88
117
  defaultExpanded?: boolean;
89
118
  }
119
+ /** Leaf or grouped column definition accepted by the grid. */
90
120
  export type ColumnDef<T> = ColumnLeafDef<T> | ColumnGroupDef<T>;
91
121
  export interface GridOptions<T> {
92
122
  data?: T[];
@@ -102,6 +132,21 @@ export interface GridOptions<T> {
102
132
  getRowClass?: (params: RowRenderParams<T>) => string | undefined;
103
133
  rowClassRules?: RowClassRules<T>;
104
134
  plugins?: GridPlugin<T>[];
135
+ /** Whether data is currently being fetched. Triggers an automatic "loading" overlay. @default false */
136
+ loading?: boolean;
137
+ /**
138
+ * Custom overlay content keyed by overlay type. Each function receives an
139
+ * optional payload and the current grid state, and returns headless content
140
+ * (SlotContent) materialized by the adapter — the same protocol used by
141
+ * `cellRenderer` / slot content.
142
+ */
143
+ overlayComponents?: Partial<Record<OverlayType, (payload: unknown, state: GridState<T>) => unknown>>;
144
+ /**
145
+ * Called with the grid API instance when the grid is ready.
146
+ * Use this to programmatically control overlays, sorting, scrolling, etc.
147
+ * @api
148
+ */
149
+ onGridReady?: (grid: GridApi<T>) => void;
105
150
  }
106
151
  export interface ViewportState {
107
152
  width: number;
@@ -200,6 +245,8 @@ export interface GridState<T> {
200
245
  rowHeight: number;
201
246
  rowOverscan: number;
202
247
  columnOverscan: number;
248
+ /** Active overlay state — updated automatically by the grid's overlay manager. */
249
+ overlay: OverlayState;
203
250
  }
204
251
  export interface GridEvents<T> {
205
252
  stateChange: GridState<T>;
@@ -219,6 +266,7 @@ export interface GridEvents<T> {
219
266
  slot: SlotName;
220
267
  mounts: SlotMount<T>[];
221
268
  };
269
+ overlayChange: OverlayState;
222
270
  }
223
271
  /** Opaque token for a row node owned by the adapter. */
224
272
  export type RowHost<T> = object;
@@ -286,10 +334,13 @@ export interface BlockConfig<Name extends string = string> {
286
334
  position?: SlotPosition;
287
335
  priority?: number;
288
336
  }
289
- export type SlotNodeEventName = "click" | "change" | "keydown";
337
+ export type SlotNodeEventName = "click" | "change" | "keydown" | "pointerdown" | "pointermove" | "pointerup" | "dblclick";
290
338
  export interface SlotNodeEvent {
291
339
  value?: string;
292
340
  key?: string;
341
+ clientX?: number;
342
+ clientY?: number;
343
+ button?: number;
293
344
  }
294
345
  /**
295
346
  * Context passed to the slot content provider. Headless: the plugin
@@ -362,6 +413,7 @@ export interface GridApi<T> {
362
413
  getState(): GridState<T>;
363
414
  getScrollPosition(): ScrollPosition;
364
415
  getViewportData(): ViewportData<T>;
416
+ getColumnWidth(columnId: string): number | undefined;
365
417
  getProcessedData(): T[];
366
418
  getRowId(row: T, index: number): RowId;
367
419
  setData(data: T[]): void;
@@ -380,6 +432,33 @@ export interface GridApi<T> {
380
432
  readonly slots: SlotManager<T>;
381
433
  readonly icons: IconRegistry<T>;
382
434
  getSlotMounts(slot: SlotName): SlotMount<T>[];
435
+ /**
436
+ * Shows an overlay of the given type, optionally with a payload.
437
+ *
438
+ * Calling this disables automatic overlay evaluation until `hideOverlay`
439
+ * is called — the manual overlay takes precedence over auto-triggered
440
+ * states (loading, noRows, etc.).
441
+ * @api
442
+ */
443
+ showOverlay(type: OverlayType, payload?: unknown): void;
444
+ /**
445
+ * Hides the current overlay and re-enables automatic overlay evaluation
446
+ * based on the Data Pipeline state.
447
+ * @api
448
+ */
449
+ hideOverlay(): void;
450
+ /**
451
+ * Returns the current overlay state (a copy).
452
+ * @api
453
+ */
454
+ getOverlayState(): OverlayState;
455
+ /**
456
+ * Marks the grid as loading or not — triggers automatic overlay
457
+ * re-evaluation. When `true`, the "loading" overlay is shown regardless
458
+ * of the current data.
459
+ * @api
460
+ */
461
+ setLoading(isLoading: boolean): void;
383
462
  /** Monotonic counter for structural changes (refresh / data / columns). */
384
463
  getRevision(): number;
385
464
  destroy(): void;
@@ -103,7 +103,9 @@ export class Virtualizer {
103
103
  }
104
104
  getColumnWidths(columns, viewportWidth) {
105
105
  const widths = columns.map((column) => this.getBaseColumnWidth(column));
106
- const flexIndexes = columns.map((column, index) => (column.flex && column.flex > 0 ? index : -1)).filter((index) => index >= 0);
106
+ const flexIndexes = columns
107
+ .map((column, index) => (column.flex && column.flex > 0 && column.width === undefined ? index : -1))
108
+ .filter((index) => index >= 0);
107
109
  if (flexIndexes.length === 0)
108
110
  return widths;
109
111
  const fixedWidth = widths.reduce((total, width, index) => (flexIndexes.includes(index) ? total : total + width), 0);
@@ -168,8 +170,12 @@ export class Virtualizer {
168
170
  return widths;
169
171
  }
170
172
  getBaseColumnWidth(column) {
171
- if (column.flex && column.flex > 0)
173
+ if (column.flex && column.flex > 0) {
174
+ if (column.width !== undefined) {
175
+ return Math.min(this.getMaxColumnWidth(column), Math.max(this.getMinColumnWidth(column), column.width));
176
+ }
172
177
  return this.getMinColumnWidth(column);
178
+ }
173
179
  const width = column.width ?? 120;
174
180
  return Math.min(this.getMaxColumnWidth(column), Math.max(this.getMinColumnWidth(column), width));
175
181
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Framework-agnostic core engine for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",