Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-konva-grid

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-konva-grid - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

5

package.json
{
"name": "react-konva-grid",
"description": "Canvas grid to render large set of tabular data with virtualization.",
"version": "1.0.3",
"version": "1.0.4",
"main": "dist/index.js",

@@ -11,2 +11,4 @@ "license": "MIT",

"storybook": "start-storybook -p 9002",
"build-storybook": "build-storybook -c .storybook -o .out",
"deploy-storybook": "storybook-to-ghpages",
"prepublish": "yarn build",

@@ -43,2 +45,3 @@ "prettier": "prettier src/**/*.tsx --write"

"@storybook/react": "^5.3.18",
"@storybook/storybook-deployer": "^2.8.6",
"@types/react": "^16.9.35",

@@ -45,0 +48,0 @@ "@types/react-dom": "^16.9.8",

@@ -364,1 +364,43 @@ // Utilities extracted from https://github.com/bvaughn/react-window

};
export const getEstimatedTotalHeight = (rowCount: number, estimatedRowHeight: number, instanceProps: IInstanceProps) => {
let totalSizeOfMeasuredRows = 0;
let { lastMeasuredRowIndex, rowMetadataMap } = instanceProps
// Edge case check for when the number of items decreases while a scroll is in progress.
// https://github.com/bvaughn/react-window/pull/138
if (lastMeasuredRowIndex >= rowCount) {
lastMeasuredRowIndex = rowCount - 1;
}
if (lastMeasuredRowIndex >= 0) {
const itemMetadata = rowMetadataMap[lastMeasuredRowIndex];
totalSizeOfMeasuredRows = itemMetadata.offset + itemMetadata.size;
}
const numUnmeasuredItems = rowCount - lastMeasuredRowIndex - 1;
const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedRowHeight;
return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
};
export const getEstimatedTotalWidth = (columnCount: number, estimatedColumnWidth: number, instanceProps: IInstanceProps) => {
let totalSizeOfMeasuredRows = 0;
let { lastMeasuredColumnIndex, columnMetadataMap } = instanceProps
// Edge case check for when the number of items decreases while a scroll is in progress.
// https://github.com/bvaughn/react-window/pull/138
if (lastMeasuredColumnIndex >= columnCount) {
lastMeasuredColumnIndex = columnCount - 1;
}
if (lastMeasuredColumnIndex >= 0) {
const itemMetadata = columnMetadataMap[lastMeasuredColumnIndex];
totalSizeOfMeasuredRows = itemMetadata.offset + itemMetadata.size;
}
const numUnmeasuredItems = columnCount - lastMeasuredColumnIndex - 1;
const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedColumnWidth;
return totalSizeOfMeasuredRows + totalSizeOfUnmeasuredItems;
};
src/Grid.stories.tsx

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc