@univerjs/sheets-formula 0.5.4 → 0.5.5-experimental.20250123-34738ff

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.
@@ -1 +1 @@
1
- "use strict";const a={formula:{progress:{analyzing:"Analyzing",calculating:"Calculating","array-analysis":"Array Analysis","array-calculation":"Array Calculation",done:"Done"}}};module.exports=a;
1
+ "use strict";const locale={formula:{progress:{analyzing:"Analyzing",calculating:"Calculating","array-analysis":"Array Analysis","array-calculation":"Array Calculation",done:"Done"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const a={formula:{progress:{analyzing:"در حال تحلیل",calculating:"در حال محاسبه","array-analysis":"تحلیل آرایه","array-calculation":"محاسبه آرایه",done:"تمام"}}};module.exports=a;
1
+ "use strict";const locale={formula:{progress:{analyzing:"در حال تحلیل",calculating:"در حال محاسبه","array-analysis":"تحلیل آرایه","array-calculation":"محاسبه آرایه",done:"تمام"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const a={formula:{progress:{analyzing:"Analyse en cours",calculating:"Calcul en cours","array-analysis":"Analyse de tableau","array-calculation":"Calcul de tableau",done:"Terminé"}}};module.exports=a;
1
+ "use strict";const locale={formula:{progress:{analyzing:"Analyse en cours",calculating:"Calcul en cours","array-analysis":"Analyse de tableau","array-calculation":"Calcul de tableau",done:"Terminé"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const a={formula:{progress:{analyzing:"Анализ",calculating:"Вычисление","array-analysis":"Анализ массива","array-calculation":"Вычисление массива",done:"Готово"}}};module.exports=a;
1
+ "use strict";const locale={formula:{progress:{analyzing:"Анализ",calculating:"Вычисление","array-analysis":"Анализ массива","array-calculation":"Вычисление массива",done:"Готово"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const n={formula:{progress:{analyzing:"Đang phân tích",calculating:"Đang tính toán","array-analysis":"Phân tích mảng","array-calculation":"Tính toán mảng",done:"Hoàn tất"}}};module.exports=n;
1
+ "use strict";const locale={formula:{progress:{analyzing:"Đang phân tích",calculating:"Đang tính toán","array-analysis":"Phân tích mảng","array-calculation":"Tính toán mảng",done:"Hoàn tất"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const a={formula:{progress:{analyzing:"分析中",calculating:"计算中","array-analysis":"数组分析","array-calculation":"数组计算",done:"完成"}}};module.exports=a;
1
+ "use strict";const locale={formula:{progress:{analyzing:"分析中",calculating:"计算中","array-analysis":"数组分析","array-calculation":"数组计算",done:"完成"}}};module.exports=locale;
@@ -1 +1 @@
1
- "use strict";const a={formula:{progress:{analyzing:"分析中",calculating:"計算中","array-analysis":"陣列分析","array-calculation":"陣列計算",done:"完成"}}};module.exports=a;
1
+ "use strict";const locale={formula:{progress:{analyzing:"分析中",calculating:"計算中","array-analysis":"陣列分析","array-calculation":"陣列計算",done:"完成"}}};module.exports=locale;
package/lib/es/facade.js CHANGED
@@ -1,16 +1,18 @@
1
- import { FUniver as s, debounce as u, LifecycleService as m, ILogService as h, IConfigService as F, LifecycleStages as S } from "@univerjs/core";
2
- import { SetFormulaCalculationStartMutation as d } from "@univerjs/engine-formula";
3
- import { IRegisterFunctionService as i, RegisterFunctionService as l, PLUGIN_CONFIG_KEY_BASE as _ } from "@univerjs/sheets-formula";
4
- import { FFormula as f } from "@univerjs/engine-formula/facade";
5
- class C extends s {
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3
+ import { FUniver, debounce, LifecycleService, ILogService, IConfigService, LifecycleStages } from "@univerjs/core";
4
+ import { SetFormulaCalculationStartMutation } from "@univerjs/engine-formula";
5
+ import { IRegisterFunctionService, RegisterFunctionService, PLUGIN_CONFIG_KEY_BASE } from "@univerjs/sheets-formula";
6
+ import { FFormula } from "@univerjs/engine-formula/facade";
7
+ const _FUniverSheetsFormulaMixin = class _FUniverSheetsFormulaMixin extends FUniver {
6
8
  /**
7
9
  * Initialize the FUniver instance.
8
- * @private
10
+ * @ignore
9
11
  */
10
12
  _initialize() {
11
- this._debouncedFormulaCalculation = u(() => {
13
+ this._debouncedFormulaCalculation = debounce(() => {
12
14
  this._commandService.executeCommand(
13
- d.id,
15
+ SetFormulaCalculationStartMutation.id,
14
16
  {
15
17
  commands: [],
16
18
  forceCalculation: !0
@@ -21,23 +23,25 @@ class C extends s {
21
23
  );
22
24
  }, 10);
23
25
  }
24
- registerFunction(n) {
25
- let c = this._injector.get(i);
26
- c || (this._injector.add([i, { useClass: l }]), c = this._injector.get(i));
27
- const e = c.registerFunctions(n);
28
- return this._debouncedFormulaCalculation(), e;
26
+ registerFunction(config) {
27
+ let registerFunctionService = this._injector.get(IRegisterFunctionService);
28
+ registerFunctionService || (this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]), registerFunctionService = this._injector.get(IRegisterFunctionService));
29
+ const functionsDisposable = registerFunctionService.registerFunctions(config);
30
+ return this._debouncedFormulaCalculation(), functionsDisposable;
29
31
  }
30
- }
31
- s.extend(C);
32
- class v extends f {
32
+ };
33
+ __name(_FUniverSheetsFormulaMixin, "FUniverSheetsFormulaMixin");
34
+ let FUniverSheetsFormulaMixin = _FUniverSheetsFormulaMixin;
35
+ FUniver.extend(FUniverSheetsFormulaMixin);
36
+ const _FFormulaSheetsMixin = class _FFormulaSheetsMixin extends FFormula {
33
37
  /**
34
38
  * Initialize the FUniver instance.
35
- * @private
39
+ * @ignore
36
40
  */
37
41
  _initialize() {
38
- this._debouncedFormulaCalculation = u(() => {
42
+ this._debouncedFormulaCalculation = debounce(() => {
39
43
  this._commandService.executeCommand(
40
- d.id,
44
+ SetFormulaCalculationStartMutation.id,
41
45
  {
42
46
  commands: [],
43
47
  forceCalculation: !0
@@ -48,35 +52,37 @@ class v extends f {
48
52
  );
49
53
  }, 10);
50
54
  }
51
- setInitialFormulaComputing(n) {
52
- const e = this._injector.get(m).stage, t = this._injector.get(h), o = this._injector.get(F);
53
- e > S.Starting && t.warn("[FFormula]", "CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");
54
- const r = o.getConfig(_);
55
- r && (r.initialFormulaComputing = n);
55
+ setInitialFormulaComputing(calculationMode) {
56
+ const lifecycleStage = this._injector.get(LifecycleService).stage, logService = this._injector.get(ILogService), configService = this._injector.get(IConfigService);
57
+ lifecycleStage > LifecycleStages.Starting && logService.warn("[FFormula]", "CalculationMode is called after the Starting lifecycle and will take effect the next time the Univer Sheet is constructed. If you want it to take effect when the Univer Sheet is initialized this time, consider calling it before the Ready lifecycle or using configuration.");
58
+ const config = configService.getConfig(PLUGIN_CONFIG_KEY_BASE);
59
+ config && (config.initialFormulaComputing = calculationMode);
56
60
  }
57
- registerFunction(n, c, e) {
58
- var a;
59
- let t = this._injector.get(i);
60
- t || (this._injector.add([i, { useClass: l }]), t = this._injector.get(i));
61
- const o = {
62
- name: n,
63
- func: c,
64
- description: typeof e == "string" ? e : (a = e == null ? void 0 : e.description) != null ? a : "",
65
- locales: typeof e == "object" ? e.locales : void 0
66
- }, r = t.registerFunction(o);
67
- return this._debouncedFormulaCalculation(), r;
61
+ registerFunction(name, func, options) {
62
+ var _a;
63
+ let registerFunctionService = this._injector.get(IRegisterFunctionService);
64
+ registerFunctionService || (this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]), registerFunctionService = this._injector.get(IRegisterFunctionService));
65
+ const params = {
66
+ name,
67
+ func,
68
+ description: typeof options == "string" ? options : (_a = options == null ? void 0 : options.description) != null ? _a : "",
69
+ locales: typeof options == "object" ? options.locales : void 0
70
+ }, functionsDisposable = registerFunctionService.registerFunction(params);
71
+ return this._debouncedFormulaCalculation(), functionsDisposable;
68
72
  }
69
- registerAsyncFunction(n, c, e) {
70
- var a;
71
- let t = this._injector.get(i);
72
- t || (this._injector.add([i, { useClass: l }]), t = this._injector.get(i));
73
- const o = {
74
- name: n,
75
- func: c,
76
- description: typeof e == "string" ? e : (a = e == null ? void 0 : e.description) != null ? a : "",
77
- locales: typeof e == "object" ? e.locales : void 0
78
- }, r = t.registerAsyncFunction(o);
79
- return this._debouncedFormulaCalculation(), r;
73
+ registerAsyncFunction(name, func, options) {
74
+ var _a;
75
+ let registerFunctionService = this._injector.get(IRegisterFunctionService);
76
+ registerFunctionService || (this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]), registerFunctionService = this._injector.get(IRegisterFunctionService));
77
+ const params = {
78
+ name,
79
+ func,
80
+ description: typeof options == "string" ? options : (_a = options == null ? void 0 : options.description) != null ? _a : "",
81
+ locales: typeof options == "object" ? options.locales : void 0
82
+ }, functionsDisposable = registerFunctionService.registerAsyncFunction(params);
83
+ return this._debouncedFormulaCalculation(), functionsDisposable;
80
84
  }
81
- }
82
- f.extend(v);
85
+ };
86
+ __name(_FFormulaSheetsMixin, "FFormulaSheetsMixin");
87
+ let FFormulaSheetsMixin = _FFormulaSheetsMixin;
88
+ FFormula.extend(FFormulaSheetsMixin);