@univerjs/sheets-formula 0.15.0-insiders.20260110-48b77c8 → 0.15.1-insiders.20260117-8ce4a01
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/lib/cjs/index.js +1 -1
- package/lib/es/index.js +343 -348
- package/lib/index.js +343 -348
- package/lib/types/controllers/utils/ref-range-formula.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Wa = Object.defineProperty;
|
|
2
2
|
var Ka = (a, e, n) => e in a ? Wa(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
|
|
3
3
|
var K = (a, e, n) => Ka(a, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t, ILogService as nn, IConfigService as Ce, LocaleService as Gt, isFormulaString as Me, isFormulaId as sa, cellToRange as da, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as X, UniverInstanceType as
|
|
5
|
-
import { SetRangeValuesCommand as Ta, SheetsSelectionsService as un, getSheetCommandTarget as mn, findFirstNonEmptyCell as fn, alignToMergedCellsBorders as It, expandToContinuousRange as cn, SetSelectionsOperation as ln, SheetInterceptorService as lt, INTERCEPTOR_POINT as Ea, InterceptCellContentPriority as sn, SetRangeValuesMutation as
|
|
6
|
-
import { serializeRange as Se, FormulaDataModel as ye, ErrorType as
|
|
4
|
+
import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t, ILogService as nn, IConfigService as Ce, LocaleService as Gt, isFormulaString as Me, isFormulaId as sa, cellToRange as da, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as X, UniverInstanceType as k, Injector as ct, isRealNum as rn, createIdentifier as Ht, toDisposable as J, moveRangeByOffset as yt, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as on, DependentOn as pa, Plugin as La, merge as Pa, touchDependencies as Ue, isNodeEnv as Xt } from "@univerjs/core";
|
|
5
|
+
import { SetRangeValuesCommand as Ta, SheetsSelectionsService as un, getSheetCommandTarget as mn, findFirstNonEmptyCell as fn, alignToMergedCellsBorders as It, expandToContinuousRange as cn, SetSelectionsOperation as ln, SheetInterceptorService as lt, INTERCEPTOR_POINT as Ea, InterceptCellContentPriority as sn, SetRangeValuesMutation as j, SetStyleCommand as wt, SetBorderCommand as Ia, ClearSelectionFormatCommand as Na, handleMoveCols as Ra, EffectRefRangId as w, runRefRangeMutations as Y, handleMoveRows as Sa, handleMoveRange as Aa, handleInsertRangeMoveRight as Ca, handleInsertRangeMoveDown as Da, handleDeleteRangeMoveUp as ba, handleDeleteRangeMoveLeft as Oa, handleIRemoveCol as Ma, handleIRemoveRow as xa, handleInsertCol as _a, handleInsertRow as ya, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as qa, RemoveSheetCommand as dn, SetWorksheetNameCommand as pn, DeleteRangeMoveLeftCommand as Ln, DeleteRangeMoveUpCommand as Pn, RemoveColCommand as Tn, RemoveRowCommand as En, InsertRangeMoveDownCommand as In, InsertRangeMoveRightCommand as Nn, InsertColCommand as Rn, InsertRowCommand as Sn, MoveColsCommand as An, MoveRowsCommand as Cn, MoveRangeCommand as Dn, RemoveSheetMutation as gt, InsertSheetMutation as qt, SetRangeCustomMetadataCommand as bn, MoveRangeMutation as Wt, MoveRowsMutation as Kt, MoveColsMutation as kt, ReorderRangeMutation as Qt, RemoveRowMutation as jt, RemoveColMutation as $t, InsertColMutation as zt, InsertRowMutation as Zt, SetRowHiddenMutation as Jt, SetRowVisibleMutation as ea, SetWorksheetActiveOperation as ha, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as On, handleDefaultRangeChangeWithEffectRefCommands as ta, getSeparateEffectedRangesOnCommand as Mn, handleCommonDefaultRangeChangeWithEffectRefCommands as xn, UniverSheetsPlugin as _n } from "@univerjs/sheets";
|
|
6
|
+
import { serializeRange as Se, FormulaDataModel as ye, ErrorType as Q, SetImageFormulaDataMutation as yn, IActiveDirtyManagerService as Ua, RegisterOtherFormulaService as gn, SetFormulaCalculationStartMutation as Fe, SetFormulaStringBatchCalculationMutation as qn, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE as hn, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as Un, SetFormulaCalculationStopMutation as aa, SetFormulaCalculationNotificationMutation as Fn, FormulaExecuteStageType as Be, FormulaExecutedStateType as be, SetTriggerFormulaCalculationStartMutation as je, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, IDefinedNamesService as dt, LexerTreeBuilder as pt, generateStringWithSequence as $e, SetDefinedNameMutation as Ae, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as ht, initSheetFormulaData as na, RemoveDefinedNameMutation as Ut, IFunctionService as Lt, SetFormulaCalculationResultMutation as Bn, stripErrorMargin as vn, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as W, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as Vn, functionArray as Gn, functionCompatibility as Hn, functionCube as wn, functionDatabase as Yn, functionDate as Xn, functionEngineering as Wn, functionFinancial as Kn, functionInformation as kn, functionLogical as Qn, functionLookup as jn, functionMath as $n, functionMeta as zn, functionStatistical as Zn, functionText as Jn, functionUniver as ei, functionWeb as ti, OtherFormulaMarkDirty as ai, SetSuperTableMutation as ni, RemoveSuperTableMutation as ii, serializeRangeWithSheet as ze, ISuperTableService as ri, serializeRangeWithSpreadsheet as ra, CustomFunction as Ft, AsyncCustomFunction as Fa, UniverFormulaEnginePlugin as oi, IFormulaCurrentConfigService as ui, Lexer as mi, AstTreeBuilder as fi, Interpreter as ci, generateExecuteAstNodeData as li, getObjectValue as si } from "@univerjs/engine-formula";
|
|
7
7
|
import { BehaviorSubject as di, map as pi } from "rxjs";
|
|
8
8
|
import { IRPCChannelService as Ba, fromModule as Li, toModule as Pi } from "@univerjs/rpc";
|
|
9
9
|
const Ti = {
|
|
@@ -11,21 +11,21 @@ const Ti = {
|
|
|
11
11
|
type: ca.COMMAND,
|
|
12
12
|
handler: async (a, e) => {
|
|
13
13
|
const { list: n, listOfRangeHasNumber: i } = e, r = a.get(ue), o = new V();
|
|
14
|
-
n.forEach((
|
|
15
|
-
const { range:
|
|
14
|
+
n.forEach((m) => {
|
|
15
|
+
const { range: f, primary: c, formula: l } = m, { row: L, column: E } = c, p = la(6);
|
|
16
16
|
o.setValue(L, E, {
|
|
17
17
|
f: l,
|
|
18
18
|
si: p
|
|
19
19
|
});
|
|
20
|
-
const { startRow: S, startColumn: A, endRow: I, endColumn: d } =
|
|
20
|
+
const { startRow: S, startColumn: A, endRow: I, endColumn: d } = f;
|
|
21
21
|
for (let R = S; R <= I; R++)
|
|
22
22
|
for (let N = A; N <= d; N++)
|
|
23
23
|
(R !== L || N !== E) && o.setValue(R, N, {
|
|
24
24
|
si: p
|
|
25
25
|
});
|
|
26
|
-
}), i && i.length > 0 && i.forEach((
|
|
27
|
-
const { primary:
|
|
28
|
-
o.setValue(
|
|
26
|
+
}), i && i.length > 0 && i.forEach((m) => {
|
|
27
|
+
const { primary: f, formula: c } = m;
|
|
28
|
+
o.setValue(f.row, f.column, {
|
|
29
29
|
f: c
|
|
30
30
|
});
|
|
31
31
|
});
|
|
@@ -43,41 +43,41 @@ const Ti = {
|
|
|
43
43
|
const i = a.get(Ee), r = mn(i);
|
|
44
44
|
if (!r) return !1;
|
|
45
45
|
const o = n.range, { worksheet: u } = r;
|
|
46
|
-
let
|
|
47
|
-
if (!
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
startRow:
|
|
51
|
-
startColumn:
|
|
46
|
+
let m = fn(o, u);
|
|
47
|
+
if (!m) return !1;
|
|
48
|
+
m = It(m, u);
|
|
49
|
+
const f = cn({
|
|
50
|
+
startRow: m.startRow,
|
|
51
|
+
startColumn: m.startColumn,
|
|
52
52
|
endRow: o.endRow,
|
|
53
53
|
endColumn: o.endColumn
|
|
54
54
|
}, { left: !0, right: !0, up: !0, down: !0 }, u), c = new V(), l = It({
|
|
55
|
-
startRow:
|
|
56
|
-
endRow:
|
|
57
|
-
startColumn:
|
|
58
|
-
endColumn:
|
|
55
|
+
startRow: f.endRow,
|
|
56
|
+
endRow: f.endRow,
|
|
57
|
+
startColumn: f.startColumn,
|
|
58
|
+
endColumn: f.endColumn
|
|
59
59
|
}, u);
|
|
60
|
-
if (!fe.equals(l,
|
|
60
|
+
if (!fe.equals(l, f))
|
|
61
61
|
for (const p of u.iterateByColumn(l))
|
|
62
62
|
(!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
|
|
63
63
|
f: `=SUM(${Se({
|
|
64
64
|
startColumn: p.col,
|
|
65
65
|
endColumn: p.col,
|
|
66
|
-
startRow:
|
|
66
|
+
startRow: f.startRow,
|
|
67
67
|
endRow: p.row - 1
|
|
68
68
|
})})`
|
|
69
69
|
});
|
|
70
70
|
const L = It({
|
|
71
|
-
startRow:
|
|
72
|
-
startColumn:
|
|
73
|
-
endRow:
|
|
74
|
-
endColumn:
|
|
71
|
+
startRow: f.startRow,
|
|
72
|
+
startColumn: f.endColumn,
|
|
73
|
+
endRow: f.endRow,
|
|
74
|
+
endColumn: f.endColumn
|
|
75
75
|
}, u);
|
|
76
|
-
if (!fe.equals(L,
|
|
76
|
+
if (!fe.equals(L, f))
|
|
77
77
|
for (const p of u.iterateByRow(L))
|
|
78
78
|
(!p.value || !u.cellHasValue(p.value)) && c.setValue(p.row, p.col, {
|
|
79
79
|
f: `=SUM(${Se({
|
|
80
|
-
startColumn:
|
|
80
|
+
startColumn: f.startColumn,
|
|
81
81
|
endColumn: p.col - 1,
|
|
82
82
|
startRow: p.row,
|
|
83
83
|
endRow: p.row
|
|
@@ -88,7 +88,7 @@ const Ti = {
|
|
|
88
88
|
{
|
|
89
89
|
id: Ta.id,
|
|
90
90
|
params: {
|
|
91
|
-
range:
|
|
91
|
+
range: f,
|
|
92
92
|
value: c.getMatrix()
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -98,8 +98,8 @@ const Ti = {
|
|
|
98
98
|
unitId: r.unitId,
|
|
99
99
|
subUnitId: r.subUnitId,
|
|
100
100
|
selections: [{
|
|
101
|
-
range:
|
|
102
|
-
primary: fe.contains(
|
|
101
|
+
range: f,
|
|
102
|
+
primary: fe.contains(f, n.primary) ? n.primary : { ...m, actualRow: m.startRow, actualColumn: m.startColumn },
|
|
103
103
|
style: null
|
|
104
104
|
}]
|
|
105
105
|
}
|
|
@@ -118,7 +118,7 @@ let Ze = class extends ee {
|
|
|
118
118
|
constructor(e, n, i) {
|
|
119
119
|
super();
|
|
120
120
|
K(this, "_errorValueCell", {
|
|
121
|
-
v:
|
|
121
|
+
v: Q.VALUE,
|
|
122
122
|
t: xt.STRING
|
|
123
123
|
});
|
|
124
124
|
K(this, "_refreshRender");
|
|
@@ -139,8 +139,8 @@ let Ze = class extends ee {
|
|
|
139
139
|
i.map((u) => this._getImageNatureSize(u))
|
|
140
140
|
), o = {};
|
|
141
141
|
r.forEach((u) => {
|
|
142
|
-
const { unitId:
|
|
143
|
-
o[
|
|
142
|
+
const { unitId: m, sheetId: f, row: c, column: l, ...L } = u;
|
|
143
|
+
o[m] || (o[m] = {}), o[m][f] || (o[m][f] = new V()), o[m][f].setValue(c, l, L);
|
|
144
144
|
}), this._formulaDataModel.mergeUnitImageFormulaData(o), this._refreshRender();
|
|
145
145
|
}
|
|
146
146
|
})
|
|
@@ -155,7 +155,7 @@ let Ze = class extends ee {
|
|
|
155
155
|
// eslint-disable-next-line max-lines-per-function
|
|
156
156
|
handler: (e, n, i) => {
|
|
157
157
|
var q, M;
|
|
158
|
-
const { unitId: r, subUnitId: o, row: u, col:
|
|
158
|
+
const { unitId: r, subUnitId: o, row: u, col: m } = n, f = this._formulaDataModel.getUnitImageFormulaData(), c = (M = (q = f == null ? void 0 : f[r]) == null ? void 0 : q[o]) == null ? void 0 : M.getValue(u, m);
|
|
159
159
|
if (!c)
|
|
160
160
|
return i(e);
|
|
161
161
|
const {
|
|
@@ -268,7 +268,7 @@ var Si = Object.getOwnPropertyDescriptor, Ai = (a, e, n, i) => {
|
|
|
268
268
|
}, pe = (a, e) => (n, i) => e(n, i, a);
|
|
269
269
|
const ma = { done: 0, count: 0 }, At = { onlyLocal: !0 };
|
|
270
270
|
let xe = class extends ee {
|
|
271
|
-
constructor(e, n, i, r, o, u,
|
|
271
|
+
constructor(e, n, i, r, o, u, m) {
|
|
272
272
|
super();
|
|
273
273
|
K(this, "_waitingCommandQueue", []);
|
|
274
274
|
K(this, "_executingDirtyData", {
|
|
@@ -288,7 +288,7 @@ let xe = class extends ee {
|
|
|
288
288
|
K(this, "_restartCalculation", !1);
|
|
289
289
|
K(this, "_progress$", new di(ma));
|
|
290
290
|
K(this, "progress$", this._progress$.asObservable());
|
|
291
|
-
this._commandService = e, this._activeDirtyManagerService = n, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService =
|
|
291
|
+
this._commandService = e, this._activeDirtyManagerService = n, this._logService = i, this._configService = r, this._formulaDataModel = o, this._localeService = u, this._registerOtherFormulaService = m, this._commandExecutedListener(), this._initialExecuteFormulaProcessListener(), this._initialExecuteFormula();
|
|
292
292
|
}
|
|
293
293
|
_emitProgress(e) {
|
|
294
294
|
this._progress$.next({ done: this._doneCalculationTaskCount, count: this._totalCalculationTaskCount, label: e });
|
|
@@ -337,7 +337,7 @@ let xe = class extends ee {
|
|
|
337
337
|
), this.disposeWithMe(
|
|
338
338
|
this._commandService.onCommandExecuted((e, n) => {
|
|
339
339
|
if (this._activeDirtyManagerService.get(e.id)) {
|
|
340
|
-
if (e.id ===
|
|
340
|
+
if (e.id === j.id) {
|
|
341
341
|
const i = e.params;
|
|
342
342
|
if (n && n.onlyLocal === !0 || i.trigger === wt.id || i.trigger === Ia.id || i.trigger === Na.id)
|
|
343
343
|
return;
|
|
@@ -351,14 +351,14 @@ let xe = class extends ee {
|
|
|
351
351
|
);
|
|
352
352
|
}
|
|
353
353
|
_generateDirty(e) {
|
|
354
|
-
const n = [], i = {}, r = {}, o = {}, u = {},
|
|
355
|
-
let
|
|
354
|
+
const n = [], i = {}, r = {}, o = {}, u = {}, m = {};
|
|
355
|
+
let f = !1;
|
|
356
356
|
for (const c of e) {
|
|
357
357
|
const l = this._activeDirtyManagerService.get(c.id);
|
|
358
358
|
if (l == null)
|
|
359
359
|
continue;
|
|
360
360
|
const L = l.getDirtyData(c), { dirtyRanges: E, dirtyNameMap: p, dirtyDefinedNameMap: S, dirtyUnitFeatureMap: A, dirtyUnitOtherFormulaMap: I, clearDependencyTreeCache: d, forceCalculation: R = !1 } = L;
|
|
361
|
-
E != null && this._mergeDirtyRanges(n, E), p != null && this._mergeDirtyNameMap(i, p), S != null && this._mergeDirtyNameMap(r, S), A != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, A), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, I), d != null && this._mergeDirtyNameMap(
|
|
361
|
+
E != null && this._mergeDirtyRanges(n, E), p != null && this._mergeDirtyNameMap(i, p), S != null && this._mergeDirtyNameMap(r, S), A != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(o, A), I != null && this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, I), d != null && this._mergeDirtyNameMap(m, d), f = f || R;
|
|
362
362
|
}
|
|
363
363
|
return {
|
|
364
364
|
dirtyRanges: n,
|
|
@@ -366,23 +366,23 @@ let xe = class extends ee {
|
|
|
366
366
|
dirtyDefinedNameMap: r,
|
|
367
367
|
dirtyUnitFeatureMap: o,
|
|
368
368
|
dirtyUnitOtherFormulaMap: u,
|
|
369
|
-
forceCalculation:
|
|
370
|
-
clearDependencyTreeCache:
|
|
369
|
+
forceCalculation: f,
|
|
370
|
+
clearDependencyTreeCache: m
|
|
371
371
|
// numfmtItemMap,
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
_mergeDirty(e, n) {
|
|
375
|
-
const i = [...e.dirtyRanges, ...n.dirtyRanges], r = { ...e.dirtyNameMap }, o = { ...e.dirtyDefinedNameMap }, u = { ...e.dirtyUnitFeatureMap },
|
|
376
|
-
this._mergeDirtyNameMap(r, n.dirtyNameMap), this._mergeDirtyNameMap(o, n.dirtyDefinedNameMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, n.dirtyUnitFeatureMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(
|
|
375
|
+
const i = [...e.dirtyRanges, ...n.dirtyRanges], r = { ...e.dirtyNameMap }, o = { ...e.dirtyDefinedNameMap }, u = { ...e.dirtyUnitFeatureMap }, m = { ...e.dirtyUnitOtherFormulaMap }, f = { ...e.clearDependencyTreeCache };
|
|
376
|
+
this._mergeDirtyNameMap(r, n.dirtyNameMap), this._mergeDirtyNameMap(o, n.dirtyDefinedNameMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(u, n.dirtyUnitFeatureMap), this._mergeDirtyUnitFeatureOrOtherFormulaMap(m, n.dirtyUnitOtherFormulaMap), this._mergeDirtyNameMap(f, n.clearDependencyTreeCache);
|
|
377
377
|
const c = e.forceCalculation || n.forceCalculation;
|
|
378
378
|
return {
|
|
379
379
|
dirtyRanges: i,
|
|
380
380
|
dirtyNameMap: r,
|
|
381
381
|
dirtyDefinedNameMap: o,
|
|
382
382
|
dirtyUnitFeatureMap: u,
|
|
383
|
-
dirtyUnitOtherFormulaMap:
|
|
383
|
+
dirtyUnitOtherFormulaMap: m,
|
|
384
384
|
forceCalculation: c,
|
|
385
|
-
clearDependencyTreeCache:
|
|
385
|
+
clearDependencyTreeCache: f
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
/**
|
|
@@ -395,8 +395,8 @@ let xe = class extends ee {
|
|
|
395
395
|
let r = !1;
|
|
396
396
|
for (const o of e)
|
|
397
397
|
if (i.unitId === o.unitId && i.sheetId === o.sheetId) {
|
|
398
|
-
const { startRow: u, startColumn:
|
|
399
|
-
if (u === l &&
|
|
398
|
+
const { startRow: u, startColumn: m, endRow: f, endColumn: c } = i.range, { startRow: l, startColumn: L, endRow: E, endColumn: p } = o.range;
|
|
399
|
+
if (u === l && m === L && f === E && c === p) {
|
|
400
400
|
r = !0;
|
|
401
401
|
break;
|
|
402
402
|
}
|
|
@@ -553,9 +553,9 @@ function Oi(a, e) {
|
|
|
553
553
|
const o = e[r], u = a[r];
|
|
554
554
|
if (o == null || u == null)
|
|
555
555
|
return !0;
|
|
556
|
-
Object.keys(o).forEach((
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
556
|
+
Object.keys(o).forEach((m) => {
|
|
557
|
+
const f = new V(o[m] || {}), c = new V(u[m] || {}), l = new V(), L = new V();
|
|
558
|
+
if (f.forValue((I, d, R) => {
|
|
559
559
|
if (R == null)
|
|
560
560
|
return !0;
|
|
561
561
|
const N = _e(R);
|
|
@@ -563,20 +563,20 @@ function Oi(a, e) {
|
|
|
563
563
|
}), l.getSizeOf() === 0)
|
|
564
564
|
return;
|
|
565
565
|
const E = {
|
|
566
|
-
subUnitId:
|
|
566
|
+
subUnitId: m,
|
|
567
567
|
unitId: r,
|
|
568
568
|
cellValue: l.getMatrix()
|
|
569
569
|
}, p = {
|
|
570
|
-
id:
|
|
570
|
+
id: j.id,
|
|
571
571
|
params: E
|
|
572
572
|
};
|
|
573
573
|
i.push(p);
|
|
574
574
|
const S = {
|
|
575
|
-
subUnitId:
|
|
575
|
+
subUnitId: m,
|
|
576
576
|
unitId: r,
|
|
577
577
|
cellValue: L.getMatrix()
|
|
578
578
|
}, A = {
|
|
579
|
-
id:
|
|
579
|
+
id: j.id,
|
|
580
580
|
params: S
|
|
581
581
|
};
|
|
582
582
|
n.push(A);
|
|
@@ -588,29 +588,29 @@ function Oi(a, e) {
|
|
|
588
588
|
}
|
|
589
589
|
function Mi(a, e, n) {
|
|
590
590
|
const { redoFormulaData: i, undoFormulaData: r } = xi(a, e, n), o = [], u = [];
|
|
591
|
-
return Object.keys(i).forEach((
|
|
592
|
-
Object.keys(i[
|
|
593
|
-
if (Object.keys(i[
|
|
591
|
+
return Object.keys(i).forEach((m) => {
|
|
592
|
+
Object.keys(i[m]).forEach((f) => {
|
|
593
|
+
if (Object.keys(i[m][f]).length !== 0) {
|
|
594
594
|
const c = {
|
|
595
|
-
subUnitId:
|
|
596
|
-
unitId:
|
|
597
|
-
cellValue: i[
|
|
595
|
+
subUnitId: f,
|
|
596
|
+
unitId: m,
|
|
597
|
+
cellValue: i[m][f]
|
|
598
598
|
}, l = {
|
|
599
|
-
id:
|
|
599
|
+
id: j.id,
|
|
600
600
|
params: c
|
|
601
601
|
};
|
|
602
602
|
o.push(l);
|
|
603
603
|
}
|
|
604
604
|
});
|
|
605
|
-
}), Object.keys(r).forEach((
|
|
606
|
-
Object.keys(r[
|
|
607
|
-
if (Object.keys(r[
|
|
605
|
+
}), Object.keys(r).forEach((m) => {
|
|
606
|
+
Object.keys(r[m]).forEach((f) => {
|
|
607
|
+
if (Object.keys(r[m][f]).length !== 0) {
|
|
608
608
|
const c = {
|
|
609
|
-
subUnitId:
|
|
610
|
-
unitId:
|
|
611
|
-
cellValue: r[
|
|
609
|
+
subUnitId: f,
|
|
610
|
+
unitId: m,
|
|
611
|
+
cellValue: r[m][f]
|
|
612
612
|
}, l = {
|
|
613
|
-
id:
|
|
613
|
+
id: j.id,
|
|
614
614
|
params: c
|
|
615
615
|
};
|
|
616
616
|
u.push(l);
|
|
@@ -623,23 +623,23 @@ function Mi(a, e, n) {
|
|
|
623
623
|
}
|
|
624
624
|
function xi(a, e, n) {
|
|
625
625
|
const i = {}, r = {}, { unitId: o, sheetId: u } = n;
|
|
626
|
-
return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((
|
|
627
|
-
if (Ci(a,
|
|
626
|
+
return (/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(e)])).forEach((f) => {
|
|
627
|
+
if (Ci(a, f, u))
|
|
628
628
|
return;
|
|
629
629
|
(/* @__PURE__ */ new Set([
|
|
630
|
-
...Object.keys(a[
|
|
631
|
-
...Object.keys(e[
|
|
630
|
+
...Object.keys(a[f] || {}),
|
|
631
|
+
...Object.keys(e[f] || {})
|
|
632
632
|
])).forEach((l) => {
|
|
633
633
|
var R, N;
|
|
634
|
-
const L = (R = a[
|
|
634
|
+
const L = (R = a[f]) == null ? void 0 : R[l], E = (N = e[f]) == null ? void 0 : N[l], p = new V(L || {}), S = new V(E || {});
|
|
635
635
|
let A = [];
|
|
636
|
-
|
|
636
|
+
f !== o || l !== u ? A = yi(S) : A = _i(p, S, n);
|
|
637
637
|
const I = Wi(A, p, S), d = Ki(A, p);
|
|
638
|
-
i[
|
|
639
|
-
...i[
|
|
638
|
+
i[f] || (i[f] = {}), r[f] || (r[f] = {}), i[f][l] = {
|
|
639
|
+
...i[f][l],
|
|
640
640
|
...I
|
|
641
|
-
}, r[
|
|
642
|
-
...r[
|
|
641
|
+
}, r[f][l] = {
|
|
642
|
+
...r[f][l],
|
|
643
643
|
...d
|
|
644
644
|
};
|
|
645
645
|
});
|
|
@@ -649,10 +649,10 @@ function xi(a, e, n) {
|
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
651
|
function _i(a, e, n) {
|
|
652
|
-
const { type: i, from: r, to: o, range: u } = n,
|
|
653
|
-
return a.forValue((
|
|
652
|
+
const { type: i, from: r, to: o, range: u } = n, m = [];
|
|
653
|
+
return a.forValue((f, c, l) => {
|
|
654
654
|
if (l == null || !va(l)) return !0;
|
|
655
|
-
const L = da(
|
|
655
|
+
const L = da(f, c);
|
|
656
656
|
let E = null, p = !1;
|
|
657
657
|
if ([
|
|
658
658
|
0,
|
|
@@ -665,10 +665,10 @@ function _i(a, e, n) {
|
|
|
665
665
|
const S = qi(L, n);
|
|
666
666
|
E = S.newCell, p = S.isReverse;
|
|
667
667
|
}
|
|
668
|
-
if (Xe.diffValue(L, E) && !e.getValue(
|
|
668
|
+
if (Xe.diffValue(L, E) && !e.getValue(f, c))
|
|
669
669
|
return !0;
|
|
670
|
-
p ?
|
|
671
|
-
}),
|
|
670
|
+
p ? m.unshift({ oldCell: L, newCell: E }) : m.push({ oldCell: L, newCell: E });
|
|
671
|
+
}), m;
|
|
672
672
|
}
|
|
673
673
|
function yi(a) {
|
|
674
674
|
const e = [];
|
|
@@ -837,10 +837,10 @@ function Xi(a, e) {
|
|
|
837
837
|
function Wi(a, e, n) {
|
|
838
838
|
var r, o, u;
|
|
839
839
|
const i = new V({});
|
|
840
|
-
for (let
|
|
841
|
-
const { oldCell:
|
|
842
|
-
if ((r = i.getValue(
|
|
843
|
-
const l = (u = n.getValue(
|
|
840
|
+
for (let m = 0; m < a.length; m++) {
|
|
841
|
+
const { oldCell: f, newCell: c } = a[m];
|
|
842
|
+
if ((r = i.getValue(f.startRow, f.startColumn)) != null && r.f || (o = i.getValue(f.startRow, f.startColumn)) != null && o.si || i.setValue(f.startRow, f.startColumn, { f: null, si: null }), c) {
|
|
843
|
+
const l = (u = n.getValue(f.startRow, f.startColumn)) != null ? u : e.getValue(f.startRow, f.startColumn), L = _e(l);
|
|
844
844
|
i.setValue(c.startRow, c.startColumn, L);
|
|
845
845
|
}
|
|
846
846
|
}
|
|
@@ -849,16 +849,18 @@ function Wi(a, e, n) {
|
|
|
849
849
|
function Ki(a, e) {
|
|
850
850
|
const n = new V({});
|
|
851
851
|
for (let i = a.length - 1; i >= 0; i--) {
|
|
852
|
-
const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn),
|
|
853
|
-
if (n.setValue(r.startRow, r.startColumn,
|
|
854
|
-
const
|
|
852
|
+
const { oldCell: r, newCell: o } = a[i], u = e.getValue(r.startRow, r.startColumn), m = _e(u);
|
|
853
|
+
if (n.setValue(r.startRow, r.startColumn, m), o) {
|
|
854
|
+
const f = e.getValue(o.startRow, o.startColumn), c = _e(f);
|
|
855
855
|
n.setValue(o.startRow, o.startColumn, c != null ? c : { f: null, si: null });
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
return n.getMatrix();
|
|
859
859
|
}
|
|
860
860
|
function _e(a) {
|
|
861
|
-
if (a
|
|
861
|
+
if (a === void 0)
|
|
862
|
+
return;
|
|
863
|
+
if (a === null)
|
|
862
864
|
return {
|
|
863
865
|
f: null,
|
|
864
866
|
si: null
|
|
@@ -869,15 +871,16 @@ function _e(a) {
|
|
|
869
871
|
f: null,
|
|
870
872
|
si: null
|
|
871
873
|
};
|
|
872
|
-
const
|
|
873
|
-
return u && (
|
|
874
|
+
const m = {};
|
|
875
|
+
return u && (m.si = n), o && i === 0 && r === 0 && (m.f = e), m.f === void 0 && (m.f = null), m.si === void 0 && (m.si = null), m;
|
|
874
876
|
}
|
|
875
|
-
function ki(a) {
|
|
876
|
-
const
|
|
877
|
-
return new V(a).forValue((
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
877
|
+
function ki(a, e) {
|
|
878
|
+
const n = new V({});
|
|
879
|
+
return new V(a).forValue((r, o, u) => {
|
|
880
|
+
var f;
|
|
881
|
+
const m = _e(u);
|
|
882
|
+
m !== void 0 && (e && ((f = e[r]) != null && f[o]) && (m != null && m.f || m != null && m.si) && (m.v = null, m.t = null), n.setValue(r, o, m));
|
|
883
|
+
}), n.getMatrix();
|
|
881
884
|
}
|
|
882
885
|
function va(a) {
|
|
883
886
|
const e = (a == null ? void 0 : a.f) || "", n = (a == null ? void 0 : a.si) || "", i = Me(e), r = sa(n);
|
|
@@ -894,14 +897,14 @@ function Va(a, e, n, i, r, o) {
|
|
|
894
897
|
function Ga(a, e, n = 0, i = 0) {
|
|
895
898
|
const r = [];
|
|
896
899
|
for (let o = 0, u = a.length; o < u; o++) {
|
|
897
|
-
const
|
|
898
|
-
if (typeof
|
|
899
|
-
r.push(
|
|
900
|
+
const m = a[o];
|
|
901
|
+
if (typeof m == "string" || m.nodeType !== ie.REFERENCE || e.includes(o)) {
|
|
902
|
+
r.push(m);
|
|
900
903
|
continue;
|
|
901
904
|
}
|
|
902
|
-
const { token:
|
|
905
|
+
const { token: f } = m, c = Pe(f), { range: l, sheetName: L, unitId: E } = c, p = fe.moveOffset(l, n, i);
|
|
903
906
|
r.push({
|
|
904
|
-
...
|
|
907
|
+
...m,
|
|
905
908
|
token: st({
|
|
906
909
|
range: p,
|
|
907
910
|
unitId: E,
|
|
@@ -912,7 +915,7 @@ function Ga(a, e, n = 0, i = 0) {
|
|
|
912
915
|
return r;
|
|
913
916
|
}
|
|
914
917
|
function Ha(a, e, n, i) {
|
|
915
|
-
const { type: r, unitId: o, sheetId: u, range:
|
|
918
|
+
const { type: r, unitId: o, sheetId: u, range: m, from: f, to: c, rangeFilteredRows: l } = e, {
|
|
916
919
|
range: L,
|
|
917
920
|
sheetId: E,
|
|
918
921
|
unitId: p,
|
|
@@ -932,24 +935,24 @@ function Ha(a, e, n, i) {
|
|
|
932
935
|
const d = fe.moveOffset(L, A, I);
|
|
933
936
|
let R = null;
|
|
934
937
|
if (r === y.MoveRange) {
|
|
935
|
-
if (
|
|
938
|
+
if (f == null || c == null)
|
|
936
939
|
return;
|
|
937
|
-
const N = bt(d,
|
|
940
|
+
const N = bt(d, f), P = We(d, f);
|
|
938
941
|
if (P == null || N !== 4)
|
|
939
942
|
return;
|
|
940
943
|
const q = Aa(
|
|
941
|
-
{ id: w.MoveRangeCommandId, params: { toRange: c, fromRange:
|
|
944
|
+
{ id: w.MoveRangeCommandId, params: { toRange: c, fromRange: f } },
|
|
942
945
|
P
|
|
943
946
|
), M = Y(q, P);
|
|
944
947
|
if (M == null)
|
|
945
|
-
return
|
|
946
|
-
R = Dt(N, M,
|
|
948
|
+
return Q.REF;
|
|
949
|
+
R = Dt(N, M, f, c, d, P);
|
|
947
950
|
} else if (r === y.MoveRows) {
|
|
948
|
-
if (
|
|
951
|
+
if (f == null || c == null)
|
|
949
952
|
return;
|
|
950
|
-
const N = bt(d,
|
|
951
|
-
let P = We(d,
|
|
952
|
-
if (P == null && (
|
|
953
|
+
const N = bt(d, f);
|
|
954
|
+
let P = We(d, f);
|
|
955
|
+
if (P == null && (f.endRow < d.startRow && c.endRow <= d.startRow || f.startRow > d.endRow && c.startRow > d.endRow))
|
|
953
956
|
return;
|
|
954
957
|
P == null && (P = {
|
|
955
958
|
startRow: d.startRow,
|
|
@@ -959,18 +962,18 @@ function Ha(a, e, n, i) {
|
|
|
959
962
|
rangeType: X.NORMAL
|
|
960
963
|
});
|
|
961
964
|
const q = Sa(
|
|
962
|
-
{ id: w.MoveRowsCommandId, params: { toRange: c, fromRange:
|
|
965
|
+
{ id: w.MoveRowsCommandId, params: { toRange: c, fromRange: f } },
|
|
963
966
|
P
|
|
964
967
|
), M = Y(q, P);
|
|
965
968
|
if (M == null)
|
|
966
|
-
return
|
|
967
|
-
R = Dt(N, M,
|
|
969
|
+
return Q.REF;
|
|
970
|
+
R = Dt(N, M, f, c, d, P);
|
|
968
971
|
} else if (r === y.MoveCols) {
|
|
969
|
-
if (
|
|
972
|
+
if (f == null || c == null)
|
|
970
973
|
return;
|
|
971
|
-
const N = bt(d,
|
|
972
|
-
let P = We(d,
|
|
973
|
-
if (P == null && (
|
|
974
|
+
const N = bt(d, f);
|
|
975
|
+
let P = We(d, f);
|
|
976
|
+
if (P == null && (f.endColumn < d.startColumn && c.endColumn <= d.startColumn || f.startColumn > d.endColumn && c.startColumn > d.endColumn))
|
|
974
977
|
return;
|
|
975
978
|
P == null && (P = {
|
|
976
979
|
startRow: d.startRow,
|
|
@@ -980,19 +983,19 @@ function Ha(a, e, n, i) {
|
|
|
980
983
|
rangeType: X.NORMAL
|
|
981
984
|
});
|
|
982
985
|
const q = Ra(
|
|
983
|
-
{ id: w.MoveColsCommandId, params: { toRange: c, fromRange:
|
|
986
|
+
{ id: w.MoveColsCommandId, params: { toRange: c, fromRange: f } },
|
|
984
987
|
P
|
|
985
988
|
), M = Y(q, P);
|
|
986
989
|
if (M == null)
|
|
987
|
-
return
|
|
988
|
-
R = Dt(N, M,
|
|
990
|
+
return Q.REF;
|
|
991
|
+
R = Dt(N, M, f, c, d, P);
|
|
989
992
|
}
|
|
990
|
-
if (
|
|
993
|
+
if (m != null) {
|
|
991
994
|
if (r === y.InsertRow) {
|
|
992
995
|
const N = ya(
|
|
993
996
|
{
|
|
994
997
|
id: w.InsertRowCommandId,
|
|
995
|
-
params: { range:
|
|
998
|
+
params: { range: m, unitId: "", subUnitId: "", direction: Ke.DOWN }
|
|
996
999
|
},
|
|
997
1000
|
d
|
|
998
1001
|
), P = Y(N, d);
|
|
@@ -1006,7 +1009,7 @@ function Ha(a, e, n, i) {
|
|
|
1006
1009
|
const N = _a(
|
|
1007
1010
|
{
|
|
1008
1011
|
id: w.InsertColCommandId,
|
|
1009
|
-
params: { range:
|
|
1012
|
+
params: { range: m, unitId: "", subUnitId: "", direction: Ke.RIGHT }
|
|
1010
1013
|
},
|
|
1011
1014
|
d
|
|
1012
1015
|
), P = Y(N, d);
|
|
@@ -1020,13 +1023,13 @@ function Ha(a, e, n, i) {
|
|
|
1020
1023
|
const N = xa(
|
|
1021
1024
|
{
|
|
1022
1025
|
id: w.RemoveRowCommandId,
|
|
1023
|
-
params: { range:
|
|
1026
|
+
params: { range: m }
|
|
1024
1027
|
},
|
|
1025
1028
|
d,
|
|
1026
1029
|
l
|
|
1027
1030
|
), P = Y(N, d);
|
|
1028
1031
|
if (P == null)
|
|
1029
|
-
return
|
|
1032
|
+
return Q.REF;
|
|
1030
1033
|
R = {
|
|
1031
1034
|
...d,
|
|
1032
1035
|
...P
|
|
@@ -1035,12 +1038,12 @@ function Ha(a, e, n, i) {
|
|
|
1035
1038
|
const N = Ma(
|
|
1036
1039
|
{
|
|
1037
1040
|
id: w.RemoveColCommandId,
|
|
1038
|
-
params: { range:
|
|
1041
|
+
params: { range: m }
|
|
1039
1042
|
},
|
|
1040
1043
|
d
|
|
1041
1044
|
), P = Y(N, d);
|
|
1042
1045
|
if (P == null)
|
|
1043
|
-
return
|
|
1046
|
+
return Q.REF;
|
|
1044
1047
|
R = {
|
|
1045
1048
|
...d,
|
|
1046
1049
|
...P
|
|
@@ -1049,12 +1052,12 @@ function Ha(a, e, n, i) {
|
|
|
1049
1052
|
const N = Oa(
|
|
1050
1053
|
{
|
|
1051
1054
|
id: w.DeleteRangeMoveLeftCommandId,
|
|
1052
|
-
params: { range:
|
|
1055
|
+
params: { range: m }
|
|
1053
1056
|
},
|
|
1054
1057
|
d
|
|
1055
1058
|
), P = Y(N, d);
|
|
1056
1059
|
if (P == null)
|
|
1057
|
-
return
|
|
1060
|
+
return Q.REF;
|
|
1058
1061
|
R = {
|
|
1059
1062
|
...d,
|
|
1060
1063
|
...P
|
|
@@ -1063,12 +1066,12 @@ function Ha(a, e, n, i) {
|
|
|
1063
1066
|
const N = ba(
|
|
1064
1067
|
{
|
|
1065
1068
|
id: w.DeleteRangeMoveUpCommandId,
|
|
1066
|
-
params: { range:
|
|
1069
|
+
params: { range: m }
|
|
1067
1070
|
},
|
|
1068
1071
|
d
|
|
1069
1072
|
), P = Y(N, d);
|
|
1070
1073
|
if (P == null)
|
|
1071
|
-
return
|
|
1074
|
+
return Q.REF;
|
|
1072
1075
|
R = {
|
|
1073
1076
|
...d,
|
|
1074
1077
|
...P
|
|
@@ -1077,7 +1080,7 @@ function Ha(a, e, n, i) {
|
|
|
1077
1080
|
const N = Da(
|
|
1078
1081
|
{
|
|
1079
1082
|
id: w.InsertRangeMoveDownCommandId,
|
|
1080
|
-
params: { range:
|
|
1083
|
+
params: { range: m }
|
|
1081
1084
|
},
|
|
1082
1085
|
d
|
|
1083
1086
|
), P = Y(N, d);
|
|
@@ -1091,7 +1094,7 @@ function Ha(a, e, n, i) {
|
|
|
1091
1094
|
const N = Ca(
|
|
1092
1095
|
{
|
|
1093
1096
|
id: w.InsertRangeMoveRightCommandId,
|
|
1094
|
-
params: { range:
|
|
1097
|
+
params: { range: m }
|
|
1095
1098
|
},
|
|
1096
1099
|
d
|
|
1097
1100
|
), P = Y(N, d);
|
|
@@ -1111,7 +1114,7 @@ function Ha(a, e, n, i) {
|
|
|
1111
1114
|
});
|
|
1112
1115
|
}
|
|
1113
1116
|
function Dt(a, e, n, i, r, o) {
|
|
1114
|
-
const { startRow: u, endRow:
|
|
1117
|
+
const { startRow: u, endRow: m, startColumn: f, endColumn: c, rangeType: l } = Oe(e), {
|
|
1115
1118
|
startRow: L,
|
|
1116
1119
|
startColumn: E,
|
|
1117
1120
|
endRow: p,
|
|
@@ -1130,10 +1133,10 @@ function Dt(a, e, n, i, r, o) {
|
|
|
1130
1133
|
rangeType: ae = X.NORMAL
|
|
1131
1134
|
} = Oe(r), O = { ...r };
|
|
1132
1135
|
function ce() {
|
|
1133
|
-
return l === X.COLUMN && ae === X.COLUMN ? !0 :
|
|
1136
|
+
return l === X.COLUMN && ae === X.COLUMN ? !0 : f >= F && c <= B;
|
|
1134
1137
|
}
|
|
1135
1138
|
function ne() {
|
|
1136
|
-
return l === X.ROW && ae === X.ROW ? !0 : u >= h &&
|
|
1139
|
+
return l === X.ROW && ae === X.ROW ? !0 : u >= h && m <= x;
|
|
1137
1140
|
}
|
|
1138
1141
|
if (a === 0)
|
|
1139
1142
|
if (ce())
|
|
@@ -1147,9 +1150,9 @@ function Dt(a, e, n, i, r, o) {
|
|
|
1147
1150
|
return;
|
|
1148
1151
|
else if (a === 1)
|
|
1149
1152
|
if (ce())
|
|
1150
|
-
if (
|
|
1151
|
-
O.endRow =
|
|
1152
|
-
else if (
|
|
1153
|
+
if (m > x)
|
|
1154
|
+
O.endRow = m;
|
|
1155
|
+
else if (m <= h)
|
|
1153
1156
|
O.startRow += x - L + 1;
|
|
1154
1157
|
else
|
|
1155
1158
|
return;
|
|
@@ -1157,9 +1160,9 @@ function Dt(a, e, n, i, r, o) {
|
|
|
1157
1160
|
return;
|
|
1158
1161
|
else if (a === 2)
|
|
1159
1162
|
if (ne())
|
|
1160
|
-
if (
|
|
1161
|
-
O.startColumn =
|
|
1162
|
-
else if (
|
|
1163
|
+
if (f < F)
|
|
1164
|
+
O.startColumn = f;
|
|
1165
|
+
else if (f >= B)
|
|
1163
1166
|
O.endColumn -= S + 1 - F;
|
|
1164
1167
|
else
|
|
1165
1168
|
return;
|
|
@@ -1175,21 +1178,21 @@ function Dt(a, e, n, i, r, o) {
|
|
|
1175
1178
|
return;
|
|
1176
1179
|
else
|
|
1177
1180
|
return;
|
|
1178
|
-
else a === 4 ? (O.startRow = u, O.startColumn =
|
|
1181
|
+
else a === 4 ? (O.startRow = u, O.startColumn = f, O.endRow = m, O.endColumn = c) : E <= F && S >= B || A === X.ROW && ae === X.ROW ? n.endRow < h ? (I >= h && (O.startRow -= p - L + 1), I >= x && (O.endRow -= p - L + 1)) : n.startRow > x ? (R <= x && (O.endRow += p - L + 1), R <= h && (O.startRow += p - L + 1)) : n.startRow >= h && n.endRow <= x && (I <= h ? O.startRow += p - L + 1 : I >= x && (O.endRow -= p - L + 1)) : L <= h && p >= x || A === X.COLUMN && ae === X.COLUMN ? n.endColumn < F ? (d >= F && (O.startColumn -= S - E + 1), d >= B && (O.endColumn -= S - E + 1)) : n.startColumn > B ? (N <= B && (O.endColumn += S - E + 1), N <= F && (O.startColumn += S - E + 1)) : n.startColumn >= F && n.endColumn <= B && (d <= F ? O.startColumn += S - E + 1 : d >= B && (O.endColumn -= S - E + 1)) : ((d <= U + 1 && N >= B || d <= F && N >= M - 1) && I <= h && R >= x || (I <= q + 1 && R >= x || I <= h && R >= P - 1) && d <= F && N >= B, O.startRow = u, O.startColumn = f, O.endRow = m, O.endColumn = c);
|
|
1179
1182
|
return O;
|
|
1180
1183
|
}
|
|
1181
1184
|
function bt(a, e) {
|
|
1182
|
-
const n = Ne(a.startRow), i = Re(a.endRow), r = Ne(a.startColumn), o = Re(a.endColumn), u = Ne(e.startRow),
|
|
1185
|
+
const n = Ne(a.startRow), i = Re(a.endRow), r = Ne(a.startColumn), o = Re(a.endColumn), u = Ne(e.startRow), m = Re(e.endRow), f = Ne(e.startColumn), c = Re(e.endColumn);
|
|
1183
1186
|
function l() {
|
|
1184
|
-
return a.rangeType === X.COLUMN && e.rangeType === X.COLUMN ? !0 : n >= u && i <=
|
|
1187
|
+
return a.rangeType === X.COLUMN && e.rangeType === X.COLUMN ? !0 : n >= u && i <= m;
|
|
1185
1188
|
}
|
|
1186
1189
|
function L() {
|
|
1187
|
-
return a.rangeType === X.ROW && e.rangeType === X.ROW ? !0 : r >=
|
|
1190
|
+
return a.rangeType === X.ROW && e.rangeType === X.ROW ? !0 : r >= f && o <= c;
|
|
1188
1191
|
}
|
|
1189
1192
|
function E() {
|
|
1190
1193
|
return a.rangeType === X.ALL && e.rangeType === X.ALL;
|
|
1191
1194
|
}
|
|
1192
|
-
return l() && L() || E() ? 4 : L() && n >= u && n <=
|
|
1195
|
+
return l() && L() || E() ? 4 : L() && n >= u && n <= m && i > m ? 0 : L() && i >= u && i <= m && n < u ? 1 : l() && r >= f && r <= c && o > c ? 2 : l() && o >= f && o <= c && r < f ? 3 : null;
|
|
1193
1196
|
}
|
|
1194
1197
|
function Ne(a) {
|
|
1195
1198
|
return isNaN(a) ? -1 / 0 : a;
|
|
@@ -1287,26 +1290,26 @@ function ji(a, e) {
|
|
|
1287
1290
|
const {
|
|
1288
1291
|
fromRange: { startRow: i, endRow: r },
|
|
1289
1292
|
toRange: { startRow: o, endRow: u }
|
|
1290
|
-
} = n,
|
|
1291
|
-
if (!
|
|
1292
|
-
const c =
|
|
1293
|
+
} = n, m = e.getUnitId(), f = e.getActiveSheet();
|
|
1294
|
+
if (!f) return null;
|
|
1295
|
+
const c = f.getSheetId(), l = {
|
|
1293
1296
|
startRow: i,
|
|
1294
1297
|
startColumn: 0,
|
|
1295
1298
|
endRow: r,
|
|
1296
|
-
endColumn:
|
|
1299
|
+
endColumn: f.getColumnCount() - 1,
|
|
1297
1300
|
rangeType: X.ROW
|
|
1298
1301
|
}, L = {
|
|
1299
1302
|
startRow: o,
|
|
1300
1303
|
startColumn: 0,
|
|
1301
1304
|
endRow: u,
|
|
1302
|
-
endColumn:
|
|
1305
|
+
endColumn: f.getColumnCount() - 1,
|
|
1303
1306
|
rangeType: X.ROW
|
|
1304
1307
|
};
|
|
1305
1308
|
return {
|
|
1306
1309
|
type: y.MoveRows,
|
|
1307
1310
|
from: l,
|
|
1308
1311
|
to: L,
|
|
1309
|
-
unitId:
|
|
1312
|
+
unitId: m,
|
|
1310
1313
|
sheetId: c
|
|
1311
1314
|
};
|
|
1312
1315
|
}
|
|
@@ -1316,18 +1319,18 @@ function $i(a, e) {
|
|
|
1316
1319
|
const {
|
|
1317
1320
|
fromRange: { startColumn: i, endColumn: r },
|
|
1318
1321
|
toRange: { startColumn: o, endColumn: u }
|
|
1319
|
-
} = n,
|
|
1320
|
-
if (!
|
|
1321
|
-
const c =
|
|
1322
|
+
} = n, m = e.getUnitId(), f = e.getActiveSheet();
|
|
1323
|
+
if (!f) return null;
|
|
1324
|
+
const c = f.getSheetId(), l = {
|
|
1322
1325
|
startRow: 0,
|
|
1323
1326
|
startColumn: i,
|
|
1324
|
-
endRow:
|
|
1327
|
+
endRow: f.getRowCount() - 1,
|
|
1325
1328
|
endColumn: r,
|
|
1326
1329
|
rangeType: X.COLUMN
|
|
1327
1330
|
}, L = {
|
|
1328
1331
|
startRow: 0,
|
|
1329
1332
|
startColumn: o,
|
|
1330
|
-
endRow:
|
|
1333
|
+
endRow: f.getRowCount() - 1,
|
|
1331
1334
|
endColumn: u,
|
|
1332
1335
|
rangeType: X.COLUMN
|
|
1333
1336
|
};
|
|
@@ -1335,7 +1338,7 @@ function $i(a, e) {
|
|
|
1335
1338
|
type: y.MoveCols,
|
|
1336
1339
|
from: l,
|
|
1337
1340
|
to: L,
|
|
1338
|
-
unitId:
|
|
1341
|
+
unitId: m,
|
|
1339
1342
|
sheetId: c
|
|
1340
1343
|
};
|
|
1341
1344
|
}
|
|
@@ -1384,7 +1387,7 @@ function er(a, e) {
|
|
|
1384
1387
|
};
|
|
1385
1388
|
}
|
|
1386
1389
|
function tr(a, e) {
|
|
1387
|
-
var u,
|
|
1390
|
+
var u, m;
|
|
1388
1391
|
const { params: n } = a;
|
|
1389
1392
|
if (!n) return null;
|
|
1390
1393
|
const { range: i } = n, { unitId: r, sheetId: o } = te(e);
|
|
@@ -1393,7 +1396,7 @@ function tr(a, e) {
|
|
|
1393
1396
|
range: i,
|
|
1394
1397
|
unitId: r,
|
|
1395
1398
|
sheetId: o,
|
|
1396
|
-
rangeFilteredRows: (
|
|
1399
|
+
rangeFilteredRows: (m = (u = e.getSheetBySheetId(o)) == null ? void 0 : u.getRangeFilterRows(i)) != null ? m : []
|
|
1397
1400
|
};
|
|
1398
1401
|
}
|
|
1399
1402
|
function ar(a, e) {
|
|
@@ -1432,11 +1435,11 @@ function ir(a, e) {
|
|
|
1432
1435
|
function rr(a, e) {
|
|
1433
1436
|
const { params: n } = a;
|
|
1434
1437
|
if (!n) return null;
|
|
1435
|
-
const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId:
|
|
1438
|
+
const { unitId: i, subUnitId: r, name: o } = n, { unitId: u, sheetId: m } = te(e);
|
|
1436
1439
|
return {
|
|
1437
1440
|
type: y.SetName,
|
|
1438
1441
|
unitId: i || u,
|
|
1439
|
-
sheetId: r ||
|
|
1442
|
+
sheetId: r || m,
|
|
1440
1443
|
sheetName: o
|
|
1441
1444
|
};
|
|
1442
1445
|
}
|
|
@@ -1495,7 +1498,7 @@ let Je = class extends ee {
|
|
|
1495
1498
|
redos: [],
|
|
1496
1499
|
undos: []
|
|
1497
1500
|
};
|
|
1498
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
1501
|
+
const e = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET);
|
|
1499
1502
|
if (e == null)
|
|
1500
1503
|
return {
|
|
1501
1504
|
redos: [],
|
|
@@ -1518,10 +1521,10 @@ let Je = class extends ee {
|
|
|
1518
1521
|
redos: [],
|
|
1519
1522
|
undos: []
|
|
1520
1523
|
};
|
|
1521
|
-
const u = [],
|
|
1522
|
-
return Object.values(o).forEach((
|
|
1524
|
+
const u = [], m = [];
|
|
1525
|
+
return Object.values(o).forEach((f) => {
|
|
1523
1526
|
var I;
|
|
1524
|
-
const { formulaOrRefString: c } =
|
|
1527
|
+
const { formulaOrRefString: c } = f, l = this._lexerTreeBuilder.sequenceNodesBuilder(c);
|
|
1525
1528
|
if (l == null)
|
|
1526
1529
|
return !0;
|
|
1527
1530
|
let L = !1;
|
|
@@ -1540,7 +1543,7 @@ let Je = class extends ee {
|
|
|
1540
1543
|
};
|
|
1541
1544
|
let B = null;
|
|
1542
1545
|
if (n === y.RemoveSheet)
|
|
1543
|
-
B = this._removeSheet(
|
|
1546
|
+
B = this._removeSheet(f, i, r);
|
|
1544
1547
|
else if (n === y.SetName) {
|
|
1545
1548
|
const {
|
|
1546
1549
|
sheetId: ae,
|
|
@@ -1571,7 +1574,7 @@ let Je = class extends ee {
|
|
|
1571
1574
|
id: Ae.id,
|
|
1572
1575
|
params: {
|
|
1573
1576
|
unitId: i,
|
|
1574
|
-
...
|
|
1577
|
+
...f,
|
|
1575
1578
|
formulaOrRefString: p
|
|
1576
1579
|
}
|
|
1577
1580
|
};
|
|
@@ -1580,19 +1583,19 @@ let Je = class extends ee {
|
|
|
1580
1583
|
id: Ae.id,
|
|
1581
1584
|
params: {
|
|
1582
1585
|
unitId: i,
|
|
1583
|
-
...
|
|
1586
|
+
...f
|
|
1584
1587
|
}
|
|
1585
1588
|
};
|
|
1586
|
-
|
|
1589
|
+
m.push(A);
|
|
1587
1590
|
}), {
|
|
1588
1591
|
redos: u,
|
|
1589
|
-
undos:
|
|
1592
|
+
undos: m
|
|
1590
1593
|
};
|
|
1591
1594
|
}
|
|
1592
1595
|
_removeSheet(a, e, n) {
|
|
1593
1596
|
var o;
|
|
1594
1597
|
const { formulaOrRefString: i } = a;
|
|
1595
|
-
return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ?
|
|
1598
|
+
return ((o = this._definedNamesService.getWorksheetByRef(e, i)) == null ? void 0 : o.getSheetId()) === n ? Q.REF : null;
|
|
1596
1599
|
}
|
|
1597
1600
|
};
|
|
1598
1601
|
Je = cr([
|
|
@@ -1607,8 +1610,8 @@ var lr = Object.getOwnPropertyDescriptor, sr = (a, e, n, i) => {
|
|
|
1607
1610
|
return r;
|
|
1608
1611
|
}, me = (a, e) => (n, i) => e(n, i, a);
|
|
1609
1612
|
let et = class extends ee {
|
|
1610
|
-
constructor(a, e, n, i, r, o, u,
|
|
1611
|
-
super(), this._univerInstanceService = a, this._commandService = e, this._lexerTreeBuilder = n, this._formulaDataModel = i, this._sheetInterceptorService = r, this._definedNamesService = o, this._configService = u, this._injector =
|
|
1613
|
+
constructor(a, e, n, i, r, o, u, m) {
|
|
1614
|
+
super(), this._univerInstanceService = a, this._commandService = e, this._lexerTreeBuilder = n, this._formulaDataModel = i, this._sheetInterceptorService = r, this._definedNamesService = o, this._configService = u, this._injector = m, this._commandExecutedListener();
|
|
1612
1615
|
}
|
|
1613
1616
|
_commandExecutedListener() {
|
|
1614
1617
|
this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
|
|
@@ -1623,14 +1626,14 @@ let et = class extends ee {
|
|
|
1623
1626
|
})
|
|
1624
1627
|
), this.disposeWithMe(
|
|
1625
1628
|
this._commandService.beforeCommandExecuted((a, e) => {
|
|
1626
|
-
if (a.id ===
|
|
1629
|
+
if (a.id === j.id) {
|
|
1627
1630
|
const n = a.params;
|
|
1628
1631
|
if (e && e.onlyLocal === !0 || e && e.syncOnly === !0 || n.trigger === wt.id || n.trigger === Ia.id || n.trigger === Na.id || n.trigger === bn.id)
|
|
1629
1632
|
return;
|
|
1630
1633
|
this._handleSetRangeValuesMutation(n);
|
|
1631
1634
|
}
|
|
1632
1635
|
})
|
|
1633
|
-
), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(
|
|
1636
|
+
), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(k.UNIVER_SHEET).subscribe((a) => this._handleWorkbookAdded(a))), this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(k.UNIVER_SHEET).pipe(pi((a) => a.getUnitId())).subscribe((a) => this._handleWorkbookDisposed(a)));
|
|
1634
1637
|
}
|
|
1635
1638
|
_handleSetRangeValuesMutation(a) {
|
|
1636
1639
|
const { subUnitId: e, unitId: n, cellValue: i } = a;
|
|
@@ -1645,11 +1648,11 @@ let et = class extends ee {
|
|
|
1645
1648
|
}
|
|
1646
1649
|
};
|
|
1647
1650
|
this._commandService.executeCommand(
|
|
1648
|
-
|
|
1651
|
+
j.id,
|
|
1649
1652
|
{
|
|
1650
1653
|
unitId: n,
|
|
1651
1654
|
subUnitId: e,
|
|
1652
|
-
cellValue: ki(r)
|
|
1655
|
+
cellValue: ki(r, i)
|
|
1653
1656
|
},
|
|
1654
1657
|
{
|
|
1655
1658
|
onlyLocal: !0,
|
|
@@ -1677,7 +1680,7 @@ let et = class extends ee {
|
|
|
1677
1680
|
);
|
|
1678
1681
|
}
|
|
1679
1682
|
_handleWorkbookDisposed(a, e) {
|
|
1680
|
-
const n = this._formulaDataModel.getFormulaData(), i = Ct(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Ct(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(),
|
|
1683
|
+
const n = this._formulaDataModel.getFormulaData(), i = Ct(n, a, e), r = this._formulaDataModel.getArrayFormulaRange(), o = Ct(r, a, e), u = this._formulaDataModel.getArrayFormulaCellData(), m = Ct(u, a, e);
|
|
1681
1684
|
i && this._commandService.executeCommand(
|
|
1682
1685
|
ve.id,
|
|
1683
1686
|
{
|
|
@@ -1686,7 +1689,7 @@ let et = class extends ee {
|
|
|
1686
1689
|
{
|
|
1687
1690
|
onlyLocal: !0
|
|
1688
1691
|
}
|
|
1689
|
-
), o &&
|
|
1692
|
+
), o && m && this._commandService.executeCommand(
|
|
1690
1693
|
ht.id,
|
|
1691
1694
|
{
|
|
1692
1695
|
arrayFormulaRange: r,
|
|
@@ -1698,11 +1701,11 @@ let et = class extends ee {
|
|
|
1698
1701
|
);
|
|
1699
1702
|
}
|
|
1700
1703
|
_handleInsertSheetMutation(a) {
|
|
1701
|
-
const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new V(o),
|
|
1704
|
+
const { sheet: e, unitId: n } = a, i = this._formulaDataModel.getFormulaData(), { id: r, cellData: o } = e, u = new V(o), m = na(i, n, r, u);
|
|
1702
1705
|
this._commandService.executeCommand(
|
|
1703
1706
|
ve.id,
|
|
1704
1707
|
{
|
|
1705
|
-
formulaData:
|
|
1708
|
+
formulaData: m
|
|
1706
1709
|
},
|
|
1707
1710
|
{
|
|
1708
1711
|
onlyLocal: !0
|
|
@@ -1710,15 +1713,15 @@ let et = class extends ee {
|
|
|
1710
1713
|
);
|
|
1711
1714
|
}
|
|
1712
1715
|
_handleWorkbookAdded(a) {
|
|
1713
|
-
var
|
|
1716
|
+
var f;
|
|
1714
1717
|
const e = {}, n = a.getUnitId(), i = { [n]: {} };
|
|
1715
1718
|
a.getSheets().forEach((c) => {
|
|
1716
1719
|
var p;
|
|
1717
1720
|
const l = c.getCellMatrix(), L = c.getSheetId(), E = na(e, n, L, l);
|
|
1718
1721
|
i[n][L] = (p = E[n]) == null ? void 0 : p[L];
|
|
1719
1722
|
}), this._commandService.executeCommand(ve.id, { formulaData: i }, { onlyLocal: !0 });
|
|
1720
|
-
const o = this._configService.getConfig(ge), u = (
|
|
1721
|
-
this._commandService.executeCommand(je.id,
|
|
1723
|
+
const o = this._configService.getConfig(ge), u = (f = o == null ? void 0 : o.initialFormulaComputing) != null ? f : Te.WHEN_EMPTY, m = this._getDirtyDataByCalculationMode(u);
|
|
1724
|
+
this._commandService.executeCommand(je.id, m, { onlyLocal: !0 });
|
|
1722
1725
|
}
|
|
1723
1726
|
_getDirtyDataByCalculationMode(a) {
|
|
1724
1727
|
const e = a === Te.FORCED, n = a === Te.WHEN_EMPTY ? this._formulaDataModel.getFormulaDirtyRanges() : [];
|
|
@@ -1733,7 +1736,7 @@ let et = class extends ee {
|
|
|
1733
1736
|
};
|
|
1734
1737
|
}
|
|
1735
1738
|
_getUpdateFormula(a) {
|
|
1736
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
1739
|
+
const e = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET);
|
|
1737
1740
|
if (!e)
|
|
1738
1741
|
return {
|
|
1739
1742
|
undos: [],
|
|
@@ -1745,10 +1748,10 @@ let et = class extends ee {
|
|
|
1745
1748
|
r,
|
|
1746
1749
|
i,
|
|
1747
1750
|
n
|
|
1748
|
-
), { undos: u, redos:
|
|
1751
|
+
), { undos: u, redos: m } = bi(r, o, n);
|
|
1749
1752
|
return {
|
|
1750
1753
|
undos: u,
|
|
1751
|
-
redos:
|
|
1754
|
+
redos: m
|
|
1752
1755
|
};
|
|
1753
1756
|
}
|
|
1754
1757
|
return {
|
|
@@ -1763,13 +1766,13 @@ let et = class extends ee {
|
|
|
1763
1766
|
if (i.length === 0) return { newFormulaData: {}, oldFormulaData: {} };
|
|
1764
1767
|
const r = {}, o = {};
|
|
1765
1768
|
for (const u of i) {
|
|
1766
|
-
const
|
|
1767
|
-
if (
|
|
1769
|
+
const m = a[u];
|
|
1770
|
+
if (m == null)
|
|
1768
1771
|
continue;
|
|
1769
|
-
const
|
|
1772
|
+
const f = Object.keys(m);
|
|
1770
1773
|
Xe.isDefine(r[u]) || (r[u] = {}), Xe.isDefine(o[u]) || (o[u] = {});
|
|
1771
|
-
for (const c of
|
|
1772
|
-
const l = new V(
|
|
1774
|
+
for (const c of f) {
|
|
1775
|
+
const l = new V(m[c] || {}), L = new V(), E = [];
|
|
1773
1776
|
l.forValue((p, S, A) => {
|
|
1774
1777
|
var F;
|
|
1775
1778
|
if (!A) return !0;
|
|
@@ -1792,7 +1795,7 @@ let et = class extends ee {
|
|
|
1792
1795
|
continue;
|
|
1793
1796
|
P[B] = {
|
|
1794
1797
|
...O,
|
|
1795
|
-
token: U === y.SetDefinedName ? Ie :
|
|
1798
|
+
token: U === y.SetDefinedName ? Ie : Q.REF
|
|
1796
1799
|
}, q = !0, M.push(B);
|
|
1797
1800
|
continue;
|
|
1798
1801
|
} else if (ne !== ie.REFERENCE)
|
|
@@ -1837,7 +1840,7 @@ let et = class extends ee {
|
|
|
1837
1840
|
} = n;
|
|
1838
1841
|
if (Z == null || Z.length === 0 || Ie !== Z)
|
|
1839
1842
|
continue;
|
|
1840
|
-
De =
|
|
1843
|
+
De = Q.REF;
|
|
1841
1844
|
} else U !== y.SetDefinedName && (De = Ha(
|
|
1842
1845
|
Et,
|
|
1843
1846
|
n,
|
|
@@ -1891,8 +1894,8 @@ let tt = class extends ee {
|
|
|
1891
1894
|
this._initialConversion();
|
|
1892
1895
|
}
|
|
1893
1896
|
_initialConversion() {
|
|
1894
|
-
this._activeDirtyManagerService.register(
|
|
1895
|
-
commandId:
|
|
1897
|
+
this._activeDirtyManagerService.register(j.id, {
|
|
1898
|
+
commandId: j.id,
|
|
1896
1899
|
getDirtyData: (a) => {
|
|
1897
1900
|
const e = a.params;
|
|
1898
1901
|
return e.trigger === wt.id ? {} : {
|
|
@@ -2096,15 +2099,15 @@ let tt = class extends ee {
|
|
|
2096
2099
|
return r.push(...this._getDirtyRangesByCellValue(e, n.subUnitId, n.value)), r.push(...this._getDirtyRangesByCellValue(e, i.subUnitId, i.value)), r.push(...this._getDirtyRangesForArrayFormula(e, i.subUnitId, i.value)), r;
|
|
2097
2100
|
}
|
|
2098
2101
|
_getMoveRowsMutationDirtyRange(a) {
|
|
2099
|
-
const { subUnitId: e, unitId: n, sourceRange: i, targetRange: r } = a, o = [], u = this._rangeToMatrix(i).getData(),
|
|
2100
|
-
return o.push(...this._getDirtyRangesByCellValue(n, e, u)), o.push(...this._getDirtyRangesByCellValue(n, e,
|
|
2102
|
+
const { subUnitId: e, unitId: n, sourceRange: i, targetRange: r } = a, o = [], u = this._rangeToMatrix(i).getData(), m = this._rangeToMatrix(r).getData();
|
|
2103
|
+
return o.push(...this._getDirtyRangesByCellValue(n, e, u)), o.push(...this._getDirtyRangesByCellValue(n, e, m)), o.push(...this._getDirtyRangesForArrayFormula(n, e, m)), o;
|
|
2101
2104
|
}
|
|
2102
2105
|
_getReorderRangeMutationDirtyRange(a) {
|
|
2103
2106
|
const { unitId: e, subUnitId: n, range: i } = a, r = this._rangeToMatrix(i).getData(), o = [];
|
|
2104
2107
|
return o.push(...this._getDirtyRangesByCellValue(e, n, r)), o.push(...this._getDirtyRangesForArrayFormula(e, n, r)), o;
|
|
2105
2108
|
}
|
|
2106
2109
|
_getRemoveRowOrColumnMutation(a, e = !0) {
|
|
2107
|
-
const { subUnitId: n, unitId: i, range: r } = a, o = [], u = this._univerInstanceService.getUniverSheetInstance(i),
|
|
2110
|
+
const { subUnitId: n, unitId: i, range: r } = a, o = [], u = this._univerInstanceService.getUniverSheetInstance(i), m = u == null ? void 0 : u.getSheetBySheetId(n), f = (m == null ? void 0 : m.getRowCount()) || 0, c = (m == null ? void 0 : m.getColumnCount()) || 0;
|
|
2108
2111
|
let l = null;
|
|
2109
2112
|
const { startRow: L, endRow: E, startColumn: p, endColumn: S } = r;
|
|
2110
2113
|
e === !0 ? l = this._rangeToMatrix({
|
|
@@ -2115,7 +2118,7 @@ let tt = class extends ee {
|
|
|
2115
2118
|
}) : l = this._rangeToMatrix({
|
|
2116
2119
|
startRow: 0,
|
|
2117
2120
|
startColumn: p,
|
|
2118
|
-
endRow:
|
|
2121
|
+
endRow: f,
|
|
2119
2122
|
endColumn: S
|
|
2120
2123
|
});
|
|
2121
2124
|
const A = l.getData();
|
|
@@ -2139,8 +2142,8 @@ let tt = class extends ee {
|
|
|
2139
2142
|
_rangeToMatrix(a) {
|
|
2140
2143
|
const e = new V(), { startRow: n, startColumn: i, endRow: r, endColumn: o } = a;
|
|
2141
2144
|
for (let u = n; u <= r; u++)
|
|
2142
|
-
for (let
|
|
2143
|
-
e.setValue(u,
|
|
2145
|
+
for (let m = i; m <= o; m++)
|
|
2146
|
+
e.setValue(u, m, {});
|
|
2144
2147
|
return e;
|
|
2145
2148
|
}
|
|
2146
2149
|
_getDirtyRangesByCellValue(a, e, n) {
|
|
@@ -2154,15 +2157,15 @@ let tt = class extends ee {
|
|
|
2154
2157
|
* All other positions, apart from the top-left corner, need to be marked as dirty.
|
|
2155
2158
|
*/
|
|
2156
2159
|
_getDirtyRangesForArrayFormula(a, e, n) {
|
|
2157
|
-
var u,
|
|
2160
|
+
var u, m;
|
|
2158
2161
|
const i = [];
|
|
2159
2162
|
if (n == null)
|
|
2160
2163
|
return i;
|
|
2161
2164
|
const r = new V(n), o = this._formulaDataModel.getArrayFormulaRange();
|
|
2162
2165
|
if ((u = o == null ? void 0 : o[a]) != null && u[e]) {
|
|
2163
|
-
const
|
|
2166
|
+
const f = new V((m = o == null ? void 0 : o[a]) == null ? void 0 : m[e]);
|
|
2164
2167
|
r.forValue((c, l) => {
|
|
2165
|
-
|
|
2168
|
+
f.forValue((L, E, p) => {
|
|
2166
2169
|
if (p == null)
|
|
2167
2170
|
return !0;
|
|
2168
2171
|
const { startRow: S, startColumn: A, endRow: I, endColumn: d } = p;
|
|
@@ -2240,18 +2243,18 @@ let at = class extends ee {
|
|
|
2240
2243
|
if (!o)
|
|
2241
2244
|
return;
|
|
2242
2245
|
const u = new V();
|
|
2243
|
-
new V(o).forValue((
|
|
2246
|
+
new V(o).forValue((f, c, l) => {
|
|
2244
2247
|
const L = l == null ? void 0 : l.f;
|
|
2245
2248
|
if ((l == null ? void 0 : l.x) != null || !L || L.length === 0)
|
|
2246
2249
|
return;
|
|
2247
2250
|
if (e.has(L)) {
|
|
2248
2251
|
const p = e.get(L);
|
|
2249
|
-
u.setValue(
|
|
2252
|
+
u.setValue(f, c, { xf: p });
|
|
2250
2253
|
return;
|
|
2251
2254
|
}
|
|
2252
2255
|
const E = this._lexerTreeBuilder.getNewFormulaWithPrefix(L, this._functionService.hasExecutor.bind(this._functionService));
|
|
2253
|
-
E && (u.setValue(
|
|
2254
|
-
}), this._commandService.executeCommand(
|
|
2256
|
+
E && (u.setValue(f, c, { xf: E }), e.set(L, E));
|
|
2257
|
+
}), this._commandService.executeCommand(j.id, {
|
|
2255
2258
|
unitId: n,
|
|
2256
2259
|
subUnitId: r,
|
|
2257
2260
|
cellValue: u.getMatrix()
|
|
@@ -2265,13 +2268,13 @@ let at = class extends ee {
|
|
|
2265
2268
|
_writeArrayFormulaToSnapshot(a, e, n) {
|
|
2266
2269
|
a && Object.entries(a).forEach(([i, r]) => {
|
|
2267
2270
|
r && Array.from(Object.entries(r)).forEach(([o, u]) => {
|
|
2268
|
-
const
|
|
2271
|
+
const m = new V();
|
|
2269
2272
|
new V(u).forValue((c, l, L) => {
|
|
2270
|
-
|
|
2271
|
-
}), this._commandService.executeCommand(
|
|
2273
|
+
m.setValue(c, l, { ref: Se(L) });
|
|
2274
|
+
}), this._commandService.executeCommand(j.id, {
|
|
2272
2275
|
unitId: i,
|
|
2273
2276
|
subUnitId: o,
|
|
2274
|
-
cellValue:
|
|
2277
|
+
cellValue: m.getMatrix()
|
|
2275
2278
|
}, {
|
|
2276
2279
|
onlyLocal: !0,
|
|
2277
2280
|
fromFormula: !0
|
|
@@ -2279,10 +2282,10 @@ let at = class extends ee {
|
|
|
2279
2282
|
});
|
|
2280
2283
|
}), n && Object.entries(n).forEach(([i, r]) => {
|
|
2281
2284
|
r && Array.from(Object.entries(r)).forEach(([o, u]) => {
|
|
2282
|
-
const
|
|
2285
|
+
const m = new V();
|
|
2283
2286
|
new V(u).forValue((c, l) => {
|
|
2284
2287
|
var E, p, S;
|
|
2285
|
-
(S = (p = (E = a == null ? void 0 : a[i]) == null ? void 0 : E[o]) == null ? void 0 : p[c]) != null && S[l] ||
|
|
2288
|
+
(S = (p = (E = a == null ? void 0 : a[i]) == null ? void 0 : E[o]) == null ? void 0 : p[c]) != null && S[l] || m.setValue(c, l, {
|
|
2286
2289
|
ref: Se({
|
|
2287
2290
|
startRow: c,
|
|
2288
2291
|
endRow: c,
|
|
@@ -2290,10 +2293,10 @@ let at = class extends ee {
|
|
|
2290
2293
|
endColumn: l
|
|
2291
2294
|
})
|
|
2292
2295
|
});
|
|
2293
|
-
}), this._commandService.executeCommand(
|
|
2296
|
+
}), this._commandService.executeCommand(j.id, {
|
|
2294
2297
|
unitId: i,
|
|
2295
2298
|
subUnitId: o,
|
|
2296
|
-
cellValue:
|
|
2299
|
+
cellValue: m.getMatrix()
|
|
2297
2300
|
}, {
|
|
2298
2301
|
onlyLocal: !0,
|
|
2299
2302
|
fromFormula: !0
|
|
@@ -2301,7 +2304,7 @@ let at = class extends ee {
|
|
|
2301
2304
|
});
|
|
2302
2305
|
}), e && Object.entries(e).forEach(([i, r]) => {
|
|
2303
2306
|
r && Array.from(Object.entries(r)).forEach(([o, u]) => {
|
|
2304
|
-
this._commandService.executeCommand(
|
|
2307
|
+
this._commandService.executeCommand(j.id, {
|
|
2305
2308
|
unitId: i,
|
|
2306
2309
|
subUnitId: o,
|
|
2307
2310
|
cellValue: u
|
|
@@ -2320,7 +2323,7 @@ let at = class extends ee {
|
|
|
2320
2323
|
handler: (a, e, n) => {
|
|
2321
2324
|
var l, L, E;
|
|
2322
2325
|
let i = a;
|
|
2323
|
-
const { unitId: r, subUnitId: o, row: u, col:
|
|
2326
|
+
const { unitId: r, subUnitId: o, row: u, col: m } = e, f = this._formulaDataModel.getArrayFormulaCellData(), c = (E = (L = (l = f == null ? void 0 : f[r]) == null ? void 0 : l[o]) == null ? void 0 : L[u]) == null ? void 0 : E[m];
|
|
2324
2327
|
return c == null ? n(i) : ((!i || i === e.rawData) && (i = { ...e.rawData }), c.v == null && c.t == null ? (i.v = 0, i.t = xt.NUMBER, n(i)) : (i == null ? void 0 : i.t) === xt.NUMBER && i.v !== void 0 && i.v !== null && rn(i.v) ? (i.v = vn(Number(i.v)), n(i)) : (i.v = c.v, i.t = c.t, n(i)));
|
|
2325
2328
|
}
|
|
2326
2329
|
})
|
|
@@ -3599,7 +3602,7 @@ const Er = [
|
|
|
3599
3602
|
}
|
|
3600
3603
|
], Rr = [
|
|
3601
3604
|
{
|
|
3602
|
-
functionName:
|
|
3605
|
+
functionName: $.DAVERAGE,
|
|
3603
3606
|
functionType: t.Database,
|
|
3604
3607
|
description: "formula.functionList.DAVERAGE.description",
|
|
3605
3608
|
abstract: "formula.functionList.DAVERAGE.abstract",
|
|
@@ -3628,7 +3631,7 @@ const Er = [
|
|
|
3628
3631
|
]
|
|
3629
3632
|
},
|
|
3630
3633
|
{
|
|
3631
|
-
functionName:
|
|
3634
|
+
functionName: $.DCOUNT,
|
|
3632
3635
|
functionType: t.Database,
|
|
3633
3636
|
description: "formula.functionList.DCOUNT.description",
|
|
3634
3637
|
abstract: "formula.functionList.DCOUNT.abstract",
|
|
@@ -3657,7 +3660,7 @@ const Er = [
|
|
|
3657
3660
|
]
|
|
3658
3661
|
},
|
|
3659
3662
|
{
|
|
3660
|
-
functionName:
|
|
3663
|
+
functionName: $.DCOUNTA,
|
|
3661
3664
|
functionType: t.Database,
|
|
3662
3665
|
description: "formula.functionList.DCOUNTA.description",
|
|
3663
3666
|
abstract: "formula.functionList.DCOUNTA.abstract",
|
|
@@ -3686,7 +3689,7 @@ const Er = [
|
|
|
3686
3689
|
]
|
|
3687
3690
|
},
|
|
3688
3691
|
{
|
|
3689
|
-
functionName:
|
|
3692
|
+
functionName: $.DGET,
|
|
3690
3693
|
functionType: t.Database,
|
|
3691
3694
|
description: "formula.functionList.DGET.description",
|
|
3692
3695
|
abstract: "formula.functionList.DGET.abstract",
|
|
@@ -3715,7 +3718,7 @@ const Er = [
|
|
|
3715
3718
|
]
|
|
3716
3719
|
},
|
|
3717
3720
|
{
|
|
3718
|
-
functionName:
|
|
3721
|
+
functionName: $.DMAX,
|
|
3719
3722
|
functionType: t.Database,
|
|
3720
3723
|
description: "formula.functionList.DMAX.description",
|
|
3721
3724
|
abstract: "formula.functionList.DMAX.abstract",
|
|
@@ -3744,7 +3747,7 @@ const Er = [
|
|
|
3744
3747
|
]
|
|
3745
3748
|
},
|
|
3746
3749
|
{
|
|
3747
|
-
functionName:
|
|
3750
|
+
functionName: $.DMIN,
|
|
3748
3751
|
functionType: t.Database,
|
|
3749
3752
|
description: "formula.functionList.DMIN.description",
|
|
3750
3753
|
abstract: "formula.functionList.DMIN.abstract",
|
|
@@ -3773,7 +3776,7 @@ const Er = [
|
|
|
3773
3776
|
]
|
|
3774
3777
|
},
|
|
3775
3778
|
{
|
|
3776
|
-
functionName:
|
|
3779
|
+
functionName: $.DPRODUCT,
|
|
3777
3780
|
functionType: t.Database,
|
|
3778
3781
|
description: "formula.functionList.DPRODUCT.description",
|
|
3779
3782
|
abstract: "formula.functionList.DPRODUCT.abstract",
|
|
@@ -3802,7 +3805,7 @@ const Er = [
|
|
|
3802
3805
|
]
|
|
3803
3806
|
},
|
|
3804
3807
|
{
|
|
3805
|
-
functionName:
|
|
3808
|
+
functionName: $.DSTDEV,
|
|
3806
3809
|
functionType: t.Database,
|
|
3807
3810
|
description: "formula.functionList.DSTDEV.description",
|
|
3808
3811
|
abstract: "formula.functionList.DSTDEV.abstract",
|
|
@@ -3831,7 +3834,7 @@ const Er = [
|
|
|
3831
3834
|
]
|
|
3832
3835
|
},
|
|
3833
3836
|
{
|
|
3834
|
-
functionName:
|
|
3837
|
+
functionName: $.DSTDEVP,
|
|
3835
3838
|
functionType: t.Database,
|
|
3836
3839
|
description: "formula.functionList.DSTDEVP.description",
|
|
3837
3840
|
abstract: "formula.functionList.DSTDEVP.abstract",
|
|
@@ -3860,7 +3863,7 @@ const Er = [
|
|
|
3860
3863
|
]
|
|
3861
3864
|
},
|
|
3862
3865
|
{
|
|
3863
|
-
functionName:
|
|
3866
|
+
functionName: $.DSUM,
|
|
3864
3867
|
functionType: t.Database,
|
|
3865
3868
|
description: "formula.functionList.DSUM.description",
|
|
3866
3869
|
abstract: "formula.functionList.DSUM.abstract",
|
|
@@ -3889,7 +3892,7 @@ const Er = [
|
|
|
3889
3892
|
]
|
|
3890
3893
|
},
|
|
3891
3894
|
{
|
|
3892
|
-
functionName:
|
|
3895
|
+
functionName: $.DVAR,
|
|
3893
3896
|
functionType: t.Database,
|
|
3894
3897
|
description: "formula.functionList.DVAR.description",
|
|
3895
3898
|
abstract: "formula.functionList.DVAR.abstract",
|
|
@@ -3918,7 +3921,7 @@ const Er = [
|
|
|
3918
3921
|
]
|
|
3919
3922
|
},
|
|
3920
3923
|
{
|
|
3921
|
-
functionName:
|
|
3924
|
+
functionName: $.DVARP,
|
|
3922
3925
|
functionType: t.Database,
|
|
3923
3926
|
description: "formula.functionList.DVARP.description",
|
|
3924
3927
|
abstract: "formula.functionList.DVARP.abstract",
|
|
@@ -15703,15 +15706,15 @@ let Bt = class {
|
|
|
15703
15706
|
getSearchListByName(a) {
|
|
15704
15707
|
const e = [], n = this._functionService.getDescriptions(), i = a.toLocaleUpperCase().trim();
|
|
15705
15708
|
return n.forEach((r) => {
|
|
15706
|
-
const { functionName: o, abstract: u, functionType:
|
|
15707
|
-
o.toLocaleUpperCase().indexOf(i) > -1 &&
|
|
15709
|
+
const { functionName: o, abstract: u, functionType: m } = r;
|
|
15710
|
+
o.toLocaleUpperCase().indexOf(i) > -1 && m !== t.DefinedName && e.push({ name: o, desc: u });
|
|
15708
15711
|
}), e;
|
|
15709
15712
|
}
|
|
15710
15713
|
getSearchListByNameFirstLetter(a) {
|
|
15711
15714
|
const e = [], n = this._functionService.getDescriptions(), i = a.toLocaleUpperCase().trim();
|
|
15712
15715
|
return n.forEach((r) => {
|
|
15713
|
-
const { functionName: o, abstract: u, functionType:
|
|
15714
|
-
o.toLocaleUpperCase().indexOf(i) === 0 && e.push({ name: o, desc: u, functionType:
|
|
15716
|
+
const { functionName: o, abstract: u, functionType: m } = r;
|
|
15717
|
+
o.toLocaleUpperCase().indexOf(i) === 0 && e.push({ name: o, desc: u, functionType: m });
|
|
15715
15718
|
}), e;
|
|
15716
15719
|
}
|
|
15717
15720
|
getSearchListByType(a) {
|
|
@@ -15815,8 +15818,8 @@ let nt = class extends ee {
|
|
|
15815
15818
|
}
|
|
15816
15819
|
_changeUnitListener() {
|
|
15817
15820
|
J(
|
|
15818
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
15819
|
-
this._unRegisterDescriptions(), this._registerDescriptions();
|
|
15821
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(k.UNIVER_SHEET).subscribe((e) => {
|
|
15822
|
+
this._unRegisterDescriptions(), e && this._registerDescriptions();
|
|
15820
15823
|
})
|
|
15821
15824
|
);
|
|
15822
15825
|
}
|
|
@@ -15838,11 +15841,10 @@ let nt = class extends ee {
|
|
|
15838
15841
|
);
|
|
15839
15842
|
}
|
|
15840
15843
|
_registerDescription(e) {
|
|
15841
|
-
const
|
|
15842
|
-
if (n
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
!this._descriptionService.hasDescription(r) && (f == null || f === Nt || f === i) && this._descriptionService.registerDescriptions([{
|
|
15844
|
+
const n = this._getUnitIdAndSheetId(e);
|
|
15845
|
+
if (!n) return;
|
|
15846
|
+
const { sheetId: i } = n, { name: r, comment: o, formulaOrRefString: u, localSheetId: m } = e;
|
|
15847
|
+
!this._descriptionService.hasDescription(r) && (m == null || m === Nt || m === i) && this._descriptionService.registerDescriptions([{
|
|
15846
15848
|
functionName: r,
|
|
15847
15849
|
description: u + (o || ""),
|
|
15848
15850
|
abstract: u,
|
|
@@ -15866,47 +15868,44 @@ let nt = class extends ee {
|
|
|
15866
15868
|
n.push(r);
|
|
15867
15869
|
}), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
|
|
15868
15870
|
}
|
|
15869
|
-
_getUnitIdAndSheetId() {
|
|
15870
|
-
const e = this._univerInstanceService.
|
|
15871
|
-
if (
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
};
|
|
15871
|
+
_getUnitIdAndSheetId(e = {}) {
|
|
15872
|
+
const { unitId: n, subUnitId: i } = e, r = n ? this._univerInstanceService.getUnit(n, k.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(k.UNIVER_SHEET);
|
|
15873
|
+
if (!r) return null;
|
|
15874
|
+
const o = i ? r.getSheetBySheetId(i) : r.getActiveSheet(!0);
|
|
15875
|
+
return o ? {
|
|
15876
|
+
unitId: r.getUnitId(),
|
|
15877
|
+
sheetId: o.getSheetId()
|
|
15878
|
+
} : null;
|
|
15878
15879
|
}
|
|
15879
15880
|
_registerDescriptions() {
|
|
15880
|
-
const
|
|
15881
|
-
if (e
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
if (!i)
|
|
15881
|
+
const e = this._getUnitIdAndSheetId();
|
|
15882
|
+
if (!e) return;
|
|
15883
|
+
const { unitId: n, sheetId: i } = e, r = this._definedNamesService.getDefinedNameMap(n);
|
|
15884
|
+
if (!r)
|
|
15885
15885
|
return;
|
|
15886
|
-
const
|
|
15887
|
-
this._preUnitId =
|
|
15888
|
-
const { name:
|
|
15889
|
-
!this._descriptionService.hasDescription(
|
|
15890
|
-
functionName:
|
|
15891
|
-
description:
|
|
15892
|
-
abstract:
|
|
15886
|
+
const o = [];
|
|
15887
|
+
this._preUnitId = n, Array.from(Object.values(r)).forEach((u) => {
|
|
15888
|
+
const { name: m, comment: f, formulaOrRefString: c, localSheetId: l } = u;
|
|
15889
|
+
!this._descriptionService.hasDescription(m) && (l == null || l === Nt || l === i) && o.push({
|
|
15890
|
+
functionName: m,
|
|
15891
|
+
description: c + (f || ""),
|
|
15892
|
+
abstract: c,
|
|
15893
15893
|
functionType: t.DefinedName,
|
|
15894
15894
|
functionParameter: []
|
|
15895
15895
|
});
|
|
15896
|
-
}), this._descriptionService.registerDescriptions(
|
|
15896
|
+
}), this._descriptionService.registerDescriptions(o);
|
|
15897
15897
|
}
|
|
15898
15898
|
_unregisterDescriptionsForNotInSheetId() {
|
|
15899
|
-
const
|
|
15900
|
-
if (e
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
if (!i)
|
|
15899
|
+
const e = this._getUnitIdAndSheetId();
|
|
15900
|
+
if (!e) return;
|
|
15901
|
+
const { unitId: n, sheetId: i } = e, r = this._definedNamesService.getDefinedNameMap(n);
|
|
15902
|
+
if (!r)
|
|
15904
15903
|
return;
|
|
15905
|
-
const
|
|
15906
|
-
Array.from(Object.values(
|
|
15907
|
-
const { name:
|
|
15908
|
-
f !== Nt && f !==
|
|
15909
|
-
}), this._descriptionService.unregisterDescriptions(
|
|
15904
|
+
const o = [];
|
|
15905
|
+
Array.from(Object.values(r)).forEach((u) => {
|
|
15906
|
+
const { name: m, localSheetId: f } = u;
|
|
15907
|
+
f !== Nt && f !== i && o.push(m);
|
|
15908
|
+
}), this._descriptionService.unregisterDescriptions(o);
|
|
15910
15909
|
}
|
|
15911
15910
|
};
|
|
15912
15911
|
nt = vr([
|
|
@@ -15955,8 +15954,8 @@ let rt = class extends ee {
|
|
|
15955
15954
|
}
|
|
15956
15955
|
_changeUnitListener() {
|
|
15957
15956
|
J(
|
|
15958
|
-
this._univerInstanceService.getCurrentTypeOfUnit$(
|
|
15959
|
-
this._unRegisterDescriptions(), this._registerDescriptions();
|
|
15957
|
+
this._univerInstanceService.getCurrentTypeOfUnit$(k.UNIVER_SHEET).subscribe((e) => {
|
|
15958
|
+
this._unRegisterDescriptions(), e && this._registerDescriptions();
|
|
15960
15959
|
})
|
|
15961
15960
|
);
|
|
15962
15961
|
}
|
|
@@ -15978,13 +15977,12 @@ let rt = class extends ee {
|
|
|
15978
15977
|
);
|
|
15979
15978
|
}
|
|
15980
15979
|
_registerDescription(e) {
|
|
15981
|
-
var u,
|
|
15982
|
-
const
|
|
15983
|
-
if (n
|
|
15984
|
-
|
|
15985
|
-
const { tableName: r, reference: o } = e;
|
|
15980
|
+
var u, m;
|
|
15981
|
+
const n = this._getUnitIdAndSheetId(e);
|
|
15982
|
+
if (!n) return;
|
|
15983
|
+
const { unitId: i } = n, { tableName: r, reference: o } = e;
|
|
15986
15984
|
if (!this._descriptionService.hasDescription(r)) {
|
|
15987
|
-
const
|
|
15985
|
+
const f = ((m = (u = this._univerInstanceService.getUnit(i)) == null ? void 0 : u.getSheetBySheetId(o.sheetId)) == null ? void 0 : m.getName()) || "", c = ze(f, o.range);
|
|
15988
15986
|
this._descriptionService.registerDescriptions([{
|
|
15989
15987
|
functionName: r,
|
|
15990
15988
|
description: c,
|
|
@@ -16009,41 +16007,38 @@ let rt = class extends ee {
|
|
|
16009
16007
|
n.push(r);
|
|
16010
16008
|
}), this._descriptionService.unregisterDescriptions(n), this._preUnitId = null;
|
|
16011
16009
|
}
|
|
16012
|
-
_getUnitIdAndSheetId() {
|
|
16013
|
-
const e = this._univerInstanceService.
|
|
16014
|
-
if (
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
};
|
|
16010
|
+
_getUnitIdAndSheetId(e = {}) {
|
|
16011
|
+
const { unitId: n, subUnitId: i } = e, r = n ? this._univerInstanceService.getUnit(n, k.UNIVER_SHEET) : this._univerInstanceService.getCurrentUnitOfType(k.UNIVER_SHEET);
|
|
16012
|
+
if (!r) return null;
|
|
16013
|
+
const o = i ? r.getSheetBySheetId(i) : r.getActiveSheet(!0);
|
|
16014
|
+
return o ? {
|
|
16015
|
+
unitId: r.getUnitId(),
|
|
16016
|
+
sheetId: o.getSheetId()
|
|
16017
|
+
} : null;
|
|
16021
16018
|
}
|
|
16022
16019
|
_registerDescriptions() {
|
|
16023
|
-
const
|
|
16024
|
-
if (e
|
|
16025
|
-
|
|
16026
|
-
const i = this._superTableService.getTableMap(e);
|
|
16020
|
+
const e = this._getUnitIdAndSheetId();
|
|
16021
|
+
if (!e) return;
|
|
16022
|
+
const { unitId: n } = e, i = this._superTableService.getTableMap(n);
|
|
16027
16023
|
if (!i)
|
|
16028
16024
|
return;
|
|
16029
16025
|
const r = [];
|
|
16030
|
-
this._preUnitId =
|
|
16026
|
+
this._preUnitId = n, i.forEach((o, u) => {
|
|
16031
16027
|
var c, l;
|
|
16032
|
-
const
|
|
16028
|
+
const m = ((l = (c = this._univerInstanceService.getUnit(n)) == null ? void 0 : c.getSheetBySheetId(o.sheetId)) == null ? void 0 : l.getName()) || "", f = ze(m, o.range);
|
|
16033
16029
|
this._descriptionService.hasDescription(u) || r.push({
|
|
16034
16030
|
functionName: u,
|
|
16035
|
-
description:
|
|
16036
|
-
abstract:
|
|
16031
|
+
description: f,
|
|
16032
|
+
abstract: f,
|
|
16037
16033
|
functionType: t.Table,
|
|
16038
16034
|
functionParameter: []
|
|
16039
16035
|
});
|
|
16040
16036
|
}), this._descriptionService.registerDescriptions(r);
|
|
16041
16037
|
}
|
|
16042
16038
|
_unregisterDescriptionsForNotInSheetId() {
|
|
16043
|
-
const
|
|
16044
|
-
if (e
|
|
16045
|
-
|
|
16046
|
-
const i = this._superTableService.getTableMap(e);
|
|
16039
|
+
const e = this._getUnitIdAndSheetId();
|
|
16040
|
+
if (!e) return;
|
|
16041
|
+
const { unitId: n } = e, i = this._superTableService.getTableMap(n);
|
|
16047
16042
|
if (!i)
|
|
16048
16043
|
return;
|
|
16049
16044
|
const r = [];
|
|
@@ -16068,11 +16063,11 @@ function fa(a, e, n, i) {
|
|
|
16068
16063
|
if (r == null)
|
|
16069
16064
|
return e;
|
|
16070
16065
|
const o = [];
|
|
16071
|
-
for (let u = 0,
|
|
16072
|
-
const
|
|
16073
|
-
if (typeof
|
|
16066
|
+
for (let u = 0, m = r.length; u < m; u++) {
|
|
16067
|
+
const f = r[u];
|
|
16068
|
+
if (typeof f == "string" || f.nodeType !== ie.REFERENCE)
|
|
16074
16069
|
continue;
|
|
16075
|
-
const { token: c } =
|
|
16070
|
+
const { token: c } = f, l = Pe(c), { sheetName: L, unitId: E } = l;
|
|
16076
16071
|
let p = l.range;
|
|
16077
16072
|
p.startAbsoluteRefType === Qe.ALL && p.endAbsoluteRefType === Qe.ALL || (p = yt(p, n, i), o.push({
|
|
16078
16073
|
unitId: E,
|
|
@@ -16087,13 +16082,13 @@ let vt = class extends ee {
|
|
|
16087
16082
|
super(), this._refRangeService = a, this._lexerTreeBuilder = e, this._univerInstanceService = n, this._injector = i;
|
|
16088
16083
|
}
|
|
16089
16084
|
transformFormulaByEffectCommand(a, e, n, i) {
|
|
16090
|
-
const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(
|
|
16085
|
+
const r = this._lexerTreeBuilder.sequenceNodesBuilder(n), o = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET), u = o.getActiveSheet(), m = o.getUnitId(), f = u.getSheetId(), c = r == null ? void 0 : r.map((l) => {
|
|
16091
16086
|
if (typeof l == "object" && l.nodeType === ie.REFERENCE) {
|
|
16092
16087
|
const L = Pe(l.token), { range: E, unitId: p, sheetName: S } = L, A = this._univerInstanceService.getUnit(p || a), I = S ? A == null ? void 0 : A.getSheetBySheetName(S) : A == null ? void 0 : A.getSheetBySheetId(e);
|
|
16093
16088
|
if (!I)
|
|
16094
16089
|
throw new Error("Sheet not found");
|
|
16095
16090
|
const d = A.getUnitId(), R = I.getSheetId();
|
|
16096
|
-
if (d !==
|
|
16091
|
+
if (d !== m || R !== f)
|
|
16097
16092
|
return l;
|
|
16098
16093
|
const N = ta(E, i);
|
|
16099
16094
|
let P = "";
|
|
@@ -16101,7 +16096,7 @@ let vt = class extends ee {
|
|
|
16101
16096
|
const q = N.startColumn - E.startColumn, M = N.startRow - E.startRow, U = yt(E, q, M);
|
|
16102
16097
|
p && S ? P = ra(p, S, U) : S ? P = ze(S, U) : P = Se(U);
|
|
16103
16098
|
} else
|
|
16104
|
-
P =
|
|
16099
|
+
P = Q.REF;
|
|
16105
16100
|
return {
|
|
16106
16101
|
...l,
|
|
16107
16102
|
token: P
|
|
@@ -16112,19 +16107,19 @@ let vt = class extends ee {
|
|
|
16112
16107
|
return c ? `=${$e(c)}` : "";
|
|
16113
16108
|
}
|
|
16114
16109
|
registerFormula(a, e, n, i) {
|
|
16115
|
-
const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new ke(),
|
|
16116
|
-
const c = this._univerInstanceService.getCurrentUnitForType(
|
|
16110
|
+
const r = /* @__PURE__ */ new Map(), o = this._lexerTreeBuilder.sequenceNodesBuilder(n), u = new ke(), m = (f) => {
|
|
16111
|
+
const c = this._univerInstanceService.getCurrentUnitForType(k.UNIVER_SHEET), l = c.getActiveSheet(), L = c.getUnitId(), E = l.getSheetId(), p = o == null ? void 0 : o.map((A) => {
|
|
16117
16112
|
if (typeof A == "object" && A.nodeType === ie.REFERENCE) {
|
|
16118
16113
|
const I = r.get(A.token);
|
|
16119
16114
|
if (I.unitId !== L || I.subUnitId !== E)
|
|
16120
16115
|
return A;
|
|
16121
|
-
const d = ta(I.range,
|
|
16116
|
+
const d = ta(I.range, f);
|
|
16122
16117
|
let R = "";
|
|
16123
16118
|
if (d) {
|
|
16124
16119
|
const N = d.startColumn - I.range.startColumn, P = d.startRow - I.range.startRow, q = yt(I.range, N, P);
|
|
16125
16120
|
I.unitId && I.sheetName ? R = ra(I.unitId, I.sheetName, q) : I.sheetName ? R = ze(I.sheetName, q) : R = Se(q);
|
|
16126
16121
|
} else
|
|
16127
|
-
R =
|
|
16122
|
+
R = Q.REF;
|
|
16128
16123
|
return {
|
|
16129
16124
|
...A,
|
|
16130
16125
|
token: R
|
|
@@ -16134,9 +16129,9 @@ let vt = class extends ee {
|
|
|
16134
16129
|
}), S = p && $e(p);
|
|
16135
16130
|
return i(`=${S}`);
|
|
16136
16131
|
};
|
|
16137
|
-
return o == null || o.forEach((
|
|
16138
|
-
if (typeof
|
|
16139
|
-
const c = Pe(
|
|
16132
|
+
return o == null || o.forEach((f) => {
|
|
16133
|
+
if (typeof f == "object" && f.nodeType === ie.REFERENCE) {
|
|
16134
|
+
const c = Pe(f.token), { range: l, unitId: L, sheetName: E } = c, p = this._univerInstanceService.getUnit(L || a), S = E ? p == null ? void 0 : p.getSheetBySheetName(E) : p == null ? void 0 : p.getSheetBySheetId(e);
|
|
16140
16135
|
if (!S)
|
|
16141
16136
|
return;
|
|
16142
16137
|
const A = p.getUnitId(), I = S.getSheetId(), d = {
|
|
@@ -16145,7 +16140,7 @@ let vt = class extends ee {
|
|
|
16145
16140
|
range: l,
|
|
16146
16141
|
sheetName: E
|
|
16147
16142
|
};
|
|
16148
|
-
r.set(
|
|
16143
|
+
r.set(f.token, d), u.add(this._refRangeService.registerRefRange(l, m, A, I));
|
|
16149
16144
|
}
|
|
16150
16145
|
}), u;
|
|
16151
16146
|
}
|
|
@@ -16153,13 +16148,13 @@ let vt = class extends ee {
|
|
|
16153
16148
|
const r = Me(n) ? this._lexerTreeBuilder.sequenceNodesBuilder(n) : null, o = [];
|
|
16154
16149
|
return r == null || r.forEach((u) => {
|
|
16155
16150
|
if (typeof u == "object" && u.nodeType === ie.REFERENCE) {
|
|
16156
|
-
const
|
|
16157
|
-
if (
|
|
16151
|
+
const m = Pe(u.token), { range: f, unitId: c, sheetName: l } = m;
|
|
16152
|
+
if (f.startAbsoluteRefType === Qe.ALL && f.endAbsoluteRefType === Qe.ALL)
|
|
16158
16153
|
return;
|
|
16159
16154
|
const L = this._univerInstanceService.getUnit(c || a), E = l ? L == null ? void 0 : L.getSheetBySheetName(l) : L == null ? void 0 : L.getSheetBySheetId(e);
|
|
16160
16155
|
if (!E)
|
|
16161
16156
|
return;
|
|
16162
|
-
const p = L.getUnitId(), S = E.getSheetId(), A = i[0].startRow, I = i[0].startColumn, d =
|
|
16157
|
+
const p = L.getUnitId(), S = E.getSheetId(), A = i[0].startRow, I = i[0].startColumn, d = f.startRow, R = f.startColumn, N = i.map((P) => ({
|
|
16163
16158
|
startRow: P.startRow - A + d,
|
|
16164
16159
|
endRow: P.endRow - A + d,
|
|
16165
16160
|
startColumn: P.startColumn - I + R,
|
|
@@ -16175,8 +16170,8 @@ let vt = class extends ee {
|
|
|
16175
16170
|
}
|
|
16176
16171
|
// eslint-disable-next-line max-lines-per-function
|
|
16177
16172
|
registerRangeFormula(a, e, n, i, r) {
|
|
16178
|
-
const o = new ke(), u = i.map((
|
|
16179
|
-
const c = n[0].startRow, l = n[0].startColumn, L = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Mn(this._injector,
|
|
16173
|
+
const o = new ke(), u = i.map((f) => this._getFormulaDependcy(a, e, f, n)), m = (f) => {
|
|
16174
|
+
const c = n[0].startRow, l = n[0].startColumn, L = [{ unitId: a, subUnitId: e, ranges: n }, ...u.flat()], E = [], p = Mn(this._injector, f);
|
|
16180
16175
|
for (const { unitId: S, subUnitId: A, ranges: I } of L)
|
|
16181
16176
|
if (S === p.unitId && A === p.subUnitId) {
|
|
16182
16177
|
const d = [], R = I[0].startRow, N = I[0].startColumn, P = R - c, q = N - l;
|
|
@@ -16198,12 +16193,12 @@ let vt = class extends ee {
|
|
|
16198
16193
|
A.sort((P, q) => P.startRow - q.startRow || P.startColumn - q.startColumn);
|
|
16199
16194
|
const I = /* @__PURE__ */ new Map();
|
|
16200
16195
|
for (let P = 0; P < S.length; P++) {
|
|
16201
|
-
const q = S[P], M = q.startRow, U = q.startColumn, h = M - c, x = U - l, F = xn(q,
|
|
16196
|
+
const q = S[P], M = q.startRow, U = q.startColumn, h = M - c, x = U - l, F = xn(q, f).sort((z, re) => z.startRow - re.startRow || z.startColumn - re.startColumn);
|
|
16202
16197
|
if (!F.length)
|
|
16203
16198
|
continue;
|
|
16204
16199
|
const B = F[0].startRow, ae = F[0].startColumn, O = B - c, ce = ae - l, ne = [];
|
|
16205
16200
|
for (let z = 0; z < i.length; z++) {
|
|
16206
|
-
const re = i[z], oe = Me(re), qe = oe ? this._lexerTreeBuilder.moveFormulaRefOffset(re, x, h) : re, Z = oe ? this.transformFormulaByEffectCommand(a, e, qe,
|
|
16201
|
+
const re = i[z], oe = Me(re), qe = oe ? this._lexerTreeBuilder.moveFormulaRefOffset(re, x, h) : re, Z = oe ? this.transformFormulaByEffectCommand(a, e, qe, f) : qe, Et = fa(this._lexerTreeBuilder, Z, -ce, -O);
|
|
16207
16202
|
ne.push({
|
|
16208
16203
|
newFormula: Z,
|
|
16209
16204
|
orginFormula: Et
|
|
@@ -16251,12 +16246,12 @@ let vt = class extends ee {
|
|
|
16251
16246
|
redos: []
|
|
16252
16247
|
};
|
|
16253
16248
|
};
|
|
16254
|
-
return n.forEach((
|
|
16255
|
-
const c = this._refRangeService.registerRefRange(
|
|
16249
|
+
return n.forEach((f) => {
|
|
16250
|
+
const c = this._refRangeService.registerRefRange(f, m, a, e);
|
|
16256
16251
|
o.add(c);
|
|
16257
|
-
}), [...u.flat()].forEach(({ unitId:
|
|
16252
|
+
}), [...u.flat()].forEach(({ unitId: f, subUnitId: c, ranges: l }) => {
|
|
16258
16253
|
l.forEach((L) => {
|
|
16259
|
-
const E = this._refRangeService.registerRefRange(L,
|
|
16254
|
+
const E = this._refRangeService.registerRefRange(L, m, f, c);
|
|
16260
16255
|
o.add(E);
|
|
16261
16256
|
});
|
|
16262
16257
|
}), o;
|
|
@@ -16326,11 +16321,11 @@ let Vt = class extends ee {
|
|
|
16326
16321
|
if (n)
|
|
16327
16322
|
r.add(this._descriptionService.registerDescriptions(n));
|
|
16328
16323
|
else {
|
|
16329
|
-
const o = i.map(([u,
|
|
16330
|
-
functionName:
|
|
16324
|
+
const o = i.map(([u, m, f]) => ({
|
|
16325
|
+
functionName: m,
|
|
16331
16326
|
functionType: t.User,
|
|
16332
16327
|
description: "",
|
|
16333
|
-
abstract:
|
|
16328
|
+
abstract: f || "",
|
|
16334
16329
|
functionParameter: []
|
|
16335
16330
|
}));
|
|
16336
16331
|
r.add(this._functionService.registerDescriptions(...o));
|
|
@@ -16340,18 +16335,18 @@ let Vt = class extends ee {
|
|
|
16340
16335
|
_registerSingleFunction(a) {
|
|
16341
16336
|
const { name: e, func: n, description: i, locales: r, async: o = !1 } = a, u = new ke();
|
|
16342
16337
|
if (r && this._localeService.load(r), typeof i == "string") {
|
|
16343
|
-
const
|
|
16338
|
+
const f = {
|
|
16344
16339
|
functionName: e,
|
|
16345
16340
|
functionType: t.User,
|
|
16346
16341
|
description: i,
|
|
16347
16342
|
abstract: i || "",
|
|
16348
16343
|
functionParameter: []
|
|
16349
16344
|
};
|
|
16350
|
-
u.add(this._descriptionService.registerDescriptions([
|
|
16345
|
+
u.add(this._descriptionService.registerDescriptions([f]));
|
|
16351
16346
|
} else
|
|
16352
16347
|
u.add(this._descriptionService.registerDescriptions([i]));
|
|
16353
|
-
const
|
|
16354
|
-
return
|
|
16348
|
+
const m = o ? new Fa(e) : new Ft(e);
|
|
16349
|
+
return m.calculateCustom = n, this._functionService.registerExecutors(m), u.add(J(() => this._functionService.unregisterExecutors(e))), u.add(J(() => this._functionService.unregisterDescriptions(e))), u.add(J(() => this._functionService.deleteFormulaAstCacheKey(e))), this._remoteRegisterFunctionService && (this._remoteRegisterFunctionService.registerAsyncFunctions([[n.toString(), e]]), u.add(
|
|
16355
16350
|
J(() => this._remoteRegisterFunctionService.unregisterFunctions([e]))
|
|
16356
16351
|
)), u;
|
|
16357
16352
|
}
|
|
@@ -16396,7 +16391,7 @@ let mt = class extends La {
|
|
|
16396
16391
|
}
|
|
16397
16392
|
};
|
|
16398
16393
|
Tt(mt, "pluginName", "SHEET_FORMULA_REMOTE_PLUGIN");
|
|
16399
|
-
Tt(mt, "type",
|
|
16394
|
+
Tt(mt, "type", k.UNIVER_SHEET);
|
|
16400
16395
|
mt = Xa([
|
|
16401
16396
|
pa(oi),
|
|
16402
16397
|
ut(1, H(ct)),
|
|
@@ -16457,14 +16452,14 @@ let ft = class extends La {
|
|
|
16457
16452
|
}
|
|
16458
16453
|
};
|
|
16459
16454
|
Tt(ft, "pluginName", dr);
|
|
16460
|
-
Tt(ft, "type",
|
|
16455
|
+
Tt(ft, "type", k.UNIVER_SHEET);
|
|
16461
16456
|
ft = Xa([
|
|
16462
16457
|
pa(_n),
|
|
16463
16458
|
ut(1, H(ct)),
|
|
16464
16459
|
ut(2, Ce)
|
|
16465
16460
|
], ft);
|
|
16466
16461
|
function fo(a, e, n, i) {
|
|
16467
|
-
const r = a.get(ui), o = a.get(mi), u = a.get(fi),
|
|
16462
|
+
const r = a.get(ui), o = a.get(mi), u = a.get(fi), m = a.get(ci);
|
|
16468
16463
|
r.load({
|
|
16469
16464
|
formulaData: {},
|
|
16470
16465
|
arrayFormulaCellData: {},
|
|
@@ -16480,7 +16475,7 @@ function fo(a, e, n, i) {
|
|
|
16480
16475
|
},
|
|
16481
16476
|
dirtyUnitOtherFormulaMap: {}
|
|
16482
16477
|
});
|
|
16483
|
-
const
|
|
16478
|
+
const f = o.treeBuilder(e), c = u.parse(f), l = m.execute(li(c));
|
|
16484
16479
|
return si(l);
|
|
16485
16480
|
}
|
|
16486
16481
|
export {
|