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AAM;IAC1E;IAEA,uBACE,CAAS,EACT,CAAS,EACT,iBAAkD,EAC/B;QACnB,kCAAkC;QAClC,KACE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAA,GAAA,2CAAG,EAAE,GAAG,GAAG,GAAG,IAAI,IAAI,CAAC,CAAA,OAAQ,KAAK,IAAI,KAAK,cAAc,KACvF,UAAU;QACf,OAAO,KAAK,CAAC,uBAAuB,GAAG,GAAG;IAC5C;;QAnGK,qBACG,YAAqB;;AAmG/B","sources":["packages/@adobe/react-spectrum/src/table/TableViewLayout.ts"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport {DropTarget} from '@react-types/shared';\nimport {GridNode} from 'react-stately/private/grid/GridCollection';\nimport {LayoutInfo, LayoutNode, Rect, TableLayout} from 'react-stately/useVirtualizerState';\nimport {TableCollection} from 'react-stately/private/table/TableCollection';\n\nexport class TableViewLayout<T> extends TableLayout<T> {\n  private isLoading: boolean = false;\n\n  protected buildCollection(): LayoutNode[] {\n    let collection = this.virtualizer!.collection as TableCollection<T>;\n    let loadingState = collection.body.props.loadingState;\n    this.isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n    return super.buildCollection();\n  }\n\n  protected buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode {\n    let res = super.buildColumn(node, x, y);\n    res.layoutInfo.allowOverflow = true; // for resizer nubbin\n    return res;\n  }\n\n  protected buildBody(): LayoutNode {\n    let node = super.buildBody(0);\n    let {children, layoutInfo} = node;\n    if (!children) {\n      throw new Error('Missing children in LayoutInfo');\n    }\n\n    let width = node.layoutInfo.rect.width;\n\n    if (this.isLoading) {\n      // Add some margin around the loader to ensure that scrollbars don't flicker in and out.\n      let rect = new Rect(\n        40,\n        children.length === 0 ? 40 : layoutInfo.rect.maxY,\n        (width || this.virtualizer!.visibleRect.width) - 80,\n        children.length === 0 ? this.virtualizer!.visibleRect.height - 80 : 60\n      );\n      let loader = new LayoutInfo('loader', 'loader', rect);\n      loader.parentKey = layoutInfo.key;\n      loader.isSticky = children.length === 0;\n      let node = {\n        layoutInfo: loader,\n        validRect: loader.rect\n      };\n      children.push(node);\n      this.layoutNodes.set(loader.key, node);\n      layoutInfo.rect.height = loader.rect.maxY;\n      width = Math.max(width, rect.width);\n    } else if (children.length === 0) {\n      let rect = new Rect(\n        40,\n        40,\n        this.virtualizer!.visibleRect.width - 80,\n        this.virtualizer!.visibleRect.height - 80\n      );\n      let empty = new LayoutInfo('empty', 'empty', rect);\n      empty.parentKey = layoutInfo.key;\n      empty.isSticky = true;\n      empty.allowOverflow = true;\n      let node = {\n        layoutInfo: empty,\n        validRect: empty.rect\n      };\n      children.push(node);\n      layoutInfo.rect.height = empty.rect.maxY;\n      width = Math.max(width, rect.width);\n    }\n\n    return node;\n  }\n\n  protected buildRow(node: GridNode<T>, x: number, y: number): LayoutNode {\n    let res = super.buildRow(node, x, y);\n    res.layoutInfo.rect.height += 1; // for bottom border\n    return res;\n  }\n\n  protected buildCell(node: GridNode<T>, x: number, y: number): LayoutNode {\n    let res = super.buildCell(node, x, y);\n    if (node.column?.props.hideHeader) {\n      res.layoutInfo.allowOverflow = true;\n    }\n    return res;\n  }\n\n  protected getEstimatedRowHeight(): number {\n    return super.getEstimatedRowHeight() + 1; // for bottom border\n  }\n\n  protected isStickyColumn(node: GridNode<T>): boolean {\n    return (node.props?.isDragButtonCell || node.props?.isSelectionCell) ?? false;\n  }\n\n  getDropTargetFromPoint(\n    x: number,\n    y: number,\n    isValidDropTarget: (target: DropTarget) => boolean\n  ): DropTarget | null {\n    // Offset for height of header row\n    y -=\n      this.getVisibleLayoutInfos(new Rect(x, y, 1, 1)).find(info => info.type === 'headerrow')?.rect\n        .height ?? 0;\n    return super.getDropTargetFromPoint(x, y, isValidDropTarget);\n  }\n}\n"],"names":[],"version":3,"file":"TableViewLayout.cjs.map"}