@alaarab/ogrid-mcp 2.8.1 → 2.11.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.
- package/bundled-docs/api/README.md +7 -32
- package/bundled-docs/api/column-def.mdx +1 -1
- package/bundled-docs/api/components-column-chooser.mdx +0 -96
- package/bundled-docs/api/components-column-header-filter.mdx +1 -83
- package/bundled-docs/api/components-datagrid-table.mdx +0 -63
- package/bundled-docs/api/components-pagination-controls.mdx +0 -94
- package/bundled-docs/api/components-sidebar.mdx +0 -76
- package/bundled-docs/api/components-status-bar.mdx +0 -66
- package/bundled-docs/api/headless-hooks.mdx +410 -0
- package/bundled-docs/api/ogrid-props.mdx +1 -1
- package/bundled-docs/api/types.mdx +1 -1
- package/bundled-docs/features/cell-references.mdx +2 -116
- package/bundled-docs/features/column-chooser.mdx +0 -131
- package/bundled-docs/features/column-groups.mdx +1 -136
- package/bundled-docs/features/column-pinning.mdx +1 -108
- package/bundled-docs/features/column-reordering.mdx +1 -168
- package/bundled-docs/features/column-types.mdx +0 -71
- package/bundled-docs/features/context-menu.mdx +1 -93
- package/bundled-docs/features/csv-export.mdx +1 -104
- package/bundled-docs/features/editing.mdx +0 -149
- package/bundled-docs/features/filtering.mdx +0 -119
- package/bundled-docs/features/formulas.mdx +2 -102
- package/bundled-docs/features/grid-api.mdx +1 -108
- package/bundled-docs/features/keyboard-navigation.mdx +1 -74
- package/bundled-docs/features/mobile-touch.mdx +0 -71
- package/bundled-docs/features/pagination.mdx +0 -105
- package/bundled-docs/features/performance.mdx +0 -191
- package/bundled-docs/features/premium-inputs.mdx +0 -311
- package/bundled-docs/features/responsive-columns.mdx +1 -76
- package/bundled-docs/features/row-selection.mdx +2 -106
- package/bundled-docs/features/server-side-data.mdx +1 -129
- package/bundled-docs/features/sidebar.mdx +1 -78
- package/bundled-docs/features/sorting.mdx +2 -108
- package/bundled-docs/features/spreadsheet-selection.mdx +2 -79
- package/bundled-docs/features/status-bar.mdx +1 -72
- package/bundled-docs/features/toolbar.mdx +1 -75
- package/bundled-docs/features/virtual-scrolling.mdx +1 -304
- package/bundled-docs/getting-started/headless-or-component.mdx +112 -0
- package/bundled-docs/getting-started/installation.mdx +11 -141
- package/bundled-docs/getting-started/overview.mdx +15 -55
- package/bundled-docs/getting-started/quick-start.mdx +4 -279
- package/bundled-docs/guides/browser-support-matrix.mdx +6 -17
- package/bundled-docs/guides/mcp-live-testing.mdx +0 -82
- package/bundled-docs/guides/mcp.mdx +4 -4
- package/bundled-docs/guides/migration-from-ag-grid.mdx +2 -3
- package/bundled-docs/guides/theming.mdx +50 -23
- package/dist/esm/index.js +9 -39
- package/package.json +5 -5
- package/bundled-docs/api/js-api.mdx +0 -198
- package/bundled-docs/getting-started/vanilla-js.mdx +0 -218
- package/bundled-docs/guides/framework-showcase.mdx +0 -246
|
@@ -14,7 +14,7 @@ Export grid data to a downloadable CSV file using the `exportToCsv` utility from
|
|
|
14
14
|
<CsvExportDemo />
|
|
15
15
|
|
|
16
16
|
:::tip Try it in your framework
|
|
17
|
-
The demo above uses Radix UI for styling. To see this feature with
|
|
17
|
+
The demo above uses Radix UI for styling. To see this feature with the Fluent UI implementation, click **"Open in online demo"** below the demo.
|
|
18
18
|
:::
|
|
19
19
|
|
|
20
20
|
## Quick Example
|
|
@@ -48,111 +48,8 @@ The `OGrid` component has the same props across all React UI packages. To switch
|
|
|
48
48
|
|
|
49
49
|
- **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
|
|
50
50
|
- **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` - wrap in `<FluentProvider>`
|
|
51
|
-
- **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` - wrap in `<ThemeProvider>`
|
|
52
51
|
:::
|
|
53
52
|
|
|
54
|
-
</TabItem>
|
|
55
|
-
<TabItem value="angular" label="Angular">
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
|
|
59
|
-
@Component({
|
|
60
|
-
standalone: true,
|
|
61
|
-
template: `<button (click)="handleExport()">Export to CSV</button>`
|
|
62
|
-
})
|
|
63
|
-
export class ExportButtonComponent {
|
|
64
|
-
data: Row[] = [];
|
|
65
|
-
columns: IColumnDef<Row>[] = [];
|
|
66
|
-
|
|
67
|
-
handleExport() {
|
|
68
|
-
exportToCsv(
|
|
69
|
-
this.data,
|
|
70
|
-
this.columns.map((col) => ({ columnId: col.columnId, name: col.name })),
|
|
71
|
-
(item: Row, columnId: string) => {
|
|
72
|
-
const col = this.columns.find((c) => c.columnId === columnId);
|
|
73
|
-
if (!col) return '';
|
|
74
|
-
const value = col.valueGetter ? col.valueGetter(item) : (item as Record<string, unknown>)[columnId];
|
|
75
|
-
return col.valueFormatter ? col.valueFormatter(value as unknown, item) : String(value ?? '');
|
|
76
|
-
},
|
|
77
|
-
'my-data.csv'
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
:::tip Switching UI libraries
|
|
84
|
-
Same component API across Angular packages. To switch, just change the import:
|
|
85
|
-
|
|
86
|
-
- **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
|
|
87
|
-
- **Angular Material**: `from '@alaarab/ogrid-angular-material'`
|
|
88
|
-
- **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
|
|
89
|
-
|
|
90
|
-
All components are standalone - no NgModule required.
|
|
91
|
-
:::
|
|
92
|
-
|
|
93
|
-
</TabItem>
|
|
94
|
-
<TabItem value="vue" label="Vue">
|
|
95
|
-
|
|
96
|
-
```vue
|
|
97
|
-
<script setup lang="ts">
|
|
98
|
-
|
|
99
|
-
const props = defineProps<{ data: Row[]; columns: IColumnDef<Row>[] }>();
|
|
100
|
-
|
|
101
|
-
function handleExport() {
|
|
102
|
-
exportToCsv(
|
|
103
|
-
props.data,
|
|
104
|
-
props.columns.map((col) => ({ columnId: col.columnId, name: col.name })),
|
|
105
|
-
(item, columnId) => {
|
|
106
|
-
const col = props.columns.find((c) => c.columnId === columnId);
|
|
107
|
-
if (!col) return '';
|
|
108
|
-
const value = col.valueGetter ? col.valueGetter(item) : (item as Record<string, unknown>)[columnId];
|
|
109
|
-
return col.valueFormatter ? col.valueFormatter(value, item) : String(value ?? '');
|
|
110
|
-
},
|
|
111
|
-
'my-data.csv'
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
</script>
|
|
115
|
-
|
|
116
|
-
<template>
|
|
117
|
-
<button @click="handleExport">Export to CSV</button>
|
|
118
|
-
</template>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
:::tip Switching UI libraries
|
|
122
|
-
Same component API across Vue packages. To switch, just change the import:
|
|
123
|
-
|
|
124
|
-
- **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
|
|
125
|
-
- **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` - wrap in `<v-app>` for theming
|
|
126
|
-
- **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
|
|
127
|
-
:::
|
|
128
|
-
|
|
129
|
-
</TabItem>
|
|
130
|
-
<TabItem value="js" label="Vanilla JS">
|
|
131
|
-
|
|
132
|
-
```js
|
|
133
|
-
|
|
134
|
-
const grid = new OGrid(document.getElementById('grid'), {
|
|
135
|
-
columns: columns,
|
|
136
|
-
data: data,
|
|
137
|
-
getRowId: (r) => r.id,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
// Export to CSV
|
|
141
|
-
document.getElementById('export-btn').addEventListener('click', () => {
|
|
142
|
-
exportToCsv(
|
|
143
|
-
data,
|
|
144
|
-
columns.map((col) => ({ columnId: col.columnId, name: col.name })),
|
|
145
|
-
(item, columnId) => {
|
|
146
|
-
const col = columns.find((c) => c.columnId === columnId);
|
|
147
|
-
if (!col) return '';
|
|
148
|
-
const value = item[columnId];
|
|
149
|
-
return col.valueFormatter ? col.valueFormatter(value, item) : String(value ?? '');
|
|
150
|
-
},
|
|
151
|
-
'my-data.csv'
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
```
|
|
155
|
-
|
|
156
53
|
</TabItem>
|
|
157
54
|
</Tabs>
|
|
158
55
|
|
|
@@ -83,157 +83,8 @@ Same props across all React packages — just change the import:
|
|
|
83
83
|
|
|
84
84
|
- **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
|
|
85
85
|
- **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` - wrap in `<FluentProvider>`
|
|
86
|
-
- **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` - wrap in `<ThemeProvider>`
|
|
87
86
|
:::
|
|
88
87
|
|
|
89
|
-
</TabItem>
|
|
90
|
-
<TabItem value="angular" label="Angular">
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
|
|
94
|
-
const DEPTS = ['Engineering', 'Marketing', 'Sales', 'Finance', 'Operations'];
|
|
95
|
-
const STATUSES = ['Active', 'Draft', 'Archived'];
|
|
96
|
-
|
|
97
|
-
@Component({
|
|
98
|
-
standalone: true,
|
|
99
|
-
imports: [OGridComponent],
|
|
100
|
-
template: `<ogrid [props]="gridProps" />`
|
|
101
|
-
})
|
|
102
|
-
export class GridComponent {
|
|
103
|
-
gridProps = {
|
|
104
|
-
columns: [
|
|
105
|
-
{ columnId: 'name', name: 'Name', editable: true },
|
|
106
|
-
{
|
|
107
|
-
columnId: 'department', name: 'Department', editable: true,
|
|
108
|
-
cellEditor: 'richSelect', cellEditorParams: { values: DEPTS },
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
columnId: 'status', name: 'Status', editable: true,
|
|
112
|
-
cellEditor: 'select', cellEditorParams: { values: STATUSES },
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
columnId: 'salary', name: 'Salary', editable: true, type: 'numeric',
|
|
116
|
-
valueParser: ({ newValue }: any) => {
|
|
117
|
-
const num = Number(newValue);
|
|
118
|
-
return isNaN(num) || num < 0 ? undefined : num;
|
|
119
|
-
},
|
|
120
|
-
valueFormatter: (v: unknown) => `$${Number(v).toLocaleString()}`,
|
|
121
|
-
},
|
|
122
|
-
] as IColumnDef<Person>[],
|
|
123
|
-
data: initialData,
|
|
124
|
-
getRowId: (item: Person) => item.id,
|
|
125
|
-
editable: true,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
:::tip Switching UI libraries
|
|
131
|
-
Same component API across Angular packages. Change the import:
|
|
132
|
-
|
|
133
|
-
- **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
|
|
134
|
-
- **Angular Material**: `from '@alaarab/ogrid-angular-material'`
|
|
135
|
-
- **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
|
|
136
|
-
|
|
137
|
-
All components are standalone — no NgModule required.
|
|
138
|
-
:::
|
|
139
|
-
|
|
140
|
-
</TabItem>
|
|
141
|
-
<TabItem value="vue" label="Vue">
|
|
142
|
-
|
|
143
|
-
```vue
|
|
144
|
-
<script setup lang="ts">
|
|
145
|
-
|
|
146
|
-
const DEPTS = ['Engineering', 'Marketing', 'Sales', 'Finance', 'Operations'];
|
|
147
|
-
const STATUSES = ['Active', 'Draft', 'Archived'];
|
|
148
|
-
|
|
149
|
-
const columns: IColumnDef<Person>[] = [
|
|
150
|
-
{ columnId: 'name', name: 'Name', editable: true },
|
|
151
|
-
{
|
|
152
|
-
columnId: 'department', name: 'Department', editable: true,
|
|
153
|
-
cellEditor: 'richSelect', cellEditorParams: { values: DEPTS },
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
columnId: 'status', name: 'Status', editable: true,
|
|
157
|
-
cellEditor: 'select', cellEditorParams: { values: STATUSES },
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
columnId: 'salary', name: 'Salary', editable: true, type: 'numeric',
|
|
161
|
-
valueParser: ({ newValue }) => {
|
|
162
|
-
const num = Number(newValue);
|
|
163
|
-
return isNaN(num) || num < 0 ? undefined : num;
|
|
164
|
-
},
|
|
165
|
-
valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
|
|
166
|
-
},
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
const gridProps = {
|
|
170
|
-
columns,
|
|
171
|
-
data: initialData,
|
|
172
|
-
getRowId: (item) => item.id,
|
|
173
|
-
editable: true,
|
|
174
|
-
};
|
|
175
|
-
</script>
|
|
176
|
-
|
|
177
|
-
<template>
|
|
178
|
-
<OGrid :gridProps="gridProps" />
|
|
179
|
-
</template>
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
:::tip Switching UI libraries
|
|
183
|
-
Same API across Vue packages. Change the import:
|
|
184
|
-
|
|
185
|
-
- **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
|
|
186
|
-
- **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` - wrap in `<v-app>` for theming
|
|
187
|
-
- **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
|
|
188
|
-
:::
|
|
189
|
-
|
|
190
|
-
</TabItem>
|
|
191
|
-
<TabItem value="js" label="Vanilla JS">
|
|
192
|
-
|
|
193
|
-
```js
|
|
194
|
-
|
|
195
|
-
const DEPTS = ['Engineering', 'Marketing', 'Sales', 'Finance', 'Operations'];
|
|
196
|
-
const STATUSES = ['Active', 'Draft', 'Archived'];
|
|
197
|
-
|
|
198
|
-
const grid = new OGrid(document.getElementById('grid'), {
|
|
199
|
-
columns: [
|
|
200
|
-
{ columnId: 'name', name: 'Name', editable: true },
|
|
201
|
-
{
|
|
202
|
-
columnId: 'department',
|
|
203
|
-
name: 'Department',
|
|
204
|
-
editable: true,
|
|
205
|
-
cellEditor: 'richSelect',
|
|
206
|
-
cellEditorParams: { values: DEPTS },
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
columnId: 'status',
|
|
210
|
-
name: 'Status',
|
|
211
|
-
editable: true,
|
|
212
|
-
cellEditor: 'select',
|
|
213
|
-
cellEditorParams: { values: STATUSES },
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
columnId: 'salary',
|
|
217
|
-
name: 'Salary',
|
|
218
|
-
editable: true,
|
|
219
|
-
type: 'numeric',
|
|
220
|
-
valueParser: ({ newValue }) => {
|
|
221
|
-
const num = Number(newValue);
|
|
222
|
-
return isNaN(num) || num < 0 ? undefined : num;
|
|
223
|
-
},
|
|
224
|
-
valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
|
|
225
|
-
},
|
|
226
|
-
],
|
|
227
|
-
data: initialData,
|
|
228
|
-
getRowId: (item) => item.id,
|
|
229
|
-
editable: true,
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
grid.on('cellValueChanged', (event) => {
|
|
233
|
-
console.log(`${event.columnId} changed to ${event.newValue}`);
|
|
234
|
-
});
|
|
235
|
-
```
|
|
236
|
-
|
|
237
88
|
</TabItem>
|
|
238
89
|
</Tabs>
|
|
239
90
|
|
|
@@ -65,127 +65,8 @@ Same props across all React packages — just change the import:
|
|
|
65
65
|
|
|
66
66
|
- **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
|
|
67
67
|
- **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` - wrap in `<FluentProvider>`
|
|
68
|
-
- **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` - wrap in `<ThemeProvider>`
|
|
69
68
|
:::
|
|
70
69
|
|
|
71
|
-
</TabItem>
|
|
72
|
-
<TabItem value="angular" label="Angular">
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
|
|
76
|
-
@Component({
|
|
77
|
-
standalone: true,
|
|
78
|
-
imports: [OGridComponent],
|
|
79
|
-
template: `<ogrid [props]="gridProps" />`
|
|
80
|
-
})
|
|
81
|
-
export class GridComponent {
|
|
82
|
-
gridProps = {
|
|
83
|
-
columns: [
|
|
84
|
-
{ columnId: 'name', name: 'Name', filterable: { type: 'text' } },
|
|
85
|
-
{
|
|
86
|
-
columnId: 'department', name: 'Department',
|
|
87
|
-
filterable: { type: 'multiSelect', filterField: 'department' },
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
columnId: 'status', name: 'Status',
|
|
91
|
-
filterable: { type: 'multiSelect', filterField: 'status' },
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
columnId: 'salary', name: 'Salary', type: 'numeric',
|
|
95
|
-
valueFormatter: (v: unknown) => `$${Number(v).toLocaleString()}`,
|
|
96
|
-
},
|
|
97
|
-
] as IColumnDef<Person>[],
|
|
98
|
-
data: people,
|
|
99
|
-
getRowId: (item: Person) => item.id,
|
|
100
|
-
defaultPageSize: 10,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
:::tip Switching UI libraries
|
|
106
|
-
Same API across Angular packages. Change the import:
|
|
107
|
-
|
|
108
|
-
- **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
|
|
109
|
-
- **Angular Material**: `from '@alaarab/ogrid-angular-material'`
|
|
110
|
-
- **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
|
|
111
|
-
|
|
112
|
-
All components are standalone — no NgModule required.
|
|
113
|
-
:::
|
|
114
|
-
|
|
115
|
-
</TabItem>
|
|
116
|
-
<TabItem value="vue" label="Vue">
|
|
117
|
-
|
|
118
|
-
```vue
|
|
119
|
-
<script setup lang="ts">
|
|
120
|
-
|
|
121
|
-
const columns: IColumnDef<Person>[] = [
|
|
122
|
-
{ columnId: 'name', name: 'Name', filterable: { type: 'text' } },
|
|
123
|
-
{
|
|
124
|
-
columnId: 'department', name: 'Department',
|
|
125
|
-
filterable: { type: 'multiSelect', filterField: 'department' },
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
columnId: 'status', name: 'Status',
|
|
129
|
-
filterable: { type: 'multiSelect', filterField: 'status' },
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
columnId: 'salary', name: 'Salary', type: 'numeric',
|
|
133
|
-
valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
const gridProps = {
|
|
138
|
-
columns,
|
|
139
|
-
data: people,
|
|
140
|
-
getRowId: (item) => item.id,
|
|
141
|
-
defaultPageSize: 10,
|
|
142
|
-
};
|
|
143
|
-
</script>
|
|
144
|
-
|
|
145
|
-
<template>
|
|
146
|
-
<OGrid :gridProps="gridProps" />
|
|
147
|
-
</template>
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
:::tip Switching UI libraries
|
|
151
|
-
Same API across Vue packages. Change the import:
|
|
152
|
-
|
|
153
|
-
- **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
|
|
154
|
-
- **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` - wrap in `<v-app>` for theming
|
|
155
|
-
- **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
|
|
156
|
-
:::
|
|
157
|
-
|
|
158
|
-
</TabItem>
|
|
159
|
-
<TabItem value="js" label="Vanilla JS">
|
|
160
|
-
|
|
161
|
-
```js
|
|
162
|
-
|
|
163
|
-
const grid = new OGrid(document.getElementById('grid'), {
|
|
164
|
-
columns: [
|
|
165
|
-
{ columnId: 'name', name: 'Name', filterable: { type: 'text' } },
|
|
166
|
-
{
|
|
167
|
-
columnId: 'department',
|
|
168
|
-
name: 'Department',
|
|
169
|
-
filterable: { type: 'multiSelect', filterField: 'department' },
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
columnId: 'status',
|
|
173
|
-
name: 'Status',
|
|
174
|
-
filterable: { type: 'multiSelect', filterField: 'status' },
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
columnId: 'salary',
|
|
178
|
-
name: 'Salary',
|
|
179
|
-
type: 'numeric',
|
|
180
|
-
valueFormatter: (v) => `$${Number(v).toLocaleString()}`,
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
data: people,
|
|
184
|
-
getRowId: (item) => item.id,
|
|
185
|
-
pageSize: 10,
|
|
186
|
-
});
|
|
187
|
-
```
|
|
188
|
-
|
|
189
70
|
</TabItem>
|
|
190
71
|
</Tabs>
|
|
191
72
|
|
|
@@ -15,8 +15,8 @@ The engine adds ~12KB gzipped and is completely **tree-shakeable** — grids wit
|
|
|
15
15
|
|
|
16
16
|
<FormulasDemo />
|
|
17
17
|
|
|
18
|
-
:::tip Try it
|
|
19
|
-
The demo uses Radix UI styling. The formula engine itself is
|
|
18
|
+
:::tip Try it with Fluent UI
|
|
19
|
+
The demo uses Radix UI styling. The formula engine itself is UI-agnostic — identical behavior in `@alaarab/ogrid-react-radix` and `@alaarab/ogrid-react-fluent`.
|
|
20
20
|
:::
|
|
21
21
|
|
|
22
22
|
## Why bother with in-grid formulas?
|
|
@@ -67,108 +67,8 @@ Same props across all React packages — just change the import:
|
|
|
67
67
|
|
|
68
68
|
- **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
|
|
69
69
|
- **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` - wrap in `<FluentProvider>`
|
|
70
|
-
- **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` - wrap in `<ThemeProvider>`
|
|
71
70
|
:::
|
|
72
71
|
|
|
73
|
-
</TabItem>
|
|
74
|
-
<TabItem value="angular" label="Angular">
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
|
|
78
|
-
@Component({
|
|
79
|
-
standalone: true,
|
|
80
|
-
imports: [OGridComponent],
|
|
81
|
-
providers: [FormulaEngineService],
|
|
82
|
-
template: `<ogrid [props]="gridProps" />`
|
|
83
|
-
})
|
|
84
|
-
export class FormulaGridComponent {
|
|
85
|
-
constructor(private formulaEngine: FormulaEngineService<Row>) {
|
|
86
|
-
this.formulaEngine.configure({ formulas: true });
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
gridProps = {
|
|
90
|
-
columns: [
|
|
91
|
-
{ columnId: 'a', name: 'A', type: 'numeric', editable: true },
|
|
92
|
-
{ columnId: 'b', name: 'B', type: 'numeric', editable: true },
|
|
93
|
-
{ columnId: 'c', name: 'C', type: 'numeric', editable: true },
|
|
94
|
-
] as IColumnDef<Row>[],
|
|
95
|
-
data: initialData,
|
|
96
|
-
getRowId: (r: Row) => r.id,
|
|
97
|
-
editable: true,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
:::tip Switching UI libraries
|
|
103
|
-
Same API across Angular packages. Change the import:
|
|
104
|
-
|
|
105
|
-
- **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
|
|
106
|
-
- **Angular Material**: `from '@alaarab/ogrid-angular-material'`
|
|
107
|
-
- **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
|
|
108
|
-
|
|
109
|
-
All components are standalone — no NgModule required.
|
|
110
|
-
:::
|
|
111
|
-
|
|
112
|
-
</TabItem>
|
|
113
|
-
<TabItem value="vue" label="Vue">
|
|
114
|
-
|
|
115
|
-
```vue
|
|
116
|
-
<script setup lang="ts">
|
|
117
|
-
|
|
118
|
-
const columns: IColumnDef<Row>[] = [
|
|
119
|
-
{ columnId: 'a', name: 'A', type: 'numeric', editable: true },
|
|
120
|
-
{ columnId: 'b', name: 'B', type: 'numeric', editable: true },
|
|
121
|
-
{ columnId: 'c', name: 'C', type: 'numeric', editable: true },
|
|
122
|
-
];
|
|
123
|
-
|
|
124
|
-
const data = ref(initialData);
|
|
125
|
-
const formulas = ref(true);
|
|
126
|
-
const items = ref(data.value);
|
|
127
|
-
const flatColumns = ref(columns);
|
|
128
|
-
|
|
129
|
-
const formulaEngine = useFormulaEngine({
|
|
130
|
-
formulas,
|
|
131
|
-
items,
|
|
132
|
-
flatColumns,
|
|
133
|
-
initialFormulas: [
|
|
134
|
-
{ col: 2, row: 0, formula: '=A1+B1' },
|
|
135
|
-
],
|
|
136
|
-
});
|
|
137
|
-
</script>
|
|
138
|
-
|
|
139
|
-
<template>
|
|
140
|
-
<OGrid :columns="columns" :data="data" :getRowId="(r) => r.id" editable />
|
|
141
|
-
</template>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
:::tip Switching UI libraries
|
|
145
|
-
Same API across Vue packages. Change the import:
|
|
146
|
-
|
|
147
|
-
- **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
|
|
148
|
-
- **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` - wrap in `<v-app>` for theming
|
|
149
|
-
- **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
|
|
150
|
-
:::
|
|
151
|
-
|
|
152
|
-
</TabItem>
|
|
153
|
-
<TabItem value="js" label="Vanilla JS">
|
|
154
|
-
|
|
155
|
-
```js
|
|
156
|
-
|
|
157
|
-
const grid = new OGrid(document.getElementById('grid'), {
|
|
158
|
-
columns: [
|
|
159
|
-
{ columnId: 'a', name: 'A', type: 'numeric', editable: true },
|
|
160
|
-
{ columnId: 'b', name: 'B', type: 'numeric', editable: true },
|
|
161
|
-
{ columnId: 'c', name: 'C', type: 'numeric', editable: true },
|
|
162
|
-
],
|
|
163
|
-
data: initialData,
|
|
164
|
-
getRowId: (r) => r.id,
|
|
165
|
-
editable: true,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
const formulaState = new FormulaEngineState({ formulas: true });
|
|
169
|
-
formulaState.setFormula(2, 0, '=A1+B1', grid.getApi().getDataAccessor());
|
|
170
|
-
```
|
|
171
|
-
|
|
172
72
|
</TabItem>
|
|
173
73
|
</Tabs>
|
|
174
74
|
|
|
@@ -14,7 +14,7 @@ The `IOGridApi` ref gives you imperative control over the grid: set data, manage
|
|
|
14
14
|
<GridApiDemo />
|
|
15
15
|
|
|
16
16
|
:::tip Try it in your framework
|
|
17
|
-
The demo above uses Radix UI for styling. To see this feature with
|
|
17
|
+
The demo above uses Radix UI for styling. To see this feature with the Fluent UI implementation, click **"Open in online demo"** below the demo.
|
|
18
18
|
:::
|
|
19
19
|
|
|
20
20
|
## Quick Example
|
|
@@ -60,115 +60,8 @@ The `OGrid` component has the same props across all React UI packages. To switch
|
|
|
60
60
|
|
|
61
61
|
- **Radix** (lightweight, default): `from '@alaarab/ogrid-react-radix'`
|
|
62
62
|
- **Fluent UI** (Microsoft 365 / SPFx): `from '@alaarab/ogrid-react-fluent'` - wrap in `<FluentProvider>`
|
|
63
|
-
- **Material UI** (MUI v7): `from '@alaarab/ogrid-react-material'` - wrap in `<ThemeProvider>`
|
|
64
63
|
:::
|
|
65
64
|
|
|
66
|
-
</TabItem>
|
|
67
|
-
<TabItem value="angular" label="Angular">
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
|
|
71
|
-
interface Row {
|
|
72
|
-
id: number;
|
|
73
|
-
name: string;
|
|
74
|
-
department: string;
|
|
75
|
-
salary: number;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@Component({
|
|
79
|
-
standalone: true,
|
|
80
|
-
imports: [OGridComponent],
|
|
81
|
-
template: `
|
|
82
|
-
<button (click)="handleRefresh()">Refresh</button>
|
|
83
|
-
<ogrid [props]="gridProps" />
|
|
84
|
-
`
|
|
85
|
-
})
|
|
86
|
-
export class GridComponent {
|
|
87
|
-
gridProps = {
|
|
88
|
-
columns: columns,
|
|
89
|
-
data: initialData,
|
|
90
|
-
getRowId: (r: Row) => r.id,
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
async handleRefresh() {
|
|
94
|
-
// Use the grid API via ViewChild or service
|
|
95
|
-
const data = await fetchEmployees();
|
|
96
|
-
this.gridProps = { ...this.gridProps, data };
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
:::tip Switching UI libraries
|
|
102
|
-
Same component API across Angular packages. To switch, just change the import:
|
|
103
|
-
|
|
104
|
-
- **Radix (CDK)**: `from '@alaarab/ogrid-angular-radix'` *(default, lightweight)*
|
|
105
|
-
- **Angular Material**: `from '@alaarab/ogrid-angular-material'`
|
|
106
|
-
- **PrimeNG**: `from '@alaarab/ogrid-angular-primeng'`
|
|
107
|
-
|
|
108
|
-
All components are standalone - no NgModule required.
|
|
109
|
-
:::
|
|
110
|
-
|
|
111
|
-
</TabItem>
|
|
112
|
-
<TabItem value="vue" label="Vue">
|
|
113
|
-
|
|
114
|
-
```vue
|
|
115
|
-
<script setup lang="ts">
|
|
116
|
-
|
|
117
|
-
interface Row {
|
|
118
|
-
id: number;
|
|
119
|
-
name: string;
|
|
120
|
-
department: string;
|
|
121
|
-
salary: number;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const data = ref<Row[]>(initialData);
|
|
125
|
-
|
|
126
|
-
const gridProps = {
|
|
127
|
-
columns,
|
|
128
|
-
data: data.value,
|
|
129
|
-
getRowId: (r: Row) => r.id,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
async function handleRefresh() {
|
|
133
|
-
const fresh = await fetchEmployees();
|
|
134
|
-
data.value = fresh;
|
|
135
|
-
}
|
|
136
|
-
</script>
|
|
137
|
-
|
|
138
|
-
<template>
|
|
139
|
-
<button @click="handleRefresh">Refresh</button>
|
|
140
|
-
<OGrid :gridProps="gridProps" />
|
|
141
|
-
</template>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
:::tip Switching UI libraries
|
|
145
|
-
Same component API across Vue packages. To switch, just change the import:
|
|
146
|
-
|
|
147
|
-
- **Radix (Headless UI)**: `from '@alaarab/ogrid-vue-radix'` *(default, lightweight)*
|
|
148
|
-
- **Vuetify**: `from '@alaarab/ogrid-vue-vuetify'` - wrap in `<v-app>` for theming
|
|
149
|
-
- **PrimeVue**: `from '@alaarab/ogrid-vue-primevue'`
|
|
150
|
-
:::
|
|
151
|
-
|
|
152
|
-
</TabItem>
|
|
153
|
-
<TabItem value="js" label="Vanilla JS">
|
|
154
|
-
|
|
155
|
-
```js
|
|
156
|
-
|
|
157
|
-
const grid = new OGrid(document.getElementById('grid'), {
|
|
158
|
-
columns: columns,
|
|
159
|
-
data: initialData,
|
|
160
|
-
getRowId: (r) => r.id,
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
// Use the grid API directly
|
|
164
|
-
async function handleRefresh() {
|
|
165
|
-
grid.api.setLoading(true);
|
|
166
|
-
const data = await fetchEmployees();
|
|
167
|
-
grid.api.setRowData(data);
|
|
168
|
-
grid.api.setLoading(false);
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
65
|
</TabItem>
|
|
173
66
|
</Tabs>
|
|
174
67
|
|