@react-spectrum/table 3.12.11-nightly.4691 → 3.12.11-nightly.4694
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 +8 -3
- package/dist/TableViewBase.main.js.map +1 -1
- package/dist/TableViewBase.mjs +8 -3
- package/dist/TableViewBase.module.js +8 -3
- package/dist/TableViewBase.module.js.map +1 -1
- package/dist/TableViewLayout.main.js +17 -1
- package/dist/TableViewLayout.main.js.map +1 -1
- package/dist/TableViewLayout.mjs +17 -1
- package/dist/TableViewLayout.module.js +17 -1
- package/dist/TableViewLayout.module.js.map +1 -1
- package/package.json +30 -30
- package/src/TableViewBase.tsx +16 -4
- package/src/TableViewLayout.ts +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/table",
|
|
3
|
-
"version": "3.12.11-nightly.
|
|
3
|
+
"version": "3.12.11-nightly.4694+b46d23b99",
|
|
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.
|
|
40
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
41
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
42
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
43
|
-
"@react-aria/overlays": "3.0.0-nightly.
|
|
44
|
-
"@react-aria/selection": "3.0.0-nightly.
|
|
45
|
-
"@react-aria/table": "3.14.2-nightly.
|
|
46
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
47
|
-
"@react-aria/virtualizer": "3.10.2-nightly.
|
|
48
|
-
"@react-aria/visually-hidden": "3.0.0-nightly.
|
|
49
|
-
"@react-spectrum/checkbox": "3.0.0-nightly.
|
|
50
|
-
"@react-spectrum/dnd": "3.3.11-nightly.
|
|
51
|
-
"@react-spectrum/layout": "3.6.6-nightly.
|
|
52
|
-
"@react-spectrum/menu": "3.19.2-nightly.
|
|
53
|
-
"@react-spectrum/progress": "3.0.0-nightly.
|
|
54
|
-
"@react-spectrum/tooltip": "3.0.0-nightly.
|
|
55
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
56
|
-
"@react-stately/flags": "3.0.4-nightly.
|
|
57
|
-
"@react-stately/layout": "3.13.10-nightly.
|
|
58
|
-
"@react-stately/table": "3.11.9-nightly.
|
|
59
|
-
"@react-stately/virtualizer": "3.7.2-nightly.
|
|
60
|
-
"@react-types/grid": "3.2.7-nightly.
|
|
61
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
62
|
-
"@react-types/table": "3.9.6-nightly.
|
|
63
|
-
"@spectrum-icons/ui": "3.0.0-nightly.
|
|
39
|
+
"@react-aria/button": "3.0.0-nightly.2982+b46d23b99",
|
|
40
|
+
"@react-aria/focus": "3.0.0-nightly.2982+b46d23b99",
|
|
41
|
+
"@react-aria/i18n": "3.0.0-nightly.2982+b46d23b99",
|
|
42
|
+
"@react-aria/interactions": "3.0.0-nightly.2982+b46d23b99",
|
|
43
|
+
"@react-aria/overlays": "3.0.0-nightly.2982+b46d23b99",
|
|
44
|
+
"@react-aria/selection": "3.0.0-nightly.2982+b46d23b99",
|
|
45
|
+
"@react-aria/table": "3.14.2-nightly.4694+b46d23b99",
|
|
46
|
+
"@react-aria/utils": "3.0.0-nightly.2982+b46d23b99",
|
|
47
|
+
"@react-aria/virtualizer": "3.10.2-nightly.4694+b46d23b99",
|
|
48
|
+
"@react-aria/visually-hidden": "3.0.0-nightly.2982+b46d23b99",
|
|
49
|
+
"@react-spectrum/checkbox": "3.0.0-nightly.2982+b46d23b99",
|
|
50
|
+
"@react-spectrum/dnd": "3.3.11-nightly.4694+b46d23b99",
|
|
51
|
+
"@react-spectrum/layout": "3.6.6-nightly.4694+b46d23b99",
|
|
52
|
+
"@react-spectrum/menu": "3.19.2-nightly.4694+b46d23b99",
|
|
53
|
+
"@react-spectrum/progress": "3.0.0-nightly.2982+b46d23b99",
|
|
54
|
+
"@react-spectrum/tooltip": "3.0.0-nightly.2982+b46d23b99",
|
|
55
|
+
"@react-spectrum/utils": "3.0.0-nightly.2982+b46d23b99",
|
|
56
|
+
"@react-stately/flags": "3.0.4-nightly.4694+b46d23b99",
|
|
57
|
+
"@react-stately/layout": "3.13.10-nightly.4694+b46d23b99",
|
|
58
|
+
"@react-stately/table": "3.11.9-nightly.4694+b46d23b99",
|
|
59
|
+
"@react-stately/virtualizer": "3.7.2-nightly.4694+b46d23b99",
|
|
60
|
+
"@react-types/grid": "3.2.7-nightly.4694+b46d23b99",
|
|
61
|
+
"@react-types/shared": "3.0.0-nightly.2982+b46d23b99",
|
|
62
|
+
"@react-types/table": "3.9.6-nightly.4694+b46d23b99",
|
|
63
|
+
"@spectrum-icons/ui": "3.0.0-nightly.2982+b46d23b99",
|
|
64
64
|
"@swc/helpers": "^0.5.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
68
|
-
"@react-aria/dnd": "3.6.2-nightly.
|
|
69
|
-
"@react-stately/dnd": "3.3.2-nightly.
|
|
67
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.2982+b46d23b99",
|
|
68
|
+
"@react-aria/dnd": "3.6.2-nightly.4694+b46d23b99",
|
|
69
|
+
"@react-stately/dnd": "3.3.2-nightly.4694+b46d23b99"
|
|
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": "
|
|
79
|
+
"gitHead": "b46d23b9919eaec8ab1f621b52beced82e88b6ca"
|
|
80
80
|
}
|
package/src/TableViewBase.tsx
CHANGED
|
@@ -550,11 +550,10 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
|
|
|
550
550
|
getDefaultMinWidth
|
|
551
551
|
}, tableState);
|
|
552
552
|
|
|
553
|
-
let state = useVirtualizerState<
|
|
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
|
-
{
|
|
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
|
-
{
|
|
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);
|
package/src/TableViewLayout.ts
CHANGED
|
@@ -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
|
}
|