@univerjs/engine-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 CHANGED
@@ -1486,11 +1486,11 @@ function isReferenceString(refString) {
1486
1486
  //#endregion
1487
1487
  //#region src/basics/runtime.ts
1488
1488
  function convertUnitDataToRuntime(unitData) {
1489
- const arrayFormulaCellData = {};
1489
+ const arrayFormulaCellData = Object.create(null);
1490
1490
  Object.keys(unitData).forEach((unitId) => {
1491
1491
  const sheetData = unitData[unitId];
1492
1492
  if (sheetData == null) return true;
1493
- if (arrayFormulaCellData[unitId] == null) arrayFormulaCellData[unitId] = {};
1493
+ if (arrayFormulaCellData[unitId] == null) arrayFormulaCellData[unitId] = Object.create(null);
1494
1494
  Object.keys(sheetData).forEach((sheetId) => {
1495
1495
  const cellData = sheetData[sheetId];
1496
1496
  arrayFormulaCellData[unitId][sheetId] = new _univerjs_core.ObjectMatrix(cellData);
@@ -1499,16 +1499,16 @@ function convertUnitDataToRuntime(unitData) {
1499
1499
  return arrayFormulaCellData;
1500
1500
  }
1501
1501
  function convertRuntimeToUnitData(unitData) {
1502
- const unitPrimitiveData = {};
1503
- for (const unitId in unitData) {
1502
+ const unitPrimitiveData = Object.create(null);
1503
+ for (const unitId of Object.keys(unitData)) {
1504
1504
  const sheetData = unitData[unitId];
1505
1505
  if (sheetData == null) continue;
1506
- if (unitPrimitiveData[unitId] == null) unitPrimitiveData[unitId] = {};
1507
- for (const sheetId in sheetData) {
1506
+ if (unitPrimitiveData[unitId] == null) unitPrimitiveData[unitId] = Object.create(null);
1507
+ for (const sheetId of Object.keys(sheetData)) {
1508
1508
  const cellData = sheetData[sheetId];
1509
- const primitiveData = {};
1509
+ const primitiveData = Object.create(null);
1510
1510
  cellData.forValue((row, column, value) => {
1511
- if (primitiveData[row] === void 0) primitiveData[row] = {};
1511
+ if (primitiveData[row] === void 0) primitiveData[row] = Object.create(null);
1512
1512
  primitiveData[row][column] = value;
1513
1513
  });
1514
1514
  unitPrimitiveData[unitId][sheetId] = primitiveData;
@@ -1516,6 +1516,12 @@ function convertRuntimeToUnitData(unitData) {
1516
1516
  }
1517
1517
  return unitPrimitiveData;
1518
1518
  }
1519
+ /** Copy the unit and sheet dictionaries without retaining inherited identifier keys. */
1520
+ function copyUnitData(data) {
1521
+ const result = Object.create(null);
1522
+ for (const unitId of Object.keys(data)) if (data[unitId] != null) result[unitId] = Object.assign(Object.create(null), data[unitId]);
1523
+ return result;
1524
+ }
1519
1525
 
1520
1526
  //#endregion
1521
1527
  //#region src/basics/token-type.ts
@@ -1899,8 +1905,8 @@ let DefinedNamesService = class DefinedNamesService extends _univerjs_core.Dispo
1899
1905
  constructor(_univerInstanceService) {
1900
1906
  super();
1901
1907
  this._univerInstanceService = _univerInstanceService;
1902
- _defineProperty(this, "_definedNameMap", {});
1903
- _defineProperty(this, "_nameCacheMap", {});
1908
+ _defineProperty(this, "_definedNameMap", Object.create(null));
1909
+ _defineProperty(this, "_nameCacheMap", Object.create(null));
1904
1910
  _defineProperty(this, "_definedNamesIsEmpty", true);
1905
1911
  _defineProperty(this, "_update$", new rxjs.Subject());
1906
1912
  _defineProperty(this, "update$", this._update$.asObservable());
@@ -1921,8 +1927,8 @@ let DefinedNamesService = class DefinedNamesService extends _univerjs_core.Dispo
1921
1927
  }
1922
1928
  dispose() {
1923
1929
  super.dispose();
1924
- this._definedNameMap = {};
1925
- this._nameCacheMap = {};
1930
+ this._definedNameMap = Object.create(null);
1931
+ this._nameCacheMap = Object.create(null);
1926
1932
  this._update$.complete();
1927
1933
  this._currentRange$.complete();
1928
1934
  this._focusRange$.complete();
@@ -1951,7 +1957,7 @@ let DefinedNamesService = class DefinedNamesService extends _univerjs_core.Dispo
1951
1957
  return serializeRange(this._currentRange.range);
1952
1958
  }
1953
1959
  registerDefinedNames(unitId, params) {
1954
- this._definedNameMap[unitId] = params;
1960
+ this._definedNameMap[unitId] = Object.assign(Object.create(null), params);
1955
1961
  this._updateCache(unitId);
1956
1962
  const definedNames = Object.values(params);
1957
1963
  this._update({
@@ -1962,7 +1968,7 @@ let DefinedNamesService = class DefinedNamesService extends _univerjs_core.Dispo
1962
1968
  if (definedNames.length > 0) this._definedNamesIsEmpty = false;
1963
1969
  }
1964
1970
  registerDefinedName(unitId, param) {
1965
- if (this._definedNameMap[unitId] === void 0) this._definedNameMap[unitId] = {};
1971
+ if (this._definedNameMap[unitId] === void 0) this._definedNameMap[unitId] = Object.create(null);
1966
1972
  this._definedNameMap[unitId][param.id] = param;
1967
1973
  this._updateCache(unitId);
1968
1974
  this._update({
@@ -2043,7 +2049,7 @@ let DefinedNamesService = class DefinedNamesService extends _univerjs_core.Dispo
2043
2049
  delete this._nameCacheMap[unitId];
2044
2050
  return;
2045
2051
  }
2046
- this._nameCacheMap[unitId] = {};
2052
+ this._nameCacheMap[unitId] = Object.create(null);
2047
2053
  for (const item of Object.values(nameMap)) this._nameCacheMap[unitId][item.name.toLowerCase()] = item;
2048
2054
  }
2049
2055
  _isDeepDefinedNameMapEmpty() {
@@ -4872,15 +4878,15 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
4872
4878
  super();
4873
4879
  this._univerInstanceService = _univerInstanceService;
4874
4880
  this._lexerTreeBuilder = _lexerTreeBuilder;
4875
- _defineProperty(this, "_arrayFormulaRange", {});
4876
- _defineProperty(this, "_arrayFormulaCellData", {});
4877
- _defineProperty(this, "_unitImageFormulaData", {});
4881
+ _defineProperty(this, "_arrayFormulaRange", Object.create(null));
4882
+ _defineProperty(this, "_arrayFormulaCellData", Object.create(null));
4883
+ _defineProperty(this, "_unitImageFormulaData", Object.create(null));
4878
4884
  }
4879
4885
  dispose() {
4880
4886
  super.dispose();
4881
- this._arrayFormulaRange = {};
4882
- this._arrayFormulaCellData = {};
4883
- this._unitImageFormulaData = {};
4887
+ this._arrayFormulaRange = Object.create(null);
4888
+ this._arrayFormulaCellData = Object.create(null);
4889
+ this._unitImageFormulaData = Object.create(null);
4884
4890
  }
4885
4891
  clearPreviousArrayFormulaCellData(clearArrayFormulaCellData) {
4886
4892
  Object.keys(clearArrayFormulaCellData).forEach((unitId) => {
@@ -4912,8 +4918,8 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
4912
4918
  Object.keys(unitData).forEach((unitId) => {
4913
4919
  const sheetData = unitData[unitId];
4914
4920
  if (sheetData == null) return true;
4915
- if (this._arrayFormulaRange[unitId] == null) this._arrayFormulaRange[unitId] = {};
4916
- if (this._arrayFormulaCellData[unitId] == null) this._arrayFormulaCellData[unitId] = {};
4921
+ if (this._arrayFormulaRange[unitId] == null) this._arrayFormulaRange[unitId] = Object.create(null);
4922
+ if (this._arrayFormulaCellData[unitId] == null) this._arrayFormulaCellData[unitId] = Object.create(null);
4917
4923
  Object.keys(sheetData).forEach((sheetId) => {
4918
4924
  var _this$_arrayFormulaRa2, _this$_arrayFormulaCe3;
4919
4925
  const cellMatrixData = sheetData[sheetId];
@@ -4937,12 +4943,12 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
4937
4943
  });
4938
4944
  }
4939
4945
  getFormulaData() {
4940
- const formulaData = {};
4946
+ const formulaData = Object.create(null);
4941
4947
  const allSheets = this._univerInstanceService.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
4942
4948
  if (allSheets.length === 0) return formulaData;
4943
4949
  allSheets.forEach((workbook) => {
4944
4950
  const unitId = workbook.getUnitId();
4945
- formulaData[unitId] = {};
4951
+ formulaData[unitId] = Object.create(null);
4946
4952
  workbook.getSheets().forEach((worksheet) => {
4947
4953
  const cellMatrix = worksheet.getCellMatrix();
4948
4954
  initSheetFormulaData(formulaData, unitId, worksheet.getSheetId(), cellMatrix);
@@ -4951,10 +4957,10 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
4951
4957
  return formulaData;
4952
4958
  }
4953
4959
  getSheetFormulaData(unitId, sheetId) {
4954
- const formulaData = {};
4960
+ const formulaData = Object.create(null);
4955
4961
  const workbook = this._univerInstanceService.getUnit(unitId);
4956
4962
  if (workbook == null) return {};
4957
- formulaData[unitId] = {};
4963
+ formulaData[unitId] = Object.create(null);
4958
4964
  const worksheet = workbook.getSheetBySheetId(sheetId);
4959
4965
  if (worksheet == null) return {};
4960
4966
  initSheetFormulaData(formulaData, unitId, sheetId, worksheet.getCellMatrix());
@@ -4964,25 +4970,25 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
4964
4970
  return this._arrayFormulaRange;
4965
4971
  }
4966
4972
  setArrayFormulaRange(value) {
4967
- this._arrayFormulaRange = value;
4973
+ this._arrayFormulaRange = copyUnitData(value);
4968
4974
  }
4969
4975
  getArrayFormulaCellData() {
4970
4976
  return this._arrayFormulaCellData;
4971
4977
  }
4972
4978
  setArrayFormulaCellData(value) {
4973
- this._arrayFormulaCellData = value;
4979
+ this._arrayFormulaCellData = copyUnitData(value);
4974
4980
  }
4975
4981
  getUnitImageFormulaData() {
4976
4982
  return this._unitImageFormulaData;
4977
4983
  }
4978
4984
  setUnitImageFormulaData(value) {
4979
- this._unitImageFormulaData = value;
4985
+ this._unitImageFormulaData = copyUnitData(value);
4980
4986
  }
4981
4987
  mergeArrayFormulaRange(formulaData) {
4982
4988
  Object.keys(formulaData).forEach((unitId) => {
4983
4989
  const sheetData = formulaData[unitId];
4984
4990
  if (sheetData == null) return true;
4985
- if (!this._arrayFormulaRange[unitId]) this._arrayFormulaRange[unitId] = {};
4991
+ if (!this._arrayFormulaRange[unitId]) this._arrayFormulaRange[unitId] = Object.create(null);
4986
4992
  Object.keys(sheetData).forEach((sheetId) => {
4987
4993
  var _this$_arrayFormulaRa3;
4988
4994
  const arrayFormula = new _univerjs_core.ObjectMatrix(sheetData[sheetId]);
@@ -5000,7 +5006,7 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5000
5006
  const unitId = unitIds[i];
5001
5007
  const sheetData = formulaData[unitId];
5002
5008
  if (!sheetData) continue;
5003
- if (!this._unitImageFormulaData[unitId]) this._unitImageFormulaData[unitId] = {};
5009
+ if (!this._unitImageFormulaData[unitId]) this._unitImageFormulaData[unitId] = Object.create(null);
5004
5010
  const sheetIds = Object.keys(sheetData);
5005
5011
  for (let j = 0; j < sheetIds.length; j++) {
5006
5012
  const sheetId = sheetIds[j];
@@ -5025,14 +5031,14 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5025
5031
  }
5026
5032
  getCalculateData() {
5027
5033
  const unitAllSheet = this._univerInstanceService.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
5028
- const allUnitData = {};
5029
- const unitStylesData = {};
5030
- const unitSheetNameMap = {};
5034
+ const allUnitData = Object.create(null);
5035
+ const unitStylesData = Object.create(null);
5036
+ const unitSheetNameMap = Object.create(null);
5031
5037
  for (const workbook of unitAllSheet) {
5032
5038
  const unitId = workbook.getUnitId();
5033
5039
  const sheets = workbook.getSheets();
5034
- const sheetData = {};
5035
- const sheetNameMap = {};
5040
+ const sheetData = Object.create(null);
5041
+ const sheetNameMap = Object.create(null);
5036
5042
  for (const sheet of sheets) {
5037
5043
  const sheetId = sheet.getSheetId();
5038
5044
  const sheetConfig = sheet.getConfig();
@@ -5064,17 +5070,17 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5064
5070
  */
5065
5071
  getHiddenRowsFiltered() {
5066
5072
  const unitAllSheet = this._univerInstanceService.getAllUnitsForType(_univerjs_core.UniverInstanceType.UNIVER_SHEET);
5067
- const rowData = {};
5073
+ const rowData = Object.create(null);
5068
5074
  for (const workbook of unitAllSheet) {
5069
5075
  const unitId = workbook.getUnitId();
5070
5076
  const sheets = workbook.getSheets();
5071
- rowData[unitId] = {};
5077
+ rowData[unitId] = Object.create(null);
5072
5078
  for (const sheet of sheets) {
5073
5079
  const sheetId = sheet.getSheetId();
5074
- rowData[unitId][sheetId] = {};
5080
+ rowData[unitId][sheetId] = Object.create(null);
5075
5081
  const startRow = 0;
5076
5082
  const endRow = sheet.getRowCount() - 1;
5077
- const sheetRowData = {};
5083
+ const sheetRowData = Object.create(null);
5078
5084
  for (let i = startRow; i <= endRow; i++) if (!sheet.getRowVisible(i)) sheetRowData[i] = { hd: _univerjs_core.BooleanNumber.TRUE };
5079
5085
  rowData[unitId][sheetId] = sheetRowData;
5080
5086
  }
@@ -5086,9 +5092,9 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5086
5092
  const formulaIdMap = this._getSheetFormulaIdMap(unitId, sheetId);
5087
5093
  const deleteFormulaIdMap = /* @__PURE__ */ new Map();
5088
5094
  const formulaData = this.getFormulaData();
5089
- if (formulaData[unitId] == null) formulaData[unitId] = {};
5095
+ if (formulaData[unitId] == null) formulaData[unitId] = Object.create(null);
5090
5096
  const workbookFormulaData = formulaData[unitId];
5091
- if (workbookFormulaData[sheetId] == null) workbookFormulaData[sheetId] = {};
5097
+ if (workbookFormulaData[sheetId] == null) workbookFormulaData[sheetId] = Object.create(null);
5092
5098
  const sheetFormulaDataMatrix = new _univerjs_core.ObjectMatrix(workbookFormulaData[sheetId] || {});
5093
5099
  const newSheetFormulaDataMatrix = new _univerjs_core.ObjectMatrix();
5094
5100
  cellMatrix.forValue((r, c, cell) => {
@@ -5234,7 +5240,7 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5234
5240
  if (!sheet) continue;
5235
5241
  const sheetInstance = workbookInstance.getSheetBySheetId(sheetId);
5236
5242
  if (!sheetInstance) continue;
5237
- const columnRanges = {};
5243
+ const columnRanges = Object.create(null);
5238
5244
  for (const rowStr of Object.keys(sheet)) {
5239
5245
  const row = Number(rowStr);
5240
5246
  for (const columnStr in sheet[row]) {
@@ -5274,7 +5280,7 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5274
5280
  return dirtyRanges;
5275
5281
  }
5276
5282
  _getSheetFormulaIdMap(unitId, sheetId) {
5277
- const formulaIdMap = {};
5283
+ const formulaIdMap = Object.create(null);
5278
5284
  const workbook = this._univerInstanceService.getUnit(unitId);
5279
5285
  if (workbook == null) return formulaIdMap;
5280
5286
  const worksheet = workbook.getSheetBySheetId(sheetId);
@@ -5293,10 +5299,16 @@ let FormulaDataModel = class FormulaDataModel extends _univerjs_core.Disposable
5293
5299
  };
5294
5300
  FormulaDataModel = __decorate([__decorateParam(0, _univerjs_core.IUniverInstanceService), __decorateParam(1, (0, _univerjs_core.Inject)(LexerTreeBuilder))], FormulaDataModel);
5295
5301
  function initSheetFormulaData(formulaData, unitId, sheetId, cellMatrix) {
5296
- if (!formulaData[unitId]) formulaData[unitId] = {};
5297
- if (!formulaData[unitId][sheetId]) formulaData[unitId][sheetId] = {};
5302
+ const unitData = Object.assign(Object.create(null), Object.prototype.hasOwnProperty.call(formulaData, unitId) ? formulaData[unitId] : void 0);
5303
+ Object.defineProperty(formulaData, unitId, {
5304
+ value: unitData,
5305
+ writable: true,
5306
+ configurable: true,
5307
+ enumerable: true
5308
+ });
5309
+ if (!unitData[sheetId]) unitData[sheetId] = Object.create(null);
5298
5310
  const formulaIdMap = /* @__PURE__ */ new Map();
5299
- const sheetFormulaDataMatrix = new _univerjs_core.ObjectMatrix(formulaData[unitId][sheetId]);
5311
+ const sheetFormulaDataMatrix = new _univerjs_core.ObjectMatrix(unitData[sheetId]);
5300
5312
  cellMatrix.forValue((r, c, cell) => {
5301
5313
  const formulaString = (cell === null || cell === void 0 ? void 0 : cell.f) || "";
5302
5314
  const formulaId = (cell === null || cell === void 0 ? void 0 : cell.si) || "";
@@ -5382,42 +5394,42 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5382
5394
  this._localeService = _localeService;
5383
5395
  this._formulaDataModel = _formulaDataModel;
5384
5396
  this._sheetRowFilteredService = _sheetRowFilteredService;
5385
- _defineProperty(this, "_unitData", {});
5386
- _defineProperty(this, "_unitStylesData", {});
5387
- _defineProperty(this, "_arrayFormulaCellData", {});
5388
- _defineProperty(this, "_arrayFormulaRange", {});
5389
- _defineProperty(this, "_formulaData", {});
5390
- _defineProperty(this, "_sheetNameMap", {});
5397
+ _defineProperty(this, "_unitData", Object.create(null));
5398
+ _defineProperty(this, "_unitStylesData", Object.create(null));
5399
+ _defineProperty(this, "_arrayFormulaCellData", Object.create(null));
5400
+ _defineProperty(this, "_arrayFormulaRange", Object.create(null));
5401
+ _defineProperty(this, "_formulaData", Object.create(null));
5402
+ _defineProperty(this, "_sheetNameMap", Object.create(null));
5391
5403
  _defineProperty(this, "_forceCalculate", false);
5392
- _defineProperty(this, "_clearDependencyTreeCache", {});
5404
+ _defineProperty(this, "_clearDependencyTreeCache", Object.create(null));
5393
5405
  _defineProperty(this, "_dirtyRanges", []);
5394
- _defineProperty(this, "_dirtyNameMap", {});
5395
- _defineProperty(this, "_dirtyDefinedNameMap", {});
5396
- _defineProperty(this, "_dirtySuperTableMap", {});
5397
- _defineProperty(this, "_dirtyUnitFeatureMap", {});
5398
- _defineProperty(this, "_dirtyUnitOtherFormulaMap", {});
5406
+ _defineProperty(this, "_dirtyNameMap", Object.create(null));
5407
+ _defineProperty(this, "_dirtyDefinedNameMap", Object.create(null));
5408
+ _defineProperty(this, "_dirtySuperTableMap", Object.create(null));
5409
+ _defineProperty(this, "_dirtyUnitFeatureMap", Object.create(null));
5410
+ _defineProperty(this, "_dirtyUnitOtherFormulaMap", Object.create(null));
5399
5411
  _defineProperty(this, "_excludedCell", void 0);
5400
- _defineProperty(this, "_sheetIdToNameMap", {});
5412
+ _defineProperty(this, "_sheetIdToNameMap", Object.create(null));
5401
5413
  _defineProperty(this, "_executeUnitId", "");
5402
5414
  _defineProperty(this, "_executeSubUnitId", "");
5403
5415
  }
5404
5416
  dispose() {
5405
5417
  super.dispose();
5406
- this._unitData = {};
5407
- this._unitStylesData = {};
5408
- this._arrayFormulaCellData = {};
5409
- this._arrayFormulaRange = {};
5410
- this._formulaData = {};
5411
- this._sheetNameMap = {};
5412
- this._clearDependencyTreeCache = {};
5418
+ this._unitData = Object.create(null);
5419
+ this._unitStylesData = Object.create(null);
5420
+ this._arrayFormulaCellData = Object.create(null);
5421
+ this._arrayFormulaRange = Object.create(null);
5422
+ this._formulaData = Object.create(null);
5423
+ this._sheetNameMap = Object.create(null);
5424
+ this._clearDependencyTreeCache = Object.create(null);
5413
5425
  this._dirtyRanges = [];
5414
- this._dirtyNameMap = {};
5415
- this._dirtyDefinedNameMap = {};
5416
- this._dirtySuperTableMap = {};
5417
- this._dirtyUnitFeatureMap = {};
5418
- this._dirtyUnitOtherFormulaMap = {};
5419
- this._excludedCell = {};
5420
- this._sheetIdToNameMap = {};
5426
+ this._dirtyNameMap = Object.create(null);
5427
+ this._dirtyDefinedNameMap = Object.create(null);
5428
+ this._dirtySuperTableMap = Object.create(null);
5429
+ this._dirtyUnitFeatureMap = Object.create(null);
5430
+ this._dirtyUnitOtherFormulaMap = Object.create(null);
5431
+ this._excludedCell = Object.create(null);
5432
+ this._sheetIdToNameMap = Object.create(null);
5421
5433
  }
5422
5434
  getExecuteUnitId() {
5423
5435
  return this._executeUnitId;
@@ -5478,7 +5490,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5478
5490
  return this._sheetIdToNameMap[unitId][sheetId] || "";
5479
5491
  }
5480
5492
  setSheetNameMap(sheetIdToNameMap) {
5481
- this._sheetIdToNameMap = sheetIdToNameMap;
5493
+ this._sheetIdToNameMap = copyUnitData(sheetIdToNameMap);
5482
5494
  }
5483
5495
  getClearDependencyTreeCache() {
5484
5496
  return this._clearDependencyTreeCache;
@@ -5514,14 +5526,14 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5514
5526
  }
5515
5527
  load(config) {
5516
5528
  if (config.allUnitData && config.unitSheetNameMap && config.unitStylesData) {
5517
- this._unitData = config.allUnitData;
5529
+ this._unitData = copyUnitData(config.allUnitData);
5518
5530
  this._unitStylesData = config.unitStylesData;
5519
- this._sheetNameMap = config.unitSheetNameMap;
5531
+ this._sheetNameMap = copyUnitData(config.unitSheetNameMap);
5520
5532
  } else {
5521
5533
  const { allUnitData, unitSheetNameMap, unitStylesData } = this._loadSheetData();
5522
- this._unitData = allUnitData;
5534
+ this._unitData = copyUnitData(allUnitData);
5523
5535
  this._unitStylesData = unitStylesData;
5524
- this._sheetNameMap = unitSheetNameMap;
5536
+ this._sheetNameMap = copyUnitData(unitSheetNameMap);
5525
5537
  }
5526
5538
  if (config.rowData) this._applyUnitRowData(config.rowData);
5527
5539
  this._formulaData = config.formulaData;
@@ -5540,9 +5552,9 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5540
5552
  }
5541
5553
  loadDataLite(rowData) {
5542
5554
  const { allUnitData, unitSheetNameMap, unitStylesData } = this._loadSheetData();
5543
- this._unitData = allUnitData;
5555
+ this._unitData = copyUnitData(allUnitData);
5544
5556
  this._unitStylesData = unitStylesData;
5545
- this._sheetNameMap = unitSheetNameMap;
5557
+ this._sheetNameMap = copyUnitData(unitSheetNameMap);
5546
5558
  this._formulaData = this._formulaDataModel.getFormulaData();
5547
5559
  this._arrayFormulaCellData = convertUnitDataToRuntime(this._formulaDataModel.getArrayFormulaCellData());
5548
5560
  this._arrayFormulaRange = this._formulaDataModel.getArrayFormulaRange();
@@ -5566,28 +5578,28 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5566
5578
  /**
5567
5579
  * Mark dirty for expansion of array formulas, need to clear the worksheet's dirty flag.
5568
5580
  */
5569
- this._dirtyNameMap = {};
5581
+ this._dirtyNameMap = Object.create(null);
5570
5582
  }
5571
5583
  registerUnitData(unitData) {
5572
- this._unitData = unitData;
5584
+ this._unitData = copyUnitData(unitData);
5573
5585
  }
5574
5586
  registerFormulaData(formulaData) {
5575
5587
  this._formulaData = formulaData;
5576
5588
  }
5577
5589
  registerSheetNameMap(sheetNameMap) {
5578
- this._sheetNameMap = sheetNameMap;
5590
+ this._sheetNameMap = copyUnitData(sheetNameMap);
5579
5591
  }
5580
5592
  _mergeNameMap(unitSheetNameMap, dirtyNameMap) {
5581
5593
  Object.keys(dirtyNameMap).forEach((unitId) => {
5582
5594
  if (dirtyNameMap[unitId]) Object.keys(dirtyNameMap[unitId]).forEach((sheetId) => {
5583
- if (unitSheetNameMap[unitId] == null) unitSheetNameMap[unitId] = {};
5595
+ if (unitSheetNameMap[unitId] == null) unitSheetNameMap[unitId] = Object.create(null);
5584
5596
  unitSheetNameMap[unitId][dirtyNameMap[unitId][sheetId]] = sheetId;
5585
5597
  });
5586
5598
  });
5587
- this._sheetIdToNameMap = {};
5599
+ this._sheetIdToNameMap = Object.create(null);
5588
5600
  Object.keys(unitSheetNameMap).forEach((unitId) => {
5589
5601
  Object.keys(unitSheetNameMap[unitId]).forEach((sheetName) => {
5590
- if (this._sheetIdToNameMap[unitId] == null) this._sheetIdToNameMap[unitId] = {};
5602
+ if (this._sheetIdToNameMap[unitId] == null) this._sheetIdToNameMap[unitId] = Object.create(null);
5591
5603
  this._sheetIdToNameMap[unitId][unitSheetNameMap[unitId][sheetName]] = sheetName;
5592
5604
  });
5593
5605
  });
@@ -5604,11 +5616,11 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5604
5616
  * @param rowData
5605
5617
  */
5606
5618
  _applyUnitRowData(rowData) {
5607
- for (const unitId in rowData) {
5619
+ for (const unitId of Object.keys(rowData)) {
5608
5620
  if (rowData[unitId] == null) continue;
5609
- for (const sheetId in rowData[unitId]) {
5621
+ for (const sheetId of Object.keys(rowData[unitId])) {
5610
5622
  if (rowData[unitId][sheetId] == null) continue;
5611
- if (this._unitData[unitId] == null) this._unitData[unitId] = {};
5623
+ if (this._unitData[unitId] == null) this._unitData[unitId] = Object.create(null);
5612
5624
  if (this._unitData[unitId][sheetId] == null) this._unitData[unitId][sheetId] = {
5613
5625
  cellData: new _univerjs_core.ObjectMatrix({}),
5614
5626
  rowCount: 0,
@@ -9313,14 +9325,14 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9313
9325
  _defineProperty(this, "_currentColumnCount", Number.NEGATIVE_INFINITY);
9314
9326
  _defineProperty(this, "_currentSubUnitId", "");
9315
9327
  _defineProperty(this, "_currentUnitId", "");
9316
- _defineProperty(this, "_runtimeData", {});
9317
- _defineProperty(this, "_runtimeOtherData", {});
9318
- _defineProperty(this, "_unitArrayFormulaRange", {});
9319
- _defineProperty(this, "_unitArrayFormulaEmbeddedMap", {});
9320
- _defineProperty(this, "_runtimeArrayFormulaCellData", {});
9321
- _defineProperty(this, "_runtimeClearArrayFormulaCellData", {});
9322
- _defineProperty(this, "_runtimeFeatureRange", {});
9323
- _defineProperty(this, "_runtimeFeatureCellData", {});
9328
+ _defineProperty(this, "_runtimeData", Object.create(null));
9329
+ _defineProperty(this, "_runtimeOtherData", Object.create(null));
9330
+ _defineProperty(this, "_unitArrayFormulaRange", Object.create(null));
9331
+ _defineProperty(this, "_unitArrayFormulaEmbeddedMap", Object.create(null));
9332
+ _defineProperty(this, "_runtimeArrayFormulaCellData", Object.create(null));
9333
+ _defineProperty(this, "_runtimeClearArrayFormulaCellData", Object.create(null));
9334
+ _defineProperty(this, "_runtimeFeatureRange", Object.create(null));
9335
+ _defineProperty(this, "_runtimeFeatureCellData", Object.create(null));
9324
9336
  _defineProperty(this, "_runtimeImageFormulaData", []);
9325
9337
  _defineProperty(this, "_functionsExecutedState", 0);
9326
9338
  _defineProperty(this, "_functionDefinitionPrivacyVar", /* @__PURE__ */ new Map());
@@ -9353,8 +9365,8 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9353
9365
  dispose() {
9354
9366
  super.dispose();
9355
9367
  this.reset();
9356
- this._runtimeFeatureCellData = {};
9357
- this._runtimeFeatureRange = {};
9368
+ this._runtimeFeatureCellData = Object.create(null);
9369
+ this._runtimeFeatureRange = Object.create(null);
9358
9370
  this.clearReferenceAndNumberformatCache();
9359
9371
  }
9360
9372
  enableCycleDependency() {
@@ -9423,12 +9435,12 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9423
9435
  }
9424
9436
  reset() {
9425
9437
  this._formulaExecuteStage = 0;
9426
- this._runtimeData = {};
9427
- this._runtimeOtherData = {};
9428
- this._unitArrayFormulaRange = {};
9429
- this._unitArrayFormulaEmbeddedMap = {};
9430
- this._runtimeArrayFormulaCellData = {};
9431
- this._runtimeClearArrayFormulaCellData = {};
9438
+ this._runtimeData = Object.create(null);
9439
+ this._runtimeOtherData = Object.create(null);
9440
+ this._unitArrayFormulaRange = Object.create(null);
9441
+ this._unitArrayFormulaEmbeddedMap = Object.create(null);
9442
+ this._runtimeArrayFormulaCellData = Object.create(null);
9443
+ this._runtimeClearArrayFormulaCellData = Object.create(null);
9432
9444
  this._runtimeImageFormulaData = [];
9433
9445
  this._functionDefinitionPrivacyVar.clear();
9434
9446
  this.markedAsInitialFunctionsExecuted();
@@ -9463,9 +9475,9 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9463
9475
  setRuntimeOtherData(formulaId, x, y, functionVariant) {
9464
9476
  const subUnitId = this._currentSubUnitId;
9465
9477
  const unitId = this._currentUnitId;
9466
- if (this._runtimeOtherData[unitId] === void 0) this._runtimeOtherData[unitId] = {};
9478
+ if (this._runtimeOtherData[unitId] === void 0) this._runtimeOtherData[unitId] = Object.create(null);
9467
9479
  const unitData = this._runtimeOtherData[unitId];
9468
- if (unitData[subUnitId] === void 0 || unitData[subUnitId] === null) unitData[subUnitId] = {};
9480
+ if (unitData[subUnitId] === void 0 || unitData[subUnitId] === null) unitData[subUnitId] = Object.create(null);
9469
9481
  const subComponentData = unitData[subUnitId];
9470
9482
  let cellDatas = [];
9471
9483
  if (functionVariant.isReferenceObject() || functionVariant.isValueObject() && functionVariant.isArray()) {
@@ -9479,8 +9491,8 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9479
9491
  cellDatas[row][column] = value;
9480
9492
  });
9481
9493
  } else cellDatas = [[this._getValueObjectOfRuntimeData(functionVariant)]];
9482
- if (subComponentData[formulaId] === void 0 || subComponentData[formulaId] === null) subComponentData[formulaId] = {};
9483
- if (subComponentData[formulaId][y] === void 0 || subComponentData[formulaId][y] === null) subComponentData[formulaId][y] = {};
9494
+ if (subComponentData[formulaId] === void 0 || subComponentData[formulaId] === null) subComponentData[formulaId] = Object.create(null);
9495
+ if (subComponentData[formulaId][y] === void 0 || subComponentData[formulaId][y] === null) subComponentData[formulaId][y] = Object.create(null);
9484
9496
  subComponentData[formulaId][y][x] = cellDatas;
9485
9497
  }
9486
9498
  setRuntimeData(functionVariant) {
@@ -9490,19 +9502,19 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9490
9502
  const columnCount = this.currentColumnCount;
9491
9503
  const sheetId = this._currentSubUnitId;
9492
9504
  const unitId = this._currentUnitId;
9493
- if (this._runtimeData[unitId] == null) this._runtimeData[unitId] = {};
9505
+ if (this._runtimeData[unitId] == null) this._runtimeData[unitId] = Object.create(null);
9494
9506
  const unitData = this._runtimeData[unitId];
9495
9507
  if (unitData[sheetId] == null) unitData[sheetId] = new _univerjs_core.ObjectMatrix();
9496
9508
  const sheetData = unitData[sheetId];
9497
- if (this._unitArrayFormulaRange[unitId] == null) this._unitArrayFormulaRange[unitId] = {};
9509
+ if (this._unitArrayFormulaRange[unitId] == null) this._unitArrayFormulaRange[unitId] = Object.create(null);
9498
9510
  const arrayFormulaRange = this._unitArrayFormulaRange[unitId];
9499
- if (arrayFormulaRange[sheetId] === null || arrayFormulaRange[sheetId] === void 0) arrayFormulaRange[sheetId] = {};
9511
+ if (arrayFormulaRange[sheetId] === null || arrayFormulaRange[sheetId] === void 0) arrayFormulaRange[sheetId] = Object.create(null);
9500
9512
  const arrayData = new _univerjs_core.ObjectMatrix(arrayFormulaRange[sheetId]);
9501
- if (this._runtimeArrayFormulaCellData[unitId] === void 0) this._runtimeArrayFormulaCellData[unitId] = {};
9513
+ if (this._runtimeArrayFormulaCellData[unitId] === void 0) this._runtimeArrayFormulaCellData[unitId] = Object.create(null);
9502
9514
  const runtimeArrayFormulaCellData = this._runtimeArrayFormulaCellData[unitId];
9503
9515
  if (runtimeArrayFormulaCellData[sheetId] == null) runtimeArrayFormulaCellData[sheetId] = new _univerjs_core.ObjectMatrix();
9504
9516
  const runtimeArrayUnitData = runtimeArrayFormulaCellData[sheetId];
9505
- if (this._runtimeClearArrayFormulaCellData[unitId] === void 0) this._runtimeClearArrayFormulaCellData[unitId] = {};
9517
+ if (this._runtimeClearArrayFormulaCellData[unitId] === void 0) this._runtimeClearArrayFormulaCellData[unitId] = Object.create(null);
9506
9518
  const clearArrayFormulaCellData = this._runtimeClearArrayFormulaCellData[unitId];
9507
9519
  if (clearArrayFormulaCellData[sheetId] == null) clearArrayFormulaCellData[sheetId] = new _univerjs_core.ObjectMatrix();
9508
9520
  const clearArrayUnitData = clearArrayFormulaCellData[sheetId];
@@ -9615,9 +9627,9 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9615
9627
  const rowIndex = this._currentRow;
9616
9628
  const columnIndex = this._currentColumn;
9617
9629
  const arrayFormulaEmbeddedMap = this._unitArrayFormulaEmbeddedMap;
9618
- if (arrayFormulaEmbeddedMap[unitId] == null) arrayFormulaEmbeddedMap[unitId] = {};
9619
- if (arrayFormulaEmbeddedMap[unitId][sheetId] == null) arrayFormulaEmbeddedMap[unitId][sheetId] = {};
9620
- if (arrayFormulaEmbeddedMap[unitId][sheetId][rowIndex] == null) arrayFormulaEmbeddedMap[unitId][sheetId][rowIndex] = {};
9630
+ if (arrayFormulaEmbeddedMap[unitId] == null) arrayFormulaEmbeddedMap[unitId] = Object.create(null);
9631
+ if (arrayFormulaEmbeddedMap[unitId][sheetId] == null) arrayFormulaEmbeddedMap[unitId][sheetId] = Object.create(null);
9632
+ if (arrayFormulaEmbeddedMap[unitId][sheetId][rowIndex] == null) arrayFormulaEmbeddedMap[unitId][sheetId][rowIndex] = Object.create(null);
9621
9633
  arrayFormulaEmbeddedMap[unitId][sheetId][rowIndex][columnIndex] = true;
9622
9634
  }
9623
9635
  getRuntimeOtherData() {
@@ -12230,11 +12242,11 @@ const IFeatureCalculationManagerService = (0, _univerjs_core.createIdentifier)("
12230
12242
  var OtherFormulaManagerService = class extends _univerjs_core.Disposable {
12231
12243
  constructor(..._args) {
12232
12244
  super(..._args);
12233
- _defineProperty(this, "_otherFormulaData", {});
12245
+ _defineProperty(this, "_otherFormulaData", Object.create(null));
12234
12246
  }
12235
12247
  dispose() {
12236
12248
  super.dispose();
12237
- this._otherFormulaData = {};
12249
+ this._otherFormulaData = Object.create(null);
12238
12250
  }
12239
12251
  remove(searchParam) {
12240
12252
  var _this$_otherFormulaDa;
@@ -12253,8 +12265,8 @@ var OtherFormulaManagerService = class extends _univerjs_core.Disposable {
12253
12265
  }
12254
12266
  register(insertParam) {
12255
12267
  const { unitId, subUnitId, formulaId, item } = insertParam;
12256
- if (!this._otherFormulaData[unitId]) this._otherFormulaData[unitId] = {};
12257
- if (!this._otherFormulaData[unitId][subUnitId]) this._otherFormulaData[unitId][subUnitId] = {};
12268
+ if (!this._otherFormulaData[unitId]) this._otherFormulaData[unitId] = Object.create(null);
12269
+ if (!this._otherFormulaData[unitId][subUnitId]) this._otherFormulaData[unitId][subUnitId] = Object.create(null);
12258
12270
  this._otherFormulaData[unitId][subUnitId][formulaId] = item;
12259
12271
  }
12260
12272
  batchRegister(formulaData) {
@@ -13657,7 +13669,7 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
13657
13669
  }
13658
13670
  _getArrayFormulaDirtyRangeAndExcludedRange(arrayFormulaRange, runtimeFeatureRange) {
13659
13671
  const dirtyRanges = [];
13660
- const excludedCell = {};
13672
+ const excludedCell = Object.create(null);
13661
13673
  Object.keys(arrayFormulaRange).forEach((unitId) => {
13662
13674
  const sheetArrayFormulaRange = arrayFormulaRange[unitId];
13663
13675
  if (sheetArrayFormulaRange == null) return true;
@@ -13673,7 +13685,7 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
13673
13685
  range
13674
13686
  });
13675
13687
  });
13676
- if (excludedCell[unitId] == null) excludedCell[unitId] = {};
13688
+ if (excludedCell[unitId] == null) excludedCell[unitId] = Object.create(null);
13677
13689
  excludedCell[unitId][sheetId] = newCellData;
13678
13690
  });
13679
13691
  });
@@ -13779,21 +13791,21 @@ let CalculateFormulaService = class CalculateFormulaService extends _univerjs_co
13779
13791
  this._currentConfigService.loadDataLite(rowData);
13780
13792
  const unitData = this._currentConfigService.getUnitData();
13781
13793
  this._runtimeService.reset();
13782
- const result = {};
13794
+ const result = Object.create(null);
13783
13795
  for (const unitId of Object.keys(formulas)) {
13784
13796
  const sheetFormulas = formulas[unitId];
13785
13797
  if (sheetFormulas == null) continue;
13786
- result[unitId] = {};
13798
+ result[unitId] = Object.create(null);
13787
13799
  for (const sheetId of Object.keys(sheetFormulas)) {
13788
13800
  var _unitData$unitId;
13789
13801
  const rowFormulas = sheetFormulas[sheetId];
13790
13802
  if (rowFormulas == null) continue;
13791
13803
  const sheetItem = (_unitData$unitId = unitData[unitId]) === null || _unitData$unitId === void 0 ? void 0 : _unitData$unitId[sheetId];
13792
13804
  if (sheetItem == null) continue;
13793
- result[unitId][sheetId] = {};
13805
+ result[unitId][sheetId] = Object.create(null);
13794
13806
  for (const rowString of Object.keys(rowFormulas)) {
13795
13807
  const row = Number.parseInt(rowString);
13796
- result[unitId][sheetId][row] = {};
13808
+ result[unitId][sheetId][row] = Object.create(null);
13797
13809
  const cellData = rowFormulas[row];
13798
13810
  if (!cellData) continue;
13799
13811
  for (const columnString of Object.keys(cellData)) {
@@ -40468,7 +40480,7 @@ function getObjectValue(result, isUseStrip = false) {
40468
40480
  //#endregion
40469
40481
  //#region package.json
40470
40482
  var name = "@univerjs/engine-formula";
40471
- var version = "0.25.1";
40483
+ var version = "0.25.2";
40472
40484
 
40473
40485
  //#endregion
40474
40486
  //#region src/services/global-computing-status.service.ts