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

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.4691+fabca84b9",
3
+ "version": "3.12.11-nightly.4695+2964e9aaf",
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.2979+fabca84b9",
40
- "@react-aria/focus": "3.0.0-nightly.2979+fabca84b9",
41
- "@react-aria/i18n": "3.0.0-nightly.2979+fabca84b9",
42
- "@react-aria/interactions": "3.0.0-nightly.2979+fabca84b9",
43
- "@react-aria/overlays": "3.0.0-nightly.2979+fabca84b9",
44
- "@react-aria/selection": "3.0.0-nightly.2979+fabca84b9",
45
- "@react-aria/table": "3.14.2-nightly.4691+fabca84b9",
46
- "@react-aria/utils": "3.0.0-nightly.2979+fabca84b9",
47
- "@react-aria/virtualizer": "3.10.2-nightly.4691+fabca84b9",
48
- "@react-aria/visually-hidden": "3.0.0-nightly.2979+fabca84b9",
49
- "@react-spectrum/checkbox": "3.0.0-nightly.2979+fabca84b9",
50
- "@react-spectrum/dnd": "3.3.11-nightly.4691+fabca84b9",
51
- "@react-spectrum/layout": "3.6.6-nightly.4691+fabca84b9",
52
- "@react-spectrum/menu": "3.19.2-nightly.4691+fabca84b9",
53
- "@react-spectrum/progress": "3.0.0-nightly.2979+fabca84b9",
54
- "@react-spectrum/tooltip": "3.0.0-nightly.2979+fabca84b9",
55
- "@react-spectrum/utils": "3.0.0-nightly.2979+fabca84b9",
56
- "@react-stately/flags": "3.0.4-nightly.4691+fabca84b9",
57
- "@react-stately/layout": "3.13.10-nightly.4691+fabca84b9",
58
- "@react-stately/table": "3.11.9-nightly.4691+fabca84b9",
59
- "@react-stately/virtualizer": "3.7.2-nightly.4691+fabca84b9",
60
- "@react-types/grid": "3.2.7-nightly.4691+fabca84b9",
61
- "@react-types/shared": "3.0.0-nightly.2979+fabca84b9",
62
- "@react-types/table": "3.9.6-nightly.4691+fabca84b9",
63
- "@spectrum-icons/ui": "3.0.0-nightly.2979+fabca84b9",
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",
64
64
  "@swc/helpers": "^0.5.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@adobe/spectrum-css-temp": "3.0.0-nightly.2979+fabca84b9",
68
- "@react-aria/dnd": "3.6.2-nightly.4691+fabca84b9",
69
- "@react-stately/dnd": "3.3.2-nightly.4691+fabca84b9"
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"
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": "fabca84b95c9c61f9062d5f1e66ebe2c920a2a5d"
79
+ "gitHead": "2964e9aafc281888cd65da5bd77512e7f999bd84"
80
80
  }
@@ -550,11 +550,10 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
550
550
  getDefaultMinWidth
551
551
  }, tableState);
552
552
 
553
- let state = useVirtualizerState<object, ReactNode, ReactNode>({
553
+ let state = useVirtualizerState<GridNode<unknown>, ReactNode>({
554
554
  layout,
555
555
  collection,
556
556
  renderView,
557
- renderWrapper,
558
557
  onVisibleRectChange(rect) {
559
558
  bodyRef.current.scrollTop = rect.y;
560
559
  setScrollLeft(bodyRef.current, direction, rect.x);
@@ -623,6 +622,8 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
623
622
  scrollPadding = columnResizeState.getColumnWidth(firstColumn.key);
624
623
  }
625
624
 
625
+ let visibleViews = renderChildren(null, state.visibleViews, renderWrapper);
626
+
626
627
  return (
627
628
  <VirtualizerContext.Provider value={resizingColumn}>
628
629
  <FocusScope>
@@ -641,7 +642,7 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
641
642
  }}
642
643
  ref={headerRef}>
643
644
  <ResizeStateContext.Provider value={columnResizeState}>
644
- {state.visibleViews[0]}
645
+ {visibleViews[0]}
645
646
  </ResizeStateContext.Provider>
646
647
  </div>
647
648
  <ScrollView
@@ -679,7 +680,7 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
679
680
  onScrollStart={state.startScrolling}
680
681
  onScrollEnd={state.endScrolling}
681
682
  onScroll={onScroll}>
682
- {state.visibleViews[1]}
683
+ {visibleViews[1]}
683
684
  <div
684
685
  className={classNames(styles, 'spectrum-Table-bodyResizeIndicator')}
685
686
  style={{[direction === 'ltr' ? 'left' : 'right']: `${resizerPosition}px`, height: `${Math.max(state.virtualizer.contentSize.height, state.virtualizer.visibleRect.height)}px`, display: columnResizeState.resizingColumn ? 'block' : 'none'}} />
@@ -690,6 +691,17 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
690
691
  );
691
692
  }
692
693
 
694
+ function renderChildren<T extends object>(parent: View | null, views: View[], renderWrapper: TableVirtualizerProps<T>['renderWrapper']) {
695
+ return views.map(view => {
696
+ return renderWrapper(
697
+ parent,
698
+ view,
699
+ view.children ? Array.from(view.children) : [],
700
+ childViews => renderChildren(view, childViews, renderWrapper)
701
+ );
702
+ });
703
+ }
704
+
693
705
  function useStyle(layoutInfo: LayoutInfo, parent: LayoutInfo | null) {
694
706
  let {direction} = useLocale();
695
707
  let style = layoutInfoToStyle(layoutInfo, direction, parent);
@@ -1,3 +1,15 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ import {DropTarget} from '@react-types/shared';
1
13
  import {GridNode} from '@react-types/grid';
2
14
  import {LayoutInfo, Rect} from '@react-stately/virtualizer';
3
15
  import {LayoutNode, TableLayout} from '@react-stately/layout';
@@ -66,4 +78,10 @@ export class TableViewLayout<T> extends TableLayout<T> {
66
78
  protected isStickyColumn(node: GridNode<T>) {
67
79
  return node.props?.isDragButtonCell || node.props?.isSelectionCell;
68
80
  }
81
+
82
+ getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {
83
+ // Offset for height of header row
84
+ y -= this.virtualizer.layout.getVisibleLayoutInfos(new Rect(x, y, 1, 1)).find(info => info.type === 'headerrow')?.rect.height;
85
+ return super.getDropTargetFromPoint(x, y, isValidDropTarget);
86
+ }
69
87
  }