@univerjs/engine-formula 0.24.0 → 0.25.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/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AbsoluteRefType, AsyncLock, BooleanNumber, BuildTextUtils, CellValueType, CommandType, DataStreamTreeTokenType, Disposable, DisposableCollection, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, LRUMap, LifecycleService, LocaleService, LocaleType, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, Plugin, RANGE_TYPE, RTree, Rectangle, RichTextBuilder, Tools, UniverInstanceType, cellToRange, columnLabelToNumber, createIdentifier, generateRandomId, getNumfmtParseValueFilter, hashAlgorithm, isFormulaId, isFormulaString, isRealNum, isTextFormat, isValidRange, merge, moveRangeByOffset, numfmt, requestImmediateMacroTask, sortRules, toDisposable, touchDependencies } from "@univerjs/core";
1
+ import { AbsoluteRefType, AsyncLock, BooleanNumber, BuildTextUtils, CellValueType, CommandType, DataStreamTreeTokenType, Disposable, DisposableCollection, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, LRUMap, LifecycleService, LocaleService, LocaleType, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, Plugin, RANGE_TYPE, RTree, Rectangle, RichTextBuilder, Tools, UniverInstanceType, cellToRange, columnLabelToNumber, createIdentifier, escapeRegExp, generateRandomId, getNumfmtParseValueFilter, hashAlgorithm, isFormulaId, isFormulaString, isNullCell, isRealNum, isTextFormat, isValidRange, merge, moveRangeByOffset, numfmt, requestImmediateMacroTask, sortRules, toDisposable, touchDependencies } from "@univerjs/core";
2
2
  import IntervalTree from "@flatten-js/interval-tree";
3
3
  import { BehaviorSubject, Observable, Subject, bufferWhen, combineLatest, distinctUntilChanged, filter, map, shareReplay, skip } from "rxjs";
4
4
  import Decimal from "decimal.js";
@@ -12,7 +12,7 @@ let BooleanValue = /* @__PURE__ */ function(BooleanValue) {
12
12
  }({});
13
13
 
14
14
  //#endregion
15
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
15
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
16
16
  function _typeof(o) {
17
17
  "@babel/helpers - typeof";
18
18
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -23,7 +23,7 @@ function _typeof(o) {
23
23
  }
24
24
 
25
25
  //#endregion
26
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
26
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
27
27
  function toPrimitive(t, r) {
28
28
  if ("object" != _typeof(t) || !t) return t;
29
29
  var e = t[Symbol.toPrimitive];
@@ -36,14 +36,14 @@ function toPrimitive(t, r) {
36
36
  }
37
37
 
38
38
  //#endregion
39
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
39
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
40
40
  function toPropertyKey(t) {
41
41
  var i = toPrimitive(t, "string");
42
42
  return "symbol" == _typeof(i) ? i : i + "";
43
43
  }
44
44
 
45
45
  //#endregion
46
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
46
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
47
47
  function _defineProperty(e, r, t) {
48
48
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
49
49
  value: t,
@@ -845,7 +845,7 @@ function getWeekDayByDateSerialNumber(dateSerialNumber) {
845
845
  let date = excelSerialToDate(dateSerialNumber);
846
846
  const leapDayDateTime = Date.UTC(1900, 1, 28);
847
847
  const dateTime = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
848
- if (!isDate19000229 && dateTime <= leapDayDateTime) date = new Date(dateTime - perDayMilliseconds);
848
+ if (!isDate19000229 && dateTime <= leapDayDateTime) date = /* @__PURE__ */ new Date(dateTime - perDayMilliseconds);
849
849
  return date.getUTCDay();
850
850
  }
851
851
  function getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basis) {
@@ -1847,7 +1847,7 @@ function splitTableStructuredRef(ref) {
1847
1847
  }
1848
1848
 
1849
1849
  //#endregion
1850
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
1850
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
1851
1851
  function __decorateParam(paramIndex, decorator) {
1852
1852
  return function(target, key) {
1853
1853
  decorator(target, key, paramIndex);
@@ -1855,7 +1855,7 @@ function __decorateParam(paramIndex, decorator) {
1855
1855
  }
1856
1856
 
1857
1857
  //#endregion
1858
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
1858
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
1859
1859
  function __decorate(decorators, target, key, desc) {
1860
1860
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1861
1861
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -5363,6 +5363,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends Disp
5363
5363
  _defineProperty(this, "_dirtyRanges", []);
5364
5364
  _defineProperty(this, "_dirtyNameMap", {});
5365
5365
  _defineProperty(this, "_dirtyDefinedNameMap", {});
5366
+ _defineProperty(this, "_dirtySuperTableMap", {});
5366
5367
  _defineProperty(this, "_dirtyUnitFeatureMap", {});
5367
5368
  _defineProperty(this, "_dirtyUnitOtherFormulaMap", {});
5368
5369
  _defineProperty(this, "_excludedCell", void 0);
@@ -5382,6 +5383,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends Disp
5382
5383
  this._dirtyRanges = [];
5383
5384
  this._dirtyNameMap = {};
5384
5385
  this._dirtyDefinedNameMap = {};
5386
+ this._dirtySuperTableMap = {};
5385
5387
  this._dirtyUnitFeatureMap = {};
5386
5388
  this._dirtyUnitOtherFormulaMap = {};
5387
5389
  this._excludedCell = {};
@@ -5432,6 +5434,9 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends Disp
5432
5434
  getDirtyDefinedNameMap() {
5433
5435
  return this._dirtyDefinedNameMap;
5434
5436
  }
5437
+ getDirtySuperTableMap() {
5438
+ return this._dirtySuperTableMap;
5439
+ }
5435
5440
  getDirtyUnitFeatureMap() {
5436
5441
  return this._dirtyUnitFeatureMap;
5437
5442
  }
@@ -5497,6 +5502,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends Disp
5497
5502
  this._dirtyRanges = config.dirtyRanges;
5498
5503
  this._dirtyNameMap = config.dirtyNameMap;
5499
5504
  this._dirtyDefinedNameMap = config.dirtyDefinedNameMap;
5505
+ this._dirtySuperTableMap = config.dirtySuperTableMap || {};
5500
5506
  this._dirtyUnitFeatureMap = config.dirtyUnitFeatureMap;
5501
5507
  this._dirtyUnitOtherFormulaMap = config.dirtyUnitOtherFormulaMap;
5502
5508
  this._excludedCell = config.excludedCell;
@@ -5518,6 +5524,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends Disp
5518
5524
  dirtyRanges: this._dirtyRanges,
5519
5525
  dirtyNameMap: this._dirtyNameMap,
5520
5526
  dirtyDefinedNameMap: this._dirtyDefinedNameMap,
5527
+ dirtySuperTableMap: this._dirtySuperTableMap,
5521
5528
  dirtyUnitFeatureMap: this._dirtyUnitFeatureMap,
5522
5529
  dirtyUnitOtherFormulaMap: this._dirtyUnitOtherFormulaMap,
5523
5530
  clearDependencyTreeCache: this._clearDependencyTreeCache
@@ -5632,22 +5639,6 @@ Lexer = __decorate([
5632
5639
  __decorateParam(2, IFormulaCurrentConfigService)
5633
5640
  ], Lexer);
5634
5641
 
5635
- //#endregion
5636
- //#region src/basics/is-null-cell.ts
5637
- /**
5638
- * Examine if a cell is empty (null) in the formula-related modules. This is not
5639
- * interchangable with {@link isNullCell} from the core package, because for
5640
- * formulas, "custom" field is meaningless.
5641
- */
5642
- function isNullCellForFormula(cell) {
5643
- if (cell == null) return true;
5644
- const { v, f, si, p } = cell;
5645
- if (!(v == null || typeof v === "string" && v.length === 0)) return false;
5646
- if (f != null && f.length > 0 || si != null && si.length > 0) return false;
5647
- if (p != null) return false;
5648
- return true;
5649
- }
5650
-
5651
5642
  //#endregion
5652
5643
  //#region src/engine/utils/cell.ts
5653
5644
  function getCellValue(cell) {
@@ -5699,7 +5690,7 @@ function isWildcard(str) {
5699
5690
  return str.indexOf("*") > -1 || str.indexOf("?") > -1;
5700
5691
  }
5701
5692
  function isMatchWildcard(currentValue, value) {
5702
- const pattern = escapeRegExp(value).replace(/~?[*?]/g, (match) => {
5693
+ const pattern = escapeRegExpForWildcard(value).replace(/~?[*?]/g, (match) => {
5703
5694
  if (match.startsWith("~")) return `\\${match.substring(1)}`;
5704
5695
  if (match === "*") return ".*";
5705
5696
  if (match === "?") return ".";
@@ -5734,7 +5725,7 @@ function compareWithWildcard(currentValue, value, operator) {
5734
5725
  }
5735
5726
  return result;
5736
5727
  }
5737
- function escapeRegExp(str) {
5728
+ function escapeRegExpForWildcard(str) {
5738
5729
  return str.replace(/[.+^${}()|[\]\\]/g, "\\$&");
5739
5730
  }
5740
5731
  function getMatchModeValue(matchModeValue) {
@@ -5783,11 +5774,20 @@ const localeCurrencySymbolMap = new Map([
5783
5774
  [LocaleType.VI_VN, "₫"],
5784
5775
  [LocaleType.ZH_CN, "¥"],
5785
5776
  [LocaleType.ZH_TW, "NT$"],
5777
+ [LocaleType.ZH_HK, "HK$"],
5786
5778
  [LocaleType.FR_FR, "€"],
5787
5779
  [LocaleType.FA_IR, "﷼"],
5788
5780
  [LocaleType.KO_KR, "₩"],
5789
5781
  [LocaleType.ES_ES, "€"],
5790
- [LocaleType.CA_ES, "€"]
5782
+ [LocaleType.CA_ES, "€"],
5783
+ [LocaleType.SK_SK, "€"],
5784
+ [LocaleType.JA_JP, "¥"],
5785
+ [LocaleType.PT_BR, "R$"],
5786
+ [LocaleType.DE_DE, "€"],
5787
+ [LocaleType.IT_IT, "€"],
5788
+ [LocaleType.ID_ID, "Rp"],
5789
+ [LocaleType.PL_PL, "zł"],
5790
+ [LocaleType.AR_SA, "﷼"]
5791
5791
  ]);
5792
5792
  function getCurrencySymbol(locale) {
5793
5793
  return localeCurrencySymbolMap.get(locale) || "$";
@@ -8215,7 +8215,7 @@ var BaseReferenceObject = class extends ObjectClassType {
8215
8215
  if (r < 0 || c < 0) return callback(ErrorValueObject.create("#REF!"), r, c);
8216
8216
  const cell = this.getCellData(r, c);
8217
8217
  let result = false;
8218
- if (isNullCellForFormula(cell)) {
8218
+ if (isNullCell(cell)) {
8219
8219
  result = callback(null, r, c);
8220
8220
  continue;
8221
8221
  }
@@ -9662,10 +9662,10 @@ let FormulaRuntimeService = class FormulaRuntimeService extends Disposable {
9662
9662
  const currentCell = unitData === null || unitData === void 0 || (_unitData$formulaUnit = unitData[formulaUnitId]) === null || _unitData$formulaUnit === void 0 || (_unitData$formulaUnit = _unitData$formulaUnit[formulaSheetId]) === null || _unitData$formulaUnit === void 0 || (_unitData$formulaUnit = _unitData$formulaUnit.cellData) === null || _unitData$formulaUnit === void 0 ? void 0 : _unitData$formulaUnit.getValue(r, c);
9663
9663
  const featureCell = this._getRuntimeFeatureCellValue(r, c, formulaSheetId, formulaUnitId);
9664
9664
  const isPreviousCellOfCurrentArrayFormula = this._arrayCellHasData(arrayDataCell) && this._isInArrayFormulaRange(previousArrayFormulaRange, r, c) && (currentCell == null || this._isSameCellValue(currentCell, arrayDataCell));
9665
- const hasRuntimeCell = !isNullCellForFormula(cell);
9665
+ const hasRuntimeCell = !isNullCell(cell);
9666
9666
  const isInOtherArrayFormulaRange = this._isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c);
9667
- const currentCellBlocks = !isNullCellForFormula(currentCell) && !isPreviousCellOfCurrentArrayFormula;
9668
- const featureCellBlocks = !isNullCellForFormula(featureCell);
9667
+ const currentCellBlocks = !isNullCell(currentCell) && !isPreviousCellOfCurrentArrayFormula;
9668
+ const featureCellBlocks = !isNullCell(featureCell);
9669
9669
  if (hasRuntimeCell || isInOtherArrayFormulaRange || currentCellBlocks || featureCellBlocks) return true;
9670
9670
  }
9671
9671
  return false;
@@ -9938,9 +9938,11 @@ const COLUMN_LIKE_FUNCTION_NAMES = new Set(ALL_GROUPS.flatMap((g) => Object.valu
9938
9938
  //#region src/engine/utils/generate-ast-node.ts
9939
9939
  const FORMULA_CACHE_LRU_COUNT = 5e3;
9940
9940
  const FORMULA_AST_CACHE = new FormulaAstLRU(FORMULA_CACHE_LRU_COUNT);
9941
+ const DIRTY_DEFINED_NAME_SET_CACHE = /* @__PURE__ */ new WeakMap();
9942
+ const DIRTY_SUPER_TABLE_PATTERN_CACHE = /* @__PURE__ */ new WeakMap();
9941
9943
  function generateAstNode(unitId, formulaString, lexer, astTreeBuilder, currentConfigService) {
9942
9944
  let astNode = FORMULA_AST_CACHE.get(`${unitId}${formulaString}`);
9943
- const noCache = checkIsChangedByDefinedName(unitId, formulaString, currentConfigService);
9945
+ const noCache = checkIsChangedByDefinedName(unitId, formulaString, currentConfigService) || checkIsChangedBySuperTable(unitId, formulaString, currentConfigService);
9944
9946
  if (!noCache && astNode && !isDirtyDefinedForNode(astNode, currentConfigService)) return astNode;
9945
9947
  const lexerNode = lexer.treeBuilder(formulaString);
9946
9948
  if (ERROR_TYPE_SET.has(lexerNode)) return ErrorNode.create(lexerNode);
@@ -9955,14 +9957,37 @@ function generateAstNode(unitId, formulaString, lexer, astTreeBuilder, currentCo
9955
9957
  function checkIsChangedByDefinedName(unitId, formula, currentConfigService) {
9956
9958
  const unitDefinedNameMap = currentConfigService.getDirtyDefinedNameMap()[unitId];
9957
9959
  if (unitDefinedNameMap == null) return false;
9958
- const formulaText = normalizeFormulaText(formula);
9959
- const names = Object.keys(unitDefinedNameMap);
9960
- for (let i = 0, len = names.length; i < len; i++) if (normalizeFormulaText(names[i]) === formulaText) return true;
9961
- return false;
9960
+ return getNormalizedDirtyDefinedNameSet(unitDefinedNameMap).has(normalizeFormulaText(formula));
9962
9961
  }
9963
9962
  function normalizeFormulaText(formula) {
9964
9963
  return formula.startsWith("=") ? formula.slice(1) : formula;
9965
9964
  }
9965
+ function checkIsChangedBySuperTable(unitId, formula, currentConfigService) {
9966
+ var _currentConfigService, _tableReferencePatter;
9967
+ const getDirtySuperTableMap = (_currentConfigService = currentConfigService.getDirtySuperTableMap) === null || _currentConfigService === void 0 ? void 0 : _currentConfigService.bind(currentConfigService);
9968
+ const changedSuperTableMap = getDirtySuperTableMap === null || getDirtySuperTableMap === void 0 ? void 0 : getDirtySuperTableMap();
9969
+ const unitSuperTableMap = changedSuperTableMap === null || changedSuperTableMap === void 0 ? void 0 : changedSuperTableMap[unitId];
9970
+ if (unitSuperTableMap == null) return false;
9971
+ const tableReferencePattern = getDirtySuperTableReferencePattern(unitSuperTableMap);
9972
+ return (_tableReferencePatter = tableReferencePattern === null || tableReferencePattern === void 0 ? void 0 : tableReferencePattern.test(normalizeFormulaText(formula))) !== null && _tableReferencePatter !== void 0 ? _tableReferencePatter : false;
9973
+ }
9974
+ function getNormalizedDirtyDefinedNameSet(unitDefinedNameMap) {
9975
+ let normalizedNameSet = DIRTY_DEFINED_NAME_SET_CACHE.get(unitDefinedNameMap);
9976
+ if (normalizedNameSet == null) {
9977
+ normalizedNameSet = new Set(Object.keys(unitDefinedNameMap).map(normalizeFormulaText));
9978
+ DIRTY_DEFINED_NAME_SET_CACHE.set(unitDefinedNameMap, normalizedNameSet);
9979
+ }
9980
+ return normalizedNameSet;
9981
+ }
9982
+ function getDirtySuperTableReferencePattern(unitSuperTableMap) {
9983
+ let tableReferencePattern = DIRTY_SUPER_TABLE_PATTERN_CACHE.get(unitSuperTableMap);
9984
+ if (tableReferencePattern === void 0) {
9985
+ const escapedTableNames = Object.keys(unitSuperTableMap).filter((tableName) => tableName.length > 0).map(escapeRegExp);
9986
+ tableReferencePattern = escapedTableNames.length > 0 ? new RegExp(`(^|[^A-Za-z0-9_])(?:${escapedTableNames.join("|")})(\\s*\\[|$|[^A-Za-z0-9_])`, "i") : null;
9987
+ DIRTY_SUPER_TABLE_PATTERN_CACHE.set(unitSuperTableMap, tableReferencePattern);
9988
+ }
9989
+ return tableReferencePattern;
9990
+ }
9966
9991
  function isDirtyDefinedForNode(node, currentConfigService) {
9967
9992
  const definedNameMap = currentConfigService.getDirtyDefinedNameMap();
9968
9993
  const executeUnitId = currentConfigService.getExecuteUnitId();
@@ -11760,9 +11785,7 @@ var DependencyManagerBaseService = class extends Disposable {
11760
11785
  clearFormulaDependency(unitId, sheetId) {
11761
11786
  throw new Error("Method not implemented.");
11762
11787
  }
11763
- removeFormulaDependencyByDefinedName(unitId, definedName) {
11764
- throw new Error("Method not implemented.");
11765
- }
11788
+ removeFormulaDependencyByDefinedName(unitId, definedName) {}
11766
11789
  searchDependency(search, exceptTreeIds) {
11767
11790
  return this._dependencyRTreeCache.bulkSearch(search, exceptTreeIds);
11768
11791
  }
@@ -13871,7 +13894,7 @@ let CalculateController = class CalculateController extends Disposable {
13871
13894
  }));
13872
13895
  }
13873
13896
  async _calculate(formulaDirtyData) {
13874
- const { forceCalculation: forceCalculate = false, dirtyRanges = [], dirtyNameMap = {}, dirtyDefinedNameMap = {}, dirtyUnitFeatureMap = {}, dirtyUnitOtherFormulaMap = {}, clearDependencyTreeCache = {}, maxIteration = 1, rowData, isCalculateTreeModel = false } = formulaDirtyData;
13897
+ const { forceCalculation: forceCalculate = false, dirtyRanges = [], dirtyNameMap = {}, dirtyDefinedNameMap = {}, dirtySuperTableMap = {}, dirtyUnitFeatureMap = {}, dirtyUnitOtherFormulaMap = {}, clearDependencyTreeCache = {}, maxIteration = 1, rowData, isCalculateTreeModel = false } = formulaDirtyData;
13875
13898
  const formulaData = this._formulaDataModel.getFormulaData();
13876
13899
  const arrayFormulaCellData = this._formulaDataModel.getArrayFormulaCellData();
13877
13900
  const arrayFormulaRange = this._formulaDataModel.getArrayFormulaRange();
@@ -13883,6 +13906,7 @@ let CalculateController = class CalculateController extends Disposable {
13883
13906
  dirtyRanges,
13884
13907
  dirtyNameMap,
13885
13908
  dirtyDefinedNameMap,
13909
+ dirtySuperTableMap,
13886
13910
  dirtyUnitFeatureMap,
13887
13911
  dirtyUnitOtherFormulaMap,
13888
13912
  clearDependencyTreeCache,
@@ -24110,14 +24134,14 @@ function guessIsNaNorInfinity(guess, iterF) {
24110
24134
  const max = Number.MAX_VALUE;
24111
24135
  const min = -1;
24112
24136
  const step = 1.6;
24113
- let low = guess - .01 <= min ? min + g_Eps : guess - .01;
24137
+ let low = guess - .01 <= min ? -.9999999 : guess - .01;
24114
24138
  let high = guess + .01 >= max ? max - g_Eps : guess + .01;
24115
24139
  let xBegin;
24116
24140
  let xEnd;
24117
24141
  let currentIter = 0;
24118
24142
  if (guess <= min || guess >= max) return ErrorValueObject.create("#NUM!");
24119
24143
  for (let i = 0; i < nIM; i++) {
24120
- xBegin = low <= min ? min + g_Eps : low;
24144
+ xBegin = low <= min ? -.9999999 : low;
24121
24145
  xEnd = high >= max ? max - g_Eps : high;
24122
24146
  const x = iterF(xBegin);
24123
24147
  const y = iterF(xEnd);
@@ -32713,7 +32737,7 @@ var Roundbank = class extends BaseFunction {
32713
32737
  const integerPart = Math.floor(adjustedNum);
32714
32738
  const decimalPart = adjustedNum - integerPart;
32715
32739
  let result = Math.round(adjustedNum);
32716
- if (decimalPart > .5 - EPSILON && decimalPart < .5 + EPSILON) result = integerPart % 2 === 0 ? integerPart : integerPart + 1;
32740
+ if (decimalPart > .5 - EPSILON && decimalPart < .50000001) result = integerPart % 2 === 0 ? integerPart : integerPart + 1;
32717
32741
  return numDigits ? result / multiplier : result;
32718
32742
  }
32719
32743
  };
@@ -40031,10 +40055,7 @@ var Textsplit = class extends BaseFunction {
40031
40055
  if (valueObject.isNull()) value = "\\s";
40032
40056
  if (valueObject.isBoolean()) value = value ? "TRUE" : "FALSE";
40033
40057
  value += "";
40034
- return this._escapeRegExp(value);
40035
- }
40036
- _escapeRegExp(string) {
40037
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
40058
+ return escapeRegExp(value);
40038
40059
  }
40039
40060
  };
40040
40061
 
@@ -40417,7 +40438,7 @@ function getObjectValue(result, isUseStrip = false) {
40417
40438
  //#endregion
40418
40439
  //#region package.json
40419
40440
  var name = "@univerjs/engine-formula";
40420
- var version = "0.24.0";
40441
+ var version = "0.25.0";
40421
40442
 
40422
40443
  //#endregion
40423
40444
  //#region src/services/global-computing-status.service.ts
@@ -40475,7 +40496,7 @@ let ComputingStatusReporterController = class ComputingStatusReporterController
40475
40496
  const params = command.params;
40476
40497
  if (params.stageInfo) return observe.next(params.stageInfo.stage === 0 || params.stageInfo.stage === 8);
40477
40498
  });
40478
- }).pipe(distinctUntilChanged(), shareReplay()));
40499
+ }).pipe(distinctUntilChanged(), shareReplay({ refCount: true })));
40479
40500
  const disposables = new DisposableCollection();
40480
40501
  const subject = new BehaviorSubject(true);
40481
40502
  disposables.add(this._globalComputingSrv.pushComputingStatusSubject(subject));
package/lib/facade.js CHANGED
@@ -3,7 +3,7 @@ import { ICommandService, IConfigService, Inject, Injector } from "@univerjs/cor
3
3
  import { ENGINE_FORMULA_CYCLE_REFERENCE_COUNT, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE, GlobalComputingStatusService, IDefinedNamesService, IFunctionService, ISuperTableService, LexerTreeBuilder, SetCellFormulaDependencyCalculationMutation, SetCellFormulaDependencyCalculationResultMutation, SetFormulaCalculationNotificationMutation, SetFormulaCalculationStartMutation, SetFormulaCalculationStopMutation, SetFormulaDependencyCalculationMutation, SetFormulaDependencyCalculationResultMutation, SetFormulaStringBatchCalculationMutation, SetFormulaStringBatchCalculationResultMutation, SetQueryFormulaDependencyAllMutation, SetQueryFormulaDependencyAllResultMutation, SetQueryFormulaDependencyMutation, SetQueryFormulaDependencyResultMutation, SetTriggerFormulaCalculationStartMutation } from "@univerjs/engine-formula";
4
4
  import { filter, firstValueFrom, map, race, timer } from "rxjs";
5
5
 
6
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
6
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
7
7
  function __decorateParam(paramIndex, decorator) {
8
8
  return function(target, key) {
9
9
  decorator(target, key, paramIndex);
@@ -11,7 +11,7 @@ function __decorateParam(paramIndex, decorator) {
11
11
  }
12
12
 
13
13
  //#endregion
14
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
14
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
15
15
  function __decorate(decorators, target, key, desc) {
16
16
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17
17
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -146,7 +146,7 @@ let FFormula = class FFormula extends FBase {
146
146
  });
147
147
  }
148
148
  /**
149
- * @deprecated Use `onCalculationEnd` instead.
149
+ * @deprecated Use `onCalculationResultApplied` instead.
150
150
  */
151
151
  whenComputingCompleteAsync(timeout) {
152
152
  const gcss = this._injector.get(GlobalComputingStatusService);
@@ -154,8 +154,7 @@ let FFormula = class FFormula extends FBase {
154
154
  return firstValueFrom(race(gcss.computingStatus$.pipe(filter((computing) => computing)), timer(timeout !== null && timeout !== void 0 ? timeout : 3e4).pipe(map(() => false))));
155
155
  }
156
156
  /**
157
- * Waits for the formula calculation to complete.
158
- * @returns {Promise<void>} This method returns a promise that resolves when the calculation is complete.
157
+ * @deprecated Use `onCalculationResultApplied` instead.
159
158
  */
160
159
  onCalculationEnd() {
161
160
  return new Promise((resolve, reject) => {