@arbor-education/design-system.components 0.5.5 → 0.6.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/CHANGELOG.md +14 -0
- package/dist/components/avatarGroup/AvatarGroup.d.ts +32 -0
- package/dist/components/avatarGroup/AvatarGroup.d.ts.map +1 -0
- package/dist/components/avatarGroup/AvatarGroup.js +37 -0
- package/dist/components/avatarGroup/AvatarGroup.js.map +1 -0
- package/dist/components/avatarGroup/AvatarGroup.stories.d.ts +14 -0
- package/dist/components/avatarGroup/AvatarGroup.stories.d.ts.map +1 -0
- package/dist/components/avatarGroup/AvatarGroup.stories.js +91 -0
- package/dist/components/avatarGroup/AvatarGroup.stories.js.map +1 -0
- package/dist/components/avatarGroup/AvatarGroup.test.d.ts +2 -0
- package/dist/components/avatarGroup/AvatarGroup.test.d.ts.map +1 -0
- package/dist/components/avatarGroup/AvatarGroup.test.js +155 -0
- package/dist/components/avatarGroup/AvatarGroup.test.js.map +1 -0
- package/dist/components/avatarGroup/avatarGroupOverflow.d.ts +8 -0
- package/dist/components/avatarGroup/avatarGroupOverflow.d.ts.map +1 -0
- package/dist/components/avatarGroup/avatarGroupOverflow.js +14 -0
- package/dist/components/avatarGroup/avatarGroupOverflow.js.map +1 -0
- package/dist/components/avatarGroup/collectAvatarGroupChildren.d.ts +4 -0
- package/dist/components/avatarGroup/collectAvatarGroupChildren.d.ts.map +1 -0
- package/dist/components/avatarGroup/collectAvatarGroupChildren.js +26 -0
- package/dist/components/avatarGroup/collectAvatarGroupChildren.js.map +1 -0
- package/dist/components/avatarGroup/useAvatarGroupItems.d.ts +9 -0
- package/dist/components/avatarGroup/useAvatarGroupItems.d.ts.map +1 -0
- package/dist/components/avatarGroup/useAvatarGroupItems.js +24 -0
- package/dist/components/avatarGroup/useAvatarGroupItems.js.map +1 -0
- package/dist/components/table/Table.d.ts +1 -0
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/Table.js +2 -0
- 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 +447 -77
- package/dist/components/table/Table.stories.js.map +1 -1
- package/dist/components/table/Table.test.js +1 -1
- package/dist/components/table/Table.test.js.map +1 -1
- package/dist/components/table/TableSettingsDropdown.d.ts.map +1 -0
- package/dist/components/table/{pagination/TableSettingsDropdown.js → TableSettingsDropdown.js} +6 -6
- package/dist/components/table/TableSettingsDropdown.js.map +1 -0
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts +2 -5
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.d.ts.map +1 -1
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js +7 -5
- package/dist/components/table/cellRenderers/SelectDropdownCellRenderer.js.map +1 -1
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/avatarGroup/AvatarGroup.stories.tsx +218 -0
- package/src/components/avatarGroup/AvatarGroup.test.tsx +298 -0
- package/src/components/avatarGroup/AvatarGroup.tsx +127 -0
- package/src/components/avatarGroup/avatarGroup.scss +31 -0
- package/src/components/avatarGroup/avatarGroupOverflow.ts +29 -0
- package/src/components/avatarGroup/collectAvatarGroupChildren.ts +30 -0
- package/src/components/avatarGroup/useAvatarGroupItems.ts +39 -0
- package/src/components/table/Table.stories.tsx +678 -265
- package/src/components/table/Table.test.tsx +1 -1
- package/src/components/table/Table.tsx +2 -0
- package/src/components/table/{pagination/TableSettingsDropdown.tsx → TableSettingsDropdown.tsx} +1 -1
- package/src/components/table/cellRenderers/SelectDropdownCellRenderer.tsx +42 -12
- package/src/global.scss +1 -1
- package/src/index.scss +1 -0
- package/src/index.ts +7 -0
- package/src/tokens.scss +2 -0
- package/tokens/json/Arbor.json +13 -1
- package/dist/components/table/pagination/TableSettingsDropdown.d.ts.map +0 -1
- package/dist/components/table/pagination/TableSettingsDropdown.js.map +0 -1
- /package/dist/components/table/{pagination/TableSettingsDropdown.d.ts → TableSettingsDropdown.d.ts} +0 -0
|
@@ -9,13 +9,20 @@ import { useState, type ComponentProps } from 'react';
|
|
|
9
9
|
import { RowCountInfo } from './pagination/RowCountInfo';
|
|
10
10
|
import { PaginationPanel } from './pagination/PaginationPanel';
|
|
11
11
|
import { HideColumnsDropdown } from './HideColumnsDropdown';
|
|
12
|
-
import { TableSettingsDropdown } from './
|
|
12
|
+
import { TableSettingsDropdown } from './TableSettingsDropdown';
|
|
13
13
|
import { ModalManager } from 'Components/modal/modalManager/ModalManager';
|
|
14
14
|
import { Modal } from 'Components/modal/Modal';
|
|
15
15
|
import { ModalUtils } from 'Utils/ModalUtils';
|
|
16
16
|
import type { SemanticColorKey } from './cellColorStyles';
|
|
17
|
-
import {
|
|
18
|
-
|
|
17
|
+
import {
|
|
18
|
+
BooleanFilter,
|
|
19
|
+
doesBooleanFilterPass,
|
|
20
|
+
} from './columnFilters/BooleanFilter/BooleanFilter';
|
|
21
|
+
import {
|
|
22
|
+
doesTimeFilterPass,
|
|
23
|
+
TimeFilter,
|
|
24
|
+
} from './columnFilters/TimeFilter/TimeFilter';
|
|
25
|
+
import type { CustomCellRendererProps } from 'ag-grid-react';
|
|
19
26
|
|
|
20
27
|
type TableProps = ComponentProps<typeof Table>;
|
|
21
28
|
|
|
@@ -26,7 +33,8 @@ const meta: Meta<TableProps> = {
|
|
|
26
33
|
parameters: {
|
|
27
34
|
docs: {
|
|
28
35
|
description: {
|
|
29
|
-
component:
|
|
36
|
+
component:
|
|
37
|
+
'The Table component is a wrapper around the ag-grid-react component. It provides a set of props that can be used to configure the table.',
|
|
30
38
|
},
|
|
31
39
|
},
|
|
32
40
|
},
|
|
@@ -52,11 +60,56 @@ interface RowData {
|
|
|
52
60
|
}
|
|
53
61
|
|
|
54
62
|
const sampleData: RowData[] = [
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
{
|
|
64
|
+
id: 1,
|
|
65
|
+
name: { value: 'Alice Johnson' },
|
|
66
|
+
email: { value: 'alice.johnson@example.com' },
|
|
67
|
+
role: { value: 'Developer' },
|
|
68
|
+
status: { value: 'Active' },
|
|
69
|
+
active: true,
|
|
70
|
+
time: '2026-01-28 12:00:00',
|
|
71
|
+
dateOfBirth: new Date(1990, 0, 1),
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 2,
|
|
75
|
+
name: { value: 'Bob Smith' },
|
|
76
|
+
email: { value: 'bob.smith@example.com' },
|
|
77
|
+
role: { value: 'Designer' },
|
|
78
|
+
status: { value: 'Active' },
|
|
79
|
+
active: false,
|
|
80
|
+
time: '2026-01-28 13:00:00',
|
|
81
|
+
dateOfBirth: new Date(1991, 1, 2),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 3,
|
|
85
|
+
name: { value: 'Charlie Brown' },
|
|
86
|
+
email: { value: 'charlie.brown@example.com' },
|
|
87
|
+
role: { value: 'Manager' },
|
|
88
|
+
status: { value: 'Inactive' },
|
|
89
|
+
active: true,
|
|
90
|
+
time: '2026-01-28 14:00:00',
|
|
91
|
+
dateOfBirth: new Date(1992, 2, 3),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 4,
|
|
95
|
+
name: { value: 'Diana Prince' },
|
|
96
|
+
email: { value: 'diana.prince@example.com' },
|
|
97
|
+
role: { value: 'Developer' },
|
|
98
|
+
status: { value: 'Active' },
|
|
99
|
+
active: false,
|
|
100
|
+
time: '2026-01-28 15:00:00',
|
|
101
|
+
dateOfBirth: new Date(1993, 3, 4),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 5,
|
|
105
|
+
name: { value: 'Ethan Hunt' },
|
|
106
|
+
email: { value: 'ethan.hunt@example.com' },
|
|
107
|
+
role: { value: 'Analyst' },
|
|
108
|
+
status: { value: 'Active' },
|
|
109
|
+
active: false,
|
|
110
|
+
time: '2026-01-28 16:00:00',
|
|
111
|
+
dateOfBirth: new Date(1994, 4, 5),
|
|
112
|
+
},
|
|
60
113
|
];
|
|
61
114
|
|
|
62
115
|
const defaultColDef: ColDef = {
|
|
@@ -72,30 +125,69 @@ const sampleColumnDefs: (ColDef | ColGroupDef)[] = [
|
|
|
72
125
|
{
|
|
73
126
|
headerName: 'Details',
|
|
74
127
|
children: [
|
|
75
|
-
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
128
|
+
{
|
|
129
|
+
field: 'name',
|
|
130
|
+
headerTooltip: 'The name of the user',
|
|
131
|
+
filter: 'agSetColumnFilter',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
field: 'email',
|
|
135
|
+
headerTooltip: 'The email of the user',
|
|
136
|
+
filter: 'agSetColumnFilter',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
field: 'role',
|
|
140
|
+
headerTooltip: 'The role of the user',
|
|
141
|
+
filter: 'agSetColumnFilter',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
field: 'dateOfBirth',
|
|
145
|
+
filter: 'agDateColumnFilter',
|
|
146
|
+
filterParams: { buttons: ['clear', 'apply'] },
|
|
147
|
+
headerTooltip: 'The date of birth of the user',
|
|
148
|
+
valueFormatter: params =>
|
|
149
|
+
params.value instanceof Date
|
|
150
|
+
? params.value.toLocaleDateString()
|
|
151
|
+
: params.value,
|
|
152
|
+
},
|
|
79
153
|
],
|
|
80
154
|
// Value formatters from the defaultColDef are not respected for non-string value
|
|
81
155
|
// so until AG Grid fixes it we have to do it explicitly on each colDef
|
|
82
156
|
valueFormatter: Table.DefaultValueFormatter,
|
|
83
157
|
},
|
|
84
158
|
{ field: 'status', valueFormatter: Table.DefaultValueFormatter },
|
|
85
|
-
{
|
|
86
|
-
|
|
159
|
+
{
|
|
160
|
+
field: 'active',
|
|
161
|
+
filter: { component: BooleanFilter, doesFilterPass: doesBooleanFilterPass },
|
|
162
|
+
cellDataType: 'boolean',
|
|
163
|
+
editable: false,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
field: 'time',
|
|
167
|
+
filter: { component: TimeFilter, doesFilterPass: doesTimeFilterPass },
|
|
168
|
+
cellDataType: 'string',
|
|
169
|
+
editable: false,
|
|
170
|
+
},
|
|
87
171
|
];
|
|
88
172
|
|
|
89
173
|
const footerContent = [
|
|
90
|
-
<Button key={0} variant="primary">
|
|
174
|
+
<Button key={0} variant="primary">
|
|
175
|
+
Button 1
|
|
176
|
+
</Button>,
|
|
91
177
|
<RowCountInfo key={3} />,
|
|
92
|
-
<Button key={2} variant="secondary">
|
|
178
|
+
<Button key={2} variant="secondary">
|
|
179
|
+
Button 2
|
|
180
|
+
</Button>,
|
|
93
181
|
];
|
|
94
182
|
|
|
95
183
|
const headerContent = [
|
|
96
184
|
<div key={0} style={{ display: 'flex', gap: '0.5rem' }}>
|
|
97
|
-
<Button key={0} variant="secondary" size="S">
|
|
98
|
-
|
|
185
|
+
<Button key={0} variant="secondary" size="S">
|
|
186
|
+
Button 1
|
|
187
|
+
</Button>
|
|
188
|
+
<Button key={1} variant="secondary" size="S">
|
|
189
|
+
Button 2
|
|
190
|
+
</Button>
|
|
99
191
|
</div>,
|
|
100
192
|
<div key={1} style={{ display: 'flex', gap: '1rem' }}>
|
|
101
193
|
<Icon name="download" />
|
|
@@ -178,7 +270,8 @@ export const WithBulkActions: Story = {
|
|
|
178
270
|
parameters: {
|
|
179
271
|
docs: {
|
|
180
272
|
description: {
|
|
181
|
-
story:
|
|
273
|
+
story:
|
|
274
|
+
"The BulkActionsDropdown component is used to add bulk actions to the table. We don't provide any bulk actions by default, you need to pass the actions prop to the BulkActionsDropdown component.",
|
|
182
275
|
},
|
|
183
276
|
},
|
|
184
277
|
},
|
|
@@ -192,14 +285,17 @@ export const WithBulkActions: Story = {
|
|
|
192
285
|
key={0}
|
|
193
286
|
actions={[
|
|
194
287
|
{
|
|
195
|
-
displayName: 'foo',
|
|
288
|
+
displayName: 'foo',
|
|
289
|
+
callback: (gridApi) => {
|
|
196
290
|
console.log('clicked on the foo action', gridApi);
|
|
197
291
|
},
|
|
198
292
|
},
|
|
199
293
|
{
|
|
200
|
-
displayName: 'bar',
|
|
294
|
+
displayName: 'bar',
|
|
295
|
+
callback: (gridApi) => {
|
|
201
296
|
console.log('clicked on the bar action', gridApi);
|
|
202
|
-
},
|
|
297
|
+
},
|
|
298
|
+
disabled: true,
|
|
203
299
|
},
|
|
204
300
|
]}
|
|
205
301
|
/>,
|
|
@@ -211,7 +307,8 @@ export const WithHideColumnsDropdown: Story = {
|
|
|
211
307
|
parameters: {
|
|
212
308
|
docs: {
|
|
213
309
|
description: {
|
|
214
|
-
story:
|
|
310
|
+
story:
|
|
311
|
+
'The HideColumnsDropdown component is used to hide columns in the table. It is used in the header content of the table.',
|
|
215
312
|
},
|
|
216
313
|
},
|
|
217
314
|
},
|
|
@@ -256,7 +353,8 @@ export const WithRestrictedHideColumnsDropdown: Story = {
|
|
|
256
353
|
parameters: {
|
|
257
354
|
docs: {
|
|
258
355
|
description: {
|
|
259
|
-
story:
|
|
356
|
+
story:
|
|
357
|
+
'If you want to exclude certain columns from the HideColumnsDropdown, you can pass the columns prop to the HideColumnsDropdown component and it will only display the columns that are passed to it.',
|
|
260
358
|
},
|
|
261
359
|
},
|
|
262
360
|
},
|
|
@@ -308,7 +406,8 @@ export const WithClientSidePagination: StoryObj<TableProps> = {
|
|
|
308
406
|
parameters: {
|
|
309
407
|
docs: {
|
|
310
408
|
description: {
|
|
311
|
-
story:
|
|
409
|
+
story:
|
|
410
|
+
'For simple client side pagination you just need to set the pagination prop to true and use the PaginationPanel component to render the pagination controls.',
|
|
312
411
|
},
|
|
313
412
|
},
|
|
314
413
|
},
|
|
@@ -318,7 +417,12 @@ export const WithClientSidePagination: StoryObj<TableProps> = {
|
|
|
318
417
|
defaultColDef,
|
|
319
418
|
domLayout: 'autoHeight',
|
|
320
419
|
pagination: true,
|
|
321
|
-
footerContent:
|
|
420
|
+
footerContent: (
|
|
421
|
+
<PaginationPanel
|
|
422
|
+
availableSizes={[1, 2, 3, 4, 'All']}
|
|
423
|
+
initialPageSize={2}
|
|
424
|
+
/>
|
|
425
|
+
),
|
|
322
426
|
},
|
|
323
427
|
};
|
|
324
428
|
|
|
@@ -326,7 +430,8 @@ export const WithServerSidePagination: StoryObj<TableProps> = {
|
|
|
326
430
|
parameters: {
|
|
327
431
|
docs: {
|
|
328
432
|
description: {
|
|
329
|
-
story:
|
|
433
|
+
story:
|
|
434
|
+
'For server side or custom pagination you need to implement the pagination logic yourself and pass the logic via props to the PaginationPanel.',
|
|
330
435
|
},
|
|
331
436
|
},
|
|
332
437
|
},
|
|
@@ -345,7 +450,10 @@ export const WithServerSidePagination: StoryObj<TableProps> = {
|
|
|
345
450
|
|
|
346
451
|
const splitRowDataBasedOnPageSize = (arr: RowData[]): RowData[][] =>
|
|
347
452
|
arr.length > currentPageSize
|
|
348
|
-
? [
|
|
453
|
+
? [
|
|
454
|
+
arr.slice(0, currentPageSize),
|
|
455
|
+
...splitRowDataBasedOnPageSize(arr.slice(currentPageSize)),
|
|
456
|
+
]
|
|
349
457
|
: [arr];
|
|
350
458
|
|
|
351
459
|
const pageData = splitRowDataBasedOnPageSize(sampleData);
|
|
@@ -376,33 +484,92 @@ export const WithServerSidePagination: StoryObj<TableProps> = {
|
|
|
376
484
|
const sampleColumnDefsWithButtonCellRenderer: (ColDef | ColGroupDef)[] = [
|
|
377
485
|
{
|
|
378
486
|
headerName: 'Details',
|
|
379
|
-
children: [
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
487
|
+
children: [
|
|
488
|
+
{
|
|
489
|
+
field: 'name',
|
|
490
|
+
headerTooltip: 'The name of the user',
|
|
491
|
+
cellRenderer: 'dsButtonCellRenderer',
|
|
492
|
+
cellRendererParams: {
|
|
493
|
+
supressCellFocusAndFocusFirstElement: true,
|
|
494
|
+
},
|
|
495
|
+
editable: false,
|
|
385
496
|
},
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
497
|
+
{
|
|
498
|
+
field: 'email',
|
|
499
|
+
headerTooltip: 'The email of the user',
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
field: 'role',
|
|
503
|
+
headerTooltip: 'The role of the user',
|
|
504
|
+
},
|
|
505
|
+
],
|
|
394
506
|
},
|
|
395
507
|
{ field: 'status' },
|
|
396
508
|
];
|
|
397
509
|
|
|
398
|
-
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) =>
|
|
510
|
+
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) =>
|
|
511
|
+
alert(`clicked on the button ${e.currentTarget.value}`);
|
|
399
512
|
|
|
400
513
|
const sampleDataWithButtonCellRenderer = [
|
|
401
|
-
{
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
514
|
+
{
|
|
515
|
+
id: 1,
|
|
516
|
+
name: {
|
|
517
|
+
children: 'Alice Johnson',
|
|
518
|
+
value: 'Alice Johnson',
|
|
519
|
+
onClick: handleClick,
|
|
520
|
+
},
|
|
521
|
+
email: 'alice.johnson@example.com',
|
|
522
|
+
role: 'Developer',
|
|
523
|
+
status: 'Active',
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: 2,
|
|
527
|
+
name: {
|
|
528
|
+
children: 'Bob Smith',
|
|
529
|
+
variant: 'secondary',
|
|
530
|
+
value: 'Bob Smith',
|
|
531
|
+
onClick: handleClick,
|
|
532
|
+
},
|
|
533
|
+
email: 'bob.smith@example.com',
|
|
534
|
+
role: 'Designer',
|
|
535
|
+
status: 'Active',
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
id: 3,
|
|
539
|
+
name: {
|
|
540
|
+
children: 'Charlie Brown',
|
|
541
|
+
size: 'S',
|
|
542
|
+
value: 'Charlie Brown',
|
|
543
|
+
onClick: handleClick,
|
|
544
|
+
},
|
|
545
|
+
email: 'charlie.brown@example.com',
|
|
546
|
+
role: 'Manager',
|
|
547
|
+
status: 'Inactive',
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
id: 4,
|
|
551
|
+
name: {
|
|
552
|
+
children: 'Diana Prince',
|
|
553
|
+
disabled: true,
|
|
554
|
+
value: 'Diana Prince',
|
|
555
|
+
onClick: handleClick,
|
|
556
|
+
},
|
|
557
|
+
email: 'diana.prince@example.com',
|
|
558
|
+
role: 'Developer',
|
|
559
|
+
status: 'Active',
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
id: 5,
|
|
563
|
+
name: {
|
|
564
|
+
children: 'Ethan Hunt',
|
|
565
|
+
iconLeftName: 'download',
|
|
566
|
+
value: 'Ethan Hunt',
|
|
567
|
+
onClick: handleClick,
|
|
568
|
+
},
|
|
569
|
+
email: 'ethan.hunt@example.com',
|
|
570
|
+
role: 'Analyst',
|
|
571
|
+
status: 'Active',
|
|
572
|
+
},
|
|
406
573
|
];
|
|
407
574
|
|
|
408
575
|
export const WithButtonCellRenderer: Story = {
|
|
@@ -416,177 +583,248 @@ export const WithButtonCellRenderer: Story = {
|
|
|
416
583
|
},
|
|
417
584
|
};
|
|
418
585
|
|
|
419
|
-
export const WithButtonCellRendererThatOpensAModalWithModalManager: StoryObj<TableProps>
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
<Modal.
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
const sampleData = [
|
|
443
|
-
{ id: 1, name: { children: 'Alice Johnson', value: 'Alice Johnson', onClick: () => ModalUtils.addModal({ children: ModalContent('Alice Johnson') }) }, email: 'alice.johnson@example.com', role: 'Developer', status: 'Active' },
|
|
444
|
-
{ id: 2, name: { children: 'Bob Smith', variant: 'secondary', value: 'Bob Smith', onClick: () => ModalUtils.addModal({ children: ModalContent('Bob Smith') }) }, email: 'bob.smith@example.com', role: 'Designer', status: 'Active' },
|
|
445
|
-
{ id: 3, name: { children: 'Charlie Brown', size: 'S', value: 'Charlie Brown', onClick: () => ModalUtils.addModal({ children: ModalContent('Charlie Brown') }) }, email: 'charlie.brown@example.com', role: 'Manager', status: 'Inactive' },
|
|
446
|
-
{ id: 4, name: { children: 'Diana Prince', disabled: true, value: 'Diana Prince', onClick: () => ModalUtils.addModal({ children: ModalContent('Diana Prince') }) }, email: 'diana.prince@example.com', role: 'Developer', status: 'Active' },
|
|
447
|
-
{ id: 5, name: { children: 'Ethan Hunt', iconLeftName: 'download', value: 'Ethan Hunt', onClick: () => ModalUtils.addModal({ children: ModalContent('Ethan Hunt') }) }, email: 'ethan.hunt@example.com', role: 'Analyst', status: 'Active' },
|
|
448
|
-
];
|
|
449
|
-
return (
|
|
450
|
-
<>
|
|
451
|
-
<Table
|
|
452
|
-
rowData={sampleData}
|
|
453
|
-
columnDefs={sampleColumnDefsWithButtonCellRenderer}
|
|
454
|
-
defaultColDef={defaultColDef}
|
|
455
|
-
domLayout="autoHeight"
|
|
456
|
-
/>
|
|
457
|
-
<ModalManager />
|
|
458
|
-
</>
|
|
586
|
+
export const WithButtonCellRendererThatOpensAModalWithModalManager: StoryObj<TableProps>
|
|
587
|
+
= {
|
|
588
|
+
args: {
|
|
589
|
+
rowData: sampleData,
|
|
590
|
+
columnDefs: sampleColumnDefs,
|
|
591
|
+
defaultColDef,
|
|
592
|
+
domLayout: 'autoHeight',
|
|
593
|
+
},
|
|
594
|
+
render: () => {
|
|
595
|
+
const ModalContent = (name: string) => (
|
|
596
|
+
<>
|
|
597
|
+
<Modal.Header>
|
|
598
|
+
<Modal.Title>
|
|
599
|
+
You've clicked on
|
|
600
|
+
{name}
|
|
601
|
+
</Modal.Title>
|
|
602
|
+
</Modal.Header>
|
|
603
|
+
<Modal.Body>
|
|
604
|
+
<p>Look at you go.</p>
|
|
605
|
+
</Modal.Body>
|
|
606
|
+
</>
|
|
607
|
+
);
|
|
459
608
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
609
|
+
const sampleData = [
|
|
610
|
+
{
|
|
611
|
+
id: 1,
|
|
612
|
+
name: {
|
|
613
|
+
children: 'Alice Johnson',
|
|
614
|
+
value: 'Alice Johnson',
|
|
615
|
+
onClick: () =>
|
|
616
|
+
ModalUtils.addModal({ children: ModalContent('Alice Johnson') }),
|
|
617
|
+
},
|
|
618
|
+
email: 'alice.johnson@example.com',
|
|
619
|
+
role: 'Developer',
|
|
620
|
+
status: 'Active',
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
id: 2,
|
|
624
|
+
name: {
|
|
625
|
+
children: 'Bob Smith',
|
|
626
|
+
variant: 'secondary',
|
|
627
|
+
value: 'Bob Smith',
|
|
628
|
+
onClick: () =>
|
|
629
|
+
ModalUtils.addModal({ children: ModalContent('Bob Smith') }),
|
|
630
|
+
},
|
|
631
|
+
email: 'bob.smith@example.com',
|
|
632
|
+
role: 'Designer',
|
|
633
|
+
status: 'Active',
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
id: 3,
|
|
637
|
+
name: {
|
|
638
|
+
children: 'Charlie Brown',
|
|
639
|
+
size: 'S',
|
|
640
|
+
value: 'Charlie Brown',
|
|
641
|
+
onClick: () =>
|
|
642
|
+
ModalUtils.addModal({ children: ModalContent('Charlie Brown') }),
|
|
643
|
+
},
|
|
644
|
+
email: 'charlie.brown@example.com',
|
|
645
|
+
role: 'Manager',
|
|
646
|
+
status: 'Inactive',
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
id: 4,
|
|
650
|
+
name: {
|
|
651
|
+
children: 'Diana Prince',
|
|
652
|
+
disabled: true,
|
|
653
|
+
value: 'Diana Prince',
|
|
654
|
+
onClick: () =>
|
|
655
|
+
ModalUtils.addModal({ children: ModalContent('Diana Prince') }),
|
|
656
|
+
},
|
|
657
|
+
email: 'diana.prince@example.com',
|
|
658
|
+
role: 'Developer',
|
|
659
|
+
status: 'Active',
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
id: 5,
|
|
663
|
+
name: {
|
|
664
|
+
children: 'Ethan Hunt',
|
|
665
|
+
iconLeftName: 'download',
|
|
666
|
+
value: 'Ethan Hunt',
|
|
667
|
+
onClick: () =>
|
|
668
|
+
ModalUtils.addModal({ children: ModalContent('Ethan Hunt') }),
|
|
669
|
+
},
|
|
670
|
+
email: 'ethan.hunt@example.com',
|
|
671
|
+
role: 'Analyst',
|
|
672
|
+
status: 'Active',
|
|
673
|
+
},
|
|
674
|
+
];
|
|
675
|
+
return (
|
|
676
|
+
<>
|
|
677
|
+
<Table
|
|
678
|
+
rowData={sampleData}
|
|
679
|
+
columnDefs={sampleColumnDefsWithButtonCellRenderer}
|
|
680
|
+
defaultColDef={defaultColDef}
|
|
681
|
+
domLayout="autoHeight"
|
|
682
|
+
/>
|
|
683
|
+
<ModalManager />
|
|
684
|
+
</>
|
|
685
|
+
);
|
|
686
|
+
},
|
|
687
|
+
};
|
|
463
688
|
|
|
464
|
-
export const WithButtonCellRendererThatOpensAModalWithComposableModal: StoryObj<TableProps>
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
689
|
+
export const WithButtonCellRendererThatOpensAModalWithComposableModal: StoryObj<TableProps>
|
|
690
|
+
= {
|
|
691
|
+
args: {
|
|
692
|
+
rowData: sampleData,
|
|
693
|
+
columnDefs: sampleColumnDefs,
|
|
694
|
+
defaultColDef,
|
|
695
|
+
domLayout: 'autoHeight',
|
|
696
|
+
},
|
|
697
|
+
render: () => {
|
|
698
|
+
const [activePersonId, setActivePersonId] = useState<number | null>(null);
|
|
699
|
+
const [showModal, setShowModal] = useState(false);
|
|
474
700
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
701
|
+
const sampleData = [
|
|
702
|
+
{
|
|
703
|
+
id: 1,
|
|
704
|
+
name: {
|
|
705
|
+
children: 'Alice Johnson',
|
|
706
|
+
value: 'Alice Johnson',
|
|
707
|
+
onClick: () => {
|
|
708
|
+
setActivePersonId(1);
|
|
709
|
+
setShowModal(true);
|
|
710
|
+
},
|
|
484
711
|
},
|
|
712
|
+
email: 'alice.johnson@example.com',
|
|
713
|
+
role: 'Developer',
|
|
714
|
+
status: 'Active',
|
|
485
715
|
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
onClick: () => {
|
|
497
|
-
setActivePersonId(2);
|
|
498
|
-
setShowModal(true);
|
|
716
|
+
{
|
|
717
|
+
id: 2,
|
|
718
|
+
name: {
|
|
719
|
+
children: 'Bob Smith',
|
|
720
|
+
variant: 'secondary',
|
|
721
|
+
value: 'Bob Smith',
|
|
722
|
+
onClick: () => {
|
|
723
|
+
setActivePersonId(2);
|
|
724
|
+
setShowModal(true);
|
|
725
|
+
},
|
|
499
726
|
},
|
|
727
|
+
email: 'bob.smith@example.com',
|
|
728
|
+
role: 'Designer',
|
|
729
|
+
status: 'Active',
|
|
500
730
|
},
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
onClick: () => {
|
|
512
|
-
setActivePersonId(3);
|
|
513
|
-
setShowModal(true);
|
|
731
|
+
{
|
|
732
|
+
id: 3,
|
|
733
|
+
name: {
|
|
734
|
+
children: 'Charlie Brown',
|
|
735
|
+
size: 'S',
|
|
736
|
+
value: 'Charlie Brown',
|
|
737
|
+
onClick: () => {
|
|
738
|
+
setActivePersonId(3);
|
|
739
|
+
setShowModal(true);
|
|
740
|
+
},
|
|
514
741
|
},
|
|
742
|
+
email: 'charlie.brown@example.com',
|
|
743
|
+
role: 'Manager',
|
|
744
|
+
status: 'Inactive',
|
|
515
745
|
},
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
onClick: () => {
|
|
527
|
-
setActivePersonId(4);
|
|
528
|
-
setShowModal(true);
|
|
746
|
+
{
|
|
747
|
+
id: 4,
|
|
748
|
+
name: {
|
|
749
|
+
children: 'Diana Prince',
|
|
750
|
+
disabled: true,
|
|
751
|
+
value: 'Diana Prince',
|
|
752
|
+
onClick: () => {
|
|
753
|
+
setActivePersonId(4);
|
|
754
|
+
setShowModal(true);
|
|
755
|
+
},
|
|
529
756
|
},
|
|
757
|
+
email: 'diana.prince@example.com',
|
|
758
|
+
role: 'Developer',
|
|
759
|
+
status: 'Active',
|
|
530
760
|
},
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
onClick: () => {
|
|
542
|
-
setActivePersonId(5);
|
|
543
|
-
setShowModal(true);
|
|
761
|
+
{
|
|
762
|
+
id: 5,
|
|
763
|
+
name: {
|
|
764
|
+
children: 'Ethan Hunt',
|
|
765
|
+
iconLeftName: 'download',
|
|
766
|
+
value: 'Ethan Hunt',
|
|
767
|
+
onClick: () => {
|
|
768
|
+
setActivePersonId(5);
|
|
769
|
+
setShowModal(true);
|
|
770
|
+
},
|
|
544
771
|
},
|
|
772
|
+
email: 'ethan.hunt@example.com',
|
|
773
|
+
role: 'Analyst',
|
|
774
|
+
status: 'Active',
|
|
545
775
|
},
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
</Modal.
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
776
|
+
];
|
|
777
|
+
return (
|
|
778
|
+
<>
|
|
779
|
+
<Table
|
|
780
|
+
rowData={sampleData}
|
|
781
|
+
columnDefs={sampleColumnDefsWithButtonCellRenderer}
|
|
782
|
+
defaultColDef={defaultColDef}
|
|
783
|
+
domLayout="autoHeight"
|
|
784
|
+
/>
|
|
785
|
+
<Modal open={showModal} closeHandler={() => setShowModal(false)}>
|
|
786
|
+
<Modal.Header>
|
|
787
|
+
<Modal.Title>
|
|
788
|
+
You've clicked on
|
|
789
|
+
{' '}
|
|
790
|
+
{
|
|
791
|
+
sampleData.find(person => person.id === activePersonId)
|
|
792
|
+
?.name.children
|
|
793
|
+
}
|
|
794
|
+
</Modal.Title>
|
|
795
|
+
</Modal.Header>
|
|
796
|
+
<Modal.Body>
|
|
797
|
+
<p>Look at you go.</p>
|
|
798
|
+
</Modal.Body>
|
|
799
|
+
<Modal.Footer>
|
|
800
|
+
<Button variant="tertiary" onClick={() => setShowModal(false)}>
|
|
801
|
+
Close
|
|
802
|
+
</Button>
|
|
803
|
+
<Button variant="primary" onClick={() => setShowModal(false)}>
|
|
804
|
+
Primary Action
|
|
805
|
+
</Button>
|
|
806
|
+
</Modal.Footer>
|
|
807
|
+
</Modal>
|
|
808
|
+
</>
|
|
809
|
+
);
|
|
810
|
+
},
|
|
811
|
+
};
|
|
580
812
|
|
|
581
813
|
export const WithInlineTextCellRenderer: Story = {
|
|
582
814
|
args: {
|
|
583
815
|
rowData: sampleData,
|
|
584
|
-
columnDefs: [
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
816
|
+
columnDefs: [
|
|
817
|
+
{
|
|
818
|
+
field: 'name',
|
|
819
|
+
cellRenderer: 'dsInlineTextCellRenderer',
|
|
820
|
+
cellRendererParams: {
|
|
821
|
+
supressCellFocusAndFocusFirstElement: true,
|
|
822
|
+
suppressCount: true,
|
|
823
|
+
suppressDoubleClickExpand: true,
|
|
824
|
+
suppressEnterExpand: true,
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
],
|
|
590
828
|
defaultColDef,
|
|
591
829
|
domLayout: 'autoHeight',
|
|
592
830
|
},
|
|
@@ -597,7 +835,10 @@ export const WithTreeData: Story = {
|
|
|
597
835
|
columnDefs: [
|
|
598
836
|
{
|
|
599
837
|
headerName: 'Details',
|
|
600
|
-
children: [
|
|
838
|
+
children: [
|
|
839
|
+
{ field: 'email', headerTooltip: 'The email of the user' },
|
|
840
|
+
{ field: 'role', headerTooltip: 'The role of the user' },
|
|
841
|
+
],
|
|
601
842
|
},
|
|
602
843
|
{ field: 'status' },
|
|
603
844
|
],
|
|
@@ -618,17 +859,47 @@ export const WithTreeData: Story = {
|
|
|
618
859
|
id: 1,
|
|
619
860
|
name: 'Group 1',
|
|
620
861
|
children: [
|
|
621
|
-
{
|
|
622
|
-
|
|
862
|
+
{
|
|
863
|
+
id: 2,
|
|
864
|
+
name: 'Alice Johnson',
|
|
865
|
+
email: 'alice.johnson@example.com',
|
|
866
|
+
role: 'Developer',
|
|
867
|
+
status: 'Active',
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
id: 3,
|
|
871
|
+
name: 'Bob Smith',
|
|
872
|
+
email: 'bob.smith@example.com',
|
|
873
|
+
role: 'Designer',
|
|
874
|
+
status: 'Active',
|
|
875
|
+
},
|
|
623
876
|
],
|
|
624
877
|
},
|
|
625
878
|
{
|
|
626
879
|
id: 4,
|
|
627
880
|
name: 'Group 2',
|
|
628
881
|
children: [
|
|
629
|
-
{
|
|
630
|
-
|
|
631
|
-
|
|
882
|
+
{
|
|
883
|
+
id: 5,
|
|
884
|
+
name: 'Charlie Brown',
|
|
885
|
+
email: 'charlie.brown@example.com',
|
|
886
|
+
role: 'Manager',
|
|
887
|
+
status: 'Inactive',
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
id: 6,
|
|
891
|
+
name: 'Diana Prince',
|
|
892
|
+
email: 'diana.prince@example.com',
|
|
893
|
+
role: 'Developer',
|
|
894
|
+
status: 'Active',
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
id: 7,
|
|
898
|
+
name: 'Ethan Hunt',
|
|
899
|
+
email: 'ethan.hunt@example.com',
|
|
900
|
+
role: 'Analyst',
|
|
901
|
+
status: 'Active',
|
|
902
|
+
},
|
|
632
903
|
],
|
|
633
904
|
},
|
|
634
905
|
],
|
|
@@ -638,19 +909,23 @@ export const WithTreeData: Story = {
|
|
|
638
909
|
const colDefsWithValidation: (ColDef | ColGroupDef)[] = [
|
|
639
910
|
{
|
|
640
911
|
headerName: 'Details',
|
|
641
|
-
children: [
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
912
|
+
children: [
|
|
913
|
+
{
|
|
914
|
+
field: 'name',
|
|
915
|
+
headerTooltip: 'The name of the user',
|
|
916
|
+
cellEditorParams: {
|
|
917
|
+
maxLength: 10,
|
|
918
|
+
},
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
field: 'email',
|
|
922
|
+
headerTooltip: 'The email of the user',
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
field: 'role',
|
|
926
|
+
headerTooltip: 'The role of the user',
|
|
927
|
+
},
|
|
928
|
+
],
|
|
654
929
|
},
|
|
655
930
|
{ field: 'status' },
|
|
656
931
|
];
|
|
@@ -659,7 +934,8 @@ export const WithValidation: Story = {
|
|
|
659
934
|
parameters: {
|
|
660
935
|
docs: {
|
|
661
936
|
description: {
|
|
662
|
-
story:
|
|
937
|
+
story:
|
|
938
|
+
'See https://www.ag-grid.com/react-data-grid/cell-editing-validation/ for more information. The name field has a max length of 10 characters in this example. The cell gets invalid styling when it is being edited and the value is longer than 10 characters.',
|
|
663
939
|
},
|
|
664
940
|
},
|
|
665
941
|
},
|
|
@@ -676,22 +952,27 @@ export const WithValidation: Story = {
|
|
|
676
952
|
const colDefsWithValidationClasses: (ColDef | ColGroupDef)[] = [
|
|
677
953
|
{
|
|
678
954
|
headerName: 'Details',
|
|
679
|
-
children: [
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
955
|
+
children: [
|
|
956
|
+
{
|
|
957
|
+
field: 'name',
|
|
958
|
+
headerTooltip: 'The name of the user',
|
|
959
|
+
cellEditorParams: {
|
|
960
|
+
maxLength: 10,
|
|
961
|
+
},
|
|
962
|
+
cellClassRules: {
|
|
963
|
+
'ds-table__cell--invalid': params =>
|
|
964
|
+
params.value?.value?.length > 10,
|
|
965
|
+
},
|
|
684
966
|
},
|
|
685
|
-
|
|
686
|
-
'
|
|
967
|
+
{
|
|
968
|
+
field: 'email',
|
|
969
|
+
headerTooltip: 'The email of the user',
|
|
687
970
|
},
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
headerTooltip: 'The role of the user',
|
|
694
|
-
}],
|
|
971
|
+
{
|
|
972
|
+
field: 'role',
|
|
973
|
+
headerTooltip: 'The role of the user',
|
|
974
|
+
},
|
|
975
|
+
],
|
|
695
976
|
},
|
|
696
977
|
{ field: 'status' },
|
|
697
978
|
];
|
|
@@ -700,7 +981,8 @@ export const WithValidationClassesAdded: Story = {
|
|
|
700
981
|
parameters: {
|
|
701
982
|
docs: {
|
|
702
983
|
description: {
|
|
703
|
-
story:
|
|
984
|
+
story:
|
|
985
|
+
'If you need to show invalid styling in the cell when not editing, you can add the ds-table__cell--invalid class to the cell. See https://www.ag-grid.com/javascript-data-grid/cell-styles/ on how to add styling to cells.',
|
|
704
986
|
},
|
|
705
987
|
},
|
|
706
988
|
},
|
|
@@ -737,7 +1019,13 @@ const marksheetTidyTableColumnDefs: (ColDef | ColGroupDef)[] = [
|
|
|
737
1019
|
headerName: 'Assessment Component',
|
|
738
1020
|
field: 'assessmentComponent',
|
|
739
1021
|
cellRenderer: 'dsSelectDropdownCellRenderer',
|
|
740
|
-
cellRendererParams:
|
|
1022
|
+
cellRendererParams: (params: CustomCellRendererProps) => {
|
|
1023
|
+
return {
|
|
1024
|
+
options: assessmentComponentOptions,
|
|
1025
|
+
placeholder: 'Select',
|
|
1026
|
+
hasError: params.node.data.assessmentComponent === 'comp-maths',
|
|
1027
|
+
};
|
|
1028
|
+
},
|
|
741
1029
|
editable: false,
|
|
742
1030
|
},
|
|
743
1031
|
{
|
|
@@ -770,27 +1058,90 @@ const marksheetTidyTableData = [
|
|
|
770
1058
|
id: 2,
|
|
771
1059
|
name: 'Autumn',
|
|
772
1060
|
children: [
|
|
773
|
-
{
|
|
774
|
-
|
|
775
|
-
|
|
1061
|
+
{
|
|
1062
|
+
id: 3,
|
|
1063
|
+
name: 'English Language',
|
|
1064
|
+
assessmentComponent: 'comp-english-lang',
|
|
1065
|
+
visibility: 'auto-visible',
|
|
1066
|
+
editable: true,
|
|
1067
|
+
formatting: undefined,
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
id: 4,
|
|
1071
|
+
name: 'English Literature',
|
|
1072
|
+
assessmentComponent: 'comp-english-lit',
|
|
1073
|
+
visibility: 'auto-visible',
|
|
1074
|
+
editable: true,
|
|
1075
|
+
formatting: undefined,
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
id: 5,
|
|
1079
|
+
name: 'Maths',
|
|
1080
|
+
assessmentComponent: 'comp-maths',
|
|
1081
|
+
visibility: 'auto-visible',
|
|
1082
|
+
editable: true,
|
|
1083
|
+
formatting: undefined,
|
|
1084
|
+
},
|
|
776
1085
|
],
|
|
777
1086
|
},
|
|
778
1087
|
{
|
|
779
1088
|
id: 6,
|
|
780
1089
|
name: 'Spring',
|
|
781
1090
|
children: [
|
|
782
|
-
{
|
|
783
|
-
|
|
784
|
-
|
|
1091
|
+
{
|
|
1092
|
+
id: 7,
|
|
1093
|
+
name: 'English Language',
|
|
1094
|
+
assessmentComponent: 'comp-english-lang',
|
|
1095
|
+
visibility: 'auto-visible',
|
|
1096
|
+
editable: true,
|
|
1097
|
+
formatting: undefined,
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
id: 8,
|
|
1101
|
+
name: 'English Literature',
|
|
1102
|
+
assessmentComponent: 'comp-english-lit',
|
|
1103
|
+
visibility: 'auto-visible',
|
|
1104
|
+
editable: true,
|
|
1105
|
+
formatting: undefined,
|
|
1106
|
+
},
|
|
1107
|
+
{
|
|
1108
|
+
id: 9,
|
|
1109
|
+
name: 'Maths',
|
|
1110
|
+
assessmentComponent: 'comp-maths',
|
|
1111
|
+
visibility: 'auto-visible',
|
|
1112
|
+
editable: true,
|
|
1113
|
+
formatting: undefined,
|
|
1114
|
+
},
|
|
785
1115
|
],
|
|
786
1116
|
},
|
|
787
1117
|
{
|
|
788
1118
|
id: 10,
|
|
789
1119
|
name: 'Summer',
|
|
790
1120
|
children: [
|
|
791
|
-
{
|
|
792
|
-
|
|
793
|
-
|
|
1121
|
+
{
|
|
1122
|
+
id: 11,
|
|
1123
|
+
name: 'English Language',
|
|
1124
|
+
assessmentComponent: 'comp-english-lang',
|
|
1125
|
+
visibility: 'auto-visible',
|
|
1126
|
+
editable: true,
|
|
1127
|
+
formatting: undefined,
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
id: 12,
|
|
1131
|
+
name: 'English Literature',
|
|
1132
|
+
assessmentComponent: 'comp-english-lit',
|
|
1133
|
+
visibility: 'auto-visible',
|
|
1134
|
+
editable: true,
|
|
1135
|
+
formatting: undefined,
|
|
1136
|
+
},
|
|
1137
|
+
{
|
|
1138
|
+
id: 13,
|
|
1139
|
+
name: 'Maths',
|
|
1140
|
+
assessmentComponent: 'comp-maths',
|
|
1141
|
+
visibility: 'auto-visible',
|
|
1142
|
+
editable: true,
|
|
1143
|
+
formatting: undefined,
|
|
1144
|
+
},
|
|
794
1145
|
],
|
|
795
1146
|
},
|
|
796
1147
|
];
|
|
@@ -835,38 +1186,98 @@ export const TableWithExplicitColours: Story = {
|
|
|
835
1186
|
rowData: [
|
|
836
1187
|
{
|
|
837
1188
|
id: 1,
|
|
838
|
-
name: {
|
|
1189
|
+
name: {
|
|
1190
|
+
value: 'Alice Johnson',
|
|
1191
|
+
backgroundColor: '#e3f2fd',
|
|
1192
|
+
foregroundColor: '#0d47a1',
|
|
1193
|
+
},
|
|
839
1194
|
email: { value: 'alice.johnson@example.com' },
|
|
840
|
-
role: {
|
|
841
|
-
|
|
1195
|
+
role: {
|
|
1196
|
+
value: 'Developer',
|
|
1197
|
+
backgroundColor: '#c8e6c9',
|
|
1198
|
+
foregroundColor: '#1b5e20',
|
|
1199
|
+
},
|
|
1200
|
+
status: {
|
|
1201
|
+
value: 'Active',
|
|
1202
|
+
backgroundColor: '#a5d6a7',
|
|
1203
|
+
foregroundColor: '#2e7d32',
|
|
1204
|
+
},
|
|
842
1205
|
},
|
|
843
1206
|
{
|
|
844
1207
|
id: 2,
|
|
845
|
-
name: {
|
|
1208
|
+
name: {
|
|
1209
|
+
value: 'Bob Smith',
|
|
1210
|
+
backgroundColor: '#fff3e0',
|
|
1211
|
+
foregroundColor: '#e65100',
|
|
1212
|
+
},
|
|
846
1213
|
email: { value: 'bob.smith@example.com' },
|
|
847
|
-
role: {
|
|
848
|
-
|
|
1214
|
+
role: {
|
|
1215
|
+
value: 'Designer',
|
|
1216
|
+
backgroundColor: '#f3e5f5',
|
|
1217
|
+
foregroundColor: '#4a148c',
|
|
1218
|
+
},
|
|
1219
|
+
status: {
|
|
1220
|
+
value: 'Active',
|
|
1221
|
+
backgroundColor: '#a5d6a7',
|
|
1222
|
+
foregroundColor: '#2e7d32',
|
|
1223
|
+
},
|
|
849
1224
|
},
|
|
850
1225
|
{
|
|
851
1226
|
id: 3,
|
|
852
|
-
name: {
|
|
1227
|
+
name: {
|
|
1228
|
+
value: 'Charlie Brown',
|
|
1229
|
+
backgroundColor: '#fce4ec',
|
|
1230
|
+
foregroundColor: '#880e4f',
|
|
1231
|
+
},
|
|
853
1232
|
email: { value: 'charlie.brown@example.com' },
|
|
854
|
-
role: {
|
|
855
|
-
|
|
1233
|
+
role: {
|
|
1234
|
+
value: 'Manager',
|
|
1235
|
+
backgroundColor: '#fff9c4',
|
|
1236
|
+
foregroundColor: '#f57f17',
|
|
1237
|
+
},
|
|
1238
|
+
status: {
|
|
1239
|
+
value: 'Inactive',
|
|
1240
|
+
backgroundColor: '#ffcdd2',
|
|
1241
|
+
foregroundColor: '#b71c1c',
|
|
1242
|
+
},
|
|
856
1243
|
},
|
|
857
1244
|
{
|
|
858
1245
|
id: 4,
|
|
859
|
-
name: {
|
|
1246
|
+
name: {
|
|
1247
|
+
value: 'Diana Prince',
|
|
1248
|
+
backgroundColor: '#e1bee7',
|
|
1249
|
+
foregroundColor: '#6a1b9a',
|
|
1250
|
+
},
|
|
860
1251
|
email: { value: 'diana.prince@example.com' },
|
|
861
|
-
role: {
|
|
862
|
-
|
|
1252
|
+
role: {
|
|
1253
|
+
value: 'Developer',
|
|
1254
|
+
backgroundColor: '#c8e6c9',
|
|
1255
|
+
foregroundColor: '#1b5e20',
|
|
1256
|
+
},
|
|
1257
|
+
status: {
|
|
1258
|
+
value: 'Active',
|
|
1259
|
+
backgroundColor: '#a5d6a7',
|
|
1260
|
+
foregroundColor: '#2e7d32',
|
|
1261
|
+
},
|
|
863
1262
|
},
|
|
864
1263
|
{
|
|
865
1264
|
id: 5,
|
|
866
|
-
name: {
|
|
1265
|
+
name: {
|
|
1266
|
+
value: 'Ethan Hunt',
|
|
1267
|
+
backgroundColor: '#b2ebf2',
|
|
1268
|
+
foregroundColor: '#006064',
|
|
1269
|
+
},
|
|
867
1270
|
email: { value: 'ethan.hunt@example.com' },
|
|
868
|
-
role: {
|
|
869
|
-
|
|
1271
|
+
role: {
|
|
1272
|
+
value: 'Analyst',
|
|
1273
|
+
backgroundColor: '#ffccbc',
|
|
1274
|
+
foregroundColor: '#bf360c',
|
|
1275
|
+
},
|
|
1276
|
+
status: {
|
|
1277
|
+
value: 'Active',
|
|
1278
|
+
backgroundColor: '#a5d6a7',
|
|
1279
|
+
foregroundColor: '#2e7d32',
|
|
1280
|
+
},
|
|
870
1281
|
},
|
|
871
1282
|
],
|
|
872
1283
|
columnDefs: sampleColumnDefs,
|
|
@@ -883,7 +1294,8 @@ export const TableWithExplicitColours: Story = {
|
|
|
883
1294
|
parameters: {
|
|
884
1295
|
docs: {
|
|
885
1296
|
description: {
|
|
886
|
-
story:
|
|
1297
|
+
story:
|
|
1298
|
+
'Table cells can define `foregroundColor` and `backgroundColor` fields with any valid CSS color (including ones from our tokens)',
|
|
887
1299
|
},
|
|
888
1300
|
},
|
|
889
1301
|
},
|
|
@@ -942,7 +1354,8 @@ export const TableWithSemanticColors: Story = {
|
|
|
942
1354
|
parameters: {
|
|
943
1355
|
docs: {
|
|
944
1356
|
description: {
|
|
945
|
-
story:
|
|
1357
|
+
story:
|
|
1358
|
+
'Table cells can define a `semanticColor` field with one of the following values: DESTRUCTIVE, CAUTION, INFO, SUCCESS and WARNING',
|
|
946
1359
|
},
|
|
947
1360
|
},
|
|
948
1361
|
},
|