@react-stately/table
Advanced tools
Comparing version 3.11.8-nightly.4624 to 3.11.8
@@ -22,9 +22,9 @@ | ||
let { children: children } = props; | ||
let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || ""; | ||
let textValue = props.textValue || (typeof children === 'string' ? children : '') || props['aria-label'] || ''; | ||
yield { | ||
type: "cell", | ||
type: 'cell', | ||
props: props, | ||
rendered: children, | ||
textValue: textValue, | ||
"aria-label": props["aria-label"], | ||
'aria-label': props['aria-label'], | ||
hasChildNodes: false | ||
@@ -31,0 +31,0 @@ }; |
@@ -16,9 +16,9 @@ /* | ||
let { children: children } = props; | ||
let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || ""; | ||
let textValue = props.textValue || (typeof children === 'string' ? children : '') || props['aria-label'] || ''; | ||
yield { | ||
type: "cell", | ||
type: 'cell', | ||
props: props, | ||
rendered: children, | ||
textValue: textValue, | ||
"aria-label": props["aria-label"], | ||
'aria-label': props['aria-label'], | ||
hasChildNodes: false | ||
@@ -25,0 +25,0 @@ }; |
@@ -30,5 +30,5 @@ var $kykIu$react = require("react"); | ||
let rendered = title || children; | ||
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"]; | ||
let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label']; | ||
let fullNodes = yield { | ||
type: "column", | ||
type: 'column', | ||
hasChildNodes: !!childColumns || title && (0, ($parcel$interopDefault($kykIu$react))).Children.count(children) > 0, | ||
@@ -40,3 +40,3 @@ rendered: rendered, | ||
if (childColumns) for (let child of childColumns)yield { | ||
type: "column", | ||
type: 'column', | ||
value: child | ||
@@ -48,3 +48,3 @@ }; | ||
childColumns.push({ | ||
type: "column", | ||
type: 'column', | ||
element: child | ||
@@ -51,0 +51,0 @@ }); |
@@ -20,5 +20,5 @@ import $kIQ5E$react from "react"; | ||
let rendered = title || children; | ||
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"]; | ||
let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label']; | ||
let fullNodes = yield { | ||
type: "column", | ||
type: 'column', | ||
hasChildNodes: !!childColumns || title && (0, $kIQ5E$react).Children.count(children) > 0, | ||
@@ -30,3 +30,3 @@ rendered: rendered, | ||
if (childColumns) for (let child of childColumns)yield { | ||
type: "column", | ||
type: 'column', | ||
value: child | ||
@@ -38,3 +38,3 @@ }; | ||
childColumns.push({ | ||
type: "column", | ||
type: 'column', | ||
element: child | ||
@@ -41,0 +41,0 @@ }); |
@@ -30,6 +30,6 @@ var $7Z9ig$react = require("react"); | ||
yield { | ||
type: "item", | ||
type: 'item', | ||
props: props, | ||
textValue: textValue, | ||
"aria-label": props["aria-label"], | ||
'aria-label': props['aria-label'], | ||
hasChildNodes: true, | ||
@@ -39,4 +39,4 @@ *childNodes () { | ||
if (context.showDragButtons) yield { | ||
type: "cell", | ||
key: "header-drag", | ||
type: 'cell', | ||
key: 'header-drag', | ||
props: { | ||
@@ -46,5 +46,5 @@ isDragButtonCell: true | ||
}; | ||
if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield { | ||
type: "cell", | ||
key: "header", | ||
if (context.showSelectionCheckboxes && context.selectionMode !== 'none') yield { | ||
type: 'cell', | ||
key: 'header', | ||
props: { | ||
@@ -54,5 +54,5 @@ isSelectionCell: true | ||
}; | ||
if (typeof children === "function") { | ||
if (typeof children === 'function') { | ||
for (let column of context.columns)yield { | ||
type: "cell", | ||
type: 'cell', | ||
element: children(column.key), | ||
@@ -64,3 +64,3 @@ key: column.key // this is combined with the row key by CollectionBuilder | ||
yield { | ||
type: "item", | ||
type: 'item', | ||
value: child | ||
@@ -73,9 +73,9 @@ }; | ||
if (node.type === $9ec6912e32cc0d81$var$Row) { | ||
if (cells.length < context.columns.length) throw new Error("All of a Row's child Cells must be positioned before any child Rows."); | ||
if (cells.length < context.columns.length) throw new Error('All of a Row\'s child Cells must be positioned before any child Rows.'); | ||
childRows.push({ | ||
type: "item", | ||
type: 'item', | ||
element: node | ||
}); | ||
} else cells.push({ | ||
type: "cell", | ||
type: 'cell', | ||
element: node | ||
@@ -82,0 +82,0 @@ }); |
@@ -20,6 +20,6 @@ import $7GIZw$react from "react"; | ||
yield { | ||
type: "item", | ||
type: 'item', | ||
props: props, | ||
textValue: textValue, | ||
"aria-label": props["aria-label"], | ||
'aria-label': props['aria-label'], | ||
hasChildNodes: true, | ||
@@ -29,4 +29,4 @@ *childNodes () { | ||
if (context.showDragButtons) yield { | ||
type: "cell", | ||
key: "header-drag", | ||
type: 'cell', | ||
key: 'header-drag', | ||
props: { | ||
@@ -36,5 +36,5 @@ isDragButtonCell: true | ||
}; | ||
if (context.showSelectionCheckboxes && context.selectionMode !== "none") yield { | ||
type: "cell", | ||
key: "header", | ||
if (context.showSelectionCheckboxes && context.selectionMode !== 'none') yield { | ||
type: 'cell', | ||
key: 'header', | ||
props: { | ||
@@ -44,5 +44,5 @@ isSelectionCell: true | ||
}; | ||
if (typeof children === "function") { | ||
if (typeof children === 'function') { | ||
for (let column of context.columns)yield { | ||
type: "cell", | ||
type: 'cell', | ||
element: children(column.key), | ||
@@ -54,3 +54,3 @@ key: column.key // this is combined with the row key by CollectionBuilder | ||
yield { | ||
type: "item", | ||
type: 'item', | ||
value: child | ||
@@ -63,9 +63,9 @@ }; | ||
if (node.type === $70d70eb16ea48428$var$Row) { | ||
if (cells.length < context.columns.length) throw new Error("All of a Row's child Cells must be positioned before any child Rows."); | ||
if (cells.length < context.columns.length) throw new Error('All of a Row\'s child Cells must be positioned before any child Rows.'); | ||
childRows.push({ | ||
type: "item", | ||
type: 'item', | ||
element: node | ||
}); | ||
} else cells.push({ | ||
type: "cell", | ||
type: 'cell', | ||
element: node | ||
@@ -72,0 +72,0 @@ }); |
@@ -30,10 +30,10 @@ var $ablJS$react = require("react"); | ||
yield { | ||
type: "body", | ||
type: 'body', | ||
hasChildNodes: true, | ||
props: props, | ||
*childNodes () { | ||
if (typeof children === "function") { | ||
if (!items) throw new Error("props.children was a function but props.items is missing"); | ||
if (typeof children === 'function') { | ||
if (!items) throw new Error('props.children was a function but props.items is missing'); | ||
for (let item of items)yield { | ||
type: "item", | ||
type: 'item', | ||
value: item, | ||
@@ -46,3 +46,3 @@ renderer: children | ||
items.push({ | ||
type: "item", | ||
type: 'item', | ||
element: item | ||
@@ -49,0 +49,0 @@ }); |
@@ -20,10 +20,10 @@ import $6tF2U$react from "react"; | ||
yield { | ||
type: "body", | ||
type: 'body', | ||
hasChildNodes: true, | ||
props: props, | ||
*childNodes () { | ||
if (typeof children === "function") { | ||
if (!items) throw new Error("props.children was a function but props.items is missing"); | ||
if (typeof children === 'function') { | ||
if (!items) throw new Error('props.children was a function but props.items is missing'); | ||
for (let item of items)yield { | ||
type: "item", | ||
type: 'item', | ||
value: item, | ||
@@ -36,3 +36,3 @@ renderer: children | ||
items.push({ | ||
type: "item", | ||
type: 'item', | ||
element: item | ||
@@ -39,0 +39,0 @@ }); |
@@ -23,5 +23,5 @@ var $bkA0E$reactstatelycollections = require("@react-stately/collections"); | ||
const $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2); | ||
let $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2); | ||
while($7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY === $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG)$7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2); | ||
const $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY = 'row-header-column-' + Math.random().toString(36).slice(2); | ||
let $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2); | ||
while($7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY === $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG)$7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2); | ||
function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) { | ||
@@ -77,4 +77,4 @@ if (columnNodes.length === 0) return []; | ||
let placeholder = { | ||
type: "placeholder", | ||
key: "placeholder-" + item.key, | ||
type: 'placeholder', | ||
key: 'placeholder-' + item.key, | ||
colspan: colIndex - rowLength, | ||
@@ -114,4 +114,4 @@ index: rowLength, | ||
let placeholder = { | ||
type: "placeholder", | ||
key: "placeholder-" + row[row.length - 1].key, | ||
type: 'placeholder', | ||
key: 'placeholder-' + row[row.length - 1].key, | ||
colspan: columnNodes.length - rowLength, | ||
@@ -133,4 +133,4 @@ index: rowLength, | ||
let row = { | ||
type: "headerrow", | ||
key: "headerrow-" + index, | ||
type: 'headerrow', | ||
key: 'headerrow-' + index, | ||
index: index, | ||
@@ -184,3 +184,3 @@ value: null, | ||
let row = this.getItem(key); | ||
if (!row) return ""; | ||
if (!row) return ''; | ||
// If the row has a textValue, use that. | ||
@@ -197,5 +197,5 @@ if (row.textValue) return row.textValue; | ||
} | ||
return text.join(" "); | ||
return text.join(' '); | ||
} | ||
return ""; | ||
return ''; | ||
} | ||
@@ -209,6 +209,6 @@ constructor(nodes, prev, opts){ | ||
let rowHeaderColumn = { | ||
type: "column", | ||
type: 'column', | ||
key: $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY, | ||
value: null, | ||
textValue: "", | ||
textValue: '', | ||
level: 0, | ||
@@ -228,6 +228,6 @@ index: (opts === null || opts === void 0 ? void 0 : opts.showDragButtons) ? 1 : 0, | ||
let rowHeaderColumn = { | ||
type: "column", | ||
type: 'column', | ||
key: $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG, | ||
value: null, | ||
textValue: "", | ||
textValue: '', | ||
level: 0, | ||
@@ -248,6 +248,6 @@ index: 0, | ||
switch(node.type){ | ||
case "body": | ||
case 'body': | ||
body = node; | ||
break; | ||
case "column": | ||
case 'column': | ||
columnKeyMap.set(node.key, node); | ||
@@ -259,3 +259,3 @@ if (!node.hasChildNodes) { | ||
break; | ||
case "item": | ||
case 'item': | ||
rows.push(node); | ||
@@ -262,0 +262,0 @@ return; // do not go into childNodes |
@@ -16,5 +16,5 @@ import {getFirstItem as $iLnZt$getFirstItem, getLastItem as $iLnZt$getLastItem} from "@react-stately/collections"; | ||
const $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2); | ||
let $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2); | ||
while($788781baa30117fa$var$ROW_HEADER_COLUMN_KEY === $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG)$788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2); | ||
const $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY = 'row-header-column-' + Math.random().toString(36).slice(2); | ||
let $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2); | ||
while($788781baa30117fa$var$ROW_HEADER_COLUMN_KEY === $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG)$788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = 'row-header-column-' + Math.random().toString(36).slice(2); | ||
function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) { | ||
@@ -70,4 +70,4 @@ if (columnNodes.length === 0) return []; | ||
let placeholder = { | ||
type: "placeholder", | ||
key: "placeholder-" + item.key, | ||
type: 'placeholder', | ||
key: 'placeholder-' + item.key, | ||
colspan: colIndex - rowLength, | ||
@@ -107,4 +107,4 @@ index: rowLength, | ||
let placeholder = { | ||
type: "placeholder", | ||
key: "placeholder-" + row[row.length - 1].key, | ||
type: 'placeholder', | ||
key: 'placeholder-' + row[row.length - 1].key, | ||
colspan: columnNodes.length - rowLength, | ||
@@ -126,4 +126,4 @@ index: rowLength, | ||
let row = { | ||
type: "headerrow", | ||
key: "headerrow-" + index, | ||
type: 'headerrow', | ||
key: 'headerrow-' + index, | ||
index: index, | ||
@@ -177,3 +177,3 @@ value: null, | ||
let row = this.getItem(key); | ||
if (!row) return ""; | ||
if (!row) return ''; | ||
// If the row has a textValue, use that. | ||
@@ -190,5 +190,5 @@ if (row.textValue) return row.textValue; | ||
} | ||
return text.join(" "); | ||
return text.join(' '); | ||
} | ||
return ""; | ||
return ''; | ||
} | ||
@@ -202,6 +202,6 @@ constructor(nodes, prev, opts){ | ||
let rowHeaderColumn = { | ||
type: "column", | ||
type: 'column', | ||
key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY, | ||
value: null, | ||
textValue: "", | ||
textValue: '', | ||
level: 0, | ||
@@ -221,6 +221,6 @@ index: (opts === null || opts === void 0 ? void 0 : opts.showDragButtons) ? 1 : 0, | ||
let rowHeaderColumn = { | ||
type: "column", | ||
type: 'column', | ||
key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG, | ||
value: null, | ||
textValue: "", | ||
textValue: '', | ||
level: 0, | ||
@@ -241,6 +241,6 @@ index: 0, | ||
switch(node.type){ | ||
case "body": | ||
case 'body': | ||
body = node; | ||
break; | ||
case "column": | ||
case 'column': | ||
columnKeyMap.set(node.key, node); | ||
@@ -252,3 +252,3 @@ if (!node.hasChildNodes) { | ||
break; | ||
case "item": | ||
case 'item': | ||
rows.push(node); | ||
@@ -255,0 +255,0 @@ return; // do not go into childNodes |
@@ -49,3 +49,3 @@ var $9e5f6a0caf75716e$exports = require("./TableUtils.main.js"); | ||
key, | ||
(_ref = (_col_props_defaultWidth = col.props.defaultWidth) !== null && _col_props_defaultWidth !== void 0 ? _col_props_defaultWidth : (_this_getDefaultWidth = (_this = this).getDefaultWidth) === null || _this_getDefaultWidth === void 0 ? void 0 : _this_getDefaultWidth.call(_this, col)) !== null && _ref !== void 0 ? _ref : "1fr" | ||
(_ref = (_col_props_defaultWidth = col.props.defaultWidth) !== null && _col_props_defaultWidth !== void 0 ? _col_props_defaultWidth : (_this_getDefaultWidth = (_this = this).getDefaultWidth) === null || _this_getDefaultWidth === void 0 ? void 0 : _this_getDefaultWidth.call(_this, col)) !== null && _ref !== void 0 ? _ref : '1fr' | ||
]; | ||
@@ -91,3 +91,3 @@ })); | ||
frValue = (0, $9e5f6a0caf75716e$exports.parseFractionalUnit)(column.props.width); | ||
} else if (col !== column.key && ((_column_props_width = column.props.width) === null || _column_props_width === void 0 ? void 0 : (_column_props_width_endsWith = _column_props_width.endsWith) === null || _column_props_width_endsWith === void 0 ? void 0 : _column_props_width_endsWith.call(_column_props_width, "%"))) percentKeys.set(column.key, column.props.width); | ||
} else if (col !== column.key && ((_column_props_width = column.props.width) === null || _column_props_width === void 0 ? void 0 : (_column_props_width_endsWith = _column_props_width.endsWith) === null || _column_props_width_endsWith === void 0 ? void 0 : _column_props_width_endsWith.call(_column_props_width, '%'))) percentKeys.set(column.key, column.props.width); | ||
// don't freeze columns to the right of the resizing one | ||
@@ -157,3 +157,3 @@ if (resizeIndex < i) { | ||
var _options_getDefaultWidth; | ||
this.getDefaultWidth = (_options_getDefaultWidth = options === null || options === void 0 ? void 0 : options.getDefaultWidth) !== null && _options_getDefaultWidth !== void 0 ? _options_getDefaultWidth : ()=>"1fr"; | ||
this.getDefaultWidth = (_options_getDefaultWidth = options === null || options === void 0 ? void 0 : options.getDefaultWidth) !== null && _options_getDefaultWidth !== void 0 ? _options_getDefaultWidth : ()=>'1fr'; | ||
var _options_getDefaultMinWidth; | ||
@@ -160,0 +160,0 @@ this.getDefaultMinWidth = (_options_getDefaultMinWidth = options === null || options === void 0 ? void 0 : options.getDefaultMinWidth) !== null && _options_getDefaultMinWidth !== void 0 ? _options_getDefaultMinWidth : ()=>75; |
@@ -43,3 +43,3 @@ import {calculateColumnSizes as $6818b1c4fc67028d$export$55d50dc687385491, getMaxWidth as $6818b1c4fc67028d$export$59185c62a7544aa0, getMinWidth as $6818b1c4fc67028d$export$f556054ce4358701, isStatic as $6818b1c4fc67028d$export$1994a077b98ee0d5, parseFractionalUnit as $6818b1c4fc67028d$export$9078bad4c3934604} from "./TableUtils.module.js"; | ||
key, | ||
(_ref = (_col_props_defaultWidth = col.props.defaultWidth) !== null && _col_props_defaultWidth !== void 0 ? _col_props_defaultWidth : (_this_getDefaultWidth = (_this = this).getDefaultWidth) === null || _this_getDefaultWidth === void 0 ? void 0 : _this_getDefaultWidth.call(_this, col)) !== null && _ref !== void 0 ? _ref : "1fr" | ||
(_ref = (_col_props_defaultWidth = col.props.defaultWidth) !== null && _col_props_defaultWidth !== void 0 ? _col_props_defaultWidth : (_this_getDefaultWidth = (_this = this).getDefaultWidth) === null || _this_getDefaultWidth === void 0 ? void 0 : _this_getDefaultWidth.call(_this, col)) !== null && _ref !== void 0 ? _ref : '1fr' | ||
]; | ||
@@ -85,3 +85,3 @@ })); | ||
frValue = (0, $6818b1c4fc67028d$export$9078bad4c3934604)(column.props.width); | ||
} else if (col !== column.key && ((_column_props_width = column.props.width) === null || _column_props_width === void 0 ? void 0 : (_column_props_width_endsWith = _column_props_width.endsWith) === null || _column_props_width_endsWith === void 0 ? void 0 : _column_props_width_endsWith.call(_column_props_width, "%"))) percentKeys.set(column.key, column.props.width); | ||
} else if (col !== column.key && ((_column_props_width = column.props.width) === null || _column_props_width === void 0 ? void 0 : (_column_props_width_endsWith = _column_props_width.endsWith) === null || _column_props_width_endsWith === void 0 ? void 0 : _column_props_width_endsWith.call(_column_props_width, '%'))) percentKeys.set(column.key, column.props.width); | ||
// don't freeze columns to the right of the resizing one | ||
@@ -151,3 +151,3 @@ if (resizeIndex < i) { | ||
var _options_getDefaultWidth; | ||
this.getDefaultWidth = (_options_getDefaultWidth = options === null || options === void 0 ? void 0 : options.getDefaultWidth) !== null && _options_getDefaultWidth !== void 0 ? _options_getDefaultWidth : ()=>"1fr"; | ||
this.getDefaultWidth = (_options_getDefaultWidth = options === null || options === void 0 ? void 0 : options.getDefaultWidth) !== null && _options_getDefaultWidth !== void 0 ? _options_getDefaultWidth : ()=>'1fr'; | ||
var _options_getDefaultMinWidth; | ||
@@ -154,0 +154,0 @@ this.getDefaultMinWidth = (_options_getDefaultMinWidth = options === null || options === void 0 ? void 0 : options.getDefaultMinWidth) !== null && _options_getDefaultMinWidth !== void 0 ? _options_getDefaultMinWidth : ()=>75; |
@@ -31,6 +31,6 @@ var $kcTb5$react = require("react"); | ||
context.columns = []; | ||
if (typeof children === "function") { | ||
if (!columns) throw new Error("props.children was a function but props.columns is missing"); | ||
if (typeof children === 'function') { | ||
if (!columns) throw new Error('props.children was a function but props.columns is missing'); | ||
for (let column of columns)yield { | ||
type: "column", | ||
type: 'column', | ||
value: column, | ||
@@ -43,3 +43,3 @@ renderer: children | ||
columns.push({ | ||
type: "column", | ||
type: 'column', | ||
element: column | ||
@@ -46,0 +46,0 @@ }); |
@@ -21,6 +21,6 @@ import $20k3Y$react from "react"; | ||
context.columns = []; | ||
if (typeof children === "function") { | ||
if (!columns) throw new Error("props.children was a function but props.columns is missing"); | ||
if (typeof children === 'function') { | ||
if (!columns) throw new Error('props.children was a function but props.columns is missing'); | ||
for (let column of columns)yield { | ||
type: "column", | ||
type: 'column', | ||
value: column, | ||
@@ -33,3 +33,3 @@ renderer: children | ||
columns.push({ | ||
type: "column", | ||
type: 'column', | ||
element: column | ||
@@ -36,0 +36,0 @@ }); |
@@ -29,3 +29,3 @@ | ||
if (!match) { | ||
console.warn(`width: ${width} is not a supported format, width should be a number (ex. 150), percentage (ex. '50%') or fr unit (ex. '2fr')`, "defaulting to '1fr'"); | ||
console.warn(`width: ${width} is not a supported format, width should be a number (ex. 150), percentage (ex. '50%') or fr unit (ex. '2fr')`, 'defaulting to \'1fr\''); | ||
return 1; | ||
@@ -36,5 +36,5 @@ } | ||
function $9e5f6a0caf75716e$export$7bbad27896f7ae9f(width, tableWidth) { | ||
if (typeof width === "string") { | ||
if (typeof width === 'string') { | ||
let match = width.match(/^(\d+)(?=%$)/); | ||
if (!match) throw new Error("Only percentages or numbers are supported for static column widths"); | ||
if (!match) throw new Error('Only percentages or numbers are supported for static column widths'); | ||
return tableWidth * (parseFloat(match[0]) / 100); | ||
@@ -54,3 +54,3 @@ } | ||
var _column_width, _ref, _ref1; | ||
let width = changedColumns.get(column.key) != null ? changedColumns.get(column.key) : (_ref1 = (_ref = (_column_width = column.width) !== null && _column_width !== void 0 ? _column_width : column.defaultWidth) !== null && _ref !== void 0 ? _ref : getDefaultWidth === null || getDefaultWidth === void 0 ? void 0 : getDefaultWidth(index)) !== null && _ref1 !== void 0 ? _ref1 : "1fr"; | ||
let width = changedColumns.get(column.key) != null ? changedColumns.get(column.key) : (_ref1 = (_ref = (_column_width = column.width) !== null && _column_width !== void 0 ? _column_width : column.defaultWidth) !== null && _ref !== void 0 ? _ref : getDefaultWidth === null || getDefaultWidth === void 0 ? void 0 : getDefaultWidth(index)) !== null && _ref1 !== void 0 ? _ref1 : '1fr'; | ||
let frozen = false; | ||
@@ -57,0 +57,0 @@ let baseSize = 0; |
@@ -19,3 +19,3 @@ /* | ||
if (!match) { | ||
console.warn(`width: ${width} is not a supported format, width should be a number (ex. 150), percentage (ex. '50%') or fr unit (ex. '2fr')`, "defaulting to '1fr'"); | ||
console.warn(`width: ${width} is not a supported format, width should be a number (ex. 150), percentage (ex. '50%') or fr unit (ex. '2fr')`, 'defaulting to \'1fr\''); | ||
return 1; | ||
@@ -26,5 +26,5 @@ } | ||
function $6818b1c4fc67028d$export$7bbad27896f7ae9f(width, tableWidth) { | ||
if (typeof width === "string") { | ||
if (typeof width === 'string') { | ||
let match = width.match(/^(\d+)(?=%$)/); | ||
if (!match) throw new Error("Only percentages or numbers are supported for static column widths"); | ||
if (!match) throw new Error('Only percentages or numbers are supported for static column widths'); | ||
return tableWidth * (parseFloat(match[0]) / 100); | ||
@@ -44,3 +44,3 @@ } | ||
var _column_width, _ref, _ref1; | ||
let width = changedColumns.get(column.key) != null ? changedColumns.get(column.key) : (_ref1 = (_ref = (_column_width = column.width) !== null && _column_width !== void 0 ? _column_width : column.defaultWidth) !== null && _ref !== void 0 ? _ref : getDefaultWidth === null || getDefaultWidth === void 0 ? void 0 : getDefaultWidth(index)) !== null && _ref1 !== void 0 ? _ref1 : "1fr"; | ||
let width = changedColumns.get(column.key) != null ? changedColumns.get(column.key) : (_ref1 = (_ref = (_column_width = column.width) !== null && _column_width !== void 0 ? _column_width : column.defaultWidth) !== null && _ref !== void 0 ? _ref : getDefaultWidth === null || getDefaultWidth === void 0 ? void 0 : getDefaultWidth(index)) !== null && _ref1 !== void 0 ? _ref1 : '1fr'; | ||
let frozen = false; | ||
@@ -47,0 +47,0 @@ let baseSize = 0; |
@@ -27,10 +27,10 @@ var $7f5a58334d8866a5$exports = require("./TableCollection.main.js"); | ||
const $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION = { | ||
ascending: "descending", | ||
descending: "ascending" | ||
ascending: 'descending', | ||
descending: 'ascending' | ||
}; | ||
function $e3f7784147dde23d$export$907bcc6c48325fd6(props) { | ||
let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = (0, $hkaUn$react.useState)(false); | ||
let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons } = props; | ||
let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons } = props; | ||
let context = (0, $hkaUn$react.useMemo)(()=>({ | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none", | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none', | ||
showDragButtons: showDragButtons, | ||
@@ -51,3 +51,3 @@ selectionMode: selectionMode, | ||
collection: collection, | ||
disabledBehavior: props.disabledBehavior || "selection" | ||
disabledBehavior: props.disabledBehavior || 'selection' | ||
}); | ||
@@ -66,3 +66,3 @@ return { | ||
column: columnKey, | ||
direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor = props.sortDescriptor) === null || _props_sortDescriptor === void 0 ? void 0 : _props_sortDescriptor.column) === columnKey ? $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : "ascending" | ||
direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor = props.sortDescriptor) === null || _props_sortDescriptor === void 0 ? void 0 : _props_sortDescriptor.column) === columnKey ? $e3f7784147dde23d$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : 'ascending' | ||
}); | ||
@@ -69,0 +69,0 @@ } |
@@ -21,10 +21,10 @@ import {TableCollection as $788781baa30117fa$export$596e1b2e2cf93690} from "./TableCollection.module.js"; | ||
const $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION = { | ||
ascending: "descending", | ||
descending: "ascending" | ||
ascending: 'descending', | ||
descending: 'ascending' | ||
}; | ||
function $4a0dd036d492cee4$export$907bcc6c48325fd6(props) { | ||
let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = (0, $1YSEb$useState)(false); | ||
let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons } = props; | ||
let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons } = props; | ||
let context = (0, $1YSEb$useMemo)(()=>({ | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none", | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none', | ||
showDragButtons: showDragButtons, | ||
@@ -45,3 +45,3 @@ selectionMode: selectionMode, | ||
collection: collection, | ||
disabledBehavior: props.disabledBehavior || "selection" | ||
disabledBehavior: props.disabledBehavior || 'selection' | ||
}); | ||
@@ -60,3 +60,3 @@ return { | ||
column: columnKey, | ||
direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor = props.sortDescriptor) === null || _props_sortDescriptor === void 0 ? void 0 : _props_sortDescriptor.column) === columnKey ? $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : "ascending" | ||
direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor = props.sortDescriptor) === null || _props_sortDescriptor === void 0 ? void 0 : _props_sortDescriptor.column) === columnKey ? $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : 'ascending' | ||
}); | ||
@@ -63,0 +63,0 @@ } |
@@ -31,7 +31,7 @@ var $7f5a58334d8866a5$exports = require("./TableCollection.main.js"); | ||
function $ed4e0b68b470dcfd$export$34dfa8a1622185a4(props) { | ||
let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props; | ||
if (!(0, $5Qo8l$reactstatelyflags.tableNestedRows)()) throw new Error("Feature flag for table nested rows must be enabled to use useTreeGridState."); | ||
let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props; | ||
if (!(0, $5Qo8l$reactstatelyflags.tableNestedRows)()) throw new Error('Feature flag for table nested rows must be enabled to use useTreeGridState.'); | ||
let [expandedKeys, setExpandedKeys] = (0, $5Qo8l$reactstatelyutils.useControlledState)(propExpandedKeys ? $ed4e0b68b470dcfd$var$convertExpanded(propExpandedKeys) : undefined, propDefaultExpandedKeys ? $ed4e0b68b470dcfd$var$convertExpanded(propDefaultExpandedKeys) : new Set(), UNSTABLE_onExpandedChange); | ||
let context = (0, $5Qo8l$react.useMemo)(()=>({ | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none", | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none', | ||
showDragButtons: showDragButtons, | ||
@@ -89,3 +89,3 @@ selectionMode: selectionMode, | ||
let updatedExpandedKeys; | ||
if (currentExpandedKeys === "all") { | ||
if (currentExpandedKeys === 'all') { | ||
updatedExpandedKeys = new Set(collection.flattenedRows.filter((row)=>row.props.UNSTABLE_childItems || row.props.children.length > collection.userColumnCount).map((row)=>row.key)); | ||
@@ -102,3 +102,3 @@ updatedExpandedKeys.delete(key); | ||
if (!expanded) return new Set(); | ||
return expanded === "all" ? "all" : new Set(expanded); | ||
return expanded === 'all' ? 'all' : new Set(expanded); | ||
} | ||
@@ -118,10 +118,10 @@ function $ed4e0b68b470dcfd$var$generateTreeGridCollection(nodes, opts) { | ||
switch(node.type){ | ||
case "body": | ||
case 'body': | ||
body = node; | ||
keyMap.set(body.key, body); | ||
break; | ||
case "column": | ||
case 'column': | ||
if (!node.hasChildNodes) userColumnCount++; | ||
break; | ||
case "item": | ||
case 'item': | ||
topLevelRows.push(node); | ||
@@ -133,3 +133,3 @@ return; | ||
for (let node of nodes){ | ||
if (node.type === "column") originalColumns.push(node); | ||
if (node.type === 'column') originalColumns.push(node); | ||
visit(node); | ||
@@ -144,5 +144,5 @@ } | ||
// values automatically calculated via CollectionBuilder | ||
if (node.type === "item") { | ||
if (node.type === 'item') { | ||
let childNodes = []; | ||
for (let child of node.childNodes)if (child.type === "cell") { | ||
for (let child of node.childNodes)if (child.type === 'cell') { | ||
let cellClone = { | ||
@@ -167,3 +167,3 @@ ...child | ||
// Assign indexOfType to cells and rows for aria-posinset | ||
if (node.type !== "placeholder" && node.type !== "column") newProps["indexOfType"] = i; | ||
if (node.type !== 'placeholder' && node.type !== 'column') newProps['indexOfType'] = i; | ||
// Use Object.assign instead of spread to preserve object reference for keyMap. Also ensures retrieving nodes | ||
@@ -175,3 +175,3 @@ // via .childNodes returns the same object as the one found via keyMap look up | ||
let rowIndex = 0; | ||
for (let child of node.childNodes)if (!(child.type === "item" && expandedKeys !== "all" && !expandedKeys.has(node.key))) { | ||
for (let child of node.childNodes)if (!(child.type === 'item' && expandedKeys !== 'all' && !expandedKeys.has(node.key))) { | ||
if (child.parentKey == null) // if child is a cell/expanded row/column and the parent key isn't already established by the collection, match child node to parent row | ||
@@ -183,3 +183,3 @@ child.parentKey = node.key; | ||
} else child.prevKey = null; | ||
if (child.type === "item") visitNode(child, rowIndex++); | ||
if (child.type === 'item') visitNode(child, rowIndex++); | ||
else // We enforce that the cells come before rows so can just reuse cell index | ||
@@ -186,0 +186,0 @@ visitNode(child, child.index); |
@@ -25,7 +25,7 @@ import {TableCollection as $788781baa30117fa$export$596e1b2e2cf93690} from "./TableCollection.module.js"; | ||
function $ee65a0057fd99531$export$34dfa8a1622185a4(props) { | ||
let { selectionMode: selectionMode = "none", showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props; | ||
if (!(0, $2Mvwf$tableNestedRows)()) throw new Error("Feature flag for table nested rows must be enabled to use useTreeGridState."); | ||
let { selectionMode: selectionMode = 'none', showSelectionCheckboxes: showSelectionCheckboxes, showDragButtons: showDragButtons, UNSTABLE_expandedKeys: propExpandedKeys, UNSTABLE_defaultExpandedKeys: propDefaultExpandedKeys, UNSTABLE_onExpandedChange: UNSTABLE_onExpandedChange, children: children } = props; | ||
if (!(0, $2Mvwf$tableNestedRows)()) throw new Error('Feature flag for table nested rows must be enabled to use useTreeGridState.'); | ||
let [expandedKeys, setExpandedKeys] = (0, $2Mvwf$useControlledState)(propExpandedKeys ? $ee65a0057fd99531$var$convertExpanded(propExpandedKeys) : undefined, propDefaultExpandedKeys ? $ee65a0057fd99531$var$convertExpanded(propDefaultExpandedKeys) : new Set(), UNSTABLE_onExpandedChange); | ||
let context = (0, $2Mvwf$useMemo)(()=>({ | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none", | ||
showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== 'none', | ||
showDragButtons: showDragButtons, | ||
@@ -83,3 +83,3 @@ selectionMode: selectionMode, | ||
let updatedExpandedKeys; | ||
if (currentExpandedKeys === "all") { | ||
if (currentExpandedKeys === 'all') { | ||
updatedExpandedKeys = new Set(collection.flattenedRows.filter((row)=>row.props.UNSTABLE_childItems || row.props.children.length > collection.userColumnCount).map((row)=>row.key)); | ||
@@ -96,3 +96,3 @@ updatedExpandedKeys.delete(key); | ||
if (!expanded) return new Set(); | ||
return expanded === "all" ? "all" : new Set(expanded); | ||
return expanded === 'all' ? 'all' : new Set(expanded); | ||
} | ||
@@ -112,10 +112,10 @@ function $ee65a0057fd99531$var$generateTreeGridCollection(nodes, opts) { | ||
switch(node.type){ | ||
case "body": | ||
case 'body': | ||
body = node; | ||
keyMap.set(body.key, body); | ||
break; | ||
case "column": | ||
case 'column': | ||
if (!node.hasChildNodes) userColumnCount++; | ||
break; | ||
case "item": | ||
case 'item': | ||
topLevelRows.push(node); | ||
@@ -127,3 +127,3 @@ return; | ||
for (let node of nodes){ | ||
if (node.type === "column") originalColumns.push(node); | ||
if (node.type === 'column') originalColumns.push(node); | ||
visit(node); | ||
@@ -138,5 +138,5 @@ } | ||
// values automatically calculated via CollectionBuilder | ||
if (node.type === "item") { | ||
if (node.type === 'item') { | ||
let childNodes = []; | ||
for (let child of node.childNodes)if (child.type === "cell") { | ||
for (let child of node.childNodes)if (child.type === 'cell') { | ||
let cellClone = { | ||
@@ -161,3 +161,3 @@ ...child | ||
// Assign indexOfType to cells and rows for aria-posinset | ||
if (node.type !== "placeholder" && node.type !== "column") newProps["indexOfType"] = i; | ||
if (node.type !== 'placeholder' && node.type !== 'column') newProps['indexOfType'] = i; | ||
// Use Object.assign instead of spread to preserve object reference for keyMap. Also ensures retrieving nodes | ||
@@ -169,3 +169,3 @@ // via .childNodes returns the same object as the one found via keyMap look up | ||
let rowIndex = 0; | ||
for (let child of node.childNodes)if (!(child.type === "item" && expandedKeys !== "all" && !expandedKeys.has(node.key))) { | ||
for (let child of node.childNodes)if (!(child.type === 'item' && expandedKeys !== 'all' && !expandedKeys.has(node.key))) { | ||
if (child.parentKey == null) // if child is a cell/expanded row/column and the parent key isn't already established by the collection, match child node to parent row | ||
@@ -177,3 +177,3 @@ child.parentKey = node.key; | ||
} else child.prevKey = null; | ||
if (child.type === "item") visitNode(child, rowIndex++); | ||
if (child.type === 'item') visitNode(child, rowIndex++); | ||
else // We enforce that the cells come before rows so can just reuse cell index | ||
@@ -180,0 +180,0 @@ visitNode(child, child.index); |
{ | ||
"name": "@react-stately/table", | ||
"version": "3.11.8-nightly.4624+d80999e89", | ||
"version": "3.11.8", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,10 +25,10 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-stately/collections": "3.0.0-nightly.2912+d80999e89", | ||
"@react-stately/flags": "3.0.3-nightly.4624+d80999e89", | ||
"@react-stately/grid": "3.8.7-nightly.4624+d80999e89", | ||
"@react-stately/selection": "3.0.0-nightly.2912+d80999e89", | ||
"@react-stately/utils": "3.0.0-nightly.2912+d80999e89", | ||
"@react-types/grid": "3.2.6-nightly.4624+d80999e89", | ||
"@react-types/shared": "3.0.0-nightly.2912+d80999e89", | ||
"@react-types/table": "3.9.5-nightly.4624+d80999e89", | ||
"@react-stately/collections": "^3.10.7", | ||
"@react-stately/flags": "^3.0.3", | ||
"@react-stately/grid": "^3.8.7", | ||
"@react-stately/selection": "^3.15.1", | ||
"@react-stately/utils": "^3.10.1", | ||
"@react-types/grid": "^3.2.6", | ||
"@react-types/shared": "^3.23.1", | ||
"@react-types/table": "^3.9.5", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -42,3 +42,3 @@ }, | ||
}, | ||
"gitHead": "d80999e897b4d4db9fcfb4e9b8fcdc9fdd700882" | ||
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433" | ||
} |
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
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
0
452512
+ Added@react-stately/collections@3.10.7(transitive)
+ Added@react-stately/flags@3.0.3(transitive)
+ Added@react-stately/grid@3.8.7(transitive)
+ Added@react-stately/selection@3.15.1(transitive)
+ Added@react-stately/utils@3.10.1(transitive)
+ Added@react-types/grid@3.2.6(transitive)
+ Added@react-types/shared@3.23.1(transitive)
+ Added@react-types/table@3.9.5(transitive)
Updated@react-stately/flags@^3.0.3
Updated@react-stately/grid@^3.8.7
Updated@react-stately/utils@^3.10.1
Updated@react-types/grid@^3.2.6
Updated@react-types/shared@^3.23.1
Updated@react-types/table@^3.9.5