@react-stately/table 3.13.1 → 3.14.0

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/Row.main.js CHANGED
@@ -63,6 +63,7 @@ $9ec6912e32cc0d81$var$Row.getCollectionNode = function* getCollectionNode(props,
63
63
  } else {
64
64
  let cells = [];
65
65
  let childRows = [];
66
+ let columnCount = 0;
66
67
  (0, ($parcel$interopDefault($7Z9ig$react))).Children.forEach(children, (node)=>{
67
68
  if (node.type === $9ec6912e32cc0d81$var$Row) {
68
69
  if (cells.length < context.columns.length) throw new Error('All of a Row\'s child Cells must be positioned before any child Rows.');
@@ -70,12 +71,16 @@ $9ec6912e32cc0d81$var$Row.getCollectionNode = function* getCollectionNode(props,
70
71
  type: 'item',
71
72
  element: node
72
73
  });
73
- } else cells.push({
74
- type: 'cell',
75
- element: node
76
- });
74
+ } else {
75
+ cells.push({
76
+ type: 'cell',
77
+ element: node
78
+ });
79
+ var _node_props_colSpan;
80
+ columnCount += (_node_props_colSpan = node.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1;
81
+ }
77
82
  });
78
- if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
83
+ if (columnCount !== context.columns.length) throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
79
84
  yield* cells;
80
85
  yield* childRows;
81
86
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAOD,SAAS,0BAAO,KAAkB;IAChC,OAAO;AACT;AAEA,0BAAI,iBAAiB,GAAG,UAAU,kBAAqB,KAAkB,EAAE,OAAoC;IAC7G,IAAI,YAAC,QAAQ,aAAE,SAAS,uBAAE,mBAAmB,EAAC,GAAG;IAEjD,MAAM;QACJ,MAAM;QACN,OAAO;mBACP;QACA,cAAc,KAAK,CAAC,aAAa;QACjC,eAAe;QACf,CAAC;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W,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,GAAG,KAAK,QAAQ,OAAO,CAAC,EAAE,CAAC,GAAG,KAClE,WAAW,uBAAuB,KAAK,QAAQ,uBAAuB,IACtE,WAAW,eAAe,KAAK,QAAQ,eAAe,IACtD,WAAW,aAAa,KAAK,QAAQ,aAAa;QACtD;IACF;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAO","sources":["packages/@react-stately/table/src/Row.ts"],"sourcesContent":["/*\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\nimport {CollectionBuilderContext} from './useTableState';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {RowProps} from '@react-types/table';\n\nfunction Row<T>(props: RowProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nRow.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>> {\n let {children, textValue, UNSTABLE_childItems} = props;\n\n yield {\n type: 'item',\n props: props,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n // Process cells first\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag', // this is combined with the row key by CollectionBuilder\n props: {\n isDragButtonCell: true\n }\n };\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header', // this is combined with the row key by CollectionBuilder\n props: {\n isSelectionCell: true\n }\n };\n }\n\n if (typeof children === 'function') {\n for (let column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key // this is combined with the row key by CollectionBuilder\n };\n }\n\n if (UNSTABLE_childItems) {\n for (let child of UNSTABLE_childItems) {\n // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up\n // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells\n yield {\n type: 'item',\n value: child\n };\n }\n }\n } else {\n let cells: PartialNode<T>[] = [];\n let childRows: PartialNode<T>[] = [];\n React.Children.forEach(children, node => {\n if (node.type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error('All of a Row\\'s child Cells must be positioned before any child Rows.');\n }\n\n childRows.push({\n type: 'item',\n element: node\n });\n } else {\n cells.push({\n type: 'cell',\n element: node\n });\n }\n });\n\n if (cells.length !== context.columns.length) {\n throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);\n }\n\n yield* cells;\n yield* childRows;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // Invalidate all rows if the columns changed.\n return newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c, i) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode;\n }\n };\n};\n\n/**\n * A Row represents a single item in a Table and contains Cell elements for each column.\n * Cells can be statically defined as children, or generated dynamically using a function\n * based on the columns defined in the TableHeader.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Row = Row as <T>(props: RowProps<T>) => JSX.Element;\nexport {_Row as Row};\n"],"names":[],"version":3,"file":"Row.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAOD,SAAS,0BAAO,KAAkB;IAChC,OAAO;AACT;AAEA,0BAAI,iBAAiB,GAAG,UAAU,kBAAqB,KAAkB,EAAE,OAAoC;IAC7G,IAAI,YAAC,QAAQ,aAAE,SAAS,uBAAE,mB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W,EAAE,QAAQ,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;gBAGzH,OAAO;gBACP,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,8CAA8C;YAC9C,OAAO,WAAW,OAAO,CAAC,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,IACzD,WAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,GAAG,KAAK,QAAQ,OAAO,CAAC,EAAE,CAAC,GAAG,KAClE,WAAW,uBAAuB,KAAK,QAAQ,uBAAuB,IACtE,WAAW,eAAe,KAAK,QAAQ,eAAe,IACtD,WAAW,aAAa,KAAK,QAAQ,aAAa;QACtD;IACF;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAO","sources":["packages/@react-stately/table/src/Row.ts"],"sourcesContent":["/*\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\nimport {CollectionBuilderContext} from './useTableState';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {RowProps} from '@react-types/table';\n\nfunction Row<T>(props: RowProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nRow.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>> {\n let {children, textValue, UNSTABLE_childItems} = props;\n\n yield {\n type: 'item',\n props: props,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n // Process cells first\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag', // this is combined with the row key by CollectionBuilder\n props: {\n isDragButtonCell: true\n }\n };\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header', // this is combined with the row key by CollectionBuilder\n props: {\n isSelectionCell: true\n }\n };\n }\n\n if (typeof children === 'function') {\n for (let column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key // this is combined with the row key by CollectionBuilder\n };\n }\n\n if (UNSTABLE_childItems) {\n for (let child of UNSTABLE_childItems) {\n // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up\n // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells\n yield {\n type: 'item',\n value: child\n };\n }\n }\n } else {\n let cells: PartialNode<T>[] = [];\n let childRows: PartialNode<T>[] = [];\n let columnCount = 0;\n React.Children.forEach(children, node => {\n if (node.type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error('All of a Row\\'s child Cells must be positioned before any child Rows.');\n }\n\n childRows.push({\n type: 'item',\n element: node\n });\n } else {\n cells.push({\n type: 'cell',\n element: node\n });\n columnCount += node.props.colSpan ?? 1;\n }\n });\n\n if (columnCount !== context.columns.length) {\n throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);\n }\n\n yield* cells;\n yield* childRows;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // Invalidate all rows if the columns changed.\n return newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c, i) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode;\n }\n };\n};\n\n/**\n * A Row represents a single item in a Table and contains Cell elements for each column.\n * Cells can be statically defined as children, or generated dynamically using a function\n * based on the columns defined in the TableHeader.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Row = Row as <T>(props: RowProps<T>) => JSX.Element;\nexport {_Row as Row};\n"],"names":[],"version":3,"file":"Row.main.js.map"}
package/dist/Row.mjs CHANGED
@@ -53,6 +53,7 @@ $70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode(props,
53
53
  } else {
54
54
  let cells = [];
55
55
  let childRows = [];
56
+ let columnCount = 0;
56
57
  (0, $7GIZw$react).Children.forEach(children, (node)=>{
57
58
  if (node.type === $70d70eb16ea48428$var$Row) {
58
59
  if (cells.length < context.columns.length) throw new Error('All of a Row\'s child Cells must be positioned before any child Rows.');
@@ -60,12 +61,16 @@ $70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode(props,
60
61
  type: 'item',
61
62
  element: node
62
63
  });
63
- } else cells.push({
64
- type: 'cell',
65
- element: node
66
- });
64
+ } else {
65
+ cells.push({
66
+ type: 'cell',
67
+ element: node
68
+ });
69
+ var _node_props_colSpan;
70
+ columnCount += (_node_props_colSpan = node.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1;
71
+ }
67
72
  });
68
- if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
73
+ if (columnCount !== context.columns.length) throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
69
74
  yield* cells;
70
75
  yield* childRows;
71
76
  }
@@ -53,6 +53,7 @@ $70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode(props,
53
53
  } else {
54
54
  let cells = [];
55
55
  let childRows = [];
56
+ let columnCount = 0;
56
57
  (0, $7GIZw$react).Children.forEach(children, (node)=>{
57
58
  if (node.type === $70d70eb16ea48428$var$Row) {
58
59
  if (cells.length < context.columns.length) throw new Error('All of a Row\'s child Cells must be positioned before any child Rows.');
@@ -60,12 +61,16 @@ $70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode(props,
60
61
  type: 'item',
61
62
  element: node
62
63
  });
63
- } else cells.push({
64
- type: 'cell',
65
- element: node
66
- });
64
+ } else {
65
+ cells.push({
66
+ type: 'cell',
67
+ element: node
68
+ });
69
+ var _node_props_colSpan;
70
+ columnCount += (_node_props_colSpan = node.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1;
71
+ }
67
72
  });
68
- if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
73
+ if (columnCount !== context.columns.length) throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
69
74
  yield* cells;
70
75
  yield* childRows;
71
76
  }
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAOD,SAAS,0BAAO,KAAkB;IAChC,OAAO;AACT;AAEA,0BAAI,iBAAiB,GAAG,UAAU,kBAAqB,KAAkB,EAAE,OAAoC;IAC7G,IAAI,YAAC,QAAQ,aAAE,SAAS,uBAAE,mBAAmB,EAAC,GAAG;IAEjD,MAAM;QACJ,MAAM;QACN,OAAO;mBACP;QACA,cAAc,KAAK,CAAC,aAAa;QACjC,eAAe;QACf,CAAC;YACC,sBAAsB;YACtB,IAAI,QAAQ,eAAe,EACzB,MAAM;gBACJ,MAAM;gBACN,KAAK;gBACL,OAAO;oBACL,kBAAkB;gBACpB;YACF;YAGF,IAAI,QAAQ,uBAAuB,IAAI,QAAQ,aAAa,KAAK,QAC/D,MAAM;gBACJ,MAAM;gBACN,KAAK;gBACL,OAAO;oBACL,iBAAiB;gBACnB;YACF;YAGF,IAAI,OAAO,aAAa,YAAY;gBAClC,KAAK,IAAI,UAAU,QAAQ,OAAO,CAChC,MAAM;oBACJ,MAAM;oBACN,SAAS,SAAS,OAAO,GAAG;oBAC5B,KAAK,OAAO,GAAG,CAAC,yDAAyD;gBAC3E;gBAGF,IAAI,qBACF,KAAK,IAAI,SAAS,oBAChB,kKAAkK;gBAClK,iIAAiI;gBACjI,MAAM;oBACJ,MAAM;oBACN,OAAO;gBACT;YAGN,OAAO;gBACL,IAAI,QAA0B,EAAE;gBAChC,IAAI,YAA8B,EAAE;gBACpC,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,IAAI,KAAK,IAAI,KAAK,2BAAK;wBACrB,IAAI,MAAM,MAAM,GAAG,QAAQ,OAAO,CAAC,MAAM,EACvC,MAAM,IAAI,MAAM;wBAGlB,UAAU,IAAI,CAAC;4BACb,MAAM;4BACN,SAAS;wBACX;oBACF,OACE,MAAM,IAAI,CAAC;wBACT,MAAM;wBACN,SAAS;oBACX;gBAEJ;gBAEA,IAAI,MAAM,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,EACzC,MAAM,IAAI,MAAM,CAAC,0CAA0C,EAAE,MAAM,MAAM,CAAC,WAAW,EAAE,QAAQ,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;gBAG1H,OAAO;gBACP,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,8CAA8C;YAC9C,OAAO,WAAW,OAAO,CAAC,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,IACzD,WAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,GAAG,KAAK,QAAQ,OAAO,CAAC,EAAE,CAAC,GAAG,KAClE,WAAW,uBAAuB,KAAK,QAAQ,uBAAuB,IACtE,WAAW,eAAe,KAAK,QAAQ,eAAe,IACtD,WAAW,aAAa,KAAK,QAAQ,aAAa;QACtD;IACF;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAO","sources":["packages/@react-stately/table/src/Row.ts"],"sourcesContent":["/*\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\nimport {CollectionBuilderContext} from './useTableState';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {RowProps} from '@react-types/table';\n\nfunction Row<T>(props: RowProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nRow.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>> {\n let {children, textValue, UNSTABLE_childItems} = props;\n\n yield {\n type: 'item',\n props: props,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n // Process cells first\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag', // this is combined with the row key by CollectionBuilder\n props: {\n isDragButtonCell: true\n }\n };\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header', // this is combined with the row key by CollectionBuilder\n props: {\n isSelectionCell: true\n }\n };\n }\n\n if (typeof children === 'function') {\n for (let column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key // this is combined with the row key by CollectionBuilder\n };\n }\n\n if (UNSTABLE_childItems) {\n for (let child of UNSTABLE_childItems) {\n // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up\n // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells\n yield {\n type: 'item',\n value: child\n };\n }\n }\n } else {\n let cells: PartialNode<T>[] = [];\n let childRows: PartialNode<T>[] = [];\n React.Children.forEach(children, node => {\n if (node.type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error('All of a Row\\'s child Cells must be positioned before any child Rows.');\n }\n\n childRows.push({\n type: 'item',\n element: node\n });\n } else {\n cells.push({\n type: 'cell',\n element: node\n });\n }\n });\n\n if (cells.length !== context.columns.length) {\n throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);\n }\n\n yield* cells;\n yield* childRows;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // Invalidate all rows if the columns changed.\n return newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c, i) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode;\n }\n };\n};\n\n/**\n * A Row represents a single item in a Table and contains Cell elements for each column.\n * Cells can be statically defined as children, or generated dynamically using a function\n * based on the columns defined in the TableHeader.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Row = Row as <T>(props: RowProps<T>) => JSX.Element;\nexport {_Row as Row};\n"],"names":[],"version":3,"file":"Row.module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC;AAOD,SAAS,0BAAO,KAAkB;IAChC,OAAO;AACT;AAEA,0BAAI,iBAAiB,GAAG,UAAU,kBAAqB,KAAkB,EAAE,OAAoC;IAC7G,IAAI,YAAC,QAAQ,aAAE,SAAS,uBAAE,mBAAmB,EAAC,GAAG;IAEjD,MAAM;QACJ,MAAM;QACN,OAAO;mBACP;QACA,cAAc,KAAK,CAAC,aAAa;QACjC,eAAe;QACf,CAAC;YACC,sBAAsB;YACtB,IAAI,QAAQ,eAAe,EACzB,MAAM;gBACJ,MAAM;gBACN,KAAK;gBACL,OAAO;oBACL,kBAAkB;gBACpB;YACF;YAGF,IAAI,QAAQ,uBAAuB,IAAI,QAAQ,aAAa,KAAK,QAC/D,MAAM;gBACJ,MAAM;gBACN,KAAK;gBACL,OAAO;oBACL,iBAAiB;gBACnB;YACF;YAGF,IAAI,OAAO,aAAa,YAAY;gBAClC,KAAK,IAAI,UAAU,QAAQ,OAAO,CAChC,MAAM;oBACJ,MAAM;oBACN,SAAS,SAAS,OAAO,GAAG;oBAC5B,KAAK,OAAO,GAAG,CAAC,yDAAyD;gBAC3E;gBAGF,IAAI,qBACF,KAAK,IAAI,SAAS,oBAChB,kKAAkK;gBAClK,iIAAiI;gBACjI,MAAM;oBACJ,MAAM;oBACN,OAAO;gBACT;YAGN,OAAO;gBACL,IAAI,QAA0B,EAAE;gBAChC,IAAI,YAA8B,EAAE;gBACpC,IAAI,cAAc;gBAClB,CAAA,GAAA,YAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAA;oBAC/B,IAAI,KAAK,IAAI,KAAK,2BAAK;wBACrB,IAAI,MAAM,MAAM,GAAG,QAAQ,OAAO,CAAC,MAAM,EACvC,MAAM,IAAI,MAAM;wBAGlB,UAAU,IAAI,CAAC;4BACb,MAAM;4BACN,SAAS;wBACX;oBACF,OAAO;wBACL,MAAM,IAAI,CAAC;4BACT,MAAM;4BACN,SAAS;wBACX;4BACe;wBAAf,eAAe,CAAA,sBAAA,KAAK,KAAK,CAAC,OAAO,cAAlB,iCAAA,sBAAsB;oBACvC;gBACF;gBAEA,IAAI,gBAAgB,QAAQ,OAAO,CAAC,MAAM,EACxC,MAAM,IAAI,MAAM,CAAC,0CAA0C,EAAE,YAAY,WAAW,EAAE,QAAQ,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;gBAGzH,OAAO;gBACP,OAAO;YACT;QACF;QACA,kBAAiB,UAAuC;YACtD,8CAA8C;YAC9C,OAAO,WAAW,OAAO,CAAC,MAAM,KAAK,QAAQ,OAAO,CAAC,MAAM,IACzD,WAAW,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAM,EAAE,GAAG,KAAK,QAAQ,OAAO,CAAC,EAAE,CAAC,GAAG,KAClE,WAAW,uBAAuB,KAAK,QAAQ,uBAAuB,IACtE,WAAW,eAAe,KAAK,QAAQ,eAAe,IACtD,WAAW,aAAa,KAAK,QAAQ,aAAa;QACtD;IACF;AACF;AAEA;;;;CAIC,GACD,oEAAoE;AACpE,IAAI,4CAAO","sources":["packages/@react-stately/table/src/Row.ts"],"sourcesContent":["/*\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\nimport {CollectionBuilderContext} from './useTableState';\nimport {PartialNode} from '@react-stately/collections';\nimport React, {JSX, ReactElement} from 'react';\nimport {RowProps} from '@react-types/table';\n\nfunction Row<T>(props: RowProps<T>): ReactElement | null { // eslint-disable-line @typescript-eslint/no-unused-vars\n return null;\n}\n\nRow.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, context: CollectionBuilderContext<T>): Generator<PartialNode<T>> {\n let {children, textValue, UNSTABLE_childItems} = props;\n\n yield {\n type: 'item',\n props: props,\n textValue,\n 'aria-label': props['aria-label'],\n hasChildNodes: true,\n *childNodes() {\n // Process cells first\n if (context.showDragButtons) {\n yield {\n type: 'cell',\n key: 'header-drag', // this is combined with the row key by CollectionBuilder\n props: {\n isDragButtonCell: true\n }\n };\n }\n\n if (context.showSelectionCheckboxes && context.selectionMode !== 'none') {\n yield {\n type: 'cell',\n key: 'header', // this is combined with the row key by CollectionBuilder\n props: {\n isSelectionCell: true\n }\n };\n }\n\n if (typeof children === 'function') {\n for (let column of context.columns) {\n yield {\n type: 'cell',\n element: children(column.key),\n key: column.key // this is combined with the row key by CollectionBuilder\n };\n }\n\n if (UNSTABLE_childItems) {\n for (let child of UNSTABLE_childItems) {\n // Note: in order to reuse the render function of TableBody for our child rows, we just need to yield a type and a value here. CollectionBuilder will then look up\n // the parent renderer and use that to build the full node of this child row, using the value provided here to generate the cells\n yield {\n type: 'item',\n value: child\n };\n }\n }\n } else {\n let cells: PartialNode<T>[] = [];\n let childRows: PartialNode<T>[] = [];\n let columnCount = 0;\n React.Children.forEach(children, node => {\n if (node.type === Row) {\n if (cells.length < context.columns.length) {\n throw new Error('All of a Row\\'s child Cells must be positioned before any child Rows.');\n }\n\n childRows.push({\n type: 'item',\n element: node\n });\n } else {\n cells.push({\n type: 'cell',\n element: node\n });\n columnCount += node.props.colSpan ?? 1;\n }\n });\n\n if (columnCount !== context.columns.length) {\n throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);\n }\n\n yield* cells;\n yield* childRows;\n }\n },\n shouldInvalidate(newContext: CollectionBuilderContext<T>) {\n // Invalidate all rows if the columns changed.\n return newContext.columns.length !== context.columns.length ||\n newContext.columns.some((c, i) => c.key !== context.columns[i].key) ||\n newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes ||\n newContext.showDragButtons !== context.showDragButtons ||\n newContext.selectionMode !== context.selectionMode;\n }\n };\n};\n\n/**\n * A Row represents a single item in a Table and contains Cell elements for each column.\n * Cells can be statically defined as children, or generated dynamically using a function\n * based on the columns defined in the TableHeader.\n */\n// We don't want getCollectionNode to show up in the type definition\nlet _Row = Row as <T>(props: RowProps<T>) => JSX.Element;\nexport {_Row as Row};\n"],"names":[],"version":3,"file":"Row.module.js.map"}
@@ -41,9 +41,10 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
41
41
  // in the previous column so it's level with the current column.
42
42
  if (seen.has(parent)) {
43
43
  var _parent;
44
- var _colspan;
45
- (_colspan = (_parent = parent).colspan) !== null && _colspan !== void 0 ? _colspan : _parent.colspan = 0;
46
- parent.colspan++;
44
+ var _colSpan;
45
+ (_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0;
46
+ parent.colSpan++;
47
+ parent.colspan = parent.colSpan;
47
48
  let { column: column, index: index } = seen.get(parent);
48
49
  if (index > col.length) break;
49
50
  for(let i = index; i < col.length; i++)column.splice(i, 0, null);
@@ -51,6 +52,7 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
51
52
  for(let i = col.length; i < column.length; i++)// eslint-disable-next-line max-depth
52
53
  if (column[i] && seen.has(column[i])) seen.get(column[i]).index = i;
53
54
  } else {
55
+ parent.colSpan = 1;
54
56
  parent.colspan = 1;
55
57
  col.push(parent);
56
58
  seen.set(parent, {
@@ -74,14 +76,15 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
74
76
  // Fill the space up until the current column with a placeholder
75
77
  let row = headerRows[i];
76
78
  let rowLength = row.reduce((p, c)=>{
77
- var _c_colspan;
78
- return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1);
79
+ var _c_colSpan;
80
+ return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
79
81
  }, 0);
80
82
  if (rowLength < colIndex) {
81
83
  let placeholder = {
82
84
  type: 'placeholder',
83
85
  key: 'placeholder-' + item.key,
84
86
  colspan: colIndex - rowLength,
87
+ colSpan: colIndex - rowLength,
85
88
  index: rowLength,
86
89
  value: null,
87
90
  rendered: null,
@@ -113,13 +116,14 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
113
116
  let i = 0;
114
117
  for (let row of headerRows){
115
118
  let rowLength = row.reduce((p, c)=>{
116
- var _c_colspan;
117
- return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1);
119
+ var _c_colSpan;
120
+ return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
118
121
  }, 0);
119
122
  if (rowLength < columnNodes.length) {
120
123
  let placeholder = {
121
124
  type: 'placeholder',
122
125
  key: 'placeholder-' + row[row.length - 1].key,
126
+ colSpan: columnNodes.length - rowLength,
123
127
  colspan: columnNodes.length - rowLength,
124
128
  index: rowLength,
125
129
  value: null,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAaD,MAAM,8CAAwB,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AACtF,IAAI,mDA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Eb,IAAI,KAAK,KAAK,CAAC,WAAW,EACxB,oBAAoB,GAAG,CAAC,KAAK,GAAG;oBAEpC;oBACA;gBACF,KAAK;oBACH,KAAK,IAAI,CAAC;oBACV,QAAQ,4BAA4B;YACxC;YACA,KAAK,IAAI,SAAS,KAAK,UAAU,CAC/B,MAAM;QAEV;QAEA,KAAK,IAAI,QAAQ,MACf,MAAM;QAGR,IAAI,aAAa,0CAAgB,cAAc;QAC/C,WAAW,OAAO,CAAC,CAAC,KAAK,IAAM,KAAK,MAAM,CAAC,GAAG,GAAG;QAEjD,KAAK,CAAC;YACJ,aAAa,QAAQ,MAAM;YAC3B,OAAO;YACP,WAAW,CAAA;gBACT,KAAK,MAAM,GAAG,OAAO,CAAC,KAAK,KAAK,CAAC;gBACjC,OAAO;YACT;QACF,SAtFF,QAAgB;QAuFd,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,mBAAmB,GAAG;QAC3B,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,KAAK,GAAG;eAAI,KAAM,UAAU;SAAC,CAAC,MAAM;QAEzC,8CAA8C;QAC9C,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,GAAG;YACvC,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;oBAAW,eAAmC;uBAApC,GAAC,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,gBAAgB,KAAI,GAAC,iBAAA,OAAO,KAAK,cAAZ,qCAAA,eAAc,eAAe;;YACvG,IAAI,KACF,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,GAAG;QAExC;IACF;AAgFF","sources":["packages/@react-stately/table/src/TableCollection.ts"],"sourcesContent":["/*\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\nimport {getFirstItem, getLastItem} from '@react-stately/collections';\nimport {GridCollection} from '@react-stately/grid';\nimport {GridNode} from '@react-types/grid';\nimport {TableCollection as ITableCollection} from '@react-types/table';\nimport {Key} from '@react-types/shared';\n\ninterface GridCollectionOptions {\n showSelectionCheckboxes?: boolean,\n showDragButtons?: boolean\n}\n\nconst ROW_HEADER_COLUMN_KEY = 'row-header-column-' + Math.random().toString(36).slice(2);\nlet ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\nwhile (ROW_HEADER_COLUMN_KEY === ROW_HEADER_COLUMN_KEY_DRAG) {\n ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\n}\n\n/** @private */\nexport function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: GridNode<T>[]): GridNode<T>[] {\n if (columnNodes.length === 0) {\n return [];\n }\n\n let columns: GridNode<T>[][] = [];\n let seen = new Map();\n for (let column of columnNodes) {\n let parentKey = column.parentKey;\n let col = [column];\n\n while (parentKey) {\n let parent: GridNode<T> | undefined = keyMap.get(parentKey);\n if (!parent) {\n break;\n }\n\n // If we've already seen this parent, than it is shared\n // with a previous column. If the current column is taller\n // than the previous column, than we need to shift the parent\n // in the previous column so it's level with the current column.\n if (seen.has(parent)) {\n parent.colspan ??= 0;\n parent.colspan++;\n\n let {column, index} = seen.get(parent);\n if (index > col.length) {\n break;\n }\n\n for (let i = index; i < col.length; i++) {\n column.splice(i, 0, null);\n }\n\n // Adjust shifted indices\n for (let i = col.length; i < column.length; i++) {\n // eslint-disable-next-line max-depth\n if (column[i] && seen.has(column[i])) {\n seen.get(column[i]).index = i;\n }\n }\n } else {\n parent.colspan = 1;\n col.push(parent);\n seen.set(parent, {column: col, index: col.length - 1});\n }\n\n parentKey = parent.parentKey;\n }\n\n columns.push(col);\n column.index = columns.length - 1;\n }\n\n let maxLength = Math.max(...columns.map(c => c.length));\n let headerRows: GridNode<T>[][] = Array(maxLength).fill(0).map(() => []);\n\n // Convert columns into rows.\n let colIndex = 0;\n for (let column of columns) {\n let i = maxLength - 1;\n for (let item of column) {\n if (item) {\n // Fill the space up until the current column with a placeholder\n let row = headerRows[i];\n let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0);\n if (rowLength < colIndex) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + item.key,\n colspan: colIndex - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: ''\n };\n\n // eslint-disable-next-line max-depth\n if (row.length > 0) {\n row[row.length - 1].nextKey = placeholder.key;\n placeholder.prevKey = row[row.length - 1].key;\n }\n\n row.push(placeholder);\n }\n\n if (row.length > 0) {\n row[row.length - 1].nextKey = item.key;\n item.prevKey = row[row.length - 1].key;\n }\n\n item.level = i;\n item.colIndex = colIndex;\n row.push(item);\n }\n\n i--;\n }\n\n colIndex++;\n }\n\n // Add placeholders at the end of each row that is shorter than the maximum\n let i = 0;\n for (let row of headerRows) {\n let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0);\n if (rowLength < columnNodes.length) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + row[row.length - 1].key,\n colspan: columnNodes.length - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: '',\n prevKey: row[row.length - 1].key\n };\n\n row.push(placeholder);\n }\n\n i++;\n }\n\n return headerRows.map((childNodes, index) => {\n let row: GridNode<T> = {\n type: 'headerrow',\n key: 'headerrow-' + index,\n index,\n value: null,\n rendered: null,\n level: 0,\n hasChildNodes: true,\n childNodes,\n textValue: ''\n };\n\n return row;\n });\n}\n\nexport class TableCollection<T> extends GridCollection<T> implements ITableCollection<T> {\n headerRows: GridNode<T>[];\n columns: GridNode<T>[];\n rowHeaderColumnKeys: Set<Key>;\n body: GridNode<T>;\n _size: number = 0;\n\n constructor(nodes: Iterable<GridNode<T>>, prev?: ITableCollection<T> | null, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T> | null = null;\n let columns: GridNode<T>[] = [];\n // Add cell for selection checkboxes if needed.\n if (opts?.showSelectionCheckboxes) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY,\n value: null,\n textValue: '',\n level: 0,\n index: opts?.showDragButtons ? 1 : 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isSelectionCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n // Add cell for drag buttons if needed.\n if (opts?.showDragButtons) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY_DRAG,\n value: null,\n textValue: '',\n level: 0,\n index: 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isDragButtonCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n let rows: GridNode<T>[] = [];\n let columnKeyMap = new Map();\n let visit = (node: GridNode<T>) => {\n switch (node.type) {\n case 'body':\n body = node;\n break;\n case 'column':\n columnKeyMap.set(node.key, node);\n if (!node.hasChildNodes) {\n columns.push(node);\n\n if (node.props.isRowHeader) {\n rowHeaderColumnKeys.add(node.key);\n }\n }\n break;\n case 'item':\n rows.push(node);\n return; // do not go into childNodes\n }\n for (let child of node.childNodes) {\n visit(child);\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let headerRows = buildHeaderRows(columnKeyMap, columns) as GridNode<T>[];\n headerRows.forEach((row, i) => rows.splice(i, 0, row));\n\n super({\n columnCount: columns.length,\n items: rows,\n visitNode: node => {\n node.column = columns[node.index];\n return node;\n }\n });\n this.columns = columns;\n this.rowHeaderColumnKeys = rowHeaderColumnKeys;\n this.body = body!;\n this.headerRows = headerRows;\n this._size = [...body!.childNodes].length;\n\n // Default row header column to the first one.\n if (this.rowHeaderColumnKeys.size === 0) {\n let col = this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell);\n if (col) {\n this.rowHeaderColumnKeys.add(col.key);\n }\n }\n }\n\n *[Symbol.iterator]() {\n yield* this.body.childNodes;\n }\n\n get size() {\n return this._size;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key) {\n let node = this.keyMap.get(key);\n return node?.prevKey ?? null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node?.nextKey ?? null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key ?? null;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key ?? null;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number) {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n\n getChildren(key: Key): Iterable<GridNode<T>> {\n if (key === this.body.key) {\n return this.body.childNodes;\n }\n\n return super.getChildren(key);\n }\n\n getTextValue(key: Key): string {\n let row = this.getItem(key);\n if (!row) {\n return '';\n }\n\n // If the row has a textValue, use that.\n if (row.textValue) {\n return row.textValue;\n }\n\n // Otherwise combine the text of each of the row header columns.\n let rowHeaderColumnKeys = this.rowHeaderColumnKeys;\n if (rowHeaderColumnKeys) {\n let text: string[] = [];\n for (let cell of row.childNodes) {\n let column = this.columns[cell.index];\n if (rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n text.push(cell.textValue);\n }\n\n if (text.length === rowHeaderColumnKeys.size) {\n break;\n }\n }\n\n return text.join(' ');\n }\n\n return '';\n }\n}\n"],"names":[],"version":3,"file":"TableCollection.main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAa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AAI,GAAG;QAExC;IACF;AAgFF","sources":["packages/@react-stately/table/src/TableCollection.ts"],"sourcesContent":["/*\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\nimport {getFirstItem, getLastItem} from '@react-stately/collections';\nimport {GridCollection} from '@react-stately/grid';\nimport {GridNode} from '@react-types/grid';\nimport {TableCollection as ITableCollection} from '@react-types/table';\nimport {Key} from '@react-types/shared';\n\ninterface GridCollectionOptions {\n showSelectionCheckboxes?: boolean,\n showDragButtons?: boolean\n}\n\nconst ROW_HEADER_COLUMN_KEY = 'row-header-column-' + Math.random().toString(36).slice(2);\nlet ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\nwhile (ROW_HEADER_COLUMN_KEY === ROW_HEADER_COLUMN_KEY_DRAG) {\n ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\n}\n\n/** @private */\nexport function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: GridNode<T>[]): GridNode<T>[] {\n if (columnNodes.length === 0) {\n return [];\n }\n\n let columns: GridNode<T>[][] = [];\n let seen = new Map();\n for (let column of columnNodes) {\n let parentKey = column.parentKey;\n let col = [column];\n\n while (parentKey) {\n let parent: GridNode<T> | undefined = keyMap.get(parentKey);\n if (!parent) {\n break;\n }\n\n // If we've already seen this parent, than it is shared\n // with a previous column. If the current column is taller\n // than the previous column, than we need to shift the parent\n // in the previous column so it's level with the current column.\n if (seen.has(parent)) {\n parent.colSpan ??= 0;\n parent.colSpan++;\n parent.colspan = parent.colSpan;\n\n let {column, index} = seen.get(parent);\n if (index > col.length) {\n break;\n }\n\n for (let i = index; i < col.length; i++) {\n column.splice(i, 0, null);\n }\n\n // Adjust shifted indices\n for (let i = col.length; i < column.length; i++) {\n // eslint-disable-next-line max-depth\n if (column[i] && seen.has(column[i])) {\n seen.get(column[i]).index = i;\n }\n }\n } else {\n parent.colSpan = 1;\n parent.colspan = 1;\n col.push(parent);\n seen.set(parent, {column: col, index: col.length - 1});\n }\n\n parentKey = parent.parentKey;\n }\n\n columns.push(col);\n column.index = columns.length - 1;\n }\n\n let maxLength = Math.max(...columns.map(c => c.length));\n let headerRows: GridNode<T>[][] = Array(maxLength).fill(0).map(() => []);\n\n // Convert columns into rows.\n let colIndex = 0;\n for (let column of columns) {\n let i = maxLength - 1;\n for (let item of column) {\n if (item) {\n // Fill the space up until the current column with a placeholder\n let row = headerRows[i];\n let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0);\n if (rowLength < colIndex) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + item.key,\n colspan: colIndex - rowLength,\n colSpan: colIndex - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: ''\n };\n\n // eslint-disable-next-line max-depth\n if (row.length > 0) {\n row[row.length - 1].nextKey = placeholder.key;\n placeholder.prevKey = row[row.length - 1].key;\n }\n\n row.push(placeholder);\n }\n\n if (row.length > 0) {\n row[row.length - 1].nextKey = item.key;\n item.prevKey = row[row.length - 1].key;\n }\n\n item.level = i;\n item.colIndex = colIndex;\n row.push(item);\n }\n\n i--;\n }\n\n colIndex++;\n }\n\n // Add placeholders at the end of each row that is shorter than the maximum\n let i = 0;\n for (let row of headerRows) {\n let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0);\n if (rowLength < columnNodes.length) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + row[row.length - 1].key,\n colSpan: columnNodes.length - rowLength,\n colspan: columnNodes.length - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: '',\n prevKey: row[row.length - 1].key\n };\n\n row.push(placeholder);\n }\n\n i++;\n }\n\n return headerRows.map((childNodes, index) => {\n let row: GridNode<T> = {\n type: 'headerrow',\n key: 'headerrow-' + index,\n index,\n value: null,\n rendered: null,\n level: 0,\n hasChildNodes: true,\n childNodes,\n textValue: ''\n };\n\n return row;\n });\n}\n\nexport class TableCollection<T> extends GridCollection<T> implements ITableCollection<T> {\n headerRows: GridNode<T>[];\n columns: GridNode<T>[];\n rowHeaderColumnKeys: Set<Key>;\n body: GridNode<T>;\n _size: number = 0;\n\n constructor(nodes: Iterable<GridNode<T>>, prev?: ITableCollection<T> | null, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T> | null = null;\n let columns: GridNode<T>[] = [];\n // Add cell for selection checkboxes if needed.\n if (opts?.showSelectionCheckboxes) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY,\n value: null,\n textValue: '',\n level: 0,\n index: opts?.showDragButtons ? 1 : 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isSelectionCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n // Add cell for drag buttons if needed.\n if (opts?.showDragButtons) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY_DRAG,\n value: null,\n textValue: '',\n level: 0,\n index: 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isDragButtonCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n let rows: GridNode<T>[] = [];\n let columnKeyMap = new Map();\n let visit = (node: GridNode<T>) => {\n switch (node.type) {\n case 'body':\n body = node;\n break;\n case 'column':\n columnKeyMap.set(node.key, node);\n if (!node.hasChildNodes) {\n columns.push(node);\n\n if (node.props.isRowHeader) {\n rowHeaderColumnKeys.add(node.key);\n }\n }\n break;\n case 'item':\n rows.push(node);\n return; // do not go into childNodes\n }\n for (let child of node.childNodes) {\n visit(child);\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let headerRows = buildHeaderRows(columnKeyMap, columns) as GridNode<T>[];\n headerRows.forEach((row, i) => rows.splice(i, 0, row));\n\n super({\n columnCount: columns.length,\n items: rows,\n visitNode: node => {\n node.column = columns[node.index];\n return node;\n }\n });\n this.columns = columns;\n this.rowHeaderColumnKeys = rowHeaderColumnKeys;\n this.body = body!;\n this.headerRows = headerRows;\n this._size = [...body!.childNodes].length;\n\n // Default row header column to the first one.\n if (this.rowHeaderColumnKeys.size === 0) {\n let col = this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell);\n if (col) {\n this.rowHeaderColumnKeys.add(col.key);\n }\n }\n }\n\n *[Symbol.iterator]() {\n yield* this.body.childNodes;\n }\n\n get size() {\n return this._size;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key) {\n let node = this.keyMap.get(key);\n return node?.prevKey ?? null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node?.nextKey ?? null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key ?? null;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key ?? null;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number) {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n\n getChildren(key: Key): Iterable<GridNode<T>> {\n if (key === this.body.key) {\n return this.body.childNodes;\n }\n\n return super.getChildren(key);\n }\n\n getTextValue(key: Key): string {\n let row = this.getItem(key);\n if (!row) {\n return '';\n }\n\n // If the row has a textValue, use that.\n if (row.textValue) {\n return row.textValue;\n }\n\n // Otherwise combine the text of each of the row header columns.\n let rowHeaderColumnKeys = this.rowHeaderColumnKeys;\n if (rowHeaderColumnKeys) {\n let text: string[] = [];\n for (let cell of row.childNodes) {\n let column = this.columns[cell.index];\n if (rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n text.push(cell.textValue);\n }\n\n if (text.length === rowHeaderColumnKeys.size) {\n break;\n }\n }\n\n return text.join(' ');\n }\n\n return '';\n }\n}\n"],"names":[],"version":3,"file":"TableCollection.main.js.map"}
@@ -34,9 +34,10 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
34
34
  // in the previous column so it's level with the current column.
35
35
  if (seen.has(parent)) {
36
36
  var _parent;
37
- var _colspan;
38
- (_colspan = (_parent = parent).colspan) !== null && _colspan !== void 0 ? _colspan : _parent.colspan = 0;
39
- parent.colspan++;
37
+ var _colSpan;
38
+ (_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0;
39
+ parent.colSpan++;
40
+ parent.colspan = parent.colSpan;
40
41
  let { column: column, index: index } = seen.get(parent);
41
42
  if (index > col.length) break;
42
43
  for(let i = index; i < col.length; i++)column.splice(i, 0, null);
@@ -44,6 +45,7 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
44
45
  for(let i = col.length; i < column.length; i++)// eslint-disable-next-line max-depth
45
46
  if (column[i] && seen.has(column[i])) seen.get(column[i]).index = i;
46
47
  } else {
48
+ parent.colSpan = 1;
47
49
  parent.colspan = 1;
48
50
  col.push(parent);
49
51
  seen.set(parent, {
@@ -67,14 +69,15 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
67
69
  // Fill the space up until the current column with a placeholder
68
70
  let row = headerRows[i];
69
71
  let rowLength = row.reduce((p, c)=>{
70
- var _c_colspan;
71
- return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1);
72
+ var _c_colSpan;
73
+ return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
72
74
  }, 0);
73
75
  if (rowLength < colIndex) {
74
76
  let placeholder = {
75
77
  type: 'placeholder',
76
78
  key: 'placeholder-' + item.key,
77
79
  colspan: colIndex - rowLength,
80
+ colSpan: colIndex - rowLength,
78
81
  index: rowLength,
79
82
  value: null,
80
83
  rendered: null,
@@ -106,13 +109,14 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
106
109
  let i = 0;
107
110
  for (let row of headerRows){
108
111
  let rowLength = row.reduce((p, c)=>{
109
- var _c_colspan;
110
- return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1);
112
+ var _c_colSpan;
113
+ return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
111
114
  }, 0);
112
115
  if (rowLength < columnNodes.length) {
113
116
  let placeholder = {
114
117
  type: 'placeholder',
115
118
  key: 'placeholder-' + row[row.length - 1].key,
119
+ colSpan: columnNodes.length - rowLength,
116
120
  colspan: columnNodes.length - rowLength,
117
121
  index: rowLength,
118
122
  value: null,
@@ -34,9 +34,10 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
34
34
  // in the previous column so it's level with the current column.
35
35
  if (seen.has(parent)) {
36
36
  var _parent;
37
- var _colspan;
38
- (_colspan = (_parent = parent).colspan) !== null && _colspan !== void 0 ? _colspan : _parent.colspan = 0;
39
- parent.colspan++;
37
+ var _colSpan;
38
+ (_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0;
39
+ parent.colSpan++;
40
+ parent.colspan = parent.colSpan;
40
41
  let { column: column, index: index } = seen.get(parent);
41
42
  if (index > col.length) break;
42
43
  for(let i = index; i < col.length; i++)column.splice(i, 0, null);
@@ -44,6 +45,7 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
44
45
  for(let i = col.length; i < column.length; i++)// eslint-disable-next-line max-depth
45
46
  if (column[i] && seen.has(column[i])) seen.get(column[i]).index = i;
46
47
  } else {
48
+ parent.colSpan = 1;
47
49
  parent.colspan = 1;
48
50
  col.push(parent);
49
51
  seen.set(parent, {
@@ -67,14 +69,15 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
67
69
  // Fill the space up until the current column with a placeholder
68
70
  let row = headerRows[i];
69
71
  let rowLength = row.reduce((p, c)=>{
70
- var _c_colspan;
71
- return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1);
72
+ var _c_colSpan;
73
+ return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
72
74
  }, 0);
73
75
  if (rowLength < colIndex) {
74
76
  let placeholder = {
75
77
  type: 'placeholder',
76
78
  key: 'placeholder-' + item.key,
77
79
  colspan: colIndex - rowLength,
80
+ colSpan: colIndex - rowLength,
78
81
  index: rowLength,
79
82
  value: null,
80
83
  rendered: null,
@@ -106,13 +109,14 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
106
109
  let i = 0;
107
110
  for (let row of headerRows){
108
111
  let rowLength = row.reduce((p, c)=>{
109
- var _c_colspan;
110
- return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1);
112
+ var _c_colSpan;
113
+ return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
111
114
  }, 0);
112
115
  if (rowLength < columnNodes.length) {
113
116
  let placeholder = {
114
117
  type: 'placeholder',
115
118
  key: 'placeholder-' + row[row.length - 1].key,
119
+ colSpan: columnNodes.length - rowLength,
116
120
  colspan: columnNodes.length - rowLength,
117
121
  index: rowLength,
118
122
  value: null,
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAaD,MAAM,8CAAwB,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AACtF,IAAI,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,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AG,CAAC,KAAK,GAAG;oBAEpC;oBACA;gBACF,KAAK;oBACH,KAAK,IAAI,CAAC;oBACV,QAAQ,4BAA4B;YACxC;YACA,KAAK,IAAI,SAAS,KAAK,UAAU,CAC/B,MAAM;QAEV;QAEA,KAAK,IAAI,QAAQ,MACf,MAAM;QAGR,IAAI,aAAa,0CAAgB,cAAc;QAC/C,WAAW,OAAO,CAAC,CAAC,KAAK,IAAM,KAAK,MAAM,CAAC,GAAG,GAAG;QAEjD,KAAK,CAAC;YACJ,aAAa,QAAQ,MAAM;YAC3B,OAAO;YACP,WAAW,CAAA;gBACT,KAAK,MAAM,GAAG,OAAO,CAAC,KAAK,KAAK,CAAC;gBACjC,OAAO;YACT;QACF,SAtFF,QAAgB;QAuFd,IAAI,CAAC,OAAO,GAAG;QACf,IAAI,CAAC,mBAAmB,GAAG;QAC3B,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,KAAK,GAAG;eAAI,KAAM,UAAU;SAAC,CAAC,MAAM;QAEzC,8CAA8C;QAC9C,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,GAAG;YACvC,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;oBAAW,eAAmC;uBAApC,GAAC,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,gBAAgB,KAAI,GAAC,iBAAA,OAAO,KAAK,cAAZ,qCAAA,eAAc,eAAe;;YACvG,IAAI,KACF,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,GAAG;QAExC;IACF;AAgFF","sources":["packages/@react-stately/table/src/TableCollection.ts"],"sourcesContent":["/*\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\nimport {getFirstItem, getLastItem} from '@react-stately/collections';\nimport {GridCollection} from '@react-stately/grid';\nimport {GridNode} from '@react-types/grid';\nimport {TableCollection as ITableCollection} from '@react-types/table';\nimport {Key} from '@react-types/shared';\n\ninterface GridCollectionOptions {\n showSelectionCheckboxes?: boolean,\n showDragButtons?: boolean\n}\n\nconst ROW_HEADER_COLUMN_KEY = 'row-header-column-' + Math.random().toString(36).slice(2);\nlet ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\nwhile (ROW_HEADER_COLUMN_KEY === ROW_HEADER_COLUMN_KEY_DRAG) {\n ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\n}\n\n/** @private */\nexport function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: GridNode<T>[]): GridNode<T>[] {\n if (columnNodes.length === 0) {\n return [];\n }\n\n let columns: GridNode<T>[][] = [];\n let seen = new Map();\n for (let column of columnNodes) {\n let parentKey = column.parentKey;\n let col = [column];\n\n while (parentKey) {\n let parent: GridNode<T> | undefined = keyMap.get(parentKey);\n if (!parent) {\n break;\n }\n\n // If we've already seen this parent, than it is shared\n // with a previous column. If the current column is taller\n // than the previous column, than we need to shift the parent\n // in the previous column so it's level with the current column.\n if (seen.has(parent)) {\n parent.colspan ??= 0;\n parent.colspan++;\n\n let {column, index} = seen.get(parent);\n if (index > col.length) {\n break;\n }\n\n for (let i = index; i < col.length; i++) {\n column.splice(i, 0, null);\n }\n\n // Adjust shifted indices\n for (let i = col.length; i < column.length; i++) {\n // eslint-disable-next-line max-depth\n if (column[i] && seen.has(column[i])) {\n seen.get(column[i]).index = i;\n }\n }\n } else {\n parent.colspan = 1;\n col.push(parent);\n seen.set(parent, {column: col, index: col.length - 1});\n }\n\n parentKey = parent.parentKey;\n }\n\n columns.push(col);\n column.index = columns.length - 1;\n }\n\n let maxLength = Math.max(...columns.map(c => c.length));\n let headerRows: GridNode<T>[][] = Array(maxLength).fill(0).map(() => []);\n\n // Convert columns into rows.\n let colIndex = 0;\n for (let column of columns) {\n let i = maxLength - 1;\n for (let item of column) {\n if (item) {\n // Fill the space up until the current column with a placeholder\n let row = headerRows[i];\n let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0);\n if (rowLength < colIndex) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + item.key,\n colspan: colIndex - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: ''\n };\n\n // eslint-disable-next-line max-depth\n if (row.length > 0) {\n row[row.length - 1].nextKey = placeholder.key;\n placeholder.prevKey = row[row.length - 1].key;\n }\n\n row.push(placeholder);\n }\n\n if (row.length > 0) {\n row[row.length - 1].nextKey = item.key;\n item.prevKey = row[row.length - 1].key;\n }\n\n item.level = i;\n item.colIndex = colIndex;\n row.push(item);\n }\n\n i--;\n }\n\n colIndex++;\n }\n\n // Add placeholders at the end of each row that is shorter than the maximum\n let i = 0;\n for (let row of headerRows) {\n let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0);\n if (rowLength < columnNodes.length) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + row[row.length - 1].key,\n colspan: columnNodes.length - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: '',\n prevKey: row[row.length - 1].key\n };\n\n row.push(placeholder);\n }\n\n i++;\n }\n\n return headerRows.map((childNodes, index) => {\n let row: GridNode<T> = {\n type: 'headerrow',\n key: 'headerrow-' + index,\n index,\n value: null,\n rendered: null,\n level: 0,\n hasChildNodes: true,\n childNodes,\n textValue: ''\n };\n\n return row;\n });\n}\n\nexport class TableCollection<T> extends GridCollection<T> implements ITableCollection<T> {\n headerRows: GridNode<T>[];\n columns: GridNode<T>[];\n rowHeaderColumnKeys: Set<Key>;\n body: GridNode<T>;\n _size: number = 0;\n\n constructor(nodes: Iterable<GridNode<T>>, prev?: ITableCollection<T> | null, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T> | null = null;\n let columns: GridNode<T>[] = [];\n // Add cell for selection checkboxes if needed.\n if (opts?.showSelectionCheckboxes) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY,\n value: null,\n textValue: '',\n level: 0,\n index: opts?.showDragButtons ? 1 : 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isSelectionCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n // Add cell for drag buttons if needed.\n if (opts?.showDragButtons) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY_DRAG,\n value: null,\n textValue: '',\n level: 0,\n index: 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isDragButtonCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n let rows: GridNode<T>[] = [];\n let columnKeyMap = new Map();\n let visit = (node: GridNode<T>) => {\n switch (node.type) {\n case 'body':\n body = node;\n break;\n case 'column':\n columnKeyMap.set(node.key, node);\n if (!node.hasChildNodes) {\n columns.push(node);\n\n if (node.props.isRowHeader) {\n rowHeaderColumnKeys.add(node.key);\n }\n }\n break;\n case 'item':\n rows.push(node);\n return; // do not go into childNodes\n }\n for (let child of node.childNodes) {\n visit(child);\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let headerRows = buildHeaderRows(columnKeyMap, columns) as GridNode<T>[];\n headerRows.forEach((row, i) => rows.splice(i, 0, row));\n\n super({\n columnCount: columns.length,\n items: rows,\n visitNode: node => {\n node.column = columns[node.index];\n return node;\n }\n });\n this.columns = columns;\n this.rowHeaderColumnKeys = rowHeaderColumnKeys;\n this.body = body!;\n this.headerRows = headerRows;\n this._size = [...body!.childNodes].length;\n\n // Default row header column to the first one.\n if (this.rowHeaderColumnKeys.size === 0) {\n let col = this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell);\n if (col) {\n this.rowHeaderColumnKeys.add(col.key);\n }\n }\n }\n\n *[Symbol.iterator]() {\n yield* this.body.childNodes;\n }\n\n get size() {\n return this._size;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key) {\n let node = this.keyMap.get(key);\n return node?.prevKey ?? null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node?.nextKey ?? null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key ?? null;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key ?? null;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number) {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n\n getChildren(key: Key): Iterable<GridNode<T>> {\n if (key === this.body.key) {\n return this.body.childNodes;\n }\n\n return super.getChildren(key);\n }\n\n getTextValue(key: Key): string {\n let row = this.getItem(key);\n if (!row) {\n return '';\n }\n\n // If the row has a textValue, use that.\n if (row.textValue) {\n return row.textValue;\n }\n\n // Otherwise combine the text of each of the row header columns.\n let rowHeaderColumnKeys = this.rowHeaderColumnKeys;\n if (rowHeaderColumnKeys) {\n let text: string[] = [];\n for (let cell of row.childNodes) {\n let column = this.columns[cell.index];\n if (rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n text.push(cell.textValue);\n }\n\n if (text.length === rowHeaderColumnKeys.size) {\n break;\n }\n }\n\n return text.join(' ');\n }\n\n return '';\n }\n}\n"],"names":[],"version":3,"file":"TableCollection.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAaD,MAAM,8CAAwB,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IA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"],"sourcesContent":["/*\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\nimport {getFirstItem, getLastItem} from '@react-stately/collections';\nimport {GridCollection} from '@react-stately/grid';\nimport {GridNode} from '@react-types/grid';\nimport {TableCollection as ITableCollection} from '@react-types/table';\nimport {Key} from '@react-types/shared';\n\ninterface GridCollectionOptions {\n showSelectionCheckboxes?: boolean,\n showDragButtons?: boolean\n}\n\nconst ROW_HEADER_COLUMN_KEY = 'row-header-column-' + Math.random().toString(36).slice(2);\nlet ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\nwhile (ROW_HEADER_COLUMN_KEY === ROW_HEADER_COLUMN_KEY_DRAG) {\n ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2);\n}\n\n/** @private */\nexport function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: GridNode<T>[]): GridNode<T>[] {\n if (columnNodes.length === 0) {\n return [];\n }\n\n let columns: GridNode<T>[][] = [];\n let seen = new Map();\n for (let column of columnNodes) {\n let parentKey = column.parentKey;\n let col = [column];\n\n while (parentKey) {\n let parent: GridNode<T> | undefined = keyMap.get(parentKey);\n if (!parent) {\n break;\n }\n\n // If we've already seen this parent, than it is shared\n // with a previous column. If the current column is taller\n // than the previous column, than we need to shift the parent\n // in the previous column so it's level with the current column.\n if (seen.has(parent)) {\n parent.colSpan ??= 0;\n parent.colSpan++;\n parent.colspan = parent.colSpan;\n\n let {column, index} = seen.get(parent);\n if (index > col.length) {\n break;\n }\n\n for (let i = index; i < col.length; i++) {\n column.splice(i, 0, null);\n }\n\n // Adjust shifted indices\n for (let i = col.length; i < column.length; i++) {\n // eslint-disable-next-line max-depth\n if (column[i] && seen.has(column[i])) {\n seen.get(column[i]).index = i;\n }\n }\n } else {\n parent.colSpan = 1;\n parent.colspan = 1;\n col.push(parent);\n seen.set(parent, {column: col, index: col.length - 1});\n }\n\n parentKey = parent.parentKey;\n }\n\n columns.push(col);\n column.index = columns.length - 1;\n }\n\n let maxLength = Math.max(...columns.map(c => c.length));\n let headerRows: GridNode<T>[][] = Array(maxLength).fill(0).map(() => []);\n\n // Convert columns into rows.\n let colIndex = 0;\n for (let column of columns) {\n let i = maxLength - 1;\n for (let item of column) {\n if (item) {\n // Fill the space up until the current column with a placeholder\n let row = headerRows[i];\n let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0);\n if (rowLength < colIndex) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + item.key,\n colspan: colIndex - rowLength,\n colSpan: colIndex - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: ''\n };\n\n // eslint-disable-next-line max-depth\n if (row.length > 0) {\n row[row.length - 1].nextKey = placeholder.key;\n placeholder.prevKey = row[row.length - 1].key;\n }\n\n row.push(placeholder);\n }\n\n if (row.length > 0) {\n row[row.length - 1].nextKey = item.key;\n item.prevKey = row[row.length - 1].key;\n }\n\n item.level = i;\n item.colIndex = colIndex;\n row.push(item);\n }\n\n i--;\n }\n\n colIndex++;\n }\n\n // Add placeholders at the end of each row that is shorter than the maximum\n let i = 0;\n for (let row of headerRows) {\n let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0);\n if (rowLength < columnNodes.length) {\n let placeholder: GridNode<T> = {\n type: 'placeholder',\n key: 'placeholder-' + row[row.length - 1].key,\n colSpan: columnNodes.length - rowLength,\n colspan: columnNodes.length - rowLength,\n index: rowLength,\n value: null,\n rendered: null,\n level: i,\n hasChildNodes: false,\n childNodes: [],\n textValue: '',\n prevKey: row[row.length - 1].key\n };\n\n row.push(placeholder);\n }\n\n i++;\n }\n\n return headerRows.map((childNodes, index) => {\n let row: GridNode<T> = {\n type: 'headerrow',\n key: 'headerrow-' + index,\n index,\n value: null,\n rendered: null,\n level: 0,\n hasChildNodes: true,\n childNodes,\n textValue: ''\n };\n\n return row;\n });\n}\n\nexport class TableCollection<T> extends GridCollection<T> implements ITableCollection<T> {\n headerRows: GridNode<T>[];\n columns: GridNode<T>[];\n rowHeaderColumnKeys: Set<Key>;\n body: GridNode<T>;\n _size: number = 0;\n\n constructor(nodes: Iterable<GridNode<T>>, prev?: ITableCollection<T> | null, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T> | null = null;\n let columns: GridNode<T>[] = [];\n // Add cell for selection checkboxes if needed.\n if (opts?.showSelectionCheckboxes) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY,\n value: null,\n textValue: '',\n level: 0,\n index: opts?.showDragButtons ? 1 : 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isSelectionCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n // Add cell for drag buttons if needed.\n if (opts?.showDragButtons) {\n let rowHeaderColumn: GridNode<T> = {\n type: 'column',\n key: ROW_HEADER_COLUMN_KEY_DRAG,\n value: null,\n textValue: '',\n level: 0,\n index: 0,\n hasChildNodes: false,\n rendered: null,\n childNodes: [],\n props: {\n isDragButtonCell: true\n }\n };\n\n columns.unshift(rowHeaderColumn);\n }\n\n let rows: GridNode<T>[] = [];\n let columnKeyMap = new Map();\n let visit = (node: GridNode<T>) => {\n switch (node.type) {\n case 'body':\n body = node;\n break;\n case 'column':\n columnKeyMap.set(node.key, node);\n if (!node.hasChildNodes) {\n columns.push(node);\n\n if (node.props.isRowHeader) {\n rowHeaderColumnKeys.add(node.key);\n }\n }\n break;\n case 'item':\n rows.push(node);\n return; // do not go into childNodes\n }\n for (let child of node.childNodes) {\n visit(child);\n }\n };\n\n for (let node of nodes) {\n visit(node);\n }\n\n let headerRows = buildHeaderRows(columnKeyMap, columns) as GridNode<T>[];\n headerRows.forEach((row, i) => rows.splice(i, 0, row));\n\n super({\n columnCount: columns.length,\n items: rows,\n visitNode: node => {\n node.column = columns[node.index];\n return node;\n }\n });\n this.columns = columns;\n this.rowHeaderColumnKeys = rowHeaderColumnKeys;\n this.body = body!;\n this.headerRows = headerRows;\n this._size = [...body!.childNodes].length;\n\n // Default row header column to the first one.\n if (this.rowHeaderColumnKeys.size === 0) {\n let col = this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell);\n if (col) {\n this.rowHeaderColumnKeys.add(col.key);\n }\n }\n }\n\n *[Symbol.iterator]() {\n yield* this.body.childNodes;\n }\n\n get size() {\n return this._size;\n }\n\n getKeys() {\n return this.keyMap.keys();\n }\n\n getKeyBefore(key: Key) {\n let node = this.keyMap.get(key);\n return node?.prevKey ?? null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node?.nextKey ?? null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key ?? null;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key ?? null;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key) ?? null;\n }\n\n at(idx: number) {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\n }\n\n getChildren(key: Key): Iterable<GridNode<T>> {\n if (key === this.body.key) {\n return this.body.childNodes;\n }\n\n return super.getChildren(key);\n }\n\n getTextValue(key: Key): string {\n let row = this.getItem(key);\n if (!row) {\n return '';\n }\n\n // If the row has a textValue, use that.\n if (row.textValue) {\n return row.textValue;\n }\n\n // Otherwise combine the text of each of the row header columns.\n let rowHeaderColumnKeys = this.rowHeaderColumnKeys;\n if (rowHeaderColumnKeys) {\n let text: string[] = [];\n for (let cell of row.childNodes) {\n let column = this.columns[cell.index];\n if (rowHeaderColumnKeys.has(column.key) && cell.textValue) {\n text.push(cell.textValue);\n }\n\n if (text.length === rowHeaderColumnKeys.size) {\n break;\n }\n }\n\n return text.join(' ');\n }\n\n return '';\n }\n}\n"],"names":[],"version":3,"file":"TableCollection.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;ACqBA,mCAA0C,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACzE,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,SAAS,CAAA;CAC5E;AAED,+BAA+B,CAAC;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACxE,kBAAkB,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3E,YAAY,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAa;IAC3C,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAa;IAC9C,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAa;gBAElC,OAAO,EAAE,yBAAyB,CAAC,CAAC;IAKhD,2HAA2H;IAC3H,yCAAyC,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAWtH,iFAAiF;IACjF,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC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AmE;IACnE,yBAAyB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,CAAA;CACpD;AAED;;;GAGG;AACH,0CAA0C,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAmD1G;AC5CD;;;GAGG;AAEH,OAAA,IAAI,aAA8B,CAAC,CAAC,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;ACHjF;;;GAGG;AAEH,OAAA,IAAI,WAA0B,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;ACgB3E;;;;GAIG;AAEH,OAAA,IAAI,QAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;AC8BlE;;;;GAIG;AAEH,OAAA,IAAI,KAAc,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;ACnFzD;;GAEG;AAEH,OAAA,IAAI,MAAgB,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,OAAO,CAAC;ACxBtD,YAAY,EAAC,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAU3G,OAAO,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAC","sources":["packages/@react-stately/table/src/packages/@react-stately/table/src/TableUtils.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableColumnLayout.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableCollection.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/useTableState.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/useTableColumnResizeState.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/useTreeGridState.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableHeader.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableBody.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/Column.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/Row.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/Cell.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/index.ts","packages/@react-stately/table/src/index.ts"],"sourcesContent":[null,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\nexport type {TableColumnResizeState, TableColumnResizeStateProps} from './useTableColumnResizeState';\nexport type {TableState, CollectionBuilderContext, TableStateProps} from './useTableState';\nexport type {TableHeaderProps, TableBodyProps, ColumnProps, RowProps, CellProps} from '@react-types/table';\nexport type {TreeGridState, TreeGridStateProps} from './useTreeGridState';\n\nexport {useTableColumnResizeState} from './useTableColumnResizeState';\nexport {useTableState} from './useTableState';\nexport {TableHeader} from './TableHeader';\nexport {TableBody} from './TableBody';\nexport {Column} from './Column';\nexport {Row} from './Row';\nexport {Cell} from './Cell';\nexport {Section} from '@react-stately/collections';\nexport {TableCollection, buildHeaderRows} from './TableCollection';\nexport {TableColumnLayout} from './TableColumnLayout';\nexport {UNSTABLE_useTreeGridState} from './useTreeGridState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;;;ACqBA,mCAA0C,CAAC;IACzC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACzE,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS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E,KAAK,EAAE,eAAe,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;ACgB3E;;;;GAIG;AAEH,OAAA,IAAI,QAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;ACgClE;;;;GAIG;AAEH,OAAA,IAAI,KAAc,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;ACrFzD;;GAEG;AAEH,OAAA,IAAI,MAAgB,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,OAAO,CAAC;ACxBtD,YAAY,EAAC,gBAAgB,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAU3G,OAAO,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAC","sources":["packages/@react-stately/table/src/packages/@react-stately/table/src/TableUtils.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableColumnLayout.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableCollection.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/useTableState.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/useTableColumnResizeState.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/useTreeGridState.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableHeader.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/TableBody.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/Column.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/Row.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/Cell.ts","packages/@react-stately/table/src/packages/@react-stately/table/src/index.ts","packages/@react-stately/table/src/index.ts"],"sourcesContent":[null,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\nexport type {TableColumnResizeState, TableColumnResizeStateProps} from './useTableColumnResizeState';\nexport type {TableState, CollectionBuilderContext, TableStateProps} from './useTableState';\nexport type {TableHeaderProps, TableBodyProps, ColumnProps, RowProps, CellProps} from '@react-types/table';\nexport type {TreeGridState, TreeGridStateProps} from './useTreeGridState';\n\nexport {useTableColumnResizeState} from './useTableColumnResizeState';\nexport {useTableState} from './useTableState';\nexport {TableHeader} from './TableHeader';\nexport {TableBody} from './TableBody';\nexport {Column} from './Column';\nexport {Row} from './Row';\nexport {Cell} from './Cell';\nexport {Section} from '@react-stately/collections';\nexport {TableCollection, buildHeaderRows} from './TableCollection';\nexport {TableColumnLayout} from './TableColumnLayout';\nexport {UNSTABLE_useTreeGridState} from './useTreeGridState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-stately/table",
3
- "version": "3.13.1",
3
+ "version": "3.14.0",
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.12.1",
26
- "@react-stately/flags": "^3.0.5",
27
- "@react-stately/grid": "^3.10.1",
28
- "@react-stately/selection": "^3.19.0",
25
+ "@react-stately/collections": "^3.12.2",
26
+ "@react-stately/flags": "^3.1.0",
27
+ "@react-stately/grid": "^3.11.0",
28
+ "@react-stately/selection": "^3.20.0",
29
29
  "@react-stately/utils": "^3.10.5",
30
- "@react-types/grid": "^3.2.11",
31
- "@react-types/shared": "^3.27.0",
32
- "@react-types/table": "^3.10.4",
30
+ "@react-types/grid": "^3.3.0",
31
+ "@react-types/shared": "^3.28.0",
32
+ "@react-types/table": "^3.11.0",
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": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
41
+ "gitHead": "4d3c72c94eea2d72eb3a0e7d56000c6ef7e39726"
42
42
  }
package/src/Row.ts CHANGED
@@ -72,6 +72,7 @@ Row.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, conte
72
72
  } else {
73
73
  let cells: PartialNode<T>[] = [];
74
74
  let childRows: PartialNode<T>[] = [];
75
+ let columnCount = 0;
75
76
  React.Children.forEach(children, node => {
76
77
  if (node.type === Row) {
77
78
  if (cells.length < context.columns.length) {
@@ -87,11 +88,12 @@ Row.getCollectionNode = function* getCollectionNode<T>(props: RowProps<T>, conte
87
88
  type: 'cell',
88
89
  element: node
89
90
  });
91
+ columnCount += node.props.colSpan ?? 1;
90
92
  }
91
93
  });
92
94
 
93
- if (cells.length !== context.columns.length) {
94
- throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`);
95
+ if (columnCount !== context.columns.length) {
96
+ throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
95
97
  }
96
98
 
97
99
  yield* cells;
@@ -50,8 +50,9 @@ export function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: G
50
50
  // than the previous column, than we need to shift the parent
51
51
  // in the previous column so it's level with the current column.
52
52
  if (seen.has(parent)) {
53
- parent.colspan ??= 0;
54
- parent.colspan++;
53
+ parent.colSpan ??= 0;
54
+ parent.colSpan++;
55
+ parent.colspan = parent.colSpan;
55
56
 
56
57
  let {column, index} = seen.get(parent);
57
58
  if (index > col.length) {
@@ -70,6 +71,7 @@ export function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: G
70
71
  }
71
72
  }
72
73
  } else {
74
+ parent.colSpan = 1;
73
75
  parent.colspan = 1;
74
76
  col.push(parent);
75
77
  seen.set(parent, {column: col, index: col.length - 1});
@@ -93,12 +95,13 @@ export function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: G
93
95
  if (item) {
94
96
  // Fill the space up until the current column with a placeholder
95
97
  let row = headerRows[i];
96
- let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0);
98
+ let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0);
97
99
  if (rowLength < colIndex) {
98
100
  let placeholder: GridNode<T> = {
99
101
  type: 'placeholder',
100
102
  key: 'placeholder-' + item.key,
101
103
  colspan: colIndex - rowLength,
104
+ colSpan: colIndex - rowLength,
102
105
  index: rowLength,
103
106
  value: null,
104
107
  rendered: null,
@@ -136,11 +139,12 @@ export function buildHeaderRows<T>(keyMap: Map<Key, GridNode<T>>, columnNodes: G
136
139
  // Add placeholders at the end of each row that is shorter than the maximum
137
140
  let i = 0;
138
141
  for (let row of headerRows) {
139
- let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0);
142
+ let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0);
140
143
  if (rowLength < columnNodes.length) {
141
144
  let placeholder: GridNode<T> = {
142
145
  type: 'placeholder',
143
146
  key: 'placeholder-' + row[row.length - 1].key,
147
+ colSpan: columnNodes.length - rowLength,
144
148
  colspan: columnNodes.length - rowLength,
145
149
  index: rowLength,
146
150
  value: null,