streaksheet
Advanced tools
Comparing version 0.9.4 to 0.9.5
@@ -94,36 +94,43 @@ "use strict"; | ||
} | ||
} | ||
content = /*#__PURE__*/React.createElement(React.Fragment, null, isEditing && initialEditQueuedValue !== undefined && /*#__PURE__*/React.createElement(RunOnMount, { | ||
fn: function fn() { | ||
// Remove the queuedValue as soon as we can, | ||
// so that way if this component gets unmounted and | ||
// remounted (such as by the user scrolling), we don't | ||
// redeliver the stale queuedValue. | ||
var entry = data.queuedValueRef.current; | ||
} // eslint-disable-next-line react/display-name | ||
if (entry && (0, _lodash.isEqual)(entry.cellKeys, { | ||
sectionKey: sectionKey, | ||
columnKey: columnKey, | ||
rowKey: rowKey | ||
})) { | ||
data.queuedValueRef.current = null; | ||
content = function content(_ref2) { | ||
var primarySelection = _ref2.primarySelection; | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, isEditing && initialEditQueuedValue !== undefined && /*#__PURE__*/React.createElement(RunOnMount, { | ||
fn: function fn() { | ||
// Remove the queuedValue as soon as we can, | ||
// so that way if this component gets unmounted and | ||
// remounted (such as by the user scrolling), we don't | ||
// redeliver the stale queuedValue. | ||
var entry = data.queuedValueRef.current; | ||
if (entry && (0, _lodash.isEqual)(entry.cellKeys, { | ||
sectionKey: sectionKey, | ||
columnKey: columnKey, | ||
rowKey: rowKey | ||
})) { | ||
data.queuedValueRef.current = null; | ||
} | ||
} | ||
} | ||
}), /*#__PURE__*/React.createElement(Cell, { | ||
columnKey: columnKey, | ||
ref: function ref(_ref2) { | ||
if (isEditing) { | ||
data.editedCellRef.current = _ref2; | ||
} | ||
}, | ||
isEditing: isEditing, | ||
isRowSelected: selectedRowsManager.isRowSelected(sectionKey, rowKey), | ||
setEditing: setEditing, | ||
rowData: rowData, | ||
rowKey: rowKey, | ||
sectionKey: sectionKey, | ||
initialEditQueuedValue: initialEditQueuedValue | ||
})); | ||
}), /*#__PURE__*/React.createElement(Cell, { | ||
columnKey: columnKey, | ||
ref: function ref(_ref3) { | ||
if (isEditing) { | ||
data.editedCellRef.current = _ref3; | ||
} | ||
}, | ||
isPrimarySelection: primarySelection ? primarySelection[0] === rowIndex && primarySelection[1] === columnIndex : false, | ||
isEditing: isEditing, | ||
isRowSelected: selectedRowsManager.isRowSelected(sectionKey, rowKey), | ||
setEditing: setEditing, | ||
rowData: rowData, | ||
rowKey: rowKey, | ||
sectionKey: sectionKey, | ||
initialEditQueuedValue: initialEditQueuedValue | ||
})); | ||
}; | ||
} else { | ||
content = null; | ||
content = function content() { | ||
return null; | ||
}; | ||
} | ||
@@ -163,3 +170,3 @@ | ||
style: cellStyle | ||
}, content); | ||
}, content(cellContainerContext)); | ||
}); | ||
@@ -166,0 +173,0 @@ }, function (prevProps, nextProps) { |
@@ -39,2 +39,3 @@ import * as React from 'react'; | ||
isEditing: boolean; | ||
isPrimarySelection: boolean; | ||
isRowSelected: boolean; | ||
@@ -41,0 +42,0 @@ setEditing(isEditing: boolean): void; |
@@ -106,3 +106,4 @@ "use strict"; | ||
onEnterEditMode = props.onEnterEditMode, | ||
onExitEditMode = props.onExitEditMode; | ||
onExitEditMode = props.onExitEditMode, | ||
rowHoveredClassName = props.rowHoveredClassName; | ||
var groupbarHeightVarName = (groupbar === null || groupbar === void 0 ? void 0 : groupbar.heightVarName) || '--streaksheet-groupbar-height'; | ||
@@ -916,2 +917,5 @@ var groupbarHeightTransition = (groupbar === null || groupbar === void 0 ? void 0 : groupbar.heightTransition) || '0.2s cubic-bezier(0.82, 0.1, 0.04, 0.9)'; | ||
var primarySelection = (0, React.useMemo)(function () { | ||
return selection.length > 0 ? selection[0][0] : undefined; | ||
}, [selection]); | ||
var queuedValueRef = (0, React.useRef)(null); | ||
@@ -930,5 +934,5 @@ var itemData = (0, React.useMemo)(function () { | ||
setCellBeingEdited: setCellBeingEdited, | ||
rowHoveredClassName: props.rowHoveredClassName | ||
rowHoveredClassName: rowHoveredClassName | ||
}; | ||
}, [Cell, editedCellRef, cellBeingEdited, cellIndexesToKeys, cellIndexesToKeysAndData, sectionRowMatcher, selectedRowsManager, styles, setCellBeingEdited, props.rowHoveredClassName]); | ||
}, [Cell, editedCellRef, cellBeingEdited, cellIndexesToKeys, cellIndexesToKeysAndData, sectionRowMatcher, selectedRowsManager, styles, setCellBeingEdited, rowHoveredClassName]); | ||
var onItemsRendered = (0, React.useCallback)(function (_ref3) { | ||
@@ -1056,3 +1060,4 @@ var visibleRowStartIndex = _ref3.visibleRowStartIndex, | ||
value: { | ||
hoveredRow: hoveredRow | ||
hoveredRow: hoveredRow, | ||
primarySelection: primarySelection | ||
} | ||
@@ -1059,0 +1064,0 @@ }, gridElement))); |
@@ -97,2 +97,3 @@ import type { ComponentType } from 'react'; | ||
hoveredRow?: number; | ||
primarySelection?: CellIndexes; | ||
} | ||
@@ -99,0 +100,0 @@ export declare const CellContainerContext: React.Context<CellContainerContextI | undefined>; |
@@ -25,2 +25,12 @@ "use strict"; | ||
if (prev.primarySelection !== next.primarySelection) { | ||
if (prev.primarySelection !== undefined) { | ||
r |= 1 << prev.primarySelection[0] % 30; | ||
} | ||
if (next.primarySelection !== undefined) { | ||
r |= 1 << next.primarySelection[0] % 30; | ||
} | ||
} | ||
return r; | ||
@@ -27,0 +37,0 @@ }); |
{ | ||
"name": "streaksheet", | ||
"version": "0.9.4", | ||
"version": "0.9.5", | ||
"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
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
828615
7345