sheet-happens 0.0.9 → 0.0.10
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.js +42 -5
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +42 -5
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1114,10 +1114,26 @@ function Sheet(props) {
|
|
|
1114
1114
|
var td = _step18.value;
|
|
1115
1115
|
|
|
1116
1116
|
if (td.nodeName === 'TD') {
|
|
1117
|
+
var str = '';
|
|
1118
|
+
|
|
1119
|
+
if (td.children.length !== 0 && td.children[0].nodeName === 'P') {
|
|
1120
|
+
var p = td.children[0];
|
|
1121
|
+
|
|
1122
|
+
if (p.children.length !== 0 && p.children[0].nodeName === 'FONT') {
|
|
1123
|
+
str = p.children[0].innerHTML;
|
|
1124
|
+
} else {
|
|
1125
|
+
str = p.innerHTML;
|
|
1126
|
+
}
|
|
1127
|
+
} else {
|
|
1128
|
+
str = td.innerHTML;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
str = str.replaceAll('\n', '');
|
|
1132
|
+
str = str.replaceAll(/\s\s+/g, ' ');
|
|
1117
1133
|
changes.push({
|
|
1118
1134
|
y: y,
|
|
1119
1135
|
x: x,
|
|
1120
|
-
value:
|
|
1136
|
+
value: str
|
|
1121
1137
|
});
|
|
1122
1138
|
x++;
|
|
1123
1139
|
}
|
|
@@ -1399,7 +1415,7 @@ function Sheet(props) {
|
|
|
1399
1415
|
var scrollToP2 = true;
|
|
1400
1416
|
|
|
1401
1417
|
if (x < rowHeaderWidth) {
|
|
1402
|
-
sel2.x = 100;
|
|
1418
|
+
sel2.x = dataOffset.x + 100;
|
|
1403
1419
|
scrollToP2 = false;
|
|
1404
1420
|
setRowSelectionInProgress(true);
|
|
1405
1421
|
} else {
|
|
@@ -1407,7 +1423,7 @@ function Sheet(props) {
|
|
|
1407
1423
|
}
|
|
1408
1424
|
|
|
1409
1425
|
if (y < columnHeaderHeight) {
|
|
1410
|
-
sel2.y = 100;
|
|
1426
|
+
sel2.y = dataOffset.y + 100;
|
|
1411
1427
|
scrollToP2 = false;
|
|
1412
1428
|
setColumnSelectionInProgress(true);
|
|
1413
1429
|
} else {
|
|
@@ -1665,7 +1681,14 @@ function Sheet(props) {
|
|
|
1665
1681
|
y2 = selection.y1;
|
|
1666
1682
|
}
|
|
1667
1683
|
|
|
1668
|
-
|
|
1684
|
+
var xCellDiff = 0;
|
|
1685
|
+
if (cell.x < x1) xCellDiff = cell.x - x1;
|
|
1686
|
+
if (cell.x > x2) xCellDiff = x2 - cell.x;
|
|
1687
|
+
var yCellDiff = 0;
|
|
1688
|
+
if (cell.y < y1) yCellDiff = cell.y - y1;
|
|
1689
|
+
if (cell.y > y2) yCellDiff = y2 - cell.y;
|
|
1690
|
+
|
|
1691
|
+
if (xCellDiff > yCellDiff) {
|
|
1669
1692
|
if (cell.y < y1) {
|
|
1670
1693
|
y1 = cell.y;
|
|
1671
1694
|
} else {
|
|
@@ -1689,7 +1712,9 @@ function Sheet(props) {
|
|
|
1689
1712
|
};
|
|
1690
1713
|
|
|
1691
1714
|
var onDoubleClick = function onDoubleClick(e) {
|
|
1692
|
-
|
|
1715
|
+
e.preventDefault();
|
|
1716
|
+
|
|
1717
|
+
if (!e.target || !(e.target instanceof Element) || shiftKeyDown) {
|
|
1693
1718
|
return;
|
|
1694
1719
|
}
|
|
1695
1720
|
|
|
@@ -1893,6 +1918,18 @@ function Sheet(props) {
|
|
|
1893
1918
|
y1 = selection.y1,
|
|
1894
1919
|
y2 = selection.y2;
|
|
1895
1920
|
|
|
1921
|
+
if (x1 > x2) {
|
|
1922
|
+
var _ref = [x2, x1];
|
|
1923
|
+
x1 = _ref[0];
|
|
1924
|
+
x2 = _ref[1];
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
if (y1 > y2) {
|
|
1928
|
+
var _ref2 = [y2, y1];
|
|
1929
|
+
y1 = _ref2[0];
|
|
1930
|
+
y2 = _ref2[1];
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1896
1933
|
if (!(y > columnHeaderHeight && x > rowHeaderWidth)) {
|
|
1897
1934
|
return;
|
|
1898
1935
|
}
|