@react-aria/grid 3.8.9-nightly.4555 → 3.8.9-nightly.4558
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 +252 -0
- package/dist/GridKeyboardDelegate.main.js.map +1 -0
- package/dist/GridKeyboardDelegate.mjs +247 -0
- package/dist/GridKeyboardDelegate.module.js +247 -0
- package/dist/GridKeyboardDelegate.module.js.map +1 -0
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/import.mjs +8 -884
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/main.js +16 -892
- package/dist/main.js.map +1 -1
- package/dist/module.js +8 -884
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/useGrid.main.js +132 -0
- package/dist/useGrid.main.js.map +1 -0
- package/dist/useGrid.mjs +127 -0
- package/dist/useGrid.module.js +127 -0
- package/dist/useGrid.module.js.map +1 -0
- package/dist/useGridCell.main.js +220 -0
- package/dist/useGridCell.main.js.map +1 -0
- package/dist/useGridCell.mjs +215 -0
- package/dist/useGridCell.module.js +215 -0
- package/dist/useGridCell.module.js.map +1 -0
- package/dist/useGridRow.main.js +53 -0
- package/dist/useGridRow.main.js.map +1 -0
- package/dist/useGridRow.mjs +48 -0
- package/dist/useGridRow.module.js +48 -0
- package/dist/useGridRow.module.js.map +1 -0
- package/dist/useGridRowGroup.main.js +26 -0
- package/dist/useGridRowGroup.main.js.map +1 -0
- package/dist/useGridRowGroup.mjs +21 -0
- package/dist/useGridRowGroup.module.js +21 -0
- package/dist/useGridRowGroup.module.js.map +1 -0
- package/dist/useGridSelectionAnnouncement.main.js +94 -0
- package/dist/useGridSelectionAnnouncement.main.js.map +1 -0
- package/dist/useGridSelectionAnnouncement.mjs +89 -0
- package/dist/useGridSelectionAnnouncement.module.js +89 -0
- package/dist/useGridSelectionAnnouncement.module.js.map +1 -0
- package/dist/useGridSelectionCheckbox.main.js +38 -0
- package/dist/useGridSelectionCheckbox.main.js.map +1 -0
- package/dist/useGridSelectionCheckbox.mjs +33 -0
- package/dist/useGridSelectionCheckbox.module.js +33 -0
- package/dist/useGridSelectionCheckbox.module.js.map +1 -0
- package/dist/useHighlightSelectionDescription.main.js +55 -0
- package/dist/useHighlightSelectionDescription.main.js.map +1 -0
- package/dist/useHighlightSelectionDescription.mjs +50 -0
- package/dist/useHighlightSelectionDescription.module.js +50 -0
- package/dist/useHighlightSelectionDescription.module.js.map +1 -0
- package/dist/utils.main.js +20 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +15 -0
- package/dist/utils.module.js +15 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +15 -15
package/dist/module.js
CHANGED
|
@@ -1,633 +1,11 @@
|
|
|
1
|
-
import $
|
|
2
|
-
import $
|
|
3
|
-
import $
|
|
4
|
-
import $
|
|
5
|
-
import $
|
|
6
|
-
import $
|
|
7
|
-
import $
|
|
8
|
-
import $
|
|
9
|
-
import $5cbb62c8a19173ac$exports from "./et-EE.module.js";
|
|
10
|
-
import $a33d71dc804cc59e$exports from "./fi-FI.module.js";
|
|
11
|
-
import $92d800447793d084$exports from "./fr-FR.module.js";
|
|
12
|
-
import $fe732cdb32124ea8$exports from "./he-IL.module.js";
|
|
13
|
-
import $e41234e934efb4f5$exports from "./hr-HR.module.js";
|
|
14
|
-
import $1b0393182473bf9e$exports from "./hu-HU.module.js";
|
|
15
|
-
import $2eed782c1c110ce7$exports from "./it-IT.module.js";
|
|
16
|
-
import $8b5d459f86e9b23c$exports from "./ja-JP.module.js";
|
|
17
|
-
import $1949c3ad17295fd4$exports from "./ko-KR.module.js";
|
|
18
|
-
import $f5e3df4dc8aa7b54$exports from "./lt-LT.module.js";
|
|
19
|
-
import $9dd86690a5c2b2c5$exports from "./lv-LV.module.js";
|
|
20
|
-
import $843964c3bf9a7d24$exports from "./nb-NO.module.js";
|
|
21
|
-
import $73f50e845f9ef3b4$exports from "./nl-NL.module.js";
|
|
22
|
-
import $87f92a7e077514b2$exports from "./pl-PL.module.js";
|
|
23
|
-
import $c28c98d58ee9ff6f$exports from "./pt-BR.module.js";
|
|
24
|
-
import $b6b1503b17b2254d$exports from "./pt-PT.module.js";
|
|
25
|
-
import $8bdaeb71e50c3e1a$exports from "./ro-RO.module.js";
|
|
26
|
-
import $ec2b852dd7c3d1f2$exports from "./ru-RU.module.js";
|
|
27
|
-
import $79e6d900d6a4f82d$exports from "./sk-SK.module.js";
|
|
28
|
-
import $f4c1f0d5d4d03d80$exports from "./sl-SI.module.js";
|
|
29
|
-
import $46252cd87269b10b$exports from "./sr-SP.module.js";
|
|
30
|
-
import $d4d5d8dab362555c$exports from "./sv-SE.module.js";
|
|
31
|
-
import $3d55d1f97c377e83$exports from "./tr-TR.module.js";
|
|
32
|
-
import $5368512f1c703a3f$exports from "./uk-UA.module.js";
|
|
33
|
-
import $f1316b1074463583$exports from "./zh-CN.module.js";
|
|
34
|
-
import $7e60654723031b6f$exports from "./zh-TW.module.js";
|
|
35
|
-
import {getNthItem as $cVkRF$getNthItem, getChildNodes as $cVkRF$getChildNodes, getLastItem as $cVkRF$getLastItem, getFirstItem as $cVkRF$getFirstItem} from "@react-stately/collections";
|
|
36
|
-
import {Rect as $cVkRF$Rect} from "@react-stately/virtualizer";
|
|
37
|
-
import {useId as $cVkRF$useId, filterDOMProps as $cVkRF$filterDOMProps, mergeProps as $cVkRF$mergeProps, useUpdateEffect as $cVkRF$useUpdateEffect, useDescription as $cVkRF$useDescription, chain as $cVkRF$chain, scrollIntoViewport as $cVkRF$scrollIntoViewport, getScrollParent as $cVkRF$getScrollParent} from "@react-aria/utils";
|
|
38
|
-
import {useMemo as $cVkRF$useMemo, useCallback as $cVkRF$useCallback, useRef as $cVkRF$useRef} from "react";
|
|
39
|
-
import {useCollator as $cVkRF$useCollator, useLocale as $cVkRF$useLocale, useLocalizedStringFormatter as $cVkRF$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
40
|
-
import {useHasTabbableChild as $cVkRF$useHasTabbableChild, getFocusableTreeWalker as $cVkRF$getFocusableTreeWalker, focusSafely as $cVkRF$focusSafely} from "@react-aria/focus";
|
|
41
|
-
import {useSelectableCollection as $cVkRF$useSelectableCollection, useSelectableItem as $cVkRF$useSelectableItem} from "@react-aria/selection";
|
|
42
|
-
import {announce as $cVkRF$announce} from "@react-aria/live-announcer";
|
|
43
|
-
import {useInteractionModality as $cVkRF$useInteractionModality, isFocusVisible as $cVkRF$isFocusVisible} from "@react-aria/interactions";
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
function $parcel$interopDefault(a) {
|
|
47
|
-
return a && a.__esModule ? a.default : a;
|
|
48
|
-
}
|
|
49
|
-
/*
|
|
50
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
51
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
52
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
53
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
54
|
-
*
|
|
55
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
56
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
57
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
58
|
-
* governing permissions and limitations under the License.
|
|
59
|
-
*/ /*
|
|
60
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
61
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
62
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
63
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
64
|
-
*
|
|
65
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
66
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
67
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
68
|
-
* governing permissions and limitations under the License.
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
class $d1c300d9c497e402$export$de9feff04fda126e {
|
|
72
|
-
isCell(node) {
|
|
73
|
-
return node.type === "cell";
|
|
74
|
-
}
|
|
75
|
-
isRow(node) {
|
|
76
|
-
return node.type === "row" || node.type === "item";
|
|
77
|
-
}
|
|
78
|
-
isDisabled(item) {
|
|
79
|
-
var _item_props;
|
|
80
|
-
return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
|
|
81
|
-
}
|
|
82
|
-
findPreviousKey(fromKey, pred) {
|
|
83
|
-
let key = fromKey != null ? this.collection.getKeyBefore(fromKey) : this.collection.getLastKey();
|
|
84
|
-
while(key != null){
|
|
85
|
-
let item = this.collection.getItem(key);
|
|
86
|
-
if (!this.isDisabled(item) && (!pred || pred(item))) return key;
|
|
87
|
-
key = this.collection.getKeyBefore(key);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
findNextKey(fromKey, pred) {
|
|
91
|
-
let key = fromKey != null ? this.collection.getKeyAfter(fromKey) : this.collection.getFirstKey();
|
|
92
|
-
while(key != null){
|
|
93
|
-
let item = this.collection.getItem(key);
|
|
94
|
-
if (!this.isDisabled(item) && (!pred || pred(item))) return key;
|
|
95
|
-
key = this.collection.getKeyAfter(key);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
getKeyBelow(key) {
|
|
99
|
-
let startItem = this.collection.getItem(key);
|
|
100
|
-
if (!startItem) return;
|
|
101
|
-
// If focus was on a cell, start searching from the parent row
|
|
102
|
-
if (this.isCell(startItem)) key = startItem.parentKey;
|
|
103
|
-
// Find the next item
|
|
104
|
-
key = this.findNextKey(key);
|
|
105
|
-
if (key != null) {
|
|
106
|
-
// If focus was on a cell, focus the cell with the same index in the next row.
|
|
107
|
-
if (this.isCell(startItem)) {
|
|
108
|
-
let item = this.collection.getItem(key);
|
|
109
|
-
return (0, $cVkRF$getNthItem)((0, $cVkRF$getChildNodes)(item, this.collection), startItem.index).key;
|
|
110
|
-
}
|
|
111
|
-
// Otherwise, focus the next row
|
|
112
|
-
if (this.focusMode === "row") return key;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
getKeyAbove(key) {
|
|
116
|
-
let startItem = this.collection.getItem(key);
|
|
117
|
-
if (!startItem) return;
|
|
118
|
-
// If focus is on a cell, start searching from the parent row
|
|
119
|
-
if (this.isCell(startItem)) key = startItem.parentKey;
|
|
120
|
-
// Find the previous item
|
|
121
|
-
key = this.findPreviousKey(key);
|
|
122
|
-
if (key != null) {
|
|
123
|
-
// If focus was on a cell, focus the cell with the same index in the previous row.
|
|
124
|
-
if (this.isCell(startItem)) {
|
|
125
|
-
let item = this.collection.getItem(key);
|
|
126
|
-
return (0, $cVkRF$getNthItem)((0, $cVkRF$getChildNodes)(item, this.collection), startItem.index).key;
|
|
127
|
-
}
|
|
128
|
-
// Otherwise, focus the previous row
|
|
129
|
-
if (this.focusMode === "row") return key;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
getKeyRightOf(key) {
|
|
133
|
-
let item = this.collection.getItem(key);
|
|
134
|
-
if (!item) return;
|
|
135
|
-
// If focus is on a row, focus the first child cell.
|
|
136
|
-
if (this.isRow(item)) {
|
|
137
|
-
let children = (0, $cVkRF$getChildNodes)(item, this.collection);
|
|
138
|
-
return this.direction === "rtl" ? (0, $cVkRF$getLastItem)(children).key : (0, $cVkRF$getFirstItem)(children).key;
|
|
139
|
-
}
|
|
140
|
-
// If focus is on a cell, focus the next cell if any,
|
|
141
|
-
// otherwise focus the parent row.
|
|
142
|
-
if (this.isCell(item)) {
|
|
143
|
-
let parent = this.collection.getItem(item.parentKey);
|
|
144
|
-
let children = (0, $cVkRF$getChildNodes)(parent, this.collection);
|
|
145
|
-
let next = this.direction === "rtl" ? (0, $cVkRF$getNthItem)(children, item.index - 1) : (0, $cVkRF$getNthItem)(children, item.index + 1);
|
|
146
|
-
if (next) return next.key;
|
|
147
|
-
// focus row only if focusMode is set to row
|
|
148
|
-
if (this.focusMode === "row") return item.parentKey;
|
|
149
|
-
return this.direction === "rtl" ? this.getFirstKey(key) : this.getLastKey(key);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
getKeyLeftOf(key) {
|
|
153
|
-
let item = this.collection.getItem(key);
|
|
154
|
-
if (!item) return;
|
|
155
|
-
// If focus is on a row, focus the last child cell.
|
|
156
|
-
if (this.isRow(item)) {
|
|
157
|
-
let children = (0, $cVkRF$getChildNodes)(item, this.collection);
|
|
158
|
-
return this.direction === "rtl" ? (0, $cVkRF$getFirstItem)(children).key : (0, $cVkRF$getLastItem)(children).key;
|
|
159
|
-
}
|
|
160
|
-
// If focus is on a cell, focus the previous cell if any,
|
|
161
|
-
// otherwise focus the parent row.
|
|
162
|
-
if (this.isCell(item)) {
|
|
163
|
-
let parent = this.collection.getItem(item.parentKey);
|
|
164
|
-
let children = (0, $cVkRF$getChildNodes)(parent, this.collection);
|
|
165
|
-
let prev = this.direction === "rtl" ? (0, $cVkRF$getNthItem)(children, item.index + 1) : (0, $cVkRF$getNthItem)(children, item.index - 1);
|
|
166
|
-
if (prev) return prev.key;
|
|
167
|
-
// focus row only if focusMode is set to row
|
|
168
|
-
if (this.focusMode === "row") return item.parentKey;
|
|
169
|
-
return this.direction === "rtl" ? this.getLastKey(key) : this.getFirstKey(key);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
getFirstKey(key, global) {
|
|
173
|
-
let item;
|
|
174
|
-
if (key != null) {
|
|
175
|
-
item = this.collection.getItem(key);
|
|
176
|
-
if (!item) return;
|
|
177
|
-
// If global flag is not set, and a cell is currently focused,
|
|
178
|
-
// move focus to the first cell in the parent row.
|
|
179
|
-
if (this.isCell(item) && !global) {
|
|
180
|
-
let parent = this.collection.getItem(item.parentKey);
|
|
181
|
-
return (0, $cVkRF$getFirstItem)((0, $cVkRF$getChildNodes)(parent, this.collection)).key;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
// Find the first row
|
|
185
|
-
key = this.findNextKey();
|
|
186
|
-
// If global flag is set (or if focus mode is cell), focus the first cell in the first row.
|
|
187
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode === "cell") {
|
|
188
|
-
let item = this.collection.getItem(key);
|
|
189
|
-
key = (0, $cVkRF$getFirstItem)((0, $cVkRF$getChildNodes)(item, this.collection)).key;
|
|
190
|
-
}
|
|
191
|
-
// Otherwise, focus the row itself.
|
|
192
|
-
return key;
|
|
193
|
-
}
|
|
194
|
-
getLastKey(key, global) {
|
|
195
|
-
let item;
|
|
196
|
-
if (key != null) {
|
|
197
|
-
item = this.collection.getItem(key);
|
|
198
|
-
if (!item) return;
|
|
199
|
-
// If global flag is not set, and a cell is currently focused,
|
|
200
|
-
// move focus to the last cell in the parent row.
|
|
201
|
-
if (this.isCell(item) && !global) {
|
|
202
|
-
let parent = this.collection.getItem(item.parentKey);
|
|
203
|
-
let children = (0, $cVkRF$getChildNodes)(parent, this.collection);
|
|
204
|
-
return (0, $cVkRF$getLastItem)(children).key;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// Find the last row
|
|
208
|
-
key = this.findPreviousKey();
|
|
209
|
-
// If global flag is set (or if focus mode is cell), focus the last cell in the last row.
|
|
210
|
-
if (key != null && item && this.isCell(item) && global || this.focusMode === "cell") {
|
|
211
|
-
let item = this.collection.getItem(key);
|
|
212
|
-
let children = (0, $cVkRF$getChildNodes)(item, this.collection);
|
|
213
|
-
key = (0, $cVkRF$getLastItem)(children).key;
|
|
214
|
-
}
|
|
215
|
-
// Otherwise, focus the row itself.
|
|
216
|
-
return key;
|
|
217
|
-
}
|
|
218
|
-
getItem(key) {
|
|
219
|
-
return this.ref.current.querySelector(`[data-key="${CSS.escape(key.toString())}"]`);
|
|
220
|
-
}
|
|
221
|
-
getItemRect(key) {
|
|
222
|
-
var _this_layout_getLayoutInfo;
|
|
223
|
-
if (this.layout) return (_this_layout_getLayoutInfo = this.layout.getLayoutInfo(key)) === null || _this_layout_getLayoutInfo === void 0 ? void 0 : _this_layout_getLayoutInfo.rect;
|
|
224
|
-
let item = this.getItem(key);
|
|
225
|
-
if (item) return new (0, $cVkRF$Rect)(item.offsetLeft, item.offsetTop, item.offsetWidth, item.offsetHeight);
|
|
226
|
-
}
|
|
227
|
-
getPageHeight() {
|
|
228
|
-
var _this_layout_virtualizer, _this_ref_current, _this_ref;
|
|
229
|
-
if (this.layout) return (_this_layout_virtualizer = this.layout.virtualizer) === null || _this_layout_virtualizer === void 0 ? void 0 : _this_layout_virtualizer.visibleRect.height;
|
|
230
|
-
return (_this_ref = this.ref) === null || _this_ref === void 0 ? void 0 : (_this_ref_current = _this_ref.current) === null || _this_ref_current === void 0 ? void 0 : _this_ref_current.offsetHeight;
|
|
231
|
-
}
|
|
232
|
-
getContentHeight() {
|
|
233
|
-
var _this_ref_current, _this_ref;
|
|
234
|
-
if (this.layout) return this.layout.getContentSize().height;
|
|
235
|
-
return (_this_ref = this.ref) === null || _this_ref === void 0 ? void 0 : (_this_ref_current = _this_ref.current) === null || _this_ref_current === void 0 ? void 0 : _this_ref_current.scrollHeight;
|
|
236
|
-
}
|
|
237
|
-
getKeyPageAbove(key) {
|
|
238
|
-
let itemRect = this.getItemRect(key);
|
|
239
|
-
if (!itemRect) return null;
|
|
240
|
-
let pageY = Math.max(0, itemRect.maxY - this.getPageHeight());
|
|
241
|
-
while(itemRect && itemRect.y > pageY){
|
|
242
|
-
key = this.getKeyAbove(key);
|
|
243
|
-
itemRect = this.getItemRect(key);
|
|
244
|
-
}
|
|
245
|
-
return key;
|
|
246
|
-
}
|
|
247
|
-
getKeyPageBelow(key) {
|
|
248
|
-
let itemRect = this.getItemRect(key);
|
|
249
|
-
if (!itemRect) return null;
|
|
250
|
-
let pageHeight = this.getPageHeight();
|
|
251
|
-
let pageY = Math.min(this.getContentHeight(), itemRect.y + pageHeight);
|
|
252
|
-
while(itemRect && itemRect.maxY < pageY){
|
|
253
|
-
let nextKey = this.getKeyBelow(key);
|
|
254
|
-
itemRect = this.getItemRect(nextKey);
|
|
255
|
-
// Guard against case where maxY of the last key is barely less than pageY due to rounding
|
|
256
|
-
// and thus it attempts to set key to null
|
|
257
|
-
if (nextKey != null) key = nextKey;
|
|
258
|
-
}
|
|
259
|
-
return key;
|
|
260
|
-
}
|
|
261
|
-
getKeyForSearch(search, fromKey) {
|
|
262
|
-
if (!this.collator) return null;
|
|
263
|
-
let collection = this.collection;
|
|
264
|
-
let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
|
|
265
|
-
// If the starting key is a cell, search from its parent row.
|
|
266
|
-
let startItem = collection.getItem(key);
|
|
267
|
-
if (startItem.type === "cell") key = startItem.parentKey;
|
|
268
|
-
let hasWrapped = false;
|
|
269
|
-
while(key != null){
|
|
270
|
-
let item = collection.getItem(key);
|
|
271
|
-
// check row text value for match
|
|
272
|
-
if (item.textValue) {
|
|
273
|
-
let substring = item.textValue.slice(0, search.length);
|
|
274
|
-
if (this.collator.compare(substring, search) === 0) {
|
|
275
|
-
if (this.isRow(item) && this.focusMode === "cell") return (0, $cVkRF$getFirstItem)((0, $cVkRF$getChildNodes)(item, this.collection)).key;
|
|
276
|
-
return item.key;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
key = this.findNextKey(key);
|
|
280
|
-
// Wrap around when reaching the end of the collection
|
|
281
|
-
if (key == null && !hasWrapped) {
|
|
282
|
-
key = this.getFirstKey();
|
|
283
|
-
hasWrapped = true;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
constructor(options){
|
|
289
|
-
this.collection = options.collection;
|
|
290
|
-
this.disabledKeys = options.disabledKeys;
|
|
291
|
-
this.disabledBehavior = options.disabledBehavior || "all";
|
|
292
|
-
this.ref = options.ref;
|
|
293
|
-
this.direction = options.direction;
|
|
294
|
-
this.collator = options.collator;
|
|
295
|
-
this.layout = options.layout;
|
|
296
|
-
this.focusMode = options.focusMode || "row";
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
/*
|
|
302
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
303
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
304
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
305
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
306
|
-
*
|
|
307
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
308
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
309
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
310
|
-
* governing permissions and limitations under the License.
|
|
311
|
-
*/
|
|
312
|
-
|
|
313
|
-
/*
|
|
314
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
315
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
316
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
317
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
318
|
-
*
|
|
319
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
320
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
321
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
322
|
-
* governing permissions and limitations under the License.
|
|
323
|
-
*/ const $1af922eb41e03c8f$export$e6235c0d09b995d0 = new WeakMap();
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
/*
|
|
329
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
330
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
331
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
332
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
333
|
-
*
|
|
334
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
335
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
336
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
337
|
-
* governing permissions and limitations under the License.
|
|
338
|
-
*/
|
|
339
|
-
var $835c96616a7cb4f9$exports = {};
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
$835c96616a7cb4f9$exports = {
|
|
375
|
-
"ar-AE": $682989befd4f478d$exports,
|
|
376
|
-
"bg-BG": $f7fca02019afd941$exports,
|
|
377
|
-
"cs-CZ": $8f86f40be75387f1$exports,
|
|
378
|
-
"da-DK": $db24ba43c8d652ee$exports,
|
|
379
|
-
"de-DE": $f8f1e72c8b5447d6$exports,
|
|
380
|
-
"el-GR": $9a73ed2983c3ab0b$exports,
|
|
381
|
-
"en-US": $583de0b3587601b9$exports,
|
|
382
|
-
"es-ES": $147159c978043442$exports,
|
|
383
|
-
"et-EE": $5cbb62c8a19173ac$exports,
|
|
384
|
-
"fi-FI": $a33d71dc804cc59e$exports,
|
|
385
|
-
"fr-FR": $92d800447793d084$exports,
|
|
386
|
-
"he-IL": $fe732cdb32124ea8$exports,
|
|
387
|
-
"hr-HR": $e41234e934efb4f5$exports,
|
|
388
|
-
"hu-HU": $1b0393182473bf9e$exports,
|
|
389
|
-
"it-IT": $2eed782c1c110ce7$exports,
|
|
390
|
-
"ja-JP": $8b5d459f86e9b23c$exports,
|
|
391
|
-
"ko-KR": $1949c3ad17295fd4$exports,
|
|
392
|
-
"lt-LT": $f5e3df4dc8aa7b54$exports,
|
|
393
|
-
"lv-LV": $9dd86690a5c2b2c5$exports,
|
|
394
|
-
"nb-NO": $843964c3bf9a7d24$exports,
|
|
395
|
-
"nl-NL": $73f50e845f9ef3b4$exports,
|
|
396
|
-
"pl-PL": $87f92a7e077514b2$exports,
|
|
397
|
-
"pt-BR": $c28c98d58ee9ff6f$exports,
|
|
398
|
-
"pt-PT": $b6b1503b17b2254d$exports,
|
|
399
|
-
"ro-RO": $8bdaeb71e50c3e1a$exports,
|
|
400
|
-
"ru-RU": $ec2b852dd7c3d1f2$exports,
|
|
401
|
-
"sk-SK": $79e6d900d6a4f82d$exports,
|
|
402
|
-
"sl-SI": $f4c1f0d5d4d03d80$exports,
|
|
403
|
-
"sr-SP": $46252cd87269b10b$exports,
|
|
404
|
-
"sv-SE": $d4d5d8dab362555c$exports,
|
|
405
|
-
"tr-TR": $3d55d1f97c377e83$exports,
|
|
406
|
-
"uk-UA": $5368512f1c703a3f$exports,
|
|
407
|
-
"zh-CN": $f1316b1074463583$exports,
|
|
408
|
-
"zh-TW": $7e60654723031b6f$exports
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
function $92599c3fd427b763$export$137e594ef3218a10(props, state) {
|
|
416
|
-
let { getRowText: getRowText = (key)=>{
|
|
417
|
-
var _state_collection_getTextValue, _state_collection, _state_collection_getItem;
|
|
418
|
-
var _state_collection_getTextValue1;
|
|
419
|
-
return (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : (_state_collection_getItem = state.collection.getItem(key)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.textValue;
|
|
420
|
-
} } = props;
|
|
421
|
-
let stringFormatter = (0, $cVkRF$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($835c96616a7cb4f9$exports))), "@react-aria/grid");
|
|
422
|
-
// Many screen readers do not announce when items in a grid are selected/deselected.
|
|
423
|
-
// We do this using an ARIA live region.
|
|
424
|
-
let selection = state.selectionManager.rawSelection;
|
|
425
|
-
let lastSelection = (0, $cVkRF$useRef)(selection);
|
|
426
|
-
(0, $cVkRF$useUpdateEffect)(()=>{
|
|
427
|
-
var _lastSelection_current;
|
|
428
|
-
if (!state.selectionManager.isFocused) {
|
|
429
|
-
lastSelection.current = selection;
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
let addedKeys = $92599c3fd427b763$var$diffSelection(selection, lastSelection.current);
|
|
433
|
-
let removedKeys = $92599c3fd427b763$var$diffSelection(lastSelection.current, selection);
|
|
434
|
-
// If adding or removing a single row from the selection, announce the name of that item.
|
|
435
|
-
let isReplace = state.selectionManager.selectionBehavior === "replace";
|
|
436
|
-
let messages = [];
|
|
437
|
-
if (state.selectionManager.selectedKeys.size === 1 && isReplace) {
|
|
438
|
-
if (state.collection.getItem(state.selectionManager.selectedKeys.keys().next().value)) {
|
|
439
|
-
let currentSelectionText = getRowText(state.selectionManager.selectedKeys.keys().next().value);
|
|
440
|
-
if (currentSelectionText) messages.push(stringFormatter.format("selectedItem", {
|
|
441
|
-
item: currentSelectionText
|
|
442
|
-
}));
|
|
443
|
-
}
|
|
444
|
-
} else if (addedKeys.size === 1 && removedKeys.size === 0) {
|
|
445
|
-
let addedText = getRowText(addedKeys.keys().next().value);
|
|
446
|
-
if (addedText) messages.push(stringFormatter.format("selectedItem", {
|
|
447
|
-
item: addedText
|
|
448
|
-
}));
|
|
449
|
-
} else if (removedKeys.size === 1 && addedKeys.size === 0) {
|
|
450
|
-
if (state.collection.getItem(removedKeys.keys().next().value)) {
|
|
451
|
-
let removedText = getRowText(removedKeys.keys().next().value);
|
|
452
|
-
if (removedText) messages.push(stringFormatter.format("deselectedItem", {
|
|
453
|
-
item: removedText
|
|
454
|
-
}));
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
// Announce how many items are selected, except when selecting the first item.
|
|
458
|
-
if (state.selectionManager.selectionMode === "multiple") {
|
|
459
|
-
if (messages.length === 0 || selection === "all" || selection.size > 1 || lastSelection.current === "all" || ((_lastSelection_current = lastSelection.current) === null || _lastSelection_current === void 0 ? void 0 : _lastSelection_current.size) > 1) messages.push(selection === "all" ? stringFormatter.format("selectedAll") : stringFormatter.format("selectedCount", {
|
|
460
|
-
count: selection.size
|
|
461
|
-
}));
|
|
462
|
-
}
|
|
463
|
-
if (messages.length > 0) (0, $cVkRF$announce)(messages.join(" "));
|
|
464
|
-
lastSelection.current = selection;
|
|
465
|
-
}, [
|
|
466
|
-
selection
|
|
467
|
-
]);
|
|
468
|
-
}
|
|
469
|
-
function $92599c3fd427b763$var$diffSelection(a, b) {
|
|
470
|
-
let res = new Set();
|
|
471
|
-
if (a === "all" || b === "all") return res;
|
|
472
|
-
for (let key of a.keys())if (!b.has(key)) res.add(key);
|
|
473
|
-
return res;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
/*
|
|
479
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
480
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
481
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
482
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
483
|
-
*
|
|
484
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
485
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
486
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
487
|
-
* governing permissions and limitations under the License.
|
|
488
|
-
*/
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
function $5b9b5b5723db6ae1$export$be42ebdab07ae4c2(props) {
|
|
494
|
-
let stringFormatter = (0, $cVkRF$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($835c96616a7cb4f9$exports))), "@react-aria/grid");
|
|
495
|
-
let modality = (0, $cVkRF$useInteractionModality)();
|
|
496
|
-
// null is the default if the user hasn't interacted with the table at all yet or the rest of the page
|
|
497
|
-
let shouldLongPress = (modality === "pointer" || modality === "virtual" || modality == null) && typeof window !== "undefined" && "ontouchstart" in window;
|
|
498
|
-
let interactionDescription = (0, $cVkRF$useMemo)(()=>{
|
|
499
|
-
let selectionMode = props.selectionManager.selectionMode;
|
|
500
|
-
let selectionBehavior = props.selectionManager.selectionBehavior;
|
|
501
|
-
let message = undefined;
|
|
502
|
-
if (shouldLongPress) message = stringFormatter.format("longPressToSelect");
|
|
503
|
-
return selectionBehavior === "replace" && selectionMode !== "none" && props.hasItemActions ? message : undefined;
|
|
504
|
-
}, [
|
|
505
|
-
props.selectionManager.selectionMode,
|
|
506
|
-
props.selectionManager.selectionBehavior,
|
|
507
|
-
props.hasItemActions,
|
|
508
|
-
stringFormatter,
|
|
509
|
-
shouldLongPress
|
|
510
|
-
]);
|
|
511
|
-
let descriptionProps = (0, $cVkRF$useDescription)(interactionDescription);
|
|
512
|
-
return descriptionProps;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
|
|
518
|
-
let { isVirtualized: isVirtualized, keyboardDelegate: keyboardDelegate, focusMode: focusMode, scrollRef: scrollRef, getRowText: getRowText, onRowAction: onRowAction, onCellAction: onCellAction } = props;
|
|
519
|
-
let { selectionManager: manager } = state;
|
|
520
|
-
if (!props["aria-label"] && !props["aria-labelledby"]) console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
|
|
521
|
-
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
522
|
-
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
523
|
-
let collator = (0, $cVkRF$useCollator)({
|
|
524
|
-
usage: "search",
|
|
525
|
-
sensitivity: "base"
|
|
526
|
-
});
|
|
527
|
-
let { direction: direction } = (0, $cVkRF$useLocale)();
|
|
528
|
-
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
529
|
-
let delegate = (0, $cVkRF$useMemo)(()=>keyboardDelegate || new (0, $d1c300d9c497e402$export$de9feff04fda126e)({
|
|
530
|
-
collection: state.collection,
|
|
531
|
-
disabledKeys: state.disabledKeys,
|
|
532
|
-
disabledBehavior: disabledBehavior,
|
|
533
|
-
ref: ref,
|
|
534
|
-
direction: direction,
|
|
535
|
-
collator: collator,
|
|
536
|
-
focusMode: focusMode
|
|
537
|
-
}), [
|
|
538
|
-
keyboardDelegate,
|
|
539
|
-
state.collection,
|
|
540
|
-
state.disabledKeys,
|
|
541
|
-
disabledBehavior,
|
|
542
|
-
ref,
|
|
543
|
-
direction,
|
|
544
|
-
collator,
|
|
545
|
-
focusMode
|
|
546
|
-
]);
|
|
547
|
-
let { collectionProps: collectionProps } = (0, $cVkRF$useSelectableCollection)({
|
|
548
|
-
ref: ref,
|
|
549
|
-
selectionManager: manager,
|
|
550
|
-
keyboardDelegate: delegate,
|
|
551
|
-
isVirtualized: isVirtualized,
|
|
552
|
-
scrollRef: scrollRef
|
|
553
|
-
});
|
|
554
|
-
let id = (0, $cVkRF$useId)(props.id);
|
|
555
|
-
(0, $1af922eb41e03c8f$export$e6235c0d09b995d0).set(state, {
|
|
556
|
-
keyboardDelegate: delegate,
|
|
557
|
-
actions: {
|
|
558
|
-
onRowAction: onRowAction,
|
|
559
|
-
onCellAction: onCellAction
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
let descriptionProps = (0, $5b9b5b5723db6ae1$export$be42ebdab07ae4c2)({
|
|
563
|
-
selectionManager: manager,
|
|
564
|
-
hasItemActions: !!(onRowAction || onCellAction)
|
|
565
|
-
});
|
|
566
|
-
let domProps = (0, $cVkRF$filterDOMProps)(props, {
|
|
567
|
-
labelable: true
|
|
568
|
-
});
|
|
569
|
-
let onFocus = (0, $cVkRF$useCallback)((e)=>{
|
|
570
|
-
if (manager.isFocused) {
|
|
571
|
-
// If a focus event bubbled through a portal, reset focus state.
|
|
572
|
-
if (!e.currentTarget.contains(e.target)) manager.setFocused(false);
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
// Focus events can bubble through portals. Ignore these events.
|
|
576
|
-
if (!e.currentTarget.contains(e.target)) return;
|
|
577
|
-
manager.setFocused(true);
|
|
578
|
-
}, [
|
|
579
|
-
manager
|
|
580
|
-
]);
|
|
581
|
-
// Continue to track collection focused state even if keyboard navigation is disabled
|
|
582
|
-
let navDisabledHandlers = (0, $cVkRF$useMemo)(()=>({
|
|
583
|
-
onBlur: collectionProps.onBlur,
|
|
584
|
-
onFocus: onFocus
|
|
585
|
-
}), [
|
|
586
|
-
onFocus,
|
|
587
|
-
collectionProps.onBlur
|
|
588
|
-
]);
|
|
589
|
-
let hasTabbableChild = (0, $cVkRF$useHasTabbableChild)(ref, {
|
|
590
|
-
isDisabled: state.collection.size !== 0
|
|
591
|
-
});
|
|
592
|
-
let gridProps = (0, $cVkRF$mergeProps)(domProps, {
|
|
593
|
-
role: "grid",
|
|
594
|
-
id: id,
|
|
595
|
-
"aria-multiselectable": manager.selectionMode === "multiple" ? "true" : undefined
|
|
596
|
-
}, state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps, // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
|
|
597
|
-
state.collection.size === 0 && {
|
|
598
|
-
tabIndex: hasTabbableChild ? -1 : 0
|
|
599
|
-
}, descriptionProps);
|
|
600
|
-
if (isVirtualized) {
|
|
601
|
-
gridProps["aria-rowcount"] = state.collection.size;
|
|
602
|
-
gridProps["aria-colcount"] = state.collection.columnCount;
|
|
603
|
-
}
|
|
604
|
-
(0, $92599c3fd427b763$export$137e594ef3218a10)({
|
|
605
|
-
getRowText: getRowText
|
|
606
|
-
}, state);
|
|
607
|
-
return {
|
|
608
|
-
gridProps: gridProps
|
|
609
|
-
};
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
/*
|
|
614
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
615
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
616
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
617
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
618
|
-
*
|
|
619
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
620
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
621
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
622
|
-
* governing permissions and limitations under the License.
|
|
623
|
-
*/ function $e45487f8ba1cbdbf$export$d3037f5d3f3e51bf() {
|
|
624
|
-
return {
|
|
625
|
-
rowGroupProps: {
|
|
626
|
-
role: "rowgroup"
|
|
627
|
-
}
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
|
|
1
|
+
import {GridKeyboardDelegate as $d1c300d9c497e402$export$de9feff04fda126e} from "./GridKeyboardDelegate.module.js";
|
|
2
|
+
import {useGrid as $83c6e2eafa584c67$export$f6b86a04e5d66d90} from "./useGrid.module.js";
|
|
3
|
+
import {useGridRowGroup as $e45487f8ba1cbdbf$export$d3037f5d3f3e51bf} from "./useGridRowGroup.module.js";
|
|
4
|
+
import {useGridRow as $4159a7a9cbb0cc18$export$96357d5a73f686fa} from "./useGridRow.module.js";
|
|
5
|
+
import {useGridCell as $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c} from "./useGridCell.module.js";
|
|
6
|
+
import {useGridSelectionCheckbox as $7cb39d07f245a780$export$70e2eed1a92976ad} from "./useGridSelectionCheckbox.module.js";
|
|
7
|
+
import {useHighlightSelectionDescription as $5b9b5b5723db6ae1$export$be42ebdab07ae4c2} from "./useHighlightSelectionDescription.module.js";
|
|
8
|
+
import {useGridSelectionAnnouncement as $92599c3fd427b763$export$137e594ef3218a10} from "./useGridSelectionAnnouncement.module.js";
|
|
631
9
|
|
|
632
10
|
/*
|
|
633
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -642,261 +20,7 @@ function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
|
|
|
642
20
|
*/
|
|
643
21
|
|
|
644
22
|
|
|
645
|
-
function $4159a7a9cbb0cc18$export$96357d5a73f686fa(props, state, ref) {
|
|
646
|
-
var _node_props, _node_props1;
|
|
647
|
-
let { node: node, isVirtualized: isVirtualized, shouldSelectOnPressUp: shouldSelectOnPressUp, onAction: onAction } = props;
|
|
648
|
-
let { actions: actions } = (0, $1af922eb41e03c8f$export$e6235c0d09b995d0).get(state);
|
|
649
|
-
let onRowAction = actions.onRowAction ? ()=>actions.onRowAction(node.key) : onAction;
|
|
650
|
-
let { itemProps: itemProps, ...states } = (0, $cVkRF$useSelectableItem)({
|
|
651
|
-
selectionManager: state.selectionManager,
|
|
652
|
-
key: node.key,
|
|
653
|
-
ref: ref,
|
|
654
|
-
isVirtualized: isVirtualized,
|
|
655
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
656
|
-
onAction: onRowAction || (node === null || node === void 0 ? void 0 : (_node_props = node.props) === null || _node_props === void 0 ? void 0 : _node_props.onAction) ? (0, $cVkRF$chain)(node === null || node === void 0 ? void 0 : (_node_props1 = node.props) === null || _node_props1 === void 0 ? void 0 : _node_props1.onAction, onRowAction) : undefined,
|
|
657
|
-
isDisabled: state.collection.size === 0
|
|
658
|
-
});
|
|
659
|
-
let isSelected = state.selectionManager.isSelected(node.key);
|
|
660
|
-
let rowProps = {
|
|
661
|
-
role: "row",
|
|
662
|
-
"aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : undefined,
|
|
663
|
-
"aria-disabled": states.isDisabled || undefined,
|
|
664
|
-
...itemProps
|
|
665
|
-
};
|
|
666
|
-
if (isVirtualized) rowProps["aria-rowindex"] = node.index + 1; // aria-rowindex is 1 based
|
|
667
|
-
return {
|
|
668
|
-
rowProps: rowProps,
|
|
669
|
-
...states
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
/*
|
|
675
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
676
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
677
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
678
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
679
|
-
*
|
|
680
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
681
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
682
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
683
|
-
* governing permissions and limitations under the License.
|
|
684
|
-
*/
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
function $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c(props, state, ref) {
|
|
692
|
-
let { node: node, isVirtualized: isVirtualized, focusMode: focusMode = "child", shouldSelectOnPressUp: shouldSelectOnPressUp, onAction: onAction } = props;
|
|
693
|
-
let { direction: direction } = (0, $cVkRF$useLocale)();
|
|
694
|
-
let { keyboardDelegate: keyboardDelegate, actions: { onCellAction: onCellAction } } = (0, $1af922eb41e03c8f$export$e6235c0d09b995d0).get(state);
|
|
695
|
-
// We need to track the key of the item at the time it was last focused so that we force
|
|
696
|
-
// focus to go to the item when the DOM node is reused for a different item in a virtualizer.
|
|
697
|
-
let keyWhenFocused = (0, $cVkRF$useRef)(null);
|
|
698
|
-
// Handles focusing the cell. If there is a focusable child,
|
|
699
|
-
// it is focused, otherwise the cell itself is focused.
|
|
700
|
-
let focus = ()=>{
|
|
701
|
-
let treeWalker = (0, $cVkRF$getFocusableTreeWalker)(ref.current);
|
|
702
|
-
if (focusMode === "child") {
|
|
703
|
-
// If focus is already on a focusable child within the cell, early return so we don't shift focus
|
|
704
|
-
if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement) return;
|
|
705
|
-
let focusable = state.selectionManager.childFocusStrategy === "last" ? $ab90dcbc1b5466d0$var$last(treeWalker) : treeWalker.firstChild();
|
|
706
|
-
if (focusable) {
|
|
707
|
-
(0, $cVkRF$focusSafely)(focusable);
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
if (keyWhenFocused.current != null && node.key !== keyWhenFocused.current || !ref.current.contains(document.activeElement)) (0, $cVkRF$focusSafely)(ref.current);
|
|
712
|
-
};
|
|
713
|
-
let { itemProps: itemProps, isPressed: isPressed } = (0, $cVkRF$useSelectableItem)({
|
|
714
|
-
selectionManager: state.selectionManager,
|
|
715
|
-
key: node.key,
|
|
716
|
-
ref: ref,
|
|
717
|
-
isVirtualized: isVirtualized,
|
|
718
|
-
focus: focus,
|
|
719
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
720
|
-
onAction: onCellAction ? ()=>onCellAction(node.key) : onAction,
|
|
721
|
-
isDisabled: state.collection.size === 0
|
|
722
|
-
});
|
|
723
|
-
let onKeyDownCapture = (e)=>{
|
|
724
|
-
if (!e.currentTarget.contains(e.target) || state.isKeyboardNavigationDisabled) return;
|
|
725
|
-
let walker = (0, $cVkRF$getFocusableTreeWalker)(ref.current);
|
|
726
|
-
walker.currentNode = document.activeElement;
|
|
727
|
-
switch(e.key){
|
|
728
|
-
case "ArrowLeft":
|
|
729
|
-
{
|
|
730
|
-
// Find the next focusable element within the cell.
|
|
731
|
-
let focusable = direction === "rtl" ? walker.nextNode() : walker.previousNode();
|
|
732
|
-
// Don't focus the cell itself if focusMode is "child"
|
|
733
|
-
if (focusMode === "child" && focusable === ref.current) focusable = null;
|
|
734
|
-
e.preventDefault();
|
|
735
|
-
e.stopPropagation();
|
|
736
|
-
if (focusable) {
|
|
737
|
-
(0, $cVkRF$focusSafely)(focusable);
|
|
738
|
-
(0, $cVkRF$scrollIntoViewport)(focusable, {
|
|
739
|
-
containingElement: (0, $cVkRF$getScrollParent)(ref.current)
|
|
740
|
-
});
|
|
741
|
-
} else {
|
|
742
|
-
// If there is no next focusable child, then move to the next cell to the left of this one.
|
|
743
|
-
// This will be handled by useSelectableCollection. However, if there is no cell to the left
|
|
744
|
-
// of this one, only one column, and the grid doesn't focus rows, then the next key will be the
|
|
745
|
-
// same as this one. In that case we need to handle focusing either the cell or the first/last
|
|
746
|
-
// child, depending on the focus mode.
|
|
747
|
-
let prev = keyboardDelegate.getKeyLeftOf(node.key);
|
|
748
|
-
if (prev !== node.key) {
|
|
749
|
-
// We prevent the capturing event from reaching children of the cell, e.g. pickers.
|
|
750
|
-
// We want arrow keys to navigate to the next cell instead. We need to re-dispatch
|
|
751
|
-
// the event from a higher parent so it still bubbles and gets handled by useSelectableCollection.
|
|
752
|
-
ref.current.parentElement.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
if (focusMode === "cell" && direction === "rtl") {
|
|
756
|
-
(0, $cVkRF$focusSafely)(ref.current);
|
|
757
|
-
(0, $cVkRF$scrollIntoViewport)(ref.current, {
|
|
758
|
-
containingElement: (0, $cVkRF$getScrollParent)(ref.current)
|
|
759
|
-
});
|
|
760
|
-
} else {
|
|
761
|
-
walker.currentNode = ref.current;
|
|
762
|
-
focusable = direction === "rtl" ? walker.firstChild() : $ab90dcbc1b5466d0$var$last(walker);
|
|
763
|
-
if (focusable) {
|
|
764
|
-
(0, $cVkRF$focusSafely)(focusable);
|
|
765
|
-
(0, $cVkRF$scrollIntoViewport)(focusable, {
|
|
766
|
-
containingElement: (0, $cVkRF$getScrollParent)(ref.current)
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
break;
|
|
772
|
-
}
|
|
773
|
-
case "ArrowRight":
|
|
774
|
-
{
|
|
775
|
-
let focusable = direction === "rtl" ? walker.previousNode() : walker.nextNode();
|
|
776
|
-
if (focusMode === "child" && focusable === ref.current) focusable = null;
|
|
777
|
-
e.preventDefault();
|
|
778
|
-
e.stopPropagation();
|
|
779
|
-
if (focusable) {
|
|
780
|
-
(0, $cVkRF$focusSafely)(focusable);
|
|
781
|
-
(0, $cVkRF$scrollIntoViewport)(focusable, {
|
|
782
|
-
containingElement: (0, $cVkRF$getScrollParent)(ref.current)
|
|
783
|
-
});
|
|
784
|
-
} else {
|
|
785
|
-
let next = keyboardDelegate.getKeyRightOf(node.key);
|
|
786
|
-
if (next !== node.key) {
|
|
787
|
-
// We prevent the capturing event from reaching children of the cell, e.g. pickers.
|
|
788
|
-
// We want arrow keys to navigate to the next cell instead. We need to re-dispatch
|
|
789
|
-
// the event from a higher parent so it still bubbles and gets handled by useSelectableCollection.
|
|
790
|
-
ref.current.parentElement.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
if (focusMode === "cell" && direction === "ltr") {
|
|
794
|
-
(0, $cVkRF$focusSafely)(ref.current);
|
|
795
|
-
(0, $cVkRF$scrollIntoViewport)(ref.current, {
|
|
796
|
-
containingElement: (0, $cVkRF$getScrollParent)(ref.current)
|
|
797
|
-
});
|
|
798
|
-
} else {
|
|
799
|
-
walker.currentNode = ref.current;
|
|
800
|
-
focusable = direction === "rtl" ? $ab90dcbc1b5466d0$var$last(walker) : walker.firstChild();
|
|
801
|
-
if (focusable) {
|
|
802
|
-
(0, $cVkRF$focusSafely)(focusable);
|
|
803
|
-
(0, $cVkRF$scrollIntoViewport)(focusable, {
|
|
804
|
-
containingElement: (0, $cVkRF$getScrollParent)(ref.current)
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
break;
|
|
810
|
-
}
|
|
811
|
-
case "ArrowUp":
|
|
812
|
-
case "ArrowDown":
|
|
813
|
-
// Prevent this event from reaching cell children, e.g. menu buttons. We want arrow keys to navigate
|
|
814
|
-
// to the cell above/below instead. We need to re-dispatch the event from a higher parent so it still
|
|
815
|
-
// bubbles and gets handled by useSelectableCollection.
|
|
816
|
-
if (!e.altKey && ref.current.contains(e.target)) {
|
|
817
|
-
e.stopPropagation();
|
|
818
|
-
e.preventDefault();
|
|
819
|
-
ref.current.parentElement.dispatchEvent(new KeyboardEvent(e.nativeEvent.type, e.nativeEvent));
|
|
820
|
-
}
|
|
821
|
-
break;
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
// Grid cells can have focusable elements inside them. In this case, focus should
|
|
825
|
-
// be marshalled to that element rather than focusing the cell itself.
|
|
826
|
-
let onFocus = (e)=>{
|
|
827
|
-
keyWhenFocused.current = node.key;
|
|
828
|
-
if (e.target !== ref.current) {
|
|
829
|
-
// useSelectableItem only handles setting the focused key when
|
|
830
|
-
// the focused element is the gridcell itself. We also want to
|
|
831
|
-
// set the focused key when a child element receives focus.
|
|
832
|
-
// If focus is currently visible (e.g. the user is navigating with the keyboard),
|
|
833
|
-
// then skip this. We want to restore focus to the previously focused row/cell
|
|
834
|
-
// in that case since the table should act like a single tab stop.
|
|
835
|
-
if (!(0, $cVkRF$isFocusVisible)()) state.selectionManager.setFocusedKey(node.key);
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
// If the cell itself is focused, wait a frame so that focus finishes propagatating
|
|
839
|
-
// up to the tree, and move focus to a focusable child if possible.
|
|
840
|
-
requestAnimationFrame(()=>{
|
|
841
|
-
if (focusMode === "child" && document.activeElement === ref.current) focus();
|
|
842
|
-
});
|
|
843
|
-
};
|
|
844
|
-
let gridCellProps = (0, $cVkRF$mergeProps)(itemProps, {
|
|
845
|
-
role: "gridcell",
|
|
846
|
-
onKeyDownCapture: onKeyDownCapture,
|
|
847
|
-
onFocus: onFocus
|
|
848
|
-
});
|
|
849
|
-
var _node_colIndex;
|
|
850
|
-
if (isVirtualized) gridCellProps["aria-colindex"] = ((_node_colIndex = node.colIndex) !== null && _node_colIndex !== void 0 ? _node_colIndex : node.index) + 1; // aria-colindex is 1-based
|
|
851
|
-
// When pressing with a pointer and cell selection is not enabled, usePress will be applied to the
|
|
852
|
-
// row rather than the cell. However, when the row is draggable, usePress cannot preventDefault
|
|
853
|
-
// on pointer down, so the browser will try to focus the cell which has a tabIndex applied.
|
|
854
|
-
// To avoid this, remove the tabIndex from the cell briefly on pointer down.
|
|
855
|
-
if (shouldSelectOnPressUp && gridCellProps.tabIndex != null && gridCellProps.onPointerDown == null) gridCellProps.onPointerDown = (e)=>{
|
|
856
|
-
let el = e.currentTarget;
|
|
857
|
-
let tabindex = el.getAttribute("tabindex");
|
|
858
|
-
el.removeAttribute("tabindex");
|
|
859
|
-
requestAnimationFrame(()=>{
|
|
860
|
-
el.setAttribute("tabindex", tabindex);
|
|
861
|
-
});
|
|
862
|
-
};
|
|
863
|
-
return {
|
|
864
|
-
gridCellProps: gridCellProps,
|
|
865
|
-
isPressed: isPressed
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
function $ab90dcbc1b5466d0$var$last(walker) {
|
|
869
|
-
let next;
|
|
870
|
-
let last;
|
|
871
|
-
do {
|
|
872
|
-
last = walker.lastChild();
|
|
873
|
-
if (last) next = last;
|
|
874
|
-
}while (last);
|
|
875
|
-
return next;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
23
|
|
|
882
|
-
function $7cb39d07f245a780$export$70e2eed1a92976ad(props, state) {
|
|
883
|
-
let { key: key } = props;
|
|
884
|
-
let manager = state.selectionManager;
|
|
885
|
-
let checkboxId = (0, $cVkRF$useId)();
|
|
886
|
-
let isDisabled = !state.selectionManager.canSelectItem(key);
|
|
887
|
-
let isSelected = state.selectionManager.isSelected(key);
|
|
888
|
-
let onChange = ()=>manager.select(key);
|
|
889
|
-
const stringFormatter = (0, $cVkRF$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($835c96616a7cb4f9$exports))), "@react-aria/grid");
|
|
890
|
-
return {
|
|
891
|
-
checkboxProps: {
|
|
892
|
-
id: checkboxId,
|
|
893
|
-
"aria-label": stringFormatter.format("select"),
|
|
894
|
-
isSelected: isSelected,
|
|
895
|
-
isDisabled: isDisabled,
|
|
896
|
-
onChange: onChange
|
|
897
|
-
}
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
24
|
|
|
901
25
|
|
|
902
26
|
|