@react-spectrum/table 3.14.1 → 3.15.0
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/InsertionIndicator.main.js +4 -3
- package/dist/InsertionIndicator.main.js.map +1 -1
- package/dist/InsertionIndicator.mjs +4 -3
- package/dist/InsertionIndicator.module.js +4 -3
- package/dist/InsertionIndicator.module.js.map +1 -1
- package/dist/Resizer.main.js +4 -3
- package/dist/Resizer.main.js.map +1 -1
- package/dist/Resizer.mjs +5 -4
- package/dist/Resizer.module.js +5 -4
- package/dist/Resizer.module.js.map +1 -1
- package/dist/RootDropIndicator.main.js +1 -1
- package/dist/RootDropIndicator.main.js.map +1 -1
- package/dist/RootDropIndicator.mjs +1 -1
- package/dist/RootDropIndicator.module.js +1 -1
- package/dist/RootDropIndicator.module.js.map +1 -1
- package/dist/TableViewBase.main.js +80 -80
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +80 -80
- package/dist/TableViewBase.module.js +80 -80
- package/dist/TableViewBase.module.js.map +1 -1
- package/dist/TableViewLayout.main.js +7 -5
- package/dist/TableViewLayout.main.js.map +1 -1
- package/dist/TableViewLayout.mjs +7 -5
- package/dist/TableViewLayout.module.js +7 -5
- package/dist/TableViewLayout.module.js.map +1 -1
- package/dist/table_vars_css.main.js.map +1 -1
- package/dist/table_vars_css.module.js.map +1 -1
- package/package.json +29 -29
- package/src/InsertionIndicator.tsx +5 -5
- package/src/Resizer.tsx +10 -9
- package/src/RootDropIndicator.tsx +4 -4
- package/src/TableViewBase.tsx +136 -126
- package/src/TableViewLayout.ts +11 -5
|
@@ -130,7 +130,7 @@ function $e39c6de4eb69450d$export$3f8f74b6bfd2c5df() {
|
|
|
130
130
|
return (0, $idLTj$react.useContext)($e39c6de4eb69450d$export$d288a7dd40372bc);
|
|
131
131
|
}
|
|
132
132
|
function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
133
|
-
var _dropState_target;
|
|
133
|
+
var _dropState_target, _dragAndDropHooks_isVirtualDragging, _dragAndDropHooks_isVirtualDragging1;
|
|
134
134
|
props = (0, $idLTj$reactspectrumprovider.useProviderProps)(props);
|
|
135
135
|
let { isQuiet: isQuiet, onAction: onAction, onResizeStart: propsOnResizeStart, onResizeEnd: propsOnResizeEnd, dragAndDropHooks: dragAndDropHooks, state: state } = props;
|
|
136
136
|
let isTableDraggable = !!(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.useDraggableCollectionState);
|
|
@@ -156,25 +156,24 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
156
156
|
// with table layout, so we need to track it here
|
|
157
157
|
let [, setIsResizing] = (0, $idLTj$react.useState)(false);
|
|
158
158
|
let domRef = (0, $idLTj$reactspectrumutils.useDOMRef)(ref);
|
|
159
|
-
let headerRef = (0, $idLTj$react.useRef)(
|
|
160
|
-
let bodyRef = (0, $idLTj$react.useRef)(
|
|
159
|
+
let headerRef = (0, $idLTj$react.useRef)(null);
|
|
160
|
+
let bodyRef = (0, $idLTj$react.useRef)(null);
|
|
161
161
|
let density = props.density || 'regular';
|
|
162
162
|
let layout = (0, $idLTj$react.useMemo)(()=>new (0, $2b402d473779c595$exports.TableViewLayout)({
|
|
163
163
|
// If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
|
|
164
|
-
rowHeight: props.overflowMode === 'wrap' ?
|
|
165
|
-
estimatedRowHeight: props.overflowMode === 'wrap' ? $e39c6de4eb69450d$var$ROW_HEIGHTS[density][scale] :
|
|
166
|
-
headingHeight: props.overflowMode === 'wrap' ?
|
|
167
|
-
estimatedHeadingHeight: props.overflowMode === 'wrap' ? $e39c6de4eb69450d$var$DEFAULT_HEADER_HEIGHT[scale] :
|
|
164
|
+
rowHeight: props.overflowMode === 'wrap' ? undefined : $e39c6de4eb69450d$var$ROW_HEIGHTS[density][scale],
|
|
165
|
+
estimatedRowHeight: props.overflowMode === 'wrap' ? $e39c6de4eb69450d$var$ROW_HEIGHTS[density][scale] : undefined,
|
|
166
|
+
headingHeight: props.overflowMode === 'wrap' ? undefined : $e39c6de4eb69450d$var$DEFAULT_HEADER_HEIGHT[scale],
|
|
167
|
+
estimatedHeadingHeight: props.overflowMode === 'wrap' ? $e39c6de4eb69450d$var$DEFAULT_HEADER_HEIGHT[scale] : undefined
|
|
168
168
|
}), // don't recompute when state.collection changes, only used for initial value
|
|
169
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
170
169
|
[
|
|
171
170
|
props.overflowMode,
|
|
172
171
|
scale,
|
|
173
172
|
density
|
|
174
173
|
]);
|
|
175
|
-
let dragState;
|
|
174
|
+
let dragState = null;
|
|
176
175
|
let preview = (0, $idLTj$react.useRef)(null);
|
|
177
|
-
if (isTableDraggable) {
|
|
176
|
+
if (isTableDraggable && dragAndDropHooks) {
|
|
178
177
|
dragState = dragAndDropHooks.useDraggableCollectionState({
|
|
179
178
|
collection: state.collection,
|
|
180
179
|
selectionManager: state.selectionManager,
|
|
@@ -183,10 +182,10 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
183
182
|
dragAndDropHooks.useDraggableCollection({}, dragState, domRef);
|
|
184
183
|
}
|
|
185
184
|
let DragPreview = dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.DragPreview;
|
|
186
|
-
let dropState;
|
|
187
|
-
let droppableCollection;
|
|
188
|
-
let isRootDropTarget;
|
|
189
|
-
if (isTableDroppable) {
|
|
185
|
+
let dropState = null;
|
|
186
|
+
let droppableCollection = null;
|
|
187
|
+
let isRootDropTarget = false;
|
|
188
|
+
if (isTableDroppable && dragAndDropHooks) {
|
|
190
189
|
dropState = dragAndDropHooks.useDroppableCollectionState({
|
|
191
190
|
collection: state.collection,
|
|
192
191
|
selectionManager: state.selectionManager
|
|
@@ -215,31 +214,35 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
215
214
|
let [headerRowHovered, setHeaderRowHovered] = (0, $idLTj$react.useState)(false);
|
|
216
215
|
// This overrides collection view's renderWrapper to support DOM hierarchy.
|
|
217
216
|
let renderWrapper = (0, $idLTj$react.useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
217
|
+
var _parent_layoutInfo;
|
|
218
218
|
if (reusableView.viewType === 'rowgroup') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableRowGroup, {
|
|
219
219
|
key: reusableView.key,
|
|
220
220
|
layoutInfo: reusableView.layoutInfo,
|
|
221
|
-
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
221
|
+
parent: (_parent_layoutInfo = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo !== void 0 ? _parent_layoutInfo : null,
|
|
222
222
|
// Override the default role="rowgroup" with role="presentation",
|
|
223
223
|
// in favor or adding role="rowgroup" to the ScrollView with
|
|
224
224
|
// ref={bodyRef} in the TableVirtualizer below.
|
|
225
225
|
role: "presentation"
|
|
226
226
|
}, renderChildren(children));
|
|
227
|
+
var _parent_layoutInfo1;
|
|
227
228
|
if (reusableView.viewType === 'header') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableHeader, {
|
|
228
229
|
key: reusableView.key,
|
|
229
230
|
layoutInfo: reusableView.layoutInfo,
|
|
230
|
-
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
231
|
+
parent: (_parent_layoutInfo1 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo1 !== void 0 ? _parent_layoutInfo1 : null
|
|
231
232
|
}, renderChildren(children));
|
|
233
|
+
var _parent_layoutInfo2;
|
|
232
234
|
if (reusableView.viewType === 'row') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableRow, {
|
|
233
235
|
key: reusableView.key,
|
|
234
236
|
item: reusableView.content,
|
|
235
237
|
layoutInfo: reusableView.layoutInfo,
|
|
236
|
-
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
238
|
+
parent: (_parent_layoutInfo2 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo2 !== void 0 ? _parent_layoutInfo2 : null
|
|
237
239
|
}, renderChildren(children));
|
|
240
|
+
var _parent_layoutInfo3;
|
|
238
241
|
if (reusableView.viewType === 'headerrow') return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableHeaderRow, {
|
|
239
242
|
onHoverChange: setHeaderRowHovered,
|
|
240
243
|
key: reusableView.key,
|
|
241
244
|
layoutInfo: reusableView.layoutInfo,
|
|
242
|
-
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
245
|
+
parent: (_parent_layoutInfo3 = parent === null || parent === void 0 ? void 0 : parent.layoutInfo) !== null && _parent_layoutInfo3 !== void 0 ? _parent_layoutInfo3 : null,
|
|
243
246
|
item: reusableView.content
|
|
244
247
|
}, renderChildren(children));
|
|
245
248
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableCellWrapper, {
|
|
@@ -272,7 +275,7 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
272
275
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
273
276
|
role: "gridcell",
|
|
274
277
|
"aria-colindex": item.index + 1,
|
|
275
|
-
"aria-colspan": item.colspan > 1 ? item.colspan :
|
|
278
|
+
"aria-colspan": item.colspan != null && item.colspan > 1 ? item.colspan : undefined
|
|
276
279
|
});
|
|
277
280
|
case 'column':
|
|
278
281
|
if (item.props.isSelectionCell) return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableSelectAllCell, {
|
|
@@ -301,6 +304,7 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
301
304
|
case 'empty':
|
|
302
305
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$EmptyState, null);
|
|
303
306
|
}
|
|
307
|
+
return null;
|
|
304
308
|
}, []);
|
|
305
309
|
let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = (0, $idLTj$react.useState)(false);
|
|
306
310
|
let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = (0, $idLTj$react.useState)(false);
|
|
@@ -321,7 +325,7 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
321
325
|
let { isFocusVisible: isFocusVisible, focusProps: focusProps } = (0, $idLTj$reactariafocus.useFocusRing)();
|
|
322
326
|
let isEmpty = state.collection.size === 0;
|
|
323
327
|
let onFocusedResizer = ()=>{
|
|
324
|
-
bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
328
|
+
if (bodyRef.current && headerRef.current) bodyRef.current.scrollLeft = headerRef.current.scrollLeft;
|
|
325
329
|
};
|
|
326
330
|
let onResizeStart = (0, $idLTj$react.useCallback)((widths)=>{
|
|
327
331
|
setIsResizing(true);
|
|
@@ -356,9 +360,8 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
356
360
|
focusedKey,
|
|
357
361
|
dropTargetKey
|
|
358
362
|
]);
|
|
359
|
-
let mergedProps = (0, $idLTj$reactariautils.mergeProps)(isTableDroppable
|
|
360
|
-
|
|
361
|
-
});
|
|
363
|
+
let mergedProps = (0, $idLTj$reactariautils.mergeProps)(isTableDroppable ? droppableCollection === null || droppableCollection === void 0 ? void 0 : droppableCollection.collectionProps : null, gridProps, focusProps);
|
|
364
|
+
if (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) mergedProps.tabIndex = undefined;
|
|
362
365
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$export$93e4b0b2cc49b648.Provider, {
|
|
363
366
|
value: {
|
|
364
367
|
state: state,
|
|
@@ -401,11 +404,12 @@ function $e39c6de4eb69450d$var$TableViewBase(props, ref) {
|
|
|
401
404
|
headerRef: headerRef,
|
|
402
405
|
bodyRef: bodyRef,
|
|
403
406
|
isFocusVisible: isFocusVisible,
|
|
404
|
-
isVirtualDragging: dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging(),
|
|
407
|
+
isVirtualDragging: (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging1 = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging1 === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging1.call(dragAndDropHooks)) || false,
|
|
405
408
|
isRootDropTarget: isRootDropTarget
|
|
406
|
-
}), DragPreview && isTableDraggable && /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement(DragPreview, {
|
|
409
|
+
}), DragPreview && isTableDraggable && dragAndDropHooks && dragState && /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement(DragPreview, {
|
|
407
410
|
ref: preview
|
|
408
411
|
}, ()=>{
|
|
412
|
+
if (dragState.draggedKey == null) return null;
|
|
409
413
|
if (dragAndDropHooks.renderPreview) return dragAndDropHooks.renderPreview(dragState.draggingKeys, dragState.draggedKey);
|
|
410
414
|
let itemCount = dragState.draggingKeys.size;
|
|
411
415
|
let maxWidth = bodyRef.current.getBoundingClientRect().width;
|
|
@@ -458,8 +462,10 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
458
462
|
collection: collection,
|
|
459
463
|
renderView: renderView,
|
|
460
464
|
onVisibleRectChange (rect) {
|
|
461
|
-
bodyRef.current
|
|
462
|
-
|
|
465
|
+
if (bodyRef.current) {
|
|
466
|
+
bodyRef.current.scrollTop = rect.y;
|
|
467
|
+
(0, $idLTj$reactariavirtualizer.setScrollLeft)(bodyRef.current, direction, rect.x);
|
|
468
|
+
}
|
|
463
469
|
},
|
|
464
470
|
persistedKeys: persistedKeys,
|
|
465
471
|
layoutOptions: (0, $idLTj$react.useMemo)(()=>({
|
|
@@ -490,7 +496,8 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
490
496
|
// only that it changes in a resize, and when that happens, we want to sync the body to the
|
|
491
497
|
// header scroll position
|
|
492
498
|
(0, $idLTj$react.useEffect)(()=>{
|
|
493
|
-
|
|
499
|
+
var _headerRef_current;
|
|
500
|
+
if ((0, $idLTj$reactariainteractions.getInteractionModality)() === 'keyboard' && ((_headerRef_current = headerRef.current) === null || _headerRef_current === void 0 ? void 0 : _headerRef_current.contains(document.activeElement)) && bodyRef.current) {
|
|
494
501
|
(0, $idLTj$reactariautils.scrollIntoView)(headerRef.current, document.activeElement);
|
|
495
502
|
(0, $idLTj$reactariautils.scrollIntoViewport)(document.activeElement, {
|
|
496
503
|
containingElement: domRef.current
|
|
@@ -506,7 +513,7 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
506
513
|
let headerHeight = ((_layout_getLayoutInfo = layout.getLayoutInfo('header')) === null || _layout_getLayoutInfo === void 0 ? void 0 : _layout_getLayoutInfo.rect.height) || 0;
|
|
507
514
|
// Sync the scroll position from the table body to the header container.
|
|
508
515
|
let onScroll = (0, $idLTj$react.useCallback)(()=>{
|
|
509
|
-
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
516
|
+
if (headerRef.current && bodyRef.current) headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
510
517
|
}, [
|
|
511
518
|
bodyRef,
|
|
512
519
|
headerRef
|
|
@@ -526,9 +533,7 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
526
533
|
resizingColumnWidth,
|
|
527
534
|
columnResizeState.resizingColumn
|
|
528
535
|
]);
|
|
529
|
-
|
|
530
|
-
tabIndex: null
|
|
531
|
-
});
|
|
536
|
+
if (isVirtualDragging) otherProps.tabIndex = undefined;
|
|
532
537
|
let firstColumn = collection.columns[0];
|
|
533
538
|
let scrollPadding = 0;
|
|
534
539
|
if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding = columnResizeState.getColumnWidth(firstColumn.key);
|
|
@@ -536,7 +541,7 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
536
541
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$export$d288a7dd40372bc.Provider, {
|
|
537
542
|
value: resizingColumn
|
|
538
543
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $idLTj$reactariafocus.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
539
|
-
...
|
|
544
|
+
...otherProps,
|
|
540
545
|
ref: domRef
|
|
541
546
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
542
547
|
role: "presentation",
|
|
@@ -563,7 +568,7 @@ function $e39c6de4eb69450d$var$TableVirtualizer(props) {
|
|
|
563
568
|
// Using tabIndex={-1} prevents the ScrollView from being tabbable, and using role="rowgroup"
|
|
564
569
|
// here and role="presentation" on the table body content fixes the table structure.
|
|
565
570
|
role: "rowgroup",
|
|
566
|
-
tabIndex: isVirtualDragging ?
|
|
571
|
+
tabIndex: isVirtualDragging ? undefined : -1,
|
|
567
572
|
style: {
|
|
568
573
|
flex: 1,
|
|
569
574
|
scrollPaddingInlineStart: scrollPadding
|
|
@@ -658,7 +663,7 @@ function $e39c6de4eb69450d$var$TableColumnHeader(props) {
|
|
|
658
663
|
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-headCellContents')
|
|
659
664
|
}, column.rendered)));
|
|
660
665
|
}
|
|
661
|
-
let $e39c6de4eb69450d$var$
|
|
666
|
+
let $e39c6de4eb69450d$var$ForwardTableColumnHeaderButton = (props, ref)=>{
|
|
662
667
|
let { focusProps: focusProps, alignment: alignment, ...otherProps } = props;
|
|
663
668
|
let { isEmpty: isEmpty } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
664
669
|
let domRef = (0, $idLTj$reactspectrumutils.useFocusableRef)(ref);
|
|
@@ -686,7 +691,7 @@ let $e39c6de4eb69450d$var$_TableColumnHeaderButton = (props, ref)=>{
|
|
|
686
691
|
ref: domRef
|
|
687
692
|
}, props.children));
|
|
688
693
|
};
|
|
689
|
-
let $e39c6de4eb69450d$var$TableColumnHeaderButton = /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).forwardRef($e39c6de4eb69450d$var$
|
|
694
|
+
let $e39c6de4eb69450d$var$TableColumnHeaderButton = /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).forwardRef($e39c6de4eb69450d$var$ForwardTableColumnHeaderButton);
|
|
690
695
|
function $e39c6de4eb69450d$var$ResizableTableColumnHeader(props) {
|
|
691
696
|
var _column_props, _state_sortDescriptor, _state_sortDescriptor1, _state_sortDescriptor2, _state_sortDescriptor3;
|
|
692
697
|
let { column: column } = props;
|
|
@@ -731,20 +736,21 @@ function $e39c6de4eb69450d$var$ResizableTableColumnHeader(props) {
|
|
|
731
736
|
};
|
|
732
737
|
let allowsSorting = (_column_props = column.props) === null || _column_props === void 0 ? void 0 : _column_props.allowsSorting;
|
|
733
738
|
let items = (0, $idLTj$react.useMemo)(()=>{
|
|
734
|
-
let options = [
|
|
735
|
-
|
|
739
|
+
let options = [];
|
|
740
|
+
if (allowsSorting) {
|
|
741
|
+
options.push({
|
|
736
742
|
label: stringFormatter.format('sortAscending'),
|
|
737
743
|
id: 'sort-asc'
|
|
738
|
-
}
|
|
739
|
-
|
|
744
|
+
});
|
|
745
|
+
options.push({
|
|
740
746
|
label: stringFormatter.format('sortDescending'),
|
|
741
747
|
id: 'sort-desc'
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
options.push({
|
|
751
|
+
label: stringFormatter.format('resizeColumn'),
|
|
752
|
+
id: 'resize'
|
|
753
|
+
});
|
|
748
754
|
return options;
|
|
749
755
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
750
756
|
}, [
|
|
@@ -815,7 +821,7 @@ function $e39c6de4eb69450d$var$ResizableTableColumnHeader(props) {
|
|
|
815
821
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement((0, $18b3deb5c431fa13$exports.Nubbin), null)))));
|
|
816
822
|
}
|
|
817
823
|
function $e39c6de4eb69450d$var$TableSelectAllCell({ column: column }) {
|
|
818
|
-
let ref = (0, $idLTj$react.useRef)(
|
|
824
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
819
825
|
let { state: state } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
820
826
|
let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
|
|
821
827
|
let { columnHeaderProps: columnHeaderProps } = (0, $idLTj$reactariatable.useTableColumnHeader)({
|
|
@@ -847,7 +853,7 @@ function $e39c6de4eb69450d$var$TableSelectAllCell({ column: column }) {
|
|
|
847
853
|
})));
|
|
848
854
|
}
|
|
849
855
|
function $e39c6de4eb69450d$var$TableDragHeaderCell({ column: column }) {
|
|
850
|
-
let ref = (0, $idLTj$react.useRef)(
|
|
856
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
851
857
|
let { state: state } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
852
858
|
let { columnHeaderProps: columnHeaderProps } = (0, $idLTj$reactariatable.useTableColumnHeader)({
|
|
853
859
|
node: column,
|
|
@@ -896,8 +902,10 @@ function $e39c6de4eb69450d$export$cd7c5802f9e21187() {
|
|
|
896
902
|
return (0, $idLTj$react.useContext)($e39c6de4eb69450d$var$TableRowContext);
|
|
897
903
|
}
|
|
898
904
|
function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
899
|
-
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer
|
|
900
|
-
|
|
905
|
+
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
|
|
906
|
+
// allowing for single swipe navigation between row drop indicator
|
|
907
|
+
_dragAndDropHooks_isVirtualDragging;
|
|
908
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
901
909
|
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, isTableDraggable: isTableDraggable, isTableDroppable: isTableDroppable, dragState: dragState, dropState: dropState } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
902
910
|
let isSelected = state.selectionManager.isSelected(item.key);
|
|
903
911
|
let { rowProps: rowProps, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $idLTj$reactariatable.useTableRow)({
|
|
@@ -907,7 +915,6 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layout
|
|
|
907
915
|
}, state, ref);
|
|
908
916
|
let isDisabled = state.selectionManager.isDisabled(item.key);
|
|
909
917
|
let isInteractive = !isDisabled && (hasAction || allowsSelection || isTableDraggable);
|
|
910
|
-
let isDroppable = isTableDroppable && !isDisabled;
|
|
911
918
|
let { pressProps: pressProps, isPressed: isPressed } = (0, $idLTj$reactariainteractions.usePress)({
|
|
912
919
|
isDisabled: !isInteractive
|
|
913
920
|
});
|
|
@@ -925,35 +932,33 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layout
|
|
|
925
932
|
// Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
|
|
926
933
|
// border corners of the last row when selected.
|
|
927
934
|
let isFlushWithContainerBottom = false;
|
|
935
|
+
var _layout_virtualizer_visibleRect_height;
|
|
928
936
|
if (isLastRow) {
|
|
929
|
-
if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height)) isFlushWithContainerBottom = true;
|
|
937
|
+
if (((_layout_getContentSize = layout.getContentSize()) === null || _layout_getContentSize === void 0 ? void 0 : _layout_getContentSize.height) >= ((_layout_virtualizer_visibleRect_height = (_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.visibleRect.height) !== null && _layout_virtualizer_visibleRect_height !== void 0 ? _layout_virtualizer_visibleRect_height : 0)) isFlushWithContainerBottom = true;
|
|
930
938
|
}
|
|
931
|
-
let draggableItem;
|
|
932
|
-
if (isTableDraggable) {
|
|
933
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
939
|
+
let draggableItem = null;
|
|
940
|
+
if (isTableDraggable && dragAndDropHooks && dragState) {
|
|
934
941
|
draggableItem = dragAndDropHooks.useDraggableItem({
|
|
935
942
|
key: item.key,
|
|
936
943
|
hasDragButton: true
|
|
937
944
|
}, dragState);
|
|
938
945
|
if (isDisabled) draggableItem = null;
|
|
939
946
|
}
|
|
940
|
-
let
|
|
941
|
-
let
|
|
942
|
-
let
|
|
943
|
-
|
|
944
|
-
if (isTableDroppable) {
|
|
947
|
+
let isDropTarget = false;
|
|
948
|
+
let dropIndicator = null;
|
|
949
|
+
let dropIndicatorRef = (0, $idLTj$react.useRef)(null);
|
|
950
|
+
if (isTableDroppable && dragAndDropHooks && dropState) {
|
|
945
951
|
let target = {
|
|
946
952
|
type: 'item',
|
|
947
953
|
key: item.key,
|
|
948
954
|
dropPosition: 'on'
|
|
949
955
|
};
|
|
950
956
|
isDropTarget = dropState.isDropTarget(target);
|
|
951
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
952
957
|
dropIndicator = dragAndDropHooks.useDropIndicator({
|
|
953
958
|
target: target
|
|
954
959
|
}, dropState, dropIndicatorRef);
|
|
955
960
|
}
|
|
956
|
-
let dragButtonRef = (0, ($parcel$interopDefault($idLTj$react))).useRef(
|
|
961
|
+
let dragButtonRef = (0, ($parcel$interopDefault($idLTj$react))).useRef(null);
|
|
957
962
|
let { buttonProps: dragButtonProps } = (0, $idLTj$reactariabutton.useButton)({
|
|
958
963
|
...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
|
|
959
964
|
elementType: 'div'
|
|
@@ -961,14 +966,9 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layout
|
|
|
961
966
|
let style = $e39c6de4eb69450d$var$useStyle(layoutInfo, parent);
|
|
962
967
|
let props = (0, $idLTj$reactariautils.mergeProps)(rowProps, otherProps, {
|
|
963
968
|
style: style
|
|
964
|
-
}, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps,
|
|
965
|
-
// allowing for single swipe navigation between row drop indicator
|
|
966
|
-
(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
|
|
969
|
+
}, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, (dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : (_dragAndDropHooks_isVirtualDragging = dragAndDropHooks.isVirtualDragging) === null || _dragAndDropHooks_isVirtualDragging === void 0 ? void 0 : _dragAndDropHooks_isVirtualDragging.call(dragAndDropHooks)) ? {
|
|
967
970
|
tabIndex: null
|
|
968
|
-
});
|
|
969
|
-
let dropProps = isDroppable ? droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps : {
|
|
970
|
-
'aria-hidden': droppableItem === null || droppableItem === void 0 ? void 0 : droppableItem.dropProps['aria-hidden']
|
|
971
|
-
};
|
|
971
|
+
} : null);
|
|
972
972
|
let { visuallyHiddenProps: visuallyHiddenProps } = (0, $idLTj$reactariavisuallyhidden.useVisuallyHidden)();
|
|
973
973
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$TableRowContext.Provider, {
|
|
974
974
|
value: {
|
|
@@ -994,13 +994,13 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layout
|
|
|
994
994
|
...dropIndicator === null || dropIndicator === void 0 ? void 0 : dropIndicator.dropIndicatorProps,
|
|
995
995
|
ref: dropIndicatorRef
|
|
996
996
|
}))), /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement("div", {
|
|
997
|
-
...
|
|
997
|
+
...props,
|
|
998
998
|
ref: ref,
|
|
999
999
|
className: (0, $idLTj$reactspectrumutils.classNames)((0, ($parcel$interopDefault($982885d0a34882ea$exports))), 'spectrum-Table-row', {
|
|
1000
1000
|
'is-active': isPressed,
|
|
1001
1001
|
'is-selected': isSelected,
|
|
1002
1002
|
'spectrum-Table-row--highlightSelection': state.selectionManager.selectionBehavior === 'replace',
|
|
1003
|
-
'is-next-selected': state.selectionManager.isSelected(item.nextKey),
|
|
1003
|
+
'is-next-selected': item.nextKey != null && state.selectionManager.isSelected(item.nextKey),
|
|
1004
1004
|
'is-focused': isFocusVisibleWithin,
|
|
1005
1005
|
'focus-ring': isFocusVisible,
|
|
1006
1006
|
'is-hovered': isHovered,
|
|
@@ -1023,7 +1023,7 @@ function $e39c6de4eb69450d$var$TableRow({ item: item, children: children, layout
|
|
|
1023
1023
|
}
|
|
1024
1024
|
function $e39c6de4eb69450d$var$TableHeaderRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...props }) {
|
|
1025
1025
|
let { state: state, headerMenuOpen: headerMenuOpen } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1026
|
-
let ref = (0, $idLTj$react.useRef)(
|
|
1026
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
1027
1027
|
let { rowProps: rowProps } = (0, $idLTj$reactariatable.useTableHeaderRow)({
|
|
1028
1028
|
node: item,
|
|
1029
1029
|
isVirtualized: true
|
|
@@ -1040,7 +1040,7 @@ function $e39c6de4eb69450d$var$TableHeaderRow({ item: item, children: children,
|
|
|
1040
1040
|
}, children);
|
|
1041
1041
|
}
|
|
1042
1042
|
function $e39c6de4eb69450d$var$TableDragCell({ cell: cell }) {
|
|
1043
|
-
let ref = (0, $idLTj$react.useRef)(
|
|
1043
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
1044
1044
|
let { state: state, isTableDraggable: isTableDraggable } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1045
1045
|
let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
|
|
1046
1046
|
let { gridCellProps: gridCellProps } = (0, $idLTj$reactariatable.useTableCell)({
|
|
@@ -1058,7 +1058,7 @@ function $e39c6de4eb69450d$var$TableDragCell({ cell: cell }) {
|
|
|
1058
1058
|
}, isTableDraggable && !isDisabled && /*#__PURE__*/ (0, ($parcel$interopDefault($idLTj$react))).createElement($e39c6de4eb69450d$var$DragButton, null)));
|
|
1059
1059
|
}
|
|
1060
1060
|
function $e39c6de4eb69450d$var$TableCheckboxCell({ cell: cell }) {
|
|
1061
|
-
let ref = (0, $idLTj$react.useRef)(
|
|
1061
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
1062
1062
|
let { state: state } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1063
1063
|
// The TableCheckbox should always render its disabled status if the row is disabled, regardless of disabledBehavior,
|
|
1064
1064
|
// but the cell itself should not render its disabled styles if disabledBehavior="selection" because the row might have actions on it.
|
|
@@ -1090,7 +1090,7 @@ function $e39c6de4eb69450d$var$TableCell({ cell: cell }) {
|
|
|
1090
1090
|
let { scale: scale } = (0, $idLTj$reactspectrumprovider.useProvider)();
|
|
1091
1091
|
let { state: state } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1092
1092
|
let isExpandableTable = 'expandedKeys' in state;
|
|
1093
|
-
let ref = (0, $idLTj$react.useRef)(
|
|
1093
|
+
let ref = (0, $idLTj$react.useRef)(null);
|
|
1094
1094
|
let columnProps = cell.column.props;
|
|
1095
1095
|
let isDisabled = state.selectionManager.isDisabled(cell.parentKey);
|
|
1096
1096
|
let { gridCellProps: gridCellProps } = (0, $idLTj$reactariatable.useTableCell)({
|
|
@@ -1137,9 +1137,9 @@ function $e39c6de4eb69450d$var$TableCell({ cell: cell }) {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
function $e39c6de4eb69450d$var$TableCellWrapper({ layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children }) {
|
|
1139
1139
|
let { isTableDroppable: isTableDroppable, dropState: dropState } = (0, $idLTj$react.useContext)($e39c6de4eb69450d$export$93e4b0b2cc49b648);
|
|
1140
|
-
let isDropTarget;
|
|
1141
|
-
let isRootDroptarget;
|
|
1142
|
-
if (isTableDroppable) {
|
|
1140
|
+
let isDropTarget = false;
|
|
1141
|
+
let isRootDroptarget = false;
|
|
1142
|
+
if (isTableDroppable && dropState) {
|
|
1143
1143
|
if (parent.content) isDropTarget = dropState.isDropTarget({
|
|
1144
1144
|
type: 'item',
|
|
1145
1145
|
dropPosition: 'on',
|
|
@@ -1167,7 +1167,7 @@ function $e39c6de4eb69450d$var$ExpandableRowChevron({ cell: cell }) {
|
|
|
1167
1167
|
// TODO: move some/all of the chevron button setup into a separate hook?
|
|
1168
1168
|
let { direction: direction } = (0, $idLTj$reactariai18n.useLocale)();
|
|
1169
1169
|
let { state: state } = $e39c6de4eb69450d$export$3cb274deb6c2d854();
|
|
1170
|
-
let expandButtonRef = (0, $idLTj$react.useRef)(
|
|
1170
|
+
let expandButtonRef = (0, $idLTj$react.useRef)(null);
|
|
1171
1171
|
let stringFormatter = (0, $idLTj$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($1a3d6ad53eb75d54$exports))), '@react-spectrum/table');
|
|
1172
1172
|
let isExpanded;
|
|
1173
1173
|
if ('expandedKeys' in state) isExpanded = state.expandedKeys === 'all' || state.expandedKeys.has(cell.parentKey);
|
|
@@ -1213,7 +1213,7 @@ function $e39c6de4eb69450d$var$CenteredWrapper({ children: children }) {
|
|
|
1213
1213
|
let rowProps;
|
|
1214
1214
|
if ('expandedKeys' in state) {
|
|
1215
1215
|
let topLevelRowCount = [
|
|
1216
|
-
...state.
|
|
1216
|
+
...state.collection.body.childNodes
|
|
1217
1217
|
].length;
|
|
1218
1218
|
rowProps = {
|
|
1219
1219
|
'aria-level': 1,
|