@fileverse-dev/fortune-core 1.3.10 → 1.3.11-input-ref-1
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/es/api/range.js +20 -0
- package/es/api/sheet.js +30 -2
- package/es/events/keyboard.js +50 -15
- package/es/events/mouse.js +62 -40
- package/es/events/paste.js +77 -28
- package/es/modules/cell.js +60 -2
- package/es/modules/comment.js +129 -24
- package/es/modules/dataVerification.js +34 -1
- package/es/modules/dropCell.js +65 -1
- package/es/modules/formula.d.ts +11 -0
- package/es/modules/formula.js +390 -47
- package/es/modules/hyperlink.js +52 -5
- package/es/modules/merge.js +93 -1
- package/es/modules/moveCells.js +35 -9
- package/es/modules/rowcol.js +75 -2
- package/es/modules/searchReplace.js +58 -2
- package/es/modules/selection.js +152 -42
- package/es/modules/sort.js +74 -9
- package/es/modules/splitColumn.js +21 -0
- package/es/modules/toolbar.js +46 -3
- package/es/settings.d.ts +5 -0
- package/lib/api/range.js +20 -0
- package/lib/api/sheet.js +29 -1
- package/lib/events/keyboard.js +49 -14
- package/lib/events/mouse.js +61 -39
- package/lib/events/paste.js +77 -28
- package/lib/modules/cell.js +60 -2
- package/lib/modules/comment.js +129 -24
- package/lib/modules/dataVerification.js +34 -1
- package/lib/modules/dropCell.js +65 -1
- package/lib/modules/formula.d.ts +11 -0
- package/lib/modules/formula.js +399 -47
- package/lib/modules/hyperlink.js +52 -5
- package/lib/modules/merge.js +93 -1
- package/lib/modules/moveCells.js +35 -9
- package/lib/modules/rowcol.js +75 -2
- package/lib/modules/searchReplace.js +58 -2
- package/lib/modules/selection.js +152 -42
- package/lib/modules/sort.js +74 -9
- package/lib/modules/splitColumn.js +21 -0
- package/lib/modules/toolbar.js +46 -3
- package/lib/settings.d.ts +5 -0
- package/package.json +1 -1
|
@@ -244,7 +244,7 @@ function validateCellData(ctx, item, cellValue) {
|
|
|
244
244
|
return true;
|
|
245
245
|
}
|
|
246
246
|
function checkboxChange(ctx, r, c) {
|
|
247
|
-
var _a;
|
|
247
|
+
var _a, _b, _c, _d;
|
|
248
248
|
var index = (0, _.getSheetIndex)(ctx, ctx.currentSheetId);
|
|
249
249
|
var currentDataVerification = (_a = ctx.luckysheetfile[index].dataVerification) !== null && _a !== void 0 ? _a : {};
|
|
250
250
|
var item = currentDataVerification["".concat(r, "_").concat(c)];
|
|
@@ -255,6 +255,25 @@ function checkboxChange(ctx, r, c) {
|
|
|
255
255
|
}
|
|
256
256
|
var d = (0, _.getFlowdata)(ctx);
|
|
257
257
|
(0, _.setCellValue)(ctx, r, c, d, value);
|
|
258
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
259
|
+
ctx.hooks.updateCellYdoc([{
|
|
260
|
+
sheetId: ctx.currentSheetId,
|
|
261
|
+
path: ["celldata"],
|
|
262
|
+
value: {
|
|
263
|
+
r: r,
|
|
264
|
+
c: c,
|
|
265
|
+
v: (_d = (_c = d === null || d === void 0 ? void 0 : d[r]) === null || _c === void 0 ? void 0 : _c[c]) !== null && _d !== void 0 ? _d : null
|
|
266
|
+
},
|
|
267
|
+
key: "".concat(r, "_").concat(c),
|
|
268
|
+
type: "update"
|
|
269
|
+
}, {
|
|
270
|
+
sheetId: ctx.currentSheetId,
|
|
271
|
+
path: ["dataVerification"],
|
|
272
|
+
key: "".concat(r, "_").concat(c),
|
|
273
|
+
value: JSON.parse(JSON.stringify(item)),
|
|
274
|
+
type: "update"
|
|
275
|
+
}]);
|
|
276
|
+
}
|
|
258
277
|
}
|
|
259
278
|
function getFailureText(ctx, item) {
|
|
260
279
|
var _a, _b, _c, _d, _e;
|
|
@@ -602,6 +621,7 @@ function cellFocus(ctx, r, c, clickMode) {
|
|
|
602
621
|
}
|
|
603
622
|
function setDropdownValue(ctx, value, arr) {
|
|
604
623
|
var _a;
|
|
624
|
+
var _b, _c, _d;
|
|
605
625
|
if (!ctx.luckysheet_select_save) return;
|
|
606
626
|
var d = (0, _.getFlowdata)(ctx);
|
|
607
627
|
if (!d) return;
|
|
@@ -647,6 +667,19 @@ function setDropdownValue(ctx, value, arr) {
|
|
|
647
667
|
v: value,
|
|
648
668
|
pillColor: selectedColor
|
|
649
669
|
});
|
|
670
|
+
if ((_b = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _b === void 0 ? void 0 : _b.updateCellYdoc) {
|
|
671
|
+
ctx.hooks.updateCellYdoc([{
|
|
672
|
+
sheetId: ctx.currentSheetId,
|
|
673
|
+
path: ["celldata"],
|
|
674
|
+
value: {
|
|
675
|
+
r: rowIndex,
|
|
676
|
+
c: colIndex,
|
|
677
|
+
v: (_d = (_c = d === null || d === void 0 ? void 0 : d[rowIndex]) === null || _c === void 0 ? void 0 : _c[colIndex]) !== null && _d !== void 0 ? _d : null
|
|
678
|
+
},
|
|
679
|
+
key: "".concat(rowIndex, "_").concat(colIndex),
|
|
680
|
+
type: "update"
|
|
681
|
+
}]);
|
|
682
|
+
}
|
|
650
683
|
var currentRowHeight = (0, _api.getRowHeight)(ctx, [rowIndex])[rowIndex];
|
|
651
684
|
var newHeight = 22 * (value.split(",").length || (valueData === null || valueData === void 0 ? void 0 : valueData.length)) || 22;
|
|
652
685
|
if (currentRowHeight < newHeight) {
|
package/lib/modules/dropCell.js
CHANGED
|
@@ -1795,7 +1795,7 @@ function getApplyData(copyD, csLen, asLen) {
|
|
|
1795
1795
|
}
|
|
1796
1796
|
function updateDropCell(ctx) {
|
|
1797
1797
|
var _a, _b, _c, _d;
|
|
1798
|
-
var _e, _f, _g;
|
|
1798
|
+
var _e, _f, _g, _h;
|
|
1799
1799
|
var d = (0, _context.getFlowdata)(ctx);
|
|
1800
1800
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1801
1801
|
var isReadOnly = (0, _utils.isAllowEditReadOnly)(ctx);
|
|
@@ -1831,6 +1831,7 @@ function updateDropCell(ctx) {
|
|
|
1831
1831
|
var apply_end_r = applyRange.row[1];
|
|
1832
1832
|
var apply_str_c = applyRange.column[0];
|
|
1833
1833
|
var apply_end_c = applyRange.column[1];
|
|
1834
|
+
var cellChanges = [];
|
|
1834
1835
|
if (direction === "down" || direction === "up") {
|
|
1835
1836
|
var asLen = apply_end_r - apply_str_r + 1;
|
|
1836
1837
|
for (var i = apply_str_c; i <= apply_end_c; i += 1) {
|
|
@@ -1841,6 +1842,7 @@ function updateDropCell(ctx) {
|
|
|
1841
1842
|
for (var j = apply_str_r; j <= apply_end_r; j += 1) {
|
|
1842
1843
|
if (hiddenRows.has("".concat(j))) continue;
|
|
1843
1844
|
var cell = applyData[j - apply_str_r];
|
|
1845
|
+
var afterHookCalled = false;
|
|
1844
1846
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
1845
1847
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "down", j - apply_str_r + 1));
|
|
1846
1848
|
var v = formula.execfunction(ctx, f, j, i);
|
|
@@ -1852,6 +1854,7 @@ function updateDropCell(ctx) {
|
|
|
1852
1854
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
1853
1855
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
1854
1856
|
}));
|
|
1857
|
+
afterHookCalled = true;
|
|
1855
1858
|
}
|
|
1856
1859
|
if (cell.spl != null) {
|
|
1857
1860
|
cell.spl = v[3].data;
|
|
@@ -1889,6 +1892,19 @@ function updateDropCell(ctx) {
|
|
|
1889
1892
|
}
|
|
1890
1893
|
}
|
|
1891
1894
|
d[j][i] = cell || null;
|
|
1895
|
+
if (!afterHookCalled) {
|
|
1896
|
+
cellChanges.push({
|
|
1897
|
+
sheetId: ctx.currentSheetId,
|
|
1898
|
+
path: ["celldata"],
|
|
1899
|
+
value: {
|
|
1900
|
+
r: j,
|
|
1901
|
+
c: i,
|
|
1902
|
+
v: d[j][i]
|
|
1903
|
+
},
|
|
1904
|
+
key: "".concat(j, "_").concat(i),
|
|
1905
|
+
type: "update"
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1892
1908
|
var bd_r = copy_str_r + (j - apply_str_r) % csLen;
|
|
1893
1909
|
var bd_c = i;
|
|
1894
1910
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -1927,6 +1943,7 @@ function updateDropCell(ctx) {
|
|
|
1927
1943
|
for (var j = apply_end_r; j >= apply_str_r; j -= 1) {
|
|
1928
1944
|
if (hiddenRows.has("".concat(j))) continue;
|
|
1929
1945
|
var cell = applyData[apply_end_r - j];
|
|
1946
|
+
var afterHookCalled = false;
|
|
1930
1947
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
1931
1948
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "up", apply_end_r - j + 1));
|
|
1932
1949
|
var v = formula.execfunction(ctx, f, j, i);
|
|
@@ -1938,6 +1955,7 @@ function updateDropCell(ctx) {
|
|
|
1938
1955
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
1939
1956
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
1940
1957
|
}));
|
|
1958
|
+
afterHookCalled = true;
|
|
1941
1959
|
}
|
|
1942
1960
|
if (cell.spl != null) {
|
|
1943
1961
|
cell.spl = v[3].data;
|
|
@@ -1969,6 +1987,19 @@ function updateDropCell(ctx) {
|
|
|
1969
1987
|
}
|
|
1970
1988
|
}
|
|
1971
1989
|
d[j][i] = cell || null;
|
|
1990
|
+
if (!afterHookCalled) {
|
|
1991
|
+
cellChanges.push({
|
|
1992
|
+
sheetId: ctx.currentSheetId,
|
|
1993
|
+
path: ["celldata"],
|
|
1994
|
+
value: {
|
|
1995
|
+
r: j,
|
|
1996
|
+
c: i,
|
|
1997
|
+
v: d[j][i]
|
|
1998
|
+
},
|
|
1999
|
+
key: "".concat(j, "_").concat(i),
|
|
2000
|
+
type: "update"
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
1972
2003
|
var bd_r = copy_end_r - (apply_end_r - j) % csLen;
|
|
1973
2004
|
var bd_c = i;
|
|
1974
2005
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -2014,6 +2045,7 @@ function updateDropCell(ctx) {
|
|
|
2014
2045
|
for (var j = apply_str_c; j <= apply_end_c; j += 1) {
|
|
2015
2046
|
if (hiddenCols.has("".concat(j))) continue;
|
|
2016
2047
|
var cell = applyData[j - apply_str_c];
|
|
2048
|
+
var afterHookCalled = false;
|
|
2017
2049
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
2018
2050
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "right", j - apply_str_c + 1));
|
|
2019
2051
|
var v = formula.execfunction(ctx, f, i, j);
|
|
@@ -2025,6 +2057,7 @@ function updateDropCell(ctx) {
|
|
|
2025
2057
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
2026
2058
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
2027
2059
|
}));
|
|
2060
|
+
afterHookCalled = true;
|
|
2028
2061
|
}
|
|
2029
2062
|
if (cell.spl != null) {
|
|
2030
2063
|
cell.spl = v[3].data;
|
|
@@ -2056,6 +2089,19 @@ function updateDropCell(ctx) {
|
|
|
2056
2089
|
}
|
|
2057
2090
|
}
|
|
2058
2091
|
d[i][j] = cell || null;
|
|
2092
|
+
if (!afterHookCalled) {
|
|
2093
|
+
cellChanges.push({
|
|
2094
|
+
sheetId: ctx.currentSheetId,
|
|
2095
|
+
path: ["celldata"],
|
|
2096
|
+
value: {
|
|
2097
|
+
r: i,
|
|
2098
|
+
c: j,
|
|
2099
|
+
v: d[i][j]
|
|
2100
|
+
},
|
|
2101
|
+
key: "".concat(i, "_").concat(j),
|
|
2102
|
+
type: "update"
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2059
2105
|
var bd_r = i;
|
|
2060
2106
|
var bd_c = copy_str_c + (j - apply_str_c) % csLen;
|
|
2061
2107
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -2094,6 +2140,7 @@ function updateDropCell(ctx) {
|
|
|
2094
2140
|
for (var j = apply_end_c; j >= apply_str_c; j -= 1) {
|
|
2095
2141
|
if (hiddenCols.has("".concat(j))) continue;
|
|
2096
2142
|
var cell = applyData[apply_end_c - j];
|
|
2143
|
+
var afterHookCalled = false;
|
|
2097
2144
|
if ((cell === null || cell === void 0 ? void 0 : cell.f) != null) {
|
|
2098
2145
|
var f = "=".concat(formula.functionCopy(ctx, cell.f, "left", apply_end_c - j + 1));
|
|
2099
2146
|
var v = formula.execfunction(ctx, f, i, j);
|
|
@@ -2105,6 +2152,7 @@ function updateDropCell(ctx) {
|
|
|
2105
2152
|
v: v[1] instanceof Promise ? v[1] : cell.v,
|
|
2106
2153
|
m: v[1] instanceof Promise ? "[object Promise]" : v[1]
|
|
2107
2154
|
}));
|
|
2155
|
+
afterHookCalled = true;
|
|
2108
2156
|
}
|
|
2109
2157
|
if (cell.spl != null) {
|
|
2110
2158
|
cell.spl = v[3].data;
|
|
@@ -2136,6 +2184,19 @@ function updateDropCell(ctx) {
|
|
|
2136
2184
|
}
|
|
2137
2185
|
}
|
|
2138
2186
|
d[i][j] = cell || null;
|
|
2187
|
+
if (!afterHookCalled) {
|
|
2188
|
+
cellChanges.push({
|
|
2189
|
+
sheetId: ctx.currentSheetId,
|
|
2190
|
+
path: ["celldata"],
|
|
2191
|
+
value: {
|
|
2192
|
+
r: i,
|
|
2193
|
+
c: j,
|
|
2194
|
+
v: d[i][j]
|
|
2195
|
+
},
|
|
2196
|
+
key: "".concat(i, "_").concat(j),
|
|
2197
|
+
type: "update"
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2139
2200
|
var bd_r = i;
|
|
2140
2201
|
var bd_c = copy_end_c - (apply_end_c - j) % csLen;
|
|
2141
2202
|
if (borderInfoCompute["".concat(bd_r, "_").concat(bd_c)]) {
|
|
@@ -2172,6 +2233,9 @@ function updateDropCell(ctx) {
|
|
|
2172
2233
|
}
|
|
2173
2234
|
}
|
|
2174
2235
|
}
|
|
2236
|
+
if (cellChanges.length > 0 && ((_h = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _h === void 0 ? void 0 : _h.updateCellYdoc)) {
|
|
2237
|
+
ctx.hooks.updateCellYdoc(cellChanges);
|
|
2238
|
+
}
|
|
2175
2239
|
var cdformat = file.luckysheet_conditionformat_save;
|
|
2176
2240
|
if (cdformat != null && cdformat.length > 0) {
|
|
2177
2241
|
for (var i = 0; i < cdformat.length; i += 1) {
|
package/lib/modules/formula.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export declare class FormulaCache {
|
|
|
20
20
|
rangetosheet?: string;
|
|
21
21
|
rangedrag_column_start?: boolean;
|
|
22
22
|
rangedrag_row_start?: boolean;
|
|
23
|
+
rangeSelectionActive?: boolean | null;
|
|
24
|
+
formulaEditorOwner?: "cell" | "fx" | null;
|
|
23
25
|
functionRangeIndex?: number[];
|
|
24
26
|
functionlistMap: any;
|
|
25
27
|
execFunctionExist?: any[];
|
|
@@ -44,8 +46,17 @@ export declare function setCaretPosition(ctx: Context, textDom: HTMLElement, chi
|
|
|
44
46
|
export declare function getrangeseleciton(): ParentNode | ChildNode | null | undefined;
|
|
45
47
|
export declare function rangeHightlightselected(ctx: Context, $editor: HTMLDivElement): void;
|
|
46
48
|
export declare function functionHTMLGenerate(txt: string): string;
|
|
49
|
+
export declare function getLastFormulaRangeIndex($editor: HTMLDivElement): number | null;
|
|
50
|
+
export declare function getFormulaRangeIndexAtCaret($editor: HTMLDivElement): number | null;
|
|
51
|
+
export declare function setFormulaEditorOwner(ctx: Context, owner: "cell" | "fx" | null): void;
|
|
52
|
+
export declare function getFormulaEditorOwner(ctx: Context): "cell" | "fx" | null;
|
|
53
|
+
export declare function isCaretAtValidFormulaRangeInsertionPoint(editor: HTMLElement | null): boolean;
|
|
54
|
+
export declare function markRangeSelectionDirty(ctx: Context): void;
|
|
55
|
+
export declare function getFormulaRangeIndexForKeyboardSync($editor: HTMLDivElement): number | null;
|
|
47
56
|
export declare function handleFormulaInput(ctx: Context, $copyTo: HTMLDivElement | null | undefined, $editor: HTMLDivElement, kcode: number, preText?: string, refreshRangeSelect?: boolean): void;
|
|
48
57
|
export declare function israngeseleciton(ctx: Context, istooltip?: boolean): boolean;
|
|
58
|
+
export declare function isFormulaReferenceInputMode(ctx: Context): boolean;
|
|
59
|
+
export declare function maybeRecoverDirtyRangeSelection(ctx: Context): boolean;
|
|
49
60
|
export declare function functionStrChange(txt: string, type: string, rc: "row" | "col", orient: string | null, stindex: number, step: number): string;
|
|
50
61
|
export declare function rangeSetValue(ctx: Context, cellInput: HTMLDivElement, selected: any, fxInput?: HTMLDivElement | null): void;
|
|
51
62
|
export declare function onFormulaRangeDragEnd(ctx: Context): void;
|