sheet-happens 0.0.20 → 0.0.22
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.
- package/dist/index.d.ts +16 -0
- package/dist/index.js +159 -66
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +159 -66
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -332,6 +332,26 @@ function absCoordianteToCell(absX, absY, rowSizes, columnSizes) {
|
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
function normalizeSelection(selection) {
|
|
336
|
+
var selx1 = selection.x1;
|
|
337
|
+
var selx2 = selection.x2;
|
|
338
|
+
|
|
339
|
+
if (selection.x1 > selection.x2) {
|
|
340
|
+
selx1 = selection.x2;
|
|
341
|
+
selx2 = selection.x1;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
var sely1 = selection.y1;
|
|
345
|
+
var sely2 = selection.y2;
|
|
346
|
+
|
|
347
|
+
if (selection.y1 > selection.y2) {
|
|
348
|
+
sely1 = selection.y2;
|
|
349
|
+
sely2 = selection.y1;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return [selx1, sely1, selx2, sely2];
|
|
353
|
+
}
|
|
354
|
+
|
|
335
355
|
function cellToAbsCoordinate(cellX, cellY, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle) {
|
|
336
356
|
var absX = sheetStyle.rowHeaderWidth;
|
|
337
357
|
var indX = columnSizes.index.findIndex(function (i) {
|
|
@@ -500,7 +520,7 @@ function findInDisplayData(displayData, start, direction) {
|
|
|
500
520
|
return i;
|
|
501
521
|
}
|
|
502
522
|
|
|
503
|
-
function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle) {
|
|
523
|
+
function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, secondarySelections, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle) {
|
|
504
524
|
resizeCanvas(context.canvas);
|
|
505
525
|
context.clearRect(0, 0, context.canvas.width, context.canvas.height);
|
|
506
526
|
context.fillStyle = 'white';
|
|
@@ -511,8 +531,8 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
|
|
|
511
531
|
var y = _step2.value;
|
|
512
532
|
var xCoord1 = sheetStyle.rowHeaderWidth;
|
|
513
533
|
|
|
514
|
-
for (var
|
|
515
|
-
var x =
|
|
534
|
+
for (var _iterator9 = _createForOfIteratorHelperLoose(columnSizes.index), _step9; !(_step9 = _iterator9()).done;) {
|
|
535
|
+
var x = _step9.value;
|
|
516
536
|
var style = cellStyle(x, y);
|
|
517
537
|
|
|
518
538
|
if (style.fillColor) {
|
|
@@ -527,21 +547,12 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
|
|
|
527
547
|
}
|
|
528
548
|
|
|
529
549
|
var hideKnob = false;
|
|
530
|
-
var selx1 = selection.x1;
|
|
531
|
-
var selx2 = selection.x2;
|
|
532
550
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
var sely1 = selection.y1;
|
|
539
|
-
var sely2 = selection.y2;
|
|
540
|
-
|
|
541
|
-
if (selection.y1 > selection.y2) {
|
|
542
|
-
sely1 = selection.y2;
|
|
543
|
-
sely2 = selection.y1;
|
|
544
|
-
}
|
|
551
|
+
var _normalizeSelection = normalizeSelection(selection),
|
|
552
|
+
selx1 = _normalizeSelection[0],
|
|
553
|
+
sely1 = _normalizeSelection[1],
|
|
554
|
+
selx2 = _normalizeSelection[2],
|
|
555
|
+
sely2 = _normalizeSelection[3];
|
|
545
556
|
|
|
546
557
|
var selectionActive = selx1 !== -1 && selx2 !== -1 || sely1 !== -1 && sely2 !== -1;
|
|
547
558
|
var rowSelectionActive = selx1 === -1 && selx2 === -1 && sely1 !== -1 && sely2 !== -1;
|
|
@@ -724,6 +735,70 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
|
|
|
724
735
|
context.stroke();
|
|
725
736
|
}
|
|
726
737
|
|
|
738
|
+
for (var _iterator7 = _createForOfIteratorHelperLoose(secondarySelections), _step7; !(_step7 = _iterator7()).done;) {
|
|
739
|
+
var secondarySelection = _step7.value;
|
|
740
|
+
|
|
741
|
+
var _normalizeSelection2 = normalizeSelection(secondarySelection.span),
|
|
742
|
+
_selx = _normalizeSelection2[0],
|
|
743
|
+
_sely = _normalizeSelection2[1],
|
|
744
|
+
_selx2 = _normalizeSelection2[2],
|
|
745
|
+
_sely2 = _normalizeSelection2[3];
|
|
746
|
+
|
|
747
|
+
var secondarySelectionActive = _selx !== -1 && _selx2 !== -1 || _sely !== -1 && _sely2 !== -1;
|
|
748
|
+
|
|
749
|
+
if (!secondarySelectionActive) {
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
var rowSecondarySelectionActive = _selx === -1 && _selx2 === -1 && _sely !== -1 && _sely2 !== -1;
|
|
754
|
+
var colSecondarySelectionActive = _selx !== -1 && _selx2 !== -1 && _sely === -1 && _sely2 === -1;
|
|
755
|
+
|
|
756
|
+
var _p = cellToAbsCoordinate(_selx, _sely, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
|
|
757
|
+
|
|
758
|
+
var _p2 = cellToAbsCoordinate(_selx2, _sely2, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
|
|
759
|
+
|
|
760
|
+
_p2.x += cellWidth(_selx2);
|
|
761
|
+
_p2.y += cellHeight(_sely2);
|
|
762
|
+
|
|
763
|
+
if (_p.x >= _p2.x) {
|
|
764
|
+
_p2.x = _p.x;
|
|
765
|
+
var _currentCol = _selx;
|
|
766
|
+
|
|
767
|
+
while (columnSizes.index.includes(_currentCol)) {
|
|
768
|
+
_p2.x += cellWidth(_currentCol);
|
|
769
|
+
_currentCol++;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
if (_p.y >= _p2.y) {
|
|
774
|
+
_p2.y = _p.y;
|
|
775
|
+
var _currentRow = _sely;
|
|
776
|
+
|
|
777
|
+
while (rowSizes.index.includes(_currentRow)) {
|
|
778
|
+
_p2.y += cellHeight(_currentRow);
|
|
779
|
+
_currentRow++;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
context.strokeStyle = secondarySelection.color;
|
|
784
|
+
context.lineWidth = 1;
|
|
785
|
+
context.beginPath();
|
|
786
|
+
|
|
787
|
+
if (rowSecondarySelectionActive) {
|
|
788
|
+
var _p1x2 = Math.max(-100, _p.x);
|
|
789
|
+
|
|
790
|
+
context.rect(_p1x2, _p.y, 100000, _p2.y - _p.y);
|
|
791
|
+
} else if (colSecondarySelectionActive) {
|
|
792
|
+
var _p1y2 = Math.max(-100, _p.y);
|
|
793
|
+
|
|
794
|
+
context.rect(_p.x, _p1y2, _p2.x - _p.x, 100000);
|
|
795
|
+
} else {
|
|
796
|
+
context.rect(_p.x, _p.y, _p2.x - _p.x, _p2.y - _p.y);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
context.stroke();
|
|
800
|
+
}
|
|
801
|
+
|
|
727
802
|
if (knobDragInProgress) {
|
|
728
803
|
var kx1 = knobArea.x1;
|
|
729
804
|
var kx2 = knobArea.x2;
|
|
@@ -768,14 +843,14 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
|
|
|
768
843
|
context.textBaseline = 'middle';
|
|
769
844
|
var yCoord = sheetStyle.columnHeaderHeight;
|
|
770
845
|
|
|
771
|
-
for (var
|
|
772
|
-
var _y =
|
|
846
|
+
for (var _iterator8 = _createForOfIteratorHelperLoose(rowSizes.index), _step8; !(_step8 = _iterator8()).done;) {
|
|
847
|
+
var _y = _step8.value;
|
|
773
848
|
var xCoord = sheetStyle.rowHeaderWidth;
|
|
774
849
|
|
|
775
850
|
var _ch = cellHeight(_y);
|
|
776
851
|
|
|
777
|
-
for (var
|
|
778
|
-
var _x =
|
|
852
|
+
for (var _iterator10 = _createForOfIteratorHelperLoose(columnSizes.index), _step10; !(_step10 = _iterator10()).done;) {
|
|
853
|
+
var _x = _step10.value;
|
|
779
854
|
|
|
780
855
|
var _cellContent = displayData(_x, _y);
|
|
781
856
|
|
|
@@ -1089,23 +1164,23 @@ function Sheet(props) {
|
|
|
1089
1164
|
}
|
|
1090
1165
|
|
|
1091
1166
|
if (selection.x2 !== -1 && selection.y2 !== -1) {
|
|
1092
|
-
var
|
|
1167
|
+
var _selx3 = selection.x2;
|
|
1093
1168
|
|
|
1094
1169
|
if (selection.x1 > selection.x2) {
|
|
1095
|
-
|
|
1170
|
+
_selx3 = selection.x1;
|
|
1096
1171
|
}
|
|
1097
1172
|
|
|
1098
|
-
var
|
|
1173
|
+
var _sely3 = selection.y2;
|
|
1099
1174
|
|
|
1100
1175
|
if (selection.y1 > selection.y2) {
|
|
1101
|
-
|
|
1176
|
+
_sely3 = selection.y1;
|
|
1102
1177
|
}
|
|
1103
1178
|
|
|
1104
|
-
var _c2 = cellToAbsCoordinate(
|
|
1179
|
+
var _c2 = cellToAbsCoordinate(_selx3, _sely3, rowSizes, columnSizes, dataOffset, cellWidth, cellHeight, sheetStyle);
|
|
1105
1180
|
|
|
1106
1181
|
return {
|
|
1107
|
-
x: _c2.x + cellWidth(
|
|
1108
|
-
y: _c2.y + cellHeight(
|
|
1182
|
+
x: _c2.x + cellWidth(_selx3),
|
|
1183
|
+
y: _c2.y + cellHeight(_sely3)
|
|
1109
1184
|
};
|
|
1110
1185
|
}
|
|
1111
1186
|
|
|
@@ -1126,16 +1201,16 @@ function Sheet(props) {
|
|
|
1126
1201
|
var yCoord = sheetStyle.columnHeaderHeight;
|
|
1127
1202
|
var xCoord = sheetStyle.rowHeaderWidth;
|
|
1128
1203
|
|
|
1129
|
-
for (var
|
|
1130
|
-
var x =
|
|
1204
|
+
for (var _iterator11 = _createForOfIteratorHelperLoose(columnSizes.index), _step11; !(_step11 = _iterator11()).done;) {
|
|
1205
|
+
var x = _step11.value;
|
|
1131
1206
|
var ch = columnHeaders(x);
|
|
1132
1207
|
var cellW = cellWidth(x);
|
|
1133
1208
|
|
|
1134
1209
|
if (ch && typeof ch === 'object' && ch.items) {
|
|
1135
1210
|
var finalStyle = void 0;
|
|
1136
1211
|
|
|
1137
|
-
for (var
|
|
1138
|
-
var obj =
|
|
1212
|
+
for (var _iterator13 = _createForOfIteratorHelperLoose(ch.items), _step13; !(_step13 = _iterator13()).done;) {
|
|
1213
|
+
var obj = _step13.value;
|
|
1139
1214
|
|
|
1140
1215
|
if (obj.onClick) {
|
|
1141
1216
|
if (!finalStyle) {
|
|
@@ -1181,12 +1256,12 @@ function Sheet(props) {
|
|
|
1181
1256
|
xCoord += cellW;
|
|
1182
1257
|
}
|
|
1183
1258
|
|
|
1184
|
-
for (var
|
|
1185
|
-
var y =
|
|
1259
|
+
for (var _iterator12 = _createForOfIteratorHelperLoose(rowSizes.index), _step12; !(_step12 = _iterator12()).done;) {
|
|
1260
|
+
var y = _step12.value;
|
|
1186
1261
|
xCoord = sheetStyle.rowHeaderWidth;
|
|
1187
1262
|
|
|
1188
|
-
for (var
|
|
1189
|
-
var _x2 =
|
|
1263
|
+
for (var _iterator14 = _createForOfIteratorHelperLoose(columnSizes.index), _step14; !(_step14 = _iterator14()).done;) {
|
|
1264
|
+
var _x2 = _step14.value;
|
|
1190
1265
|
var cellContent = displayData(_x2, y);
|
|
1191
1266
|
|
|
1192
1267
|
var _cellW = cellWidth(_x2);
|
|
@@ -1202,8 +1277,8 @@ function Sheet(props) {
|
|
|
1202
1277
|
if (typeof cellContent === 'object' && cellContent.items) {
|
|
1203
1278
|
var _finalStyle = void 0;
|
|
1204
1279
|
|
|
1205
|
-
for (var
|
|
1206
|
-
var _obj =
|
|
1280
|
+
for (var _iterator15 = _createForOfIteratorHelperLoose(cellContent.items), _step15; !(_step15 = _iterator15()).done;) {
|
|
1281
|
+
var _obj = _step15.value;
|
|
1207
1282
|
|
|
1208
1283
|
if (_obj.onClick) {
|
|
1209
1284
|
if (!_finalStyle) {
|
|
@@ -1277,12 +1352,12 @@ function Sheet(props) {
|
|
|
1277
1352
|
}
|
|
1278
1353
|
|
|
1279
1354
|
var animationFrameId = window.requestAnimationFrame(function () {
|
|
1280
|
-
renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle);
|
|
1355
|
+
renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, props.secondarySelections || [], knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle);
|
|
1281
1356
|
});
|
|
1282
1357
|
return function () {
|
|
1283
1358
|
window.cancelAnimationFrame(animationFrameId);
|
|
1284
1359
|
};
|
|
1285
|
-
}, [canvasRef, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle]);
|
|
1360
|
+
}, [canvasRef, rowSizes, columnSizes, cellStyle, cellWidth, cellHeight, selection, props.secondarySelections, knobDragInProgress, columnHeaders, columnHeaderStyle, knobArea, displayData, dataOffset, knobCoordinates, sheetStyle]);
|
|
1286
1361
|
|
|
1287
1362
|
var setFocusToTextArea = function setFocusToTextArea() {
|
|
1288
1363
|
if (copyPasteTextAreaRef.current) {
|
|
@@ -1342,8 +1417,8 @@ function Sheet(props) {
|
|
|
1342
1417
|
});
|
|
1343
1418
|
|
|
1344
1419
|
var findTable = function findTable(element) {
|
|
1345
|
-
for (var
|
|
1346
|
-
var child =
|
|
1420
|
+
for (var _iterator16 = _createForOfIteratorHelperLoose(element.children), _step16; !(_step16 = _iterator16()).done;) {
|
|
1421
|
+
var child = _step16.value;
|
|
1347
1422
|
|
|
1348
1423
|
if (child.nodeName === 'TABLE') {
|
|
1349
1424
|
return child;
|
|
@@ -1392,17 +1467,17 @@ function Sheet(props) {
|
|
|
1392
1467
|
return;
|
|
1393
1468
|
}
|
|
1394
1469
|
|
|
1395
|
-
for (var
|
|
1396
|
-
var tableChild =
|
|
1470
|
+
for (var _iterator17 = _createForOfIteratorHelperLoose(tableNode.children), _step17; !(_step17 = _iterator17()).done;) {
|
|
1471
|
+
var tableChild = _step17.value;
|
|
1397
1472
|
|
|
1398
1473
|
if (tableChild.nodeName === 'TBODY') {
|
|
1399
|
-
for (var
|
|
1400
|
-
var tr =
|
|
1474
|
+
for (var _iterator18 = _createForOfIteratorHelperLoose(tableChild.children), _step18; !(_step18 = _iterator18()).done;) {
|
|
1475
|
+
var tr = _step18.value;
|
|
1401
1476
|
x = pasteLocX;
|
|
1402
1477
|
|
|
1403
1478
|
if (tr.nodeName === 'TR') {
|
|
1404
|
-
for (var
|
|
1405
|
-
var td =
|
|
1479
|
+
for (var _iterator19 = _createForOfIteratorHelperLoose(tr.children), _step19; !(_step19 = _iterator19()).done;) {
|
|
1480
|
+
var td = _step19.value;
|
|
1406
1481
|
|
|
1407
1482
|
if (td.nodeName === 'TD') {
|
|
1408
1483
|
var str = '';
|
|
@@ -1670,8 +1745,8 @@ function Sheet(props) {
|
|
|
1670
1745
|
var hitTargetKeyY = Math.floor(y / yBinSize);
|
|
1671
1746
|
|
|
1672
1747
|
if (hitMap[hitTargetKeyX] && hitMap[hitTargetKeyX][hitTargetKeyY]) {
|
|
1673
|
-
for (var
|
|
1674
|
-
var hitTarget =
|
|
1748
|
+
for (var _iterator20 = _createForOfIteratorHelperLoose(hitMap[hitTargetKeyX][hitTargetKeyY]), _step20; !(_step20 = _iterator20()).done;) {
|
|
1749
|
+
var hitTarget = _step20.value;
|
|
1675
1750
|
|
|
1676
1751
|
if (hitTarget.x <= x && x <= hitTarget.x + hitTarget.w && hitTarget.y <= y && y <= hitTarget.y + hitTarget.h) {
|
|
1677
1752
|
setButtonClickMouseDownCoordinates({
|
|
@@ -1769,7 +1844,9 @@ function Sheet(props) {
|
|
|
1769
1844
|
} : _extends({}, sel2);
|
|
1770
1845
|
|
|
1771
1846
|
if (editMode) {
|
|
1772
|
-
|
|
1847
|
+
if (!props.dontCommitEditOnSelectionChange) {
|
|
1848
|
+
commitEditingCell();
|
|
1849
|
+
}
|
|
1773
1850
|
}
|
|
1774
1851
|
|
|
1775
1852
|
var scrollToP2 = true;
|
|
@@ -1794,11 +1871,14 @@ function Sheet(props) {
|
|
|
1794
1871
|
|
|
1795
1872
|
setSelectionInProgress(true);
|
|
1796
1873
|
changeSelection(sel1.x, sel1.y, sel2.x, sel2.y, scrollToP2);
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1874
|
+
|
|
1875
|
+
if (!props.dontCommitEditOnSelectionChange) {
|
|
1876
|
+
setEditCell({
|
|
1877
|
+
x: -1,
|
|
1878
|
+
y: -1
|
|
1879
|
+
});
|
|
1880
|
+
setEditKey('');
|
|
1881
|
+
}
|
|
1802
1882
|
};
|
|
1803
1883
|
|
|
1804
1884
|
var onMouseUp = function onMouseUp(e) {
|
|
@@ -1862,7 +1942,11 @@ function Sheet(props) {
|
|
|
1862
1942
|
changes.push({
|
|
1863
1943
|
x: x,
|
|
1864
1944
|
y: y,
|
|
1865
|
-
value: value
|
|
1945
|
+
value: value,
|
|
1946
|
+
source: {
|
|
1947
|
+
x: x,
|
|
1948
|
+
y: srcY
|
|
1949
|
+
}
|
|
1866
1950
|
});
|
|
1867
1951
|
}
|
|
1868
1952
|
|
|
@@ -1895,7 +1979,11 @@ function Sheet(props) {
|
|
|
1895
1979
|
changes.push({
|
|
1896
1980
|
x: _x3,
|
|
1897
1981
|
y: _y2,
|
|
1898
|
-
value: _value
|
|
1982
|
+
value: _value,
|
|
1983
|
+
source: {
|
|
1984
|
+
x: srcX,
|
|
1985
|
+
y: _y2
|
|
1986
|
+
}
|
|
1899
1987
|
});
|
|
1900
1988
|
}
|
|
1901
1989
|
|
|
@@ -1966,8 +2054,8 @@ function Sheet(props) {
|
|
|
1966
2054
|
var hitTargetKeyY = Math.floor(y / yBinSize);
|
|
1967
2055
|
|
|
1968
2056
|
if (hitMap[hitTargetKeyX] && hitMap[hitTargetKeyX][hitTargetKeyY]) {
|
|
1969
|
-
for (var
|
|
1970
|
-
var hitTarget =
|
|
2057
|
+
for (var _iterator21 = _createForOfIteratorHelperLoose(hitMap[hitTargetKeyX][hitTargetKeyY]), _step21; !(_step21 = _iterator21()).done;) {
|
|
2058
|
+
var hitTarget = _step21.value;
|
|
1971
2059
|
|
|
1972
2060
|
if (hitTarget.x <= x && x <= hitTarget.x + hitTarget.w && hitTarget.y <= y && y <= hitTarget.y + hitTarget.h) {
|
|
1973
2061
|
window.document.body.style.cursor = 'pointer';
|
|
@@ -1978,8 +2066,8 @@ function Sheet(props) {
|
|
|
1978
2066
|
if (!sheetStyle.hideColumnHeaders && props.onCellWidthChange && y < sheetStyle.columnHeaderHeight) {
|
|
1979
2067
|
var xx = sheetStyle.rowHeaderWidth;
|
|
1980
2068
|
|
|
1981
|
-
for (var
|
|
1982
|
-
var col =
|
|
2069
|
+
for (var _iterator22 = _createForOfIteratorHelperLoose(columnSizes.index), _step22; !(_step22 = _iterator22()).done;) {
|
|
2070
|
+
var col = _step22.value;
|
|
1983
2071
|
|
|
1984
2072
|
if (Math.abs(xx - x) < resizeColumnRowMouseThreshold) {
|
|
1985
2073
|
window.document.body.style.cursor = 'col-resize';
|
|
@@ -1993,8 +2081,8 @@ function Sheet(props) {
|
|
|
1993
2081
|
if (!sheetStyle.hideRowHeaders && props.onCellHeightChange && x < sheetStyle.rowHeaderWidth) {
|
|
1994
2082
|
var yy = sheetStyle.columnHeaderHeight;
|
|
1995
2083
|
|
|
1996
|
-
for (var
|
|
1997
|
-
var row =
|
|
2084
|
+
for (var _iterator23 = _createForOfIteratorHelperLoose(rowSizes.index), _step23; !(_step23 = _iterator23()).done;) {
|
|
2085
|
+
var row = _step23.value;
|
|
1998
2086
|
|
|
1999
2087
|
if (Math.abs(yy - y) < resizeColumnRowMouseThreshold) {
|
|
2000
2088
|
window.document.body.style.cursor = 'row-resize';
|
|
@@ -2101,8 +2189,8 @@ function Sheet(props) {
|
|
|
2101
2189
|
var hitTargetKeyY = Math.floor(y / yBinSize);
|
|
2102
2190
|
|
|
2103
2191
|
if (hitMap[hitTargetKeyX] && hitMap[hitTargetKeyX][hitTargetKeyY]) {
|
|
2104
|
-
for (var
|
|
2105
|
-
var hitTarget =
|
|
2192
|
+
for (var _iterator24 = _createForOfIteratorHelperLoose(hitMap[hitTargetKeyX][hitTargetKeyY]), _step24; !(_step24 = _iterator24()).done;) {
|
|
2193
|
+
var hitTarget = _step24.value;
|
|
2106
2194
|
|
|
2107
2195
|
if (hitTarget.x <= x && x <= hitTarget.x + hitTarget.w && hitTarget.y <= y && y <= hitTarget.y + hitTarget.h) {
|
|
2108
2196
|
return;
|
|
@@ -2112,6 +2200,11 @@ function Sheet(props) {
|
|
|
2112
2200
|
|
|
2113
2201
|
var editCell = absCoordianteToCell(x, y, rowSizes, columnSizes);
|
|
2114
2202
|
setArrowKeyCommitMode(false);
|
|
2203
|
+
|
|
2204
|
+
if (editMode) {
|
|
2205
|
+
commitEditingCell();
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2115
2208
|
startEditingCell(editCell);
|
|
2116
2209
|
};
|
|
2117
2210
|
|