@react-stately/layout
Advanced tools
Comparing version 3.2.1-nightly.2531 to 3.2.1-nightly.2534
import { Collection, KeyboardDelegate, Node } from "@react-types/shared"; | ||
import { InvalidationContext, Layout, LayoutInfo, Rect, Size, Point } from "@react-stately/virtualizer"; | ||
import { Key } from "react"; | ||
import { TableCollection, TableNode } from "@react-types/table"; | ||
import { TableCollection } from "@react-types/table"; | ||
import { GridNode } from "@react-types/grid"; | ||
export type ListLayoutOptions<T> = { | ||
@@ -91,3 +92,3 @@ /** The height of a row in px. */ | ||
buildHeader(): LayoutNode; | ||
buildHeaderRow(headerRow: TableNode<T>, x: number, y: number): { | ||
buildHeaderRow(headerRow: GridNode<T>, x: number, y: number): { | ||
layoutInfo: LayoutInfo; | ||
@@ -97,12 +98,12 @@ children: LayoutNode[]; | ||
setChildHeights(children: LayoutNode[], height: number): void; | ||
getColumnWidth(node: TableNode<T>): number; | ||
getEstimatedHeight(node: TableNode<T>, width: number, height: number, estimatedHeight: number): { | ||
getColumnWidth(node: GridNode<T>): number; | ||
getEstimatedHeight(node: GridNode<T>, width: number, height: number, estimatedHeight: number): { | ||
height: number; | ||
isEstimated: boolean; | ||
}; | ||
buildColumn(node: TableNode<T>, x: number, y: number): LayoutNode; | ||
buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode; | ||
buildBody(y: number): LayoutNode; | ||
buildNode(node: TableNode<T>, x: number, y: number): LayoutNode; | ||
buildRow(node: TableNode<T>, x: number, y: number): LayoutNode; | ||
buildCell(node: TableNode<T>, x: number, y: number): LayoutNode; | ||
buildNode(node: GridNode<T>, x: number, y: number): LayoutNode; | ||
buildRow(node: GridNode<T>, x: number, y: number): LayoutNode; | ||
buildCell(node: GridNode<T>, x: number, y: number): LayoutNode; | ||
getVisibleLayoutInfos(rect: Rect): LayoutInfo[]; | ||
@@ -109,0 +110,0 @@ addVisibleLayoutInfos(res: LayoutInfo[], node: LayoutNode, rect: Rect): void; |
{ | ||
"name": "@react-stately/layout", | ||
"version": "3.2.1-nightly.2531+464fe21a", | ||
"version": "3.2.1-nightly.2534+7927421d", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,6 +21,7 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-stately/collections": "3.0.0-nightly.853+464fe21a", | ||
"@react-stately/virtualizer": "3.1.3-nightly.2531+464fe21a", | ||
"@react-types/shared": "3.0.0-nightly.853+464fe21a", | ||
"@react-types/table": "3.0.0-nightly.2531+464fe21a" | ||
"@react-stately/collections": "3.0.0-nightly.856+7927421d", | ||
"@react-stately/virtualizer": "3.1.3-nightly.2534+7927421d", | ||
"@react-types/grid": "3.0.0-nightly.2534+7927421d", | ||
"@react-types/shared": "3.0.0-nightly.856+7927421d", | ||
"@react-types/table": "3.0.0-nightly.2534+7927421d" | ||
}, | ||
@@ -33,3 +34,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "464fe21aba88848c79ab62dac26eff81a9138817" | ||
"gitHead": "7927421dedfb001d3459e0a94f5def9461fbc4c7" | ||
} |
@@ -13,3 +13,4 @@ /* | ||
import {ColumnProps, TableCollection, TableNode} from '@react-types/table'; | ||
import {ColumnProps, TableCollection} from '@react-types/table'; | ||
import {GridNode} from '@react-types/grid'; | ||
import {Key} from 'react'; | ||
@@ -64,3 +65,3 @@ import {LayoutInfo, Point, Rect, Size} from '@react-stately/virtualizer'; | ||
// Pass 1: set widths for all explicitly defined columns. | ||
let remainingColumns = new Set<TableNode<T>>(); | ||
let remainingColumns = new Set<GridNode<T>>(); | ||
let remainingSpace = this.virtualizer.visibleRect.width; | ||
@@ -143,3 +144,3 @@ for (let column of this.collection.columns) { | ||
buildHeaderRow(headerRow: TableNode<T>, x: number, y: number) { | ||
buildHeaderRow(headerRow: GridNode<T>, x: number, y: number) { | ||
let rect = new Rect(0, y, 0, 0); | ||
@@ -181,3 +182,3 @@ let row = new LayoutInfo('headerrow', headerRow.key, rect); | ||
getColumnWidth(node: TableNode<T>) { | ||
getColumnWidth(node: GridNode<T>) { | ||
let colspan = node.colspan ?? 1; | ||
@@ -193,3 +194,3 @@ let width = 0; | ||
getEstimatedHeight(node: TableNode<T>, width: number, height: number, estimatedHeight: number) { | ||
getEstimatedHeight(node: GridNode<T>, width: number, height: number, estimatedHeight: number) { | ||
let isEstimated = false; | ||
@@ -217,3 +218,3 @@ | ||
buildColumn(node: TableNode<T>, x: number, y: number): LayoutNode { | ||
buildColumn(node: GridNode<T>, x: number, y: number): LayoutNode { | ||
let width = this.getColumnWidth(node); | ||
@@ -279,3 +280,3 @@ let {height, isEstimated} = this.getEstimatedHeight(node, width, this.headingHeight, this.estimatedHeadingHeight); | ||
buildNode(node: TableNode<T>, x: number, y: number): LayoutNode { | ||
buildNode(node: GridNode<T>, x: number, y: number): LayoutNode { | ||
switch (node.type) { | ||
@@ -296,3 +297,3 @@ case 'headerrow': | ||
buildRow(node: TableNode<T>, x: number, y: number): LayoutNode { | ||
buildRow(node: GridNode<T>, x: number, y: number): LayoutNode { | ||
let rect = new Rect(x, y, 0, 0); | ||
@@ -321,3 +322,3 @@ let layoutInfo = new LayoutInfo('row', node.key, rect); | ||
buildCell(node: TableNode<T>, x: number, y: number): LayoutNode { | ||
buildCell(node: GridNode<T>, x: number, y: number): LayoutNode { | ||
let width = this.getColumnWidth(node); | ||
@@ -324,0 +325,0 @@ let {height, isEstimated} = this.getEstimatedHeight(node, width, this.rowHeight, this.estimatedRowHeight); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
227981
2370
7