@univerjs/sheets-formula 0.2.2 → 0.2.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +13 -7
  2. package/lib/cjs/index.js +4 -4
  3. package/lib/es/index.js +4321 -4196
  4. package/lib/locale/en-US.json +103 -119
  5. package/lib/locale/ru-RU.json +103 -119
  6. package/lib/locale/vi-VN.json +7425 -0
  7. package/lib/locale/zh-CN.json +107 -123
  8. package/lib/locale/zh-TW.json +10292 -0
  9. package/lib/types/commands/operations/__tests__/create-command-test-bed.d.ts +7 -8
  10. package/lib/types/controllers/__tests__/create-command-test-bed.d.ts +1 -2
  11. package/lib/types/controllers/formula-clipboard.controller.d.ts +1 -2
  12. package/lib/types/controllers/formula-editor-show.controller.d.ts +7 -3
  13. package/lib/types/controllers/formula-ui.controller.d.ts +2 -2
  14. package/lib/types/controllers/menu.d.ts +1 -1
  15. package/lib/types/controllers/prompt.controller.d.ts +27 -25
  16. package/lib/types/controllers/trigger-calculation.controller.d.ts +4 -0
  17. package/lib/types/controllers/update-formula.controller.d.ts +3 -4
  18. package/lib/types/controllers/utils/ref-range-formula.d.ts +0 -17
  19. package/lib/types/formula-ui-plugin.d.ts +9 -4
  20. package/lib/types/index.d.ts +2 -2
  21. package/lib/types/locale/en-US.d.ts +53 -69
  22. package/lib/types/locale/function-list/array/vi-VN.d.ts +17 -0
  23. package/lib/types/locale/function-list/array/zh-TW.d.ts +17 -0
  24. package/lib/types/locale/function-list/compatibility/vi-VN.d.ts +702 -0
  25. package/lib/types/locale/function-list/compatibility/zh-TW.d.ts +702 -0
  26. package/lib/types/locale/function-list/cube/vi-VN.d.ts +144 -0
  27. package/lib/types/locale/function-list/cube/zh-TW.d.ts +144 -0
  28. package/lib/types/locale/function-list/database/vi-VN.d.ts +234 -0
  29. package/lib/types/locale/function-list/database/zh-TW.d.ts +234 -0
  30. package/lib/types/locale/function-list/date/en-US.d.ts +37 -25
  31. package/lib/types/locale/function-list/date/ja-JP.d.ts +37 -25
  32. package/lib/types/locale/function-list/date/vi-VN.d.ts +379 -0
  33. package/lib/types/locale/function-list/date/zh-CN.d.ts +37 -25
  34. package/lib/types/locale/function-list/date/zh-TW.d.ts +426 -0
  35. package/lib/types/locale/function-list/engineering/vi-VN.d.ts +990 -0
  36. package/lib/types/locale/function-list/engineering/zh-TW.d.ts +990 -0
  37. package/lib/types/locale/function-list/financial/vi-VN.d.ts +954 -0
  38. package/lib/types/locale/function-list/financial/zh-TW.d.ts +1008 -0
  39. package/lib/types/locale/function-list/information/vi-VN.d.ts +3 -0
  40. package/lib/types/locale/function-list/information/zh-TW.d.ts +352 -0
  41. package/lib/types/locale/function-list/logical/vi-VN.d.ts +368 -0
  42. package/lib/types/locale/function-list/logical/zh-TW.d.ts +368 -0
  43. package/lib/types/locale/function-list/lookup/vi-VN.d.ts +188 -0
  44. package/lib/types/locale/function-list/lookup/zh-TW.d.ts +752 -0
  45. package/lib/types/locale/function-list/math/en-US.d.ts +16 -44
  46. package/lib/types/locale/function-list/math/ja-JP.d.ts +16 -44
  47. package/lib/types/locale/function-list/math/vi-VN.d.ts +3 -0
  48. package/lib/types/locale/function-list/math/zh-CN.d.ts +16 -44
  49. package/lib/types/locale/function-list/math/zh-TW.d.ts +1498 -0
  50. package/lib/types/locale/function-list/statistical/vi-VN.d.ts +394 -0
  51. package/lib/types/locale/function-list/statistical/zh-TW.d.ts +2060 -0
  52. package/lib/types/locale/function-list/text/vi-VN.d.ts +650 -0
  53. package/lib/types/locale/function-list/text/zh-TW.d.ts +852 -0
  54. package/lib/types/locale/function-list/univer/vi-VN.d.ts +17 -0
  55. package/lib/types/locale/function-list/univer/zh-TW.d.ts +17 -0
  56. package/lib/types/locale/function-list/web/vi-VN.d.ts +3 -0
  57. package/lib/types/locale/function-list/web/zh-TW.d.ts +72 -0
  58. package/lib/types/locale/ru-RU.d.ts +53 -69
  59. package/lib/types/locale/vi-VN.d.ts +6699 -0
  60. package/lib/types/locale/zh-CN.d.ts +53 -69
  61. package/lib/types/locale/zh-TW.d.ts +9288 -0
  62. package/lib/types/services/description.service.d.ts +2 -3
  63. package/lib/types/services/formula-ref-range.service.d.ts +1 -2
  64. package/lib/types/services/prompt.service.d.ts +2 -11
  65. package/lib/types/services/register-function.service.d.ts +21 -8
  66. package/lib/types/services/register-other-formula.service.d.ts +1 -0
  67. package/lib/types/services/remote/remote-register-function.service.d.ts +17 -0
  68. package/lib/types/services/render-services/ref-selections.render-service.d.ts +36 -0
  69. package/lib/types/views/prompt/resize-scroll-observer.d.ts +18 -0
  70. package/lib/umd/index.js +4 -4
  71. package/package.json +24 -24
  72. package/lib/types/services/formula-custom-function.service.d.ts +0 -19
@@ -1,6 +1,5 @@
1
- import { LocaleService } from '@univerjs/core';
1
+ import { LocaleService, IDisposable } from '@univerjs/core';
2
2
  import { IFunctionInfo, IFunctionNames, IFunctionService } from '@univerjs/engine-formula';
3
- import { IDisposable } from '@wendellhu/redi';
4
3
 
5
4
  export interface ISearchItem {
6
5
  name: string;
@@ -61,7 +60,7 @@ export interface IDescriptionService {
61
60
  */
62
61
  isFormulaDefinedName(name: string): boolean;
63
62
  }
64
- export declare const IDescriptionService: import('@wendellhu/redi').IdentifierDecorator<IDescriptionService>;
63
+ export declare const IDescriptionService: import('@univerjs/core').IdentifierDecorator<IDescriptionService>;
65
64
  export declare class DescriptionService implements IDescriptionService, IDisposable {
66
65
  private _description;
67
66
  private readonly _functionService;
@@ -1,7 +1,6 @@
1
- import { IMutationInfo, Disposable, IUniverInstanceService } from '@univerjs/core';
1
+ import { IDisposable, IMutationInfo, Disposable, IUniverInstanceService } from '@univerjs/core';
2
2
  import { LexerTreeBuilder } from '@univerjs/engine-formula';
3
3
  import { RefRangeService } from '@univerjs/sheets';
4
- import { IDisposable } from '@wendellhu/redi';
5
4
 
6
5
  export type FormulaChangeMap = Record<string, Record<string, Record<string, string>>>;
7
6
  export type FormulaChangeCallback = (formulaString: string) => {
@@ -1,6 +1,5 @@
1
- import { Direction } from '@univerjs/core';
1
+ import { Direction, IDisposable } from '@univerjs/core';
2
2
  import { IFunctionInfo, ISequenceNode } from '@univerjs/engine-formula';
3
- import { IDisposable } from '@wendellhu/redi';
4
3
  import { Observable } from 'rxjs';
5
4
  import { ISearchItem } from './description.service';
6
5
 
@@ -88,9 +87,6 @@ export interface IFormulaPromptService {
88
87
  updateSequenceRef(nodeIndex: number, refString: string): void;
89
88
  insertSequenceRef(index: number, refString: string): void;
90
89
  insertSequenceString(index: number, content: string): void;
91
- enableSelectionMoving(): void;
92
- disableSelectionMoving(): void;
93
- isSelectionMoving(): boolean;
94
90
  enableLockedSelectionChange(): void;
95
91
  disableLockedSelectionChange(): void;
96
92
  isLockedSelectionChange(): boolean;
@@ -98,7 +94,7 @@ export interface IFormulaPromptService {
98
94
  disableLockedSelectionInsert(): void;
99
95
  isLockedSelectionInsert(): boolean;
100
96
  }
101
- export declare const IFormulaPromptService: import('@wendellhu/redi').IdentifierDecorator<FormulaPromptService>;
97
+ export declare const IFormulaPromptService: import('@univerjs/core').IdentifierDecorator<FormulaPromptService>;
102
98
  export declare class FormulaPromptService implements IFormulaPromptService, IDisposable {
103
99
  private readonly _search$;
104
100
  private readonly _help$;
@@ -112,9 +108,7 @@ export declare class FormulaPromptService implements IFormulaPromptService, IDis
112
108
  readonly acceptFormulaName$: Observable<string>;
113
109
  private _searching;
114
110
  private _helping;
115
- private _isInsertRefString;
116
111
  private _sequenceNodes;
117
- private _isSelectionMoving;
118
112
  private _isLockedOnSelectionChangeRefString;
119
113
  private _isLockedOnSelectionInsertRefString;
120
114
  dispose(): void;
@@ -154,9 +148,6 @@ export declare class FormulaPromptService implements IFormulaPromptService, IDis
154
148
  * @param content
155
149
  */
156
150
  insertSequenceString(index: number, content: string): void;
157
- enableSelectionMoving(): void;
158
- disableSelectionMoving(): void;
159
- isSelectionMoving(): boolean;
160
151
  enableLockedSelectionChange(): void;
161
152
  disableLockedSelectionChange(): void;
162
153
  isLockedSelectionChange(): boolean;
@@ -1,9 +1,17 @@
1
- import { ILocales, Disposable, LocaleService } from '@univerjs/core';
2
- import { IFunctionInfo, IFunctionService } from '@univerjs/engine-formula';
3
- import { IDisposable } from '@wendellhu/redi';
1
+ import { IDisposable, ILocales, Disposable, LocaleService } from '@univerjs/core';
2
+ import { IFunctionInfo, PrimitiveValueType, IFunctionService } from '@univerjs/engine-formula';
4
3
  import { IDescriptionService } from './description.service';
5
- import { IRegisterFunctionList, IFormulaCustomFunctionService } from './formula-custom-function.service';
4
+ import { IRemoteRegisterFunctionService } from './remote/remote-register-function.service';
6
5
 
6
+ export type IRegisterFunction = (...arg: Array<PrimitiveValueType | PrimitiveValueType[][]>) => PrimitiveValueType | PrimitiveValueType[][];
7
+ export type IRegisterFunctionList = [[IRegisterFunction, string, string?]];
8
+ export interface IFormulaCustomFunctionService {
9
+ /**
10
+ * register descriptions
11
+ * @param functionList
12
+ */
13
+ registerFunctions(functionList: IRegisterFunctionList): IDisposable;
14
+ }
7
15
  /**
8
16
  * Register function operation params
9
17
  */
@@ -34,19 +42,24 @@ export interface IUnregisterFunctionParams {
34
42
  */
35
43
  functionNames: string[];
36
44
  }
45
+ /**
46
+ * This
47
+ */
37
48
  export interface IRegisterFunctionService {
38
49
  /**
39
50
  * register descriptions
40
- * @param functionList
51
+ * @param params
41
52
  */
42
53
  registerFunctions(params: IRegisterFunctionParams): IDisposable;
43
54
  }
44
- export declare const IRegisterFunctionService: import('@wendellhu/redi').IdentifierDecorator<IRegisterFunctionService>;
55
+ export declare const IRegisterFunctionService: import('@univerjs/core').IdentifierDecorator<IRegisterFunctionService>;
45
56
  export declare class RegisterFunctionService extends Disposable implements IRegisterFunctionService {
46
57
  private readonly _localeService;
47
58
  private readonly _descriptionService;
48
- private readonly _formulaCustomFunctionService;
49
59
  private readonly _functionService;
50
- constructor(_localeService: LocaleService, _descriptionService: IDescriptionService, _formulaCustomFunctionService: IFormulaCustomFunctionService, _functionService: IFunctionService);
60
+ private readonly _remoteRegisterFunctionService?;
61
+ constructor(_localeService: LocaleService, _descriptionService: IDescriptionService, _functionService: IFunctionService, _remoteRegisterFunctionService?: IRemoteRegisterFunctionService | undefined);
51
62
  registerFunctions(params: IRegisterFunctionParams): IDisposable;
63
+ private _registerLocalExecutors;
64
+ private _registerRemoteExecutors;
52
65
  }
@@ -16,6 +16,7 @@ export declare class RegisterOtherFormulaService extends Disposable {
16
16
  private _formulaResult$;
17
17
  formulaResult$: import('rxjs').Observable<Record<string, Record<string, IOtherFormulaResult[]>>>;
18
18
  constructor(_commandService: ICommandService, _activeDirtyManagerService: IActiveDirtyManagerService);
19
+ dispose(): void;
19
20
  private _ensureCacheMap;
20
21
  private _createFormulaId;
21
22
  private _initFormulaRegister;
@@ -0,0 +1,17 @@
1
+ import { IFunctionService } from '@univerjs/engine-formula';
2
+
3
+ export interface IRemoteRegisterFunctionService {
4
+ registerFunctions(serializedFuncs: Array<[string, string]>): Promise<void>;
5
+ unregisterFunctions(names: string[]): Promise<void>;
6
+ }
7
+ export declare const RemoteRegisterFunctionServiceName = "sheets-formula.remote-register-function.service";
8
+ export declare const IRemoteRegisterFunctionService: import('@univerjs/core').IdentifierDecorator<IRemoteRegisterFunctionService>;
9
+ /**
10
+ * This class should resident in the remote process.
11
+ */
12
+ export declare class RemoteRegisterFunctionService implements IRemoteRegisterFunctionService {
13
+ private readonly _functionService;
14
+ constructor(_functionService: IFunctionService);
15
+ registerFunctions(serializedFuncs: Array<[string, string]>): Promise<void>;
16
+ unregisterFunctions(names: string[]): Promise<void>;
17
+ }
@@ -0,0 +1,36 @@
1
+ import { IDisposable, Workbook, Injector, ThemeService } from '@univerjs/core';
2
+ import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
3
+ import { SheetsSelectionsService } from '@univerjs/sheets';
4
+ import { BaseSelectionRenderService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';
5
+ import { IShortcutService } from '@univerjs/ui';
6
+
7
+ /**
8
+ * This service extends the existing `SelectionRenderService` to provide the rendering of prompt selections
9
+ * when user is editing ref ranges in formulas.
10
+ *
11
+ * Not that this service works with Uni-mode, which means it should be able to deal with multi render unit
12
+ * and handle selections on them, though each at a time.
13
+ */
14
+ export declare class RefSelectionsRenderService extends BaseSelectionRenderService implements IRenderModule {
15
+ private readonly _context;
16
+ private readonly _sheetSkeletonManagerService;
17
+ private readonly _workbookSelections;
18
+ private _eventDisposables;
19
+ constructor(_context: IRenderContext<Workbook>, injector: Injector, themeService: ThemeService, shortcutService: IShortcutService, renderManagerService: IRenderManagerService, refSelectionsService: SheetsSelectionsService, _sheetSkeletonManagerService: SheetSkeletonManagerService);
20
+ getLocation(): [string, string];
21
+ setRemainLastEnabled(enabled: boolean): void;
22
+ setSkipLastEnabled(enabled: boolean): void;
23
+ clearLastSelection(): void;
24
+ /**
25
+ * Call this method and user will be able to select on the canvas to update selections.
26
+ */
27
+ enableSelectionChanging(): IDisposable;
28
+ private _disableSelectionChanging;
29
+ private _initCanvasEventListeners;
30
+ private _initUserActionSyncListener;
31
+ private _updateSelections;
32
+ private _initSelectionChangeListener;
33
+ private _initSkeletonChangeListener;
34
+ private _getActiveViewport;
35
+ private _getSheetObject;
36
+ }
@@ -0,0 +1,18 @@
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
+ type Callback = () => void;
17
+ export declare const useResizeScrollObserver: (callback: Callback, delay?: number) => void;
18
+ export default useResizeScrollObserver;