@react-stately/table 3.11.8-nightly.4624 → 3.11.9-nightly.4629

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.
@@ -28,11 +28,11 @@ $parcel$export(module.exports, "UNSTABLE_useTreeGridState", () => $ed4e0b68b470d
28
28
 
29
29
 
30
30
  function $ed4e0b68b470dcfd$export$34dfa8a1622185a4(props) {
31
- let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props;
32
- if (!(0, $5Qo8l$reactstatelyflags.tableNestedRows)()) throw new Error("Feature flag for table nested rows must be enabled to use useTreeGridState.");
31
+ let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props;
32
+ if (!(0, $5Qo8l$reactstatelyflags.tableNestedRows)()) throw new Error('Feature flag for table nested rows must be enabled to use useTreeGridState.');
33
33
  let [expandedKeys, setExpandedKeys] = (0, $5Qo8l$reactstatelyutils.useControlledState)(propExpandedKeys ? $ed4e0b68b470dcfd$var$convertExpanded(propExpandedKeys) : undefined, propDefaultExpandedKeys ? $ed4e0b68b470dcfd$var$convertExpanded(propDefaultExpandedKeys) : new Set(), UNSTABLE_onExpandedChange);
34
34
  let context = (0, $5Qo8l$react.useMemo)(()=>({
35
- showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none",
35
+ showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none',
36
36
  showDragButtons: showDragButtons,
37
37
  selectionMode: selectionMode,
38
38
  columns: []
@@ -85,7 +85,7 @@ function $ed4e0b68b470dcfd$export$34dfa8a1622185a4(props) {
85
85
  }
86
86
  function $ed4e0b68b470dcfd$var$toggleKey(currentExpandedKeys, key, collection) {
87
87
  let updatedExpandedKeys;
88
- if (currentExpandedKeys === "all") {
88
+ if (currentExpandedKeys === 'all') {
89
89
  updatedExpandedKeys = new Set(collection.flattenedRows.filter((row)=>row.props.UNSTABLE_childItems || row.props.children.length > collection.userColumnCount).map((row)=>row.key));
90
90
  updatedExpandedKeys.delete(key);
91
91
  } else {
@@ -97,7 +97,7 @@ function $ed4e0b68b470dcfd$var$toggleKey(currentExpandedKeys, key, collection) {
97
97
  }
98
98
  function $ed4e0b68b470dcfd$var$convertExpanded(expanded) {
99
99
  if (!expanded) return new Set();
100
- return expanded === "all" ? "all" : new Set(expanded);
100
+ return expanded === 'all' ? 'all' : new Set(expanded);
101
101
  }
102
102
  function $ed4e0b68b470dcfd$var$generateTreeGridCollection(nodes, opts) {
103
103
  let { expandedKeys: expandedKeys = new Set() } = opts;
@@ -112,21 +112,21 @@ function $ed4e0b68b470dcfd$var$generateTreeGridCollection(nodes, opts) {
112
112
  let topLevelRows = [];
113
113
  let visit = (node)=>{
114
114
  switch(node.type){
115
- case "body":
115
+ case 'body':
116
116
  body = node;
117
117
  keyMap.set(body.key, body);
118
118
  break;
119
- case "column":
119
+ case 'column':
120
120
  if (!node.hasChildNodes) userColumnCount++;
121
121
  break;
122
- case "item":
122
+ case 'item':
123
123
  topLevelRows.push(node);
124
124
  return;
125
125
  }
126
126
  for (let child of node.childNodes)visit(child);
127
127
  };
128
128
  for (let node of nodes){
129
- if (node.type === "column") originalColumns.push(node);
129
+ if (node.type === 'column') originalColumns.push(node);
130
130
  visit(node);
131
131
  }
132
132
  columnCount += userColumnCount;
@@ -136,9 +136,9 @@ function $ed4e0b68b470dcfd$var$generateTreeGridCollection(nodes, opts) {
136
136
  // Clone row node and its children so modifications to the node for treegrid specific values aren't applied on the nodes provided
137
137
  // to TableCollection. Index, level, and parent keys are all changed to reflect a flattened row structure rather than the treegrid structure
138
138
  // values automatically calculated via CollectionBuilder
139
- if (node.type === "item") {
139
+ if (node.type === 'item') {
140
140
  let childNodes = [];
141
- for (let child of node.childNodes)if (child.type === "cell") {
141
+ for (let child of node.childNodes)if (child.type === 'cell') {
142
142
  let cellClone = {
143
143
  ...child
144
144
  };
@@ -158,21 +158,21 @@ function $ed4e0b68b470dcfd$var$generateTreeGridCollection(nodes, opts) {
158
158
  }
159
159
  let newProps = {};
160
160
  // Assign indexOfType to cells and rows for aria-posinset
161
- if (node.type !== "placeholder" && node.type !== "column") newProps["indexOfType"] = i;
161
+ if (node.type !== 'placeholder' && node.type !== 'column') newProps['indexOfType'] = i;
162
162
  // Use Object.assign instead of spread to preserve object reference for keyMap. Also ensures retrieving nodes
163
163
  // via .childNodes returns the same object as the one found via keyMap look up
164
164
  Object.assign(node, newProps);
165
165
  keyMap.set(node.key, node);
166
166
  let lastNode;
167
167
  let rowIndex = 0;
168
- for (let child of node.childNodes)if (!(child.type === "item" && expandedKeys !== "all" && !expandedKeys.has(node.key))) {
168
+ for (let child of node.childNodes)if (!(child.type === 'item' && expandedKeys !== 'all' && !expandedKeys.has(node.key))) {
169
169
  if (child.parentKey == null) // if child is a cell/expanded row/column and the parent key isn't already established by the collection, match child node to parent row
170
170
  child.parentKey = node.key;
171
171
  if (lastNode) {
172
172
  lastNode.nextKey = child.key;
173
173
  child.prevKey = lastNode.key;
174
174
  } else child.prevKey = null;
175
- if (child.type === "item") visitNode(child, rowIndex++);
175
+ if (child.type === 'item') visitNode(child, rowIndex++);
176
176
  else // We enforce that the cells come before rows so can just reuse cell index
177
177
  visitNode(child, child.index);
178
178
  lastNode = child;
@@ -22,11 +22,11 @@ import {useControlledState as $2Mvwf$useControlledState} from "@react-stately/ut
22
22
 
23
23
 
24
24
  function $ee65a0057fd99531$export$34dfa8a1622185a4(props) {
25
- let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props;
26
- if (!(0, $2Mvwf$tableNestedRows)()) throw new Error("Feature flag for table nested rows must be enabled to use useTreeGridState.");
25
+ let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props;
26
+ if (!(0, $2Mvwf$tableNestedRows)()) throw new Error('Feature flag for table nested rows must be enabled to use useTreeGridState.');
27
27
  let [expandedKeys, setExpandedKeys] = (0, $2Mvwf$useControlledState)(propExpandedKeys ? $ee65a0057fd99531$var$convertExpanded(propExpandedKeys) : undefined, propDefaultExpandedKeys ? $ee65a0057fd99531$var$convertExpanded(propDefaultExpandedKeys) : new Set(), UNSTABLE_onExpandedChange);
28
28
  let context = (0, $2Mvwf$useMemo)(()=>({
29
- showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none",
29
+ showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none',
30
30
  showDragButtons: showDragButtons,
31
31
  selectionMode: selectionMode,
32
32
  columns: []
@@ -79,7 +79,7 @@ function $ee65a0057fd99531$export$34dfa8a1622185a4(props) {
79
79
  }
80
80
  function $ee65a0057fd99531$var$toggleKey(currentExpandedKeys, key, collection) {
81
81
  let updatedExpandedKeys;
82
- if (currentExpandedKeys === "all") {
82
+ if (currentExpandedKeys === 'all') {
83
83
  updatedExpandedKeys = new Set(collection.flattenedRows.filter((row)=>row.props.UNSTABLE_childItems || row.props.children.length > collection.userColumnCount).map((row)=>row.key));
84
84
  updatedExpandedKeys.delete(key);
85
85
  } else {
@@ -91,7 +91,7 @@ function $ee65a0057fd99531$var$toggleKey(currentExpandedKeys, key, collection) {
91
91
  }
92
92
  function $ee65a0057fd99531$var$convertExpanded(expanded) {
93
93
  if (!expanded) return new Set();
94
- return expanded === "all" ? "all" : new Set(expanded);
94
+ return expanded === 'all' ? 'all' : new Set(expanded);
95
95
  }
96
96
  function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
97
97
  let { expandedKeys: expandedKeys = new Set() } = opts;
@@ -106,21 +106,21 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
106
106
  let topLevelRows = [];
107
107
  let visit = (node)=>{
108
108
  switch(node.type){
109
- case "body":
109
+ case 'body':
110
110
  body = node;
111
111
  keyMap.set(body.key, body);
112
112
  break;
113
- case "column":
113
+ case 'column':
114
114
  if (!node.hasChildNodes) userColumnCount++;
115
115
  break;
116
- case "item":
116
+ case 'item':
117
117
  topLevelRows.push(node);
118
118
  return;
119
119
  }
120
120
  for (let child of node.childNodes)visit(child);
121
121
  };
122
122
  for (let node of nodes){
123
- if (node.type === "column") originalColumns.push(node);
123
+ if (node.type === 'column') originalColumns.push(node);
124
124
  visit(node);
125
125
  }
126
126
  columnCount += userColumnCount;
@@ -130,9 +130,9 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
130
130
  // Clone row node and its children so modifications to the node for treegrid specific values aren't applied on the nodes provided
131
131
  // to TableCollection. Index, level, and parent keys are all changed to reflect a flattened row structure rather than the treegrid structure
132
132
  // values automatically calculated via CollectionBuilder
133
- if (node.type === "item") {
133
+ if (node.type === 'item') {
134
134
  let childNodes = [];
135
- for (let child of node.childNodes)if (child.type === "cell") {
135
+ for (let child of node.childNodes)if (child.type === 'cell') {
136
136
  let cellClone = {
137
137
  ...child
138
138
  };
@@ -152,21 +152,21 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
152
152
  }
153
153
  let newProps = {};
154
154
  // Assign indexOfType to cells and rows for aria-posinset
155
- if (node.type !== "placeholder" && node.type !== "column") newProps["indexOfType"] = i;
155
+ if (node.type !== 'placeholder' && node.type !== 'column') newProps['indexOfType'] = i;
156
156
  // Use Object.assign instead of spread to preserve object reference for keyMap. Also ensures retrieving nodes
157
157
  // via .childNodes returns the same object as the one found via keyMap look up
158
158
  Object.assign(node, newProps);
159
159
  keyMap.set(node.key, node);
160
160
  let lastNode;
161
161
  let rowIndex = 0;
162
- for (let child of node.childNodes)if (!(child.type === "item" && expandedKeys !== "all" && !expandedKeys.has(node.key))) {
162
+ for (let child of node.childNodes)if (!(child.type === 'item' && expandedKeys !== 'all' && !expandedKeys.has(node.key))) {
163
163
  if (child.parentKey == null) // if child is a cell/expanded row/column and the parent key isn't already established by the collection, match child node to parent row
164
164
  child.parentKey = node.key;
165
165
  if (lastNode) {
166
166
  lastNode.nextKey = child.key;
167
167
  child.prevKey = lastNode.key;
168
168
  } else child.prevKey = null;
169
- if (child.type === "item") visitNode(child, rowIndex++);
169
+ if (child.type === 'item') visitNode(child, rowIndex++);
170
170
  else // We enforce that the cells come before rows so can just reuse cell index
171
171
  visitNode(child, child.index);
172
172
  lastNode = child;
@@ -22,11 +22,11 @@ import {useControlledState as $2Mvwf$useControlledState} from "@react-stately/ut
22
22
 
23
23
 
24
24
  function $ee65a0057fd99531$export$34dfa8a1622185a4(props) {
25
- let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props;
26
- if (!(0, $2Mvwf$tableNestedRows)()) throw new Error("Feature flag for table nested rows must be enabled to use useTreeGridState.");
25
+ let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props;
26
+ if (!(0, $2Mvwf$tableNestedRows)()) throw new Error('Feature flag for table nested rows must be enabled to use useTreeGridState.');
27
27
  let [expandedKeys, setExpandedKeys] = (0, $2Mvwf$useControlledState)(propExpandedKeys ? $ee65a0057fd99531$var$convertExpanded(propExpandedKeys) : undefined, propDefaultExpandedKeys ? $ee65a0057fd99531$var$convertExpanded(propDefaultExpandedKeys) : new Set(), UNSTABLE_onExpandedChange);
28
28
  let context = (0, $2Mvwf$useMemo)(()=>({
29
- showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none",
29
+ showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none',
30
30
  showDragButtons: showDragButtons,
31
31
  selectionMode: selectionMode,
32
32
  columns: []
@@ -79,7 +79,7 @@ function $ee65a0057fd99531$export$34dfa8a1622185a4(props) {
79
79
  }
80
80
  function $ee65a0057fd99531$var$toggleKey(currentExpandedKeys, key, collection) {
81
81
  let updatedExpandedKeys;
82
- if (currentExpandedKeys === "all") {
82
+ if (currentExpandedKeys === 'all') {
83
83
  updatedExpandedKeys = new Set(collection.flattenedRows.filter((row)=>row.props.UNSTABLE_childItems || row.props.children.length > collection.userColumnCount).map((row)=>row.key));
84
84
  updatedExpandedKeys.delete(key);
85
85
  } else {
@@ -91,7 +91,7 @@ function $ee65a0057fd99531$var$toggleKey(currentExpandedKeys, key, collection) {
91
91
  }
92
92
  function $ee65a0057fd99531$var$convertExpanded(expanded) {
93
93
  if (!expanded) return new Set();
94
- return expanded === "all" ? "all" : new Set(expanded);
94
+ return expanded === 'all' ? 'all' : new Set(expanded);
95
95
  }
96
96
  function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
97
97
  let { expandedKeys: expandedKeys = new Set() } = opts;
@@ -106,21 +106,21 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
106
106
  let topLevelRows = [];
107
107
  let visit = (node)=>{
108
108
  switch(node.type){
109
- case "body":
109
+ case 'body':
110
110
  body = node;
111
111
  keyMap.set(body.key, body);
112
112
  break;
113
- case "column":
113
+ case 'column':
114
114
  if (!node.hasChildNodes) userColumnCount++;
115
115
  break;
116
- case "item":
116
+ case 'item':
117
117
  topLevelRows.push(node);
118
118
  return;
119
119
  }
120
120
  for (let child of node.childNodes)visit(child);
121
121
  };
122
122
  for (let node of nodes){
123
- if (node.type === "column") originalColumns.push(node);
123
+ if (node.type === 'column') originalColumns.push(node);
124
124
  visit(node);
125
125
  }
126
126
  columnCount += userColumnCount;
@@ -130,9 +130,9 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
130
130
  // Clone row node and its children so modifications to the node for treegrid specific values aren't applied on the nodes provided
131
131
  // to TableCollection. Index, level, and parent keys are all changed to reflect a flattened row structure rather than the treegrid structure
132
132
  // values automatically calculated via CollectionBuilder
133
- if (node.type === "item") {
133
+ if (node.type === 'item') {
134
134
  let childNodes = [];
135
- for (let child of node.childNodes)if (child.type === "cell") {
135
+ for (let child of node.childNodes)if (child.type === 'cell') {
136
136
  let cellClone = {
137
137
  ...child
138
138
  };
@@ -152,21 +152,21 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) {
152
152
  }
153
153
  let newProps = {};
154
154
  // Assign indexOfType to cells and rows for aria-posinset
155
- if (node.type !== "placeholder" && node.type !== "column") newProps["indexOfType"] = i;
155
+ if (node.type !== 'placeholder' && node.type !== 'column') newProps['indexOfType'] = i;
156
156
  // Use Object.assign instead of spread to preserve object reference for keyMap. Also ensures retrieving nodes
157
157
  // via .childNodes returns the same object as the one found via keyMap look up
158
158
  Object.assign(node, newProps);
159
159
  keyMap.set(node.key, node);
160
160
  let lastNode;
161
161
  let rowIndex = 0;
162
- for (let child of node.childNodes)if (!(child.type === "item" && expandedKeys !== "all" && !expandedKeys.has(node.key))) {
162
+ for (let child of node.childNodes)if (!(child.type === 'item' && expandedKeys !== 'all' && !expandedKeys.has(node.key))) {
163
163
  if (child.parentKey == null) // if child is a cell/expanded row/column and the parent key isn't already established by the collection, match child node to parent row
164
164
  child.parentKey = node.key;
165
165
  if (lastNode) {
166
166
  lastNode.nextKey = child.key;
167
167
  child.prevKey = lastNode.key;
168
168
  } else child.prevKey = null;
169
- if (child.type === "item") visitNode(child, rowIndex++);
169
+ if (child.type === 'item') visitNode(child, rowIndex++);
170
170
  else // We enforce that the cells come before rows so can just reuse cell index
171
171
  visitNode(child, child.index);
172
172
  lastNode = child;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/table",
3
- "version": "3.11.8-nightly.4624+d80999e89",
3
+ "version": "3.11.9-nightly.4629+c34886769",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,14 +22,14 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-stately/collections": "3.0.0-nightly.2912+d80999e89",
26
- "@react-stately/flags": "3.0.3-nightly.4624+d80999e89",
27
- "@react-stately/grid": "3.8.7-nightly.4624+d80999e89",
28
- "@react-stately/selection": "3.0.0-nightly.2912+d80999e89",
29
- "@react-stately/utils": "3.0.0-nightly.2912+d80999e89",
30
- "@react-types/grid": "3.2.6-nightly.4624+d80999e89",
31
- "@react-types/shared": "3.0.0-nightly.2912+d80999e89",
32
- "@react-types/table": "3.9.5-nightly.4624+d80999e89",
25
+ "@react-stately/collections": "3.0.0-nightly.2917+c34886769",
26
+ "@react-stately/flags": "3.0.4-nightly.4629+c34886769",
27
+ "@react-stately/grid": "3.8.8-nightly.4629+c34886769",
28
+ "@react-stately/selection": "3.0.0-nightly.2917+c34886769",
29
+ "@react-stately/utils": "3.0.0-nightly.2917+c34886769",
30
+ "@react-types/grid": "3.2.7-nightly.4629+c34886769",
31
+ "@react-types/shared": "3.0.0-nightly.2917+c34886769",
32
+ "@react-types/table": "3.9.6-nightly.4629+c34886769",
33
33
  "@swc/helpers": "^0.5.0"
34
34
  },
35
35
  "peerDependencies": {
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "d80999e897b4d4db9fcfb4e9b8fcdc9fdd700882"
41
+ "gitHead": "c34886769d3e69bb56553a02eead6a0fd877e754"
42
42
  }