@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.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAqDD,MAAM,uCAAiB;AAOhB,MAAM,kDAAuE,CAAA,GAAA,qCAAK;IA0CvF,0CAA0C;IAC1C,IAAc,aAAkC;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEA,cAAc,GAAQ,EAAqB;YAElC;QADP,IAAI,CAAC,gBAAgB,CAAC;QACtB,OAAO,EAAA,wBAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,kBAArB,4CAAA,sBAA2B,UAAU,KAAI;IAClD;IAEA,sBAAsB,IAAU,EAAgB;QAC9C,yDAAyD;QACzD,kDAAkD;QAClD,IAAI,KAAK,MAAM,GAAG,GAAG;gBACF,iBAAA;YAAjB,IAAI,YAAY,AAAC,CAAA,CAAA,OAAA,CAAA,kBAAA,IAAI,CAAC,SAAS,cAAd,6BAAA,kBAAkB,IAAI,CAAC,kBAAkB,cAAzC,kBAAA,OAA6C,oCAAa,IAAK,IAAI,CAAC,GAAG;YACxF,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,aAAa;YAC1C,KAAK,MAAM,GAAG,KAAK,IAAI,CAAC,KAAK,MAAM,GAAG,aAAa;QACrD;QAEA,mEAAmE;QACnE,wDAAwD;QACxD,IAAI,CAAC,cAAc,CAAC;QAEpB,IAAI,MAAoB,EAAE;QAE1B,IAAI,WAAW,CAAC;YACd,KAAK,IAAI,QAAQ,MACf,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,OAAO;gBAC9B,IAAI,IAAI,CAAC,KAAK,UAAU;gBAExB,IAAI,KAAK,QAAQ,EACf,SAAS,KAAK,QAAQ;YAE1B;QAEJ;QAEA,SAAS,IAAI,CAAC,SAAS;QACvB,OAAO;IAC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C,KAAK;YACY;QAAjB,IAAI,CAAC,SAAS,GAAG,CAAA,qBAAA,QAAQ,SAAS,cAAjB,gCAAA,qBAAqB;YACZ;QAA1B,IAAI,CAAC,kBAAkB,GAAG,CAAA,8BAAA,QAAQ,kBAAkB,cAA1B,yCAAA,8BAA8B;YACnC;QAArB,IAAI,CAAC,aAAa,GAAG,CAAA,yBAAA,QAAQ,aAAa,cAArB,oCAAA,yBAAyB;YAChB;QAA9B,IAAI,CAAC,sBAAsB,GAAG,CAAA,kCAAA,QAAQ,sBAAsB,cAA9B,6CAAA,kCAAkC;YAC5C;QAApB,IAAI,CAAC,YAAY,GAAG,CAAA,wBAAA,QAAQ,YAAY,cAApB,mCAAA,wBAAwB;QAC5C,IAAI,CAAC,sBAAsB,GAAG,QAAQ,sBAAsB,IAAI;QAChE,IAAI,CAAC,GAAG,GAAG,QAAQ,GAAG,IAAI;QAC1B,IAAI,CAAC,OAAO,GAAG,QAAQ,OAAO,IAAI;QAClC,IAAI,CAAC,WAAW,GAAG,IAAI;QACvB,IAAI,CAAC,SAAS,GAAG,EAAE;QACnB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,oBAAoB,GAAG;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA,GAAA,mCAAG;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA,GAAA,mCAAG;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA,GAAA,mCAAG;IAC5B;AAseF","sources":["packages/@react-stately/layout/src/ListLayout.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 {Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\nimport {InvalidationContext, Layout, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface ListLayoutOptions {\n /**\n * The fixed height of a row in px.\n * @default 48\n */\n rowHeight?: number,\n /** The estimated height of a row, when row heights are variable. */\n estimatedRowHeight?: number,\n /**\n * The fixed height of a section header in px.\n * @default 48\n */\n headingHeight?: number,\n /** The estimated height of a section header, when the height is variable. */\n estimatedHeadingHeight?: number,\n /**\n * The fixed height of a loader element in px. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n */\n loaderHeight?: number,\n /**\n * The thickness of the drop indicator.\n * @default 2\n */\n dropIndicatorThickness?: number,\n /**\n * The gap between items.\n * @default 0\n */\n gap?: number,\n /**\n * The padding around the list.\n * @default 0\n */\n padding?: number\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n node?: Node<unknown>,\n layoutInfo: LayoutInfo,\n children?: LayoutNode[],\n validRect: Rect,\n index?: number\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a vertical stack. It supports both fixed\n * and variable height items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {\n protected rowHeight: number | null;\n protected estimatedRowHeight: number | null;\n protected headingHeight: number | null;\n protected estimatedHeadingHeight: number | null;\n protected loaderHeight: number | null;\n protected dropIndicatorThickness: number;\n protected gap: number;\n protected padding: number;\n protected layoutNodes: Map<Key, LayoutNode>;\n protected contentSize: Size;\n protected lastCollection: Collection<Node<T>> | null;\n protected rootNodes: LayoutNode[];\n private invalidateEverything: boolean;\n /** The rectangle containing currently valid layout infos. */\n protected validRect: Rect;\n /** The rectangle of requested layout infos so far. */\n protected requestedRect: Rect;\n\n /**\n * Creates a new ListLayout with options. See the list of properties below for a description\n * of the options that can be provided.\n */\n constructor(options: ListLayoutOptions = {}) {\n super();\n this.rowHeight = options.rowHeight ?? null;\n this.estimatedRowHeight = options.estimatedRowHeight ?? null;\n this.headingHeight = options.headingHeight ?? null;\n this.estimatedHeadingHeight = options.estimatedHeadingHeight ?? null;\n this.loaderHeight = options.loaderHeight ?? null;\n this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n this.gap = options.gap || 0;\n this.padding = options.padding || 0;\n this.layoutNodes = new Map();\n this.rootNodes = [];\n this.lastCollection = null;\n this.invalidateEverything = false;\n this.validRect = new Rect();\n this.requestedRect = new Rect();\n this.contentSize = new Size();\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): Collection<Node<T>> {\n return this.virtualizer!.collection;\n }\n\n getLayoutInfo(key: Key): LayoutInfo | null {\n this.ensureLayoutInfo(key);\n return this.layoutNodes.get(key)?.layoutInfo || null;\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.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\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 let addNodes = (nodes: LayoutNode[]) => {\n for (let node of nodes) {\n if (this.isVisible(node, rect)) {\n res.push(node.layoutInfo);\n\n if (node.children) {\n addNodes(node.children);\n }\n }\n }\n };\n\n addNodes(this.rootNodes);\n return res;\n }\n\n protected layoutIfNeeded(rect: Rect): void {\n if (!this.lastCollection) {\n return;\n }\n\n if (!this.requestedRect.containsRect(rect)) {\n this.requestedRect = this.requestedRect.union(rect);\n this.rootNodes = this.buildCollection();\n }\n\n // Ensure all of the persisted keys are available.\n for (let key of this.virtualizer!.persistedKeys) {\n if (this.ensureLayoutInfo(key)) {\n return;\n }\n }\n }\n\n private ensureLayoutInfo(key: Key) {\n // If the layout info wasn't found, it might be outside the bounds of the area that we've\n // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n // Compute the full layout and try again.\n if (!this.layoutNodes.has(key) && this.requestedRect.area < this.contentSize.area && this.lastCollection) {\n this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n this.rootNodes = this.buildCollection();\n this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n return true;\n }\n\n return false;\n }\n\n protected isVisible(node: LayoutNode, rect: Rect): boolean {\n return node.layoutInfo.rect.intersects(rect) || node.layoutInfo.isSticky || node.layoutInfo.type === 'header' || node.layoutInfo.type === 'loader' || this.virtualizer!.isPersistedKey(node.layoutInfo.key);\n }\n\n protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n // Invalidate cache if the size of the collection changed.\n // In this case, we need to recalculate the entire layout.\n // Also invalidate if fixed sizes/gaps change.\n let options = invalidationContext.layoutOptions;\n return invalidationContext.sizeChanged\n || this.rowHeight !== (options?.rowHeight ?? this.rowHeight)\n || this.headingHeight !== (options?.headingHeight ?? this.headingHeight)\n || this.loaderHeight !== (options?.loaderHeight ?? this.loaderHeight)\n || this.gap !== (options?.gap ?? this.gap)\n || this.padding !== (options?.padding ?? this.padding);\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.rowHeight !== oldOptions.rowHeight\n || newOptions.estimatedRowHeight !== oldOptions.estimatedRowHeight\n || newOptions.headingHeight !== oldOptions.headingHeight\n || newOptions.estimatedHeadingHeight !== oldOptions.estimatedHeadingHeight\n || newOptions.loaderHeight !== oldOptions.loaderHeight\n || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n || newOptions.gap !== oldOptions.gap\n || newOptions.padding !== oldOptions.padding;\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let collection = this.virtualizer!.collection;\n\n // Reset valid rect if we will have to invalidate everything.\n // Otherwise we can reuse cached layout infos outside the current visible rect.\n this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n if (this.invalidateEverything) {\n this.requestedRect = this.virtualizer!.visibleRect.copy();\n this.layoutNodes.clear();\n }\n\n let options = invalidationContext.layoutOptions;\n this.rowHeight = options?.rowHeight ?? this.rowHeight;\n this.estimatedRowHeight = options?.estimatedRowHeight ?? this.estimatedRowHeight;\n this.headingHeight = options?.headingHeight ?? this.headingHeight;\n this.estimatedHeadingHeight = options?.estimatedHeadingHeight ?? this.estimatedHeadingHeight;\n this.loaderHeight = options?.loaderHeight ?? this.loaderHeight;\n this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n this.gap = options?.gap ?? this.gap;\n this.padding = options?.padding ?? this.padding;\n\n this.rootNodes = this.buildCollection();\n\n // Remove deleted layout nodes\n if (this.lastCollection && collection !== this.lastCollection) {\n for (let key of this.lastCollection.getKeys()) {\n if (!collection.getItem(key)) {\n let layoutNode = this.layoutNodes.get(key);\n if (layoutNode) {\n this.layoutNodes.delete(key);\n }\n }\n }\n }\n\n this.lastCollection = collection;\n this.invalidateEverything = false;\n this.validRect = this.requestedRect.copy();\n }\n\n protected buildCollection(y = this.padding): LayoutNode[] {\n let collection = this.virtualizer!.collection;\n let skipped = 0;\n let nodes: LayoutNode[] = [];\n let isEmptyOrLoading = collection?.size === 0 || (collection.size === 1 && collection.getItem(collection.getFirstKey()!)!.type === 'loader');\n if (isEmptyOrLoading) {\n y = 0;\n }\n\n for (let node of collection) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n // Skip rows before the valid rectangle unless they are already cached.\n if (node.type === 'item' && 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, null);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n nodes.push(layoutNode);\n if (node.type === 'item' && y > this.requestedRect.maxY) {\n let itemsAfterRect = collection.size - (nodes.length + skipped);\n let lastNode = collection.getItem(collection.getLastKey()!);\n if (lastNode?.type === 'loader') {\n itemsAfterRect--;\n }\n\n y += itemsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last option/row\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && nodes.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, null);\n nodes.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n y -= this.gap;\n y += isEmptyOrLoading ? 0 : this.padding;\n this.contentSize = new Size(this.virtualizer!.visibleRect.width, y);\n return nodes;\n }\n\n protected isValid(node: Node<T>, y: number): boolean {\n let cached = this.layoutNodes.get(node.key);\n return (\n !this.invalidateEverything &&\n !!cached &&\n cached.node === node &&\n y === cached.layoutInfo.rect.y &&\n cached.layoutInfo.rect.intersects(this.validRect) &&\n cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n );\n }\n\n protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n if (this.isValid(node, y)) {\n return this.layoutNodes.get(node.key)!;\n }\n\n let layoutNode = this.buildNode(node, x, y);\n\n layoutNode.layoutInfo.parentKey = parentKey ?? null;\n layoutNode.layoutInfo.allowOverflow = true;\n this.layoutNodes.set(node.key, layoutNode);\n return layoutNode;\n }\n\n protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'section':\n return this.buildSection(node, x, y);\n case 'item':\n return this.buildItem(node, x, y);\n case 'header':\n return this.buildSectionHeader(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n case 'separator':\n return this.buildItem(node, x, y);\n default:\n throw new Error('Unsupported node type: ' + node.type);\n }\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, this.padding, 0);\n let layoutInfo = new LayoutInfo('loader', node.key, rect);\n rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n rect.height = node.props.isLoading ? this.loaderHeight ?? this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT : 0;\n\n return {\n layoutInfo,\n validRect: rect.intersection(this.requestedRect)\n };\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection;\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rect = new Rect(x, y, width - x, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n let startY = y;\n let skipped = 0;\n let children: LayoutNode[] = [];\n for (let child of getChildNodes(node, collection)) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n\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(child, x, y, layoutInfo.key);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n break;\n }\n }\n\n y -= this.gap;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rectHeight = this.headingHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n if (previousLayoutInfo) {\n let curNode = this.virtualizer!.collection.getItem(node.key);\n let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n rectHeight = previousLayoutInfo.rect.height;\n isEstimated = width !== previousLayoutInfo.rect.width || curNode !== lastNode || previousLayoutInfo.estimatedSize;\n } else {\n rectHeight = (node.rendered ? this.estimatedHeadingHeight : 0);\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let headerRect = new Rect(x, y, width - x, rectHeight);\n let header = new LayoutInfo('header', node.key, headerRect);\n header.estimatedSize = isEstimated;\n return {\n layoutInfo: header,\n children: [],\n validRect: header.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding - x;\n let rectHeight = this.rowHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n rectHeight = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = width !== previousLayoutNode.layoutInfo.rect.width || node !== previousLayoutNode.node || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n rectHeight = this.estimatedRowHeight;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let rect = new Rect(x, y, width, rectHeight);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.estimatedSize = isEstimated;\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n updateItemSize(key: Key, size: Size): boolean {\n let layoutNode = this.layoutNodes.get(key);\n // If no layoutInfo, item has been deleted/removed.\n if (!layoutNode) {\n return false;\n }\n\n let collection = this.virtualizer!.collection;\n let layoutInfo = layoutNode.layoutInfo;\n layoutInfo.estimatedSize = false;\n if (layoutInfo.rect.height !== size.height) {\n // Copy layout info rather than mutating so that later caches are invalidated.\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height;\n layoutNode.layoutInfo = newLayoutInfo;\n\n // Items after this layoutInfo will need to be repositioned to account for the new height.\n // Adjust the validRect so that only items above remain valid.\n this.validRect.height = Math.min(this.validRect.height, layoutInfo.rect.y - this.validRect.y);\n\n // The requestedRect also needs to be adjusted to account for the height difference.\n this.requestedRect.height += newLayoutInfo.rect.height - layoutInfo.rect.height;\n\n // Invalidate layout for this layout node and all parents\n this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n while (node) {\n this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n }\n\n return true;\n }\n\n return false;\n }\n\n private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n let n = this.layoutNodes.get(key);\n if (n) {\n // Invalidate by intersecting the validRect of this node with the overall validRect.\n n.validRect = n.validRect.intersection(this.validRect);\n\n // Replace layout info in LayoutNode\n if (n.layoutInfo === oldLayoutInfo) {\n n.layoutInfo = newLayoutInfo;\n }\n }\n }\n\n getContentSize(): Size {\n return this.contentSize;\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.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 = this.getLayoutInfo(target.key)!;\n let rect: Rect;\n if (target.dropPosition === 'before') {\n rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.y - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else if (target.dropPosition === 'after') {\n rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else {\n rect = layoutInfo.rect;\n }\n\n return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n }\n}\n"],"names":[],"version":3,"file":"ListLayout.main.js.map"}
1
+ {"mappings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,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA,GAAA,mCAAG;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA,GAAA,mCAAG;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA,GAAA,mCAAG;IAC5B;AA4fF","sources":["packages/@react-stately/layout/src/ListLayout.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 {Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\nimport {InvalidationContext, Layout, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface ListLayoutOptions {\n /**\n * The fixed height of a row in px.\n * @default 48\n */\n rowHeight?: number,\n /** The estimated height of a row, when row heights are variable. */\n estimatedRowHeight?: number,\n /**\n * The fixed height of a section header in px.\n * @default 48\n */\n headingHeight?: number,\n /** The estimated height of a section header, when the height is variable. */\n estimatedHeadingHeight?: number,\n /**\n * The fixed height of a loader element in px. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n */\n loaderHeight?: number,\n /**\n * The thickness of the drop indicator.\n * @default 2\n */\n dropIndicatorThickness?: number,\n /**\n * The gap between items.\n * @default 0\n */\n gap?: number,\n /**\n * The padding around the list.\n * @default 0\n */\n padding?: number\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n node?: Node<unknown>,\n layoutInfo: LayoutInfo,\n children?: LayoutNode[],\n validRect: Rect,\n index?: number\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a vertical stack. It supports both fixed\n * and variable height items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {\n protected rowHeight: number | null;\n protected estimatedRowHeight: number | null;\n protected headingHeight: number | null;\n protected estimatedHeadingHeight: number | null;\n protected loaderHeight: number | null;\n protected dropIndicatorThickness: number;\n protected gap: number;\n protected padding: number;\n protected layoutNodes: Map<Key, LayoutNode>;\n protected contentSize: Size;\n protected lastCollection: Collection<Node<T>> | null;\n protected rootNodes: LayoutNode[];\n private invalidateEverything: boolean;\n /** The rectangle containing currently valid layout infos. */\n protected validRect: Rect;\n /** The rectangle of requested layout infos so far. */\n protected requestedRect: Rect;\n\n /**\n * Creates a new ListLayout with options. See the list of properties below for a description\n * of the options that can be provided.\n */\n constructor(options: ListLayoutOptions = {}) {\n super();\n this.rowHeight = options.rowHeight ?? null;\n this.estimatedRowHeight = options.estimatedRowHeight ?? null;\n this.headingHeight = options.headingHeight ?? null;\n this.estimatedHeadingHeight = options.estimatedHeadingHeight ?? null;\n this.loaderHeight = options.loaderHeight ?? null;\n this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n this.gap = options.gap || 0;\n this.padding = options.padding || 0;\n this.layoutNodes = new Map();\n this.rootNodes = [];\n this.lastCollection = null;\n this.invalidateEverything = false;\n this.validRect = new Rect();\n this.requestedRect = new Rect();\n this.contentSize = new Size();\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): Collection<Node<T>> {\n return this.virtualizer!.collection;\n }\n\n getLayoutInfo(key: Key): LayoutInfo | null {\n this.ensureLayoutInfo(key);\n return this.layoutNodes.get(key)?.layoutInfo || null;\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.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\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 let addNodes = (nodes: LayoutNode[]) => {\n for (let node of nodes) {\n if (this.isVisible(node, rect)) {\n res.push(node.layoutInfo);\n\n if (node.children) {\n addNodes(node.children);\n }\n }\n }\n };\n\n addNodes(this.rootNodes);\n return res;\n }\n\n protected layoutIfNeeded(rect: Rect): void {\n if (!this.lastCollection) {\n return;\n }\n\n if (!this.requestedRect.containsRect(rect)) {\n this.requestedRect = this.requestedRect.union(rect);\n this.rootNodes = this.buildCollection();\n }\n\n // Ensure all of the persisted keys are available.\n for (let key of this.virtualizer!.persistedKeys) {\n if (this.ensureLayoutInfo(key)) {\n return;\n }\n }\n }\n\n private ensureLayoutInfo(key: Key) {\n // If the layout info wasn't found, it might be outside the bounds of the area that we've\n // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n // Compute the full layout and try again.\n if (!this.layoutNodes.has(key) && this.requestedRect.area < this.contentSize.area && this.lastCollection) {\n this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n this.rootNodes = this.buildCollection();\n this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n return true;\n }\n\n return false;\n }\n\n protected isVisible(node: LayoutNode, rect: Rect): boolean {\n return node.layoutInfo.rect.intersects(rect) || node.layoutInfo.isSticky || node.layoutInfo.type === 'header' || node.layoutInfo.type === 'loader' || this.virtualizer!.isPersistedKey(node.layoutInfo.key);\n }\n\n protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n // Invalidate cache if the size of the collection changed.\n // In this case, we need to recalculate the entire layout.\n // Also invalidate if fixed sizes/gaps change.\n let options = invalidationContext.layoutOptions;\n return invalidationContext.sizeChanged\n || this.rowHeight !== (options?.rowHeight ?? this.rowHeight)\n || this.headingHeight !== (options?.headingHeight ?? this.headingHeight)\n || this.loaderHeight !== (options?.loaderHeight ?? this.loaderHeight)\n || this.gap !== (options?.gap ?? this.gap)\n || this.padding !== (options?.padding ?? this.padding);\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.rowHeight !== oldOptions.rowHeight\n || newOptions.estimatedRowHeight !== oldOptions.estimatedRowHeight\n || newOptions.headingHeight !== oldOptions.headingHeight\n || newOptions.estimatedHeadingHeight !== oldOptions.estimatedHeadingHeight\n || newOptions.loaderHeight !== oldOptions.loaderHeight\n || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n || newOptions.gap !== oldOptions.gap\n || newOptions.padding !== oldOptions.padding;\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let collection = this.virtualizer!.collection;\n\n // Reset valid rect if we will have to invalidate everything.\n // Otherwise we can reuse cached layout infos outside the current visible rect.\n this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n if (this.invalidateEverything) {\n this.requestedRect = this.virtualizer!.visibleRect.copy();\n this.layoutNodes.clear();\n }\n\n let options = invalidationContext.layoutOptions;\n this.rowHeight = options?.rowHeight ?? this.rowHeight;\n this.estimatedRowHeight = options?.estimatedRowHeight ?? this.estimatedRowHeight;\n this.headingHeight = options?.headingHeight ?? this.headingHeight;\n this.estimatedHeadingHeight = options?.estimatedHeadingHeight ?? this.estimatedHeadingHeight;\n this.loaderHeight = options?.loaderHeight ?? this.loaderHeight;\n this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n this.gap = options?.gap ?? this.gap;\n this.padding = options?.padding ?? this.padding;\n\n this.rootNodes = this.buildCollection();\n\n // Remove deleted layout nodes\n if (this.lastCollection && collection !== this.lastCollection) {\n for (let key of this.lastCollection.getKeys()) {\n if (!collection.getItem(key)) {\n let layoutNode = this.layoutNodes.get(key);\n if (layoutNode) {\n this.layoutNodes.delete(key);\n }\n }\n }\n }\n\n this.lastCollection = collection;\n this.invalidateEverything = false;\n this.validRect = this.requestedRect.copy();\n }\n\n protected buildCollection(y: number = this.padding): LayoutNode[] {\n let collection = this.virtualizer!.collection;\n let collectionNodes = [...collection];\n let loaderNodes = collectionNodes.filter(node => node.type === 'loader');\n let nodes: LayoutNode[] = [];\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n y = 0;\n }\n\n for (let node of collectionNodes) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n // Skip rows before the valid rectangle unless they are already cached.\n if (node.type === 'item' && y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, null);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n nodes.push(layoutNode);\n if (node.type === 'loader') {\n let index = loaderNodes.indexOf(node);\n loaderNodes.splice(index, 1);\n }\n\n // Build each loader that exists in the collection that is outside the visible rect so that they are persisted\n // at the proper estimated location. If the node.type is \"section\" then we don't do this shortcut since we have to\n // build the sections to see how tall they are.\n if ((node.type === 'item' || node.type === 'loader') && y > this.requestedRect.maxY) {\n let lastProcessedIndex = collectionNodes.indexOf(node);\n for (let loaderNode of loaderNodes) {\n let loaderNodeIndex = collectionNodes.indexOf(loaderNode);\n // Subtract by an additional 1 since we've already added the current item's height to y\n y += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;\n let loader = this.buildChild(loaderNode, this.padding, y, null);\n nodes.push(loader);\n y = loader.layoutInfo.rect.maxY;\n lastProcessedIndex = loaderNodeIndex;\n }\n\n // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already\n y += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;\n break;\n }\n }\n\n y -= this.gap;\n y += isEmptyOrLoading ? 0 : this.padding;\n this.contentSize = new Size(this.virtualizer!.visibleRect.width, y);\n return nodes;\n }\n\n protected isValid(node: Node<T>, y: number): boolean {\n let cached = this.layoutNodes.get(node.key);\n return (\n !this.invalidateEverything &&\n !!cached &&\n cached.node === node &&\n y === cached.layoutInfo.rect.y &&\n cached.layoutInfo.rect.intersects(this.validRect) &&\n cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n );\n }\n\n protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n if (this.isValid(node, y)) {\n return this.layoutNodes.get(node.key)!;\n }\n\n let layoutNode = this.buildNode(node, x, y);\n\n layoutNode.layoutInfo.parentKey = parentKey ?? null;\n layoutNode.layoutInfo.allowOverflow = true;\n this.layoutNodes.set(node.key, layoutNode);\n return layoutNode;\n }\n\n protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'section':\n return this.buildSection(node, x, y);\n case 'item':\n return this.buildItem(node, x, y);\n case 'header':\n return this.buildSectionHeader(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n case 'separator':\n return this.buildItem(node, x, y);\n default:\n throw new Error('Unsupported node type: ' + node.type);\n }\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, this.padding, 0);\n let layoutInfo = new LayoutInfo('loader', node.key, rect);\n rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n rect.height = node.props.isLoading ? this.loaderHeight ?? this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT : 0;\n\n return {\n layoutInfo,\n validRect: rect.intersection(this.requestedRect)\n };\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection;\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rect = new Rect(x, y, width - x, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n let startY = y;\n let skipped = 0;\n let children: LayoutNode[] = [];\n for (let child of getChildNodes(node, collection)) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n\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(child, x, y, layoutInfo.key);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n break;\n }\n }\n\n y -= this.gap;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rectHeight = this.headingHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n if (previousLayoutInfo) {\n let curNode = this.virtualizer!.collection.getItem(node.key);\n let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n rectHeight = previousLayoutInfo.rect.height;\n isEstimated = width !== previousLayoutInfo.rect.width || curNode !== lastNode || previousLayoutInfo.estimatedSize;\n } else {\n rectHeight = (node.rendered ? this.estimatedHeadingHeight : 0);\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let headerRect = new Rect(x, y, width - x, rectHeight);\n let header = new LayoutInfo('header', node.key, headerRect);\n header.estimatedSize = isEstimated;\n return {\n layoutInfo: header,\n children: [],\n validRect: header.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding - x;\n let rectHeight = this.rowHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n rectHeight = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = width !== previousLayoutNode.layoutInfo.rect.width || node !== previousLayoutNode.node || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n rectHeight = this.estimatedRowHeight;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let rect = new Rect(x, y, width, rectHeight);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.estimatedSize = isEstimated;\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n updateItemSize(key: Key, size: Size): boolean {\n let layoutNode = this.layoutNodes.get(key);\n // If no layoutInfo, item has been deleted/removed.\n if (!layoutNode) {\n return false;\n }\n\n let collection = this.virtualizer!.collection;\n let layoutInfo = layoutNode.layoutInfo;\n layoutInfo.estimatedSize = false;\n if (layoutInfo.rect.height !== size.height) {\n // Copy layout info rather than mutating so that later caches are invalidated.\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height;\n layoutNode.layoutInfo = newLayoutInfo;\n\n // Items after this layoutInfo will need to be repositioned to account for the new height.\n // Adjust the validRect so that only items above remain valid.\n this.validRect.height = Math.min(this.validRect.height, layoutInfo.rect.y - this.validRect.y);\n\n // The requestedRect also needs to be adjusted to account for the height difference.\n this.requestedRect.height += newLayoutInfo.rect.height - layoutInfo.rect.height;\n\n // Invalidate layout for this layout node and all parents\n this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n while (node) {\n this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n }\n\n return true;\n }\n\n return false;\n }\n\n private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n let n = this.layoutNodes.get(key);\n if (n) {\n // Invalidate by intersecting the validRect of this node with the overall validRect.\n n.validRect = n.validRect.intersection(this.validRect);\n\n // Replace layout info in LayoutNode\n if (n.layoutInfo === oldLayoutInfo) {\n n.layoutInfo = newLayoutInfo;\n }\n }\n }\n\n getContentSize(): Size {\n return this.contentSize;\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.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 = this.getLayoutInfo(target.key)!;\n let rect: Rect;\n if (target.dropPosition === 'before') {\n rect = new Rect(layoutInfo.rect.x, Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2), layoutInfo.rect.width, this.dropIndicatorThickness);\n } else if (target.dropPosition === 'after') {\n // Render after last visible descendant of the drop target.\n let targetNode = this.collection.getItem(target.key);\n if (targetNode) {\n let targetLevel = targetNode.level ?? 0;\n let currentKey = this.collection.getKeyAfter(target.key);\n\n while (currentKey != null) {\n let node = this.collection.getItem(currentKey);\n if (!node || node.level <= targetLevel) {\n break;\n }\n\n layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;\n currentKey = this.collection.getKeyAfter(currentKey);\n }\n }\n rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else {\n rect = layoutInfo.rect;\n }\n\n return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n }\n}\n"],"names":[],"version":3,"file":"ListLayout.main.js.map"}
@@ -123,35 +123,44 @@ class $61ef60fc9b1041f4$export$cacbb3924155d68e extends (0, $img26$Layout) {
123
123
  }
124
124
  buildCollection(y = this.padding) {
125
125
  let collection = this.virtualizer.collection;
126
- let skipped = 0;
126
+ let collectionNodes = [
127
+ ...collection
128
+ ];
129
+ let loaderNodes = collectionNodes.filter((node)=>node.type === 'loader');
127
130
  let nodes = [];
128
- let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0 || collection.size === 1 && collection.getItem(collection.getFirstKey()).type === 'loader';
131
+ let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0;
129
132
  if (isEmptyOrLoading) y = 0;
130
- for (let node of collection){
133
+ for (let node of collectionNodes){
131
134
  var _this_rowHeight, _ref;
132
135
  let rowHeight = ((_ref = (_this_rowHeight = this.rowHeight) !== null && _this_rowHeight !== void 0 ? _this_rowHeight : this.estimatedRowHeight) !== null && _ref !== void 0 ? _ref : $61ef60fc9b1041f4$var$DEFAULT_HEIGHT) + this.gap;
133
136
  // Skip rows before the valid rectangle unless they are already cached.
134
137
  if (node.type === 'item' && y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {
135
138
  y += rowHeight;
136
- skipped++;
137
139
  continue;
138
140
  }
139
141
  let layoutNode = this.buildChild(node, this.padding, y, null);
140
142
  y = layoutNode.layoutInfo.rect.maxY + this.gap;
141
143
  nodes.push(layoutNode);
142
- if (node.type === 'item' && y > this.requestedRect.maxY) {
143
- var _nodes_at;
144
- let itemsAfterRect = collection.size - (nodes.length + skipped);
145
- let lastNode = collection.getItem(collection.getLastKey());
146
- if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader') itemsAfterRect--;
147
- y += itemsAfterRect * rowHeight;
148
- // Always add the loader sentinel if present. This assumes the loader is the last option/row
149
- // will need to refactor when handling multi section loading
150
- if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader' && ((_nodes_at = nodes.at(-1)) === null || _nodes_at === void 0 ? void 0 : _nodes_at.layoutInfo.type) !== 'loader') {
151
- let loader = this.buildChild(lastNode, this.padding, y, null);
144
+ if (node.type === 'loader') {
145
+ let index = loaderNodes.indexOf(node);
146
+ loaderNodes.splice(index, 1);
147
+ }
148
+ // Build each loader that exists in the collection that is outside the visible rect so that they are persisted
149
+ // at the proper estimated location. If the node.type is "section" then we don't do this shortcut since we have to
150
+ // build the sections to see how tall they are.
151
+ if ((node.type === 'item' || node.type === 'loader') && y > this.requestedRect.maxY) {
152
+ let lastProcessedIndex = collectionNodes.indexOf(node);
153
+ for (let loaderNode of loaderNodes){
154
+ let loaderNodeIndex = collectionNodes.indexOf(loaderNode);
155
+ // Subtract by an additional 1 since we've already added the current item's height to y
156
+ y += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;
157
+ let loader = this.buildChild(loaderNode, this.padding, y, null);
152
158
  nodes.push(loader);
153
159
  y = loader.layoutInfo.rect.maxY;
160
+ lastProcessedIndex = loaderNodeIndex;
154
161
  }
162
+ // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already
163
+ y += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;
155
164
  break;
156
165
  }
157
166
  }
@@ -394,9 +403,23 @@ class $61ef60fc9b1041f4$export$cacbb3924155d68e extends (0, $img26$Layout) {
394
403
  getDropTargetLayoutInfo(target) {
395
404
  let layoutInfo = this.getLayoutInfo(target.key);
396
405
  let rect;
397
- if (target.dropPosition === 'before') rect = new (0, $img26$Rect)(layoutInfo.rect.x, layoutInfo.rect.y - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);
398
- else if (target.dropPosition === 'after') rect = new (0, $img26$Rect)(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);
399
- else rect = layoutInfo.rect;
406
+ if (target.dropPosition === 'before') rect = new (0, $img26$Rect)(layoutInfo.rect.x, Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2), layoutInfo.rect.width, this.dropIndicatorThickness);
407
+ else if (target.dropPosition === 'after') {
408
+ // Render after last visible descendant of the drop target.
409
+ let targetNode = this.collection.getItem(target.key);
410
+ if (targetNode) {
411
+ var _targetNode_level;
412
+ let targetLevel = (_targetNode_level = targetNode.level) !== null && _targetNode_level !== void 0 ? _targetNode_level : 0;
413
+ let currentKey = this.collection.getKeyAfter(target.key);
414
+ while(currentKey != null){
415
+ let node = this.collection.getItem(currentKey);
416
+ if (!node || node.level <= targetLevel) break;
417
+ layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;
418
+ currentKey = this.collection.getKeyAfter(currentKey);
419
+ }
420
+ }
421
+ rect = new (0, $img26$Rect)(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);
422
+ } else rect = layoutInfo.rect;
400
423
  return new (0, $img26$LayoutInfo)('dropIndicator', target.key + ':' + target.dropPosition, rect);
401
424
  }
402
425
  /**
@@ -123,35 +123,44 @@ class $61ef60fc9b1041f4$export$cacbb3924155d68e extends (0, $img26$Layout) {
123
123
  }
124
124
  buildCollection(y = this.padding) {
125
125
  let collection = this.virtualizer.collection;
126
- let skipped = 0;
126
+ let collectionNodes = [
127
+ ...collection
128
+ ];
129
+ let loaderNodes = collectionNodes.filter((node)=>node.type === 'loader');
127
130
  let nodes = [];
128
- let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0 || collection.size === 1 && collection.getItem(collection.getFirstKey()).type === 'loader';
131
+ let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0;
129
132
  if (isEmptyOrLoading) y = 0;
130
- for (let node of collection){
133
+ for (let node of collectionNodes){
131
134
  var _this_rowHeight, _ref;
132
135
  let rowHeight = ((_ref = (_this_rowHeight = this.rowHeight) !== null && _this_rowHeight !== void 0 ? _this_rowHeight : this.estimatedRowHeight) !== null && _ref !== void 0 ? _ref : $61ef60fc9b1041f4$var$DEFAULT_HEIGHT) + this.gap;
133
136
  // Skip rows before the valid rectangle unless they are already cached.
134
137
  if (node.type === 'item' && y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {
135
138
  y += rowHeight;
136
- skipped++;
137
139
  continue;
138
140
  }
139
141
  let layoutNode = this.buildChild(node, this.padding, y, null);
140
142
  y = layoutNode.layoutInfo.rect.maxY + this.gap;
141
143
  nodes.push(layoutNode);
142
- if (node.type === 'item' && y > this.requestedRect.maxY) {
143
- var _nodes_at;
144
- let itemsAfterRect = collection.size - (nodes.length + skipped);
145
- let lastNode = collection.getItem(collection.getLastKey());
146
- if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader') itemsAfterRect--;
147
- y += itemsAfterRect * rowHeight;
148
- // Always add the loader sentinel if present. This assumes the loader is the last option/row
149
- // will need to refactor when handling multi section loading
150
- if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader' && ((_nodes_at = nodes.at(-1)) === null || _nodes_at === void 0 ? void 0 : _nodes_at.layoutInfo.type) !== 'loader') {
151
- let loader = this.buildChild(lastNode, this.padding, y, null);
144
+ if (node.type === 'loader') {
145
+ let index = loaderNodes.indexOf(node);
146
+ loaderNodes.splice(index, 1);
147
+ }
148
+ // Build each loader that exists in the collection that is outside the visible rect so that they are persisted
149
+ // at the proper estimated location. If the node.type is "section" then we don't do this shortcut since we have to
150
+ // build the sections to see how tall they are.
151
+ if ((node.type === 'item' || node.type === 'loader') && y > this.requestedRect.maxY) {
152
+ let lastProcessedIndex = collectionNodes.indexOf(node);
153
+ for (let loaderNode of loaderNodes){
154
+ let loaderNodeIndex = collectionNodes.indexOf(loaderNode);
155
+ // Subtract by an additional 1 since we've already added the current item's height to y
156
+ y += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;
157
+ let loader = this.buildChild(loaderNode, this.padding, y, null);
152
158
  nodes.push(loader);
153
159
  y = loader.layoutInfo.rect.maxY;
160
+ lastProcessedIndex = loaderNodeIndex;
154
161
  }
162
+ // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already
163
+ y += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;
155
164
  break;
156
165
  }
157
166
  }
@@ -394,9 +403,23 @@ class $61ef60fc9b1041f4$export$cacbb3924155d68e extends (0, $img26$Layout) {
394
403
  getDropTargetLayoutInfo(target) {
395
404
  let layoutInfo = this.getLayoutInfo(target.key);
396
405
  let rect;
397
- if (target.dropPosition === 'before') rect = new (0, $img26$Rect)(layoutInfo.rect.x, layoutInfo.rect.y - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);
398
- else if (target.dropPosition === 'after') rect = new (0, $img26$Rect)(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);
399
- else rect = layoutInfo.rect;
406
+ if (target.dropPosition === 'before') rect = new (0, $img26$Rect)(layoutInfo.rect.x, Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2), layoutInfo.rect.width, this.dropIndicatorThickness);
407
+ else if (target.dropPosition === 'after') {
408
+ // Render after last visible descendant of the drop target.
409
+ let targetNode = this.collection.getItem(target.key);
410
+ if (targetNode) {
411
+ var _targetNode_level;
412
+ let targetLevel = (_targetNode_level = targetNode.level) !== null && _targetNode_level !== void 0 ? _targetNode_level : 0;
413
+ let currentKey = this.collection.getKeyAfter(target.key);
414
+ while(currentKey != null){
415
+ let node = this.collection.getItem(currentKey);
416
+ if (!node || node.level <= targetLevel) break;
417
+ layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;
418
+ currentKey = this.collection.getKeyAfter(currentKey);
419
+ }
420
+ }
421
+ rect = new (0, $img26$Rect)(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);
422
+ } else rect = layoutInfo.rect;
400
423
  return new (0, $img26$LayoutInfo)('dropIndicator', target.key + ':' + target.dropPosition, rect);
401
424
  }
402
425
  /**
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAqDD,MAAM,uCAAiB;AAOhB,MAAM,kDAAuE,CAAA,GAAA,aAAK;IA0CvF,0CAA0C;IAC1C,IAAc,aAAkC;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEA,cAAc,GAAQ,EAAqB;YAElC;QAD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;QAApB,IAAI,CAAC,YAAY,GAAG,CAAA,wBAAA,QAAQ,YAAY,cAApB,mCAAA,wBAAwB;QAC5C,IAAI,CAAC,sBAAsB,GAAG,QAAQ,sBAAsB,IAAI;QAChE,IAAI,CAAC,GAAG,GAAG,QAAQ,GAAG,IAAI;QAC1B,IAAI,CAAC,OAAO,GAAG,QAAQ,OAAO,IAAI;QAClC,IAAI,CAAC,WAAW,GAAG,IAAI;QACvB,IAAI,CAAC,SAAS,GAAG,EAAE;QACnB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,oBAAoB,GAAG;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA,GAAA,WAAG;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA,GAAA,WAAG;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA,GAAA,WAAG;IAC5B;AAseF","sources":["packages/@react-stately/layout/src/ListLayout.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 {Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\nimport {InvalidationContext, Layout, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface ListLayoutOptions {\n /**\n * The fixed height of a row in px.\n * @default 48\n */\n rowHeight?: number,\n /** The estimated height of a row, when row heights are variable. */\n estimatedRowHeight?: number,\n /**\n * The fixed height of a section header in px.\n * @default 48\n */\n headingHeight?: number,\n /** The estimated height of a section header, when the height is variable. */\n estimatedHeadingHeight?: number,\n /**\n * The fixed height of a loader element in px. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n */\n loaderHeight?: number,\n /**\n * The thickness of the drop indicator.\n * @default 2\n */\n dropIndicatorThickness?: number,\n /**\n * The gap between items.\n * @default 0\n */\n gap?: number,\n /**\n * The padding around the list.\n * @default 0\n */\n padding?: number\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n node?: Node<unknown>,\n layoutInfo: LayoutInfo,\n children?: LayoutNode[],\n validRect: Rect,\n index?: number\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a vertical stack. It supports both fixed\n * and variable height items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {\n protected rowHeight: number | null;\n protected estimatedRowHeight: number | null;\n protected headingHeight: number | null;\n protected estimatedHeadingHeight: number | null;\n protected loaderHeight: number | null;\n protected dropIndicatorThickness: number;\n protected gap: number;\n protected padding: number;\n protected layoutNodes: Map<Key, LayoutNode>;\n protected contentSize: Size;\n protected lastCollection: Collection<Node<T>> | null;\n protected rootNodes: LayoutNode[];\n private invalidateEverything: boolean;\n /** The rectangle containing currently valid layout infos. */\n protected validRect: Rect;\n /** The rectangle of requested layout infos so far. */\n protected requestedRect: Rect;\n\n /**\n * Creates a new ListLayout with options. See the list of properties below for a description\n * of the options that can be provided.\n */\n constructor(options: ListLayoutOptions = {}) {\n super();\n this.rowHeight = options.rowHeight ?? null;\n this.estimatedRowHeight = options.estimatedRowHeight ?? null;\n this.headingHeight = options.headingHeight ?? null;\n this.estimatedHeadingHeight = options.estimatedHeadingHeight ?? null;\n this.loaderHeight = options.loaderHeight ?? null;\n this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n this.gap = options.gap || 0;\n this.padding = options.padding || 0;\n this.layoutNodes = new Map();\n this.rootNodes = [];\n this.lastCollection = null;\n this.invalidateEverything = false;\n this.validRect = new Rect();\n this.requestedRect = new Rect();\n this.contentSize = new Size();\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): Collection<Node<T>> {\n return this.virtualizer!.collection;\n }\n\n getLayoutInfo(key: Key): LayoutInfo | null {\n this.ensureLayoutInfo(key);\n return this.layoutNodes.get(key)?.layoutInfo || null;\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.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\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 let addNodes = (nodes: LayoutNode[]) => {\n for (let node of nodes) {\n if (this.isVisible(node, rect)) {\n res.push(node.layoutInfo);\n\n if (node.children) {\n addNodes(node.children);\n }\n }\n }\n };\n\n addNodes(this.rootNodes);\n return res;\n }\n\n protected layoutIfNeeded(rect: Rect): void {\n if (!this.lastCollection) {\n return;\n }\n\n if (!this.requestedRect.containsRect(rect)) {\n this.requestedRect = this.requestedRect.union(rect);\n this.rootNodes = this.buildCollection();\n }\n\n // Ensure all of the persisted keys are available.\n for (let key of this.virtualizer!.persistedKeys) {\n if (this.ensureLayoutInfo(key)) {\n return;\n }\n }\n }\n\n private ensureLayoutInfo(key: Key) {\n // If the layout info wasn't found, it might be outside the bounds of the area that we've\n // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n // Compute the full layout and try again.\n if (!this.layoutNodes.has(key) && this.requestedRect.area < this.contentSize.area && this.lastCollection) {\n this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n this.rootNodes = this.buildCollection();\n this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n return true;\n }\n\n return false;\n }\n\n protected isVisible(node: LayoutNode, rect: Rect): boolean {\n return node.layoutInfo.rect.intersects(rect) || node.layoutInfo.isSticky || node.layoutInfo.type === 'header' || node.layoutInfo.type === 'loader' || this.virtualizer!.isPersistedKey(node.layoutInfo.key);\n }\n\n protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n // Invalidate cache if the size of the collection changed.\n // In this case, we need to recalculate the entire layout.\n // Also invalidate if fixed sizes/gaps change.\n let options = invalidationContext.layoutOptions;\n return invalidationContext.sizeChanged\n || this.rowHeight !== (options?.rowHeight ?? this.rowHeight)\n || this.headingHeight !== (options?.headingHeight ?? this.headingHeight)\n || this.loaderHeight !== (options?.loaderHeight ?? this.loaderHeight)\n || this.gap !== (options?.gap ?? this.gap)\n || this.padding !== (options?.padding ?? this.padding);\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.rowHeight !== oldOptions.rowHeight\n || newOptions.estimatedRowHeight !== oldOptions.estimatedRowHeight\n || newOptions.headingHeight !== oldOptions.headingHeight\n || newOptions.estimatedHeadingHeight !== oldOptions.estimatedHeadingHeight\n || newOptions.loaderHeight !== oldOptions.loaderHeight\n || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n || newOptions.gap !== oldOptions.gap\n || newOptions.padding !== oldOptions.padding;\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let collection = this.virtualizer!.collection;\n\n // Reset valid rect if we will have to invalidate everything.\n // Otherwise we can reuse cached layout infos outside the current visible rect.\n this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n if (this.invalidateEverything) {\n this.requestedRect = this.virtualizer!.visibleRect.copy();\n this.layoutNodes.clear();\n }\n\n let options = invalidationContext.layoutOptions;\n this.rowHeight = options?.rowHeight ?? this.rowHeight;\n this.estimatedRowHeight = options?.estimatedRowHeight ?? this.estimatedRowHeight;\n this.headingHeight = options?.headingHeight ?? this.headingHeight;\n this.estimatedHeadingHeight = options?.estimatedHeadingHeight ?? this.estimatedHeadingHeight;\n this.loaderHeight = options?.loaderHeight ?? this.loaderHeight;\n this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n this.gap = options?.gap ?? this.gap;\n this.padding = options?.padding ?? this.padding;\n\n this.rootNodes = this.buildCollection();\n\n // Remove deleted layout nodes\n if (this.lastCollection && collection !== this.lastCollection) {\n for (let key of this.lastCollection.getKeys()) {\n if (!collection.getItem(key)) {\n let layoutNode = this.layoutNodes.get(key);\n if (layoutNode) {\n this.layoutNodes.delete(key);\n }\n }\n }\n }\n\n this.lastCollection = collection;\n this.invalidateEverything = false;\n this.validRect = this.requestedRect.copy();\n }\n\n protected buildCollection(y = this.padding): LayoutNode[] {\n let collection = this.virtualizer!.collection;\n let skipped = 0;\n let nodes: LayoutNode[] = [];\n let isEmptyOrLoading = collection?.size === 0 || (collection.size === 1 && collection.getItem(collection.getFirstKey()!)!.type === 'loader');\n if (isEmptyOrLoading) {\n y = 0;\n }\n\n for (let node of collection) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n // Skip rows before the valid rectangle unless they are already cached.\n if (node.type === 'item' && 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, null);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n nodes.push(layoutNode);\n if (node.type === 'item' && y > this.requestedRect.maxY) {\n let itemsAfterRect = collection.size - (nodes.length + skipped);\n let lastNode = collection.getItem(collection.getLastKey()!);\n if (lastNode?.type === 'loader') {\n itemsAfterRect--;\n }\n\n y += itemsAfterRect * rowHeight;\n\n // Always add the loader sentinel if present. This assumes the loader is the last option/row\n // will need to refactor when handling multi section loading\n if (lastNode?.type === 'loader' && nodes.at(-1)?.layoutInfo.type !== 'loader') {\n let loader = this.buildChild(lastNode, this.padding, y, null);\n nodes.push(loader);\n y = loader.layoutInfo.rect.maxY;\n }\n break;\n }\n }\n\n y -= this.gap;\n y += isEmptyOrLoading ? 0 : this.padding;\n this.contentSize = new Size(this.virtualizer!.visibleRect.width, y);\n return nodes;\n }\n\n protected isValid(node: Node<T>, y: number): boolean {\n let cached = this.layoutNodes.get(node.key);\n return (\n !this.invalidateEverything &&\n !!cached &&\n cached.node === node &&\n y === cached.layoutInfo.rect.y &&\n cached.layoutInfo.rect.intersects(this.validRect) &&\n cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n );\n }\n\n protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n if (this.isValid(node, y)) {\n return this.layoutNodes.get(node.key)!;\n }\n\n let layoutNode = this.buildNode(node, x, y);\n\n layoutNode.layoutInfo.parentKey = parentKey ?? null;\n layoutNode.layoutInfo.allowOverflow = true;\n this.layoutNodes.set(node.key, layoutNode);\n return layoutNode;\n }\n\n protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'section':\n return this.buildSection(node, x, y);\n case 'item':\n return this.buildItem(node, x, y);\n case 'header':\n return this.buildSectionHeader(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n case 'separator':\n return this.buildItem(node, x, y);\n default:\n throw new Error('Unsupported node type: ' + node.type);\n }\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, this.padding, 0);\n let layoutInfo = new LayoutInfo('loader', node.key, rect);\n rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n rect.height = node.props.isLoading ? this.loaderHeight ?? this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT : 0;\n\n return {\n layoutInfo,\n validRect: rect.intersection(this.requestedRect)\n };\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection;\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rect = new Rect(x, y, width - x, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n let startY = y;\n let skipped = 0;\n let children: LayoutNode[] = [];\n for (let child of getChildNodes(node, collection)) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n\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(child, x, y, layoutInfo.key);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n break;\n }\n }\n\n y -= this.gap;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rectHeight = this.headingHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n if (previousLayoutInfo) {\n let curNode = this.virtualizer!.collection.getItem(node.key);\n let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n rectHeight = previousLayoutInfo.rect.height;\n isEstimated = width !== previousLayoutInfo.rect.width || curNode !== lastNode || previousLayoutInfo.estimatedSize;\n } else {\n rectHeight = (node.rendered ? this.estimatedHeadingHeight : 0);\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let headerRect = new Rect(x, y, width - x, rectHeight);\n let header = new LayoutInfo('header', node.key, headerRect);\n header.estimatedSize = isEstimated;\n return {\n layoutInfo: header,\n children: [],\n validRect: header.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding - x;\n let rectHeight = this.rowHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n rectHeight = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = width !== previousLayoutNode.layoutInfo.rect.width || node !== previousLayoutNode.node || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n rectHeight = this.estimatedRowHeight;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let rect = new Rect(x, y, width, rectHeight);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.estimatedSize = isEstimated;\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n updateItemSize(key: Key, size: Size): boolean {\n let layoutNode = this.layoutNodes.get(key);\n // If no layoutInfo, item has been deleted/removed.\n if (!layoutNode) {\n return false;\n }\n\n let collection = this.virtualizer!.collection;\n let layoutInfo = layoutNode.layoutInfo;\n layoutInfo.estimatedSize = false;\n if (layoutInfo.rect.height !== size.height) {\n // Copy layout info rather than mutating so that later caches are invalidated.\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height;\n layoutNode.layoutInfo = newLayoutInfo;\n\n // Items after this layoutInfo will need to be repositioned to account for the new height.\n // Adjust the validRect so that only items above remain valid.\n this.validRect.height = Math.min(this.validRect.height, layoutInfo.rect.y - this.validRect.y);\n\n // The requestedRect also needs to be adjusted to account for the height difference.\n this.requestedRect.height += newLayoutInfo.rect.height - layoutInfo.rect.height;\n\n // Invalidate layout for this layout node and all parents\n this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n while (node) {\n this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n }\n\n return true;\n }\n\n return false;\n }\n\n private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n let n = this.layoutNodes.get(key);\n if (n) {\n // Invalidate by intersecting the validRect of this node with the overall validRect.\n n.validRect = n.validRect.intersection(this.validRect);\n\n // Replace layout info in LayoutNode\n if (n.layoutInfo === oldLayoutInfo) {\n n.layoutInfo = newLayoutInfo;\n }\n }\n }\n\n getContentSize(): Size {\n return this.contentSize;\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.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 = this.getLayoutInfo(target.key)!;\n let rect: Rect;\n if (target.dropPosition === 'before') {\n rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.y - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else if (target.dropPosition === 'after') {\n rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else {\n rect = layoutInfo.rect;\n }\n\n return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n }\n}\n"],"names":[],"version":3,"file":"ListLayout.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAqDD,MAAM,uCAAiB;AAOhB,MAAM,kDAAuE,CAAA,GAAA,aAAK;IA0CvF,0CAA0C;IAC1C,IAAc,aAAkC;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAE,UAAU;IACrC;IAEA,cAAc,GAAQ,EAAqB;YAElC;QADP,IAAI,CAAC,gBAAgB,CAAC;QACtB,OAAO,EAAA,wBAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,kBAArB,4CAAA,sBAA2B,UAAU,KAAI;IAClD;IAEA,sBAAsB,IAAU,EAAgB;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AAG,GAAG,MAAM,OAAO,YAAY,EAAE;IACjF;IAhhBA;;;GAGC,GACD,YAAY,UAA6B,CAAC,CAAC,CAAE;QAC3C,KAAK;YACY;QAAjB,IAAI,CAAC,SAAS,GAAG,CAAA,qBAAA,QAAQ,SAAS,cAAjB,gCAAA,qBAAqB;YACZ;QAA1B,IAAI,CAAC,kBAAkB,GAAG,CAAA,8BAAA,QAAQ,kBAAkB,cAA1B,yCAAA,8BAA8B;YACnC;QAArB,IAAI,CAAC,aAAa,GAAG,CAAA,yBAAA,QAAQ,aAAa,cAArB,oCAAA,yBAAyB;YAChB;QAA9B,IAAI,CAAC,sBAAsB,GAAG,CAAA,kCAAA,QAAQ,sBAAsB,cAA9B,6CAAA,kCAAkC;YAC5C;QAApB,IAAI,CAAC,YAAY,GAAG,CAAA,wBAAA,QAAQ,YAAY,cAApB,mCAAA,wBAAwB;QAC5C,IAAI,CAAC,sBAAsB,GAAG,QAAQ,sBAAsB,IAAI;QAChE,IAAI,CAAC,GAAG,GAAG,QAAQ,GAAG,IAAI;QAC1B,IAAI,CAAC,OAAO,GAAG,QAAQ,OAAO,IAAI;QAClC,IAAI,CAAC,WAAW,GAAG,IAAI;QACvB,IAAI,CAAC,SAAS,GAAG,EAAE;QACnB,IAAI,CAAC,cAAc,GAAG;QACtB,IAAI,CAAC,oBAAoB,GAAG;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA,GAAA,WAAG;QACxB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA,GAAA,WAAG;QAC5B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA,GAAA,WAAG;IAC5B;AA4fF","sources":["packages/@react-stately/layout/src/ListLayout.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 {Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node} from '@react-types/shared';\nimport {getChildNodes} from '@react-stately/collections';\nimport {InvalidationContext, Layout, LayoutInfo, Rect, Size} from '@react-stately/virtualizer';\n\nexport interface ListLayoutOptions {\n /**\n * The fixed height of a row in px.\n * @default 48\n */\n rowHeight?: number,\n /** The estimated height of a row, when row heights are variable. */\n estimatedRowHeight?: number,\n /**\n * The fixed height of a section header in px.\n * @default 48\n */\n headingHeight?: number,\n /** The estimated height of a section header, when the height is variable. */\n estimatedHeadingHeight?: number,\n /**\n * The fixed height of a loader element in px. This loader is specifically for\n * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n * @default 48\n */\n loaderHeight?: number,\n /**\n * The thickness of the drop indicator.\n * @default 2\n */\n dropIndicatorThickness?: number,\n /**\n * The gap between items.\n * @default 0\n */\n gap?: number,\n /**\n * The padding around the list.\n * @default 0\n */\n padding?: number\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n node?: Node<unknown>,\n layoutInfo: LayoutInfo,\n children?: LayoutNode[],\n validRect: Rect,\n index?: number\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a vertical stack. It supports both fixed\n * and variable height items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {\n protected rowHeight: number | null;\n protected estimatedRowHeight: number | null;\n protected headingHeight: number | null;\n protected estimatedHeadingHeight: number | null;\n protected loaderHeight: number | null;\n protected dropIndicatorThickness: number;\n protected gap: number;\n protected padding: number;\n protected layoutNodes: Map<Key, LayoutNode>;\n protected contentSize: Size;\n protected lastCollection: Collection<Node<T>> | null;\n protected rootNodes: LayoutNode[];\n private invalidateEverything: boolean;\n /** The rectangle containing currently valid layout infos. */\n protected validRect: Rect;\n /** The rectangle of requested layout infos so far. */\n protected requestedRect: Rect;\n\n /**\n * Creates a new ListLayout with options. See the list of properties below for a description\n * of the options that can be provided.\n */\n constructor(options: ListLayoutOptions = {}) {\n super();\n this.rowHeight = options.rowHeight ?? null;\n this.estimatedRowHeight = options.estimatedRowHeight ?? null;\n this.headingHeight = options.headingHeight ?? null;\n this.estimatedHeadingHeight = options.estimatedHeadingHeight ?? null;\n this.loaderHeight = options.loaderHeight ?? null;\n this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n this.gap = options.gap || 0;\n this.padding = options.padding || 0;\n this.layoutNodes = new Map();\n this.rootNodes = [];\n this.lastCollection = null;\n this.invalidateEverything = false;\n this.validRect = new Rect();\n this.requestedRect = new Rect();\n this.contentSize = new Size();\n }\n\n // Backward compatibility for subclassing.\n protected get collection(): Collection<Node<T>> {\n return this.virtualizer!.collection;\n }\n\n getLayoutInfo(key: Key): LayoutInfo | null {\n this.ensureLayoutInfo(key);\n return this.layoutNodes.get(key)?.layoutInfo || null;\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.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\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 let addNodes = (nodes: LayoutNode[]) => {\n for (let node of nodes) {\n if (this.isVisible(node, rect)) {\n res.push(node.layoutInfo);\n\n if (node.children) {\n addNodes(node.children);\n }\n }\n }\n };\n\n addNodes(this.rootNodes);\n return res;\n }\n\n protected layoutIfNeeded(rect: Rect): void {\n if (!this.lastCollection) {\n return;\n }\n\n if (!this.requestedRect.containsRect(rect)) {\n this.requestedRect = this.requestedRect.union(rect);\n this.rootNodes = this.buildCollection();\n }\n\n // Ensure all of the persisted keys are available.\n for (let key of this.virtualizer!.persistedKeys) {\n if (this.ensureLayoutInfo(key)) {\n return;\n }\n }\n }\n\n private ensureLayoutInfo(key: Key) {\n // If the layout info wasn't found, it might be outside the bounds of the area that we've\n // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n // Compute the full layout and try again.\n if (!this.layoutNodes.has(key) && this.requestedRect.area < this.contentSize.area && this.lastCollection) {\n this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n this.rootNodes = this.buildCollection();\n this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n return true;\n }\n\n return false;\n }\n\n protected isVisible(node: LayoutNode, rect: Rect): boolean {\n return node.layoutInfo.rect.intersects(rect) || node.layoutInfo.isSticky || node.layoutInfo.type === 'header' || node.layoutInfo.type === 'loader' || this.virtualizer!.isPersistedKey(node.layoutInfo.key);\n }\n\n protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n // Invalidate cache if the size of the collection changed.\n // In this case, we need to recalculate the entire layout.\n // Also invalidate if fixed sizes/gaps change.\n let options = invalidationContext.layoutOptions;\n return invalidationContext.sizeChanged\n || this.rowHeight !== (options?.rowHeight ?? this.rowHeight)\n || this.headingHeight !== (options?.headingHeight ?? this.headingHeight)\n || this.loaderHeight !== (options?.loaderHeight ?? this.loaderHeight)\n || this.gap !== (options?.gap ?? this.gap)\n || this.padding !== (options?.padding ?? this.padding);\n }\n\n shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n return newOptions.rowHeight !== oldOptions.rowHeight\n || newOptions.estimatedRowHeight !== oldOptions.estimatedRowHeight\n || newOptions.headingHeight !== oldOptions.headingHeight\n || newOptions.estimatedHeadingHeight !== oldOptions.estimatedHeadingHeight\n || newOptions.loaderHeight !== oldOptions.loaderHeight\n || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n || newOptions.gap !== oldOptions.gap\n || newOptions.padding !== oldOptions.padding;\n }\n\n update(invalidationContext: InvalidationContext<O>): void {\n let collection = this.virtualizer!.collection;\n\n // Reset valid rect if we will have to invalidate everything.\n // Otherwise we can reuse cached layout infos outside the current visible rect.\n this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n if (this.invalidateEverything) {\n this.requestedRect = this.virtualizer!.visibleRect.copy();\n this.layoutNodes.clear();\n }\n\n let options = invalidationContext.layoutOptions;\n this.rowHeight = options?.rowHeight ?? this.rowHeight;\n this.estimatedRowHeight = options?.estimatedRowHeight ?? this.estimatedRowHeight;\n this.headingHeight = options?.headingHeight ?? this.headingHeight;\n this.estimatedHeadingHeight = options?.estimatedHeadingHeight ?? this.estimatedHeadingHeight;\n this.loaderHeight = options?.loaderHeight ?? this.loaderHeight;\n this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n this.gap = options?.gap ?? this.gap;\n this.padding = options?.padding ?? this.padding;\n\n this.rootNodes = this.buildCollection();\n\n // Remove deleted layout nodes\n if (this.lastCollection && collection !== this.lastCollection) {\n for (let key of this.lastCollection.getKeys()) {\n if (!collection.getItem(key)) {\n let layoutNode = this.layoutNodes.get(key);\n if (layoutNode) {\n this.layoutNodes.delete(key);\n }\n }\n }\n }\n\n this.lastCollection = collection;\n this.invalidateEverything = false;\n this.validRect = this.requestedRect.copy();\n }\n\n protected buildCollection(y: number = this.padding): LayoutNode[] {\n let collection = this.virtualizer!.collection;\n let collectionNodes = [...collection];\n let loaderNodes = collectionNodes.filter(node => node.type === 'loader');\n let nodes: LayoutNode[] = [];\n let isEmptyOrLoading = collection?.size === 0;\n if (isEmptyOrLoading) {\n y = 0;\n }\n\n for (let node of collectionNodes) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n // Skip rows before the valid rectangle unless they are already cached.\n if (node.type === 'item' && y + rowHeight < this.requestedRect.y && !this.isValid(node, y)) {\n y += rowHeight;\n continue;\n }\n\n let layoutNode = this.buildChild(node, this.padding, y, null);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n nodes.push(layoutNode);\n if (node.type === 'loader') {\n let index = loaderNodes.indexOf(node);\n loaderNodes.splice(index, 1);\n }\n\n // Build each loader that exists in the collection that is outside the visible rect so that they are persisted\n // at the proper estimated location. If the node.type is \"section\" then we don't do this shortcut since we have to\n // build the sections to see how tall they are.\n if ((node.type === 'item' || node.type === 'loader') && y > this.requestedRect.maxY) {\n let lastProcessedIndex = collectionNodes.indexOf(node);\n for (let loaderNode of loaderNodes) {\n let loaderNodeIndex = collectionNodes.indexOf(loaderNode);\n // Subtract by an additional 1 since we've already added the current item's height to y\n y += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;\n let loader = this.buildChild(loaderNode, this.padding, y, null);\n nodes.push(loader);\n y = loader.layoutInfo.rect.maxY;\n lastProcessedIndex = loaderNodeIndex;\n }\n\n // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already\n y += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;\n break;\n }\n }\n\n y -= this.gap;\n y += isEmptyOrLoading ? 0 : this.padding;\n this.contentSize = new Size(this.virtualizer!.visibleRect.width, y);\n return nodes;\n }\n\n protected isValid(node: Node<T>, y: number): boolean {\n let cached = this.layoutNodes.get(node.key);\n return (\n !this.invalidateEverything &&\n !!cached &&\n cached.node === node &&\n y === cached.layoutInfo.rect.y &&\n cached.layoutInfo.rect.intersects(this.validRect) &&\n cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n );\n }\n\n protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n if (this.isValid(node, y)) {\n return this.layoutNodes.get(node.key)!;\n }\n\n let layoutNode = this.buildNode(node, x, y);\n\n layoutNode.layoutInfo.parentKey = parentKey ?? null;\n layoutNode.layoutInfo.allowOverflow = true;\n this.layoutNodes.set(node.key, layoutNode);\n return layoutNode;\n }\n\n protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n switch (node.type) {\n case 'section':\n return this.buildSection(node, x, y);\n case 'item':\n return this.buildItem(node, x, y);\n case 'header':\n return this.buildSectionHeader(node, x, y);\n case 'loader':\n return this.buildLoader(node, x, y);\n case 'separator':\n return this.buildItem(node, x, y);\n default:\n throw new Error('Unsupported node type: ' + node.type);\n }\n }\n\n protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n let rect = new Rect(x, y, this.padding, 0);\n let layoutInfo = new LayoutInfo('loader', node.key, rect);\n rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n // room for the loader alongside rendering the emptyState\n rect.height = node.props.isLoading ? this.loaderHeight ?? this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT : 0;\n\n return {\n layoutInfo,\n validRect: rect.intersection(this.requestedRect)\n };\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n let collection = this.virtualizer!.collection;\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rect = new Rect(x, y, width - x, 0);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n let startY = y;\n let skipped = 0;\n let children: LayoutNode[] = [];\n for (let child of getChildNodes(node, collection)) {\n let rowHeight = (this.rowHeight ?? this.estimatedRowHeight ?? DEFAULT_HEIGHT) + this.gap;\n\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(child, x, y, layoutInfo.key);\n y = layoutNode.layoutInfo.rect.maxY + this.gap;\n children.push(layoutNode);\n\n if (y > this.requestedRect.maxY) {\n // Estimate the remaining height for rows that we don't need to layout right now.\n y += ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n break;\n }\n }\n\n y -= this.gap;\n rect.height = y - startY;\n\n return {\n layoutInfo,\n children,\n validRect: layoutInfo.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding;\n let rectHeight = this.headingHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n if (previousLayoutInfo) {\n let curNode = this.virtualizer!.collection.getItem(node.key);\n let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n rectHeight = previousLayoutInfo.rect.height;\n isEstimated = width !== previousLayoutInfo.rect.width || curNode !== lastNode || previousLayoutInfo.estimatedSize;\n } else {\n rectHeight = (node.rendered ? this.estimatedHeadingHeight : 0);\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let headerRect = new Rect(x, y, width - x, rectHeight);\n let header = new LayoutInfo('header', node.key, headerRect);\n header.estimatedSize = isEstimated;\n return {\n layoutInfo: header,\n children: [],\n validRect: header.rect.intersection(this.requestedRect),\n node\n };\n }\n\n protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n let width = this.virtualizer!.visibleRect.width - this.padding - x;\n let rectHeight = this.rowHeight;\n let isEstimated = false;\n\n // If no explicit height is available, use an estimated height.\n if (rectHeight == null) {\n // If a previous version of this layout info exists, reuse its height.\n // Mark as estimated if the size of the overall virtualizer changed,\n // or the content of the item changed.\n let previousLayoutNode = this.layoutNodes.get(node.key);\n if (previousLayoutNode) {\n rectHeight = previousLayoutNode.layoutInfo.rect.height;\n isEstimated = width !== previousLayoutNode.layoutInfo.rect.width || node !== previousLayoutNode.node || previousLayoutNode.layoutInfo.estimatedSize;\n } else {\n rectHeight = this.estimatedRowHeight;\n isEstimated = true;\n }\n }\n\n if (rectHeight == null) {\n rectHeight = DEFAULT_HEIGHT;\n }\n\n let rect = new Rect(x, y, width, rectHeight);\n let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n layoutInfo.estimatedSize = isEstimated;\n return {\n layoutInfo,\n children: [],\n validRect: layoutInfo.rect,\n node\n };\n }\n\n updateItemSize(key: Key, size: Size): boolean {\n let layoutNode = this.layoutNodes.get(key);\n // If no layoutInfo, item has been deleted/removed.\n if (!layoutNode) {\n return false;\n }\n\n let collection = this.virtualizer!.collection;\n let layoutInfo = layoutNode.layoutInfo;\n layoutInfo.estimatedSize = false;\n if (layoutInfo.rect.height !== size.height) {\n // Copy layout info rather than mutating so that later caches are invalidated.\n let newLayoutInfo = layoutInfo.copy();\n newLayoutInfo.rect.height = size.height;\n layoutNode.layoutInfo = newLayoutInfo;\n\n // Items after this layoutInfo will need to be repositioned to account for the new height.\n // Adjust the validRect so that only items above remain valid.\n this.validRect.height = Math.min(this.validRect.height, layoutInfo.rect.y - this.validRect.y);\n\n // The requestedRect also needs to be adjusted to account for the height difference.\n this.requestedRect.height += newLayoutInfo.rect.height - layoutInfo.rect.height;\n\n // Invalidate layout for this layout node and all parents\n this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n while (node) {\n this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n }\n\n return true;\n }\n\n return false;\n }\n\n private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n let n = this.layoutNodes.get(key);\n if (n) {\n // Invalidate by intersecting the validRect of this node with the overall validRect.\n n.validRect = n.validRect.intersection(this.validRect);\n\n // Replace layout info in LayoutNode\n if (n.layoutInfo === oldLayoutInfo) {\n n.layoutInfo = newLayoutInfo;\n }\n }\n }\n\n getContentSize(): Size {\n return this.contentSize;\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.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 = this.getLayoutInfo(target.key)!;\n let rect: Rect;\n if (target.dropPosition === 'before') {\n rect = new Rect(layoutInfo.rect.x, Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2), layoutInfo.rect.width, this.dropIndicatorThickness);\n } else if (target.dropPosition === 'after') {\n // Render after last visible descendant of the drop target.\n let targetNode = this.collection.getItem(target.key);\n if (targetNode) {\n let targetLevel = targetNode.level ?? 0;\n let currentKey = this.collection.getKeyAfter(target.key);\n\n while (currentKey != null) {\n let node = this.collection.getItem(currentKey);\n if (!node || node.level <= targetLevel) {\n break;\n }\n\n layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;\n currentKey = this.collection.getKeyAfter(currentKey);\n }\n }\n rect = new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n } else {\n rect = layoutInfo.rect;\n }\n\n return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n }\n}\n"],"names":[],"version":3,"file":"ListLayout.module.js.map"}
@@ -41,9 +41,10 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
41
41
  // If columnWidths were provided via layoutOptions, update those.
42
42
  // Otherwise, calculate column widths ourselves.
43
43
  if ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.columnWidths) {
44
- if (invalidationContext.layoutOptions.columnWidths !== this.columnWidths) {
44
+ for (const [key, val] of invalidationContext.layoutOptions.columnWidths)if (this.columnWidths.get(key) !== val) {
45
45
  this.columnWidths = invalidationContext.layoutOptions.columnWidths;
46
46
  invalidationContext.sizeChanged = true;
47
+ break;
47
48
  }
48
49
  } else if (invalidationContext.sizeChanged || this.columnsChanged(newCollection, this.lastCollection)) {
49
50
  let columnLayout = new (0, $9lycG$reactstatelytable.TableColumnLayout)({});
@@ -218,7 +219,6 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
218
219
  var _children_at;
219
220
  let rowsAfterRect = collection.size - (children.length + skipped);
220
221
  let lastNode = (0, $9lycG$reactstatelycollections.getLastItem)(childNodes);
221
- if ((lastNode === null || lastNode === void 0 ? void 0 : lastNode.type) === 'loader') rowsAfterRect--;
222
222
  // Estimate the remaining height for rows that we don't need to layout right now.
223
223
  y += rowsAfterRect * rowHeight;
224
224
  // Always add the loader sentinel if present. This assumes the loader is the last row in the body,
@@ -235,7 +235,7 @@ class $67c493497dcda343$export$62444c3c724b1b20 extends (0, $fe69e47e38ed0ac4$ex
235
235
  }
236
236
  }
237
237
  // Make sure that the table body gets a height if empty or performing initial load
238
- let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0 || collection.size === 1 && collection.getItem(collection.getFirstKey()).type === 'loader';
238
+ let isEmptyOrLoading = (collection === null || collection === void 0 ? void 0 : collection.size) === 0;
239
239
  if (isEmptyOrLoading) y = this.virtualizer.visibleRect.maxY;
240
240
  else y -= this.gap;
241
241
  rect.width = width;