@fluentui/react-table 9.10.7 → 9.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +93 -1
- package/CHANGELOG.md +29 -2
- package/package.json +7 -7
- package/Spec.md +0 -505
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,99 @@
|
|
|
2
2
|
"name": "@fluentui/react-table",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 01 Nov 2023 12:51:07 GMT",
|
|
6
|
+
"tag": "@fluentui/react-table_v9.10.9",
|
|
7
|
+
"version": "9.10.9",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "beachball",
|
|
12
|
+
"package": "@fluentui/react-table",
|
|
13
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.44",
|
|
14
|
+
"commit": "838b05367dbdddb17732b9e0c807090e0a4445d5"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-table",
|
|
19
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.54",
|
|
20
|
+
"commit": "838b05367dbdddb17732b9e0c807090e0a4445d5"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-table",
|
|
25
|
+
"comment": "Bump @fluentui/react-radio to v9.1.54",
|
|
26
|
+
"commit": "838b05367dbdddb17732b9e0c807090e0a4445d5"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-table",
|
|
31
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.11.1",
|
|
32
|
+
"commit": "838b05367dbdddb17732b9e0c807090e0a4445d5"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-table",
|
|
37
|
+
"comment": "Bump @fluentui/react-tabster to v9.14.3",
|
|
38
|
+
"commit": "838b05367dbdddb17732b9e0c807090e0a4445d5"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-table",
|
|
43
|
+
"comment": "Bump @fluentui/react-theme to v9.1.15",
|
|
44
|
+
"commit": "838b05367dbdddb17732b9e0c807090e0a4445d5"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Sat, 28 Oct 2023 23:35:59 GMT",
|
|
51
|
+
"tag": "@fluentui/react-table_v9.10.8",
|
|
52
|
+
"version": "9.10.8",
|
|
53
|
+
"comments": {
|
|
54
|
+
"none": [
|
|
55
|
+
{
|
|
56
|
+
"author": "olfedias@microsoft.com",
|
|
57
|
+
"package": "@fluentui/react-table",
|
|
58
|
+
"commit": "971eb8653bcb54723876fd89778eb30bf40a40cf",
|
|
59
|
+
"comment": "chore: move the component spec"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"patch": [
|
|
63
|
+
{
|
|
64
|
+
"author": "beachball",
|
|
65
|
+
"package": "@fluentui/react-table",
|
|
66
|
+
"comment": "Bump @fluentui/react-avatar to v9.5.43",
|
|
67
|
+
"commit": "555b0fae3ec7f052e765557ae243c58000514f92"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"author": "beachball",
|
|
71
|
+
"package": "@fluentui/react-table",
|
|
72
|
+
"comment": "Bump @fluentui/react-checkbox to v9.1.53",
|
|
73
|
+
"commit": "555b0fae3ec7f052e765557ae243c58000514f92"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"author": "beachball",
|
|
77
|
+
"package": "@fluentui/react-table",
|
|
78
|
+
"comment": "Bump @fluentui/react-radio to v9.1.53",
|
|
79
|
+
"commit": "555b0fae3ec7f052e765557ae243c58000514f92"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"author": "beachball",
|
|
83
|
+
"package": "@fluentui/react-table",
|
|
84
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.11.0",
|
|
85
|
+
"commit": "555b0fae3ec7f052e765557ae243c58000514f92"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"author": "beachball",
|
|
89
|
+
"package": "@fluentui/react-table",
|
|
90
|
+
"comment": "Bump @fluentui/react-tabster to v9.14.2",
|
|
91
|
+
"commit": "555b0fae3ec7f052e765557ae243c58000514f92"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"date": "Mon, 23 Oct 2023 09:51:56 GMT",
|
|
6
98
|
"tag": "@fluentui/react-table_v9.10.7",
|
|
7
99
|
"version": "9.10.7",
|
|
8
100
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-table
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 01 Nov 2023 12:51:07 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.10.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.10.9)
|
|
8
|
+
|
|
9
|
+
Wed, 01 Nov 2023 12:51:07 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.10.8..@fluentui/react-table_v9.10.9)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- Bump @fluentui/react-avatar to v9.5.44 ([PR #29663](https://github.com/microsoft/fluentui/pull/29663) by beachball)
|
|
15
|
+
- Bump @fluentui/react-checkbox to v9.1.54 ([PR #29663](https://github.com/microsoft/fluentui/pull/29663) by beachball)
|
|
16
|
+
- Bump @fluentui/react-radio to v9.1.54 ([PR #29663](https://github.com/microsoft/fluentui/pull/29663) by beachball)
|
|
17
|
+
- Bump @fluentui/react-shared-contexts to v9.11.1 ([PR #29663](https://github.com/microsoft/fluentui/pull/29663) by beachball)
|
|
18
|
+
- Bump @fluentui/react-tabster to v9.14.3 ([PR #29663](https://github.com/microsoft/fluentui/pull/29663) by beachball)
|
|
19
|
+
- Bump @fluentui/react-theme to v9.1.15 ([PR #29663](https://github.com/microsoft/fluentui/pull/29663) by beachball)
|
|
20
|
+
|
|
21
|
+
## [9.10.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.10.8)
|
|
22
|
+
|
|
23
|
+
Sat, 28 Oct 2023 23:35:59 GMT
|
|
24
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.10.7..@fluentui/react-table_v9.10.8)
|
|
25
|
+
|
|
26
|
+
### Patches
|
|
27
|
+
|
|
28
|
+
- Bump @fluentui/react-avatar to v9.5.43 ([commit](https://github.com/microsoft/fluentui/commit/555b0fae3ec7f052e765557ae243c58000514f92) by beachball)
|
|
29
|
+
- Bump @fluentui/react-checkbox to v9.1.53 ([commit](https://github.com/microsoft/fluentui/commit/555b0fae3ec7f052e765557ae243c58000514f92) by beachball)
|
|
30
|
+
- Bump @fluentui/react-radio to v9.1.53 ([commit](https://github.com/microsoft/fluentui/commit/555b0fae3ec7f052e765557ae243c58000514f92) by beachball)
|
|
31
|
+
- Bump @fluentui/react-shared-contexts to v9.11.0 ([commit](https://github.com/microsoft/fluentui/commit/555b0fae3ec7f052e765557ae243c58000514f92) by beachball)
|
|
32
|
+
- Bump @fluentui/react-tabster to v9.14.2 ([commit](https://github.com/microsoft/fluentui/commit/555b0fae3ec7f052e765557ae243c58000514f92) by beachball)
|
|
33
|
+
|
|
7
34
|
## [9.10.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-table_v9.10.7)
|
|
8
35
|
|
|
9
|
-
Mon, 23 Oct 2023 09:
|
|
36
|
+
Mon, 23 Oct 2023 09:51:56 GMT
|
|
10
37
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-table_v9.10.6..@fluentui/react-table_v9.10.7)
|
|
11
38
|
|
|
12
39
|
### Patches
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-table",
|
|
3
|
-
"version": "9.10.
|
|
3
|
+
"version": "9.10.9",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fluentui/keyboard-keys": "^9.0.6",
|
|
39
39
|
"@fluentui/react-aria": "^9.3.43",
|
|
40
|
-
"@fluentui/react-avatar": "^9.5.
|
|
41
|
-
"@fluentui/react-checkbox": "^9.1.
|
|
40
|
+
"@fluentui/react-avatar": "^9.5.44",
|
|
41
|
+
"@fluentui/react-checkbox": "^9.1.54",
|
|
42
42
|
"@fluentui/react-context-selector": "^9.1.41",
|
|
43
43
|
"@fluentui/react-icons": "^2.0.217",
|
|
44
|
-
"@fluentui/react-radio": "^9.1.
|
|
45
|
-
"@fluentui/react-shared-contexts": "^9.
|
|
46
|
-
"@fluentui/react-tabster": "^9.14.
|
|
47
|
-
"@fluentui/react-theme": "^9.1.
|
|
44
|
+
"@fluentui/react-radio": "^9.1.54",
|
|
45
|
+
"@fluentui/react-shared-contexts": "^9.11.1",
|
|
46
|
+
"@fluentui/react-tabster": "^9.14.3",
|
|
47
|
+
"@fluentui/react-theme": "^9.1.15",
|
|
48
48
|
"@fluentui/react-utilities": "^9.15.1",
|
|
49
49
|
"@fluentui/react-jsx-runtime": "^9.0.18",
|
|
50
50
|
"@griffel/react": "^1.5.14",
|
package/Spec.md
DELETED
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
# @fluentui/react-table Spec
|
|
2
|
-
|
|
3
|
-
## Background
|
|
4
|
-
|
|
5
|
-
A table is a control that represents information in a two dimensional format in rows and columns.
|
|
6
|
-
A table can also be interactive where the user can navigation each individual cell in the table using
|
|
7
|
-
keyboard or nest controls inside table cells. Tables should can include both header and footer cells
|
|
8
|
-
that can be used to label the data in the associated cells or facilitate data sorting.
|
|
9
|
-
|
|
10
|
-
## Prior Art
|
|
11
|
-
|
|
12
|
-
- https://open-ui.org/components/table.research
|
|
13
|
-
- [23983](https://github.com/microsoft/fluentui/issues/23983)
|
|
14
|
-
|
|
15
|
-
### Comparison of v8 and v0
|
|
16
|
-
|
|
17
|
-
- v0 [Table](https://fluentsite.z22.web.core.windows.net/components/table/props) component
|
|
18
|
-
- v8 [DetailsList](https://developer.microsoft.com/en-us/fluentui#/controls/web/detailslist) component
|
|
19
|
-
|
|
20
|
-
The equivalent of the proposed Table component is DetailsList for v8 and Table in v0. There are many differences
|
|
21
|
-
between the two are the complexity of the built-in features of these components. The v0 Table off-loads more complex
|
|
22
|
-
scenarios to the end user rather than built in. The v8 DetailsList owns a lot of the complex features of a table
|
|
23
|
-
such as selection, sorting, virtualization and marquee selection.
|
|
24
|
-
|
|
25
|
-
#### Focusability and interaction
|
|
26
|
-
|
|
27
|
-
The v0 Table supports row and cell keyboard navigation through focusing. This is done through an accessibility behaviour
|
|
28
|
-
prop.
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
<Table header={header} rows={rowsPlain} aria-label="Nested navigation" accessibility={gridNestedBehavior} />
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
The v8 DetailsList supports focusing rows and navigating rows using arrow keys by default.
|
|
35
|
-
|
|
36
|
-
Row navigation behaves the same way for v0 and v8. Each table row is focusable and navigable using the up and down
|
|
37
|
-
arrow keys. Using up or down arrow while focused on a cell will focus the next row.
|
|
38
|
-
|
|
39
|
-
In v0 if there are nested focusable elements inside a focusable cell, then the user must press `Enter` to move focus
|
|
40
|
-
into the cell. The focus inside a cell is trapped and focus can only revert to the cell when the user presses `Escape`. v8
|
|
41
|
-
handles this in a completely different way. Cells are not focusable by default but the FocusZone component will allow
|
|
42
|
-
horizontal cell navigation by the the focusable elements.
|
|
43
|
-
|
|
44
|
-
The pattern followed by v0 has a drawback that there is no screen reader prompt to let users know that a table cell
|
|
45
|
-
contains interactive elements. The pattern followed by v8 however has a drawback that custom handling is necessary
|
|
46
|
-
when the cell contents also need to support arrow key navigation.
|
|
47
|
-
|
|
48
|
-
#### Selection
|
|
49
|
-
|
|
50
|
-
The v0 table does not support any built-in selection features. However guidance on how to implement a table with
|
|
51
|
-
selectable rows is provided in [prototypes on the docsite](https://fluentsite.z22.web.core.windows.net/0.63.0/prototype-table).
|
|
52
|
-
|
|
53
|
-
The v8 DetailsList supports row selection by displaying a checkbox on first column that indicates the selection status
|
|
54
|
-
of the row. The first column of the header is also a checkbox that can either indicate the selection status of the
|
|
55
|
-
rows or can be used to toggle selection of all rows in the list. Additionally, the DetailsList supports marquee selection
|
|
56
|
-
where a user can click and drag a selection box that will select every row that is partially contained within the selection box.
|
|
57
|
-
|
|
58
|
-
v8 uses a non-standard Selection class that is passed as reference through props to get the current selection state of the list.
|
|
59
|
-
The architecture choice for selection is most likely related to having to support marquee selection as a composite behaviour.
|
|
60
|
-
|
|
61
|
-
```tsx
|
|
62
|
-
_selection = new Selection({
|
|
63
|
-
onSelectionChanged: () => {
|
|
64
|
-
this.setState({
|
|
65
|
-
selectionDetails: this._getSelectionDetails(),
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
<DetailsList items={items} selectionMode={SelectionMode.multiple} setKey="multiple" selection={_selection} />;
|
|
71
|
-
|
|
72
|
-
// Marquee selection
|
|
73
|
-
<MarqueeSelection selection={this._selection}>
|
|
74
|
-
<DetailsList items={items} selectionMode={SelectionMode.multiple} setKey="multiple" selection={_selection} />;
|
|
75
|
-
</MarqueeSelection>;
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Selection in the DetailsList is also possible with keyboard by holding down the `Shift` key while using up and down
|
|
79
|
-
arrow to navigate rows. The next focused row is selected if `Shift` is pressed.
|
|
80
|
-
|
|
81
|
-
#### Sorting
|
|
82
|
-
|
|
83
|
-
Both v0 Table and v8 DetailsList provide code samples of sorting data by column that follow the same principle. The component
|
|
84
|
-
APIs both allow events for column click which can be used to sort data.
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
// v0
|
|
88
|
-
const sortColumnHeader = (title, order, onOrderChange) => ({
|
|
89
|
-
content: `${title} ${order !== 0 ? order === 1 ? <ArrowUp /> : <ArrowDown /> : ''}`
|
|
90
|
-
onClick: () => onOrderChange(order === 0 ? 1 : -order),
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const header = {
|
|
94
|
-
key: 'header',
|
|
95
|
-
items: columns.map(c =>
|
|
96
|
-
sortColumnHeader(c.title, c.name === sortColumn ? sortDirection : 0, newSortDirection => {
|
|
97
|
-
setSortColumn(c.name);
|
|
98
|
-
setSortDirection(newSortDirection);
|
|
99
|
-
}),
|
|
100
|
-
),
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
<Table header={header} rows={sortedRows} />;
|
|
104
|
-
|
|
105
|
-
// v8
|
|
106
|
-
const onColumnClick = (ev: React.MouseEvent<HTMLElement>, column: IColumn): void => {
|
|
107
|
-
// sort data
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const columns: IColumn[] = [
|
|
111
|
-
{
|
|
112
|
-
name: 'File Type',
|
|
113
|
-
fieldName: 'name',
|
|
114
|
-
onColumnClick: onColumnClick,
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'Name',
|
|
118
|
-
fieldName: 'name',
|
|
119
|
-
onColumnClick: onColumnClick,
|
|
120
|
-
},
|
|
121
|
-
];
|
|
122
|
-
|
|
123
|
-
<DetailsList
|
|
124
|
-
items={items}
|
|
125
|
-
columns={columns}
|
|
126
|
-
isHeaderVisible={true}
|
|
127
|
-
/>
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
#### Column resizing
|
|
131
|
-
|
|
132
|
-
Column resizing is only supported by the v8 DetailsList. Columns can be resized without any additional configuration.
|
|
133
|
-
In order to support this, every column always has an inline style where the width in pixels is applied.
|
|
134
|
-
|
|
135
|
-
## Sample Code
|
|
136
|
-
|
|
137
|
-
```tsx
|
|
138
|
-
<Table>
|
|
139
|
-
<TableHeader>
|
|
140
|
-
<TableRow>
|
|
141
|
-
<TableCell> </TableCell>
|
|
142
|
-
<TableCell> </TableCell>
|
|
143
|
-
<TableCell> </TableCell>
|
|
144
|
-
</TableRow>
|
|
145
|
-
</TableHeader>
|
|
146
|
-
|
|
147
|
-
<TableBody>
|
|
148
|
-
<TableRow>
|
|
149
|
-
<TableCell> </TableCell>
|
|
150
|
-
<TableCell> </TableCell>
|
|
151
|
-
<TableCell> </TableCell>
|
|
152
|
-
</TableRow>
|
|
153
|
-
</TableBody>
|
|
154
|
-
</Table>
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## Variants
|
|
158
|
-
|
|
159
|
-
### Sorting
|
|
160
|
-
|
|
161
|
-
The table header should support design and interactions for sorting the table by column.
|
|
162
|
-
|
|
163
|
-
### Selectable rows
|
|
164
|
-
|
|
165
|
-
Table rows can be selected. The table header should also support a 'select all' feature, selecting the
|
|
166
|
-
table header should select all rows.
|
|
167
|
-
|
|
168
|
-
### Primary column
|
|
169
|
-
|
|
170
|
-
A primary column is generally the first column of the table, however there is no strict requirement on this. This
|
|
171
|
-
column has some design differences and supports secondary content which can contain extra instructions or
|
|
172
|
-
description.
|
|
173
|
-
|
|
174
|
-
### Column actions
|
|
175
|
-
|
|
176
|
-
Each cell can support optional buttons/actions that only appear when focused or the row is hovered.
|
|
177
|
-
|
|
178
|
-
#### Cell media
|
|
179
|
-
|
|
180
|
-
A cell can also include a media item such as an icon or an avatar positioned at the start of the cell.
|
|
181
|
-
|
|
182
|
-
### Sizes
|
|
183
|
-
|
|
184
|
-
The table supports the following sizes that affect the layout and size of its child components:
|
|
185
|
-
|
|
186
|
-
- small
|
|
187
|
-
- smaller
|
|
188
|
-
- medium
|
|
189
|
-
- large
|
|
190
|
-
|
|
191
|
-
## API
|
|
192
|
-
|
|
193
|
-
### Table
|
|
194
|
-
|
|
195
|
-
The `Table` component is intended to present data in a tabular format. Apart from sortable headers, the component
|
|
196
|
-
is intended to be presentational and not interactive. This component can also be a bail out for end users if
|
|
197
|
-
overriding the default interaction behaviour of the `DataGrid` component is too difficult.
|
|
198
|
-
|
|
199
|
-
- [Table](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/Table/Table.types.ts);
|
|
200
|
-
- [TableHeader](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/TableHeader/TableHeader.types.ts);
|
|
201
|
-
- [TableRow](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/TableRow/TableRow.types.ts);
|
|
202
|
-
- [TableCell](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/TableCell/TableCell.types.ts);
|
|
203
|
-
- [TableCellLayout](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/TableCellLayout/TableCellLayout.types.ts);
|
|
204
|
-
- [TableBody](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/TableBody/TableBody.types.ts);
|
|
205
|
-
- [TableSelectionCell](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/TableSelectionCell/TableSelectionCell.types.ts);
|
|
206
|
-
|
|
207
|
-
### DataGrid
|
|
208
|
-
|
|
209
|
-
- [DataGrid](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGrid/DataGrid.types.ts);
|
|
210
|
-
- [DataGridHeader](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGridHeader/DataGridHeader.types.ts);
|
|
211
|
-
- [DataGridRow](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGridRow/DataGridRow.types.ts);
|
|
212
|
-
- [DataGridCell](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGridCell/DataGridCell.types.ts);
|
|
213
|
-
- [DataGridCellLayout](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGridCellLayout/DataGridCellLayout.types.ts);
|
|
214
|
-
- [DataGridBody](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGridBody/DataGridBody.types.ts);
|
|
215
|
-
- [DataGridSelectionCell](https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-table/src/components/DataGridSelectionCell/DataGridSelectionCell.types.ts);
|
|
216
|
-
|
|
217
|
-
## Structure
|
|
218
|
-
|
|
219
|
-
### Table
|
|
220
|
-
|
|
221
|
-
```tsx
|
|
222
|
-
<Table>
|
|
223
|
-
<TableHeader>
|
|
224
|
-
<TableRow>
|
|
225
|
-
<TableCell> </TableCell>
|
|
226
|
-
<TableRow>
|
|
227
|
-
</TableHeader>
|
|
228
|
-
|
|
229
|
-
<TableBody>
|
|
230
|
-
<TableRow>
|
|
231
|
-
<TableCell> </TableCell>
|
|
232
|
-
</TableRow>
|
|
233
|
-
</TableBody>
|
|
234
|
-
</Table>
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
```html
|
|
238
|
-
<table>
|
|
239
|
-
<thead>
|
|
240
|
-
<tr>
|
|
241
|
-
<th></th>
|
|
242
|
-
</tr>
|
|
243
|
-
</thead>
|
|
244
|
-
|
|
245
|
-
<tbody>
|
|
246
|
-
<tr>
|
|
247
|
-
<td></td>
|
|
248
|
-
</tr>
|
|
249
|
-
</tbody>
|
|
250
|
-
</table>
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Table cell with media
|
|
254
|
-
|
|
255
|
-
```tsx
|
|
256
|
-
<TableRow>
|
|
257
|
-
<TableCell>
|
|
258
|
-
<TableCellLayout media={<FileIcon />}>Cell</TableCellLayout>
|
|
259
|
-
</TableCell>
|
|
260
|
-
<TableRow>
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
```html
|
|
264
|
-
<tr>
|
|
265
|
-
<td><span>FileIcon</span> Cell</td>
|
|
266
|
-
</tr>
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Table without semantic elements
|
|
270
|
-
|
|
271
|
-
```tsx
|
|
272
|
-
<Table noNativeElements>
|
|
273
|
-
<TableHeader>
|
|
274
|
-
<TableRow>
|
|
275
|
-
<TableHeaderCell>Header</TableHeaderCell>
|
|
276
|
-
</TableRow>
|
|
277
|
-
</TableHeader>
|
|
278
|
-
</Table>
|
|
279
|
-
|
|
280
|
-
// OR
|
|
281
|
-
|
|
282
|
-
<Table as="div">
|
|
283
|
-
<TableHeader as="div">
|
|
284
|
-
<TableRow as="div">
|
|
285
|
-
<TableHeaderCell as="div">Header</TableHeaderCell>
|
|
286
|
-
</TableRow>
|
|
287
|
-
</TableHeader>
|
|
288
|
-
</Table>
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
```html
|
|
292
|
-
<div role="table">
|
|
293
|
-
<div role="rowgroup">
|
|
294
|
-
<div role="row">
|
|
295
|
-
<div role="columnheader"><button>Header</button></div>
|
|
296
|
-
</div>
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
### Sortable
|
|
302
|
-
|
|
303
|
-
```tsx
|
|
304
|
-
<Table sortable>
|
|
305
|
-
<TableHeader>
|
|
306
|
-
<TableRow>
|
|
307
|
-
<TableHeaderCell sortDirection="ascending">Header</TableHeaderCell>
|
|
308
|
-
</TableRow>
|
|
309
|
-
</TableHeader>
|
|
310
|
-
</Table>
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
```html
|
|
314
|
-
<table>
|
|
315
|
-
<thead>
|
|
316
|
-
<tr>
|
|
317
|
-
<th aria-sort="ascending"><button>Header</button></th>
|
|
318
|
-
</tr>
|
|
319
|
-
</thead>
|
|
320
|
-
</table>
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Primary column
|
|
324
|
-
|
|
325
|
-
```tsx
|
|
326
|
-
<Table>
|
|
327
|
-
<TableBody>
|
|
328
|
-
<TableRow>
|
|
329
|
-
<TableCell>
|
|
330
|
-
<TableCellLayout main="Main content" description="Description" media={<FileIcon />} appearance="primary">
|
|
331
|
-
Children
|
|
332
|
-
</TableCellLayout>
|
|
333
|
-
</TableCell>
|
|
334
|
-
</TableRow>
|
|
335
|
-
</TableBody>
|
|
336
|
-
</Table>
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
```html
|
|
340
|
-
<table>
|
|
341
|
-
<tbody>
|
|
342
|
-
<tr>
|
|
343
|
-
<td>
|
|
344
|
-
<span aria-hidden="true">icon</span>
|
|
345
|
-
<div>
|
|
346
|
-
<span>Main content</span>
|
|
347
|
-
<span>Description</span>
|
|
348
|
-
</div>
|
|
349
|
-
Children
|
|
350
|
-
</td>
|
|
351
|
-
</tr>
|
|
352
|
-
</tbody>
|
|
353
|
-
</table>
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
### Column actions
|
|
357
|
-
|
|
358
|
-
```tsx
|
|
359
|
-
<Table>
|
|
360
|
-
<TableBody>
|
|
361
|
-
<TableRow>
|
|
362
|
-
<TableCell media={<FileIcon />}>
|
|
363
|
-
Content
|
|
364
|
-
<TableCellActions><Button icon={<FileIcon />} /></TableCellActions>
|
|
365
|
-
</TablePrimaryCell>
|
|
366
|
-
</TableRow>
|
|
367
|
-
</TableBody>
|
|
368
|
-
</Table>
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
```html
|
|
372
|
-
<table>
|
|
373
|
-
<tbody>
|
|
374
|
-
<tr>
|
|
375
|
-
<td>
|
|
376
|
-
<span aria-hidden="true">icon</span>
|
|
377
|
-
Content
|
|
378
|
-
<div>
|
|
379
|
-
<button><span>FileIcon</span></button>
|
|
380
|
-
</div>
|
|
381
|
-
</td>
|
|
382
|
-
</tr>
|
|
383
|
-
</tbody>
|
|
384
|
-
</table>
|
|
385
|
-
```
|
|
386
|
-
|
|
387
|
-
### DataGrid
|
|
388
|
-
|
|
389
|
-
```tsx
|
|
390
|
-
<DataGrid
|
|
391
|
-
items={items}
|
|
392
|
-
columns={columns}
|
|
393
|
-
sortable
|
|
394
|
-
selectionMode="multiselect"
|
|
395
|
-
getRowId={item => item.file.label}
|
|
396
|
-
onSelectionChange={(e, data) => console.log(data)}
|
|
397
|
-
>
|
|
398
|
-
<DataGridHeader>
|
|
399
|
-
<DataGridRow selectionCell={{ 'aria-label': 'Select all rows' }}>
|
|
400
|
-
{({ renderHeaderCell }) => <DataGridHeaderCell>{renderHeaderCell()}</DataGridHeaderCell>}
|
|
401
|
-
</DataGridRow>
|
|
402
|
-
</DataGridHeader>
|
|
403
|
-
<DataGridBody<Item>>
|
|
404
|
-
{({ item, rowId }) => (
|
|
405
|
-
<DataGridRow<Item> key={rowId} selectionCell={{ 'aria-label': 'Select row' }}>
|
|
406
|
-
{({ renderCell }) => <DataGridCell>{renderCell(item)}</DataGridCell>}
|
|
407
|
-
</DataGridRow>
|
|
408
|
-
)}
|
|
409
|
-
</DataGridBody>
|
|
410
|
-
</DataGrid>
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
```html
|
|
414
|
-
<div role="grid">
|
|
415
|
-
<div role="rowgroup">
|
|
416
|
-
<div role="row">
|
|
417
|
-
<div role="columnheader"></div>
|
|
418
|
-
</div>
|
|
419
|
-
</div>
|
|
420
|
-
|
|
421
|
-
<div role="rowgroup">
|
|
422
|
-
<div role="row">
|
|
423
|
-
<div role="gridcell"></div>
|
|
424
|
-
</div>
|
|
425
|
-
</div>
|
|
426
|
-
</div>
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
## Migration
|
|
430
|
-
|
|
431
|
-
> ⚒️ This section is still being developed and will be completed once APIs for this component become more stable
|
|
432
|
-
|
|
433
|
-
## Behaviors
|
|
434
|
-
|
|
435
|
-
### Sortable header cells
|
|
436
|
-
|
|
437
|
-
Table header cells are only focusable when they are sortable. Focus when tabbing into the Table control should
|
|
438
|
-
focus on the first sortable header, if any.
|
|
439
|
-
|
|
440
|
-
<img src="./etc/images/table-interactions/Slide2.PNG" width="700" />
|
|
441
|
-
<img src="./etc/images/table-interactions/Slide3.PNG" width="700" />
|
|
442
|
-
<img src="./etc/images/table-interactions/Slide4.PNG" width="700" />
|
|
443
|
-
|
|
444
|
-
### Navigation modes
|
|
445
|
-
|
|
446
|
-
The below are the different navigation modes that are possible on a table
|
|
447
|
-
|
|
448
|
-
#### none
|
|
449
|
-
|
|
450
|
-
This mode is the default, there is no keyboard navigation possible in the table content. However, this does not
|
|
451
|
-
include the header cells which can be sortable. They are covered above.
|
|
452
|
-
|
|
453
|
-
#### cell
|
|
454
|
-
|
|
455
|
-
This is the most accessible and screenreader friendly navigation mode. This is what is recommended by the
|
|
456
|
-
[WAI APG examples](https://www.w3.org/WAI/ARIA/apg/example-index/grid/dataGrids). Navigation happsn only
|
|
457
|
-
on the level of the cell in both directions.
|
|
458
|
-
|
|
459
|
-
<img src="./etc/images/table-interactions/Slide6.PNG" width="700" />
|
|
460
|
-
<img src="./etc/images/table-interactions/Slide7.PNG" width="700" />
|
|
461
|
-
<img src="./etc/images/table-interactions/Slide8.PNG" width="700" />
|
|
462
|
-
<img src="./etc/images/table-interactions/Slide9.PNG" width="700" />
|
|
463
|
-
<img src="./etc/images/table-interactions/Slide10.PNG" width="700" />
|
|
464
|
-
|
|
465
|
-
#### row
|
|
466
|
-
|
|
467
|
-
This navigation mode can cause screen reader issues since tables are not intended to be navigated by row in any mode.
|
|
468
|
-
This mode only navigates the table by row and can be useful when row selection is the only interactive feature of
|
|
469
|
-
the component
|
|
470
|
-
|
|
471
|
-
<img src="./etc/images/table-interactions/Slide12.PNG" width="700" />
|
|
472
|
-
<img src="./etc/images/table-interactions/Slide13.PNG" width="700" />
|
|
473
|
-
<img src="./etc/images/table-interactions/Slide14.PNG" width="700" />
|
|
474
|
-
|
|
475
|
-
### Nested focusables in cells
|
|
476
|
-
|
|
477
|
-
#### Single focusable
|
|
478
|
-
|
|
479
|
-
When there is a single focusable element inside a cell, users are recommended to choose `cell` navigation mode.
|
|
480
|
-
In this scenario, cells will be focused on navigation, but the focusable
|
|
481
|
-
element inside the cell should be focused if it exists.
|
|
482
|
-
|
|
483
|
-
<img src="./etc/images/table-interactions/Slide24.PNG" width="700" />
|
|
484
|
-
<img src="./etc/images/table-interactions/Slide25.PNG" width="700" />
|
|
485
|
-
|
|
486
|
-
#### Nested focusable
|
|
487
|
-
|
|
488
|
-
When there are multile focusable elemnts inside a cell, we implement a pattern similar to the [WAI grid pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/).
|
|
489
|
-
Pressing `Enter` on a cell will move focus and trap focus inside until the user presses `Escape` to revert back to grid navigation.
|
|
490
|
-
|
|
491
|
-
<img src="./etc/images/table-interactions/Slide27.PNG" width="700" />
|
|
492
|
-
<img src="./etc/images/table-interactions/Slide28.PNG" width="700" />
|
|
493
|
-
<img src="./etc/images/table-interactions/Slide29.PNG" width="700" />
|
|
494
|
-
<img src="./etc/images/table-interactions/Slide30.PNG" width="700" />
|
|
495
|
-
## Accessibility
|
|
496
|
-
|
|
497
|
-
The spec aims to use the accessibility section as little as possible and building an accessible component by default.
|
|
498
|
-
The follow a11y resources were used in the drafting of this spec:
|
|
499
|
-
|
|
500
|
-
- https://www.w3.org/WAI/ARIA/apg/patterns/grid/
|
|
501
|
-
- https://www.w3.org/WAI/ARIA/apg/example-index/grid/dataGrids
|
|
502
|
-
- https://www.w3.org/WAI/ARIA/apg/example-index/table/sortable-table.html
|
|
503
|
-
- https://www.w3.org/WAI/ARIA/apg/example-index/table/table
|
|
504
|
-
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/grid_role
|
|
505
|
-
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/table_role
|