@react-spectrum/table 3.12.11-nightly.4649 → 3.12.11-nightly.4654
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/TableViewBase.main.js +113 -97
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +115 -99
- package/dist/TableViewBase.module.js +115 -99
- package/dist/TableViewBase.module.js.map +1 -1
- package/package.json +29 -29
- package/src/TableViewBase.tsx +157 -117
package/dist/TableViewBase.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import $7lS7h$table_vars_cssmodulejs from "./table_vars_css.mjs";
|
|
|
9
9
|
import "./table.b13eee90.css";
|
|
10
10
|
import $7lS7h$table_cssmodulejs from "./table_css.mjs";
|
|
11
11
|
import $7lS7h$spectrumiconsuiArrowDownSmall from "@spectrum-icons/ui/ArrowDownSmall";
|
|
12
|
-
import {mergeProps as $7lS7h$mergeProps,
|
|
12
|
+
import {mergeProps as $7lS7h$mergeProps, chain as $7lS7h$chain, scrollIntoView as $7lS7h$scrollIntoView, scrollIntoViewport as $7lS7h$scrollIntoViewport, isAndroid as $7lS7h$isAndroid} from "@react-aria/utils";
|
|
13
13
|
import {Checkbox as $7lS7h$Checkbox} from "@react-spectrum/checkbox";
|
|
14
14
|
import $7lS7h$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
|
|
15
15
|
import $7lS7h$spectrumiconsuiChevronLeftMedium from "@spectrum-icons/ui/ChevronLeftMedium";
|
|
@@ -18,11 +18,11 @@ import {useStyleProps as $7lS7h$useStyleProps, useDOMRef as $7lS7h$useDOMRef, cl
|
|
|
18
18
|
import {useFocusRing as $7lS7h$useFocusRing, FocusScope as $7lS7h$FocusScope, FocusRing as $7lS7h$FocusRing} from "@react-aria/focus";
|
|
19
19
|
import {getInteractionModality as $7lS7h$getInteractionModality, usePress as $7lS7h$usePress, useHover as $7lS7h$useHover, isFocusVisible as $7lS7h$isFocusVisible} from "@react-aria/interactions";
|
|
20
20
|
import {MenuTrigger as $7lS7h$MenuTrigger, Menu as $7lS7h$Menu, Item as $7lS7h$Item} from "@react-spectrum/menu";
|
|
21
|
-
import {
|
|
21
|
+
import {useVirtualizerState as $7lS7h$useVirtualizerState} from "@react-stately/virtualizer";
|
|
22
|
+
import {setScrollLeft as $7lS7h$setScrollLeft, useVirtualizer as $7lS7h$useVirtualizer, ScrollView as $7lS7h$ScrollView, layoutInfoToStyle as $7lS7h$layoutInfoToStyle, VirtualizerItem as $7lS7h$VirtualizerItem} from "@react-aria/virtualizer";
|
|
22
23
|
import $7lS7h$spectrumiconsuiListGripper from "@spectrum-icons/ui/ListGripper";
|
|
23
24
|
import {ProgressCircle as $7lS7h$ProgressCircle} from "@react-spectrum/progress";
|
|
24
25
|
import $7lS7h$react, {useContext as $7lS7h$useContext, useRef as $7lS7h$useRef, useEffect as $7lS7h$useEffect, useCallback as $7lS7h$useCallback, useState as $7lS7h$useState, useMemo as $7lS7h$useMemo} from "react";
|
|
25
|
-
import {useVirtualizerState as $7lS7h$useVirtualizerState} from "@react-stately/virtualizer";
|
|
26
26
|
import {TableColumnLayout as $7lS7h$TableColumnLayout} from "@react-stately/table";
|
|
27
27
|
import {TableLayout as $7lS7h$TableLayout} from "@react-stately/layout";
|
|
28
28
|
import {TooltipTrigger as $7lS7h$TooltipTrigger, Tooltip as $7lS7h$Tooltip} from "@react-spectrum/tooltip";
|
|
@@ -137,7 +137,6 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
137
137
|
state
|
|
138
138
|
]);
|
|
139
139
|
let { styleProps: styleProps } = (0, $7lS7h$useStyleProps)(props);
|
|
140
|
-
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
141
140
|
let { scale: scale } = (0, $7lS7h$useProvider)();
|
|
142
141
|
const getDefaultWidth = (0, $7lS7h$useCallback)(({ props: { hideHeader: hideHeader, isSelectionCell: isSelectionCell, showDivider: showDivider, isDragButtonCell: isDragButtonCell } })=>{
|
|
143
142
|
if (hideHeader) {
|
|
@@ -168,7 +167,6 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
168
167
|
let domRef = (0, $7lS7h$useDOMRef)(ref);
|
|
169
168
|
let headerRef = (0, $7lS7h$useRef)();
|
|
170
169
|
let bodyRef = (0, $7lS7h$useRef)();
|
|
171
|
-
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
172
170
|
let density = props.density || 'regular';
|
|
173
171
|
let columnLayout = (0, $7lS7h$useMemo)(()=>new (0, $7lS7h$TableColumnLayout)({
|
|
174
172
|
getDefaultWidth: getDefaultWidth,
|
|
@@ -237,61 +235,43 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
237
235
|
...props,
|
|
238
236
|
isVirtualized: true,
|
|
239
237
|
layout: layout,
|
|
240
|
-
onRowAction: onAction
|
|
238
|
+
onRowAction: onAction,
|
|
239
|
+
scrollRef: bodyRef
|
|
241
240
|
}, state, domRef);
|
|
242
241
|
let [headerMenuOpen, setHeaderMenuOpen] = (0, $7lS7h$useState)(false);
|
|
243
242
|
let [headerRowHovered, setHeaderRowHovered] = (0, $7lS7h$useState)(false);
|
|
244
|
-
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
245
|
-
let style = (0, $7lS7h$layoutInfoToStyle)(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
|
|
246
|
-
if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
|
|
243
|
+
let renderWrapper = (0, $7lS7h$useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
247
244
|
if (reusableView.viewType === 'rowgroup') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRowGroup, {
|
|
248
245
|
key: reusableView.key,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}), renderChildren(children));
|
|
246
|
+
layoutInfo: reusableView.layoutInfo,
|
|
247
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
248
|
+
}, renderChildren(children));
|
|
253
249
|
if (reusableView.viewType === 'header') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableHeader, {
|
|
254
250
|
key: reusableView.key,
|
|
255
|
-
|
|
251
|
+
layoutInfo: reusableView.layoutInfo,
|
|
252
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
256
253
|
}, renderChildren(children));
|
|
257
254
|
if (reusableView.viewType === 'row') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableRow, {
|
|
258
255
|
key: reusableView.key,
|
|
259
256
|
item: reusableView.content,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
isTableDroppable: isTableDroppable,
|
|
263
|
-
isTableDraggable: isTableDraggable
|
|
257
|
+
layoutInfo: reusableView.layoutInfo,
|
|
258
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
264
259
|
}, renderChildren(children));
|
|
265
260
|
if (reusableView.viewType === 'headerrow') return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableHeaderRow, {
|
|
266
261
|
onHoverChange: setHeaderRowHovered,
|
|
267
262
|
key: reusableView.key,
|
|
268
|
-
|
|
263
|
+
layoutInfo: reusableView.layoutInfo,
|
|
264
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
269
265
|
item: reusableView.content
|
|
270
266
|
}, renderChildren(children));
|
|
271
|
-
|
|
272
|
-
let isRootDroptarget;
|
|
273
|
-
if (isTableDroppable) {
|
|
274
|
-
if (parent.content) isDropTarget = dropState.isDropTarget({
|
|
275
|
-
type: 'item',
|
|
276
|
-
dropPosition: 'on',
|
|
277
|
-
key: parent.content.key
|
|
278
|
-
});
|
|
279
|
-
isRootDroptarget = dropState.isDropTarget({
|
|
280
|
-
type: 'root'
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VirtualizerItem), {
|
|
267
|
+
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableCellWrapper, {
|
|
284
268
|
key: reusableView.key,
|
|
285
269
|
layoutInfo: reusableView.layoutInfo,
|
|
286
270
|
virtualizer: reusableView.virtualizer,
|
|
287
|
-
parent: parent
|
|
288
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cellWrapper', (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), {
|
|
289
|
-
'react-spectrum-Table-cellWrapper': !reusableView.layoutInfo.estimatedSize,
|
|
290
|
-
'react-spectrum-Table-cellWrapper--dropTarget': isDropTarget || isRootDroptarget
|
|
291
|
-
}))
|
|
271
|
+
parent: parent
|
|
292
272
|
}, reusableView.rendered);
|
|
293
|
-
};
|
|
294
|
-
let renderView = (type, item)=>{
|
|
273
|
+
}, []);
|
|
274
|
+
let renderView = (0, $7lS7h$useCallback)((type, item)=>{
|
|
295
275
|
switch(type){
|
|
296
276
|
case 'header':
|
|
297
277
|
case 'rowgroup':
|
|
@@ -333,25 +313,17 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
333
313
|
placement: "top"
|
|
334
314
|
}, item.rendered));
|
|
335
315
|
if (item.props.allowsResizing && !item.hasChildNodes) return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$ResizableTableColumnHeader, {
|
|
336
|
-
tableRef: domRef,
|
|
337
316
|
column: item
|
|
338
317
|
});
|
|
339
318
|
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableColumnHeader, {
|
|
340
319
|
column: item
|
|
341
320
|
});
|
|
342
321
|
case 'loader':
|
|
343
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$
|
|
344
|
-
isIndeterminate: true,
|
|
345
|
-
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
|
|
346
|
-
}));
|
|
322
|
+
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$LoadingState, null);
|
|
347
323
|
case 'empty':
|
|
348
|
-
|
|
349
|
-
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
350
|
-
if (emptyState == null) return null;
|
|
351
|
-
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$CenteredWrapper, null, emptyState);
|
|
352
|
-
}
|
|
324
|
+
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$EmptyState, null);
|
|
353
325
|
}
|
|
354
|
-
};
|
|
326
|
+
}, []);
|
|
355
327
|
let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = (0, $7lS7h$useState)(false);
|
|
356
328
|
let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = (0, $7lS7h$useState)(false);
|
|
357
329
|
let viewport = (0, $7lS7h$useRef)({
|
|
@@ -412,7 +384,8 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
412
384
|
isEmpty: isEmpty,
|
|
413
385
|
onFocusedResizer: onFocusedResizer,
|
|
414
386
|
headerMenuOpen: headerMenuOpen,
|
|
415
|
-
setHeaderMenuOpen: setHeaderMenuOpen
|
|
387
|
+
setHeaderMenuOpen: setHeaderMenuOpen,
|
|
388
|
+
renderEmptyState: props.renderEmptyState
|
|
416
389
|
}
|
|
417
390
|
}, /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$TableVirtualizer, {
|
|
418
391
|
...mergedProps,
|
|
@@ -424,7 +397,9 @@ function $bd013581c0a4b065$var$TableViewBase(props, ref) {
|
|
|
424
397
|
'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
|
|
425
398
|
'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
|
|
426
399
|
}, (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table'), styleProps.className),
|
|
427
|
-
layout
|
|
400
|
+
// This should be `tableLayout` rather than `layout` so it doesn't
|
|
401
|
+
// change objects and invalidate virtualizer.
|
|
402
|
+
layout: tableLayout,
|
|
428
403
|
collection: state.collection,
|
|
429
404
|
focusedKey: focusedKey,
|
|
430
405
|
renderView: renderView,
|
|
@@ -460,10 +435,6 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
460
435
|
let loadingState = collection.body.props.loadingState;
|
|
461
436
|
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
462
437
|
let onLoadMore = collection.body.props.onLoadMore;
|
|
463
|
-
let transitionDuration = 220;
|
|
464
|
-
if (isLoading) transitionDuration = 160;
|
|
465
|
-
if (layout.resizingColumn != null) // while resizing, prop changes should not cause animations
|
|
466
|
-
transitionDuration = 0;
|
|
467
438
|
let state = (0, $7lS7h$useVirtualizerState)({
|
|
468
439
|
layout: layout,
|
|
469
440
|
collection: collection,
|
|
@@ -473,44 +444,28 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
473
444
|
bodyRef.current.scrollTop = rect.y;
|
|
474
445
|
(0, $7lS7h$setScrollLeft)(bodyRef.current, direction, rect.x);
|
|
475
446
|
},
|
|
476
|
-
|
|
447
|
+
persistedKeys: (0, $7lS7h$useMemo)(()=>focusedKey ? new Set([
|
|
448
|
+
focusedKey
|
|
449
|
+
]) : new Set(), [
|
|
450
|
+
focusedKey
|
|
451
|
+
])
|
|
477
452
|
});
|
|
478
|
-
let scrollToItem = (0, $7lS7h$useCallback)((key)=>{
|
|
479
|
-
let item = collection.getItem(key);
|
|
480
|
-
let column = collection.columns[0];
|
|
481
|
-
let virtualizer = state.virtualizer;
|
|
482
|
-
virtualizer.scrollToItem(key, {
|
|
483
|
-
duration: 0,
|
|
484
|
-
// Prevent scrolling to the top when clicking on column headers.
|
|
485
|
-
shouldScrollY: (item === null || item === void 0 ? void 0 : item.type) !== 'column',
|
|
486
|
-
// Offset scroll position by width of selection cell
|
|
487
|
-
// (which is sticky and will overlap the cell we're scrolling to).
|
|
488
|
-
offsetX: column.props.isSelectionCell || column.props.isDragButtonCell ? layout.getColumnWidth(column.key) : 0
|
|
489
|
-
});
|
|
490
|
-
// Sync the scroll positions of the column headers and the body so scrollIntoViewport can
|
|
491
|
-
// properly decide if the column is outside the viewport or not
|
|
492
|
-
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
493
|
-
}, [
|
|
494
|
-
collection,
|
|
495
|
-
bodyRef,
|
|
496
|
-
headerRef,
|
|
497
|
-
layout,
|
|
498
|
-
state.virtualizer
|
|
499
|
-
]);
|
|
500
453
|
let memoedVirtualizerProps = (0, $7lS7h$useMemo)(()=>({
|
|
501
454
|
tabIndex: otherProps.tabIndex,
|
|
502
455
|
focusedKey: focusedKey,
|
|
503
|
-
scrollToItem: scrollToItem,
|
|
504
456
|
isLoading: isLoading,
|
|
505
457
|
onLoadMore: onLoadMore
|
|
506
458
|
}), [
|
|
507
459
|
otherProps.tabIndex,
|
|
508
460
|
focusedKey,
|
|
509
|
-
scrollToItem,
|
|
510
461
|
isLoading,
|
|
511
462
|
onLoadMore
|
|
512
463
|
]);
|
|
513
464
|
let { virtualizerProps: virtualizerProps, scrollViewProps: { onVisibleRectChange: onVisibleRectChange } } = (0, $7lS7h$useVirtualizer)(memoedVirtualizerProps, state, domRef);
|
|
465
|
+
let onVisibleRectChangeMemo = (0, $7lS7h$useMemo)(()=>(0, $7lS7h$chain)(onVisibleRectChange, onVisibleRectChangeProp), [
|
|
466
|
+
onVisibleRectChange,
|
|
467
|
+
onVisibleRectChangeProp
|
|
468
|
+
]);
|
|
514
469
|
// this effect runs whenever the contentSize changes, it doesn't matter what the content size is
|
|
515
470
|
// only that it changes in a resize, and when that happens, we want to sync the body to the
|
|
516
471
|
// header scroll position
|
|
@@ -554,6 +509,9 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
554
509
|
let mergedProps = (0, $7lS7h$mergeProps)(otherProps, virtualizerProps, isVirtualDragging && {
|
|
555
510
|
tabIndex: null
|
|
556
511
|
});
|
|
512
|
+
let firstColumn = collection.columns[0];
|
|
513
|
+
let scrollPadding = 0;
|
|
514
|
+
if (firstColumn.props.isSelectionCell || firstColumn.props.isDragButtonCell) scrollPadding = layout.getColumnWidth(firstColumn.key);
|
|
557
515
|
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$export$d288a7dd40372bc.Provider, {
|
|
558
516
|
value: resizingColumn
|
|
559
517
|
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$FocusScope), null, /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
@@ -567,7 +525,7 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
567
525
|
overflow: 'hidden',
|
|
568
526
|
position: 'relative',
|
|
569
527
|
willChange: state.isScrolling ? 'scroll-position' : undefined,
|
|
570
|
-
|
|
528
|
+
scrollPaddingInlineStart: scrollPadding
|
|
571
529
|
},
|
|
572
530
|
ref: headerRef
|
|
573
531
|
}, state.visibleViews[0]), /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$ScrollView), {
|
|
@@ -580,15 +538,15 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
580
538
|
})),
|
|
581
539
|
tabIndex: isVirtualDragging ? null : -1,
|
|
582
540
|
style: {
|
|
583
|
-
flex: 1
|
|
541
|
+
flex: 1,
|
|
542
|
+
scrollPaddingInlineStart: scrollPadding
|
|
584
543
|
},
|
|
585
544
|
innerStyle: {
|
|
586
|
-
overflow: 'visible'
|
|
587
|
-
transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
|
|
545
|
+
overflow: 'visible'
|
|
588
546
|
},
|
|
589
547
|
ref: bodyRef,
|
|
590
548
|
contentSize: state.contentSize,
|
|
591
|
-
onVisibleRectChange:
|
|
549
|
+
onVisibleRectChange: onVisibleRectChangeMemo,
|
|
592
550
|
onScrollStart: state.startScrolling,
|
|
593
551
|
onScrollEnd: state.endScrolling,
|
|
594
552
|
onScroll: onScroll
|
|
@@ -601,12 +559,20 @@ function $bd013581c0a4b065$var$TableVirtualizer(props) {
|
|
|
601
559
|
}
|
|
602
560
|
})))));
|
|
603
561
|
}
|
|
604
|
-
function $bd013581c0a4b065$var$
|
|
562
|
+
function $bd013581c0a4b065$var$useStyle(layoutInfo, parent) {
|
|
563
|
+
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
564
|
+
let style = (0, $7lS7h$layoutInfoToStyle)(layoutInfo, direction, parent);
|
|
565
|
+
if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
|
|
566
|
+
return style;
|
|
567
|
+
}
|
|
568
|
+
function $bd013581c0a4b065$var$TableHeader({ children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
605
569
|
let { rowGroupProps: rowGroupProps } = (0, $7lS7h$useTableRowGroup)();
|
|
570
|
+
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
606
571
|
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
607
572
|
...rowGroupProps,
|
|
608
573
|
...otherProps,
|
|
609
|
-
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-head')
|
|
574
|
+
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-head'),
|
|
575
|
+
style: style
|
|
610
576
|
}, children);
|
|
611
577
|
}
|
|
612
578
|
function $bd013581c0a4b065$var$TableColumnHeader(props) {
|
|
@@ -863,12 +829,17 @@ function $bd013581c0a4b065$var$TableDragHeaderCell({ column: column }) {
|
|
|
863
829
|
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-headCell', (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), 'react-spectrum-Table-headCell', 'react-spectrum-Table-dragButtonHeadCell'))
|
|
864
830
|
}, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VisuallyHidden), null, stringFormatter.format('drag'))));
|
|
865
831
|
}
|
|
866
|
-
function $bd013581c0a4b065$var$TableRowGroup({ children: children, ...otherProps }) {
|
|
832
|
+
function $bd013581c0a4b065$var$TableRowGroup({ children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
867
833
|
let { rowGroupProps: rowGroupProps } = (0, $7lS7h$useTableRowGroup)();
|
|
834
|
+
let { isTableDroppable: isTableDroppable } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
835
|
+
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
868
836
|
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
869
837
|
...rowGroupProps,
|
|
838
|
+
style: style,
|
|
870
839
|
...otherProps
|
|
871
|
-
},
|
|
840
|
+
}, isTableDroppable && /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $4e6fc36ba71ba405$export$d30a7814cfd4033e), {
|
|
841
|
+
key: "root"
|
|
842
|
+
}), children);
|
|
872
843
|
}
|
|
873
844
|
function $bd013581c0a4b065$var$DragButton() {
|
|
874
845
|
let { dragButtonProps: dragButtonProps, dragButtonRef: dragButtonRef, isFocusVisibleWithin: isFocusVisibleWithin } = $bd013581c0a4b065$export$cd7c5802f9e21187();
|
|
@@ -891,19 +862,18 @@ const $bd013581c0a4b065$var$TableRowContext = /*#__PURE__*/ (0, $7lS7h$react).cr
|
|
|
891
862
|
function $bd013581c0a4b065$export$cd7c5802f9e21187() {
|
|
892
863
|
return (0, $7lS7h$useContext)($bd013581c0a4b065$var$TableRowContext);
|
|
893
864
|
}
|
|
894
|
-
function $bd013581c0a4b065$var$TableRow({ item: item, children: children,
|
|
865
|
+
function $bd013581c0a4b065$var$TableRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...otherProps }) {
|
|
895
866
|
var _state_collection_rows_find, _layout_getContentSize, _layout_virtualizer;
|
|
896
867
|
let ref = (0, $7lS7h$useRef)();
|
|
897
|
-
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, dragState: dragState, dropState: dropState } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
898
|
-
let allowsInteraction = state.selectionManager.selectionMode !== 'none' || hasActions;
|
|
899
|
-
let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
|
|
900
|
-
let isDroppable = isTableDroppable && !isDisabled;
|
|
868
|
+
let { state: state, layout: layout, dragAndDropHooks: dragAndDropHooks, isTableDraggable: isTableDraggable, isTableDroppable: isTableDroppable, dragState: dragState, dropState: dropState } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
901
869
|
let isSelected = state.selectionManager.isSelected(item.key);
|
|
902
|
-
let { rowProps: rowProps } = (0, $7lS7h$useTableRow)({
|
|
870
|
+
let { rowProps: rowProps, hasAction: hasAction, allowsSelection: allowsSelection } = (0, $7lS7h$useTableRow)({
|
|
903
871
|
node: item,
|
|
904
872
|
isVirtualized: true,
|
|
905
873
|
shouldSelectOnPressUp: isTableDraggable
|
|
906
874
|
}, state, ref);
|
|
875
|
+
let isDisabled = !allowsSelection && !hasAction;
|
|
876
|
+
let isDroppable = isTableDroppable && !isDisabled;
|
|
907
877
|
let { pressProps: pressProps, isPressed: isPressed } = (0, $7lS7h$usePress)({
|
|
908
878
|
isDisabled: isDisabled
|
|
909
879
|
});
|
|
@@ -922,7 +892,7 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, hasAct
|
|
|
922
892
|
// border corners of the last row when selected.
|
|
923
893
|
let isFlushWithContainerBottom = false;
|
|
924
894
|
if (isLastRow) {
|
|
925
|
-
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.
|
|
895
|
+
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;
|
|
926
896
|
}
|
|
927
897
|
let draggableItem;
|
|
928
898
|
if (isTableDraggable) {
|
|
@@ -954,7 +924,10 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, hasAct
|
|
|
954
924
|
...draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragButtonProps,
|
|
955
925
|
elementType: 'div'
|
|
956
926
|
}, dragButtonRef);
|
|
957
|
-
let
|
|
927
|
+
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
928
|
+
let props = (0, $7lS7h$mergeProps)(rowProps, otherProps, {
|
|
929
|
+
style: style
|
|
930
|
+
}, focusWithinProps, focusProps, hoverProps, pressProps, draggableItem === null || draggableItem === void 0 ? void 0 : draggableItem.dragProps, // Remove tab index from list row if performing a screenreader drag. This prevents TalkBack from focusing the row,
|
|
958
931
|
// allowing for single swipe navigation between row drop indicator
|
|
959
932
|
(dragAndDropHooks === null || dragAndDropHooks === void 0 ? void 0 : dragAndDropHooks.isVirtualDragging()) && {
|
|
960
933
|
tabIndex: null
|
|
@@ -1014,7 +987,7 @@ function $bd013581c0a4b065$var$TableRow({ item: item, children: children, hasAct
|
|
|
1014
987
|
}
|
|
1015
988
|
}));
|
|
1016
989
|
}
|
|
1017
|
-
function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children,
|
|
990
|
+
function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children, layoutInfo: layoutInfo, parent: parent, ...props }) {
|
|
1018
991
|
let { state: state, headerMenuOpen: headerMenuOpen } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1019
992
|
let ref = (0, $7lS7h$useRef)();
|
|
1020
993
|
let { rowProps: rowProps } = (0, $7lS7h$useTableHeaderRow)({
|
|
@@ -1025,6 +998,7 @@ function $bd013581c0a4b065$var$TableHeaderRow({ item: item, children: children,
|
|
|
1025
998
|
...props,
|
|
1026
999
|
isDisabled: headerMenuOpen
|
|
1027
1000
|
});
|
|
1001
|
+
let style = $bd013581c0a4b065$var$useStyle(layoutInfo, parent);
|
|
1028
1002
|
return /*#__PURE__*/ (0, $7lS7h$react).createElement("div", {
|
|
1029
1003
|
...(0, $7lS7h$mergeProps)(rowProps, hoverProps),
|
|
1030
1004
|
ref: ref,
|
|
@@ -1124,6 +1098,34 @@ function $bd013581c0a4b065$var$TableCell({ cell: cell }) {
|
|
|
1124
1098
|
className: (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cellContents')
|
|
1125
1099
|
}, cell.rendered)));
|
|
1126
1100
|
}
|
|
1101
|
+
function $bd013581c0a4b065$var$TableCellWrapper({ layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children }) {
|
|
1102
|
+
let { isTableDroppable: isTableDroppable, dropState: dropState } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
1103
|
+
let isDropTarget;
|
|
1104
|
+
let isRootDroptarget;
|
|
1105
|
+
if (isTableDroppable) {
|
|
1106
|
+
if (parent.content) isDropTarget = dropState.isDropTarget({
|
|
1107
|
+
type: 'item',
|
|
1108
|
+
dropPosition: 'on',
|
|
1109
|
+
key: parent.content.key
|
|
1110
|
+
});
|
|
1111
|
+
isRootDroptarget = dropState.isDropTarget({
|
|
1112
|
+
type: 'root'
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
return /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$VirtualizerItem), {
|
|
1116
|
+
layoutInfo: layoutInfo,
|
|
1117
|
+
virtualizer: virtualizer,
|
|
1118
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
|
|
1119
|
+
className: (0, $7lS7h$useMemo)(()=>(0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_vars_cssmodulejs))), 'spectrum-Table-cellWrapper', (0, $7lS7h$classNames)((0, ($parcel$interopDefault($7lS7h$table_cssmodulejs))), {
|
|
1120
|
+
'react-spectrum-Table-cellWrapper': !layoutInfo.estimatedSize,
|
|
1121
|
+
'react-spectrum-Table-cellWrapper--dropTarget': isDropTarget || isRootDroptarget
|
|
1122
|
+
})), [
|
|
1123
|
+
layoutInfo.estimatedSize,
|
|
1124
|
+
isDropTarget,
|
|
1125
|
+
isRootDroptarget
|
|
1126
|
+
])
|
|
1127
|
+
}, children);
|
|
1128
|
+
}
|
|
1127
1129
|
function $bd013581c0a4b065$var$ExpandableRowChevron({ cell: cell }) {
|
|
1128
1130
|
// TODO: move some/all of the chevron button setup into a separate hook?
|
|
1129
1131
|
let { direction: direction } = (0, $7lS7h$useLocale)();
|
|
@@ -1155,6 +1157,20 @@ function $bd013581c0a4b065$var$ExpandableRowChevron({ cell: cell }) {
|
|
|
1155
1157
|
})
|
|
1156
1158
|
}, direction === 'ltr' ? /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiChevronRightMedium), null) : /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$spectrumiconsuiChevronLeftMedium), null));
|
|
1157
1159
|
}
|
|
1160
|
+
function $bd013581c0a4b065$var$LoadingState() {
|
|
1161
|
+
let { state: state } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
1162
|
+
let stringFormatter = (0, $7lS7h$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7lS7h$intlStringsmodulejs))), '@react-spectrum/table');
|
|
1163
|
+
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$CenteredWrapper, null, /*#__PURE__*/ (0, $7lS7h$react).createElement((0, $7lS7h$ProgressCircle), {
|
|
1164
|
+
isIndeterminate: true,
|
|
1165
|
+
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
|
|
1166
|
+
}));
|
|
1167
|
+
}
|
|
1168
|
+
function $bd013581c0a4b065$var$EmptyState() {
|
|
1169
|
+
let { renderEmptyState: renderEmptyState } = (0, $7lS7h$useContext)($bd013581c0a4b065$export$93e4b0b2cc49b648);
|
|
1170
|
+
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
1171
|
+
if (emptyState == null) return null;
|
|
1172
|
+
return /*#__PURE__*/ (0, $7lS7h$react).createElement($bd013581c0a4b065$var$CenteredWrapper, null, emptyState);
|
|
1173
|
+
}
|
|
1158
1174
|
function $bd013581c0a4b065$var$CenteredWrapper({ children: children }) {
|
|
1159
1175
|
let { state: state } = $bd013581c0a4b065$export$3cb274deb6c2d854();
|
|
1160
1176
|
let rowProps;
|