Socket
Socket
Sign inDemoInstall

@react-stately/layout

Package Overview
Dependencies
7
Maintainers
2
Versions
695
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.13.10-nightly.4640 to 3.13.10-nightly.4643

63

dist/ListLayout.main.js

@@ -156,2 +156,4 @@ var $iId4j$reactstatelycollections = require("@react-stately/collections");

return this.buildItem(node, x, y);
case 'header':
return this.buildHeader(node, x, y);
}

@@ -161,26 +163,10 @@ }

let width = this.virtualizer.visibleRect.width;
let rectHeight = this.headingHeight;
let isEstimated = false;
// If no explicit height is available, use an estimated height.
if (rectHeight == null) {
// If a previous version of this layout info exists, reuse its height.
// Mark as estimated if the size of the overall collection view changed,
// or the content of the item changed.
let previousLayoutNode = this.layoutNodes.get(node.key);
if (previousLayoutNode && previousLayoutNode.header) {
let curNode = this.collection.getItem(node.key);
let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;
rectHeight = previousLayoutNode.header.rect.height;
isEstimated = width !== this.lastWidth || curNode !== lastNode || previousLayoutNode.header.estimatedSize;
} else {
rectHeight = node.rendered ? this.estimatedHeadingHeight : 0;
isEstimated = true;
}
let header = null;
if (node.rendered) {
let headerNode = this.buildHeader(node, x, y);
header = headerNode.layoutInfo;
header.key += ':header';
header.parentKey = node.key;
y += header.rect.height;
}
if (rectHeight == null) rectHeight = $fe69e47e38ed0ac4$var$DEFAULT_HEIGHT;
let headerRect = new (0, $iId4j$reactstatelyvirtualizer.Rect)(0, y, width, rectHeight);
let header = new (0, $iId4j$reactstatelyvirtualizer.LayoutInfo)('header', node.key + ':header', headerRect);
header.estimatedSize = isEstimated;
header.parentKey = node.key;
y += header.rect.height;
let rect = new (0, $iId4j$reactstatelyvirtualizer.Rect)(0, y, width, 0);

@@ -219,2 +205,33 @@ let layoutInfo = new (0, $iId4j$reactstatelyvirtualizer.LayoutInfo)(node.type, node.key, rect);

}
buildHeader(node, x, y) {
let width = this.virtualizer.visibleRect.width;
let rectHeight = this.headingHeight;
let isEstimated = false;
// If no explicit height is available, use an estimated height.
if (rectHeight == null) {
// If a previous version of this layout info exists, reuse its height.
// Mark as estimated if the size of the overall collection view changed,
// or the content of the item changed.
let previousLayoutNode = this.layoutNodes.get(node.key);
let previousLayoutInfo = (previousLayoutNode === null || previousLayoutNode === void 0 ? void 0 : previousLayoutNode.header) || (previousLayoutNode === null || previousLayoutNode === void 0 ? void 0 : previousLayoutNode.layoutInfo);
if (previousLayoutInfo) {
let curNode = this.collection.getItem(node.key);
let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;
rectHeight = previousLayoutInfo.rect.height;
isEstimated = width !== this.lastWidth || curNode !== lastNode || previousLayoutInfo.estimatedSize;
} else {
rectHeight = node.rendered ? this.estimatedHeadingHeight : 0;
isEstimated = true;
}
}
if (rectHeight == null) rectHeight = $fe69e47e38ed0ac4$var$DEFAULT_HEIGHT;
let headerRect = new (0, $iId4j$reactstatelyvirtualizer.Rect)(0, y, width, rectHeight);
let header = new (0, $iId4j$reactstatelyvirtualizer.LayoutInfo)('header', node.key, headerRect);
header.estimatedSize = isEstimated;
return {
layoutInfo: header,
children: [],
validRect: header.rect.intersection(this.validRect)
};
}
buildItem(node, x, y) {

@@ -221,0 +238,0 @@ let width = this.virtualizer.visibleRect.width;

@@ -150,2 +150,4 @@ import {getChildNodes as $img26$getChildNodes} from "@react-stately/collections";

return this.buildItem(node, x, y);
case 'header':
return this.buildHeader(node, x, y);
}

@@ -155,26 +157,10 @@ }

let width = this.virtualizer.visibleRect.width;
let rectHeight = this.headingHeight;
let isEstimated = false;
// If no explicit height is available, use an estimated height.
if (rectHeight == null) {
// If a previous version of this layout info exists, reuse its height.
// Mark as estimated if the size of the overall collection view changed,
// or the content of the item changed.
let previousLayoutNode = this.layoutNodes.get(node.key);
if (previousLayoutNode && previousLayoutNode.header) {
let curNode = this.collection.getItem(node.key);
let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;
rectHeight = previousLayoutNode.header.rect.height;
isEstimated = width !== this.lastWidth || curNode !== lastNode || previousLayoutNode.header.estimatedSize;
} else {
rectHeight = node.rendered ? this.estimatedHeadingHeight : 0;
isEstimated = true;
}
let header = null;
if (node.rendered) {
let headerNode = this.buildHeader(node, x, y);
header = headerNode.layoutInfo;
header.key += ':header';
header.parentKey = node.key;
y += header.rect.height;
}
if (rectHeight == null) rectHeight = $61ef60fc9b1041f4$var$DEFAULT_HEIGHT;
let headerRect = new (0, $img26$Rect)(0, y, width, rectHeight);
let header = new (0, $img26$LayoutInfo)('header', node.key + ':header', headerRect);
header.estimatedSize = isEstimated;
header.parentKey = node.key;
y += header.rect.height;
let rect = new (0, $img26$Rect)(0, y, width, 0);

@@ -213,2 +199,33 @@ let layoutInfo = new (0, $img26$LayoutInfo)(node.type, node.key, rect);

}
buildHeader(node, x, y) {
let width = this.virtualizer.visibleRect.width;
let rectHeight = this.headingHeight;
let isEstimated = false;
// If no explicit height is available, use an estimated height.
if (rectHeight == null) {
// If a previous version of this layout info exists, reuse its height.
// Mark as estimated if the size of the overall collection view changed,
// or the content of the item changed.
let previousLayoutNode = this.layoutNodes.get(node.key);
let previousLayoutInfo = (previousLayoutNode === null || previousLayoutNode === void 0 ? void 0 : previousLayoutNode.header) || (previousLayoutNode === null || previousLayoutNode === void 0 ? void 0 : previousLayoutNode.layoutInfo);
if (previousLayoutInfo) {
let curNode = this.collection.getItem(node.key);
let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;
rectHeight = previousLayoutInfo.rect.height;
isEstimated = width !== this.lastWidth || curNode !== lastNode || previousLayoutInfo.estimatedSize;
} else {
rectHeight = node.rendered ? this.estimatedHeadingHeight : 0;
isEstimated = true;
}
}
if (rectHeight == null) rectHeight = $61ef60fc9b1041f4$var$DEFAULT_HEIGHT;
let headerRect = new (0, $img26$Rect)(0, y, width, rectHeight);
let header = new (0, $img26$LayoutInfo)('header', node.key, headerRect);
header.estimatedSize = isEstimated;
return {
layoutInfo: header,
children: [],
validRect: header.rect.intersection(this.validRect)
};
}
buildItem(node, x, y) {

@@ -215,0 +232,0 @@ let width = this.virtualizer.visibleRect.width;

@@ -75,2 +75,3 @@ import { Collection, DropTarget, DropTargetDelegate, Key, KeyboardDelegate, Node } from "@react-types/shared";

buildSection(node: Node<T>, x: number, y: number): LayoutNode;
buildHeader(node: Node<T>, x: number, y: number): LayoutNode;
buildItem(node: Node<T>, x: number, y: number): LayoutNode;

@@ -77,0 +78,0 @@ updateItemSize(key: Key, size: Size): boolean;

{
"name": "@react-stately/layout",
"version": "3.13.10-nightly.4640+379e8d64f",
"version": "3.13.10-nightly.4643+2bda4c971",
"description": "Spectrum UI components in React",

@@ -25,8 +25,8 @@ "license": "Apache-2.0",

"dependencies": {
"@react-stately/collections": "3.0.0-nightly.2928+379e8d64f",
"@react-stately/table": "3.11.9-nightly.4640+379e8d64f",
"@react-stately/virtualizer": "3.7.2-nightly.4640+379e8d64f",
"@react-types/grid": "3.2.7-nightly.4640+379e8d64f",
"@react-types/shared": "3.0.0-nightly.2928+379e8d64f",
"@react-types/table": "3.9.6-nightly.4640+379e8d64f",
"@react-stately/collections": "3.0.0-nightly.2931+2bda4c971",
"@react-stately/table": "3.11.9-nightly.4643+2bda4c971",
"@react-stately/virtualizer": "3.7.2-nightly.4643+2bda4c971",
"@react-types/grid": "3.2.7-nightly.4643+2bda4c971",
"@react-types/shared": "3.0.0-nightly.2931+2bda4c971",
"@react-types/table": "3.9.6-nightly.4643+2bda4c971",
"@swc/helpers": "^0.5.0"

@@ -40,3 +40,3 @@ },

},
"gitHead": "379e8d64f76c15bbb35f710c4150cc84e85b1d7e"
"gitHead": "2bda4c971dd557be7ecc44614569a8281e6cb6dd"
}

@@ -117,3 +117,3 @@ /*

return res;
return res!;
}

@@ -275,2 +275,4 @@

return this.buildItem(node, x, y);
case 'header':
return this.buildHeader(node, x, y);
}

@@ -281,32 +283,11 @@ }

let width = this.virtualizer.visibleRect.width;
let rectHeight = this.headingHeight;
let isEstimated = false;
// If no explicit height is available, use an estimated height.
if (rectHeight == null) {
// If a previous version of this layout info exists, reuse its height.
// Mark as estimated if the size of the overall collection view changed,
// or the content of the item changed.
let previousLayoutNode = this.layoutNodes.get(node.key);
if (previousLayoutNode && previousLayoutNode.header) {
let curNode = this.collection.getItem(node.key);
let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;
rectHeight = previousLayoutNode.header.rect.height;
isEstimated = width !== this.lastWidth || curNode !== lastNode || previousLayoutNode.header.estimatedSize;
} else {
rectHeight = (node.rendered ? this.estimatedHeadingHeight : 0);
isEstimated = true;
}
let header = null;
if (node.rendered) {
let headerNode = this.buildHeader(node, x, y);
header = headerNode.layoutInfo;
header.key += ':header';
header.parentKey = node.key;
y += header.rect.height;
}
if (rectHeight == null) {
rectHeight = DEFAULT_HEIGHT;
}
let headerRect = new Rect(0, y, width, rectHeight);
let header = new LayoutInfo('header', node.key + ':header', headerRect);
header.estimatedSize = isEstimated;
header.parentKey = node.key;
y += header.rect.height;
let rect = new Rect(0, y, width, 0);

@@ -349,2 +330,39 @@ let layoutInfo = new LayoutInfo(node.type, node.key, rect);

buildHeader(node: Node<T>, x: number, y: number): LayoutNode {
let width = this.virtualizer.visibleRect.width;
let rectHeight = this.headingHeight;
let isEstimated = false;
// If no explicit height is available, use an estimated height.
if (rectHeight == null) {
// If a previous version of this layout info exists, reuse its height.
// Mark as estimated if the size of the overall collection view changed,
// or the content of the item changed.
let previousLayoutNode = this.layoutNodes.get(node.key);
let previousLayoutInfo = previousLayoutNode?.header || previousLayoutNode?.layoutInfo;
if (previousLayoutInfo) {
let curNode = this.collection.getItem(node.key);
let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;
rectHeight = previousLayoutInfo.rect.height;
isEstimated = width !== this.lastWidth || curNode !== lastNode || previousLayoutInfo.estimatedSize;
} else {
rectHeight = (node.rendered ? this.estimatedHeadingHeight : 0);
isEstimated = true;
}
}
if (rectHeight == null) {
rectHeight = DEFAULT_HEIGHT;
}
let headerRect = new Rect(0, y, width, rectHeight);
let header = new LayoutInfo('header', node.key, headerRect);
header.estimatedSize = isEstimated;
return {
layoutInfo: header,
children: [],
validRect: header.rect.intersection(this.validRect)
};
}
buildItem(node: Node<T>, x: number, y: number): LayoutNode {

@@ -351,0 +369,0 @@ let width = this.virtualizer.visibleRect.width;

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc