@react-aria/table 3.14.1-nightly.4624 → 3.14.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/dist/TableKeyboardDelegate.main.js +13 -13
- package/dist/TableKeyboardDelegate.mjs +13 -13
- package/dist/TableKeyboardDelegate.module.js +13 -13
- package/dist/useTable.main.js +10 -10
- package/dist/useTable.mjs +10 -10
- package/dist/useTable.module.js +10 -10
- package/dist/useTableCell.main.js +1 -1
- package/dist/useTableCell.mjs +1 -1
- package/dist/useTableCell.module.js +1 -1
- package/dist/useTableColumnHeader.main.js +8 -8
- package/dist/useTableColumnHeader.mjs +8 -8
- package/dist/useTableColumnHeader.module.js +8 -8
- package/dist/useTableColumnResize.main.js +19 -19
- package/dist/useTableColumnResize.mjs +19 -19
- package/dist/useTableColumnResize.module.js +19 -19
- package/dist/useTableHeaderRow.main.js +2 -2
- package/dist/useTableHeaderRow.mjs +2 -2
- package/dist/useTableHeaderRow.module.js +2 -2
- package/dist/useTableRow.main.js +15 -15
- package/dist/useTableRow.mjs +15 -15
- package/dist/useTableRow.module.js +15 -15
- package/dist/useTableSelectionCheckbox.main.js +4 -4
- package/dist/useTableSelectionCheckbox.mjs +4 -4
- package/dist/useTableSelectionCheckbox.module.js +4 -4
- package/dist/utils.main.js +5 -5
- package/dist/utils.mjs +5 -5
- package/dist/utils.module.js +5 -5
- package/package.json +17 -17
|
@@ -21,14 +21,14 @@ $parcel$export(module.exports, "TableKeyboardDelegate", () => $a911ff492b884835$
|
|
|
21
21
|
|
|
22
22
|
class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid.GridKeyboardDelegate) {
|
|
23
23
|
isCell(node) {
|
|
24
|
-
return node.type ===
|
|
24
|
+
return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';
|
|
25
25
|
}
|
|
26
26
|
getKeyBelow(key) {
|
|
27
27
|
let startItem = this.collection.getItem(key);
|
|
28
28
|
if (!startItem) return;
|
|
29
29
|
// If focus was on a column, then focus the first child column if any,
|
|
30
30
|
// or find the corresponding cell in the first row.
|
|
31
|
-
if (startItem.type ===
|
|
31
|
+
if (startItem.type === 'column') {
|
|
32
32
|
let child = (0, $heEpC$reactstatelycollections.getFirstItem)((0, $heEpC$reactstatelycollections.getChildNodes)(startItem, this.collection));
|
|
33
33
|
if (child) return child.key;
|
|
34
34
|
let firstKey = this.getFirstKey();
|
|
@@ -42,14 +42,14 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid
|
|
|
42
42
|
let startItem = this.collection.getItem(key);
|
|
43
43
|
if (!startItem) return;
|
|
44
44
|
// If focus was on a column, focus the parent column if any
|
|
45
|
-
if (startItem.type ===
|
|
45
|
+
if (startItem.type === 'column') {
|
|
46
46
|
let parent = this.collection.getItem(startItem.parentKey);
|
|
47
|
-
if (parent && parent.type ===
|
|
47
|
+
if (parent && parent.type === 'column') return parent.key;
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
50
|
// only return above row key if not header row
|
|
51
51
|
let superKey = super.getKeyAbove(key);
|
|
52
|
-
if (superKey != null && this.collection.getItem(superKey).type !==
|
|
52
|
+
if (superKey != null && this.collection.getItem(superKey).type !== 'headerrow') return superKey;
|
|
53
53
|
// If no item was found, and focus was on a cell, then focus the
|
|
54
54
|
// corresponding column header.
|
|
55
55
|
if (this.isCell(startItem)) return this.collection.columns[startItem.index].key;
|
|
@@ -58,17 +58,17 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid
|
|
|
58
58
|
}
|
|
59
59
|
findNextColumnKey(column) {
|
|
60
60
|
// Search following columns
|
|
61
|
-
let key = this.findNextKey(column.key, (item)=>item.type ===
|
|
61
|
+
let key = this.findNextKey(column.key, (item)=>item.type === 'column');
|
|
62
62
|
if (key != null) return key;
|
|
63
63
|
// Wrap around to the first column
|
|
64
64
|
let row = this.collection.headerRows[column.level];
|
|
65
65
|
for (let item of (0, $heEpC$reactstatelycollections.getChildNodes)(row, this.collection)){
|
|
66
|
-
if (item.type ===
|
|
66
|
+
if (item.type === 'column') return item.key;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
findPreviousColumnKey(column) {
|
|
70
70
|
// Search previous columns
|
|
71
|
-
let key = this.findPreviousKey(column.key, (item)=>item.type ===
|
|
71
|
+
let key = this.findPreviousKey(column.key, (item)=>item.type === 'column');
|
|
72
72
|
if (key != null) return key;
|
|
73
73
|
// Wrap around to the last column
|
|
74
74
|
let row = this.collection.headerRows[column.level];
|
|
@@ -77,21 +77,21 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid
|
|
|
77
77
|
];
|
|
78
78
|
for(let i = childNodes.length - 1; i >= 0; i--){
|
|
79
79
|
let item = childNodes[i];
|
|
80
|
-
if (item.type ===
|
|
80
|
+
if (item.type === 'column') return item.key;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
getKeyRightOf(key) {
|
|
84
84
|
let item = this.collection.getItem(key);
|
|
85
85
|
if (!item) return;
|
|
86
86
|
// If focus was on a column, then focus the next column
|
|
87
|
-
if (item.type ===
|
|
87
|
+
if (item.type === 'column') return this.direction === 'rtl' ? this.findPreviousColumnKey(item) : this.findNextColumnKey(item);
|
|
88
88
|
return super.getKeyRightOf(key);
|
|
89
89
|
}
|
|
90
90
|
getKeyLeftOf(key) {
|
|
91
91
|
let item = this.collection.getItem(key);
|
|
92
92
|
if (!item) return;
|
|
93
93
|
// If focus was on a column, then focus the previous column
|
|
94
|
-
if (item.type ===
|
|
94
|
+
if (item.type === 'column') return this.direction === 'rtl' ? this.findNextColumnKey(item) : this.findPreviousColumnKey(item);
|
|
95
95
|
return super.getKeyLeftOf(key);
|
|
96
96
|
}
|
|
97
97
|
getKeyForSearch(search, fromKey) {
|
|
@@ -101,7 +101,7 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid
|
|
|
101
101
|
if (key == null) return null;
|
|
102
102
|
// If the starting key is a cell, search from its parent row.
|
|
103
103
|
let startItem = collection.getItem(key);
|
|
104
|
-
if (startItem.type ===
|
|
104
|
+
if (startItem.type === 'cell') key = startItem.parentKey;
|
|
105
105
|
let hasWrapped = false;
|
|
106
106
|
while(key != null){
|
|
107
107
|
let item = collection.getItem(key);
|
|
@@ -113,7 +113,7 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $heEpC$reactariagrid
|
|
|
113
113
|
if (this.collator.compare(substring, search) === 0) {
|
|
114
114
|
// If we started on a cell, end on the matching cell. Otherwise, end on the row.
|
|
115
115
|
let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
|
|
116
|
-
return fromItem.type ===
|
|
116
|
+
return fromItem.type === 'cell' ? cell.key : item.key;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -15,14 +15,14 @@ import {GridKeyboardDelegate as $eIXPM$GridKeyboardDelegate} from "@react-aria/g
|
|
|
15
15
|
|
|
16
16
|
class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardDelegate) {
|
|
17
17
|
isCell(node) {
|
|
18
|
-
return node.type ===
|
|
18
|
+
return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';
|
|
19
19
|
}
|
|
20
20
|
getKeyBelow(key) {
|
|
21
21
|
let startItem = this.collection.getItem(key);
|
|
22
22
|
if (!startItem) return;
|
|
23
23
|
// If focus was on a column, then focus the first child column if any,
|
|
24
24
|
// or find the corresponding cell in the first row.
|
|
25
|
-
if (startItem.type ===
|
|
25
|
+
if (startItem.type === 'column') {
|
|
26
26
|
let child = (0, $eIXPM$getFirstItem)((0, $eIXPM$getChildNodes)(startItem, this.collection));
|
|
27
27
|
if (child) return child.key;
|
|
28
28
|
let firstKey = this.getFirstKey();
|
|
@@ -36,14 +36,14 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
36
36
|
let startItem = this.collection.getItem(key);
|
|
37
37
|
if (!startItem) return;
|
|
38
38
|
// If focus was on a column, focus the parent column if any
|
|
39
|
-
if (startItem.type ===
|
|
39
|
+
if (startItem.type === 'column') {
|
|
40
40
|
let parent = this.collection.getItem(startItem.parentKey);
|
|
41
|
-
if (parent && parent.type ===
|
|
41
|
+
if (parent && parent.type === 'column') return parent.key;
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
// only return above row key if not header row
|
|
45
45
|
let superKey = super.getKeyAbove(key);
|
|
46
|
-
if (superKey != null && this.collection.getItem(superKey).type !==
|
|
46
|
+
if (superKey != null && this.collection.getItem(superKey).type !== 'headerrow') return superKey;
|
|
47
47
|
// If no item was found, and focus was on a cell, then focus the
|
|
48
48
|
// corresponding column header.
|
|
49
49
|
if (this.isCell(startItem)) return this.collection.columns[startItem.index].key;
|
|
@@ -52,17 +52,17 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
52
52
|
}
|
|
53
53
|
findNextColumnKey(column) {
|
|
54
54
|
// Search following columns
|
|
55
|
-
let key = this.findNextKey(column.key, (item)=>item.type ===
|
|
55
|
+
let key = this.findNextKey(column.key, (item)=>item.type === 'column');
|
|
56
56
|
if (key != null) return key;
|
|
57
57
|
// Wrap around to the first column
|
|
58
58
|
let row = this.collection.headerRows[column.level];
|
|
59
59
|
for (let item of (0, $eIXPM$getChildNodes)(row, this.collection)){
|
|
60
|
-
if (item.type ===
|
|
60
|
+
if (item.type === 'column') return item.key;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
findPreviousColumnKey(column) {
|
|
64
64
|
// Search previous columns
|
|
65
|
-
let key = this.findPreviousKey(column.key, (item)=>item.type ===
|
|
65
|
+
let key = this.findPreviousKey(column.key, (item)=>item.type === 'column');
|
|
66
66
|
if (key != null) return key;
|
|
67
67
|
// Wrap around to the last column
|
|
68
68
|
let row = this.collection.headerRows[column.level];
|
|
@@ -71,21 +71,21 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
71
71
|
];
|
|
72
72
|
for(let i = childNodes.length - 1; i >= 0; i--){
|
|
73
73
|
let item = childNodes[i];
|
|
74
|
-
if (item.type ===
|
|
74
|
+
if (item.type === 'column') return item.key;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
getKeyRightOf(key) {
|
|
78
78
|
let item = this.collection.getItem(key);
|
|
79
79
|
if (!item) return;
|
|
80
80
|
// If focus was on a column, then focus the next column
|
|
81
|
-
if (item.type ===
|
|
81
|
+
if (item.type === 'column') return this.direction === 'rtl' ? this.findPreviousColumnKey(item) : this.findNextColumnKey(item);
|
|
82
82
|
return super.getKeyRightOf(key);
|
|
83
83
|
}
|
|
84
84
|
getKeyLeftOf(key) {
|
|
85
85
|
let item = this.collection.getItem(key);
|
|
86
86
|
if (!item) return;
|
|
87
87
|
// If focus was on a column, then focus the previous column
|
|
88
|
-
if (item.type ===
|
|
88
|
+
if (item.type === 'column') return this.direction === 'rtl' ? this.findNextColumnKey(item) : this.findPreviousColumnKey(item);
|
|
89
89
|
return super.getKeyLeftOf(key);
|
|
90
90
|
}
|
|
91
91
|
getKeyForSearch(search, fromKey) {
|
|
@@ -95,7 +95,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
95
95
|
if (key == null) return null;
|
|
96
96
|
// If the starting key is a cell, search from its parent row.
|
|
97
97
|
let startItem = collection.getItem(key);
|
|
98
|
-
if (startItem.type ===
|
|
98
|
+
if (startItem.type === 'cell') key = startItem.parentKey;
|
|
99
99
|
let hasWrapped = false;
|
|
100
100
|
while(key != null){
|
|
101
101
|
let item = collection.getItem(key);
|
|
@@ -107,7 +107,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
107
107
|
if (this.collator.compare(substring, search) === 0) {
|
|
108
108
|
// If we started on a cell, end on the matching cell. Otherwise, end on the row.
|
|
109
109
|
let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
|
|
110
|
-
return fromItem.type ===
|
|
110
|
+
return fromItem.type === 'cell' ? cell.key : item.key;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -15,14 +15,14 @@ import {GridKeyboardDelegate as $eIXPM$GridKeyboardDelegate} from "@react-aria/g
|
|
|
15
15
|
|
|
16
16
|
class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardDelegate) {
|
|
17
17
|
isCell(node) {
|
|
18
|
-
return node.type ===
|
|
18
|
+
return node.type === 'cell' || node.type === 'rowheader' || node.type === 'column';
|
|
19
19
|
}
|
|
20
20
|
getKeyBelow(key) {
|
|
21
21
|
let startItem = this.collection.getItem(key);
|
|
22
22
|
if (!startItem) return;
|
|
23
23
|
// If focus was on a column, then focus the first child column if any,
|
|
24
24
|
// or find the corresponding cell in the first row.
|
|
25
|
-
if (startItem.type ===
|
|
25
|
+
if (startItem.type === 'column') {
|
|
26
26
|
let child = (0, $eIXPM$getFirstItem)((0, $eIXPM$getChildNodes)(startItem, this.collection));
|
|
27
27
|
if (child) return child.key;
|
|
28
28
|
let firstKey = this.getFirstKey();
|
|
@@ -36,14 +36,14 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
36
36
|
let startItem = this.collection.getItem(key);
|
|
37
37
|
if (!startItem) return;
|
|
38
38
|
// If focus was on a column, focus the parent column if any
|
|
39
|
-
if (startItem.type ===
|
|
39
|
+
if (startItem.type === 'column') {
|
|
40
40
|
let parent = this.collection.getItem(startItem.parentKey);
|
|
41
|
-
if (parent && parent.type ===
|
|
41
|
+
if (parent && parent.type === 'column') return parent.key;
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
// only return above row key if not header row
|
|
45
45
|
let superKey = super.getKeyAbove(key);
|
|
46
|
-
if (superKey != null && this.collection.getItem(superKey).type !==
|
|
46
|
+
if (superKey != null && this.collection.getItem(superKey).type !== 'headerrow') return superKey;
|
|
47
47
|
// If no item was found, and focus was on a cell, then focus the
|
|
48
48
|
// corresponding column header.
|
|
49
49
|
if (this.isCell(startItem)) return this.collection.columns[startItem.index].key;
|
|
@@ -52,17 +52,17 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
52
52
|
}
|
|
53
53
|
findNextColumnKey(column) {
|
|
54
54
|
// Search following columns
|
|
55
|
-
let key = this.findNextKey(column.key, (item)=>item.type ===
|
|
55
|
+
let key = this.findNextKey(column.key, (item)=>item.type === 'column');
|
|
56
56
|
if (key != null) return key;
|
|
57
57
|
// Wrap around to the first column
|
|
58
58
|
let row = this.collection.headerRows[column.level];
|
|
59
59
|
for (let item of (0, $eIXPM$getChildNodes)(row, this.collection)){
|
|
60
|
-
if (item.type ===
|
|
60
|
+
if (item.type === 'column') return item.key;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
findPreviousColumnKey(column) {
|
|
64
64
|
// Search previous columns
|
|
65
|
-
let key = this.findPreviousKey(column.key, (item)=>item.type ===
|
|
65
|
+
let key = this.findPreviousKey(column.key, (item)=>item.type === 'column');
|
|
66
66
|
if (key != null) return key;
|
|
67
67
|
// Wrap around to the last column
|
|
68
68
|
let row = this.collection.headerRows[column.level];
|
|
@@ -71,21 +71,21 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
71
71
|
];
|
|
72
72
|
for(let i = childNodes.length - 1; i >= 0; i--){
|
|
73
73
|
let item = childNodes[i];
|
|
74
|
-
if (item.type ===
|
|
74
|
+
if (item.type === 'column') return item.key;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
getKeyRightOf(key) {
|
|
78
78
|
let item = this.collection.getItem(key);
|
|
79
79
|
if (!item) return;
|
|
80
80
|
// If focus was on a column, then focus the next column
|
|
81
|
-
if (item.type ===
|
|
81
|
+
if (item.type === 'column') return this.direction === 'rtl' ? this.findPreviousColumnKey(item) : this.findNextColumnKey(item);
|
|
82
82
|
return super.getKeyRightOf(key);
|
|
83
83
|
}
|
|
84
84
|
getKeyLeftOf(key) {
|
|
85
85
|
let item = this.collection.getItem(key);
|
|
86
86
|
if (!item) return;
|
|
87
87
|
// If focus was on a column, then focus the previous column
|
|
88
|
-
if (item.type ===
|
|
88
|
+
if (item.type === 'column') return this.direction === 'rtl' ? this.findNextColumnKey(item) : this.findPreviousColumnKey(item);
|
|
89
89
|
return super.getKeyLeftOf(key);
|
|
90
90
|
}
|
|
91
91
|
getKeyForSearch(search, fromKey) {
|
|
@@ -95,7 +95,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
95
95
|
if (key == null) return null;
|
|
96
96
|
// If the starting key is a cell, search from its parent row.
|
|
97
97
|
let startItem = collection.getItem(key);
|
|
98
|
-
if (startItem.type ===
|
|
98
|
+
if (startItem.type === 'cell') key = startItem.parentKey;
|
|
99
99
|
let hasWrapped = false;
|
|
100
100
|
while(key != null){
|
|
101
101
|
let item = collection.getItem(key);
|
|
@@ -107,7 +107,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $eIXPM$GridKeyboardD
|
|
|
107
107
|
if (this.collator.compare(substring, search) === 0) {
|
|
108
108
|
// If we started on a cell, end on the matching cell. Otherwise, end on the row.
|
|
109
109
|
let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
|
|
110
|
-
return fromItem.type ===
|
|
110
|
+
return fromItem.type === 'cell' ? cell.key : item.key;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
package/dist/useTable.main.js
CHANGED
|
@@ -42,8 +42,8 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
42
42
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
43
43
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
44
44
|
let collator = (0, $aZ1Oy$reactariai18n.useCollator)({
|
|
45
|
-
usage:
|
|
46
|
-
sensitivity:
|
|
45
|
+
usage: 'search',
|
|
46
|
+
sensitivity: 'base'
|
|
47
47
|
});
|
|
48
48
|
let { direction: direction } = (0, $aZ1Oy$reactariai18n.useLocale)();
|
|
49
49
|
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
@@ -73,10 +73,10 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
73
73
|
keyboardDelegate: delegate
|
|
74
74
|
}, state, ref);
|
|
75
75
|
// Override to include header rows
|
|
76
|
-
if (isVirtualized) gridProps[
|
|
77
|
-
if ((0, $aZ1Oy$reactstatelyflags.tableNestedRows)() &&
|
|
76
|
+
if (isVirtualized) gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;
|
|
77
|
+
if ((0, $aZ1Oy$reactstatelyflags.tableNestedRows)() && 'expandedKeys' in state) gridProps.role = 'treegrid';
|
|
78
78
|
let { column: column, direction: sortDirection } = state.sortDescriptor || {};
|
|
79
|
-
let stringFormatter = (0, $aZ1Oy$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))),
|
|
79
|
+
let stringFormatter = (0, $aZ1Oy$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))), '@react-aria/table');
|
|
80
80
|
let sortDescription = (0, $aZ1Oy$react.useMemo)(()=>{
|
|
81
81
|
var _state_collection_columns_find;
|
|
82
82
|
let columnName = (_state_collection_columns_find = state.collection.columns.find((c)=>c.key === column)) === null || _state_collection_columns_find === void 0 ? void 0 : _state_collection_columns_find.textValue;
|
|
@@ -92,17 +92,17 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
92
92
|
let descriptionProps = (0, $aZ1Oy$reactariautils.useDescription)(sortDescription);
|
|
93
93
|
// Only announce after initial render, tabbing to the table will tell you the initial sort info already
|
|
94
94
|
(0, $aZ1Oy$reactariautils.useUpdateEffect)(()=>{
|
|
95
|
-
(0, $aZ1Oy$reactarialiveannouncer.announce)(sortDescription,
|
|
95
|
+
(0, $aZ1Oy$reactarialiveannouncer.announce)(sortDescription, 'assertive', 500);
|
|
96
96
|
}, [
|
|
97
97
|
sortDescription
|
|
98
98
|
]);
|
|
99
99
|
return {
|
|
100
100
|
gridProps: (0, $aZ1Oy$reactariautils.mergeProps)(gridProps, descriptionProps, {
|
|
101
101
|
// merge sort description with long press information
|
|
102
|
-
|
|
103
|
-
descriptionProps[
|
|
104
|
-
gridProps[
|
|
105
|
-
].filter(Boolean).join(
|
|
102
|
+
'aria-describedby': [
|
|
103
|
+
descriptionProps['aria-describedby'],
|
|
104
|
+
gridProps['aria-describedby']
|
|
105
|
+
].filter(Boolean).join(' ')
|
|
106
106
|
})
|
|
107
107
|
};
|
|
108
108
|
}
|
package/dist/useTable.mjs
CHANGED
|
@@ -36,8 +36,8 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
36
36
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
37
37
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
38
38
|
let collator = (0, $dDeJM$useCollator)({
|
|
39
|
-
usage:
|
|
40
|
-
sensitivity:
|
|
39
|
+
usage: 'search',
|
|
40
|
+
sensitivity: 'base'
|
|
41
41
|
});
|
|
42
42
|
let { direction: direction } = (0, $dDeJM$useLocale)();
|
|
43
43
|
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
@@ -67,10 +67,10 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
67
67
|
keyboardDelegate: delegate
|
|
68
68
|
}, state, ref);
|
|
69
69
|
// Override to include header rows
|
|
70
|
-
if (isVirtualized) gridProps[
|
|
71
|
-
if ((0, $dDeJM$tableNestedRows)() &&
|
|
70
|
+
if (isVirtualized) gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;
|
|
71
|
+
if ((0, $dDeJM$tableNestedRows)() && 'expandedKeys' in state) gridProps.role = 'treegrid';
|
|
72
72
|
let { column: column, direction: sortDirection } = state.sortDescriptor || {};
|
|
73
|
-
let stringFormatter = (0, $dDeJM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dDeJM$intlStringsmodulejs))),
|
|
73
|
+
let stringFormatter = (0, $dDeJM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dDeJM$intlStringsmodulejs))), '@react-aria/table');
|
|
74
74
|
let sortDescription = (0, $dDeJM$useMemo)(()=>{
|
|
75
75
|
var _state_collection_columns_find;
|
|
76
76
|
let columnName = (_state_collection_columns_find = state.collection.columns.find((c)=>c.key === column)) === null || _state_collection_columns_find === void 0 ? void 0 : _state_collection_columns_find.textValue;
|
|
@@ -86,17 +86,17 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
86
86
|
let descriptionProps = (0, $dDeJM$useDescription)(sortDescription);
|
|
87
87
|
// Only announce after initial render, tabbing to the table will tell you the initial sort info already
|
|
88
88
|
(0, $dDeJM$useUpdateEffect)(()=>{
|
|
89
|
-
(0, $dDeJM$announce)(sortDescription,
|
|
89
|
+
(0, $dDeJM$announce)(sortDescription, 'assertive', 500);
|
|
90
90
|
}, [
|
|
91
91
|
sortDescription
|
|
92
92
|
]);
|
|
93
93
|
return {
|
|
94
94
|
gridProps: (0, $dDeJM$mergeProps)(gridProps, descriptionProps, {
|
|
95
95
|
// merge sort description with long press information
|
|
96
|
-
|
|
97
|
-
descriptionProps[
|
|
98
|
-
gridProps[
|
|
99
|
-
].filter(Boolean).join(
|
|
96
|
+
'aria-describedby': [
|
|
97
|
+
descriptionProps['aria-describedby'],
|
|
98
|
+
gridProps['aria-describedby']
|
|
99
|
+
].filter(Boolean).join(' ')
|
|
100
100
|
})
|
|
101
101
|
};
|
|
102
102
|
}
|
package/dist/useTable.module.js
CHANGED
|
@@ -36,8 +36,8 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
36
36
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
37
37
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
38
38
|
let collator = (0, $dDeJM$useCollator)({
|
|
39
|
-
usage:
|
|
40
|
-
sensitivity:
|
|
39
|
+
usage: 'search',
|
|
40
|
+
sensitivity: 'base'
|
|
41
41
|
});
|
|
42
42
|
let { direction: direction } = (0, $dDeJM$useLocale)();
|
|
43
43
|
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
@@ -67,10 +67,10 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
67
67
|
keyboardDelegate: delegate
|
|
68
68
|
}, state, ref);
|
|
69
69
|
// Override to include header rows
|
|
70
|
-
if (isVirtualized) gridProps[
|
|
71
|
-
if ((0, $dDeJM$tableNestedRows)() &&
|
|
70
|
+
if (isVirtualized) gridProps['aria-rowcount'] = state.collection.size + state.collection.headerRows.length;
|
|
71
|
+
if ((0, $dDeJM$tableNestedRows)() && 'expandedKeys' in state) gridProps.role = 'treegrid';
|
|
72
72
|
let { column: column, direction: sortDirection } = state.sortDescriptor || {};
|
|
73
|
-
let stringFormatter = (0, $dDeJM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dDeJM$intlStringsmodulejs))),
|
|
73
|
+
let stringFormatter = (0, $dDeJM$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dDeJM$intlStringsmodulejs))), '@react-aria/table');
|
|
74
74
|
let sortDescription = (0, $dDeJM$useMemo)(()=>{
|
|
75
75
|
var _state_collection_columns_find;
|
|
76
76
|
let columnName = (_state_collection_columns_find = state.collection.columns.find((c)=>c.key === column)) === null || _state_collection_columns_find === void 0 ? void 0 : _state_collection_columns_find.textValue;
|
|
@@ -86,17 +86,17 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
|
86
86
|
let descriptionProps = (0, $dDeJM$useDescription)(sortDescription);
|
|
87
87
|
// Only announce after initial render, tabbing to the table will tell you the initial sort info already
|
|
88
88
|
(0, $dDeJM$useUpdateEffect)(()=>{
|
|
89
|
-
(0, $dDeJM$announce)(sortDescription,
|
|
89
|
+
(0, $dDeJM$announce)(sortDescription, 'assertive', 500);
|
|
90
90
|
}, [
|
|
91
91
|
sortDescription
|
|
92
92
|
]);
|
|
93
93
|
return {
|
|
94
94
|
gridProps: (0, $dDeJM$mergeProps)(gridProps, descriptionProps, {
|
|
95
95
|
// merge sort description with long press information
|
|
96
|
-
|
|
97
|
-
descriptionProps[
|
|
98
|
-
gridProps[
|
|
99
|
-
].filter(Boolean).join(
|
|
96
|
+
'aria-describedby': [
|
|
97
|
+
descriptionProps['aria-describedby'],
|
|
98
|
+
gridProps['aria-describedby']
|
|
99
|
+
].filter(Boolean).join(' ')
|
|
100
100
|
})
|
|
101
101
|
};
|
|
102
102
|
}
|
|
@@ -23,7 +23,7 @@ function $32387a1f2c61cda2$export$49571c903d73624c(props, state, ref) {
|
|
|
23
23
|
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $8iEv8$reactariagrid.useGridCell)(props, state, ref);
|
|
24
24
|
let columnKey = props.node.column.key;
|
|
25
25
|
if (state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
26
|
-
gridCellProps.role =
|
|
26
|
+
gridCellProps.role = 'rowheader';
|
|
27
27
|
gridCellProps.id = (0, $6acf696f746f932c$exports.getCellId)(state, props.node.parentKey, columnKey);
|
|
28
28
|
}
|
|
29
29
|
return {
|
package/dist/useTableCell.mjs
CHANGED
|
@@ -17,7 +17,7 @@ function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
|
|
|
17
17
|
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $1jd6q$useGridCell)(props, state, ref);
|
|
18
18
|
let columnKey = props.node.column.key;
|
|
19
19
|
if (state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
20
|
-
gridCellProps.role =
|
|
20
|
+
gridCellProps.role = 'rowheader';
|
|
21
21
|
gridCellProps.id = (0, $2140fb2337097f2d$export$19baff3266315d44)(state, props.node.parentKey, columnKey);
|
|
22
22
|
}
|
|
23
23
|
return {
|
|
@@ -17,7 +17,7 @@ function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
|
|
|
17
17
|
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $1jd6q$useGridCell)(props, state, ref);
|
|
18
18
|
let columnKey = props.node.column.key;
|
|
19
19
|
if (state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
20
|
-
gridCellProps.role =
|
|
20
|
+
gridCellProps.role = 'rowheader';
|
|
21
21
|
gridCellProps.id = (0, $2140fb2337097f2d$export$19baff3266315d44)(state, props.node.parentKey, columnKey);
|
|
22
22
|
}
|
|
23
23
|
return {
|
|
@@ -42,9 +42,9 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
|
|
|
42
42
|
// if there are no focusable children, the column header will focus the cell
|
|
43
43
|
let { gridCellProps: gridCellProps } = (0, $33PgG$reactariagrid.useGridCell)({
|
|
44
44
|
...props,
|
|
45
|
-
focusMode:
|
|
45
|
+
focusMode: 'child'
|
|
46
46
|
}, state, ref);
|
|
47
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode ===
|
|
47
|
+
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
|
|
48
48
|
let { pressProps: pressProps } = (0, $33PgG$reactariainteractions.usePress)({
|
|
49
49
|
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
50
50
|
onPress () {
|
|
@@ -58,11 +58,11 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
|
|
|
58
58
|
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
59
59
|
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
60
60
|
// aria-sort not supported in Android Talkback
|
|
61
|
-
if (node.props.allowsSorting && !(0, $33PgG$reactariautils.isAndroid)()) ariaSort = isSortedColumn ? sortDirection :
|
|
62
|
-
let stringFormatter = (0, $33PgG$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))),
|
|
61
|
+
if (node.props.allowsSorting && !(0, $33PgG$reactariautils.isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
|
|
62
|
+
let stringFormatter = (0, $33PgG$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))), '@react-aria/table');
|
|
63
63
|
let sortDescription;
|
|
64
64
|
if (allowsSorting) {
|
|
65
|
-
sortDescription = `${stringFormatter.format(
|
|
65
|
+
sortDescription = `${stringFormatter.format('sortable')}`;
|
|
66
66
|
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
67
67
|
if (isSortedColumn && sortDirection && (0, $33PgG$reactariautils.isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
68
68
|
}
|
|
@@ -81,10 +81,10 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
|
|
|
81
81
|
shouldDisableFocus && {
|
|
82
82
|
tabIndex: -1
|
|
83
83
|
}),
|
|
84
|
-
role:
|
|
84
|
+
role: 'columnheader',
|
|
85
85
|
id: (0, $6acf696f746f932c$exports.getColumnHeaderId)(state, node.key),
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : null,
|
|
87
|
+
'aria-sort': ariaSort
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
}
|
|
@@ -36,9 +36,9 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
|
36
36
|
// if there are no focusable children, the column header will focus the cell
|
|
37
37
|
let { gridCellProps: gridCellProps } = (0, $cjB6b$useGridCell)({
|
|
38
38
|
...props,
|
|
39
|
-
focusMode:
|
|
39
|
+
focusMode: 'child'
|
|
40
40
|
}, state, ref);
|
|
41
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode ===
|
|
41
|
+
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
|
|
42
42
|
let { pressProps: pressProps } = (0, $cjB6b$usePress)({
|
|
43
43
|
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
44
44
|
onPress () {
|
|
@@ -52,11 +52,11 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
|
52
52
|
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
53
53
|
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
54
54
|
// aria-sort not supported in Android Talkback
|
|
55
|
-
if (node.props.allowsSorting && !(0, $cjB6b$isAndroid)()) ariaSort = isSortedColumn ? sortDirection :
|
|
56
|
-
let stringFormatter = (0, $cjB6b$useLocalizedStringFormatter)((0, ($parcel$interopDefault($cjB6b$intlStringsmodulejs))),
|
|
55
|
+
if (node.props.allowsSorting && !(0, $cjB6b$isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
|
|
56
|
+
let stringFormatter = (0, $cjB6b$useLocalizedStringFormatter)((0, ($parcel$interopDefault($cjB6b$intlStringsmodulejs))), '@react-aria/table');
|
|
57
57
|
let sortDescription;
|
|
58
58
|
if (allowsSorting) {
|
|
59
|
-
sortDescription = `${stringFormatter.format(
|
|
59
|
+
sortDescription = `${stringFormatter.format('sortable')}`;
|
|
60
60
|
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
61
61
|
if (isSortedColumn && sortDirection && (0, $cjB6b$isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
62
62
|
}
|
|
@@ -75,10 +75,10 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
|
75
75
|
shouldDisableFocus && {
|
|
76
76
|
tabIndex: -1
|
|
77
77
|
}),
|
|
78
|
-
role:
|
|
78
|
+
role: 'columnheader',
|
|
79
79
|
id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : null,
|
|
81
|
+
'aria-sort': ariaSort
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
}
|
|
@@ -36,9 +36,9 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
|
36
36
|
// if there are no focusable children, the column header will focus the cell
|
|
37
37
|
let { gridCellProps: gridCellProps } = (0, $cjB6b$useGridCell)({
|
|
38
38
|
...props,
|
|
39
|
-
focusMode:
|
|
39
|
+
focusMode: 'child'
|
|
40
40
|
}, state, ref);
|
|
41
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode ===
|
|
41
|
+
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
|
|
42
42
|
let { pressProps: pressProps } = (0, $cjB6b$usePress)({
|
|
43
43
|
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
44
44
|
onPress () {
|
|
@@ -52,11 +52,11 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
|
52
52
|
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
53
53
|
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
54
54
|
// aria-sort not supported in Android Talkback
|
|
55
|
-
if (node.props.allowsSorting && !(0, $cjB6b$isAndroid)()) ariaSort = isSortedColumn ? sortDirection :
|
|
56
|
-
let stringFormatter = (0, $cjB6b$useLocalizedStringFormatter)((0, ($parcel$interopDefault($cjB6b$intlStringsmodulejs))),
|
|
55
|
+
if (node.props.allowsSorting && !(0, $cjB6b$isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
|
|
56
|
+
let stringFormatter = (0, $cjB6b$useLocalizedStringFormatter)((0, ($parcel$interopDefault($cjB6b$intlStringsmodulejs))), '@react-aria/table');
|
|
57
57
|
let sortDescription;
|
|
58
58
|
if (allowsSorting) {
|
|
59
|
-
sortDescription = `${stringFormatter.format(
|
|
59
|
+
sortDescription = `${stringFormatter.format('sortable')}`;
|
|
60
60
|
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
61
61
|
if (isSortedColumn && sortDirection && (0, $cjB6b$isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
62
62
|
}
|
|
@@ -75,10 +75,10 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
|
75
75
|
shouldDisableFocus && {
|
|
76
76
|
tabIndex: -1
|
|
77
77
|
}),
|
|
78
|
-
role:
|
|
78
|
+
role: 'columnheader',
|
|
79
79
|
id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
'aria-colspan': node.colspan && node.colspan > 1 ? node.colspan : null,
|
|
81
|
+
'aria-sort': ariaSort
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
}
|