@react-stately/table 3.11.9-nightly.4674 → 3.11.9-nightly.4681

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.
@@ -175,6 +175,10 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends (0, $bkA0E$reactstatelyg
175
175
  ];
176
176
  return this.getItem(keys[idx]);
177
177
  }
178
+ getChildren(key) {
179
+ if (key === this.body.key) return this.body.childNodes;
180
+ return super.getChildren(key);
181
+ }
178
182
  getTextValue(key) {
179
183
  let row = this.getItem(key);
180
184
  if (!row) return '';
@@ -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,KAAK,CAAC;AACzF,MAAO,gDAA0B,iDAC/B,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AAIhF,SAAS,0CAAmB,MAA6B,EAAE,WAA0B;IAC1F,IAAI,YAAY,MAAM,KAAK,GACzB,OAAO,EAAE;IAGX,IAAI,UAA2B,EAAE;IACjC,IAAI,OAAO,IAAI;IACf,KAAK,IAAI,UAAU,YAAa;QAC9B,IAAI,YAAY,OAAO,SAAS;QAChC,IAAI,MAAM;YAAC;SAAO;QAElB,MAAO,UAAW;YAChB,IAAI,SAAsB,OAAO,GAAG,CAAC;YACrC,IAAI,CAAC,QACH;YAGF,uDAAuD;YACvD,0DAA0D;YAC1D,6DAA6D;YAC7D,gEAAgE;YAChE,IAAI,KAAK,GAAG,CAAC,SAAS;gBACpB,OAAO,OAAO;gBAEd,IAAI,UAAC,MAAM,SAAE,KAAK,EAAC,GAAG,KAAK,GAAG,CAAC;gBAC/B,IAAI,QAAQ,IAAI,MAAM,EACpB;gBAGF,IAAK,IA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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;aAtFF,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,KAAK,UAAU;SAAC,CAAC,MAAM;QAExC,8CAA8C;QAC9C,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,GACpC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBAAW,eAAmC;mBAApC,GAAC,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,gBAAgB,KAAI,GAAC,iBAAA,OAAO,KAAK,cAAZ,qCAAA,eAAc,eAAe;WAAE,GAAG;IAEnI;AAwEF","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> = 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++;\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 = 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, 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: null\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, 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: null,\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: null\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>, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T>;\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 = [];\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 this.rowHeaderColumnKeys.add(this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell).key);\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 ? node.prevKey : null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node ? node.nextKey : null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key);\n }\n\n at(idx: number) {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\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 = [];\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;;AAaD,MAAM,8CAAwB,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AACtF,IAAI,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AACzF,MAAO,gDAA0B,iDAC/B,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AAIhF,SAA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,CAAC,mBAAmB,GAAG;QAC3B,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,KAAK,GAAG;eAAI,KAAK,UAAU;SAAC,CAAC,MAAM;QAExC,8CAA8C;QAC9C,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,GACpC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBAAW,eAAmC;mBAApC,GAAC,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,gBAAgB,KAAI,GAAC,iBAAA,OAAO,KAAK,cAAZ,qCAAA,eAAc,eAAe;WAAE,GAAG;IAEnI;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> = 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++;\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 = 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, 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: null\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, 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: null,\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: null\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>, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T>;\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 = [];\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 this.rowHeaderColumnKeys.add(this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell).key);\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 ? node.prevKey : null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node ? node.nextKey : null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key);\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 = [];\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"}
@@ -168,6 +168,10 @@ class $788781baa30117fa$export$596e1b2e2cf93690 extends (0, $iLnZt$GridCollectio
168
168
  ];
169
169
  return this.getItem(keys[idx]);
170
170
  }
171
+ getChildren(key) {
172
+ if (key === this.body.key) return this.body.childNodes;
173
+ return super.getChildren(key);
174
+ }
171
175
  getTextValue(key) {
172
176
  let row = this.getItem(key);
173
177
  if (!row) return '';
@@ -168,6 +168,10 @@ class $788781baa30117fa$export$596e1b2e2cf93690 extends (0, $iLnZt$GridCollectio
168
168
  ];
169
169
  return this.getItem(keys[idx]);
170
170
  }
171
+ getChildren(key) {
172
+ if (key === this.body.key) return this.body.childNodes;
173
+ return super.getChildren(key);
174
+ }
171
175
  getTextValue(key) {
172
176
  let row = this.getItem(key);
173
177
  if (!row) return '';
@@ -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,KAAK,CAAC;AACzF,MAAO,gDAA0B,iDAC/B,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ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AK,UAAU;SAAC,CAAC,MAAM;QAExC,8CAA8C;QAC9C,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,GACpC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBAAW,eAAmC;mBAApC,GAAC,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,gBAAgB,KAAI,GAAC,iBAAA,OAAO,KAAK,cAAZ,qCAAA,eAAc,eAAe;WAAE,GAAG;IAEnI;AAwEF","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> = 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++;\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 = 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, 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: null\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, 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: null,\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: null\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>, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T>;\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 = [];\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 this.rowHeaderColumnKeys.add(this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell).key);\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 ? node.prevKey : null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node ? node.nextKey : null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key);\n }\n\n at(idx: number) {\n const keys = [...this.getKeys()];\n return this.getItem(keys[idx]);\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 = [];\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,IAAI,KAAK,CAAC;AACtF,IAAI,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AACzF,MAAO,gDAA0B,iDAC/B,mDAA6B,uBAAuB,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,KAAK,CAAC;AAIhF,SAAS,0CAAmB,MAA6B,EAAE,WAA0B;IAC1F,IAAI,YAAY,MAAM,KAAK,GACzB,OAAO,EAAE;IAGX,IAAI,UAA2B,EAAE;IACjC,IAAI,OAAO,IAAI;IACf,KAAK,IAAI,UAAU,YAAa;QAC9B,IAAI,YAAY,OAAO,SAAS;QAChC,IAAI,MAAM;YAAC;SAAO;QAElB,MAAO,UAAW;YAChB,IAAI,SAAsB,OAAO,GAAG,CAAC;YACrC,IAAI,CAAC,QACH;YAGF,uDAAuD;YACvD,0DAA0D;YAC1D,6DAA6D;YAC7D,gEAAgE;YAChE,IAAI,KAAK,GAAG,CAAC,SAAS;gBACpB,OAAO,OAAO;gBAEd,IAAI,UAAC,MAAM,SAAE,KAAK,EAAC,GAAG,KAAK,GAAG,CAAC;gBAC/B,IAAI,QAAQ,IAAI,MAAM,EACpB;gBAGF,IAAK,IAAI,IAAI,OAAO,IAAI,IAAI,MAAM,EAAE,IAClC,OAAO,MAAM,CAAC,GAAG,GAAG;gBAGtB,yBAAyB;gBACzB,IAAK,IAAI,IAAI,IAAI,MAAM,E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,CAAC;wBAEb,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;aAtFF,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,KAAK,UAAU;SAAC,CAAC,MAAM;QAExC,8CAA8C;QAC9C,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,KAAK,GACpC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;gBAAW,eAAmC;mBAApC,GAAC,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,gBAAgB,KAAI,GAAC,iBAAA,OAAO,KAAK,cAAZ,qCAAA,eAAc,eAAe;WAAE,GAAG;IAEnI;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> = 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++;\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 = 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, 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: null\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, 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: null,\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: null\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>, opts?: GridCollectionOptions) {\n let rowHeaderColumnKeys: Set<Key> = new Set();\n let body: GridNode<T>;\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 = [];\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 this.rowHeaderColumnKeys.add(this.columns.find(column => !column.props?.isDragButtonCell && !column.props?.isSelectionCell).key);\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 ? node.prevKey : null;\n }\n\n getKeyAfter(key: Key) {\n let node = this.keyMap.get(key);\n return node ? node.nextKey : null;\n }\n\n getFirstKey() {\n return getFirstItem(this.body.childNodes)?.key;\n }\n\n getLastKey() {\n return getLastItem(this.body.childNodes)?.key;\n }\n\n getItem(key: Key) {\n return this.keyMap.get(key);\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 = [];\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"}
@@ -62,68 +62,19 @@ class $2240a72410c17d51$export$7ff77a162970b30e {
62
62
  var _this_columnMaxWidths_get;
63
63
  return (_this_columnMaxWidths_get = this.columnMaxWidths.get(key)) !== null && _this_columnMaxWidths_get !== void 0 ? _this_columnMaxWidths_get : 0;
64
64
  }
65
- resizeColumnWidth(tableWidth, collection, controlledWidths, uncontrolledWidths, col = null, width) {
65
+ resizeColumnWidth(collection, uncontrolledWidths, col, width) {
66
66
  let prevColumnWidths = this.columnWidths;
67
- // resizing a column
68
- let resizeIndex = Infinity;
69
- let resizingChanged = new Map([
70
- ...controlledWidths,
71
- ...uncontrolledWidths
72
- ]);
73
- let percentKeys = new Map();
74
- let frKeysToTheRight = new Map();
75
- let minWidths = new Map();
76
- // freeze columns to the left to their previous pixel value
77
- collection.columns.forEach((column, i)=>{
78
- var _column_props_width_endsWith, _column_props_width;
79
- let frKey;
80
- let frValue;
81
- minWidths.set(column.key, this.getDefaultMinWidth(collection.columns[i]));
82
- if (col !== column.key && !column.props.width && !(0, $9e5f6a0caf75716e$exports.isStatic)(uncontrolledWidths.get(column.key))) {
83
- // uncontrolled don't have props.width for us, so instead get from our state
84
- frKey = column.key;
85
- frValue = (0, $9e5f6a0caf75716e$exports.parseFractionalUnit)(uncontrolledWidths.get(column.key));
86
- } else if (col !== column.key && !(0, $9e5f6a0caf75716e$exports.isStatic)(column.props.width) && !uncontrolledWidths.get(column.key)) {
87
- // controlledWidths will be the same in the collection
88
- frKey = column.key;
89
- frValue = (0, $9e5f6a0caf75716e$exports.parseFractionalUnit)(column.props.width);
90
- } 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);
91
- // don't freeze columns to the right of the resizing one
92
- if (resizeIndex < i) {
93
- if (frKey) frKeysToTheRight.set(frKey, frValue);
94
- return;
95
- }
96
- // we already know the new size of the resizing column
97
- if (column.key === col) {
98
- resizeIndex = i;
99
- resizingChanged.set(column.key, Math.floor(width));
100
- return;
101
- }
102
- // freeze column to previous value
103
- resizingChanged.set(column.key, prevColumnWidths.get(column.key));
104
- });
105
- // predict pixels sizes for all columns based on resize
106
- let columnWidths = (0, $9e5f6a0caf75716e$exports.calculateColumnSizes)(tableWidth, collection.columns.map((col)=>({
107
- ...col.props,
108
- key: col.key
109
- })), resizingChanged, (i)=>this.getDefaultWidth(collection.columns[i]), (i)=>this.getDefaultMinWidth(collection.columns[i]));
110
- // set all new column widths for onResize event
111
- // columns going in will be the same order as the columns coming out
67
+ let freeze = true;
112
68
  let newWidths = new Map();
113
- // set all column widths based on calculateColumnSize
114
- columnWidths.forEach((width, index)=>{
115
- let key = collection.columns[index].key;
116
- newWidths.set(key, width);
117
- });
118
- // add FR's back as they were to columns to the right
119
- Array.from(frKeysToTheRight).forEach(([key])=>{
120
- newWidths.set(key, `${frKeysToTheRight.get(key)}fr`);
121
- });
122
- // put back in percents
123
- Array.from(percentKeys).forEach(([key, width])=>{
124
- // resizing locks a column to a px width
125
- if (key === col) return;
126
- newWidths.set(key, width);
69
+ width = Math.max(this.getColumnMinWidth(col), Math.min(this.getColumnMaxWidth(col), Math.floor(width)));
70
+ collection.columns.forEach((column)=>{
71
+ var _column_props_width;
72
+ if (column.key === col) {
73
+ newWidths.set(column.key, width);
74
+ freeze = false;
75
+ } else if (freeze) // freeze columns to the left to their previous pixel value
76
+ newWidths.set(column.key, prevColumnWidths.get(column.key));
77
+ else newWidths.set(column.key, (_column_props_width = column.props.width) !== null && _column_props_width !== void 0 ? _column_props_width : uncontrolledWidths.get(column.key));
127
78
  });
128
79
  return newWidths;
129
80
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAkBM,MAAM;IAYX,yHAAyH,GACzH,0CAA0C,OAA2B,EAAkD;QACrH,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK;YAC1B,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,MACrB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE;iBAEpB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE;YAEtB,OAAO;QACT,GAAG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\n * Copyright 2022 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 {\n calculateColumnSizes,\n getMaxWidth,\n getMinWidth,\n isStatic,\n parseFractionalUnit\n} from './TableUtils';\nimport {ColumnSize, TableCollection} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {Key} from '@react-types/shared';\n\nexport interface TableColumnLayoutOptions<T> {\n getDefaultWidth?: (column: GridNode<T>) => ColumnSize | null | undefined,\n getDefaultMinWidth?: (column: GridNode<T>) => ColumnSize | null | undefined\n}\n\nexport class TableColumnLayout<T> {\n getDefaultWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n getDefaultMinWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n columnWidths: Map<Key, number> = new Map();\n columnMinWidths: Map<Key, number> = new Map();\n columnMaxWidths: Map<Key, number> = new Map();\n\n constructor(options: TableColumnLayoutOptions<T>) {\n this.getDefaultWidth = options?.getDefaultWidth ?? (() => '1fr');\n this.getDefaultMinWidth = options?.getDefaultMinWidth ?? (() => 75);\n }\n\n /** Takes an array of columns and splits it into 2 maps of columns with controlled and columns with uncontrolled widths. */\n splitColumnsIntoControlledAndUncontrolled(columns: Array<GridNode<T>>): [Map<Key, GridNode<T>>, Map<Key, GridNode<T>>] {\n return columns.reduce((acc, col) => {\n if (col.props.width != null) {\n acc[0].set(col.key, col);\n } else {\n acc[1].set(col.key, col);\n }\n return acc;\n }, [new Map(), new Map()]);\n }\n\n /** Takes uncontrolled and controlled widths and joins them into a single Map. */\n recombineColumns(columns: Array<GridNode<T>>, uncontrolledWidths: Map<Key, ColumnSize>, uncontrolledColumns: Map<Key, GridNode<T>>, controlledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(columns.map(col => {\n if (uncontrolledColumns.has(col.key)) {\n return [col.key, uncontrolledWidths.get(col.key)];\n } else {\n return [col.key, controlledColumns.get(col.key).props.width];\n }\n }));\n }\n\n /** Used to make an initial Map of the uncontrolled widths based on default widths. */\n getInitialUncontrolledWidths(uncontrolledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(Array.from(uncontrolledColumns).map(([key, col]) =>\n [key, col.props.defaultWidth ?? this.getDefaultWidth?.(col) ?? '1fr']\n ));\n }\n\n getColumnWidth(key: Key): number {\n return this.columnWidths.get(key) ?? 0;\n }\n\n getColumnMinWidth(key: Key): number {\n return this.columnMinWidths.get(key) ?? 0;\n }\n\n getColumnMaxWidth(key: Key): number {\n return this.columnMaxWidths.get(key) ?? 0;\n }\n\n resizeColumnWidth(tableWidth: number, collection: TableCollection<T>, controlledWidths: Map<Key, ColumnSize>, uncontrolledWidths: Map<Key, ColumnSize>, col = null, width: number): Map<Key, ColumnSize> {\n let prevColumnWidths = this.columnWidths;\n // resizing a column\n let resizeIndex = Infinity;\n let resizingChanged = new Map<Key, ColumnSize>([...controlledWidths, ...uncontrolledWidths]);\n let percentKeys = new Map();\n let frKeysToTheRight = new Map();\n let minWidths = new Map();\n // freeze columns to the left to their previous pixel value\n collection.columns.forEach((column, i) => {\n let frKey;\n let frValue;\n minWidths.set(column.key, this.getDefaultMinWidth(collection.columns[i]));\n if (col !== column.key && !column.props.width && !isStatic(uncontrolledWidths.get(column.key))) {\n // uncontrolled don't have props.width for us, so instead get from our state\n frKey = column.key;\n frValue = parseFractionalUnit(uncontrolledWidths.get(column.key) as string);\n } else if (col !== column.key && !isStatic(column.props.width) && !uncontrolledWidths.get(column.key)) {\n // controlledWidths will be the same in the collection\n frKey = column.key;\n frValue = parseFractionalUnit(column.props.width);\n } else if (col !== column.key && column.props.width?.endsWith?.('%')) {\n percentKeys.set(column.key, column.props.width);\n }\n // don't freeze columns to the right of the resizing one\n if (resizeIndex < i) {\n if (frKey) {\n frKeysToTheRight.set(frKey, frValue);\n }\n return;\n }\n // we already know the new size of the resizing column\n if (column.key === col) {\n resizeIndex = i;\n resizingChanged.set(column.key, Math.floor(width));\n return;\n }\n // freeze column to previous value\n resizingChanged.set(column.key, prevColumnWidths.get(column.key));\n });\n\n // predict pixels sizes for all columns based on resize\n let columnWidths = calculateColumnSizes(\n tableWidth,\n collection.columns.map(col => ({...col.props, key: col.key})),\n resizingChanged,\n (i) => this.getDefaultWidth(collection.columns[i]),\n (i) => this.getDefaultMinWidth(collection.columns[i])\n );\n\n // set all new column widths for onResize event\n // columns going in will be the same order as the columns coming out\n let newWidths = new Map<Key, ColumnSize>();\n // set all column widths based on calculateColumnSize\n columnWidths.forEach((width, index) => {\n let key = collection.columns[index].key;\n newWidths.set(key, width);\n });\n\n // add FR's back as they were to columns to the right\n Array.from(frKeysToTheRight).forEach(([key]) => {\n newWidths.set(key, `${frKeysToTheRight.get(key)}fr`);\n });\n\n // put back in percents\n Array.from(percentKeys).forEach(([key, width]) => {\n // resizing locks a column to a px width\n if (key === col) {\n return;\n }\n newWidths.set(key, width);\n });\n return newWidths;\n }\n\n buildColumnWidths(tableWidth: number, collection: TableCollection<T>, widths: Map<Key, ColumnSize>) {\n this.columnWidths = new Map();\n this.columnMinWidths = new Map();\n this.columnMaxWidths = new Map();\n\n // initial layout or table/window resizing\n let columnWidths = calculateColumnSizes(\n tableWidth,\n collection.columns.map(col => ({...col.props, key: col.key})),\n widths,\n (i) => this.getDefaultWidth(collection.columns[i]),\n (i) => this.getDefaultMinWidth(collection.columns[i])\n );\n\n // columns going in will be the same order as the columns coming out\n columnWidths.forEach((width, index) => {\n let key = collection.columns[index].key;\n let column = collection.columns[index];\n this.columnWidths.set(key, width);\n this.columnMinWidths.set(key, getMinWidth(column.props.minWidth ?? this.getDefaultMinWidth(column), tableWidth));\n this.columnMaxWidths.set(key, getM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,eAAe,CAAA,GAAA,8CAAmB,EACpC,YACA,WAAW,OAAO,CAAC,GAAG,CAAC,CAAA,MAAQ,CAAA;gBAAC,GAAG,IAAI,KAAK;gBAAE,KAAK,IAAI,GAAG;YAAA,CAAA,IAC1D,QACA,CAAC,IAAM,IAAI,CAAC,eAAe,CAAC,WAAW,OAAO,CAAC,EAAE,GACjD,CAAC,IAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,OAAO,CAAC,EAAE;QAGtD,oEAAoE;QACpE,aAAa,OAAO,CAAC,CAAC,OAAO;YAC3B,IAAI,MAAM,WAAW,OAAO,CAAC,MAAM,CAAC,GAAG;YACvC,IAAI,SAAS,WAAW,OAAO,CAAC,MAAM;YACtC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK;gBACe;YAA1C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAA,GAAA,qCAAU,EAAE,CAAA,yBAAA,OAAO,KAAK,CAAC,QAAQ,cAArB,oCAAA,yBAAyB,IAAI,CAAC,kBAAkB,CAAC,SAAS;YACpG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAA,GAAA,qCAAU,EAAE,OAAO,KAAK,CAAC,QAAQ,EAAE;QACnE;QACA,OAAO,IAAI,CAAC,YAAY;IAC1B;IA5FA,YAAY,OAAoC,CAAE;aAJlD,eAAiC,IAAI;aACrC,kBAAoC,IAAI;aACxC,kBAAoC,IAAI;YAGf;QAAvB,IAAI,CAAC,eAAe,GAAG,CAAA,2BAAA,oBAAA,8BAAA,QAAS,eAAe,cAAxB,sCAAA,2BAA6B,IAAM;YAChC;QAA1B,IAAI,CAAC,kBAAkB,GAAG,CAAA,8BAAA,oBAAA,8BAAA,QAAS,kBAAkB,cAA3B,yCAAA,8BAAgC,IAAM;IAClE;AA0FF","sources":["packages/@react-stately/table/src/TableColumnLayout.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {\n calculateColumnSizes,\n getMaxWidth,\n getMinWidth\n} from './TableUtils';\nimport {ColumnSize, TableCollection} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {Key} from '@react-types/shared';\n\nexport interface TableColumnLayoutOptions<T> {\n getDefaultWidth?: (column: GridNode<T>) => ColumnSize | null | undefined,\n getDefaultMinWidth?: (column: GridNode<T>) => ColumnSize | null | undefined\n}\n\nexport class TableColumnLayout<T> {\n getDefaultWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n getDefaultMinWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n columnWidths: Map<Key, number> = new Map();\n columnMinWidths: Map<Key, number> = new Map();\n columnMaxWidths: Map<Key, number> = new Map();\n\n constructor(options: TableColumnLayoutOptions<T>) {\n this.getDefaultWidth = options?.getDefaultWidth ?? (() => '1fr');\n this.getDefaultMinWidth = options?.getDefaultMinWidth ?? (() => 75);\n }\n\n /** Takes an array of columns and splits it into 2 maps of columns with controlled and columns with uncontrolled widths. */\n splitColumnsIntoControlledAndUncontrolled(columns: Array<GridNode<T>>): [Map<Key, GridNode<T>>, Map<Key, GridNode<T>>] {\n return columns.reduce((acc, col) => {\n if (col.props.width != null) {\n acc[0].set(col.key, col);\n } else {\n acc[1].set(col.key, col);\n }\n return acc;\n }, [new Map(), new Map()]);\n }\n\n /** Takes uncontrolled and controlled widths and joins them into a single Map. */\n recombineColumns(columns: Array<GridNode<T>>, uncontrolledWidths: Map<Key, ColumnSize>, uncontrolledColumns: Map<Key, GridNode<T>>, controlledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(columns.map(col => {\n if (uncontrolledColumns.has(col.key)) {\n return [col.key, uncontrolledWidths.get(col.key)];\n } else {\n return [col.key, controlledColumns.get(col.key).props.width];\n }\n }));\n }\n\n /** Used to make an initial Map of the uncontrolled widths based on default widths. */\n getInitialUncontrolledWidths(uncontrolledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(Array.from(uncontrolledColumns).map(([key, col]) =>\n [key, col.props.defaultWidth ?? this.getDefaultWidth?.(col) ?? '1fr']\n ));\n }\n\n getColumnWidth(key: Key): number {\n return this.columnWidths.get(key) ?? 0;\n }\n\n getColumnMinWidth(key: Key): number {\n return this.columnMinWidths.get(key) ?? 0;\n }\n\n getColumnMaxWidth(key: Key): number {\n return this.columnMaxWidths.get(key) ?? 0;\n }\n\n resizeColumnWidth(collection: TableCollection<T>, uncontrolledWidths: Map<Key, ColumnSize>, col: Key, width: number): Map<Key, ColumnSize> {\n let prevColumnWidths = this.columnWidths;\n let freeze = true;\n let newWidths = new Map<Key, ColumnSize>();\n\n width = Math.max(this.getColumnMinWidth(col), Math.min(this.getColumnMaxWidth(col), Math.floor(width)));\n\n collection.columns.forEach(column => {\n if (column.key === col) {\n newWidths.set(column.key, width);\n freeze = false;\n } else if (freeze) {\n // freeze columns to the left to their previous pixel value\n newWidths.set(column.key, prevColumnWidths.get(column.key));\n } else {\n newWidths.set(column.key, column.props.width ?? uncontrolledWidths.get(column.key));\n }\n });\n\n return newWidths;\n }\n\n buildColumnWidths(tableWidth: number, collection: TableCollection<T>, widths: Map<Key, ColumnSize>) {\n this.columnWidths = new Map();\n this.columnMinWidths = new Map();\n this.columnMaxWidths = new Map();\n\n // initial layout or table/window resizing\n let columnWidths = calculateColumnSizes(\n tableWidth,\n collection.columns.map(col => ({...col.props, key: col.key})),\n widths,\n (i) => this.getDefaultWidth(collection.columns[i]),\n (i) => this.getDefaultMinWidth(collection.columns[i])\n );\n\n // columns going in will be the same order as the columns coming out\n columnWidths.forEach((width, index) => {\n let key = collection.columns[index].key;\n let column = collection.columns[index];\n this.columnWidths.set(key, width);\n this.columnMinWidths.set(key, getMinWidth(column.props.minWidth ?? this.getDefaultMinWidth(column), tableWidth));\n this.columnMaxWidths.set(key, getMaxWidth(column.props.maxWidth, tableWidth));\n });\n return this.columnWidths;\n }\n}\n"],"names":[],"version":3,"file":"TableColumnLayout.main.js.map"}
@@ -1,4 +1,4 @@
1
- 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.mjs";
1
+ import {calculateColumnSizes as $6818b1c4fc67028d$export$55d50dc687385491, getMaxWidth as $6818b1c4fc67028d$export$59185c62a7544aa0, getMinWidth as $6818b1c4fc67028d$export$f556054ce4358701} from "./TableUtils.mjs";
2
2
 
3
3
  /*
4
4
  * Copyright 2022 Adobe. All rights reserved.
@@ -56,68 +56,19 @@ class $a9e7ae544a4e41dd$export$7ff77a162970b30e {
56
56
  var _this_columnMaxWidths_get;
57
57
  return (_this_columnMaxWidths_get = this.columnMaxWidths.get(key)) !== null && _this_columnMaxWidths_get !== void 0 ? _this_columnMaxWidths_get : 0;
58
58
  }
59
- resizeColumnWidth(tableWidth, collection, controlledWidths, uncontrolledWidths, col = null, width) {
59
+ resizeColumnWidth(collection, uncontrolledWidths, col, width) {
60
60
  let prevColumnWidths = this.columnWidths;
61
- // resizing a column
62
- let resizeIndex = Infinity;
63
- let resizingChanged = new Map([
64
- ...controlledWidths,
65
- ...uncontrolledWidths
66
- ]);
67
- let percentKeys = new Map();
68
- let frKeysToTheRight = new Map();
69
- let minWidths = new Map();
70
- // freeze columns to the left to their previous pixel value
71
- collection.columns.forEach((column, i)=>{
72
- var _column_props_width_endsWith, _column_props_width;
73
- let frKey;
74
- let frValue;
75
- minWidths.set(column.key, this.getDefaultMinWidth(collection.columns[i]));
76
- if (col !== column.key && !column.props.width && !(0, $6818b1c4fc67028d$export$1994a077b98ee0d5)(uncontrolledWidths.get(column.key))) {
77
- // uncontrolled don't have props.width for us, so instead get from our state
78
- frKey = column.key;
79
- frValue = (0, $6818b1c4fc67028d$export$9078bad4c3934604)(uncontrolledWidths.get(column.key));
80
- } else if (col !== column.key && !(0, $6818b1c4fc67028d$export$1994a077b98ee0d5)(column.props.width) && !uncontrolledWidths.get(column.key)) {
81
- // controlledWidths will be the same in the collection
82
- frKey = column.key;
83
- frValue = (0, $6818b1c4fc67028d$export$9078bad4c3934604)(column.props.width);
84
- } 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);
85
- // don't freeze columns to the right of the resizing one
86
- if (resizeIndex < i) {
87
- if (frKey) frKeysToTheRight.set(frKey, frValue);
88
- return;
89
- }
90
- // we already know the new size of the resizing column
91
- if (column.key === col) {
92
- resizeIndex = i;
93
- resizingChanged.set(column.key, Math.floor(width));
94
- return;
95
- }
96
- // freeze column to previous value
97
- resizingChanged.set(column.key, prevColumnWidths.get(column.key));
98
- });
99
- // predict pixels sizes for all columns based on resize
100
- let columnWidths = (0, $6818b1c4fc67028d$export$55d50dc687385491)(tableWidth, collection.columns.map((col)=>({
101
- ...col.props,
102
- key: col.key
103
- })), resizingChanged, (i)=>this.getDefaultWidth(collection.columns[i]), (i)=>this.getDefaultMinWidth(collection.columns[i]));
104
- // set all new column widths for onResize event
105
- // columns going in will be the same order as the columns coming out
61
+ let freeze = true;
106
62
  let newWidths = new Map();
107
- // set all column widths based on calculateColumnSize
108
- columnWidths.forEach((width, index)=>{
109
- let key = collection.columns[index].key;
110
- newWidths.set(key, width);
111
- });
112
- // add FR's back as they were to columns to the right
113
- Array.from(frKeysToTheRight).forEach(([key])=>{
114
- newWidths.set(key, `${frKeysToTheRight.get(key)}fr`);
115
- });
116
- // put back in percents
117
- Array.from(percentKeys).forEach(([key, width])=>{
118
- // resizing locks a column to a px width
119
- if (key === col) return;
120
- newWidths.set(key, width);
63
+ width = Math.max(this.getColumnMinWidth(col), Math.min(this.getColumnMaxWidth(col), Math.floor(width)));
64
+ collection.columns.forEach((column)=>{
65
+ var _column_props_width;
66
+ if (column.key === col) {
67
+ newWidths.set(column.key, width);
68
+ freeze = false;
69
+ } else if (freeze) // freeze columns to the left to their previous pixel value
70
+ newWidths.set(column.key, prevColumnWidths.get(column.key));
71
+ else newWidths.set(column.key, (_column_props_width = column.props.width) !== null && _column_props_width !== void 0 ? _column_props_width : uncontrolledWidths.get(column.key));
121
72
  });
122
73
  return newWidths;
123
74
  }
@@ -1,4 +1,4 @@
1
- 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";
1
+ import {calculateColumnSizes as $6818b1c4fc67028d$export$55d50dc687385491, getMaxWidth as $6818b1c4fc67028d$export$59185c62a7544aa0, getMinWidth as $6818b1c4fc67028d$export$f556054ce4358701} from "./TableUtils.module.js";
2
2
 
3
3
  /*
4
4
  * Copyright 2022 Adobe. All rights reserved.
@@ -56,68 +56,19 @@ class $a9e7ae544a4e41dd$export$7ff77a162970b30e {
56
56
  var _this_columnMaxWidths_get;
57
57
  return (_this_columnMaxWidths_get = this.columnMaxWidths.get(key)) !== null && _this_columnMaxWidths_get !== void 0 ? _this_columnMaxWidths_get : 0;
58
58
  }
59
- resizeColumnWidth(tableWidth, collection, controlledWidths, uncontrolledWidths, col = null, width) {
59
+ resizeColumnWidth(collection, uncontrolledWidths, col, width) {
60
60
  let prevColumnWidths = this.columnWidths;
61
- // resizing a column
62
- let resizeIndex = Infinity;
63
- let resizingChanged = new Map([
64
- ...controlledWidths,
65
- ...uncontrolledWidths
66
- ]);
67
- let percentKeys = new Map();
68
- let frKeysToTheRight = new Map();
69
- let minWidths = new Map();
70
- // freeze columns to the left to their previous pixel value
71
- collection.columns.forEach((column, i)=>{
72
- var _column_props_width_endsWith, _column_props_width;
73
- let frKey;
74
- let frValue;
75
- minWidths.set(column.key, this.getDefaultMinWidth(collection.columns[i]));
76
- if (col !== column.key && !column.props.width && !(0, $6818b1c4fc67028d$export$1994a077b98ee0d5)(uncontrolledWidths.get(column.key))) {
77
- // uncontrolled don't have props.width for us, so instead get from our state
78
- frKey = column.key;
79
- frValue = (0, $6818b1c4fc67028d$export$9078bad4c3934604)(uncontrolledWidths.get(column.key));
80
- } else if (col !== column.key && !(0, $6818b1c4fc67028d$export$1994a077b98ee0d5)(column.props.width) && !uncontrolledWidths.get(column.key)) {
81
- // controlledWidths will be the same in the collection
82
- frKey = column.key;
83
- frValue = (0, $6818b1c4fc67028d$export$9078bad4c3934604)(column.props.width);
84
- } 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);
85
- // don't freeze columns to the right of the resizing one
86
- if (resizeIndex < i) {
87
- if (frKey) frKeysToTheRight.set(frKey, frValue);
88
- return;
89
- }
90
- // we already know the new size of the resizing column
91
- if (column.key === col) {
92
- resizeIndex = i;
93
- resizingChanged.set(column.key, Math.floor(width));
94
- return;
95
- }
96
- // freeze column to previous value
97
- resizingChanged.set(column.key, prevColumnWidths.get(column.key));
98
- });
99
- // predict pixels sizes for all columns based on resize
100
- let columnWidths = (0, $6818b1c4fc67028d$export$55d50dc687385491)(tableWidth, collection.columns.map((col)=>({
101
- ...col.props,
102
- key: col.key
103
- })), resizingChanged, (i)=>this.getDefaultWidth(collection.columns[i]), (i)=>this.getDefaultMinWidth(collection.columns[i]));
104
- // set all new column widths for onResize event
105
- // columns going in will be the same order as the columns coming out
61
+ let freeze = true;
106
62
  let newWidths = new Map();
107
- // set all column widths based on calculateColumnSize
108
- columnWidths.forEach((width, index)=>{
109
- let key = collection.columns[index].key;
110
- newWidths.set(key, width);
111
- });
112
- // add FR's back as they were to columns to the right
113
- Array.from(frKeysToTheRight).forEach(([key])=>{
114
- newWidths.set(key, `${frKeysToTheRight.get(key)}fr`);
115
- });
116
- // put back in percents
117
- Array.from(percentKeys).forEach(([key, width])=>{
118
- // resizing locks a column to a px width
119
- if (key === col) return;
120
- newWidths.set(key, width);
63
+ width = Math.max(this.getColumnMinWidth(col), Math.min(this.getColumnMaxWidth(col), Math.floor(width)));
64
+ collection.columns.forEach((column)=>{
65
+ var _column_props_width;
66
+ if (column.key === col) {
67
+ newWidths.set(column.key, width);
68
+ freeze = false;
69
+ } else if (freeze) // freeze columns to the left to their previous pixel value
70
+ newWidths.set(column.key, prevColumnWidths.get(column.key));
71
+ else newWidths.set(column.key, (_column_props_width = column.props.width) !== null && _column_props_width !== void 0 ? _column_props_width : uncontrolledWidths.get(column.key));
121
72
  });
122
73
  return newWidths;
123
74
  }
@@ -1 +1 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAkBM,MAAM;IAYX,yHAAyH,GACzH,0CAA0C,OAA2B,EAAkD;QACrH,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK;YAC1B,IAAI,IAAI,KAAK,CAAC,KAAK,IAAI,MACrB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE;iBAEpB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE;YAEtB,OAAO;QACT,GAAG;YAAC,IAAI;YAAO,IAAI;SAAM;IAC3B;IAEA,+EAA+E,GAC/E,iBAAiB,OAA2B,EAAE,kBAA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pC,YACA,WAAW,OAAO,CAAC,GAAG,CAAC,CAAA,MAAQ,CAAA;gBAAC,GAAG,IAAI,KAAK;gBAAE,KAAK,IAAI,GAAG;YAAA,CAAA,IAC1D,QACA,CAAC,IAAM,IAAI,CAAC,eAAe,CAAC,WAAW,OAAO,CAAC,EAAE,GACjD,CAAC,IAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,OAAO,CAAC,EAAE;QAGtD,oEAAoE;QACpE,aAAa,OAAO,CAAC,CAAC,OAAO;YAC3B,IAAI,MAAM,WAAW,OAAO,CAAC,MAAM,CAAC,GAAG;YACvC,IAAI,SAAS,WAAW,OAAO,CAAC,MAAM;YACtC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK;gBACe;YAA1C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAA,GAAA,yCAAU,EAAE,CAAA,yBAAA,OAAO,KAAK,CAAC,QAAQ,cAArB,oCAAA,yBAAyB,IAAI,CAAC,kBAAkB,CAAC,SAAS;YACpG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAA,GAAA,yCAAU,EAAE,OAAO,KAAK,CAAC,QAAQ,EAAE;QACnE;QACA,OAAO,IAAI,CAAC,YAAY;IAC1B;IAjJA,YAAY,OAAoC,CAAE;aAJlD,eAAiC,IAAI;aACrC,kBAAoC,IAAI;aACxC,kBAAoC,IAAI;YAGf;QAAvB,IAAI,CAAC,eAAe,GAAG,CAAA,2BAAA,oBAAA,8BAAA,QAAS,eAAe,cAAxB,sCAAA,2BAA6B,IAAM;YAChC;QAA1B,IAAI,CAAC,kBAAkB,GAAG,CAAA,8BAAA,oBAAA,8BAAA,QAAS,kBAAkB,cAA3B,yCAAA,8BAAgC,IAAM;IAClE;AA+IF","sources":["packages/@react-stately/table/src/TableColumnLayout.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {\n calculateColumnSizes,\n getMaxWidth,\n getMinWidth,\n isStatic,\n parseFractionalUnit\n} from './TableUtils';\nimport {ColumnSize, TableCollection} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {Key} from '@react-types/shared';\n\nexport interface TableColumnLayoutOptions<T> {\n getDefaultWidth?: (column: GridNode<T>) => ColumnSize | null | undefined,\n getDefaultMinWidth?: (column: GridNode<T>) => ColumnSize | null | undefined\n}\n\nexport class TableColumnLayout<T> {\n getDefaultWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n getDefaultMinWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n columnWidths: Map<Key, number> = new Map();\n columnMinWidths: Map<Key, number> = new Map();\n columnMaxWidths: Map<Key, number> = new Map();\n\n constructor(options: TableColumnLayoutOptions<T>) {\n this.getDefaultWidth = options?.getDefaultWidth ?? (() => '1fr');\n this.getDefaultMinWidth = options?.getDefaultMinWidth ?? (() => 75);\n }\n\n /** Takes an array of columns and splits it into 2 maps of columns with controlled and columns with uncontrolled widths. */\n splitColumnsIntoControlledAndUncontrolled(columns: Array<GridNode<T>>): [Map<Key, GridNode<T>>, Map<Key, GridNode<T>>] {\n return columns.reduce((acc, col) => {\n if (col.props.width != null) {\n acc[0].set(col.key, col);\n } else {\n acc[1].set(col.key, col);\n }\n return acc;\n }, [new Map(), new Map()]);\n }\n\n /** Takes uncontrolled and controlled widths and joins them into a single Map. */\n recombineColumns(columns: Array<GridNode<T>>, uncontrolledWidths: Map<Key, ColumnSize>, uncontrolledColumns: Map<Key, GridNode<T>>, controlledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(columns.map(col => {\n if (uncontrolledColumns.has(col.key)) {\n return [col.key, uncontrolledWidths.get(col.key)];\n } else {\n return [col.key, controlledColumns.get(col.key).props.width];\n }\n }));\n }\n\n /** Used to make an initial Map of the uncontrolled widths based on default widths. */\n getInitialUncontrolledWidths(uncontrolledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(Array.from(uncontrolledColumns).map(([key, col]) =>\n [key, col.props.defaultWidth ?? this.getDefaultWidth?.(col) ?? '1fr']\n ));\n }\n\n getColumnWidth(key: Key): number {\n return this.columnWidths.get(key) ?? 0;\n }\n\n getColumnMinWidth(key: Key): number {\n return this.columnMinWidths.get(key) ?? 0;\n }\n\n getColumnMaxWidth(key: Key): number {\n return this.columnMaxWidths.get(key) ?? 0;\n }\n\n resizeColumnWidth(tableWidth: number, collection: TableCollection<T>, controlledWidths: Map<Key, ColumnSize>, uncontrolledWidths: Map<Key, ColumnSize>, col = null, width: number): Map<Key, ColumnSize> {\n let prevColumnWidths = this.columnWidths;\n // resizing a column\n let resizeIndex = Infinity;\n let resizingChanged = new Map<Key, ColumnSize>([...controlledWidths, ...uncontrolledWidths]);\n let percentKeys = new Map();\n let frKeysToTheRight = new Map();\n let minWidths = new Map();\n // freeze columns to the left to their previous pixel value\n collection.columns.forEach((column, i) => {\n let frKey;\n let frValue;\n minWidths.set(column.key, this.getDefaultMinWidth(collection.columns[i]));\n if (col !== column.key && !column.props.width && !isStatic(uncontrolledWidths.get(column.key))) {\n // uncontrolled don't have props.width for us, so instead get from our state\n frKey = column.key;\n frValue = parseFractionalUnit(uncontrolledWidths.get(column.key) as string);\n } else if (col !== column.key && !isStatic(column.props.width) && !uncontrolledWidths.get(column.key)) {\n // controlledWidths will be the same in the collection\n frKey = column.key;\n frValue = parseFractionalUnit(column.props.width);\n } else if (col !== column.key && column.props.width?.endsWith?.('%')) {\n percentKeys.set(column.key, column.props.width);\n }\n // don't freeze columns to the right of the resizing one\n if (resizeIndex < i) {\n if (frKey) {\n frKeysToTheRight.set(frKey, frValue);\n }\n return;\n }\n // we already know the new size of the resizing column\n if (column.key === col) {\n resizeIndex = i;\n resizingChanged.set(column.key, Math.floor(width));\n return;\n }\n // freeze column to previous value\n resizingChanged.set(column.key, prevColumnWidths.get(column.key));\n });\n\n // predict pixels sizes for all columns based on resize\n let columnWidths = calculateColumnSizes(\n tableWidth,\n collection.columns.map(col => ({...col.props, key: col.key})),\n resizingChanged,\n (i) => this.getDefaultWidth(collection.columns[i]),\n (i) => this.getDefaultMinWidth(collection.columns[i])\n );\n\n // set all new column widths for onResize event\n // columns going in will be the same order as the columns coming out\n let newWidths = new Map<Key, ColumnSize>();\n // set all column widths based on calculateColumnSize\n columnWidths.forEach((width, index) => {\n let key = collection.columns[index].key;\n newWidths.set(key, width);\n });\n\n // add FR's back as they were to columns to the right\n Array.from(frKeysToTheRight).forEach(([key]) => {\n newWidths.set(key, `${frKeysToTheRight.get(key)}fr`);\n });\n\n // put back in percents\n Array.from(percentKeys).forEach(([key, width]) => {\n // resizing locks a column to a px width\n if (key === col) {\n return;\n }\n newWidths.set(key, width);\n });\n return newWidths;\n }\n\n buildColumnWidths(tableWidth: number, collection: TableCollection<T>, widths: Map<Key, ColumnSize>) {\n this.columnWidths = new Map();\n this.columnMinWidths = new Map();\n this.columnMaxWidths = new Map();\n\n // initial layout or table/window resizing\n let columnWidths = calculateColumnSizes(\n tableWidth,\n collection.columns.map(col => ({...col.props, key: col.key})),\n widths,\n (i) => this.getDefaultWidth(collection.columns[i]),\n (i) => this.getDefaultMinWidth(collection.columns[i])\n );\n\n // columns going in will be the same order as the columns coming out\n columnWidths.forEach((width, index) => {\n let key = collection.columns[index].key;\n let column = collection.columns[index];\n this.columnWidths.set(key, width);\n this.columnMinWidths.set(key, getMinWidth(column.props.minWidth ?? this.getDefaultMinWidth(column), tableWidth));\n this.columnMaxWidths.set(key, getMaxWidth(column.props.maxWidth, tableWidth));\n });\n return this.columnWidths;\n }\n}\n"],"names":[],"version":3,"file":"TableColumnLayout.module.js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,GAAG,IAAI,KAAK;gBAAE,KAAK,IAAI,GAAG;YAAA,CAAA,IAC1D,QACA,CAAC,IAAM,IAAI,CAAC,eAAe,CAAC,WAAW,OAAO,CAAC,EAAE,GACjD,CAAC,IAAM,IAAI,CAAC,kBAAkB,CAAC,WAAW,OAAO,CAAC,EAAE;QAGtD,oEAAoE;QACpE,aAAa,OAAO,CAAC,CAAC,OAAO;YAC3B,IAAI,MAAM,WAAW,OAAO,CAAC,MAAM,CAAC,GAAG;YACvC,IAAI,SAAS,WAAW,OAAO,CAAC,MAAM;YACtC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK;gBACe;YAA1C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAA,GAAA,yCAAU,EAAE,CAAA,yBAAA,OAAO,KAAK,CAAC,QAAQ,cAArB,oCAAA,yBAAyB,IAAI,CAAC,kBAAkB,CAAC,SAAS;YACpG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAK,CAAA,GAAA,yCAAU,EAAE,OAAO,KAAK,CAAC,QAAQ,EAAE;QACnE;QACA,OAAO,IAAI,CAAC,YAAY;IAC1B;IA5FA,YAAY,OAAoC,CAAE;aAJlD,eAAiC,IAAI;aACrC,kBAAoC,IAAI;aACxC,kBAAoC,IAAI;YAGf;QAAvB,IAAI,CAAC,eAAe,GAAG,CAAA,2BAAA,oBAAA,8BAAA,QAAS,eAAe,cAAxB,sCAAA,2BAA6B,IAAM;YAChC;QAA1B,IAAI,CAAC,kBAAkB,GAAG,CAAA,8BAAA,oBAAA,8BAAA,QAAS,kBAAkB,cAA3B,yCAAA,8BAAgC,IAAM;IAClE;AA0FF","sources":["packages/@react-stately/table/src/TableColumnLayout.ts"],"sourcesContent":["/*\n * Copyright 2022 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 {\n calculateColumnSizes,\n getMaxWidth,\n getMinWidth\n} from './TableUtils';\nimport {ColumnSize, TableCollection} from '@react-types/table';\nimport {GridNode} from '@react-types/grid';\nimport {Key} from '@react-types/shared';\n\nexport interface TableColumnLayoutOptions<T> {\n getDefaultWidth?: (column: GridNode<T>) => ColumnSize | null | undefined,\n getDefaultMinWidth?: (column: GridNode<T>) => ColumnSize | null | undefined\n}\n\nexport class TableColumnLayout<T> {\n getDefaultWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n getDefaultMinWidth: (column: GridNode<T>) => ColumnSize | null | undefined;\n columnWidths: Map<Key, number> = new Map();\n columnMinWidths: Map<Key, number> = new Map();\n columnMaxWidths: Map<Key, number> = new Map();\n\n constructor(options: TableColumnLayoutOptions<T>) {\n this.getDefaultWidth = options?.getDefaultWidth ?? (() => '1fr');\n this.getDefaultMinWidth = options?.getDefaultMinWidth ?? (() => 75);\n }\n\n /** Takes an array of columns and splits it into 2 maps of columns with controlled and columns with uncontrolled widths. */\n splitColumnsIntoControlledAndUncontrolled(columns: Array<GridNode<T>>): [Map<Key, GridNode<T>>, Map<Key, GridNode<T>>] {\n return columns.reduce((acc, col) => {\n if (col.props.width != null) {\n acc[0].set(col.key, col);\n } else {\n acc[1].set(col.key, col);\n }\n return acc;\n }, [new Map(), new Map()]);\n }\n\n /** Takes uncontrolled and controlled widths and joins them into a single Map. */\n recombineColumns(columns: Array<GridNode<T>>, uncontrolledWidths: Map<Key, ColumnSize>, uncontrolledColumns: Map<Key, GridNode<T>>, controlledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(columns.map(col => {\n if (uncontrolledColumns.has(col.key)) {\n return [col.key, uncontrolledWidths.get(col.key)];\n } else {\n return [col.key, controlledColumns.get(col.key).props.width];\n }\n }));\n }\n\n /** Used to make an initial Map of the uncontrolled widths based on default widths. */\n getInitialUncontrolledWidths(uncontrolledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {\n return new Map(Array.from(uncontrolledColumns).map(([key, col]) =>\n [key, col.props.defaultWidth ?? this.getDefaultWidth?.(col) ?? '1fr']\n ));\n }\n\n getColumnWidth(key: Key): number {\n return this.columnWidths.get(key) ?? 0;\n }\n\n getColumnMinWidth(key: Key): number {\n return this.columnMinWidths.get(key) ?? 0;\n }\n\n getColumnMaxWidth(key: Key): number {\n return this.columnMaxWidths.get(key) ?? 0;\n }\n\n resizeColumnWidth(collection: TableCollection<T>, uncontrolledWidths: Map<Key, ColumnSize>, col: Key, width: number): Map<Key, ColumnSize> {\n let prevColumnWidths = this.columnWidths;\n let freeze = true;\n let newWidths = new Map<Key, ColumnSize>();\n\n width = Math.max(this.getColumnMinWidth(col), Math.min(this.getColumnMaxWidth(col), Math.floor(width)));\n\n collection.columns.forEach(column => {\n if (column.key === col) {\n newWidths.set(column.key, width);\n freeze = false;\n } else if (freeze) {\n // freeze columns to the left to their previous pixel value\n newWidths.set(column.key, prevColumnWidths.get(column.key));\n } else {\n newWidths.set(column.key, column.props.width ?? uncontrolledWidths.get(column.key));\n }\n });\n\n return newWidths;\n }\n\n buildColumnWidths(tableWidth: number, collection: TableCollection<T>, widths: Map<Key, ColumnSize>) {\n this.columnWidths = new Map();\n this.columnMinWidths = new Map();\n this.columnMaxWidths = new Map();\n\n // initial layout or table/window resizing\n let columnWidths = calculateColumnSizes(\n tableWidth,\n collection.columns.map(col => ({...col.props, key: col.key})),\n widths,\n (i) => this.getDefaultWidth(collection.columns[i]),\n (i) => this.getDefaultMinWidth(collection.columns[i])\n );\n\n // columns going in will be the same order as the columns coming out\n columnWidths.forEach((width, index) => {\n let key = collection.columns[index].key;\n let column = collection.columns[index];\n this.columnWidths.set(key, width);\n this.columnMinWidths.set(key, getMinWidth(column.props.minWidth ?? this.getDefaultMinWidth(column), tableWidth));\n this.columnMaxWidths.set(key, getMaxWidth(column.props.maxWidth, tableWidth));\n });\n return this.columnWidths;\n }\n}\n"],"names":[],"version":3,"file":"TableColumnLayout.module.js.map"}
@@ -3,8 +3,6 @@ function $parcel$export(e, n, v, s) {
3
3
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
4
  }
5
5
 
6
- $parcel$export(module.exports, "isStatic", () => $9e5f6a0caf75716e$export$1994a077b98ee0d5);
7
- $parcel$export(module.exports, "parseFractionalUnit", () => $9e5f6a0caf75716e$export$9078bad4c3934604);
8
6
  $parcel$export(module.exports, "getMaxWidth", () => $9e5f6a0caf75716e$export$59185c62a7544aa0);
9
7
  $parcel$export(module.exports, "getMinWidth", () => $9e5f6a0caf75716e$export$f556054ce4358701);
10
8
  $parcel$export(module.exports, "calculateColumnSizes", () => $9e5f6a0caf75716e$export$55d50dc687385491);