@opencorestack/opengridx 3.6.0 → 3.7.1

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/ai.cjs +3 -3
  3. package/dist/ai.cjs.map +1 -1
  4. package/dist/ai.es.js +3 -3
  5. package/dist/ai.es.js.map +1 -1
  6. package/dist/index.d.ts +30 -0
  7. package/dist/opengridx.css +1 -1
  8. package/dist/opengridx.es.js +8756 -8244
  9. package/dist/opengridx.es.js.map +1 -1
  10. package/dist/opengridx.umd.js +15 -15
  11. package/dist/opengridx.umd.js.map +1 -1
  12. package/docs/API_REFERENCE.md +3 -2
  13. package/docs/architecture/datagrid-orchestration.md +46 -29
  14. package/docs/architecture/grid-row-meta.md +1 -1
  15. package/docs/customization/slots-api.md +1 -1
  16. package/docs/customization/theming.md +43 -0
  17. package/docs/features/virtualization.md +16 -2
  18. package/docs/performance.md +3 -1
  19. package/lib/components/AiAssistant/GridAiAssistantPanel.css +3 -1
  20. package/lib/components/Cell/Cell.css +4 -2
  21. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.css +2 -2
  22. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +3 -1
  23. package/lib/components/DataGrid/DataGrid.css +9 -12
  24. package/lib/components/DataGrid/DataGrid.tsx +163 -671
  25. package/lib/components/DataGrid/GridRoot.tsx +239 -0
  26. package/lib/components/DataGrid/GridViewport.tsx +314 -0
  27. package/lib/components/FilterPanel/FilterPanel.css +9 -8
  28. package/lib/components/Header/ColumnMenu.css +4 -3
  29. package/lib/components/Header/Header.css +5 -4
  30. package/lib/components/HeaderFilter/HeaderFilter.css +1 -1
  31. package/lib/components/ListView/ListView.css +4 -4
  32. package/lib/components/Pagination/Pagination.css +1 -1
  33. package/lib/components/Row/Row.css +2 -2
  34. package/lib/components/Toolbar/GridToolbar.css +8 -7
  35. package/lib/components/Toolbar/PivotPanel.css +3 -3
  36. package/lib/hooks/core/useGridDevWarnings.ts +3 -1
  37. package/lib/hooks/core/useGridEditPipeline.ts +55 -0
  38. package/lib/hooks/core/useGridRangeEditing.ts +129 -0
  39. package/lib/hooks/core/useGridRenderWindow.ts +66 -0
  40. package/lib/hooks/core/useGridScrollViewport.ts +42 -0
  41. package/lib/hooks/core/useGridSelectionAndStateApi.ts +61 -0
  42. package/lib/hooks/core/useGridToolbarStack.ts +49 -0
  43. package/lib/hooks/core/useGridViewApis.ts +46 -0
  44. package/lib/hooks/core/useLayout.ts +34 -24
  45. package/lib/styles/base/reset.css +5 -3
  46. package/lib/styles/base/variables.css +12 -0
  47. package/lib/theme/DataGridThemeProvider.tsx +15 -0
  48. package/lib/theme/__baseline__/default-theme.darwin.chromium.json +1503 -0
  49. package/lib/theme/__baseline__/default-theme.darwin.firefox.json +1503 -0
  50. package/lib/theme/__baseline__/default-theme.darwin.webkit.json +1503 -0
  51. package/lib/theme/types.ts +31 -0
  52. package/lib/types/ai.ts +109 -0
  53. package/lib/types/api.ts +169 -0
  54. package/lib/types/columns.ts +341 -0
  55. package/lib/types/dataSource.ts +40 -0
  56. package/lib/types/editing.ts +77 -0
  57. package/lib/types/export.ts +164 -0
  58. package/lib/types/filtering.ts +52 -0
  59. package/lib/types/grouping.ts +27 -0
  60. package/lib/types/index.ts +18 -1702
  61. package/lib/types/locale.ts +51 -0
  62. package/lib/types/props.ts +405 -0
  63. package/lib/types/rows.ts +132 -0
  64. package/lib/types/selection.ts +66 -0
  65. package/lib/types/slots.ts +56 -0
  66. package/lib/types/sorting.ts +25 -0
  67. package/lib/types/state.ts +35 -0
  68. package/lib/utils/export/exportShared.ts +22 -4
  69. package/lib/utils/export/index.ts +8 -4
  70. package/lib/utils/filtering/index.ts +8 -2
  71. package/lib/utils/parsing.ts +24 -1
  72. package/lib/utils/values.ts +31 -0
  73. package/llms.txt +1 -1
  74. package/package.json +4 -2
@@ -245,7 +245,9 @@ export function useLayout<R extends GridRowModel>(params: UseLayoutParams<R>): L
245
245
  getRowId = defaultGetRowId,
246
246
  } = params;
247
247
 
248
- return useMemo<LayoutResult<R>>(() => {
248
+ // Rows and columns are measured in separate memos: a column resize must not walk every row
249
+ // (1M rows), and a sort or filter must not recompute column widths.
250
+ const rowLayout = useMemo(() => {
249
251
  const unpinnedRows = pagination ? paginatedUnpinnedRows : sortedUnpinnedRows;
250
252
 
251
253
  const heightOf = (row: R, rowIndex: number) => {
@@ -279,6 +281,35 @@ export function useLayout<R extends GridRowModel>(params: UseLayoutParams<R>): L
279
281
  const pinnedTopHeight = pinnedBlockHeight(pinnedTopRows, pinnedTopRowsLength);
280
282
  const pinnedBottomHeight = pinnedBlockHeight(pinnedBottomRows, pinnedBottomRowsLength);
281
283
 
284
+ return {
285
+ rowHeights,
286
+ cumulativeHeights,
287
+ unpinnedRowsHeight,
288
+ pinnedTopHeight,
289
+ pinnedBottomHeight,
290
+ pinnedTopRowsLength,
291
+ pinnedBottomRowsLength,
292
+ unpinnedRowsLength: rowCount,
293
+ };
294
+ }, [
295
+ rowHeight,
296
+ pagination,
297
+ paginatedUnpinnedRows,
298
+ sortedUnpinnedRows,
299
+ expandedRowIds,
300
+ getDetailPanelHeight,
301
+ detailPanelHeights,
302
+ pinnedTopRowsLength,
303
+ pinnedBottomRowsLength,
304
+ pinnedTopRows,
305
+ pinnedBottomRows,
306
+ paginationMode,
307
+ isLoading,
308
+ pageSize,
309
+ getRowId,
310
+ ]);
311
+
312
+ const columnLayout = useMemo(() => {
282
313
  // Pinned columns render in pinnedColumns.left / .right order; unpinned ones in column order.
283
314
  const { left: rawLeftPinnedCols, center: unpinnedCols, right: rawRightPinnedCols } =
284
315
  getPinnedColumnGroups(visibleOrderedColumns, pinnedColumns);
@@ -326,11 +357,6 @@ export function useLayout<R extends GridRowModel>(params: UseLayoutParams<R>): L
326
357
  }, [] as number[]);
327
358
 
328
359
  return {
329
- rowHeights,
330
- cumulativeHeights,
331
- unpinnedRowsHeight,
332
- pinnedTopHeight,
333
- pinnedBottomHeight,
334
360
  leftPinnedCols,
335
361
  rightPinnedCols,
336
362
  unpinnedColsWithWidth,
@@ -342,22 +368,8 @@ export function useLayout<R extends GridRowModel>(params: UseLayoutParams<R>): L
342
368
  unpinnedTotalWidth,
343
369
  systemColumnsWidth,
344
370
  pinnedSystemColumnsWidth,
345
- pinnedTopRowsLength,
346
- pinnedBottomRowsLength,
347
- unpinnedRowsLength: unpinnedRows.length,
348
371
  };
349
372
  }, [
350
- rowHeight,
351
- pagination,
352
- paginatedUnpinnedRows,
353
- sortedUnpinnedRows,
354
- expandedRowIds,
355
- getDetailPanelHeight,
356
- detailPanelHeights,
357
- pinnedTopRowsLength,
358
- pinnedBottomRowsLength,
359
- pinnedTopRows,
360
- pinnedBottomRows,
361
373
  visibleOrderedColumns,
362
374
  pinnedColumns,
363
375
  columnWidths,
@@ -367,9 +379,7 @@ export function useLayout<R extends GridRowModel>(params: UseLayoutParams<R>): L
367
379
  rowReordering,
368
380
  pinCheckboxColumn,
369
381
  pinExpandColumn,
370
- paginationMode,
371
- isLoading,
372
- pageSize,
373
- getRowId,
374
382
  ]);
383
+
384
+ return useMemo<LayoutResult<R>>(() => ({ ...rowLayout, ...columnLayout }), [rowLayout, columnLayout]);
375
385
  }
@@ -1,6 +1,8 @@
1
- *,
2
- *::before,
3
- *::after {
1
+ /* Only the grid's own elements, including its portalled menus and panels (all carry an ogx class).
2
+ :where() keeps the specificity at zero, so a consumer's own box-sizing rule still wins. */
3
+ :where([class*="ogx"], [class*="ogx"] *),
4
+ :where([class*="ogx"], [class*="ogx"] *)::before,
5
+ :where([class*="ogx"], [class*="ogx"] *)::after {
4
6
  box-sizing: border-box;
5
7
  }
6
8
  .ogx--dragging {
@@ -81,6 +81,18 @@
81
81
  --ogx-grid-cell-font-size: 13px;
82
82
  --ogx-grid-header-font-size: 13px;
83
83
  --ogx-grid-line-height: var(--ogx-line-height-normal);
84
+ /* Outer border and divider widths (v3.7). 0 hides a divider. Their colours,
85
+ --ogx-grid-column-divider-color and --ogx-grid-row-divider-color, are unset here and fall back
86
+ to --ogx-grid-border-color where they are used. So do the other theme-builder variables:
87
+ --ogx-grid-border-radius (--ogx-border-radius-lg), --ogx-grid-header-padding-x
88
+ (--ogx-grid-cell-padding-x), --ogx-grid-header-font-family / -font-weight and
89
+ --ogx-grid-cell-font-family / -font-weight (inherited; header weight 600), and
90
+ --ogx-overlay-font-family / -font-weight / -font-size (the grid font, each item's own weight,
91
+ --ogx-font-size-xs for menu and panel items). */
92
+ --ogx-grid-border-width: 1px;
93
+ --ogx-grid-column-divider-width: 1px;
94
+ --ogx-grid-header-column-divider-width: 1px;
95
+ --ogx-grid-row-divider-width: 1px;
84
96
  --ogx-grid-background: var(--ogx-color-white);
85
97
  --ogx-grid-border-color: var(--ogx-color-gray-200);
86
98
  --ogx-grid-header-background: var(--ogx-color-gray-50);
@@ -272,6 +272,18 @@ function themeToCSS(theme: GridTheme): Record<string, string> {
272
272
  set('--ogx-grid-cell-padding-y', g.cellPaddingY);
273
273
  set('--ogx-grid-cell-font-size', g.cellFontSize);
274
274
  set('--ogx-grid-header-font-size', g.headerFontSize);
275
+ set('--ogx-grid-header-font-family', g.headerFontFamily);
276
+ set('--ogx-grid-header-font-weight', g.headerFontWeight);
277
+ set('--ogx-grid-cell-font-family', g.cellFontFamily);
278
+ set('--ogx-grid-cell-font-weight', g.cellFontWeight);
279
+ set('--ogx-grid-header-padding-x', g.headerPaddingX);
280
+ set('--ogx-grid-border-width', g.borderWidth);
281
+ set('--ogx-grid-border-radius', g.borderRadius);
282
+ set('--ogx-grid-column-divider-width', g.columnDividerWidth);
283
+ set('--ogx-grid-header-column-divider-width', g.headerColumnDividerWidth);
284
+ set('--ogx-grid-row-divider-width', g.rowDividerWidth);
285
+ set('--ogx-grid-column-divider-color', g.columnDividerColor);
286
+ set('--ogx-grid-row-divider-color', g.rowDividerColor);
275
287
  set('--ogx-grid-background', g.background);
276
288
  set('--ogx-grid-border-color', g.borderColor);
277
289
  set('--ogx-grid-header-background', g.headerBackground);
@@ -338,6 +350,9 @@ function themeToCSS(theme: GridTheme): Record<string, string> {
338
350
  set('--ogx-overlay-item-selected-text', o.itemSelectedText);
339
351
  set('--ogx-overlay-item-danger-bg', o.itemDangerBackground);
340
352
  set('--ogx-overlay-item-danger-text', o.itemDangerText);
353
+ set('--ogx-overlay-font-family', o.fontFamily);
354
+ set('--ogx-overlay-font-weight', o.fontWeight);
355
+ set('--ogx-overlay-font-size', o.fontSize);
341
356
  }
342
357
 
343
358
  if (theme.scrollbar) {