@react-spectrum/table 3.9.1-nightly.3940 → 3.9.1-nightly.3960

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/module.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./main.css";
2
2
  import {Column as $gyhAV$Column, TableHeader as $e668f3d0f378a712$re_export$TableHeader, TableBody as $e668f3d0f378a712$re_export$TableBody, Section as $e668f3d0f378a712$re_export$Section, Row as $e668f3d0f378a712$re_export$Row, Cell as $e668f3d0f378a712$re_export$Cell, useTableState as $gyhAV$useTableState, TableColumnLayout as $gyhAV$TableColumnLayout} from "@react-stately/table";
3
3
  import $gyhAV$spectrumiconsuiArrowDownSmall from "@spectrum-icons/ui/ArrowDownSmall";
4
- import {mergeProps as $gyhAV$mergeProps, scrollIntoViewport as $gyhAV$scrollIntoViewport, scrollIntoView as $gyhAV$scrollIntoView, useLayoutEffect as $gyhAV$useLayoutEffect, chain as $gyhAV$chain, isWebKit as $gyhAV$isWebKit} from "@react-aria/utils";
4
+ import {mergeProps as $gyhAV$mergeProps, scrollIntoView as $gyhAV$scrollIntoView, scrollIntoViewport as $gyhAV$scrollIntoViewport, chain as $gyhAV$chain, isWebKit as $gyhAV$isWebKit} from "@react-aria/utils";
5
5
  import {Checkbox as $gyhAV$Checkbox} from "@react-spectrum/checkbox";
6
6
  import $gyhAV$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
7
7
  import {useStyleProps as $gyhAV$useStyleProps, useDOMRef as $gyhAV$useDOMRef, classNames as $gyhAV$classNames, useFocusableRef as $gyhAV$useFocusableRef, useIsMobileDevice as $gyhAV$useIsMobileDevice, useUnwrapDOMRef as $gyhAV$useUnwrapDOMRef} from "@react-spectrum/utils";
@@ -672,7 +672,6 @@ function $cb7d341e8868d81d$export$d9658cdf8c86807() {
672
672
 
673
673
 
674
674
 
675
-
676
675
  /* eslint-disable jsx-a11y/role-supports-aria-props */
677
676
  var $2fc56f9fdd93be52$exports = {};
678
677
  $2fc56f9fdd93be52$exports = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"-1 0 31 32\">\n <filter id=\"shadow\">\n <feDropShadow dx=\"0\" dy=\"0.5\" stdDeviation=\"1.2\" flood-opacity=\"0.7\"></feDropShadow>\n </filter>\n <g filter=\"url('#shadow')\" transform=\"translate(.5 0)\">\n <path d=\"M9.5,2c.27614,0,.5,.22388,.5,.5v6.5h3v-1.74951c0-.14893,.12215-.25049,.2513-.25049,.05457,0,.1104,.01819,.15875,.05847l2.58995,2.44153-2.58995,2.44153c-.04837,.04028-.10419,.05847-.15875,.05847-.12914,0-.2513-.10156-.2513-.25049v-1.74951h-3v6.5c0,.27612-.22386,.5-.5,.5h-1c-.27614,0-.5-.22388-.5-.5V2.5c0-.27612,.22386-.5,.5-.5h1Zm0-1h-1c-.82843,0-1.5,.67157-1.5,1.5v14c0,.82843,.67157,1.5,1.5,1.5h1c.82843,0,1.5-.67157,1.5-1.5v-5.5h1v.67757c0,.40416,.1632,.80501,.48197,1.05347,.49639,.3869,1.14001,.33571,1.56838-.02144l.02344-.01953,.0222-.02087,2.97589-2.80537c.20937-.19737,.20937-.53028,0-.72765l-2.97589-2.80537-.0222-.02087-.02345-.01965c-.22456-.18713-.5083-.29028-.79895-.29028-.3208,0-.62624,.12134-.86003,.34167-.24872,.23438-.39136,.56567-.39136,.90881v.74951h-1V2.5c0-.82843-.67157-1.5-1.5-1.5Z\" fill=\"#fff\"></path>\n <path d=\"M10,16.5v-6.5h3v1.74952c0,.21196,.24721,.32775,.41005,.19206l2.58995-2.44158-2.58995-2.44158c-.16283-.13569-.41005-.0199-.41005,.19206v1.74952h-3V2.5c0-.27614-.22386-.5-.5-.5h-1c-.27614,0-.5,.22386-.5,.5v14c0,.27614,.22386,.5,.5,.5h1c.27614,0,.5-.22386,.5-.5Z\"></path>\n </g>\n</svg>\n";
@@ -955,6 +954,7 @@ function $fc695d2eafc2b351$var$CursorOverlay(props) {
955
954
  const $fc695d2eafc2b351$export$48a76196cafe3b93 = /*#__PURE__*/ (0, $gyhAV$react).forwardRef($fc695d2eafc2b351$var$Resizer);
956
955
 
957
956
 
957
+
958
958
  /*
959
959
  * Copyright 2023 Adobe. All rights reserved.
960
960
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1251,13 +1251,14 @@ function $d14697b14e638114$var$TableView(props, ref) {
1251
1251
  }
1252
1252
  return /*#__PURE__*/ (0, $gyhAV$react).createElement((0, $gyhAV$VirtualizerItem), {
1253
1253
  key: reusableView.key,
1254
- reusableView: reusableView,
1255
- parent: parent,
1254
+ layoutInfo: reusableView.layoutInfo,
1255
+ virtualizer: reusableView.virtualizer,
1256
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo,
1256
1257
  className: (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($bd5d41f647a296c3$exports))), "spectrum-Table-cellWrapper", (0, $gyhAV$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($325bc3d43b25708b$exports))), {
1257
1258
  "react-spectrum-Table-cellWrapper": !reusableView.layoutInfo.estimatedSize,
1258
1259
  "react-spectrum-Table-cellWrapper--dropTarget": isDropTarget || isRootDroptarget
1259
1260
  }))
1260
- });
1261
+ }, reusableView.rendered);
1261
1262
  };
1262
1263
  let renderView = (type, item)=>{
1263
1264
  switch(type){
@@ -1422,8 +1423,9 @@ function $d14697b14e638114$var$TableView(props, ref) {
1422
1423
  }));
1423
1424
  }
1424
1425
  // This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
1425
- function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: collection , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , headerRef: headerRef , onVisibleRectChange: onVisibleRectChangeProp , isFocusVisible: isFocusVisible , isVirtualDragging: isVirtualDragging , isRootDropTarget: isRootDropTarget , ...otherProps }) {
1426
+ function $d14697b14e638114$var$TableVirtualizer(props) {
1426
1427
  var _layout_getLayoutInfo;
1428
+ let { layout: layout , collection: collection , focusedKey: focusedKey , renderView: renderView , renderWrapper: renderWrapper , domRef: domRef , bodyRef: bodyRef , headerRef: headerRef , onVisibleRectChange: onVisibleRectChangeProp , isFocusVisible: isFocusVisible , isVirtualDragging: isVirtualDragging , isRootDropTarget: isRootDropTarget , ...otherProps } = props;
1427
1429
  let { direction: direction } = (0, $gyhAV$useLocale)();
1428
1430
  let loadingState = collection.body.props.loadingState;
1429
1431
  let isLoading = loadingState === "loading" || loadingState === "loadingMore";
@@ -1447,7 +1449,6 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
1447
1449
  let item = collection.getItem(key);
1448
1450
  let column = collection.columns[0];
1449
1451
  let virtualizer = state.virtualizer;
1450
- let modality = (0, $gyhAV$getInteractionModality)();
1451
1452
  virtualizer.scrollToItem(key, {
1452
1453
  duration: 0,
1453
1454
  // Prevent scrolling to the top when clicking on column headers.
@@ -1459,22 +1460,27 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
1459
1460
  // Sync the scroll positions of the column headers and the body so scrollIntoViewport can
1460
1461
  // properly decide if the column is outside the viewport or not
1461
1462
  headerRef.current.scrollLeft = bodyRef.current.scrollLeft;
1462
- if (modality === "keyboard") (0, $gyhAV$scrollIntoViewport)(document.activeElement, {
1463
- containingElement: domRef.current
1464
- });
1465
1463
  }, [
1466
1464
  collection,
1467
- domRef,
1468
1465
  bodyRef,
1469
1466
  headerRef,
1470
1467
  layout,
1471
1468
  state.virtualizer
1472
1469
  ]);
1473
- let { virtualizerProps: virtualizerProps } = (0, $gyhAV$useVirtualizer)({
1474
- tabIndex: otherProps.tabIndex,
1475
- focusedKey: focusedKey,
1476
- scrollToItem: scrollToItem
1477
- }, state, domRef);
1470
+ let memoedVirtualizerProps = (0, $gyhAV$useMemo)(()=>({
1471
+ tabIndex: otherProps.tabIndex,
1472
+ focusedKey: focusedKey,
1473
+ scrollToItem: scrollToItem,
1474
+ isLoading: isLoading,
1475
+ onLoadMore: onLoadMore
1476
+ }), [
1477
+ otherProps.tabIndex,
1478
+ focusedKey,
1479
+ scrollToItem,
1480
+ isLoading,
1481
+ onLoadMore
1482
+ ]);
1483
+ let { virtualizerProps: virtualizerProps , scrollViewProps: { onVisibleRectChange: onVisibleRectChange } } = (0, $gyhAV$useVirtualizer)(memoedVirtualizerProps, state, domRef);
1478
1484
  // this effect runs whenever the contentSize changes, it doesn't matter what the content size is
1479
1485
  // only that it changes in a resize, and when that happens, we want to sync the body to the
1480
1486
  // header scroll position
@@ -1501,30 +1507,6 @@ function $d14697b14e638114$var$TableVirtualizer({ layout: layout , collection: c
1501
1507
  bodyRef,
1502
1508
  headerRef
1503
1509
  ]);
1504
- let onVisibleRectChange = (0, $gyhAV$useCallback)((rect)=>{
1505
- state.setVisibleRect(rect);
1506
- if (!isLoading && onLoadMore) {
1507
- let scrollOffset = state.virtualizer.contentSize.height - rect.height * 2;
1508
- if (rect.y > scrollOffset) onLoadMore();
1509
- }
1510
- // eslint-disable-next-line react-hooks/exhaustive-deps
1511
- }, [
1512
- onLoadMore,
1513
- isLoading,
1514
- state.setVisibleRect,
1515
- state.virtualizer
1516
- ]);
1517
- (0, $gyhAV$useLayoutEffect)(()=>{
1518
- if (!isLoading && onLoadMore && !state.isAnimating) {
1519
- if (state.contentSize.height <= state.virtualizer.visibleRect.height) onLoadMore();
1520
- }
1521
- }, [
1522
- state.contentSize,
1523
- state.virtualizer,
1524
- state.isAnimating,
1525
- onLoadMore,
1526
- isLoading
1527
- ]);
1528
1510
  let resizerPosition = layout.getResizerPosition() - 2;
1529
1511
  let resizerAtEdge = resizerPosition > Math.max(state.virtualizer.contentSize.width, state.virtualizer.visibleRect.width) - 3;
1530
1512
  // this should be fine, every movement of the resizer causes a rerender