@univerjs/sheets-formula 0.1.0-beta.0 → 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.
Files changed (38) hide show
  1. package/lib/cjs/index.js +8 -6
  2. package/lib/es/index.js +13695 -2372
  3. package/lib/index.css +1 -1
  4. package/lib/types/commands/operations/insert-function.operation.d.ts +12 -1
  5. package/lib/types/controllers/utils.d.ts +3 -2
  6. package/lib/types/formula-ui-plugin.d.ts +6 -1
  7. package/lib/types/index.d.ts +6 -0
  8. package/lib/types/locale/en-US.d.ts +89 -80
  9. package/lib/types/locale/function-list/compatibility/en-US.d.ts +0 -54
  10. package/lib/types/locale/function-list/compatibility/ja-JP.d.ts +0 -54
  11. package/lib/types/locale/function-list/compatibility/zh-CN.d.ts +0 -54
  12. package/lib/types/locale/function-list/logical/en-US.d.ts +6 -2
  13. package/lib/types/locale/function-list/logical/ja-JP.d.ts +6 -2
  14. package/lib/types/locale/function-list/logical/zh-CN.d.ts +6 -2
  15. package/lib/types/locale/function-list/lookup/en-US.d.ts +24 -4
  16. package/lib/types/locale/function-list/lookup/ja-JP.d.ts +24 -4
  17. package/lib/types/locale/function-list/lookup/zh-CN.d.ts +24 -4
  18. package/lib/types/locale/function-list/math/en-US.d.ts +4 -20
  19. package/lib/types/locale/function-list/math/ja-JP.d.ts +4 -20
  20. package/lib/types/locale/function-list/math/zh-CN.d.ts +4 -20
  21. package/lib/types/locale/zh-CN.d.ts +89 -80
  22. package/lib/types/services/description.service.d.ts +22 -1
  23. package/lib/types/services/formula-custom-function.service.d.ts +34 -0
  24. package/lib/types/services/function-list/array.d.ts +1 -1
  25. package/lib/types/services/function-list/compatibility.d.ts +1 -1
  26. package/lib/types/services/function-list/cube.d.ts +1 -1
  27. package/lib/types/services/function-list/database.d.ts +1 -1
  28. package/lib/types/services/function-list/date.d.ts +1 -1
  29. package/lib/types/services/function-list/engineering.d.ts +1 -1
  30. package/lib/types/services/function-list/financial.d.ts +1 -1
  31. package/lib/types/services/function-list/information.d.ts +1 -1
  32. package/lib/types/services/function-list/logical.d.ts +1 -1
  33. package/lib/types/services/function-list/lookup.d.ts +1 -1
  34. package/lib/types/services/function-list/text.d.ts +1 -1
  35. package/lib/types/services/function-list/web.d.ts +1 -1
  36. package/lib/types/services/register-function.service.d.ts +70 -0
  37. package/lib/umd/index.js +8 -6
  38. package/package.json +26 -26
@@ -22,11 +22,23 @@ declare const _default: {
22
22
  url: string;
23
23
  }[];
24
24
  functionParameter: {
25
- number1: {
25
+ row_num: {
26
26
  name: string;
27
27
  detail: string;
28
28
  };
29
- number2: {
29
+ column_num: {
30
+ name: string;
31
+ detail: string;
32
+ };
33
+ abs_num: {
34
+ name: string;
35
+ detail: string;
36
+ };
37
+ a1: {
38
+ name: string;
39
+ detail: string;
40
+ };
41
+ sheet_text: {
30
42
  name: string;
31
43
  detail: string;
32
44
  };
@@ -580,11 +592,19 @@ declare const _default: {
580
592
  url: string;
581
593
  }[];
582
594
  functionParameter: {
583
- number1: {
595
+ lookupValue: {
584
596
  name: string;
585
597
  detail: string;
586
598
  };
587
- number2: {
599
+ tableArray: {
600
+ name: string;
601
+ detail: string;
602
+ };
603
+ colIndexNum: {
604
+ name: string;
605
+ detail: string;
606
+ };
607
+ rangeLookup: {
588
608
  name: string;
589
609
  detail: string;
590
610
  };
@@ -22,11 +22,23 @@ declare const _default: {
22
22
  url: string;
23
23
  }[];
24
24
  functionParameter: {
25
- number1: {
25
+ row_num: {
26
26
  name: string;
27
27
  detail: string;
28
28
  };
29
- number2: {
29
+ column_num: {
30
+ name: string;
31
+ detail: string;
32
+ };
33
+ abs_num: {
34
+ name: string;
35
+ detail: string;
36
+ };
37
+ a1: {
38
+ name: string;
39
+ detail: string;
40
+ };
41
+ sheet_text: {
30
42
  name: string;
31
43
  detail: string;
32
44
  };
@@ -580,11 +592,19 @@ declare const _default: {
580
592
  url: string;
581
593
  }[];
582
594
  functionParameter: {
583
- number1: {
595
+ lookupValue: {
584
596
  name: string;
585
597
  detail: string;
586
598
  };
587
- number2: {
599
+ tableArray: {
600
+ name: string;
601
+ detail: string;
602
+ };
603
+ colIndexNum: {
604
+ name: string;
605
+ detail: string;
606
+ };
607
+ rangeLookup: {
588
608
  name: string;
589
609
  detail: string;
590
610
  };
@@ -22,11 +22,7 @@ declare const _default: {
22
22
  url: string;
23
23
  }[];
24
24
  functionParameter: {
25
- number1: {
26
- name: string;
27
- detail: string;
28
- };
29
- number2: {
25
+ number: {
30
26
  name: string;
31
27
  detail: string;
32
28
  };
@@ -40,11 +36,7 @@ declare const _default: {
40
36
  url: string;
41
37
  }[];
42
38
  functionParameter: {
43
- number1: {
44
- name: string;
45
- detail: string;
46
- };
47
- number2: {
39
+ number: {
48
40
  name: string;
49
41
  detail: string;
50
42
  };
@@ -58,11 +50,7 @@ declare const _default: {
58
50
  url: string;
59
51
  }[];
60
52
  functionParameter: {
61
- number1: {
62
- name: string;
63
- detail: string;
64
- };
65
- number2: {
53
+ number: {
66
54
  name: string;
67
55
  detail: string;
68
56
  };
@@ -76,11 +64,7 @@ declare const _default: {
76
64
  url: string;
77
65
  }[];
78
66
  functionParameter: {
79
- number1: {
80
- name: string;
81
- detail: string;
82
- };
83
- number2: {
67
+ number: {
84
68
  name: string;
85
69
  detail: string;
86
70
  };
@@ -22,11 +22,7 @@ declare const _default: {
22
22
  url: string;
23
23
  }[];
24
24
  functionParameter: {
25
- number1: {
26
- name: string;
27
- detail: string;
28
- };
29
- number2: {
25
+ number: {
30
26
  name: string;
31
27
  detail: string;
32
28
  };
@@ -40,11 +36,7 @@ declare const _default: {
40
36
  url: string;
41
37
  }[];
42
38
  functionParameter: {
43
- number1: {
44
- name: string;
45
- detail: string;
46
- };
47
- number2: {
39
+ number: {
48
40
  name: string;
49
41
  detail: string;
50
42
  };
@@ -58,11 +50,7 @@ declare const _default: {
58
50
  url: string;
59
51
  }[];
60
52
  functionParameter: {
61
- number1: {
62
- name: string;
63
- detail: string;
64
- };
65
- number2: {
53
+ number: {
66
54
  name: string;
67
55
  detail: string;
68
56
  };
@@ -76,11 +64,7 @@ declare const _default: {
76
64
  url: string;
77
65
  }[];
78
66
  functionParameter: {
79
- number1: {
80
- name: string;
81
- detail: string;
82
- };
83
- number2: {
67
+ number: {
84
68
  name: string;
85
69
  detail: string;
86
70
  };
@@ -22,11 +22,7 @@ declare const _default: {
22
22
  url: string;
23
23
  }[];
24
24
  functionParameter: {
25
- number1: {
26
- name: string;
27
- detail: string;
28
- };
29
- number2: {
25
+ number: {
30
26
  name: string;
31
27
  detail: string;
32
28
  };
@@ -40,11 +36,7 @@ declare const _default: {
40
36
  url: string;
41
37
  }[];
42
38
  functionParameter: {
43
- number1: {
44
- name: string;
45
- detail: string;
46
- };
47
- number2: {
39
+ number: {
48
40
  name: string;
49
41
  detail: string;
50
42
  };
@@ -58,11 +50,7 @@ declare const _default: {
58
50
  url: string;
59
51
  }[];
60
52
  functionParameter: {
61
- number1: {
62
- name: string;
63
- detail: string;
64
- };
65
- number2: {
53
+ number: {
66
54
  name: string;
67
55
  detail: string;
68
56
  };
@@ -76,11 +64,7 @@ declare const _default: {
76
64
  url: string;
77
65
  }[];
78
66
  functionParameter: {
79
- number1: {
80
- name: string;
81
- detail: string;
82
- };
83
- number2: {
67
+ number: {
84
68
  name: string;
85
69
  detail: string;
86
70
  };
@@ -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
- number1: {
2394
+ parameter: {
2449
2395
  name: string;
2450
2396
  detail: string;
2451
2397
  };
2452
- number2: {
2398
+ calculation: {
2453
2399
  name: string;
2454
2400
  detail: string;
2455
2401
  };
@@ -2489,6 +2435,10 @@ declare const _default: {
2489
2435
  name: string;
2490
2436
  detail: string;
2491
2437
  };
2438
+ value3: {
2439
+ name: string;
2440
+ detail: string;
2441
+ };
2492
2442
  };
2493
2443
  };
2494
2444
  MAP: {
@@ -2761,6 +2711,24 @@ declare const _default: {
2761
2711
  };
2762
2712
  };
2763
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
+ };
2764
2732
  DBCS: {
2765
2733
  description: string;
2766
2734
  abstract: string;
@@ -3687,11 +3655,23 @@ declare const _default: {
3687
3655
  url: string;
3688
3656
  }[];
3689
3657
  functionParameter: {
3690
- number1: {
3658
+ row_num: {
3691
3659
  name: string;
3692
3660
  detail: string;
3693
3661
  };
3694
- number2: {
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: {
3695
3675
  name: string;
3696
3676
  detail: string;
3697
3677
  };
@@ -4245,11 +4225,19 @@ declare const _default: {
4245
4225
  url: string;
4246
4226
  }[];
4247
4227
  functionParameter: {
4248
- number1: {
4228
+ lookupValue: {
4249
4229
  name: string;
4250
4230
  detail: string;
4251
4231
  };
4252
- number2: {
4232
+ tableArray: {
4233
+ name: string;
4234
+ detail: string;
4235
+ };
4236
+ colIndexNum: {
4237
+ name: string;
4238
+ detail: string;
4239
+ };
4240
+ rangeLookup: {
4253
4241
  name: string;
4254
4242
  detail: string;
4255
4243
  };
@@ -4957,6 +4945,24 @@ declare const _default: {
4957
4945
  };
4958
4946
  };
4959
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
+ };
4960
4966
  FORECAST_ETS: {
4961
4967
  description: string;
4962
4968
  abstract: string;
@@ -6333,11 +6339,7 @@ declare const _default: {
6333
6339
  url: string;
6334
6340
  }[];
6335
6341
  functionParameter: {
6336
- number1: {
6337
- name: string;
6338
- detail: string;
6339
- };
6340
- number2: {
6342
+ number: {
6341
6343
  name: string;
6342
6344
  detail: string;
6343
6345
  };
@@ -6351,11 +6353,7 @@ declare const _default: {
6351
6353
  url: string;
6352
6354
  }[];
6353
6355
  functionParameter: {
6354
- number1: {
6355
- name: string;
6356
- detail: string;
6357
- };
6358
- number2: {
6356
+ number: {
6359
6357
  name: string;
6360
6358
  detail: string;
6361
6359
  };
@@ -6369,11 +6367,7 @@ declare const _default: {
6369
6367
  url: string;
6370
6368
  }[];
6371
6369
  functionParameter: {
6372
- number1: {
6373
- name: string;
6374
- detail: string;
6375
- };
6376
- number2: {
6370
+ number: {
6377
6371
  name: string;
6378
6372
  detail: string;
6379
6373
  };
@@ -6387,11 +6381,7 @@ declare const _default: {
6387
6381
  url: string;
6388
6382
  }[];
6389
6383
  functionParameter: {
6390
- number1: {
6391
- name: string;
6392
- detail: string;
6393
- };
6394
- number2: {
6384
+ number: {
6395
6385
  name: string;
6396
6386
  detail: string;
6397
6387
  };
@@ -6865,6 +6855,24 @@ declare const _default: {
6865
6855
  };
6866
6856
  };
6867
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
+ };
6868
6876
  FLOOR_MATH: {
6869
6877
  description: string;
6870
6878
  abstract: string;
@@ -9232,6 +9240,7 @@ declare const _default: {
9232
9240
  web: string;
9233
9241
  array: string;
9234
9242
  univer: string;
9243
+ user: string;
9235
9244
  };
9236
9245
  moreFunctions: {
9237
9246
  confirm: string;
@@ -38,25 +38,46 @@ export interface IDescriptionService {
38
38
  * @returns
39
39
  */
40
40
  getSearchListByName(searchText: string): ISearchItem[];
41
+ /**
42
+ * get search list by name, from first letter
43
+ * @param searchText
44
+ * @returns
45
+ */
46
+ getSearchListByNameFirstLetter(searchText: string): ISearchItem[];
41
47
  /**
42
48
  * get search list by type, if type is -1, return all
43
49
  * @param type
44
50
  * @returns
45
51
  */
46
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;
47
63
  }
48
64
  export declare const IDescriptionService: import("@wendellhu/redi").IdentifierDecorator<IDescriptionService>;
49
65
  export declare class DescriptionService implements IDescriptionService, IDisposable {
50
66
  private _description;
51
67
  private readonly _functionService;
52
68
  private readonly _localeService;
69
+ private _descriptions;
53
70
  constructor(_description: IFunctionInfo[], _functionService: IFunctionService, _localeService: LocaleService);
54
71
  dispose(): void;
55
72
  getDescriptions(): Map<IFunctionNames, IFunctionInfo>;
56
73
  hasFunction(searchText: string): boolean;
57
74
  getFunctionInfo(searchText: string): IFunctionInfo | undefined;
58
75
  getSearchListByName(searchText: string): ISearchItem[];
76
+ getSearchListByNameFirstLetter(searchText: string): ISearchItem[];
59
77
  getSearchListByType(type: number): ISearchItem[];
78
+ registerDescriptions(description: IFunctionInfo[]): void;
79
+ unregisterDescriptions(functionNames: string[]): void;
60
80
  private _initialize;
61
- private _registerDescription;
81
+ private _initDescription;
82
+ private _registerDescriptions;
62
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 { IFunctionInfo } from '@univerjs/engine-formula';
16
+ import { type IFunctionInfo } from '@univerjs/engine-formula';
17
17
  export declare const FUNCTION_LIST_ARRAY: 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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
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 { IFunctionInfo } from '@univerjs/engine-formula';
16
+ import { type IFunctionInfo } from '@univerjs/engine-formula';
17
17
  export declare const FUNCTION_LIST_LOOKUP: IFunctionInfo[];