@react-stately/grid 3.8.7-nightly.4623 → 3.8.7
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.
|
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "GridCollection", () => $8bb6a9101b052a66$export$
|
|
|
77
77
|
let childKeys = new Set();
|
|
78
78
|
let last;
|
|
79
79
|
for (let child of node.childNodes){
|
|
80
|
-
if (child.type ===
|
|
80
|
+
if (child.type === 'cell' && child.parentKey == null) // if child is a cell parent key isn't already established by the collection, match child node to parent row
|
|
81
81
|
child.parentKey = node.key;
|
|
82
82
|
childKeys.add(child.key);
|
|
83
83
|
if (last) {
|
|
@@ -101,8 +101,8 @@ $parcel$export(module.exports, "GridCollection", () => $8bb6a9101b052a66$export$
|
|
|
101
101
|
opts.items.forEach((node, i)=>{
|
|
102
102
|
let rowNode = {
|
|
103
103
|
level: 0,
|
|
104
|
-
key:
|
|
105
|
-
type:
|
|
104
|
+
key: 'row-' + i,
|
|
105
|
+
type: 'row',
|
|
106
106
|
value: undefined,
|
|
107
107
|
hasChildNodes: true,
|
|
108
108
|
childNodes: [
|
package/dist/GridCollection.mjs
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
let childKeys = new Set();
|
|
72
72
|
let last;
|
|
73
73
|
for (let child of node.childNodes){
|
|
74
|
-
if (child.type ===
|
|
74
|
+
if (child.type === 'cell' && child.parentKey == null) // if child is a cell parent key isn't already established by the collection, match child node to parent row
|
|
75
75
|
child.parentKey = node.key;
|
|
76
76
|
childKeys.add(child.key);
|
|
77
77
|
if (last) {
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
opts.items.forEach((node, i)=>{
|
|
96
96
|
let rowNode = {
|
|
97
97
|
level: 0,
|
|
98
|
-
key:
|
|
99
|
-
type:
|
|
98
|
+
key: 'row-' + i,
|
|
99
|
+
type: 'row',
|
|
100
100
|
value: undefined,
|
|
101
101
|
hasChildNodes: true,
|
|
102
102
|
childNodes: [
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
let childKeys = new Set();
|
|
72
72
|
let last;
|
|
73
73
|
for (let child of node.childNodes){
|
|
74
|
-
if (child.type ===
|
|
74
|
+
if (child.type === 'cell' && child.parentKey == null) // if child is a cell parent key isn't already established by the collection, match child node to parent row
|
|
75
75
|
child.parentKey = node.key;
|
|
76
76
|
childKeys.add(child.key);
|
|
77
77
|
if (last) {
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
opts.items.forEach((node, i)=>{
|
|
96
96
|
let rowNode = {
|
|
97
97
|
level: 0,
|
|
98
|
-
key:
|
|
99
|
-
type:
|
|
98
|
+
key: 'row-' + i,
|
|
99
|
+
type: 'row',
|
|
100
100
|
value: undefined,
|
|
101
101
|
hasChildNodes: true,
|
|
102
102
|
childNodes: [
|
|
@@ -20,12 +20,12 @@ function $38009b28e45912ea$export$4007ac09ff9c68ed(props) {
|
|
|
20
20
|
let setFocusedKey = selectionState.setFocusedKey;
|
|
21
21
|
selectionState.setFocusedKey = (key, child)=>{
|
|
22
22
|
// If focusMode is cell and an item is focused, focus a child cell instead.
|
|
23
|
-
if (focusMode ===
|
|
23
|
+
if (focusMode === 'cell' && key != null) {
|
|
24
24
|
let item = collection.getItem(key);
|
|
25
|
-
if ((item === null || item === void 0 ? void 0 : item.type) ===
|
|
25
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'item') {
|
|
26
26
|
var _getLastItem, _getFirstItem;
|
|
27
27
|
let children = (0, $5Cus8$reactstatelycollections.getChildNodes)(item, collection);
|
|
28
|
-
if (child ===
|
|
28
|
+
if (child === 'last') key = (_getLastItem = (0, $5Cus8$reactstatelycollections.getLastItem)(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key;
|
|
29
29
|
else key = (_getFirstItem = (0, $5Cus8$reactstatelycollections.getFirstItem)(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -40,14 +40,14 @@ function $38009b28e45912ea$export$4007ac09ff9c68ed(props) {
|
|
|
40
40
|
(0, $5Cus8$react.useEffect)(()=>{
|
|
41
41
|
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey)) {
|
|
42
42
|
const node = cachedCollection.current.getItem(selectionState.focusedKey);
|
|
43
|
-
const parentNode = node.parentKey != null && (node.type ===
|
|
43
|
+
const parentNode = node.parentKey != null && (node.type === 'cell' || node.type === 'rowheader' || node.type === 'column') ? cachedCollection.current.getItem(node.parentKey) : node;
|
|
44
44
|
const cachedRows = cachedCollection.current.rows;
|
|
45
45
|
const rows = collection.rows;
|
|
46
46
|
const diff = cachedRows.length - rows.length;
|
|
47
47
|
let index = Math.min(diff > 1 ? Math.max(parentNode.index - diff + 1, 0) : parentNode.index, rows.length - 1);
|
|
48
48
|
let newRow;
|
|
49
49
|
while(index >= 0){
|
|
50
|
-
if (!selectionManager.isDisabled(rows[index].key) && rows[index].type !==
|
|
50
|
+
if (!selectionManager.isDisabled(rows[index].key) && rows[index].type !== 'headerrow') {
|
|
51
51
|
newRow = rows[index];
|
|
52
52
|
break;
|
|
53
53
|
}
|
package/dist/useGridState.mjs
CHANGED
|
@@ -14,12 +14,12 @@ function $62967d126f3aa823$export$4007ac09ff9c68ed(props) {
|
|
|
14
14
|
let setFocusedKey = selectionState.setFocusedKey;
|
|
15
15
|
selectionState.setFocusedKey = (key, child)=>{
|
|
16
16
|
// If focusMode is cell and an item is focused, focus a child cell instead.
|
|
17
|
-
if (focusMode ===
|
|
17
|
+
if (focusMode === 'cell' && key != null) {
|
|
18
18
|
let item = collection.getItem(key);
|
|
19
|
-
if ((item === null || item === void 0 ? void 0 : item.type) ===
|
|
19
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'item') {
|
|
20
20
|
var _getLastItem, _getFirstItem;
|
|
21
21
|
let children = (0, $7nPCv$getChildNodes)(item, collection);
|
|
22
|
-
if (child ===
|
|
22
|
+
if (child === 'last') key = (_getLastItem = (0, $7nPCv$getLastItem)(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key;
|
|
23
23
|
else key = (_getFirstItem = (0, $7nPCv$getFirstItem)(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -34,14 +34,14 @@ function $62967d126f3aa823$export$4007ac09ff9c68ed(props) {
|
|
|
34
34
|
(0, $7nPCv$useEffect)(()=>{
|
|
35
35
|
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey)) {
|
|
36
36
|
const node = cachedCollection.current.getItem(selectionState.focusedKey);
|
|
37
|
-
const parentNode = node.parentKey != null && (node.type ===
|
|
37
|
+
const parentNode = node.parentKey != null && (node.type === 'cell' || node.type === 'rowheader' || node.type === 'column') ? cachedCollection.current.getItem(node.parentKey) : node;
|
|
38
38
|
const cachedRows = cachedCollection.current.rows;
|
|
39
39
|
const rows = collection.rows;
|
|
40
40
|
const diff = cachedRows.length - rows.length;
|
|
41
41
|
let index = Math.min(diff > 1 ? Math.max(parentNode.index - diff + 1, 0) : parentNode.index, rows.length - 1);
|
|
42
42
|
let newRow;
|
|
43
43
|
while(index >= 0){
|
|
44
|
-
if (!selectionManager.isDisabled(rows[index].key) && rows[index].type !==
|
|
44
|
+
if (!selectionManager.isDisabled(rows[index].key) && rows[index].type !== 'headerrow') {
|
|
45
45
|
newRow = rows[index];
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
@@ -14,12 +14,12 @@ function $62967d126f3aa823$export$4007ac09ff9c68ed(props) {
|
|
|
14
14
|
let setFocusedKey = selectionState.setFocusedKey;
|
|
15
15
|
selectionState.setFocusedKey = (key, child)=>{
|
|
16
16
|
// If focusMode is cell and an item is focused, focus a child cell instead.
|
|
17
|
-
if (focusMode ===
|
|
17
|
+
if (focusMode === 'cell' && key != null) {
|
|
18
18
|
let item = collection.getItem(key);
|
|
19
|
-
if ((item === null || item === void 0 ? void 0 : item.type) ===
|
|
19
|
+
if ((item === null || item === void 0 ? void 0 : item.type) === 'item') {
|
|
20
20
|
var _getLastItem, _getFirstItem;
|
|
21
21
|
let children = (0, $7nPCv$getChildNodes)(item, collection);
|
|
22
|
-
if (child ===
|
|
22
|
+
if (child === 'last') key = (_getLastItem = (0, $7nPCv$getLastItem)(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key;
|
|
23
23
|
else key = (_getFirstItem = (0, $7nPCv$getFirstItem)(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -34,14 +34,14 @@ function $62967d126f3aa823$export$4007ac09ff9c68ed(props) {
|
|
|
34
34
|
(0, $7nPCv$useEffect)(()=>{
|
|
35
35
|
if (selectionState.focusedKey != null && !collection.getItem(selectionState.focusedKey)) {
|
|
36
36
|
const node = cachedCollection.current.getItem(selectionState.focusedKey);
|
|
37
|
-
const parentNode = node.parentKey != null && (node.type ===
|
|
37
|
+
const parentNode = node.parentKey != null && (node.type === 'cell' || node.type === 'rowheader' || node.type === 'column') ? cachedCollection.current.getItem(node.parentKey) : node;
|
|
38
38
|
const cachedRows = cachedCollection.current.rows;
|
|
39
39
|
const rows = collection.rows;
|
|
40
40
|
const diff = cachedRows.length - rows.length;
|
|
41
41
|
let index = Math.min(diff > 1 ? Math.max(parentNode.index - diff + 1, 0) : parentNode.index, rows.length - 1);
|
|
42
42
|
let newRow;
|
|
43
43
|
while(index >= 0){
|
|
44
|
-
if (!selectionManager.isDisabled(rows[index].key) && rows[index].type !==
|
|
44
|
+
if (!selectionManager.isDisabled(rows[index].key) && rows[index].type !== 'headerrow') {
|
|
45
45
|
newRow = rows[index];
|
|
46
46
|
break;
|
|
47
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/grid",
|
|
3
|
-
"version": "3.8.7
|
|
3
|
+
"version": "3.8.7",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-stately/collections": "3.
|
|
26
|
-
"@react-stately/selection": "3.
|
|
27
|
-
"@react-types/grid": "3.2.6
|
|
28
|
-
"@react-types/shared": "3.
|
|
25
|
+
"@react-stately/collections": "^3.10.7",
|
|
26
|
+
"@react-stately/selection": "^3.15.1",
|
|
27
|
+
"@react-types/grid": "^3.2.6",
|
|
28
|
+
"@react-types/shared": "^3.23.1",
|
|
29
29
|
"@swc/helpers": "^0.5.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
38
38
|
}
|