@univerjs/sheets-formula 0.1.9 → 0.1.11

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 (57) hide show
  1. package/README.md +3 -768
  2. package/lib/cjs/index.js +8 -8
  3. package/lib/es/index.js +3432 -2216
  4. package/lib/types/commands/operations/__tests__/create-command-test-bed.d.ts +2 -2
  5. package/lib/types/commands/operations/editor-formula.operation.d.ts +3 -3
  6. package/lib/types/common/selection.d.ts +1 -1
  7. package/lib/types/controllers/__tests__/create-command-test-bed.d.ts +1 -1
  8. package/lib/types/controllers/active-dirty.controller.d.ts +1 -1
  9. package/lib/types/controllers/array-formula-display.controller.d.ts +2 -2
  10. package/lib/types/controllers/defined-name.controller.d.ts +2 -2
  11. package/lib/types/controllers/formula-alert.controller.d.ts +12 -0
  12. package/lib/types/controllers/formula-auto-fill.controller.d.ts +2 -2
  13. package/lib/types/controllers/formula-clipboard.controller.d.ts +3 -3
  14. package/lib/types/controllers/formula-editor-show.controller.d.ts +7 -6
  15. package/lib/types/controllers/formula-render.controller.d.ts +11 -0
  16. package/lib/types/controllers/formula-ui.controller.d.ts +6 -3
  17. package/lib/types/controllers/menu.d.ts +1 -1
  18. package/lib/types/controllers/prompt.controller.d.ts +8 -8
  19. package/lib/types/controllers/trigger-calculation.controller.d.ts +3 -3
  20. package/lib/types/controllers/update-formula.controller.d.ts +4 -3
  21. package/lib/types/controllers/utils/__tests__/utils.spec.d.ts +16 -0
  22. package/lib/types/controllers/utils/offset-formula-data.d.ts +4 -2
  23. package/lib/types/controllers/utils/ref-range-formula.d.ts +1 -1
  24. package/lib/types/controllers/utils/utils.d.ts +8 -1
  25. package/lib/types/formula-ui-plugin.d.ts +3 -3
  26. package/lib/types/index.d.ts +1 -1
  27. package/lib/types/locale/en-US.d.ts +15 -0
  28. package/lib/types/locale/function-list/array/ru-RU.d.ts +3 -0
  29. package/lib/types/locale/function-list/compatibility/ru-RU.d.ts +3 -0
  30. package/lib/types/locale/function-list/cube/ru-RU.d.ts +144 -0
  31. package/lib/types/locale/function-list/database/ru-RU.d.ts +234 -0
  32. package/lib/types/locale/function-list/date/ru-RU.d.ts +3 -0
  33. package/lib/types/locale/function-list/engineering/ru-RU.d.ts +3 -0
  34. package/lib/types/locale/function-list/financial/ru-RU.d.ts +3 -0
  35. package/lib/types/locale/function-list/information/ru-RU.d.ts +3 -0
  36. package/lib/types/locale/function-list/logical/ru-RU.d.ts +3 -0
  37. package/lib/types/locale/function-list/lookup/ru-RU.d.ts +3 -0
  38. package/lib/types/locale/function-list/math/ru-RU.d.ts +3 -0
  39. package/lib/types/locale/function-list/statistical/ru-RU.d.ts +3 -0
  40. package/lib/types/locale/function-list/text/ru-RU.d.ts +852 -0
  41. package/lib/types/locale/function-list/univer/ru-RU.d.ts +17 -0
  42. package/lib/types/locale/function-list/web/ru-RU.d.ts +72 -0
  43. package/lib/types/locale/index.d.ts +1 -0
  44. package/lib/types/locale/ru-RU.d.ts +9276 -0
  45. package/lib/types/locale/zh-CN.d.ts +15 -0
  46. package/lib/types/services/description.service.d.ts +4 -4
  47. package/lib/types/services/formula-custom-function.service.d.ts +4 -5
  48. package/lib/types/services/formula-ref-range.service.d.ts +3 -3
  49. package/lib/types/services/prompt.service.d.ts +4 -4
  50. package/lib/types/services/register-function.service.d.ts +6 -7
  51. package/lib/types/services/register-other-formula.service.d.ts +2 -2
  52. package/lib/types/services/utils.d.ts +2 -1
  53. package/lib/types/views/more-functions/function-help/FunctionHelp.d.ts +15 -1
  54. package/lib/types/views/more-functions/input-params/InputParams.d.ts +1 -1
  55. package/lib/types/views/more-functions/select-function/SelectFunction.d.ts +1 -1
  56. package/lib/umd/index.js +7 -7
  57. package/package.json +27 -24
@@ -9227,6 +9227,21 @@ declare const _default: {
9227
9227
  required: string;
9228
9228
  optional: string;
9229
9229
  };
9230
+ error: {
9231
+ title: string;
9232
+ divByZero: string;
9233
+ name: string;
9234
+ value: string;
9235
+ num: string;
9236
+ na: string;
9237
+ cycle: string;
9238
+ ref: string;
9239
+ spill: string;
9240
+ calc: string;
9241
+ error: string;
9242
+ connect: string;
9243
+ null: string;
9244
+ };
9230
9245
  functionType: {
9231
9246
  financial: string;
9232
9247
  date: string;
@@ -1,6 +1,6 @@
1
- import { IDisposable } from '@wendellhu/redi';
2
- import { IFunctionInfo, IFunctionNames, IFunctionService } from '@univerjs/engine-formula';
3
1
  import { LocaleService } from '@univerjs/core';
2
+ import { IFunctionInfo, IFunctionNames, IFunctionService } from '@univerjs/engine-formula';
3
+ import { IDisposable } from '@wendellhu/redi';
4
4
 
5
5
  export interface ISearchItem {
6
6
  name: string;
@@ -39,7 +39,7 @@ export interface IDescriptionService {
39
39
  * register descriptions
40
40
  * @param functionList
41
41
  */
42
- registerDescriptions(functionList: IFunctionInfo[]): void;
42
+ registerDescriptions(functionList: IFunctionInfo[]): IDisposable;
43
43
  /**
44
44
  * unregister descriptions
45
45
  * @param functionList
@@ -75,7 +75,7 @@ export declare class DescriptionService implements IDescriptionService, IDisposa
75
75
  getSearchListByName(searchText: string): ISearchItem[];
76
76
  getSearchListByNameFirstLetter(searchText: string): ISearchItem[];
77
77
  getSearchListByType(type: number): ISearchItem[];
78
- registerDescriptions(description: IFunctionInfo[]): void;
78
+ registerDescriptions(description: IFunctionInfo[]): IDisposable;
79
79
  unregisterDescriptions(functionNames: string[]): void;
80
80
  hasDescription(name: string): boolean;
81
81
  hasDefinedNameDescription(name: string): boolean;
@@ -1,5 +1,6 @@
1
- import { PrimitiveValueType } from '@univerjs/engine-formula';
2
1
  import { Disposable, ICommandService } from '@univerjs/core';
2
+ import { PrimitiveValueType } from '@univerjs/engine-formula';
3
+ import { IDisposable } from '@wendellhu/redi';
3
4
 
4
5
  export type IRegisterFunction = (...arg: Array<PrimitiveValueType | PrimitiveValueType[][]>) => PrimitiveValueType | PrimitiveValueType[][];
5
6
  export type IRegisterFunctionList = [[IRegisterFunction, string, string?]];
@@ -8,13 +9,11 @@ export interface IFormulaCustomFunctionService {
8
9
  * register descriptions
9
10
  * @param functionList
10
11
  */
11
- registerFunctions(functionList: IRegisterFunctionList): void;
12
- unregisterFunctions(functionList: string[]): void;
12
+ registerFunctions(functionList: IRegisterFunctionList): IDisposable;
13
13
  }
14
14
  export declare const IFormulaCustomFunctionService: import('@wendellhu/redi').IdentifierDecorator<IFormulaCustomFunctionService>;
15
15
  export declare class FormulaCustomFunctionService extends Disposable implements IFormulaCustomFunctionService {
16
16
  private readonly _commandService;
17
17
  constructor(_commandService: ICommandService);
18
- registerFunctions(functionList: IRegisterFunctionList): void;
19
- unregisterFunctions(functionList: string[]): void;
18
+ registerFunctions(functionList: IRegisterFunctionList): IDisposable;
20
19
  }
@@ -1,7 +1,7 @@
1
- import { IDisposable } from '@wendellhu/redi';
2
- import { RefRangeService } from '@univerjs/sheets';
3
- import { LexerTreeBuilder } from '@univerjs/engine-formula';
4
1
  import { IMutationInfo, Disposable, IUniverInstanceService } from '@univerjs/core';
2
+ import { LexerTreeBuilder } from '@univerjs/engine-formula';
3
+ import { RefRangeService } from '@univerjs/sheets';
4
+ import { IDisposable } from '@wendellhu/redi';
5
5
 
6
6
  export type FormulaChangeMap = Record<string, Record<string, Record<string, string>>>;
7
7
  export type FormulaChangeCallback = (formulaString: string) => {
@@ -1,8 +1,8 @@
1
- import { ISearchItem } from './description.service';
2
- import { Observable } from 'rxjs';
3
- import { IDisposable } from '@wendellhu/redi';
4
- import { IFunctionInfo, ISequenceNode } from '@univerjs/engine-formula';
5
1
  import { Direction } from '@univerjs/core';
2
+ import { IFunctionInfo, ISequenceNode } from '@univerjs/engine-formula';
3
+ import { IDisposable } from '@wendellhu/redi';
4
+ import { Observable } from 'rxjs';
5
+ import { ISearchItem } from './description.service';
6
6
 
7
7
  export interface ISearchFunctionOperationParams {
8
8
  /**
@@ -1,7 +1,8 @@
1
- import { IRegisterFunctionList, IFormulaCustomFunctionService } from './formula-custom-function.service';
2
- import { IDescriptionService } from './description.service';
3
- import { IFunctionInfo, IFunctionService } from '@univerjs/engine-formula';
4
1
  import { ILocales, Disposable, LocaleService } from '@univerjs/core';
2
+ import { IFunctionInfo, IFunctionService } from '@univerjs/engine-formula';
3
+ import { IDisposable } from '@wendellhu/redi';
4
+ import { IDescriptionService } from './description.service';
5
+ import { IRegisterFunctionList, IFormulaCustomFunctionService } from './formula-custom-function.service';
5
6
 
6
7
  /**
7
8
  * Register function operation params
@@ -38,8 +39,7 @@ export interface IRegisterFunctionService {
38
39
  * register descriptions
39
40
  * @param functionList
40
41
  */
41
- registerFunctions(params: IRegisterFunctionParams): void;
42
- unregisterFunctions(params: IUnregisterFunctionParams): void;
42
+ registerFunctions(params: IRegisterFunctionParams): IDisposable;
43
43
  }
44
44
  export declare const IRegisterFunctionService: import('@wendellhu/redi').IdentifierDecorator<IRegisterFunctionService>;
45
45
  export declare class RegisterFunctionService extends Disposable implements IRegisterFunctionService {
@@ -48,6 +48,5 @@ export declare class RegisterFunctionService extends Disposable implements IRegi
48
48
  private readonly _formulaCustomFunctionService;
49
49
  private readonly _functionService;
50
50
  constructor(_localeService: LocaleService, _descriptionService: IDescriptionService, _formulaCustomFunctionService: IFormulaCustomFunctionService, _functionService: IFunctionService);
51
- registerFunctions(params: IRegisterFunctionParams): void;
52
- unregisterFunctions(params: IUnregisterFunctionParams): void;
51
+ registerFunctions(params: IRegisterFunctionParams): IDisposable;
53
52
  }
@@ -1,6 +1,6 @@
1
- import { IOtherFormulaResult } from './formula-common';
2
- import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
3
1
  import { Nullable, Disposable, ICommandService } from '@univerjs/core';
2
+ import { IActiveDirtyManagerService } from '@univerjs/engine-formula';
3
+ import { IOtherFormulaResult } from './formula-common';
4
4
 
5
5
  export declare class RegisterOtherFormulaService extends Disposable {
6
6
  private readonly _commandService;
@@ -1,8 +1,9 @@
1
- import { IFunctionInfo } from '@univerjs/engine-formula';
2
1
  import { LocaleService } from '@univerjs/core';
2
+ import { IFunctionInfo, IFunctionParam } from '@univerjs/engine-formula';
3
3
 
4
4
  export declare function getFunctionTypeValues(enumObj: any, localeService: LocaleService): Array<{
5
5
  label: string;
6
6
  value: string;
7
7
  }>;
8
8
  export declare function getFunctionName(item: IFunctionInfo, localeService: LocaleService): string;
9
+ export declare function generateParam(param: IFunctionParam): string | undefined;
@@ -1,9 +1,23 @@
1
- import { default as React } from 'react';
2
1
  import { IFunctionParam } from '@univerjs/engine-formula';
2
+ import { default as React } from 'react';
3
3
 
4
4
  interface IFunctionHelpProps {
5
5
  prefix?: string;
6
6
  value?: IFunctionParam[];
7
7
  }
8
+ /**
9
+ * Determine the parameter format
10
+ * ┌─────────┬────────┬─────────────┐
11
+ * │ Require │ Repeat │ Parameter │
12
+ * ├─────────┼────────┼─────────────┤
13
+ * │ 0 │ 0 │ [Number] │
14
+ * │ 1 │ 0 │ Number │
15
+ * │ 0 │ 1 │ [Number,...] │
16
+ * │ 1 │ 1 │ Number,... │
17
+ * └─────────┴────────┴─────────────┘
18
+ *
19
+ * @param props
20
+ * @returns
21
+ */
8
22
  export declare function FunctionHelp(props: IFunctionHelpProps): React.JSX.Element;
9
23
  export {};
@@ -1,5 +1,5 @@
1
- import { default as React } from 'react';
2
1
  import { IFunctionInfo } from '@univerjs/engine-formula';
2
+ import { default as React } from 'react';
3
3
 
4
4
  export interface IInputParamsProps {
5
5
  functionInfo: IFunctionInfo | null;
@@ -1,5 +1,5 @@
1
- import { default as React } from 'react';
2
1
  import { IFunctionInfo } from '@univerjs/engine-formula';
2
+ import { default as React } from 'react';
3
3
 
4
4
  export interface ISelectFunctionProps {
5
5
  onChange: (functionInfo: IFunctionInfo) => void;