@react-stately/layout 4.3.1 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GridLayout.main.js +21 -10
- package/dist/GridLayout.main.js.map +1 -1
- package/dist/GridLayout.mjs +21 -10
- package/dist/GridLayout.module.js +21 -10
- package/dist/GridLayout.module.js.map +1 -1
- package/dist/ListLayout.main.js +40 -17
- package/dist/ListLayout.main.js.map +1 -1
- package/dist/ListLayout.mjs +40 -17
- package/dist/ListLayout.module.js +40 -17
- package/dist/ListLayout.module.js.map +1 -1
- package/dist/TableLayout.main.js +3 -3
- package/dist/TableLayout.main.js.map +1 -1
- package/dist/TableLayout.mjs +3 -3
- package/dist/TableLayout.module.js +3 -3
- package/dist/TableLayout.module.js.map +1 -1
- package/dist/WaterfallLayout.main.js +12 -8
- package/dist/WaterfallLayout.main.js.map +1 -1
- package/dist/WaterfallLayout.mjs +12 -8
- package/dist/WaterfallLayout.module.js +12 -8
- package/dist/WaterfallLayout.module.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/GridLayout.ts +28 -8
- package/src/ListLayout.ts +40 -18
- package/src/TableLayout.ts +7 -7
- package/src/WaterfallLayout.ts +17 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAcD,MAAM,2CAAqB;AAMpB,MAAM,kDAAsE,CAAA,GAAA,oCAAS;IAY1F,0CAA0C;IAC1C,IAAc,aAAiC;QAC7C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEQ,eAAe,aAAiC,EAAE,aAAwC,EAAE;QAClG,OAAO,CAAC,iBACN,cAAc,OAAO,KAAK,cAAc,OAAO,IAC/C,cAAc,OAAO,CAAC,MAAM,KAAK,cAAc,OAAO,CAAC,MAAM,IAC7D,cAAc,OAAO,CAAC,IAAI,CAAC,CAAC,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oC;QACpC,IAAI,CAAC,kBAAkB,SAAS;YAC9B,IAAI,KAAK,KAAK,CAAC,GAAG,KAAK,MAAM,GAAG,KAAK,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAQ,IACvF,OAAO,YAAY,GAAG;iBACjB,IAAI,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAO,IAC5D,OAAO,YAAY,GAAG;QAE1B,OAAO,IAAI,KAAK,KAAK,CAAC,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAQ,IACjF,OAAO,YAAY,GAAG;aACjB,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAO,IACnF,OAAO,YAAY,GAAG;QAGxB,OAAO;IACT;IAEA,wBAAwB,MAAsB,EAAc;QAC1D,IAAI,aAAa,KAAK,CAAC,wBAAwB;QAC/C,WAAW,SAAS,GAAG,AAAC,IAAI,CAAC,WAAW,CAAE,UAAU,CAAwB,IAAI,CAAC,GAAG;QACpF,OAAO;IACT;IAnlBA,YAAY,OAA2B,CAAE;QACvC,KAAK,CAAC,eAPE,iBAA4C,WAC9C,eAAiC,IAAI,YAErC,oBAAqC,WACrC,mBAAuC,IAAI;QAIjD,IAAI,CAAC,mBAAmB,GAAG,EAAE;IAC/B;AAilBF","sources":["packages/@react-stately/layout/src/TableLayout.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 {DropTarget, ItemDropTarget, Key} from '@react-types/shared';\nimport {getChildNodes, getLastItem} from '@react-stately/collections';\nimport {GridNode} from '@react-types/grid';\nimport {InvalidationContext, LayoutInfo, Point, Rect, Size} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from './ListLayout';\nimport {TableCollection} from '@react-types/table';\nimport {TableColumnLayout} from '@react-stately/table';\n\nexport interface TableLayoutProps extends ListLayoutOptions {\n columnWidths?: Map<Key, number>\n}\n\nconst DEFAULT_ROW_HEIGHT = 48;\n\n/**\n * TableLayout is a virtualizer Layout implementation that arranges\n * items in rows and columns.\n */\nexport class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<T, O> {\n protected lastCollection: TableCollection<T> | null = null;\n private columnWidths: Map<Key, number> = new Map();\n private stickyColumnIndices: number[];\n private lastPersistedKeys: Set<Key> | null = null;\n private persistedIndices: Map<Key, number[]> = new Map();\n\n constructor(options?: ListLayoutOptions) {\n super(options);\n this.stickyColumnIndices = [];\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): TableCollection<T> {\n return this.virtualizer!.collection as TableCollection<T>;\n }\n\n private columnsChanged(newCollection: TableCollection<T>, oldCollection: TableCollection<T> | null) {\n return !oldCollection ||\n newCollection.columns !== oldCollection.columns &&\n newCollection.columns.length !== oldCollection.columns.length ||\n newCollection.columns.some((c, i) =>\n c.key !== oldCollection.columns[i].key ||\n c.props.width !== oldCollection.columns[i].props.width ||\n c.props.minWidth !== oldCollection.columns[i].props.minWidth ||\n c.props.maxWidth !== oldCollection.columns[i].props.maxWidth\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.columnWidths !== oldOptions.columnWidths\n || super.shouldInvalidateLayoutOptions(newOptions, oldOptions);\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let newCollection = this.virtualizer!.collection as TableCollection<T>;\n\n // If columnWidths were provided via layoutOptions, update those.\n // Otherwise, calculate column widths ourselves.\n if (invalidationContext.layoutOptions?.columnWidths) {\n if (invalidationContext.layoutOptions.columnWidths !== this.columnWidths) {\n this.columnWidths = invalidationContext.layoutOptions.columnWidths;\n invalidationContext.sizeChanged = true;\n }\n } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {\n let columnLayout = new TableColumnLayout({});\n this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer!.visibleRect.width - this.padding * 2, newCollection, new Map());\n invalidationContext.sizeChanged = true;\n }\n\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n this.stickyColumnIndices = [];\n\n let collection = this.virtualizer!.collection as TableCollection<T>;\n if (collection.head?.key === -1) {\n return [];\n }\n\n for (let column of collection.columns) {\n // The selection cell and any other sticky columns always need to be visible.\n // In addition, row headers need to be in the DOM for accessibility labeling.\n if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) {\n this.stickyColumnIndices.push(column.index);\n }\n }\n\n let header = this.buildTableHeader();\n this.layoutNodes.set(header.layoutInfo.key, header);\n let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);\n this.lastPersistedKeys = null;\n\n body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);\n this.contentSize = new Size(body.layoutInfo.rect.width + this.padding * 2, body.layoutInfo.rect.maxY + this.padding);\n return [\n header,\n body\n ];\n }\n\n protected buildTableHeader(): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, this.padding, 0, 0);\n let layoutInfo = new LayoutInfo('header', collection.head?.key ?? 'header', rect);\n layoutInfo.isSticky = true;\n layoutInfo.zIndex = 1;\n\n let y = this.padding;\n let width = 0;\n let children: LayoutNode[] = [];\n for (let headerRow of collection.headerRows) {\n let layoutNode = this.buildChild(headerRow, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n y = layoutNode.layoutInfo.rect.maxY;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n\n rect.width = width;\n rect.height = y - this.padding;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect,\n node: collection.head\n };\n }\n\n protected buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, 0, 0);\n let row = new LayoutInfo('headerrow', headerRow.key, rect);\n\n let height = 0;\n let columns: LayoutNode[] = [];\n for (let cell of getChildNodes(headerRow, this.virtualizer!.collection)) {\n let layoutNode = this.buildChild(cell, x, y, row.key);\n layoutNode.layoutInfo.parentKey = row.key;\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = columns.length;\n columns.push(layoutNode);\n }\n for (let [i, layout] of columns.entries()) {\n layout.layoutInfo.zIndex = columns.length - i + 1;\n }\n\n this.setChildHeights(columns, height);\n\n rect.height = height;\n rect.width = x - rect.x;\n\n return {\n layoutInfo: row,\n children: columns,\n validRect: rect,\n node: headerRow\n };\n }\n\n private setChildHeights(children: LayoutNode[], height: number) {\n for (let child of children) {\n if (child.layoutInfo.rect.height !== height) {\n // Need to copy the layout info before we mutate it.\n child.layoutInfo = child.layoutInfo.copy();\n child.layoutInfo.rect.height = height;\n }\n }\n }\n\n // used to get the column widths when rendering to the DOM\n private getRenderedColumnWidth(node: GridNode<T>) {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let colSpan = node.colSpan ?? 1;\n let colIndex = node.colIndex ?? node.index;\n let width = 0;\n for (let i = colIndex; i < colIndex + colSpan; i++) {\n let column = collection.columns[i];\n if (column?.key != null) {\n width += this.columnWidths.get(column.key) ?? 0;\n }\n }\n\n return width;\n }\n\n private getEstimatedHeight(node: GridNode<T>, width: number, height: number | null, estimatedHeight: number | null) {\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (height == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall collection view changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n height = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n height = estimatedHeight ?? DEFAULT_ROW_HEIGHT;\n isEstimated = true;\n }\n }\n\n return {height, isEstimated};\n }\n\n protected getEstimatedRowHeight(): number {\n return this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_ROW_HEIGHT;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.headingHeight ?? this.rowHeight, this.estimatedHeadingHeight ?? this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n // For subclasses.\n // eslint-disable-next-line\n protected isStickyColumn(node: GridNode<T>) {\n return false;\n }\n\n protected buildBody(y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, y, 0, 0);\n let layoutInfo = new LayoutInfo('rowgroup', collection.body.key, rect);\n\n let startY = y;\n let skipped = 0;\n let width = 0;\n let children: LayoutNode[] = [];\n let rowHeight = this.getEstimatedRowHeight() + this.gap;\n let childNodes = getChildNodes(collection.body, collection);\n for (let node of childNodes) {\n // Skip rows before the valid rectangle unless they are already cached.\n if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n layoutNode.index = children.length;\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n let rowsAfterRect = collection.size - (children.length + skipped);\n let lastNode = getLastItem(childNodes);\n if (lastNode?.type === 'loader') {\n rowsAfterRect--;\n }\n\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += rowsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last row in the body,\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && children.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, layoutInfo.key);\n loader.layoutInfo.parentKey = layoutInfo.key;\n loader.index = collection.size;\n width = Math.max(width, loader.layoutInfo.rect.width);\n children.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n // Make sure that the table body gets a height if empty or performing initial load\n let isEmptyOrLoading = collection?.size === 0 || (collection.size === 1 && collection.getItem(collection.getFirstKey()!)!.type === 'loader');\n if (isEmptyOrLoading) {\n y = this.virtualizer!.visibleRect.maxY;\n } else {\n y -= this.gap;\n }\n\n rect.width = width;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node: collection.body\n };\n }\n\n protected buildNode(node: GridNode<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'headerrow':\n return this.buildHeaderRow(node, x, y);\n case 'item':\n return this.buildRow(node, x, y);\n case 'column':\n case 'placeholder':\n return this.buildColumn(node, x, y);\n case 'cell':\n return this.buildCell(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n default:\n throw new Error('Unknown node type ' + node.type);\n }\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(x, y, 0, 0);\n let layoutInfo = new LayoutInfo('row', node.key, rect);\n\n let children: LayoutNode[] = [];\n let height = 0;\n for (let child of getChildNodes(node, collection)) {\n if (child.type === 'cell') {\n if (x > this.requestedRect.maxX) {\n // Adjust existing cached layoutInfo to ensure that it is out of view.\n // This can happen due to column resizing.\n let layoutNode = this.layoutNodes.get(child.key);\n if (layoutNode) {\n layoutNode.layoutInfo.rect.x = x;\n x += layoutNode.layoutInfo.rect.width;\n } else {\n break;\n }\n } else {\n let layoutNode = this.buildChild(child, x, y, layoutInfo.key);\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n }\n }\n\n this.setChildHeights(children, height);\n\n rect.width = this.layoutNodes.get(collection.head?.key ?? 'header')!.layoutInfo.rect.width;\n rect.height = height;\n\n return {\n layoutInfo,\n children,\n validRect: rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.rowHeight, this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: rect,\n node\n };\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 for getDropTargetFromPoint)\n if (rect.height > 1) {\n let rowHeight = this.getEstimatedRowHeight();\n rect.y = Math.floor(rect.y / rowHeight) * rowHeight;\n rect.height = Math.ceil(rect.height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n this.buildPersistedIndices();\n for (let node of this.rootNodes) {\n res.push(node.layoutInfo);\n this.addVisibleLayoutInfos(res, node, rect);\n }\n\n return res;\n }\n\n private addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect) {\n if (!node.children || node.children.length === 0) {\n return;\n }\n\n switch (node.layoutInfo.type) {\n case 'header': {\n for (let child of node.children) {\n res.push(child.layoutInfo);\n this.addVisibleLayoutInfos(res, child, rect);\n }\n break;\n }\n case 'rowgroup': {\n let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');\n let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');\n\n // Add persisted rows before the visible rows.\n let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);\n let persistIndex = 0;\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < firstVisibleRow\n ) {\n let idx = persistedRowIndices[persistIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n persistIndex++;\n }\n\n for (let i = firstVisibleRow; i <= lastVisibleRow; i++) {\n // Skip persisted rows that overlap with visible cells.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length && persistedRowIndices[persistIndex] < i) {\n persistIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[i], rect);\n }\n\n // Add persisted rows after the visible rows.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length) {\n let idx = persistedRowIndices[persistIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n }\n\n // Always include loading sentinel even when virtualized, we assume it is always the last child for now\n let lastRow = node.children.at(-1);\n if (lastRow?.layoutInfo.type === 'loader') {\n res.push(lastRow.layoutInfo);\n }\n break;\n }\n case 'headerrow':\n case 'row': {\n let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');\n let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');\n let stickyIndex = 0;\n\n // Add persisted/sticky cells before the visible cells.\n let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < firstVisibleCell) {\n let idx = persistedCellIndices[stickyIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n stickyIndex++;\n }\n\n for (let i = firstVisibleCell; i <= lastVisibleCell; i++) {\n // Skip sticky cells that overlap with visible cells.\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < i) {\n stickyIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n }\n\n // Add any remaining sticky cells after the visible cells.\n while (stickyIndex < persistedCellIndices.length) {\n let idx = persistedCellIndices[stickyIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n }\n break;\n }\n default:\n throw new Error('Unknown node type ' + node.layoutInfo.type);\n }\n }\n\n private binarySearch(items: LayoutNode[], point: Point, axis: 'x' | 'y') {\n let low = 0;\n let high = items.length - 1;\n while (low <= high) {\n let mid = (low + high) >> 1;\n let item = items[mid];\n\n if ((axis === 'x' && item.layoutInfo.rect.maxX <= point.x) || (axis === 'y' && item.layoutInfo.rect.maxY <= point.y)) {\n low = mid + 1;\n } else if ((axis === 'x' && item.layoutInfo.rect.x > point.x) || (axis === 'y' && item.layoutInfo.rect.y > point.y)) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.max(0, Math.min(items.length - 1, low));\n }\n\n private buildPersistedIndices() {\n if (this.virtualizer!.persistedKeys === this.lastPersistedKeys) {\n return;\n }\n\n this.lastPersistedKeys = this.virtualizer!.persistedKeys;\n this.persistedIndices.clear();\n\n // Build a map of parentKey => indices of children to persist.\n for (let key of this.virtualizer!.persistedKeys) {\n let layoutInfo = this.layoutNodes.get(key)?.layoutInfo;\n\n // Walk up ancestors so parents are also persisted if children are.\n while (layoutInfo && layoutInfo.parentKey) {\n let collectionNode = this.virtualizer!.collection.getItem(layoutInfo.key);\n let indices = this.persistedIndices.get(layoutInfo.parentKey);\n if (!indices) {\n // stickyColumnIndices are always persisted along with any cells from persistedKeys.\n indices = collectionNode?.type === 'cell' || collectionNode?.type === 'column' ? [...this.stickyColumnIndices] : [];\n this.persistedIndices.set(layoutInfo.parentKey, indices);\n }\n\n let index = this.layoutNodes.get(layoutInfo.key)?.index;\n if (index != null && !indices.includes(index)) {\n indices.push(index);\n }\n\n layoutInfo = this.layoutNodes.get(layoutInfo.parentKey)?.layoutInfo;\n }\n }\n\n for (let indices of this.persistedIndices.values()) {\n indices.sort((a, b) => a - b);\n }\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (candidate.type !== 'row' || !candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = super.getDropTargetLayoutInfo(target);\n layoutInfo.parentKey = (this.virtualizer!.collection as TableCollection<T>).body.key;\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"TableLayout.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAcD,MAAM,2CAAqB;AAMpB,MAAM,kDAAsE,CAAA,GAAA,oCAAS;IAY1F,0CAA0C;IAC1C,IAAc,aAAiC;QAC7C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEQ,eAAe,aAAiC,EAAE,aAAwC,EAAE;QAClG,OAAO,CAAC,iBACN,cAAc,OAAO,KAAK,cAAc,OAAO,IAC/C,cAAc,OAAO,CAAC,MAAM,KAAK,cAAc,OAAO,CAAC,MAAM,IAC7D,cAAc,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAC7B,EAAE,GAAG,KAAK,cAAc,OAAO,CAAC,EAAE,CAAC,GAAG,IACtC,EAAE,KAAK,CAAC,KAAK,KAAK,cAAc,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,IACtD,EAAE,KAAK,CAAC,QAAQ,KAAK,cAAc,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,IAC5D,EAAE,KAAK,CAAC,QAAQ,KAAK,cAAc,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ;IAElE;IAEA,8BAA8B,UAAa,EAAE,UAAa,EAAW;QACnE,OAAO,WAAW,YAAY,KAAK,WAAW,YAAY,IACrD,KAAK,CAAC,8BAA8B,YAAY;IAC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,MAAsB,EAAc;QAC1D,IAAI,aAAa,KAAK,CAAC,wBAAwB;QAC/C,WAAW,SAAS,GAAG,AAAC,IAAI,CAAC,WAAW,CAAE,UAAU,CAAwB,IAAI,CAAC,GAAG;QACpF,OAAO;IACT;IAnlBA,YAAY,OAA2B,CAAE;QACvC,KAAK,CAAC,eAPE,iBAA4C,WAC9C,eAAiC,IAAI,YAErC,oBAAqC,WACrC,mBAAuC,IAAI;QAIjD,IAAI,CAAC,mBAAmB,GAAG,EAAE;IAC/B;AAilBF","sources":["packages/@react-stately/layout/src/TableLayout.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 {DropTarget, ItemDropTarget, Key} from '@react-types/shared';\nimport {getChildNodes, getLastItem} from '@react-stately/collections';\nimport {GridNode} from '@react-types/grid';\nimport {InvalidationContext, LayoutInfo, Point, Rect, Size} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from './ListLayout';\nimport {TableCollection} from '@react-types/table';\nimport {TableColumnLayout} from '@react-stately/table';\n\nexport interface TableLayoutProps extends ListLayoutOptions {\n columnWidths?: Map<Key, number>\n}\n\nconst DEFAULT_ROW_HEIGHT = 48;\n\n/**\n * TableLayout is a virtualizer Layout implementation that arranges\n * items in rows and columns.\n */\nexport class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<T, O> {\n protected lastCollection: TableCollection<T> | null = null;\n private columnWidths: Map<Key, number> = new Map();\n private stickyColumnIndices: number[];\n private lastPersistedKeys: Set<Key> | null = null;\n private persistedIndices: Map<Key, number[]> = new Map();\n\n constructor(options?: ListLayoutOptions) {\n super(options);\n this.stickyColumnIndices = [];\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): TableCollection<T> {\n return this.virtualizer!.collection as TableCollection<T>;\n }\n\n private columnsChanged(newCollection: TableCollection<T>, oldCollection: TableCollection<T> | null) {\n return !oldCollection ||\n newCollection.columns !== oldCollection.columns &&\n newCollection.columns.length !== oldCollection.columns.length ||\n newCollection.columns.some((c, i) =>\n c.key !== oldCollection.columns[i].key ||\n c.props.width !== oldCollection.columns[i].props.width ||\n c.props.minWidth !== oldCollection.columns[i].props.minWidth ||\n c.props.maxWidth !== oldCollection.columns[i].props.maxWidth\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.columnWidths !== oldOptions.columnWidths\n || super.shouldInvalidateLayoutOptions(newOptions, oldOptions);\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let newCollection = this.virtualizer!.collection as TableCollection<T>;\n\n // If columnWidths were provided via layoutOptions, update those.\n // Otherwise, calculate column widths ourselves.\n if (invalidationContext.layoutOptions?.columnWidths) {\n for (const [key, val] of invalidationContext.layoutOptions.columnWidths) {\n if (this.columnWidths.get(key) !== val) {\n this.columnWidths = invalidationContext.layoutOptions.columnWidths;\n invalidationContext.sizeChanged = true;\n break;\n }\n }\n } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {\n let columnLayout = new TableColumnLayout({});\n this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer!.visibleRect.width - this.padding * 2, newCollection, new Map());\n invalidationContext.sizeChanged = true;\n }\n\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n this.stickyColumnIndices = [];\n\n let collection = this.virtualizer!.collection as TableCollection<T>;\n if (collection.head?.key === -1) {\n return [];\n }\n\n for (let column of collection.columns) {\n // The selection cell and any other sticky columns always need to be visible.\n // In addition, row headers need to be in the DOM for accessibility labeling.\n if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) {\n this.stickyColumnIndices.push(column.index);\n }\n }\n\n let header = this.buildTableHeader();\n this.layoutNodes.set(header.layoutInfo.key, header);\n let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);\n this.lastPersistedKeys = null;\n\n body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);\n this.contentSize = new Size(body.layoutInfo.rect.width + this.padding * 2, body.layoutInfo.rect.maxY + this.padding);\n return [\n header,\n body\n ];\n }\n\n protected buildTableHeader(): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, this.padding, 0, 0);\n let layoutInfo = new LayoutInfo('header', collection.head?.key ?? 'header', rect);\n layoutInfo.isSticky = true;\n layoutInfo.zIndex = 1;\n\n let y = this.padding;\n let width = 0;\n let children: LayoutNode[] = [];\n for (let headerRow of collection.headerRows) {\n let layoutNode = this.buildChild(headerRow, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n y = layoutNode.layoutInfo.rect.maxY;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n\n rect.width = width;\n rect.height = y - this.padding;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect,\n node: collection.head\n };\n }\n\n protected buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, 0, 0);\n let row = new LayoutInfo('headerrow', headerRow.key, rect);\n\n let height = 0;\n let columns: LayoutNode[] = [];\n for (let cell of getChildNodes(headerRow, this.virtualizer!.collection)) {\n let layoutNode = this.buildChild(cell, x, y, row.key);\n layoutNode.layoutInfo.parentKey = row.key;\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = columns.length;\n columns.push(layoutNode);\n }\n for (let [i, layout] of columns.entries()) {\n layout.layoutInfo.zIndex = columns.length - i + 1;\n }\n\n this.setChildHeights(columns, height);\n\n rect.height = height;\n rect.width = x - rect.x;\n\n return {\n layoutInfo: row,\n children: columns,\n validRect: rect,\n node: headerRow\n };\n }\n\n private setChildHeights(children: LayoutNode[], height: number) {\n for (let child of children) {\n if (child.layoutInfo.rect.height !== height) {\n // Need to copy the layout info before we mutate it.\n child.layoutInfo = child.layoutInfo.copy();\n child.layoutInfo.rect.height = height;\n }\n }\n }\n\n // used to get the column widths when rendering to the DOM\n private getRenderedColumnWidth(node: GridNode<T>) {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let colSpan = node.colSpan ?? 1;\n let colIndex = node.colIndex ?? node.index;\n let width = 0;\n for (let i = colIndex; i < colIndex + colSpan; i++) {\n let column = collection.columns[i];\n if (column?.key != null) {\n width += this.columnWidths.get(column.key) ?? 0;\n }\n }\n\n return width;\n }\n\n private getEstimatedHeight(node: GridNode<T>, width: number, height: number | null, estimatedHeight: number | null) {\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (height == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall collection view changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n height = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n height = estimatedHeight ?? DEFAULT_ROW_HEIGHT;\n isEstimated = true;\n }\n }\n\n return {height, isEstimated};\n }\n\n protected getEstimatedRowHeight(): number {\n return this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_ROW_HEIGHT;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.headingHeight ?? this.rowHeight, this.estimatedHeadingHeight ?? this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n // For subclasses.\n // eslint-disable-next-line\n protected isStickyColumn(node: GridNode<T>) {\n return false;\n }\n\n protected buildBody(y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, y, 0, 0);\n let layoutInfo = new LayoutInfo('rowgroup', collection.body.key, rect);\n\n let startY = y;\n let skipped = 0;\n let width = 0;\n let children: LayoutNode[] = [];\n let rowHeight = this.getEstimatedRowHeight() + this.gap;\n let childNodes = getChildNodes(collection.body, collection);\n for (let node of childNodes) {\n // Skip rows before the valid rectangle unless they are already cached.\n if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n layoutNode.index = children.length;\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n let rowsAfterRect = collection.size - (children.length + skipped);\n let lastNode = getLastItem(childNodes);\n\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += rowsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last row in the body,\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && children.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, layoutInfo.key);\n loader.layoutInfo.parentKey = layoutInfo.key;\n loader.index = collection.size;\n width = Math.max(width, loader.layoutInfo.rect.width);\n children.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n // Make sure that the table body gets a height if empty or performing initial load\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n y = this.virtualizer!.visibleRect.maxY;\n } else {\n y -= this.gap;\n }\n\n rect.width = width;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node: collection.body\n };\n }\n\n protected buildNode(node: GridNode<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'headerrow':\n return this.buildHeaderRow(node, x, y);\n case 'item':\n return this.buildRow(node, x, y);\n case 'column':\n case 'placeholder':\n return this.buildColumn(node, x, y);\n case 'cell':\n return this.buildCell(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n default:\n throw new Error('Unknown node type ' + node.type);\n }\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(x, y, 0, 0);\n let layoutInfo = new LayoutInfo('row', node.key, rect);\n\n let children: LayoutNode[] = [];\n let height = 0;\n for (let child of getChildNodes(node, collection)) {\n if (child.type === 'cell') {\n if (x > this.requestedRect.maxX) {\n // Adjust existing cached layoutInfo to ensure that it is out of view.\n // This can happen due to column resizing.\n let layoutNode = this.layoutNodes.get(child.key);\n if (layoutNode) {\n layoutNode.layoutInfo.rect.x = x;\n x += layoutNode.layoutInfo.rect.width;\n } else {\n break;\n }\n } else {\n let layoutNode = this.buildChild(child, x, y, layoutInfo.key);\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n }\n }\n\n this.setChildHeights(children, height);\n\n rect.width = this.layoutNodes.get(collection.head?.key ?? 'header')!.layoutInfo.rect.width;\n rect.height = height;\n\n return {\n layoutInfo,\n children,\n validRect: rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.rowHeight, this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: rect,\n node\n };\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 for getDropTargetFromPoint)\n if (rect.height > 1) {\n let rowHeight = this.getEstimatedRowHeight();\n rect.y = Math.floor(rect.y / rowHeight) * rowHeight;\n rect.height = Math.ceil(rect.height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n this.buildPersistedIndices();\n for (let node of this.rootNodes) {\n res.push(node.layoutInfo);\n this.addVisibleLayoutInfos(res, node, rect);\n }\n\n return res;\n }\n\n private addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect) {\n if (!node.children || node.children.length === 0) {\n return;\n }\n\n switch (node.layoutInfo.type) {\n case 'header': {\n for (let child of node.children) {\n res.push(child.layoutInfo);\n this.addVisibleLayoutInfos(res, child, rect);\n }\n break;\n }\n case 'rowgroup': {\n let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');\n let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');\n\n // Add persisted rows before the visible rows.\n let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);\n let persistIndex = 0;\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < firstVisibleRow\n ) {\n let idx = persistedRowIndices[persistIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n persistIndex++;\n }\n\n for (let i = firstVisibleRow; i <= lastVisibleRow; i++) {\n // Skip persisted rows that overlap with visible cells.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length && persistedRowIndices[persistIndex] < i) {\n persistIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[i], rect);\n }\n\n // Add persisted rows after the visible rows.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length) {\n let idx = persistedRowIndices[persistIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n }\n\n // Always include loading sentinel even when virtualized, we assume it is always the last child for now\n let lastRow = node.children.at(-1);\n if (lastRow?.layoutInfo.type === 'loader') {\n res.push(lastRow.layoutInfo);\n }\n break;\n }\n case 'headerrow':\n case 'row': {\n let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');\n let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');\n let stickyIndex = 0;\n\n // Add persisted/sticky cells before the visible cells.\n let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < firstVisibleCell) {\n let idx = persistedCellIndices[stickyIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n stickyIndex++;\n }\n\n for (let i = firstVisibleCell; i <= lastVisibleCell; i++) {\n // Skip sticky cells that overlap with visible cells.\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < i) {\n stickyIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n }\n\n // Add any remaining sticky cells after the visible cells.\n while (stickyIndex < persistedCellIndices.length) {\n let idx = persistedCellIndices[stickyIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n }\n break;\n }\n default:\n throw new Error('Unknown node type ' + node.layoutInfo.type);\n }\n }\n\n private binarySearch(items: LayoutNode[], point: Point, axis: 'x' | 'y') {\n let low = 0;\n let high = items.length - 1;\n while (low <= high) {\n let mid = (low + high) >> 1;\n let item = items[mid];\n\n if ((axis === 'x' && item.layoutInfo.rect.maxX <= point.x) || (axis === 'y' && item.layoutInfo.rect.maxY <= point.y)) {\n low = mid + 1;\n } else if ((axis === 'x' && item.layoutInfo.rect.x > point.x) || (axis === 'y' && item.layoutInfo.rect.y > point.y)) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.max(0, Math.min(items.length - 1, low));\n }\n\n private buildPersistedIndices() {\n if (this.virtualizer!.persistedKeys === this.lastPersistedKeys) {\n return;\n }\n\n this.lastPersistedKeys = this.virtualizer!.persistedKeys;\n this.persistedIndices.clear();\n\n // Build a map of parentKey => indices of children to persist.\n for (let key of this.virtualizer!.persistedKeys) {\n let layoutInfo = this.layoutNodes.get(key)?.layoutInfo;\n\n // Walk up ancestors so parents are also persisted if children are.\n while (layoutInfo && layoutInfo.parentKey) {\n let collectionNode = this.virtualizer!.collection.getItem(layoutInfo.key);\n let indices = this.persistedIndices.get(layoutInfo.parentKey);\n if (!indices) {\n // stickyColumnIndices are always persisted along with any cells from persistedKeys.\n indices = collectionNode?.type === 'cell' || collectionNode?.type === 'column' ? [...this.stickyColumnIndices] : [];\n this.persistedIndices.set(layoutInfo.parentKey, indices);\n }\n\n let index = this.layoutNodes.get(layoutInfo.key)?.index;\n if (index != null && !indices.includes(index)) {\n indices.push(index);\n }\n\n layoutInfo = this.layoutNodes.get(layoutInfo.parentKey)?.layoutInfo;\n }\n }\n\n for (let indices of this.persistedIndices.values()) {\n indices.sort((a, b) => a - b);\n }\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (candidate.type !== 'row' || !candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = super.getDropTargetLayoutInfo(target);\n layoutInfo.parentKey = (this.virtualizer!.collection as TableCollection<T>).body.key;\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"TableLayout.main.js.map"}
|
package/dist/TableLayout.mjs
CHANGED
|
@@ -35,9 +35,10 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
35
35
|
// If columnWidths were provided via layoutOptions, update those.
|
|
36
36
|
// Otherwise, calculate column widths ourselves.
|
|
37
37
|
if ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.columnWidths) {
|
|
38
|
-
|
|
38
|
+
for (const [key, val] of invalidationContext.layoutOptions.columnWidths)if (this.columnWidths.get(key) !== val) {
|
|
39
39
|
this.columnWidths = invalidationContext.layoutOptions.columnWidths;
|
|
40
40
|
invalidationContext.sizeChanged = true;
|
|
41
|
+
break;
|
|
41
42
|
}
|
|
42
43
|
} else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {
|
|
43
44
|
let columnLayout = new (0, $bmsJv$TableColumnLayout)({});
|
|
@@ -212,7 +213,6 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
212
213
|
var _children_at;
|
|
213
214
|
let rowsAfterRect = collection.size - (children.length + skipped);
|
|
214
215
|
let lastNode = (0, $bmsJv$getLastItem)(childNodes);
|
|
215
|
-
if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader') rowsAfterRect--;
|
|
216
216
|
// Estimate the remaining height for rows that we don't need to layout right now.
|
|
217
217
|
y += rowsAfterRect * rowHeight;
|
|
218
218
|
// Always add the loader sentinel if present. This assumes the loader is the last row in the body,
|
|
@@ -229,7 +229,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
// Make sure that the table body gets a height if empty or performing initial load
|
|
232
|
-
let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0
|
|
232
|
+
let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0;
|
|
233
233
|
if (isEmptyOrLoading) y = this.virtualizer.visibleRect.maxY;
|
|
234
234
|
else y -= this.gap;
|
|
235
235
|
rect.width = width;
|
|
@@ -35,9 +35,10 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
35
35
|
// If columnWidths were provided via layoutOptions, update those.
|
|
36
36
|
// Otherwise, calculate column widths ourselves.
|
|
37
37
|
if ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.columnWidths) {
|
|
38
|
-
|
|
38
|
+
for (const [key, val] of invalidationContext.layoutOptions.columnWidths)if (this.columnWidths.get(key) !== val) {
|
|
39
39
|
this.columnWidths = invalidationContext.layoutOptions.columnWidths;
|
|
40
40
|
invalidationContext.sizeChanged = true;
|
|
41
|
+
break;
|
|
41
42
|
}
|
|
42
43
|
} else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {
|
|
43
44
|
let columnLayout = new (0, $bmsJv$TableColumnLayout)({});
|
|
@@ -212,7 +213,6 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
212
213
|
var _children_at;
|
|
213
214
|
let rowsAfterRect = collection.size - (children.length + skipped);
|
|
214
215
|
let lastNode = (0, $bmsJv$getLastItem)(childNodes);
|
|
215
|
-
if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader') rowsAfterRect--;
|
|
216
216
|
// Estimate the remaining height for rows that we don't need to layout right now.
|
|
217
217
|
y += rowsAfterRect * rowHeight;
|
|
218
218
|
// Always add the loader sentinel if present. This assumes the loader is the last row in the body,
|
|
@@ -229,7 +229,7 @@ class $a152112e902709bf$export$62444c3c724b1b20 extends (0, $61ef60fc9b1041f4$ex
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
// Make sure that the table body gets a height if empty or performing initial load
|
|
232
|
-
let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0
|
|
232
|
+
let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0;
|
|
233
233
|
if (isEmptyOrLoading) y = this.virtualizer.visibleRect.maxY;
|
|
234
234
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I;QAIjD,IAAI,CAAC,mBAAmB,GAAG,EAAE;IAC/B;AAilBF","sources":["packages/@react-stately/layout/src/TableLayout.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 {DropTarget, ItemDropTarget, Key} from '@react-types/shared';\nimport {getChildNodes, getLastItem} from '@react-stately/collections';\nimport {GridNode} from '@react-types/grid';\nimport {InvalidationContext, LayoutInfo, Point, Rect, Size} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from './ListLayout';\nimport {TableCollection} from '@react-types/table';\nimport {TableColumnLayout} from '@react-stately/table';\n\nexport interface TableLayoutProps extends ListLayoutOptions {\n columnWidths?: Map<Key, number>\n}\n\nconst DEFAULT_ROW_HEIGHT = 48;\n\n/**\n * TableLayout is a virtualizer Layout implementation that arranges\n * items in rows and columns.\n */\nexport class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<T, O> {\n protected lastCollection: TableCollection<T> | null = null;\n private columnWidths: Map<Key, number> = new Map();\n private stickyColumnIndices: number[];\n private lastPersistedKeys: Set<Key> | null = null;\n private persistedIndices: Map<Key, number[]> = new Map();\n\n constructor(options?: ListLayoutOptions) {\n super(options);\n this.stickyColumnIndices = [];\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): TableCollection<T> {\n return this.virtualizer!.collection as TableCollection<T>;\n }\n\n private columnsChanged(newCollection: TableCollection<T>, oldCollection: TableCollection<T> | null) {\n return !oldCollection ||\n newCollection.columns !== oldCollection.columns &&\n newCollection.columns.length !== oldCollection.columns.length ||\n newCollection.columns.some((c, i) =>\n c.key !== oldCollection.columns[i].key ||\n c.props.width !== oldCollection.columns[i].props.width ||\n c.props.minWidth !== oldCollection.columns[i].props.minWidth ||\n c.props.maxWidth !== oldCollection.columns[i].props.maxWidth\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.columnWidths !== oldOptions.columnWidths\n || super.shouldInvalidateLayoutOptions(newOptions, oldOptions);\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let newCollection = this.virtualizer!.collection as TableCollection<T>;\n\n // If columnWidths were provided via layoutOptions, update those.\n // Otherwise, calculate column widths ourselves.\n if (invalidationContext.layoutOptions?.columnWidths) {\n if (invalidationContext.layoutOptions.columnWidths !== this.columnWidths) {\n this.columnWidths = invalidationContext.layoutOptions.columnWidths;\n invalidationContext.sizeChanged = true;\n }\n } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {\n let columnLayout = new TableColumnLayout({});\n this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer!.visibleRect.width - this.padding * 2, newCollection, new Map());\n invalidationContext.sizeChanged = true;\n }\n\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n this.stickyColumnIndices = [];\n\n let collection = this.virtualizer!.collection as TableCollection<T>;\n if (collection.head?.key === -1) {\n return [];\n }\n\n for (let column of collection.columns) {\n // The selection cell and any other sticky columns always need to be visible.\n // In addition, row headers need to be in the DOM for accessibility labeling.\n if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) {\n this.stickyColumnIndices.push(column.index);\n }\n }\n\n let header = this.buildTableHeader();\n this.layoutNodes.set(header.layoutInfo.key, header);\n let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);\n this.lastPersistedKeys = null;\n\n body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);\n this.contentSize = new Size(body.layoutInfo.rect.width + this.padding * 2, body.layoutInfo.rect.maxY + this.padding);\n return [\n header,\n body\n ];\n }\n\n protected buildTableHeader(): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, this.padding, 0, 0);\n let layoutInfo = new LayoutInfo('header', collection.head?.key ?? 'header', rect);\n layoutInfo.isSticky = true;\n layoutInfo.zIndex = 1;\n\n let y = this.padding;\n let width = 0;\n let children: LayoutNode[] = [];\n for (let headerRow of collection.headerRows) {\n let layoutNode = this.buildChild(headerRow, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n y = layoutNode.layoutInfo.rect.maxY;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n\n rect.width = width;\n rect.height = y - this.padding;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect,\n node: collection.head\n };\n }\n\n protected buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, 0, 0);\n let row = new LayoutInfo('headerrow', headerRow.key, rect);\n\n let height = 0;\n let columns: LayoutNode[] = [];\n for (let cell of getChildNodes(headerRow, this.virtualizer!.collection)) {\n let layoutNode = this.buildChild(cell, x, y, row.key);\n layoutNode.layoutInfo.parentKey = row.key;\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = columns.length;\n columns.push(layoutNode);\n }\n for (let [i, layout] of columns.entries()) {\n layout.layoutInfo.zIndex = columns.length - i + 1;\n }\n\n this.setChildHeights(columns, height);\n\n rect.height = height;\n rect.width = x - rect.x;\n\n return {\n layoutInfo: row,\n children: columns,\n validRect: rect,\n node: headerRow\n };\n }\n\n private setChildHeights(children: LayoutNode[], height: number) {\n for (let child of children) {\n if (child.layoutInfo.rect.height !== height) {\n // Need to copy the layout info before we mutate it.\n child.layoutInfo = child.layoutInfo.copy();\n child.layoutInfo.rect.height = height;\n }\n }\n }\n\n // used to get the column widths when rendering to the DOM\n private getRenderedColumnWidth(node: GridNode<T>) {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let colSpan = node.colSpan ?? 1;\n let colIndex = node.colIndex ?? node.index;\n let width = 0;\n for (let i = colIndex; i < colIndex + colSpan; i++) {\n let column = collection.columns[i];\n if (column?.key != null) {\n width += this.columnWidths.get(column.key) ?? 0;\n }\n }\n\n return width;\n }\n\n private getEstimatedHeight(node: GridNode<T>, width: number, height: number | null, estimatedHeight: number | null) {\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (height == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall collection view changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n height = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n height = estimatedHeight ?? DEFAULT_ROW_HEIGHT;\n isEstimated = true;\n }\n }\n\n return {height, isEstimated};\n }\n\n protected getEstimatedRowHeight(): number {\n return this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_ROW_HEIGHT;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.headingHeight ?? this.rowHeight, this.estimatedHeadingHeight ?? this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n // For subclasses.\n // eslint-disable-next-line\n protected isStickyColumn(node: GridNode<T>) {\n return false;\n }\n\n protected buildBody(y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, y, 0, 0);\n let layoutInfo = new LayoutInfo('rowgroup', collection.body.key, rect);\n\n let startY = y;\n let skipped = 0;\n let width = 0;\n let children: LayoutNode[] = [];\n let rowHeight = this.getEstimatedRowHeight() + this.gap;\n let childNodes = getChildNodes(collection.body, collection);\n for (let node of childNodes) {\n // Skip rows before the valid rectangle unless they are already cached.\n if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n layoutNode.index = children.length;\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n let rowsAfterRect = collection.size - (children.length + skipped);\n let lastNode = getLastItem(childNodes);\n if (lastNode?.type === 'loader') {\n rowsAfterRect--;\n }\n\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += rowsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last row in the body,\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && children.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, layoutInfo.key);\n loader.layoutInfo.parentKey = layoutInfo.key;\n loader.index = collection.size;\n width = Math.max(width, loader.layoutInfo.rect.width);\n children.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n // Make sure that the table body gets a height if empty or performing initial load\n let isEmptyOrLoading = collection?.size === 0 || (collection.size === 1 && collection.getItem(collection.getFirstKey()!)!.type === 'loader');\n if (isEmptyOrLoading) {\n y = this.virtualizer!.visibleRect.maxY;\n } else {\n y -= this.gap;\n }\n\n rect.width = width;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node: collection.body\n };\n }\n\n protected buildNode(node: GridNode<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'headerrow':\n return this.buildHeaderRow(node, x, y);\n case 'item':\n return this.buildRow(node, x, y);\n case 'column':\n case 'placeholder':\n return this.buildColumn(node, x, y);\n case 'cell':\n return this.buildCell(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n default:\n throw new Error('Unknown node type ' + node.type);\n }\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(x, y, 0, 0);\n let layoutInfo = new LayoutInfo('row', node.key, rect);\n\n let children: LayoutNode[] = [];\n let height = 0;\n for (let child of getChildNodes(node, collection)) {\n if (child.type === 'cell') {\n if (x > this.requestedRect.maxX) {\n // Adjust existing cached layoutInfo to ensure that it is out of view.\n // This can happen due to column resizing.\n let layoutNode = this.layoutNodes.get(child.key);\n if (layoutNode) {\n layoutNode.layoutInfo.rect.x = x;\n x += layoutNode.layoutInfo.rect.width;\n } else {\n break;\n }\n } else {\n let layoutNode = this.buildChild(child, x, y, layoutInfo.key);\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n }\n }\n\n this.setChildHeights(children, height);\n\n rect.width = this.layoutNodes.get(collection.head?.key ?? 'header')!.layoutInfo.rect.width;\n rect.height = height;\n\n return {\n layoutInfo,\n children,\n validRect: rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.rowHeight, this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: rect,\n node\n };\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 for getDropTargetFromPoint)\n if (rect.height > 1) {\n let rowHeight = this.getEstimatedRowHeight();\n rect.y = Math.floor(rect.y / rowHeight) * rowHeight;\n rect.height = Math.ceil(rect.height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n this.buildPersistedIndices();\n for (let node of this.rootNodes) {\n res.push(node.layoutInfo);\n this.addVisibleLayoutInfos(res, node, rect);\n }\n\n return res;\n }\n\n private addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect) {\n if (!node.children || node.children.length === 0) {\n return;\n }\n\n switch (node.layoutInfo.type) {\n case 'header': {\n for (let child of node.children) {\n res.push(child.layoutInfo);\n this.addVisibleLayoutInfos(res, child, rect);\n }\n break;\n }\n case 'rowgroup': {\n let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');\n let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');\n\n // Add persisted rows before the visible rows.\n let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);\n let persistIndex = 0;\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < firstVisibleRow\n ) {\n let idx = persistedRowIndices[persistIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n persistIndex++;\n }\n\n for (let i = firstVisibleRow; i <= lastVisibleRow; i++) {\n // Skip persisted rows that overlap with visible cells.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length && persistedRowIndices[persistIndex] < i) {\n persistIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[i], rect);\n }\n\n // Add persisted rows after the visible rows.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length) {\n let idx = persistedRowIndices[persistIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n }\n\n // Always include loading sentinel even when virtualized, we assume it is always the last child for now\n let lastRow = node.children.at(-1);\n if (lastRow?.layoutInfo.type === 'loader') {\n res.push(lastRow.layoutInfo);\n }\n break;\n }\n case 'headerrow':\n case 'row': {\n let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');\n let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');\n let stickyIndex = 0;\n\n // Add persisted/sticky cells before the visible cells.\n let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < firstVisibleCell) {\n let idx = persistedCellIndices[stickyIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n stickyIndex++;\n }\n\n for (let i = firstVisibleCell; i <= lastVisibleCell; i++) {\n // Skip sticky cells that overlap with visible cells.\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < i) {\n stickyIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n }\n\n // Add any remaining sticky cells after the visible cells.\n while (stickyIndex < persistedCellIndices.length) {\n let idx = persistedCellIndices[stickyIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n }\n break;\n }\n default:\n throw new Error('Unknown node type ' + node.layoutInfo.type);\n }\n }\n\n private binarySearch(items: LayoutNode[], point: Point, axis: 'x' | 'y') {\n let low = 0;\n let high = items.length - 1;\n while (low <= high) {\n let mid = (low + high) >> 1;\n let item = items[mid];\n\n if ((axis === 'x' && item.layoutInfo.rect.maxX <= point.x) || (axis === 'y' && item.layoutInfo.rect.maxY <= point.y)) {\n low = mid + 1;\n } else if ((axis === 'x' && item.layoutInfo.rect.x > point.x) || (axis === 'y' && item.layoutInfo.rect.y > point.y)) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.max(0, Math.min(items.length - 1, low));\n }\n\n private buildPersistedIndices() {\n if (this.virtualizer!.persistedKeys === this.lastPersistedKeys) {\n return;\n }\n\n this.lastPersistedKeys = this.virtualizer!.persistedKeys;\n this.persistedIndices.clear();\n\n // Build a map of parentKey => indices of children to persist.\n for (let key of this.virtualizer!.persistedKeys) {\n let layoutInfo = this.layoutNodes.get(key)?.layoutInfo;\n\n // Walk up ancestors so parents are also persisted if children are.\n while (layoutInfo && layoutInfo.parentKey) {\n let collectionNode = this.virtualizer!.collection.getItem(layoutInfo.key);\n let indices = this.persistedIndices.get(layoutInfo.parentKey);\n if (!indices) {\n // stickyColumnIndices are always persisted along with any cells from persistedKeys.\n indices = collectionNode?.type === 'cell' || collectionNode?.type === 'column' ? [...this.stickyColumnIndices] : [];\n this.persistedIndices.set(layoutInfo.parentKey, indices);\n }\n\n let index = this.layoutNodes.get(layoutInfo.key)?.index;\n if (index != null && !indices.includes(index)) {\n indices.push(index);\n }\n\n layoutInfo = this.layoutNodes.get(layoutInfo.parentKey)?.layoutInfo;\n }\n }\n\n for (let indices of this.persistedIndices.values()) {\n indices.sort((a, b) => a - b);\n }\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (candidate.type !== 'row' || !candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = super.getDropTargetLayoutInfo(target);\n layoutInfo.parentKey = (this.virtualizer!.collection as TableCollection<T>).body.key;\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"TableLayout.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAcD,MAAM,2CAAqB;AAMpB,MAAM,kDAAsE,CAAA,GAAA,yCAAS;IAY1F,0CAA0C;IAC1C,IAAc,aAAiC;QAC7C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEQ,eAAe,aAAiC,EAAE,aAAwC,EAAE;QAClG,OAAO,CAAC,iBACN,cAAc,OAAO,KAAK,cAAc,OAAO,IAC/C,cAAc,OAAO,CAAC,MAAM,KAAK,cAAc,OAAO,CAAC,MAAM,IAC7D,cAAc,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAC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AG,KAAK,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAQ,IACvF,OAAO,YAAY,GAAG;iBACjB,IAAI,kBAAkB;gBAAC,GAAG,MAAM;gBAAE,cAAc;YAAO,IAC5D,OAAO,YAAY,GAAG;QAE1B,OAAO,IAAI,KAAK,KAAK,CAAC,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAQ,IACjF,OAAO,YAAY,GAAG;aACjB,IAAI,KAAK,KAAK,IAAI,GAAG,MAAM,kBAAkB;YAAC,GAAG,MAAM;YAAE,cAAc;QAAO,IACnF,OAAO,YAAY,GAAG;QAGxB,OAAO;IACT;IAEA,wBAAwB,MAAsB,EAAc;QAC1D,IAAI,aAAa,KAAK,CAAC,wBAAwB;QAC/C,WAAW,SAAS,GAAG,AAAC,IAAI,CAAC,WAAW,CAAE,UAAU,CAAwB,IAAI,CAAC,GAAG;QACpF,OAAO;IACT;IAnlBA,YAAY,OAA2B,CAAE;QACvC,KAAK,CAAC,eAPE,iBAA4C,WAC9C,eAAiC,IAAI,YAErC,oBAAqC,WACrC,mBAAuC,IAAI;QAIjD,IAAI,CAAC,mBAAmB,GAAG,EAAE;IAC/B;AAilBF","sources":["packages/@react-stately/layout/src/TableLayout.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 {DropTarget, ItemDropTarget, Key} from '@react-types/shared';\nimport {getChildNodes, getLastItem} from '@react-stately/collections';\nimport {GridNode} from '@react-types/grid';\nimport {InvalidationContext, LayoutInfo, Point, Rect, Size} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from './ListLayout';\nimport {TableCollection} from '@react-types/table';\nimport {TableColumnLayout} from '@react-stately/table';\n\nexport interface TableLayoutProps extends ListLayoutOptions {\n columnWidths?: Map<Key, number>\n}\n\nconst DEFAULT_ROW_HEIGHT = 48;\n\n/**\n * TableLayout is a virtualizer Layout implementation that arranges\n * items in rows and columns.\n */\nexport class TableLayout<T, O extends TableLayoutProps = TableLayoutProps> extends ListLayout<T, O> {\n protected lastCollection: TableCollection<T> | null = null;\n private columnWidths: Map<Key, number> = new Map();\n private stickyColumnIndices: number[];\n private lastPersistedKeys: Set<Key> | null = null;\n private persistedIndices: Map<Key, number[]> = new Map();\n\n constructor(options?: ListLayoutOptions) {\n super(options);\n this.stickyColumnIndices = [];\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): TableCollection<T> {\n return this.virtualizer!.collection as TableCollection<T>;\n }\n\n private columnsChanged(newCollection: TableCollection<T>, oldCollection: TableCollection<T> | null) {\n return !oldCollection ||\n newCollection.columns !== oldCollection.columns &&\n newCollection.columns.length !== oldCollection.columns.length ||\n newCollection.columns.some((c, i) =>\n c.key !== oldCollection.columns[i].key ||\n c.props.width !== oldCollection.columns[i].props.width ||\n c.props.minWidth !== oldCollection.columns[i].props.minWidth ||\n c.props.maxWidth !== oldCollection.columns[i].props.maxWidth\n );\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.columnWidths !== oldOptions.columnWidths\n || super.shouldInvalidateLayoutOptions(newOptions, oldOptions);\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let newCollection = this.virtualizer!.collection as TableCollection<T>;\n\n // If columnWidths were provided via layoutOptions, update those.\n // Otherwise, calculate column widths ourselves.\n if (invalidationContext.layoutOptions?.columnWidths) {\n for (const [key, val] of invalidationContext.layoutOptions.columnWidths) {\n if (this.columnWidths.get(key) !== val) {\n this.columnWidths = invalidationContext.layoutOptions.columnWidths;\n invalidationContext.sizeChanged = true;\n break;\n }\n }\n } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {\n let columnLayout = new TableColumnLayout({});\n this.columnWidths = columnLayout.buildColumnWidths(this.virtualizer!.visibleRect.width - this.padding * 2, newCollection, new Map());\n invalidationContext.sizeChanged = true;\n }\n\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n this.stickyColumnIndices = [];\n\n let collection = this.virtualizer!.collection as TableCollection<T>;\n if (collection.head?.key === -1) {\n return [];\n }\n\n for (let column of collection.columns) {\n // The selection cell and any other sticky columns always need to be visible.\n // In addition, row headers need to be in the DOM for accessibility labeling.\n if (this.isStickyColumn(column) || collection.rowHeaderColumnKeys.has(column.key)) {\n this.stickyColumnIndices.push(column.index);\n }\n }\n\n let header = this.buildTableHeader();\n this.layoutNodes.set(header.layoutInfo.key, header);\n let body = this.buildBody(header.layoutInfo.rect.maxY + this.gap);\n this.lastPersistedKeys = null;\n\n body.layoutInfo.rect.width = Math.max(header.layoutInfo.rect.width, body.layoutInfo.rect.width);\n this.contentSize = new Size(body.layoutInfo.rect.width + this.padding * 2, body.layoutInfo.rect.maxY + this.padding);\n return [\n header,\n body\n ];\n }\n\n protected buildTableHeader(): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, this.padding, 0, 0);\n let layoutInfo = new LayoutInfo('header', collection.head?.key ?? 'header', rect);\n layoutInfo.isSticky = true;\n layoutInfo.zIndex = 1;\n\n let y = this.padding;\n let width = 0;\n let children: LayoutNode[] = [];\n for (let headerRow of collection.headerRows) {\n let layoutNode = this.buildChild(headerRow, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n y = layoutNode.layoutInfo.rect.maxY;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n\n rect.width = width;\n rect.height = y - this.padding;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect,\n node: collection.head\n };\n }\n\n protected buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, 0, 0);\n let row = new LayoutInfo('headerrow', headerRow.key, rect);\n\n let height = 0;\n let columns: LayoutNode[] = [];\n for (let cell of getChildNodes(headerRow, this.virtualizer!.collection)) {\n let layoutNode = this.buildChild(cell, x, y, row.key);\n layoutNode.layoutInfo.parentKey = row.key;\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = columns.length;\n columns.push(layoutNode);\n }\n for (let [i, layout] of columns.entries()) {\n layout.layoutInfo.zIndex = columns.length - i + 1;\n }\n\n this.setChildHeights(columns, height);\n\n rect.height = height;\n rect.width = x - rect.x;\n\n return {\n layoutInfo: row,\n children: columns,\n validRect: rect,\n node: headerRow\n };\n }\n\n private setChildHeights(children: LayoutNode[], height: number) {\n for (let child of children) {\n if (child.layoutInfo.rect.height !== height) {\n // Need to copy the layout info before we mutate it.\n child.layoutInfo = child.layoutInfo.copy();\n child.layoutInfo.rect.height = height;\n }\n }\n }\n\n // used to get the column widths when rendering to the DOM\n private getRenderedColumnWidth(node: GridNode<T>) {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let colSpan = node.colSpan ?? 1;\n let colIndex = node.colIndex ?? node.index;\n let width = 0;\n for (let i = colIndex; i < colIndex + colSpan; i++) {\n let column = collection.columns[i];\n if (column?.key != null) {\n width += this.columnWidths.get(column.key) ?? 0;\n }\n }\n\n return width;\n }\n\n private getEstimatedHeight(node: GridNode<T>, width: number, height: number | null, estimatedHeight: number | null) {\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (height == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall collection view changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n height = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = node !== previousLayoutNode.node || width !== previousLayoutNode.layoutInfo.rect.width || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n height = estimatedHeight ?? DEFAULT_ROW_HEIGHT;\n isEstimated = true;\n }\n }\n\n return {height, isEstimated};\n }\n\n protected getEstimatedRowHeight(): number {\n return this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_ROW_HEIGHT;\n }\n\n protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.headingHeight ?? this.rowHeight, this.estimatedHeadingHeight ?? this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n // For subclasses.\n // eslint-disable-next-line\n protected isStickyColumn(node: GridNode<T>) {\n return false;\n }\n\n protected buildBody(y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(this.padding, y, 0, 0);\n let layoutInfo = new LayoutInfo('rowgroup', collection.body.key, rect);\n\n let startY = y;\n let skipped = 0;\n let width = 0;\n let children: LayoutNode[] = [];\n let rowHeight = this.getEstimatedRowHeight() + this.gap;\n let childNodes = getChildNodes(collection.body, collection);\n for (let node of childNodes) {\n // Skip rows before the valid rectangle unless they are already cached.\n if (y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n skipped++;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, layoutInfo.key);\n layoutNode.layoutInfo.parentKey = layoutInfo.key;\n layoutNode.index = children.length;\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n width = Math.max(width, layoutNode.layoutInfo.rect.width);\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n let rowsAfterRect = collection.size - (children.length + skipped);\n let lastNode = getLastItem(childNodes);\n\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += rowsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last row in the body,\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && children.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, layoutInfo.key);\n loader.layoutInfo.parentKey = layoutInfo.key;\n loader.index = collection.size;\n width = Math.max(width, loader.layoutInfo.rect.width);\n children.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n // Make sure that the table body gets a height if empty or performing initial load\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n y = this.virtualizer!.visibleRect.maxY;\n } else {\n y -= this.gap;\n }\n\n rect.width = width;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node: collection.body\n };\n }\n\n protected buildNode(node: GridNode<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'headerrow':\n return this.buildHeaderRow(node, x, y);\n case 'item':\n return this.buildRow(node, x, y);\n case 'column':\n case 'placeholder':\n return this.buildColumn(node, x, y);\n case 'cell':\n return this.buildCell(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n default:\n throw new Error('Unknown node type ' + node.type);\n }\n }\n\n protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection as TableCollection<T>;\n let rect = new Rect(x, y, 0, 0);\n let layoutInfo = new LayoutInfo('row', node.key, rect);\n\n let children: LayoutNode[] = [];\n let height = 0;\n for (let child of getChildNodes(node, collection)) {\n if (child.type === 'cell') {\n if (x > this.requestedRect.maxX) {\n // Adjust existing cached layoutInfo to ensure that it is out of view.\n // This can happen due to column resizing.\n let layoutNode = this.layoutNodes.get(child.key);\n if (layoutNode) {\n layoutNode.layoutInfo.rect.x = x;\n x += layoutNode.layoutInfo.rect.width;\n } else {\n break;\n }\n } else {\n let layoutNode = this.buildChild(child, x, y, layoutInfo.key);\n x = layoutNode.layoutInfo.rect.maxX;\n height = Math.max(height, layoutNode.layoutInfo.rect.height);\n layoutNode.index = children.length;\n children.push(layoutNode);\n }\n }\n }\n\n this.setChildHeights(children, height);\n\n rect.width = this.layoutNodes.get(collection.head?.key ?? 'header')!.layoutInfo.rect.width;\n rect.height = height;\n\n return {\n layoutInfo,\n children,\n validRect: rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n let width = this.getRenderedColumnWidth(node);\n let {height, isEstimated} = this.getEstimatedHeight(node, width, this.rowHeight, this.estimatedRowHeight);\n let rect = new Rect(x, y, width, height);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.isSticky = this.isStickyColumn(node);\n layoutInfo.zIndex = layoutInfo.isSticky ? 2 : 1;\n layoutInfo.estimatedSize = isEstimated;\n\n return {\n layoutInfo,\n children: [],\n validRect: rect,\n node\n };\n }\n\n getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n // Adjust rect to keep number of visible rows consistent.\n // (only if height > 1 for getDropTargetFromPoint)\n if (rect.height > 1) {\n let rowHeight = this.getEstimatedRowHeight();\n rect.y = Math.floor(rect.y / rowHeight) * rowHeight;\n rect.height = Math.ceil(rect.height / rowHeight) * rowHeight;\n }\n\n // If layout hasn't yet been done for the requested rect, union the\n // new rect with the existing valid rect, and recompute.\n this.layoutIfNeeded(rect);\n\n let res: LayoutInfo[] = [];\n\n this.buildPersistedIndices();\n for (let node of this.rootNodes) {\n res.push(node.layoutInfo);\n this.addVisibleLayoutInfos(res, node, rect);\n }\n\n return res;\n }\n\n private addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect) {\n if (!node.children || node.children.length === 0) {\n return;\n }\n\n switch (node.layoutInfo.type) {\n case 'header': {\n for (let child of node.children) {\n res.push(child.layoutInfo);\n this.addVisibleLayoutInfos(res, child, rect);\n }\n break;\n }\n case 'rowgroup': {\n let firstVisibleRow = this.binarySearch(node.children, rect.topLeft, 'y');\n let lastVisibleRow = this.binarySearch(node.children, rect.bottomRight, 'y');\n\n // Add persisted rows before the visible rows.\n let persistedRowIndices = this.persistedIndices.get(node.layoutInfo.key);\n let persistIndex = 0;\n while (\n persistedRowIndices &&\n persistIndex < persistedRowIndices.length &&\n persistedRowIndices[persistIndex] < firstVisibleRow\n ) {\n let idx = persistedRowIndices[persistIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n persistIndex++;\n }\n\n for (let i = firstVisibleRow; i <= lastVisibleRow; i++) {\n // Skip persisted rows that overlap with visible cells.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length && persistedRowIndices[persistIndex] < i) {\n persistIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[i], rect);\n }\n\n // Add persisted rows after the visible rows.\n while (persistedRowIndices && persistIndex < persistedRowIndices.length) {\n let idx = persistedRowIndices[persistIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n this.addVisibleLayoutInfos(res, node.children[idx], rect);\n }\n }\n\n // Always include loading sentinel even when virtualized, we assume it is always the last child for now\n let lastRow = node.children.at(-1);\n if (lastRow?.layoutInfo.type === 'loader') {\n res.push(lastRow.layoutInfo);\n }\n break;\n }\n case 'headerrow':\n case 'row': {\n let firstVisibleCell = this.binarySearch(node.children, rect.topLeft, 'x');\n let lastVisibleCell = this.binarySearch(node.children, rect.topRight, 'x');\n let stickyIndex = 0;\n\n // Add persisted/sticky cells before the visible cells.\n let persistedCellIndices = this.persistedIndices.get(node.layoutInfo.key) || this.stickyColumnIndices;\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < firstVisibleCell) {\n let idx = persistedCellIndices[stickyIndex];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n stickyIndex++;\n }\n\n for (let i = firstVisibleCell; i <= lastVisibleCell; i++) {\n // Skip sticky cells that overlap with visible cells.\n while (stickyIndex < persistedCellIndices.length && persistedCellIndices[stickyIndex] < i) {\n stickyIndex++;\n }\n\n res.push(node.children[i].layoutInfo);\n }\n\n // Add any remaining sticky cells after the visible cells.\n while (stickyIndex < persistedCellIndices.length) {\n let idx = persistedCellIndices[stickyIndex++];\n if (idx < node.children.length) {\n res.push(node.children[idx].layoutInfo);\n }\n }\n break;\n }\n default:\n throw new Error('Unknown node type ' + node.layoutInfo.type);\n }\n }\n\n private binarySearch(items: LayoutNode[], point: Point, axis: 'x' | 'y') {\n let low = 0;\n let high = items.length - 1;\n while (low <= high) {\n let mid = (low + high) >> 1;\n let item = items[mid];\n\n if ((axis === 'x' && item.layoutInfo.rect.maxX <= point.x) || (axis === 'y' && item.layoutInfo.rect.maxY <= point.y)) {\n low = mid + 1;\n } else if ((axis === 'x' && item.layoutInfo.rect.x > point.x) || (axis === 'y' && item.layoutInfo.rect.y > point.y)) {\n high = mid - 1;\n } else {\n return mid;\n }\n }\n\n return Math.max(0, Math.min(items.length - 1, low));\n }\n\n private buildPersistedIndices() {\n if (this.virtualizer!.persistedKeys === this.lastPersistedKeys) {\n return;\n }\n\n this.lastPersistedKeys = this.virtualizer!.persistedKeys;\n this.persistedIndices.clear();\n\n // Build a map of parentKey => indices of children to persist.\n for (let key of this.virtualizer!.persistedKeys) {\n let layoutInfo = this.layoutNodes.get(key)?.layoutInfo;\n\n // Walk up ancestors so parents are also persisted if children are.\n while (layoutInfo && layoutInfo.parentKey) {\n let collectionNode = this.virtualizer!.collection.getItem(layoutInfo.key);\n let indices = this.persistedIndices.get(layoutInfo.parentKey);\n if (!indices) {\n // stickyColumnIndices are always persisted along with any cells from persistedKeys.\n indices = collectionNode?.type === 'cell' || collectionNode?.type === 'column' ? [...this.stickyColumnIndices] : [];\n this.persistedIndices.set(layoutInfo.parentKey, indices);\n }\n\n let index = this.layoutNodes.get(layoutInfo.key)?.index;\n if (index != null && !indices.includes(index)) {\n indices.push(index);\n }\n\n layoutInfo = this.layoutNodes.get(layoutInfo.parentKey)?.layoutInfo;\n }\n }\n\n for (let indices of this.persistedIndices.values()) {\n indices.sort((a, b) => a - b);\n }\n }\n\n getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n x += this.virtualizer!.visibleRect.x;\n y += this.virtualizer!.visibleRect.y;\n\n // Find the closest item within on either side of the point using the gap width.\n let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n let candidates = this.getVisibleLayoutInfos(searchRect);\n let key: Key | null = null;\n let minDistance = Infinity;\n for (let candidate of candidates) {\n // Ignore items outside the search rect, e.g. persisted keys.\n if (candidate.type !== 'row' || !candidate.rect.intersects(searchRect)) {\n continue;\n }\n\n let yDist = Math.abs(candidate.rect.y - y);\n let maxYDist = Math.abs(candidate.rect.maxY - y);\n let dist = Math.min(yDist, maxYDist);\n if (dist < minDistance) {\n minDistance = dist;\n key = candidate.key;\n }\n }\n\n if (key == null || this.virtualizer!.collection.size === 0) {\n return {type: 'root'};\n }\n\n let layoutInfo = this.getLayoutInfo(key);\n if (!layoutInfo) {\n return null;\n }\n\n let rect = layoutInfo.rect;\n let target: DropTarget = {\n type: 'item',\n key: layoutInfo.key,\n dropPosition: 'on'\n };\n\n // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n // of the top or bottom of the item.\n if (!isValidDropTarget(target)) {\n if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n target.dropPosition = 'before';\n } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n target.dropPosition = 'after';\n }\n\n return target;\n }\n\n getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n let layoutInfo = super.getDropTargetLayoutInfo(target);\n layoutInfo.parentKey = (this.virtualizer!.collection as TableCollection<T>).body.key;\n return layoutInfo;\n }\n}\n"],"names":[],"version":3,"file":"TableLayout.module.js.map"}
|
|
@@ -31,15 +31,17 @@ const $f2cd6b90da09fa37$var$DEFAULT_OPTIONS = {
|
|
|
31
31
|
minItemSize: new (0, $5TwTj$reactstatelyvirtualizer.Size)(200, 200),
|
|
32
32
|
maxItemSize: new (0, $5TwTj$reactstatelyvirtualizer.Size)(Infinity, Infinity),
|
|
33
33
|
minSpace: new (0, $5TwTj$reactstatelyvirtualizer.Size)(18, 18),
|
|
34
|
+
maxSpace: Infinity,
|
|
34
35
|
maxColumns: Infinity,
|
|
35
36
|
dropIndicatorThickness: 2
|
|
36
37
|
};
|
|
37
38
|
class $f2cd6b90da09fa37$export$e9f7cda058ba8df8 extends (0, $5TwTj$reactstatelyvirtualizer.Layout) {
|
|
38
39
|
shouldInvalidateLayoutOptions(newOptions, oldOptions) {
|
|
39
|
-
return newOptions.maxColumns !== oldOptions.maxColumns || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness || !(newOptions.minItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minItemSize).equals(oldOptions.minItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minItemSize) || !(newOptions.maxItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxItemSize).equals(oldOptions.maxItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxItemSize) || !(newOptions.minSpace || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minSpace).equals(oldOptions.minSpace || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minSpace);
|
|
40
|
+
return newOptions.maxColumns !== oldOptions.maxColumns || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness || !(newOptions.minItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minItemSize).equals(oldOptions.minItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minItemSize) || !(newOptions.maxItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxItemSize).equals(oldOptions.maxItemSize || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxItemSize) || !(newOptions.minSpace || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minSpace).equals(oldOptions.minSpace || $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minSpace) || newOptions.maxHorizontalSpace !== oldOptions.maxHorizontalSpace;
|
|
40
41
|
}
|
|
41
42
|
update(invalidationContext) {
|
|
42
|
-
|
|
43
|
+
var _collection_getItem;
|
|
44
|
+
let { minItemSize: minItemSize = $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minItemSize, maxItemSize: maxItemSize = $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxItemSize, minSpace: minSpace = $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.minSpace, maxHorizontalSpace: maxHorizontalSpace = $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxSpace, maxColumns: maxColumns = $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.maxColumns, dropIndicatorThickness: dropIndicatorThickness = $f2cd6b90da09fa37$var$DEFAULT_OPTIONS.dropIndicatorThickness } = invalidationContext.layoutOptions || {};
|
|
43
45
|
this.dropIndicatorThickness = dropIndicatorThickness;
|
|
44
46
|
let visibleWidth = this.virtualizer.visibleRect.width;
|
|
45
47
|
// The max item width is always the entire viewport.
|
|
@@ -58,8 +60,9 @@ class $f2cd6b90da09fa37$export$e9f7cda058ba8df8 extends (0, $5TwTj$reactstatelyv
|
|
|
58
60
|
let t = (itemWidth - minItemSize.width) / Math.max(1, maxItemWidth - minItemSize.width);
|
|
59
61
|
let itemHeight = minItemSize.height + Math.floor((maxItemHeight - minItemSize.height) * t);
|
|
60
62
|
itemHeight = Math.max(minItemSize.height, Math.min(maxItemHeight, itemHeight));
|
|
61
|
-
// Compute the horizontal spacing and
|
|
62
|
-
let horizontalSpacing = Math.floor((visibleWidth - numColumns * itemWidth) / (numColumns + 1));
|
|
63
|
+
// Compute the horizontal spacing, content height and horizontal margin
|
|
64
|
+
let horizontalSpacing = Math.min(Math.max(maxHorizontalSpace, minSpace.width), Math.floor((visibleWidth - numColumns * itemWidth) / (numColumns + 1)));
|
|
65
|
+
this.margin = Math.floor((visibleWidth - numColumns * itemWidth - horizontalSpacing * (numColumns + 1)) / 2);
|
|
63
66
|
// Setup an array of column heights
|
|
64
67
|
let columnHeights = Array(numColumns).fill(minSpace.height);
|
|
65
68
|
let newLayoutInfos = new Map();
|
|
@@ -75,7 +78,7 @@ class $f2cd6b90da09fa37$export$e9f7cda058ba8df8 extends (0, $5TwTj$reactstatelyv
|
|
|
75
78
|
// Preserve the previous column index so items don't jump around during resizing unless the number of columns changed.
|
|
76
79
|
let prevColumn = numColumns === this.numColumns && oldLayoutInfo && oldLayoutInfo.rect.y < this.virtualizer.visibleRect.maxY ? oldLayoutInfo.column : undefined;
|
|
77
80
|
let column = prevColumn !== null && prevColumn !== void 0 ? prevColumn : columnHeights.reduce((minIndex, h, i)=>h < columnHeights[minIndex] ? i : minIndex, 0);
|
|
78
|
-
let x = horizontalSpacing + column * (itemWidth + horizontalSpacing);
|
|
81
|
+
let x = horizontalSpacing + column * (itemWidth + horizontalSpacing) + this.margin;
|
|
79
82
|
let y = columnHeights[column];
|
|
80
83
|
let rect = new (0, $5TwTj$reactstatelyvirtualizer.Rect)(x, y, itemWidth, height);
|
|
81
84
|
let layoutInfo = new $f2cd6b90da09fa37$var$WaterfallLayoutInfo(node.type, key, rect);
|
|
@@ -113,8 +116,9 @@ class $f2cd6b90da09fa37$export$e9f7cda058ba8df8 extends (0, $5TwTj$reactstatelyv
|
|
|
113
116
|
let layoutInfo = new (0, $5TwTj$reactstatelyvirtualizer.LayoutInfo)('loader', lastNode.key, rect);
|
|
114
117
|
newLayoutInfos.set(lastNode.key, layoutInfo);
|
|
115
118
|
}
|
|
116
|
-
// Reset all columns to the maximum for the next section. If loading, set to 0 so virtualizer doesn't render its body since there aren't items to render
|
|
117
|
-
|
|
119
|
+
// Reset all columns to the maximum for the next section. If loading, set to 0 so virtualizer doesn't render its body since there aren't items to render,
|
|
120
|
+
// except if we are performing skeleton loading
|
|
121
|
+
let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0 && ((_collection_getItem = collection.getItem(collection.getFirstKey())) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.type) !== 'skeleton';
|
|
118
122
|
let maxHeight = isEmptyOrLoading ? 0 : Math.max(...columnHeights);
|
|
119
123
|
this.contentSize = new (0, $5TwTj$reactstatelyvirtualizer.Size)(this.virtualizer.visibleRect.width, maxHeight);
|
|
120
124
|
this.layoutInfos = newLayoutInfos;
|
|
@@ -216,7 +220,7 @@ class $f2cd6b90da09fa37$export$e9f7cda058ba8df8 extends (0, $5TwTj$reactstatelyv
|
|
|
216
220
|
};
|
|
217
221
|
}
|
|
218
222
|
constructor(...args){
|
|
219
|
-
super(...args), this.contentSize = new (0, $5TwTj$reactstatelyvirtualizer.Size)(), this.layoutInfos = new Map(), this.numColumns = 0, this.dropIndicatorThickness = 2;
|
|
223
|
+
super(...args), this.contentSize = new (0, $5TwTj$reactstatelyvirtualizer.Size)(), this.layoutInfos = new Map(), this.numColumns = 0, this.dropIndicatorThickness = 2, this.margin = 0;
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
|