sheet-happens 0.0.19 → 0.0.21
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 +5 -0
- package/dist/index.js +40 -30
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +40 -30
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -580,14 +580,10 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
|
|
|
580
580
|
|
|
581
581
|
if (rowSelectionActive) {
|
|
582
582
|
var p1x = Math.max(-100, p1.x);
|
|
583
|
-
|
|
584
|
-
context.fillRect(p1x, p1y, 100000, p2.y - p1.y);
|
|
583
|
+
context.fillRect(p1x, p1.y, 100000, p2.y - p1.y);
|
|
585
584
|
} else if (colSelectionActive) {
|
|
586
|
-
var
|
|
587
|
-
|
|
588
|
-
var _p1y = Math.max(-100, p1.y);
|
|
589
|
-
|
|
590
|
-
context.fillRect(_p1x, _p1y, p2.x - p1.x, 100000);
|
|
585
|
+
var p1y = Math.max(0, p1.y);
|
|
586
|
+
context.fillRect(p1.x, p1y, p2.x - p1.x, 100000);
|
|
591
587
|
} else {
|
|
592
588
|
context.fillRect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y);
|
|
593
589
|
}
|
|
@@ -714,17 +710,13 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
|
|
|
714
710
|
context.beginPath();
|
|
715
711
|
|
|
716
712
|
if (rowSelectionActive) {
|
|
717
|
-
var
|
|
718
|
-
|
|
719
|
-
var _p1y2 = Math.max(-100, p1.y);
|
|
713
|
+
var _p1x = Math.max(-100, p1.x);
|
|
720
714
|
|
|
721
|
-
context.rect(
|
|
715
|
+
context.rect(_p1x, p1.y, 100000, p2.y - p1.y);
|
|
722
716
|
} else if (colSelectionActive) {
|
|
723
|
-
var
|
|
724
|
-
|
|
725
|
-
var _p1y3 = Math.max(-100, p1.y);
|
|
717
|
+
var _p1y = Math.max(-100, p1.y);
|
|
726
718
|
|
|
727
|
-
context.rect(
|
|
719
|
+
context.rect(p1.x, _p1y, p2.x - p1.x, 100000);
|
|
728
720
|
} else {
|
|
729
721
|
context.rect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y);
|
|
730
722
|
}
|
|
@@ -1333,12 +1325,12 @@ function Sheet(props) {
|
|
|
1333
1325
|
var clipboardData = e.clipboardData || window.clipboardData;
|
|
1334
1326
|
var types = clipboardData.types;
|
|
1335
1327
|
|
|
1336
|
-
if (types.includes('text/
|
|
1337
|
-
var text = clipboardData.getData('text/plain');
|
|
1338
|
-
parsePastedText(text);
|
|
1339
|
-
} else if (types.includes('text/html')) {
|
|
1328
|
+
if (types.includes('text/html')) {
|
|
1340
1329
|
var pastedHtml = clipboardData.getData('text/html');
|
|
1341
1330
|
parsePastedHtml(pastedHtml);
|
|
1331
|
+
} else if (types.includes('text/plain')) {
|
|
1332
|
+
var text = clipboardData.getData('text/plain');
|
|
1333
|
+
parsePastedText(text);
|
|
1342
1334
|
}
|
|
1343
1335
|
};
|
|
1344
1336
|
|
|
@@ -1419,12 +1411,12 @@ function Sheet(props) {
|
|
|
1419
1411
|
var p = td.children[0];
|
|
1420
1412
|
|
|
1421
1413
|
if (p.children.length !== 0 && p.children[0].nodeName === 'FONT') {
|
|
1422
|
-
str = p.children[0].
|
|
1414
|
+
str = p.children[0].textContent.trim();
|
|
1423
1415
|
} else {
|
|
1424
|
-
str = p.
|
|
1416
|
+
str = p.textContent.trim();
|
|
1425
1417
|
}
|
|
1426
1418
|
} else {
|
|
1427
|
-
str = td.
|
|
1419
|
+
str = td.textContent.trim();
|
|
1428
1420
|
}
|
|
1429
1421
|
|
|
1430
1422
|
str = str.replaceAll('\n', '');
|
|
@@ -1777,7 +1769,9 @@ function Sheet(props) {
|
|
|
1777
1769
|
} : _extends({}, sel2);
|
|
1778
1770
|
|
|
1779
1771
|
if (editMode) {
|
|
1780
|
-
|
|
1772
|
+
if (!props.dontCommitEditOnSelectionChange) {
|
|
1773
|
+
commitEditingCell();
|
|
1774
|
+
}
|
|
1781
1775
|
}
|
|
1782
1776
|
|
|
1783
1777
|
var scrollToP2 = true;
|
|
@@ -1802,11 +1796,14 @@ function Sheet(props) {
|
|
|
1802
1796
|
|
|
1803
1797
|
setSelectionInProgress(true);
|
|
1804
1798
|
changeSelection(sel1.x, sel1.y, sel2.x, sel2.y, scrollToP2);
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1799
|
+
|
|
1800
|
+
if (!props.dontCommitEditOnSelectionChange) {
|
|
1801
|
+
setEditCell({
|
|
1802
|
+
x: -1,
|
|
1803
|
+
y: -1
|
|
1804
|
+
});
|
|
1805
|
+
setEditKey('');
|
|
1806
|
+
}
|
|
1810
1807
|
};
|
|
1811
1808
|
|
|
1812
1809
|
var onMouseUp = function onMouseUp(e) {
|
|
@@ -1870,7 +1867,11 @@ function Sheet(props) {
|
|
|
1870
1867
|
changes.push({
|
|
1871
1868
|
x: x,
|
|
1872
1869
|
y: y,
|
|
1873
|
-
value: value
|
|
1870
|
+
value: value,
|
|
1871
|
+
source: {
|
|
1872
|
+
x: x,
|
|
1873
|
+
y: srcY
|
|
1874
|
+
}
|
|
1874
1875
|
});
|
|
1875
1876
|
}
|
|
1876
1877
|
|
|
@@ -1903,7 +1904,11 @@ function Sheet(props) {
|
|
|
1903
1904
|
changes.push({
|
|
1904
1905
|
x: _x3,
|
|
1905
1906
|
y: _y2,
|
|
1906
|
-
value: _value
|
|
1907
|
+
value: _value,
|
|
1908
|
+
source: {
|
|
1909
|
+
x: srcX,
|
|
1910
|
+
y: _y2
|
|
1911
|
+
}
|
|
1907
1912
|
});
|
|
1908
1913
|
}
|
|
1909
1914
|
|
|
@@ -2120,6 +2125,11 @@ function Sheet(props) {
|
|
|
2120
2125
|
|
|
2121
2126
|
var editCell = absCoordianteToCell(x, y, rowSizes, columnSizes);
|
|
2122
2127
|
setArrowKeyCommitMode(false);
|
|
2128
|
+
|
|
2129
|
+
if (editMode) {
|
|
2130
|
+
commitEditingCell();
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2123
2133
|
startEditingCell(editCell);
|
|
2124
2134
|
};
|
|
2125
2135
|
|