@univerjs/sheets-formula 0.15.2 → 0.15.3-insiders.20260131-b9b8805
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/cjs/locale/sk-SK.js +1 -0
- package/lib/es/facade.js +105 -74
- package/lib/es/index.js +10 -10
- package/lib/es/locale/sk-SK.js +14 -0
- package/lib/facade.js +105 -74
- package/lib/index.js +10 -10
- package/lib/locale/sk-SK.js +14 -0
- package/lib/types/facade/f-formula.d.ts +56 -1
- package/lib/types/locale/sk-SK.d.ts +3 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -0
- package/package.json +9 -9
- package/LICENSE +0 -176
package/lib/cjs/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const C=require("@univerjs/core"),I=require("@univerjs/core/facade"),s=require("@univerjs/engine-formula"),c=require("@univerjs/sheets-formula"),b=require("@univerjs/engine-formula/facade"),y=require("@univerjs/sheets"),R=require("@univerjs/sheets/facade");class p extends I.FUniver{_initialize(){this._debouncedFormulaCalculation=C.debounce(()=>{this._commandService.executeCommand(s.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let o=this._injector.get(c.IRegisterFunctionService);o||(this._injector.add([c.IRegisterFunctionService,{useClass:c.RegisterFunctionService}]),o=this._injector.get(c.IRegisterFunctionService));const e=o.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}I.FUniver.extend(p);class M extends b.FFormula{_initialize(){this._debouncedFormulaCalculation=C.debounce(()=>{this._commandService.executeCommand(s.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(C.LifecycleService).stage,n=this._injector.get(C.ILogService),i=this._injector.get(C.IConfigService);e>C.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 r=i.getConfig(c.PLUGIN_CONFIG_KEY_BASE);if(!r){i.setConfig(c.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,o,e){var a;let n=this._injector.get(c.IRegisterFunctionService);n||(this._injector.add([c.IRegisterFunctionService,{useClass:c.RegisterFunctionService}]),n=this._injector.get(c.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerFunction(i);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,o,e){var a;let n=this._injector.get(c.IRegisterFunctionService);n||(this._injector.add([c.IRegisterFunctionService,{useClass:c.RegisterFunctionService}]),n=this._injector.get(c.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerAsyncFunction(i);return this._debouncedFormulaCalculation(),r}calculationResultApplied(t){let o=!1,e=!1,n=null;return this._commandService.onCommandExecuted((i,r)=>{i.id!==s.SetFormulaCalculationResultMutation.id&&i.id!==y.SetRangeValuesMutation.id||(i.id===s.SetFormulaCalculationResultMutation.id&&(o=!0,n=i.params),i.id===y.SetRangeValuesMutation.id&&(r!=null&&r.applyFormulaCalculationResult)&&(e=!0),!(!o||!e)&&requestIdleCallback(()=>{t(n)}))})}onCalculationResultApplied(){return new Promise((t,o)=>{let e=!1,n=!1;const i=setTimeout(()=>{l(),o(new Error("Calculation end timeout"))},6e4),r=setTimeout(()=>{e||(l(),t())},500),a=this.calculationProcessing(g=>{const{stage:m,totalArrayFormulasToCalculate:f,totalFormulasToCalculate:d}=g;if(m===s.FormulaExecuteStageType.START_CALCULATION&&f+d===0){l(),t();return}e||(e=!0,clearTimeout(r))}),_=this.calculationResultApplied(()=>{n||(n=!0,l(),t())});function l(){clearTimeout(i),clearTimeout(r),a.dispose(),_.dispose()}})}}b.FFormula.extend(M);class j{get CalculationMode(){return c.CalculationMode}}I.FEnum.extend(j);class E extends R.FWorkbook{getAllFormulaError(){const t=[],o=this._workbook,e=o.getUnitId(),n=o.getSheets(),i=this._injector.get(s.FormulaDataModel).getArrayFormulaCellData();return n.forEach(r=>{var m;const a=r.getName(),_=r.getSheetId(),l=r.getCellMatrix(),g=((m=i==null?void 0:i[e])==null?void 0:m[_])||{};l.forValue((f,d,h)=>{var S;if(!h)return;const F=(S=g==null?void 0:g[f])==null?void 0:S[d],u=s.extractFormulaError(h,!!F);u&&t.push({sheetName:a,row:f,column:d,formula:h.f||"",errorType:u})})}),t}}R.FWorkbook.extend(E);class T extends R.FRange{getFormulaError(){var d,h;const t=[],o=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),n=this._worksheet.getName(),i=this._workbook.getSheetBySheetId(e);if(!i)return t;const r=this._injector.get(s.FormulaDataModel).getArrayFormulaCellData(),a=((d=r==null?void 0:r[o])==null?void 0:d[e])||{},_=i.getCellMatrix(),{startRow:l,endRow:g,startColumn:m,endColumn:f}=this._range;for(let F=l;F<=g;F++)for(let u=m;u<=f;u++){const S=_.getValue(F,u);if(!S)continue;const k=(h=a==null?void 0:a[F])==null?void 0:h[u],x=s.extractFormulaError(S,!!k);x&&t.push({sheetName:n,row:F,column:u,formula:S.f||"",errorType:x})}return t}}R.FRange.extend(T);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a={formula:{progress:{analyzing:"Analyzovanie",calculating:"Výpočet","array-analysis":"Analýza poľa","array-calculation":"Výpočet poľa",done:"Hotovo"}}};module.exports=a;
|
package/lib/es/facade.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { debounce as
|
|
2
|
-
import { FUniver as
|
|
3
|
-
import { SetTriggerFormulaCalculationStartMutation as
|
|
4
|
-
import { IRegisterFunctionService as
|
|
5
|
-
import { FFormula as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { debounce as v, LifecycleService as E, ILogService as D, IConfigService as L, LifecycleStages as U } from "@univerjs/core";
|
|
2
|
+
import { FUniver as I, FEnum as N } from "@univerjs/core/facade";
|
|
3
|
+
import { SetTriggerFormulaCalculationStartMutation as k, SetFormulaCalculationResultMutation as y, FormulaExecuteStageType as z, FormulaDataModel as j, extractFormulaError as R } from "@univerjs/engine-formula";
|
|
4
|
+
import { IRegisterFunctionService as a, RegisterFunctionService as _, PLUGIN_CONFIG_KEY_BASE as x, CalculationMode as P } from "@univerjs/sheets-formula";
|
|
5
|
+
import { FFormula as T } from "@univerjs/engine-formula/facade";
|
|
6
|
+
import { SetRangeValuesMutation as b } from "@univerjs/sheets";
|
|
7
|
+
import { FWorkbook as w, FRange as M } from "@univerjs/sheets/facade";
|
|
8
|
+
class V extends I {
|
|
8
9
|
/**
|
|
9
10
|
* Initialize the FUniver instance.
|
|
10
11
|
* @ignore
|
|
11
12
|
*/
|
|
12
13
|
_initialize() {
|
|
13
|
-
this._debouncedFormulaCalculation =
|
|
14
|
+
this._debouncedFormulaCalculation = v(() => {
|
|
14
15
|
this._commandService.executeCommand(
|
|
15
|
-
|
|
16
|
+
k.id,
|
|
16
17
|
{
|
|
17
18
|
commands: [],
|
|
18
19
|
forceCalculation: !0
|
|
@@ -24,22 +25,22 @@ class z extends b {
|
|
|
24
25
|
}, 10);
|
|
25
26
|
}
|
|
26
27
|
registerFunction(t) {
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
const e =
|
|
28
|
+
let n = this._injector.get(a);
|
|
29
|
+
n || (this._injector.add([a, { useClass: _ }]), n = this._injector.get(a));
|
|
30
|
+
const e = n.registerFunctions(t);
|
|
30
31
|
return this._debouncedFormulaCalculation(), e;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
class
|
|
34
|
+
I.extend(V);
|
|
35
|
+
class W extends T {
|
|
35
36
|
/**
|
|
36
37
|
* Initialize the FUniver instance.
|
|
37
38
|
* @ignore
|
|
38
39
|
*/
|
|
39
40
|
_initialize() {
|
|
40
|
-
this._debouncedFormulaCalculation =
|
|
41
|
+
this._debouncedFormulaCalculation = v(() => {
|
|
41
42
|
this._commandService.executeCommand(
|
|
42
|
-
|
|
43
|
+
k.id,
|
|
43
44
|
{
|
|
44
45
|
commands: [],
|
|
45
46
|
forceCalculation: !0
|
|
@@ -51,89 +52,119 @@ class T extends w {
|
|
|
51
52
|
}, 10);
|
|
52
53
|
}
|
|
53
54
|
setInitialFormulaComputing(t) {
|
|
54
|
-
const e = this._injector.get(
|
|
55
|
-
e >
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
-
|
|
55
|
+
const e = this._injector.get(E).stage, o = this._injector.get(D), i = this._injector.get(L);
|
|
56
|
+
e > U.Starting && o.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.");
|
|
57
|
+
const r = i.getConfig(x);
|
|
58
|
+
if (!r) {
|
|
59
|
+
i.setConfig(x, { initialFormulaComputing: t });
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
r.initialFormulaComputing = t;
|
|
62
63
|
}
|
|
63
|
-
registerFunction(t,
|
|
64
|
-
var
|
|
65
|
-
let o = this._injector.get(
|
|
66
|
-
o || (this._injector.add([
|
|
67
|
-
const
|
|
64
|
+
registerFunction(t, n, e) {
|
|
65
|
+
var l;
|
|
66
|
+
let o = this._injector.get(a);
|
|
67
|
+
o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
|
|
68
|
+
const i = {
|
|
68
69
|
name: t,
|
|
69
|
-
func:
|
|
70
|
-
description: typeof e == "string" ? e : (
|
|
70
|
+
func: n,
|
|
71
|
+
description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
|
|
71
72
|
locales: typeof e == "object" ? e.locales : void 0
|
|
72
|
-
},
|
|
73
|
-
return this._debouncedFormulaCalculation(),
|
|
73
|
+
}, r = o.registerFunction(i);
|
|
74
|
+
return this._debouncedFormulaCalculation(), r;
|
|
74
75
|
}
|
|
75
|
-
registerAsyncFunction(t,
|
|
76
|
-
var
|
|
77
|
-
let o = this._injector.get(
|
|
78
|
-
o || (this._injector.add([
|
|
79
|
-
const
|
|
76
|
+
registerAsyncFunction(t, n, e) {
|
|
77
|
+
var l;
|
|
78
|
+
let o = this._injector.get(a);
|
|
79
|
+
o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
|
|
80
|
+
const i = {
|
|
80
81
|
name: t,
|
|
81
|
-
func:
|
|
82
|
-
description: typeof e == "string" ? e : (
|
|
82
|
+
func: n,
|
|
83
|
+
description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
|
|
83
84
|
locales: typeof e == "object" ? e.locales : void 0
|
|
84
|
-
},
|
|
85
|
-
return this._debouncedFormulaCalculation(),
|
|
85
|
+
}, r = o.registerAsyncFunction(i);
|
|
86
|
+
return this._debouncedFormulaCalculation(), r;
|
|
87
|
+
}
|
|
88
|
+
calculationResultApplied(t) {
|
|
89
|
+
let n = !1, e = !1, o = null;
|
|
90
|
+
return this._commandService.onCommandExecuted((i, r) => {
|
|
91
|
+
i.id !== y.id && i.id !== b.id || (i.id === y.id && (n = !0, o = i.params), i.id === b.id && (r != null && r.applyFormulaCalculationResult) && (e = !0), !(!n || !e) && requestIdleCallback(() => {
|
|
92
|
+
t(o);
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
onCalculationResultApplied() {
|
|
97
|
+
return new Promise((t, n) => {
|
|
98
|
+
let e = !1, o = !1;
|
|
99
|
+
const i = setTimeout(() => {
|
|
100
|
+
c(), n(new Error("Calculation end timeout"));
|
|
101
|
+
}, 6e4), r = setTimeout(() => {
|
|
102
|
+
e || (c(), t());
|
|
103
|
+
}, 500), l = this.calculationProcessing((u) => {
|
|
104
|
+
const { stage: g, totalArrayFormulasToCalculate: f, totalFormulasToCalculate: d } = u;
|
|
105
|
+
if (g === z.START_CALCULATION && f + d === 0) {
|
|
106
|
+
c(), t();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
e || (e = !0, clearTimeout(r));
|
|
110
|
+
}), C = this.calculationResultApplied(() => {
|
|
111
|
+
o || (o = !0, c(), t());
|
|
112
|
+
});
|
|
113
|
+
function c() {
|
|
114
|
+
clearTimeout(i), clearTimeout(r), l.dispose(), C.dispose();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
86
117
|
}
|
|
87
118
|
}
|
|
88
|
-
|
|
119
|
+
T.extend(W);
|
|
89
120
|
class B {
|
|
90
121
|
get CalculationMode() {
|
|
91
|
-
return
|
|
122
|
+
return P;
|
|
92
123
|
}
|
|
93
124
|
}
|
|
94
|
-
|
|
95
|
-
class G extends
|
|
125
|
+
N.extend(B);
|
|
126
|
+
class G extends w {
|
|
96
127
|
getAllFormulaError() {
|
|
97
|
-
const t = [],
|
|
98
|
-
return o.forEach((
|
|
99
|
-
var
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
sheetName:
|
|
107
|
-
row:
|
|
128
|
+
const t = [], n = this._workbook, e = n.getUnitId(), o = n.getSheets(), i = this._injector.get(j).getArrayFormulaCellData();
|
|
129
|
+
return o.forEach((r) => {
|
|
130
|
+
var g;
|
|
131
|
+
const l = r.getName(), C = r.getSheetId(), c = r.getCellMatrix(), u = ((g = i == null ? void 0 : i[e]) == null ? void 0 : g[C]) || {};
|
|
132
|
+
c.forValue((f, d, h) => {
|
|
133
|
+
var F;
|
|
134
|
+
if (!h) return;
|
|
135
|
+
const m = (F = u == null ? void 0 : u[f]) == null ? void 0 : F[d], s = R(h, !!m);
|
|
136
|
+
s && t.push({
|
|
137
|
+
sheetName: l,
|
|
138
|
+
row: f,
|
|
108
139
|
column: d,
|
|
109
|
-
formula:
|
|
110
|
-
errorType:
|
|
140
|
+
formula: h.f || "",
|
|
141
|
+
errorType: s
|
|
111
142
|
});
|
|
112
143
|
});
|
|
113
144
|
}), t;
|
|
114
145
|
}
|
|
115
146
|
}
|
|
116
|
-
|
|
117
|
-
class
|
|
147
|
+
w.extend(G);
|
|
148
|
+
class O extends M {
|
|
118
149
|
getFormulaError() {
|
|
119
|
-
var d,
|
|
120
|
-
const t = [],
|
|
121
|
-
if (!
|
|
122
|
-
const
|
|
123
|
-
for (let
|
|
124
|
-
for (let
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
127
|
-
const
|
|
128
|
-
|
|
150
|
+
var d, h;
|
|
151
|
+
const t = [], n = this._workbook.getUnitId(), e = this._worksheet.getSheetId(), o = this._worksheet.getName(), i = this._workbook.getSheetBySheetId(e);
|
|
152
|
+
if (!i) return t;
|
|
153
|
+
const r = this._injector.get(j).getArrayFormulaCellData(), l = ((d = r == null ? void 0 : r[n]) == null ? void 0 : d[e]) || {}, C = i.getCellMatrix(), { startRow: c, endRow: u, startColumn: g, endColumn: f } = this._range;
|
|
154
|
+
for (let m = c; m <= u; m++)
|
|
155
|
+
for (let s = g; s <= f; s++) {
|
|
156
|
+
const F = C.getValue(m, s);
|
|
157
|
+
if (!F) continue;
|
|
158
|
+
const A = (h = l == null ? void 0 : l[m]) == null ? void 0 : h[s], p = R(F, !!A);
|
|
159
|
+
p && t.push({
|
|
129
160
|
sheetName: o,
|
|
130
|
-
row:
|
|
131
|
-
column:
|
|
132
|
-
formula:
|
|
133
|
-
errorType:
|
|
161
|
+
row: m,
|
|
162
|
+
column: s,
|
|
163
|
+
formula: F.f || "",
|
|
164
|
+
errorType: p
|
|
134
165
|
});
|
|
135
166
|
}
|
|
136
167
|
return t;
|
|
137
168
|
}
|
|
138
169
|
}
|
|
139
|
-
|
|
170
|
+
M.extend(O);
|
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Wa = Object.defineProperty;
|
|
2
2
|
var Ka = (a, e, n) => e in a ? Wa(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
|
|
3
3
|
var K = (a, e, n) => Ka(a, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t,
|
|
4
|
+
import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t, LocaleService as Gt, ILogService as nn, IConfigService as Ce, isFormulaString as Me, isFormulaId as sa, cellToRange as da, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as X, UniverInstanceType as k, Injector as ct, isRealNum as rn, createIdentifier as Ht, toDisposable as J, moveRangeByOffset as yt, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as on, DependentOn as pa, Plugin as La, merge as Pa, touchDependencies as Ue, isNodeEnv as Xt } from "@univerjs/core";
|
|
5
5
|
import { SetRangeValuesCommand as Ta, SheetsSelectionsService as un, getSheetCommandTarget as mn, findFirstNonEmptyCell as fn, alignToMergedCellsBorders as It, expandToContinuousRange as cn, SetSelectionsOperation as ln, SheetInterceptorService as lt, INTERCEPTOR_POINT as Ea, InterceptCellContentPriority as sn, SetRangeValuesMutation as j, SetStyleCommand as wt, SetBorderCommand as Ia, ClearSelectionFormatCommand as Na, handleMoveCols as Ra, EffectRefRangId as w, runRefRangeMutations as Y, handleMoveRows as Sa, handleMoveRange as Aa, handleInsertRangeMoveRight as Ca, handleInsertRangeMoveDown as Da, handleDeleteRangeMoveUp as ba, handleDeleteRangeMoveLeft as Oa, handleIRemoveCol as Ma, handleIRemoveRow as xa, handleInsertCol as _a, handleInsertRow as ya, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as qa, RemoveSheetCommand as dn, SetWorksheetNameCommand as pn, DeleteRangeMoveLeftCommand as Ln, DeleteRangeMoveUpCommand as Pn, RemoveColCommand as Tn, RemoveRowCommand as En, InsertRangeMoveDownCommand as In, InsertRangeMoveRightCommand as Nn, InsertColCommand as Rn, InsertRowCommand as Sn, MoveColsCommand as An, MoveRowsCommand as Cn, MoveRangeCommand as Dn, RemoveSheetMutation as gt, InsertSheetMutation as qt, SetRangeCustomMetadataCommand as bn, MoveRangeMutation as Wt, MoveRowsMutation as Kt, MoveColsMutation as kt, ReorderRangeMutation as Qt, RemoveRowMutation as jt, RemoveColMutation as $t, InsertColMutation as zt, InsertRowMutation as Zt, SetRowHiddenMutation as Jt, SetRowVisibleMutation as ea, SetWorksheetActiveOperation as ha, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as On, handleDefaultRangeChangeWithEffectRefCommands as ta, getSeparateEffectedRangesOnCommand as Mn, handleCommonDefaultRangeChangeWithEffectRefCommands as xn, UniverSheetsPlugin as _n } from "@univerjs/sheets";
|
|
6
|
-
import { serializeRange as Se, FormulaDataModel as ye, ErrorType as Q, SetImageFormulaDataMutation as yn,
|
|
6
|
+
import { serializeRange as Se, FormulaDataModel as ye, ErrorType as Q, SetImageFormulaDataMutation as yn, RegisterOtherFormulaService as gn, SetFormulaCalculationStartMutation as Fe, SetFormulaStringBatchCalculationMutation as qn, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE as hn, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as Un, SetFormulaCalculationStopMutation as aa, SetFormulaCalculationNotificationMutation as Fn, FormulaExecuteStageType as Be, FormulaExecutedStateType as be, SetTriggerFormulaCalculationStartMutation as je, IActiveDirtyManagerService as Ua, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, LexerTreeBuilder as dt, generateStringWithSequence as $e, SetDefinedNameMutation as Ae, IDefinedNamesService as pt, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as ht, initSheetFormulaData as na, RemoveDefinedNameMutation as Ut, SetFormulaCalculationResultMutation as Bn, stripErrorMargin as vn, IFunctionService as Lt, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as W, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as Vn, functionArray as Gn, functionCompatibility as Hn, functionCube as wn, functionDatabase as Yn, functionDate as Xn, functionEngineering as Wn, functionFinancial as Kn, functionInformation as kn, functionLogical as Qn, functionLookup as jn, functionMath as $n, functionMeta as zn, functionStatistical as Zn, functionText as Jn, functionUniver as ei, functionWeb as ti, OtherFormulaMarkDirty as ai, SetSuperTableMutation as ni, RemoveSuperTableMutation as ii, serializeRangeWithSheet as ze, ISuperTableService as ri, serializeRangeWithSpreadsheet as ra, CustomFunction as Ft, AsyncCustomFunction as Fa, UniverFormulaEnginePlugin as oi, IFormulaCurrentConfigService as ui, Lexer as mi, AstTreeBuilder as fi, Interpreter as ci, generateExecuteAstNodeData as li, getObjectValue as si } from "@univerjs/engine-formula";
|
|
7
7
|
import { BehaviorSubject as di, map as pi } from "rxjs";
|
|
8
8
|
import { IRPCChannelService as Ba, fromModule as Li, toModule as Pi } from "@univerjs/rpc";
|
|
9
9
|
const Ti = {
|
|
@@ -1599,10 +1599,10 @@ let Je = class extends ee {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
};
|
|
1601
1601
|
Je = cr([
|
|
1602
|
-
Ve(0,
|
|
1602
|
+
Ve(0, pt),
|
|
1603
1603
|
Ve(1, Ee),
|
|
1604
1604
|
Ve(2, H(lt)),
|
|
1605
|
-
Ve(3, H(
|
|
1605
|
+
Ve(3, H(dt))
|
|
1606
1606
|
], Je);
|
|
1607
1607
|
var lr = Object.getOwnPropertyDescriptor, sr = (a, e, n, i) => {
|
|
1608
1608
|
for (var r = i > 1 ? void 0 : i ? lr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
|
|
@@ -1873,10 +1873,10 @@ let et = class extends ee {
|
|
|
1873
1873
|
et = sr([
|
|
1874
1874
|
me(0, Ee),
|
|
1875
1875
|
me(1, ue),
|
|
1876
|
-
me(2, H(
|
|
1876
|
+
me(2, H(dt)),
|
|
1877
1877
|
me(3, H(ye)),
|
|
1878
1878
|
me(4, H(lt)),
|
|
1879
|
-
me(5,
|
|
1879
|
+
me(5, pt),
|
|
1880
1880
|
me(6, Ce),
|
|
1881
1881
|
me(7, H(ct))
|
|
1882
1882
|
], et);
|
|
@@ -2335,9 +2335,9 @@ at = Tr([
|
|
|
2335
2335
|
Le(1, Ce),
|
|
2336
2336
|
Le(2, H(lt)),
|
|
2337
2337
|
Le(3, H(ye)),
|
|
2338
|
-
Le(4, H(
|
|
2338
|
+
Le(4, H(dt)),
|
|
2339
2339
|
Le(5, Lt),
|
|
2340
|
-
Le(6,
|
|
2340
|
+
Le(6, pt)
|
|
2341
2341
|
], at);
|
|
2342
2342
|
const Er = [
|
|
2343
2343
|
{
|
|
@@ -15910,7 +15910,7 @@ let nt = class extends ee {
|
|
|
15910
15910
|
};
|
|
15911
15911
|
nt = vr([
|
|
15912
15912
|
Ge(0, Pt),
|
|
15913
|
-
Ge(1,
|
|
15913
|
+
Ge(1, pt),
|
|
15914
15914
|
Ge(2, Ee),
|
|
15915
15915
|
Ge(3, ue)
|
|
15916
15916
|
], nt);
|
|
@@ -16259,7 +16259,7 @@ let vt = class extends ee {
|
|
|
16259
16259
|
};
|
|
16260
16260
|
vt = Wr([
|
|
16261
16261
|
we(0, H(On)),
|
|
16262
|
-
we(1, H(
|
|
16262
|
+
we(1, H(dt)),
|
|
16263
16263
|
we(2, Ee),
|
|
16264
16264
|
we(3, H(ct))
|
|
16265
16265
|
], vt);
|
package/lib/facade.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { debounce as
|
|
2
|
-
import { FUniver as
|
|
3
|
-
import { SetTriggerFormulaCalculationStartMutation as
|
|
4
|
-
import { IRegisterFunctionService as
|
|
5
|
-
import { FFormula as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { debounce as v, LifecycleService as E, ILogService as D, IConfigService as L, LifecycleStages as U } from "@univerjs/core";
|
|
2
|
+
import { FUniver as I, FEnum as N } from "@univerjs/core/facade";
|
|
3
|
+
import { SetTriggerFormulaCalculationStartMutation as k, SetFormulaCalculationResultMutation as y, FormulaExecuteStageType as z, FormulaDataModel as j, extractFormulaError as R } from "@univerjs/engine-formula";
|
|
4
|
+
import { IRegisterFunctionService as a, RegisterFunctionService as _, PLUGIN_CONFIG_KEY_BASE as x, CalculationMode as P } from "@univerjs/sheets-formula";
|
|
5
|
+
import { FFormula as T } from "@univerjs/engine-formula/facade";
|
|
6
|
+
import { SetRangeValuesMutation as b } from "@univerjs/sheets";
|
|
7
|
+
import { FWorkbook as w, FRange as M } from "@univerjs/sheets/facade";
|
|
8
|
+
class V extends I {
|
|
8
9
|
/**
|
|
9
10
|
* Initialize the FUniver instance.
|
|
10
11
|
* @ignore
|
|
11
12
|
*/
|
|
12
13
|
_initialize() {
|
|
13
|
-
this._debouncedFormulaCalculation =
|
|
14
|
+
this._debouncedFormulaCalculation = v(() => {
|
|
14
15
|
this._commandService.executeCommand(
|
|
15
|
-
|
|
16
|
+
k.id,
|
|
16
17
|
{
|
|
17
18
|
commands: [],
|
|
18
19
|
forceCalculation: !0
|
|
@@ -24,22 +25,22 @@ class z extends b {
|
|
|
24
25
|
}, 10);
|
|
25
26
|
}
|
|
26
27
|
registerFunction(t) {
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
const e =
|
|
28
|
+
let n = this._injector.get(a);
|
|
29
|
+
n || (this._injector.add([a, { useClass: _ }]), n = this._injector.get(a));
|
|
30
|
+
const e = n.registerFunctions(t);
|
|
30
31
|
return this._debouncedFormulaCalculation(), e;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
class
|
|
34
|
+
I.extend(V);
|
|
35
|
+
class W extends T {
|
|
35
36
|
/**
|
|
36
37
|
* Initialize the FUniver instance.
|
|
37
38
|
* @ignore
|
|
38
39
|
*/
|
|
39
40
|
_initialize() {
|
|
40
|
-
this._debouncedFormulaCalculation =
|
|
41
|
+
this._debouncedFormulaCalculation = v(() => {
|
|
41
42
|
this._commandService.executeCommand(
|
|
42
|
-
|
|
43
|
+
k.id,
|
|
43
44
|
{
|
|
44
45
|
commands: [],
|
|
45
46
|
forceCalculation: !0
|
|
@@ -51,89 +52,119 @@ class T extends w {
|
|
|
51
52
|
}, 10);
|
|
52
53
|
}
|
|
53
54
|
setInitialFormulaComputing(t) {
|
|
54
|
-
const e = this._injector.get(
|
|
55
|
-
e >
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
-
|
|
55
|
+
const e = this._injector.get(E).stage, o = this._injector.get(D), i = this._injector.get(L);
|
|
56
|
+
e > U.Starting && o.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.");
|
|
57
|
+
const r = i.getConfig(x);
|
|
58
|
+
if (!r) {
|
|
59
|
+
i.setConfig(x, { initialFormulaComputing: t });
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
+
r.initialFormulaComputing = t;
|
|
62
63
|
}
|
|
63
|
-
registerFunction(t,
|
|
64
|
-
var
|
|
65
|
-
let o = this._injector.get(
|
|
66
|
-
o || (this._injector.add([
|
|
67
|
-
const
|
|
64
|
+
registerFunction(t, n, e) {
|
|
65
|
+
var l;
|
|
66
|
+
let o = this._injector.get(a);
|
|
67
|
+
o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
|
|
68
|
+
const i = {
|
|
68
69
|
name: t,
|
|
69
|
-
func:
|
|
70
|
-
description: typeof e == "string" ? e : (
|
|
70
|
+
func: n,
|
|
71
|
+
description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
|
|
71
72
|
locales: typeof e == "object" ? e.locales : void 0
|
|
72
|
-
},
|
|
73
|
-
return this._debouncedFormulaCalculation(),
|
|
73
|
+
}, r = o.registerFunction(i);
|
|
74
|
+
return this._debouncedFormulaCalculation(), r;
|
|
74
75
|
}
|
|
75
|
-
registerAsyncFunction(t,
|
|
76
|
-
var
|
|
77
|
-
let o = this._injector.get(
|
|
78
|
-
o || (this._injector.add([
|
|
79
|
-
const
|
|
76
|
+
registerAsyncFunction(t, n, e) {
|
|
77
|
+
var l;
|
|
78
|
+
let o = this._injector.get(a);
|
|
79
|
+
o || (this._injector.add([a, { useClass: _ }]), o = this._injector.get(a));
|
|
80
|
+
const i = {
|
|
80
81
|
name: t,
|
|
81
|
-
func:
|
|
82
|
-
description: typeof e == "string" ? e : (
|
|
82
|
+
func: n,
|
|
83
|
+
description: typeof e == "string" ? e : (l = e == null ? void 0 : e.description) != null ? l : "",
|
|
83
84
|
locales: typeof e == "object" ? e.locales : void 0
|
|
84
|
-
},
|
|
85
|
-
return this._debouncedFormulaCalculation(),
|
|
85
|
+
}, r = o.registerAsyncFunction(i);
|
|
86
|
+
return this._debouncedFormulaCalculation(), r;
|
|
87
|
+
}
|
|
88
|
+
calculationResultApplied(t) {
|
|
89
|
+
let n = !1, e = !1, o = null;
|
|
90
|
+
return this._commandService.onCommandExecuted((i, r) => {
|
|
91
|
+
i.id !== y.id && i.id !== b.id || (i.id === y.id && (n = !0, o = i.params), i.id === b.id && (r != null && r.applyFormulaCalculationResult) && (e = !0), !(!n || !e) && requestIdleCallback(() => {
|
|
92
|
+
t(o);
|
|
93
|
+
}));
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
onCalculationResultApplied() {
|
|
97
|
+
return new Promise((t, n) => {
|
|
98
|
+
let e = !1, o = !1;
|
|
99
|
+
const i = setTimeout(() => {
|
|
100
|
+
c(), n(new Error("Calculation end timeout"));
|
|
101
|
+
}, 6e4), r = setTimeout(() => {
|
|
102
|
+
e || (c(), t());
|
|
103
|
+
}, 500), l = this.calculationProcessing((u) => {
|
|
104
|
+
const { stage: g, totalArrayFormulasToCalculate: f, totalFormulasToCalculate: d } = u;
|
|
105
|
+
if (g === z.START_CALCULATION && f + d === 0) {
|
|
106
|
+
c(), t();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
e || (e = !0, clearTimeout(r));
|
|
110
|
+
}), C = this.calculationResultApplied(() => {
|
|
111
|
+
o || (o = !0, c(), t());
|
|
112
|
+
});
|
|
113
|
+
function c() {
|
|
114
|
+
clearTimeout(i), clearTimeout(r), l.dispose(), C.dispose();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
86
117
|
}
|
|
87
118
|
}
|
|
88
|
-
|
|
119
|
+
T.extend(W);
|
|
89
120
|
class B {
|
|
90
121
|
get CalculationMode() {
|
|
91
|
-
return
|
|
122
|
+
return P;
|
|
92
123
|
}
|
|
93
124
|
}
|
|
94
|
-
|
|
95
|
-
class G extends
|
|
125
|
+
N.extend(B);
|
|
126
|
+
class G extends w {
|
|
96
127
|
getAllFormulaError() {
|
|
97
|
-
const t = [],
|
|
98
|
-
return o.forEach((
|
|
99
|
-
var
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
sheetName:
|
|
107
|
-
row:
|
|
128
|
+
const t = [], n = this._workbook, e = n.getUnitId(), o = n.getSheets(), i = this._injector.get(j).getArrayFormulaCellData();
|
|
129
|
+
return o.forEach((r) => {
|
|
130
|
+
var g;
|
|
131
|
+
const l = r.getName(), C = r.getSheetId(), c = r.getCellMatrix(), u = ((g = i == null ? void 0 : i[e]) == null ? void 0 : g[C]) || {};
|
|
132
|
+
c.forValue((f, d, h) => {
|
|
133
|
+
var F;
|
|
134
|
+
if (!h) return;
|
|
135
|
+
const m = (F = u == null ? void 0 : u[f]) == null ? void 0 : F[d], s = R(h, !!m);
|
|
136
|
+
s && t.push({
|
|
137
|
+
sheetName: l,
|
|
138
|
+
row: f,
|
|
108
139
|
column: d,
|
|
109
|
-
formula:
|
|
110
|
-
errorType:
|
|
140
|
+
formula: h.f || "",
|
|
141
|
+
errorType: s
|
|
111
142
|
});
|
|
112
143
|
});
|
|
113
144
|
}), t;
|
|
114
145
|
}
|
|
115
146
|
}
|
|
116
|
-
|
|
117
|
-
class
|
|
147
|
+
w.extend(G);
|
|
148
|
+
class O extends M {
|
|
118
149
|
getFormulaError() {
|
|
119
|
-
var d,
|
|
120
|
-
const t = [],
|
|
121
|
-
if (!
|
|
122
|
-
const
|
|
123
|
-
for (let
|
|
124
|
-
for (let
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
127
|
-
const
|
|
128
|
-
|
|
150
|
+
var d, h;
|
|
151
|
+
const t = [], n = this._workbook.getUnitId(), e = this._worksheet.getSheetId(), o = this._worksheet.getName(), i = this._workbook.getSheetBySheetId(e);
|
|
152
|
+
if (!i) return t;
|
|
153
|
+
const r = this._injector.get(j).getArrayFormulaCellData(), l = ((d = r == null ? void 0 : r[n]) == null ? void 0 : d[e]) || {}, C = i.getCellMatrix(), { startRow: c, endRow: u, startColumn: g, endColumn: f } = this._range;
|
|
154
|
+
for (let m = c; m <= u; m++)
|
|
155
|
+
for (let s = g; s <= f; s++) {
|
|
156
|
+
const F = C.getValue(m, s);
|
|
157
|
+
if (!F) continue;
|
|
158
|
+
const A = (h = l == null ? void 0 : l[m]) == null ? void 0 : h[s], p = R(F, !!A);
|
|
159
|
+
p && t.push({
|
|
129
160
|
sheetName: o,
|
|
130
|
-
row:
|
|
131
|
-
column:
|
|
132
|
-
formula:
|
|
133
|
-
errorType:
|
|
161
|
+
row: m,
|
|
162
|
+
column: s,
|
|
163
|
+
formula: F.f || "",
|
|
164
|
+
errorType: p
|
|
134
165
|
});
|
|
135
166
|
}
|
|
136
167
|
return t;
|
|
137
168
|
}
|
|
138
169
|
}
|
|
139
|
-
|
|
170
|
+
M.extend(O);
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Wa = Object.defineProperty;
|
|
2
2
|
var Ka = (a, e, n) => e in a ? Wa(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
|
|
3
3
|
var K = (a, e, n) => Ka(a, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t,
|
|
4
|
+
import { CommandType as ca, ICommandService as ue, ObjectMatrix as V, generateRandomId as la, IUniverInstanceService as Ee, Rectangle as fe, sequenceExecuteAsync as ka, Inject as H, Disposable as ee, CellValueType as xt, createDocumentModelWithStyle as Qa, WrapTextType as ja, PositionedObjectLayoutType as $a, BooleanNumber as za, ObjectRelativeFromV as Za, ObjectRelativeFromH as Ja, ImageSourceType as en, DrawingTypeEnum as tn, BuildTextUtils as an, InterceptorEffectEnum as _t, LocaleService as Gt, ILogService as nn, IConfigService as Ce, isFormulaString as Me, isFormulaId as sa, cellToRange as da, Tools as Xe, Direction as Ke, getIntersectRange as We, RANGE_TYPE as X, UniverInstanceType as k, Injector as ct, isRealNum as rn, createIdentifier as Ht, toDisposable as J, moveRangeByOffset as yt, DisposableCollection as ke, AbsoluteRefType as Qe, Optional as on, DependentOn as pa, Plugin as La, merge as Pa, touchDependencies as Ue, isNodeEnv as Xt } from "@univerjs/core";
|
|
5
5
|
import { SetRangeValuesCommand as Ta, SheetsSelectionsService as un, getSheetCommandTarget as mn, findFirstNonEmptyCell as fn, alignToMergedCellsBorders as It, expandToContinuousRange as cn, SetSelectionsOperation as ln, SheetInterceptorService as lt, INTERCEPTOR_POINT as Ea, InterceptCellContentPriority as sn, SetRangeValuesMutation as j, SetStyleCommand as wt, SetBorderCommand as Ia, ClearSelectionFormatCommand as Na, handleMoveCols as Ra, EffectRefRangId as w, runRefRangeMutations as Y, handleMoveRows as Sa, handleMoveRange as Aa, handleInsertRangeMoveRight as Ca, handleInsertRangeMoveDown as Da, handleDeleteRangeMoveUp as ba, handleDeleteRangeMoveLeft as Oa, handleIRemoveCol as Ma, handleIRemoveRow as xa, handleInsertCol as _a, handleInsertRow as ya, RemoveDefinedNameCommand as ga, SetDefinedNameCommand as qa, RemoveSheetCommand as dn, SetWorksheetNameCommand as pn, DeleteRangeMoveLeftCommand as Ln, DeleteRangeMoveUpCommand as Pn, RemoveColCommand as Tn, RemoveRowCommand as En, InsertRangeMoveDownCommand as In, InsertRangeMoveRightCommand as Nn, InsertColCommand as Rn, InsertRowCommand as Sn, MoveColsCommand as An, MoveRowsCommand as Cn, MoveRangeCommand as Dn, RemoveSheetMutation as gt, InsertSheetMutation as qt, SetRangeCustomMetadataCommand as bn, MoveRangeMutation as Wt, MoveRowsMutation as Kt, MoveColsMutation as kt, ReorderRangeMutation as Qt, RemoveRowMutation as jt, RemoveColMutation as $t, InsertColMutation as zt, InsertRowMutation as Zt, SetRowHiddenMutation as Jt, SetRowVisibleMutation as ea, SetWorksheetActiveOperation as ha, SCOPE_WORKBOOK_VALUE_DEFINED_NAME as Nt, RefRangeService as On, handleDefaultRangeChangeWithEffectRefCommands as ta, getSeparateEffectedRangesOnCommand as Mn, handleCommonDefaultRangeChangeWithEffectRefCommands as xn, UniverSheetsPlugin as _n } from "@univerjs/sheets";
|
|
6
|
-
import { serializeRange as Se, FormulaDataModel as ye, ErrorType as Q, SetImageFormulaDataMutation as yn,
|
|
6
|
+
import { serializeRange as Se, FormulaDataModel as ye, ErrorType as Q, SetImageFormulaDataMutation as yn, RegisterOtherFormulaService as gn, SetFormulaCalculationStartMutation as Fe, SetFormulaStringBatchCalculationMutation as qn, ENGINE_FORMULA_RETURN_DEPENDENCY_TREE as hn, ENGINE_FORMULA_CYCLE_REFERENCE_COUNT as Un, SetFormulaCalculationStopMutation as aa, SetFormulaCalculationNotificationMutation as Fn, FormulaExecuteStageType as Be, FormulaExecutedStateType as be, SetTriggerFormulaCalculationStartMutation as je, IActiveDirtyManagerService as Ua, sequenceNodeType as ie, deserializeRangeWithSheetWithCache as Pe, serializeRangeToRefString as st, LexerTreeBuilder as dt, generateStringWithSequence as $e, SetDefinedNameMutation as Ae, IDefinedNamesService as pt, SetFormulaDataMutation as ve, SetArrayFormulaDataMutation as ht, initSheetFormulaData as na, RemoveDefinedNameMutation as Ut, SetFormulaCalculationResultMutation as Bn, stripErrorMargin as vn, IFunctionService as Lt, FunctionType as t, FUNCTION_NAMES_ARRAY as ia, FUNCTION_NAMES_COMPATIBILITY as _, FUNCTION_NAMES_CUBE as de, FUNCTION_NAMES_DATABASE as $, FUNCTION_NAMES_DATE as v, FUNCTION_NAMES_ENGINEERING as C, FUNCTION_NAMES_FINANCIAL as D, FUNCTION_NAMES_INFORMATION as G, FUNCTION_NAMES_LOGICAL as W, FUNCTION_NAMES_LOOKUP as g, FUNCTION_NAMES_MATH as T, FUNCTION_NAMES_STATISTICAL as s, FUNCTION_NAMES_TEXT as b, FUNCTION_NAMES_WEB as Rt, isReferenceStrings as Vn, functionArray as Gn, functionCompatibility as Hn, functionCube as wn, functionDatabase as Yn, functionDate as Xn, functionEngineering as Wn, functionFinancial as Kn, functionInformation as kn, functionLogical as Qn, functionLookup as jn, functionMath as $n, functionMeta as zn, functionStatistical as Zn, functionText as Jn, functionUniver as ei, functionWeb as ti, OtherFormulaMarkDirty as ai, SetSuperTableMutation as ni, RemoveSuperTableMutation as ii, serializeRangeWithSheet as ze, ISuperTableService as ri, serializeRangeWithSpreadsheet as ra, CustomFunction as Ft, AsyncCustomFunction as Fa, UniverFormulaEnginePlugin as oi, IFormulaCurrentConfigService as ui, Lexer as mi, AstTreeBuilder as fi, Interpreter as ci, generateExecuteAstNodeData as li, getObjectValue as si } from "@univerjs/engine-formula";
|
|
7
7
|
import { BehaviorSubject as di, map as pi } from "rxjs";
|
|
8
8
|
import { IRPCChannelService as Ba, fromModule as Li, toModule as Pi } from "@univerjs/rpc";
|
|
9
9
|
const Ti = {
|
|
@@ -1599,10 +1599,10 @@ let Je = class extends ee {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
};
|
|
1601
1601
|
Je = cr([
|
|
1602
|
-
Ve(0,
|
|
1602
|
+
Ve(0, pt),
|
|
1603
1603
|
Ve(1, Ee),
|
|
1604
1604
|
Ve(2, H(lt)),
|
|
1605
|
-
Ve(3, H(
|
|
1605
|
+
Ve(3, H(dt))
|
|
1606
1606
|
], Je);
|
|
1607
1607
|
var lr = Object.getOwnPropertyDescriptor, sr = (a, e, n, i) => {
|
|
1608
1608
|
for (var r = i > 1 ? void 0 : i ? lr(e, n) : e, o = a.length - 1, u; o >= 0; o--)
|
|
@@ -1873,10 +1873,10 @@ let et = class extends ee {
|
|
|
1873
1873
|
et = sr([
|
|
1874
1874
|
me(0, Ee),
|
|
1875
1875
|
me(1, ue),
|
|
1876
|
-
me(2, H(
|
|
1876
|
+
me(2, H(dt)),
|
|
1877
1877
|
me(3, H(ye)),
|
|
1878
1878
|
me(4, H(lt)),
|
|
1879
|
-
me(5,
|
|
1879
|
+
me(5, pt),
|
|
1880
1880
|
me(6, Ce),
|
|
1881
1881
|
me(7, H(ct))
|
|
1882
1882
|
], et);
|
|
@@ -2335,9 +2335,9 @@ at = Tr([
|
|
|
2335
2335
|
Le(1, Ce),
|
|
2336
2336
|
Le(2, H(lt)),
|
|
2337
2337
|
Le(3, H(ye)),
|
|
2338
|
-
Le(4, H(
|
|
2338
|
+
Le(4, H(dt)),
|
|
2339
2339
|
Le(5, Lt),
|
|
2340
|
-
Le(6,
|
|
2340
|
+
Le(6, pt)
|
|
2341
2341
|
], at);
|
|
2342
2342
|
const Er = [
|
|
2343
2343
|
{
|
|
@@ -15910,7 +15910,7 @@ let nt = class extends ee {
|
|
|
15910
15910
|
};
|
|
15911
15911
|
nt = vr([
|
|
15912
15912
|
Ge(0, Pt),
|
|
15913
|
-
Ge(1,
|
|
15913
|
+
Ge(1, pt),
|
|
15914
15914
|
Ge(2, Ee),
|
|
15915
15915
|
Ge(3, ue)
|
|
15916
15916
|
], nt);
|
|
@@ -16259,7 +16259,7 @@ let vt = class extends ee {
|
|
|
16259
16259
|
};
|
|
16260
16260
|
vt = Wr([
|
|
16261
16261
|
we(0, H(On)),
|
|
16262
|
-
we(1, H(
|
|
16262
|
+
we(1, H(dt)),
|
|
16263
16263
|
we(2, Ee),
|
|
16264
16264
|
we(3, H(ct))
|
|
16265
16265
|
], vt);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDisposable, ILocales } from '@univerjs/core';
|
|
2
|
-
import { IFunctionInfo } from '@univerjs/engine-formula';
|
|
2
|
+
import { IFunctionInfo, ISetFormulaCalculationResultMutation } from '@univerjs/engine-formula';
|
|
3
3
|
import { CalculationMode, IRegisterAsyncFunction, IRegisterFunction } from '@univerjs/sheets-formula';
|
|
4
4
|
import { FFormula } from '@univerjs/engine-formula/facade';
|
|
5
5
|
/**
|
|
@@ -254,6 +254,59 @@ export interface IFFormulaSheetsMixin {
|
|
|
254
254
|
locales?: ILocales;
|
|
255
255
|
description?: string | IFunctionInfo;
|
|
256
256
|
}): IDisposable;
|
|
257
|
+
/**
|
|
258
|
+
* Listens for the moment when formula-calculation results are applied.
|
|
259
|
+
*
|
|
260
|
+
* This event fires after the engine completes a calculation cycle and
|
|
261
|
+
* dispatches a `SetFormulaCalculationResultMutation`.
|
|
262
|
+
* The callback is invoked during an idle frame to avoid blocking UI updates.
|
|
263
|
+
*
|
|
264
|
+
* @param {Function} callback - A function called with the calculation result payload
|
|
265
|
+
* once the result-application mutation is emitted.
|
|
266
|
+
* @returns {IDisposable} A disposable used to unsubscribe from the event.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* const formulaEngine = univerAPI.getFormula();
|
|
271
|
+
*
|
|
272
|
+
* const dispose = formulaEngine.calculationResultApplied((result) => {
|
|
273
|
+
* console.log('Calculation results applied:', result);
|
|
274
|
+
* });
|
|
275
|
+
*
|
|
276
|
+
* // Later…
|
|
277
|
+
* dispose.dispose();
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
calculationResultApplied(callback: (result: ISetFormulaCalculationResultMutation) => void): IDisposable;
|
|
281
|
+
/**
|
|
282
|
+
* Waits for formula-calculation results to be applied.
|
|
283
|
+
*
|
|
284
|
+
* This method resolves under three conditions:
|
|
285
|
+
* 1. A real calculation runs and the engine emits a "calculation started" signal,
|
|
286
|
+
* followed by a "calculation result applied" signal.
|
|
287
|
+
* 2. No calculation actually starts within 500 ms — the method assumes there is
|
|
288
|
+
* nothing to wait for and resolves automatically.
|
|
289
|
+
* 3. A global 30 s timeout triggers, in which case the promise rejects.
|
|
290
|
+
*
|
|
291
|
+
* The API internally listens to both “calculation in progress” events and
|
|
292
|
+
* “calculation result applied” events, ensuring it behaves correctly whether
|
|
293
|
+
* formulas are recalculated or skipped due to cache/state.
|
|
294
|
+
*
|
|
295
|
+
* @returns {Promise<void>} A promise that resolves when calculation results are applied
|
|
296
|
+
* or when no calculation occurs within the start-detection window.
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* ```ts
|
|
300
|
+
* const formulaEngine = univerAPI.getFormula();
|
|
301
|
+
*
|
|
302
|
+
* // Wait for formula updates to apply before reading values.
|
|
303
|
+
* await formulaEngine.onCalculationResultApplied();
|
|
304
|
+
*
|
|
305
|
+
* const value = sheet.getRange("C24").getValue();
|
|
306
|
+
* console.log("Updated value:", value);
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
onCalculationResultApplied(): Promise<void>;
|
|
257
310
|
}
|
|
258
311
|
export declare class FFormulaSheetsMixin extends FFormula implements IFFormulaSheetsMixin {
|
|
259
312
|
/**
|
|
@@ -270,6 +323,8 @@ export declare class FFormulaSheetsMixin extends FFormula implements IFFormulaSh
|
|
|
270
323
|
registerFunction(name: string, func: IRegisterFunction, description: string): IDisposable;
|
|
271
324
|
registerAsyncFunction(name: string, func: IRegisterAsyncFunction): IDisposable;
|
|
272
325
|
registerAsyncFunction(name: string, func: IRegisterAsyncFunction, description: string): IDisposable;
|
|
326
|
+
calculationResultApplied(callback: (result: ISetFormulaCalculationResultMutation) => void): IDisposable;
|
|
327
|
+
onCalculationResultApplied(): Promise<void>;
|
|
273
328
|
}
|
|
274
329
|
declare module '@univerjs/engine-formula/facade' {
|
|
275
330
|
interface FFormula extends IFFormulaSheetsMixin {
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(c,f){typeof exports=="object"&&typeof module<"u"?f(require("@univerjs/core"),require("@univerjs/core/facade"),require("@univerjs/engine-formula"),require("@univerjs/sheets-formula"),require("@univerjs/engine-formula/facade"),require("@univerjs/sheets"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["@univerjs/core","@univerjs/core/facade","@univerjs/engine-formula","@univerjs/sheets-formula","@univerjs/engine-formula/facade","@univerjs/sheets","@univerjs/sheets/facade"],f):(c=typeof globalThis<"u"?globalThis:c||self,f(c.UniverCore,c.UniverCoreFacade,c.UniverEngineFormula,c.UniverSheetsFormula,c.UniverEngineFormulaFacade,c.UniverSheets,c.UniverSheetsFacade))})(this,(function(c,f,u,s,I,y,j){"use strict";class p extends f.FUniver{_initialize(){this._debouncedFormulaCalculation=c.debounce(()=>{this._commandService.executeCommand(u.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}registerFunction(t){let o=this._injector.get(s.IRegisterFunctionService);o||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),o=this._injector.get(s.IRegisterFunctionService));const e=o.registerFunctions(t);return this._debouncedFormulaCalculation(),e}}f.FUniver.extend(p);class k extends I.FFormula{_initialize(){this._debouncedFormulaCalculation=c.debounce(()=>{this._commandService.executeCommand(u.SetTriggerFormulaCalculationStartMutation.id,{commands:[],forceCalculation:!0},{onlyLocal:!0})},10)}setInitialFormulaComputing(t){const e=this._injector.get(c.LifecycleService).stage,n=this._injector.get(c.ILogService),i=this._injector.get(c.IConfigService);e>c.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 r=i.getConfig(s.PLUGIN_CONFIG_KEY_BASE);if(!r){i.setConfig(s.PLUGIN_CONFIG_KEY_BASE,{initialFormulaComputing:t});return}r.initialFormulaComputing=t}registerFunction(t,o,e){var a;let n=this._injector.get(s.IRegisterFunctionService);n||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),n=this._injector.get(s.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerFunction(i);return this._debouncedFormulaCalculation(),r}registerAsyncFunction(t,o,e){var a;let n=this._injector.get(s.IRegisterFunctionService);n||(this._injector.add([s.IRegisterFunctionService,{useClass:s.RegisterFunctionService}]),n=this._injector.get(s.IRegisterFunctionService));const i={name:t,func:o,description:typeof e=="string"?e:(a=e==null?void 0:e.description)!=null?a:"",locales:typeof e=="object"?e.locales:void 0},r=n.registerAsyncFunction(i);return this._debouncedFormulaCalculation(),r}calculationResultApplied(t){let o=!1,e=!1,n=null;return this._commandService.onCommandExecuted((i,r)=>{i.id!==u.SetFormulaCalculationResultMutation.id&&i.id!==y.SetRangeValuesMutation.id||(i.id===u.SetFormulaCalculationResultMutation.id&&(o=!0,n=i.params),i.id===y.SetRangeValuesMutation.id&&(r!=null&&r.applyFormulaCalculationResult)&&(e=!0),!(!o||!e)&&requestIdleCallback(()=>{t(n)}))})}onCalculationResultApplied(){return new Promise((t,o)=>{let e=!1,n=!1;const i=setTimeout(()=>{l(),o(new Error("Calculation end timeout"))},6e4),r=setTimeout(()=>{e||(l(),t())},500),a=this.calculationProcessing(g=>{const{stage:h,totalArrayFormulasToCalculate:S,totalFormulasToCalculate:m}=g;if(h===u.FormulaExecuteStageType.START_CALCULATION&&S+m===0){l(),t();return}e||(e=!0,clearTimeout(r))}),_=this.calculationResultApplied(()=>{n||(n=!0,l(),t())});function l(){clearTimeout(i),clearTimeout(r),a.dispose(),_.dispose()}})}}I.FFormula.extend(k);class b{get CalculationMode(){return s.CalculationMode}}f.FEnum.extend(b);class E extends j.FWorkbook{getAllFormulaError(){const t=[],o=this._workbook,e=o.getUnitId(),n=o.getSheets(),i=this._injector.get(u.FormulaDataModel).getArrayFormulaCellData();return n.forEach(r=>{var h;const a=r.getName(),_=r.getSheetId(),l=r.getCellMatrix(),g=((h=i==null?void 0:i[e])==null?void 0:h[_])||{};l.forValue((S,m,v)=>{var C;if(!v)return;const F=(C=g==null?void 0:g[S])==null?void 0:C[m],d=u.extractFormulaError(v,!!F);d&&t.push({sheetName:a,row:S,column:m,formula:v.f||"",errorType:d})})}),t}}j.FWorkbook.extend(E);class M extends j.FRange{getFormulaError(){var m,v;const t=[],o=this._workbook.getUnitId(),e=this._worksheet.getSheetId(),n=this._worksheet.getName(),i=this._workbook.getSheetBySheetId(e);if(!i)return t;const r=this._injector.get(u.FormulaDataModel).getArrayFormulaCellData(),a=((m=r==null?void 0:r[o])==null?void 0:m[e])||{},_=i.getCellMatrix(),{startRow:l,endRow:g,startColumn:h,endColumn:S}=this._range;for(let F=l;F<=g;F++)for(let d=h;d<=S;d++){const C=_.getValue(F,d);if(!C)continue;const T=(v=a==null?void 0:a[F])==null?void 0:v[d],x=u.extractFormulaError(C,!!T);x&&t.push({sheetName:n,row:F,column:d,formula:C.f||"",errorType:x})}return t}}j.FRange.extend(M)}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,o){typeof exports=="object"&&typeof module<"u"?module.exports=o():typeof define=="function"&&define.amd?define(o):(e=typeof globalThis<"u"?globalThis:e||self,e.UniverSheetsFormulaSkSK=o())})(this,(function(){"use strict";return{formula:{progress:{analyzing:"Analyzovanie",calculating:"Výpočet","array-analysis":"Analýza poľa","array-calculation":"Výpočet poľa",done:"Hotovo"}}}}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-formula",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3-insiders.20260131-b9b8805",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "DreamNum <developer@univer.ai>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
"rxjs": ">=7.0.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@univerjs/core": "0.15.
|
|
66
|
-
"@univerjs/rpc": "0.15.
|
|
67
|
-
"@univerjs/
|
|
68
|
-
"@univerjs/
|
|
65
|
+
"@univerjs/core": "0.15.3-insiders.20260131-b9b8805",
|
|
66
|
+
"@univerjs/rpc": "0.15.3-insiders.20260131-b9b8805",
|
|
67
|
+
"@univerjs/sheets": "0.15.3-insiders.20260131-b9b8805",
|
|
68
|
+
"@univerjs/engine-formula": "0.15.3-insiders.20260131-b9b8805"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"rxjs": "^7.8.2",
|
|
72
72
|
"typescript": "^5.9.3",
|
|
73
73
|
"vite": "^7.3.1",
|
|
74
|
-
"vitest": "^4.0.
|
|
75
|
-
"@univerjs-infra/shared": "0.15.
|
|
76
|
-
"@univerjs/
|
|
77
|
-
"@univerjs/
|
|
74
|
+
"vitest": "^4.0.18",
|
|
75
|
+
"@univerjs-infra/shared": "0.15.3",
|
|
76
|
+
"@univerjs/engine-render": "0.15.3-insiders.20260131-b9b8805",
|
|
77
|
+
"@univerjs/docs": "0.15.3-insiders.20260131-b9b8805"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"test": "vitest run",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|