sheet-happens 0.0.20 → 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 +26 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +26 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export interface Change {
|
|
|
15
15
|
x: number;
|
|
16
16
|
y: number;
|
|
17
17
|
value: string | number | null;
|
|
18
|
+
source?: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
18
22
|
}
|
|
19
23
|
export interface CellContentItem {
|
|
20
24
|
content: HTMLImageElement | string | number;
|
|
@@ -52,6 +56,7 @@ export interface SheetProps {
|
|
|
52
56
|
editData?: CellProperty<string>;
|
|
53
57
|
editKeys?: CellProperty<string>;
|
|
54
58
|
sheetStyle?: SheetStyle;
|
|
59
|
+
dontCommitEditOnSelectionChange?: boolean;
|
|
55
60
|
inputComponent?: (x: number, y: number, props: SheetInputProps, commitEditingCell?: () => void) => ReactElement | undefined;
|
|
56
61
|
onSelectionChanged?: (x1: number, y1: number, x2: number, y2: number) => void;
|
|
57
62
|
onRightClick?: (e: SheetMouseEvent) => void;
|
package/dist/index.js
CHANGED
|
@@ -1772,7 +1772,9 @@ function Sheet(props) {
|
|
|
1772
1772
|
} : _extends({}, sel2);
|
|
1773
1773
|
|
|
1774
1774
|
if (editMode) {
|
|
1775
|
-
|
|
1775
|
+
if (!props.dontCommitEditOnSelectionChange) {
|
|
1776
|
+
commitEditingCell();
|
|
1777
|
+
}
|
|
1776
1778
|
}
|
|
1777
1779
|
|
|
1778
1780
|
var scrollToP2 = true;
|
|
@@ -1797,11 +1799,14 @@ function Sheet(props) {
|
|
|
1797
1799
|
|
|
1798
1800
|
setSelectionInProgress(true);
|
|
1799
1801
|
changeSelection(sel1.x, sel1.y, sel2.x, sel2.y, scrollToP2);
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1802
|
+
|
|
1803
|
+
if (!props.dontCommitEditOnSelectionChange) {
|
|
1804
|
+
setEditCell({
|
|
1805
|
+
x: -1,
|
|
1806
|
+
y: -1
|
|
1807
|
+
});
|
|
1808
|
+
setEditKey('');
|
|
1809
|
+
}
|
|
1805
1810
|
};
|
|
1806
1811
|
|
|
1807
1812
|
var onMouseUp = function onMouseUp(e) {
|
|
@@ -1865,7 +1870,11 @@ function Sheet(props) {
|
|
|
1865
1870
|
changes.push({
|
|
1866
1871
|
x: x,
|
|
1867
1872
|
y: y,
|
|
1868
|
-
value: value
|
|
1873
|
+
value: value,
|
|
1874
|
+
source: {
|
|
1875
|
+
x: x,
|
|
1876
|
+
y: srcY
|
|
1877
|
+
}
|
|
1869
1878
|
});
|
|
1870
1879
|
}
|
|
1871
1880
|
|
|
@@ -1898,7 +1907,11 @@ function Sheet(props) {
|
|
|
1898
1907
|
changes.push({
|
|
1899
1908
|
x: _x3,
|
|
1900
1909
|
y: _y2,
|
|
1901
|
-
value: _value
|
|
1910
|
+
value: _value,
|
|
1911
|
+
source: {
|
|
1912
|
+
x: srcX,
|
|
1913
|
+
y: _y2
|
|
1914
|
+
}
|
|
1902
1915
|
});
|
|
1903
1916
|
}
|
|
1904
1917
|
|
|
@@ -2115,6 +2128,11 @@ function Sheet(props) {
|
|
|
2115
2128
|
|
|
2116
2129
|
var editCell = absCoordianteToCell(x, y, rowSizes, columnSizes);
|
|
2117
2130
|
setArrowKeyCommitMode(false);
|
|
2131
|
+
|
|
2132
|
+
if (editMode) {
|
|
2133
|
+
commitEditingCell();
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2118
2136
|
startEditingCell(editCell);
|
|
2119
2137
|
};
|
|
2120
2138
|
|