@iress-oss/ids-mcp-server 6.0.0-alpha.1-canary-20251204032753-fe18cab → 6.0.0-alpha.1-canary-20251204040305-3639454
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/generated/docs/components_components-alert-docs.md +1054 -0
- package/generated/docs/components_components-autocomplete-docs.md +3304 -0
- package/generated/docs/components_components-autocomplete-recipes-docs.md +98 -0
- package/generated/docs/components_components-badge-docs.md +312 -0
- package/generated/docs/components_components-button-docs.md +2339 -0
- package/generated/docs/components_components-buttongroup-docs.md +980 -0
- package/generated/docs/components_components-card-docs.md +1970 -0
- package/generated/docs/components_components-checkbox-docs.md +1083 -0
- package/generated/docs/components_components-checkboxgroup-docs.md +1597 -0
- package/generated/docs/components_components-checkboxgroup-recipes-docs.md +209 -0
- package/generated/docs/components_components-col-docs.md +755 -0
- package/generated/docs/components_components-container-docs.md +172 -0
- package/generated/docs/components_components-divider-docs.md +235 -0
- package/generated/docs/components_components-expander-docs.md +428 -0
- package/generated/docs/components_components-field-docs.md +3345 -0
- package/generated/docs/components_components-filter-docs.md +4091 -0
- package/generated/docs/components_components-hide-docs.md +450 -0
- package/generated/docs/components_components-icon-docs.md +1017 -0
- package/generated/docs/components_components-image-docs.md +168 -0
- package/generated/docs/components_components-inline-docs.md +1962 -0
- package/generated/docs/components_components-input-docs.md +1388 -0
- package/generated/docs/components_components-input-recipes-docs.md +349 -0
- package/generated/docs/components_components-inputcurrency-docs.md +636 -0
- package/generated/docs/components_components-inputcurrency-recipes-docs.md +208 -0
- package/generated/docs/components_components-introduction-docs.md +448 -0
- package/generated/docs/components_components-label-docs.md +229 -0
- package/generated/docs/components_components-link-docs.md +454 -0
- package/generated/docs/components_components-menu-docs.md +2219 -0
- package/generated/docs/components_components-menu-menuitem-docs.md +1455 -0
- package/generated/docs/components_components-modal-docs.md +2002 -0
- package/generated/docs/components_components-panel-docs.md +342 -0
- package/generated/docs/components_components-placeholder-docs.md +98 -0
- package/generated/docs/components_components-popover-docs.md +1631 -0
- package/generated/docs/components_components-popover-recipes-docs.md +537 -0
- package/generated/docs/components_components-progress-docs.md +128 -0
- package/generated/docs/components_components-provider-docs.md +123 -0
- package/generated/docs/components_components-radio-docs.md +499 -0
- package/generated/docs/components_components-radiogroup-docs.md +1573 -0
- package/generated/docs/components_components-readonly-docs.md +277 -0
- package/generated/docs/components_components-richselect-docs.md +6101 -0
- package/generated/docs/components_components-row-docs.md +2172 -0
- package/generated/docs/components_components-select-docs.md +1110 -0
- package/generated/docs/components_components-skeleton-docs.md +467 -0
- package/generated/docs/components_components-skeleton-recipes-docs.md +110 -0
- package/generated/docs/components_components-skiplink-docs.md +220 -0
- package/generated/docs/components_components-slideout-docs.md +1910 -0
- package/generated/docs/components_components-slider-docs.md +1284 -0
- package/generated/docs/components_components-spinner-docs.md +90 -0
- package/generated/docs/components_components-stack-docs.md +730 -0
- package/generated/docs/components_components-table-docs.md +4038 -0
- package/generated/docs/components_components-tabset-docs.md +955 -0
- package/generated/docs/components_components-tabset-tab-docs.md +342 -0
- package/generated/docs/components_components-tag-docs.md +410 -0
- package/generated/docs/components_components-text-docs.md +593 -0
- package/generated/docs/components_components-toaster-docs.md +451 -0
- package/generated/docs/components_components-toggle-docs.md +513 -0
- package/generated/docs/components_components-tooltip-docs.md +564 -0
- package/generated/docs/components_components-validationmessage-docs.md +608 -0
- package/generated/docs/components_contact-us-docs.md +9 -0
- package/generated/docs/components_foundations-accessibility-docs.md +33 -0
- package/generated/docs/components_foundations-consistency-docs.md +44 -0
- package/generated/docs/components_foundations-content-docs.md +18 -0
- package/generated/docs/components_foundations-introduction-docs.md +17 -0
- package/generated/docs/components_foundations-principles-docs.md +60 -0
- package/generated/docs/components_foundations-responsive-layout-docs.md +2692 -0
- package/generated/docs/components_foundations-user-experience-docs.md +53 -0
- package/generated/docs/components_foundations-visual-design-docs.md +39 -0
- package/generated/docs/components_foundations-z-index-stacking-docs.md +288 -0
- package/generated/docs/components_frequently-asked-questions-docs.md +44 -0
- package/generated/docs/components_get-started-develop-docs.md +47 -0
- package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
- package/generated/docs/components_introduction-docs.md +85 -0
- package/generated/docs/components_patterns-form-docs.md +2469 -0
- package/generated/docs/components_patterns-form-recipes-docs.md +1597 -0
- package/generated/docs/components_patterns-introduction-docs.md +31 -0
- package/generated/docs/components_patterns-loading-docs.md +1908 -0
- package/generated/docs/components_patterns-shadow-docs.md +195 -0
- package/generated/docs/components_resources-code-katas-docs.md +25 -0
- package/generated/docs/components_resources-introduction-docs.md +28 -0
- package/generated/docs/components_resources-mcp-server-docs.md +23 -0
- package/generated/docs/components_resources-migration-guides-from-v4-to-v5-docs.md +142 -0
- package/generated/docs/components_styling-props-colour-docs.md +91 -0
- package/generated/docs/components_styling-props-elevation-docs.md +69 -0
- package/generated/docs/components_styling-props-radius-docs.md +63 -0
- package/generated/docs/components_styling-props-reference-docs.md +160 -0
- package/generated/docs/components_styling-props-screen-readers-docs.md +66 -0
- package/generated/docs/components_styling-props-sizing-docs.md +217 -0
- package/generated/docs/components_styling-props-spacing-docs.md +545 -0
- package/generated/docs/components_styling-props-typography-docs.md +66 -0
- package/generated/docs/components_versions-docs.md +14 -0
- package/generated/docs/guidelines.md +3083 -0
- package/generated/docs/introduction-docs.md +37 -0
- package/generated/docs/tokens_colour-docs.md +479 -0
- package/generated/docs/tokens_elevation-docs.md +39 -0
- package/generated/docs/tokens_introduction-docs.md +150 -0
- package/generated/docs/tokens_radius-docs.md +67 -0
- package/generated/docs/tokens_spacing-docs.md +87 -0
- package/generated/docs/tokens_typography-docs.md +305 -0
- package/package.json +2 -2
|
@@ -0,0 +1,4038 @@
|
|
|
1
|
+
Table
|
|
2
|
+
=====
|
|
3
|
+
|
|
4
|
+
Overview
|
|
5
|
+
--------
|
|
6
|
+
|
|
7
|
+
Data driven component for displaying tabular data.
|
|
8
|
+
|
|
9
|
+
* * *
|
|
10
|
+
|
|
11
|
+
Updated
|
|
12
|
+
|
|
13
|
+
**Recently updated**
|
|
14
|
+
|
|
15
|
+
This component has been recently updated with new props. The props have been marked as beta. Please tell us if there are any issues.
|
|
16
|
+
|
|
17
|
+
[](./iframe.html?id=components-table--automatic-columns)
|
|
18
|
+
|
|
19
|
+
My investments
|
|
20
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
21
|
+
| --- | --- | --- | --- |
|
|
22
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
|
|
23
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49 |
|
|
24
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
<IressTable
|
|
29
|
+
caption\="My investments"
|
|
30
|
+
rows\={\[
|
|
31
|
+
{
|
|
32
|
+
cost: 23898,
|
|
33
|
+
investmentDate: '2019-09-23',
|
|
34
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
35
|
+
totalPercentage: 24.8
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
cost: 49751.4,
|
|
39
|
+
investmentDate: '2020-06-28',
|
|
40
|
+
investment\_name: 'CASH.CASH',
|
|
41
|
+
totalPercentage: 49
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
cost: 26382.456,
|
|
45
|
+
investmentDate: '2019-02-05',
|
|
46
|
+
investment\_name: 'VODAFONE GRP',
|
|
47
|
+
totalPercentage: 26.2
|
|
48
|
+
}
|
|
49
|
+
\]}
|
|
50
|
+
/>
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Props
|
|
55
|
+
-----
|
|
56
|
+
|
|
57
|
+
| Name | Description | Default | Control |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| alternate |
|
|
60
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
61
|
+
|
|
62
|
+
boolean
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
|
67
|
+
|
|
68
|
+
false
|
|
69
|
+
|
|
70
|
+
| Set boolean |
|
|
71
|
+
| caption\* |
|
|
72
|
+
|
|
73
|
+
Caption that describes the data in the table, required for accessibility.
|
|
74
|
+
|
|
75
|
+
ReactNode
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
| \- |
|
|
80
|
+
|
|
81
|
+
"My investments"
|
|
82
|
+
|
|
83
|
+
|
|
|
84
|
+
| children |
|
|
85
|
+
|
|
86
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
87
|
+
|
|
88
|
+
ReactNode
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
| \- | \- |
|
|
93
|
+
| columns |
|
|
94
|
+
|
|
95
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
96
|
+
|
|
97
|
+
TableColumn<TRow, TVal>\[\]
|
|
98
|
+
|
|
99
|
+
| \- | Set object |
|
|
100
|
+
| compact |
|
|
101
|
+
|
|
102
|
+
Compact view of the table, used for tables with a lot of data.
|
|
103
|
+
|
|
104
|
+
boolean
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
|
109
|
+
|
|
110
|
+
false
|
|
111
|
+
|
|
112
|
+
| Set boolean |
|
|
113
|
+
| empty |
|
|
114
|
+
|
|
115
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
116
|
+
|
|
117
|
+
ReactNode
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
| \- | Set object |
|
|
122
|
+
| hiddenCaption |
|
|
123
|
+
|
|
124
|
+
When set to true, the table caption will be visually hidden.
|
|
125
|
+
|
|
126
|
+
boolean
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
| \- | Set boolean |
|
|
131
|
+
| hiddenHeader |
|
|
132
|
+
|
|
133
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
134
|
+
|
|
135
|
+
boolean
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
| \- | Set boolean |
|
|
140
|
+
| hover |
|
|
141
|
+
|
|
142
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
143
|
+
|
|
144
|
+
boolean
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
| \- | Set boolean |
|
|
149
|
+
| removeRowBorders |
|
|
150
|
+
|
|
151
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
152
|
+
|
|
153
|
+
boolean
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
|
158
|
+
|
|
159
|
+
false
|
|
160
|
+
|
|
161
|
+
| Set boolean |
|
|
162
|
+
| rowProps |
|
|
163
|
+
|
|
164
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
165
|
+
|
|
166
|
+
TableRowsProps\['rowProps'\]
|
|
167
|
+
|
|
168
|
+
| \- | Set object |
|
|
169
|
+
| rows |
|
|
170
|
+
|
|
171
|
+
Each object in the array contains the data for a row.
|
|
172
|
+
|
|
173
|
+
TRow\[\]
|
|
174
|
+
|
|
175
|
+
| \[\] |
|
|
176
|
+
|
|
177
|
+
RAW
|
|
178
|
+
|
|
179
|
+
* rows :
|
|
180
|
+
|
|
181
|
+
\[
|
|
182
|
+
|
|
183
|
+
* 0 :
|
|
184
|
+
|
|
185
|
+
{...} 4 keys
|
|
186
|
+
|
|
187
|
+
* 1 :
|
|
188
|
+
|
|
189
|
+
{...} 4 keys
|
|
190
|
+
|
|
191
|
+
* 2 :
|
|
192
|
+
|
|
193
|
+
{...} 4 keys
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
\]
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
|
202
|
+
| scope |
|
|
203
|
+
|
|
204
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
205
|
+
|
|
206
|
+
union
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
| \- |
|
|
211
|
+
|
|
212
|
+
rowcol
|
|
213
|
+
|
|
214
|
+
|
|
|
215
|
+
|
|
216
|
+
Usage
|
|
217
|
+
-----
|
|
218
|
+
|
|
219
|
+
### Automatic columns
|
|
220
|
+
|
|
221
|
+
To get started, the `IressTable` component only requires the `caption` and `rows` props to be set.
|
|
222
|
+
|
|
223
|
+
* `caption` a string describing what the table is displaying (required for accessibility, it can be visually hidden by setting the `hiddenCaption` prop).
|
|
224
|
+
* `rows` are an array of objects, each object represents a row in the table. The table will use the key of the first object to determine the columns, automatically made human readable if the key is camel case, snake case or kebab case.
|
|
225
|
+
|
|
226
|
+
[](./iframe.html?id=components-table--automatic-columns)
|
|
227
|
+
|
|
228
|
+
My investments
|
|
229
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
230
|
+
| --- | --- | --- | --- |
|
|
231
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
|
|
232
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49 |
|
|
233
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
<IressTable
|
|
238
|
+
caption\="My investments"
|
|
239
|
+
rows\={\[
|
|
240
|
+
{
|
|
241
|
+
cost: 23898,
|
|
242
|
+
investmentDate: '2019-09-23',
|
|
243
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
244
|
+
totalPercentage: 24.8
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
cost: 49751.4,
|
|
248
|
+
investmentDate: '2020-06-28',
|
|
249
|
+
investment\_name: 'CASH.CASH',
|
|
250
|
+
totalPercentage: 49
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
cost: 26382.456,
|
|
254
|
+
investmentDate: '2019-02-05',
|
|
255
|
+
investment\_name: 'VODAFONE GRP',
|
|
256
|
+
totalPercentage: 26.2
|
|
257
|
+
}
|
|
258
|
+
\]}
|
|
259
|
+
/>
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### Props
|
|
264
|
+
|
|
265
|
+
| Name | Description | Default | Control |
|
|
266
|
+
| --- | --- | --- | --- |
|
|
267
|
+
| alternate |
|
|
268
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
269
|
+
|
|
270
|
+
boolean
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
|
275
|
+
|
|
276
|
+
false
|
|
277
|
+
|
|
278
|
+
| Set boolean |
|
|
279
|
+
| caption\* |
|
|
280
|
+
|
|
281
|
+
Caption that describes the data in the table, required for accessibility.
|
|
282
|
+
|
|
283
|
+
ReactNode
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
| \- |
|
|
288
|
+
|
|
289
|
+
"My investments"
|
|
290
|
+
|
|
291
|
+
|
|
|
292
|
+
| children |
|
|
293
|
+
|
|
294
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
295
|
+
|
|
296
|
+
ReactNode
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
| \- | \- |
|
|
301
|
+
| columns |
|
|
302
|
+
|
|
303
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
304
|
+
|
|
305
|
+
TableColumn<TRow, TVal>\[\]
|
|
306
|
+
|
|
307
|
+
| \- | Set object |
|
|
308
|
+
| compact |
|
|
309
|
+
|
|
310
|
+
Compact view of the table, used for tables with a lot of data.
|
|
311
|
+
|
|
312
|
+
boolean
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
|
317
|
+
|
|
318
|
+
false
|
|
319
|
+
|
|
320
|
+
| Set boolean |
|
|
321
|
+
| empty |
|
|
322
|
+
|
|
323
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
324
|
+
|
|
325
|
+
ReactNode
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
| \- | Set object |
|
|
330
|
+
| hiddenCaption |
|
|
331
|
+
|
|
332
|
+
When set to true, the table caption will be visually hidden.
|
|
333
|
+
|
|
334
|
+
boolean
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
| \- | Set boolean |
|
|
339
|
+
| hiddenHeader |
|
|
340
|
+
|
|
341
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
342
|
+
|
|
343
|
+
boolean
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
| \- | Set boolean |
|
|
348
|
+
| hover |
|
|
349
|
+
|
|
350
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
351
|
+
|
|
352
|
+
boolean
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
| \- | Set boolean |
|
|
357
|
+
| removeRowBorders |
|
|
358
|
+
|
|
359
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
360
|
+
|
|
361
|
+
boolean
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
|
366
|
+
|
|
367
|
+
false
|
|
368
|
+
|
|
369
|
+
| Set boolean |
|
|
370
|
+
| rowProps |
|
|
371
|
+
|
|
372
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
373
|
+
|
|
374
|
+
TableRowsProps\['rowProps'\]
|
|
375
|
+
|
|
376
|
+
| \- | Set object |
|
|
377
|
+
| rows |
|
|
378
|
+
|
|
379
|
+
Each object in the array contains the data for a row.
|
|
380
|
+
|
|
381
|
+
TRow\[\]
|
|
382
|
+
|
|
383
|
+
| \[\] |
|
|
384
|
+
|
|
385
|
+
RAW
|
|
386
|
+
|
|
387
|
+
* rows :
|
|
388
|
+
|
|
389
|
+
\[
|
|
390
|
+
|
|
391
|
+
* 0 :
|
|
392
|
+
|
|
393
|
+
{...} 4 keys
|
|
394
|
+
|
|
395
|
+
* 1 :
|
|
396
|
+
|
|
397
|
+
{...} 4 keys
|
|
398
|
+
|
|
399
|
+
* 2 :
|
|
400
|
+
|
|
401
|
+
{...} 4 keys
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
\]
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
|
410
|
+
| scope |
|
|
411
|
+
|
|
412
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
413
|
+
|
|
414
|
+
union
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
| \- |
|
|
419
|
+
|
|
420
|
+
rowcol
|
|
421
|
+
|
|
422
|
+
|
|
|
423
|
+
|
|
424
|
+
### Custom columns
|
|
425
|
+
|
|
426
|
+
For more control over the columns, the `columns` prop can be used to define the columns. This accepts an array of `TableColumn` objects.
|
|
427
|
+
|
|
428
|
+
Each array item represents a key in the objects in your `rows` prop. If one of the keys in your `rows` prop is not defined in the `columns` prop, it will not be displayed in the table.
|
|
429
|
+
|
|
430
|
+
[](./iframe.html?id=components-table--custom-columns)
|
|
431
|
+
|
|
432
|
+
My investments
|
|
433
|
+
| Investment | Date | Share | Cost |
|
|
434
|
+
| --- | --- | --- | --- |
|
|
435
|
+
| Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 |
|
|
436
|
+
| CASH.CASH | 28/06/2020 | 49% | $49,751.40 |
|
|
437
|
+
| VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 |
|
|
438
|
+
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
import {
|
|
442
|
+
IressBadge,
|
|
443
|
+
IressTable,
|
|
444
|
+
IressTableFormattedValue,
|
|
445
|
+
type IressTableProps,
|
|
446
|
+
} from '@iress-oss/ids-components';
|
|
447
|
+
type Props \= Partial<IressTableProps<object, never\>>;
|
|
448
|
+
const renderColumn \= (value: number) \=> (
|
|
449
|
+
<IressBadge mode\={value \> 30000 ? 'success' : 'danger'}\>
|
|
450
|
+
<IressTableFormattedValue value\={value} format\="currency" />
|
|
451
|
+
</IressBadge\>
|
|
452
|
+
);
|
|
453
|
+
export const TableCustomColumns \= () \=> (
|
|
454
|
+
<IressTable
|
|
455
|
+
caption\="My investments"
|
|
456
|
+
rows\={\[
|
|
457
|
+
{
|
|
458
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
459
|
+
cost: 23898,
|
|
460
|
+
investmentDate: '2019-09-23',
|
|
461
|
+
totalPercentage: 24.8,
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
investment\_name: 'CASH.CASH',
|
|
465
|
+
cost: 49751.4,
|
|
466
|
+
investmentDate: '2020-06-28',
|
|
467
|
+
totalPercentage: 49,
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
investment\_name: 'VODAFONE GRP',
|
|
471
|
+
cost: 26382.456,
|
|
472
|
+
investmentDate: '2019-02-05',
|
|
473
|
+
totalPercentage: 26.2,
|
|
474
|
+
},
|
|
475
|
+
\]}
|
|
476
|
+
|
|
477
|
+
columns\={\[
|
|
478
|
+
{
|
|
479
|
+
key: 'investment\_name',
|
|
480
|
+
label: 'Investment',
|
|
481
|
+
divider: true,
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
key: 'investmentDate',
|
|
485
|
+
label: 'Date',
|
|
486
|
+
format: 'date',
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
key: 'totalPercentage',
|
|
490
|
+
label: 'Share',
|
|
491
|
+
format: 'percent',
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
key: 'cost',
|
|
495
|
+
label: 'Cost',
|
|
496
|
+
textAlign: 'right',
|
|
497
|
+
format: renderColumn,
|
|
498
|
+
},
|
|
499
|
+
\]}
|
|
500
|
+
/>
|
|
501
|
+
);
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
#### Props
|
|
506
|
+
|
|
507
|
+
| Name | Description | Default | Control |
|
|
508
|
+
| --- | --- | --- | --- |
|
|
509
|
+
| alternate |
|
|
510
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
511
|
+
|
|
512
|
+
boolean
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
|
517
|
+
|
|
518
|
+
false
|
|
519
|
+
|
|
520
|
+
| Set boolean |
|
|
521
|
+
| caption\* |
|
|
522
|
+
|
|
523
|
+
Caption that describes the data in the table, required for accessibility.
|
|
524
|
+
|
|
525
|
+
ReactNode
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
| \- | \- |
|
|
530
|
+
| children |
|
|
531
|
+
|
|
532
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
533
|
+
|
|
534
|
+
ReactNode
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
| \- | \- |
|
|
539
|
+
| columns |
|
|
540
|
+
|
|
541
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
542
|
+
|
|
543
|
+
TableColumn<TRow, TVal>\[\]
|
|
544
|
+
|
|
545
|
+
| \- | \- |
|
|
546
|
+
| compact |
|
|
547
|
+
|
|
548
|
+
Compact view of the table, used for tables with a lot of data.
|
|
549
|
+
|
|
550
|
+
boolean
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
|
555
|
+
|
|
556
|
+
false
|
|
557
|
+
|
|
558
|
+
| Set boolean |
|
|
559
|
+
| empty |
|
|
560
|
+
|
|
561
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
562
|
+
|
|
563
|
+
ReactNode
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
| \- | Set object |
|
|
568
|
+
| hiddenCaption |
|
|
569
|
+
|
|
570
|
+
When set to true, the table caption will be visually hidden.
|
|
571
|
+
|
|
572
|
+
boolean
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
| \- | Set boolean |
|
|
577
|
+
| hiddenHeader |
|
|
578
|
+
|
|
579
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
580
|
+
|
|
581
|
+
boolean
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
| \- | Set boolean |
|
|
586
|
+
| hover |
|
|
587
|
+
|
|
588
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
589
|
+
|
|
590
|
+
boolean
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
| \- | Set boolean |
|
|
595
|
+
| removeRowBorders |
|
|
596
|
+
|
|
597
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
598
|
+
|
|
599
|
+
boolean
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
|
604
|
+
|
|
605
|
+
false
|
|
606
|
+
|
|
607
|
+
| Set boolean |
|
|
608
|
+
| rowProps |
|
|
609
|
+
|
|
610
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
611
|
+
|
|
612
|
+
TableRowsProps\['rowProps'\]
|
|
613
|
+
|
|
614
|
+
| \- | Set object |
|
|
615
|
+
| rows |
|
|
616
|
+
|
|
617
|
+
Each object in the array contains the data for a row.
|
|
618
|
+
|
|
619
|
+
TRow\[\]
|
|
620
|
+
|
|
621
|
+
| \[\] | \- |
|
|
622
|
+
| scope |
|
|
623
|
+
|
|
624
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
625
|
+
|
|
626
|
+
union
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
| \- |
|
|
631
|
+
|
|
632
|
+
rowcol
|
|
633
|
+
|
|
634
|
+
|
|
|
635
|
+
|
|
636
|
+
### Column API
|
|
637
|
+
|
|
638
|
+
These are the configuration options available for each column.
|
|
639
|
+
|
|
640
|
+
**Note:** The `id` prop has been removed. The `key` is always used for the id of the table cell, alongside its row index.
|
|
641
|
+
|
|
642
|
+
export interface TableColumn<TRow extends object, TVal \= unknown\> {
|
|
643
|
+
/\*\*
|
|
644
|
+
\* Aligns the content of the cell. \* @default left \*/
|
|
645
|
+
align?: TableColumnAligns;
|
|
646
|
+
/\*\*
|
|
647
|
+
\* The currency code to prefix to the value if \`format\` is set to currency. \* @default $ \*/
|
|
648
|
+
currencyCode?: string;
|
|
649
|
+
/\*\*
|
|
650
|
+
\* When set to true, a divider will be rendered after the column. \*/
|
|
651
|
+
divider?: boolean;
|
|
652
|
+
/\*\*
|
|
653
|
+
\* Formats the cell content. \* To use the in-built formatters, set this to: string, number, date, currency, percent. \* Use a custom formatter by passing a function that returns a ReactNode. \*/
|
|
654
|
+
format?: TableCellFormats | ((value: TVal, row?: TRow) \=> ReactNode);
|
|
655
|
+
/\*\*
|
|
656
|
+
\* The unique key for the column. \*/
|
|
657
|
+
key: string;
|
|
658
|
+
/\*\*
|
|
659
|
+
\* The label for the column header. \*/
|
|
660
|
+
label?: ReactNode;
|
|
661
|
+
/\*\*
|
|
662
|
+
\* When set to true, the column will be sortable. \* Setting it to either \`asc\` or \`desc\` will set the initial sort order. \*/
|
|
663
|
+
sort?: boolean | SortDirection;
|
|
664
|
+
/\*\*
|
|
665
|
+
\* Text to be read by a screen reader when a column is sortable (but not currently sorted). \* @default sortable \*/
|
|
666
|
+
sortableText?: string;
|
|
667
|
+
/\*\*
|
|
668
|
+
\* The width of the column. \*/
|
|
669
|
+
width?: string;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
Examples
|
|
675
|
+
--------
|
|
676
|
+
|
|
677
|
+
### Formats
|
|
678
|
+
|
|
679
|
+
The table component provides some basic formatting. This is controlled by the `format` property of the `TableColumn` object.
|
|
680
|
+
|
|
681
|
+
* `date`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as DD/MM/YYYY.
|
|
682
|
+
* `currency`: the value (which should be a number or a string containing a number) is formatted with the `currencyCode` (also a prop on `TableColumn` which defaults to `$`) prepended to the number (formatted to 2 decimal places). Currency formatted columns are automatically right aligned for readability.
|
|
683
|
+
* `percent`: the value (which should be a number or a string containing a number) is formatted as a percentage (multiplied by 100 and rounded to 2 decimal places).
|
|
684
|
+
* `number`: the number format aligns the number to the right, and converts strings to a number.
|
|
685
|
+
* `shortDate`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as DD MMM YYYY.
|
|
686
|
+
* `isoDateTime`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as YYYY-MM-DD HH:mm:ss (Timezone)
|
|
687
|
+
* `relativeTime`: the value (which can be a Date object, timestamp or a ISO8601 formatted string) will be formatted to render as a relative time (eg. 2 days ago, 3 hours ago, etc). It will fallback to the `shortDate` format if the date is more than one week in the past.
|
|
688
|
+
|
|
689
|
+
To completely customise it, you can also send in a function that returns a ReactNode. It has two parameters, the original value and the row it is connected to.
|
|
690
|
+
|
|
691
|
+
[](./iframe.html?id=components-table--formats)
|
|
692
|
+
|
|
693
|
+
Available formats
|
|
694
|
+
| String | Number | Date | Short date | ISO Date & Time | Relative time | Currency (AUD) | Percent | Custom |
|
|
695
|
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
696
|
+
| Hello, world! | 123456 | 28/06/2020 | 28 Jun 2020 | 2020-06-28 00:00:00 (UTC) | 22 seconds ago | $123,456.78 | 12% | Custom |
|
|
697
|
+
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
import { IressBadge, IressTable, type IressTableProps } from '@iress-oss/ids-components';
|
|
701
|
+
type Props \= Partial<IressTableProps<object, never\>>;
|
|
702
|
+
const renderColumn \= (value: string) \=> (
|
|
703
|
+
<IressBadge mode\="info"\>{value}</IressBadge\>
|
|
704
|
+
);
|
|
705
|
+
// https://blog.devgenius.io/javascript-date-subtract-seconds-83b3285b7959
|
|
706
|
+
const subtractSeconds \= (date: Date, seconds: number) \=> {
|
|
707
|
+
// make copy with Date() constructor
|
|
708
|
+
const dateCopy \= new Date(date);
|
|
709
|
+
dateCopy.setSeconds(date.getSeconds() \- seconds);
|
|
710
|
+
return dateCopy;
|
|
711
|
+
};
|
|
712
|
+
const tenSecondsAgo \= subtractSeconds(new Date(), 10);
|
|
713
|
+
export const TableFormats \= () \=> (
|
|
714
|
+
<IressTable
|
|
715
|
+
caption\="Available formats"
|
|
716
|
+
rows\={\[
|
|
717
|
+
{
|
|
718
|
+
string: 'Hello, world!',
|
|
719
|
+
number: 123456,
|
|
720
|
+
date: '2020-06-28',
|
|
721
|
+
shortDate: '2020-06-28',
|
|
722
|
+
isoDateTime: '2020-06-28',
|
|
723
|
+
relativeTime: tenSecondsAgo,
|
|
724
|
+
currency: 123456.78,
|
|
725
|
+
percent: 12,
|
|
726
|
+
custom: 'Custom',
|
|
727
|
+
},
|
|
728
|
+
\]}
|
|
729
|
+
|
|
730
|
+
columns\={\[
|
|
731
|
+
{ key: 'string', label: 'String', format: 'string' },
|
|
732
|
+
{ key: 'number', label: 'Number', format: 'number' },
|
|
733
|
+
{ key: 'date', label: 'Date', format: 'date' },
|
|
734
|
+
{ key: 'shortDate', label: 'Short date', format: 'shortDate' },
|
|
735
|
+
{ key: 'isoDateTime', label: 'ISO Date & Time', format: 'isoDateTime' },
|
|
736
|
+
{ key: 'relativeTime', label: 'Relative time', format: 'relativeTime' },
|
|
737
|
+
{
|
|
738
|
+
key: 'currency',
|
|
739
|
+
label: 'Currency (AUD)',
|
|
740
|
+
format: 'currency',
|
|
741
|
+
currencyCode: '',
|
|
742
|
+
},
|
|
743
|
+
{ key: 'percent', label: 'Percent', format: 'percent' },
|
|
744
|
+
{
|
|
745
|
+
key: 'custom',
|
|
746
|
+
label: 'Custom',
|
|
747
|
+
format: renderColumn,
|
|
748
|
+
},
|
|
749
|
+
\]}
|
|
750
|
+
/>
|
|
751
|
+
);
|
|
752
|
+
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
#### Props
|
|
756
|
+
|
|
757
|
+
| Name | Description | Default | Control |
|
|
758
|
+
| --- | --- | --- | --- |
|
|
759
|
+
| alternate |
|
|
760
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
761
|
+
|
|
762
|
+
boolean
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
|
767
|
+
|
|
768
|
+
false
|
|
769
|
+
|
|
770
|
+
| Set boolean |
|
|
771
|
+
| caption\* |
|
|
772
|
+
|
|
773
|
+
Caption that describes the data in the table, required for accessibility.
|
|
774
|
+
|
|
775
|
+
ReactNode
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
| \- | \- |
|
|
780
|
+
| children |
|
|
781
|
+
|
|
782
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
783
|
+
|
|
784
|
+
ReactNode
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
| \- | \- |
|
|
789
|
+
| columns |
|
|
790
|
+
|
|
791
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
792
|
+
|
|
793
|
+
TableColumn<TRow, TVal>\[\]
|
|
794
|
+
|
|
795
|
+
| \- | \- |
|
|
796
|
+
| compact |
|
|
797
|
+
|
|
798
|
+
Compact view of the table, used for tables with a lot of data.
|
|
799
|
+
|
|
800
|
+
boolean
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
|
|
|
805
|
+
|
|
806
|
+
false
|
|
807
|
+
|
|
808
|
+
| Set boolean |
|
|
809
|
+
| empty |
|
|
810
|
+
|
|
811
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
812
|
+
|
|
813
|
+
ReactNode
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
| \- | Set object |
|
|
818
|
+
| hiddenCaption |
|
|
819
|
+
|
|
820
|
+
When set to true, the table caption will be visually hidden.
|
|
821
|
+
|
|
822
|
+
boolean
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
| \- | Set boolean |
|
|
827
|
+
| hiddenHeader |
|
|
828
|
+
|
|
829
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
830
|
+
|
|
831
|
+
boolean
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
| \- | Set boolean |
|
|
836
|
+
| hover |
|
|
837
|
+
|
|
838
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
839
|
+
|
|
840
|
+
boolean
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
| \- | Set boolean |
|
|
845
|
+
| removeRowBorders |
|
|
846
|
+
|
|
847
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
848
|
+
|
|
849
|
+
boolean
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
|
854
|
+
|
|
855
|
+
false
|
|
856
|
+
|
|
857
|
+
| Set boolean |
|
|
858
|
+
| rowProps |
|
|
859
|
+
|
|
860
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
861
|
+
|
|
862
|
+
TableRowsProps\['rowProps'\]
|
|
863
|
+
|
|
864
|
+
| \- | Set object |
|
|
865
|
+
| rows |
|
|
866
|
+
|
|
867
|
+
Each object in the array contains the data for a row.
|
|
868
|
+
|
|
869
|
+
TRow\[\]
|
|
870
|
+
|
|
871
|
+
| \[\] | \- |
|
|
872
|
+
| scope |
|
|
873
|
+
|
|
874
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
875
|
+
|
|
876
|
+
union
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
| \- |
|
|
881
|
+
|
|
882
|
+
rowcol
|
|
883
|
+
|
|
884
|
+
|
|
|
885
|
+
|
|
886
|
+
### Sorting
|
|
887
|
+
|
|
888
|
+
Sorting can be enabled on a column by setting the `sort` property of the `TableColumn` to true. It can also be set to `asc` or `desc` if you would like it to initally sort in a certain direction.
|
|
889
|
+
|
|
890
|
+
The sort button has some visually hidden text for screenreaders to signify that the column is sortable. If you need to change this (ie. for translation purposes), it can be done with the `sortableText` column option which defaults to: sortable.
|
|
891
|
+
|
|
892
|
+
[](./iframe.html?id=components-table--sorting)
|
|
893
|
+
|
|
894
|
+
My investments
|
|
895
|
+
| Investment | Date | Share | Cost |
|
|
896
|
+
| --- | --- | --- | --- |
|
|
897
|
+
| Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 |
|
|
898
|
+
| CASH.CASH | 28/06/2020 | 49% | $49,751.40 |
|
|
899
|
+
| VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 |
|
|
900
|
+
|
|
901
|
+
```
|
|
902
|
+
|
|
903
|
+
import {
|
|
904
|
+
IressBadge,
|
|
905
|
+
IressTable,
|
|
906
|
+
IressTableFormattedValue,
|
|
907
|
+
type IressTableProps,
|
|
908
|
+
} from '@iress-oss/ids-components';
|
|
909
|
+
type Props \= Partial<IressTableProps<object, never\>>;
|
|
910
|
+
const renderColumn \= (value: number) \=> (
|
|
911
|
+
<IressBadge mode\={value \> 30000 ? 'success' : 'danger'}\>
|
|
912
|
+
<IressTableFormattedValue value\={value} format\="currency" />
|
|
913
|
+
</IressBadge\>
|
|
914
|
+
);
|
|
915
|
+
export const TableSorting \= () \=> (
|
|
916
|
+
<IressTable
|
|
917
|
+
caption\="My investments"
|
|
918
|
+
rows\={\[
|
|
919
|
+
{
|
|
920
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
921
|
+
cost: 23898,
|
|
922
|
+
investmentDate: '2019-09-23',
|
|
923
|
+
totalPercentage: 24.8,
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
investment\_name: 'CASH.CASH',
|
|
927
|
+
cost: 49751.4,
|
|
928
|
+
investmentDate: '2020-06-28',
|
|
929
|
+
totalPercentage: 49,
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
investment\_name: 'VODAFONE GRP',
|
|
933
|
+
cost: 26382.456,
|
|
934
|
+
investmentDate: '2019-02-05',
|
|
935
|
+
totalPercentage: 26.2,
|
|
936
|
+
},
|
|
937
|
+
\]}
|
|
938
|
+
|
|
939
|
+
columns\={\[
|
|
940
|
+
{
|
|
941
|
+
key: 'investment\_name',
|
|
942
|
+
label: 'Investment',
|
|
943
|
+
divider: true,
|
|
944
|
+
sort: 'asc',
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
key: 'investmentDate',
|
|
948
|
+
label: 'Date',
|
|
949
|
+
format: 'date',
|
|
950
|
+
sort: true,
|
|
951
|
+
},
|
|
952
|
+
{
|
|
953
|
+
key: 'totalPercentage',
|
|
954
|
+
label: 'Share',
|
|
955
|
+
format: 'percent',
|
|
956
|
+
sort: true,
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
key: 'cost',
|
|
960
|
+
label: 'Cost',
|
|
961
|
+
textAlign: 'right',
|
|
962
|
+
sort: true,
|
|
963
|
+
format: renderColumn,
|
|
964
|
+
},
|
|
965
|
+
\]}
|
|
966
|
+
/>
|
|
967
|
+
);
|
|
968
|
+
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
#### Props
|
|
972
|
+
|
|
973
|
+
| Name | Description | Default | Control |
|
|
974
|
+
| --- | --- | --- | --- |
|
|
975
|
+
| alternate |
|
|
976
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
977
|
+
|
|
978
|
+
boolean
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
|
983
|
+
|
|
984
|
+
false
|
|
985
|
+
|
|
986
|
+
| Set boolean |
|
|
987
|
+
| caption\* |
|
|
988
|
+
|
|
989
|
+
Caption that describes the data in the table, required for accessibility.
|
|
990
|
+
|
|
991
|
+
ReactNode
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
| \- | \- |
|
|
996
|
+
| children |
|
|
997
|
+
|
|
998
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
999
|
+
|
|
1000
|
+
ReactNode
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
| \- | \- |
|
|
1005
|
+
| columns |
|
|
1006
|
+
|
|
1007
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
1008
|
+
|
|
1009
|
+
TableColumn<TRow, TVal>\[\]
|
|
1010
|
+
|
|
1011
|
+
| \- | \- |
|
|
1012
|
+
| compact |
|
|
1013
|
+
|
|
1014
|
+
Compact view of the table, used for tables with a lot of data.
|
|
1015
|
+
|
|
1016
|
+
boolean
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
|
|
|
1021
|
+
|
|
1022
|
+
false
|
|
1023
|
+
|
|
1024
|
+
| Set boolean |
|
|
1025
|
+
| empty |
|
|
1026
|
+
|
|
1027
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
1028
|
+
|
|
1029
|
+
ReactNode
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
| \- | Set object |
|
|
1034
|
+
| hiddenCaption |
|
|
1035
|
+
|
|
1036
|
+
When set to true, the table caption will be visually hidden.
|
|
1037
|
+
|
|
1038
|
+
boolean
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
| \- | Set boolean |
|
|
1043
|
+
| hiddenHeader |
|
|
1044
|
+
|
|
1045
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
1046
|
+
|
|
1047
|
+
boolean
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
| \- | Set boolean |
|
|
1052
|
+
| hover |
|
|
1053
|
+
|
|
1054
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
1055
|
+
|
|
1056
|
+
boolean
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
| \- | Set boolean |
|
|
1061
|
+
| removeRowBorders |
|
|
1062
|
+
|
|
1063
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
1064
|
+
|
|
1065
|
+
boolean
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
|
1070
|
+
|
|
1071
|
+
false
|
|
1072
|
+
|
|
1073
|
+
| Set boolean |
|
|
1074
|
+
| rowProps |
|
|
1075
|
+
|
|
1076
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
1077
|
+
|
|
1078
|
+
TableRowsProps\['rowProps'\]
|
|
1079
|
+
|
|
1080
|
+
| \- | Set object |
|
|
1081
|
+
| rows |
|
|
1082
|
+
|
|
1083
|
+
Each object in the array contains the data for a row.
|
|
1084
|
+
|
|
1085
|
+
TRow\[\]
|
|
1086
|
+
|
|
1087
|
+
| \[\] | \- |
|
|
1088
|
+
| scope |
|
|
1089
|
+
|
|
1090
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
1091
|
+
|
|
1092
|
+
union
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
| \- |
|
|
1097
|
+
|
|
1098
|
+
rowcol
|
|
1099
|
+
|
|
1100
|
+
|
|
|
1101
|
+
|
|
1102
|
+
### Custom sorting logic
|
|
1103
|
+
|
|
1104
|
+
By default, sorting is automatically inferred from the raw column values.
|
|
1105
|
+
|
|
1106
|
+
If you need to customise the sorting logic, you can use the `sortFn` property of the `TableColumn`. It accepts one of the following values:
|
|
1107
|
+
|
|
1108
|
+
* A `string` referencing a built-in sort function: `alphanumeric`, `alphanumericCaseSensitive`, `text`, `textCaseSensitive`, `datetime` and `basic`. To understand how they work, visit the [Tanstack Table documentation](https://tanstack.com/table/v8/docs/api/features/sorting/#sorting-functions).
|
|
1109
|
+
* A custom sort function that takes two arguments: `a` and `b`, which are the two rows being compared. It should return `-1`, `0` or `1` depending on the comparison.
|
|
1110
|
+
|
|
1111
|
+
[](./iframe.html?id=components-table--custom-sorting-logic)
|
|
1112
|
+
|
|
1113
|
+
My investments
|
|
1114
|
+
| Investment | Date | Share | Cost (sorts by net cost if available) |
|
|
1115
|
+
| --- | --- | --- | --- |
|
|
1116
|
+
| Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 (net: N/A) |
|
|
1117
|
+
| CASH.CASH | 28/06/2020 | 49% | $49,751.40 (net: $20,000.00) |
|
|
1118
|
+
| VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 (net: N/A) |
|
|
1119
|
+
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
import {
|
|
1123
|
+
IressTable,
|
|
1124
|
+
IressTableFormattedValue,
|
|
1125
|
+
type IressTableProps,
|
|
1126
|
+
type TableColumn,
|
|
1127
|
+
} from '@iress-oss/ids-components';
|
|
1128
|
+
type Props \= Partial<IressTableProps<Row, never\>>;
|
|
1129
|
+
interface Row {
|
|
1130
|
+
investment\_name: string;
|
|
1131
|
+
cost: number;
|
|
1132
|
+
netCost?: number;
|
|
1133
|
+
investmentDate: string;
|
|
1134
|
+
totalPercentage: number;
|
|
1135
|
+
}
|
|
1136
|
+
const columns: TableColumn<Row\>\[\] \= \[
|
|
1137
|
+
{
|
|
1138
|
+
key: 'investment\_name',
|
|
1139
|
+
label: 'Investment',
|
|
1140
|
+
divider: true,
|
|
1141
|
+
sort: 'asc',
|
|
1142
|
+
sortFn: 'textCaseSensitive',
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
key: 'investmentDate',
|
|
1146
|
+
label: 'Date',
|
|
1147
|
+
format: 'date',
|
|
1148
|
+
sort: true,
|
|
1149
|
+
sortFn: 'datetime',
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
key: 'totalPercentage',
|
|
1153
|
+
label: 'Share',
|
|
1154
|
+
format: 'percent',
|
|
1155
|
+
sort: true,
|
|
1156
|
+
sortFn: 'alphanumeric',
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
key: 'cost',
|
|
1160
|
+
label: 'Cost (sorts by net cost if available)',
|
|
1161
|
+
textAlign: 'right',
|
|
1162
|
+
format: (value: number, row) \=> {
|
|
1163
|
+
return (
|
|
1164
|
+
<\>
|
|
1165
|
+
<IressTableFormattedValue value\={value} format\="currency" /> (net:{' '}
|
|
1166
|
+
{row?.netCost ? (
|
|
1167
|
+
<IressTableFormattedValue value\={row.netCost} format\="currency" />
|
|
1168
|
+
) : (
|
|
1169
|
+
'N/A'
|
|
1170
|
+
)}
|
|
1171
|
+
) </\>
|
|
1172
|
+
);
|
|
1173
|
+
},
|
|
1174
|
+
sortFn: (a, b) \=> {
|
|
1175
|
+
const aCost \= a.original.netCost ?? a.original.cost;
|
|
1176
|
+
const bCost \= b.original.netCost ?? b.original.cost;
|
|
1177
|
+
return aCost \- bCost;
|
|
1178
|
+
},
|
|
1179
|
+
},
|
|
1180
|
+
\];
|
|
1181
|
+
export const TableSortingFn \= () \=> (
|
|
1182
|
+
<IressTable<Row\>
|
|
1183
|
+
caption\="My investments"
|
|
1184
|
+
rows\={\[
|
|
1185
|
+
{
|
|
1186
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
1187
|
+
cost: 23898,
|
|
1188
|
+
investmentDate: '2019-09-23',
|
|
1189
|
+
totalPercentage: 24.8,
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
investment\_name: 'CASH.CASH',
|
|
1193
|
+
cost: 49751.4,
|
|
1194
|
+
netCost: 20000,
|
|
1195
|
+
investmentDate: '2020-06-28',
|
|
1196
|
+
totalPercentage: 49,
|
|
1197
|
+
},
|
|
1198
|
+
{
|
|
1199
|
+
investment\_name: 'VODAFONE GRP',
|
|
1200
|
+
cost: 26382.456,
|
|
1201
|
+
investmentDate: '2019-02-05',
|
|
1202
|
+
totalPercentage: 26.2,
|
|
1203
|
+
},
|
|
1204
|
+
\]}
|
|
1205
|
+
|
|
1206
|
+
columns\={columns}
|
|
1207
|
+
/\>
|
|
1208
|
+
);
|
|
1209
|
+
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
#### Props
|
|
1213
|
+
|
|
1214
|
+
| Name | Description | Default | Control |
|
|
1215
|
+
| --- | --- | --- | --- |
|
|
1216
|
+
| alternate |
|
|
1217
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
1218
|
+
|
|
1219
|
+
boolean
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
|
|
|
1224
|
+
|
|
1225
|
+
false
|
|
1226
|
+
|
|
1227
|
+
| Set boolean |
|
|
1228
|
+
| caption\* |
|
|
1229
|
+
|
|
1230
|
+
Caption that describes the data in the table, required for accessibility.
|
|
1231
|
+
|
|
1232
|
+
ReactNode
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
| \- | \- |
|
|
1237
|
+
| children |
|
|
1238
|
+
|
|
1239
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
1240
|
+
|
|
1241
|
+
ReactNode
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
| \- | \- |
|
|
1246
|
+
| columns |
|
|
1247
|
+
|
|
1248
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
1249
|
+
|
|
1250
|
+
TableColumn<TRow, TVal>\[\]
|
|
1251
|
+
|
|
1252
|
+
| \- | \- |
|
|
1253
|
+
| compact |
|
|
1254
|
+
|
|
1255
|
+
Compact view of the table, used for tables with a lot of data.
|
|
1256
|
+
|
|
1257
|
+
boolean
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
|
1262
|
+
|
|
1263
|
+
false
|
|
1264
|
+
|
|
1265
|
+
| Set boolean |
|
|
1266
|
+
| empty |
|
|
1267
|
+
|
|
1268
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
1269
|
+
|
|
1270
|
+
ReactNode
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
| \- | Set object |
|
|
1275
|
+
| hiddenCaption |
|
|
1276
|
+
|
|
1277
|
+
When set to true, the table caption will be visually hidden.
|
|
1278
|
+
|
|
1279
|
+
boolean
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
|
|
1283
|
+
| \- | Set boolean |
|
|
1284
|
+
| hiddenHeader |
|
|
1285
|
+
|
|
1286
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
1287
|
+
|
|
1288
|
+
boolean
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
| \- | Set boolean |
|
|
1293
|
+
| hover |
|
|
1294
|
+
|
|
1295
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
1296
|
+
|
|
1297
|
+
boolean
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
| \- | Set boolean |
|
|
1302
|
+
| removeRowBorders |
|
|
1303
|
+
|
|
1304
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
1305
|
+
|
|
1306
|
+
boolean
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
|
1311
|
+
|
|
1312
|
+
false
|
|
1313
|
+
|
|
1314
|
+
| Set boolean |
|
|
1315
|
+
| rowProps |
|
|
1316
|
+
|
|
1317
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
1318
|
+
|
|
1319
|
+
TableRowsProps\['rowProps'\]
|
|
1320
|
+
|
|
1321
|
+
| \- | Set object |
|
|
1322
|
+
| rows |
|
|
1323
|
+
|
|
1324
|
+
Each object in the array contains the data for a row.
|
|
1325
|
+
|
|
1326
|
+
TRow\[\]
|
|
1327
|
+
|
|
1328
|
+
| \[\] | \- |
|
|
1329
|
+
| scope |
|
|
1330
|
+
|
|
1331
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
1332
|
+
|
|
1333
|
+
union
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
| \- |
|
|
1338
|
+
|
|
1339
|
+
rowcol
|
|
1340
|
+
|
|
1341
|
+
|
|
|
1342
|
+
|
|
1343
|
+
### Width
|
|
1344
|
+
|
|
1345
|
+
The width of a column is controlled by the `width` property on the `TableColumn` object. It takes a string so it can be set to a pixel value or a percentage.
|
|
1346
|
+
|
|
1347
|
+
When the table exceeds the width of the container, a horizontal scrollbar is triggered. This makes it possible to view larger tables on mobile devices.
|
|
1348
|
+
|
|
1349
|
+
[](./iframe.html?id=components-table--width)
|
|
1350
|
+
|
|
1351
|
+
My investments
|
|
1352
|
+
| Investment | Cost | Investment date | Share |
|
|
1353
|
+
| --- | --- | --- | --- |
|
|
1354
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8% |
|
|
1355
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49% |
|
|
1356
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2% |
|
|
1357
|
+
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
<IressTable
|
|
1361
|
+
caption\="My investments"
|
|
1362
|
+
rows\={\[
|
|
1363
|
+
{
|
|
1364
|
+
cost: 23898,
|
|
1365
|
+
investmentDate: '2019-09-23',
|
|
1366
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
1367
|
+
totalPercentage: 24.8
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
cost: 49751.4,
|
|
1371
|
+
investmentDate: '2020-06-28',
|
|
1372
|
+
investment\_name: 'CASH.CASH',
|
|
1373
|
+
totalPercentage: 49
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
cost: 26382.456,
|
|
1377
|
+
investmentDate: '2019-02-05',
|
|
1378
|
+
investment\_name: 'VODAFONE GRP',
|
|
1379
|
+
totalPercentage: 26.2
|
|
1380
|
+
}
|
|
1381
|
+
\]}
|
|
1382
|
+
columns\={\[
|
|
1383
|
+
{
|
|
1384
|
+
key: 'investment\_name',
|
|
1385
|
+
label: 'Investment',
|
|
1386
|
+
width: '450px'
|
|
1387
|
+
},
|
|
1388
|
+
{
|
|
1389
|
+
key: 'cost',
|
|
1390
|
+
label: 'Cost',
|
|
1391
|
+
width: '220px'
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
key: 'investmentDate',
|
|
1395
|
+
label: 'Investment date',
|
|
1396
|
+
width: '220px'
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
format: 'percent',
|
|
1400
|
+
key: 'totalPercentage',
|
|
1401
|
+
label: 'Share'
|
|
1402
|
+
}
|
|
1403
|
+
\]}
|
|
1404
|
+
/>
|
|
1405
|
+
|
|
1406
|
+
```
|
|
1407
|
+
|
|
1408
|
+
#### Props
|
|
1409
|
+
|
|
1410
|
+
| Name | Description | Default | Control |
|
|
1411
|
+
| --- | --- | --- | --- |
|
|
1412
|
+
| alternate |
|
|
1413
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
1414
|
+
|
|
1415
|
+
boolean
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
|
1420
|
+
|
|
1421
|
+
false
|
|
1422
|
+
|
|
1423
|
+
| Set boolean |
|
|
1424
|
+
| caption\* |
|
|
1425
|
+
|
|
1426
|
+
Caption that describes the data in the table, required for accessibility.
|
|
1427
|
+
|
|
1428
|
+
ReactNode
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
| \- |
|
|
1433
|
+
|
|
1434
|
+
"My investments"
|
|
1435
|
+
|
|
1436
|
+
|
|
|
1437
|
+
| children |
|
|
1438
|
+
|
|
1439
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
1440
|
+
|
|
1441
|
+
ReactNode
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
| \- | \- |
|
|
1446
|
+
| columns |
|
|
1447
|
+
|
|
1448
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
1449
|
+
|
|
1450
|
+
TableColumn<TRow, TVal>\[\]
|
|
1451
|
+
|
|
1452
|
+
| \- |
|
|
1453
|
+
|
|
1454
|
+
RAW
|
|
1455
|
+
|
|
1456
|
+
* columns :
|
|
1457
|
+
|
|
1458
|
+
\[
|
|
1459
|
+
|
|
1460
|
+
* 0 :
|
|
1461
|
+
|
|
1462
|
+
{...} 3 keys
|
|
1463
|
+
|
|
1464
|
+
* 1 :
|
|
1465
|
+
|
|
1466
|
+
{...} 3 keys
|
|
1467
|
+
|
|
1468
|
+
* 2 :
|
|
1469
|
+
|
|
1470
|
+
{...} 3 keys
|
|
1471
|
+
|
|
1472
|
+
* 3 :
|
|
1473
|
+
|
|
1474
|
+
{...} 3 keys
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
\]
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
|
|
|
1483
|
+
| compact |
|
|
1484
|
+
|
|
1485
|
+
Compact view of the table, used for tables with a lot of data.
|
|
1486
|
+
|
|
1487
|
+
boolean
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
|
|
|
1492
|
+
|
|
1493
|
+
false
|
|
1494
|
+
|
|
1495
|
+
| Set boolean |
|
|
1496
|
+
| empty |
|
|
1497
|
+
|
|
1498
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
1499
|
+
|
|
1500
|
+
ReactNode
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
| \- | Set object |
|
|
1505
|
+
| hiddenCaption |
|
|
1506
|
+
|
|
1507
|
+
When set to true, the table caption will be visually hidden.
|
|
1508
|
+
|
|
1509
|
+
boolean
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
| \- | Set boolean |
|
|
1514
|
+
| hiddenHeader |
|
|
1515
|
+
|
|
1516
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
1517
|
+
|
|
1518
|
+
boolean
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
|
|
1522
|
+
| \- | Set boolean |
|
|
1523
|
+
| hover |
|
|
1524
|
+
|
|
1525
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
1526
|
+
|
|
1527
|
+
boolean
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
|
|
1531
|
+
| \- | Set boolean |
|
|
1532
|
+
| removeRowBorders |
|
|
1533
|
+
|
|
1534
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
1535
|
+
|
|
1536
|
+
boolean
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
|
1541
|
+
|
|
1542
|
+
false
|
|
1543
|
+
|
|
1544
|
+
| Set boolean |
|
|
1545
|
+
| rowProps |
|
|
1546
|
+
|
|
1547
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
1548
|
+
|
|
1549
|
+
TableRowsProps\['rowProps'\]
|
|
1550
|
+
|
|
1551
|
+
| \- | Set object |
|
|
1552
|
+
| rows |
|
|
1553
|
+
|
|
1554
|
+
Each object in the array contains the data for a row.
|
|
1555
|
+
|
|
1556
|
+
TRow\[\]
|
|
1557
|
+
|
|
1558
|
+
| \[\] |
|
|
1559
|
+
|
|
1560
|
+
RAW
|
|
1561
|
+
|
|
1562
|
+
* rows :
|
|
1563
|
+
|
|
1564
|
+
\[
|
|
1565
|
+
|
|
1566
|
+
* 0 :
|
|
1567
|
+
|
|
1568
|
+
{...} 4 keys
|
|
1569
|
+
|
|
1570
|
+
* 1 :
|
|
1571
|
+
|
|
1572
|
+
{...} 4 keys
|
|
1573
|
+
|
|
1574
|
+
* 2 :
|
|
1575
|
+
|
|
1576
|
+
{...} 4 keys
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
\]
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
|
|
1583
|
+
|
|
1584
|
+
|
|
|
1585
|
+
| scope |
|
|
1586
|
+
|
|
1587
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
1588
|
+
|
|
1589
|
+
union
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
|
|
1593
|
+
| \- |
|
|
1594
|
+
|
|
1595
|
+
rowcol
|
|
1596
|
+
|
|
1597
|
+
|
|
|
1598
|
+
|
|
1599
|
+
### Alignment
|
|
1600
|
+
|
|
1601
|
+
Columns can be aligned using the `align` property on the `TableColumn` object. Columns can be aligned to the left, right or center.
|
|
1602
|
+
|
|
1603
|
+
Currency and number formats are automatically right aligned to make the values easier to compare, but this can be overriden by setting the `align` property.
|
|
1604
|
+
|
|
1605
|
+
[](./iframe.html?id=components-table--alignment)
|
|
1606
|
+
|
|
1607
|
+
My investments
|
|
1608
|
+
| Investment (left) | Cost (center) | Date (center) | Share (right) |
|
|
1609
|
+
| --- | --- | --- | --- |
|
|
1610
|
+
| Artemis Fund Managers Limited | $23,898.00 | 23/09/2019 | 24.8% |
|
|
1611
|
+
| CASH.CASH | $49,751.40 | 28/06/2020 | 49% |
|
|
1612
|
+
| VODAFONE GRP | $26,382.46 | 05/02/2019 | 26.2% |
|
|
1613
|
+
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
<IressTable
|
|
1617
|
+
caption\="My investments"
|
|
1618
|
+
rows\={\[
|
|
1619
|
+
{
|
|
1620
|
+
cost: 23898,
|
|
1621
|
+
investmentDate: '2019-09-23',
|
|
1622
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
1623
|
+
totalPercentage: 24.8
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
cost: 49751.4,
|
|
1627
|
+
investmentDate: '2020-06-28',
|
|
1628
|
+
investment\_name: 'CASH.CASH',
|
|
1629
|
+
totalPercentage: 49
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
cost: 26382.456,
|
|
1633
|
+
investmentDate: '2019-02-05',
|
|
1634
|
+
investment\_name: 'VODAFONE GRP',
|
|
1635
|
+
totalPercentage: 26.2
|
|
1636
|
+
}
|
|
1637
|
+
\]}
|
|
1638
|
+
columns\={\[
|
|
1639
|
+
{
|
|
1640
|
+
key: 'investment\_name',
|
|
1641
|
+
label: 'Investment (left)',
|
|
1642
|
+
textAlign: 'left'
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
format: 'currency',
|
|
1646
|
+
key: 'cost',
|
|
1647
|
+
label: 'Cost (center)',
|
|
1648
|
+
textAlign: 'center'
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
format: 'date',
|
|
1652
|
+
key: 'investmentDate',
|
|
1653
|
+
label: 'Date (center)',
|
|
1654
|
+
textAlign: 'center'
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
format: 'percent',
|
|
1658
|
+
key: 'totalPercentage',
|
|
1659
|
+
label: 'Share (right)',
|
|
1660
|
+
textAlign: 'right'
|
|
1661
|
+
}
|
|
1662
|
+
\]}
|
|
1663
|
+
/>
|
|
1664
|
+
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
#### Props
|
|
1668
|
+
|
|
1669
|
+
| Name | Description | Default | Control |
|
|
1670
|
+
| --- | --- | --- | --- |
|
|
1671
|
+
| alternate |
|
|
1672
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
1673
|
+
|
|
1674
|
+
boolean
|
|
1675
|
+
|
|
1676
|
+
|
|
1677
|
+
|
|
1678
|
+
|
|
|
1679
|
+
|
|
1680
|
+
false
|
|
1681
|
+
|
|
1682
|
+
| Set boolean |
|
|
1683
|
+
| caption\* |
|
|
1684
|
+
|
|
1685
|
+
Caption that describes the data in the table, required for accessibility.
|
|
1686
|
+
|
|
1687
|
+
ReactNode
|
|
1688
|
+
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
| \- |
|
|
1692
|
+
|
|
1693
|
+
"My investments"
|
|
1694
|
+
|
|
1695
|
+
|
|
|
1696
|
+
| children |
|
|
1697
|
+
|
|
1698
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
1699
|
+
|
|
1700
|
+
ReactNode
|
|
1701
|
+
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
| \- | \- |
|
|
1705
|
+
| columns |
|
|
1706
|
+
|
|
1707
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
1708
|
+
|
|
1709
|
+
TableColumn<TRow, TVal>\[\]
|
|
1710
|
+
|
|
1711
|
+
| \- |
|
|
1712
|
+
|
|
1713
|
+
RAW
|
|
1714
|
+
|
|
1715
|
+
* columns :
|
|
1716
|
+
|
|
1717
|
+
\[
|
|
1718
|
+
|
|
1719
|
+
* 0 :
|
|
1720
|
+
|
|
1721
|
+
{...} 3 keys
|
|
1722
|
+
|
|
1723
|
+
* 1 :
|
|
1724
|
+
|
|
1725
|
+
{...} 4 keys
|
|
1726
|
+
|
|
1727
|
+
* 2 :
|
|
1728
|
+
|
|
1729
|
+
{...} 4 keys
|
|
1730
|
+
|
|
1731
|
+
* 3 :
|
|
1732
|
+
|
|
1733
|
+
{...} 4 keys
|
|
1734
|
+
|
|
1735
|
+
|
|
1736
|
+
\]
|
|
1737
|
+
|
|
1738
|
+
|
|
1739
|
+
|
|
1740
|
+
|
|
1741
|
+
|
|
|
1742
|
+
| compact |
|
|
1743
|
+
|
|
1744
|
+
Compact view of the table, used for tables with a lot of data.
|
|
1745
|
+
|
|
1746
|
+
boolean
|
|
1747
|
+
|
|
1748
|
+
|
|
1749
|
+
|
|
1750
|
+
|
|
|
1751
|
+
|
|
1752
|
+
false
|
|
1753
|
+
|
|
1754
|
+
| Set boolean |
|
|
1755
|
+
| empty |
|
|
1756
|
+
|
|
1757
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
1758
|
+
|
|
1759
|
+
ReactNode
|
|
1760
|
+
|
|
1761
|
+
|
|
1762
|
+
|
|
1763
|
+
| \- | Set object |
|
|
1764
|
+
| hiddenCaption |
|
|
1765
|
+
|
|
1766
|
+
When set to true, the table caption will be visually hidden.
|
|
1767
|
+
|
|
1768
|
+
boolean
|
|
1769
|
+
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
| \- | Set boolean |
|
|
1773
|
+
| hiddenHeader |
|
|
1774
|
+
|
|
1775
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
1776
|
+
|
|
1777
|
+
boolean
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
|
|
1781
|
+
| \- | Set boolean |
|
|
1782
|
+
| hover |
|
|
1783
|
+
|
|
1784
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
1785
|
+
|
|
1786
|
+
boolean
|
|
1787
|
+
|
|
1788
|
+
|
|
1789
|
+
|
|
1790
|
+
| \- | Set boolean |
|
|
1791
|
+
| removeRowBorders |
|
|
1792
|
+
|
|
1793
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
1794
|
+
|
|
1795
|
+
boolean
|
|
1796
|
+
|
|
1797
|
+
|
|
1798
|
+
|
|
1799
|
+
|
|
|
1800
|
+
|
|
1801
|
+
false
|
|
1802
|
+
|
|
1803
|
+
| Set boolean |
|
|
1804
|
+
| rowProps |
|
|
1805
|
+
|
|
1806
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
1807
|
+
|
|
1808
|
+
TableRowsProps\['rowProps'\]
|
|
1809
|
+
|
|
1810
|
+
| \- | Set object |
|
|
1811
|
+
| rows |
|
|
1812
|
+
|
|
1813
|
+
Each object in the array contains the data for a row.
|
|
1814
|
+
|
|
1815
|
+
TRow\[\]
|
|
1816
|
+
|
|
1817
|
+
| \[\] |
|
|
1818
|
+
|
|
1819
|
+
RAW
|
|
1820
|
+
|
|
1821
|
+
* rows :
|
|
1822
|
+
|
|
1823
|
+
\[
|
|
1824
|
+
|
|
1825
|
+
* 0 :
|
|
1826
|
+
|
|
1827
|
+
{...} 4 keys
|
|
1828
|
+
|
|
1829
|
+
* 1 :
|
|
1830
|
+
|
|
1831
|
+
{...} 4 keys
|
|
1832
|
+
|
|
1833
|
+
* 2 :
|
|
1834
|
+
|
|
1835
|
+
{...} 4 keys
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
\]
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
|
|
1842
|
+
|
|
1843
|
+
|
|
|
1844
|
+
| scope |
|
|
1845
|
+
|
|
1846
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
1847
|
+
|
|
1848
|
+
union
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
|
|
1852
|
+
| \- |
|
|
1853
|
+
|
|
1854
|
+
rowcol
|
|
1855
|
+
|
|
1856
|
+
|
|
|
1857
|
+
|
|
1858
|
+
### Dividers
|
|
1859
|
+
|
|
1860
|
+
As a general rule we don't add vertical column borders to our tables. Sometimes though, it can be useful to add a vertical divider between columns to help group content and create visual separation.
|
|
1861
|
+
|
|
1862
|
+
To add a vertical divider you can set the `divider` prop in the `TableColumn` to true. This will add a vertical border to the end of the column.
|
|
1863
|
+
|
|
1864
|
+
[](./iframe.html?id=components-table--dividers)
|
|
1865
|
+
|
|
1866
|
+
My investments
|
|
1867
|
+
| Investment | Date | Share | Cost |
|
|
1868
|
+
| --- | --- | --- | --- |
|
|
1869
|
+
| Artemis Fund Managers Limited | 23/09/2019 | 24.8% | $23,898.00 |
|
|
1870
|
+
| CASH.CASH | 28/06/2020 | 49% | $49,751.40 |
|
|
1871
|
+
| VODAFONE GRP | 05/02/2019 | 26.2% | $26,382.46 |
|
|
1872
|
+
|
|
1873
|
+
```
|
|
1874
|
+
|
|
1875
|
+
<IressTable
|
|
1876
|
+
caption\="My investments"
|
|
1877
|
+
rows\={\[
|
|
1878
|
+
{
|
|
1879
|
+
cost: 23898,
|
|
1880
|
+
investmentDate: '2019-09-23',
|
|
1881
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
1882
|
+
totalPercentage: 24.8
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
cost: 49751.4,
|
|
1886
|
+
investmentDate: '2020-06-28',
|
|
1887
|
+
investment\_name: 'CASH.CASH',
|
|
1888
|
+
totalPercentage: 49
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
cost: 26382.456,
|
|
1892
|
+
investmentDate: '2019-02-05',
|
|
1893
|
+
investment\_name: 'VODAFONE GRP',
|
|
1894
|
+
totalPercentage: 26.2
|
|
1895
|
+
}
|
|
1896
|
+
\]}
|
|
1897
|
+
columns\={\[
|
|
1898
|
+
{
|
|
1899
|
+
divider: true,
|
|
1900
|
+
key: 'investment\_name',
|
|
1901
|
+
label: 'Investment'
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
format: 'date',
|
|
1905
|
+
key: 'investmentDate',
|
|
1906
|
+
label: 'Date'
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
format: 'percent',
|
|
1910
|
+
key: 'totalPercentage',
|
|
1911
|
+
label: 'Share'
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
format: 'currency',
|
|
1915
|
+
key: 'cost',
|
|
1916
|
+
label: 'Cost'
|
|
1917
|
+
}
|
|
1918
|
+
\]}
|
|
1919
|
+
/>
|
|
1920
|
+
|
|
1921
|
+
```
|
|
1922
|
+
|
|
1923
|
+
#### Props
|
|
1924
|
+
|
|
1925
|
+
| Name | Description | Default | Control |
|
|
1926
|
+
| --- | --- | --- | --- |
|
|
1927
|
+
| alternate |
|
|
1928
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
1929
|
+
|
|
1930
|
+
boolean
|
|
1931
|
+
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
|
|
|
1935
|
+
|
|
1936
|
+
false
|
|
1937
|
+
|
|
1938
|
+
| Set boolean |
|
|
1939
|
+
| caption\* |
|
|
1940
|
+
|
|
1941
|
+
Caption that describes the data in the table, required for accessibility.
|
|
1942
|
+
|
|
1943
|
+
ReactNode
|
|
1944
|
+
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
| \- |
|
|
1948
|
+
|
|
1949
|
+
"My investments"
|
|
1950
|
+
|
|
1951
|
+
|
|
|
1952
|
+
| children |
|
|
1953
|
+
|
|
1954
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
1955
|
+
|
|
1956
|
+
ReactNode
|
|
1957
|
+
|
|
1958
|
+
|
|
1959
|
+
|
|
1960
|
+
| \- | \- |
|
|
1961
|
+
| columns |
|
|
1962
|
+
|
|
1963
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
1964
|
+
|
|
1965
|
+
TableColumn<TRow, TVal>\[\]
|
|
1966
|
+
|
|
1967
|
+
| \- |
|
|
1968
|
+
|
|
1969
|
+
RAW
|
|
1970
|
+
|
|
1971
|
+
* columns :
|
|
1972
|
+
|
|
1973
|
+
\[
|
|
1974
|
+
|
|
1975
|
+
* 0 :
|
|
1976
|
+
|
|
1977
|
+
{...} 3 keys
|
|
1978
|
+
|
|
1979
|
+
* 1 :
|
|
1980
|
+
|
|
1981
|
+
{...} 3 keys
|
|
1982
|
+
|
|
1983
|
+
* 2 :
|
|
1984
|
+
|
|
1985
|
+
{...} 3 keys
|
|
1986
|
+
|
|
1987
|
+
* 3 :
|
|
1988
|
+
|
|
1989
|
+
{...} 3 keys
|
|
1990
|
+
|
|
1991
|
+
|
|
1992
|
+
\]
|
|
1993
|
+
|
|
1994
|
+
|
|
1995
|
+
|
|
1996
|
+
|
|
1997
|
+
|
|
|
1998
|
+
| compact |
|
|
1999
|
+
|
|
2000
|
+
Compact view of the table, used for tables with a lot of data.
|
|
2001
|
+
|
|
2002
|
+
boolean
|
|
2003
|
+
|
|
2004
|
+
|
|
2005
|
+
|
|
2006
|
+
|
|
|
2007
|
+
|
|
2008
|
+
false
|
|
2009
|
+
|
|
2010
|
+
| Set boolean |
|
|
2011
|
+
| empty |
|
|
2012
|
+
|
|
2013
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
2014
|
+
|
|
2015
|
+
ReactNode
|
|
2016
|
+
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
| \- | Set object |
|
|
2020
|
+
| hiddenCaption |
|
|
2021
|
+
|
|
2022
|
+
When set to true, the table caption will be visually hidden.
|
|
2023
|
+
|
|
2024
|
+
boolean
|
|
2025
|
+
|
|
2026
|
+
|
|
2027
|
+
|
|
2028
|
+
| \- | Set boolean |
|
|
2029
|
+
| hiddenHeader |
|
|
2030
|
+
|
|
2031
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
2032
|
+
|
|
2033
|
+
boolean
|
|
2034
|
+
|
|
2035
|
+
|
|
2036
|
+
|
|
2037
|
+
| \- | Set boolean |
|
|
2038
|
+
| hover |
|
|
2039
|
+
|
|
2040
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
2041
|
+
|
|
2042
|
+
boolean
|
|
2043
|
+
|
|
2044
|
+
|
|
2045
|
+
|
|
2046
|
+
| \- | Set boolean |
|
|
2047
|
+
| removeRowBorders |
|
|
2048
|
+
|
|
2049
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
2050
|
+
|
|
2051
|
+
boolean
|
|
2052
|
+
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
|
|
|
2056
|
+
|
|
2057
|
+
false
|
|
2058
|
+
|
|
2059
|
+
| Set boolean |
|
|
2060
|
+
| rowProps |
|
|
2061
|
+
|
|
2062
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
2063
|
+
|
|
2064
|
+
TableRowsProps\['rowProps'\]
|
|
2065
|
+
|
|
2066
|
+
| \- | Set object |
|
|
2067
|
+
| rows |
|
|
2068
|
+
|
|
2069
|
+
Each object in the array contains the data for a row.
|
|
2070
|
+
|
|
2071
|
+
TRow\[\]
|
|
2072
|
+
|
|
2073
|
+
| \[\] |
|
|
2074
|
+
|
|
2075
|
+
RAW
|
|
2076
|
+
|
|
2077
|
+
* rows :
|
|
2078
|
+
|
|
2079
|
+
\[
|
|
2080
|
+
|
|
2081
|
+
* 0 :
|
|
2082
|
+
|
|
2083
|
+
{...} 4 keys
|
|
2084
|
+
|
|
2085
|
+
* 1 :
|
|
2086
|
+
|
|
2087
|
+
{...} 4 keys
|
|
2088
|
+
|
|
2089
|
+
* 2 :
|
|
2090
|
+
|
|
2091
|
+
{...} 4 keys
|
|
2092
|
+
|
|
2093
|
+
|
|
2094
|
+
\]
|
|
2095
|
+
|
|
2096
|
+
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
|
|
|
2100
|
+
| scope |
|
|
2101
|
+
|
|
2102
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
2103
|
+
|
|
2104
|
+
union
|
|
2105
|
+
|
|
2106
|
+
|
|
2107
|
+
|
|
2108
|
+
| \- |
|
|
2109
|
+
|
|
2110
|
+
rowcol
|
|
2111
|
+
|
|
2112
|
+
|
|
|
2113
|
+
|
|
2114
|
+
### Highlight on hover
|
|
2115
|
+
|
|
2116
|
+
This can be enabled by setting the `hover` prop. This will bring attention to the row the user is hovering over, allowing users to focus on the relationship between the columns of a specific row.
|
|
2117
|
+
|
|
2118
|
+
[](./iframe.html?id=components-table--highlight-on-hover)
|
|
2119
|
+
|
|
2120
|
+
My investments
|
|
2121
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
2122
|
+
| --- | --- | --- | --- |
|
|
2123
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
|
|
2124
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49 |
|
|
2125
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
|
|
2126
|
+
|
|
2127
|
+
```
|
|
2128
|
+
|
|
2129
|
+
<IressTable
|
|
2130
|
+
caption\="My investments"
|
|
2131
|
+
rows\={\[
|
|
2132
|
+
{
|
|
2133
|
+
cost: 23898,
|
|
2134
|
+
investmentDate: '2019-09-23',
|
|
2135
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
2136
|
+
totalPercentage: 24.8
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
cost: 49751.4,
|
|
2140
|
+
investmentDate: '2020-06-28',
|
|
2141
|
+
investment\_name: 'CASH.CASH',
|
|
2142
|
+
totalPercentage: 49
|
|
2143
|
+
},
|
|
2144
|
+
{
|
|
2145
|
+
cost: 26382.456,
|
|
2146
|
+
investmentDate: '2019-02-05',
|
|
2147
|
+
investment\_name: 'VODAFONE GRP',
|
|
2148
|
+
totalPercentage: 26.2
|
|
2149
|
+
}
|
|
2150
|
+
\]}
|
|
2151
|
+
hover
|
|
2152
|
+
/>
|
|
2153
|
+
|
|
2154
|
+
```
|
|
2155
|
+
|
|
2156
|
+
#### Props
|
|
2157
|
+
|
|
2158
|
+
| Name | Description | Default | Control |
|
|
2159
|
+
| --- | --- | --- | --- |
|
|
2160
|
+
| alternate |
|
|
2161
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
2162
|
+
|
|
2163
|
+
boolean
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
|
|
2167
|
+
|
|
|
2168
|
+
|
|
2169
|
+
false
|
|
2170
|
+
|
|
2171
|
+
| Set boolean |
|
|
2172
|
+
| caption\* |
|
|
2173
|
+
|
|
2174
|
+
Caption that describes the data in the table, required for accessibility.
|
|
2175
|
+
|
|
2176
|
+
ReactNode
|
|
2177
|
+
|
|
2178
|
+
|
|
2179
|
+
|
|
2180
|
+
| \- |
|
|
2181
|
+
|
|
2182
|
+
"My investments"
|
|
2183
|
+
|
|
2184
|
+
|
|
|
2185
|
+
| children |
|
|
2186
|
+
|
|
2187
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
2188
|
+
|
|
2189
|
+
ReactNode
|
|
2190
|
+
|
|
2191
|
+
|
|
2192
|
+
|
|
2193
|
+
| \- | \- |
|
|
2194
|
+
| columns |
|
|
2195
|
+
|
|
2196
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
2197
|
+
|
|
2198
|
+
TableColumn<TRow, TVal>\[\]
|
|
2199
|
+
|
|
2200
|
+
| \- | Set object |
|
|
2201
|
+
| compact |
|
|
2202
|
+
|
|
2203
|
+
Compact view of the table, used for tables with a lot of data.
|
|
2204
|
+
|
|
2205
|
+
boolean
|
|
2206
|
+
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
|
|
|
2210
|
+
|
|
2211
|
+
false
|
|
2212
|
+
|
|
2213
|
+
| Set boolean |
|
|
2214
|
+
| empty |
|
|
2215
|
+
|
|
2216
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
2217
|
+
|
|
2218
|
+
ReactNode
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
| \- | Set object |
|
|
2223
|
+
| hiddenCaption |
|
|
2224
|
+
|
|
2225
|
+
When set to true, the table caption will be visually hidden.
|
|
2226
|
+
|
|
2227
|
+
boolean
|
|
2228
|
+
|
|
2229
|
+
|
|
2230
|
+
|
|
2231
|
+
| \- | Set boolean |
|
|
2232
|
+
| hiddenHeader |
|
|
2233
|
+
|
|
2234
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
2235
|
+
|
|
2236
|
+
boolean
|
|
2237
|
+
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
| \- | Set boolean |
|
|
2241
|
+
| hover |
|
|
2242
|
+
|
|
2243
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
2244
|
+
|
|
2245
|
+
boolean
|
|
2246
|
+
|
|
2247
|
+
|
|
2248
|
+
|
|
2249
|
+
| \- | FalseTrue |
|
|
2250
|
+
| removeRowBorders |
|
|
2251
|
+
|
|
2252
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
2253
|
+
|
|
2254
|
+
boolean
|
|
2255
|
+
|
|
2256
|
+
|
|
2257
|
+
|
|
2258
|
+
|
|
|
2259
|
+
|
|
2260
|
+
false
|
|
2261
|
+
|
|
2262
|
+
| Set boolean |
|
|
2263
|
+
| rowProps |
|
|
2264
|
+
|
|
2265
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
2266
|
+
|
|
2267
|
+
TableRowsProps\['rowProps'\]
|
|
2268
|
+
|
|
2269
|
+
| \- | Set object |
|
|
2270
|
+
| rows |
|
|
2271
|
+
|
|
2272
|
+
Each object in the array contains the data for a row.
|
|
2273
|
+
|
|
2274
|
+
TRow\[\]
|
|
2275
|
+
|
|
2276
|
+
| \[\] |
|
|
2277
|
+
|
|
2278
|
+
RAW
|
|
2279
|
+
|
|
2280
|
+
* rows :
|
|
2281
|
+
|
|
2282
|
+
\[
|
|
2283
|
+
|
|
2284
|
+
* 0 :
|
|
2285
|
+
|
|
2286
|
+
{...} 4 keys
|
|
2287
|
+
|
|
2288
|
+
* 1 :
|
|
2289
|
+
|
|
2290
|
+
{...} 4 keys
|
|
2291
|
+
|
|
2292
|
+
* 2 :
|
|
2293
|
+
|
|
2294
|
+
{...} 4 keys
|
|
2295
|
+
|
|
2296
|
+
|
|
2297
|
+
\]
|
|
2298
|
+
|
|
2299
|
+
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
|
|
|
2303
|
+
| scope |
|
|
2304
|
+
|
|
2305
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
2306
|
+
|
|
2307
|
+
union
|
|
2308
|
+
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
| \- |
|
|
2312
|
+
|
|
2313
|
+
rowcol
|
|
2314
|
+
|
|
2315
|
+
|
|
|
2316
|
+
|
|
2317
|
+
### Scope
|
|
2318
|
+
|
|
2319
|
+
`scope` defaults to row, which means the first cell in the row will be a `<th>`. When it is set to col the first cell in the row will be a `<td>`.
|
|
2320
|
+
|
|
2321
|
+
[](./iframe.html?id=components-table--scope)
|
|
2322
|
+
|
|
2323
|
+
My investments
|
|
2324
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
2325
|
+
| --- | --- | --- | --- |
|
|
2326
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
|
|
2327
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49 |
|
|
2328
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
|
|
2329
|
+
|
|
2330
|
+
```
|
|
2331
|
+
|
|
2332
|
+
<IressTable
|
|
2333
|
+
caption\="My investments"
|
|
2334
|
+
rows\={\[
|
|
2335
|
+
{
|
|
2336
|
+
cost: 23898,
|
|
2337
|
+
investmentDate: '2019-09-23',
|
|
2338
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
2339
|
+
totalPercentage: 24.8
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
cost: 49751.4,
|
|
2343
|
+
investmentDate: '2020-06-28',
|
|
2344
|
+
investment\_name: 'CASH.CASH',
|
|
2345
|
+
totalPercentage: 49
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
cost: 26382.456,
|
|
2349
|
+
investmentDate: '2019-02-05',
|
|
2350
|
+
investment\_name: 'VODAFONE GRP',
|
|
2351
|
+
totalPercentage: 26.2
|
|
2352
|
+
}
|
|
2353
|
+
\]}
|
|
2354
|
+
scope\="col"
|
|
2355
|
+
/>
|
|
2356
|
+
|
|
2357
|
+
```
|
|
2358
|
+
|
|
2359
|
+
#### Props
|
|
2360
|
+
|
|
2361
|
+
| Name | Description | Default | Control |
|
|
2362
|
+
| --- | --- | --- | --- |
|
|
2363
|
+
| alternate |
|
|
2364
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
2365
|
+
|
|
2366
|
+
boolean
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
|
2371
|
+
|
|
2372
|
+
false
|
|
2373
|
+
|
|
2374
|
+
| Set boolean |
|
|
2375
|
+
| caption\* |
|
|
2376
|
+
|
|
2377
|
+
Caption that describes the data in the table, required for accessibility.
|
|
2378
|
+
|
|
2379
|
+
ReactNode
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
| \- |
|
|
2384
|
+
|
|
2385
|
+
"My investments"
|
|
2386
|
+
|
|
2387
|
+
|
|
|
2388
|
+
| children |
|
|
2389
|
+
|
|
2390
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
2391
|
+
|
|
2392
|
+
ReactNode
|
|
2393
|
+
|
|
2394
|
+
|
|
2395
|
+
|
|
2396
|
+
| \- | \- |
|
|
2397
|
+
| columns |
|
|
2398
|
+
|
|
2399
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
2400
|
+
|
|
2401
|
+
TableColumn<TRow, TVal>\[\]
|
|
2402
|
+
|
|
2403
|
+
| \- | Set object |
|
|
2404
|
+
| compact |
|
|
2405
|
+
|
|
2406
|
+
Compact view of the table, used for tables with a lot of data.
|
|
2407
|
+
|
|
2408
|
+
boolean
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
|
|
2412
|
+
|
|
|
2413
|
+
|
|
2414
|
+
false
|
|
2415
|
+
|
|
2416
|
+
| Set boolean |
|
|
2417
|
+
| empty |
|
|
2418
|
+
|
|
2419
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
2420
|
+
|
|
2421
|
+
ReactNode
|
|
2422
|
+
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
| \- | Set object |
|
|
2426
|
+
| hiddenCaption |
|
|
2427
|
+
|
|
2428
|
+
When set to true, the table caption will be visually hidden.
|
|
2429
|
+
|
|
2430
|
+
boolean
|
|
2431
|
+
|
|
2432
|
+
|
|
2433
|
+
|
|
2434
|
+
| \- | Set boolean |
|
|
2435
|
+
| hiddenHeader |
|
|
2436
|
+
|
|
2437
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
2438
|
+
|
|
2439
|
+
boolean
|
|
2440
|
+
|
|
2441
|
+
|
|
2442
|
+
|
|
2443
|
+
| \- | Set boolean |
|
|
2444
|
+
| hover |
|
|
2445
|
+
|
|
2446
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
2447
|
+
|
|
2448
|
+
boolean
|
|
2449
|
+
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
| \- | Set boolean |
|
|
2453
|
+
| removeRowBorders |
|
|
2454
|
+
|
|
2455
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
2456
|
+
|
|
2457
|
+
boolean
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
|
2462
|
+
|
|
2463
|
+
false
|
|
2464
|
+
|
|
2465
|
+
| Set boolean |
|
|
2466
|
+
| rowProps |
|
|
2467
|
+
|
|
2468
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
2469
|
+
|
|
2470
|
+
TableRowsProps\['rowProps'\]
|
|
2471
|
+
|
|
2472
|
+
| \- | Set object |
|
|
2473
|
+
| rows |
|
|
2474
|
+
|
|
2475
|
+
Each object in the array contains the data for a row.
|
|
2476
|
+
|
|
2477
|
+
TRow\[\]
|
|
2478
|
+
|
|
2479
|
+
| \[\] |
|
|
2480
|
+
|
|
2481
|
+
RAW
|
|
2482
|
+
|
|
2483
|
+
* rows :
|
|
2484
|
+
|
|
2485
|
+
\[
|
|
2486
|
+
|
|
2487
|
+
* 0 :
|
|
2488
|
+
|
|
2489
|
+
{...} 4 keys
|
|
2490
|
+
|
|
2491
|
+
* 1 :
|
|
2492
|
+
|
|
2493
|
+
{...} 4 keys
|
|
2494
|
+
|
|
2495
|
+
* 2 :
|
|
2496
|
+
|
|
2497
|
+
{...} 4 keys
|
|
2498
|
+
|
|
2499
|
+
|
|
2500
|
+
\]
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
|
|
2504
|
+
|
|
2505
|
+
|
|
|
2506
|
+
| scope |
|
|
2507
|
+
|
|
2508
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
2509
|
+
|
|
2510
|
+
union
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
| \- |
|
|
2515
|
+
|
|
2516
|
+
rowcol
|
|
2517
|
+
|
|
2518
|
+
|
|
|
2519
|
+
|
|
2520
|
+
### Hidden header
|
|
2521
|
+
|
|
2522
|
+
For very simple tabular data, you have the option to hide the table header with the `hiddenHeader` prop. When this is set to true, the table header will not be rendered.
|
|
2523
|
+
|
|
2524
|
+
[](./iframe.html?id=components-table--hidden-header)
|
|
2525
|
+
|
|
2526
|
+
<table class="table__table table__table--compact_false table__table--hover_false table__table--sortButtonNoWrap_false table__table--tableBodyOpen_false table__table--alternate_false table__table--removeRowBorders_false ids-table" id="_r_v_"><caption id="_r_v_--caption" class="table__caption table__caption--compact_false table__caption--hover_false table__caption--sortButtonNoWrap_false table__caption--tableBodyOpen_false table__caption--alternate_false table__caption--removeRowBorders_false">My investments</caption><tbody><tr id="_r_v_--rows--0" class=""><th data-column="investment_name" id="_r_v___0_investment_name" scope="row">Artemis Fund Managers Limited</th><td data-column="cost" headers="_r_v___0_investment_name" id="_r_v___0_cost">23898</td><td data-column="investmentDate" headers="_r_v___0_investment_name" id="_r_v___0_investmentDate">2019-09-23</td><td data-column="totalPercentage" headers="_r_v___0_investment_name" id="_r_v___0_totalPercentage">24.8</td></tr><tr id="_r_v_--rows--1" class=""><th data-column="investment_name" id="_r_v___1_investment_name" scope="row">CASH.CASH</th><td data-column="cost" headers="_r_v___1_investment_name" id="_r_v___1_cost">49751.4</td><td data-column="investmentDate" headers="_r_v___1_investment_name" id="_r_v___1_investmentDate">2020-06-28</td><td data-column="totalPercentage" headers="_r_v___1_investment_name" id="_r_v___1_totalPercentage">49</td></tr><tr id="_r_v_--rows--2" class=""><th data-column="investment_name" id="_r_v___2_investment_name" scope="row">VODAFONE GRP</th><td data-column="cost" headers="_r_v___2_investment_name" id="_r_v___2_cost">26382.456</td><td data-column="investmentDate" headers="_r_v___2_investment_name" id="_r_v___2_investmentDate">2019-02-05</td><td data-column="totalPercentage" headers="_r_v___2_investment_name" id="_r_v___2_totalPercentage">26.2</td></tr></tbody></table>
|
|
2527
|
+
|
|
2528
|
+
```
|
|
2529
|
+
|
|
2530
|
+
<IressTable
|
|
2531
|
+
caption\="My investments"
|
|
2532
|
+
rows\={\[
|
|
2533
|
+
{
|
|
2534
|
+
cost: 23898,
|
|
2535
|
+
investmentDate: '2019-09-23',
|
|
2536
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
2537
|
+
totalPercentage: 24.8
|
|
2538
|
+
},
|
|
2539
|
+
{
|
|
2540
|
+
cost: 49751.4,
|
|
2541
|
+
investmentDate: '2020-06-28',
|
|
2542
|
+
investment\_name: 'CASH.CASH',
|
|
2543
|
+
totalPercentage: 49
|
|
2544
|
+
},
|
|
2545
|
+
{
|
|
2546
|
+
cost: 26382.456,
|
|
2547
|
+
investmentDate: '2019-02-05',
|
|
2548
|
+
investment\_name: 'VODAFONE GRP',
|
|
2549
|
+
totalPercentage: 26.2
|
|
2550
|
+
}
|
|
2551
|
+
\]}
|
|
2552
|
+
hiddenHeader
|
|
2553
|
+
/>
|
|
2554
|
+
|
|
2555
|
+
```
|
|
2556
|
+
|
|
2557
|
+
#### Props
|
|
2558
|
+
|
|
2559
|
+
| Name | Description | Default | Control |
|
|
2560
|
+
| --- | --- | --- | --- |
|
|
2561
|
+
| alternate |
|
|
2562
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
2563
|
+
|
|
2564
|
+
boolean
|
|
2565
|
+
|
|
2566
|
+
|
|
2567
|
+
|
|
2568
|
+
|
|
|
2569
|
+
|
|
2570
|
+
false
|
|
2571
|
+
|
|
2572
|
+
| Set boolean |
|
|
2573
|
+
| caption\* |
|
|
2574
|
+
|
|
2575
|
+
Caption that describes the data in the table, required for accessibility.
|
|
2576
|
+
|
|
2577
|
+
ReactNode
|
|
2578
|
+
|
|
2579
|
+
|
|
2580
|
+
|
|
2581
|
+
| \- |
|
|
2582
|
+
|
|
2583
|
+
"My investments"
|
|
2584
|
+
|
|
2585
|
+
|
|
|
2586
|
+
| children |
|
|
2587
|
+
|
|
2588
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
2589
|
+
|
|
2590
|
+
ReactNode
|
|
2591
|
+
|
|
2592
|
+
|
|
2593
|
+
|
|
2594
|
+
| \- | \- |
|
|
2595
|
+
| columns |
|
|
2596
|
+
|
|
2597
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
2598
|
+
|
|
2599
|
+
TableColumn<TRow, TVal>\[\]
|
|
2600
|
+
|
|
2601
|
+
| \- | Set object |
|
|
2602
|
+
| compact |
|
|
2603
|
+
|
|
2604
|
+
Compact view of the table, used for tables with a lot of data.
|
|
2605
|
+
|
|
2606
|
+
boolean
|
|
2607
|
+
|
|
2608
|
+
|
|
2609
|
+
|
|
2610
|
+
|
|
|
2611
|
+
|
|
2612
|
+
false
|
|
2613
|
+
|
|
2614
|
+
| Set boolean |
|
|
2615
|
+
| empty |
|
|
2616
|
+
|
|
2617
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
2618
|
+
|
|
2619
|
+
ReactNode
|
|
2620
|
+
|
|
2621
|
+
|
|
2622
|
+
|
|
2623
|
+
| \- | Set object |
|
|
2624
|
+
| hiddenCaption |
|
|
2625
|
+
|
|
2626
|
+
When set to true, the table caption will be visually hidden.
|
|
2627
|
+
|
|
2628
|
+
boolean
|
|
2629
|
+
|
|
2630
|
+
|
|
2631
|
+
|
|
2632
|
+
| \- | Set boolean |
|
|
2633
|
+
| hiddenHeader |
|
|
2634
|
+
|
|
2635
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
2636
|
+
|
|
2637
|
+
boolean
|
|
2638
|
+
|
|
2639
|
+
|
|
2640
|
+
|
|
2641
|
+
| \- | FalseTrue |
|
|
2642
|
+
| hover |
|
|
2643
|
+
|
|
2644
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
2645
|
+
|
|
2646
|
+
boolean
|
|
2647
|
+
|
|
2648
|
+
|
|
2649
|
+
|
|
2650
|
+
| \- | Set boolean |
|
|
2651
|
+
| removeRowBorders |
|
|
2652
|
+
|
|
2653
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
2654
|
+
|
|
2655
|
+
boolean
|
|
2656
|
+
|
|
2657
|
+
|
|
2658
|
+
|
|
2659
|
+
|
|
|
2660
|
+
|
|
2661
|
+
false
|
|
2662
|
+
|
|
2663
|
+
| Set boolean |
|
|
2664
|
+
| rowProps |
|
|
2665
|
+
|
|
2666
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
2667
|
+
|
|
2668
|
+
TableRowsProps\['rowProps'\]
|
|
2669
|
+
|
|
2670
|
+
| \- | Set object |
|
|
2671
|
+
| rows |
|
|
2672
|
+
|
|
2673
|
+
Each object in the array contains the data for a row.
|
|
2674
|
+
|
|
2675
|
+
TRow\[\]
|
|
2676
|
+
|
|
2677
|
+
| \[\] |
|
|
2678
|
+
|
|
2679
|
+
RAW
|
|
2680
|
+
|
|
2681
|
+
* rows :
|
|
2682
|
+
|
|
2683
|
+
\[
|
|
2684
|
+
|
|
2685
|
+
* 0 :
|
|
2686
|
+
|
|
2687
|
+
{...} 4 keys
|
|
2688
|
+
|
|
2689
|
+
* 1 :
|
|
2690
|
+
|
|
2691
|
+
{...} 4 keys
|
|
2692
|
+
|
|
2693
|
+
* 2 :
|
|
2694
|
+
|
|
2695
|
+
{...} 4 keys
|
|
2696
|
+
|
|
2697
|
+
|
|
2698
|
+
\]
|
|
2699
|
+
|
|
2700
|
+
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
|
|
|
2704
|
+
| scope |
|
|
2705
|
+
|
|
2706
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
2707
|
+
|
|
2708
|
+
union
|
|
2709
|
+
|
|
2710
|
+
|
|
2711
|
+
|
|
2712
|
+
| \- |
|
|
2713
|
+
|
|
2714
|
+
rowcol
|
|
2715
|
+
|
|
2716
|
+
|
|
|
2717
|
+
|
|
2718
|
+
### Rich rows (JSX)
|
|
2719
|
+
|
|
2720
|
+
The `rows` prop allows you to use `ReactNodes` as the value of a cell. This can be useful for adding rich content to a cell, such as links, buttons or icons.
|
|
2721
|
+
|
|
2722
|
+
**Note:** If you are using the `sort` property, the sorting may not work properly with rich content. If this happens, either remove the `sort` property or use the `format` prop on the column to set a custom formatter.
|
|
2723
|
+
|
|
2724
|
+
[](./iframe.html?id=components-table--rich-rows)
|
|
2725
|
+
|
|
2726
|
+
My rich investments
|
|
2727
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
2728
|
+
| --- | --- | --- | --- |
|
|
2729
|
+
| Artemis Fund Managers Limited | $23,898 | 2019/09/23 | 24.8% |
|
|
2730
|
+
| CASH.CASH | $49,751.40 | 2020/06/28 | 49% |
|
|
2731
|
+
| VODAFONE GRP | $26,382.46 | 2019/02/05 | 26.2% |
|
|
2732
|
+
|
|
2733
|
+
```
|
|
2734
|
+
|
|
2735
|
+
<IressTable
|
|
2736
|
+
caption\="My rich investments"
|
|
2737
|
+
rows\={\[
|
|
2738
|
+
{
|
|
2739
|
+
cost: '$23,898',
|
|
2740
|
+
investmentDate: '2019/09/23',
|
|
2741
|
+
investment\_name: <IressButton\>Artemis Fund Managers Limited</IressButton\>,
|
|
2742
|
+
totalPercentage: <IressBadge mode\="info"\>24.8%</IressBadge\>
|
|
2743
|
+
},
|
|
2744
|
+
{
|
|
2745
|
+
cost: '$49,751.40',
|
|
2746
|
+
investmentDate: '2020/06/28',
|
|
2747
|
+
investment\_name: <IressButton\>CASH.CASH</IressButton\>,
|
|
2748
|
+
totalPercentage: <IressBadge mode\="success"\>49%</IressBadge\>
|
|
2749
|
+
},
|
|
2750
|
+
{
|
|
2751
|
+
cost: '$26,382.46',
|
|
2752
|
+
investmentDate: '2019/02/05',
|
|
2753
|
+
investment\_name: <IressButton\>VODAFONE GRP</IressButton\>,
|
|
2754
|
+
totalPercentage: <IressBadge mode\="info"\>26.2%</IressBadge\>
|
|
2755
|
+
}
|
|
2756
|
+
\]}
|
|
2757
|
+
/>
|
|
2758
|
+
|
|
2759
|
+
```
|
|
2760
|
+
|
|
2761
|
+
#### Props
|
|
2762
|
+
|
|
2763
|
+
| Name | Description | Default | Control |
|
|
2764
|
+
| --- | --- | --- | --- |
|
|
2765
|
+
| alternate |
|
|
2766
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
2767
|
+
|
|
2768
|
+
boolean
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
|
|
|
2773
|
+
|
|
2774
|
+
false
|
|
2775
|
+
|
|
2776
|
+
| Set boolean |
|
|
2777
|
+
| caption\* |
|
|
2778
|
+
|
|
2779
|
+
Caption that describes the data in the table, required for accessibility.
|
|
2780
|
+
|
|
2781
|
+
ReactNode
|
|
2782
|
+
|
|
2783
|
+
|
|
2784
|
+
|
|
2785
|
+
| \- |
|
|
2786
|
+
|
|
2787
|
+
"My rich investments"
|
|
2788
|
+
|
|
2789
|
+
|
|
|
2790
|
+
| children |
|
|
2791
|
+
|
|
2792
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
2793
|
+
|
|
2794
|
+
ReactNode
|
|
2795
|
+
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
| \- | \- |
|
|
2799
|
+
| columns |
|
|
2800
|
+
|
|
2801
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
2802
|
+
|
|
2803
|
+
TableColumn<TRow, TVal>\[\]
|
|
2804
|
+
|
|
2805
|
+
| \- | Set object |
|
|
2806
|
+
| compact |
|
|
2807
|
+
|
|
2808
|
+
Compact view of the table, used for tables with a lot of data.
|
|
2809
|
+
|
|
2810
|
+
boolean
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
|
+
|
|
|
2815
|
+
|
|
2816
|
+
false
|
|
2817
|
+
|
|
2818
|
+
| Set boolean |
|
|
2819
|
+
| empty |
|
|
2820
|
+
|
|
2821
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
2822
|
+
|
|
2823
|
+
ReactNode
|
|
2824
|
+
|
|
2825
|
+
|
|
2826
|
+
|
|
2827
|
+
| \- | Set object |
|
|
2828
|
+
| hiddenCaption |
|
|
2829
|
+
|
|
2830
|
+
When set to true, the table caption will be visually hidden.
|
|
2831
|
+
|
|
2832
|
+
boolean
|
|
2833
|
+
|
|
2834
|
+
|
|
2835
|
+
|
|
2836
|
+
| \- | Set boolean |
|
|
2837
|
+
| hiddenHeader |
|
|
2838
|
+
|
|
2839
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
2840
|
+
|
|
2841
|
+
boolean
|
|
2842
|
+
|
|
2843
|
+
|
|
2844
|
+
|
|
2845
|
+
| \- | Set boolean |
|
|
2846
|
+
| hover |
|
|
2847
|
+
|
|
2848
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
2849
|
+
|
|
2850
|
+
boolean
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
| \- | Set boolean |
|
|
2855
|
+
| removeRowBorders |
|
|
2856
|
+
|
|
2857
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
2858
|
+
|
|
2859
|
+
boolean
|
|
2860
|
+
|
|
2861
|
+
|
|
2862
|
+
|
|
2863
|
+
|
|
|
2864
|
+
|
|
2865
|
+
false
|
|
2866
|
+
|
|
2867
|
+
| Set boolean |
|
|
2868
|
+
| rowProps |
|
|
2869
|
+
|
|
2870
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
2871
|
+
|
|
2872
|
+
TableRowsProps\['rowProps'\]
|
|
2873
|
+
|
|
2874
|
+
| \- | Set object |
|
|
2875
|
+
| rows |
|
|
2876
|
+
|
|
2877
|
+
Each object in the array contains the data for a row.
|
|
2878
|
+
|
|
2879
|
+
TRow\[\]
|
|
2880
|
+
|
|
2881
|
+
| \[\] |
|
|
2882
|
+
|
|
2883
|
+
RAW
|
|
2884
|
+
|
|
2885
|
+
* rows :
|
|
2886
|
+
|
|
2887
|
+
\[
|
|
2888
|
+
|
|
2889
|
+
* 0 :
|
|
2890
|
+
|
|
2891
|
+
{...} 4 keys
|
|
2892
|
+
|
|
2893
|
+
* 1 :
|
|
2894
|
+
|
|
2895
|
+
{...} 4 keys
|
|
2896
|
+
|
|
2897
|
+
* 2 :
|
|
2898
|
+
|
|
2899
|
+
{...} 4 keys
|
|
2900
|
+
|
|
2901
|
+
|
|
2902
|
+
\]
|
|
2903
|
+
|
|
2904
|
+
|
|
2905
|
+
|
|
2906
|
+
|
|
2907
|
+
|
|
|
2908
|
+
| scope |
|
|
2909
|
+
|
|
2910
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
2911
|
+
|
|
2912
|
+
union
|
|
2913
|
+
|
|
2914
|
+
|
|
2915
|
+
|
|
2916
|
+
| \- |
|
|
2917
|
+
|
|
2918
|
+
rowcol
|
|
2919
|
+
|
|
2920
|
+
|
|
|
2921
|
+
|
|
2922
|
+
### Empty state
|
|
2923
|
+
|
|
2924
|
+
You can provide the table with some content to display when there is no row data by using the `empty` prop.
|
|
2925
|
+
|
|
2926
|
+
This is reliant on `columns` prop to provide the information for the table header. If `columns` is not provided and there is no row data the table will not render.
|
|
2927
|
+
|
|
2928
|
+
[](./iframe.html?id=components-table--empty-state)
|
|
2929
|
+
|
|
2930
|
+
| Investment | Date | Share | Cost |
|
|
2931
|
+
| --- | --- | --- | --- |
|
|
2932
|
+
| This table has no data |
|
|
2933
|
+
|
|
2934
|
+
```
|
|
2935
|
+
|
|
2936
|
+
<IressTable
|
|
2937
|
+
columns\={\[
|
|
2938
|
+
{
|
|
2939
|
+
divider: true,
|
|
2940
|
+
key: 'investment\_name',
|
|
2941
|
+
label: 'Investment'
|
|
2942
|
+
},
|
|
2943
|
+
{
|
|
2944
|
+
format: 'date',
|
|
2945
|
+
key: 'investmentDate',
|
|
2946
|
+
label: 'Date'
|
|
2947
|
+
},
|
|
2948
|
+
{
|
|
2949
|
+
format: 'percent',
|
|
2950
|
+
key: 'totalPercentage',
|
|
2951
|
+
label: 'Share'
|
|
2952
|
+
},
|
|
2953
|
+
{
|
|
2954
|
+
format: 'currency',
|
|
2955
|
+
key: 'cost',
|
|
2956
|
+
label: 'Cost',
|
|
2957
|
+
textAlign: 'right'
|
|
2958
|
+
}
|
|
2959
|
+
\]}
|
|
2960
|
+
empty\="This table has no data"
|
|
2961
|
+
rows\={\[\]}
|
|
2962
|
+
/>
|
|
2963
|
+
|
|
2964
|
+
```
|
|
2965
|
+
|
|
2966
|
+
#### Props
|
|
2967
|
+
|
|
2968
|
+
| Name | Description | Default | Control |
|
|
2969
|
+
| --- | --- | --- | --- |
|
|
2970
|
+
| alternate |
|
|
2971
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
2972
|
+
|
|
2973
|
+
boolean
|
|
2974
|
+
|
|
2975
|
+
|
|
2976
|
+
|
|
2977
|
+
|
|
|
2978
|
+
|
|
2979
|
+
false
|
|
2980
|
+
|
|
2981
|
+
| Set boolean |
|
|
2982
|
+
| caption\* |
|
|
2983
|
+
|
|
2984
|
+
Caption that describes the data in the table, required for accessibility.
|
|
2985
|
+
|
|
2986
|
+
ReactNode
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
| \- | Set object |
|
|
2991
|
+
| children |
|
|
2992
|
+
|
|
2993
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
2994
|
+
|
|
2995
|
+
ReactNode
|
|
2996
|
+
|
|
2997
|
+
|
|
2998
|
+
|
|
2999
|
+
| \- | \- |
|
|
3000
|
+
| columns |
|
|
3001
|
+
|
|
3002
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
3003
|
+
|
|
3004
|
+
TableColumn<TRow, TVal>\[\]
|
|
3005
|
+
|
|
3006
|
+
| \- |
|
|
3007
|
+
|
|
3008
|
+
RAW
|
|
3009
|
+
|
|
3010
|
+
* columns :
|
|
3011
|
+
|
|
3012
|
+
\[
|
|
3013
|
+
|
|
3014
|
+
* 0 :
|
|
3015
|
+
|
|
3016
|
+
{...} 3 keys
|
|
3017
|
+
|
|
3018
|
+
* 1 :
|
|
3019
|
+
|
|
3020
|
+
{...} 3 keys
|
|
3021
|
+
|
|
3022
|
+
* 2 :
|
|
3023
|
+
|
|
3024
|
+
{...} 3 keys
|
|
3025
|
+
|
|
3026
|
+
* 3 :
|
|
3027
|
+
|
|
3028
|
+
{...} 4 keys
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
\]
|
|
3032
|
+
|
|
3033
|
+
|
|
3034
|
+
|
|
3035
|
+
|
|
3036
|
+
|
|
|
3037
|
+
| compact |
|
|
3038
|
+
|
|
3039
|
+
Compact view of the table, used for tables with a lot of data.
|
|
3040
|
+
|
|
3041
|
+
boolean
|
|
3042
|
+
|
|
3043
|
+
|
|
3044
|
+
|
|
3045
|
+
|
|
|
3046
|
+
|
|
3047
|
+
false
|
|
3048
|
+
|
|
3049
|
+
| Set boolean |
|
|
3050
|
+
| empty |
|
|
3051
|
+
|
|
3052
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
3053
|
+
|
|
3054
|
+
ReactNode
|
|
3055
|
+
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
| \- |
|
|
3059
|
+
|
|
3060
|
+
"This table has no data"
|
|
3061
|
+
|
|
3062
|
+
|
|
|
3063
|
+
| hiddenCaption |
|
|
3064
|
+
|
|
3065
|
+
When set to true, the table caption will be visually hidden.
|
|
3066
|
+
|
|
3067
|
+
boolean
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
|
|
3071
|
+
| \- | Set boolean |
|
|
3072
|
+
| hiddenHeader |
|
|
3073
|
+
|
|
3074
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
3075
|
+
|
|
3076
|
+
boolean
|
|
3077
|
+
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
| \- | Set boolean |
|
|
3081
|
+
| hover |
|
|
3082
|
+
|
|
3083
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
3084
|
+
|
|
3085
|
+
boolean
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
| \- | Set boolean |
|
|
3090
|
+
| removeRowBorders |
|
|
3091
|
+
|
|
3092
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
3093
|
+
|
|
3094
|
+
boolean
|
|
3095
|
+
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
|
|
|
3099
|
+
|
|
3100
|
+
false
|
|
3101
|
+
|
|
3102
|
+
| Set boolean |
|
|
3103
|
+
| rowProps |
|
|
3104
|
+
|
|
3105
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
3106
|
+
|
|
3107
|
+
TableRowsProps\['rowProps'\]
|
|
3108
|
+
|
|
3109
|
+
| \- | Set object |
|
|
3110
|
+
| rows |
|
|
3111
|
+
|
|
3112
|
+
Each object in the array contains the data for a row.
|
|
3113
|
+
|
|
3114
|
+
TRow\[\]
|
|
3115
|
+
|
|
3116
|
+
| \[\] |
|
|
3117
|
+
|
|
3118
|
+
RAW
|
|
3119
|
+
|
|
3120
|
+
* rows :
|
|
3121
|
+
|
|
3122
|
+
\[
|
|
3123
|
+
|
|
3124
|
+
\]
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
|
|
3128
|
+
|
|
3129
|
+
|
|
|
3130
|
+
| scope |
|
|
3131
|
+
|
|
3132
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
3133
|
+
|
|
3134
|
+
union
|
|
3135
|
+
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
| \- |
|
|
3139
|
+
|
|
3140
|
+
rowcol
|
|
3141
|
+
|
|
3142
|
+
|
|
|
3143
|
+
|
|
3144
|
+
### Static table
|
|
3145
|
+
|
|
3146
|
+
If you don't need all the fancy features of the table component, but would still like a styled table, you can use the `children` prop.
|
|
3147
|
+
|
|
3148
|
+
It accepts any of the table sub-elements. To ensure best display, please make use of the `thead` and `tbody` tags.
|
|
3149
|
+
|
|
3150
|
+
**Note:** Only the `caption`, `hiddenCaption`, `hiddenHeader` and `hover` props are supported when using `children` to render a table.
|
|
3151
|
+
|
|
3152
|
+
[](./iframe.html?id=components-table--static)
|
|
3153
|
+
|
|
3154
|
+
My investments
|
|
3155
|
+
| Investment | Cost | Investment date | Share |
|
|
3156
|
+
| --- | --- | --- | --- |
|
|
3157
|
+
| Artemis Fund Managers Limited | $23,898 | 2019/09/23 | 24.8% |
|
|
3158
|
+
| CASH.CASH | $49,751.40 | 2020/06/28 | 49% |
|
|
3159
|
+
| VODAFONE GRP | $26,382.46 | 2019/02/05 | 26.2% |
|
|
3160
|
+
|
|
3161
|
+
```
|
|
3162
|
+
|
|
3163
|
+
<IressTable caption\="My investments"\>
|
|
3164
|
+
<thead\>
|
|
3165
|
+
<tr\>
|
|
3166
|
+
<th\>
|
|
3167
|
+
Investment </th\>
|
|
3168
|
+
<th\>
|
|
3169
|
+
Cost </th\>
|
|
3170
|
+
<th\>
|
|
3171
|
+
Investment date </th\>
|
|
3172
|
+
<th\>
|
|
3173
|
+
Share </th\>
|
|
3174
|
+
</tr\>
|
|
3175
|
+
</thead\>
|
|
3176
|
+
<tbody\>
|
|
3177
|
+
<tr\>
|
|
3178
|
+
<th\>
|
|
3179
|
+
Artemis Fund Managers Limited </th\>
|
|
3180
|
+
<td\>
|
|
3181
|
+
$23,898 </td\>
|
|
3182
|
+
<td\>
|
|
3183
|
+
2019/09/23 </td\>
|
|
3184
|
+
<td\>
|
|
3185
|
+
24.8% </td\>
|
|
3186
|
+
</tr\>
|
|
3187
|
+
<tr\>
|
|
3188
|
+
<th\>
|
|
3189
|
+
CASH.CASH </th\>
|
|
3190
|
+
<td\>
|
|
3191
|
+
$49,751.40 </td\>
|
|
3192
|
+
<td\>
|
|
3193
|
+
2020/06/28 </td\>
|
|
3194
|
+
<td\>
|
|
3195
|
+
49% </td\>
|
|
3196
|
+
</tr\>
|
|
3197
|
+
<tr\>
|
|
3198
|
+
<th\>
|
|
3199
|
+
VODAFONE GRP </th\>
|
|
3200
|
+
<td\>
|
|
3201
|
+
$26,382.46 </td\>
|
|
3202
|
+
<td\>
|
|
3203
|
+
2019/02/05 </td\>
|
|
3204
|
+
<td\>
|
|
3205
|
+
26.2% </td\>
|
|
3206
|
+
</tr\>
|
|
3207
|
+
</tbody\>
|
|
3208
|
+
</IressTable\>
|
|
3209
|
+
|
|
3210
|
+
```
|
|
3211
|
+
|
|
3212
|
+
#### Props
|
|
3213
|
+
|
|
3214
|
+
| Name | Description | Default | Control |
|
|
3215
|
+
| --- | --- | --- | --- |
|
|
3216
|
+
| alternate |
|
|
3217
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
3218
|
+
|
|
3219
|
+
boolean
|
|
3220
|
+
|
|
3221
|
+
|
|
3222
|
+
|
|
3223
|
+
|
|
|
3224
|
+
|
|
3225
|
+
false
|
|
3226
|
+
|
|
3227
|
+
| Set boolean |
|
|
3228
|
+
| caption\* |
|
|
3229
|
+
|
|
3230
|
+
Caption that describes the data in the table, required for accessibility.
|
|
3231
|
+
|
|
3232
|
+
ReactNode
|
|
3233
|
+
|
|
3234
|
+
|
|
3235
|
+
|
|
3236
|
+
| \- |
|
|
3237
|
+
|
|
3238
|
+
"My investments"
|
|
3239
|
+
|
|
3240
|
+
|
|
|
3241
|
+
| children |
|
|
3242
|
+
|
|
3243
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
3244
|
+
|
|
3245
|
+
ReactNode
|
|
3246
|
+
|
|
3247
|
+
|
|
3248
|
+
|
|
3249
|
+
| \- | \- |
|
|
3250
|
+
| columns |
|
|
3251
|
+
|
|
3252
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
3253
|
+
|
|
3254
|
+
TableColumn<TRow, TVal>\[\]
|
|
3255
|
+
|
|
3256
|
+
| \- | Set object |
|
|
3257
|
+
| compact |
|
|
3258
|
+
|
|
3259
|
+
Compact view of the table, used for tables with a lot of data.
|
|
3260
|
+
|
|
3261
|
+
boolean
|
|
3262
|
+
|
|
3263
|
+
|
|
3264
|
+
|
|
3265
|
+
|
|
|
3266
|
+
|
|
3267
|
+
false
|
|
3268
|
+
|
|
3269
|
+
| Set boolean |
|
|
3270
|
+
| empty |
|
|
3271
|
+
|
|
3272
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
3273
|
+
|
|
3274
|
+
ReactNode
|
|
3275
|
+
|
|
3276
|
+
|
|
3277
|
+
|
|
3278
|
+
| \- | Set object |
|
|
3279
|
+
| hiddenCaption |
|
|
3280
|
+
|
|
3281
|
+
When set to true, the table caption will be visually hidden.
|
|
3282
|
+
|
|
3283
|
+
boolean
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
| \- | Set boolean |
|
|
3288
|
+
| hiddenHeader |
|
|
3289
|
+
|
|
3290
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
3291
|
+
|
|
3292
|
+
boolean
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
| \- | Set boolean |
|
|
3297
|
+
| hover |
|
|
3298
|
+
|
|
3299
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
3300
|
+
|
|
3301
|
+
boolean
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
| \- | Set boolean |
|
|
3306
|
+
| removeRowBorders |
|
|
3307
|
+
|
|
3308
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
3309
|
+
|
|
3310
|
+
boolean
|
|
3311
|
+
|
|
3312
|
+
|
|
3313
|
+
|
|
3314
|
+
|
|
|
3315
|
+
|
|
3316
|
+
false
|
|
3317
|
+
|
|
3318
|
+
| Set boolean |
|
|
3319
|
+
| rowProps |
|
|
3320
|
+
|
|
3321
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
3322
|
+
|
|
3323
|
+
TableRowsProps\['rowProps'\]
|
|
3324
|
+
|
|
3325
|
+
| \- | Set object |
|
|
3326
|
+
| rows |
|
|
3327
|
+
|
|
3328
|
+
Each object in the array contains the data for a row.
|
|
3329
|
+
|
|
3330
|
+
TRow\[\]
|
|
3331
|
+
|
|
3332
|
+
| \[\] | Set object |
|
|
3333
|
+
| scope |
|
|
3334
|
+
|
|
3335
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
3336
|
+
|
|
3337
|
+
union
|
|
3338
|
+
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
| \- |
|
|
3342
|
+
|
|
3343
|
+
rowcol
|
|
3344
|
+
|
|
3345
|
+
|
|
|
3346
|
+
|
|
3347
|
+
### Row props
|
|
3348
|
+
|
|
3349
|
+
You can customise the rows by passing in a `rowProps` object or function. It accepts a map of table row props that can be passed to a `tr` element, or a function that accepts the row data currently being rendered, and returns a map of table props.
|
|
3350
|
+
|
|
3351
|
+
[](./iframe.html?id=components-table--row-props)
|
|
3352
|
+
|
|
3353
|
+
My investments
|
|
3354
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
3355
|
+
| --- | --- | --- | --- |
|
|
3356
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
|
|
3357
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49 |
|
|
3358
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
|
|
3359
|
+
|
|
3360
|
+
```
|
|
3361
|
+
|
|
3362
|
+
<IressTable
|
|
3363
|
+
caption\="My investments"
|
|
3364
|
+
rows\={\[
|
|
3365
|
+
{
|
|
3366
|
+
cost: 23898,
|
|
3367
|
+
investmentDate: '2019-09-23',
|
|
3368
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
3369
|
+
totalPercentage: 24.8
|
|
3370
|
+
},
|
|
3371
|
+
{
|
|
3372
|
+
cost: 49751.4,
|
|
3373
|
+
investmentDate: '2020-06-28',
|
|
3374
|
+
investment\_name: 'CASH.CASH',
|
|
3375
|
+
totalPercentage: 49
|
|
3376
|
+
},
|
|
3377
|
+
{
|
|
3378
|
+
cost: 26382.456,
|
|
3379
|
+
investmentDate: '2019-02-05',
|
|
3380
|
+
investment\_name: 'VODAFONE GRP',
|
|
3381
|
+
totalPercentage: 26.2
|
|
3382
|
+
}
|
|
3383
|
+
\]}
|
|
3384
|
+
rowProps\={(row) \=> ({
|
|
3385
|
+
bg: row.original.cost && row.original.cost \> 30000 ? "colour.neutral.10" : "colour.system.success.surface"
|
|
3386
|
+
})}
|
|
3387
|
+
/>
|
|
3388
|
+
|
|
3389
|
+
```
|
|
3390
|
+
|
|
3391
|
+
#### Props
|
|
3392
|
+
|
|
3393
|
+
| Name | Description | Default | Control |
|
|
3394
|
+
| --- | --- | --- | --- |
|
|
3395
|
+
| alternate |
|
|
3396
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
3397
|
+
|
|
3398
|
+
boolean
|
|
3399
|
+
|
|
3400
|
+
|
|
3401
|
+
|
|
3402
|
+
|
|
|
3403
|
+
|
|
3404
|
+
false
|
|
3405
|
+
|
|
3406
|
+
| Set boolean |
|
|
3407
|
+
| caption\* |
|
|
3408
|
+
|
|
3409
|
+
Caption that describes the data in the table, required for accessibility.
|
|
3410
|
+
|
|
3411
|
+
ReactNode
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
|
|
3415
|
+
| \- |
|
|
3416
|
+
|
|
3417
|
+
"My investments"
|
|
3418
|
+
|
|
3419
|
+
|
|
|
3420
|
+
| children |
|
|
3421
|
+
|
|
3422
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
3423
|
+
|
|
3424
|
+
ReactNode
|
|
3425
|
+
|
|
3426
|
+
|
|
3427
|
+
|
|
3428
|
+
| \- | \- |
|
|
3429
|
+
| columns |
|
|
3430
|
+
|
|
3431
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
3432
|
+
|
|
3433
|
+
TableColumn<TRow, TVal>\[\]
|
|
3434
|
+
|
|
3435
|
+
| \- | Set object |
|
|
3436
|
+
| compact |
|
|
3437
|
+
|
|
3438
|
+
Compact view of the table, used for tables with a lot of data.
|
|
3439
|
+
|
|
3440
|
+
boolean
|
|
3441
|
+
|
|
3442
|
+
|
|
3443
|
+
|
|
3444
|
+
|
|
|
3445
|
+
|
|
3446
|
+
false
|
|
3447
|
+
|
|
3448
|
+
| Set boolean |
|
|
3449
|
+
| empty |
|
|
3450
|
+
|
|
3451
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
3452
|
+
|
|
3453
|
+
ReactNode
|
|
3454
|
+
|
|
3455
|
+
|
|
3456
|
+
|
|
3457
|
+
| \- | Set object |
|
|
3458
|
+
| hiddenCaption |
|
|
3459
|
+
|
|
3460
|
+
When set to true, the table caption will be visually hidden.
|
|
3461
|
+
|
|
3462
|
+
boolean
|
|
3463
|
+
|
|
3464
|
+
|
|
3465
|
+
|
|
3466
|
+
| \- | Set boolean |
|
|
3467
|
+
| hiddenHeader |
|
|
3468
|
+
|
|
3469
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
3470
|
+
|
|
3471
|
+
boolean
|
|
3472
|
+
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
| \- | Set boolean |
|
|
3476
|
+
| hover |
|
|
3477
|
+
|
|
3478
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
3479
|
+
|
|
3480
|
+
boolean
|
|
3481
|
+
|
|
3482
|
+
|
|
3483
|
+
|
|
3484
|
+
| \- | Set boolean |
|
|
3485
|
+
| removeRowBorders |
|
|
3486
|
+
|
|
3487
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
3488
|
+
|
|
3489
|
+
boolean
|
|
3490
|
+
|
|
3491
|
+
|
|
3492
|
+
|
|
3493
|
+
|
|
|
3494
|
+
|
|
3495
|
+
false
|
|
3496
|
+
|
|
3497
|
+
| Set boolean |
|
|
3498
|
+
| rowProps |
|
|
3499
|
+
|
|
3500
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
3501
|
+
|
|
3502
|
+
TableRowsProps\['rowProps'\]
|
|
3503
|
+
|
|
3504
|
+
| \- |
|
|
3505
|
+
|
|
3506
|
+
|
|
|
3507
|
+
| rows |
|
|
3508
|
+
|
|
3509
|
+
Each object in the array contains the data for a row.
|
|
3510
|
+
|
|
3511
|
+
TRow\[\]
|
|
3512
|
+
|
|
3513
|
+
| \[\] |
|
|
3514
|
+
|
|
3515
|
+
RAW
|
|
3516
|
+
|
|
3517
|
+
* rows :
|
|
3518
|
+
|
|
3519
|
+
\[
|
|
3520
|
+
|
|
3521
|
+
* 0 :
|
|
3522
|
+
|
|
3523
|
+
{...} 4 keys
|
|
3524
|
+
|
|
3525
|
+
* 1 :
|
|
3526
|
+
|
|
3527
|
+
{...} 4 keys
|
|
3528
|
+
|
|
3529
|
+
* 2 :
|
|
3530
|
+
|
|
3531
|
+
{...} 4 keys
|
|
3532
|
+
|
|
3533
|
+
|
|
3534
|
+
\]
|
|
3535
|
+
|
|
3536
|
+
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
|
|
|
3540
|
+
| scope |
|
|
3541
|
+
|
|
3542
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
3543
|
+
|
|
3544
|
+
union
|
|
3545
|
+
|
|
3546
|
+
|
|
3547
|
+
|
|
3548
|
+
| \- |
|
|
3549
|
+
|
|
3550
|
+
rowcol
|
|
3551
|
+
|
|
3552
|
+
|
|
|
3553
|
+
|
|
3554
|
+
### Compact
|
|
3555
|
+
|
|
3556
|
+
The `compact` prop can be used to reduce the padding around the table cells and reduce the font size. This can be useful when you have a lot of data to display and allow users to see as many columns as possible.
|
|
3557
|
+
|
|
3558
|
+
[](./iframe.html?id=components-table--compact)
|
|
3559
|
+
|
|
3560
|
+
My investments
|
|
3561
|
+
| Investment Name | Cost | Investment Date | Total Percentage |
|
|
3562
|
+
| --- | --- | --- | --- |
|
|
3563
|
+
| Artemis Fund Managers Limited | 23898 | 2019-09-23 | 24.8 |
|
|
3564
|
+
| CASH.CASH | 49751.4 | 2020-06-28 | 49 |
|
|
3565
|
+
| VODAFONE GRP | 26382.456 | 2019-02-05 | 26.2 |
|
|
3566
|
+
|
|
3567
|
+
```
|
|
3568
|
+
|
|
3569
|
+
<IressTable
|
|
3570
|
+
caption\="My investments"
|
|
3571
|
+
rows\={\[
|
|
3572
|
+
{
|
|
3573
|
+
cost: 23898,
|
|
3574
|
+
investmentDate: '2019-09-23',
|
|
3575
|
+
investment\_name: 'Artemis Fund Managers Limited',
|
|
3576
|
+
totalPercentage: 24.8
|
|
3577
|
+
},
|
|
3578
|
+
{
|
|
3579
|
+
cost: 49751.4,
|
|
3580
|
+
investmentDate: '2020-06-28',
|
|
3581
|
+
investment\_name: 'CASH.CASH',
|
|
3582
|
+
totalPercentage: 49
|
|
3583
|
+
},
|
|
3584
|
+
{
|
|
3585
|
+
cost: 26382.456,
|
|
3586
|
+
investmentDate: '2019-02-05',
|
|
3587
|
+
investment\_name: 'VODAFONE GRP',
|
|
3588
|
+
totalPercentage: 26.2
|
|
3589
|
+
}
|
|
3590
|
+
\]}
|
|
3591
|
+
compact
|
|
3592
|
+
/>
|
|
3593
|
+
|
|
3594
|
+
```
|
|
3595
|
+
|
|
3596
|
+
#### Props
|
|
3597
|
+
|
|
3598
|
+
| Name | Description | Default | Control |
|
|
3599
|
+
| --- | --- | --- | --- |
|
|
3600
|
+
| alternate |
|
|
3601
|
+
If set to true, the table will have alternating row colors. This is useful for improving readability in tables with many rows.
|
|
3602
|
+
|
|
3603
|
+
boolean
|
|
3604
|
+
|
|
3605
|
+
|
|
3606
|
+
|
|
3607
|
+
|
|
|
3608
|
+
|
|
3609
|
+
false
|
|
3610
|
+
|
|
3611
|
+
| Set boolean |
|
|
3612
|
+
| caption\* |
|
|
3613
|
+
|
|
3614
|
+
Caption that describes the data in the table, required for accessibility.
|
|
3615
|
+
|
|
3616
|
+
ReactNode
|
|
3617
|
+
|
|
3618
|
+
|
|
3619
|
+
|
|
3620
|
+
| \- |
|
|
3621
|
+
|
|
3622
|
+
"My investments"
|
|
3623
|
+
|
|
3624
|
+
|
|
|
3625
|
+
| children |
|
|
3626
|
+
|
|
3627
|
+
Multiple table elements can be passed as children. Used to create a static table, or add a `<tfoot />` element to a `rows` based table.
|
|
3628
|
+
|
|
3629
|
+
ReactNode
|
|
3630
|
+
|
|
3631
|
+
|
|
3632
|
+
|
|
3633
|
+
| \- | \- |
|
|
3634
|
+
| columns |
|
|
3635
|
+
|
|
3636
|
+
A mapping of columns to be displayed in the table. If not provided, it will be automatically regenerated from the row data.
|
|
3637
|
+
|
|
3638
|
+
TableColumn<TRow, TVal>\[\]
|
|
3639
|
+
|
|
3640
|
+
| \- | Set object |
|
|
3641
|
+
| compact |
|
|
3642
|
+
|
|
3643
|
+
Compact view of the table, used for tables with a lot of data.
|
|
3644
|
+
|
|
3645
|
+
boolean
|
|
3646
|
+
|
|
3647
|
+
|
|
3648
|
+
|
|
3649
|
+
|
|
|
3650
|
+
|
|
3651
|
+
false
|
|
3652
|
+
|
|
3653
|
+
| FalseTrue |
|
|
3654
|
+
| empty |
|
|
3655
|
+
|
|
3656
|
+
Content to be show when there is no rowData (columns must also be provided).
|
|
3657
|
+
|
|
3658
|
+
ReactNode
|
|
3659
|
+
|
|
3660
|
+
|
|
3661
|
+
|
|
3662
|
+
| \- | Set object |
|
|
3663
|
+
| hiddenCaption |
|
|
3664
|
+
|
|
3665
|
+
When set to true, the table caption will be visually hidden.
|
|
3666
|
+
|
|
3667
|
+
boolean
|
|
3668
|
+
|
|
3669
|
+
|
|
3670
|
+
|
|
3671
|
+
| \- | Set boolean |
|
|
3672
|
+
| hiddenHeader |
|
|
3673
|
+
|
|
3674
|
+
When set to true, the table header (`<thead></thead>`) will be not be rendered. Only use with very simple tables.
|
|
3675
|
+
|
|
3676
|
+
boolean
|
|
3677
|
+
|
|
3678
|
+
|
|
3679
|
+
|
|
3680
|
+
| \- | Set boolean |
|
|
3681
|
+
| hover |
|
|
3682
|
+
|
|
3683
|
+
When set to true, hovering over a row will trigger a UI change.
|
|
3684
|
+
|
|
3685
|
+
boolean
|
|
3686
|
+
|
|
3687
|
+
|
|
3688
|
+
|
|
3689
|
+
| \- | Set boolean |
|
|
3690
|
+
| removeRowBorders |
|
|
3691
|
+
|
|
3692
|
+
If set to true, the table will not have borders between rows. This is useful for simpler tables where the row borders are not needed.
|
|
3693
|
+
|
|
3694
|
+
boolean
|
|
3695
|
+
|
|
3696
|
+
|
|
3697
|
+
|
|
3698
|
+
|
|
|
3699
|
+
|
|
3700
|
+
false
|
|
3701
|
+
|
|
3702
|
+
| Set boolean |
|
|
3703
|
+
| rowProps |
|
|
3704
|
+
|
|
3705
|
+
Add additional props to the row element. Can be a props map or a function that returns an props map. The function is called with the row data.
|
|
3706
|
+
|
|
3707
|
+
TableRowsProps\['rowProps'\]
|
|
3708
|
+
|
|
3709
|
+
| \- | Set object |
|
|
3710
|
+
| rows |
|
|
3711
|
+
|
|
3712
|
+
Each object in the array contains the data for a row.
|
|
3713
|
+
|
|
3714
|
+
TRow\[\]
|
|
3715
|
+
|
|
3716
|
+
| \[\] |
|
|
3717
|
+
|
|
3718
|
+
RAW
|
|
3719
|
+
|
|
3720
|
+
* rows :
|
|
3721
|
+
|
|
3722
|
+
\[
|
|
3723
|
+
|
|
3724
|
+
* 0 :
|
|
3725
|
+
|
|
3726
|
+
{...} 4 keys
|
|
3727
|
+
|
|
3728
|
+
* 1 :
|
|
3729
|
+
|
|
3730
|
+
{...} 4 keys
|
|
3731
|
+
|
|
3732
|
+
* 2 :
|
|
3733
|
+
|
|
3734
|
+
{...} 4 keys
|
|
3735
|
+
|
|
3736
|
+
|
|
3737
|
+
\]
|
|
3738
|
+
|
|
3739
|
+
|
|
3740
|
+
|
|
3741
|
+
|
|
3742
|
+
|
|
|
3743
|
+
| scope |
|
|
3744
|
+
|
|
3745
|
+
Defaults to 'row' - the first cell in the row is a `<th>`, otherwise it's a `<td>`.
|
|
3746
|
+
|
|
3747
|
+
union
|
|
3748
|
+
|
|
3749
|
+
|
|
3750
|
+
|
|
3751
|
+
| \- |
|
|
3752
|
+
|
|
3753
|
+
rowcol
|
|
3754
|
+
|
|
3755
|
+
|
|
|
3756
|
+
|
|
3757
|
+
`IressTableBody`
|
|
3758
|
+
----------------
|
|
3759
|
+
|
|
3760
|
+
In some cases you may have a table with multiple groups of rows inside it, however the columns are the same. For these cases, you can use the `IressTableBody` component.
|
|
3761
|
+
|
|
3762
|
+
[](./iframe.html?id=components-table-body--body)
|
|
3763
|
+
|
|
3764
|
+
<table class="table__table table__table--compact_false table__table--hover_false table__table--sortButtonNoWrap_false table__table--tableBodyOpen_false table__table--alternate_false table__table--removeRowBorders_false ids-table" id="_r_18_"><caption id="_r_18_--caption" class="table__caption table__caption--compact_false table__caption--hover_false table__caption--sortButtonNoWrap_false table__caption--tableBodyOpen_false table__caption--alternate_false table__caption--removeRowBorders_false">My liabilities</caption><tbody aria-labelledby="_r_19_--caption" class=""><tr><th aria-expanded="true" colspan="8" class="table__rowGroupHeader table__rowGroupHeader--compact_false table__rowGroupHeader--hover_false table__rowGroupHeader--sortButtonNoWrap_false table__rowGroupHeader--tableBodyOpen_true" id="_r_19_--caption" scope="rowgroup" aria-controls="_r_19_--header--0 _r_19_--rows--0 _r_19_--children"><button class="table__activator table__activator--compact_false table__activator--hover_false table__activator--sortButtonNoWrap_false table__activator--tableBodyOpen_true" type="button">Current liabilities</button></th></tr><tr id="_r_19_--header--0"><th id="_r_19___owner" headers="_r_19_--caption" class="ta_start" style="width: 75px; min-width: 75px;">Owner</th><th id="_r_19___type" headers="_r_19_--caption" class="ta_start" style="width: 100px; min-width: 100px;">Type</th><th id="_r_19___provider" headers="_r_19_--caption" class="ta_start">Provider</th><th id="_r_19___status" headers="_r_19_--caption" class="ta_start bd-e_table">Status</th><th id="_r_19___frequency" headers="_r_19_--caption" class="ta_start">Frequency</th><th id="_r_19___outstanding" headers="_r_19_--caption" aria-sort="none" class="ta_start [&&]:ta_end"><button type="button" class="table__sortHeader table__sortHeader--compact_false table__sortHeader--hover_false table__sortHeader--sortButtonNoWrap_true table__sortHeader--tableBodyOpen_false">Outstanding (GBP)<span role="img" class="ids-icon fal fa-sort table__sortIcon table__sortIcon--compact_false table__sortIcon--hover_false table__sortIcon--sortButtonNoWrap_true table__sortIcon--tableBodyOpen_false" aria-hidden="false" aria-label="sortable"></span></button></th><th id="_r_19___interestRate" headers="_r_19_--caption" aria-sort="none" class="ta_right"><button type="button" class="table__sortHeader table__sortHeader--compact_false table__sortHeader--hover_false table__sortHeader--sortButtonNoWrap_true table__sortHeader--tableBodyOpen_false">Interest rate p.a.<span role="img" class="ids-icon fal fa-sort table__sortIcon table__sortIcon--compact_false table__sortIcon--hover_false table__sortIcon--sortButtonNoWrap_true table__sortIcon--tableBodyOpen_false" aria-hidden="false" aria-label="sortable"></span></button></th><th id="_r_19___repayment" headers="_r_19_--caption" aria-sort="none" class="ta_start [&&]:ta_end"><button type="button" class="table__sortHeader table__sortHeader--compact_false table__sortHeader--hover_false table__sortHeader--sortButtonNoWrap_true table__sortHeader--tableBodyOpen_false">Repayment (GBP)<span role="img" class="ids-icon fal fa-sort table__sortIcon table__sortIcon--compact_false table__sortIcon--hover_false table__sortIcon--sortButtonNoWrap_true table__sortIcon--tableBodyOpen_false" aria-hidden="false" aria-label="sortable"></span></button></th></tr><tr id="_r_19_--rows--0" class=""><td data-column="owner" headers="_r_19___owner _r_19_--caption" id="_r_19___0_owner" class="ta_start" style="width: 75px; min-width: 75px;">Client</td><td data-column="type" headers="_r_19___type _r_19_--caption" id="_r_19___0_type" class="ta_start" style="width: 100px; min-width: 100px;">Credit card</td><td data-column="provider" headers="_r_19___provider _r_19_--caption" id="_r_19___0_provider" class="ta_start"></td><td data-column="status" headers="_r_19___status _r_19_--caption" id="_r_19___0_status" class="ta_start bd-e_table">Current</td><td data-column="frequency" headers="_r_19___frequency _r_19_--caption" id="_r_19___0_frequency" class="ta_start">Monthly</td><td data-column="outstanding" headers="_r_19___outstanding _r_19_--caption" id="_r_19___0_outstanding" class="ta_start [&&]:ta_end">$5,000.00</td><td data-column="interestRate" headers="_r_19___interestRate _r_19_--caption" id="_r_19___0_interestRate" class="ta_right">0%</td><td data-column="repayment" headers="_r_19___repayment _r_19_--caption" id="_r_19___0_repayment" class="ta_start [&&]:ta_end">$300.00</td></tr><tr id="_r_19_--children"><td colspan="8"><button type="button" class="iress-form-element iress-form-element__inner button__root button__root--inButtonGroup_false button__root--mode_secondary button__root--loading_false button__root--noWrap_false ids-button"><span class="button__prepend button__prepend--inButtonGroup_false button__prepend--mode_secondary button__prepend--loading_false button__prepend--noWrap_false"><span role="img" class="ids-icon fal fa-plus-circle" aria-hidden="true"></span></span>Add current liability</button></td></tr></tbody><tbody aria-labelledby="_r_1b_--caption" class=""><tr><th aria-expanded="false" colspan="8" class="table__rowGroupHeader table__rowGroupHeader--compact_false table__rowGroupHeader--hover_false table__rowGroupHeader--sortButtonNoWrap_false table__rowGroupHeader--tableBodyOpen_false" id="_r_1b_--caption" scope="rowgroup"><button class="table__activator table__activator--compact_false table__activator--hover_false table__activator--sortButtonNoWrap_false table__activator--tableBodyOpen_false" type="button">Long term liabilities</button></th></tr></tbody><tbody aria-labelledby="_r_1c_--caption" class=""><tr><th aria-expanded="false" colspan="8" class="table__rowGroupHeader table__rowGroupHeader--compact_false table__rowGroupHeader--hover_false table__rowGroupHeader--sortButtonNoWrap_false table__rowGroupHeader--tableBodyOpen_false" id="_r_1c_--caption" scope="rowgroup"><button class="table__activator table__activator--compact_false table__activator--hover_false table__activator--sortButtonNoWrap_false table__activator--tableBodyOpen_false" type="button">Contingent liabilities</button></th></tr></tbody></table>
|
|
3765
|
+
|
|
3766
|
+
```
|
|
3767
|
+
|
|
3768
|
+
interface Liability {
|
|
3769
|
+
owner: string;
|
|
3770
|
+
type: string;
|
|
3771
|
+
provider?: string;
|
|
3772
|
+
status: string;
|
|
3773
|
+
outstanding: number;
|
|
3774
|
+
interestRate: number;
|
|
3775
|
+
repayment: number;
|
|
3776
|
+
frequency: string;
|
|
3777
|
+
}
|
|
3778
|
+
const currentLiabilities \= \[
|
|
3779
|
+
{
|
|
3780
|
+
owner: 'Client',
|
|
3781
|
+
type: 'Credit card',
|
|
3782
|
+
status: 'Current',
|
|
3783
|
+
outstanding: 5000,
|
|
3784
|
+
interestRate: 0,
|
|
3785
|
+
repayment: 300,
|
|
3786
|
+
frequency: 'Monthly',
|
|
3787
|
+
},
|
|
3788
|
+
\];
|
|
3789
|
+
const longTermLiabilities \= \[
|
|
3790
|
+
{
|
|
3791
|
+
owner: 'Joint',
|
|
3792
|
+
type: 'Primary residence mortgage',
|
|
3793
|
+
provider: 'Other',
|
|
3794
|
+
status: 'Current',
|
|
3795
|
+
outstanding: 1000000,
|
|
3796
|
+
interestRate: 0,
|
|
3797
|
+
repayment: 0,
|
|
3798
|
+
frequency: 'Monthly',
|
|
3799
|
+
},
|
|
3800
|
+
{
|
|
3801
|
+
owner: 'Joint',
|
|
3802
|
+
type: 'Buy to let mortgage',
|
|
3803
|
+
status: 'Current',
|
|
3804
|
+
outstanding: 1000000,
|
|
3805
|
+
interestRate: 0,
|
|
3806
|
+
repayment: 0,
|
|
3807
|
+
frequency: 'Monthly',
|
|
3808
|
+
},
|
|
3809
|
+
{
|
|
3810
|
+
owner: 'Joint',
|
|
3811
|
+
type: 'Buy to let mortgage',
|
|
3812
|
+
status: 'Current',
|
|
3813
|
+
outstanding: 5000,
|
|
3814
|
+
interestRate: 0,
|
|
3815
|
+
repayment: 0,
|
|
3816
|
+
frequency: 'Monthly',
|
|
3817
|
+
},
|
|
3818
|
+
\];
|
|
3819
|
+
const contingentLiabilities \= \[
|
|
3820
|
+
{
|
|
3821
|
+
owner: 'Partner',
|
|
3822
|
+
type: 'Limited',
|
|
3823
|
+
status: 'Current',
|
|
3824
|
+
outstanding: 1000,
|
|
3825
|
+
interestRate: 0,
|
|
3826
|
+
repayment: 100,
|
|
3827
|
+
frequency: 'Monthly',
|
|
3828
|
+
},
|
|
3829
|
+
\];
|
|
3830
|
+
const columns: TableColumn<Liability\>\[\] \= \[
|
|
3831
|
+
{
|
|
3832
|
+
key: 'owner',
|
|
3833
|
+
label: 'Owner',
|
|
3834
|
+
width: '75px',
|
|
3835
|
+
},
|
|
3836
|
+
{
|
|
3837
|
+
key: 'type',
|
|
3838
|
+
label: 'Type',
|
|
3839
|
+
width: '100px',
|
|
3840
|
+
},
|
|
3841
|
+
{
|
|
3842
|
+
key: 'provider',
|
|
3843
|
+
label: 'Provider',
|
|
3844
|
+
},
|
|
3845
|
+
{
|
|
3846
|
+
key: 'status',
|
|
3847
|
+
label: 'Status',
|
|
3848
|
+
divider: true,
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
key: 'frequency',
|
|
3852
|
+
label: 'Frequency',
|
|
3853
|
+
},
|
|
3854
|
+
{
|
|
3855
|
+
key: 'outstanding',
|
|
3856
|
+
label: 'Outstanding (GBP)',
|
|
3857
|
+
format: 'currency',
|
|
3858
|
+
currencyCode: '',
|
|
3859
|
+
sort: true,
|
|
3860
|
+
},
|
|
3861
|
+
{
|
|
3862
|
+
key: 'interestRate',
|
|
3863
|
+
label: 'Interest rate p.a.',
|
|
3864
|
+
format: 'percent',
|
|
3865
|
+
textAlign: 'right',
|
|
3866
|
+
sort: true,
|
|
3867
|
+
},
|
|
3868
|
+
{
|
|
3869
|
+
key: 'repayment',
|
|
3870
|
+
label: 'Repayment (GBP)',
|
|
3871
|
+
format: 'currency',
|
|
3872
|
+
currencyCode: '',
|
|
3873
|
+
sort: true,
|
|
3874
|
+
},
|
|
3875
|
+
\];
|
|
3876
|
+
export const TableGroupedRows \= () \=> (
|
|
3877
|
+
<IressTable caption\="My liabilities"\>
|
|
3878
|
+
<IressTableBody
|
|
3879
|
+
rows\={currentLiabilities}
|
|
3880
|
+
columns\={columns}
|
|
3881
|
+
caption\="Current liabilities"
|
|
3882
|
+
scope\="col"
|
|
3883
|
+
open
|
|
3884
|
+
\>
|
|
3885
|
+
<IressButton prepend\={<IressIcon name\="plus-circle" />}\>
|
|
3886
|
+
Add current liability </IressButton\>
|
|
3887
|
+
</IressTableBody\>
|
|
3888
|
+
<IressTableBody
|
|
3889
|
+
rows\={longTermLiabilities}
|
|
3890
|
+
columns\={columns}
|
|
3891
|
+
caption\="Long term liabilities"
|
|
3892
|
+
scope\="col"
|
|
3893
|
+
\>
|
|
3894
|
+
<IressButton prepend\={<IressIcon name\="plus-circle" />}\>
|
|
3895
|
+
Add long term liability </IressButton\>
|
|
3896
|
+
</IressTableBody\>
|
|
3897
|
+
<IressTableBody
|
|
3898
|
+
rows\={contingentLiabilities}
|
|
3899
|
+
columns\={columns}
|
|
3900
|
+
caption\="Contingent liabilities"
|
|
3901
|
+
scope\="col"
|
|
3902
|
+
\>
|
|
3903
|
+
<IressButton prepend\={<IressIcon name\="plus-circle" />}\>
|
|
3904
|
+
Add contingent liability </IressButton\>
|
|
3905
|
+
</IressTableBody\>
|
|
3906
|
+
</IressTable\>
|
|
3907
|
+
);
|
|
3908
|
+
|
|
3909
|
+
```
|
|
3910
|
+
|
|
3911
|
+
#### Props
|
|
3912
|
+
|
|
3913
|
+
| Name | Description | Default | Control |
|
|
3914
|
+
| --- | --- | --- | --- |
|
|
3915
|
+
| caption\* |
|
|
3916
|
+
Caption that describes the data in the inner table, required for accessibility. Used to open/close the inner table.
|
|
3917
|
+
|
|
3918
|
+
**Note:** Do not include interactive elements inside the caption.
|
|
3919
|
+
|
|
3920
|
+
ReactNode
|
|
3921
|
+
|
|
3922
|
+
|
|
3923
|
+
|
|
3924
|
+
| \- | Set object |
|
|
3925
|
+
| hiddenCaption |
|
|
3926
|
+
|
|
3927
|
+
When set to true, the table caption will be visually hidden. If set, the inner table will always be open.
|
|
3928
|
+
|
|
3929
|
+
boolean
|
|
3930
|
+
|
|
3931
|
+
|
|
3932
|
+
|
|
3933
|
+
| \- | Set boolean |
|
|
3934
|
+
| onClosed |
|
|
3935
|
+
|
|
3936
|
+
Is called when table is closed.
|
|
3937
|
+
|
|
3938
|
+
() => void
|
|
3939
|
+
|
|
3940
|
+
| \- | \- |
|
|
3941
|
+
| onOpened |
|
|
3942
|
+
|
|
3943
|
+
Is called when table is opened.
|
|
3944
|
+
|
|
3945
|
+
() => void
|
|
3946
|
+
|
|
3947
|
+
| \- | \- |
|
|
3948
|
+
| open |
|
|
3949
|
+
|
|
3950
|
+
When true, all rows will be visible, otherwise they are hidden.
|
|
3951
|
+
|
|
3952
|
+
boolean
|
|
3953
|
+
|
|
3954
|
+
|
|
3955
|
+
|
|
3956
|
+
|
|
|
3957
|
+
|
|
3958
|
+
false
|
|
3959
|
+
|
|
3960
|
+
| Set boolean |
|
|
3961
|
+
| rows |
|
|
3962
|
+
|
|
3963
|
+
| \[\] | Set object |
|
|
3964
|
+
|
|
3965
|
+
`IressTableFormattedValue`
|
|
3966
|
+
--------------------------
|
|
3967
|
+
|
|
3968
|
+
`IressTableFormattedValue` is the component used to format the table columns when the `format` property is not a render function.
|
|
3969
|
+
|
|
3970
|
+
It has been exposed so you can use it in your own components to format values in the same way as the table component.
|
|
3971
|
+
|
|
3972
|
+
[](./iframe.html?id=components-table-formattedvalue--formatted-value)
|
|
3973
|
+
|
|
3974
|
+
IressTableFormattedValue
|
|
3975
|
+
| Mode | Example |
|
|
3976
|
+
| --- | --- |
|
|
3977
|
+
| string | string |
|
|
3978
|
+
| number | 10000 |
|
|
3979
|
+
| date | 14/11/2025 |
|
|
3980
|
+
| shortDate | 14 Nov 2025 |
|
|
3981
|
+
| isoDateTime | 2025-11-14 00:00:00 (UTC) |
|
|
3982
|
+
| relativeTime | 5 days ago |
|
|
3983
|
+
| currency | $10,000.00 |
|
|
3984
|
+
| percent | 50% |
|
|
3985
|
+
|
|
3986
|
+
```
|
|
3987
|
+
|
|
3988
|
+
{
|
|
3989
|
+
args: {
|
|
3990
|
+
value: '100'
|
|
3991
|
+
},
|
|
3992
|
+
argTypes: {
|
|
3993
|
+
...disableArgTypes(\['format', 'value'\])
|
|
3994
|
+
},
|
|
3995
|
+
render: () \=> <IressTable caption\="IressTableFormattedValue" rows\={\[{
|
|
3996
|
+
mode: 'string',
|
|
3997
|
+
example: <IressTableFormattedValue value\="string" format\="string" />
|
|
3998
|
+
}, {
|
|
3999
|
+
mode: 'number',
|
|
4000
|
+
example: <IressTableFormattedValue value\="10000" format\="number" />
|
|
4001
|
+
}, {
|
|
4002
|
+
mode: 'date',
|
|
4003
|
+
example: <IressTableFormattedValue value\={new Date('2025-11-14')} format\="date" />
|
|
4004
|
+
}, {
|
|
4005
|
+
mode: 'shortDate',
|
|
4006
|
+
example: <IressTableFormattedValue value\={new Date('2025-11-14')} format\="shortDate" />
|
|
4007
|
+
}, {
|
|
4008
|
+
mode: 'isoDateTime',
|
|
4009
|
+
example: <IressTableFormattedValue value\={new Date('2025-11-14')} format\="isoDateTime" />
|
|
4010
|
+
}, {
|
|
4011
|
+
mode: 'relativeTime',
|
|
4012
|
+
example: <IressTableFormattedValue value\={fourDaysAgo} format\="relativeTime" />
|
|
4013
|
+
}, {
|
|
4014
|
+
mode: 'currency',
|
|
4015
|
+
example: <IressTableFormattedValue value\={10000} format\="currency" />
|
|
4016
|
+
}, {
|
|
4017
|
+
mode: 'percent',
|
|
4018
|
+
example: <IressTableFormattedValue value\={50} format\="percent" />
|
|
4019
|
+
}\]} />
|
|
4020
|
+
}
|
|
4021
|
+
|
|
4022
|
+
```
|
|
4023
|
+
|
|
4024
|
+
#### Props
|
|
4025
|
+
|
|
4026
|
+
| Name | Description | Default | Control |
|
|
4027
|
+
| --- | --- | --- | --- |
|
|
4028
|
+
| format |
|
|
4029
|
+
\-
|
|
4030
|
+
|
|
4031
|
+
| \- | \- |
|
|
4032
|
+
| value |
|
|
4033
|
+
|
|
4034
|
+
string
|
|
4035
|
+
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
| \- | \- |
|