@univerjs/engine-formula 1.0.0-alpha.5 → 1.0.0-alpha.7

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
@@ -79,7 +79,12 @@ let FFormula = class FFormula extends _univerjs_core_facade.FBase {
79
79
  return this._lexerTreeBuilder.sequenceNodesBuilder(formulaString) || [];
80
80
  }
81
81
  /**
82
- * Start the calculation of the formula.
82
+ * Forces formula calculation explicitly.
83
+ *
84
+ * Normal facade mutations such as `range.setFormula()` already mark formula
85
+ * data dirty and schedule calculation automatically. Use this method only when
86
+ * an external data change did not produce a dirty command or an explicit full
87
+ * recalculation is required.
83
88
  *
84
89
  * @example
85
90
  * ```ts
package/lib/cjs/index.js CHANGED
@@ -42105,7 +42105,7 @@ function getObjectValue(result, isUseStrip = false) {
42105
42105
  //#endregion
42106
42106
  //#region package.json
42107
42107
  var name = "@univerjs/engine-formula";
42108
- var version = "1.0.0-alpha.5";
42108
+ var version = "1.0.0-alpha.7";
42109
42109
 
42110
42110
  //#endregion
42111
42111
  //#region src/services/global-computing-status.service.ts
@@ -42650,6 +42650,7 @@ let OtherFormulaBizType = /* @__PURE__ */ function(OtherFormulaBizType) {
42650
42650
  OtherFormulaBizType["CONDITIONAL_FORMATTING"] = "cf";
42651
42651
  OtherFormulaBizType["DOC"] = "doc";
42652
42652
  OtherFormulaBizType["SLIDE"] = "slide";
42653
+ OtherFormulaBizType["SHAPE"] = "shape";
42653
42654
  return OtherFormulaBizType;
42654
42655
  }({});
42655
42656
  let RegisterOtherFormulaService = class RegisterOtherFormulaService extends _univerjs_core.Disposable {
@@ -42663,6 +42664,8 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends _uni
42663
42664
  _defineProperty(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
42664
42665
  _defineProperty(this, "_formulaResult$", new rxjs.Subject());
42665
42666
  _defineProperty(this, "formulaResult$", this._formulaResult$.asObservable());
42667
+ _defineProperty(this, "_otherFormulaResultApplied$", new rxjs.Subject());
42668
+ _defineProperty(this, "otherFormulaResultApplied$", this._otherFormulaResultApplied$.asObservable());
42666
42669
  _defineProperty(this, "calculateStarted$", new rxjs.BehaviorSubject(false));
42667
42670
  this._initFormulaRegister();
42668
42671
  this._initFormulaCalculationResultChange();
@@ -42671,6 +42674,7 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends _uni
42671
42674
  super.dispose();
42672
42675
  this._formulaChangeWithRange$.complete();
42673
42676
  this._formulaResult$.complete();
42677
+ this._otherFormulaResultApplied$.complete();
42674
42678
  this.calculateStarted$.complete();
42675
42679
  }
42676
42680
  _ensureCacheMap(unitId, subUnitId) {
@@ -42718,7 +42722,8 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends _uni
42718
42722
  _initFormulaCalculationResultChange() {
42719
42723
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
42720
42724
  if (commandInfo.id === SetFormulaCalculationResultMutation.id) {
42721
- const { unitOtherData } = commandInfo.params;
42725
+ const params = commandInfo.params;
42726
+ const { unitOtherData } = params;
42722
42727
  const results = {};
42723
42728
  for (const unitId in unitOtherData) {
42724
42729
  const unitData = unitOtherData[unitId];
@@ -42751,6 +42756,7 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends _uni
42751
42756
  }
42752
42757
  }
42753
42758
  this._formulaResult$.next(results);
42759
+ this._otherFormulaResultApplied$.next(params);
42754
42760
  }
42755
42761
  }));
42756
42762
  }
package/lib/es/facade.js CHANGED
@@ -78,7 +78,12 @@ let FFormula = class FFormula extends FBase {
78
78
  return this._lexerTreeBuilder.sequenceNodesBuilder(formulaString) || [];
79
79
  }
80
80
  /**
81
- * Start the calculation of the formula.
81
+ * Forces formula calculation explicitly.
82
+ *
83
+ * Normal facade mutations such as `range.setFormula()` already mark formula
84
+ * data dirty and schedule calculation automatically. Use this method only when
85
+ * an external data change did not produce a dirty command or an explicit full
86
+ * recalculation is required.
82
87
  *
83
88
  * @example
84
89
  * ```ts
package/lib/es/index.js CHANGED
@@ -42075,7 +42075,7 @@ function getObjectValue(result, isUseStrip = false) {
42075
42075
  //#endregion
42076
42076
  //#region package.json
42077
42077
  var name = "@univerjs/engine-formula";
42078
- var version = "1.0.0-alpha.5";
42078
+ var version = "1.0.0-alpha.7";
42079
42079
 
42080
42080
  //#endregion
42081
42081
  //#region src/services/global-computing-status.service.ts
@@ -42620,6 +42620,7 @@ let OtherFormulaBizType = /* @__PURE__ */ function(OtherFormulaBizType) {
42620
42620
  OtherFormulaBizType["CONDITIONAL_FORMATTING"] = "cf";
42621
42621
  OtherFormulaBizType["DOC"] = "doc";
42622
42622
  OtherFormulaBizType["SLIDE"] = "slide";
42623
+ OtherFormulaBizType["SHAPE"] = "shape";
42623
42624
  return OtherFormulaBizType;
42624
42625
  }({});
42625
42626
  let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disposable {
@@ -42633,6 +42634,8 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42633
42634
  _defineProperty(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
42634
42635
  _defineProperty(this, "_formulaResult$", new Subject());
42635
42636
  _defineProperty(this, "formulaResult$", this._formulaResult$.asObservable());
42637
+ _defineProperty(this, "_otherFormulaResultApplied$", new Subject());
42638
+ _defineProperty(this, "otherFormulaResultApplied$", this._otherFormulaResultApplied$.asObservable());
42636
42639
  _defineProperty(this, "calculateStarted$", new BehaviorSubject(false));
42637
42640
  this._initFormulaRegister();
42638
42641
  this._initFormulaCalculationResultChange();
@@ -42641,6 +42644,7 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42641
42644
  super.dispose();
42642
42645
  this._formulaChangeWithRange$.complete();
42643
42646
  this._formulaResult$.complete();
42647
+ this._otherFormulaResultApplied$.complete();
42644
42648
  this.calculateStarted$.complete();
42645
42649
  }
42646
42650
  _ensureCacheMap(unitId, subUnitId) {
@@ -42688,7 +42692,8 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42688
42692
  _initFormulaCalculationResultChange() {
42689
42693
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
42690
42694
  if (commandInfo.id === SetFormulaCalculationResultMutation.id) {
42691
- const { unitOtherData } = commandInfo.params;
42695
+ const params = commandInfo.params;
42696
+ const { unitOtherData } = params;
42692
42697
  const results = {};
42693
42698
  for (const unitId in unitOtherData) {
42694
42699
  const unitData = unitOtherData[unitId];
@@ -42721,6 +42726,7 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42721
42726
  }
42722
42727
  }
42723
42728
  this._formulaResult$.next(results);
42729
+ this._otherFormulaResultApplied$.next(params);
42724
42730
  }
42725
42731
  }));
42726
42732
  }
package/lib/facade.js CHANGED
@@ -78,7 +78,12 @@ let FFormula = class FFormula extends FBase {
78
78
  return this._lexerTreeBuilder.sequenceNodesBuilder(formulaString) || [];
79
79
  }
80
80
  /**
81
- * Start the calculation of the formula.
81
+ * Forces formula calculation explicitly.
82
+ *
83
+ * Normal facade mutations such as `range.setFormula()` already mark formula
84
+ * data dirty and schedule calculation automatically. Use this method only when
85
+ * an external data change did not produce a dirty command or an explicit full
86
+ * recalculation is required.
82
87
  *
83
88
  * @example
84
89
  * ```ts
package/lib/index.js CHANGED
@@ -42075,7 +42075,7 @@ function getObjectValue(result, isUseStrip = false) {
42075
42075
  //#endregion
42076
42076
  //#region package.json
42077
42077
  var name = "@univerjs/engine-formula";
42078
- var version = "1.0.0-alpha.5";
42078
+ var version = "1.0.0-alpha.7";
42079
42079
 
42080
42080
  //#endregion
42081
42081
  //#region src/services/global-computing-status.service.ts
@@ -42620,6 +42620,7 @@ let OtherFormulaBizType = /* @__PURE__ */ function(OtherFormulaBizType) {
42620
42620
  OtherFormulaBizType["CONDITIONAL_FORMATTING"] = "cf";
42621
42621
  OtherFormulaBizType["DOC"] = "doc";
42622
42622
  OtherFormulaBizType["SLIDE"] = "slide";
42623
+ OtherFormulaBizType["SHAPE"] = "shape";
42623
42624
  return OtherFormulaBizType;
42624
42625
  }({});
42625
42626
  let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disposable {
@@ -42633,6 +42634,8 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42633
42634
  _defineProperty(this, "formulaChangeWithRange$", this._formulaChangeWithRange$.asObservable());
42634
42635
  _defineProperty(this, "_formulaResult$", new Subject());
42635
42636
  _defineProperty(this, "formulaResult$", this._formulaResult$.asObservable());
42637
+ _defineProperty(this, "_otherFormulaResultApplied$", new Subject());
42638
+ _defineProperty(this, "otherFormulaResultApplied$", this._otherFormulaResultApplied$.asObservable());
42636
42639
  _defineProperty(this, "calculateStarted$", new BehaviorSubject(false));
42637
42640
  this._initFormulaRegister();
42638
42641
  this._initFormulaCalculationResultChange();
@@ -42641,6 +42644,7 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42641
42644
  super.dispose();
42642
42645
  this._formulaChangeWithRange$.complete();
42643
42646
  this._formulaResult$.complete();
42647
+ this._otherFormulaResultApplied$.complete();
42644
42648
  this.calculateStarted$.complete();
42645
42649
  }
42646
42650
  _ensureCacheMap(unitId, subUnitId) {
@@ -42688,7 +42692,8 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42688
42692
  _initFormulaCalculationResultChange() {
42689
42693
  this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {
42690
42694
  if (commandInfo.id === SetFormulaCalculationResultMutation.id) {
42691
- const { unitOtherData } = commandInfo.params;
42695
+ const params = commandInfo.params;
42696
+ const { unitOtherData } = params;
42692
42697
  const results = {};
42693
42698
  for (const unitId in unitOtherData) {
42694
42699
  const unitData = unitOtherData[unitId];
@@ -42721,6 +42726,7 @@ let RegisterOtherFormulaService = class RegisterOtherFormulaService extends Disp
42721
42726
  }
42722
42727
  }
42723
42728
  this._formulaResult$.next(results);
42729
+ this._otherFormulaResultApplied$.next(params);
42724
42730
  }
42725
42731
  }));
42726
42732
  }
@@ -70,7 +70,12 @@ export declare class FFormula extends FBase {
70
70
  */
71
71
  sequenceNodesBuilder(formulaString: string): (string | ISequenceNode)[];
72
72
  /**
73
- * Start the calculation of the formula.
73
+ * Forces formula calculation explicitly.
74
+ *
75
+ * Normal facade mutations such as `range.setFormula()` already mark formula
76
+ * data dirty and schedule calculation automatically. Use this method only when
77
+ * an external data change did not produce a dirty command or an explicit full
78
+ * recalculation is required.
74
79
  *
75
80
  * @example
76
81
  * ```ts
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IRange, Nullable } from '@univerjs/core';
17
+ import type { ISetFormulaCalculationResultMutation } from '../commands/mutations/set-formula-calculation.mutation';
17
18
  import type { IOtherFormulaResult } from './formula-common';
18
19
  import { Disposable, ICommandService, LifecycleService } from '@univerjs/core';
19
20
  import { BehaviorSubject } from 'rxjs';
@@ -24,7 +25,8 @@ export declare enum OtherFormulaBizType {
24
25
  DATA_VALIDATION_CUSTOM = "dv-custom",
25
26
  CONDITIONAL_FORMATTING = "cf",
26
27
  DOC = "doc",
27
- SLIDE = "slide"
28
+ SLIDE = "slide",
29
+ SHAPE = "shape"
28
30
  }
29
31
  export declare class RegisterOtherFormulaService extends Disposable {
30
32
  private readonly _commandService;
@@ -41,6 +43,8 @@ export declare class RegisterOtherFormulaService extends Disposable {
41
43
  }>;
42
44
  private _formulaResult$;
43
45
  formulaResult$: import("rxjs").Observable<Record<string, Record<string, IOtherFormulaResult[]>>>;
46
+ private _otherFormulaResultApplied$;
47
+ otherFormulaResultApplied$: import("rxjs").Observable<ISetFormulaCalculationResultMutation>;
44
48
  calculateStarted$: BehaviorSubject<boolean>;
45
49
  constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService, _lifecycleService: LifecycleService);
46
50
  dispose(): void;