streaksheet
Advanced tools
Comparing version 0.7.2 to 0.7.3
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
@@ -14,3 +16,3 @@ | ||
var _react = _interopRequireDefault(require("react")); | ||
var _react = _interopRequireWildcard(require("react")); | ||
@@ -31,4 +33,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
cellIndexesToKeysAndData = data.cellIndexesToKeysAndData, | ||
sectionRowMatcher = data.sectionRowMatcher; | ||
sectionRowMatcher = data.sectionRowMatcher, | ||
setCellBeingEdited = data.setCellBeingEdited; | ||
var position = sectionRowMatcher.getSectionRow(rowIndex); | ||
var setEditing = (0, _react.useCallback)(function (isEditing) { | ||
if (isEditing) { | ||
setCellBeingEdited([rowIndex, columnIndex]); | ||
} else { | ||
setCellBeingEdited(null); | ||
} | ||
}, [setCellBeingEdited, rowIndex, columnIndex]); | ||
@@ -61,2 +71,3 @@ if (!position || position.rowIndex === -1) { | ||
isEditing: isEditing, | ||
setEditing: setEditing, | ||
rowData: rowData, | ||
@@ -63,0 +74,0 @@ rowKey: rowKey |
@@ -51,2 +51,3 @@ import React, { ComponentType, CSSProperties } from 'react'; | ||
isEditing: boolean; | ||
setEditing(isEditing: boolean): void; | ||
rowData: T; | ||
@@ -53,0 +54,0 @@ rowKey: string; |
@@ -239,4 +239,16 @@ "use strict"; | ||
cellBeingEdited = _useState2[0], | ||
setCellBeingEdited = _useState2[1]; | ||
_setCellBeingEdited = _useState2[1]; | ||
var setCellBeingEdited = (0, _react.useCallback)(function (newValue) { | ||
_setCellBeingEdited(function (cellBeingEdited) { | ||
var newActual = typeof newValue === 'function' ? newValue(cellBeingEdited) : newValue; // keep exact old value if new value is equivalent | ||
if (cellBeingEdited && newActual && cellBeingEdited[0] === newActual[0] && cellBeingEdited[1] === newActual[1]) { | ||
return cellBeingEdited; | ||
} | ||
return newActual; | ||
}); | ||
}, []); | ||
var _useState3 = (0, _react.useState)(null), | ||
@@ -363,13 +375,6 @@ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2), | ||
setCellBeingEdited(function (cellBeingEdited) { | ||
// If the active cell was double-clicked, keep the old value's identity. | ||
if (cellBeingEdited && cellBeingEdited[0] === cellIndexes[0] && cellBeingEdited[1] === cellIndexes[1]) { | ||
return cellBeingEdited; | ||
} | ||
return cellIndexes; | ||
}); | ||
setCellBeingEdited(cellIndexes); | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
}, []); | ||
}, [setCellBeingEdited]); | ||
var handleGridKeyDown = (0, _react.useCallback)(function (event) { | ||
@@ -826,3 +831,4 @@ var key = event.key, | ||
sectionRowMatcher: sectionRowMatcher, | ||
styles: styles | ||
styles: styles, | ||
setCellBeingEdited: setCellBeingEdited | ||
}; | ||
@@ -829,0 +835,0 @@ var sheetDataForStreakSheet = sheetData.useByStreakSheet(); |
@@ -27,2 +27,3 @@ import type { ComponentType } from 'react'; | ||
styles: Styles; | ||
setCellBeingEdited: React.Dispatch<React.SetStateAction<CellIndexes | null>>; | ||
} | ||
@@ -29,0 +30,0 @@ export interface InternalPasteTarget { |
{ | ||
"name": "streaksheet", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"author": "Chris Cowan <agentme49@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
323756
2942