@arbor-education/design-system.components 1.0.0 → 1.0.2
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/.github/workflows/release.yml +3 -1
- package/.storybook/main.ts +12 -6
- package/CHANGELOG.md +12 -0
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/Table.js +2 -1
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/table/Table.stories.d.ts.map +1 -1
- package/dist/components/table/Table.stories.js +24 -70
- package/dist/components/table/Table.stories.js.map +1 -1
- package/dist/components/table/cellEditors/DateCellEditor.stories.d.ts.map +1 -1
- package/dist/components/table/cellEditors/DateCellEditor.stories.js +16 -13
- package/dist/components/table/cellEditors/DateCellEditor.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.js +6 -7
- package/dist/components/table/cellRenderers/BooleanCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.js +7 -8
- package/dist/components/table/cellRenderers/ButtonCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.js +7 -8
- package/dist/components/table/cellRenderers/CheckboxCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.js +7 -8
- package/dist/components/table/cellRenderers/InlineTextCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.js +12 -15
- package/dist/components/table/cellRenderers/NumberInputCellRenderer.stories.js.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js +19 -29
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.stories.js.map +1 -1
- package/dist/components/table/columnTypes.d.ts +3 -0
- package/dist/components/table/columnTypes.d.ts.map +1 -0
- package/dist/components/table/columnTypes.js +55 -0
- package/dist/components/table/columnTypes.js.map +1 -0
- package/dist/components/toggleGroup/ToggleGroup.stories.js +1 -1
- package/dist/components/toggleGroup/ToggleGroup.stories.js.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/package.json +10 -11
- package/src/components/dropdown/dropdown.scss +6 -0
- package/src/components/table/Table.stories.tsx +24 -73
- package/src/components/table/Table.tsx +2 -0
- package/src/components/table/cellEditors/DateCellEditor.stories.tsx +16 -14
- package/src/components/table/cellRenderers/BooleanCellRenderer.stories.tsx +6 -7
- package/src/components/table/cellRenderers/ButtonCellRenderer.stories.tsx +7 -8
- package/src/components/table/cellRenderers/CheckboxCellRenderer.stories.tsx +7 -8
- package/src/components/table/cellRenderers/InlineTextCellRenderer.stories.tsx +7 -8
- package/src/components/table/cellRenderers/NumberInputCellRenderer.stories.tsx +12 -15
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.stories.tsx +19 -29
- package/src/components/table/columnTypes.ts +56 -0
- package/src/components/toggleGroup/ToggleGroup.stories.tsx +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
-
import { fn } from '
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
3
|
import {
|
|
4
4
|
Controls,
|
|
5
5
|
Heading as DocHeading,
|
|
@@ -503,7 +503,7 @@ const sampleColumnDefs: (ColDef | ColGroupDef)[] = [
|
|
|
503
503
|
{
|
|
504
504
|
field: 'marks',
|
|
505
505
|
cellDataType: 'number',
|
|
506
|
-
|
|
506
|
+
type: 'dsNumberColumn',
|
|
507
507
|
cellEditorParams: {
|
|
508
508
|
min: 0,
|
|
509
509
|
max: 100,
|
|
@@ -1042,11 +1042,7 @@ const sampleColumnDefsWithButtonCellRenderer: (ColDef | ColGroupDef)[] = [
|
|
|
1042
1042
|
{
|
|
1043
1043
|
field: 'name',
|
|
1044
1044
|
headerTooltip: 'The name of the user',
|
|
1045
|
-
|
|
1046
|
-
cellRendererParams: {
|
|
1047
|
-
suppressCellFocusAndFocusFirstElement: true,
|
|
1048
|
-
},
|
|
1049
|
-
editable: false,
|
|
1045
|
+
type: 'dsButtonColumn',
|
|
1050
1046
|
},
|
|
1051
1047
|
{
|
|
1052
1048
|
field: 'email',
|
|
@@ -1370,13 +1366,7 @@ export const WithInlineTextCellRenderer: Story = {
|
|
|
1370
1366
|
columnDefs: [
|
|
1371
1367
|
{
|
|
1372
1368
|
field: 'name',
|
|
1373
|
-
|
|
1374
|
-
cellRendererParams: {
|
|
1375
|
-
suppressCellFocusAndFocusFirstElement: true,
|
|
1376
|
-
suppressCount: true,
|
|
1377
|
-
suppressDoubleClickExpand: true,
|
|
1378
|
-
suppressEnterExpand: true,
|
|
1379
|
-
},
|
|
1369
|
+
type: 'dsInlineTextColumn',
|
|
1380
1370
|
},
|
|
1381
1371
|
],
|
|
1382
1372
|
defaultColDef,
|
|
@@ -1572,7 +1562,7 @@ const marksheetTidyTableColumnDefs: (ColDef | ColGroupDef)[] = [
|
|
|
1572
1562
|
{
|
|
1573
1563
|
headerName: 'Assessment Component',
|
|
1574
1564
|
field: 'assessmentComponent',
|
|
1575
|
-
|
|
1565
|
+
type: 'dsComboboxColumn',
|
|
1576
1566
|
cellRendererParams: (params: CustomCellRendererProps) => {
|
|
1577
1567
|
return {
|
|
1578
1568
|
options: assessmentComponentOptions,
|
|
@@ -1580,16 +1570,12 @@ const marksheetTidyTableColumnDefs: (ColDef | ColGroupDef)[] = [
|
|
|
1580
1570
|
hasError: params.node.data.assessmentComponent === 'comp-maths',
|
|
1581
1571
|
};
|
|
1582
1572
|
},
|
|
1583
|
-
editable: false,
|
|
1584
|
-
...Table.ComboboxCellRenderer.colDefDefaults,
|
|
1585
1573
|
},
|
|
1586
1574
|
{
|
|
1587
1575
|
headerName: 'Visibility',
|
|
1588
1576
|
field: 'visibility',
|
|
1589
|
-
|
|
1577
|
+
type: 'dsComboboxColumn',
|
|
1590
1578
|
cellRendererParams: { options: visibilityOptions, placeholder: 'Select' },
|
|
1591
|
-
editable: false,
|
|
1592
|
-
...Table.ComboboxCellRenderer.colDefDefaults,
|
|
1593
1579
|
},
|
|
1594
1580
|
{
|
|
1595
1581
|
headerName: 'Editable',
|
|
@@ -1973,29 +1959,17 @@ const dateEditorColDefs: (ColDef | ColGroupDef)[] = [
|
|
|
1973
1959
|
{
|
|
1974
1960
|
field: 'dateOfBirth',
|
|
1975
1961
|
headerName: 'Date of Birth',
|
|
1976
|
-
|
|
1977
|
-
valueFormatter: params =>
|
|
1978
|
-
params.value instanceof Date
|
|
1979
|
-
? params.value.toLocaleDateString('en-GB')
|
|
1980
|
-
: params.value ?? '',
|
|
1962
|
+
type: 'dsDateColumn',
|
|
1981
1963
|
},
|
|
1982
1964
|
{
|
|
1983
1965
|
field: 'enrollmentDate',
|
|
1984
1966
|
headerName: 'Enrollment Date',
|
|
1985
|
-
|
|
1986
|
-
valueFormatter: params =>
|
|
1987
|
-
params.value instanceof Date
|
|
1988
|
-
? params.value.toLocaleDateString('en-GB')
|
|
1989
|
-
: params.value ?? '',
|
|
1967
|
+
type: 'dsDateColumn',
|
|
1990
1968
|
},
|
|
1991
1969
|
{
|
|
1992
1970
|
field: 'graduationDate',
|
|
1993
1971
|
headerName: 'Graduation Date',
|
|
1994
|
-
|
|
1995
|
-
valueFormatter: params =>
|
|
1996
|
-
params.value instanceof Date
|
|
1997
|
-
? params.value.toLocaleDateString('en-GB')
|
|
1998
|
-
: params.value ?? '',
|
|
1972
|
+
type: 'dsDateColumn',
|
|
1999
1973
|
},
|
|
2000
1974
|
];
|
|
2001
1975
|
|
|
@@ -2039,14 +2013,12 @@ const booleanCellRendererColumnDefs: ColDef<BooleanRowData>[] = [
|
|
|
2039
2013
|
{
|
|
2040
2014
|
field: 'hasPet',
|
|
2041
2015
|
headerName: 'Has Pet',
|
|
2042
|
-
|
|
2043
|
-
editable: false,
|
|
2016
|
+
type: 'dsBooleanColumn',
|
|
2044
2017
|
},
|
|
2045
2018
|
{
|
|
2046
2019
|
field: 'isEnrolled',
|
|
2047
2020
|
headerName: 'Is Enrolled',
|
|
2048
|
-
|
|
2049
|
-
editable: false,
|
|
2021
|
+
type: 'dsBooleanColumn',
|
|
2050
2022
|
},
|
|
2051
2023
|
];
|
|
2052
2024
|
|
|
@@ -2129,20 +2101,12 @@ const checkboxColumnDefs: ColDef[] = [
|
|
|
2129
2101
|
{
|
|
2130
2102
|
field: 'attended',
|
|
2131
2103
|
headerName: 'Attended',
|
|
2132
|
-
|
|
2133
|
-
cellRendererParams: {
|
|
2134
|
-
suppressCellFocusAndFocusFirstElement: true,
|
|
2135
|
-
},
|
|
2136
|
-
editable: false,
|
|
2104
|
+
type: 'dsCheckboxColumn',
|
|
2137
2105
|
},
|
|
2138
2106
|
{
|
|
2139
2107
|
field: 'consented',
|
|
2140
2108
|
headerName: 'Consented',
|
|
2141
|
-
|
|
2142
|
-
cellRendererParams: {
|
|
2143
|
-
suppressCellFocusAndFocusFirstElement: true,
|
|
2144
|
-
},
|
|
2145
|
-
editable: false,
|
|
2109
|
+
type: 'dsCheckboxColumn',
|
|
2146
2110
|
},
|
|
2147
2111
|
];
|
|
2148
2112
|
|
|
@@ -2273,23 +2237,20 @@ const selectDropdownColDefs: (ColDef | ColGroupDef)[] = [
|
|
|
2273
2237
|
{
|
|
2274
2238
|
field: 'status',
|
|
2275
2239
|
headerName: 'Status',
|
|
2276
|
-
|
|
2240
|
+
type: 'dsSelectDropdownColumn',
|
|
2277
2241
|
cellRendererParams: { options: statusOptions, placeholder: 'Select status' },
|
|
2278
|
-
editable: false,
|
|
2279
2242
|
},
|
|
2280
2243
|
{
|
|
2281
2244
|
field: 'priority',
|
|
2282
2245
|
headerName: 'Priority',
|
|
2283
|
-
|
|
2246
|
+
type: 'dsSelectDropdownColumn',
|
|
2284
2247
|
cellRendererParams: { options: priorityOptions, placeholder: 'Select priority' },
|
|
2285
|
-
editable: false,
|
|
2286
2248
|
},
|
|
2287
2249
|
{
|
|
2288
2250
|
field: 'category',
|
|
2289
2251
|
headerName: 'Category',
|
|
2290
|
-
|
|
2252
|
+
type: 'dsSelectDropdownColumn',
|
|
2291
2253
|
cellRendererParams: { options: categoryOptions, placeholder: 'Select category' },
|
|
2292
|
-
editable: false,
|
|
2293
2254
|
},
|
|
2294
2255
|
];
|
|
2295
2256
|
|
|
@@ -2361,34 +2322,26 @@ const comboboxColDefs: (ColDef | ColGroupDef)[] = [
|
|
|
2361
2322
|
{
|
|
2362
2323
|
field: 'subject',
|
|
2363
2324
|
headerName: 'Subject (single, input)',
|
|
2364
|
-
|
|
2325
|
+
type: 'dsComboboxColumn',
|
|
2365
2326
|
cellRendererParams: { options: subjectOptions, placeholder: 'Select subject' },
|
|
2366
|
-
editable: false,
|
|
2367
|
-
...Table.ComboboxCellRenderer.colDefDefaults,
|
|
2368
2327
|
},
|
|
2369
2328
|
{
|
|
2370
2329
|
field: 'level',
|
|
2371
2330
|
headerName: 'Level (single, button)',
|
|
2372
|
-
|
|
2331
|
+
type: 'dsComboboxColumn',
|
|
2373
2332
|
cellRendererParams: { options: levelOptions, placeholder: 'Select level', triggerVariant: 'button' },
|
|
2374
|
-
editable: false,
|
|
2375
|
-
...Table.ComboboxCellRenderer.colDefDefaults,
|
|
2376
2333
|
},
|
|
2377
2334
|
{
|
|
2378
2335
|
field: 'tags',
|
|
2379
2336
|
headerName: 'Tags (multi, button)',
|
|
2380
|
-
|
|
2337
|
+
type: 'dsComboboxColumn',
|
|
2381
2338
|
cellRendererParams: { options: tagOptions, placeholder: 'Select tags', multiple: true, triggerVariant: 'button' },
|
|
2382
|
-
editable: false,
|
|
2383
|
-
...Table.ComboboxCellRenderer.colDefDefaults,
|
|
2384
2339
|
},
|
|
2385
2340
|
{
|
|
2386
2341
|
field: 'skills',
|
|
2387
2342
|
headerName: 'Skills (multi, input)',
|
|
2388
|
-
|
|
2343
|
+
type: 'dsComboboxColumn',
|
|
2389
2344
|
cellRendererParams: { options: skillOptions, placeholder: 'Select skills', multiple: true },
|
|
2390
|
-
editable: false,
|
|
2391
|
-
...Table.ComboboxCellRenderer.colDefDefaults,
|
|
2392
2345
|
},
|
|
2393
2346
|
];
|
|
2394
2347
|
|
|
@@ -2422,17 +2375,15 @@ const numberInputColDefs: (ColDef | ColGroupDef)[] = [
|
|
|
2422
2375
|
field: 'sessions',
|
|
2423
2376
|
headerName: 'Sessions',
|
|
2424
2377
|
flex: 1,
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
cellRendererParams: { min: 0, suppressCellFocusAndFocusFirstElement: true },
|
|
2378
|
+
type: 'dsNumberInputColumn',
|
|
2379
|
+
cellRendererParams: { min: 0 },
|
|
2428
2380
|
},
|
|
2429
2381
|
{
|
|
2430
2382
|
field: 'score',
|
|
2431
2383
|
headerName: 'Score (/100)',
|
|
2432
2384
|
flex: 1,
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
cellRendererParams: { min: 0, max: 100, suppressCellFocusAndFocusFirstElement: true },
|
|
2385
|
+
type: 'dsNumberInputColumn',
|
|
2386
|
+
cellRendererParams: { min: 0, max: 100 },
|
|
2436
2387
|
},
|
|
2437
2388
|
];
|
|
2438
2389
|
|
|
@@ -36,6 +36,7 @@ import { CheckboxCellRenderer } from './cellRenderers/CheckboxCellRenderer.js';
|
|
|
36
36
|
import { ComboboxCellRenderer } from './cellRenderers/ComboboxCellRenderer.js';
|
|
37
37
|
import { DefaultCellRenderer } from './cellRenderers/DefaultCellRenderer.js';
|
|
38
38
|
import { NumberInputCellRenderer } from './cellRenderers/NumberInputCellRenderer.js';
|
|
39
|
+
import { columnTypes } from './columnTypes.js';
|
|
39
40
|
|
|
40
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
42
|
type TableProps<TData = any> = {
|
|
@@ -214,6 +215,7 @@ export const Table = (props: TableProps) => {
|
|
|
214
215
|
dsNumberInputCellRenderer: NumberInputCellRenderer,
|
|
215
216
|
...components,
|
|
216
217
|
}}
|
|
218
|
+
columnTypes={columnTypes}
|
|
217
219
|
{...rest}
|
|
218
220
|
{...(hasSearch && { quickFilterText: searchValue })}
|
|
219
221
|
/>
|
|
@@ -21,7 +21,9 @@ const DESCRIPTION_INTRO = [
|
|
|
21
21
|
'`DateCellEditor` is an AG Grid cell editor component that renders an Arbor `DatePicker` inside a table cell.',
|
|
22
22
|
'It is invoked when a user begins editing a date column (e.g. by pressing Enter or double-clicking the cell).',
|
|
23
23
|
'',
|
|
24
|
-
'Register it via
|
|
24
|
+
'Register it via `type: \'dsDateColumn\'` on the column definition (pre-registered by Arbor\'s `Table`,',
|
|
25
|
+
'and also applies a `valueFormatter` that renders `Date` values as `en-GB` strings), or via the AG Grid',
|
|
26
|
+
'`cellEditor` column definition property directly.',
|
|
25
27
|
].join('\n');
|
|
26
28
|
|
|
27
29
|
const USAGE_GUIDANCE = [
|
|
@@ -35,12 +37,22 @@ const USAGE_GUIDANCE = [
|
|
|
35
37
|
'### Registration',
|
|
36
38
|
'',
|
|
37
39
|
'```tsx',
|
|
40
|
+
'const colDefs = [',
|
|
41
|
+
' {',
|
|
42
|
+
" field: 'dob',",
|
|
43
|
+
" headerName: 'Date of birth',",
|
|
44
|
+
" type: 'dsDateColumn', // preferred — pre-registered on Arbor's Table",
|
|
45
|
+
' },',
|
|
46
|
+
'];',
|
|
47
|
+
'',
|
|
48
|
+
'// or register the editor directly:',
|
|
38
49
|
"import { DateCellEditor } from '@arbor-education/design-system.components';",
|
|
39
50
|
'',
|
|
40
51
|
'const colDefs = [',
|
|
41
52
|
' {',
|
|
42
53
|
" field: 'dob',",
|
|
43
54
|
" headerName: 'Date of birth',",
|
|
55
|
+
' editable: true,',
|
|
44
56
|
' cellEditor: DateCellEditor,',
|
|
45
57
|
' // or via string key:',
|
|
46
58
|
" cellEditor: 'dsDateCellEditor',",
|
|
@@ -200,12 +212,7 @@ function DateCellEditorExample() {
|
|
|
200
212
|
field: 'dateOfBirth',
|
|
201
213
|
headerName: 'Date of birth',
|
|
202
214
|
flex: 1,
|
|
203
|
-
|
|
204
|
-
cellEditor: 'dsDateCellEditor',
|
|
205
|
-
valueFormatter: (params) =>
|
|
206
|
-
params.value instanceof Date
|
|
207
|
-
? params.value.toLocaleDateString('en-GB')
|
|
208
|
-
: params.value,
|
|
215
|
+
type: 'dsDateColumn',
|
|
209
216
|
},
|
|
210
217
|
]}
|
|
211
218
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -228,12 +235,7 @@ export default DateCellEditorExample;
|
|
|
228
235
|
field: 'dateOfBirth',
|
|
229
236
|
headerName: 'Date of birth',
|
|
230
237
|
flex: 1,
|
|
231
|
-
|
|
232
|
-
cellEditor: 'dsDateCellEditor',
|
|
233
|
-
valueFormatter: params =>
|
|
234
|
-
params.value instanceof Date
|
|
235
|
-
? params.value.toLocaleDateString('en-GB')
|
|
236
|
-
: params.value,
|
|
238
|
+
type: 'dsDateColumn',
|
|
237
239
|
},
|
|
238
240
|
]}
|
|
239
241
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -241,5 +243,5 @@ export default DateCellEditorExample;
|
|
|
241
243
|
/>
|
|
242
244
|
),
|
|
243
245
|
},
|
|
244
|
-
'`
|
|
246
|
+
'`type: \'dsDateColumn\'` wired up inside a full `Table`. Double-click (or press F2/Enter) on a Date of birth cell to open the `DatePicker` editor — AG Grid mounts the editor component and passes the current cell value as `value`. The column type\'s `valueFormatter` formats the stored `Date` object as a localised string for display.',
|
|
245
247
|
);
|
|
@@ -21,7 +21,8 @@ const DESCRIPTION_INTRO = [
|
|
|
21
21
|
'A `true` value renders a green check icon; a `false` value renders a red ✕ icon;',
|
|
22
22
|
'any other value (including `null` and `undefined`) renders nothing.',
|
|
23
23
|
'',
|
|
24
|
-
'Register it via the
|
|
24
|
+
'Register it via `type: \'dsBooleanColumn\'` on the column definition (pre-registered by Arbor\'s `Table`),',
|
|
25
|
+
'via the string key `dsBooleanCellRenderer`, or by importing the component directly.',
|
|
25
26
|
].join('\n');
|
|
26
27
|
|
|
27
28
|
const USAGE_GUIDANCE = [
|
|
@@ -55,7 +56,7 @@ const DEVELOPER_NOTES = [
|
|
|
55
56
|
' {',
|
|
56
57
|
" field: 'isActive',",
|
|
57
58
|
" headerName: 'Active',",
|
|
58
|
-
"
|
|
59
|
+
" type: 'dsBooleanColumn', // pre-registered column type — no import needed",
|
|
59
60
|
' },',
|
|
60
61
|
'];',
|
|
61
62
|
'```',
|
|
@@ -241,8 +242,7 @@ function BooleanCellRendererExample() {
|
|
|
241
242
|
field: 'active',
|
|
242
243
|
headerName: 'Active',
|
|
243
244
|
flex: 1,
|
|
244
|
-
|
|
245
|
-
cellRenderer: 'dsBooleanCellRenderer',
|
|
245
|
+
type: 'dsBooleanColumn',
|
|
246
246
|
},
|
|
247
247
|
]}
|
|
248
248
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -265,8 +265,7 @@ export default BooleanCellRendererExample;
|
|
|
265
265
|
field: 'active',
|
|
266
266
|
headerName: 'Active',
|
|
267
267
|
flex: 1,
|
|
268
|
-
|
|
269
|
-
cellRenderer: 'dsBooleanCellRenderer',
|
|
268
|
+
type: 'dsBooleanColumn',
|
|
270
269
|
},
|
|
271
270
|
]}
|
|
272
271
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -274,5 +273,5 @@ export default BooleanCellRendererExample;
|
|
|
274
273
|
/>
|
|
275
274
|
),
|
|
276
275
|
},
|
|
277
|
-
'`
|
|
276
|
+
'`type: \'dsBooleanColumn\'` wired up inside a full `Table`. `true` renders a check, `false` renders a ✕, and `null` leaves the cell empty. The column type sets `editable: false` — this renderer is display-only.',
|
|
278
277
|
);
|
|
@@ -21,7 +21,8 @@ const DESCRIPTION_INTRO = [
|
|
|
21
21
|
'The cell `value` (or `valueFormatted`) must be a `ButtonProps` object — the renderer spreads it',
|
|
22
22
|
'directly onto `Button`, so all button variants, sizes, and handlers are supported.',
|
|
23
23
|
'',
|
|
24
|
-
'Register it via the
|
|
24
|
+
'Register it via `type: \'dsButtonColumn\'` on the column definition (pre-registered by Arbor\'s `Table`),',
|
|
25
|
+
'via the string key `dsButtonCellRenderer`, or by importing the component directly.',
|
|
25
26
|
].join('\n');
|
|
26
27
|
|
|
27
28
|
const USAGE_GUIDANCE = [
|
|
@@ -56,7 +57,7 @@ const DEVELOPER_NOTES = [
|
|
|
56
57
|
' {',
|
|
57
58
|
" colId: 'viewAction',",
|
|
58
59
|
" headerName: '',",
|
|
59
|
-
"
|
|
60
|
+
" type: 'dsButtonColumn',",
|
|
60
61
|
' valueGetter: (params) => ({',
|
|
61
62
|
" children: 'View',",
|
|
62
63
|
" variant: 'secondary',",
|
|
@@ -199,7 +200,7 @@ const colDefs = [
|
|
|
199
200
|
{
|
|
200
201
|
colId: 'action',
|
|
201
202
|
headerName: '',
|
|
202
|
-
|
|
203
|
+
type: 'dsButtonColumn',
|
|
203
204
|
valueGetter: (params) => ({
|
|
204
205
|
children: 'Enrol',
|
|
205
206
|
variant: 'primary',
|
|
@@ -282,8 +283,7 @@ function ButtonCellRendererExample() {
|
|
|
282
283
|
headerName: '',
|
|
283
284
|
flex: 1,
|
|
284
285
|
maxWidth: 180,
|
|
285
|
-
|
|
286
|
-
cellRenderer: 'dsButtonCellRenderer',
|
|
286
|
+
type: 'dsButtonColumn',
|
|
287
287
|
valueGetter: (params) => ({
|
|
288
288
|
children: 'View details',
|
|
289
289
|
variant: 'secondary',
|
|
@@ -314,8 +314,7 @@ export default ButtonCellRendererExample;
|
|
|
314
314
|
headerName: '',
|
|
315
315
|
flex: 1,
|
|
316
316
|
maxWidth: 180,
|
|
317
|
-
|
|
318
|
-
cellRenderer: 'dsButtonCellRenderer',
|
|
317
|
+
type: 'dsButtonColumn',
|
|
319
318
|
valueGetter: params => ({
|
|
320
319
|
children: 'View details',
|
|
321
320
|
variant: 'secondary',
|
|
@@ -329,5 +328,5 @@ export default ButtonCellRendererExample;
|
|
|
329
328
|
/>
|
|
330
329
|
),
|
|
331
330
|
},
|
|
332
|
-
'`
|
|
331
|
+
'`type: \'dsButtonColumn\'` wired up inside a full `Table`. The action column uses `valueGetter` to return a `ButtonProps` object per row — `onClick` closes over `params.data` so each button knows its row. Click a button and check the browser console.',
|
|
333
332
|
);
|
|
@@ -21,7 +21,8 @@ const DESCRIPTION_INTRO = [
|
|
|
21
21
|
'`CheckboxCellRenderer` is an AG Grid cell renderer that renders an editable Arbor `CheckboxInput`',
|
|
22
22
|
'inside a table cell. On toggle, it calls `node.setDataValue` to update the row data in-place.',
|
|
23
23
|
'',
|
|
24
|
-
'Register it via the
|
|
24
|
+
'Register it via `type: \'dsCheckboxColumn\'` on the column definition (pre-registered by Arbor\'s `Table`),',
|
|
25
|
+
'via the string key `dsCheckboxCellRenderer`, or by importing the component directly.',
|
|
25
26
|
].join('\n');
|
|
26
27
|
|
|
27
28
|
const USAGE_GUIDANCE = [
|
|
@@ -61,7 +62,7 @@ const DEVELOPER_NOTES = [
|
|
|
61
62
|
' {',
|
|
62
63
|
" field: 'isEnrolled',",
|
|
63
64
|
" headerName: 'Enrolled',",
|
|
64
|
-
"
|
|
65
|
+
" type: 'dsCheckboxColumn',",
|
|
65
66
|
' // optional extra CheckboxInput props:',
|
|
66
67
|
' cellRendererParams: { disabled: isReadOnly },',
|
|
67
68
|
' },',
|
|
@@ -230,7 +231,7 @@ const colDefs = [
|
|
|
230
231
|
{
|
|
231
232
|
field: 'isEnrolled',
|
|
232
233
|
headerName: 'Enrolled',
|
|
233
|
-
|
|
234
|
+
type: 'dsCheckboxColumn',
|
|
234
235
|
},
|
|
235
236
|
];
|
|
236
237
|
`.trim(),
|
|
@@ -300,8 +301,7 @@ function CheckboxCellRendererExample() {
|
|
|
300
301
|
field: 'enrolled',
|
|
301
302
|
headerName: 'Enrolled',
|
|
302
303
|
flex: 1,
|
|
303
|
-
|
|
304
|
-
cellRenderer: 'dsCheckboxCellRenderer',
|
|
304
|
+
type: 'dsCheckboxColumn',
|
|
305
305
|
},
|
|
306
306
|
]}
|
|
307
307
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -324,8 +324,7 @@ export default CheckboxCellRendererExample;
|
|
|
324
324
|
field: 'enrolled',
|
|
325
325
|
headerName: 'Enrolled',
|
|
326
326
|
flex: 1,
|
|
327
|
-
|
|
328
|
-
cellRenderer: 'dsCheckboxCellRenderer',
|
|
327
|
+
type: 'dsCheckboxColumn',
|
|
329
328
|
},
|
|
330
329
|
]}
|
|
331
330
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -333,5 +332,5 @@ export default CheckboxCellRendererExample;
|
|
|
333
332
|
/>
|
|
334
333
|
),
|
|
335
334
|
},
|
|
336
|
-
'`
|
|
335
|
+
'`type: \'dsCheckboxColumn\'` wired up inside a full `Table`. Click a checkbox to toggle the value — AG Grid calls `node.setDataValue` which updates the row data in-place. The `headerName` ("Enrolled") becomes the checkbox `aria-label`.',
|
|
337
336
|
);
|
|
@@ -21,7 +21,8 @@ const DESCRIPTION_INTRO = [
|
|
|
21
21
|
'inside a table cell for inline text editing. Pressing Enter commits the current value via',
|
|
22
22
|
'`node.setDataValue`. The input is pre-populated from `valueFormatted ?? value`.',
|
|
23
23
|
'',
|
|
24
|
-
'Register it via the
|
|
24
|
+
'Register it via `type: \'dsInlineTextColumn\'` on the column definition (pre-registered by Arbor\'s `Table`),',
|
|
25
|
+
'via the string key `dsInlineTextCellRenderer`, or by importing the component directly.',
|
|
25
26
|
].join('\n');
|
|
26
27
|
|
|
27
28
|
const USAGE_GUIDANCE = [
|
|
@@ -60,7 +61,7 @@ const DEVELOPER_NOTES = [
|
|
|
60
61
|
' {',
|
|
61
62
|
" field: 'forename',",
|
|
62
63
|
" headerName: 'First name',",
|
|
63
|
-
"
|
|
64
|
+
" type: 'dsInlineTextColumn',",
|
|
64
65
|
' },',
|
|
65
66
|
'];',
|
|
66
67
|
'```',
|
|
@@ -206,7 +207,7 @@ const colDefs = [
|
|
|
206
207
|
{
|
|
207
208
|
field: 'forename',
|
|
208
209
|
headerName: 'First name',
|
|
209
|
-
|
|
210
|
+
type: 'dsInlineTextColumn',
|
|
210
211
|
},
|
|
211
212
|
];
|
|
212
213
|
`.trim(),
|
|
@@ -255,8 +256,7 @@ function InlineTextCellRendererExample() {
|
|
|
255
256
|
field: 'forename',
|
|
256
257
|
headerName: 'First Name',
|
|
257
258
|
flex: 1,
|
|
258
|
-
|
|
259
|
-
cellRenderer: 'dsInlineTextCellRenderer',
|
|
259
|
+
type: 'dsInlineTextColumn',
|
|
260
260
|
},
|
|
261
261
|
]}
|
|
262
262
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -279,8 +279,7 @@ export default InlineTextCellRendererExample;
|
|
|
279
279
|
field: 'forename',
|
|
280
280
|
headerName: 'First Name',
|
|
281
281
|
flex: 1,
|
|
282
|
-
|
|
283
|
-
cellRenderer: 'dsInlineTextCellRenderer',
|
|
282
|
+
type: 'dsInlineTextColumn',
|
|
284
283
|
},
|
|
285
284
|
]}
|
|
286
285
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -288,5 +287,5 @@ export default InlineTextCellRendererExample;
|
|
|
288
287
|
/>
|
|
289
288
|
),
|
|
290
289
|
},
|
|
291
|
-
'`
|
|
290
|
+
'`type: \'dsInlineTextColumn\'` wired up inside a full `Table`. Click into any First Name cell to start editing — the `TextInput` is always visible. Press Enter to commit the value via `node.setDataValue`, updating the row data in-place.',
|
|
292
291
|
);
|
|
@@ -21,7 +21,8 @@ const DESCRIPTION_INTRO = [
|
|
|
21
21
|
'`NumberInputCellRenderer` is an AG Grid cell renderer that renders an editable Arbor `NumberInput`',
|
|
22
22
|
'permanently inside a table cell. On change, it calls `node.setDataValue` to update the row data in-place.',
|
|
23
23
|
'',
|
|
24
|
-
'Register it via the
|
|
24
|
+
'Register it via `type: \'dsNumberInputColumn\'` on the column definition (pre-registered by Arbor\'s `Table`),',
|
|
25
|
+
'via the string key `dsNumberInputCellRenderer`, or by importing the component directly.',
|
|
25
26
|
].join('\n');
|
|
26
27
|
|
|
27
28
|
const USAGE_GUIDANCE = [
|
|
@@ -61,7 +62,7 @@ const DEVELOPER_NOTES = [
|
|
|
61
62
|
' {',
|
|
62
63
|
" field: 'quantity',",
|
|
63
64
|
" headerName: 'Quantity',",
|
|
64
|
-
"
|
|
65
|
+
" type: 'dsNumberInputColumn',",
|
|
65
66
|
' cellRendererParams: { min: 0, max: 100 },',
|
|
66
67
|
' },',
|
|
67
68
|
'];',
|
|
@@ -293,17 +294,15 @@ function NumberInputCellRendererExample() {
|
|
|
293
294
|
field: 'sessions',
|
|
294
295
|
headerName: 'Sessions',
|
|
295
296
|
flex: 1,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
cellRendererParams: { min: 0, suppressCellFocusAndFocusFirstElement: true },
|
|
297
|
+
type: 'dsNumberInputColumn',
|
|
298
|
+
cellRendererParams: { min: 0 },
|
|
299
299
|
},
|
|
300
300
|
{
|
|
301
301
|
field: 'score',
|
|
302
302
|
headerName: 'Score (/100)',
|
|
303
303
|
flex: 1,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
cellRendererParams: { min: 0, max: 100, suppressCellFocusAndFocusFirstElement: true },
|
|
304
|
+
type: 'dsNumberInputColumn',
|
|
305
|
+
cellRendererParams: { min: 0, max: 100 },
|
|
307
306
|
},
|
|
308
307
|
]}
|
|
309
308
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -324,17 +323,15 @@ function NumberInputCellRendererExample() {
|
|
|
324
323
|
field: 'sessions',
|
|
325
324
|
headerName: 'Sessions',
|
|
326
325
|
flex: 1,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
cellRendererParams: { min: 0, suppressCellFocusAndFocusFirstElement: true },
|
|
326
|
+
type: 'dsNumberInputColumn',
|
|
327
|
+
cellRendererParams: { min: 0 },
|
|
330
328
|
},
|
|
331
329
|
{
|
|
332
330
|
field: 'score',
|
|
333
331
|
headerName: 'Score (/100)',
|
|
334
332
|
flex: 1,
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
cellRendererParams: { min: 0, max: 100, suppressCellFocusAndFocusFirstElement: true },
|
|
333
|
+
type: 'dsNumberInputColumn',
|
|
334
|
+
cellRendererParams: { min: 0, max: 100 },
|
|
338
335
|
},
|
|
339
336
|
]}
|
|
340
337
|
defaultColDef={{ flex: 1, minWidth: 120 }}
|
|
@@ -342,5 +339,5 @@ function NumberInputCellRendererExample() {
|
|
|
342
339
|
/>
|
|
343
340
|
),
|
|
344
341
|
},
|
|
345
|
-
'`
|
|
342
|
+
'`type: \'dsNumberInputColumn\'` wired up inside a full `Table`. Sessions has `min={0}`; Score has `min={0}` and `max={100}`. Edit any cell — AG Grid calls `node.setDataValue` which updates the row data in-place.',
|
|
346
343
|
);
|