@react-aria/table 3.13.6-nightly.4552 → 3.13.6-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/TableKeyboardDelegate.main.js +132 -0
- package/dist/TableKeyboardDelegate.main.js.map +1 -0
- package/dist/TableKeyboardDelegate.mjs +127 -0
- package/dist/TableKeyboardDelegate.module.js +127 -0
- package/dist/TableKeyboardDelegate.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 -779
- 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 +15 -786
- package/dist/main.js.map +1 -1
- package/dist/module.js +8 -779
- 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/useTable.main.js +111 -0
- package/dist/useTable.main.js.map +1 -0
- package/dist/useTable.mjs +106 -0
- package/dist/useTable.module.js +106 -0
- package/dist/useTable.module.js.map +1 -0
- package/dist/useTableCell.main.js +36 -0
- package/dist/useTableCell.main.js.map +1 -0
- package/dist/useTableCell.mjs +31 -0
- package/dist/useTableCell.module.js +31 -0
- package/dist/useTableCell.module.js.map +1 -0
- package/dist/useTableColumnHeader.main.js +93 -0
- package/dist/useTableColumnHeader.main.js.map +1 -0
- package/dist/useTableColumnHeader.mjs +88 -0
- package/dist/useTableColumnHeader.module.js +88 -0
- package/dist/useTableColumnHeader.module.js.map +1 -0
- package/dist/useTableColumnResize.main.js +216 -0
- package/dist/useTableColumnResize.main.js.map +1 -0
- package/dist/useTableColumnResize.mjs +211 -0
- package/dist/useTableColumnResize.module.js +211 -0
- package/dist/useTableColumnResize.module.js.map +1 -0
- package/dist/useTableHeaderRow.main.js +32 -0
- package/dist/useTableHeaderRow.main.js.map +1 -0
- package/dist/useTableHeaderRow.mjs +27 -0
- package/dist/useTableHeaderRow.module.js +27 -0
- package/dist/useTableHeaderRow.module.js.map +1 -0
- package/dist/useTableRow.main.js +80 -0
- package/dist/useTableRow.main.js.map +1 -0
- package/dist/useTableRow.mjs +75 -0
- package/dist/useTableRow.module.js +75 -0
- package/dist/useTableRow.module.js.map +1 -0
- package/dist/useTableSelectionCheckbox.main.js +56 -0
- package/dist/useTableSelectionCheckbox.main.js.map +1 -0
- package/dist/useTableSelectionCheckbox.mjs +50 -0
- package/dist/useTableSelectionCheckbox.module.js +50 -0
- package/dist/useTableSelectionCheckbox.module.js.map +1 -0
- package/dist/utils.main.js +43 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +35 -0
- package/dist/utils.module.js +35 -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 +17 -17
package/dist/import.mjs
CHANGED
|
@@ -1,73 +1,11 @@
|
|
|
1
|
-
import $
|
|
2
|
-
import $
|
|
3
|
-
import $
|
|
4
|
-
import $
|
|
5
|
-
import $
|
|
6
|
-
import $
|
|
7
|
-
import $
|
|
8
|
-
import $
|
|
9
|
-
import $4e11db3c25a38112$exports from "./et-EE.mjs";
|
|
10
|
-
import $da1e751a92575e02$exports from "./fi-FI.mjs";
|
|
11
|
-
import $1b5d6c6c47d55106$exports from "./fr-FR.mjs";
|
|
12
|
-
import $7c18ba27b86d3308$exports from "./he-IL.mjs";
|
|
13
|
-
import $2cb40998e20e8a46$exports from "./hr-HR.mjs";
|
|
14
|
-
import $189e23eec1d6aa3a$exports from "./hu-HU.mjs";
|
|
15
|
-
import $3c5ec8e4f015dfd0$exports from "./it-IT.mjs";
|
|
16
|
-
import $d021d50e6b315ebb$exports from "./ja-JP.mjs";
|
|
17
|
-
import $52535c35c24ec937$exports from "./ko-KR.mjs";
|
|
18
|
-
import $b37ee03672edfd1d$exports from "./lt-LT.mjs";
|
|
19
|
-
import $c7df6686b4189d56$exports from "./lv-LV.mjs";
|
|
20
|
-
import $da07fe8ec87e6b68$exports from "./nb-NO.mjs";
|
|
21
|
-
import $64b7e390f5791490$exports from "./nl-NL.mjs";
|
|
22
|
-
import $2a03621e773f1678$exports from "./pl-PL.mjs";
|
|
23
|
-
import $0a79c0aba9e5ecc6$exports from "./pt-BR.mjs";
|
|
24
|
-
import $de7b4d0f7dc86fc8$exports from "./pt-PT.mjs";
|
|
25
|
-
import $28ea7e849d77bd1c$exports from "./ro-RO.mjs";
|
|
26
|
-
import $9a09321cf046b187$exports from "./ru-RU.mjs";
|
|
27
|
-
import $5afe469a63fcac7b$exports from "./sk-SK.mjs";
|
|
28
|
-
import $2956757ac31a7ce2$exports from "./sl-SI.mjs";
|
|
29
|
-
import $cedee0e66b175529$exports from "./sr-SP.mjs";
|
|
30
|
-
import $6db19998ba4427da$exports from "./sv-SE.mjs";
|
|
31
|
-
import $166b7c9cc1adb1a1$exports from "./tr-TR.mjs";
|
|
32
|
-
import $c7ab180b401e49ff$exports from "./uk-UA.mjs";
|
|
33
|
-
import $1648ec00941567f3$exports from "./zh-CN.mjs";
|
|
34
|
-
import $b26f22384b3c1526$exports from "./zh-TW.mjs";
|
|
35
|
-
import {useGridRowGroup as $lJcFS$useGridRowGroup, useGrid as $lJcFS$useGrid, GridKeyboardDelegate as $lJcFS$GridKeyboardDelegate, useGridCell as $lJcFS$useGridCell, useGridRow as $lJcFS$useGridRow, useGridSelectionCheckbox as $lJcFS$useGridSelectionCheckbox} from "@react-aria/grid";
|
|
36
|
-
import {announce as $lJcFS$announce} from "@react-aria/live-announcer";
|
|
37
|
-
import {useId as $lJcFS$useId, useDescription as $lJcFS$useDescription, useUpdateEffect as $lJcFS$useUpdateEffect, mergeProps as $lJcFS$mergeProps, isAndroid as $lJcFS$isAndroid, getSyntheticLinkProps as $lJcFS$getSyntheticLinkProps, useEffectEvent as $lJcFS$useEffectEvent} from "@react-aria/utils";
|
|
38
|
-
import {useMemo as $lJcFS$useMemo, useEffect as $lJcFS$useEffect, useRef as $lJcFS$useRef, useCallback as $lJcFS$useCallback} from "react";
|
|
39
|
-
import {tableNestedRows as $lJcFS$tableNestedRows} from "@react-stately/flags";
|
|
40
|
-
import {useCollator as $lJcFS$useCollator, useLocale as $lJcFS$useLocale, useLocalizedStringFormatter as $lJcFS$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
41
|
-
import {getFirstItem as $lJcFS$getFirstItem, getChildNodes as $lJcFS$getChildNodes, getNthItem as $lJcFS$getNthItem, getLastItem as $lJcFS$getLastItem} from "@react-stately/collections";
|
|
42
|
-
import {useFocusable as $lJcFS$useFocusable, focusSafely as $lJcFS$focusSafely} from "@react-aria/focus";
|
|
43
|
-
import {usePress as $lJcFS$usePress, useKeyboard as $lJcFS$useKeyboard, useMove as $lJcFS$useMove, useInteractionModality as $lJcFS$useInteractionModality} from "@react-aria/interactions";
|
|
44
|
-
import {useVisuallyHidden as $lJcFS$useVisuallyHidden} from "@react-aria/visually-hidden";
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function $parcel$interopDefault(a) {
|
|
48
|
-
return a && a.__esModule ? a.default : a;
|
|
49
|
-
}
|
|
50
|
-
/*
|
|
51
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
52
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
53
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
54
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
55
|
-
*
|
|
56
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
57
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
58
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
59
|
-
* governing permissions and limitations under the License.
|
|
60
|
-
*/ /*
|
|
61
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
62
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
63
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
64
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
65
|
-
*
|
|
66
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
67
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
68
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
69
|
-
* governing permissions and limitations under the License.
|
|
70
|
-
*/
|
|
1
|
+
import {useTable as $6e31608fbba75bab$export$25bceaac3c7e4dc7} from "./useTable.mjs";
|
|
2
|
+
import {useTableColumnHeader as $f329116d8ad0aba0$export$9514819a8c81e960} from "./useTableColumnHeader.mjs";
|
|
3
|
+
import {useTableRow as $b2db214c022798eb$export$7f2f6ae19e707aa5} from "./useTableRow.mjs";
|
|
4
|
+
import {useTableHeaderRow as $f917ee10f4c32dab$export$1b95a7d2d517b841} from "./useTableHeaderRow.mjs";
|
|
5
|
+
import {useTableCell as $7713593715703b24$export$49571c903d73624c} from "./useTableCell.mjs";
|
|
6
|
+
import {useTableSelectAllCheckbox as $2a795c53a101c542$export$1003db6a7e384b99, useTableSelectionCheckbox as $2a795c53a101c542$export$16ea7f650bd7c1bb} from "./useTableSelectionCheckbox.mjs";
|
|
7
|
+
import {useTableColumnResize as $e91ef4e5004e3774$export$52994e973806c219} from "./useTableColumnResize.mjs";
|
|
8
|
+
import {useGridRowGroup as $lJcFS$useGridRowGroup} from "@react-aria/grid";
|
|
71
9
|
|
|
72
10
|
/*
|
|
73
11
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -79,723 +17,14 @@ function $parcel$interopDefault(a) {
|
|
|
79
17
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
80
18
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
81
19
|
* governing permissions and limitations under the License.
|
|
82
|
-
*/ const $2140fb2337097f2d$export$552312adfd451dab = new WeakMap();
|
|
83
|
-
function $2140fb2337097f2d$var$normalizeKey(key) {
|
|
84
|
-
if (typeof key === "string") return key.replace(/\s*/g, "");
|
|
85
|
-
return "" + key;
|
|
86
|
-
}
|
|
87
|
-
function $2140fb2337097f2d$export$37cd4213f2ad742e(state, columnKey) {
|
|
88
|
-
let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
|
|
89
|
-
if (!gridId) throw new Error("Unknown grid");
|
|
90
|
-
return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
|
|
91
|
-
}
|
|
92
|
-
function $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey) {
|
|
93
|
-
let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
|
|
94
|
-
if (!gridId) throw new Error("Unknown grid");
|
|
95
|
-
return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(rowKey)}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
|
|
96
|
-
}
|
|
97
|
-
function $2140fb2337097f2d$export$85069b70317f543(state, rowKey) {
|
|
98
|
-
// A row is labelled by it's row headers.
|
|
99
|
-
return [
|
|
100
|
-
...state.collection.rowHeaderColumnKeys
|
|
101
|
-
].map((columnKey)=>$2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey)).join(" ");
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var $7476b46781682bf5$exports = {};
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
$7476b46781682bf5$exports = {
|
|
141
|
-
"ar-AE": $ce3de3ff2fd66848$exports,
|
|
142
|
-
"bg-BG": $cb80dcce530985b9$exports,
|
|
143
|
-
"cs-CZ": $68ac86749db4c0fb$exports,
|
|
144
|
-
"da-DK": $9a6cbac08487e661$exports,
|
|
145
|
-
"de-DE": $c963661d89486e72$exports,
|
|
146
|
-
"el-GR": $ac03861c6e8605f4$exports,
|
|
147
|
-
"en-US": $09e6b82e0d6e466a$exports,
|
|
148
|
-
"es-ES": $8cc39eb66c2bf220$exports,
|
|
149
|
-
"et-EE": $4e11db3c25a38112$exports,
|
|
150
|
-
"fi-FI": $da1e751a92575e02$exports,
|
|
151
|
-
"fr-FR": $1b5d6c6c47d55106$exports,
|
|
152
|
-
"he-IL": $7c18ba27b86d3308$exports,
|
|
153
|
-
"hr-HR": $2cb40998e20e8a46$exports,
|
|
154
|
-
"hu-HU": $189e23eec1d6aa3a$exports,
|
|
155
|
-
"it-IT": $3c5ec8e4f015dfd0$exports,
|
|
156
|
-
"ja-JP": $d021d50e6b315ebb$exports,
|
|
157
|
-
"ko-KR": $52535c35c24ec937$exports,
|
|
158
|
-
"lt-LT": $b37ee03672edfd1d$exports,
|
|
159
|
-
"lv-LV": $c7df6686b4189d56$exports,
|
|
160
|
-
"nb-NO": $da07fe8ec87e6b68$exports,
|
|
161
|
-
"nl-NL": $64b7e390f5791490$exports,
|
|
162
|
-
"pl-PL": $2a03621e773f1678$exports,
|
|
163
|
-
"pt-BR": $0a79c0aba9e5ecc6$exports,
|
|
164
|
-
"pt-PT": $de7b4d0f7dc86fc8$exports,
|
|
165
|
-
"ro-RO": $28ea7e849d77bd1c$exports,
|
|
166
|
-
"ru-RU": $9a09321cf046b187$exports,
|
|
167
|
-
"sk-SK": $5afe469a63fcac7b$exports,
|
|
168
|
-
"sl-SI": $2956757ac31a7ce2$exports,
|
|
169
|
-
"sr-SP": $cedee0e66b175529$exports,
|
|
170
|
-
"sv-SE": $6db19998ba4427da$exports,
|
|
171
|
-
"tr-TR": $166b7c9cc1adb1a1$exports,
|
|
172
|
-
"uk-UA": $c7ab180b401e49ff$exports,
|
|
173
|
-
"zh-CN": $1648ec00941567f3$exports,
|
|
174
|
-
"zh-TW": $b26f22384b3c1526$exports
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
/*
|
|
181
|
-
* Copyright 2022 Adobe. All rights reserved.
|
|
182
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
183
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
184
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
-
*
|
|
186
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
187
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
188
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
189
|
-
* governing permissions and limitations under the License.
|
|
190
20
|
*/
|
|
191
21
|
|
|
192
|
-
class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $lJcFS$GridKeyboardDelegate) {
|
|
193
|
-
isCell(node) {
|
|
194
|
-
return node.type === "cell" || node.type === "rowheader" || node.type === "column";
|
|
195
|
-
}
|
|
196
|
-
getKeyBelow(key) {
|
|
197
|
-
let startItem = this.collection.getItem(key);
|
|
198
|
-
if (!startItem) return;
|
|
199
|
-
// If focus was on a column, then focus the first child column if any,
|
|
200
|
-
// or find the corresponding cell in the first row.
|
|
201
|
-
if (startItem.type === "column") {
|
|
202
|
-
let child = (0, $lJcFS$getFirstItem)((0, $lJcFS$getChildNodes)(startItem, this.collection));
|
|
203
|
-
if (child) return child.key;
|
|
204
|
-
let firstKey = this.getFirstKey();
|
|
205
|
-
if (firstKey == null) return;
|
|
206
|
-
let firstItem = this.collection.getItem(firstKey);
|
|
207
|
-
return (0, $lJcFS$getNthItem)((0, $lJcFS$getChildNodes)(firstItem, this.collection), startItem.index).key;
|
|
208
|
-
}
|
|
209
|
-
return super.getKeyBelow(key);
|
|
210
|
-
}
|
|
211
|
-
getKeyAbove(key) {
|
|
212
|
-
let startItem = this.collection.getItem(key);
|
|
213
|
-
if (!startItem) return;
|
|
214
|
-
// If focus was on a column, focus the parent column if any
|
|
215
|
-
if (startItem.type === "column") {
|
|
216
|
-
let parent = this.collection.getItem(startItem.parentKey);
|
|
217
|
-
if (parent && parent.type === "column") return parent.key;
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
// only return above row key if not header row
|
|
221
|
-
let superKey = super.getKeyAbove(key);
|
|
222
|
-
if (superKey != null && this.collection.getItem(superKey).type !== "headerrow") return superKey;
|
|
223
|
-
// If no item was found, and focus was on a cell, then focus the
|
|
224
|
-
// corresponding column header.
|
|
225
|
-
if (this.isCell(startItem)) return this.collection.columns[startItem.index].key;
|
|
226
|
-
// If focus was on a row, then focus the first column header.
|
|
227
|
-
return this.collection.columns[0].key;
|
|
228
|
-
}
|
|
229
|
-
findNextColumnKey(column) {
|
|
230
|
-
// Search following columns
|
|
231
|
-
let key = this.findNextKey(column.key, (item)=>item.type === "column");
|
|
232
|
-
if (key != null) return key;
|
|
233
|
-
// Wrap around to the first column
|
|
234
|
-
let row = this.collection.headerRows[column.level];
|
|
235
|
-
for (let item of (0, $lJcFS$getChildNodes)(row, this.collection)){
|
|
236
|
-
if (item.type === "column") return item.key;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
findPreviousColumnKey(column) {
|
|
240
|
-
// Search previous columns
|
|
241
|
-
let key = this.findPreviousKey(column.key, (item)=>item.type === "column");
|
|
242
|
-
if (key != null) return key;
|
|
243
|
-
// Wrap around to the last column
|
|
244
|
-
let row = this.collection.headerRows[column.level];
|
|
245
|
-
let childNodes = [
|
|
246
|
-
...(0, $lJcFS$getChildNodes)(row, this.collection)
|
|
247
|
-
];
|
|
248
|
-
for(let i = childNodes.length - 1; i >= 0; i--){
|
|
249
|
-
let item = childNodes[i];
|
|
250
|
-
if (item.type === "column") return item.key;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
getKeyRightOf(key) {
|
|
254
|
-
let item = this.collection.getItem(key);
|
|
255
|
-
if (!item) return;
|
|
256
|
-
// If focus was on a column, then focus the next column
|
|
257
|
-
if (item.type === "column") return this.direction === "rtl" ? this.findPreviousColumnKey(item) : this.findNextColumnKey(item);
|
|
258
|
-
return super.getKeyRightOf(key);
|
|
259
|
-
}
|
|
260
|
-
getKeyLeftOf(key) {
|
|
261
|
-
let item = this.collection.getItem(key);
|
|
262
|
-
if (!item) return;
|
|
263
|
-
// If focus was on a column, then focus the previous column
|
|
264
|
-
if (item.type === "column") return this.direction === "rtl" ? this.findNextColumnKey(item) : this.findPreviousColumnKey(item);
|
|
265
|
-
return super.getKeyLeftOf(key);
|
|
266
|
-
}
|
|
267
|
-
getKeyForSearch(search, fromKey) {
|
|
268
|
-
if (!this.collator) return null;
|
|
269
|
-
let collection = this.collection;
|
|
270
|
-
let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
|
|
271
|
-
if (key == null) return null;
|
|
272
|
-
// If the starting key is a cell, search from its parent row.
|
|
273
|
-
let startItem = collection.getItem(key);
|
|
274
|
-
if (startItem.type === "cell") key = startItem.parentKey;
|
|
275
|
-
let hasWrapped = false;
|
|
276
|
-
while(key != null){
|
|
277
|
-
let item = collection.getItem(key);
|
|
278
|
-
// Check each of the row header cells in this row for a match
|
|
279
|
-
for (let cell of (0, $lJcFS$getChildNodes)(item, this.collection)){
|
|
280
|
-
let column = collection.columns[cell.index];
|
|
281
|
-
if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {
|
|
282
|
-
let substring = cell.textValue.slice(0, search.length);
|
|
283
|
-
if (this.collator.compare(substring, search) === 0) {
|
|
284
|
-
// If we started on a cell, end on the matching cell. Otherwise, end on the row.
|
|
285
|
-
let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
|
|
286
|
-
return fromItem.type === "cell" ? cell.key : item.key;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
key = this.getKeyBelow(key);
|
|
291
|
-
// Wrap around when reaching the end of the collection
|
|
292
|
-
if (key == null && !hasWrapped) {
|
|
293
|
-
key = this.getFirstKey();
|
|
294
|
-
hasWrapped = true;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return null;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
|
|
305
|
-
let { keyboardDelegate: keyboardDelegate, isVirtualized: isVirtualized, layout: layout } = props;
|
|
306
|
-
// By default, a KeyboardDelegate is provided which uses the DOM to query layout information (e.g. for page up/page down).
|
|
307
|
-
// When virtualized, the layout object will be passed in as a prop and override this.
|
|
308
|
-
let collator = (0, $lJcFS$useCollator)({
|
|
309
|
-
usage: "search",
|
|
310
|
-
sensitivity: "base"
|
|
311
|
-
});
|
|
312
|
-
let { direction: direction } = (0, $lJcFS$useLocale)();
|
|
313
|
-
let disabledBehavior = state.selectionManager.disabledBehavior;
|
|
314
|
-
let delegate = (0, $lJcFS$useMemo)(()=>keyboardDelegate || new (0, $0ba3c81c7f1caedd$export$da43f8f5cb04028d)({
|
|
315
|
-
collection: state.collection,
|
|
316
|
-
disabledKeys: state.disabledKeys,
|
|
317
|
-
disabledBehavior: disabledBehavior,
|
|
318
|
-
ref: ref,
|
|
319
|
-
direction: direction,
|
|
320
|
-
collator: collator,
|
|
321
|
-
layout: layout
|
|
322
|
-
}), [
|
|
323
|
-
keyboardDelegate,
|
|
324
|
-
state.collection,
|
|
325
|
-
state.disabledKeys,
|
|
326
|
-
disabledBehavior,
|
|
327
|
-
ref,
|
|
328
|
-
direction,
|
|
329
|
-
collator,
|
|
330
|
-
layout
|
|
331
|
-
]);
|
|
332
|
-
let id = (0, $lJcFS$useId)(props.id);
|
|
333
|
-
(0, $2140fb2337097f2d$export$552312adfd451dab).set(state, id);
|
|
334
|
-
let { gridProps: gridProps } = (0, $lJcFS$useGrid)({
|
|
335
|
-
...props,
|
|
336
|
-
id: id,
|
|
337
|
-
keyboardDelegate: delegate
|
|
338
|
-
}, state, ref);
|
|
339
|
-
// Override to include header rows
|
|
340
|
-
if (isVirtualized) gridProps["aria-rowcount"] = state.collection.size + state.collection.headerRows.length;
|
|
341
|
-
if ((0, $lJcFS$tableNestedRows)() && "expandedKeys" in state) gridProps.role = "treegrid";
|
|
342
|
-
let { column: column, direction: sortDirection } = state.sortDescriptor || {};
|
|
343
|
-
let stringFormatter = (0, $lJcFS$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($7476b46781682bf5$exports))), "@react-aria/table");
|
|
344
|
-
let sortDescription = (0, $lJcFS$useMemo)(()=>{
|
|
345
|
-
var _state_collection_columns_find;
|
|
346
|
-
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;
|
|
347
|
-
return sortDirection && column ? stringFormatter.format(`${sortDirection}Sort`, {
|
|
348
|
-
columnName: columnName
|
|
349
|
-
}) : undefined;
|
|
350
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
351
|
-
}, [
|
|
352
|
-
sortDirection,
|
|
353
|
-
column,
|
|
354
|
-
state.collection.columns
|
|
355
|
-
]);
|
|
356
|
-
let descriptionProps = (0, $lJcFS$useDescription)(sortDescription);
|
|
357
|
-
// Only announce after initial render, tabbing to the table will tell you the initial sort info already
|
|
358
|
-
(0, $lJcFS$useUpdateEffect)(()=>{
|
|
359
|
-
(0, $lJcFS$announce)(sortDescription, "assertive", 500);
|
|
360
|
-
}, [
|
|
361
|
-
sortDescription
|
|
362
|
-
]);
|
|
363
|
-
return {
|
|
364
|
-
gridProps: (0, $lJcFS$mergeProps)(gridProps, descriptionProps, {
|
|
365
|
-
// merge sort description with long press information
|
|
366
|
-
"aria-describedby": [
|
|
367
|
-
descriptionProps["aria-describedby"],
|
|
368
|
-
gridProps["aria-describedby"]
|
|
369
|
-
].filter(Boolean).join(" ")
|
|
370
|
-
})
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
|
|
374
22
|
|
|
375
|
-
/*
|
|
376
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
377
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
378
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
379
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
380
|
-
*
|
|
381
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
382
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
383
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
384
|
-
* governing permissions and limitations under the License.
|
|
385
|
-
*/
|
|
386
23
|
|
|
387
24
|
|
|
388
25
|
|
|
389
26
|
|
|
390
27
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
|
|
394
|
-
var _state_sortDescriptor, _state_sortDescriptor1;
|
|
395
|
-
let { node: node } = props;
|
|
396
|
-
let allowsSorting = node.props.allowsSorting;
|
|
397
|
-
// if there are no focusable children, the column header will focus the cell
|
|
398
|
-
let { gridCellProps: gridCellProps } = (0, $lJcFS$useGridCell)({
|
|
399
|
-
...props,
|
|
400
|
-
focusMode: "child"
|
|
401
|
-
}, state, ref);
|
|
402
|
-
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === "single";
|
|
403
|
-
let { pressProps: pressProps } = (0, $lJcFS$usePress)({
|
|
404
|
-
isDisabled: !allowsSorting || isSelectionCellDisabled,
|
|
405
|
-
onPress () {
|
|
406
|
-
state.sort(node.key);
|
|
407
|
-
},
|
|
408
|
-
ref: ref
|
|
409
|
-
});
|
|
410
|
-
// Needed to pick up the focusable context, enabling things like Tooltips for example
|
|
411
|
-
let { focusableProps: focusableProps } = (0, $lJcFS$useFocusable)({}, ref);
|
|
412
|
-
let ariaSort = null;
|
|
413
|
-
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
|
|
414
|
-
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
|
|
415
|
-
// aria-sort not supported in Android Talkback
|
|
416
|
-
if (node.props.allowsSorting && !(0, $lJcFS$isAndroid)()) ariaSort = isSortedColumn ? sortDirection : "none";
|
|
417
|
-
let stringFormatter = (0, $lJcFS$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($7476b46781682bf5$exports))), "@react-aria/table");
|
|
418
|
-
let sortDescription;
|
|
419
|
-
if (allowsSorting) {
|
|
420
|
-
sortDescription = `${stringFormatter.format("sortable")}`;
|
|
421
|
-
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
|
|
422
|
-
if (isSortedColumn && sortDirection && (0, $lJcFS$isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
|
|
423
|
-
}
|
|
424
|
-
let descriptionProps = (0, $lJcFS$useDescription)(sortDescription);
|
|
425
|
-
let shouldDisableFocus = state.collection.size === 0;
|
|
426
|
-
(0, $lJcFS$useEffect)(()=>{
|
|
427
|
-
if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) state.selectionManager.setFocusedKey(null);
|
|
428
|
-
}, [
|
|
429
|
-
shouldDisableFocus,
|
|
430
|
-
state.selectionManager,
|
|
431
|
-
node.key
|
|
432
|
-
]);
|
|
433
|
-
return {
|
|
434
|
-
columnHeaderProps: {
|
|
435
|
-
...(0, $lJcFS$mergeProps)(gridCellProps, pressProps, focusableProps, descriptionProps, // If the table is empty, make all column headers untabbable
|
|
436
|
-
shouldDisableFocus && {
|
|
437
|
-
tabIndex: -1
|
|
438
|
-
}),
|
|
439
|
-
role: "columnheader",
|
|
440
|
-
id: (0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state, node.key),
|
|
441
|
-
"aria-colspan": node.colspan && node.colspan > 1 ? node.colspan : null,
|
|
442
|
-
"aria-sort": ariaSort
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
/*
|
|
449
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
450
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
451
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
452
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
453
|
-
*
|
|
454
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
455
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
456
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
457
|
-
* governing permissions and limitations under the License.
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const $b2db214c022798eb$var$EXPANSION_KEYS = {
|
|
465
|
-
expand: {
|
|
466
|
-
ltr: "ArrowRight",
|
|
467
|
-
rtl: "ArrowLeft"
|
|
468
|
-
},
|
|
469
|
-
"collapse": {
|
|
470
|
-
ltr: "ArrowLeft",
|
|
471
|
-
rtl: "ArrowRight"
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
|
|
475
|
-
let { node: node, isVirtualized: isVirtualized } = props;
|
|
476
|
-
let { rowProps: rowProps, ...states } = (0, $lJcFS$useGridRow)(props, state, ref);
|
|
477
|
-
let { direction: direction } = (0, $lJcFS$useLocale)();
|
|
478
|
-
if (isVirtualized && !((0, $lJcFS$tableNestedRows)() && "expandedKeys" in state)) rowProps["aria-rowindex"] = node.index + 1 + state.collection.headerRows.length; // aria-rowindex is 1 based
|
|
479
|
-
else delete rowProps["aria-rowindex"];
|
|
480
|
-
let treeGridRowProps = {};
|
|
481
|
-
if ((0, $lJcFS$tableNestedRows)() && "expandedKeys" in state) {
|
|
482
|
-
let treeNode = state.keyMap.get(node.key);
|
|
483
|
-
if (treeNode != null) {
|
|
484
|
-
var _treeNode_props, _treeNode_props_children, _treeNode_props1;
|
|
485
|
-
let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
|
|
486
|
-
treeGridRowProps = {
|
|
487
|
-
onKeyDown: (e)=>{
|
|
488
|
-
if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS["expand"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== "all" && !state.expandedKeys.has(treeNode.key)) {
|
|
489
|
-
state.toggleKey(treeNode.key);
|
|
490
|
-
e.stopPropagation();
|
|
491
|
-
} else if (e.key === $b2db214c022798eb$var$EXPANSION_KEYS["collapse"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === "all" || state.expandedKeys.has(treeNode.key))) {
|
|
492
|
-
state.toggleKey(treeNode.key);
|
|
493
|
-
e.stopPropagation();
|
|
494
|
-
}
|
|
495
|
-
},
|
|
496
|
-
"aria-expanded": hasChildRows ? state.expandedKeys === "all" || state.expandedKeys.has(node.key) : undefined,
|
|
497
|
-
"aria-level": treeNode.level,
|
|
498
|
-
"aria-posinset": treeNode.indexOfType + 1,
|
|
499
|
-
"aria-setsize": treeNode.level > 1 ? (0, $lJcFS$getLastItem)(state.keyMap.get(treeNode === null || treeNode === void 0 ? void 0 : treeNode.parentKey).childNodes).indexOfType + 1 : (0, $lJcFS$getLastItem)(state.keyMap.get(state.collection.body.key).childNodes).indexOfType + 1
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
let linkProps = states.hasAction ? (0, $lJcFS$getSyntheticLinkProps)(node.props) : {};
|
|
504
|
-
return {
|
|
505
|
-
rowProps: {
|
|
506
|
-
...(0, $lJcFS$mergeProps)(rowProps, treeGridRowProps, linkProps),
|
|
507
|
-
"aria-labelledby": (0, $2140fb2337097f2d$export$85069b70317f543)(state, node.key)
|
|
508
|
-
},
|
|
509
|
-
...states
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
/*
|
|
515
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
516
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
517
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
518
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
519
|
-
*
|
|
520
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
521
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
522
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
523
|
-
* governing permissions and limitations under the License.
|
|
524
|
-
*/
|
|
525
|
-
function $f917ee10f4c32dab$export$1b95a7d2d517b841(props, state, ref) {
|
|
526
|
-
let { node: node, isVirtualized: isVirtualized } = props;
|
|
527
|
-
let rowProps = {
|
|
528
|
-
role: "row"
|
|
529
|
-
};
|
|
530
|
-
if (isVirtualized && !((0, $lJcFS$tableNestedRows)() && "expandedKeys" in state)) rowProps["aria-rowindex"] = node.index + 1; // aria-rowindex is 1 based
|
|
531
|
-
return {
|
|
532
|
-
rowProps: rowProps
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
/*
|
|
538
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
539
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
540
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
541
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
542
|
-
*
|
|
543
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
544
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
545
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
546
|
-
* governing permissions and limitations under the License.
|
|
547
|
-
*/
|
|
548
|
-
|
|
549
|
-
function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
|
|
550
|
-
let { gridCellProps: gridCellProps, isPressed: isPressed } = (0, $lJcFS$useGridCell)(props, state, ref);
|
|
551
|
-
let columnKey = props.node.column.key;
|
|
552
|
-
if (state.collection.rowHeaderColumnKeys.has(columnKey)) {
|
|
553
|
-
gridCellProps.role = "rowheader";
|
|
554
|
-
gridCellProps.id = (0, $2140fb2337097f2d$export$19baff3266315d44)(state, props.node.parentKey, columnKey);
|
|
555
|
-
}
|
|
556
|
-
return {
|
|
557
|
-
gridCellProps: gridCellProps,
|
|
558
|
-
isPressed: isPressed
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
/*
|
|
564
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
565
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
566
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
567
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
568
|
-
*
|
|
569
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
570
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
571
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
572
|
-
* governing permissions and limitations under the License.
|
|
573
|
-
*/
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
function $2a795c53a101c542$export$16ea7f650bd7c1bb(props, state) {
|
|
578
|
-
let { key: key } = props;
|
|
579
|
-
const { checkboxProps: checkboxProps } = (0, $lJcFS$useGridSelectionCheckbox)(props, state);
|
|
580
|
-
return {
|
|
581
|
-
checkboxProps: {
|
|
582
|
-
...checkboxProps,
|
|
583
|
-
"aria-labelledby": `${checkboxProps.id} ${(0, $2140fb2337097f2d$export$85069b70317f543)(state, key)}`
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
function $2a795c53a101c542$export$1003db6a7e384b99(state) {
|
|
588
|
-
let { isEmpty: isEmpty, isSelectAll: isSelectAll, selectionMode: selectionMode } = state.selectionManager;
|
|
589
|
-
const stringFormatter = (0, $lJcFS$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($7476b46781682bf5$exports))), "@react-aria/table");
|
|
590
|
-
return {
|
|
591
|
-
checkboxProps: {
|
|
592
|
-
"aria-label": stringFormatter.format(selectionMode === "single" ? "select" : "selectAll"),
|
|
593
|
-
isSelected: isSelectAll,
|
|
594
|
-
isDisabled: selectionMode !== "multiple" || state.collection.size === 0,
|
|
595
|
-
isIndeterminate: !isEmpty && !isSelectAll,
|
|
596
|
-
onChange: ()=>state.selectionManager.toggleSelectAll()
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
/*
|
|
603
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
604
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
605
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
606
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
607
|
-
*
|
|
608
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
609
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
610
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
611
|
-
* governing permissions and limitations under the License.
|
|
612
|
-
*/
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
function $e91ef4e5004e3774$export$52994e973806c219(props, state, ref) {
|
|
621
|
-
let { column: item, triggerRef: triggerRef, isDisabled: isDisabled, onResizeStart: onResizeStart, onResize: onResize, onResizeEnd: onResizeEnd, "aria-label": ariaLabel } = props;
|
|
622
|
-
const stringFormatter = (0, $lJcFS$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($7476b46781682bf5$exports))), "@react-aria/table");
|
|
623
|
-
let id = (0, $lJcFS$useId)();
|
|
624
|
-
let isResizing = state.resizingColumn === item.key;
|
|
625
|
-
let isResizingRef = (0, $lJcFS$useRef)(isResizing);
|
|
626
|
-
let lastSize = (0, $lJcFS$useRef)(null);
|
|
627
|
-
let wasFocusedOnResizeStart = (0, $lJcFS$useRef)(false);
|
|
628
|
-
let editModeEnabled = state.tableState.isKeyboardNavigationDisabled;
|
|
629
|
-
let { direction: direction } = (0, $lJcFS$useLocale)();
|
|
630
|
-
let { keyboardProps: keyboardProps } = (0, $lJcFS$useKeyboard)({
|
|
631
|
-
onKeyDown: (e)=>{
|
|
632
|
-
if (editModeEnabled) {
|
|
633
|
-
if (e.key === "Escape" || e.key === "Enter" || e.key === " " || e.key === "Tab") {
|
|
634
|
-
e.preventDefault();
|
|
635
|
-
endResize(item);
|
|
636
|
-
}
|
|
637
|
-
} else {
|
|
638
|
-
// Continue propagation on keydown events so they still bubbles to useSelectableCollection and are handled there
|
|
639
|
-
e.continuePropagation();
|
|
640
|
-
if (e.key === "Enter") startResize(item);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
let startResize = (0, $lJcFS$useEffectEvent)((item)=>{
|
|
645
|
-
if (!isResizingRef.current) {
|
|
646
|
-
lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
|
|
647
|
-
state.startResize(item.key);
|
|
648
|
-
state.tableState.setKeyboardNavigationDisabled(true);
|
|
649
|
-
onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart(lastSize.current);
|
|
650
|
-
}
|
|
651
|
-
isResizingRef.current = true;
|
|
652
|
-
});
|
|
653
|
-
let resize = (0, $lJcFS$useEffectEvent)((item, newWidth)=>{
|
|
654
|
-
let sizes = state.updateResizedColumns(item.key, newWidth);
|
|
655
|
-
onResize === null || onResize === void 0 ? void 0 : onResize(sizes);
|
|
656
|
-
lastSize.current = sizes;
|
|
657
|
-
});
|
|
658
|
-
let endResize = (0, $lJcFS$useEffectEvent)((item)=>{
|
|
659
|
-
if (isResizingRef.current) {
|
|
660
|
-
if (lastSize.current == null) lastSize.current = state.updateResizedColumns(item.key, state.getColumnWidth(item.key));
|
|
661
|
-
state.endResize();
|
|
662
|
-
state.tableState.setKeyboardNavigationDisabled(false);
|
|
663
|
-
onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd(lastSize.current);
|
|
664
|
-
isResizingRef.current = false;
|
|
665
|
-
if ((triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) && !wasFocusedOnResizeStart.current) // switch focus back to the column header unless the resizer was already focused when resizing started.
|
|
666
|
-
(0, $lJcFS$focusSafely)(triggerRef.current);
|
|
667
|
-
}
|
|
668
|
-
lastSize.current = null;
|
|
669
|
-
});
|
|
670
|
-
const columnResizeWidthRef = (0, $lJcFS$useRef)(0);
|
|
671
|
-
const { moveProps: moveProps } = (0, $lJcFS$useMove)({
|
|
672
|
-
onMoveStart () {
|
|
673
|
-
columnResizeWidthRef.current = state.getColumnWidth(item.key);
|
|
674
|
-
startResize(item);
|
|
675
|
-
},
|
|
676
|
-
onMove (e) {
|
|
677
|
-
let { deltaX: deltaX, deltaY: deltaY, pointerType: pointerType } = e;
|
|
678
|
-
if (direction === "rtl") deltaX *= -1;
|
|
679
|
-
if (pointerType === "keyboard") {
|
|
680
|
-
if (deltaY !== 0 && deltaX === 0) deltaX = deltaY * -1;
|
|
681
|
-
deltaX *= 10;
|
|
682
|
-
}
|
|
683
|
-
// if moving up/down only, no need to resize
|
|
684
|
-
if (deltaX !== 0) {
|
|
685
|
-
columnResizeWidthRef.current += deltaX;
|
|
686
|
-
resize(item, columnResizeWidthRef.current);
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
|
-
onMoveEnd (e) {
|
|
690
|
-
let { pointerType: pointerType } = e;
|
|
691
|
-
columnResizeWidthRef.current = 0;
|
|
692
|
-
if (pointerType === "mouse" || pointerType === "touch" && wasFocusedOnResizeStart.current) endResize(item);
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
let onKeyDown = (0, $lJcFS$useCallback)((e)=>{
|
|
696
|
-
if (editModeEnabled) moveProps.onKeyDown(e);
|
|
697
|
-
}, [
|
|
698
|
-
editModeEnabled,
|
|
699
|
-
moveProps
|
|
700
|
-
]);
|
|
701
|
-
let min = Math.floor(state.getColumnMinWidth(item.key));
|
|
702
|
-
let max = Math.floor(state.getColumnMaxWidth(item.key));
|
|
703
|
-
if (max === Infinity) max = Number.MAX_SAFE_INTEGER;
|
|
704
|
-
let value = Math.floor(state.getColumnWidth(item.key));
|
|
705
|
-
let modality = (0, $lJcFS$useInteractionModality)();
|
|
706
|
-
if (modality === "virtual" && typeof window !== "undefined" && "ontouchstart" in window) modality = "touch";
|
|
707
|
-
let description = (triggerRef === null || triggerRef === void 0 ? void 0 : triggerRef.current) == null && (modality === "keyboard" || modality === "virtual") && !isResizing ? stringFormatter.format("resizerDescription") : undefined;
|
|
708
|
-
let descriptionProps = (0, $lJcFS$useDescription)(description);
|
|
709
|
-
let ariaProps = {
|
|
710
|
-
"aria-label": ariaLabel,
|
|
711
|
-
"aria-orientation": "horizontal",
|
|
712
|
-
"aria-labelledby": `${id} ${(0, $2140fb2337097f2d$export$37cd4213f2ad742e)(state.tableState, item.key)}`,
|
|
713
|
-
"aria-valuetext": stringFormatter.format("columnSize", {
|
|
714
|
-
value: value
|
|
715
|
-
}),
|
|
716
|
-
"type": "range",
|
|
717
|
-
min: min,
|
|
718
|
-
max: max,
|
|
719
|
-
value: value,
|
|
720
|
-
...descriptionProps
|
|
721
|
-
};
|
|
722
|
-
const focusInput = (0, $lJcFS$useCallback)(()=>{
|
|
723
|
-
if (ref.current) (0, $lJcFS$focusSafely)(ref.current);
|
|
724
|
-
}, [
|
|
725
|
-
ref
|
|
726
|
-
]);
|
|
727
|
-
let resizingColumn = state.resizingColumn;
|
|
728
|
-
let prevResizingColumn = (0, $lJcFS$useRef)(null);
|
|
729
|
-
(0, $lJcFS$useEffect)(()=>{
|
|
730
|
-
if (prevResizingColumn.current !== resizingColumn && resizingColumn != null && resizingColumn === item.key) {
|
|
731
|
-
wasFocusedOnResizeStart.current = document.activeElement === ref.current;
|
|
732
|
-
startResize(item);
|
|
733
|
-
// Delay focusing input until Android Chrome's delayed click after touchend happens: https://bugs.chromium.org/p/chromium/issues/detail?id=1150073
|
|
734
|
-
let timeout = setTimeout(()=>focusInput(), 0);
|
|
735
|
-
// VoiceOver on iOS has problems focusing the input from a menu.
|
|
736
|
-
let VOTimeout = setTimeout(focusInput, 400);
|
|
737
|
-
return ()=>{
|
|
738
|
-
clearTimeout(timeout);
|
|
739
|
-
clearTimeout(VOTimeout);
|
|
740
|
-
};
|
|
741
|
-
}
|
|
742
|
-
prevResizingColumn.current = resizingColumn;
|
|
743
|
-
}, [
|
|
744
|
-
resizingColumn,
|
|
745
|
-
item,
|
|
746
|
-
focusInput,
|
|
747
|
-
ref,
|
|
748
|
-
startResize
|
|
749
|
-
]);
|
|
750
|
-
let onChange = (e)=>{
|
|
751
|
-
let currentWidth = state.getColumnWidth(item.key);
|
|
752
|
-
let nextValue = parseFloat(e.target.value);
|
|
753
|
-
if (nextValue > currentWidth) nextValue = currentWidth + 10;
|
|
754
|
-
else nextValue = currentWidth - 10;
|
|
755
|
-
resize(item, nextValue);
|
|
756
|
-
};
|
|
757
|
-
let { pressProps: pressProps } = (0, $lJcFS$usePress)({
|
|
758
|
-
onPressStart: (e)=>{
|
|
759
|
-
if (e.ctrlKey || e.altKey || e.metaKey || e.shiftKey || e.pointerType === "keyboard") return;
|
|
760
|
-
if (e.pointerType === "virtual" && state.resizingColumn != null) {
|
|
761
|
-
endResize(item);
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
// Sometimes onPress won't trigger for quick taps on mobile so we want to focus the input so blurring away
|
|
765
|
-
// can cancel resize mode for us.
|
|
766
|
-
focusInput();
|
|
767
|
-
// If resizer is always visible, mobile screenreader user can access the visually hidden resizer directly and thus we don't need
|
|
768
|
-
// to handle a virtual click to start the resizer.
|
|
769
|
-
if (e.pointerType !== "virtual") startResize(item);
|
|
770
|
-
},
|
|
771
|
-
onPress: (e)=>{
|
|
772
|
-
if ((e.pointerType === "touch" && wasFocusedOnResizeStart.current || e.pointerType === "mouse") && state.resizingColumn != null) endResize(item);
|
|
773
|
-
}
|
|
774
|
-
});
|
|
775
|
-
let { visuallyHiddenProps: visuallyHiddenProps } = (0, $lJcFS$useVisuallyHidden)();
|
|
776
|
-
return {
|
|
777
|
-
resizerProps: (0, $lJcFS$mergeProps)(keyboardProps, {
|
|
778
|
-
...moveProps,
|
|
779
|
-
onKeyDown: onKeyDown
|
|
780
|
-
}, pressProps, {
|
|
781
|
-
style: {
|
|
782
|
-
touchAction: "none"
|
|
783
|
-
}
|
|
784
|
-
}),
|
|
785
|
-
inputProps: (0, $lJcFS$mergeProps)(visuallyHiddenProps, {
|
|
786
|
-
id: id,
|
|
787
|
-
onBlur: ()=>{
|
|
788
|
-
endResize(item);
|
|
789
|
-
},
|
|
790
|
-
onChange: onChange,
|
|
791
|
-
disabled: isDisabled
|
|
792
|
-
}, ariaProps),
|
|
793
|
-
isResizing: isResizing
|
|
794
|
-
};
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
28
|
function $0047e6c294ea075f$export$6fb1613bd7b28198() {
|
|
800
29
|
return (0, $lJcFS$useGridRowGroup)();
|
|
801
30
|
}
|