sheet-happens 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -426,7 +426,7 @@ var findInDisplayData = function findInDisplayData(displayData, start, direction
426
426
  return maxXY(cell, [0, 0]);
427
427
  };
428
428
 
429
- var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editData, sourceData, canSizeColumn, canSizeRow, canOrderColumn, canOrderRow, cellLayout, visibleCells, sheetStyle, onEdit, onCommit, onKnobAreaChange, onDragOffsetChange, onDropTargetChange, onSelectionChange, onInvalidateColumn, onInvalidateRow, onChange, onColumnOrderChange, onRowOrderChange, onCellWidthChange, onCellHeightChange, onRightClick, dontCommitEditOnSelectionChange) {
429
+ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editData, sourceData, cellReadOnly, canSizeColumn, canSizeRow, canOrderColumn, canOrderRow, cellLayout, visibleCells, sheetStyle, onEdit, onCommit, onKnobAreaChange, onDragOffsetChange, onDropTargetChange, onSelectionChange, onInvalidateColumn, onInvalidateRow, onChange, onColumnOrderChange, onRowOrderChange, onCellWidthChange, onCellHeightChange, onRightClick, dontCommitEditOnSelectionChange) {
430
430
  var _useState = useState(null),
431
431
  hitTarget = _useState[0],
432
432
  setHitTarget = _useState[1];
@@ -782,7 +782,7 @@ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editD
782
782
  getIndentY = _ref$current2$cellLay.getIndentY;
783
783
 
784
784
  if (knobArea && draggingKnob) {
785
- var changes = parseKnobOperation(knobArea, selection, sourceData, editData);
785
+ var changes = parseKnobOperation(knobArea, selection, sourceData, editData, cellReadOnly);
786
786
  onChange === null || onChange === void 0 ? void 0 : onChange(changes);
787
787
  onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(knobArea, true, true);
788
788
  onKnobAreaChange === null || onKnobAreaChange === void 0 ? void 0 : onKnobAreaChange(null);
@@ -1179,7 +1179,7 @@ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editD
1179
1179
  };
1180
1180
  };
1181
1181
 
1182
- var parseKnobOperation = function parseKnobOperation(knobArea, selection, sourceData, editData) {
1182
+ var parseKnobOperation = function parseKnobOperation(knobArea, selection, sourceData, editData, cellReadOnly) {
1183
1183
  var _normalizeSelection6 = normalizeSelection(knobArea),
1184
1184
  _normalizeSelection6$ = _normalizeSelection6[0],
1185
1185
  kx1 = _normalizeSelection6$[0],
@@ -1222,15 +1222,18 @@ var parseKnobOperation = function parseKnobOperation(knobArea, selection, source
1222
1222
  for (var y = fy1; y <= fy2; y++) {
1223
1223
  for (var x = fx1; x <= fx2; x++) {
1224
1224
  var value = sourceData(x, srcY);
1225
- changes.push({
1226
- x: x,
1227
- y: y,
1228
- value: value,
1229
- source: {
1225
+
1226
+ if (!cellReadOnly(x, y)) {
1227
+ changes.push({
1230
1228
  x: x,
1231
- y: srcY
1232
- }
1233
- });
1229
+ y: y,
1230
+ value: value,
1231
+ source: {
1232
+ x: x,
1233
+ y: srcY
1234
+ }
1235
+ });
1236
+ }
1234
1237
  }
1235
1238
 
1236
1239
  srcY = srcY + 1;
@@ -1260,15 +1263,17 @@ var parseKnobOperation = function parseKnobOperation(knobArea, selection, source
1260
1263
  for (var _y2 = fy1; _y2 <= fy2; _y2++) {
1261
1264
  var _value = sourceData(srcX, _y2);
1262
1265
 
1263
- changes.push({
1264
- x: _x2,
1265
- y: _y2,
1266
- value: _value,
1267
- source: {
1268
- x: srcX,
1269
- y: _y2
1270
- }
1271
- });
1266
+ if (!cellReadOnly(_x2, _y2)) {
1267
+ changes.push({
1268
+ x: _x2,
1269
+ y: _y2,
1270
+ value: _value,
1271
+ source: {
1272
+ x: srcX,
1273
+ y: _y2
1274
+ }
1275
+ });
1276
+ }
1272
1277
  }
1273
1278
 
1274
1279
  srcX = srcX + 1;
@@ -2810,7 +2815,7 @@ var Sheet = forwardRef(function (props, ref) {
2810
2815
  useClipboardPaste(textAreaRef, selection, changeSelection, props.onChange);
2811
2816
  var onScroll = useScroll(dataOffset, maxScroll, cellLayout, setDataOffset, setMaxScroll);
2812
2817
 
2813
- var _useMouse = useMouse(hitmapRef, selection, knobArea, editMode, editData, sourceData, canSizeColumn, canSizeRow, canOrderColumn, canOrderRow, cellLayout, visibleCells, sheetStyle, startEditingCell, commitEditingCell, setKnobArea, setDragOffset, setDropTarget, changeSelection, props.cacheLayout ? columnLayout.clearAfter : undefined, props.cacheLayout ? rowLayout.clearAfter : undefined, props.onChange, props.onColumnOrderChange, props.onRowOrderChange, props.onCellWidthChange, props.onCellHeightChange, props.onRightClick, props.dontCommitEditOnSelectionChange),
2818
+ var _useMouse = useMouse(hitmapRef, selection, knobArea, editMode, editData, sourceData, cellReadOnly, canSizeColumn, canSizeRow, canOrderColumn, canOrderRow, cellLayout, visibleCells, sheetStyle, startEditingCell, commitEditingCell, setKnobArea, setDragOffset, setDropTarget, changeSelection, props.cacheLayout ? columnLayout.clearAfter : undefined, props.cacheLayout ? rowLayout.clearAfter : undefined, props.onChange, props.onColumnOrderChange, props.onRowOrderChange, props.onCellWidthChange, props.onCellHeightChange, props.onRightClick, props.dontCommitEditOnSelectionChange),
2814
2819
  mouseHandlers = _useMouse.mouseHandlers,
2815
2820
  knobPosition = _useMouse.knobPosition;
2816
2821
 
@@ -2891,11 +2896,13 @@ var Sheet = forwardRef(function (props, ref) {
2891
2896
 
2892
2897
  for (var y = y1; y <= y2; y++) {
2893
2898
  for (var x = x1; x <= x2; x++) {
2894
- changes.push({
2895
- x: x,
2896
- y: y,
2897
- value: null
2898
- });
2899
+ if (!cellReadOnly(x, y)) {
2900
+ changes.push({
2901
+ x: x,
2902
+ y: y,
2903
+ value: null
2904
+ });
2905
+ }
2899
2906
  }
2900
2907
  }
2901
2908