@opencorestack/opengridx 0.1.5 → 0.1.7

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 (130) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +9 -0
  3. package/dist/index.d.ts +6 -0
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +319 -319
  6. package/dist/opengridx.es.js.map +1 -1
  7. package/dist/opengridx.umd.js +7 -7
  8. package/dist/opengridx.umd.js.map +1 -1
  9. package/docs/API_REFERENCE.md +177 -0
  10. package/docs/README.md +60 -0
  11. package/docs/components/cell.md +44 -0
  12. package/docs/components/column-group-header.md +57 -0
  13. package/docs/components/column-resize.md +63 -0
  14. package/docs/components/column-visibility.md +61 -0
  15. package/docs/components/datagrid.md +70 -0
  16. package/docs/components/filter-panel.md +26 -0
  17. package/docs/components/header.md +39 -0
  18. package/docs/components/pagination.md +34 -0
  19. package/docs/components/row.md +31 -0
  20. package/docs/components/toolbar.md +40 -0
  21. package/docs/components/tooltip.md +68 -0
  22. package/docs/customization/slots-api.md +227 -0
  23. package/docs/customization/theming.md +293 -0
  24. package/docs/features/aggregation-pivot.md +79 -0
  25. package/docs/features/cell-spanning.md +520 -0
  26. package/docs/features/clipboard.md +76 -0
  27. package/docs/features/custom-pagination.md +143 -0
  28. package/docs/features/data-source.md +72 -0
  29. package/docs/features/editing-reordering.md +99 -0
  30. package/docs/features/export-guide.md +434 -0
  31. package/docs/features/filtering.md +83 -0
  32. package/docs/features/infinite-scroll.md +87 -0
  33. package/docs/features/list-view.md +65 -0
  34. package/docs/features/loading-states.md +68 -0
  35. package/docs/features/master-detail.md +46 -0
  36. package/docs/features/pinning.md +67 -0
  37. package/docs/features/selection.md +70 -0
  38. package/docs/features/sorting-pagination.md +66 -0
  39. package/docs/features/state-persistence.md +67 -0
  40. package/docs/features/tree-data-grouping.md +67 -0
  41. package/docs/features/virtualization.md +188 -0
  42. package/docs/roadmap.md +71 -0
  43. package/lib/components/Cell/Cell.css +119 -0
  44. package/lib/components/Cell/Cell.tsx +264 -0
  45. package/lib/components/Cell/GridEditInputCell.css +62 -0
  46. package/lib/components/Cell/GridEditInputCell.tsx +152 -0
  47. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.css +67 -0
  48. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.tsx +220 -0
  49. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.css +31 -0
  50. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.tsx +85 -0
  51. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +137 -0
  52. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.tsx +190 -0
  53. package/lib/components/DataGrid/DataGrid.css +224 -0
  54. package/lib/components/DataGrid/DataGrid.tsx +2253 -0
  55. package/lib/components/DetailPanel/DetailPanel.css +36 -0
  56. package/lib/components/DetailPanel/DetailPanel.tsx +34 -0
  57. package/lib/components/FilterPanel/FilterPanel.css +196 -0
  58. package/lib/components/FilterPanel/FilterPanel.tsx +183 -0
  59. package/lib/components/FilterPanel/index.ts +1 -0
  60. package/lib/components/Header/ColumnMenu.css +68 -0
  61. package/lib/components/Header/ColumnMenu.tsx +249 -0
  62. package/lib/components/Header/Header.css +224 -0
  63. package/lib/components/Header/Header.tsx +516 -0
  64. package/lib/components/ListView/ListView.css +112 -0
  65. package/lib/components/ListView/ListViewRow.tsx +63 -0
  66. package/lib/components/Pagination/Pagination.css +91 -0
  67. package/lib/components/Pagination/Pagination.tsx +151 -0
  68. package/lib/components/QuickFilter/QuickFilter.css +23 -0
  69. package/lib/components/QuickFilter/QuickFilter.tsx +79 -0
  70. package/lib/components/Row/Row.css +126 -0
  71. package/lib/components/Row/Row.tsx +377 -0
  72. package/lib/components/Skeleton/Skeleton.css +55 -0
  73. package/lib/components/Skeleton/Skeleton.tsx +22 -0
  74. package/lib/components/SkeletonRow/SkeletonRow.css +32 -0
  75. package/lib/components/SkeletonRow/SkeletonRow.tsx +89 -0
  76. package/lib/components/SkeletonRow/index.ts +1 -0
  77. package/lib/components/Toolbar/GlobalSearch.css +113 -0
  78. package/lib/components/Toolbar/GlobalSearch.tsx +120 -0
  79. package/lib/components/Toolbar/GridToolbar.css +204 -0
  80. package/lib/components/Toolbar/GridToolbar.tsx +647 -0
  81. package/lib/components/Toolbar/PivotPanel.css +212 -0
  82. package/lib/components/Toolbar/PivotPanel.tsx +239 -0
  83. package/lib/components/Tooltip/Tooltip.css +59 -0
  84. package/lib/components/Tooltip/Tooltip.tsx +106 -0
  85. package/lib/components/ui/Button.css +89 -0
  86. package/lib/components/ui/Button.tsx +39 -0
  87. package/lib/components/ui/Checkbox.css +71 -0
  88. package/lib/components/ui/Checkbox.tsx +66 -0
  89. package/lib/components/ui/DragHandleIcon.css +19 -0
  90. package/lib/components/ui/DragHandleIcon.tsx +18 -0
  91. package/lib/components/ui/ExpandIcon.css +38 -0
  92. package/lib/components/ui/ExpandIcon.tsx +75 -0
  93. package/lib/components/ui/Input.css +59 -0
  94. package/lib/components/ui/Input.tsx +45 -0
  95. package/lib/components/ui/index.ts +15 -0
  96. package/lib/hooks/core/useDataGrid.ts +392 -0
  97. package/lib/hooks/core/useGridApiRef.ts +10 -0
  98. package/lib/hooks/features/useAggregation.ts +143 -0
  99. package/lib/hooks/features/useGridClipboard.ts +133 -0
  100. package/lib/hooks/features/useGridDataSource.ts +190 -0
  101. package/lib/hooks/features/useGridEditing.ts +100 -0
  102. package/lib/hooks/features/useGridSpanning.ts +349 -0
  103. package/lib/hooks/features/usePivot.ts +149 -0
  104. package/lib/hooks/useColumnReorder.ts +114 -0
  105. package/lib/hooks/useRowGrouping.ts +302 -0
  106. package/lib/hooks/useRowReorder.ts +83 -0
  107. package/lib/hooks/useTreeData.ts +323 -0
  108. package/lib/index.ts +106 -0
  109. package/lib/state/index.ts +17 -0
  110. package/lib/state/types.ts +48 -0
  111. package/lib/state/useGridStateStorage.ts +113 -0
  112. package/lib/styles/base/reset.css +21 -0
  113. package/lib/styles/base/variables.css +161 -0
  114. package/lib/styles/opengridx.css +27 -0
  115. package/lib/styles/opengridx.css.d.ts +4 -0
  116. package/lib/theme/DataGridThemeProvider.tsx +276 -0
  117. package/lib/theme/defaultStyles.ts +0 -0
  118. package/lib/theme/index.ts +21 -0
  119. package/lib/theme/presets.ts +148 -0
  120. package/lib/theme/types.ts +155 -0
  121. package/lib/types/index.ts +764 -0
  122. package/lib/utils/export/exportToExcelAdvanced.ts +516 -0
  123. package/lib/utils/export/index.ts +550 -0
  124. package/lib/utils/filtering/index.ts +240 -0
  125. package/lib/utils/pinning/index.ts +282 -0
  126. package/lib/utils/sorting/index.ts +55 -0
  127. package/lib/utils/virtualization/index.ts +106 -0
  128. package/lib/vite-env.d.ts +1 -0
  129. package/llms.txt +12 -2
  130. package/package.json +13 -4
@@ -0,0 +1,177 @@
1
+ # 📖 OpenGridX API Reference
2
+
3
+ This document provides a comprehensive reference for all exported types, interfaces, and utility functions in the OpenGridX library.
4
+
5
+ ---
6
+
7
+ ## 🏗️ Core Components
8
+
9
+ ### `<DataGrid />`
10
+ The main component for displaying and interacting with data.
11
+
12
+ #### Props
13
+ | Prop | Type | Default | Description |
14
+ | :--- | :--- | :--- | :--- |
15
+ | `rows` | `GridRowModel[]` | `[]` | Array of data objects. |
16
+ | `columns` | `GridColDef[]` | `[]` | Definitions for the columns. |
17
+ | `getRowId` | `(row: GridRowModel) => GridRowId` | `row.id` | Returns a unique identifier for each row. |
18
+ | `rowHeight` | `number` | `52` | Height of each row in pixels. |
19
+ | `headerHeight` | `number` | `56` | Height of the header row. |
20
+ | `autoHeight` | `boolean` | `false` | Adjust grid height to match row total. |
21
+ | `loading` | `boolean` | `false` | Shows a loading skeleton overlay. |
22
+ | `checkboxSelection` | `boolean` | `false` | Enable row selection via checkboxes. |
23
+ | `pagination` | `boolean` | `false` | Enable the bottom pagination bar. |
24
+ | `paginationMode` | `'client' \| 'server' \| 'infinite'` | `'client'` | How to handle paging. |
25
+ | `paginationModel` | `GridPaginationModel` | `{page:0, pageSize:25}` | Current page and page size. |
26
+ | `rowCount` | `number` | — | Total rows (required for server-side paging). |
27
+ | `initialState` | `GridInitialState` | `undefined` | Starting state for sorting, filters, etc. |
28
+ | `slots` | `GridSlots` | `{}` | Custom component overrides. |
29
+ | `slotProps` | `Record<string, any>` | `{}` | Props passed to custom slots. |
30
+ | `filterModel` | `GridFilterModel` | `undefined` | Active filters. |
31
+ | `sortModel` | `GridSortItem[]` | `undefined` | Active sorting. |
32
+ | `onRowClick` | `(params: GridRowParams) => void` | — | Fired when a row is clicked. |
33
+ | `onCellClick` | `(params: GridCellParams) => void` | — | Fired when a cell is clicked. |
34
+ | `onStateChange` | `(state: GridState) => void` | — | Fired on any internal state update. |
35
+ | `processRowUpdate` | `(new, old) => R \| Promise<R>` | — | Fired after a cell edit is committed. |
36
+ | `dataSource` | `GridDataSource` | — | Remote data provider interface. |
37
+
38
+ ---
39
+
40
+ ## 🕹️ Imperative API (`GridApi`)
41
+
42
+ Access these methods via the `apiRef` prop.
43
+
44
+ | Method | Return | Description |
45
+ | :--- | :--- | :--- |
46
+ | `getRow(id)` | `GridRowModel \| null` | Get row data by ID. |
47
+ | `getAllRows()` | `GridRowModel[]` | Get all loaded rows. |
48
+ | `getVisibleRows()` | `GridRowModel[]` | Get rows after filtering/sorting. |
49
+ | `getColumn(field)` | `GridColDef \| null` | Get column definition by field. |
50
+ | `getVisibleColumns()` | `GridColDef[]` | Get currently visible columns. |
51
+ | `selectRow(id, isSelected)` | `void` | Set selection for a single row. |
52
+ | `selectRows(ids, isSelected)`| `void` | Set selection for multiple rows. |
53
+ | `getSelectedRows()` | `GridRowId[]` | Get IDs of all selected rows. |
54
+ | `sortColumn(field, dir)` | `void` | Programmatically sort a column. |
55
+ | `getSortModel()` | `GridSortItem[]` | Get active sorting state. |
56
+ | `setFilterModel(model)` | `void` | Programmatically set filters. |
57
+ | `setPage(page)` | `void` | Change current page (0-indexed). |
58
+ | `scrollToIndexes(params)` | `void` | Scroll to specific row/column index. |
59
+
60
+ ---
61
+
62
+ ## 🌳 Internal Data Structures
63
+
64
+ ### `GridTreeNode`
65
+ Used in Tree Data and Row Grouping hierarchies.
66
+
67
+ | Property | Type | Description |
68
+ | :--- | :--- | :--- |
69
+ | `id` | `GridRowId` | Unique ID of the row. |
70
+ | `parentId` | `GridRowId \| null` | ID of the parent node. |
71
+ | `depth` | `number` | Nesting level (0 for root). |
72
+ | `isExpanded` | `boolean` | Current expansion state. |
73
+ | `children` | `GridRowId[]` | IDs of child nodes. |
74
+ | `groupingValue` | `any` | The value this node is grouping by. |
75
+ | `aggregatedValues` | `object` | Sums/Avgs computed for this group. |
76
+
77
+ ---
78
+
79
+ ## 📑 Column Definitions
80
+
81
+ ### `GridColDef`
82
+ Defines the behavior and appearance of a single column.
83
+
84
+ | Property | Type | Default | Description |
85
+ | :--- | :--- | :--- | :--- |
86
+ | `field` | `string` | — | Unique identifier (matches row property). |
87
+ | `headerName` | `string` | — | Text displayed in the header. |
88
+ | `width` | `number` | `100` | Width in pixels. |
89
+ | `type` | `'string' \| 'number' \| 'date' \| 'dateTime' \| 'boolean'` | `'string'` | Data type for formatting and filtering. |
90
+ | `sortable` | `boolean` | `true` | Enable sorting for this column. |
91
+ | `filterable` | `boolean` | `true` | Enable filtering for this column. |
92
+ | `resizable` | `boolean` | `true` | Allow user to drag resize. |
93
+ | `hideable` | `boolean` | `true` | Allow user to hide the column. |
94
+ | `pinned` | `'left' \| 'right' \| null` | `null` | Sticky positioning. |
95
+ | `exportable` | `boolean` | `true` | If `false`, column is excluded from all exports. |
96
+ | `valueFormatter` | `(params: GridValueFormatterParams) => string` | — | Format value for display. |
97
+ | `valueGetter` | `(params: GridValueGetterParams) => any` | — | Compute value from row data. |
98
+ | `renderCell` | `(params: GridRenderCellParams) => ReactNode` | — | Custom cell renderer. |
99
+
100
+ ---
101
+
102
+ ## 📂 Export Utilities
103
+
104
+ | Function | Return | Description |
105
+ | :--- | :--- | :--- |
106
+ | `exportToCsv(rows, cols, options?)` | `void` | Triggers download of CSV file. |
107
+ | `exportToJson(rows, cols, options?)` | `void` | Triggers download of JSON file. |
108
+ | `exportToExcel(rows, cols, options?)` | `void` | Basic `.xls` export (zero-dep). |
109
+ | `exportToExcelAdvanced(rows, cols, options?)` | `Promise<void>` | Real `.xlsx` export (styled, multi-sheet, lazy-loaded). |
110
+ | `printGrid(rows, cols, title \| options)` | `void` | Opens browser print dialog. |
111
+
112
+ ---
113
+
114
+ ## 🎨 Theming & Styling
115
+
116
+ ### `DataGridThemeProvider`
117
+ Context provider for overriding the grid's visual system.
118
+
119
+ #### `GridTheme` Object
120
+ - **Colors**: `primary`, `secondary`, `header`, `border`, `rowHover`, `rowSelected`.
121
+ - **Typography**: `fontFamily`, `fontSize`, `fontWeight`.
122
+ - **Spacing**: `cellPadding`, `headerHeight`, `rowHeight`.
123
+
124
+ ---
125
+
126
+ ## 🛠️ Hooks
127
+
128
+ ### `useGridApiRef()`
129
+ Returns a ref to interact with the grid programmatically.
130
+ - `state`: Access full internal state.
131
+ - `getVisibleRows()`: Returns filtered/sorted rows.
132
+ - `getVisibleColumns()`: Returns currently visible columns.
133
+
134
+ ### `useAggregation(params)`
135
+ Compute summary values for datasets.
136
+ - **Built-in Functions**: `sum`, `avg`, `min`, `max`, `count`, `unique`.
137
+
138
+ ### `useGridStateStorage(options)`
139
+ Persist and restore grid configurations to LocalStorage or a backend.
140
+
141
+ ---
142
+
143
+ ## ⚙️ Interfaces & Types
144
+
145
+ ### `GridSortItem`
146
+ ```typescript
147
+ interface GridSortItem {
148
+ field: string;
149
+ sort: 'asc' | 'desc';
150
+ }
151
+ ```
152
+
153
+ ### `GridFilterModel`
154
+ ```typescript
155
+ interface GridFilterModel {
156
+ items: GridFilterItem[];
157
+ logicOperator?: 'and' | 'or';
158
+ quickFilterValues?: string[];
159
+ }
160
+ ```
161
+
162
+ ### `GridPaginationModel`
163
+ ```typescript
164
+ interface GridPaginationModel {
165
+ page: number;
166
+ pageSize: number;
167
+ }
168
+ ```
169
+
170
+ ### `GridPivotModel`
171
+ ```typescript
172
+ interface GridPivotModel {
173
+ rowFields: string[];
174
+ columnFields: string[];
175
+ valueFields: { field: string; aggFn: string; headerName?: string }[];
176
+ }
177
+ ```
package/docs/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # 📚 OpenGridX Documentation
2
+
3
+ ![OpenGridX Banner](assets/banner.png)
4
+
5
+ Welcome to the official documentation for **OpenGridX**, the high-performance React DataGrid library.
6
+
7
+ 🚀 **[Live Interactive Documentation](https://opencorestack.github.io/OpenGridX/)** | 🔍 **[API Reference](API_REFERENCE.md)**
8
+
9
+ ---
10
+
11
+ ## 🏗️ Base Components API
12
+ Detailed reference for the core structural components.
13
+
14
+ - **[DataGrid](components/datagrid.md)** - The main component and props
15
+ - **[Header](components/header.md)** - Column headers and grouping
16
+ - **[Row](components/row.md)** - Row rendering and states
17
+ - **[Cell](components/cell.md)** - Individual cell logic and rendering
18
+ - **[Toolbar](components/toolbar.md)** - Global grid actions
19
+ - **[Pagination](components/pagination.md)** - Navigation and paging
20
+ - **[Filter Panel](components/filter-panel.md)** - Advanced filter UI
21
+ - **[Tooltip](components/tooltip.md)** - Dynamic UI tooltips
22
+ - **[Column Visibility](components/column-visibility.md)** - Managing visible fields
23
+ - **[Column Grouping](components/column-group-header.md)** - Multi-level nested headers
24
+ - **[Column Resizing](components/column-resize.md)** - Dynamic width controls
25
+ ---
26
+
27
+ ## 🚀 Features
28
+ In-depth guides on the grid's functional capabilities.
29
+
30
+ - **[Virtualization](features/virtualization.md)** - Handling massive datasets
31
+ - **[Filtering & Search](features/filtering.md)** - Column filters and Global Quick Search
32
+ - **[Sorting & Pagination](features/sorting-pagination.md)** - Organizing and navigating data
33
+ - **[Editing & Reordering](features/editing-reordering.md)** - Inline edits and Drag-and-Drop
34
+ - **[Loading & Performance](features/loading-states.md)** - Skeletons, Lazy, and Infinite loading
35
+ - **[Row Selection](features/selection.md)** - Multi & single choice selection
36
+ - **[Clipboard](features/clipboard.md)** - Copy and Paste grid data
37
+ - **[Pinning](features/pinning.md)** - Sticky columns and rows
38
+ - **[State Persistence](features/state-persistence.md)** - Save/Restore grid configuration
39
+ - **[Aggregation & Pivot](features/aggregation-pivot.md)** - Data summarization and analytics
40
+ - **[Tree Data & Grouping](features/tree-data-grouping.md)** - Hierarchical layout and Column grouping
41
+ - **[Cell Spanning](features/cell-spanning.md)** - Row and Col span spanning
42
+ - **[Master-Detail](features/master-detail.md)** - Expandable Detail Panels
43
+ - **[List View](features/list-view.md)** - Card-based responsive layout
44
+ - **[Infinite Scroll](features/infinite-scroll.md)** - Advanced performance loading
45
+ - **[Data Source](features/data-source.md)** - Server-side fetching and SSR
46
+ - **[Export Guide](features/export-guide.md)** - Excel, CSV, JSON, and Print
47
+
48
+ ---
49
+
50
+ ## 🎨 Customization
51
+ Make the grid your own.
52
+
53
+ - **[Theming Guide](customization/theming.md)** - CSS variables and branding
54
+ - **[Slots API](customization/slots-api.md)** - Replacing internal components
55
+
56
+ ---
57
+
58
+ ## 🛠️ Project Meta
59
+ - **[Development Roadmap](roadmap.md)** - What's built and what's next
60
+ - **[Research Notes](research/FEATURE_CATALOG.md)** - Comparative analysis and design decisions
@@ -0,0 +1,44 @@
1
+ # `<Cell />`
2
+
3
+ The atomic unit of the grid. Handles rendering, formatting, editing, and selection states for a single data point.
4
+
5
+ ## ⚙️ Props
6
+
7
+ | Prop | Type | Description |
8
+ | :--- | :--- | :--- |
9
+ | `value` | `any` | The raw value to display. |
10
+ | `row` | `GridRowModel` | The full row data object. |
11
+ | `colDef` | `GridColDef` | Configuration for the column. |
12
+ | `rowIndex` | `number` | 0-indexed position in the current view. |
13
+ | `isSelected` | `boolean` | Whether the parent row is selected. |
14
+ | `isFocused` | `boolean` | Whether the cell has keyboard focus. |
15
+ | `isEditable` | `boolean` | Enables inline editing for this cell. |
16
+ | `isEditing` | `boolean` | Whether the cell is currently in edit mode. |
17
+ | `width` | `number` | Calculated width including resizing and flex. |
18
+ | `pinnedPosition` | `'left' \| 'right' \| null` | Sticky positioning state. |
19
+
20
+ ## 🧩 Modifiers & Classes
21
+
22
+ The `<Cell />` component applies various BEM classes for styling:
23
+ - `.ogx__cell--selected`: When the row is selected.
24
+ - `.ogx__cell--focused`: When focused via keyboard.
25
+ - `.ogx__cell--editing`: During active cell editing.
26
+ - `.ogx__cell--pinned-left`: Sticky to the left.
27
+ - `.ogx__cell--pinned-right`: Sticky to the right.
28
+
29
+ ## 🛠️ Custom Rendering
30
+
31
+ Use the `renderCell` property in your `GridColDef` to override the default content:
32
+
33
+ ```tsx
34
+ const columns: GridColDef[] = [
35
+ {
36
+ field: 'status',
37
+ renderCell: (params) => (
38
+ <Tag color={params.value === 'active' ? 'green' : 'red'}>
39
+ {params.value}
40
+ </Tag>
41
+ )
42
+ }
43
+ ];
44
+ ```
@@ -0,0 +1,57 @@
1
+ # `<ColumnGroupHeader />`
2
+
3
+ The `ColumnGroupHeader` component handles the rendering of nested header groups in multi-level column layouts. It allows for advanced data organization where multiple columns are grouped under a single, semantic parent.
4
+
5
+ ## 📑 Overview
6
+ - **Hierarchical Layout**: Supports an unlimited depth of nested groupings (Year → Quarter → Metric).
7
+ - **Sticky Behavior**: Automatically stays within the grid's header section during horizontal scroll.
8
+ - **Dynamic Calculation**: Positions itself based on the combined width of its child columns.
9
+ - **Reflective Styles**: Inherits header-level styling while providing specialized group-level CSS hooks.
10
+
11
+ ---
12
+
13
+ ## 🛠️ Usage
14
+
15
+ ### Define Multi-Level Grouping
16
+ In your columns definition, include nested `columnGroups`.
17
+
18
+ ```tsx
19
+ const columns = [
20
+ { field: 'id', headerName: 'ID', width: 100 },
21
+ { field: 'q1', headerName: 'Q1 Sales', width: 120 },
22
+ { field: 'q2', headerName: 'Q2 Sales', width: 120 },
23
+ ];
24
+
25
+ // Define your mapping logic in your component or use the columns API:
26
+ // ColumnGroupHeader is typically used by the DataGrid automatically when
27
+ // nested structures are detected.
28
+ ```
29
+
30
+ ### Direct Customization
31
+ While the grid uses this component internally, you can customize its appearance via specific CSS classes or by replacing it in the `slots` API.
32
+
33
+ ---
34
+
35
+ ## ⚙️ How it Works
36
+
37
+ 1. **Hierarchy Resolution**: The component takes a structure and determines which headers need to be "merged" into groups.
38
+ 2. **Width Aggregation**: Each group header calculates its own total width by summing the widths of all its children (including other nested groups).
39
+ 3. **Alignment**: Ensuring that the group labels are centered over their respective child columns for a clean visual hierarchy.
40
+
41
+ ---
42
+
43
+ ## 🎨 Slot Implementation
44
+ Replace the system's group header with a custom one for specialized styling or interactions.
45
+
46
+ ```tsx
47
+ <DataGrid
48
+ slots={{
49
+ columnGroupHeader: MyCustomGroupHeader
50
+ }}
51
+ />
52
+ ```
53
+
54
+ ## 📝 Best Practices
55
+ - **Logical Labels**: Use clear, concise labels for groups like `2024 Performance` or `Contact Info`.
56
+ - **Type-Based Grouping**: Align related data types (e.g., all currency fields under a `Finance` group) for better user comprehension.
57
+ - **Limit Depth**: While technically unlimited, more than 3-4 levels of nesting can become difficult for users to follow on small screens.
@@ -0,0 +1,63 @@
1
+ # `<ColumnResizeHandle />` & Resizing
2
+
3
+ OpenGridX supports dynamic column resizing, allowing users to adjust the width of any column on the fly for better visibility of data. This is facilitated by the `ColumnResizeHandle`, which sits invisibly between adjacent column headers.
4
+
5
+ ## 📑 Overview
6
+ - **Inter-Header Interaction**: A handle is placed on the right edge of each resizable column header.
7
+ - **Visual Feedback**: On hover and during drag, the grid provides immediate visual cues.
8
+ - **Constraints**: Supports `minWidth` and `maxWidth` values defined in your `GridColDef`.
9
+ - **Double-Click Action**: Support for auto-sizing columns to fit their longest content is built-in.
10
+
11
+ ---
12
+
13
+ ## 🛠️ Usage
14
+
15
+ ### Basic Resizing
16
+ By default, all columns are resizable. You can disable it for a specific field.
17
+
18
+ ```tsx
19
+ const columns: GridColDef[] = [
20
+ { field: 'id', headerName: 'ID', resizable: false }, // Fixed width
21
+ { field: 'name', headerName: 'Name', minWidth: 100 } // User can resize
22
+ ];
23
+ ```
24
+
25
+ ### Grid-Wide Control
26
+ Disable resizing globally via the `DataGrid` props.
27
+
28
+ ```tsx
29
+ <DataGrid
30
+ rows={rows}
31
+ columns={columns}
32
+ disableColumnResize
33
+ />
34
+ ```
35
+
36
+ ---
37
+
38
+ ## ⚙️ How it Works
39
+
40
+ 1. **Handle Deployment**: At the end of each `Header` component, a `ColumnResizeHandle` is mounted.
41
+ 2. **Drag Event Processing**: When the handle is dragged:
42
+ - It calculates the change in horizontal position (`deltaX`).
43
+ - It applies this change to the column's current width in the grid's state.
44
+ 3. **Boundaries Enforcement**: If the new width is less than `minWidth` (default 50px) or more than `maxWidth`, the change is rejected.
45
+ 4. **Finalization**: On mouse up, the new column width is persisted to the grid's `columnVisibilityModel` equivalents.
46
+
47
+ ---
48
+
49
+ ## 🎨 Slot Implementation
50
+ In the DataGrid, you can replace the default handle component for custom styling (e.g., a thicker line or different colors).
51
+
52
+ ```tsx
53
+ <DataGrid
54
+ slots={{
55
+ columnResizeHandle: MyCustomHandle
56
+ }}
57
+ />
58
+ ```
59
+
60
+ ## 📝 Best Practices
61
+ - **Define Min Widths**: Always set a reasonable `minWidth` so columns don't accidentally become 0px wide.
62
+ - **Persistence**: Listen to `onColumnWidthChange` to save the user's preferred layout for their next visit.
63
+ - **Content Fit**: Remember that large data values might hide behind narrow columns; use tooltips for overflow coverage.
@@ -0,0 +1,61 @@
1
+ # `<ColumnVisibilityPanel />`
2
+
3
+ The `ColumnVisibilityPanel` provides an interactive list for users to toggle the visibility of specific columns within the grid. This is essential for managing dense datasets where only a subset of information is needed at once.
4
+
5
+ ## 📑 Overview
6
+ - **Auto-Generating List**: It automatically builds a list of all togglable columns from the grid's state.
7
+ - **Searchable Interface**: Includes a quick search to find specific columns in grids with many fields.
8
+ - **Toggle State**: Synchronizes instantly with the grid's `columnVisibilityModel`.
9
+ - **Exclusion Logic**: Automatically hides special internal columns (e.g., checkboxes) and columns marked with `hideable: false`.
10
+
11
+ ---
12
+
13
+ ## 🛠️ Usage
14
+
15
+ ### Toolbar Integration
16
+ The most common way to use the visibility panel is within a dropdown menu in the grid's toolbar.
17
+
18
+ ```tsx
19
+ import { ColumnVisibilityPanel } from '@opencorestack/opengridx';
20
+
21
+ // In your Toolbar component
22
+ <Dropdown content={<ColumnVisibilityPanel />}>
23
+ <button>Columns</button>
24
+ </Dropdown>
25
+ ```
26
+
27
+ ### Direct Integration
28
+ You can also render it persistently beside the grid or within a custom modal.
29
+
30
+ ```tsx
31
+ <div className="my-column-sidebar">
32
+ <ColumnVisibilityPanel />
33
+ </div>
34
+ ```
35
+
36
+ ---
37
+
38
+ ## ⚙️ How it Works
39
+
40
+ 1. **Column Resolution**: The panel retrieves all columns defined in the `DataGrid`.
41
+ 2. **Filtration**: It ignores columns that should not be visible in the list:
42
+ - Columns starting with `__` (internal types).
43
+ - Columns explicitly marked as `hideable: false` in the `GridColDef`.
44
+ 3. **State Management**: When a user toggles a switch, it triggers an update to the grid's `columnVisibilityModel`, causing the grid to re-render only the affected columns.
45
+
46
+ ---
47
+
48
+ ## 🎨 Slot Implementation
49
+ In advanced scenarios, you can replace the default panel with your own implementation using the `columnVisibilityPanel` slot.
50
+
51
+ ```tsx
52
+ <DataGrid
53
+ slots={{
54
+ columnVisibilityPanel: MyCustomVisibilityPanel
55
+ }}
56
+ />
57
+ ```
58
+
59
+ ## 📝 Best Practices
60
+ - **Logical Grouping**: Ensure your columns have clear, human-readable `headerName` values so they are easily identifiable in the list.
61
+ - **Persistent State**: Use `onColumnVisibilityModelChange` to save column preferences to local storage or a database so the user's layout is preserved.
@@ -0,0 +1,70 @@
1
+ # `<DataGrid />`
2
+
3
+ The central component of the OpenGridX library. Highly optimized for performance with virtualization and a rich feature set.
4
+
5
+ ## 🚀 Usage
6
+
7
+ ```tsx
8
+ import { DataGrid } from '@opencorestack/opengridx';
9
+
10
+ function MyGrid() {
11
+ return (
12
+ <DataGrid
13
+ rows={rows}
14
+ columns={columns}
15
+ height={600}
16
+ />
17
+ );
18
+ }
19
+ ```
20
+
21
+ ## ⚙️ Core Props
22
+
23
+ | Prop | Type | Default | Description |
24
+ | :--- | :--- | :--- | :--- |
25
+ | `rows` | `R[]` | `[]` | The dataset to display. |
26
+ | `columns` | `GridColDef[]` | `[]` | Column definitions. |
27
+ | `getRowId` | `(row: R) => GridRowId` | `row.id` | Unique ID for each row. |
28
+ | `height` | `number \| string` | `undefined` | Height of the grid container. |
29
+ | `loading` | `boolean` | `false` | Displays a loading skeleton/shimmer. |
30
+ | `checkboxSelection` | `boolean` | `false` | Enable row checkboxes. |
31
+ | `pagination` | `boolean` | `false` | Enable/Disable bottom pagination bar. |
32
+ | `paginationModel` | `GridPaginationModel` | `{page:0, pageSize:25}` | Controlled pagination state. |
33
+ | `initialState` | `GridState` | `undefined` | Initial configuration (sorting, columns, etc). |
34
+
35
+ ## 🖱️ Interaction & Events
36
+
37
+ | Prop | Type | Description |
38
+ | :--- | :--- | :--- |
39
+ | `onRowClick` | `(params) => void` | Fired when clicking a row body. |
40
+ | `onCellClick` | `(params) => void` | Fired when clicking a specific cell. |
41
+ | `onStateChange` | `(state) => void` | Fired on any internal state update. |
42
+ | `processRowUpdate` | `(new, old) => R` | Fired after a cell edit is committed. |
43
+
44
+ ## 📦 Slots
45
+
46
+ Customize internal components using the `slots` prop.
47
+
48
+ ```tsx
49
+ <DataGrid
50
+ slots={{
51
+ toolbar: MyCustomToolbar,
52
+ pagination: MyCustomPagination,
53
+ noRowsOverlay: MyEmptyState
54
+ }}
55
+ />
56
+ ```
57
+
58
+ ---
59
+
60
+ ## 🔗 Related Components
61
+ - [Row](row.md)
62
+ - [Cell](cell.md)
63
+ - [Header](header.md)
64
+ - [Toolbar](toolbar.md)
65
+ - [Filter Panel](filter-panel.md)
66
+ - [Pagination](pagination.md)
67
+ - [Tooltip](tooltip.md)
68
+ - [Column Visibility](column-visibility.md)
69
+ - [Column Grouping](column-group-header.md)
70
+ - [Column Resizing](column-resize.md)
@@ -0,0 +1,26 @@
1
+ # `<FilterPanel />`
2
+
3
+ A persistent UI component for managing complex multi-column filter rules.
4
+
5
+ ## ⚙️ Key Concepts
6
+
7
+ The Filter Panel allows users to define a list of `GridFilterItem` objects. Each item consists of:
8
+ - **Field**: Which column to filter.
9
+ - **Operator**: How to compare (e.g., `contains`, `equals`, `>`, `is empty`).
10
+ - **Value**: The target value for comparison.
11
+
12
+ ## 🔌 Integration
13
+
14
+ The `<DataGrid />` manages the visibility of the Filter Panel via its internal state. It is usually triggered from the Column Menu or the Toolbar.
15
+
16
+ ## 📝 Configuration
17
+
18
+ Filter operators are automatically determined based on the column's `type`:
19
+ - `string`: contains, equals, startsWith, endsWith, isAnyOf.
20
+ - `number`: =, !=, >, >=, <, <=.
21
+ - `date` / `dateTime`: is, isNot, isAfter, isBefore.
22
+ - `boolean`: isTrue, isFalse.
23
+
24
+ ## 🎨 Slot Usage
25
+
26
+ While the Filter Panel is a complex internal component, its appearance can be influenced by CSS variables or by providing a custom implementation to the `filterPanel` slot in advanced use cases.
@@ -0,0 +1,39 @@
1
+ # `<Header />`
2
+
3
+ Manages the column headers, sorting triggers, column resizing, and column grouping rows.
4
+
5
+ ## ⚙️ Props
6
+
7
+ | Prop | Type | Description |
8
+ | :--- | :--- | :--- |
9
+ | `columns` | `GridColDef[]` | Column definitions for the visible viewport. |
10
+ | `columnGroupingModel` | `GridColumnGroupingModel` | Hierarchy for multi-level header spanning. |
11
+ | `sortModel` | `GridSortModel` | Current sorting state for highlight and icons. |
12
+ | `onSort` | `(field, direction) => void` | Callback triggered when a header is clicked. |
13
+ | `onColumnResize` | `Function` | Callback for manual column width changes. |
14
+ | `pinnedColumns` | `GridColumnPinning` | Coordinates sticky positioning for headers. |
15
+ | `checkboxSelection` | `boolean` | Renders the "Select All" checkbox. |
16
+
17
+ ## 📐 Column Grouping
18
+
19
+ The `<Header />` dynamically calculates the nesting depth of your `columnGroupingModel` and renders additional [Column Group Headers](column-group-header.md) above the main column headers.
20
+
21
+ ```tsx
22
+ const columnGroupingModel = [
23
+ {
24
+ groupId: 'internal',
25
+ headerName: 'Internal Details',
26
+ children: ['id', 'path'],
27
+ }
28
+ ];
29
+ ```
30
+
31
+ ## 🖱️ Column Menu & Resizing
32
+
33
+ Unless `disableColumnMenu` is set to `true` in a column's `GridColDef`, each header cell renders a menu icon. In addition, the header facilitates manual [Column Resizing](column-resize.md).
34
+
35
+ Clicking the menu icon opens a popover with actions to:
36
+ - Sort Asc/Desc
37
+ - Pin Left/Right/None
38
+ - Hide Column
39
+ - Manage Columns (Open [Visibility Panel](column-visibility.md))
@@ -0,0 +1,34 @@
1
+ # `<Pagination />`
2
+
3
+ Handles row limit selection and page navigation. Compatible with both client-side and server-side data modes.
4
+
5
+ ## ⚙️ Props
6
+
7
+ | Prop | Type | Default | Description |
8
+ | :--- | :--- | :--- | :--- |
9
+ | `page` | `number` | `0` | The current active page (0-indexed). |
10
+ | `pageSize` | `number` | `100` | Number of rows per page. |
11
+ | `rowCount` | `number` | `0` | Total number of rows (used to calculate page count). |
12
+ | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Options for the "Rows per page" dropdown. |
13
+
14
+ ## 🕹️ Interaction
15
+
16
+ The pagination component communicates state changes back to the `<DataGrid />` via:
17
+ - `onPageChange`: Triggered when clicking Next/Prev or a page number.
18
+ - `onPageSizeChange`: Triggered when changing the rows-per-page limit.
19
+
20
+ ## 🔄 Modes
21
+
22
+ - **Client-side**: Pagination happens automatically on the local `rows` array.
23
+ - **Server-side**: Pagination state is passed to the `GridDataSource` to fetch new chunks of data.
24
+
25
+ ## 🎨 Customizing
26
+ You can replace the internal pagination UI using the `pagination` slot:
27
+
28
+ ```tsx
29
+ <DataGrid
30
+ slots={{
31
+ pagination: MyCustomPaginationComponent
32
+ }}
33
+ />
34
+ ```
@@ -0,0 +1,31 @@
1
+ # `<Row />`
2
+
3
+ Manages a horizontal collection of cells. Includes support for selection, expansion (Detail Panels), row pinning, and reordering.
4
+
5
+ ## ⚙️ Props
6
+
7
+ | Prop | Type | Description |
8
+ | :--- | :--- | :--- |
9
+ | `row` | `GridRowModel` | The data object for this row. |
10
+ | `columns` | `GridColDef[]` | Columns currently visible in the viewport. |
11
+ | `rowIndex` | `number` | Index used for virtualization and alternating colors. |
12
+ | `isSelected` | `boolean` | Checkbox / Selection state. |
13
+ | `checkboxSelection` | `boolean` | If `true`, renders the selection checkbox. |
14
+ | `hasDetailPanel` | `boolean` | Enables the detail panel toggle icon. |
15
+ | `isDetailPanelExpanded` | `boolean` | Current expansion state. |
16
+ | `rowReordering` | `boolean` | Enables the drag handle for reordering rows. |
17
+ | `rowHeight` | `number` | Height in pixels (default: 52). |
18
+
19
+ ## 📐 Row Pinning
20
+
21
+ Rows can be pinned to the **Top** or **Bottom** of the grid using the `pinnedRows` prop on the `<DataGrid />`. Pinned rows are rendered using the same `<Row />` component but are positioned sticky within their own containers.
22
+
23
+ ## 🌈 Alternating Colors
24
+
25
+ The grid supports "Zebra" striping via CSS:
26
+ - `.ogx__row--even`: Even-indexed rows.
27
+ - `.ogx__row--odd`: Odd-indexed rows.
28
+
29
+ ## 📋 Detail Panel
30
+
31
+ When `getDetailPanelContent` is provided, the `<Row />` renders an expandable container below itself to show supplemental data.