@alaarab/ogrid-mcp 2.4.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 (52) hide show
  1. package/README.md +68 -0
  2. package/bundled-docs/api/README.md +94 -0
  3. package/bundled-docs/api/column-def.mdx +379 -0
  4. package/bundled-docs/api/components-column-chooser.mdx +310 -0
  5. package/bundled-docs/api/components-column-header-filter.mdx +363 -0
  6. package/bundled-docs/api/components-datagrid-table.mdx +316 -0
  7. package/bundled-docs/api/components-pagination-controls.mdx +344 -0
  8. package/bundled-docs/api/components-sidebar.mdx +427 -0
  9. package/bundled-docs/api/components-status-bar.mdx +309 -0
  10. package/bundled-docs/api/grid-api.mdx +299 -0
  11. package/bundled-docs/api/js-api.mdx +198 -0
  12. package/bundled-docs/api/ogrid-props.mdx +244 -0
  13. package/bundled-docs/api/types.mdx +640 -0
  14. package/bundled-docs/features/cell-references.mdx +225 -0
  15. package/bundled-docs/features/column-chooser.mdx +279 -0
  16. package/bundled-docs/features/column-groups.mdx +290 -0
  17. package/bundled-docs/features/column-pinning.mdx +282 -0
  18. package/bundled-docs/features/column-reordering.mdx +359 -0
  19. package/bundled-docs/features/column-types.mdx +181 -0
  20. package/bundled-docs/features/context-menu.mdx +216 -0
  21. package/bundled-docs/features/csv-export.mdx +227 -0
  22. package/bundled-docs/features/editing.mdx +377 -0
  23. package/bundled-docs/features/filtering.mdx +330 -0
  24. package/bundled-docs/features/formulas.mdx +381 -0
  25. package/bundled-docs/features/grid-api.mdx +311 -0
  26. package/bundled-docs/features/keyboard-navigation.mdx +236 -0
  27. package/bundled-docs/features/pagination.mdx +245 -0
  28. package/bundled-docs/features/performance.mdx +433 -0
  29. package/bundled-docs/features/row-selection.mdx +256 -0
  30. package/bundled-docs/features/server-side-data.mdx +291 -0
  31. package/bundled-docs/features/sidebar.mdx +234 -0
  32. package/bundled-docs/features/sorting.mdx +241 -0
  33. package/bundled-docs/features/spreadsheet-selection.mdx +201 -0
  34. package/bundled-docs/features/status-bar.mdx +205 -0
  35. package/bundled-docs/features/toolbar.mdx +284 -0
  36. package/bundled-docs/features/virtual-scrolling.mdx +624 -0
  37. package/bundled-docs/getting-started/installation.mdx +216 -0
  38. package/bundled-docs/getting-started/overview.mdx +151 -0
  39. package/bundled-docs/getting-started/quick-start.mdx +425 -0
  40. package/bundled-docs/getting-started/vanilla-js.mdx +191 -0
  41. package/bundled-docs/guides/accessibility.mdx +550 -0
  42. package/bundled-docs/guides/controlled-vs-uncontrolled.mdx +153 -0
  43. package/bundled-docs/guides/custom-cell-editors.mdx +201 -0
  44. package/bundled-docs/guides/framework-showcase.mdx +200 -0
  45. package/bundled-docs/guides/mcp-live-testing.mdx +291 -0
  46. package/bundled-docs/guides/mcp.mdx +172 -0
  47. package/bundled-docs/guides/migration-from-ag-grid.mdx +223 -0
  48. package/bundled-docs/guides/theming.mdx +211 -0
  49. package/dist/esm/bridge-client.d.ts +87 -0
  50. package/dist/esm/bridge-client.js +162 -0
  51. package/dist/esm/index.js +1060 -0
  52. package/package.json +43 -0
@@ -0,0 +1,236 @@
1
+ ---
2
+ sidebar_position: 17
3
+ title: Keyboard Navigation
4
+ description: Full keyboard support for navigating, editing, selecting, and operating on cells
5
+ ---
6
+
7
+
8
+ # Keyboard Navigation
9
+
10
+ OGrid supports comprehensive keyboard navigation for moving between cells, editing values, selecting ranges, and performing clipboard and undo operations -- all without touching the mouse.
11
+
12
+ ## Live Demo
13
+
14
+ <KeyboardNavigationDemo />
15
+
16
+ :::tip Try it in your framework
17
+ The demo above uses Radix UI for styling. To see this feature with your framework's design system (Fluent UI, Material UI, Vuetify, PrimeNG, etc.), click **"Open in online demo"** below the demo.
18
+ :::
19
+
20
+ ## Quick Example
21
+
22
+ <Tabs groupId="framework">
23
+ <TabItem value="react" label="React" default>
24
+
25
+ ```tsx
26
+
27
+ function App() {
28
+ return (
29
+ <OGrid
30
+ columns={columns}
31
+ data={data}
32
+ getRowId={(r) => r.id}
33
+ editable
34
+ />
35
+ );
36
+ }
37
+ ```
38
+
39
+ :::tip Switching UI libraries
40
+ The `OGrid` component has the same props across all React UI packages. To switch, just change the import:
41
+
42
+ - **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
43
+ - **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` — wrap in `<FluentProvider>`
44
+ - **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` — wrap in `<ThemeProvider>`
45
+ :::
46
+
47
+ </TabItem>
48
+ <TabItem value="angular" label="Angular">
49
+
50
+ ```typescript
51
+
52
+ @Component({
53
+ standalone: true,
54
+ imports: [OGridComponent],
55
+ template: `<ogrid [props]="gridProps" />`
56
+ })
57
+ export class GridComponent {
58
+ gridProps = {
59
+ columns: columns,
60
+ data: data,
61
+ getRowId: (r: Row) => r.id,
62
+ editable: true,
63
+ };
64
+ }
65
+ ```
66
+
67
+ :::tip Switching UI libraries
68
+ Same component API across Angular packages. To switch, just change the import:
69
+
70
+ - **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
71
+ - **Angular Material**: `from '@alaarab/ogrid-angular-material'`
72
+ - **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
73
+
74
+ All components are standalone — no NgModule required.
75
+ :::
76
+
77
+ </TabItem>
78
+ <TabItem value="vue" label="Vue">
79
+
80
+ ```vue
81
+ <script setup lang="ts">
82
+
83
+ const gridProps = {
84
+ columns,
85
+ data,
86
+ getRowId: (r) => r.id,
87
+ editable: true,
88
+ };
89
+ </script>
90
+
91
+ <template>
92
+ <OGrid :gridProps="gridProps" />
93
+ </template>
94
+ ```
95
+
96
+ :::tip Switching UI libraries
97
+ Same component API across Vue packages. To switch, just change the import:
98
+
99
+ - **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
100
+ - **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` — wrap in `<v-app>` for theming
101
+ - **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
102
+ :::
103
+
104
+ </TabItem>
105
+ <TabItem value="js" label="Vanilla JS">
106
+
107
+ ```js
108
+
109
+ const grid = new OGrid(document.getElementById('grid'), {
110
+ columns: columns,
111
+ data: data,
112
+ getRowId: (r) => r.id,
113
+ editable: true,
114
+ });
115
+
116
+ // Click any cell to make it active, then use keyboard to navigate
117
+ ```
118
+
119
+ </TabItem>
120
+ </Tabs>
121
+
122
+ Click any cell to make it the active cell, then use the keyboard to navigate and edit.
123
+
124
+ ## Navigation
125
+
126
+ | Key | Action |
127
+ |---|---|
128
+ | Arrow Up / Down / Left / Right | Move active cell in that direction |
129
+ | Ctrl+Arrow | Jump to the edge of the current data region (Excel-style) |
130
+ | Tab | Move to the next cell (left to right, then next row) |
131
+ | Shift+Tab | Move to the previous cell |
132
+ | Home | Move to the first column in the current row |
133
+ | End | Move to the last column in the current row |
134
+ | Ctrl+Home | Move to the first cell in the grid (top-left) |
135
+ | Ctrl+End | Move to the last cell in the grid (bottom-right) |
136
+ | Page Down | Move down by one page of rows |
137
+ | Page Up | Move up by one page of rows |
138
+
139
+ ## Cell Selection
140
+
141
+ | Key | Action |
142
+ |---|---|
143
+ | Click | Set active cell |
144
+ | Shift+Arrow | Extend selection range from the active cell |
145
+ | Ctrl+Shift+Arrow | Extend selection to the edge of the current data region |
146
+ | Shift+Click | Select range from active cell to clicked cell |
147
+ | Ctrl+A | Select all **cells** in the grid (for copy/paste/fill operations, not row selection) |
148
+
149
+ The selection range is highlighted with a green border. The active cell remains visually distinct within the range.
150
+
151
+ :::info Cell Selection vs Row Selection
152
+ Ctrl+A selects all **cells** in the grid for spreadsheet operations (copy/paste/fill). This is different from row selection, where the header checkbox selects all **rows** for bulk operations. See [Row Selection](./row-selection) and [Spreadsheet Selection](./spreadsheet-selection) for details.
153
+ :::
154
+
155
+ ### Ctrl+Arrow (Data Region Jump)
156
+
157
+ Ctrl+Arrow navigates the same way Excel does:
158
+
159
+ - **Non-empty cell → non-empty neighbor**: Jumps to the last non-empty cell before a gap (empty cell) or the grid edge.
160
+ - **Non-empty cell → empty neighbor**: Skips over the empty cells and lands on the next non-empty cell, or the grid edge if all remaining cells are empty.
161
+ - **Empty cell**: Jumps to the next non-empty cell in that direction, or the grid edge.
162
+
163
+ Combine with **Shift** to extend the selection range to the same target.
164
+
165
+ ## Editing
166
+
167
+ | Key | Action |
168
+ |---|---|
169
+ | Enter | Start editing the active cell; press again to commit and move down |
170
+ | F2 | Start editing the active cell (cursor at end of text) |
171
+ | Escape | Cancel editing and revert to the original value |
172
+ | Delete / Backspace | Clear the contents of selected cells |
173
+ | Any printable character | Start editing and replace cell content with the typed character |
174
+
175
+ When a cell is in edit mode:
176
+ - **Enter** commits the value and moves the active cell down.
177
+ - **Tab** commits the value and moves the active cell right.
178
+ - **Escape** discards the edit and returns to navigation mode.
179
+ - Arrow keys move the cursor within the editor (they do not navigate between cells while editing).
180
+
181
+ ## Clipboard
182
+
183
+ | Key | Action |
184
+ |---|---|
185
+ | Ctrl+C | Copy selected cells to clipboard (tab-separated) |
186
+ | Ctrl+X | Cut selected cells (copy + clear originals) |
187
+ | Ctrl+V | Paste clipboard contents starting at the active cell |
188
+
189
+ Copied data uses tab-separated format compatible with Excel and Google Sheets. Multi-cell selections copy the entire rectangular range.
190
+
191
+ ## Undo / Redo
192
+
193
+ | Key | Action |
194
+ |---|---|
195
+ | Ctrl+Z | Undo the last cell edit |
196
+ | Ctrl+Y | Redo the last undone edit |
197
+
198
+ Undo/redo requires the `onUndo`, `onRedo`, `canUndo`, and `canRedo` props to be wired up (typically via the `useUndoRedo` hook).
199
+
200
+ ## How It Works
201
+
202
+ Keyboard navigation is handled by the `useKeyboardNavigation` hook in core, which is automatically wired into the grid when `cellSelection` is enabled (the default). The hook listens for `keydown` events on the grid wrapper element and translates them into active cell movements, selection range changes, or editing actions.
203
+
204
+ ### Disabling Cell Selection
205
+
206
+ Set `cellSelection={false}` to disable keyboard-driven cell navigation, selection, clipboard, and context menu. The grid becomes a read-only display table.
207
+
208
+ ```tsx
209
+ <OGrid
210
+ columns={columns}
211
+ data={data}
212
+ getRowId={(r) => r.id}
213
+ cellSelection={false}
214
+ />
215
+ ```
216
+
217
+ ### macOS
218
+
219
+ On macOS, Ctrl is replaced by the Command key for all shortcuts (Cmd+C, Cmd+V, Cmd+Z, etc.). The grid detects the platform automatically.
220
+
221
+ ## Props Reference
222
+
223
+ | Type | Field | Description |
224
+ |---|---|---|
225
+ | `IOGridProps<T>` | `cellSelection` | `boolean` -- enable/disable keyboard navigation and selection (default `true`) |
226
+ | `IOGridProps<T>` | `editable` | `boolean` -- enable cell editing via keyboard |
227
+ | `IOGridProps<T>` | `onUndo` | Callback for Ctrl+Z |
228
+ | `IOGridProps<T>` | `onRedo` | Callback for Ctrl+Y |
229
+ | `IOGridProps<T>` | `canUndo` | `boolean` -- whether undo is available |
230
+ | `IOGridProps<T>` | `canRedo` | `boolean` -- whether redo is available |
231
+
232
+ ## Related
233
+
234
+ - [Context Menu](./context-menu) -- right-click menu mirrors keyboard shortcuts
235
+ - [Status Bar](./status-bar) -- shows aggregations for keyboard-selected ranges
236
+ - [Column Pinning](./column-pinning) -- navigation works seamlessly across pinned and scrollable columns
@@ -0,0 +1,245 @@
1
+ ---
2
+ sidebar_position: 3
3
+ title: Pagination
4
+ description: Built-in pagination with configurable page sizes for client-side and server-side data.
5
+ ---
6
+
7
+
8
+ # Pagination
9
+
10
+ OGrid includes a built-in pagination bar with page navigation buttons, page size selector, and a row count summary. It works seamlessly with both client-side data arrays and server-side data sources.
11
+
12
+ ## Live Demo
13
+
14
+ <PaginationDemo />
15
+
16
+ :::tip Framework-Specific Styling
17
+ The live demo above shows **React Radix UI** styling (lightweight default). To see how pagination controls look in your framework's design system, click the framework buttons above the demo to open online demo. Each framework renders with its native button and dropdown components, so the styling matches your design system.
18
+ :::
19
+
20
+ ## Quick Example
21
+
22
+ <Tabs groupId="framework">
23
+ <TabItem value="react" label="React" default>
24
+
25
+ ```tsx
26
+
27
+ const columns = [
28
+ { columnId: 'name', name: 'Name' },
29
+ { columnId: 'email', name: 'Email' },
30
+ { columnId: 'department', name: 'Department' },
31
+ {
32
+ columnId: 'salary',
33
+ name: 'Salary',
34
+ type: 'numeric' as const,
35
+ valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
36
+ },
37
+ ];
38
+
39
+ function App() {
40
+ return (
41
+ <OGrid
42
+ columns={columns}
43
+ data={people}
44
+ getRowId={(item) => item.id}
45
+ defaultPageSize={5}
46
+ pageSizeOptions={[5, 10, 25, 50]}
47
+ entityLabelPlural="people"
48
+ />
49
+ );
50
+ }
51
+ ```
52
+
53
+ :::tip Switching UI libraries
54
+ The `OGrid` component has the same props across all React UI packages. To switch, just change the import:
55
+
56
+ - **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
57
+ - **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` — wrap in `<FluentProvider>`
58
+ - **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` — wrap in `<ThemeProvider>`
59
+ :::
60
+
61
+ </TabItem>
62
+ <TabItem value="angular" label="Angular">
63
+
64
+ ```typescript
65
+
66
+ @Component({
67
+ standalone: true,
68
+ imports: [OGridComponent],
69
+ template: `<ogrid [props]="gridProps" />`
70
+ })
71
+ export class GridComponent {
72
+ gridProps = {
73
+ columns: [
74
+ { columnId: 'name', name: 'Name' },
75
+ { columnId: 'email', name: 'Email' },
76
+ { columnId: 'department', name: 'Department' },
77
+ {
78
+ columnId: 'salary', name: 'Salary', type: 'numeric',
79
+ valueFormatter: (v: unknown) => `$${Number(v).toLocaleString()}`,
80
+ },
81
+ ] as IColumnDef<Person>[],
82
+ data: people,
83
+ getRowId: (item: Person) => item.id,
84
+ defaultPageSize: 5,
85
+ pageSizeOptions: [5, 10, 25, 50],
86
+ entityLabelPlural: 'people',
87
+ };
88
+ }
89
+ ```
90
+
91
+ :::tip Switching UI libraries
92
+ Same component API across Angular packages. To switch, just change the import:
93
+
94
+ - **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
95
+ - **Angular Material**: `from '@alaarab/ogrid-angular-material'`
96
+ - **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
97
+
98
+ All components are standalone — no NgModule required.
99
+ :::
100
+
101
+ </TabItem>
102
+ <TabItem value="vue" label="Vue">
103
+
104
+ ```vue
105
+ <script setup lang="ts">
106
+
107
+ const columns: IColumnDef<Person>[] = [
108
+ { columnId: 'name', name: 'Name' },
109
+ { columnId: 'email', name: 'Email' },
110
+ { columnId: 'department', name: 'Department' },
111
+ {
112
+ columnId: 'salary', name: 'Salary', type: 'numeric',
113
+ valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
114
+ },
115
+ ];
116
+
117
+ const gridProps = {
118
+ columns,
119
+ data: people,
120
+ getRowId: (item) => item.id,
121
+ defaultPageSize: 5,
122
+ pageSizeOptions: [5, 10, 25, 50],
123
+ entityLabelPlural: 'people',
124
+ };
125
+ </script>
126
+
127
+ <template>
128
+ <OGrid :gridProps="gridProps" />
129
+ </template>
130
+ ```
131
+
132
+ :::tip Switching UI libraries
133
+ Same component API across Vue packages. To switch, just change the import:
134
+
135
+ - **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
136
+ - **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` — wrap in `<v-app>` for theming
137
+ - **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
138
+ :::
139
+
140
+ </TabItem>
141
+ <TabItem value="js" label="Vanilla JS">
142
+
143
+ ```js
144
+
145
+ const grid = new OGrid(document.getElementById('grid'), {
146
+ columns: [
147
+ { columnId: 'name', name: 'Name' },
148
+ { columnId: 'email', name: 'Email' },
149
+ { columnId: 'department', name: 'Department' },
150
+ {
151
+ columnId: 'salary',
152
+ name: 'Salary',
153
+ type: 'numeric',
154
+ valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
155
+ },
156
+ ],
157
+ data: people,
158
+ getRowId: (item) => item.id,
159
+ pageSize: 5,
160
+ pageSizeOptions: [5, 10, 25, 50],
161
+ entityLabelPlural: 'people',
162
+ });
163
+ ```
164
+
165
+ </TabItem>
166
+ </Tabs>
167
+
168
+ ## How It Works
169
+
170
+ Pagination is automatic. When your data exceeds the page size, the pagination bar appears at the bottom of the grid with:
171
+
172
+ - **Previous / Next** buttons
173
+ - **Page number** indicator ("Page 1 of 5")
174
+ - **Page size selector** (dropdown to change rows per page)
175
+ - **Row count summary** ("Showing 1-25 of 120 projects")
176
+
177
+ ### Client-Side Pagination
178
+
179
+ When you pass a `data` array, OGrid slices it automatically based on the current page and page size. Sorting and filtering are applied before slicing.
180
+
181
+ ### Server-Side Pagination
182
+
183
+ When you pass a `dataSource`, the grid calls `fetchPage()` with `page` and `pageSize` parameters. Your server returns only the rows for that page along with a `totalCount`:
184
+
185
+ ```tsx
186
+ const dataSource: IDataSource<Project> = {
187
+ fetchPage: async ({ page, pageSize, sort, filters }) => {
188
+ const res = await fetch(`/api/projects?page=${page}&pageSize=${pageSize}`);
189
+ const json = await res.json();
190
+ return { items: json.data, totalCount: json.total };
191
+ },
192
+ };
193
+
194
+ function App() {
195
+ return (
196
+ <OGrid
197
+ columns={columns}
198
+ dataSource={dataSource}
199
+ getRowId={(item) => item.id}
200
+ defaultPageSize={50}
201
+ entityLabelPlural="projects"
202
+ />
203
+ );
204
+ }
205
+ ```
206
+
207
+ ### Controlled Pagination
208
+
209
+ For full control over page state (e.g., URL-synced pagination), pass `page`, `pageSize`, `onPageChange`, and `onPageSizeChange`:
210
+
211
+ ```tsx
212
+ function App() {
213
+ const [page, setPage] = useState(1);
214
+ const [pageSize, setPageSize] = useState(25);
215
+
216
+ return (
217
+ <OGrid
218
+ columns={columns}
219
+ data={items}
220
+ getRowId={(item) => item.id}
221
+ page={page}
222
+ pageSize={pageSize}
223
+ onPageChange={setPage}
224
+ onPageSizeChange={setPageSize}
225
+ />
226
+ );
227
+ }
228
+ ```
229
+
230
+ ## Props
231
+
232
+ | Prop | Type | Default | Description |
233
+ |------|------|---------|-------------|
234
+ | `defaultPageSize` | `number` | `25` | Initial page size (uncontrolled mode). |
235
+ | `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Options shown in the page size dropdown. If the active page size isn't in the list, it's auto-inserted. |
236
+ | `page` | `number` | -- | Current page number (controlled mode, 1-indexed). |
237
+ | `pageSize` | `number` | -- | Rows per page (controlled mode). |
238
+ | `onPageChange` | `(page: number) => void` | -- | Called when page changes. |
239
+ | `onPageSizeChange` | `(size: number) => void` | -- | Called when page size changes. |
240
+ | `entityLabelPlural` | `string` | `'items'` | Label used in the row count summary (e.g., "Showing 1-25 of 100 **projects**"). |
241
+
242
+ ## Related
243
+
244
+ - [Sorting](./sorting) -- sort results before pagination
245
+ - [Filtering](./filtering) -- filter results before pagination