@univerjs/sheets-formula 1.0.0-rc.0 → 1.0.0
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/facade.js +4 -2
- package/lib/cjs/index.js +153 -123
- package/lib/cjs/locale/ar-SA.js +0 -1
- package/lib/cjs/locale/ca-ES.js +0 -1
- package/lib/cjs/locale/de-DE.js +0 -1
- package/lib/cjs/locale/en-US.js +0 -1
- package/lib/cjs/locale/es-ES.js +0 -1
- package/lib/cjs/locale/fa-IR.js +0 -1
- package/lib/cjs/locale/fr-FR.js +0 -1
- package/lib/cjs/locale/id-ID.js +0 -1
- package/lib/cjs/locale/it-IT.js +0 -1
- package/lib/cjs/locale/ja-JP.js +0 -1
- package/lib/cjs/locale/ko-KR.js +0 -1
- package/lib/cjs/locale/pl-PL.js +0 -1
- package/lib/cjs/locale/pt-BR.js +0 -1
- package/lib/cjs/locale/ru-RU.js +0 -1
- package/lib/cjs/locale/sk-SK.js +0 -1
- package/lib/cjs/locale/vi-VN.js +0 -1
- package/lib/cjs/locale/zh-CN.js +0 -1
- package/lib/cjs/locale/zh-HK.js +0 -1
- package/lib/cjs/locale/zh-TW.js +0 -1
- package/lib/es/facade.js +4 -2
- package/lib/es/index.js +153 -123
- package/lib/facade.js +4 -2
- package/lib/index.js +153 -123
- package/lib/types/controllers/formula-calculation-session.controller.d.ts +24 -0
- package/lib/types/facade/f-univer.d.ts +49 -0
- package/lib/types/locale/function-list/array/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/array/en-US.d.ts +58 -0
- package/lib/types/locale/function-list/array/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/array/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/array/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/array/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/array/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/array/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/array/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/array/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/array/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/array/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/en-US.d.ts +838 -0
- package/lib/types/locale/function-list/compatibility/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/compatibility/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/cube/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/cube/en-US.d.ts +144 -0
- package/lib/types/locale/function-list/cube/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/cube/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/cube/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/cube/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/cube/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/cube/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/cube/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/cube/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/cube/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/cube/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/database/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/database/en-US.d.ts +282 -0
- package/lib/types/locale/function-list/database/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/database/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/database/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/database/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/database/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/database/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/database/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/database/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/database/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/database/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/date/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/date/en-US.d.ts +490 -0
- package/lib/types/locale/function-list/date/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/date/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/date/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/date/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/date/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/date/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/date/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/date/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/date/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/date/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/en-US.d.ts +940 -0
- package/lib/types/locale/function-list/engineering/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/engineering/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/financial/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/financial/en-US.d.ts +1608 -0
- package/lib/types/locale/function-list/financial/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/financial/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/financial/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/financial/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/financial/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/financial/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/financial/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/financial/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/financial/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/financial/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/information/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/information/en-US.d.ts +386 -0
- package/lib/types/locale/function-list/information/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/information/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/information/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/information/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/information/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/information/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/information/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/information/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/information/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/information/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/logical/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/logical/en-US.d.ts +390 -0
- package/lib/types/locale/function-list/logical/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/logical/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/logical/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/logical/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/logical/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/logical/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/logical/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/logical/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/logical/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/logical/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/en-US.d.ts +820 -0
- package/lib/types/locale/function-list/lookup/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/lookup/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/math/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/math/en-US.d.ts +1410 -0
- package/lib/types/locale/function-list/math/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/math/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/math/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/math/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/math/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/math/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/math/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/math/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/math/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/math/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/en-US.d.ts +2308 -0
- package/lib/types/locale/function-list/statistical/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/statistical/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/text/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/text/en-US.d.ts +988 -0
- package/lib/types/locale/function-list/text/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/text/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/text/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/text/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/text/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/text/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/text/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/text/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/text/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/text/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/univer/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/univer/en-US.d.ts +17 -0
- package/lib/types/locale/function-list/univer/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/univer/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/univer/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/univer/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/univer/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/univer/ru-RU.d.ts +17 -0
- package/lib/types/locale/function-list/univer/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/univer/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/univer/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/univer/zh-TW.d.ts +18 -0
- package/lib/types/locale/function-list/web/ca-ES.d.ts +18 -0
- package/lib/types/locale/function-list/web/en-US.d.ts +68 -0
- package/lib/types/locale/function-list/web/es-ES.d.ts +18 -0
- package/lib/types/locale/function-list/web/fa-IR.d.ts +18 -0
- package/lib/types/locale/function-list/web/fr-FR.d.ts +18 -0
- package/lib/types/locale/function-list/web/ja-JP.d.ts +18 -0
- package/lib/types/locale/function-list/web/ko-KR.d.ts +18 -0
- package/lib/types/locale/function-list/web/ru-RU.d.ts +18 -0
- package/lib/types/locale/function-list/web/sk-SK.d.ts +18 -0
- package/lib/types/locale/function-list/web/vi-VN.d.ts +18 -0
- package/lib/types/locale/function-list/web/zh-CN.d.ts +18 -0
- package/lib/types/locale/function-list/web/zh-TW.d.ts +18 -0
- package/lib/types/services/description.service.d.ts +93 -0
- package/lib/types/services/formula-calculation-session.service.d.ts +48 -0
- package/lib/types/services/function-list/array.d.ts +17 -0
- package/lib/types/services/function-list/compatibility.d.ts +17 -0
- package/lib/types/services/function-list/cube.d.ts +17 -0
- package/lib/types/services/function-list/database.d.ts +17 -0
- package/lib/types/services/function-list/date.d.ts +17 -0
- package/lib/types/services/function-list/engineering.d.ts +17 -0
- package/lib/types/services/function-list/financial.d.ts +17 -0
- package/lib/types/services/function-list/function-list.d.ts +17 -0
- package/lib/types/services/function-list/information.d.ts +17 -0
- package/lib/types/services/function-list/logical.d.ts +17 -0
- package/lib/types/services/function-list/lookup.d.ts +17 -0
- package/lib/types/services/function-list/math.d.ts +17 -0
- package/lib/types/services/function-list/statistical.d.ts +17 -0
- package/lib/types/services/function-list/text.d.ts +17 -0
- package/lib/types/services/function-list/univer.d.ts +17 -0
- package/lib/types/services/function-list/web.d.ts +17 -0
- package/lib/types/services/register-function.service.d.ts +117 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const PLUGIN_CONFIG_KEY_MOBILE = "sheets-formula.mobile.config";
|
|
|
69
69
|
const configSymbolMobile = Symbol(PLUGIN_CONFIG_KEY_MOBILE);
|
|
70
70
|
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region \0@oxc-project+runtime@0.
|
|
72
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
|
|
73
73
|
function __decorateParam(paramIndex, decorator) {
|
|
74
74
|
return function(target, key) {
|
|
75
75
|
decorator(target, key, paramIndex);
|
|
@@ -77,7 +77,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region \0@oxc-project+runtime@0.
|
|
80
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
|
|
81
81
|
function __decorate(decorators, target, key, desc) {
|
|
82
82
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
83
83
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -173,9 +173,7 @@ function directionToOffset(step, len, direction, location, sourceIndex) {
|
|
|
173
173
|
case Direction.DOWN:
|
|
174
174
|
offsetY = targetRows[sourceIndex] - sourceRows[sourceIndex];
|
|
175
175
|
break;
|
|
176
|
-
case Direction.LEFT:
|
|
177
|
-
offsetX = -step * len;
|
|
178
|
-
break;
|
|
176
|
+
case Direction.LEFT: offsetX = -step * len;
|
|
179
177
|
}
|
|
180
178
|
return {
|
|
181
179
|
offsetX,
|
|
@@ -191,7 +189,7 @@ function getDataLength(copyDataPiece) {
|
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
//#endregion
|
|
194
|
-
//#region \0@oxc-project+runtime@0.
|
|
192
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
195
193
|
function _typeof(o) {
|
|
196
194
|
"@babel/helpers - typeof";
|
|
197
195
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -202,7 +200,7 @@ function _typeof(o) {
|
|
|
202
200
|
}
|
|
203
201
|
|
|
204
202
|
//#endregion
|
|
205
|
-
//#region \0@oxc-project+runtime@0.
|
|
203
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
|
|
206
204
|
function toPrimitive(t, r) {
|
|
207
205
|
if ("object" != _typeof(t) || !t) return t;
|
|
208
206
|
var e = t[Symbol.toPrimitive];
|
|
@@ -215,14 +213,14 @@ function toPrimitive(t, r) {
|
|
|
215
213
|
}
|
|
216
214
|
|
|
217
215
|
//#endregion
|
|
218
|
-
//#region \0@oxc-project+runtime@0.
|
|
216
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
219
217
|
function toPropertyKey(t) {
|
|
220
218
|
var i = toPrimitive(t, "string");
|
|
221
219
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
222
220
|
}
|
|
223
221
|
|
|
224
222
|
//#endregion
|
|
225
|
-
//#region \0@oxc-project+runtime@0.
|
|
223
|
+
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
226
224
|
function _defineProperty(e, r, t) {
|
|
227
225
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
228
226
|
value: t,
|
|
@@ -261,10 +259,10 @@ let ImageFormulaCellInterceptorController = class ImageFormulaCellInterceptorCon
|
|
|
261
259
|
const updateRuntimeImageFormulaData = await Promise.all(imageFormulaData.map((imageFormulaInfo) => {
|
|
262
260
|
return this._getImageNatureSize(imageFormulaInfo);
|
|
263
261
|
}));
|
|
264
|
-
const unitImageFormulaData =
|
|
262
|
+
const unitImageFormulaData = Object.create(null);
|
|
265
263
|
updateRuntimeImageFormulaData.forEach((imageFormulaInfo) => {
|
|
266
264
|
const { unitId, sheetId, row, column, ...imageInfo } = imageFormulaInfo;
|
|
267
|
-
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] =
|
|
265
|
+
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] = Object.create(null);
|
|
268
266
|
if (!unitImageFormulaData[unitId][sheetId]) unitImageFormulaData[unitId][sheetId] = new ObjectMatrix();
|
|
269
267
|
unitImageFormulaData[unitId][sheetId].setValue(row, column, imageInfo);
|
|
270
268
|
});
|
|
@@ -511,9 +509,7 @@ let TriggerCalculationController = class TriggerCalculationController extends Di
|
|
|
511
509
|
result = "Formula calculation succeeded";
|
|
512
510
|
if (calculationProcessCount === 0 || calculationProcessCount === -1) result += `. Total time consumed: ${performance.now() - this._startExecutionTime} ms`;
|
|
513
511
|
break;
|
|
514
|
-
case FormulaExecutedStateType.INITIAL:
|
|
515
|
-
result = "Waiting for calculation";
|
|
516
|
-
break;
|
|
512
|
+
case FormulaExecutedStateType.INITIAL: result = "Waiting for calculation";
|
|
517
513
|
}
|
|
518
514
|
if (calculationProcessCount === 0 || calculationProcessCount === -1) {
|
|
519
515
|
if (startDependencyTimer) {
|
|
@@ -792,8 +788,8 @@ function getFormulaReferenceRange(oldFormulaData, newFormulaData, formulaReferen
|
|
|
792
788
|
* @returns
|
|
793
789
|
*/
|
|
794
790
|
function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMoveParam) {
|
|
795
|
-
const redoFormulaData =
|
|
796
|
-
const undoFormulaData =
|
|
791
|
+
const redoFormulaData = Object.create(null);
|
|
792
|
+
const undoFormulaData = Object.create(null);
|
|
797
793
|
const { unitId: fromUnitId, sheetId: fromSheetId } = formulaReferenceMoveParam;
|
|
798
794
|
const targetUnitId = formulaReferenceMoveParam.targetUnitId ?? fromUnitId;
|
|
799
795
|
const targetSheetId = formulaReferenceMoveParam.targetSheetId ?? fromSheetId;
|
|
@@ -811,8 +807,8 @@ function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMovePar
|
|
|
811
807
|
else rangeList = processFormulaChanges(oldFormulaMatrix, newFormulaMatrix, formulaReferenceMoveParam);
|
|
812
808
|
const sheetRedoFormulaData = getRedoFormulaData(rangeList, oldFormulaMatrix, newFormulaMatrix);
|
|
813
809
|
const sheetUndoFormulaData = getUndoFormulaData(rangeList, oldFormulaMatrix);
|
|
814
|
-
if (!redoFormulaData[unitId]) redoFormulaData[unitId] =
|
|
815
|
-
if (!undoFormulaData[unitId]) undoFormulaData[unitId] =
|
|
810
|
+
if (!redoFormulaData[unitId]) redoFormulaData[unitId] = Object.create(null);
|
|
811
|
+
if (!undoFormulaData[unitId]) undoFormulaData[unitId] = Object.create(null);
|
|
816
812
|
redoFormulaData[unitId][currentSheetId] = {
|
|
817
813
|
...redoFormulaData[unitId][currentSheetId],
|
|
818
814
|
...sheetRedoFormulaData
|
|
@@ -912,8 +908,6 @@ function handleInsertDelete(oldCell, formulaReferenceMoveParam) {
|
|
|
912
908
|
case 10:
|
|
913
909
|
newCell = handleRefInsertMoveRight(range, oldCell);
|
|
914
910
|
isReverse = true;
|
|
915
|
-
break;
|
|
916
|
-
default: break;
|
|
917
911
|
}
|
|
918
912
|
return {
|
|
919
913
|
newCell,
|
|
@@ -921,34 +915,37 @@ function handleInsertDelete(oldCell, formulaReferenceMoveParam) {
|
|
|
921
915
|
};
|
|
922
916
|
}
|
|
923
917
|
function handleRefMoveRange$1(from, to, oldCell) {
|
|
924
|
-
|
|
918
|
+
const operators = handleMoveRange({
|
|
925
919
|
id: EffectRefRangId.MoveRangeCommandId,
|
|
926
920
|
params: {
|
|
927
921
|
toRange: to,
|
|
928
922
|
fromRange: from
|
|
929
923
|
}
|
|
930
|
-
}, oldCell)
|
|
924
|
+
}, oldCell);
|
|
925
|
+
return runRefRangeMutations(operators, oldCell);
|
|
931
926
|
}
|
|
932
927
|
function handleRefMoveRows$1(from, to, oldCell) {
|
|
933
|
-
|
|
928
|
+
const operators = handleMoveRows({
|
|
934
929
|
id: EffectRefRangId.MoveRowsCommandId,
|
|
935
930
|
params: {
|
|
936
931
|
toRange: to,
|
|
937
932
|
fromRange: from
|
|
938
933
|
}
|
|
939
|
-
}, oldCell)
|
|
934
|
+
}, oldCell);
|
|
935
|
+
return runRefRangeMutations(operators, oldCell);
|
|
940
936
|
}
|
|
941
937
|
function handleRefMoveCols$1(from, to, oldCell) {
|
|
942
|
-
|
|
938
|
+
const operators = handleMoveCols({
|
|
943
939
|
id: EffectRefRangId.MoveColsCommandId,
|
|
944
940
|
params: {
|
|
945
941
|
toRange: to,
|
|
946
942
|
fromRange: from
|
|
947
943
|
}
|
|
948
|
-
}, oldCell)
|
|
944
|
+
}, oldCell);
|
|
945
|
+
return runRefRangeMutations(operators, oldCell);
|
|
949
946
|
}
|
|
950
947
|
function handleRefInsertRow$1(range, oldCell) {
|
|
951
|
-
|
|
948
|
+
const operators = handleInsertRow({
|
|
952
949
|
id: EffectRefRangId.InsertRowCommandId,
|
|
953
950
|
params: {
|
|
954
951
|
range,
|
|
@@ -956,10 +953,11 @@ function handleRefInsertRow$1(range, oldCell) {
|
|
|
956
953
|
subUnitId: "",
|
|
957
954
|
direction: Direction.DOWN
|
|
958
955
|
}
|
|
959
|
-
}, oldCell)
|
|
956
|
+
}, oldCell);
|
|
957
|
+
return runRefRangeMutations(operators, oldCell);
|
|
960
958
|
}
|
|
961
959
|
function handleRefInsertCol$1(range, oldCell) {
|
|
962
|
-
|
|
960
|
+
const operators = handleInsertCol({
|
|
963
961
|
id: EffectRefRangId.InsertColCommandId,
|
|
964
962
|
params: {
|
|
965
963
|
range,
|
|
@@ -967,43 +965,50 @@ function handleRefInsertCol$1(range, oldCell) {
|
|
|
967
965
|
subUnitId: "",
|
|
968
966
|
direction: Direction.RIGHT
|
|
969
967
|
}
|
|
970
|
-
}, oldCell)
|
|
968
|
+
}, oldCell);
|
|
969
|
+
return runRefRangeMutations(operators, oldCell);
|
|
971
970
|
}
|
|
972
971
|
function handleRefRemoveRow$1(range, oldCell, rangeFilteredRows) {
|
|
973
|
-
|
|
972
|
+
const operators = handleIRemoveRow({
|
|
974
973
|
id: EffectRefRangId.RemoveRowCommandId,
|
|
975
974
|
params: { range }
|
|
976
|
-
}, oldCell, rangeFilteredRows)
|
|
975
|
+
}, oldCell, rangeFilteredRows);
|
|
976
|
+
return runRefRangeMutations(operators, oldCell);
|
|
977
977
|
}
|
|
978
978
|
function handleRefRemoveCol$1(range, oldCell) {
|
|
979
|
-
|
|
979
|
+
const operators = handleIRemoveCol({
|
|
980
980
|
id: EffectRefRangId.RemoveColCommandId,
|
|
981
981
|
params: { range }
|
|
982
|
-
}, oldCell)
|
|
982
|
+
}, oldCell);
|
|
983
|
+
return runRefRangeMutations(operators, oldCell);
|
|
983
984
|
}
|
|
984
985
|
function handleRefDeleteMoveLeft(range, oldCell) {
|
|
985
|
-
|
|
986
|
+
const operators = handleDeleteRangeMoveLeft({
|
|
986
987
|
id: EffectRefRangId.DeleteRangeMoveLeftCommandId,
|
|
987
988
|
params: { range }
|
|
988
|
-
}, oldCell)
|
|
989
|
+
}, oldCell);
|
|
990
|
+
return runRefRangeMutations(operators, oldCell);
|
|
989
991
|
}
|
|
990
992
|
function handleRefDeleteMoveUp(range, oldCell) {
|
|
991
|
-
|
|
993
|
+
const operators = handleDeleteRangeMoveUp({
|
|
992
994
|
id: EffectRefRangId.DeleteRangeMoveUpCommandId,
|
|
993
995
|
params: { range }
|
|
994
|
-
}, oldCell)
|
|
996
|
+
}, oldCell);
|
|
997
|
+
return runRefRangeMutations(operators, oldCell);
|
|
995
998
|
}
|
|
996
999
|
function handleRefInsertMoveDown(range, oldCell) {
|
|
997
|
-
|
|
1000
|
+
const operators = handleInsertRangeMoveDown({
|
|
998
1001
|
id: EffectRefRangId.InsertRangeMoveDownCommandId,
|
|
999
1002
|
params: { range }
|
|
1000
|
-
}, oldCell)
|
|
1003
|
+
}, oldCell);
|
|
1004
|
+
return runRefRangeMutations(operators, oldCell);
|
|
1001
1005
|
}
|
|
1002
1006
|
function handleRefInsertMoveRight(range, oldCell) {
|
|
1003
|
-
|
|
1007
|
+
const operators = handleInsertRangeMoveRight({
|
|
1004
1008
|
id: EffectRefRangId.InsertRangeMoveRightCommandId,
|
|
1005
1009
|
params: { range }
|
|
1006
|
-
}, oldCell)
|
|
1010
|
+
}, oldCell);
|
|
1011
|
+
return runRefRangeMutations(operators, oldCell);
|
|
1007
1012
|
}
|
|
1008
1013
|
/**
|
|
1009
1014
|
* Delete the old value at the old position on the match, and add the new value at the new position (the new value first checks whether the old position has offset content, if so, use the new offset content, if not, take the old value)
|
|
@@ -1156,13 +1161,14 @@ function getNewRangeByMoveParam(unitRangeWidthOffset, formulaReferenceMoveParam,
|
|
|
1156
1161
|
const moveEdge = checkMoveEdge(sequenceRange, from);
|
|
1157
1162
|
const remainRange = getIntersectRange(sequenceRange, from);
|
|
1158
1163
|
if (remainRange == null || moveEdge !== 4) return;
|
|
1159
|
-
const
|
|
1164
|
+
const operators = handleMoveRange({
|
|
1160
1165
|
id: EffectRefRangId.MoveRangeCommandId,
|
|
1161
1166
|
params: {
|
|
1162
1167
|
toRange: to,
|
|
1163
1168
|
fromRange: from
|
|
1164
1169
|
}
|
|
1165
|
-
}, remainRange)
|
|
1170
|
+
}, remainRange);
|
|
1171
|
+
const result = runRefRangeMutations(operators, remainRange);
|
|
1166
1172
|
if (result == null) return ErrorType.REF;
|
|
1167
1173
|
newRange = getMoveNewRange(moveEdge, result, from, to, sequenceRange, remainRange);
|
|
1168
1174
|
} else if (type === 1) {
|
|
@@ -1177,13 +1183,14 @@ function getNewRangeByMoveParam(unitRangeWidthOffset, formulaReferenceMoveParam,
|
|
|
1177
1183
|
endColumn: sequenceRange.endColumn,
|
|
1178
1184
|
rangeType: RANGE_TYPE.NORMAL
|
|
1179
1185
|
};
|
|
1180
|
-
const
|
|
1186
|
+
const operators = handleMoveRows({
|
|
1181
1187
|
id: EffectRefRangId.MoveRowsCommandId,
|
|
1182
1188
|
params: {
|
|
1183
1189
|
toRange: to,
|
|
1184
1190
|
fromRange: from
|
|
1185
1191
|
}
|
|
1186
|
-
}, remainRange)
|
|
1192
|
+
}, remainRange);
|
|
1193
|
+
const result = runRefRangeMutations(operators, remainRange);
|
|
1187
1194
|
if (result == null) return ErrorType.REF;
|
|
1188
1195
|
newRange = getMoveNewRange(moveEdge, result, from, to, sequenceRange, remainRange);
|
|
1189
1196
|
} else if (type === 2) {
|
|
@@ -1198,19 +1205,20 @@ function getNewRangeByMoveParam(unitRangeWidthOffset, formulaReferenceMoveParam,
|
|
|
1198
1205
|
endColumn: sequenceRange.endColumn,
|
|
1199
1206
|
rangeType: RANGE_TYPE.NORMAL
|
|
1200
1207
|
};
|
|
1201
|
-
const
|
|
1208
|
+
const operators = handleMoveCols({
|
|
1202
1209
|
id: EffectRefRangId.MoveColsCommandId,
|
|
1203
1210
|
params: {
|
|
1204
1211
|
toRange: to,
|
|
1205
1212
|
fromRange: from
|
|
1206
1213
|
}
|
|
1207
|
-
}, remainRange)
|
|
1214
|
+
}, remainRange);
|
|
1215
|
+
const result = runRefRangeMutations(operators, remainRange);
|
|
1208
1216
|
if (result == null) return ErrorType.REF;
|
|
1209
1217
|
newRange = getMoveNewRange(moveEdge, result, from, to, sequenceRange, remainRange);
|
|
1210
1218
|
}
|
|
1211
1219
|
if (range != null) {
|
|
1212
1220
|
if (type === 3) {
|
|
1213
|
-
const
|
|
1221
|
+
const operators = handleInsertRow({
|
|
1214
1222
|
id: EffectRefRangId.InsertRowCommandId,
|
|
1215
1223
|
params: {
|
|
1216
1224
|
range,
|
|
@@ -1218,14 +1226,15 @@ function getNewRangeByMoveParam(unitRangeWidthOffset, formulaReferenceMoveParam,
|
|
|
1218
1226
|
subUnitId: "",
|
|
1219
1227
|
direction: Direction.DOWN
|
|
1220
1228
|
}
|
|
1221
|
-
}, sequenceRange)
|
|
1229
|
+
}, sequenceRange);
|
|
1230
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1222
1231
|
if (result == null) return;
|
|
1223
1232
|
newRange = {
|
|
1224
1233
|
...sequenceRange,
|
|
1225
1234
|
...result
|
|
1226
1235
|
};
|
|
1227
1236
|
} else if (type === 4) {
|
|
1228
|
-
const
|
|
1237
|
+
const operators = handleInsertCol({
|
|
1229
1238
|
id: EffectRefRangId.InsertColCommandId,
|
|
1230
1239
|
params: {
|
|
1231
1240
|
range,
|
|
@@ -1233,67 +1242,74 @@ function getNewRangeByMoveParam(unitRangeWidthOffset, formulaReferenceMoveParam,
|
|
|
1233
1242
|
subUnitId: "",
|
|
1234
1243
|
direction: Direction.RIGHT
|
|
1235
1244
|
}
|
|
1236
|
-
}, sequenceRange)
|
|
1245
|
+
}, sequenceRange);
|
|
1246
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1237
1247
|
if (result == null) return;
|
|
1238
1248
|
newRange = {
|
|
1239
1249
|
...sequenceRange,
|
|
1240
1250
|
...result
|
|
1241
1251
|
};
|
|
1242
1252
|
} else if (type === 5) {
|
|
1243
|
-
const
|
|
1253
|
+
const operators = handleIRemoveRow({
|
|
1244
1254
|
id: EffectRefRangId.RemoveRowCommandId,
|
|
1245
1255
|
params: { range }
|
|
1246
|
-
}, sequenceRange, rangeFilteredRows)
|
|
1256
|
+
}, sequenceRange, rangeFilteredRows);
|
|
1257
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1247
1258
|
if (result == null) return ErrorType.REF;
|
|
1248
1259
|
newRange = {
|
|
1249
1260
|
...sequenceRange,
|
|
1250
1261
|
...result
|
|
1251
1262
|
};
|
|
1252
1263
|
} else if (type === 6) {
|
|
1253
|
-
const
|
|
1264
|
+
const operators = handleIRemoveCol({
|
|
1254
1265
|
id: EffectRefRangId.RemoveColCommandId,
|
|
1255
1266
|
params: { range }
|
|
1256
|
-
}, sequenceRange)
|
|
1267
|
+
}, sequenceRange);
|
|
1268
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1257
1269
|
if (result == null) return ErrorType.REF;
|
|
1258
1270
|
newRange = {
|
|
1259
1271
|
...sequenceRange,
|
|
1260
1272
|
...result
|
|
1261
1273
|
};
|
|
1262
1274
|
} else if (type === 7) {
|
|
1263
|
-
const
|
|
1275
|
+
const operators = handleDeleteRangeMoveLeft({
|
|
1264
1276
|
id: EffectRefRangId.DeleteRangeMoveLeftCommandId,
|
|
1265
1277
|
params: { range }
|
|
1266
|
-
}, sequenceRange)
|
|
1278
|
+
}, sequenceRange);
|
|
1279
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1267
1280
|
if (result == null) return ErrorType.REF;
|
|
1268
1281
|
newRange = {
|
|
1269
1282
|
...sequenceRange,
|
|
1270
1283
|
...result
|
|
1271
1284
|
};
|
|
1272
1285
|
} else if (type === 8) {
|
|
1273
|
-
const
|
|
1286
|
+
const operators = handleDeleteRangeMoveUp({
|
|
1274
1287
|
id: EffectRefRangId.DeleteRangeMoveUpCommandId,
|
|
1275
1288
|
params: { range }
|
|
1276
|
-
}, sequenceRange)
|
|
1289
|
+
}, sequenceRange);
|
|
1290
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1277
1291
|
if (result == null) return ErrorType.REF;
|
|
1278
1292
|
newRange = {
|
|
1279
1293
|
...sequenceRange,
|
|
1280
1294
|
...result
|
|
1281
1295
|
};
|
|
1282
1296
|
} else if (type === 9) {
|
|
1283
|
-
const
|
|
1297
|
+
const operators = handleInsertRangeMoveDown({
|
|
1284
1298
|
id: EffectRefRangId.InsertRangeMoveDownCommandId,
|
|
1285
1299
|
params: { range }
|
|
1286
|
-
}, sequenceRange)
|
|
1300
|
+
}, sequenceRange);
|
|
1301
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1287
1302
|
if (result == null) return;
|
|
1288
1303
|
newRange = {
|
|
1289
1304
|
...sequenceRange,
|
|
1290
1305
|
...result
|
|
1291
1306
|
};
|
|
1292
1307
|
} else if (type === 10) {
|
|
1293
|
-
const
|
|
1308
|
+
const operators = handleInsertRangeMoveRight({
|
|
1294
1309
|
id: EffectRefRangId.InsertRangeMoveRightCommandId,
|
|
1295
1310
|
params: { range }
|
|
1296
|
-
}, sequenceRange)
|
|
1311
|
+
}, sequenceRange);
|
|
1312
|
+
const result = runRefRangeMutations(operators, sequenceRange);
|
|
1297
1313
|
if (result == null) return;
|
|
1298
1314
|
newRange = {
|
|
1299
1315
|
...sequenceRange,
|
|
@@ -1338,23 +1354,31 @@ function getMoveNewRange(moveEdge, result, from, to, origin, remain) {
|
|
|
1338
1354
|
if (rangeType === RANGE_TYPE.ROW && originRangeType === RANGE_TYPE.ROW) return true;
|
|
1339
1355
|
return startRow >= originStartRow && endRow <= originEndRow;
|
|
1340
1356
|
}
|
|
1341
|
-
if (moveEdge === 0)
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
else
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
else if (moveEdge ===
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1357
|
+
if (moveEdge === 0) {
|
|
1358
|
+
if (rowsCover()) {
|
|
1359
|
+
if (startRow < originStartRow) newRange.startRow = startRow;
|
|
1360
|
+
else if (startRow >= originEndRow) newRange.endRow -= fromEndRow + 1 - originStartRow;
|
|
1361
|
+
else return;
|
|
1362
|
+
} else return;
|
|
1363
|
+
} else if (moveEdge === 1) {
|
|
1364
|
+
if (rowsCover()) {
|
|
1365
|
+
if (endRow > originEndRow) newRange.endRow = endRow;
|
|
1366
|
+
else if (endRow <= originStartRow) newRange.startRow += originEndRow - fromStartRow + 1;
|
|
1367
|
+
else return;
|
|
1368
|
+
} else return;
|
|
1369
|
+
} else if (moveEdge === 2) {
|
|
1370
|
+
if (columnsCover()) {
|
|
1371
|
+
if (startColumn < originStartColumn) newRange.startColumn = startColumn;
|
|
1372
|
+
else if (startColumn >= originEndColumn) newRange.endColumn -= fromEndColumn + 1 - originStartColumn;
|
|
1373
|
+
else return;
|
|
1374
|
+
} else return;
|
|
1375
|
+
} else if (moveEdge === 3) {
|
|
1376
|
+
if (columnsCover()) {
|
|
1377
|
+
if (endColumn > originEndColumn) newRange.endColumn = endColumn;
|
|
1378
|
+
else if (endColumn <= originStartColumn) newRange.startColumn += originEndColumn - fromStartColumn + 1;
|
|
1379
|
+
else return;
|
|
1380
|
+
} else return;
|
|
1381
|
+
} else if (moveEdge === 4) {
|
|
1358
1382
|
newRange.startRow = startRow;
|
|
1359
1383
|
newRange.startColumn = startColumn;
|
|
1360
1384
|
newRange.endRow = endRow;
|
|
@@ -1514,9 +1538,7 @@ function getReferenceMoveParams(workbook, command) {
|
|
|
1514
1538
|
result = handleRefRemoveSheetTableName(command, workbook);
|
|
1515
1539
|
break;
|
|
1516
1540
|
case REMOVE_SHEET_TABLE_COLUMN_AT_COMMAND_ID:
|
|
1517
|
-
case REMOVE_SHEET_TABLE_COLUMN_COMMAND_ID:
|
|
1518
|
-
result = handleRefRemoveSheetTableColumn(command, workbook);
|
|
1519
|
-
break;
|
|
1541
|
+
case REMOVE_SHEET_TABLE_COLUMN_COMMAND_ID: result = handleRefRemoveSheetTableColumn(command, workbook);
|
|
1520
1542
|
}
|
|
1521
1543
|
return result;
|
|
1522
1544
|
}
|
|
@@ -2007,7 +2029,7 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2007
2029
|
return;
|
|
2008
2030
|
}
|
|
2009
2031
|
const newFormulaData = { [unitId]: { [sheetId]: newSheetFormulaData } };
|
|
2010
|
-
this._commandService.
|
|
2032
|
+
this._commandService.syncExecuteCommand(SetRangeValuesMutation.id, {
|
|
2011
2033
|
unitId,
|
|
2012
2034
|
subUnitId: sheetId,
|
|
2013
2035
|
cellValue: formulaDataToCellData(newSheetFormulaData, cellValue)
|
|
@@ -2027,7 +2049,8 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2027
2049
|
}
|
|
2028
2050
|
_handleWorkbookDisposed(unitId, sheetId) {
|
|
2029
2051
|
this._formulaDataModel.clearFormulaIdMap(unitId, sheetId);
|
|
2030
|
-
const
|
|
2052
|
+
const formulaData = this._formulaDataModel.getFormulaData();
|
|
2053
|
+
const newFormulaData = removeFormulaData(formulaData, unitId, sheetId);
|
|
2031
2054
|
const arrayFormulaRange = this._formulaDataModel.getArrayFormulaRange();
|
|
2032
2055
|
const newArrayFormulaRange = removeFormulaData(arrayFormulaRange, unitId, sheetId);
|
|
2033
2056
|
const arrayFormulaCellData = this._formulaDataModel.getArrayFormulaCellData();
|
|
@@ -2047,7 +2070,7 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2047
2070
|
this._commandService.executeCommand(SetFormulaDataMutation.id, { formulaData: newFormulaData }, { onlyLocal: true });
|
|
2048
2071
|
}
|
|
2049
2072
|
_handleWorkbookAdded(unit) {
|
|
2050
|
-
const formulaData =
|
|
2073
|
+
const formulaData = Object.create(null);
|
|
2051
2074
|
const unitId = unit.getUnitId();
|
|
2052
2075
|
const newFormulaData = { [unitId]: {} };
|
|
2053
2076
|
unit.getSheets().forEach((worksheet) => {
|
|
@@ -2068,11 +2091,11 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2068
2091
|
return {
|
|
2069
2092
|
forceCalculation: calculationMode === 0,
|
|
2070
2093
|
dirtyRanges: calculationMode === 1 ? this._formulaDataModel.getFormulaDirtyRanges() : [],
|
|
2071
|
-
dirtyNameMap:
|
|
2072
|
-
dirtyDefinedNameMap:
|
|
2073
|
-
dirtyUnitFeatureMap:
|
|
2074
|
-
dirtyUnitOtherFormulaMap:
|
|
2075
|
-
clearDependencyTreeCache:
|
|
2094
|
+
dirtyNameMap: Object.create(null),
|
|
2095
|
+
dirtyDefinedNameMap: Object.create(null),
|
|
2096
|
+
dirtyUnitFeatureMap: Object.create(null),
|
|
2097
|
+
dirtyUnitOtherFormulaMap: Object.create(null),
|
|
2098
|
+
clearDependencyTreeCache: Object.create(null)
|
|
2076
2099
|
};
|
|
2077
2100
|
}
|
|
2078
2101
|
_getUpdateFormula(command) {
|
|
@@ -2105,14 +2128,14 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2105
2128
|
if (!Tools.isDefine(formulaData)) return { newFormulaData: {} };
|
|
2106
2129
|
const formulaDataKeys = Object.keys(formulaData);
|
|
2107
2130
|
if (formulaDataKeys.length === 0) return { newFormulaData: {} };
|
|
2108
|
-
const newFormulaData =
|
|
2131
|
+
const newFormulaData = Object.create(null);
|
|
2109
2132
|
const { unitId: fromUnitId, sheetId: fromSheetId, sheetName: fromSheetName, targetUnitId, targetSheetId, type, from, to } = formulaReferenceMoveParam;
|
|
2110
2133
|
const inCrossSheetCutRangeNewFormulas = [];
|
|
2111
2134
|
for (const unitId of formulaDataKeys) {
|
|
2112
2135
|
const sheetData = formulaData[unitId];
|
|
2113
2136
|
if (sheetData == null) continue;
|
|
2114
2137
|
const sheetDataKeys = Object.keys(sheetData);
|
|
2115
|
-
if (!Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] =
|
|
2138
|
+
if (!Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] = Object.create(null);
|
|
2116
2139
|
for (const sheetId of sheetDataKeys) {
|
|
2117
2140
|
const matrixData = new ObjectMatrix(sheetData[sheetId] || {});
|
|
2118
2141
|
const newFormulaDataItem = new ObjectMatrix();
|
|
@@ -2232,21 +2255,22 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2232
2255
|
}
|
|
2233
2256
|
}
|
|
2234
2257
|
}
|
|
2235
|
-
if (!shouldModify)
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2258
|
+
if (!shouldModify) {
|
|
2259
|
+
/**
|
|
2260
|
+
* If the operation is a move type, and the formula cell has si and is the same as the current shouldModifySi, unpack the si to f.
|
|
2261
|
+
* Or the source formula cell is in the moved range.
|
|
2262
|
+
* This is to ensure that the si formula can be recalculated correctly after the move.
|
|
2263
|
+
*/
|
|
2264
|
+
if (si && [
|
|
2265
|
+
1,
|
|
2266
|
+
2,
|
|
2267
|
+
0
|
|
2268
|
+
].includes(type)) {
|
|
2269
|
+
if (from && from.startRow <= row && row <= from.endRow && from.startColumn <= column && column <= from.endColumn) {
|
|
2270
|
+
if ((x ?? 0) === 0 && (y ?? 0) === 0) shouldModifySi.push(si);
|
|
2271
|
+
} else if (!shouldModifySi.includes(si)) return true;
|
|
2272
|
+
} else return true;
|
|
2273
|
+
}
|
|
2250
2274
|
if (inCrossSheetCutRange) {
|
|
2251
2275
|
const newSequenceNodes = updateRefOffset(inCrossSheetCutRangeSequenceNodes, refChangeIds, x, y);
|
|
2252
2276
|
inCrossSheetCutRangeNewFormulas.push({
|
|
@@ -2263,13 +2287,13 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2263
2287
|
}
|
|
2264
2288
|
}
|
|
2265
2289
|
if (inCrossSheetCutRangeNewFormulas.length > 0 && targetUnitId && targetSheetId) {
|
|
2266
|
-
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] =
|
|
2267
|
-
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] =
|
|
2290
|
+
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] = Object.create(null);
|
|
2291
|
+
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] = Object.create(null);
|
|
2268
2292
|
for (const newFormula of inCrossSheetCutRangeNewFormulas) {
|
|
2269
2293
|
const { fromRow, fromColumn, formulaString } = newFormula;
|
|
2270
2294
|
const targetRow = fromRow + (((to === null || to === void 0 ? void 0 : to.startRow) ?? 0) - ((from === null || from === void 0 ? void 0 : from.startRow) ?? 0));
|
|
2271
2295
|
const targetColumn = fromColumn + (((to === null || to === void 0 ? void 0 : to.startColumn) ?? 0) - ((from === null || from === void 0 ? void 0 : from.startColumn) ?? 0));
|
|
2272
|
-
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] =
|
|
2296
|
+
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] = Object.create(null);
|
|
2273
2297
|
newFormulaData[targetUnitId][targetSheetId][targetRow][targetColumn] = { f: formulaString };
|
|
2274
2298
|
}
|
|
2275
2299
|
}
|
|
@@ -2334,7 +2358,7 @@ function tableReferenceContainsColumn(columnStruct, columnNames) {
|
|
|
2334
2358
|
//#endregion
|
|
2335
2359
|
//#region package.json
|
|
2336
2360
|
var name = "@univerjs/sheets-formula";
|
|
2337
|
-
var version = "1.0.0
|
|
2361
|
+
var version = "1.0.0";
|
|
2338
2362
|
|
|
2339
2363
|
//#endregion
|
|
2340
2364
|
//#region src/common/plugin-name.ts
|
|
@@ -2599,16 +2623,16 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2599
2623
|
return dirtyRanges;
|
|
2600
2624
|
}
|
|
2601
2625
|
_getRemoveSheetMutation(params) {
|
|
2602
|
-
const dirtyNameMap =
|
|
2626
|
+
const dirtyNameMap = Object.create(null);
|
|
2603
2627
|
const { subUnitId: sheetId, unitId, subUnitName } = params;
|
|
2604
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2628
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2605
2629
|
dirtyNameMap[unitId][sheetId] = subUnitName;
|
|
2606
2630
|
return dirtyNameMap;
|
|
2607
2631
|
}
|
|
2608
2632
|
_getInsertSheetMutation(params) {
|
|
2609
|
-
const dirtyNameMap =
|
|
2633
|
+
const dirtyNameMap = Object.create(null);
|
|
2610
2634
|
const { sheet, unitId } = params;
|
|
2611
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2635
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2612
2636
|
dirtyNameMap[unitId][sheet.id] = sheet.name;
|
|
2613
2637
|
return dirtyNameMap;
|
|
2614
2638
|
}
|
|
@@ -2710,6 +2734,9 @@ let ArrayFormulaCellInterceptorController = class ArrayFormulaCellInterceptorCon
|
|
|
2710
2734
|
const cellData = arrayFormulaCellData === null || arrayFormulaCellData === void 0 || (_arrayFormulaCellData = arrayFormulaCellData[unitId]) === null || _arrayFormulaCellData === void 0 || (_arrayFormulaCellData = _arrayFormulaCellData[subUnitId]) === null || _arrayFormulaCellData === void 0 || (_arrayFormulaCellData = _arrayFormulaCellData[row]) === null || _arrayFormulaCellData === void 0 ? void 0 : _arrayFormulaCellData[col];
|
|
2711
2735
|
if (cellData == null) return next(cell);
|
|
2712
2736
|
if (!cell || cell === location.rawData) cell = { ...location.rawData };
|
|
2737
|
+
cell.v = cellData.v;
|
|
2738
|
+
cell.t = cellData.t;
|
|
2739
|
+
cell.isInArrayFormulaRange = true;
|
|
2713
2740
|
if (cellData.v == null && cellData.t == null) {
|
|
2714
2741
|
cell.v = 0;
|
|
2715
2742
|
cell.t = CellValueType.NUMBER;
|
|
@@ -2719,8 +2746,6 @@ let ArrayFormulaCellInterceptorController = class ArrayFormulaCellInterceptorCon
|
|
|
2719
2746
|
cell.v = stripErrorMargin(Number(cell.v));
|
|
2720
2747
|
return next(cell);
|
|
2721
2748
|
}
|
|
2722
|
-
cell.v = cellData.v;
|
|
2723
|
-
cell.t = cellData.t;
|
|
2724
2749
|
return next(cell);
|
|
2725
2750
|
}
|
|
2726
2751
|
}));
|
|
@@ -2980,7 +3005,8 @@ let SuperTableController = class SuperTableController extends Disposable {
|
|
|
2980
3005
|
const { tableName, reference } = param;
|
|
2981
3006
|
if (!this._descriptionService.hasDescription(tableName)) {
|
|
2982
3007
|
var _this$_univerInstance;
|
|
2983
|
-
const
|
|
3008
|
+
const sheetName = ((_this$_univerInstance = this._univerInstanceService.getUnit(unitId)) === null || _this$_univerInstance === void 0 || (_this$_univerInstance = _this$_univerInstance.getSheetBySheetId(reference.sheetId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getName()) || "";
|
|
3009
|
+
const refString = serializeRangeWithSheet(sheetName, reference.range);
|
|
2984
3010
|
this._descriptionService.registerDescriptions([{
|
|
2985
3011
|
functionName: tableName,
|
|
2986
3012
|
description: refString,
|
|
@@ -3026,7 +3052,8 @@ let SuperTableController = class SuperTableController extends Disposable {
|
|
|
3026
3052
|
this._preUnitId = unitId;
|
|
3027
3053
|
superTables.forEach((table, tableName) => {
|
|
3028
3054
|
var _this$_univerInstance2;
|
|
3029
|
-
const
|
|
3055
|
+
const sheetName = ((_this$_univerInstance2 = this._univerInstanceService.getUnit(unitId)) === null || _this$_univerInstance2 === void 0 || (_this$_univerInstance2 = _this$_univerInstance2.getSheetBySheetId(table.sheetId)) === null || _this$_univerInstance2 === void 0 ? void 0 : _this$_univerInstance2.getName()) || "";
|
|
3056
|
+
const refString = serializeRangeWithSheet(sheetName, table.range);
|
|
3030
3057
|
if (!this._descriptionService.hasDescription(tableName)) functionList.push({
|
|
3031
3058
|
functionName: tableName,
|
|
3032
3059
|
description: refString,
|
|
@@ -3106,7 +3133,9 @@ let FormulaRefRangeService = class FormulaRefRangeService extends Disposable {
|
|
|
3106
3133
|
const newRange = handleDefaultRangeChangeWithEffectRefCommands(range, params);
|
|
3107
3134
|
let newToken = "";
|
|
3108
3135
|
if (newRange) {
|
|
3109
|
-
const
|
|
3136
|
+
const offsetX = newRange.startColumn - range.startColumn;
|
|
3137
|
+
const offsetY = newRange.startRow - range.startRow;
|
|
3138
|
+
const finalRange = moveRangeByOffset(range, offsetX, offsetY);
|
|
3110
3139
|
if (rangeUnitId && rangeSheetName) newToken = serializeRangeWithSpreadsheet(rangeUnitId, rangeSheetName, finalRange);
|
|
3111
3140
|
else if (rangeSheetName) newToken = serializeRangeWithSheet(rangeSheetName, finalRange);
|
|
3112
3141
|
else newToken = serializeRange(finalRange);
|
|
@@ -3488,7 +3517,8 @@ function calculateFormula(inject, formulaString, unitId, sheetData) {
|
|
|
3488
3517
|
});
|
|
3489
3518
|
const lexerNode = lexer.treeBuilder(formulaString);
|
|
3490
3519
|
const astNode = astTreeBuilder.parse(lexerNode);
|
|
3491
|
-
|
|
3520
|
+
const result = interpreter.execute(generateExecuteAstNodeData(astNode));
|
|
3521
|
+
return getObjectValue(result);
|
|
3492
3522
|
}
|
|
3493
3523
|
|
|
3494
3524
|
//#endregion
|