@univerjs/sheets-formula 0.25.1 → 0.25.2
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 +22 -22
- package/lib/es/index.js +22 -22
- package/lib/index.js +22 -22
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/cjs/index.js
CHANGED
|
@@ -574,10 +574,10 @@ let ImageFormulaCellInterceptorController = class ImageFormulaCellInterceptorCon
|
|
|
574
574
|
const updateRuntimeImageFormulaData = await Promise.all(imageFormulaData.map((imageFormulaInfo) => {
|
|
575
575
|
return this._getImageNatureSize(imageFormulaInfo);
|
|
576
576
|
}));
|
|
577
|
-
const unitImageFormulaData =
|
|
577
|
+
const unitImageFormulaData = Object.create(null);
|
|
578
578
|
updateRuntimeImageFormulaData.forEach((imageFormulaInfo) => {
|
|
579
579
|
const { unitId, sheetId, row, column, ...imageInfo } = imageFormulaInfo;
|
|
580
|
-
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] =
|
|
580
|
+
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] = Object.create(null);
|
|
581
581
|
if (!unitImageFormulaData[unitId][sheetId]) unitImageFormulaData[unitId][sheetId] = new _univerjs_core.ObjectMatrix();
|
|
582
582
|
unitImageFormulaData[unitId][sheetId].setValue(row, column, imageInfo);
|
|
583
583
|
});
|
|
@@ -1170,8 +1170,8 @@ function getFormulaReferenceRange(oldFormulaData, newFormulaData, formulaReferen
|
|
|
1170
1170
|
*/
|
|
1171
1171
|
function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMoveParam) {
|
|
1172
1172
|
var _formulaReferenceMove, _formulaReferenceMove2;
|
|
1173
|
-
const redoFormulaData =
|
|
1174
|
-
const undoFormulaData =
|
|
1173
|
+
const redoFormulaData = Object.create(null);
|
|
1174
|
+
const undoFormulaData = Object.create(null);
|
|
1175
1175
|
const { unitId: fromUnitId, sheetId: fromSheetId } = formulaReferenceMoveParam;
|
|
1176
1176
|
const targetUnitId = (_formulaReferenceMove = formulaReferenceMoveParam.targetUnitId) !== null && _formulaReferenceMove !== void 0 ? _formulaReferenceMove : fromUnitId;
|
|
1177
1177
|
const targetSheetId = (_formulaReferenceMove2 = formulaReferenceMoveParam.targetSheetId) !== null && _formulaReferenceMove2 !== void 0 ? _formulaReferenceMove2 : fromSheetId;
|
|
@@ -1189,8 +1189,8 @@ function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMovePar
|
|
|
1189
1189
|
else rangeList = processFormulaChanges(oldFormulaMatrix, newFormulaMatrix, formulaReferenceMoveParam);
|
|
1190
1190
|
const sheetRedoFormulaData = getRedoFormulaData(rangeList, oldFormulaMatrix, newFormulaMatrix);
|
|
1191
1191
|
const sheetUndoFormulaData = getUndoFormulaData(rangeList, oldFormulaMatrix);
|
|
1192
|
-
if (!redoFormulaData[unitId]) redoFormulaData[unitId] =
|
|
1193
|
-
if (!undoFormulaData[unitId]) undoFormulaData[unitId] =
|
|
1192
|
+
if (!redoFormulaData[unitId]) redoFormulaData[unitId] = Object.create(null);
|
|
1193
|
+
if (!undoFormulaData[unitId]) undoFormulaData[unitId] = Object.create(null);
|
|
1194
1194
|
redoFormulaData[unitId][currentSheetId] = {
|
|
1195
1195
|
...redoFormulaData[unitId][currentSheetId],
|
|
1196
1196
|
...sheetRedoFormulaData
|
|
@@ -2388,7 +2388,7 @@ let UpdateFormulaController = class UpdateFormulaController extends _univerjs_co
|
|
|
2388
2388
|
}
|
|
2389
2389
|
_handleWorkbookAdded(unit) {
|
|
2390
2390
|
var _config$initialFormul;
|
|
2391
|
-
const formulaData =
|
|
2391
|
+
const formulaData = Object.create(null);
|
|
2392
2392
|
const unitId = unit.getUnitId();
|
|
2393
2393
|
const newFormulaData = { [unitId]: {} };
|
|
2394
2394
|
unit.getSheets().forEach((worksheet) => {
|
|
@@ -2408,11 +2408,11 @@ let UpdateFormulaController = class UpdateFormulaController extends _univerjs_co
|
|
|
2408
2408
|
return {
|
|
2409
2409
|
forceCalculation: calculationMode === 0,
|
|
2410
2410
|
dirtyRanges: calculationMode === 1 ? this._formulaDataModel.getFormulaDirtyRanges() : [],
|
|
2411
|
-
dirtyNameMap:
|
|
2412
|
-
dirtyDefinedNameMap:
|
|
2413
|
-
dirtyUnitFeatureMap:
|
|
2414
|
-
dirtyUnitOtherFormulaMap:
|
|
2415
|
-
clearDependencyTreeCache:
|
|
2411
|
+
dirtyNameMap: Object.create(null),
|
|
2412
|
+
dirtyDefinedNameMap: Object.create(null),
|
|
2413
|
+
dirtyUnitFeatureMap: Object.create(null),
|
|
2414
|
+
dirtyUnitOtherFormulaMap: Object.create(null),
|
|
2415
|
+
clearDependencyTreeCache: Object.create(null)
|
|
2416
2416
|
};
|
|
2417
2417
|
}
|
|
2418
2418
|
_getUpdateFormula(command) {
|
|
@@ -2441,14 +2441,14 @@ let UpdateFormulaController = class UpdateFormulaController extends _univerjs_co
|
|
|
2441
2441
|
if (!_univerjs_core.Tools.isDefine(formulaData)) return { newFormulaData: {} };
|
|
2442
2442
|
const formulaDataKeys = Object.keys(formulaData);
|
|
2443
2443
|
if (formulaDataKeys.length === 0) return { newFormulaData: {} };
|
|
2444
|
-
const newFormulaData =
|
|
2444
|
+
const newFormulaData = Object.create(null);
|
|
2445
2445
|
const { unitId: fromUnitId, sheetId: fromSheetId, sheetName: fromSheetName, targetUnitId, targetSheetId, type, from, to } = formulaReferenceMoveParam;
|
|
2446
2446
|
const inCrossSheetCutRangeNewFormulas = [];
|
|
2447
2447
|
for (const unitId of formulaDataKeys) {
|
|
2448
2448
|
const sheetData = formulaData[unitId];
|
|
2449
2449
|
if (sheetData == null) continue;
|
|
2450
2450
|
const sheetDataKeys = Object.keys(sheetData);
|
|
2451
|
-
if (!_univerjs_core.Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] =
|
|
2451
|
+
if (!_univerjs_core.Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] = Object.create(null);
|
|
2452
2452
|
for (const sheetId of sheetDataKeys) {
|
|
2453
2453
|
const matrixData = new _univerjs_core.ObjectMatrix(sheetData[sheetId] || {});
|
|
2454
2454
|
const newFormulaDataItem = new _univerjs_core.ObjectMatrix();
|
|
@@ -2592,14 +2592,14 @@ let UpdateFormulaController = class UpdateFormulaController extends _univerjs_co
|
|
|
2592
2592
|
}
|
|
2593
2593
|
}
|
|
2594
2594
|
if (inCrossSheetCutRangeNewFormulas.length > 0 && targetUnitId && targetSheetId) {
|
|
2595
|
-
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] =
|
|
2596
|
-
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] =
|
|
2595
|
+
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] = Object.create(null);
|
|
2596
|
+
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] = Object.create(null);
|
|
2597
2597
|
for (const newFormula of inCrossSheetCutRangeNewFormulas) {
|
|
2598
2598
|
var _to$startRow, _from$startRow, _to$startColumn, _from$startColumn;
|
|
2599
2599
|
const { fromRow, fromColumn, formulaString } = newFormula;
|
|
2600
2600
|
const targetRow = fromRow + (((_to$startRow = to === null || to === void 0 ? void 0 : to.startRow) !== null && _to$startRow !== void 0 ? _to$startRow : 0) - ((_from$startRow = from === null || from === void 0 ? void 0 : from.startRow) !== null && _from$startRow !== void 0 ? _from$startRow : 0));
|
|
2601
2601
|
const targetColumn = fromColumn + (((_to$startColumn = to === null || to === void 0 ? void 0 : to.startColumn) !== null && _to$startColumn !== void 0 ? _to$startColumn : 0) - ((_from$startColumn = from === null || from === void 0 ? void 0 : from.startColumn) !== null && _from$startColumn !== void 0 ? _from$startColumn : 0));
|
|
2602
|
-
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] =
|
|
2602
|
+
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] = Object.create(null);
|
|
2603
2603
|
newFormulaData[targetUnitId][targetSheetId][targetRow][targetColumn] = { f: formulaString };
|
|
2604
2604
|
}
|
|
2605
2605
|
}
|
|
@@ -2630,7 +2630,7 @@ function tableReferenceContainsColumn(columnStruct, columnNames) {
|
|
|
2630
2630
|
//#endregion
|
|
2631
2631
|
//#region package.json
|
|
2632
2632
|
var name = "@univerjs/sheets-formula";
|
|
2633
|
-
var version = "0.25.
|
|
2633
|
+
var version = "0.25.2";
|
|
2634
2634
|
|
|
2635
2635
|
//#endregion
|
|
2636
2636
|
//#region src/common/plugin-name.ts
|
|
@@ -2922,16 +2922,16 @@ let ActiveDirtyController = class ActiveDirtyController extends _univerjs_core.D
|
|
|
2922
2922
|
return dirtyRanges;
|
|
2923
2923
|
}
|
|
2924
2924
|
_getRemoveSheetMutation(params) {
|
|
2925
|
-
const dirtyNameMap =
|
|
2925
|
+
const dirtyNameMap = Object.create(null);
|
|
2926
2926
|
const { subUnitId: sheetId, unitId, subUnitName } = params;
|
|
2927
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2927
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2928
2928
|
dirtyNameMap[unitId][sheetId] = subUnitName;
|
|
2929
2929
|
return dirtyNameMap;
|
|
2930
2930
|
}
|
|
2931
2931
|
_getInsertSheetMutation(params) {
|
|
2932
|
-
const dirtyNameMap =
|
|
2932
|
+
const dirtyNameMap = Object.create(null);
|
|
2933
2933
|
const { sheet, unitId } = params;
|
|
2934
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2934
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2935
2935
|
dirtyNameMap[unitId][sheet.id] = sheet.name;
|
|
2936
2936
|
return dirtyNameMap;
|
|
2937
2937
|
}
|
package/lib/es/index.js
CHANGED
|
@@ -573,10 +573,10 @@ let ImageFormulaCellInterceptorController = class ImageFormulaCellInterceptorCon
|
|
|
573
573
|
const updateRuntimeImageFormulaData = await Promise.all(imageFormulaData.map((imageFormulaInfo) => {
|
|
574
574
|
return this._getImageNatureSize(imageFormulaInfo);
|
|
575
575
|
}));
|
|
576
|
-
const unitImageFormulaData =
|
|
576
|
+
const unitImageFormulaData = Object.create(null);
|
|
577
577
|
updateRuntimeImageFormulaData.forEach((imageFormulaInfo) => {
|
|
578
578
|
const { unitId, sheetId, row, column, ...imageInfo } = imageFormulaInfo;
|
|
579
|
-
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] =
|
|
579
|
+
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] = Object.create(null);
|
|
580
580
|
if (!unitImageFormulaData[unitId][sheetId]) unitImageFormulaData[unitId][sheetId] = new ObjectMatrix();
|
|
581
581
|
unitImageFormulaData[unitId][sheetId].setValue(row, column, imageInfo);
|
|
582
582
|
});
|
|
@@ -1169,8 +1169,8 @@ function getFormulaReferenceRange(oldFormulaData, newFormulaData, formulaReferen
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMoveParam) {
|
|
1171
1171
|
var _formulaReferenceMove, _formulaReferenceMove2;
|
|
1172
|
-
const redoFormulaData =
|
|
1173
|
-
const undoFormulaData =
|
|
1172
|
+
const redoFormulaData = Object.create(null);
|
|
1173
|
+
const undoFormulaData = Object.create(null);
|
|
1174
1174
|
const { unitId: fromUnitId, sheetId: fromSheetId } = formulaReferenceMoveParam;
|
|
1175
1175
|
const targetUnitId = (_formulaReferenceMove = formulaReferenceMoveParam.targetUnitId) !== null && _formulaReferenceMove !== void 0 ? _formulaReferenceMove : fromUnitId;
|
|
1176
1176
|
const targetSheetId = (_formulaReferenceMove2 = formulaReferenceMoveParam.targetSheetId) !== null && _formulaReferenceMove2 !== void 0 ? _formulaReferenceMove2 : fromSheetId;
|
|
@@ -1188,8 +1188,8 @@ function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMovePar
|
|
|
1188
1188
|
else rangeList = processFormulaChanges(oldFormulaMatrix, newFormulaMatrix, formulaReferenceMoveParam);
|
|
1189
1189
|
const sheetRedoFormulaData = getRedoFormulaData(rangeList, oldFormulaMatrix, newFormulaMatrix);
|
|
1190
1190
|
const sheetUndoFormulaData = getUndoFormulaData(rangeList, oldFormulaMatrix);
|
|
1191
|
-
if (!redoFormulaData[unitId]) redoFormulaData[unitId] =
|
|
1192
|
-
if (!undoFormulaData[unitId]) undoFormulaData[unitId] =
|
|
1191
|
+
if (!redoFormulaData[unitId]) redoFormulaData[unitId] = Object.create(null);
|
|
1192
|
+
if (!undoFormulaData[unitId]) undoFormulaData[unitId] = Object.create(null);
|
|
1193
1193
|
redoFormulaData[unitId][currentSheetId] = {
|
|
1194
1194
|
...redoFormulaData[unitId][currentSheetId],
|
|
1195
1195
|
...sheetRedoFormulaData
|
|
@@ -2387,7 +2387,7 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
_handleWorkbookAdded(unit) {
|
|
2389
2389
|
var _config$initialFormul;
|
|
2390
|
-
const formulaData =
|
|
2390
|
+
const formulaData = Object.create(null);
|
|
2391
2391
|
const unitId = unit.getUnitId();
|
|
2392
2392
|
const newFormulaData = { [unitId]: {} };
|
|
2393
2393
|
unit.getSheets().forEach((worksheet) => {
|
|
@@ -2407,11 +2407,11 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2407
2407
|
return {
|
|
2408
2408
|
forceCalculation: calculationMode === 0,
|
|
2409
2409
|
dirtyRanges: calculationMode === 1 ? this._formulaDataModel.getFormulaDirtyRanges() : [],
|
|
2410
|
-
dirtyNameMap:
|
|
2411
|
-
dirtyDefinedNameMap:
|
|
2412
|
-
dirtyUnitFeatureMap:
|
|
2413
|
-
dirtyUnitOtherFormulaMap:
|
|
2414
|
-
clearDependencyTreeCache:
|
|
2410
|
+
dirtyNameMap: Object.create(null),
|
|
2411
|
+
dirtyDefinedNameMap: Object.create(null),
|
|
2412
|
+
dirtyUnitFeatureMap: Object.create(null),
|
|
2413
|
+
dirtyUnitOtherFormulaMap: Object.create(null),
|
|
2414
|
+
clearDependencyTreeCache: Object.create(null)
|
|
2415
2415
|
};
|
|
2416
2416
|
}
|
|
2417
2417
|
_getUpdateFormula(command) {
|
|
@@ -2440,14 +2440,14 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2440
2440
|
if (!Tools.isDefine(formulaData)) return { newFormulaData: {} };
|
|
2441
2441
|
const formulaDataKeys = Object.keys(formulaData);
|
|
2442
2442
|
if (formulaDataKeys.length === 0) return { newFormulaData: {} };
|
|
2443
|
-
const newFormulaData =
|
|
2443
|
+
const newFormulaData = Object.create(null);
|
|
2444
2444
|
const { unitId: fromUnitId, sheetId: fromSheetId, sheetName: fromSheetName, targetUnitId, targetSheetId, type, from, to } = formulaReferenceMoveParam;
|
|
2445
2445
|
const inCrossSheetCutRangeNewFormulas = [];
|
|
2446
2446
|
for (const unitId of formulaDataKeys) {
|
|
2447
2447
|
const sheetData = formulaData[unitId];
|
|
2448
2448
|
if (sheetData == null) continue;
|
|
2449
2449
|
const sheetDataKeys = Object.keys(sheetData);
|
|
2450
|
-
if (!Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] =
|
|
2450
|
+
if (!Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] = Object.create(null);
|
|
2451
2451
|
for (const sheetId of sheetDataKeys) {
|
|
2452
2452
|
const matrixData = new ObjectMatrix(sheetData[sheetId] || {});
|
|
2453
2453
|
const newFormulaDataItem = new ObjectMatrix();
|
|
@@ -2591,14 +2591,14 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
2593
|
if (inCrossSheetCutRangeNewFormulas.length > 0 && targetUnitId && targetSheetId) {
|
|
2594
|
-
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] =
|
|
2595
|
-
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] =
|
|
2594
|
+
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] = Object.create(null);
|
|
2595
|
+
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] = Object.create(null);
|
|
2596
2596
|
for (const newFormula of inCrossSheetCutRangeNewFormulas) {
|
|
2597
2597
|
var _to$startRow, _from$startRow, _to$startColumn, _from$startColumn;
|
|
2598
2598
|
const { fromRow, fromColumn, formulaString } = newFormula;
|
|
2599
2599
|
const targetRow = fromRow + (((_to$startRow = to === null || to === void 0 ? void 0 : to.startRow) !== null && _to$startRow !== void 0 ? _to$startRow : 0) - ((_from$startRow = from === null || from === void 0 ? void 0 : from.startRow) !== null && _from$startRow !== void 0 ? _from$startRow : 0));
|
|
2600
2600
|
const targetColumn = fromColumn + (((_to$startColumn = to === null || to === void 0 ? void 0 : to.startColumn) !== null && _to$startColumn !== void 0 ? _to$startColumn : 0) - ((_from$startColumn = from === null || from === void 0 ? void 0 : from.startColumn) !== null && _from$startColumn !== void 0 ? _from$startColumn : 0));
|
|
2601
|
-
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] =
|
|
2601
|
+
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] = Object.create(null);
|
|
2602
2602
|
newFormulaData[targetUnitId][targetSheetId][targetRow][targetColumn] = { f: formulaString };
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
@@ -2629,7 +2629,7 @@ function tableReferenceContainsColumn(columnStruct, columnNames) {
|
|
|
2629
2629
|
//#endregion
|
|
2630
2630
|
//#region package.json
|
|
2631
2631
|
var name = "@univerjs/sheets-formula";
|
|
2632
|
-
var version = "0.25.
|
|
2632
|
+
var version = "0.25.2";
|
|
2633
2633
|
|
|
2634
2634
|
//#endregion
|
|
2635
2635
|
//#region src/common/plugin-name.ts
|
|
@@ -2921,16 +2921,16 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2921
2921
|
return dirtyRanges;
|
|
2922
2922
|
}
|
|
2923
2923
|
_getRemoveSheetMutation(params) {
|
|
2924
|
-
const dirtyNameMap =
|
|
2924
|
+
const dirtyNameMap = Object.create(null);
|
|
2925
2925
|
const { subUnitId: sheetId, unitId, subUnitName } = params;
|
|
2926
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2926
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2927
2927
|
dirtyNameMap[unitId][sheetId] = subUnitName;
|
|
2928
2928
|
return dirtyNameMap;
|
|
2929
2929
|
}
|
|
2930
2930
|
_getInsertSheetMutation(params) {
|
|
2931
|
-
const dirtyNameMap =
|
|
2931
|
+
const dirtyNameMap = Object.create(null);
|
|
2932
2932
|
const { sheet, unitId } = params;
|
|
2933
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2933
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2934
2934
|
dirtyNameMap[unitId][sheet.id] = sheet.name;
|
|
2935
2935
|
return dirtyNameMap;
|
|
2936
2936
|
}
|
package/lib/index.js
CHANGED
|
@@ -573,10 +573,10 @@ let ImageFormulaCellInterceptorController = class ImageFormulaCellInterceptorCon
|
|
|
573
573
|
const updateRuntimeImageFormulaData = await Promise.all(imageFormulaData.map((imageFormulaInfo) => {
|
|
574
574
|
return this._getImageNatureSize(imageFormulaInfo);
|
|
575
575
|
}));
|
|
576
|
-
const unitImageFormulaData =
|
|
576
|
+
const unitImageFormulaData = Object.create(null);
|
|
577
577
|
updateRuntimeImageFormulaData.forEach((imageFormulaInfo) => {
|
|
578
578
|
const { unitId, sheetId, row, column, ...imageInfo } = imageFormulaInfo;
|
|
579
|
-
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] =
|
|
579
|
+
if (!unitImageFormulaData[unitId]) unitImageFormulaData[unitId] = Object.create(null);
|
|
580
580
|
if (!unitImageFormulaData[unitId][sheetId]) unitImageFormulaData[unitId][sheetId] = new ObjectMatrix();
|
|
581
581
|
unitImageFormulaData[unitId][sheetId].setValue(row, column, imageInfo);
|
|
582
582
|
});
|
|
@@ -1169,8 +1169,8 @@ function getFormulaReferenceRange(oldFormulaData, newFormulaData, formulaReferen
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMoveParam) {
|
|
1171
1171
|
var _formulaReferenceMove, _formulaReferenceMove2;
|
|
1172
|
-
const redoFormulaData =
|
|
1173
|
-
const undoFormulaData =
|
|
1172
|
+
const redoFormulaData = Object.create(null);
|
|
1173
|
+
const undoFormulaData = Object.create(null);
|
|
1174
1174
|
const { unitId: fromUnitId, sheetId: fromSheetId } = formulaReferenceMoveParam;
|
|
1175
1175
|
const targetUnitId = (_formulaReferenceMove = formulaReferenceMoveParam.targetUnitId) !== null && _formulaReferenceMove !== void 0 ? _formulaReferenceMove : fromUnitId;
|
|
1176
1176
|
const targetSheetId = (_formulaReferenceMove2 = formulaReferenceMoveParam.targetSheetId) !== null && _formulaReferenceMove2 !== void 0 ? _formulaReferenceMove2 : fromSheetId;
|
|
@@ -1188,8 +1188,8 @@ function refRangeFormula(oldFormulaData, newFormulaData, formulaReferenceMovePar
|
|
|
1188
1188
|
else rangeList = processFormulaChanges(oldFormulaMatrix, newFormulaMatrix, formulaReferenceMoveParam);
|
|
1189
1189
|
const sheetRedoFormulaData = getRedoFormulaData(rangeList, oldFormulaMatrix, newFormulaMatrix);
|
|
1190
1190
|
const sheetUndoFormulaData = getUndoFormulaData(rangeList, oldFormulaMatrix);
|
|
1191
|
-
if (!redoFormulaData[unitId]) redoFormulaData[unitId] =
|
|
1192
|
-
if (!undoFormulaData[unitId]) undoFormulaData[unitId] =
|
|
1191
|
+
if (!redoFormulaData[unitId]) redoFormulaData[unitId] = Object.create(null);
|
|
1192
|
+
if (!undoFormulaData[unitId]) undoFormulaData[unitId] = Object.create(null);
|
|
1193
1193
|
redoFormulaData[unitId][currentSheetId] = {
|
|
1194
1194
|
...redoFormulaData[unitId][currentSheetId],
|
|
1195
1195
|
...sheetRedoFormulaData
|
|
@@ -2387,7 +2387,7 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
_handleWorkbookAdded(unit) {
|
|
2389
2389
|
var _config$initialFormul;
|
|
2390
|
-
const formulaData =
|
|
2390
|
+
const formulaData = Object.create(null);
|
|
2391
2391
|
const unitId = unit.getUnitId();
|
|
2392
2392
|
const newFormulaData = { [unitId]: {} };
|
|
2393
2393
|
unit.getSheets().forEach((worksheet) => {
|
|
@@ -2407,11 +2407,11 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2407
2407
|
return {
|
|
2408
2408
|
forceCalculation: calculationMode === 0,
|
|
2409
2409
|
dirtyRanges: calculationMode === 1 ? this._formulaDataModel.getFormulaDirtyRanges() : [],
|
|
2410
|
-
dirtyNameMap:
|
|
2411
|
-
dirtyDefinedNameMap:
|
|
2412
|
-
dirtyUnitFeatureMap:
|
|
2413
|
-
dirtyUnitOtherFormulaMap:
|
|
2414
|
-
clearDependencyTreeCache:
|
|
2410
|
+
dirtyNameMap: Object.create(null),
|
|
2411
|
+
dirtyDefinedNameMap: Object.create(null),
|
|
2412
|
+
dirtyUnitFeatureMap: Object.create(null),
|
|
2413
|
+
dirtyUnitOtherFormulaMap: Object.create(null),
|
|
2414
|
+
clearDependencyTreeCache: Object.create(null)
|
|
2415
2415
|
};
|
|
2416
2416
|
}
|
|
2417
2417
|
_getUpdateFormula(command) {
|
|
@@ -2440,14 +2440,14 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2440
2440
|
if (!Tools.isDefine(formulaData)) return { newFormulaData: {} };
|
|
2441
2441
|
const formulaDataKeys = Object.keys(formulaData);
|
|
2442
2442
|
if (formulaDataKeys.length === 0) return { newFormulaData: {} };
|
|
2443
|
-
const newFormulaData =
|
|
2443
|
+
const newFormulaData = Object.create(null);
|
|
2444
2444
|
const { unitId: fromUnitId, sheetId: fromSheetId, sheetName: fromSheetName, targetUnitId, targetSheetId, type, from, to } = formulaReferenceMoveParam;
|
|
2445
2445
|
const inCrossSheetCutRangeNewFormulas = [];
|
|
2446
2446
|
for (const unitId of formulaDataKeys) {
|
|
2447
2447
|
const sheetData = formulaData[unitId];
|
|
2448
2448
|
if (sheetData == null) continue;
|
|
2449
2449
|
const sheetDataKeys = Object.keys(sheetData);
|
|
2450
|
-
if (!Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] =
|
|
2450
|
+
if (!Tools.isDefine(newFormulaData[unitId])) newFormulaData[unitId] = Object.create(null);
|
|
2451
2451
|
for (const sheetId of sheetDataKeys) {
|
|
2452
2452
|
const matrixData = new ObjectMatrix(sheetData[sheetId] || {});
|
|
2453
2453
|
const newFormulaDataItem = new ObjectMatrix();
|
|
@@ -2591,14 +2591,14 @@ let UpdateFormulaController = class UpdateFormulaController extends Disposable {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
}
|
|
2593
2593
|
if (inCrossSheetCutRangeNewFormulas.length > 0 && targetUnitId && targetSheetId) {
|
|
2594
|
-
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] =
|
|
2595
|
-
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] =
|
|
2594
|
+
if (!newFormulaData[targetUnitId]) newFormulaData[targetUnitId] = Object.create(null);
|
|
2595
|
+
if (!newFormulaData[targetUnitId][targetSheetId]) newFormulaData[targetUnitId][targetSheetId] = Object.create(null);
|
|
2596
2596
|
for (const newFormula of inCrossSheetCutRangeNewFormulas) {
|
|
2597
2597
|
var _to$startRow, _from$startRow, _to$startColumn, _from$startColumn;
|
|
2598
2598
|
const { fromRow, fromColumn, formulaString } = newFormula;
|
|
2599
2599
|
const targetRow = fromRow + (((_to$startRow = to === null || to === void 0 ? void 0 : to.startRow) !== null && _to$startRow !== void 0 ? _to$startRow : 0) - ((_from$startRow = from === null || from === void 0 ? void 0 : from.startRow) !== null && _from$startRow !== void 0 ? _from$startRow : 0));
|
|
2600
2600
|
const targetColumn = fromColumn + (((_to$startColumn = to === null || to === void 0 ? void 0 : to.startColumn) !== null && _to$startColumn !== void 0 ? _to$startColumn : 0) - ((_from$startColumn = from === null || from === void 0 ? void 0 : from.startColumn) !== null && _from$startColumn !== void 0 ? _from$startColumn : 0));
|
|
2601
|
-
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] =
|
|
2601
|
+
if (!newFormulaData[targetUnitId][targetSheetId][targetRow]) newFormulaData[targetUnitId][targetSheetId][targetRow] = Object.create(null);
|
|
2602
2602
|
newFormulaData[targetUnitId][targetSheetId][targetRow][targetColumn] = { f: formulaString };
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
@@ -2629,7 +2629,7 @@ function tableReferenceContainsColumn(columnStruct, columnNames) {
|
|
|
2629
2629
|
//#endregion
|
|
2630
2630
|
//#region package.json
|
|
2631
2631
|
var name = "@univerjs/sheets-formula";
|
|
2632
|
-
var version = "0.25.
|
|
2632
|
+
var version = "0.25.2";
|
|
2633
2633
|
|
|
2634
2634
|
//#endregion
|
|
2635
2635
|
//#region src/common/plugin-name.ts
|
|
@@ -2921,16 +2921,16 @@ let ActiveDirtyController = class ActiveDirtyController extends Disposable {
|
|
|
2921
2921
|
return dirtyRanges;
|
|
2922
2922
|
}
|
|
2923
2923
|
_getRemoveSheetMutation(params) {
|
|
2924
|
-
const dirtyNameMap =
|
|
2924
|
+
const dirtyNameMap = Object.create(null);
|
|
2925
2925
|
const { subUnitId: sheetId, unitId, subUnitName } = params;
|
|
2926
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2926
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2927
2927
|
dirtyNameMap[unitId][sheetId] = subUnitName;
|
|
2928
2928
|
return dirtyNameMap;
|
|
2929
2929
|
}
|
|
2930
2930
|
_getInsertSheetMutation(params) {
|
|
2931
|
-
const dirtyNameMap =
|
|
2931
|
+
const dirtyNameMap = Object.create(null);
|
|
2932
2932
|
const { sheet, unitId } = params;
|
|
2933
|
-
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] =
|
|
2933
|
+
if (dirtyNameMap[unitId] == null) dirtyNameMap[unitId] = Object.create(null);
|
|
2934
2934
|
dirtyNameMap[unitId][sheet.id] = sheet.name;
|
|
2935
2935
|
return dirtyNameMap;
|
|
2936
2936
|
}
|