@univerjs/sheets-formula 0.1.0-beta.1 → 0.1.0-beta.2
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/index.js +8 -6
- package/lib/es/index.js +13605 -2402
- package/lib/index.css +1 -1
- package/lib/types/commands/operations/insert-function.operation.d.ts +12 -1
- package/lib/types/controllers/utils.d.ts +2 -2
- package/lib/types/formula-ui-plugin.d.ts +6 -1
- package/lib/types/index.d.ts +6 -0
- package/lib/types/locale/en-US.d.ts +81 -60
- package/lib/types/locale/function-list/compatibility/en-US.d.ts +0 -54
- package/lib/types/locale/function-list/compatibility/ja-JP.d.ts +0 -54
- package/lib/types/locale/function-list/compatibility/zh-CN.d.ts +0 -54
- package/lib/types/locale/function-list/logical/en-US.d.ts +2 -2
- package/lib/types/locale/function-list/logical/ja-JP.d.ts +2 -2
- package/lib/types/locale/function-list/logical/zh-CN.d.ts +2 -2
- package/lib/types/locale/function-list/lookup/en-US.d.ts +24 -4
- package/lib/types/locale/function-list/lookup/ja-JP.d.ts +24 -4
- package/lib/types/locale/function-list/lookup/zh-CN.d.ts +24 -4
- package/lib/types/locale/zh-CN.d.ts +81 -60
- package/lib/types/services/description.service.d.ts +15 -1
- package/lib/types/services/formula-custom-function.service.d.ts +34 -0
- package/lib/types/services/function-list/compatibility.d.ts +1 -1
- package/lib/types/services/function-list/cube.d.ts +1 -1
- package/lib/types/services/function-list/database.d.ts +1 -1
- package/lib/types/services/function-list/date.d.ts +1 -1
- package/lib/types/services/function-list/engineering.d.ts +1 -1
- package/lib/types/services/function-list/financial.d.ts +1 -1
- package/lib/types/services/function-list/information.d.ts +1 -1
- package/lib/types/services/function-list/logical.d.ts +1 -1
- package/lib/types/services/function-list/lookup.d.ts +1 -1
- package/lib/types/services/function-list/text.d.ts +1 -1
- package/lib/types/services/function-list/web.d.ts +1 -1
- package/lib/types/services/register-function.service.d.ts +70 -0
- package/lib/umd/index.js +8 -6
- package/package.json +23 -23
|
@@ -187,24 +187,6 @@ declare const _default: {
|
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
189
|
};
|
|
190
|
-
CONCATENATE: {
|
|
191
|
-
description: string;
|
|
192
|
-
abstract: string;
|
|
193
|
-
links: {
|
|
194
|
-
title: string;
|
|
195
|
-
url: string;
|
|
196
|
-
}[];
|
|
197
|
-
functionParameter: {
|
|
198
|
-
number1: {
|
|
199
|
-
name: string;
|
|
200
|
-
detail: string;
|
|
201
|
-
};
|
|
202
|
-
number2: {
|
|
203
|
-
name: string;
|
|
204
|
-
detail: string;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
190
|
CONFIDENCE: {
|
|
209
191
|
description: string;
|
|
210
192
|
abstract: string;
|
|
@@ -313,42 +295,6 @@ declare const _default: {
|
|
|
313
295
|
};
|
|
314
296
|
};
|
|
315
297
|
};
|
|
316
|
-
FLOOR: {
|
|
317
|
-
description: string;
|
|
318
|
-
abstract: string;
|
|
319
|
-
links: {
|
|
320
|
-
title: string;
|
|
321
|
-
url: string;
|
|
322
|
-
}[];
|
|
323
|
-
functionParameter: {
|
|
324
|
-
number1: {
|
|
325
|
-
name: string;
|
|
326
|
-
detail: string;
|
|
327
|
-
};
|
|
328
|
-
number2: {
|
|
329
|
-
name: string;
|
|
330
|
-
detail: string;
|
|
331
|
-
};
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
FORECAST: {
|
|
335
|
-
description: string;
|
|
336
|
-
abstract: string;
|
|
337
|
-
links: {
|
|
338
|
-
title: string;
|
|
339
|
-
url: string;
|
|
340
|
-
}[];
|
|
341
|
-
functionParameter: {
|
|
342
|
-
number1: {
|
|
343
|
-
name: string;
|
|
344
|
-
detail: string;
|
|
345
|
-
};
|
|
346
|
-
number2: {
|
|
347
|
-
name: string;
|
|
348
|
-
detail: string;
|
|
349
|
-
};
|
|
350
|
-
};
|
|
351
|
-
};
|
|
352
298
|
FTEST: {
|
|
353
299
|
description: string;
|
|
354
300
|
abstract: string;
|
|
@@ -2445,11 +2391,11 @@ declare const _default: {
|
|
|
2445
2391
|
url: string;
|
|
2446
2392
|
}[];
|
|
2447
2393
|
functionParameter: {
|
|
2448
|
-
|
|
2394
|
+
parameter: {
|
|
2449
2395
|
name: string;
|
|
2450
2396
|
detail: string;
|
|
2451
2397
|
};
|
|
2452
|
-
|
|
2398
|
+
calculation: {
|
|
2453
2399
|
name: string;
|
|
2454
2400
|
detail: string;
|
|
2455
2401
|
};
|
|
@@ -2765,6 +2711,24 @@ declare const _default: {
|
|
|
2765
2711
|
};
|
|
2766
2712
|
};
|
|
2767
2713
|
};
|
|
2714
|
+
CONCATENATE: {
|
|
2715
|
+
description: string;
|
|
2716
|
+
abstract: string;
|
|
2717
|
+
links: {
|
|
2718
|
+
title: string;
|
|
2719
|
+
url: string;
|
|
2720
|
+
}[];
|
|
2721
|
+
functionParameter: {
|
|
2722
|
+
number1: {
|
|
2723
|
+
name: string;
|
|
2724
|
+
detail: string;
|
|
2725
|
+
};
|
|
2726
|
+
number2: {
|
|
2727
|
+
name: string;
|
|
2728
|
+
detail: string;
|
|
2729
|
+
};
|
|
2730
|
+
};
|
|
2731
|
+
};
|
|
2768
2732
|
DBCS: {
|
|
2769
2733
|
description: string;
|
|
2770
2734
|
abstract: string;
|
|
@@ -3691,11 +3655,23 @@ declare const _default: {
|
|
|
3691
3655
|
url: string;
|
|
3692
3656
|
}[];
|
|
3693
3657
|
functionParameter: {
|
|
3694
|
-
|
|
3658
|
+
row_num: {
|
|
3695
3659
|
name: string;
|
|
3696
3660
|
detail: string;
|
|
3697
3661
|
};
|
|
3698
|
-
|
|
3662
|
+
column_num: {
|
|
3663
|
+
name: string;
|
|
3664
|
+
detail: string;
|
|
3665
|
+
};
|
|
3666
|
+
abs_num: {
|
|
3667
|
+
name: string;
|
|
3668
|
+
detail: string;
|
|
3669
|
+
};
|
|
3670
|
+
a1: {
|
|
3671
|
+
name: string;
|
|
3672
|
+
detail: string;
|
|
3673
|
+
};
|
|
3674
|
+
sheet_text: {
|
|
3699
3675
|
name: string;
|
|
3700
3676
|
detail: string;
|
|
3701
3677
|
};
|
|
@@ -4249,11 +4225,19 @@ declare const _default: {
|
|
|
4249
4225
|
url: string;
|
|
4250
4226
|
}[];
|
|
4251
4227
|
functionParameter: {
|
|
4252
|
-
|
|
4228
|
+
lookupValue: {
|
|
4253
4229
|
name: string;
|
|
4254
4230
|
detail: string;
|
|
4255
4231
|
};
|
|
4256
|
-
|
|
4232
|
+
tableArray: {
|
|
4233
|
+
name: string;
|
|
4234
|
+
detail: string;
|
|
4235
|
+
};
|
|
4236
|
+
colIndexNum: {
|
|
4237
|
+
name: string;
|
|
4238
|
+
detail: string;
|
|
4239
|
+
};
|
|
4240
|
+
rangeLookup: {
|
|
4257
4241
|
name: string;
|
|
4258
4242
|
detail: string;
|
|
4259
4243
|
};
|
|
@@ -4961,6 +4945,24 @@ declare const _default: {
|
|
|
4961
4945
|
};
|
|
4962
4946
|
};
|
|
4963
4947
|
};
|
|
4948
|
+
FORECAST: {
|
|
4949
|
+
description: string;
|
|
4950
|
+
abstract: string;
|
|
4951
|
+
links: {
|
|
4952
|
+
title: string;
|
|
4953
|
+
url: string;
|
|
4954
|
+
}[];
|
|
4955
|
+
functionParameter: {
|
|
4956
|
+
number1: {
|
|
4957
|
+
name: string;
|
|
4958
|
+
detail: string;
|
|
4959
|
+
};
|
|
4960
|
+
number2: {
|
|
4961
|
+
name: string;
|
|
4962
|
+
detail: string;
|
|
4963
|
+
};
|
|
4964
|
+
};
|
|
4965
|
+
};
|
|
4964
4966
|
FORECAST_ETS: {
|
|
4965
4967
|
description: string;
|
|
4966
4968
|
abstract: string;
|
|
@@ -6853,6 +6855,24 @@ declare const _default: {
|
|
|
6853
6855
|
};
|
|
6854
6856
|
};
|
|
6855
6857
|
};
|
|
6858
|
+
FLOOR: {
|
|
6859
|
+
description: string;
|
|
6860
|
+
abstract: string;
|
|
6861
|
+
links: {
|
|
6862
|
+
title: string;
|
|
6863
|
+
url: string;
|
|
6864
|
+
}[];
|
|
6865
|
+
functionParameter: {
|
|
6866
|
+
number1: {
|
|
6867
|
+
name: string;
|
|
6868
|
+
detail: string;
|
|
6869
|
+
};
|
|
6870
|
+
number2: {
|
|
6871
|
+
name: string;
|
|
6872
|
+
detail: string;
|
|
6873
|
+
};
|
|
6874
|
+
};
|
|
6875
|
+
};
|
|
6856
6876
|
FLOOR_MATH: {
|
|
6857
6877
|
description: string;
|
|
6858
6878
|
abstract: string;
|
|
@@ -9220,6 +9240,7 @@ declare const _default: {
|
|
|
9220
9240
|
web: string;
|
|
9221
9241
|
array: string;
|
|
9222
9242
|
univer: string;
|
|
9243
|
+
user: string;
|
|
9223
9244
|
};
|
|
9224
9245
|
moreFunctions: {
|
|
9225
9246
|
confirm: string;
|
|
@@ -50,12 +50,23 @@ export interface IDescriptionService {
|
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
52
|
getSearchListByType(type: number): ISearchItem[];
|
|
53
|
+
/**
|
|
54
|
+
* register descriptions
|
|
55
|
+
* @param functionList
|
|
56
|
+
*/
|
|
57
|
+
registerDescriptions(functionList: IFunctionInfo[]): void;
|
|
58
|
+
/**
|
|
59
|
+
* unregister descriptions
|
|
60
|
+
* @param functionList
|
|
61
|
+
*/
|
|
62
|
+
unregisterDescriptions(functionNames: string[]): void;
|
|
53
63
|
}
|
|
54
64
|
export declare const IDescriptionService: import("@wendellhu/redi").IdentifierDecorator<IDescriptionService>;
|
|
55
65
|
export declare class DescriptionService implements IDescriptionService, IDisposable {
|
|
56
66
|
private _description;
|
|
57
67
|
private readonly _functionService;
|
|
58
68
|
private readonly _localeService;
|
|
69
|
+
private _descriptions;
|
|
59
70
|
constructor(_description: IFunctionInfo[], _functionService: IFunctionService, _localeService: LocaleService);
|
|
60
71
|
dispose(): void;
|
|
61
72
|
getDescriptions(): Map<IFunctionNames, IFunctionInfo>;
|
|
@@ -64,6 +75,9 @@ export declare class DescriptionService implements IDescriptionService, IDisposa
|
|
|
64
75
|
getSearchListByName(searchText: string): ISearchItem[];
|
|
65
76
|
getSearchListByNameFirstLetter(searchText: string): ISearchItem[];
|
|
66
77
|
getSearchListByType(type: number): ISearchItem[];
|
|
78
|
+
registerDescriptions(description: IFunctionInfo[]): void;
|
|
79
|
+
unregisterDescriptions(functionNames: string[]): void;
|
|
67
80
|
private _initialize;
|
|
68
|
-
private
|
|
81
|
+
private _initDescription;
|
|
82
|
+
private _registerDescriptions;
|
|
69
83
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Disposable, ICommandService } from '@univerjs/core';
|
|
17
|
+
import type { PrimitiveValueType } from '@univerjs/engine-formula';
|
|
18
|
+
export type IRegisterFunction = (...arg: Array<PrimitiveValueType | PrimitiveValueType[][]>) => PrimitiveValueType | PrimitiveValueType[][];
|
|
19
|
+
export type IRegisterFunctionList = [[IRegisterFunction, string, string?]];
|
|
20
|
+
export interface IFormulaCustomFunctionService {
|
|
21
|
+
/**
|
|
22
|
+
* register descriptions
|
|
23
|
+
* @param functionList
|
|
24
|
+
*/
|
|
25
|
+
registerFunctions(functionList: IRegisterFunctionList): void;
|
|
26
|
+
unregisterFunctions(functionList: string[]): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const IFormulaCustomFunctionService: import("@wendellhu/redi").IdentifierDecorator<IFormulaCustomFunctionService>;
|
|
29
|
+
export declare class FormulaCustomFunctionService extends Disposable implements IFormulaCustomFunctionService {
|
|
30
|
+
private readonly _commandService;
|
|
31
|
+
constructor(_commandService: ICommandService);
|
|
32
|
+
registerFunctions(functionList: IRegisterFunctionList): void;
|
|
33
|
+
unregisterFunctions(functionList: string[]): void;
|
|
34
|
+
}
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_COMPATIBILITY: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_CUBE: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_DATABASE: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_DATE: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_ENGINEERING: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_FINANCIAL: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_INFORMATION: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_LOGICAL: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_LOOKUP: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_TEXT: IFunctionInfo[];
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type
|
|
16
|
+
import { type IFunctionInfo } from '@univerjs/engine-formula';
|
|
17
17
|
export declare const FUNCTION_LIST_WEB: IFunctionInfo[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { ILocales } from '@univerjs/core';
|
|
17
|
+
import { Disposable, LocaleService } from '@univerjs/core';
|
|
18
|
+
import type { IFunctionInfo } from '@univerjs/engine-formula';
|
|
19
|
+
import { IFunctionService } from '@univerjs/engine-formula';
|
|
20
|
+
import { IDescriptionService } from './description.service';
|
|
21
|
+
import type { IRegisterFunctionList } from './formula-custom-function.service';
|
|
22
|
+
import { IFormulaCustomFunctionService } from './formula-custom-function.service';
|
|
23
|
+
/**
|
|
24
|
+
* Register function operation params
|
|
25
|
+
*/
|
|
26
|
+
export interface IRegisterFunctionParams {
|
|
27
|
+
/**
|
|
28
|
+
* i18n
|
|
29
|
+
*/
|
|
30
|
+
locales?: ILocales;
|
|
31
|
+
/**
|
|
32
|
+
* function description
|
|
33
|
+
*/
|
|
34
|
+
description?: IFunctionInfo[];
|
|
35
|
+
/**
|
|
36
|
+
* function calculation
|
|
37
|
+
*/
|
|
38
|
+
calculate: IRegisterFunctionList;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Unregister function operation params
|
|
42
|
+
*/
|
|
43
|
+
export interface IUnregisterFunctionParams {
|
|
44
|
+
/**
|
|
45
|
+
* Remove i18n
|
|
46
|
+
*/
|
|
47
|
+
localeKeys?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Function name
|
|
50
|
+
*/
|
|
51
|
+
functionNames: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface IRegisterFunctionService {
|
|
54
|
+
/**
|
|
55
|
+
* register descriptions
|
|
56
|
+
* @param functionList
|
|
57
|
+
*/
|
|
58
|
+
registerFunctions(params: IRegisterFunctionParams): void;
|
|
59
|
+
unregisterFunctions(params: IUnregisterFunctionParams): void;
|
|
60
|
+
}
|
|
61
|
+
export declare const IRegisterFunctionService: import("@wendellhu/redi").IdentifierDecorator<IRegisterFunctionService>;
|
|
62
|
+
export declare class RegisterFunctionService extends Disposable implements IRegisterFunctionService {
|
|
63
|
+
private readonly _localeService;
|
|
64
|
+
private readonly _descriptionService;
|
|
65
|
+
private readonly _formulaCustomFunctionService;
|
|
66
|
+
private readonly _functionService;
|
|
67
|
+
constructor(_localeService: LocaleService, _descriptionService: IDescriptionService, _formulaCustomFunctionService: IFormulaCustomFunctionService, _functionService: IFunctionService);
|
|
68
|
+
registerFunctions(params: IRegisterFunctionParams): void;
|
|
69
|
+
unregisterFunctions(params: IUnregisterFunctionParams): void;
|
|
70
|
+
}
|