@univerjs/sheets-formula 0.6.9 → 0.6.10-alpha.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 +1 -1
- package/lib/es/facade.js +25 -19
- package/lib/facade.js +25 -19
- package/lib/types/facade/f-enum.d.ts +17 -0
- package/lib/types/facade/index.d.ts +1 -0
- package/lib/umd/facade.js +1 -1
- package/package.json +7 -7
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("@univerjs/core"),u=require("@univerjs/core/facade"),
|
|
1
|
+
"use strict";const s=require("@univerjs/core"),u=require("@univerjs/core/facade"),g=require("@univerjs/engine-formula"),i=require("@univerjs/sheets-formula"),F=require("@univerjs/engine-formula/facade");class d extends u.FUniver{_initialize(){this._debouncedFormulaCalculation=s.debounce(()=>{this._commandService.executeCommand(g.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(c){let n=this._injector.get(i.IRegisterFunctionService);n||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),n=this._injector.get(i.IRegisterFunctionService));const e=n.registerFunctions(c);return this._debouncedFormulaCalculation(),e}}u.FUniver.extend(d);class m extends F.FFormula{_initialize(){this._debouncedFormulaCalculation=s.debounce(()=>{this._commandService.executeCommand(g.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(c){const e=this._injector.get(s.LifecycleService).stage,t=this._injector.get(s.ILogService),r=this._injector.get(s.IConfigService);e>s.LifecycleStages.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.");const o=r.getConfig(i.PLUGIN_CONFIG_KEY_BASE);if(!o){r.setConfig(i.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:c});return}o.initialFormulaComputing=c}registerFunction(c,n,e){var a;let t=this._injector.get(i.IRegisterFunctionService);t||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),t=this._injector.get(i.IRegisterFunctionService));const r={name:c,func:n,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},o=t.registerFunction(r);return this._debouncedFormulaCalculation(),o}registerAsyncFunction(c,n,e){var a;let t=this._injector.get(i.IRegisterFunctionService);t||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),t=this._injector.get(i.IRegisterFunctionService));const r={name:c,func:n,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},o=t.registerAsyncFunction(r);return this._debouncedFormulaCalculation(),o}}F.FFormula.extend(m);class S{get CalculationMode(){return i.CalculationMode}}u.FEnum.extend(S);
|
package/lib/es/facade.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { debounce as
|
|
2
|
-
import { FUniver as
|
|
3
|
-
import { SetFormulaCalculationStartMutation as
|
|
4
|
-
import { IRegisterFunctionService as i, RegisterFunctionService as
|
|
5
|
-
import { FFormula as
|
|
6
|
-
class
|
|
1
|
+
import { debounce as m, LifecycleService as F, ILogService as h, IConfigService as S, LifecycleStages as _ } from "@univerjs/core";
|
|
2
|
+
import { FUniver as d, FEnum as C } from "@univerjs/core/facade";
|
|
3
|
+
import { SetFormulaCalculationStartMutation as g } from "@univerjs/engine-formula";
|
|
4
|
+
import { IRegisterFunctionService as i, RegisterFunctionService as l, PLUGIN_CONFIG_KEY_BASE as u, CalculationMode as v } from "@univerjs/sheets-formula";
|
|
5
|
+
import { FFormula as f } from "@univerjs/engine-formula/facade";
|
|
6
|
+
class y extends d {
|
|
7
7
|
/**
|
|
8
8
|
* Initialize the FUniver instance.
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
11
11
|
_initialize() {
|
|
12
|
-
this._debouncedFormulaCalculation =
|
|
12
|
+
this._debouncedFormulaCalculation = m(() => {
|
|
13
13
|
this._commandService.executeCommand(
|
|
14
|
-
|
|
14
|
+
g.id,
|
|
15
15
|
{
|
|
16
16
|
commands: [],
|
|
17
17
|
forceCalculation: !0
|
|
@@ -24,21 +24,21 @@ class C extends m {
|
|
|
24
24
|
}
|
|
25
25
|
registerFunction(c) {
|
|
26
26
|
let n = this._injector.get(i);
|
|
27
|
-
n || (this._injector.add([i, { useClass:
|
|
27
|
+
n || (this._injector.add([i, { useClass: l }]), n = this._injector.get(i));
|
|
28
28
|
const e = n.registerFunctions(c);
|
|
29
29
|
return this._debouncedFormulaCalculation(), e;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
class
|
|
32
|
+
d.extend(y);
|
|
33
|
+
class j extends f {
|
|
34
34
|
/**
|
|
35
35
|
* Initialize the FUniver instance.
|
|
36
36
|
* @ignore
|
|
37
37
|
*/
|
|
38
38
|
_initialize() {
|
|
39
|
-
this._debouncedFormulaCalculation =
|
|
39
|
+
this._debouncedFormulaCalculation = m(() => {
|
|
40
40
|
this._commandService.executeCommand(
|
|
41
|
-
|
|
41
|
+
g.id,
|
|
42
42
|
{
|
|
43
43
|
commands: [],
|
|
44
44
|
forceCalculation: !0
|
|
@@ -50,11 +50,11 @@ class v extends g {
|
|
|
50
50
|
}, 10);
|
|
51
51
|
}
|
|
52
52
|
setInitialFormulaComputing(c) {
|
|
53
|
-
const e = this._injector.get(
|
|
53
|
+
const e = this._injector.get(F).stage, t = this._injector.get(h), r = this._injector.get(S);
|
|
54
54
|
e > _.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.");
|
|
55
|
-
const o = r.getConfig(
|
|
55
|
+
const o = r.getConfig(u);
|
|
56
56
|
if (!o) {
|
|
57
|
-
r.setConfig(
|
|
57
|
+
r.setConfig(u, { initialFormulaComputing: c });
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
o.initialFormulaComputing = c;
|
|
@@ -62,7 +62,7 @@ class v extends g {
|
|
|
62
62
|
registerFunction(c, n, e) {
|
|
63
63
|
var a;
|
|
64
64
|
let t = this._injector.get(i);
|
|
65
|
-
t || (this._injector.add([i, { useClass:
|
|
65
|
+
t || (this._injector.add([i, { useClass: l }]), t = this._injector.get(i));
|
|
66
66
|
const r = {
|
|
67
67
|
name: c,
|
|
68
68
|
func: n,
|
|
@@ -74,7 +74,7 @@ class v extends g {
|
|
|
74
74
|
registerAsyncFunction(c, n, e) {
|
|
75
75
|
var a;
|
|
76
76
|
let t = this._injector.get(i);
|
|
77
|
-
t || (this._injector.add([i, { useClass:
|
|
77
|
+
t || (this._injector.add([i, { useClass: l }]), t = this._injector.get(i));
|
|
78
78
|
const r = {
|
|
79
79
|
name: c,
|
|
80
80
|
func: n,
|
|
@@ -84,4 +84,10 @@ class v extends g {
|
|
|
84
84
|
return this._debouncedFormulaCalculation(), o;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
f.extend(j);
|
|
88
|
+
class b {
|
|
89
|
+
get CalculationMode() {
|
|
90
|
+
return v;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
C.extend(b);
|
package/lib/facade.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { debounce as
|
|
2
|
-
import { FUniver as
|
|
3
|
-
import { SetFormulaCalculationStartMutation as
|
|
4
|
-
import { IRegisterFunctionService as i, RegisterFunctionService as
|
|
5
|
-
import { FFormula as
|
|
6
|
-
class
|
|
1
|
+
import { debounce as m, LifecycleService as F, ILogService as h, IConfigService as S, LifecycleStages as _ } from "@univerjs/core";
|
|
2
|
+
import { FUniver as d, FEnum as C } from "@univerjs/core/facade";
|
|
3
|
+
import { SetFormulaCalculationStartMutation as g } from "@univerjs/engine-formula";
|
|
4
|
+
import { IRegisterFunctionService as i, RegisterFunctionService as l, PLUGIN_CONFIG_KEY_BASE as u, CalculationMode as v } from "@univerjs/sheets-formula";
|
|
5
|
+
import { FFormula as f } from "@univerjs/engine-formula/facade";
|
|
6
|
+
class y extends d {
|
|
7
7
|
/**
|
|
8
8
|
* Initialize the FUniver instance.
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
11
11
|
_initialize() {
|
|
12
|
-
this._debouncedFormulaCalculation =
|
|
12
|
+
this._debouncedFormulaCalculation = m(() => {
|
|
13
13
|
this._commandService.executeCommand(
|
|
14
|
-
|
|
14
|
+
g.id,
|
|
15
15
|
{
|
|
16
16
|
commands: [],
|
|
17
17
|
forceCalculation: !0
|
|
@@ -24,21 +24,21 @@ class C extends m {
|
|
|
24
24
|
}
|
|
25
25
|
registerFunction(c) {
|
|
26
26
|
let n = this._injector.get(i);
|
|
27
|
-
n || (this._injector.add([i, { useClass:
|
|
27
|
+
n || (this._injector.add([i, { useClass: l }]), n = this._injector.get(i));
|
|
28
28
|
const e = n.registerFunctions(c);
|
|
29
29
|
return this._debouncedFormulaCalculation(), e;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
class
|
|
32
|
+
d.extend(y);
|
|
33
|
+
class j extends f {
|
|
34
34
|
/**
|
|
35
35
|
* Initialize the FUniver instance.
|
|
36
36
|
* @ignore
|
|
37
37
|
*/
|
|
38
38
|
_initialize() {
|
|
39
|
-
this._debouncedFormulaCalculation =
|
|
39
|
+
this._debouncedFormulaCalculation = m(() => {
|
|
40
40
|
this._commandService.executeCommand(
|
|
41
|
-
|
|
41
|
+
g.id,
|
|
42
42
|
{
|
|
43
43
|
commands: [],
|
|
44
44
|
forceCalculation: !0
|
|
@@ -50,11 +50,11 @@ class v extends g {
|
|
|
50
50
|
}, 10);
|
|
51
51
|
}
|
|
52
52
|
setInitialFormulaComputing(c) {
|
|
53
|
-
const e = this._injector.get(
|
|
53
|
+
const e = this._injector.get(F).stage, t = this._injector.get(h), r = this._injector.get(S);
|
|
54
54
|
e > _.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.");
|
|
55
|
-
const o = r.getConfig(
|
|
55
|
+
const o = r.getConfig(u);
|
|
56
56
|
if (!o) {
|
|
57
|
-
r.setConfig(
|
|
57
|
+
r.setConfig(u, { initialFormulaComputing: c });
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
o.initialFormulaComputing = c;
|
|
@@ -62,7 +62,7 @@ class v extends g {
|
|
|
62
62
|
registerFunction(c, n, e) {
|
|
63
63
|
var a;
|
|
64
64
|
let t = this._injector.get(i);
|
|
65
|
-
t || (this._injector.add([i, { useClass:
|
|
65
|
+
t || (this._injector.add([i, { useClass: l }]), t = this._injector.get(i));
|
|
66
66
|
const r = {
|
|
67
67
|
name: c,
|
|
68
68
|
func: n,
|
|
@@ -74,7 +74,7 @@ class v extends g {
|
|
|
74
74
|
registerAsyncFunction(c, n, e) {
|
|
75
75
|
var a;
|
|
76
76
|
let t = this._injector.get(i);
|
|
77
|
-
t || (this._injector.add([i, { useClass:
|
|
77
|
+
t || (this._injector.add([i, { useClass: l }]), t = this._injector.get(i));
|
|
78
78
|
const r = {
|
|
79
79
|
name: c,
|
|
80
80
|
func: n,
|
|
@@ -84,4 +84,10 @@ class v extends g {
|
|
|
84
84
|
return this._debouncedFormulaCalculation(), o;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
f.extend(j);
|
|
88
|
+
class b {
|
|
89
|
+
get CalculationMode() {
|
|
90
|
+
return v;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
C.extend(b);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CalculationMode } from '@univerjs/sheets-formula';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export interface IFSheetsFormulaEnum {
|
|
6
|
+
/**
|
|
7
|
+
* Define the calculation mode during initialization
|
|
8
|
+
*/
|
|
9
|
+
CalculationMode: typeof CalculationMode;
|
|
10
|
+
}
|
|
11
|
+
export declare class FSheetsFormulaEnum implements IFSheetsFormulaEnum {
|
|
12
|
+
get CalculationMode(): typeof CalculationMode;
|
|
13
|
+
}
|
|
14
|
+
declare module '@univerjs/core/facade' {
|
|
15
|
+
interface FEnum extends IFSheetsFormulaEnum {
|
|
16
|
+
}
|
|
17
|
+
}
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(t,o){typeof exports=="object"&&typeof module<"u"?o(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula"),require("@univerjs/engine-formula/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/engine-formula","@univerjs/sheets-formula","@univerjs/engine-formula/facade"],o):(t=typeof globalThis<"u"?globalThis:t||self,o(t.UniverCore,t.UniverCoreFacade,t.UniverEngineFormula,t.UniverSheetsFormula,t.UniverEngineFormulaFacade))})(this,function(t,o,l,i,d){"use strict";class f extends o.FUniver{_initialize(){this._debouncedFormulaCalculation=t.debounce(()=>{this._commandService.executeCommand(l.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(r){let c=this._injector.get(i.IRegisterFunctionService);c||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),c=this._injector.get(i.IRegisterFunctionService));const e=c.registerFunctions(r);return this._debouncedFormulaCalculation(),e}}o.FUniver.extend(f);class v extends d.FFormula{_initialize(){this._debouncedFormulaCalculation=t.debounce(()=>{this._commandService.executeCommand(l.SetFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(r){const e=this._injector.get(t.LifecycleService).stage,n=this._injector.get(t.ILogService),u=this._injector.get(t.IConfigService);e>t.LifecycleStages.Starting&&n.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.");const a=u.getConfig(i.PLUGIN_CONFIG_KEY_BASE);if(!a){u.setConfig(i.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:r});return}a.initialFormulaComputing=r}registerFunction(r,c,e){var s;let n=this._injector.get(i.IRegisterFunctionService);n||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),n=this._injector.get(i.IRegisterFunctionService));const u={name:r,func:c,description:typeof e=="string"?e:(s=e==null?void 0:e.description)!=null?s:"",locales:typeof e=="object"?e.locales:void 0},a=n.registerFunction(u);return this._debouncedFormulaCalculation(),a}registerAsyncFunction(r,c,e){var s;let n=this._injector.get(i.IRegisterFunctionService);n||(this._injector.add([i.IRegisterFunctionService,{useClass:i.RegisterFunctionService}]),n=this._injector.get(i.IRegisterFunctionService));const u={name:r,func:c,description:typeof e=="string"?e:(s=e==null?void 0:e.description)!=null?s:"",locales:typeof e=="object"?e.locales:void 0},a=n.registerAsyncFunction(u);return this._debouncedFormulaCalculation(),a}}d.FFormula.extend(v);class S{get CalculationMode(){return i.CalculationMode}}o.FEnum.extend(S)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-formula",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "DreamNum <developer@univer.ai>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
"rxjs": ">=7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/
|
|
62
|
-
"@univerjs/rpc": "0.6.
|
|
63
|
-
"@univerjs/sheets": "0.6.
|
|
60
|
+
"@univerjs/engine-formula": "0.6.10-alpha.0",
|
|
61
|
+
"@univerjs/core": "0.6.10-alpha.0",
|
|
62
|
+
"@univerjs/rpc": "0.6.10-alpha.0",
|
|
63
|
+
"@univerjs/sheets": "0.6.10-alpha.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"rxjs": "^7.8.1",
|
|
67
67
|
"typescript": "^5.8.2",
|
|
68
68
|
"vite": "^6.2.3",
|
|
69
69
|
"vitest": "^3.0.9",
|
|
70
|
-
"@univerjs/
|
|
71
|
-
"@univerjs
|
|
70
|
+
"@univerjs-infra/shared": "0.6.10-alpha.0",
|
|
71
|
+
"@univerjs/docs": "0.6.10-alpha.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"test": "vitest run",
|