@univerjs/core 0.5.2 → 0.5.3-experimental.20250106-e3b7a39
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 -8
- package/lib/es/index.js +3438 -3261
- package/lib/types/common/interceptor.d.ts +17 -2
- package/lib/types/facade/f-base.d.ts +12 -19
- package/lib/types/facade/f-blob.d.ts +12 -12
- package/lib/types/facade/f-enum.d.ts +20 -0
- package/lib/types/facade/f-event.d.ts +33 -0
- package/lib/types/facade/f-univer.d.ts +46 -14
- package/lib/types/facade/f-usermanager.d.ts +5 -2
- package/lib/types/facade/f-util.d.ts +25 -0
- package/lib/types/index.d.ts +3 -1
- package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
- package/lib/types/sheets/typedef.d.ts +21 -7
- package/lib/types/sheets/view-model.d.ts +11 -15
- package/lib/types/sheets/worksheet.d.ts +2 -0
- package/lib/types/types/const/const.d.ts +9 -0
- package/lib/umd/index.js +8 -8
- package/package.json +5 -18
- package/LICENSE +0 -176
|
@@ -5,6 +5,7 @@ export declare enum InterceptorEffectEnum {
|
|
|
5
5
|
Value = 2
|
|
6
6
|
}
|
|
7
7
|
export interface IInterceptor<M, C> {
|
|
8
|
+
id?: string;
|
|
8
9
|
priority?: number;
|
|
9
10
|
handler: InterceptorHandler<M, C>;
|
|
10
11
|
}
|
|
@@ -26,7 +27,14 @@ export declare class InterceptorManager<P extends Record<string, IInterceptor<an
|
|
|
26
27
|
private _interceptorsByName;
|
|
27
28
|
private _interceptorPoints;
|
|
28
29
|
constructor(interceptorPoints: P);
|
|
29
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Get the interceptors.
|
|
32
|
+
* @param name Name of the intercepted point.
|
|
33
|
+
* @param filter A callback function to filter the interceptors.
|
|
34
|
+
* @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
|
|
35
|
+
* you should cache the result instead of calling this function multiple times.
|
|
36
|
+
*/
|
|
37
|
+
fetchThroughInterceptors<T, C>(name: IInterceptor<T, C>, filter?: (interceptor: IInterceptor<any, any>) => boolean): (initValue: Nullable<T>, initContext: C) => Nullable<T>;
|
|
30
38
|
intercept<T extends IInterceptor<any, any>>(name: T, interceptor: T): () => boolean;
|
|
31
39
|
getInterceptPoints(): P;
|
|
32
40
|
dispose(): void;
|
|
@@ -47,7 +55,14 @@ export declare class AsyncInterceptorManager<P extends Record<string, IAsyncInte
|
|
|
47
55
|
private _asyncInterceptorsByName;
|
|
48
56
|
private _asyncInterceptorPoints;
|
|
49
57
|
constructor(asyncInterceptorPoints: P);
|
|
50
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Get the interceptors.
|
|
60
|
+
* @param name Name of the intercepted point.
|
|
61
|
+
* @param filter A callback function to filter the interceptors.
|
|
62
|
+
* @returns It will return a composed interceptor function. If you will perform the interceptor repeatedly,
|
|
63
|
+
* you should cache the result instead of calling this function multiple times.
|
|
64
|
+
*/
|
|
65
|
+
fetchThroughAsyncInterceptors<T, C>(name: IAsyncInterceptor<T, C>, filter?: (interceptor: IAsyncInterceptor<any, any>) => boolean): (initialValue: Nullable<T>, context: C) => Promise<Nullable<T>>;
|
|
51
66
|
interceptAsync<T extends IAsyncInterceptor<any, any>>(name: T, interceptor: T): Promise<() => boolean>;
|
|
52
67
|
getInterceptPoints(): P;
|
|
53
68
|
dispose(): void;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
*/
|
|
1
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
|
+
import { Disposable } from '../shared';
|
|
16
3
|
/**
|
|
17
4
|
* `FBase` is a base class for all facade classes.
|
|
18
5
|
* It provides a way to extend classes with static and instance methods.
|
|
19
6
|
* The `_initialize` as a special method that will be called after the constructor. You should never call it directly.
|
|
20
7
|
*/
|
|
21
|
-
export declare abstract class FBase {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
export declare abstract class FBase extends Disposable {
|
|
9
|
+
static extend(source: any): void;
|
|
10
|
+
}
|
|
11
|
+
declare const InitializerSymbol: unique symbol;
|
|
12
|
+
export declare class FBaseInitialable extends Disposable {
|
|
13
|
+
protected _injector: Injector;
|
|
14
|
+
private [InitializerSymbol];
|
|
15
|
+
constructor(_injector: Injector);
|
|
16
|
+
_initialize(injector: Injector): void;
|
|
25
17
|
static extend(source: any): void;
|
|
26
18
|
}
|
|
19
|
+
export {};
|
|
@@ -21,7 +21,7 @@ export declare class FBlob extends FBase {
|
|
|
21
21
|
* @returns a new blob by copying the current blob
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* const blob =
|
|
24
|
+
* const blob = univerAPI.newBlob(blob);
|
|
25
25
|
* const newBlob = blob.copyBlob();
|
|
26
26
|
* console.log(newBlob);
|
|
27
27
|
* ```
|
|
@@ -33,29 +33,29 @@ export declare class FBlob extends FBase {
|
|
|
33
33
|
* @returns a new blob by converting the current blob to the specified content type
|
|
34
34
|
* @example
|
|
35
35
|
* ```ts
|
|
36
|
-
* const blob =
|
|
36
|
+
* const blob = univerAPI.newBlob(blob);
|
|
37
37
|
* const newBlob = blob.getBlob();
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
getAs(contentType: string): FBlob;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Get the blob as a string.
|
|
43
43
|
* @returns
|
|
44
44
|
* @example
|
|
45
45
|
* ```ts
|
|
46
|
-
* const blob =
|
|
46
|
+
* const blob = univerAPI.newBlob(blob);
|
|
47
47
|
* const newBlob = blob.getDataAsString();
|
|
48
48
|
* console.log(newBlob);
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
getDataAsString(): Promise<string>;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Get the blob as a string.
|
|
54
54
|
* @param charset the charset
|
|
55
55
|
* @returns the blob content as a string
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts
|
|
58
|
-
* const blob =
|
|
58
|
+
* const blob = univerAPI.newBlob(blob);
|
|
59
59
|
* const newBlob = blob.getDataAsString('iso-8859-1');
|
|
60
60
|
* console.log(newBlob);
|
|
61
61
|
* ```
|
|
@@ -66,7 +66,7 @@ export declare class FBlob extends FBase {
|
|
|
66
66
|
* @returns the blob content as a byte array
|
|
67
67
|
* @example
|
|
68
68
|
* ```ts
|
|
69
|
-
* const blob =
|
|
69
|
+
* const blob = univerAPI.newBlob(blob);
|
|
70
70
|
* const newBlob = blob.getBytes();
|
|
71
71
|
* console.log(newBlob);
|
|
72
72
|
* ```
|
|
@@ -78,7 +78,7 @@ export declare class FBlob extends FBase {
|
|
|
78
78
|
* @returns the blob object
|
|
79
79
|
* @example
|
|
80
80
|
* ```ts
|
|
81
|
-
* const blob =
|
|
81
|
+
* const blob = univerAPI.newBlob();
|
|
82
82
|
* const bytes = new Uint8Array(10);
|
|
83
83
|
* blob.setBytes(bytes);
|
|
84
84
|
* ```
|
|
@@ -90,7 +90,7 @@ export declare class FBlob extends FBase {
|
|
|
90
90
|
* @returns the blob object
|
|
91
91
|
* @example
|
|
92
92
|
* ```ts
|
|
93
|
-
* const blob =
|
|
93
|
+
* const blob = univerAPI.newBlob();
|
|
94
94
|
* blob.setDataFromString('Hello, World!');
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
@@ -102,7 +102,7 @@ export declare class FBlob extends FBase {
|
|
|
102
102
|
* @returns the blob object
|
|
103
103
|
* @example
|
|
104
104
|
* ```ts
|
|
105
|
-
* const blob =
|
|
105
|
+
* const blob = univerAPI.newBlob();
|
|
106
106
|
* blob.setDataFromString('Hello, World!', 'text/plain');
|
|
107
107
|
* ```
|
|
108
108
|
*/
|
|
@@ -112,7 +112,7 @@ export declare class FBlob extends FBase {
|
|
|
112
112
|
* @returns the content type
|
|
113
113
|
* @example
|
|
114
114
|
* ```ts
|
|
115
|
-
* const blob =
|
|
115
|
+
* const blob = univerAPI.newBlob(blob);
|
|
116
116
|
* const newBlob = blob.getContentType();
|
|
117
117
|
* console.log(newBlob);
|
|
118
118
|
* ```
|
|
@@ -124,7 +124,7 @@ export declare class FBlob extends FBase {
|
|
|
124
124
|
* @returns the blob object
|
|
125
125
|
* @example
|
|
126
126
|
* ```ts
|
|
127
|
-
* const blob =
|
|
127
|
+
* const blob = univerAPI.newBlob(blob);
|
|
128
128
|
* const newBlob = blob.setContentType('text/plain');
|
|
129
129
|
* console.log(newBlob);
|
|
130
130
|
* ```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UniverInstanceType } from '../common/unit';
|
|
2
|
+
import { LifecycleStages } from '../services/lifecycle/lifecycle';
|
|
3
|
+
import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style';
|
|
4
|
+
import { DataValidationOperator } from '../types/enum/data-validation-operator';
|
|
5
|
+
import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode';
|
|
6
|
+
import { DataValidationStatus } from '../types/enum/data-validation-status';
|
|
7
|
+
import { DataValidationType } from '../types/enum/data-validation-type';
|
|
8
|
+
export declare class FEnum {
|
|
9
|
+
static _instance: FEnum | null;
|
|
10
|
+
static get(): FEnum;
|
|
11
|
+
static extend(source: any): void;
|
|
12
|
+
constructor();
|
|
13
|
+
get UniverInstanceType(): typeof UniverInstanceType;
|
|
14
|
+
get LifecycleStages(): typeof LifecycleStages;
|
|
15
|
+
get DataValidationType(): typeof DataValidationType;
|
|
16
|
+
get DataValidationErrorStyle(): typeof DataValidationErrorStyle;
|
|
17
|
+
get DataValidationRenderMode(): typeof DataValidationRenderMode;
|
|
18
|
+
get DataValidationOperator(): typeof DataValidationOperator;
|
|
19
|
+
get DataValidationStatus(): typeof DataValidationStatus;
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UniverInstanceType } from '../common/unit';
|
|
2
|
+
import { LifecycleStages } from '../services/lifecycle/lifecycle';
|
|
3
|
+
import { IWorkbookData } from '../sheets/typedef';
|
|
4
|
+
import { IDocumentData } from '../types/interfaces';
|
|
5
|
+
export interface ISheetCreateParam {
|
|
6
|
+
unitId: string;
|
|
7
|
+
type: UniverInstanceType.UNIVER_SHEET;
|
|
8
|
+
data: IWorkbookData;
|
|
9
|
+
}
|
|
10
|
+
export interface IDocumentCreateParam {
|
|
11
|
+
unitId: string;
|
|
12
|
+
type: UniverInstanceType.UNIVER_DOC;
|
|
13
|
+
data: IDocumentData;
|
|
14
|
+
}
|
|
15
|
+
export interface ILifeCycleChangedParam {
|
|
16
|
+
stage: LifecycleStages;
|
|
17
|
+
}
|
|
18
|
+
export interface IEventBase {
|
|
19
|
+
cancel?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type IUnitCreateEvent = IEventBase & (ISheetCreateParam | IDocumentCreateParam);
|
|
22
|
+
export type ILifeCycleChangedEvent = IEventBase & ILifeCycleChangedParam;
|
|
23
|
+
export declare class FEventName {
|
|
24
|
+
static _instance: FEventName | null;
|
|
25
|
+
static get(): FEventName;
|
|
26
|
+
static extend(source: any): void;
|
|
27
|
+
constructor();
|
|
28
|
+
get UnitCreated(): "UnitCreated";
|
|
29
|
+
get LifeCycleChanged(): "LifeCycleChanged";
|
|
30
|
+
}
|
|
31
|
+
export interface IEventParamConfig {
|
|
32
|
+
LifeCycleChanged: ILifeCycleChangedEvent;
|
|
33
|
+
}
|
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import { IDisposable, Injector } from '../common/di';
|
|
2
2
|
import { CommandListener, IExecutionOptions, ICommandService } from '../services/command/command.service';
|
|
3
3
|
import { LifecycleStages } from '../services/lifecycle/lifecycle';
|
|
4
|
+
import { IEventParamConfig, FEventName } from './f-event';
|
|
4
5
|
import { IUniverInstanceService } from '../services/instance/instance.service';
|
|
6
|
+
import { LifecycleService } from '../services/lifecycle/lifecycle.service';
|
|
7
|
+
import { ColorBuilder } from '../shared';
|
|
5
8
|
import { Univer } from '../univer';
|
|
6
|
-
import {
|
|
9
|
+
import { FBaseInitialable } from './f-base';
|
|
7
10
|
import { FBlob } from './f-blob';
|
|
11
|
+
import { FEnum } from './f-enum';
|
|
8
12
|
import { FHooks } from './f-hooks';
|
|
9
13
|
import { FUserManager } from './f-usermanager';
|
|
10
|
-
export declare class FUniver extends
|
|
14
|
+
export declare class FUniver extends FBaseInitialable {
|
|
11
15
|
protected readonly _injector: Injector;
|
|
12
16
|
protected readonly _commandService: ICommandService;
|
|
13
17
|
protected readonly _univerInstanceService: IUniverInstanceService;
|
|
18
|
+
protected readonly _lifecycleService: LifecycleService;
|
|
14
19
|
/**
|
|
15
20
|
* Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.
|
|
16
|
-
*
|
|
17
21
|
* @static
|
|
18
|
-
*
|
|
19
22
|
* @param {Univer | Injector} wrapped - The Univer instance or injector instance.
|
|
20
23
|
* @returns {FUniver} - The FUniver instance.
|
|
21
24
|
*/
|
|
22
25
|
static newAPI(wrapped: Univer | Injector): FUniver;
|
|
23
|
-
|
|
26
|
+
private _eventRegistry;
|
|
27
|
+
private _ensureEventRegistry;
|
|
28
|
+
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
|
|
24
29
|
/**
|
|
25
30
|
* Dispose the UniverSheet by the `unitId`. The UniverSheet would be unload from the application.
|
|
26
|
-
*
|
|
27
31
|
* @param unitId The unit id of the UniverSheet.
|
|
28
32
|
* @returns Whether the Univer instance is disposed successfully.
|
|
29
33
|
*/
|
|
30
34
|
disposeUnit(unitId: string): boolean;
|
|
31
35
|
/**
|
|
32
36
|
* Get the current lifecycle stage.
|
|
33
|
-
*
|
|
34
37
|
* @returns {LifecycleStages} - The current lifecycle stage.
|
|
35
38
|
*/
|
|
36
39
|
getCurrentLifecycleStage(): LifecycleStages;
|
|
37
40
|
/**
|
|
38
41
|
* Undo an editing on the currently focused document.
|
|
39
|
-
*
|
|
40
42
|
* @returns {Promise<boolean>} undo result
|
|
41
43
|
*/
|
|
42
44
|
undo(): Promise<boolean>;
|
|
43
45
|
/**
|
|
44
46
|
* Redo an editing on the currently focused document.
|
|
45
|
-
*
|
|
46
47
|
* @returns {Promise<boolean>} redo result
|
|
47
48
|
*/
|
|
48
49
|
redo(): Promise<boolean>;
|
|
49
50
|
/**
|
|
50
51
|
* Register a callback that will be triggered before invoking a command.
|
|
51
|
-
*
|
|
52
|
+
* @deprecated use `addEvent(univerAPI.event.BeforeCommandExecute, () => {})` instead.
|
|
52
53
|
* @param {CommandListener} callback The callback.
|
|
53
54
|
* @returns {IDisposable} The disposable instance.
|
|
54
55
|
*/
|
|
55
56
|
onBeforeCommandExecute(callback: CommandListener): IDisposable;
|
|
56
57
|
/**
|
|
57
58
|
* Register a callback that will be triggered when a command is invoked.
|
|
58
|
-
*
|
|
59
|
+
* @deprecated use `addEvent(univerAPI.event.CommandExecuted, () => {})` instead.
|
|
59
60
|
* @param {CommandListener} callback The callback.
|
|
60
61
|
* @returns {IDisposable} The disposable instance.
|
|
61
62
|
*/
|
|
@@ -78,19 +79,50 @@ export declare class FUniver extends FBase {
|
|
|
78
79
|
syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): R;
|
|
79
80
|
/**
|
|
80
81
|
* Get hooks.
|
|
81
|
-
*
|
|
82
|
+
* @deprecated use `addEvent` instead.
|
|
82
83
|
* @returns {FHooks} FHooks instance
|
|
83
84
|
*/
|
|
84
85
|
getHooks(): FHooks;
|
|
85
86
|
/**
|
|
86
87
|
* Create a new blob.
|
|
87
|
-
*
|
|
88
88
|
* @returns {FBlob} The new blob instance
|
|
89
89
|
* @example
|
|
90
90
|
* ```ts
|
|
91
|
-
* const blob =
|
|
91
|
+
* const blob = univerAPI.newBlob();
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
newBlob(): FBlob;
|
|
95
|
+
newColor(): ColorBuilder;
|
|
96
|
+
get Enum(): FEnum;
|
|
97
|
+
get Event(): FEventName;
|
|
98
|
+
/**
|
|
99
|
+
* Add an event listener
|
|
100
|
+
* @param event key of event
|
|
101
|
+
* @param callback callback when event triggered
|
|
102
|
+
* @returns {Disposable} The Disposable instance, for remove the listener
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
|
|
106
|
+
* console.log('unit created', params);
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
addEvent(event: keyof IEventParamConfig, callback: (params: IEventParamConfig[typeof event]) => void): IDisposable;
|
|
111
|
+
/**
|
|
112
|
+
* Fire an event, used in internal only.
|
|
113
|
+
* @param event {string} key of event
|
|
114
|
+
* @param params {any} params of event
|
|
115
|
+
* @returns {boolean} should cancel
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* this.fireEvent(univerAPI.event.UnitCreated, params);
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
protected fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Get the callback map corresponding to the event
|
|
124
|
+
* @returns {number} The number of callbacks
|
|
125
|
+
*/
|
|
126
|
+
protected hasEventCallback(event: keyof IEventParamConfig): boolean;
|
|
95
127
|
getUserManager(): FUserManager;
|
|
96
128
|
}
|
|
@@ -6,9 +6,12 @@ export declare class FUserManager extends FBase {
|
|
|
6
6
|
private readonly _userManagerService;
|
|
7
7
|
constructor(_injector: Injector, _userManagerService: UserManagerService);
|
|
8
8
|
/**
|
|
9
|
-
* Get current user info
|
|
9
|
+
* Get current user info.
|
|
10
|
+
* @returns {IUser} Current user info.
|
|
10
11
|
* @example
|
|
11
|
-
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* univerAPI.getUserManager().getCurrentUser();
|
|
14
|
+
* ```
|
|
12
15
|
*/
|
|
13
16
|
getCurrentUser(): IUser;
|
|
14
17
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export declare class FUtil {
|
|
17
|
+
static Range: {
|
|
18
|
+
new (): Range;
|
|
19
|
+
prototype: Range;
|
|
20
|
+
readonly START_TO_START: 0;
|
|
21
|
+
readonly START_TO_END: 1;
|
|
22
|
+
readonly END_TO_END: 2;
|
|
23
|
+
readonly END_TO_START: 3;
|
|
24
|
+
};
|
|
25
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -27,10 +27,12 @@ export { AsyncInterceptorManager, composeInterceptors, createAsyncInterceptorKey
|
|
|
27
27
|
export type { Serializable } from './common/json';
|
|
28
28
|
export { MemoryCursor } from './common/memory-cursor';
|
|
29
29
|
export { mixinClass } from './common/mixin';
|
|
30
|
-
export { FBase } from './facade/f-base';
|
|
30
|
+
export { FBase, FBaseInitialable } from './facade/f-base';
|
|
31
31
|
export { FUniver } from './facade/f-univer';
|
|
32
32
|
export { FHooks } from './facade/f-hooks';
|
|
33
33
|
export { FBlob, type IFBlobSource } from './facade/f-blob';
|
|
34
|
+
export { FEventName, type IEventBase, type IEventParamConfig } from './facade/f-event';
|
|
35
|
+
export { FEnum } from './facade/f-enum';
|
|
34
36
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
35
37
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
36
38
|
export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
|
|
@@ -55,14 +55,14 @@ export declare const UndoCommandId = "univer.command.undo";
|
|
|
55
55
|
export declare const UndoCommand: {
|
|
56
56
|
readonly type: CommandType.COMMAND;
|
|
57
57
|
readonly id: "univer.command.undo";
|
|
58
|
-
handler(accessor: IAccessor):
|
|
58
|
+
handler(accessor: IAccessor): boolean;
|
|
59
59
|
dispose(): void;
|
|
60
60
|
dispatchToHandlers(): Promise<boolean>;
|
|
61
61
|
};
|
|
62
62
|
export declare const RedoCommand: {
|
|
63
63
|
readonly type: CommandType.COMMAND;
|
|
64
64
|
readonly id: "univer.command.redo";
|
|
65
|
-
handler(accessor: IAccessor):
|
|
65
|
+
handler(accessor: IAccessor): boolean;
|
|
66
66
|
dispose(): void;
|
|
67
67
|
dispatchToHandlers(): Promise<boolean>;
|
|
68
68
|
};
|
|
@@ -210,6 +210,13 @@ export interface ICellMarks {
|
|
|
210
210
|
br?: ICellMarksStyle;
|
|
211
211
|
isSkip?: boolean;
|
|
212
212
|
}
|
|
213
|
+
export interface IFontRenderExtension {
|
|
214
|
+
leftOffset?: number;
|
|
215
|
+
rightOffset?: number;
|
|
216
|
+
topOffset?: number;
|
|
217
|
+
downOffset?: number;
|
|
218
|
+
isSkip?: boolean;
|
|
219
|
+
}
|
|
213
220
|
export interface ICellDataForSheetInterceptor extends ICellData {
|
|
214
221
|
interceptorStyle?: Nullable<IStyleData>;
|
|
215
222
|
isInArrayFormulaRange?: Nullable<boolean>;
|
|
@@ -223,22 +230,29 @@ export interface ICellDataForSheetInterceptor extends ICellData {
|
|
|
223
230
|
coverable?: boolean;
|
|
224
231
|
linkUrl?: string;
|
|
225
232
|
linkId?: string;
|
|
226
|
-
fontRenderExtension?:
|
|
227
|
-
|
|
228
|
-
rightOffset?: number;
|
|
229
|
-
topOffset?: number;
|
|
230
|
-
downOffset?: number;
|
|
231
|
-
isSkip?: boolean;
|
|
232
|
-
};
|
|
233
|
+
fontRenderExtension?: IFontRenderExtension;
|
|
234
|
+
themeStyle?: Nullable<IStyleData>;
|
|
233
235
|
}
|
|
234
236
|
export declare function isICellData(value: any): value is ICellData;
|
|
235
237
|
export declare function getCellValueType(cell: ICellData): CellValueType | null | undefined;
|
|
236
238
|
export declare function isNullCell(cell: Nullable<ICellData>): boolean;
|
|
237
239
|
export declare function isCellV(cell: Nullable<ICellData | CellValue>): cell is string | number | boolean;
|
|
238
240
|
export interface IFreeze {
|
|
241
|
+
/**
|
|
242
|
+
* count of fixed cols
|
|
243
|
+
*/
|
|
239
244
|
xSplit: number;
|
|
245
|
+
/**
|
|
246
|
+
* count of fixed rows
|
|
247
|
+
*/
|
|
240
248
|
ySplit: number;
|
|
249
|
+
/**
|
|
250
|
+
* scrollable start row
|
|
251
|
+
*/
|
|
241
252
|
startRow: number;
|
|
253
|
+
/**
|
|
254
|
+
* scrollable start column
|
|
255
|
+
*/
|
|
242
256
|
startColumn: number;
|
|
243
257
|
}
|
|
244
258
|
export declare enum RANGE_TYPE {
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
import { IDisposable } from '../common/di';
|
|
2
|
+
import { IInterceptor, InterceptorEffectEnum } from '../common/interceptor';
|
|
2
3
|
import { Nullable } from '../shared/types';
|
|
3
4
|
import { ICellData, ICellDataForSheetInterceptor } from './typedef';
|
|
4
|
-
import { InterceptorEffectEnum } from '../common/interceptor';
|
|
5
5
|
import { Disposable } from '../shared/lifecycle';
|
|
6
6
|
/**
|
|
7
|
+
* A cell content interceptor is used to intercept the cell content. It can change or completely replace the cell content.
|
|
8
|
+
*
|
|
7
9
|
* @internal
|
|
8
10
|
*/
|
|
9
11
|
export interface ICellContentInterceptor {
|
|
10
|
-
getCell: (row: number, col: number, effect: InterceptorEffectEnum) => Nullable<ICellDataForSheetInterceptor>;
|
|
11
|
-
}
|
|
12
|
-
export interface IRowFilteredInterceptor {
|
|
13
|
-
}
|
|
14
|
-
export interface IRowVisibleInterceptor {
|
|
15
|
-
}
|
|
16
|
-
export interface IColVisibleInterceptor {
|
|
17
|
-
}
|
|
18
|
-
export interface ISheetViewModel {
|
|
19
|
-
registerCellContentInterceptor: (interceptor: ICellContentInterceptor) => IDisposable;
|
|
20
|
-
registerRowFilteredInterceptor: (interceptor: IRowFilteredInterceptor) => IDisposable;
|
|
21
|
-
registerRowVisibleInterceptor: (interceptor: IRowVisibleInterceptor) => IDisposable;
|
|
22
|
-
registerColVisibleInterceptor: (interceptor: IColVisibleInterceptor) => IDisposable;
|
|
23
|
-
getCell: (row: number, col: number) => Nullable<ICellDataForSheetInterceptor>;
|
|
12
|
+
getCell: (row: number, col: number, effect: InterceptorEffectEnum, key?: string, filter?: (interceptor: IInterceptor<any, any>) => boolean) => Nullable<ICellDataForSheetInterceptor>;
|
|
24
13
|
}
|
|
25
14
|
/**
|
|
26
15
|
* @internal
|
|
@@ -28,6 +17,12 @@ export interface ISheetViewModel {
|
|
|
28
17
|
export interface IRowFilteredInterceptor {
|
|
29
18
|
getRowFiltered(row: number): boolean;
|
|
30
19
|
}
|
|
20
|
+
export interface IRowFilteredInterceptor {
|
|
21
|
+
}
|
|
22
|
+
export interface IRowVisibleInterceptor {
|
|
23
|
+
}
|
|
24
|
+
export interface IColVisibleInterceptor {
|
|
25
|
+
}
|
|
31
26
|
/**
|
|
32
27
|
* @internal
|
|
33
28
|
*/
|
|
@@ -38,6 +33,7 @@ export declare class SheetViewModel extends Disposable {
|
|
|
38
33
|
constructor(getRawCell: (row: number, col: number) => Nullable<ICellData>);
|
|
39
34
|
dispose(): void;
|
|
40
35
|
getCell(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
36
|
+
getCell(row: number, col: number, key: string, filter: (interceptor: IInterceptor<any, any>) => boolean): Nullable<ICellDataForSheetInterceptor>;
|
|
41
37
|
getCellValueOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
42
38
|
getCellStyleOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
43
39
|
getRowFiltered(row: number): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IInterceptor } from '../common/interceptor';
|
|
1
2
|
import { Nullable, ObjectMatrix } from '../shared';
|
|
2
3
|
import { IPaddingData, IStyleData, ITextRotation } from '../types/interfaces';
|
|
3
4
|
import { Styles } from './styles';
|
|
@@ -228,6 +229,7 @@ export declare class Worksheet {
|
|
|
228
229
|
*/
|
|
229
230
|
getCellStyleOnly(row: number, col: number): Nullable<ICellDataForSheetInterceptor>;
|
|
230
231
|
getCellRaw(row: number, col: number): Nullable<ICellData>;
|
|
232
|
+
getCellWithFilteredInterceptors(row: number, col: number, key: string, filter: (interceptor: IInterceptor<any, any>) => boolean): Nullable<ICellDataForSheetInterceptor>;
|
|
231
233
|
getRowFiltered(row: number): boolean;
|
|
232
234
|
/**
|
|
233
235
|
* Get cell matrix from a given range and pick out non-first cells of merged cells.
|