@react-spectrum/table 3.12.11-nightly.4695 → 3.12.11-nightly.4700

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/table",
3
- "version": "3.12.11-nightly.4695+2964e9aaf",
3
+ "version": "3.12.11-nightly.4700+81abb2185",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,37 +36,37 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/button": "3.0.0-nightly.2983+2964e9aaf",
40
- "@react-aria/focus": "3.0.0-nightly.2983+2964e9aaf",
41
- "@react-aria/i18n": "3.0.0-nightly.2983+2964e9aaf",
42
- "@react-aria/interactions": "3.0.0-nightly.2983+2964e9aaf",
43
- "@react-aria/overlays": "3.0.0-nightly.2983+2964e9aaf",
44
- "@react-aria/selection": "3.0.0-nightly.2983+2964e9aaf",
45
- "@react-aria/table": "3.14.2-nightly.4695+2964e9aaf",
46
- "@react-aria/utils": "3.0.0-nightly.2983+2964e9aaf",
47
- "@react-aria/virtualizer": "3.10.2-nightly.4695+2964e9aaf",
48
- "@react-aria/visually-hidden": "3.0.0-nightly.2983+2964e9aaf",
49
- "@react-spectrum/checkbox": "3.0.0-nightly.2983+2964e9aaf",
50
- "@react-spectrum/dnd": "3.3.11-nightly.4695+2964e9aaf",
51
- "@react-spectrum/layout": "3.6.6-nightly.4695+2964e9aaf",
52
- "@react-spectrum/menu": "3.19.2-nightly.4695+2964e9aaf",
53
- "@react-spectrum/progress": "3.0.0-nightly.2983+2964e9aaf",
54
- "@react-spectrum/tooltip": "3.0.0-nightly.2983+2964e9aaf",
55
- "@react-spectrum/utils": "3.0.0-nightly.2983+2964e9aaf",
56
- "@react-stately/flags": "3.0.4-nightly.4695+2964e9aaf",
57
- "@react-stately/layout": "3.13.10-nightly.4695+2964e9aaf",
58
- "@react-stately/table": "3.11.9-nightly.4695+2964e9aaf",
59
- "@react-stately/virtualizer": "3.7.2-nightly.4695+2964e9aaf",
60
- "@react-types/grid": "3.2.7-nightly.4695+2964e9aaf",
61
- "@react-types/shared": "3.0.0-nightly.2983+2964e9aaf",
62
- "@react-types/table": "3.9.6-nightly.4695+2964e9aaf",
63
- "@spectrum-icons/ui": "3.0.0-nightly.2983+2964e9aaf",
39
+ "@react-aria/button": "3.0.0-nightly.2988+81abb2185",
40
+ "@react-aria/focus": "3.0.0-nightly.2988+81abb2185",
41
+ "@react-aria/i18n": "3.0.0-nightly.2988+81abb2185",
42
+ "@react-aria/interactions": "3.0.0-nightly.2988+81abb2185",
43
+ "@react-aria/overlays": "3.0.0-nightly.2988+81abb2185",
44
+ "@react-aria/selection": "3.0.0-nightly.2988+81abb2185",
45
+ "@react-aria/table": "3.14.2-nightly.4700+81abb2185",
46
+ "@react-aria/utils": "3.0.0-nightly.2988+81abb2185",
47
+ "@react-aria/virtualizer": "3.10.2-nightly.4700+81abb2185",
48
+ "@react-aria/visually-hidden": "3.0.0-nightly.2988+81abb2185",
49
+ "@react-spectrum/checkbox": "3.0.0-nightly.2988+81abb2185",
50
+ "@react-spectrum/dnd": "3.3.11-nightly.4700+81abb2185",
51
+ "@react-spectrum/layout": "3.6.6-nightly.4700+81abb2185",
52
+ "@react-spectrum/menu": "3.19.2-nightly.4700+81abb2185",
53
+ "@react-spectrum/progress": "3.0.0-nightly.2988+81abb2185",
54
+ "@react-spectrum/tooltip": "3.0.0-nightly.2988+81abb2185",
55
+ "@react-spectrum/utils": "3.0.0-nightly.2988+81abb2185",
56
+ "@react-stately/flags": "3.0.4-nightly.4700+81abb2185",
57
+ "@react-stately/layout": "3.13.10-nightly.4700+81abb2185",
58
+ "@react-stately/table": "3.11.9-nightly.4700+81abb2185",
59
+ "@react-stately/virtualizer": "3.7.2-nightly.4700+81abb2185",
60
+ "@react-types/grid": "3.2.7-nightly.4700+81abb2185",
61
+ "@react-types/shared": "3.0.0-nightly.2988+81abb2185",
62
+ "@react-types/table": "3.9.6-nightly.4700+81abb2185",
63
+ "@spectrum-icons/ui": "3.0.0-nightly.2988+81abb2185",
64
64
  "@swc/helpers": "^0.5.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@adobe/spectrum-css-temp": "3.0.0-nightly.2983+2964e9aaf",
68
- "@react-aria/dnd": "3.6.2-nightly.4695+2964e9aaf",
69
- "@react-stately/dnd": "3.3.2-nightly.4695+2964e9aaf"
67
+ "@adobe/spectrum-css-temp": "3.0.0-nightly.2988+81abb2185",
68
+ "@react-aria/dnd": "3.6.2-nightly.4700+81abb2185",
69
+ "@react-stately/dnd": "3.3.2-nightly.4700+81abb2185"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@react-spectrum/provider": "^3.0.0",
@@ -76,5 +76,5 @@
76
76
  "publishConfig": {
77
77
  "access": "public"
78
78
  },
79
- "gitHead": "2964e9aafc281888cd65da5bd77512e7f999bd84"
79
+ "gitHead": "81abb2185cb3a9c52a8feaf76a136c64852aea13"
80
80
  }
@@ -404,10 +404,20 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
404
404
  }, [propsOnResizeEnd, setIsInResizeMode, setIsResizing]);
405
405
 
406
406
  let focusedKey = state.selectionManager.focusedKey;
407
+ let dropTargetKey: Key | null = null;
407
408
  if (dropState?.target?.type === 'item') {
408
- focusedKey = dropState.target.key;
409
+ dropTargetKey = dropState.target.key;
410
+ if (dropState.target.dropPosition === 'before' && dropTargetKey !== state.collection.getFirstKey()) {
411
+ // Normalize to the "after" drop position since we only render those in the DOM.
412
+ // The exception to this is for the first row in the table, where we also render the "before" position.
413
+ dropTargetKey = state.collection.getKeyBefore(dropTargetKey);
414
+ }
409
415
  }
410
416
 
417
+ let persistedKeys = useMemo(() => {
418
+ return new Set([focusedKey, dropTargetKey].filter(k => k !== null));
419
+ }, [focusedKey, dropTargetKey]);
420
+
411
421
  let mergedProps = mergeProps(
412
422
  isTableDroppable && droppableCollection?.collectionProps,
413
423
  gridProps,
@@ -462,7 +472,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
462
472
  tableState={state}
463
473
  layout={layout}
464
474
  collection={state.collection}
465
- focusedKey={focusedKey}
475
+ persistedKeys={persistedKeys}
466
476
  renderView={renderView}
467
477
  renderWrapper={renderWrapper}
468
478
  onVisibleRectChange={onVisibleRectChange}
@@ -494,7 +504,7 @@ interface TableVirtualizerProps<T> extends HTMLAttributes<HTMLElement> {
494
504
  tableState: TableState<T>,
495
505
  layout: TableViewLayout<T>,
496
506
  collection: TableCollection<T>,
497
- focusedKey: Key | null,
507
+ persistedKeys: Set<Key> | null,
498
508
  renderView: (type: string, content: GridNode<T>) => ReactElement,
499
509
  renderWrapper?: (
500
510
  parent: View | null,
@@ -513,7 +523,7 @@ interface TableVirtualizerProps<T> extends HTMLAttributes<HTMLElement> {
513
523
 
514
524
  // This is a custom Virtualizer that also has a header that syncs its scroll position with the body.
515
525
  function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
516
- let {tableState, layout, collection, focusedKey, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible, isVirtualDragging, isRootDropTarget, ...otherProps} = props;
526
+ let {tableState, layout, collection, persistedKeys, renderView, renderWrapper, domRef, bodyRef, headerRef, onVisibleRectChange: onVisibleRectChangeProp, isFocusVisible, isVirtualDragging, isRootDropTarget, ...otherProps} = props;
517
527
  let {direction} = useLocale();
518
528
  let loadingState = collection.body.props.loadingState;
519
529
  let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
@@ -558,7 +568,7 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
558
568
  bodyRef.current.scrollTop = rect.y;
559
569
  setScrollLeft(bodyRef.current, direction, rect.x);
560
570
  },
561
- persistedKeys: useMemo(() => focusedKey ? new Set([focusedKey]) : new Set(), [focusedKey]),
571
+ persistedKeys,
562
572
  layoutOptions: useMemo(() => ({
563
573
  columnWidths: columnResizeState.columnWidths
564
574
  }), [columnResizeState.columnWidths])
@@ -566,10 +576,10 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
566
576
 
567
577
  let memoedVirtualizerProps = useMemo(() => ({
568
578
  tabIndex: otherProps.tabIndex,
569
- focusedKey,
579
+ persistedKeys,
570
580
  isLoading,
571
581
  onLoadMore
572
- }), [otherProps.tabIndex, focusedKey, isLoading, onLoadMore]);
582
+ }), [otherProps.tabIndex, persistedKeys, isLoading, onLoadMore]);
573
583
 
574
584
  let {virtualizerProps, scrollViewProps: {onVisibleRectChange}} = useVirtualizer(memoedVirtualizerProps, state, domRef);
575
585
  let onVisibleRectChangeMemo = useCallback(rect => {
@@ -36,7 +36,7 @@ export class TableViewLayout<T> extends TableLayout<T> {
36
36
 
37
37
  if (this.isLoading) {
38
38
  // Add some margin around the loader to ensure that scrollbars don't flicker in and out.
39
- let rect = new Rect(40, 40, (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
39
+ let rect = new Rect(40, Math.max(layoutInfo.rect.maxY, 40), (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
40
40
  let loader = new LayoutInfo('loader', 'loader', rect);
41
41
  loader.parentKey = layoutInfo.key;
42
42
  loader.isSticky = children.length === 0;