@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/cjs/facade.js CHANGED
@@ -4,7 +4,7 @@ let _univerjs_core = require("@univerjs/core");
4
4
  let _univerjs_engine_formula = require("@univerjs/engine-formula");
5
5
  let rxjs = require("rxjs");
6
6
 
7
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
7
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
8
8
  function __decorateParam(paramIndex, decorator) {
9
9
  return function(target, key) {
10
10
  decorator(target, key, paramIndex);
@@ -12,7 +12,7 @@ function __decorateParam(paramIndex, decorator) {
12
12
  }
13
13
 
14
14
  //#endregion
15
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
15
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
16
16
  function __decorate(decorators, target, key, desc) {
17
17
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
18
18
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -147,7 +147,7 @@ let FFormula = class FFormula extends _univerjs_core_facade.FBase {
147
147
  });
148
148
  }
149
149
  /**
150
- * @deprecated Use `onCalculationEnd` instead.
150
+ * @deprecated Use `onCalculationResultApplied` instead.
151
151
  */
152
152
  whenComputingCompleteAsync(timeout) {
153
153
  const gcss = this._injector.get(_univerjs_engine_formula.GlobalComputingStatusService);
@@ -155,8 +155,7 @@ let FFormula = class FFormula extends _univerjs_core_facade.FBase {
155
155
  return (0, rxjs.firstValueFrom)((0, rxjs.race)(gcss.computingStatus$.pipe((0, rxjs.filter)((computing) => computing)), (0, rxjs.timer)(timeout !== null && timeout !== void 0 ? timeout : 3e4).pipe((0, rxjs.map)(() => false))));
156
156
  }
157
157
  /**
158
- * Waits for the formula calculation to complete.
159
- * @returns {Promise<void>} This method returns a promise that resolves when the calculation is complete.
158
+ * @deprecated Use `onCalculationResultApplied` instead.
160
159
  */
161
160
  onCalculationEnd() {
162
161
  return new Promise((resolve, reject) => {
package/lib/cjs/index.js CHANGED
@@ -42,7 +42,7 @@ let BooleanValue = /* @__PURE__ */ function(BooleanValue) {
42
42
  }({});
43
43
 
44
44
  //#endregion
45
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
45
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
46
46
  function _typeof(o) {
47
47
  "@babel/helpers - typeof";
48
48
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -53,7 +53,7 @@ function _typeof(o) {
53
53
  }
54
54
 
55
55
  //#endregion
56
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
56
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
57
57
  function toPrimitive(t, r) {
58
58
  if ("object" != _typeof(t) || !t) return t;
59
59
  var e = t[Symbol.toPrimitive];
@@ -66,14 +66,14 @@ function toPrimitive(t, r) {
66
66
  }
67
67
 
68
68
  //#endregion
69
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
69
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
70
70
  function toPropertyKey(t) {
71
71
  var i = toPrimitive(t, "string");
72
72
  return "symbol" == _typeof(i) ? i : i + "";
73
73
  }
74
74
 
75
75
  //#endregion
76
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
76
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
77
77
  function _defineProperty(e, r, t) {
78
78
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
79
79
  value: t,
@@ -875,7 +875,7 @@ function getWeekDayByDateSerialNumber(dateSerialNumber) {
875
875
  let date = excelSerialToDate(dateSerialNumber);
876
876
  const leapDayDateTime = Date.UTC(1900, 1, 28);
877
877
  const dateTime = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
878
- if (!isDate19000229 && dateTime <= leapDayDateTime) date = new Date(dateTime - perDayMilliseconds);
878
+ if (!isDate19000229 && dateTime <= leapDayDateTime) date = /* @__PURE__ */ new Date(dateTime - perDayMilliseconds);
879
879
  return date.getUTCDay();
880
880
  }
881
881
  function getTwoDateDaysByBasis(startDateSerialNumber, endDateSerialNumber, basis) {
@@ -1877,7 +1877,7 @@ function splitTableStructuredRef(ref) {
1877
1877
  }
1878
1878
 
1879
1879
  //#endregion
1880
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorateParam.js
1880
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorateParam.js
1881
1881
  function __decorateParam(paramIndex, decorator) {
1882
1882
  return function(target, key) {
1883
1883
  decorator(target, key, paramIndex);
@@ -1885,7 +1885,7 @@ function __decorateParam(paramIndex, decorator) {
1885
1885
  }
1886
1886
 
1887
1887
  //#endregion
1888
- //#region \0@oxc-project+runtime@0.129.0/helpers/decorate.js
1888
+ //#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
1889
1889
  function __decorate(decorators, target, key, desc) {
1890
1890
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1891
1891
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -5393,6 +5393,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5393
5393
  _defineProperty(this, "_dirtyRanges", []);
5394
5394
  _defineProperty(this, "_dirtyNameMap", {});
5395
5395
  _defineProperty(this, "_dirtyDefinedNameMap", {});
5396
+ _defineProperty(this, "_dirtySuperTableMap", {});
5396
5397
  _defineProperty(this, "_dirtyUnitFeatureMap", {});
5397
5398
  _defineProperty(this, "_dirtyUnitOtherFormulaMap", {});
5398
5399
  _defineProperty(this, "_excludedCell", void 0);
@@ -5412,6 +5413,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5412
5413
  this._dirtyRanges = [];
5413
5414
  this._dirtyNameMap = {};
5414
5415
  this._dirtyDefinedNameMap = {};
5416
+ this._dirtySuperTableMap = {};
5415
5417
  this._dirtyUnitFeatureMap = {};
5416
5418
  this._dirtyUnitOtherFormulaMap = {};
5417
5419
  this._excludedCell = {};
@@ -5462,6 +5464,9 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5462
5464
  getDirtyDefinedNameMap() {
5463
5465
  return this._dirtyDefinedNameMap;
5464
5466
  }
5467
+ getDirtySuperTableMap() {
5468
+ return this._dirtySuperTableMap;
5469
+ }
5465
5470
  getDirtyUnitFeatureMap() {
5466
5471
  return this._dirtyUnitFeatureMap;
5467
5472
  }
@@ -5527,6 +5532,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5527
5532
  this._dirtyRanges = config.dirtyRanges;
5528
5533
  this._dirtyNameMap = config.dirtyNameMap;
5529
5534
  this._dirtyDefinedNameMap = config.dirtyDefinedNameMap;
5535
+ this._dirtySuperTableMap = config.dirtySuperTableMap || {};
5530
5536
  this._dirtyUnitFeatureMap = config.dirtyUnitFeatureMap;
5531
5537
  this._dirtyUnitOtherFormulaMap = config.dirtyUnitOtherFormulaMap;
5532
5538
  this._excludedCell = config.excludedCell;
@@ -5548,6 +5554,7 @@ let FormulaCurrentConfigService = class FormulaCurrentConfigService extends _uni
5548
5554
  dirtyRanges: this._dirtyRanges,
5549
5555
  dirtyNameMap: this._dirtyNameMap,
5550
5556
  dirtyDefinedNameMap: this._dirtyDefinedNameMap,
5557
+ dirtySuperTableMap: this._dirtySuperTableMap,
5551
5558
  dirtyUnitFeatureMap: this._dirtyUnitFeatureMap,
5552
5559
  dirtyUnitOtherFormulaMap: this._dirtyUnitOtherFormulaMap,
5553
5560
  clearDependencyTreeCache: this._clearDependencyTreeCache
@@ -5662,22 +5669,6 @@ Lexer = __decorate([
5662
5669
  __decorateParam(2, IFormulaCurrentConfigService)
5663
5670
  ], Lexer);
5664
5671
 
5665
- //#endregion
5666
- //#region src/basics/is-null-cell.ts
5667
- /**
5668
- * Examine if a cell is empty (null) in the formula-related modules. This is not
5669
- * interchangable with {@link isNullCell} from the core package, because for
5670
- * formulas, "custom" field is meaningless.
5671
- */
5672
- function isNullCellForFormula(cell) {
5673
- if (cell == null) return true;
5674
- const { v, f, si, p } = cell;
5675
- if (!(v == null || typeof v === "string" && v.length === 0)) return false;
5676
- if (f != null && f.length > 0 || si != null && si.length > 0) return false;
5677
- if (p != null) return false;
5678
- return true;
5679
- }
5680
-
5681
5672
  //#endregion
5682
5673
  //#region src/engine/utils/cell.ts
5683
5674
  function getCellValue(cell) {
@@ -5729,7 +5720,7 @@ function isWildcard(str) {
5729
5720
  return str.indexOf("*") > -1 || str.indexOf("?") > -1;
5730
5721
  }
5731
5722
  function isMatchWildcard(currentValue, value) {
5732
- const pattern = escapeRegExp(value).replace(/~?[*?]/g, (match) => {
5723
+ const pattern = escapeRegExpForWildcard(value).replace(/~?[*?]/g, (match) => {
5733
5724
  if (match.startsWith("~")) return `\\${match.substring(1)}`;
5734
5725
  if (match === "*") return ".*";
5735
5726
  if (match === "?") return ".";
@@ -5764,7 +5755,7 @@ function compareWithWildcard(currentValue, value, operator) {
5764
5755
  }
5765
5756
  return result;
5766
5757
  }
5767
- function escapeRegExp(str) {
5758
+ function escapeRegExpForWildcard(str) {
5768
5759
  return str.replace(/[.+^${}()|[\]\\]/g, "\\$&");
5769
5760
  }
5770
5761
  function getMatchModeValue(matchModeValue) {
@@ -5813,11 +5804,20 @@ const localeCurrencySymbolMap = new Map([
5813
5804
  [_univerjs_core.LocaleType.VI_VN, "₫"],
5814
5805
  [_univerjs_core.LocaleType.ZH_CN, "¥"],
5815
5806
  [_univerjs_core.LocaleType.ZH_TW, "NT$"],
5807
+ [_univerjs_core.LocaleType.ZH_HK, "HK$"],
5816
5808
  [_univerjs_core.LocaleType.FR_FR, "€"],
5817
5809
  [_univerjs_core.LocaleType.FA_IR, "﷼"],
5818
5810
  [_univerjs_core.LocaleType.KO_KR, "₩"],
5819
5811
  [_univerjs_core.LocaleType.ES_ES, "€"],
5820
- [_univerjs_core.LocaleType.CA_ES, "€"]
5812
+ [_univerjs_core.LocaleType.CA_ES, "€"],
5813
+ [_univerjs_core.LocaleType.SK_SK, "€"],
5814
+ [_univerjs_core.LocaleType.JA_JP, "¥"],
5815
+ [_univerjs_core.LocaleType.PT_BR, "R$"],
5816
+ [_univerjs_core.LocaleType.DE_DE, "€"],
5817
+ [_univerjs_core.LocaleType.IT_IT, "€"],
5818
+ [_univerjs_core.LocaleType.ID_ID, "Rp"],
5819
+ [_univerjs_core.LocaleType.PL_PL, "zł"],
5820
+ [_univerjs_core.LocaleType.AR_SA, "﷼"]
5821
5821
  ]);
5822
5822
  function getCurrencySymbol(locale) {
5823
5823
  return localeCurrencySymbolMap.get(locale) || "$";
@@ -8245,7 +8245,7 @@ var BaseReferenceObject = class extends ObjectClassType {
8245
8245
  if (r < 0 || c < 0) return callback(ErrorValueObject.create("#REF!"), r, c);
8246
8246
  const cell = this.getCellData(r, c);
8247
8247
  let result = false;
8248
- if (isNullCellForFormula(cell)) {
8248
+ if ((0, _univerjs_core.isNullCell)(cell)) {
8249
8249
  result = callback(null, r, c);
8250
8250
  continue;
8251
8251
  }
@@ -9692,10 +9692,10 @@ let FormulaRuntimeService = class FormulaRuntimeService extends _univerjs_core.D
9692
9692
  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);
9693
9693
  const featureCell = this._getRuntimeFeatureCellValue(r, c, formulaSheetId, formulaUnitId);
9694
9694
  const isPreviousCellOfCurrentArrayFormula = this._arrayCellHasData(arrayDataCell) && this._isInArrayFormulaRange(previousArrayFormulaRange, r, c) && (currentCell == null || this._isSameCellValue(currentCell, arrayDataCell));
9695
- const hasRuntimeCell = !isNullCellForFormula(cell);
9695
+ const hasRuntimeCell = !(0, _univerjs_core.isNullCell)(cell);
9696
9696
  const isInOtherArrayFormulaRange = this._isInOtherArrayFormulaRange(formulaUnitId, formulaSheetId, formulaRow, formulaColumn, r, c);
9697
- const currentCellBlocks = !isNullCellForFormula(currentCell) && !isPreviousCellOfCurrentArrayFormula;
9698
- const featureCellBlocks = !isNullCellForFormula(featureCell);
9697
+ const currentCellBlocks = !(0, _univerjs_core.isNullCell)(currentCell) && !isPreviousCellOfCurrentArrayFormula;
9698
+ const featureCellBlocks = !(0, _univerjs_core.isNullCell)(featureCell);
9699
9699
  if (hasRuntimeCell || isInOtherArrayFormulaRange || currentCellBlocks || featureCellBlocks) return true;
9700
9700
  }
9701
9701
  return false;
@@ -9968,9 +9968,11 @@ const COLUMN_LIKE_FUNCTION_NAMES = new Set(ALL_GROUPS.flatMap((g) => Object.valu
9968
9968
  //#region src/engine/utils/generate-ast-node.ts
9969
9969
  const FORMULA_CACHE_LRU_COUNT = 5e3;
9970
9970
  const FORMULA_AST_CACHE = new FormulaAstLRU(FORMULA_CACHE_LRU_COUNT);
9971
+ const DIRTY_DEFINED_NAME_SET_CACHE = /* @__PURE__ */ new WeakMap();
9972
+ const DIRTY_SUPER_TABLE_PATTERN_CACHE = /* @__PURE__ */ new WeakMap();
9971
9973
  function generateAstNode(unitId, formulaString, lexer, astTreeBuilder, currentConfigService) {
9972
9974
  let astNode = FORMULA_AST_CACHE.get(`${unitId}${formulaString}`);
9973
- const noCache = checkIsChangedByDefinedName(unitId, formulaString, currentConfigService);
9975
+ const noCache = checkIsChangedByDefinedName(unitId, formulaString, currentConfigService) || checkIsChangedBySuperTable(unitId, formulaString, currentConfigService);
9974
9976
  if (!noCache && astNode && !isDirtyDefinedForNode(astNode, currentConfigService)) return astNode;
9975
9977
  const lexerNode = lexer.treeBuilder(formulaString);
9976
9978
  if (ERROR_TYPE_SET.has(lexerNode)) return ErrorNode.create(lexerNode);
@@ -9985,14 +9987,37 @@ function generateAstNode(unitId, formulaString, lexer, astTreeBuilder, currentCo
9985
9987
  function checkIsChangedByDefinedName(unitId, formula, currentConfigService) {
9986
9988
  const unitDefinedNameMap = currentConfigService.getDirtyDefinedNameMap()[unitId];
9987
9989
  if (unitDefinedNameMap == null) return false;
9988
- const formulaText = normalizeFormulaText(formula);
9989
- const names = Object.keys(unitDefinedNameMap);
9990
- for (let i = 0, len = names.length; i < len; i++) if (normalizeFormulaText(names[i]) === formulaText) return true;
9991
- return false;
9990
+ return getNormalizedDirtyDefinedNameSet(unitDefinedNameMap).has(normalizeFormulaText(formula));
9992
9991
  }
9993
9992
  function normalizeFormulaText(formula) {
9994
9993
  return formula.startsWith("=") ? formula.slice(1) : formula;
9995
9994
  }
9995
+ function checkIsChangedBySuperTable(unitId, formula, currentConfigService) {
9996
+ var _currentConfigService, _tableReferencePatter;
9997
+ const getDirtySuperTableMap = (_currentConfigService = currentConfigService.getDirtySuperTableMap) === null || _currentConfigService === void 0 ? void 0 : _currentConfigService.bind(currentConfigService);
9998
+ const changedSuperTableMap = getDirtySuperTableMap === null || getDirtySuperTableMap === void 0 ? void 0 : getDirtySuperTableMap();
9999
+ const unitSuperTableMap = changedSuperTableMap === null || changedSuperTableMap === void 0 ? void 0 : changedSuperTableMap[unitId];
10000
+ if (unitSuperTableMap == null) return false;
10001
+ const tableReferencePattern = getDirtySuperTableReferencePattern(unitSuperTableMap);
10002
+ return (_tableReferencePatter = tableReferencePattern === null || tableReferencePattern === void 0 ? void 0 : tableReferencePattern.test(normalizeFormulaText(formula))) !== null && _tableReferencePatter !== void 0 ? _tableReferencePatter : false;
10003
+ }
10004
+ function getNormalizedDirtyDefinedNameSet(unitDefinedNameMap) {
10005
+ let normalizedNameSet = DIRTY_DEFINED_NAME_SET_CACHE.get(unitDefinedNameMap);
10006
+ if (normalizedNameSet == null) {
10007
+ normalizedNameSet = new Set(Object.keys(unitDefinedNameMap).map(normalizeFormulaText));
10008
+ DIRTY_DEFINED_NAME_SET_CACHE.set(unitDefinedNameMap, normalizedNameSet);
10009
+ }
10010
+ return normalizedNameSet;
10011
+ }
10012
+ function getDirtySuperTableReferencePattern(unitSuperTableMap) {
10013
+ let tableReferencePattern = DIRTY_SUPER_TABLE_PATTERN_CACHE.get(unitSuperTableMap);
10014
+ if (tableReferencePattern === void 0) {
10015
+ const escapedTableNames = Object.keys(unitSuperTableMap).filter((tableName) => tableName.length > 0).map(_univerjs_core.escapeRegExp);
10016
+ tableReferencePattern = escapedTableNames.length > 0 ? new RegExp(`(^|[^A-Za-z0-9_])(?:${escapedTableNames.join("|")})(\\s*\\[|$|[^A-Za-z0-9_])`, "i") : null;
10017
+ DIRTY_SUPER_TABLE_PATTERN_CACHE.set(unitSuperTableMap, tableReferencePattern);
10018
+ }
10019
+ return tableReferencePattern;
10020
+ }
9996
10021
  function isDirtyDefinedForNode(node, currentConfigService) {
9997
10022
  const definedNameMap = currentConfigService.getDirtyDefinedNameMap();
9998
10023
  const executeUnitId = currentConfigService.getExecuteUnitId();
@@ -11790,9 +11815,7 @@ var DependencyManagerBaseService = class extends _univerjs_core.Disposable {
11790
11815
  clearFormulaDependency(unitId, sheetId) {
11791
11816
  throw new Error("Method not implemented.");
11792
11817
  }
11793
- removeFormulaDependencyByDefinedName(unitId, definedName) {
11794
- throw new Error("Method not implemented.");
11795
- }
11818
+ removeFormulaDependencyByDefinedName(unitId, definedName) {}
11796
11819
  searchDependency(search, exceptTreeIds) {
11797
11820
  return this._dependencyRTreeCache.bulkSearch(search, exceptTreeIds);
11798
11821
  }
@@ -13901,7 +13924,7 @@ let CalculateController = class CalculateController extends _univerjs_core.Dispo
13901
13924
  }));
13902
13925
  }
13903
13926
  async _calculate(formulaDirtyData) {
13904
- const { forceCalculation: forceCalculate = false, dirtyRanges = [], dirtyNameMap = {}, dirtyDefinedNameMap = {}, dirtyUnitFeatureMap = {}, dirtyUnitOtherFormulaMap = {}, clearDependencyTreeCache = {}, maxIteration = 1, rowData, isCalculateTreeModel = false } = formulaDirtyData;
13927
+ const { forceCalculation: forceCalculate = false, dirtyRanges = [], dirtyNameMap = {}, dirtyDefinedNameMap = {}, dirtySuperTableMap = {}, dirtyUnitFeatureMap = {}, dirtyUnitOtherFormulaMap = {}, clearDependencyTreeCache = {}, maxIteration = 1, rowData, isCalculateTreeModel = false } = formulaDirtyData;
13905
13928
  const formulaData = this._formulaDataModel.getFormulaData();
13906
13929
  const arrayFormulaCellData = this._formulaDataModel.getArrayFormulaCellData();
13907
13930
  const arrayFormulaRange = this._formulaDataModel.getArrayFormulaRange();
@@ -13913,6 +13936,7 @@ let CalculateController = class CalculateController extends _univerjs_core.Dispo
13913
13936
  dirtyRanges,
13914
13937
  dirtyNameMap,
13915
13938
  dirtyDefinedNameMap,
13939
+ dirtySuperTableMap,
13916
13940
  dirtyUnitFeatureMap,
13917
13941
  dirtyUnitOtherFormulaMap,
13918
13942
  clearDependencyTreeCache,
@@ -24140,14 +24164,14 @@ function guessIsNaNorInfinity(guess, iterF) {
24140
24164
  const max = Number.MAX_VALUE;
24141
24165
  const min = -1;
24142
24166
  const step = 1.6;
24143
- let low = guess - .01 <= min ? min + g_Eps : guess - .01;
24167
+ let low = guess - .01 <= min ? -.9999999 : guess - .01;
24144
24168
  let high = guess + .01 >= max ? max - g_Eps : guess + .01;
24145
24169
  let xBegin;
24146
24170
  let xEnd;
24147
24171
  let currentIter = 0;
24148
24172
  if (guess <= min || guess >= max) return ErrorValueObject.create("#NUM!");
24149
24173
  for (let i = 0; i < nIM; i++) {
24150
- xBegin = low <= min ? min + g_Eps : low;
24174
+ xBegin = low <= min ? -.9999999 : low;
24151
24175
  xEnd = high >= max ? max - g_Eps : high;
24152
24176
  const x = iterF(xBegin);
24153
24177
  const y = iterF(xEnd);
@@ -32743,7 +32767,7 @@ var Roundbank = class extends BaseFunction {
32743
32767
  const integerPart = Math.floor(adjustedNum);
32744
32768
  const decimalPart = adjustedNum - integerPart;
32745
32769
  let result = Math.round(adjustedNum);
32746
- if (decimalPart > .5 - EPSILON && decimalPart < .5 + EPSILON) result = integerPart % 2 === 0 ? integerPart : integerPart + 1;
32770
+ if (decimalPart > .5 - EPSILON && decimalPart < .50000001) result = integerPart % 2 === 0 ? integerPart : integerPart + 1;
32747
32771
  return numDigits ? result / multiplier : result;
32748
32772
  }
32749
32773
  };
@@ -40061,10 +40085,7 @@ var Textsplit = class extends BaseFunction {
40061
40085
  if (valueObject.isNull()) value = "\\s";
40062
40086
  if (valueObject.isBoolean()) value = value ? "TRUE" : "FALSE";
40063
40087
  value += "";
40064
- return this._escapeRegExp(value);
40065
- }
40066
- _escapeRegExp(string) {
40067
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
40088
+ return (0, _univerjs_core.escapeRegExp)(value);
40068
40089
  }
40069
40090
  };
40070
40091
 
@@ -40447,7 +40468,7 @@ function getObjectValue(result, isUseStrip = false) {
40447
40468
  //#endregion
40448
40469
  //#region package.json
40449
40470
  var name = "@univerjs/engine-formula";
40450
- var version = "0.24.0";
40471
+ var version = "0.25.0";
40451
40472
 
40452
40473
  //#endregion
40453
40474
  //#region src/services/global-computing-status.service.ts
@@ -40505,7 +40526,7 @@ let ComputingStatusReporterController = class ComputingStatusReporterController
40505
40526
  const params = command.params;
40506
40527
  if (params.stageInfo) return observe.next(params.stageInfo.stage === 0 || params.stageInfo.stage === 8);
40507
40528
  });
40508
- }).pipe((0, rxjs.distinctUntilChanged)(), (0, rxjs.shareReplay)()));
40529
+ }).pipe((0, rxjs.distinctUntilChanged)(), (0, rxjs.shareReplay)({ refCount: true })));
40509
40530
  const disposables = new _univerjs_core.DisposableCollection();
40510
40531
  const subject = new rxjs.BehaviorSubject(true);
40511
40532
  disposables.add(this._globalComputingSrv.pushComputingStatusSubject(subject));
package/lib/es/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) => {