@react-spectrum/table 3.2.1-nightly.3335 → 3.2.1-nightly.3341
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/main.js +76 -589
- package/dist/main.js.map +1 -1
- package/dist/module.js +79 -592
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +27 -27
- package/src/Resizer.tsx +7 -7
- package/src/TableView.tsx +54 -61
- package/src/TableView_DEPRECATED.tsx +0 -728
package/dist/main.js
CHANGED
|
@@ -39,6 +39,7 @@ $parcel$export(module.exports, "Cell", () => $3fpzo$reactstatelytable.Cell);
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
42
|
+
|
|
42
43
|
var $a89862f958371476$exports = {};
|
|
43
44
|
var $aea5dbc70156d941$exports = {};
|
|
44
45
|
$aea5dbc70156d941$exports = JSON.parse("{\"loading\":\"جارٍ التحميل...\",\"loadingMore\":\"جارٍ تحميل المزيد...\",\"sortAscending\":\"Sort Ascending\",\"sortDescending\":\"Sort Descending\",\"resizeColumn\":\"Resize column\"}");
|
|
@@ -349,9 +350,11 @@ $982885d0a34882ea$export$53aa811f86efbfad = "is-next-selected_d0fc74";
|
|
|
349
350
|
|
|
350
351
|
|
|
351
352
|
function $2877766f94c67a67$var$Resizer(props, ref) {
|
|
352
|
-
const {
|
|
353
|
-
let {
|
|
354
|
-
let { resizerProps: resizerProps } = $3fpzo$reactariatable.useTableColumnResize(
|
|
353
|
+
const { column: column } = props;
|
|
354
|
+
let { columnState: columnState } = $be8a9c035a82f788$export$3cb274deb6c2d854();
|
|
355
|
+
let { resizerProps: resizerProps } = $3fpzo$reactariatable.useTableColumnResize({
|
|
356
|
+
column: column
|
|
357
|
+
}, columnState, ref);
|
|
355
358
|
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
|
|
356
359
|
focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
|
|
357
360
|
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
@@ -361,10 +364,10 @@ function $2877766f94c67a67$var$Resizer(props, ref) {
|
|
|
361
364
|
role: "separator",
|
|
362
365
|
"aria-orientation": "vertical",
|
|
363
366
|
"aria-label": "Resize column",
|
|
364
|
-
"aria-labelledby":
|
|
365
|
-
"aria-valuenow":
|
|
366
|
-
"aria-valuemin":
|
|
367
|
-
"aria-valuemax":
|
|
367
|
+
"aria-labelledby": column.key,
|
|
368
|
+
"aria-valuenow": columnState.getColumnWidth(column.key),
|
|
369
|
+
"aria-valuemin": columnState.getColumnMinWidth(column.key),
|
|
370
|
+
"aria-valuemax": columnState.getColumnMaxWidth(column.key)
|
|
368
371
|
})));
|
|
369
372
|
}
|
|
370
373
|
const $2877766f94c67a67$export$48a76196cafe3b93 = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($2877766f94c67a67$var$Resizer);
|
|
@@ -405,530 +408,6 @@ $4afcd54cfd94dbb9$export$8bffb31c98aaf8d5 = "react-spectrum-Table-centeredWrappe
|
|
|
405
408
|
|
|
406
409
|
|
|
407
410
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const $26e105b1bd39d4b5$var$DEFAULT_HEADER_HEIGHT = {
|
|
423
|
-
medium: 34,
|
|
424
|
-
large: 40
|
|
425
|
-
};
|
|
426
|
-
const $26e105b1bd39d4b5$var$DEFAULT_HIDE_HEADER_CELL_WIDTH = {
|
|
427
|
-
medium: 36,
|
|
428
|
-
large: 44
|
|
429
|
-
};
|
|
430
|
-
const $26e105b1bd39d4b5$var$ROW_HEIGHTS = {
|
|
431
|
-
compact: {
|
|
432
|
-
medium: 32,
|
|
433
|
-
large: 40
|
|
434
|
-
},
|
|
435
|
-
regular: {
|
|
436
|
-
medium: 40,
|
|
437
|
-
large: 50
|
|
438
|
-
},
|
|
439
|
-
spacious: {
|
|
440
|
-
medium: 48,
|
|
441
|
-
large: 60
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
const $26e105b1bd39d4b5$var$SELECTION_CELL_DEFAULT_WIDTH = {
|
|
445
|
-
medium: 38,
|
|
446
|
-
large: 48
|
|
447
|
-
};
|
|
448
|
-
const $26e105b1bd39d4b5$var$TableContext = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createContext(null);
|
|
449
|
-
function $26e105b1bd39d4b5$var$useTableContext() {
|
|
450
|
-
return $3fpzo$react.useContext($26e105b1bd39d4b5$var$TableContext);
|
|
451
|
-
}
|
|
452
|
-
function $26e105b1bd39d4b5$var$TableView_DEPRECATED(props, ref) {
|
|
453
|
-
props = $3fpzo$reactspectrumprovider.useProviderProps(props);
|
|
454
|
-
let { isQuiet: isQuiet , onAction: onAction } = props;
|
|
455
|
-
let { styleProps: styleProps } = $3fpzo$reactspectrumutils.useStyleProps(props);
|
|
456
|
-
let [showSelectionCheckboxes, setShowSelectionCheckboxes] = $3fpzo$react.useState(props.selectionStyle !== 'highlight');
|
|
457
|
-
let state = $3fpzo$reactstatelytable.useTableState({
|
|
458
|
-
...props,
|
|
459
|
-
showSelectionCheckboxes: showSelectionCheckboxes,
|
|
460
|
-
selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'
|
|
461
|
-
});
|
|
462
|
-
// If the selection behavior changes in state, we need to update showSelectionCheckboxes here due to the circular dependency...
|
|
463
|
-
let shouldShowCheckboxes = state.selectionManager.selectionBehavior !== 'replace';
|
|
464
|
-
if (shouldShowCheckboxes !== showSelectionCheckboxes) setShowSelectionCheckboxes(shouldShowCheckboxes);
|
|
465
|
-
let domRef = $3fpzo$reactspectrumutils.useDOMRef(ref);
|
|
466
|
-
let bodyRef = $3fpzo$react.useRef();
|
|
467
|
-
let formatMessage = $3fpzo$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($a89862f958371476$exports)));
|
|
468
|
-
let { scale: scale } = $3fpzo$reactspectrumprovider.useProvider();
|
|
469
|
-
let density = props.density || 'regular';
|
|
470
|
-
let layout = $3fpzo$react.useMemo(()=>new $3fpzo$reactstatelylayout.TableLayout_DEPRECATED({
|
|
471
|
-
// If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
|
|
472
|
-
rowHeight: props.overflowMode === 'wrap' ? null : $26e105b1bd39d4b5$var$ROW_HEIGHTS[density][scale],
|
|
473
|
-
estimatedRowHeight: props.overflowMode === 'wrap' ? $26e105b1bd39d4b5$var$ROW_HEIGHTS[density][scale] : null,
|
|
474
|
-
headingHeight: props.overflowMode === 'wrap' ? null : $26e105b1bd39d4b5$var$DEFAULT_HEADER_HEIGHT[scale],
|
|
475
|
-
estimatedHeadingHeight: props.overflowMode === 'wrap' ? $26e105b1bd39d4b5$var$DEFAULT_HEADER_HEIGHT[scale] : null,
|
|
476
|
-
getDefaultWidth: ({ hideHeader: hideHeader , isSelectionCell: isSelectionCell , showDivider: showDivider })=>{
|
|
477
|
-
if (hideHeader) {
|
|
478
|
-
let width = $26e105b1bd39d4b5$var$DEFAULT_HIDE_HEADER_CELL_WIDTH[scale];
|
|
479
|
-
return showDivider ? width + 1 : width;
|
|
480
|
-
} else if (isSelectionCell) return $26e105b1bd39d4b5$var$SELECTION_CELL_DEFAULT_WIDTH[scale];
|
|
481
|
-
}
|
|
482
|
-
})
|
|
483
|
-
, [
|
|
484
|
-
props.overflowMode,
|
|
485
|
-
scale,
|
|
486
|
-
density
|
|
487
|
-
]);
|
|
488
|
-
let { direction: direction } = $3fpzo$reactariai18n.useLocale();
|
|
489
|
-
layout.collection = state.collection;
|
|
490
|
-
let { gridProps: gridProps } = $3fpzo$reactariatable.useTable({
|
|
491
|
-
...props,
|
|
492
|
-
isVirtualized: true,
|
|
493
|
-
layout: layout,
|
|
494
|
-
onRowAction: onAction
|
|
495
|
-
}, state, domRef);
|
|
496
|
-
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
497
|
-
let style = $3fpzo$reactariavirtualizer.layoutInfoToStyle(reusableView.layoutInfo, direction, parent && parent.layoutInfo);
|
|
498
|
-
if (style.overflow === 'hidden') style.overflow = 'visible'; // needed to support position: sticky
|
|
499
|
-
if (reusableView.viewType === 'rowgroup') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableRowGroup, {
|
|
500
|
-
key: reusableView.key,
|
|
501
|
-
style: style
|
|
502
|
-
}, renderChildren(children)));
|
|
503
|
-
if (reusableView.viewType === 'header') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableHeader, {
|
|
504
|
-
key: reusableView.key,
|
|
505
|
-
style: style
|
|
506
|
-
}, renderChildren(children)));
|
|
507
|
-
if (reusableView.viewType === 'row') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableRow, {
|
|
508
|
-
key: reusableView.key,
|
|
509
|
-
item: reusableView.content,
|
|
510
|
-
style: style,
|
|
511
|
-
hasActions: onAction
|
|
512
|
-
}, renderChildren(children)));
|
|
513
|
-
if (reusableView.viewType === 'headerrow') return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableHeaderRow, {
|
|
514
|
-
key: reusableView.key,
|
|
515
|
-
style: style,
|
|
516
|
-
item: reusableView.content
|
|
517
|
-
}, renderChildren(children)));
|
|
518
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavirtualizer.VirtualizerItem, {
|
|
519
|
-
key: reusableView.key,
|
|
520
|
-
reusableView: reusableView,
|
|
521
|
-
parent: parent,
|
|
522
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cellWrapper', $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), {
|
|
523
|
-
'react-spectrum-Table-cellWrapper': !reusableView.layoutInfo.estimatedSize
|
|
524
|
-
}))
|
|
525
|
-
}));
|
|
526
|
-
};
|
|
527
|
-
let renderView = (type, item)=>{
|
|
528
|
-
switch(type){
|
|
529
|
-
case 'header':
|
|
530
|
-
case 'rowgroup':
|
|
531
|
-
case 'section':
|
|
532
|
-
case 'row':
|
|
533
|
-
case 'headerrow':
|
|
534
|
-
return null;
|
|
535
|
-
case 'cell':
|
|
536
|
-
if (item.props.isSelectionCell) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableCheckboxCell, {
|
|
537
|
-
cell: item
|
|
538
|
-
}));
|
|
539
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableCell, {
|
|
540
|
-
cell: item
|
|
541
|
-
}));
|
|
542
|
-
case 'placeholder':
|
|
543
|
-
// TODO: move to react-aria?
|
|
544
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
545
|
-
role: "gridcell",
|
|
546
|
-
"aria-colindex": item.index + 1,
|
|
547
|
-
"aria-colspan": item.colspan > 1 ? item.colspan : null
|
|
548
|
-
}));
|
|
549
|
-
case 'column':
|
|
550
|
-
if (item.props.isSelectionCell) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableSelectAllCell, {
|
|
551
|
-
column: item
|
|
552
|
-
}));
|
|
553
|
-
if (item.props.hideHeader) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumtooltip.TooltipTrigger, {
|
|
554
|
-
placement: "top",
|
|
555
|
-
trigger: "focus"
|
|
556
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableColumnHeader, {
|
|
557
|
-
column: item
|
|
558
|
-
}), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumtooltip.Tooltip, {
|
|
559
|
-
placement: "top"
|
|
560
|
-
}, item.rendered)));
|
|
561
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableColumnHeader, {
|
|
562
|
-
column: item
|
|
563
|
-
}));
|
|
564
|
-
case 'loader':
|
|
565
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$CenteredWrapper, null, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumprogress.ProgressCircle, {
|
|
566
|
-
isIndeterminate: true,
|
|
567
|
-
"aria-label": state.collection.size > 0 ? formatMessage('loadingMore') : formatMessage('loading')
|
|
568
|
-
})));
|
|
569
|
-
case 'empty':
|
|
570
|
-
{
|
|
571
|
-
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
572
|
-
if (emptyState == null) return null;
|
|
573
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$CenteredWrapper, null, emptyState));
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
// whenever the viewport changes size, check if scroll bars are visible
|
|
578
|
-
//
|
|
579
|
-
let [isVerticalScrollbarVisible, setVerticalScollbarVisible] = $3fpzo$react.useState(false);
|
|
580
|
-
let [isHorizontalScrollbarVisible, setHorizontalScollbarVisible] = $3fpzo$react.useState(false);
|
|
581
|
-
let onVisibleRectChange = $3fpzo$react.useCallback(()=>{
|
|
582
|
-
if (bodyRef.current) {
|
|
583
|
-
setVerticalScollbarVisible(bodyRef.current.clientWidth + 2 < bodyRef.current.offsetWidth);
|
|
584
|
-
setHorizontalScollbarVisible(bodyRef.current.clientHeight + 2 < bodyRef.current.offsetHeight);
|
|
585
|
-
}
|
|
586
|
-
}, []);
|
|
587
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableContext.Provider, {
|
|
588
|
-
value: {
|
|
589
|
-
state: state,
|
|
590
|
-
layout: layout
|
|
591
|
-
}
|
|
592
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$var$TableVirtualizer, {
|
|
593
|
-
...gridProps,
|
|
594
|
-
...styleProps,
|
|
595
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table', `spectrum-Table--${density}`, {
|
|
596
|
-
'spectrum-Table--quiet': isQuiet,
|
|
597
|
-
'spectrum-Table--wrap': props.overflowMode === 'wrap',
|
|
598
|
-
'spectrum-Table--loadingMore': state.collection.body.props.loadingState === 'loadingMore',
|
|
599
|
-
'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
|
|
600
|
-
'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
|
|
601
|
-
}, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table')),
|
|
602
|
-
layout: layout,
|
|
603
|
-
collection: state.collection,
|
|
604
|
-
focusedKey: state.selectionManager.focusedKey,
|
|
605
|
-
renderView: renderView,
|
|
606
|
-
renderWrapper: renderWrapper,
|
|
607
|
-
onVisibleRectChange: onVisibleRectChange,
|
|
608
|
-
domRef: domRef,
|
|
609
|
-
bodyRef: bodyRef
|
|
610
|
-
})));
|
|
611
|
-
}
|
|
612
|
-
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
|
|
613
|
-
function $26e105b1bd39d4b5$var$TableVirtualizer({ layout: layout , collection: collection , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , onVisibleRectChange: onVisibleRectChangeProp , ...otherProps }) {
|
|
614
|
-
var ref;
|
|
615
|
-
let { direction: direction } = $3fpzo$reactariai18n.useLocale();
|
|
616
|
-
let headerRef = $3fpzo$react.useRef();
|
|
617
|
-
let loadingState = collection.body.props.loadingState;
|
|
618
|
-
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
619
|
-
let onLoadMore = collection.body.props.onLoadMore;
|
|
620
|
-
let state = $3fpzo$reactstatelyvirtualizer.useVirtualizerState({
|
|
621
|
-
layout: layout,
|
|
622
|
-
collection: collection,
|
|
623
|
-
renderView: renderView,
|
|
624
|
-
renderWrapper: renderWrapper,
|
|
625
|
-
onVisibleRectChange (rect) {
|
|
626
|
-
bodyRef.current.scrollTop = rect.y;
|
|
627
|
-
$3fpzo$reactariavirtualizer.setScrollLeft(bodyRef.current, direction, rect.x);
|
|
628
|
-
},
|
|
629
|
-
transitionDuration: isLoading ? 160 : 220
|
|
630
|
-
});
|
|
631
|
-
let { virtualizerProps: virtualizerProps } = $3fpzo$reactariavirtualizer.useVirtualizer({
|
|
632
|
-
focusedKey: focusedKey,
|
|
633
|
-
scrollToItem (key) {
|
|
634
|
-
let item = collection.getItem(key);
|
|
635
|
-
let column = collection.columns[0];
|
|
636
|
-
state.virtualizer.scrollToItem(key, {
|
|
637
|
-
duration: 0,
|
|
638
|
-
// Prevent scrolling to the top when clicking on column headers.
|
|
639
|
-
shouldScrollY: (item === null || item === void 0 ? void 0 : item.type) !== 'column',
|
|
640
|
-
// Offset scroll position by width of selection cell
|
|
641
|
-
// (which is sticky and will overlap the cell we're scrolling to).
|
|
642
|
-
offsetX: column.props.isSelectionCell ? layout.columnWidths.get(column.key) : 0
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
}, state, domRef);
|
|
646
|
-
let headerHeight = ((ref = layout.getLayoutInfo('header')) === null || ref === void 0 ? void 0 : ref.rect.height) || 0;
|
|
647
|
-
let visibleRect = state.virtualizer.visibleRect;
|
|
648
|
-
// Sync the scroll position from the table body to the header container.
|
|
649
|
-
let onScroll = $3fpzo$react.useCallback(()=>{
|
|
650
|
-
headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
|
|
651
|
-
}, [
|
|
652
|
-
bodyRef
|
|
653
|
-
]);
|
|
654
|
-
let onVisibleRectChange = $3fpzo$react.useCallback((rect)=>{
|
|
655
|
-
state.setVisibleRect(rect);
|
|
656
|
-
if (!isLoading && onLoadMore) {
|
|
657
|
-
let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
|
|
658
|
-
if (rect.y > scrollOffset) onLoadMore();
|
|
659
|
-
}
|
|
660
|
-
}, [
|
|
661
|
-
onLoadMore,
|
|
662
|
-
isLoading,
|
|
663
|
-
state.setVisibleRect,
|
|
664
|
-
state.virtualizer
|
|
665
|
-
]);
|
|
666
|
-
$3fpzo$reactariautils.useLayoutEffect(()=>{
|
|
667
|
-
if (!isLoading && onLoadMore && !state.isAnimating) {
|
|
668
|
-
if (state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();
|
|
669
|
-
}
|
|
670
|
-
}, [
|
|
671
|
-
state.contentSize,
|
|
672
|
-
state.virtualizer,
|
|
673
|
-
state.isAnimating,
|
|
674
|
-
onLoadMore,
|
|
675
|
-
isLoading
|
|
676
|
-
]);
|
|
677
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
678
|
-
...$3fpzo$reactariautils.mergeProps(otherProps, virtualizerProps),
|
|
679
|
-
ref: domRef
|
|
680
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
681
|
-
role: "presentation",
|
|
682
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headWrapper'),
|
|
683
|
-
style: {
|
|
684
|
-
width: visibleRect.width,
|
|
685
|
-
height: headerHeight,
|
|
686
|
-
overflow: 'hidden',
|
|
687
|
-
position: 'relative',
|
|
688
|
-
willChange: state.isScrolling ? 'scroll-position' : '',
|
|
689
|
-
transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
|
|
690
|
-
},
|
|
691
|
-
ref: headerRef
|
|
692
|
-
}, state.visibleViews[0]), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavirtualizer.ScrollView, {
|
|
693
|
-
role: "presentation",
|
|
694
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-body'),
|
|
695
|
-
style: {
|
|
696
|
-
flex: 1
|
|
697
|
-
},
|
|
698
|
-
innerStyle: {
|
|
699
|
-
overflow: 'visible',
|
|
700
|
-
transition: state.isAnimating ? `none ${state.virtualizer.transitionDuration}ms` : undefined
|
|
701
|
-
},
|
|
702
|
-
ref: bodyRef,
|
|
703
|
-
contentSize: state.contentSize,
|
|
704
|
-
onVisibleRectChange: $3fpzo$reactariautils.chain(onVisibleRectChange, onVisibleRectChangeProp),
|
|
705
|
-
onScrollStart: state.startScrolling,
|
|
706
|
-
onScrollEnd: state.endScrolling,
|
|
707
|
-
onScroll: onScroll
|
|
708
|
-
}, state.visibleViews[1])));
|
|
709
|
-
}
|
|
710
|
-
function $26e105b1bd39d4b5$var$TableHeader({ children: children , ...otherProps }) {
|
|
711
|
-
let { rowGroupProps: rowGroupProps } = $3fpzo$reactariatable.useTableRowGroup();
|
|
712
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
713
|
-
...rowGroupProps,
|
|
714
|
-
...otherProps,
|
|
715
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-head')
|
|
716
|
-
}, children));
|
|
717
|
-
}
|
|
718
|
-
function $26e105b1bd39d4b5$var$TableColumnHeader({ column: column }) {
|
|
719
|
-
var ref, ref1, ref2, ref3;
|
|
720
|
-
let ref4 = $3fpzo$react.useRef();
|
|
721
|
-
let { state: state } = $26e105b1bd39d4b5$var$useTableContext();
|
|
722
|
-
let { columnHeaderProps: columnHeaderProps } = $3fpzo$reactariatable.useTableColumnHeader({
|
|
723
|
-
node: column,
|
|
724
|
-
isVirtualized: true
|
|
725
|
-
}, state, ref4);
|
|
726
|
-
let columnProps = column.props;
|
|
727
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
|
|
728
|
-
});
|
|
729
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
|
|
730
|
-
focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
|
|
731
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
732
|
-
...$3fpzo$reactariautils.mergeProps(columnHeaderProps, hoverProps),
|
|
733
|
-
ref: ref4,
|
|
734
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headCell', {
|
|
735
|
-
'is-sortable': columnProps.allowsSorting,
|
|
736
|
-
'is-sorted-desc': ((ref = state.sortDescriptor) === null || ref === void 0 ? void 0 : ref.column) === column.key && ((ref1 = state.sortDescriptor) === null || ref1 === void 0 ? void 0 : ref1.direction) === 'descending',
|
|
737
|
-
'is-sorted-asc': ((ref2 = state.sortDescriptor) === null || ref2 === void 0 ? void 0 : ref2.column) === column.key && ((ref3 = state.sortDescriptor) === null || ref3 === void 0 ? void 0 : ref3.direction) === 'ascending',
|
|
738
|
-
'is-hovered': isHovered,
|
|
739
|
-
'spectrum-Table-cell--hideHeader': columnProps.hideHeader
|
|
740
|
-
}, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-cell', {
|
|
741
|
-
'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center' || column.colspan > 1,
|
|
742
|
-
'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
|
|
743
|
-
}))
|
|
744
|
-
}, columnProps.hideHeader ? /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavisuallyhidden.VisuallyHidden, null, column.rendered) : /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
745
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headCellContents')
|
|
746
|
-
}, column.rendered), columnProps.allowsSorting && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement(($parcel$interopDefault($3fpzo$spectrumiconsuiArrowDownSmall)), {
|
|
747
|
-
UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-sortedIcon')
|
|
748
|
-
}))));
|
|
749
|
-
}
|
|
750
|
-
function $26e105b1bd39d4b5$var$TableSelectAllCell({ column: column }) {
|
|
751
|
-
let ref = $3fpzo$react.useRef();
|
|
752
|
-
let { state: state } = $26e105b1bd39d4b5$var$useTableContext();
|
|
753
|
-
let isSingleSelectionMode = state.selectionManager.selectionMode === 'single';
|
|
754
|
-
let { columnHeaderProps: columnHeaderProps } = $3fpzo$reactariatable.useTableColumnHeader({
|
|
755
|
-
node: column,
|
|
756
|
-
isVirtualized: true
|
|
757
|
-
}, state, ref);
|
|
758
|
-
let { checkboxProps: checkboxProps } = $3fpzo$reactariatable.useTableSelectAllCheckbox(state);
|
|
759
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
|
|
760
|
-
});
|
|
761
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
|
|
762
|
-
focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
|
|
763
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
764
|
-
...$3fpzo$reactariautils.mergeProps(columnHeaderProps, hoverProps),
|
|
765
|
-
ref: ref,
|
|
766
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-headCell', 'spectrum-Table-checkboxCell', {
|
|
767
|
-
'is-hovered': isHovered
|
|
768
|
-
})
|
|
769
|
-
}, /*
|
|
770
|
-
In single selection mode, the checkbox will be hidden.
|
|
771
|
-
So to avoid leaving a column header with no accessible content,
|
|
772
|
-
we use a VisuallyHidden component to include the aria-label from the checkbox,
|
|
773
|
-
which for single selection will be "Select."
|
|
774
|
-
*/ isSingleSelectionMode && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariavisuallyhidden.VisuallyHidden, null, checkboxProps['aria-label']), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumcheckbox.Checkbox, {
|
|
775
|
-
...checkboxProps,
|
|
776
|
-
isDisabled: isSingleSelectionMode,
|
|
777
|
-
isEmphasized: true,
|
|
778
|
-
UNSAFE_style: isSingleSelectionMode ? {
|
|
779
|
-
visibility: 'hidden'
|
|
780
|
-
} : undefined,
|
|
781
|
-
UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-checkbox')
|
|
782
|
-
}))));
|
|
783
|
-
}
|
|
784
|
-
function $26e105b1bd39d4b5$var$TableRowGroup({ children: children , ...otherProps }) {
|
|
785
|
-
let { rowGroupProps: rowGroupProps } = $3fpzo$reactariatable.useTableRowGroup();
|
|
786
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
787
|
-
...rowGroupProps,
|
|
788
|
-
...otherProps
|
|
789
|
-
}, children));
|
|
790
|
-
}
|
|
791
|
-
function $26e105b1bd39d4b5$var$TableRow({ item: item , children: children , hasActions: hasActions , ...otherProps }) {
|
|
792
|
-
var ref, ref5, ref6;
|
|
793
|
-
let ref7 = $3fpzo$react.useRef();
|
|
794
|
-
let { state: state , layout: layout } = $26e105b1bd39d4b5$var$useTableContext();
|
|
795
|
-
let allowsInteraction = state.selectionManager.selectionMode !== 'none' || hasActions;
|
|
796
|
-
let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
|
|
797
|
-
let isSelected = state.selectionManager.isSelected(item.key);
|
|
798
|
-
let { rowProps: rowProps } = $3fpzo$reactariatable.useTableRow({
|
|
799
|
-
node: item,
|
|
800
|
-
isVirtualized: true
|
|
801
|
-
}, state, ref7);
|
|
802
|
-
let { pressProps: pressProps , isPressed: isPressed } = $3fpzo$reactariainteractions.usePress({
|
|
803
|
-
isDisabled: isDisabled
|
|
804
|
-
});
|
|
805
|
-
// The row should show the focus background style when any cell inside it is focused.
|
|
806
|
-
// If the row itself is focused, then it should have a blue focus indicator on the left.
|
|
807
|
-
let { isFocusVisible: isFocusVisibleWithin , focusProps: focusWithinProps } = $3fpzo$reactariafocus.useFocusRing({
|
|
808
|
-
within: true
|
|
809
|
-
});
|
|
810
|
-
let { isFocusVisible: isFocusVisible , focusProps: focusProps } = $3fpzo$reactariafocus.useFocusRing();
|
|
811
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
|
|
812
|
-
isDisabled: isDisabled
|
|
813
|
-
});
|
|
814
|
-
let props = $3fpzo$reactariautils.mergeProps(rowProps, otherProps, focusWithinProps, focusProps, hoverProps, pressProps);
|
|
815
|
-
let isFirstRow = ((ref = state.collection.rows.find((row)=>row.level === 1
|
|
816
|
-
)) === null || ref === void 0 ? void 0 : ref.key) === item.key;
|
|
817
|
-
let isLastRow = item.nextKey == null;
|
|
818
|
-
// Figure out if the TableView content is equal or greater in height to the container. If so, we'll need to round the bottom
|
|
819
|
-
// border corners of the last row when selected.
|
|
820
|
-
let isFlushWithContainerBottom = false;
|
|
821
|
-
if (isLastRow) {
|
|
822
|
-
if (((ref5 = layout.getContentSize()) === null || ref5 === void 0 ? void 0 : ref5.height) >= ((ref6 = layout.virtualizer) === null || ref6 === void 0 ? void 0 : ref6.getVisibleRect().height)) isFlushWithContainerBottom = true;
|
|
823
|
-
}
|
|
824
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
825
|
-
...props,
|
|
826
|
-
ref: ref7,
|
|
827
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-row', {
|
|
828
|
-
'is-active': isPressed,
|
|
829
|
-
'is-selected': isSelected,
|
|
830
|
-
'spectrum-Table-row--highlightSelection': state.selectionManager.selectionBehavior === 'replace',
|
|
831
|
-
'is-next-selected': state.selectionManager.isSelected(item.nextKey),
|
|
832
|
-
'is-focused': isFocusVisibleWithin,
|
|
833
|
-
'focus-ring': isFocusVisible,
|
|
834
|
-
'is-hovered': isHovered,
|
|
835
|
-
'is-disabled': isDisabled,
|
|
836
|
-
'spectrum-Table-row--firstRow': isFirstRow,
|
|
837
|
-
'spectrum-Table-row--lastRow': isLastRow,
|
|
838
|
-
'spectrum-Table-row--isFlushBottom': isFlushWithContainerBottom
|
|
839
|
-
})
|
|
840
|
-
}, children));
|
|
841
|
-
}
|
|
842
|
-
function $26e105b1bd39d4b5$var$TableHeaderRow({ item: item , children: children , style: style }) {
|
|
843
|
-
let { state: state } = $26e105b1bd39d4b5$var$useTableContext();
|
|
844
|
-
let ref = $3fpzo$react.useRef();
|
|
845
|
-
let { rowProps: rowProps } = $3fpzo$reactariatable.useTableHeaderRow({
|
|
846
|
-
node: item,
|
|
847
|
-
isVirtualized: true
|
|
848
|
-
}, state, ref);
|
|
849
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
850
|
-
...rowProps,
|
|
851
|
-
ref: ref,
|
|
852
|
-
style: style
|
|
853
|
-
}, children));
|
|
854
|
-
}
|
|
855
|
-
function $26e105b1bd39d4b5$var$TableCheckboxCell({ cell: cell }) {
|
|
856
|
-
let ref = $3fpzo$react.useRef();
|
|
857
|
-
let { state: state } = $26e105b1bd39d4b5$var$useTableContext();
|
|
858
|
-
let isDisabled = state.disabledKeys.has(cell.parentKey);
|
|
859
|
-
let { gridCellProps: gridCellProps } = $3fpzo$reactariatable.useTableCell({
|
|
860
|
-
node: cell,
|
|
861
|
-
isVirtualized: true
|
|
862
|
-
}, state, ref);
|
|
863
|
-
let { checkboxProps: checkboxProps } = $3fpzo$reactariatable.useTableSelectionCheckbox({
|
|
864
|
-
key: cell.parentKey
|
|
865
|
-
}, state);
|
|
866
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
|
|
867
|
-
focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
|
|
868
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
869
|
-
...gridCellProps,
|
|
870
|
-
ref: ref,
|
|
871
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cell', 'spectrum-Table-checkboxCell', {
|
|
872
|
-
'is-disabled': isDisabled
|
|
873
|
-
}, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-cell'))
|
|
874
|
-
}, state.selectionManager.selectionMode !== 'none' && /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrumcheckbox.Checkbox, {
|
|
875
|
-
...checkboxProps,
|
|
876
|
-
isEmphasized: true,
|
|
877
|
-
isDisabled: isDisabled,
|
|
878
|
-
UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-checkbox')
|
|
879
|
-
}))));
|
|
880
|
-
}
|
|
881
|
-
function $26e105b1bd39d4b5$var$TableCell({ cell: cell }) {
|
|
882
|
-
let { state: state } = $26e105b1bd39d4b5$var$useTableContext();
|
|
883
|
-
let ref = $3fpzo$react.useRef();
|
|
884
|
-
let columnProps = cell.column.props;
|
|
885
|
-
let isDisabled = state.disabledKeys.has(cell.parentKey);
|
|
886
|
-
let { gridCellProps: gridCellProps } = $3fpzo$reactariatable.useTableCell({
|
|
887
|
-
node: cell,
|
|
888
|
-
isVirtualized: true
|
|
889
|
-
}, state, ref);
|
|
890
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
|
|
891
|
-
focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
|
|
892
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
893
|
-
...gridCellProps,
|
|
894
|
-
ref: ref,
|
|
895
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cell', {
|
|
896
|
-
'spectrum-Table-cell--divider': columnProps.showDivider && cell.column.nextKey !== null,
|
|
897
|
-
'spectrum-Table-cell--hideHeader': columnProps.hideHeader,
|
|
898
|
-
'is-disabled': isDisabled
|
|
899
|
-
}, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-cell', {
|
|
900
|
-
'react-spectrum-Table-cell--alignStart': columnProps.align === 'start',
|
|
901
|
-
'react-spectrum-Table-cell--alignCenter': columnProps.align === 'center',
|
|
902
|
-
'react-spectrum-Table-cell--alignEnd': columnProps.align === 'end'
|
|
903
|
-
}))
|
|
904
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("span", {
|
|
905
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-cellContents')
|
|
906
|
-
}, cell.rendered))));
|
|
907
|
-
}
|
|
908
|
-
function $26e105b1bd39d4b5$var$CenteredWrapper({ children: children }) {
|
|
909
|
-
let { state: state } = $26e105b1bd39d4b5$var$useTableContext();
|
|
910
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
911
|
-
role: "row",
|
|
912
|
-
"aria-rowindex": state.collection.headerRows.length + state.collection.size + 1,
|
|
913
|
-
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table-centeredWrapper')
|
|
914
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
915
|
-
role: "rowheader",
|
|
916
|
-
"aria-colspan": state.collection.columns.length
|
|
917
|
-
}, children)));
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
|
|
921
|
-
*/ const $26e105b1bd39d4b5$export$8790f9f1576000df = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($26e105b1bd39d4b5$var$TableView_DEPRECATED);
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
411
|
const $be8a9c035a82f788$var$DEFAULT_HEADER_HEIGHT = {
|
|
933
412
|
medium: 34,
|
|
934
413
|
large: 40
|
|
@@ -964,6 +443,7 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
964
443
|
let { isQuiet: isQuiet , onAction: onAction } = props;
|
|
965
444
|
let { styleProps: styleProps } = $3fpzo$reactspectrumutils.useStyleProps(props);
|
|
966
445
|
let [showSelectionCheckboxes, setShowSelectionCheckboxes] = $3fpzo$react.useState(props.selectionStyle !== 'highlight');
|
|
446
|
+
let { direction: direction } = $3fpzo$reactariai18n.useLocale();
|
|
967
447
|
let { scale: scale } = $3fpzo$reactspectrumprovider.useProvider();
|
|
968
448
|
const getDefaultWidth = $3fpzo$react.useCallback(({ hideHeader: hideHeader , isSelectionCell: isSelectionCell , showDivider: showDivider })=>{
|
|
969
449
|
if (hideHeader) {
|
|
@@ -976,8 +456,14 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
976
456
|
let state = $3fpzo$reactstatelytable.useTableState({
|
|
977
457
|
...props,
|
|
978
458
|
showSelectionCheckboxes: showSelectionCheckboxes,
|
|
979
|
-
selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'
|
|
980
|
-
|
|
459
|
+
selectionBehavior: props.selectionStyle === 'highlight' ? 'replace' : 'toggle'
|
|
460
|
+
});
|
|
461
|
+
const columnState = $3fpzo$reactstatelytable.useTableColumnResizeState({
|
|
462
|
+
...props,
|
|
463
|
+
columns: state.collection.columns,
|
|
464
|
+
getDefaultWidth: getDefaultWidth,
|
|
465
|
+
onColumnResize: props.onColumnResize,
|
|
466
|
+
onColumnResizeEnd: props.onColumnResizeEnd
|
|
981
467
|
});
|
|
982
468
|
// If the selection behavior changes in state, we need to update showSelectionCheckboxes here due to the circular dependency...
|
|
983
469
|
let shouldShowCheckboxes = state.selectionManager.selectionBehavior !== 'replace';
|
|
@@ -998,9 +484,8 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
998
484
|
scale,
|
|
999
485
|
density
|
|
1000
486
|
]);
|
|
1001
|
-
let { direction: direction } = $3fpzo$reactariai18n.useLocale();
|
|
1002
487
|
layout.collection = state.collection;
|
|
1003
|
-
layout.getColumnWidth =
|
|
488
|
+
layout.getColumnWidth = columnState.getColumnWidth;
|
|
1004
489
|
let { gridProps: gridProps } = $3fpzo$reactariatable.useTable({
|
|
1005
490
|
...props,
|
|
1006
491
|
isVirtualized: true,
|
|
@@ -1073,8 +558,7 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
1073
558
|
placement: "top"
|
|
1074
559
|
}, item.rendered)));
|
|
1075
560
|
if (item.props.allowsResizing) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$ResizableTableColumnHeader, {
|
|
1076
|
-
|
|
1077
|
-
state: state
|
|
561
|
+
column: item
|
|
1078
562
|
}));
|
|
1079
563
|
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableColumnHeader, {
|
|
1080
564
|
column: item
|
|
@@ -1111,7 +595,8 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
1111
595
|
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableContext.Provider, {
|
|
1112
596
|
value: {
|
|
1113
597
|
state: state,
|
|
1114
|
-
layout: layout
|
|
598
|
+
layout: layout,
|
|
599
|
+
columnState: columnState
|
|
1115
600
|
}
|
|
1116
601
|
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableVirtualizer, {
|
|
1117
602
|
...gridProps,
|
|
@@ -1120,7 +605,7 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
1120
605
|
'spectrum-Table--quiet': isQuiet,
|
|
1121
606
|
'spectrum-Table--wrap': props.overflowMode === 'wrap',
|
|
1122
607
|
'spectrum-Table--loadingMore': state.collection.body.props.loadingState === 'loadingMore',
|
|
1123
|
-
'spectrum-Table--resizingColumn':
|
|
608
|
+
'spectrum-Table--resizingColumn': columnState.isResizingColumn,
|
|
1124
609
|
'spectrum-Table--isVerticalScrollbarVisible': isVerticalScrollbarVisible,
|
|
1125
610
|
'spectrum-Table--isHorizontalScrollbarVisible': isHorizontalScrollbarVisible
|
|
1126
611
|
}, $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($4afcd54cfd94dbb9$exports)), 'react-spectrum-Table')),
|
|
@@ -1129,11 +614,11 @@ function $be8a9c035a82f788$var$TableView(props, ref) {
|
|
|
1129
614
|
focusedKey: state.selectionManager.focusedKey,
|
|
1130
615
|
renderView: renderView,
|
|
1131
616
|
renderWrapper: renderWrapper,
|
|
1132
|
-
setTableWidth:
|
|
617
|
+
setTableWidth: columnState.setTableWidth,
|
|
1133
618
|
onVisibleRectChange: onVisibleRectChange,
|
|
1134
619
|
domRef: domRef,
|
|
1135
620
|
bodyRef: bodyRef,
|
|
1136
|
-
getColumnWidth:
|
|
621
|
+
getColumnWidth: columnState.getColumnWidth
|
|
1137
622
|
})));
|
|
1138
623
|
}
|
|
1139
624
|
// This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
|
|
@@ -1188,8 +673,7 @@ function $be8a9c035a82f788$var$TableVirtualizer({ layout: layout , collection: c
|
|
|
1188
673
|
bodyRef
|
|
1189
674
|
]);
|
|
1190
675
|
let onVisibleRectChange = $3fpzo$react.useCallback((rect)=>{
|
|
1191
|
-
|
|
1192
|
-
if (state.virtualizer.contentSize.height > 0) setTableWidth(rect.width);
|
|
676
|
+
setTableWidth(rect.width);
|
|
1193
677
|
state.setVisibleRect(rect);
|
|
1194
678
|
if (!isLoading && onLoadMore) {
|
|
1195
679
|
let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
|
|
@@ -1270,11 +754,16 @@ function $be8a9c035a82f788$var$TableColumnHeader(props) {
|
|
|
1270
754
|
if (columnProps.width && columnProps.allowsResizing) throw new Error('Controlled state is not yet supported with column resizing. Please use defaultWidth for uncontrolled column resizing or remove the allowsResizing prop.');
|
|
1271
755
|
let { hoverProps: hoverProps , isHovered: isHovered } = $3fpzo$reactariainteractions.useHover({
|
|
1272
756
|
});
|
|
757
|
+
if (columnProps.allowsResizing) // if we allow resizing, override the usePress that useTableColumnHeader generates so that clicking brings up the menu
|
|
758
|
+
// instead of sorting the column immediately
|
|
759
|
+
columnHeaderProps = {
|
|
760
|
+
...columnHeaderProps,
|
|
761
|
+
...buttonProps
|
|
762
|
+
};
|
|
1273
763
|
const allProps = [
|
|
1274
764
|
columnHeaderProps,
|
|
1275
765
|
hoverProps
|
|
1276
766
|
];
|
|
1277
|
-
if (columnProps.allowsResizing) allProps.push(buttonProps);
|
|
1278
767
|
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactariafocus.FocusRing, {
|
|
1279
768
|
focusRingClass: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'focus-ring')
|
|
1280
769
|
}, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
@@ -1297,40 +786,60 @@ function $be8a9c035a82f788$var$TableColumnHeader(props) {
|
|
|
1297
786
|
UNSAFE_className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-sortedIcon')
|
|
1298
787
|
}))));
|
|
1299
788
|
}
|
|
1300
|
-
function $be8a9c035a82f788$var$ResizableTableColumnHeader({
|
|
1301
|
-
var ref
|
|
1302
|
-
let
|
|
789
|
+
function $be8a9c035a82f788$var$ResizableTableColumnHeader({ column: column }) {
|
|
790
|
+
var ref;
|
|
791
|
+
let ref5 = $3fpzo$react.useRef();
|
|
792
|
+
let { state: state } = $be8a9c035a82f788$export$3cb274deb6c2d854();
|
|
1303
793
|
let formatMessage = $3fpzo$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($a89862f958371476$exports)));
|
|
1304
794
|
const onMenuSelect = (key)=>{
|
|
1305
795
|
switch(key){
|
|
1306
796
|
case 'sort-asc':
|
|
1307
|
-
state.sort(
|
|
797
|
+
state.sort(column.key, 'ascending');
|
|
1308
798
|
break;
|
|
1309
799
|
case 'sort-desc':
|
|
1310
|
-
state.sort(
|
|
800
|
+
state.sort(column.key, 'descending');
|
|
1311
801
|
break;
|
|
1312
802
|
case 'resize':
|
|
1313
803
|
// focusResizer, needs timeout so that it happens after the animation timeout for menu close
|
|
1314
804
|
setTimeout(()=>{
|
|
1315
|
-
$3fpzo$reactariafocus.focusSafely(
|
|
805
|
+
$3fpzo$reactariafocus.focusSafely(ref5.current);
|
|
1316
806
|
}, 360);
|
|
1317
807
|
break;
|
|
1318
808
|
}
|
|
1319
809
|
};
|
|
810
|
+
let allowsSorting = (ref = column.props) === null || ref === void 0 ? void 0 : ref.allowsSorting;
|
|
811
|
+
let items = $3fpzo$react.useMemo(()=>{
|
|
812
|
+
let options = {
|
|
813
|
+
sortAscending: allowsSorting && {
|
|
814
|
+
label: formatMessage('sortAscending'),
|
|
815
|
+
id: 'sort-asc'
|
|
816
|
+
},
|
|
817
|
+
sortDescending: allowsSorting && {
|
|
818
|
+
label: formatMessage('sortDescending'),
|
|
819
|
+
id: 'sort-desc'
|
|
820
|
+
},
|
|
821
|
+
resize: {
|
|
822
|
+
label: formatMessage('resizeColumn'),
|
|
823
|
+
id: 'resize'
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
return Object.keys(options).reduce((acc, key)=>{
|
|
827
|
+
if (options[key]) acc.push(options[key]);
|
|
828
|
+
return acc;
|
|
829
|
+
}, []);
|
|
830
|
+
}, [
|
|
831
|
+
allowsSorting
|
|
832
|
+
]);
|
|
1320
833
|
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement(($parcel$interopDefault($3fpzo$react)).Fragment, null, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.MenuTrigger, null, /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$TableColumnHeader, {
|
|
1321
|
-
column:
|
|
834
|
+
column: column
|
|
1322
835
|
}), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.Menu, {
|
|
1323
836
|
onAction: onMenuSelect,
|
|
1324
|
-
minWidth: "size-2000"
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
key: "resize"
|
|
1331
|
-
}, formatMessage('resizeColumn')))), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($2877766f94c67a67$export$48a76196cafe3b93, {
|
|
1332
|
-
ref: ref6,
|
|
1333
|
-
item: item
|
|
837
|
+
minWidth: "size-2000",
|
|
838
|
+
items: items
|
|
839
|
+
}, (item)=>/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($3fpzo$reactspectrummenu.Item, null, item.label)
|
|
840
|
+
)), /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($2877766f94c67a67$export$48a76196cafe3b93, {
|
|
841
|
+
ref: ref5,
|
|
842
|
+
column: column
|
|
1334
843
|
})));
|
|
1335
844
|
}
|
|
1336
845
|
function $be8a9c035a82f788$var$TableSelectAllCell({ column: column }) {
|
|
@@ -1375,8 +884,8 @@ function $be8a9c035a82f788$var$TableRowGroup({ children: children , ...otherProp
|
|
|
1375
884
|
}, children));
|
|
1376
885
|
}
|
|
1377
886
|
function $be8a9c035a82f788$var$TableRow({ item: item , children: children , hasActions: hasActions , ...otherProps }) {
|
|
1378
|
-
var ref,
|
|
1379
|
-
let
|
|
887
|
+
var ref, ref6, ref7;
|
|
888
|
+
let ref8 = $3fpzo$react.useRef();
|
|
1380
889
|
let { state: state , layout: layout } = $be8a9c035a82f788$export$3cb274deb6c2d854();
|
|
1381
890
|
let allowsInteraction = state.selectionManager.selectionMode !== 'none' || hasActions;
|
|
1382
891
|
let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
|
|
@@ -1384,7 +893,7 @@ function $be8a9c035a82f788$var$TableRow({ item: item , children: children , hasA
|
|
|
1384
893
|
let { rowProps: rowProps } = $3fpzo$reactariatable.useTableRow({
|
|
1385
894
|
node: item,
|
|
1386
895
|
isVirtualized: true
|
|
1387
|
-
}, state,
|
|
896
|
+
}, state, ref8);
|
|
1388
897
|
let { pressProps: pressProps , isPressed: isPressed } = $3fpzo$reactariainteractions.usePress({
|
|
1389
898
|
isDisabled: isDisabled
|
|
1390
899
|
});
|
|
@@ -1405,11 +914,11 @@ function $be8a9c035a82f788$var$TableRow({ item: item , children: children , hasA
|
|
|
1405
914
|
// border corners of the last row when selected.
|
|
1406
915
|
let isFlushWithContainerBottom = false;
|
|
1407
916
|
if (isLastRow) {
|
|
1408
|
-
if (((
|
|
917
|
+
if (((ref6 = layout.getContentSize()) === null || ref6 === void 0 ? void 0 : ref6.height) >= ((ref7 = layout.virtualizer) === null || ref7 === void 0 ? void 0 : ref7.getVisibleRect().height)) isFlushWithContainerBottom = true;
|
|
1409
918
|
}
|
|
1410
919
|
return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement("div", {
|
|
1411
920
|
...props,
|
|
1412
|
-
ref:
|
|
921
|
+
ref: ref8,
|
|
1413
922
|
className: $3fpzo$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($982885d0a34882ea$exports)), 'spectrum-Table-row', {
|
|
1414
923
|
'is-active': isPressed,
|
|
1415
924
|
'is-selected': isSelected,
|
|
@@ -1504,29 +1013,7 @@ function $be8a9c035a82f788$var$CenteredWrapper({ children: children }) {
|
|
|
1504
1013
|
}
|
|
1505
1014
|
/**
|
|
1506
1015
|
* Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
|
|
1507
|
-
*/ const $be8a9c035a82f788$
|
|
1508
|
-
/*
|
|
1509
|
-
When ready to remove this feature flag, you can remove this whole section of code, delete the _DEPRECATED files, and just replace the export with the _TableView above.
|
|
1510
|
-
*/ function $be8a9c035a82f788$var$FeatureFlaggedTableView(props, ref10) {
|
|
1511
|
-
let state = $3fpzo$reactstatelytable.useTableState({
|
|
1512
|
-
...props
|
|
1513
|
-
});
|
|
1514
|
-
const someColumnsAllowResizing = state.collection.columns.some((c)=>{
|
|
1515
|
-
var ref;
|
|
1516
|
-
return (ref = c.props) === null || ref === void 0 ? void 0 : ref.allowsResizing;
|
|
1517
|
-
});
|
|
1518
|
-
if (someColumnsAllowResizing) return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($be8a9c035a82f788$var$_TableView, {
|
|
1519
|
-
...props,
|
|
1520
|
-
ref: ref10
|
|
1521
|
-
}));
|
|
1522
|
-
else return(/*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).createElement($26e105b1bd39d4b5$export$8790f9f1576000df, {
|
|
1523
|
-
...props,
|
|
1524
|
-
ref: ref10
|
|
1525
|
-
}));
|
|
1526
|
-
}
|
|
1527
|
-
/**
|
|
1528
|
-
* Tables are containers for displaying information. They allow users to quickly scan, sort, compare, and take action on large amounts of data.
|
|
1529
|
-
*/ const $be8a9c035a82f788$export$b3c27e869d856b7 = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($be8a9c035a82f788$var$FeatureFlaggedTableView);
|
|
1016
|
+
*/ const $be8a9c035a82f788$export$b3c27e869d856b7 = /*#__PURE__*/ ($parcel$interopDefault($3fpzo$react)).forwardRef($be8a9c035a82f788$var$TableView);
|
|
1530
1017
|
|
|
1531
1018
|
|
|
1532
1019
|
|