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