@react-aria/grid 3.9.1-nightly.4624 → 3.9.2-nightly.4629
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/GridKeyboardDelegate.main.js +19 -19
- package/dist/GridKeyboardDelegate.mjs +19 -19
- package/dist/GridKeyboardDelegate.module.js +19 -19
- package/dist/useGrid.main.js +7 -7
- package/dist/useGrid.mjs +7 -7
- package/dist/useGrid.module.js +7 -7
- package/dist/useGridCell.main.js +21 -21
- package/dist/useGridCell.mjs +21 -21
- package/dist/useGridCell.module.js +21 -21
- package/dist/useGridRow.main.js +4 -4
- package/dist/useGridRow.mjs +4 -4
- package/dist/useGridRow.module.js +4 -4
- package/dist/useGridRowGroup.main.js +1 -1
- package/dist/useGridRowGroup.mjs +1 -1
- package/dist/useGridRowGroup.module.js +1 -1
- package/dist/useGridSelectionAnnouncement.main.js +9 -9
- package/dist/useGridSelectionAnnouncement.mjs +9 -9
- package/dist/useGridSelectionAnnouncement.module.js +9 -9
- package/dist/useGridSelectionCheckbox.main.js +2 -2
- package/dist/useGridSelectionCheckbox.mjs +2 -2
- package/dist/useGridSelectionCheckbox.module.js +2 -2
- package/dist/useHighlightSelectionDescription.main.js +4 -4
- package/dist/useHighlightSelectionDescription.mjs +4 -4
- package/dist/useHighlightSelectionDescription.module.js +4 -4
- package/package.json +15 -15
|
@@ -21,14 +21,14 @@ $parcel$export(module.exports, "GridKeyboardDelegate", () => $3187c0e19200cb16$e
|
|
|
21
21
|
|
|
22
22
|
class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
23
23
|
isCell(node) {
|
|
24
|
-
return node.type ===
|
|
24
|
+
return node.type === 'cell';
|
|
25
25
|
}
|
|
26
26
|
isRow(node) {
|
|
27
|
-
return node.type ===
|
|
27
|
+
return node.type === 'row' || node.type === 'item';
|
|
28
28
|
}
|
|
29
29
|
isDisabled(item) {
|
|
30
30
|
var _item_props;
|
|
31
|
-
return this.disabledBehavior ===
|
|
31
|
+
return this.disabledBehavior === 'all' && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
|
|
32
32
|
}
|
|
33
33
|
findPreviousKey(fromKey, pred) {
|
|
34
34
|
let key = fromKey != null ? this.collection.getKeyBefore(fromKey) : this.collection.getLastKey();
|
|
@@ -60,7 +60,7 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
60
60
|
return (0, $iKGCm$reactstatelycollections.getNthItem)((0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection), startItem.index).key;
|
|
61
61
|
}
|
|
62
62
|
// Otherwise, focus the next row
|
|
63
|
-
if (this.focusMode ===
|
|
63
|
+
if (this.focusMode === 'row') return key;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
getKeyAbove(key) {
|
|
@@ -77,7 +77,7 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
77
77
|
return (0, $iKGCm$reactstatelycollections.getNthItem)((0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection), startItem.index).key;
|
|
78
78
|
}
|
|
79
79
|
// Otherwise, focus the previous row
|
|
80
|
-
if (this.focusMode ===
|
|
80
|
+
if (this.focusMode === 'row') return key;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
getKeyRightOf(key) {
|
|
@@ -86,18 +86,18 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
86
86
|
// If focus is on a row, focus the first child cell.
|
|
87
87
|
if (this.isRow(item)) {
|
|
88
88
|
let children = (0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection);
|
|
89
|
-
return this.direction ===
|
|
89
|
+
return this.direction === 'rtl' ? (0, $iKGCm$reactstatelycollections.getLastItem)(children).key : (0, $iKGCm$reactstatelycollections.getFirstItem)(children).key;
|
|
90
90
|
}
|
|
91
91
|
// If focus is on a cell, focus the next cell if any,
|
|
92
92
|
// otherwise focus the parent row.
|
|
93
93
|
if (this.isCell(item)) {
|
|
94
94
|
let parent = this.collection.getItem(item.parentKey);
|
|
95
95
|
let children = (0, $iKGCm$reactstatelycollections.getChildNodes)(parent, this.collection);
|
|
96
|
-
let next = this.direction ===
|
|
96
|
+
let next = this.direction === 'rtl' ? (0, $iKGCm$reactstatelycollections.getNthItem)(children, item.index - 1) : (0, $iKGCm$reactstatelycollections.getNthItem)(children, item.index + 1);
|
|
97
97
|
if (next) return next.key;
|
|
98
98
|
// focus row only if focusMode is set to row
|
|
99
|
-
if (this.focusMode ===
|
|
100
|
-
return this.direction ===
|
|
99
|
+
if (this.focusMode === 'row') return item.parentKey;
|
|
100
|
+
return this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
getKeyLeftOf(key) {
|
|
@@ -106,18 +106,18 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
106
106
|
// If focus is on a row, focus the last child cell.
|
|
107
107
|
if (this.isRow(item)) {
|
|
108
108
|
let children = (0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection);
|
|
109
|
-
return this.direction ===
|
|
109
|
+
return this.direction === 'rtl' ? (0, $iKGCm$reactstatelycollections.getFirstItem)(children).key : (0, $iKGCm$reactstatelycollections.getLastItem)(children).key;
|
|
110
110
|
}
|
|
111
111
|
// If focus is on a cell, focus the previous cell if any,
|
|
112
112
|
// otherwise focus the parent row.
|
|
113
113
|
if (this.isCell(item)) {
|
|
114
114
|
let parent = this.collection.getItem(item.parentKey);
|
|
115
115
|
let children = (0, $iKGCm$reactstatelycollections.getChildNodes)(parent, this.collection);
|
|
116
|
-
let prev = this.direction ===
|
|
116
|
+
let prev = this.direction === 'rtl' ? (0, $iKGCm$reactstatelycollections.getNthItem)(children, item.index + 1) : (0, $iKGCm$reactstatelycollections.getNthItem)(children, item.index - 1);
|
|
117
117
|
if (prev) return prev.key;
|
|
118
118
|
// focus row only if focusMode is set to row
|
|
119
|
-
if (this.focusMode ===
|
|
120
|
-
return this.direction ===
|
|
119
|
+
if (this.focusMode === 'row') return item.parentKey;
|
|
120
|
+
return this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
getFirstKey(key, global) {
|
|
@@ -135,7 +135,7 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
135
135
|
// Find the first row
|
|
136
136
|
key = this.findNextKey();
|
|
137
137
|
// If global flag is set (or if focus mode is cell), focus the first cell in the first row.
|
|
138
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode ===
|
|
138
|
+
if (key != null && item && this.isCell(item) && global || this.focusMode === 'cell') {
|
|
139
139
|
let item = this.collection.getItem(key);
|
|
140
140
|
key = (0, $iKGCm$reactstatelycollections.getFirstItem)((0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection)).key;
|
|
141
141
|
}
|
|
@@ -158,7 +158,7 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
158
158
|
// Find the last row
|
|
159
159
|
key = this.findPreviousKey();
|
|
160
160
|
// If global flag is set (or if focus mode is cell), focus the last cell in the last row.
|
|
161
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode ===
|
|
161
|
+
if (key != null && item && this.isCell(item) && global || this.focusMode === 'cell') {
|
|
162
162
|
let item = this.collection.getItem(key);
|
|
163
163
|
let children = (0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection);
|
|
164
164
|
key = (0, $iKGCm$reactstatelycollections.getLastItem)(children).key;
|
|
@@ -215,7 +215,7 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
215
215
|
let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
|
|
216
216
|
// If the starting key is a cell, search from its parent row.
|
|
217
217
|
let startItem = collection.getItem(key);
|
|
218
|
-
if (startItem.type ===
|
|
218
|
+
if (startItem.type === 'cell') key = startItem.parentKey;
|
|
219
219
|
let hasWrapped = false;
|
|
220
220
|
while(key != null){
|
|
221
221
|
let item = collection.getItem(key);
|
|
@@ -223,7 +223,7 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
223
223
|
if (item.textValue) {
|
|
224
224
|
let substring = item.textValue.slice(0, search.length);
|
|
225
225
|
if (this.collator.compare(substring, search) === 0) {
|
|
226
|
-
if (this.isRow(item) && this.focusMode ===
|
|
226
|
+
if (this.isRow(item) && this.focusMode === 'cell') return (0, $iKGCm$reactstatelycollections.getFirstItem)((0, $iKGCm$reactstatelycollections.getChildNodes)(item, this.collection)).key;
|
|
227
227
|
return item.key;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -239,12 +239,12 @@ class $3187c0e19200cb16$export$de9feff04fda126e {
|
|
|
239
239
|
constructor(options){
|
|
240
240
|
this.collection = options.collection;
|
|
241
241
|
this.disabledKeys = options.disabledKeys;
|
|
242
|
-
this.disabledBehavior = options.disabledBehavior ||
|
|
242
|
+
this.disabledBehavior = options.disabledBehavior || 'all';
|
|
243
243
|
this.ref = options.ref;
|
|
244
244
|
this.direction = options.direction;
|
|
245
245
|
this.collator = options.collator;
|
|
246
246
|
this.layout = options.layout;
|
|
247
|
-
this.focusMode = options.focusMode ||
|
|
247
|
+
this.focusMode = options.focusMode || 'row';
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
|
|
@@ -15,14 +15,14 @@ import {Rect as $kbsd1$Rect} from "@react-stately/virtualizer";
|
|
|
15
15
|
|
|
16
16
|
class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
17
17
|
isCell(node) {
|
|
18
|
-
return node.type ===
|
|
18
|
+
return node.type === 'cell';
|
|
19
19
|
}
|
|
20
20
|
isRow(node) {
|
|
21
|
-
return node.type ===
|
|
21
|
+
return node.type === 'row' || node.type === 'item';
|
|
22
22
|
}
|
|
23
23
|
isDisabled(item) {
|
|
24
24
|
var _item_props;
|
|
25
|
-
return this.disabledBehavior ===
|
|
25
|
+
return this.disabledBehavior === 'all' && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
|
|
26
26
|
}
|
|
27
27
|
findPreviousKey(fromKey, pred) {
|
|
28
28
|
let key = fromKey != null ? this.collection.getKeyBefore(fromKey) : this.collection.getLastKey();
|
|
@@ -54,7 +54,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
54
54
|
return (0, $kbsd1$getNthItem)((0, $kbsd1$getChildNodes)(item, this.collection), startItem.index).key;
|
|
55
55
|
}
|
|
56
56
|
// Otherwise, focus the next row
|
|
57
|
-
if (this.focusMode ===
|
|
57
|
+
if (this.focusMode === 'row') return key;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
getKeyAbove(key) {
|
|
@@ -71,7 +71,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
71
71
|
return (0, $kbsd1$getNthItem)((0, $kbsd1$getChildNodes)(item, this.collection), startItem.index).key;
|
|
72
72
|
}
|
|
73
73
|
// Otherwise, focus the previous row
|
|
74
|
-
if (this.focusMode ===
|
|
74
|
+
if (this.focusMode === 'row') return key;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
getKeyRightOf(key) {
|
|
@@ -80,18 +80,18 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
80
80
|
// If focus is on a row, focus the first child cell.
|
|
81
81
|
if (this.isRow(item)) {
|
|
82
82
|
let children = (0, $kbsd1$getChildNodes)(item, this.collection);
|
|
83
|
-
return this.direction ===
|
|
83
|
+
return this.direction === 'rtl' ? (0, $kbsd1$getLastItem)(children).key : (0, $kbsd1$getFirstItem)(children).key;
|
|
84
84
|
}
|
|
85
85
|
// If focus is on a cell, focus the next cell if any,
|
|
86
86
|
// otherwise focus the parent row.
|
|
87
87
|
if (this.isCell(item)) {
|
|
88
88
|
let parent = this.collection.getItem(item.parentKey);
|
|
89
89
|
let children = (0, $kbsd1$getChildNodes)(parent, this.collection);
|
|
90
|
-
let next = this.direction ===
|
|
90
|
+
let next = this.direction === 'rtl' ? (0, $kbsd1$getNthItem)(children, item.index - 1) : (0, $kbsd1$getNthItem)(children, item.index + 1);
|
|
91
91
|
if (next) return next.key;
|
|
92
92
|
// focus row only if focusMode is set to row
|
|
93
|
-
if (this.focusMode ===
|
|
94
|
-
return this.direction ===
|
|
93
|
+
if (this.focusMode === 'row') return item.parentKey;
|
|
94
|
+
return this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
getKeyLeftOf(key) {
|
|
@@ -100,18 +100,18 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
100
100
|
// If focus is on a row, focus the last child cell.
|
|
101
101
|
if (this.isRow(item)) {
|
|
102
102
|
let children = (0, $kbsd1$getChildNodes)(item, this.collection);
|
|
103
|
-
return this.direction ===
|
|
103
|
+
return this.direction === 'rtl' ? (0, $kbsd1$getFirstItem)(children).key : (0, $kbsd1$getLastItem)(children).key;
|
|
104
104
|
}
|
|
105
105
|
// If focus is on a cell, focus the previous cell if any,
|
|
106
106
|
// otherwise focus the parent row.
|
|
107
107
|
if (this.isCell(item)) {
|
|
108
108
|
let parent = this.collection.getItem(item.parentKey);
|
|
109
109
|
let children = (0, $kbsd1$getChildNodes)(parent, this.collection);
|
|
110
|
-
let prev = this.direction ===
|
|
110
|
+
let prev = this.direction === 'rtl' ? (0, $kbsd1$getNthItem)(children, item.index + 1) : (0, $kbsd1$getNthItem)(children, item.index - 1);
|
|
111
111
|
if (prev) return prev.key;
|
|
112
112
|
// focus row only if focusMode is set to row
|
|
113
|
-
if (this.focusMode ===
|
|
114
|
-
return this.direction ===
|
|
113
|
+
if (this.focusMode === 'row') return item.parentKey;
|
|
114
|
+
return this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
getFirstKey(key, global) {
|
|
@@ -129,7 +129,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
129
129
|
// Find the first row
|
|
130
130
|
key = this.findNextKey();
|
|
131
131
|
// If global flag is set (or if focus mode is cell), focus the first cell in the first row.
|
|
132
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode ===
|
|
132
|
+
if (key != null && item && this.isCell(item) && global || this.focusMode === 'cell') {
|
|
133
133
|
let item = this.collection.getItem(key);
|
|
134
134
|
key = (0, $kbsd1$getFirstItem)((0, $kbsd1$getChildNodes)(item, this.collection)).key;
|
|
135
135
|
}
|
|
@@ -152,7 +152,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
152
152
|
// Find the last row
|
|
153
153
|
key = this.findPreviousKey();
|
|
154
154
|
// If global flag is set (or if focus mode is cell), focus the last cell in the last row.
|
|
155
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode ===
|
|
155
|
+
if (key != null && item && this.isCell(item) && global || this.focusMode === 'cell') {
|
|
156
156
|
let item = this.collection.getItem(key);
|
|
157
157
|
let children = (0, $kbsd1$getChildNodes)(item, this.collection);
|
|
158
158
|
key = (0, $kbsd1$getLastItem)(children).key;
|
|
@@ -209,7 +209,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
209
209
|
let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
|
|
210
210
|
// If the starting key is a cell, search from its parent row.
|
|
211
211
|
let startItem = collection.getItem(key);
|
|
212
|
-
if (startItem.type ===
|
|
212
|
+
if (startItem.type === 'cell') key = startItem.parentKey;
|
|
213
213
|
let hasWrapped = false;
|
|
214
214
|
while(key != null){
|
|
215
215
|
let item = collection.getItem(key);
|
|
@@ -217,7 +217,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
217
217
|
if (item.textValue) {
|
|
218
218
|
let substring = item.textValue.slice(0, search.length);
|
|
219
219
|
if (this.collator.compare(substring, search) === 0) {
|
|
220
|
-
if (this.isRow(item) && this.focusMode ===
|
|
220
|
+
if (this.isRow(item) && this.focusMode === 'cell') return (0, $kbsd1$getFirstItem)((0, $kbsd1$getChildNodes)(item, this.collection)).key;
|
|
221
221
|
return item.key;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -233,12 +233,12 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
233
233
|
constructor(options){
|
|
234
234
|
this.collection = options.collection;
|
|
235
235
|
this.disabledKeys = options.disabledKeys;
|
|
236
|
-
this.disabledBehavior = options.disabledBehavior ||
|
|
236
|
+
this.disabledBehavior = options.disabledBehavior || 'all';
|
|
237
237
|
this.ref = options.ref;
|
|
238
238
|
this.direction = options.direction;
|
|
239
239
|
this.collator = options.collator;
|
|
240
240
|
this.layout = options.layout;
|
|
241
|
-
this.focusMode = options.focusMode ||
|
|
241
|
+
this.focusMode = options.focusMode || 'row';
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -15,14 +15,14 @@ import {Rect as $kbsd1$Rect} from "@react-stately/virtualizer";
|
|
|
15
15
|
|
|
16
16
|
class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
17
17
|
isCell(node) {
|
|
18
|
-
return node.type ===
|
|
18
|
+
return node.type === 'cell';
|
|
19
19
|
}
|
|
20
20
|
isRow(node) {
|
|
21
|
-
return node.type ===
|
|
21
|
+
return node.type === 'row' || node.type === 'item';
|
|
22
22
|
}
|
|
23
23
|
isDisabled(item) {
|
|
24
24
|
var _item_props;
|
|
25
|
-
return this.disabledBehavior ===
|
|
25
|
+
return this.disabledBehavior === 'all' && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
|
|
26
26
|
}
|
|
27
27
|
findPreviousKey(fromKey, pred) {
|
|
28
28
|
let key = fromKey != null ? this.collection.getKeyBefore(fromKey) : this.collection.getLastKey();
|
|
@@ -54,7 +54,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
54
54
|
return (0, $kbsd1$getNthItem)((0, $kbsd1$getChildNodes)(item, this.collection), startItem.index).key;
|
|
55
55
|
}
|
|
56
56
|
// Otherwise, focus the next row
|
|
57
|
-
if (this.focusMode ===
|
|
57
|
+
if (this.focusMode === 'row') return key;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
getKeyAbove(key) {
|
|
@@ -71,7 +71,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
71
71
|
return (0, $kbsd1$getNthItem)((0, $kbsd1$getChildNodes)(item, this.collection), startItem.index).key;
|
|
72
72
|
}
|
|
73
73
|
// Otherwise, focus the previous row
|
|
74
|
-
if (this.focusMode ===
|
|
74
|
+
if (this.focusMode === 'row') return key;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
getKeyRightOf(key) {
|
|
@@ -80,18 +80,18 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
80
80
|
// If focus is on a row, focus the first child cell.
|
|
81
81
|
if (this.isRow(item)) {
|
|
82
82
|
let children = (0, $kbsd1$getChildNodes)(item, this.collection);
|
|
83
|
-
return this.direction ===
|
|
83
|
+
return this.direction === 'rtl' ? (0, $kbsd1$getLastItem)(children).key : (0, $kbsd1$getFirstItem)(children).key;
|
|
84
84
|
}
|
|
85
85
|
// If focus is on a cell, focus the next cell if any,
|
|
86
86
|
// otherwise focus the parent row.
|
|
87
87
|
if (this.isCell(item)) {
|
|
88
88
|
let parent = this.collection.getItem(item.parentKey);
|
|
89
89
|
let children = (0, $kbsd1$getChildNodes)(parent, this.collection);
|
|
90
|
-
let next = this.direction ===
|
|
90
|
+
let next = this.direction === 'rtl' ? (0, $kbsd1$getNthItem)(children, item.index - 1) : (0, $kbsd1$getNthItem)(children, item.index + 1);
|
|
91
91
|
if (next) return next.key;
|
|
92
92
|
// focus row only if focusMode is set to row
|
|
93
|
-
if (this.focusMode ===
|
|
94
|
-
return this.direction ===
|
|
93
|
+
if (this.focusMode === 'row') return item.parentKey;
|
|
94
|
+
return this.direction === 'rtl' ? this.getFirstKey(key) : this.getLastKey(key);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
getKeyLeftOf(key) {
|
|
@@ -100,18 +100,18 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
100
100
|
// If focus is on a row, focus the last child cell.
|
|
101
101
|
if (this.isRow(item)) {
|
|
102
102
|
let children = (0, $kbsd1$getChildNodes)(item, this.collection);
|
|
103
|
-
return this.direction ===
|
|
103
|
+
return this.direction === 'rtl' ? (0, $kbsd1$getFirstItem)(children).key : (0, $kbsd1$getLastItem)(children).key;
|
|
104
104
|
}
|
|
105
105
|
// If focus is on a cell, focus the previous cell if any,
|
|
106
106
|
// otherwise focus the parent row.
|
|
107
107
|
if (this.isCell(item)) {
|
|
108
108
|
let parent = this.collection.getItem(item.parentKey);
|
|
109
109
|
let children = (0, $kbsd1$getChildNodes)(parent, this.collection);
|
|
110
|
-
let prev = this.direction ===
|
|
110
|
+
let prev = this.direction === 'rtl' ? (0, $kbsd1$getNthItem)(children, item.index + 1) : (0, $kbsd1$getNthItem)(children, item.index - 1);
|
|
111
111
|
if (prev) return prev.key;
|
|
112
112
|
// focus row only if focusMode is set to row
|
|
113
|
-
if (this.focusMode ===
|
|
114
|
-
return this.direction ===
|
|
113
|
+
if (this.focusMode === 'row') return item.parentKey;
|
|
114
|
+
return this.direction === 'rtl' ? this.getLastKey(key) : this.getFirstKey(key);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
getFirstKey(key, global) {
|
|
@@ -129,7 +129,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
129
129
|
// Find the first row
|
|
130
130
|
key = this.findNextKey();
|
|
131
131
|
// If global flag is set (or if focus mode is cell), focus the first cell in the first row.
|
|
132
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode ===
|
|
132
|
+
if (key != null && item && this.isCell(item) && global || this.focusMode === 'cell') {
|
|
133
133
|
let item = this.collection.getItem(key);
|
|
134
134
|
key = (0, $kbsd1$getFirstItem)((0, $kbsd1$getChildNodes)(item, this.collection)).key;
|
|
135
135
|
}
|
|
@@ -152,7 +152,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
152
152
|
// Find the last row
|
|
153
153
|
key = this.findPreviousKey();
|
|
154
154
|
// If global flag is set (or if focus mode is cell), focus the last cell in the last row.
|
|
155
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode ===
|
|
155
|
+
if (key != null && item && this.isCell(item) && global || this.focusMode === 'cell') {
|
|
156
156
|
let item = this.collection.getItem(key);
|
|
157
157
|
let children = (0, $kbsd1$getChildNodes)(item, this.collection);
|
|
158
158
|
key = (0, $kbsd1$getLastItem)(children).key;
|
|
@@ -209,7 +209,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
209
209
|
let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
|
|
210
210
|
// If the starting key is a cell, search from its parent row.
|
|
211
211
|
let startItem = collection.getItem(key);
|
|
212
|
-
if (startItem.type ===
|
|
212
|
+
if (startItem.type === 'cell') key = startItem.parentKey;
|
|
213
213
|
let hasWrapped = false;
|
|
214
214
|
while(key != null){
|
|
215
215
|
let item = collection.getItem(key);
|
|
@@ -217,7 +217,7 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
217
217
|
if (item.textValue) {
|
|
218
218
|
let substring = item.textValue.slice(0, search.length);
|
|
219
219
|
if (this.collator.compare(substring, search) === 0) {
|
|
220
|
-
if (this.isRow(item) && this.focusMode ===
|
|
220
|
+
if (this.isRow(item) && this.focusMode === 'cell') return (0, $kbsd1$getFirstItem)((0, $kbsd1$getChildNodes)(item, this.collection)).key;
|
|
221
221
|
return item.key;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
@@ -233,12 +233,12 @@ class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
|
233
233
|
constructor(options){
|
|
234
234
|
this.collection = options.collection;
|
|
235
235
|
this.disabledKeys = options.disabledKeys;
|
|
236
|
-
this.disabledBehavior = options.disabledBehavior ||
|
|
236
|
+
this.disabledBehavior = options.disabledBehavior || 'all';
|
|
237
237
|
this.ref = options.ref;
|
|
238
238
|
this.direction = options.direction;
|
|
239
239
|
this.collator = options.collator;
|
|
240
240
|
this.layout = options.layout;
|
|
241
|
-
this.focusMode = options.focusMode ||
|
|
241
|
+
this.focusMode = options.focusMode || 'row';
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
package/dist/useGrid.main.js
CHANGED
|
@@ -36,12 +36,12 @@ $parcel$export(module.exports, "useGrid", () => $11d770dfabe45077$export$f6b86a0
|
|
|
36
36
|
function $11d770dfabe45077$export$f6b86a04e5d66d90(props, state, ref) {
|
|
37
37
|
let { isVirtualized: isVirtualized, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
|
|
38
38
|
let { selectionManager: manager } = state;
|
|
39
|
-
if (!props[
|
|
39
|
+
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
|
|
40
40
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
41
41
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
42
42
|
let collator = (0, $lBaOG$reactariai18n.useCollator)({
|
|
43
|
-
usage:
|
|
44
|
-
sensitivity:
|
|
43
|
+
usage: 'search',
|
|
44
|
+
sensitivity: 'base'
|
|
45
45
|
});
|
|
46
46
|
let { direction: direction } = (0, $lBaOG$reactariai18n.useLocale)();
|
|
47
47
|
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
@@ -109,16 +109,16 @@ function $11d770dfabe45077$export$f6b86a04e5d66d90(props, state, ref) {
|
|
|
109
109
|
isDisabled: state.collection.size !== 0
|
|
110
110
|
});
|
|
111
111
|
let gridProps = (0, $lBaOG$reactariautils.mergeProps)(domProps, {
|
|
112
|
-
role:
|
|
112
|
+
role: 'grid',
|
|
113
113
|
id: id,
|
|
114
|
-
|
|
114
|
+
'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined
|
|
115
115
|
}, state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps, // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
|
|
116
116
|
state.collection.size === 0 && {
|
|
117
117
|
tabIndex: hasTabbableChild ? -1 : 0
|
|
118
118
|
}, descriptionProps);
|
|
119
119
|
if (isVirtualized) {
|
|
120
|
-
gridProps[
|
|
121
|
-
gridProps[
|
|
120
|
+
gridProps['aria-rowcount'] = state.collection.size;
|
|
121
|
+
gridProps['aria-colcount'] = state.collection.columnCount;
|
|
122
122
|
}
|
|
123
123
|
(0, $1eb174acfe8a0f16$exports.useGridSelectionAnnouncement)({
|
|
124
124
|
getRowText: getRowText
|
package/dist/useGrid.mjs
CHANGED
|
@@ -30,12 +30,12 @@ import {useSelectableCollection as $eV0xE$useSelectableCollection} from "@react-
|
|
|
30
30
|
function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
|
|
31
31
|
let { isVirtualized: isVirtualized, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
|
|
32
32
|
let { selectionManager: manager } = state;
|
|
33
|
-
if (!props[
|
|
33
|
+
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
|
|
34
34
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
35
35
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
36
36
|
let collator = (0, $eV0xE$useCollator)({
|
|
37
|
-
usage:
|
|
38
|
-
sensitivity:
|
|
37
|
+
usage: 'search',
|
|
38
|
+
sensitivity: 'base'
|
|
39
39
|
});
|
|
40
40
|
let { direction: direction } = (0, $eV0xE$useLocale)();
|
|
41
41
|
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
@@ -103,16 +103,16 @@ function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
|
|
|
103
103
|
isDisabled: state.collection.size !== 0
|
|
104
104
|
});
|
|
105
105
|
let gridProps = (0, $eV0xE$mergeProps)(domProps, {
|
|
106
|
-
role:
|
|
106
|
+
role: 'grid',
|
|
107
107
|
id: id,
|
|
108
|
-
|
|
108
|
+
'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined
|
|
109
109
|
}, state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps, // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
|
|
110
110
|
state.collection.size === 0 && {
|
|
111
111
|
tabIndex: hasTabbableChild ? -1 : 0
|
|
112
112
|
}, descriptionProps);
|
|
113
113
|
if (isVirtualized) {
|
|
114
|
-
gridProps[
|
|
115
|
-
gridProps[
|
|
114
|
+
gridProps['aria-rowcount'] = state.collection.size;
|
|
115
|
+
gridProps['aria-colcount'] = state.collection.columnCount;
|
|
116
116
|
}
|
|
117
117
|
(0, $92599c3fd427b763$export$137e594ef3218a10)({
|
|
118
118
|
getRowText: getRowText
|
package/dist/useGrid.module.js
CHANGED
|
@@ -30,12 +30,12 @@ import {useSelectableCollection as $eV0xE$useSelectableCollection} from "@react-
|
|
|
30
30
|
function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
|
|
31
31
|
let { isVirtualized: isVirtualized, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
|
|
32
32
|
let { selectionManager: manager } = state;
|
|
33
|
-
if (!props[
|
|
33
|
+
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
|
|
34
34
|
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
35
35
|
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
36
36
|
let collator = (0, $eV0xE$useCollator)({
|
|
37
|
-
usage:
|
|
38
|
-
sensitivity:
|
|
37
|
+
usage: 'search',
|
|
38
|
+
sensitivity: 'base'
|
|
39
39
|
});
|
|
40
40
|
let { direction: direction } = (0, $eV0xE$useLocale)();
|
|
41
41
|
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
@@ -103,16 +103,16 @@ function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
|
|
|
103
103
|
isDisabled: state.collection.size !== 0
|
|
104
104
|
});
|
|
105
105
|
let gridProps = (0, $eV0xE$mergeProps)(domProps, {
|
|
106
|
-
role:
|
|
106
|
+
role: 'grid',
|
|
107
107
|
id: id,
|
|
108
|
-
|
|
108
|
+
'aria-multiselectable': manager.selectionMode === 'multiple' ? 'true' : undefined
|
|
109
109
|
}, state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps, // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
|
|
110
110
|
state.collection.size === 0 && {
|
|
111
111
|
tabIndex: hasTabbableChild ? -1 : 0
|
|
112
112
|
}, descriptionProps);
|
|
113
113
|
if (isVirtualized) {
|
|
114
|
-
gridProps[
|
|
115
|
-
gridProps[
|
|
114
|
+
gridProps['aria-rowcount'] = state.collection.size;
|
|
115
|
+
gridProps['aria-colcount'] = state.collection.columnCount;
|
|
116
116
|
}
|
|
117
117
|
(0, $92599c3fd427b763$export$137e594ef3218a10)({
|
|
118
118
|
getRowText: getRowText
|