@react-spectrum/table 3.12.11-nightly.4685 → 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.
@@ -0,0 +1,86 @@
1
+ import {Rect as $5yFQM$Rect, LayoutInfo as $5yFQM$LayoutInfo} from "@react-stately/virtualizer";
2
+ import {TableLayout as $5yFQM$TableLayout} from "@react-stately/layout";
3
+
4
+ /*
5
+ * Copyright 2024 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ class $5fb43af69b290859$export$725d101278f5a47b extends (0, $5yFQM$TableLayout) {
17
+ buildCollection() {
18
+ let loadingState = this.collection.body.props.loadingState;
19
+ this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
20
+ return super.buildCollection();
21
+ }
22
+ buildColumn(node, x, y) {
23
+ let res = super.buildColumn(node, x, y);
24
+ res.layoutInfo.allowOverflow = true; // for resizer nubbin
25
+ return res;
26
+ }
27
+ buildBody() {
28
+ let node = super.buildBody(0);
29
+ let { children: children, layoutInfo: layoutInfo } = node;
30
+ let width = node.layoutInfo.rect.width;
31
+ if (this.isLoading) {
32
+ // Add some margin around the loader to ensure that scrollbars don't flicker in and out.
33
+ let rect = new (0, $5yFQM$Rect)(40, 40, (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
34
+ let loader = new (0, $5yFQM$LayoutInfo)('loader', 'loader', rect);
35
+ loader.parentKey = layoutInfo.key;
36
+ loader.isSticky = children.length === 0;
37
+ let node = {
38
+ layoutInfo: loader,
39
+ validRect: loader.rect
40
+ };
41
+ children.push(node);
42
+ this.layoutNodes.set(loader.key, node);
43
+ layoutInfo.rect.height = loader.rect.maxY;
44
+ width = Math.max(width, rect.width);
45
+ } else if (children.length === 0) {
46
+ let rect = new (0, $5yFQM$Rect)(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);
47
+ let empty = new (0, $5yFQM$LayoutInfo)('empty', 'empty', rect);
48
+ empty.parentKey = layoutInfo.key;
49
+ empty.isSticky = true;
50
+ let node = {
51
+ layoutInfo: empty,
52
+ validRect: empty.rect
53
+ };
54
+ children.push(node);
55
+ layoutInfo.rect.height = empty.rect.maxY;
56
+ width = Math.max(width, rect.width);
57
+ }
58
+ return node;
59
+ }
60
+ buildRow(node, x, y) {
61
+ let res = super.buildRow(node, x, y);
62
+ res.layoutInfo.rect.height += 1; // for bottom border
63
+ return res;
64
+ }
65
+ getEstimatedRowHeight() {
66
+ return super.getEstimatedRowHeight() + 1; // for bottom border
67
+ }
68
+ isStickyColumn(node) {
69
+ var _node_props, _node_props1;
70
+ return ((_node_props = node.props) === null || _node_props === void 0 ? void 0 : _node_props.isDragButtonCell) || ((_node_props1 = node.props) === null || _node_props1 === void 0 ? void 0 : _node_props1.isSelectionCell);
71
+ }
72
+ getDropTargetFromPoint(x, y, isValidDropTarget) {
73
+ var _this_virtualizer_layout_getVisibleLayoutInfos_find;
74
+ // Offset for height of header row
75
+ y -= (_this_virtualizer_layout_getVisibleLayoutInfos_find = this.virtualizer.layout.getVisibleLayoutInfos(new (0, $5yFQM$Rect)(x, y, 1, 1)).find((info)=>info.type === 'headerrow')) === null || _this_virtualizer_layout_getVisibleLayoutInfos_find === void 0 ? void 0 : _this_virtualizer_layout_getVisibleLayoutInfos_find.rect.height;
76
+ return super.getDropTargetFromPoint(x, y, isValidDropTarget);
77
+ }
78
+ constructor(...args){
79
+ super(...args);
80
+ this.isLoading = false;
81
+ }
82
+ }
83
+
84
+
85
+ export {$5fb43af69b290859$export$725d101278f5a47b as TableViewLayout};
86
+ //# sourceMappingURL=TableViewLayout.module.js.map
@@ -0,0 +1,86 @@
1
+ import {Rect as $5yFQM$Rect, LayoutInfo as $5yFQM$LayoutInfo} from "@react-stately/virtualizer";
2
+ import {TableLayout as $5yFQM$TableLayout} from "@react-stately/layout";
3
+
4
+ /*
5
+ * Copyright 2024 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+
16
+ class $5fb43af69b290859$export$725d101278f5a47b extends (0, $5yFQM$TableLayout) {
17
+ buildCollection() {
18
+ let loadingState = this.collection.body.props.loadingState;
19
+ this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
20
+ return super.buildCollection();
21
+ }
22
+ buildColumn(node, x, y) {
23
+ let res = super.buildColumn(node, x, y);
24
+ res.layoutInfo.allowOverflow = true; // for resizer nubbin
25
+ return res;
26
+ }
27
+ buildBody() {
28
+ let node = super.buildBody(0);
29
+ let { children: children, layoutInfo: layoutInfo } = node;
30
+ let width = node.layoutInfo.rect.width;
31
+ if (this.isLoading) {
32
+ // Add some margin around the loader to ensure that scrollbars don't flicker in and out.
33
+ let rect = new (0, $5yFQM$Rect)(40, 40, (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);
34
+ let loader = new (0, $5yFQM$LayoutInfo)('loader', 'loader', rect);
35
+ loader.parentKey = layoutInfo.key;
36
+ loader.isSticky = children.length === 0;
37
+ let node = {
38
+ layoutInfo: loader,
39
+ validRect: loader.rect
40
+ };
41
+ children.push(node);
42
+ this.layoutNodes.set(loader.key, node);
43
+ layoutInfo.rect.height = loader.rect.maxY;
44
+ width = Math.max(width, rect.width);
45
+ } else if (children.length === 0) {
46
+ let rect = new (0, $5yFQM$Rect)(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);
47
+ let empty = new (0, $5yFQM$LayoutInfo)('empty', 'empty', rect);
48
+ empty.parentKey = layoutInfo.key;
49
+ empty.isSticky = true;
50
+ let node = {
51
+ layoutInfo: empty,
52
+ validRect: empty.rect
53
+ };
54
+ children.push(node);
55
+ layoutInfo.rect.height = empty.rect.maxY;
56
+ width = Math.max(width, rect.width);
57
+ }
58
+ return node;
59
+ }
60
+ buildRow(node, x, y) {
61
+ let res = super.buildRow(node, x, y);
62
+ res.layoutInfo.rect.height += 1; // for bottom border
63
+ return res;
64
+ }
65
+ getEstimatedRowHeight() {
66
+ return super.getEstimatedRowHeight() + 1; // for bottom border
67
+ }
68
+ isStickyColumn(node) {
69
+ var _node_props, _node_props1;
70
+ return ((_node_props = node.props) === null || _node_props === void 0 ? void 0 : _node_props.isDragButtonCell) || ((_node_props1 = node.props) === null || _node_props1 === void 0 ? void 0 : _node_props1.isSelectionCell);
71
+ }
72
+ getDropTargetFromPoint(x, y, isValidDropTarget) {
73
+ var _this_virtualizer_layout_getVisibleLayoutInfos_find;
74
+ // Offset for height of header row
75
+ y -= (_this_virtualizer_layout_getVisibleLayoutInfos_find = this.virtualizer.layout.getVisibleLayoutInfos(new (0, $5yFQM$Rect)(x, y, 1, 1)).find((info)=>info.type === 'headerrow')) === null || _this_virtualizer_layout_getVisibleLayoutInfos_find === void 0 ? void 0 : _this_virtualizer_layout_getVisibleLayoutInfos_find.rect.height;
76
+ return super.getDropTargetFromPoint(x, y, isValidDropTarget);
77
+ }
78
+ constructor(...args){
79
+ super(...args);
80
+ this.isLoading = false;
81
+ }
82
+ }
83
+
84
+
85
+ export {$5fb43af69b290859$export$725d101278f5a47b as TableViewLayout};
86
+ //# sourceMapping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BAA/F,0EAAA,oDAA6G,IAAI,CAAC,MAAM;QAC7H,OAAO,KAAK,CAAC,uBAAuB,GAAG,GAAG;IAC5C;;;aApEQ,YAAqB;;AAqE/B","sources":["packages/@react-spectrum/table/src/TableViewLayout.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {DropTarget} from '@react-types/shared';\nimport {GridNode} from '@react-types/grid';\nimport {LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, TableLayout} from '@react-stately/layout';\n\nexport class TableViewLayout<T> extends TableLayout<T> {\n private isLoading: boolean = false;\n\n protected buildCollection(): LayoutNode[] {\n let loadingState = this.collection.body.props.loadingState;\n this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n return super.buildCollection();\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let res = super.buildColumn(node, x, y);\n res.layoutInfo.allowOverflow = true; // for resizer nubbin\n return res;\n }\n\n protected buildBody(): LayoutNode {\n let node = super.buildBody(0);\n let {children, layoutInfo} = node;\n let width = node.layoutInfo.rect.width;\n\n if (this.isLoading) {\n // Add some margin around the loader to ensure that scrollbars don't flicker in and out.\n let rect = new Rect(40, 40, (width || this.virtualizer.visibleRect.width) - 80, children.length === 0 ? this.virtualizer.visibleRect.height - 80 : 60);\n let loader = new LayoutInfo('loader', 'loader', rect);\n loader.parentKey = layoutInfo.key;\n loader.isSticky = children.length === 0;\n let node = {\n layoutInfo: loader,\n validRect: loader.rect\n };\n children.push(node);\n this.layoutNodes.set(loader.key, node);\n layoutInfo.rect.height = loader.rect.maxY;\n width = Math.max(width, rect.width);\n } else if (children.length === 0) {\n let rect = new Rect(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);\n let empty = new LayoutInfo('empty', 'empty', rect);\n empty.parentKey = layoutInfo.key;\n empty.isSticky = true;\n let node = {\n layoutInfo: empty,\n validRect: empty.rect\n };\n children.push(node);\n layoutInfo.rect.height = empty.rect.maxY;\n width = Math.max(width, rect.width);\n }\n\n return node;\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let res = super.buildRow(node, x, y);\n res.layoutInfo.rect.height += 1; // for bottom border\n return res;\n }\n\n protected getEstimatedRowHeight(): number {\n return super.getEstimatedRowHeight() + 1; // for bottom border\n }\n\n protected isStickyColumn(node: GridNode<T>) {\n return node.props?.isDragButtonCell || node.props?.isSelectionCell;\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget {\n // Offset for height of header row\n y -= this.virtualizer.layout.getVisibleLayoutInfos(new Rect(x, y, 1, 1)).find(info => info.type === 'headerrow')?.rect.height;\n return super.getDropTargetFromPoint(x, y, isValidDropTarget);\n }\n}\n"],"names":[],"version":3,"file":"TableViewLayout.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;AQoBA,oCAAoC,CAAC,CAAE,SAAQ,WAAW,CAAC,CAAC,EAAE,sBAAsB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU;IAC3H;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC7C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IACrC,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAA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/table/src/packages/@react-spectrum/table/src/InsertionIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Nubbin.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Resizer.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/RootDropIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/DragPreview.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableViewBase.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableView.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TreeGridTableView.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableViewWrapper.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/index.ts","packages/@react-spectrum/table/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {TableView} from './TableViewWrapper';\nimport {Column} from '@react-stately/table';\nimport {JSX} from 'react';\nimport {SpectrumColumnProps} from '@react-types/table';\n\n// Override TS for Column to support spectrum specific props.\nconst SpectrumColumn = Column as <T>(props: SpectrumColumnProps<T>) => JSX.Element;\nexport {SpectrumColumn as Column};\n\nexport {\n TableHeader,\n TableBody,\n Section,\n Row,\n Cell\n} from '@react-stately/table';\n\nexport type {SpectrumColumnProps, TableHeaderProps, TableBodyProps, RowProps, CellProps} from '@react-types/table';\nexport type {SpectrumTableProps} from './TableViewWrapper';\n"],"names":[],"version":3,"file":"types.d.ts.map"}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0D,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,OAAO,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;AC9EnJ,OAAA,MAAM,QAA2B,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;AAGnF,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,GAAG,EACH,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAC,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC","sources":["packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/InsertionIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Nubbin.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/Resizer.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/RootDropIndicator.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/DragPreview.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableViewLayout.ts","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableViewBase.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableView.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TreeGridTableView.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/TableViewWrapper.tsx","packages/@react-spectrum/table/src/packages/@react-spectrum/table/src/index.ts","packages/@react-spectrum/table/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {TableView} from './TableViewWrapper';\nimport {Column} from '@react-stately/table';\nimport {JSX} from 'react';\nimport {SpectrumColumnProps} from '@react-types/table';\n\n// Override TS for Column to support spectrum specific props.\nconst SpectrumColumn = Column as <T>(props: SpectrumColumnProps<T>) => JSX.Element;\nexport {SpectrumColumn as Column};\n\nexport {\n TableHeader,\n TableBody,\n Section,\n Row,\n Cell\n} from '@react-stately/table';\n\nexport type {SpectrumColumnProps, TableHeaderProps, TableBodyProps, RowProps, CellProps} from '@react-types/table';\nexport type {SpectrumTableProps} from './TableViewWrapper';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/table",
3
- "version": "3.12.11-nightly.4685+a48d1673f",
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.2973+a48d1673f",
40
- "@react-aria/focus": "3.0.0-nightly.2973+a48d1673f",
41
- "@react-aria/i18n": "3.0.0-nightly.2973+a48d1673f",
42
- "@react-aria/interactions": "3.0.0-nightly.2973+a48d1673f",
43
- "@react-aria/overlays": "3.0.0-nightly.2973+a48d1673f",
44
- "@react-aria/selection": "3.0.0-nightly.2973+a48d1673f",
45
- "@react-aria/table": "3.14.2-nightly.4685+a48d1673f",
46
- "@react-aria/utils": "3.0.0-nightly.2973+a48d1673f",
47
- "@react-aria/virtualizer": "3.10.2-nightly.4685+a48d1673f",
48
- "@react-aria/visually-hidden": "3.0.0-nightly.2973+a48d1673f",
49
- "@react-spectrum/checkbox": "3.0.0-nightly.2973+a48d1673f",
50
- "@react-spectrum/dnd": "3.3.11-nightly.4685+a48d1673f",
51
- "@react-spectrum/layout": "3.6.6-nightly.4685+a48d1673f",
52
- "@react-spectrum/menu": "3.19.2-nightly.4685+a48d1673f",
53
- "@react-spectrum/progress": "3.0.0-nightly.2973+a48d1673f",
54
- "@react-spectrum/tooltip": "3.0.0-nightly.2973+a48d1673f",
55
- "@react-spectrum/utils": "3.0.0-nightly.2973+a48d1673f",
56
- "@react-stately/flags": "3.0.4-nightly.4685+a48d1673f",
57
- "@react-stately/layout": "3.13.10-nightly.4685+a48d1673f",
58
- "@react-stately/table": "3.11.9-nightly.4685+a48d1673f",
59
- "@react-stately/virtualizer": "3.7.2-nightly.4685+a48d1673f",
60
- "@react-types/grid": "3.2.7-nightly.4685+a48d1673f",
61
- "@react-types/shared": "3.0.0-nightly.2973+a48d1673f",
62
- "@react-types/table": "3.9.6-nightly.4685+a48d1673f",
63
- "@spectrum-icons/ui": "3.0.0-nightly.2973+a48d1673f",
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.2973+a48d1673f",
68
- "@react-aria/dnd": "3.6.2-nightly.4685+a48d1673f",
69
- "@react-stately/dnd": "3.3.2-nightly.4685+a48d1673f"
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": "a48d1673f2144714e31712e38310a8801edab550"
79
+ "gitHead": "b46d23b9919eaec8ab1f621b52beced82e88b6ca"
80
80
  }
@@ -48,8 +48,8 @@ import {DragPreview as SpectrumDragPreview} from './DragPreview';
48
48
  import {SpectrumTableProps} from './TableViewWrapper';
49
49
  import styles from '@adobe/spectrum-css-temp/components/table/vars.css';
50
50
  import stylesOverrides from './table.css';
51
- import {TableLayout} from '@react-stately/layout';
52
51
  import {TableState, TreeGridState, useTableColumnResizeState} from '@react-stately/table';
52
+ import {TableViewLayout} from './TableViewLayout';
53
53
  import {Tooltip, TooltipTrigger} from '@react-spectrum/tooltip';
54
54
  import {useButton} from '@react-aria/button';
55
55
  import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
@@ -113,7 +113,7 @@ export interface TableContextValue<T> {
113
113
  dragAndDropHooks: DragAndDropHooks['dragAndDropHooks'],
114
114
  isTableDraggable: boolean,
115
115
  isTableDroppable: boolean,
116
- layout: TableLayout<T>,
116
+ layout: TableViewLayout<T>,
117
117
  headerRowHovered: boolean,
118
118
  isInResizeMode: boolean,
119
119
  setIsInResizeMode: (val: boolean) => void,
@@ -185,7 +185,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
185
185
  let bodyRef = useRef<HTMLDivElement>(undefined);
186
186
 
187
187
  let density = props.density || 'regular';
188
- let layout = useMemo(() => new TableLayout({
188
+ let layout = useMemo(() => new TableViewLayout({
189
189
  // If props.rowHeight is auto, then use estimated heights based on scale, otherwise use fixed heights.
190
190
  rowHeight: props.overflowMode === 'wrap'
191
191
  ? null
@@ -198,9 +198,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
198
198
  : DEFAULT_HEADER_HEIGHT[scale],
199
199
  estimatedHeadingHeight: props.overflowMode === 'wrap'
200
200
  ? DEFAULT_HEADER_HEIGHT[scale]
201
- : null,
202
- scrollContainer: 'body',
203
- enableEmptyState: true
201
+ : null
204
202
  }),
205
203
  // don't recompute when state.collection changes, only used for initial value
206
204
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -494,7 +492,7 @@ function TableViewBase<T extends object>(props: TableBaseProps<T>, ref: DOMRef<H
494
492
 
495
493
  interface TableVirtualizerProps<T> extends HTMLAttributes<HTMLElement> {
496
494
  tableState: TableState<T>,
497
- layout: TableLayout<T>,
495
+ layout: TableViewLayout<T>,
498
496
  collection: TableCollection<T>,
499
497
  focusedKey: Key | null,
500
498
  renderView: (type: string, content: GridNode<T>) => ReactElement,
@@ -552,11 +550,10 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
552
550
  getDefaultMinWidth
553
551
  }, tableState);
554
552
 
555
- let state = useVirtualizerState<object, ReactNode, ReactNode>({
553
+ let state = useVirtualizerState<GridNode<unknown>, ReactNode>({
556
554
  layout,
557
555
  collection,
558
556
  renderView,
559
- renderWrapper,
560
557
  onVisibleRectChange(rect) {
561
558
  bodyRef.current.scrollTop = rect.y;
562
559
  setScrollLeft(bodyRef.current, direction, rect.x);
@@ -625,6 +622,8 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
625
622
  scrollPadding = columnResizeState.getColumnWidth(firstColumn.key);
626
623
  }
627
624
 
625
+ let visibleViews = renderChildren(null, state.visibleViews, renderWrapper);
626
+
628
627
  return (
629
628
  <VirtualizerContext.Provider value={resizingColumn}>
630
629
  <FocusScope>
@@ -643,7 +642,7 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
643
642
  }}
644
643
  ref={headerRef}>
645
644
  <ResizeStateContext.Provider value={columnResizeState}>
646
- {state.visibleViews[0]}
645
+ {visibleViews[0]}
647
646
  </ResizeStateContext.Provider>
648
647
  </div>
649
648
  <ScrollView
@@ -681,7 +680,7 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
681
680
  onScrollStart={state.startScrolling}
682
681
  onScrollEnd={state.endScrolling}
683
682
  onScroll={onScroll}>
684
- {state.visibleViews[1]}
683
+ {visibleViews[1]}
685
684
  <div
686
685
  className={classNames(styles, 'spectrum-Table-bodyResizeIndicator')}
687
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'}} />
@@ -692,6 +691,17 @@ function TableVirtualizer<T>(props: TableVirtualizerProps<T>) {
692
691
  );
693
692
  }
694
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
+
695
705
  function useStyle(layoutInfo: LayoutInfo, parent: LayoutInfo | null) {
696
706
  let {direction} = useLocale();
697
707
  let style = layoutInfoToStyle(layoutInfo, direction, parent);
@@ -0,0 +1,87 @@
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';
13
+ import {GridNode} from '@react-types/grid';
14
+ import {LayoutInfo, Rect} from '@react-stately/virtualizer';
15
+ import {LayoutNode, TableLayout} from '@react-stately/layout';
16
+
17
+ export class TableViewLayout<T> extends TableLayout<T> {
18
+ private isLoading: boolean = false;
19
+
20
+ protected buildCollection(): LayoutNode[] {
21
+ let loadingState = this.collection.body.props.loadingState;
22
+ this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
23
+ return super.buildCollection();
24
+ }
25
+
26
+ protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {
27
+ let res = super.buildColumn(node, x, y);
28
+ res.layoutInfo.allowOverflow = true; // for resizer nubbin
29
+ return res;
30
+ }
31
+
32
+ protected buildBody(): LayoutNode {
33
+ let node = super.buildBody(0);
34
+ let {children, layoutInfo} = node;
35
+ let width = node.layoutInfo.rect.width;
36
+
37
+ if (this.isLoading) {
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);
40
+ let loader = new LayoutInfo('loader', 'loader', rect);
41
+ loader.parentKey = layoutInfo.key;
42
+ loader.isSticky = children.length === 0;
43
+ let node = {
44
+ layoutInfo: loader,
45
+ validRect: loader.rect
46
+ };
47
+ children.push(node);
48
+ this.layoutNodes.set(loader.key, node);
49
+ layoutInfo.rect.height = loader.rect.maxY;
50
+ width = Math.max(width, rect.width);
51
+ } else if (children.length === 0) {
52
+ let rect = new Rect(40, 40, this.virtualizer.visibleRect.width - 80, this.virtualizer.visibleRect.height - 80);
53
+ let empty = new LayoutInfo('empty', 'empty', rect);
54
+ empty.parentKey = layoutInfo.key;
55
+ empty.isSticky = true;
56
+ let node = {
57
+ layoutInfo: empty,
58
+ validRect: empty.rect
59
+ };
60
+ children.push(node);
61
+ layoutInfo.rect.height = empty.rect.maxY;
62
+ width = Math.max(width, rect.width);
63
+ }
64
+
65
+ return node;
66
+ }
67
+
68
+ protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {
69
+ let res = super.buildRow(node, x, y);
70
+ res.layoutInfo.rect.height += 1; // for bottom border
71
+ return res;
72
+ }
73
+
74
+ protected getEstimatedRowHeight(): number {
75
+ return super.getEstimatedRowHeight() + 1; // for bottom border
76
+ }
77
+
78
+ protected isStickyColumn(node: GridNode<T>) {
79
+ return node.props?.isDragButtonCell || node.props?.isSelectionCell;
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
+ }
87
+ }