@react-stately/table
Advanced tools
Comparing version 3.0.0-nightly-c78b24831-250206 to 3.0.0-nightly-c8fdba56e-250225
@@ -66,2 +66,3 @@ var $7Z9ig$react = require("react"); | ||
let childRows = []; | ||
let columnCount = 0; | ||
(0, ($parcel$interopDefault($7Z9ig$react))).Children.forEach(children, (node)=>{ | ||
@@ -74,8 +75,12 @@ if (node.type === $9ec6912e32cc0d81$var$Row) { | ||
}); | ||
} else cells.push({ | ||
type: 'cell', | ||
element: node | ||
}); | ||
} else { | ||
cells.push({ | ||
type: 'cell', | ||
element: node | ||
}); | ||
var _node_props_colSpan; | ||
columnCount += (_node_props_colSpan = node.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1; | ||
} | ||
}); | ||
if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`); | ||
if (columnCount !== context.columns.length) throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`); | ||
yield* cells; | ||
@@ -82,0 +87,0 @@ yield* childRows; |
@@ -56,2 +56,3 @@ import $7GIZw$react from "react"; | ||
let childRows = []; | ||
let columnCount = 0; | ||
(0, $7GIZw$react).Children.forEach(children, (node)=>{ | ||
@@ -64,8 +65,12 @@ if (node.type === $70d70eb16ea48428$var$Row) { | ||
}); | ||
} else cells.push({ | ||
type: 'cell', | ||
element: node | ||
}); | ||
} else { | ||
cells.push({ | ||
type: 'cell', | ||
element: node | ||
}); | ||
var _node_props_colSpan; | ||
columnCount += (_node_props_colSpan = node.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1; | ||
} | ||
}); | ||
if (cells.length !== context.columns.length) throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`); | ||
if (columnCount !== context.columns.length) throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`); | ||
yield* cells; | ||
@@ -72,0 +77,0 @@ yield* childRows; |
@@ -44,5 +44,6 @@ var $bkA0E$reactstatelycollections = require("@react-stately/collections"); | ||
var _parent; | ||
var _colspan; | ||
(_colspan = (_parent = parent).colspan) !== null && _colspan !== void 0 ? _colspan : _parent.colspan = 0; | ||
parent.colspan++; | ||
var _colSpan; | ||
(_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0; | ||
parent.colSpan++; | ||
parent.colspan = parent.colSpan; | ||
let { column: column, index: index } = seen.get(parent); | ||
@@ -55,2 +56,3 @@ if (index > col.length) break; | ||
} else { | ||
parent.colSpan = 1; | ||
parent.colspan = 1; | ||
@@ -79,4 +81,4 @@ col.push(parent); | ||
let rowLength = row.reduce((p, c)=>{ | ||
var _c_colspan; | ||
return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1); | ||
var _c_colSpan; | ||
return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1); | ||
}, 0); | ||
@@ -88,2 +90,3 @@ if (rowLength < colIndex) { | ||
colspan: colIndex - rowLength, | ||
colSpan: colIndex - rowLength, | ||
index: rowLength, | ||
@@ -120,4 +123,4 @@ value: null, | ||
let rowLength = row.reduce((p, c)=>{ | ||
var _c_colspan; | ||
return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1); | ||
var _c_colSpan; | ||
return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1); | ||
}, 0); | ||
@@ -128,2 +131,3 @@ if (rowLength < columnNodes.length) { | ||
key: 'placeholder-' + row[row.length - 1].key, | ||
colSpan: columnNodes.length - rowLength, | ||
colspan: columnNodes.length - rowLength, | ||
@@ -130,0 +134,0 @@ index: rowLength, |
@@ -37,5 +37,6 @@ import {getFirstItem as $iLnZt$getFirstItem, getLastItem as $iLnZt$getLastItem} from "@react-stately/collections"; | ||
var _parent; | ||
var _colspan; | ||
(_colspan = (_parent = parent).colspan) !== null && _colspan !== void 0 ? _colspan : _parent.colspan = 0; | ||
parent.colspan++; | ||
var _colSpan; | ||
(_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0; | ||
parent.colSpan++; | ||
parent.colspan = parent.colSpan; | ||
let { column: column, index: index } = seen.get(parent); | ||
@@ -48,2 +49,3 @@ if (index > col.length) break; | ||
} else { | ||
parent.colSpan = 1; | ||
parent.colspan = 1; | ||
@@ -72,4 +74,4 @@ col.push(parent); | ||
let rowLength = row.reduce((p, c)=>{ | ||
var _c_colspan; | ||
return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1); | ||
var _c_colSpan; | ||
return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1); | ||
}, 0); | ||
@@ -81,2 +83,3 @@ if (rowLength < colIndex) { | ||
colspan: colIndex - rowLength, | ||
colSpan: colIndex - rowLength, | ||
index: rowLength, | ||
@@ -113,4 +116,4 @@ value: null, | ||
let rowLength = row.reduce((p, c)=>{ | ||
var _c_colspan; | ||
return p + ((_c_colspan = c.colspan) !== null && _c_colspan !== void 0 ? _c_colspan : 1); | ||
var _c_colSpan; | ||
return p + ((_c_colSpan = c.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1); | ||
}, 0); | ||
@@ -121,2 +124,3 @@ if (rowLength < columnNodes.length) { | ||
key: 'placeholder-' + row[row.length - 1].key, | ||
colSpan: columnNodes.length - rowLength, | ||
colspan: columnNodes.length - rowLength, | ||
@@ -123,0 +127,0 @@ index: rowLength, |
{ | ||
"name": "@react-stately/table", | ||
"version": "3.0.0-nightly-c78b24831-250206", | ||
"version": "3.0.0-nightly-c8fdba56e-250225", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,10 +25,10 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/collections": "3.0.0-nightly-c78b24831-250206", | ||
"@react-stately/flags": "3.0.0-nightly-c78b24831-250206", | ||
"@react-stately/grid": "3.0.0-nightly-c78b24831-250206", | ||
"@react-stately/selection": "3.0.0-nightly-c78b24831-250206", | ||
"@react-stately/utils": "3.0.0-nightly-c78b24831-250206", | ||
"@react-types/grid": "3.0.0-nightly-c78b24831-250206", | ||
"@react-types/shared": "3.0.0-nightly-c78b24831-250206", | ||
"@react-types/table": "3.0.0-nightly-c78b24831-250206", | ||
"@react-stately/collections": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-stately/flags": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-stately/grid": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-stately/selection": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-stately/utils": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-types/grid": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-types/shared": "3.0.0-nightly-c8fdba56e-250225", | ||
"@react-types/table": "3.0.0-nightly-c8fdba56e-250225", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -35,0 +35,0 @@ }, |
@@ -75,2 +75,3 @@ /* | ||
let childRows: PartialNode<T>[] = []; | ||
let columnCount = 0; | ||
React.Children.forEach(children, node => { | ||
@@ -91,7 +92,8 @@ if (node.type === Row) { | ||
}); | ||
columnCount += node.props.colSpan ?? 1; | ||
} | ||
}); | ||
if (cells.length !== context.columns.length) { | ||
throw new Error(`Cell count must match column count. Found ${cells.length} cells and ${context.columns.length} columns.`); | ||
if (columnCount !== context.columns.length) { | ||
throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`); | ||
} | ||
@@ -98,0 +100,0 @@ |
@@ -53,4 +53,5 @@ /* | ||
if (seen.has(parent)) { | ||
parent.colspan ??= 0; | ||
parent.colspan++; | ||
parent.colSpan ??= 0; | ||
parent.colSpan++; | ||
parent.colspan = parent.colSpan; | ||
@@ -74,2 +75,3 @@ let {column, index} = seen.get(parent); | ||
} else { | ||
parent.colSpan = 1; | ||
parent.colspan = 1; | ||
@@ -98,3 +100,3 @@ col.push(parent); | ||
let row = headerRows[i]; | ||
let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0); | ||
let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0); | ||
if (rowLength < colIndex) { | ||
@@ -105,2 +107,3 @@ let placeholder: GridNode<T> = { | ||
colspan: colIndex - rowLength, | ||
colSpan: colIndex - rowLength, | ||
index: rowLength, | ||
@@ -143,3 +146,3 @@ value: null, | ||
for (let row of headerRows) { | ||
let rowLength = row.reduce((p, c) => p + (c.colspan ?? 1), 0); | ||
let rowLength = row.reduce((p, c) => p + (c.colSpan ?? 1), 0); | ||
if (rowLength < columnNodes.length) { | ||
@@ -149,2 +152,3 @@ let placeholder: GridNode<T> = { | ||
key: 'placeholder-' + row[row.length - 1].key, | ||
colSpan: columnNodes.length - rowLength, | ||
colspan: columnNodes.length - rowLength, | ||
@@ -151,0 +155,0 @@ index: rowLength, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
434064
5464
+ Added@react-stately/collections@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-stately/flags@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-stately/grid@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-stately/selection@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-stately/utils@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-types/grid@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-types/shared@3.0.0-nightly-c8fdba56e-250225(transitive)
+ Added@react-types/table@3.0.0-nightly-c8fdba56e-250225(transitive)
- Removed@react-stately/collections@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-stately/flags@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-stately/grid@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-stately/selection@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-stately/utils@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-types/grid@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-types/shared@3.0.0-nightly-c78b24831-250206(transitive)
- Removed@react-types/table@3.0.0-nightly-c78b24831-250206(transitive)
Updated@react-stately/collections@3.0.0-nightly-c8fdba56e-250225
Updated@react-stately/selection@3.0.0-nightly-c8fdba56e-250225