Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-konva-grid
Advanced tools
Canvas grid to render large set of tabular data. Uses virtualization similar to react-window
Born out of frustration at work, having to deal with complicated imperative canvas libraries, I wanted to create something easy to understand and declarative in nature. React-Konva uses React's custom renderer to expose konva components.
yarn add react-konva-grid
npm install react-konva-grid --save
Konva grid will work with any browser that supports react, konva and canvas element.
import { Grid } from 'react-konva-grid'
import { Group, Text, Rect } from 'react-konva'
const App = () => {
const Cell = ({ rowIndex, columnIndex, x, y, width, height}) => {
return (
<Group>
<Rect
x={x}
y={y}
height={height}
width={width}
fill="white"
stroke="grey"
/>
<Text
x={x}
y={y}
height={height}
width={width}
text={text}
verticalAlign="middle"
align="center"
/>
</Group>
)
}
return (
<Grid
rowCount={100}
columnCount={100}
width={800}
height={800}
rowHeight={(rowIndex) => 20}
columnWidth={(columnIndex) => 100}
itemRenderer={Cell}
/>
)
}
This is the list of props that are meant to be used to customise the konva-grid
behavior.
Name | Required | Type | Description | Default |
---|---|---|---|---|
width | true | number | Width of the grid container | 800 |
height | true | number | Height of the grid container | 800 |
columnCount | true | number | No of columns in the grid | 200 |
rowCount | true | number | No of rows in the grid | 200 |
rowHeight | true | function | Function that returns height of the row based on rowIndex | (rowIndex) => 20 |
columnWidth | true | function | Function that returns width of the column based on columnIndex | (columnIndex) => 100 |
itemRenderer | true | Function | React component to render the cell | null |
scrollbarSize | false | number | Size of the scrollbar | 17 |
showScrollbar | false | boolean | Always show scrollbar | true |
selectionBackgroundColor | false | string | Background color of selected cells | rgba(66, 133, 244, 0.3) |
selectionBorderColor | false | string | Border color of bounding box of selected cells | rgba(66, 133, 244, 1) |
selections | false | Array | Array of selected cell areas | [] |
frozenRows | false | number | No of frozen rows | 0 |
frozenColumns | false | number | No of frozen columns | 0 |
scrollTo({ scrollLeft, scrollTop }
Scrolls the grid to a specified x,y
position relative to the container
resetAfterIndices({ rowIndex, columnIndex })
Imperatively trigger re-render of the grid after specified rowIndex
or columnIndex
Examples can be found as stories in Grid.stories.tsx
. To run storybook, enter the following commands
yarn
yarn run storybook
Feel free to fork and submit pull requests
git clone https://github.com/rmdort/konva-grid.git
cd konva-grid
yarn
// Run storybook
yarn storybook
FAQs
Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets
The npm package react-konva-grid receives a total of 428 weekly downloads. As such, react-konva-grid popularity was classified as not popular.
We found that react-konva-grid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.