@opencorestack/opengridx 1.0.3 → 1.0.5

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.
@@ -202,6 +202,18 @@ export function DataGrid<R extends GridRowModel = GridRowModel>(props: DataGridP
202
202
  const defaultGetRowId = useCallback((row: R) => row.id, []);
203
203
  const effectiveGetRowId = getRowId || defaultGetRowId;
204
204
 
205
+ // Normalize rows so every row has `id === getRowId(row)`.
206
+ // createInitialState and SET_ROWS both key the internal store by row.id,
207
+ // so rows without a native id field collide on undefined without this.
208
+ // When getRowId is the default (row) => row.id this is a no-op per row.
209
+ const normalizedRows = useMemo(
210
+ () => activeRows.map(row => {
211
+ const id = effectiveGetRowId(row);
212
+ return id === row.id ? row : ({ ...row, id } as R);
213
+ }),
214
+ [activeRows, effectiveGetRowId]
215
+ );
216
+
205
217
  // Keyboard-mode flag: toggled via DOM classname — no React state needed
206
218
  // so the ring appears instantly without a re-render cycle.
207
219
  const setKeyboardMode = useCallback((on: boolean) => {
@@ -226,7 +238,7 @@ export function DataGrid<R extends GridRowModel = GridRowModel>(props: DataGridP
226
238
  }, [treeData]);
227
239
 
228
240
  const gridData = useDataGrid({
229
- rows: activeRows,
241
+ rows: normalizedRows,
230
242
  columns: activeColumns,
231
243
  rowHeight,
232
244
  headerHeight,
@@ -358,9 +370,9 @@ export function DataGrid<R extends GridRowModel = GridRowModel>(props: DataGridP
358
370
 
359
371
  useEffect(() => {
360
372
  if (!dataSource) {
361
- setRows(activeRows);
373
+ setRows(normalizedRows);
362
374
  }
363
- }, [activeRows, setRows, dataSource]);
375
+ }, [normalizedRows, setRows, dataSource]);
364
376
 
365
377
  // ── Detail panel (hoisted — hasDetailPanel feeds into useGridColumns) ──────
366
378
  const hasDetailPanel = Boolean(getDetailPanelContent);
@@ -501,6 +513,19 @@ export function DataGrid<R extends GridRowModel = GridRowModel>(props: DataGridP
501
513
  pageSize: effectivePaginationModel.pageSize,
502
514
  });
503
515
 
516
+ // Merge layout-computed widths (which include flex resolution) with user-resize
517
+ // overrides. The footer and other consumers that receive `columnWidths` only get
518
+ // the resize-override map, which has no entry for flex columns that haven't been
519
+ // manually resized — causing them to fall back to the raw `col.width` prop instead
520
+ // of the actual rendered width.
521
+ const resolvedColumnWidths = useMemo(() => {
522
+ const result: Record<string, number> = {};
523
+ for (const col of [...layout.leftPinnedCols, ...layout.unpinnedColsWithWidth, ...layout.rightPinnedCols]) {
524
+ if (!col.isSpacer) result[col.field] = col.width;
525
+ }
526
+ return { ...result, ...columnWidths };
527
+ }, [layout.leftPinnedCols, layout.unpinnedColsWithWidth, layout.rightPinnedCols, columnWidths]);
528
+
504
529
  useEffect(() => {
505
530
  gridData.apiRef.current.scrollToIndexes = ({ rowIndex, colIndex }) => {
506
531
  const el = viewportRef.current;
@@ -965,7 +990,7 @@ export function DataGrid<R extends GridRowModel = GridRowModel>(props: DataGridP
965
990
  columns={orderedColumns as unknown as GridColDef[]}
966
991
  aggregationModel={aggregationModel}
967
992
  aggregationResult={aggregationResult}
968
- columnWidths={columnWidths}
993
+ columnWidths={resolvedColumnWidths}
969
994
  rowHeight={rowHeight}
970
995
  checkboxSelection={checkboxSelection}
971
996
  hasDetailPanel={hasDetailPanel}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencorestack/opengridx",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "OpenGridX: High-performance React data infrastructure. Unlock advanced Row Grouping, Excel Export, and Column Pinning without the usual \"Pro\" gatekeeping. Built for speed, scale, and complete architectural freedom. Fully open, virtualization-ready, and feature-complete.",
5
5
  "type": "module",
6
6
  "main": "./dist/opengridx.umd.js",