react-konva-grid
Advanced tools
Comparing version 2.6.6 to 2.6.7
@@ -421,2 +421,9 @@ "use strict"; | ||
exports.requestTimeout = requestTimeout; | ||
// export function getNextCellInSelectionBounds (selections: SelectionProps, activeCell: CellInterface) { | ||
// let nextCell | ||
// for (let i = 0; i <= selections.length; i++) { | ||
// const { bounds } = selections[i] | ||
// const { top, left, right, bottom } = bounds | ||
// } | ||
// } | ||
//# sourceMappingURL=helpers.js.map |
import React from "react"; | ||
import { CellInterface, ScrollCoords, CellPosition, GridRef, SelectionArea } from "../Grid"; | ||
import { KeyCodes } from "./../types"; | ||
export interface UseEditableOptions { | ||
@@ -24,3 +23,3 @@ getEditor?: (cell: CellInterface | null) => React.ElementType; | ||
onChange: (value: string) => void; | ||
onSubmit?: (sourceKey?: KeyCodes) => void; | ||
onSubmit?: (e: React.KeyboardEvent<HTMLInputElement>) => void; | ||
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void; | ||
@@ -27,0 +26,0 @@ onEscape?: (e: React.KeyboardEvent<HTMLInputElement>) => void; |
@@ -65,3 +65,3 @@ "use strict"; | ||
if (e.which === types_1.KeyCodes.Enter) { | ||
onSubmit && onSubmit(); | ||
onSubmit && onSubmit(e); | ||
} | ||
@@ -74,3 +74,3 @@ if (e.which === types_1.KeyCodes.Escape) { | ||
e.preventDefault(); | ||
onSubmit && onSubmit(types_1.KeyCodes.Tab); | ||
onSubmit && onSubmit(e); | ||
} | ||
@@ -142,3 +142,3 @@ }, onBlur: (e) => { | ||
e.nativeEvent.ctrlKey || | ||
e.nativeEvent.shiftKey || | ||
(e.nativeEvent.shiftKey && e.nativeEvent.key === "Shift") || | ||
e.nativeEvent.metaKey) | ||
@@ -161,9 +161,12 @@ return; | ||
/* Save the value */ | ||
const handleSubmit = react_1.useCallback((sourceKey) => { | ||
const handleSubmit = react_1.useCallback((e) => { | ||
if (!activeCell) | ||
return; | ||
const nextActiveCell = sourceKey === types_1.KeyCodes.Tab | ||
const isTabKeyPressed = e.which === types_1.KeyCodes.Tab; | ||
const shiftKey = e.shiftKey; | ||
const nextIndex = shiftKey ? -1 : 1; | ||
const nextActiveCell = isTabKeyPressed | ||
? { | ||
rowIndex: activeCell.rowIndex, | ||
columnIndex: activeCell.columnIndex + 1, | ||
columnIndex: activeCell.columnIndex + nextIndex, | ||
} | ||
@@ -170,0 +173,0 @@ : { |
@@ -256,2 +256,3 @@ "use strict"; | ||
case types_1.KeyCodes.Tab: | ||
/* TODO Cycle through the selections if selections.length > 0 */ | ||
if (isShiftKey) { | ||
@@ -266,3 +267,3 @@ keyNavigate(types_1.Direction.Left); | ||
} | ||
}, [rowCount, columnCount, activeCell]); | ||
}, [rowCount, columnCount, activeCell, selections]); | ||
return { | ||
@@ -269,0 +270,0 @@ activeCell, |
{ | ||
"name": "react-konva-grid", | ||
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets", | ||
"version": "2.6.6", | ||
"version": "2.6.7", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -8,2 +8,3 @@ // Utilities extracted from https://github.com/bvaughn/react-window | ||
CellMetaData, | ||
SelectionProps, | ||
} from "./Grid"; | ||
@@ -637,1 +638,9 @@ | ||
} | ||
// export function getNextCellInSelectionBounds (selections: SelectionProps, activeCell: CellInterface) { | ||
// let nextCell | ||
// for (let i = 0; i <= selections.length; i++) { | ||
// const { bounds } = selections[i] | ||
// const { top, left, right, bottom } = bounds | ||
// } | ||
// } |
@@ -329,2 +329,3 @@ import React, { useState, useCallback, useRef } from "react"; | ||
case KeyCodes.Tab: | ||
/* TODO Cycle through the selections if selections.length > 0 */ | ||
if (isShiftKey) { | ||
@@ -339,3 +340,3 @@ keyNavigate(Direction.Left); | ||
}, | ||
[rowCount, columnCount, activeCell] | ||
[rowCount, columnCount, activeCell, selections] | ||
); | ||
@@ -342,0 +343,0 @@ |
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
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
14784068
21178