react-konva-grid
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"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; | ||
}; |
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
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
339710
843
14