react-konva-grid
Advanced tools
Comparing version 2.4.3 to 2.4.4
@@ -12,3 +12,3 @@ "use strict"; | ||
*/ | ||
const useAutoSizer = ({ gridRef, getValue, initialVisibleRows = 20, cellSpacing = 10, minColumnWidth = 40, timeout = 300, resizeOnScroll = true, font = "12px Arial", }) => { | ||
const useAutoSizer = ({ gridRef, getValue, initialVisibleRows = 20, cellSpacing = 10, minColumnWidth = 60, timeout = 300, resizeOnScroll = true, font = "12px Arial", }) => { | ||
const autoSizer = react_1.useRef(AutoSizerCanvas(font)); | ||
@@ -15,0 +15,0 @@ const [viewport, setViewport] = react_1.useState({ |
@@ -5,5 +5,5 @@ import React from "react"; | ||
gridRef?: React.MutableRefObject<GridRef>; | ||
initialSelections?: AreaProps[]; | ||
columnCount: number; | ||
rowCount: number; | ||
initialSelections: AreaProps[]; | ||
columnCount?: number; | ||
rowCount?: number; | ||
} | ||
@@ -14,3 +14,3 @@ /** | ||
*/ | ||
declare const useSelection: (options?: UseSelectionOptions) => { | ||
declare const useSelection: (options?: UseSelectionOptions | undefined) => { | ||
selections: AreaProps[]; | ||
@@ -17,0 +17,0 @@ onMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const react_1 = require("react"); | ||
const defaultOptions = { | ||
initialSelection: [], | ||
columnCount: 0, | ||
rowCount: 0, | ||
}; | ||
var Direction; | ||
@@ -20,4 +15,4 @@ (function (Direction) { | ||
*/ | ||
const useSelection = (options = defaultOptions) => { | ||
const { gridRef, initialSelections = [], columnCount, rowCount } = options; | ||
const useSelection = (options) => { | ||
const { gridRef, initialSelections = [], columnCount = 0, rowCount = 0 } = options || {}; | ||
const [selections, setSelections] = react_1.useState(initialSelections); | ||
@@ -24,0 +19,0 @@ const selectionStart = react_1.useRef(); |
{ | ||
"name": "react-konva-grid", | ||
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets", | ||
"version": "2.4.3", | ||
"version": "2.4.4", | ||
"main": "dist/index.js", | ||
@@ -56,2 +56,3 @@ "license": "MIT", | ||
"@testing-library/react": "^10.0.4", | ||
"@testing-library/react-hooks": "^3.2.1", | ||
"@types/jest": "^25.2.3", | ||
@@ -67,2 +68,3 @@ "@types/react": "^16.9.35", | ||
"react-docgen-typescript-loader": "^3.7.2", | ||
"react-test-renderer": "^16.13.1", | ||
"react-use": "^15.1.0", | ||
@@ -69,0 +71,0 @@ "rimraf": "^3.0.2", |
@@ -33,3 +33,3 @@ import React, { useCallback, useState, useRef, useEffect } from "react"; | ||
cellSpacing = 10, | ||
minColumnWidth = 40, | ||
minColumnWidth = 60, | ||
timeout = 300, | ||
@@ -36,0 +36,0 @@ resizeOnScroll = true, |
@@ -6,13 +6,7 @@ import React, { useState, useCallback, useRef } from "react"; | ||
gridRef?: React.MutableRefObject<GridRef>; | ||
initialSelections?: AreaProps[]; | ||
columnCount: number; | ||
rowCount: number; | ||
initialSelections: AreaProps[]; | ||
columnCount?: number; | ||
rowCount?: number; | ||
} | ||
const defaultOptions = { | ||
initialSelection: [], | ||
columnCount: 0, | ||
rowCount: 0, | ||
}; | ||
enum Direction { | ||
@@ -29,4 +23,5 @@ Up = "UP", | ||
*/ | ||
const useSelection = (options: UseSelectionOptions = defaultOptions) => { | ||
const { gridRef, initialSelections = [], columnCount, rowCount } = options; | ||
const useSelection = (options?: UseSelectionOptions) => { | ||
const { gridRef, initialSelections = [], columnCount = 0, rowCount = 0 } = | ||
options || {}; | ||
const [selections, setSelections] = useState<AreaProps[]>(initialSelections); | ||
@@ -33,0 +28,0 @@ const selectionStart = useRef<CellInterface>(); |
Sorry, the diff of this file is not supported yet
14688550
63
18875
26