@opencorestack/opengridx 3.0.0 → 3.1.0

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 (42) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +10 -6
  3. package/dist/index.d.ts +51 -8
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +4056 -3957
  6. package/dist/opengridx.es.js.map +1 -1
  7. package/dist/opengridx.umd.js +14 -14
  8. package/dist/opengridx.umd.js.map +1 -1
  9. package/docs/API_REFERENCE.md +15 -8
  10. package/docs/architecture/datagrid-orchestration.md +1 -0
  11. package/docs/components/column-resize.md +14 -2
  12. package/docs/components/datagrid.md +1 -1
  13. package/docs/customization/theming.md +1 -1
  14. package/docs/features/list-view.md +1 -1
  15. package/docs/features/pdf-export.md +16 -0
  16. package/docs/features/pinning.md +1 -0
  17. package/docs/features/sorting-pagination.md +26 -0
  18. package/docs/features/virtualization.md +11 -9
  19. package/docs/migration/v2-to-v3.md +13 -2
  20. package/docs/roadmap.md +1 -1
  21. package/lib/components/Cell/Cell.css +4 -0
  22. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.css +5 -3
  23. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.tsx +12 -3
  24. package/lib/components/DataGrid/DataGrid.css +8 -0
  25. package/lib/components/DataGrid/DataGrid.tsx +9 -2
  26. package/lib/components/DataGrid/GridListView.tsx +2 -1
  27. package/lib/components/Header/Header.css +3 -0
  28. package/lib/components/Header/Header.tsx +7 -1
  29. package/lib/hooks/core/gridApiPlaceholder.ts +4 -2
  30. package/lib/hooks/core/useGridApiRef.ts +7 -4
  31. package/lib/hooks/core/useGridColumnAutosize.ts +52 -0
  32. package/lib/hooks/core/useGridDevWarnings.ts +23 -5
  33. package/lib/hooks/core/useGridRowPipeline.ts +2 -2
  34. package/lib/hooks/useRowGrouping.ts +20 -3
  35. package/lib/hooks/useTreeData.ts +8 -1
  36. package/lib/index.ts +1 -0
  37. package/lib/types/index.ts +46 -7
  38. package/lib/utils/columnAutosize.ts +56 -0
  39. package/lib/utils/pivot/index.ts +11 -2
  40. package/lib/utils/sorting/index.ts +77 -24
  41. package/llms.txt +12 -7
  42. package/package.json +1 -1
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # OpenGridX — AI Agent Context
2
2
  # Package: @opencorestack/opengridx
3
- # Version: 3.0.0
3
+ # Version: 3.1.0
4
4
  # Docs: https://opencorestack.github.io/OpenGridX/
5
5
  # This file is machine-readable. AI developers: start here.
6
6
 
@@ -71,7 +71,7 @@ export default function App() {
71
71
  ### Display
72
72
  | Prop | Type | Default | Description |
73
73
  |-------------------|-----------|---------|----------------------------------------|
74
- | height | number/string | — | Grid height. No default. The grid must have a BOUNDED height or it renders every row (see GOTCHAS) |
74
+ | height | number/string | — | Grid height. No default: fills its container (class ogx--fill, 3.0.1+); the container must have a BOUNDED height or it renders every row (see GOTCHAS) |
75
75
  | autoHeight | boolean | false | Fit height to rows (renders every row) |
76
76
  | overscanRowCount | number | 3 | Minimum rows rendered outside the viewport (raised automatically while scrolling fast) |
77
77
  | ariaLabel | string | — | Accessible name for the grid |
@@ -211,12 +211,12 @@ There are no getRowClassName / getCellClassName / theme props: use GridColDef.ce
211
211
  | Prop | Type | Description |
212
212
  |--------------|------------------|----------------------------------------------|
213
213
  | initialState | GridInitialState | Starting sorting, filter, pagination, columns (widths, order, pinning, visibility) and density. Read at mount only |
214
- | apiRef | MutableRefObject<GridApi> | Imperative API handle from useGridApiRef() |
214
+ | apiRef | MutableRefObject<GridApi<R>> or MutableRefObject<GridApi> | Imperative API handle from useGridApiRef<R>() (typed row getters) or useGridApiRef() |
215
215
 
216
216
  ### List View
217
217
  | Prop | Type | Description |
218
218
  |----------------|--------------------|---------------------------------------------|
219
- | listView | boolean | Render as cards instead of a table (requires listViewColumn; without it the grid view shows + dev warning). Honours loading, noRowsOverlay/loadingOverlay and slots.footer; rows are a roving Tab stop (arrows, Home/End, PageUp/Down, Enter/Space, Alt+Arrow expand); tree/group parents get a chevron. Not virtualized |
219
+ | listView | boolean | Render as cards instead of a table (requires listViewColumn; without it the grid view shows + dev warning). Honours loading, noRowsOverlay/loadingOverlay and slots.footer; rows are a roving Tab stop (arrows, Home/End, PageUp/Down, Enter/Space, Alt+Arrow expand); tree/group parents get a chevron. Not virtualized (dev warning above 2,000 items; paginate) |
220
220
  | listViewColumn | { field, renderCell } | Defines the card renderer |
221
221
 
222
222
  ---
@@ -248,8 +248,9 @@ There are no getRowClassName / getCellClassName / theme props: use GridColDef.ce
248
248
  | align | 'left'/'center'/'right' | Cell content alignment |
249
249
  | headerAlign | 'left'/'center'/'right' | Header content alignment |
250
250
  | sortable | boolean (default true) | Enable sorting |
251
+ | sortComparator | (v1, v2, params1, params2) => number | Custom ascending comparator (3.1.0+). v1/v2 are valueGetter values incl. null/undefined; params { id, field, row, value }. Negated for desc; multi-sort tie-break chain; groups by grouping value; tree siblings; pivot row labels. Throw/NaN = 0. Ignored in server sortingMode |
251
252
  | filterable | boolean (default true) | Enable filtering and quick search |
252
- | resizable | boolean (default true) | Enable resize handle (mouse, touch, Alt+Arrow on header) |
253
+ | resizable | boolean (default true) | Enable resize handle (mouse, touch, Alt+Arrow on header); double-click or Enter on the handle auto-sizes to content (3.1.0+) |
253
254
  | hideable | boolean (default true) | Allow hiding via toolbar / column menu |
254
255
  | pinnable | boolean (default true) | Allow pinning via column menu (does not affect drag-reorder) |
255
256
  | exportable | boolean (default true) | Include in CSV/Excel/JSON/Print/PDF exports and clipboard copy |
@@ -269,7 +270,7 @@ const apiRef = useGridApiRef();
269
270
  <DataGrid apiRef={apiRef} rows={rows} columns={columns} />
270
271
 
271
272
  // Row access
272
- apiRef.current.getRow(id) // → GridRowModel | null
273
+ apiRef.current.getRow(id) // → R | null with useGridApiRef<R>(), else GridRowModel | null
273
274
  apiRef.current.getAllRows() // → every loaded row
274
275
  apiRef.current.getVisibleRows() // → rows on screen: current page + pinned rows
275
276
  apiRef.current.getAllFilteredRows() // → every filtered + sorted row, all pages (use for exports); tree data + filter: matching rows only
@@ -298,6 +299,10 @@ apiRef.current.setPageSize(size)
298
299
  // Scroll
299
300
  apiRef.current.scrollToIndexes({ rowIndex, colIndex })
300
301
 
302
+ // Auto-size to header + rendered cells, clamped to minWidth/maxWidth (3.1.0+)
303
+ apiRef.current.autosizeColumn(field)
304
+ apiRef.current.autosizeColumns(fields?)
305
+
301
306
  // Clipboard
302
307
  apiRef.current.copySelectedRows() // → Promise<void>; rejects if the write fails. Copies every selected row that passes
303
308
  // the filter (all pages, collapsed groups, pinned rows), visible columns in screen order
@@ -599,7 +604,7 @@ Arrows move between cells (skipping hidden columns); Home/End, Ctrl+Home/End, Pa
599
604
  8. **`initialState.columns.columnWidths`**: accepts `Record<string, number>` to restore saved column widths. Every part of `initialState` is optional.
600
605
  9. **`pinnedColumns`** and **`columnWidths`** are independent state — pinning does not reset widths.
601
606
  10. **Aggregation**: setting `aggregationModel` alone renders a sticky footer with the totals; with `rowGroupingModel` each group row also shows its own aggregates. `null`/`undefined`, blank strings, booleans and arrays are ignored by sum/avg/min/max; min/max of dates return a `Date`; `valueGetter` columns aggregate the computed value; footer totals go through the column's `valueFormatter` (not for count/unique).
602
- 11. **GOTCHAS — bounded height**: virtualization only works if the grid's container has a bounded height. A flex child without `min-height: 0` grows to fit every row, so every row is rendered. Pagination hides this, and row grouping turns pagination off. Use `<div style={{ flex: 1, minHeight: 0 }}>` around `height="100%"`, or pass a fixed pixel `height`. Dev builds log a warning when this happens.
607
+ 11. **GOTCHAS — bounded height**: virtualization only works if the grid's container has a bounded height. A flex child without `min-height: 0` grows to fit every row, so every row is rendered. Pagination hides this, and row grouping turns pagination off. Without a `height` prop the grid fills its container (3.0.1+), so use `<div style={{ flex: 1, minHeight: 0 }}>` around the grid, or pass a fixed pixel `height`. The list view never virtualizes: paginate it. Dev builds log a warning when this happens.
603
608
  12. **Pagination is ignored under row grouping** — a grouped grid is one scrollable, virtualized list.
604
609
  13. **`valueFormatter` + `renderCell`**: `renderCell` receives `params.formattedValue` (v2.1+), so a custom renderer can reuse the formatter instead of duplicating it.
605
610
  14. **`slots.footer`** replaces the pagination area and receives `apiRef`, `aggregationModel`, `aggregationResult`, `rowCount` (filtered data rows excluding pinned rows in flat grids — data rows under tree data / grouping; the server total with `paginationMode="server"`), `pagination`, `paginationModel`, `pageSizeOptions` and `onPaginationModelChange`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencorestack/opengridx",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
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",