@univerjs/core 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.
- package/README.md +17 -8
- package/lib/cjs/index.js +11 -9
- package/lib/es/index.js +5302 -4223
- package/lib/types/common/__tests__/url.spec.d.ts +16 -0
- package/lib/types/common/di.d.ts +17 -0
- package/lib/types/common/url.d.ts +1 -0
- package/lib/types/docs/data-model/document-data-model.d.ts +2 -1
- package/lib/types/docs/data-model/preset-list-type.d.ts +3 -29
- package/lib/types/docs/data-model/text-x/utils.d.ts +6 -1
- package/lib/types/index.d.ts +3 -2
- package/lib/types/services/__tests__/index.d.ts +7 -7
- package/lib/types/services/authz-io/authz-io-local.service.d.ts +1 -0
- package/lib/types/services/authz-io/type.d.ts +1 -1
- package/lib/types/services/command/command.service.d.ts +5 -3
- package/lib/types/services/config/config.service.d.ts +1 -1
- package/lib/types/services/context/context.service.d.ts +1 -1
- package/lib/types/services/instance/instance.service.d.ts +2 -2
- package/lib/types/services/lifecycle/lifecycle.d.ts +1 -1
- package/lib/types/services/lifecycle/lifecycle.service.d.ts +3 -3
- package/lib/types/services/local-storage/local-storage.service.d.ts +1 -1
- package/lib/types/services/log/log.service.d.ts +1 -1
- package/lib/types/services/permission/type.d.ts +1 -1
- package/lib/types/services/plugin/plugin-override.d.ts +1 -1
- package/lib/types/services/plugin/plugin.d.ts +1 -1
- package/lib/types/services/plugin/plugin.service.d.ts +3 -1
- package/lib/types/services/resource-loader/type.d.ts +1 -1
- package/lib/types/services/resource-manager/type.d.ts +2 -2
- package/lib/types/services/snapshot/snapshot-server.service.d.ts +1 -1
- package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
- package/lib/types/services/user-manager/user-manager.service.d.ts +1 -0
- package/lib/types/shared/__tests__/rxjs.spec.d.ts +16 -0
- package/lib/types/shared/common.d.ts +1 -1
- package/lib/types/shared/lifecycle.d.ts +8 -1
- package/lib/types/shared/lru/lru-map.d.ts +1 -1
- package/lib/types/shared/rxjs.d.ts +5 -1
- package/lib/types/shared/tools.d.ts +7 -0
- package/lib/types/sheets/view-model.d.ts +1 -1
- package/lib/types/sheets/workbook.d.ts +10 -4
- package/lib/types/types/enum/locale-type.d.ts +3 -1
- package/lib/types/types/interfaces/i-data-validation.d.ts +19 -4
- package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +10 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +29 -21
- package/lib/types/types/interfaces/i-range.d.ts +27 -12
- package/lib/types/types/interfaces/index.d.ts +1 -0
- package/lib/types/univer.d.ts +1 -1
- package/lib/umd/index.js +11 -9
- package/package.json +7 -7
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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 * from '@wendellhu/redi';
|
|
17
|
+
export * from '@wendellhu/redi/react-bindings';
|
|
@@ -2,6 +2,7 @@ import { Nullable } from '../../shared';
|
|
|
2
2
|
import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings } from '../../types/interfaces/i-document-data';
|
|
3
3
|
import { IPaddingData } from '../../types/interfaces/i-style-data';
|
|
4
4
|
import { UnitModel, UniverInstanceType } from '../../common/unit';
|
|
5
|
+
import { SliceBodyType } from './text-x/utils';
|
|
5
6
|
import { JSONXActions } from './json-x/json-x';
|
|
6
7
|
|
|
7
8
|
export declare const DEFAULT_DOC: {
|
|
@@ -53,7 +54,7 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
|
|
|
53
54
|
getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
|
|
54
55
|
getUnitId(): string;
|
|
55
56
|
apply(actions: JSONXActions): IDocumentData | undefined;
|
|
56
|
-
sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
|
|
57
|
+
sliceBody(startOffset: number, endOffset: number, type?: SliceBodyType): Nullable<IDocumentBody>;
|
|
57
58
|
private _initializeHeaderFooterModel;
|
|
58
59
|
updateDocumentId(unitId: string): void;
|
|
59
60
|
}
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IListData } from '../../types/interfaces/i-document-data';
|
|
2
2
|
|
|
3
3
|
export declare enum PresetListType {
|
|
4
4
|
BULLET_LIST = "BULLET_LIST",
|
|
5
5
|
ORDER_LIST = "ORDER_LIST"
|
|
6
6
|
}
|
|
7
7
|
export declare const PRESET_LIST_TYPE: {
|
|
8
|
-
BULLET_LIST:
|
|
9
|
-
|
|
10
|
-
nestingLevel: {
|
|
11
|
-
bulletAlignment: BulletAlignment;
|
|
12
|
-
glyphFormat: string;
|
|
13
|
-
textStyle: {
|
|
14
|
-
fs: number;
|
|
15
|
-
};
|
|
16
|
-
startNumber: number;
|
|
17
|
-
glyphSymbol: string;
|
|
18
|
-
hanging: number;
|
|
19
|
-
indentStart: number;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
ORDER_LIST: {
|
|
23
|
-
listType: PresetListType;
|
|
24
|
-
nestingLevel: {
|
|
25
|
-
bulletAlignment: BulletAlignment;
|
|
26
|
-
glyphFormat: string;
|
|
27
|
-
textStyle: {
|
|
28
|
-
fs: number;
|
|
29
|
-
};
|
|
30
|
-
startNumber: number;
|
|
31
|
-
glyphType: GlyphType;
|
|
32
|
-
hanging: number;
|
|
33
|
-
indentStart: number;
|
|
34
|
-
}[];
|
|
35
|
-
};
|
|
8
|
+
BULLET_LIST: IListData;
|
|
9
|
+
ORDER_LIST: IListData;
|
|
36
10
|
};
|
|
@@ -2,7 +2,11 @@ import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
|
2
2
|
import { ICustomDecoration, IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
3
3
|
import { IRetainAction } from './action-types';
|
|
4
4
|
|
|
5
|
-
export declare
|
|
5
|
+
export declare enum SliceBodyType {
|
|
6
|
+
copy = 0,
|
|
7
|
+
cut = 1
|
|
8
|
+
}
|
|
9
|
+
export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean, type?: SliceBodyType): IDocumentBody;
|
|
6
10
|
export declare function normalizeBody(body: IDocumentBody): IDocumentBody;
|
|
7
11
|
export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
|
|
8
12
|
customRanges: {
|
|
@@ -10,6 +14,7 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
|
|
|
10
14
|
endIndex: number;
|
|
11
15
|
rangeId: string;
|
|
12
16
|
rangeType: import('../../../types/interfaces/i-document-data').CustomRangeType;
|
|
17
|
+
wholeEntity?: boolean;
|
|
13
18
|
}[];
|
|
14
19
|
leftOffset: number;
|
|
15
20
|
rightOffset: number;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export * from './docs/data-model';
|
|
|
31
31
|
export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/text-x/action-types';
|
|
32
32
|
export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
|
|
33
33
|
export { ActionIterator } from './docs/data-model/text-x/action-iterator';
|
|
34
|
-
export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
|
|
34
|
+
export { getBodySlice, composeBody, SliceBodyType } from './docs/data-model/text-x/utils';
|
|
35
35
|
export { TextX } from './docs/data-model/text-x/text-x';
|
|
36
36
|
export type { TPriority } from './docs/data-model/text-x/text-x';
|
|
37
37
|
export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
|
|
@@ -61,7 +61,7 @@ export { IResourceManagerService } from './services/resource-manager/type';
|
|
|
61
61
|
export { type IStyleSheet, ThemeService } from './services/theme/theme.service';
|
|
62
62
|
export { type IUndoRedoCommandInfos, type IUndoRedoCommandInfosByInterceptor, type IUndoRedoItem, IUndoRedoService, type IUndoRedoStatus, LocalUndoRedoService, RedoCommand, UndoCommand, RedoCommandId, UndoCommandId, } from './services/undoredo/undoredo.service';
|
|
63
63
|
export * from './shared';
|
|
64
|
-
export { fromCallback } from './shared/rxjs';
|
|
64
|
+
export { fromCallback, takeAfter } from './shared/rxjs';
|
|
65
65
|
export { UserManagerService, type IUser } from './services/user-manager/user-manager.service';
|
|
66
66
|
export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
67
67
|
export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
|
|
@@ -110,3 +110,4 @@ export { normalizeBody, getCustomRangeSlice, getCustomDecorationSlice } from './
|
|
|
110
110
|
export { updateAttributeByDelete } from './docs/data-model/text-x/apply-utils/delete-apply';
|
|
111
111
|
export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/insert-apply';
|
|
112
112
|
export { nameCharacterCheck } from './shared/name';
|
|
113
|
+
export * from './common/di';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ICommandService, Univer } from '@univerjs/core';
|
|
2
|
-
import { Dependency } from '
|
|
2
|
+
import { Dependency } from '../../common/di';
|
|
3
3
|
|
|
4
4
|
export declare const createTestBed: (dependencies?: Dependency[]) => {
|
|
5
5
|
univer: Univer;
|
|
6
6
|
get: {
|
|
7
|
-
<T>(id: import('@
|
|
8
|
-
<T>(id: import('@
|
|
9
|
-
<T>(id: import('@
|
|
10
|
-
<T>(id: import('@
|
|
11
|
-
<T>(id: import('@
|
|
12
|
-
<T>(id: import('@
|
|
7
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, lookUp?: import('@univerjs/core').LookUp): T;
|
|
8
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.MANY, lookUp?: import('@univerjs/core').LookUp): T[];
|
|
9
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.OPTIONAL, lookUp?: import('@univerjs/core').LookUp): T | null;
|
|
10
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity: import("@univerjs/core").Quantity.REQUIRED, lookUp?: import('@univerjs/core').LookUp): T;
|
|
11
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantity?: import('@univerjs/core').Quantity, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
12
|
+
<T>(id: import('@univerjs/core').DependencyIdentifier<T>, quantityOrLookup?: import('@univerjs/core').Quantity | import('@univerjs/core').LookUp, lookUp?: import('@univerjs/core').LookUp): T[] | T | null;
|
|
13
13
|
};
|
|
14
14
|
workbook: import('@univerjs/core').Workbook;
|
|
15
15
|
unitId: string;
|
|
@@ -11,6 +11,7 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
|
|
|
11
11
|
private _userManagerService;
|
|
12
12
|
private _permissionMap;
|
|
13
13
|
constructor(_resourceManagerService: IResourceManagerService, _userManagerService: UserManagerService);
|
|
14
|
+
private _initDefaultUser;
|
|
14
15
|
private _getRole;
|
|
15
16
|
private _initSnapshot;
|
|
16
17
|
create(config: ICreateRequest): Promise<string>;
|
|
@@ -17,4 +17,4 @@ export interface IAuthzIoService {
|
|
|
17
17
|
createCollaborator(config: ICreateCollaboratorRequest, context?: ILogContext): Promise<void>;
|
|
18
18
|
putCollaborators(config: IPutCollaboratorsRequest, context?: ILogContext): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
export declare const IAuthzIoService: import('@
|
|
20
|
+
export declare const IAuthzIoService: import('@univerjs/core').IdentifierDecorator<IAuthzIoService>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IAccessor, IDisposable, Injector } from '
|
|
1
|
+
import { IAccessor, IDisposable, Injector } from '../../common/di';
|
|
2
|
+
import { Disposable } from '../../shared/lifecycle';
|
|
2
3
|
import { IContextService } from '../context/context.service';
|
|
3
4
|
import { ILogService } from '../log/log.service';
|
|
4
5
|
|
|
@@ -110,7 +111,7 @@ export interface ICommandService {
|
|
|
110
111
|
*/
|
|
111
112
|
beforeCommandExecuted(listener: CommandListener): IDisposable;
|
|
112
113
|
}
|
|
113
|
-
export declare const ICommandService: import('
|
|
114
|
+
export declare const ICommandService: import('../../common/di').IdentifierDecorator<ICommandService>;
|
|
114
115
|
/**
|
|
115
116
|
* The registry of commands.
|
|
116
117
|
*/
|
|
@@ -123,7 +124,7 @@ export declare class CommandRegistry {
|
|
|
123
124
|
getCommandType(id: string): CommandType | undefined;
|
|
124
125
|
}
|
|
125
126
|
export declare const NilCommand: ICommand;
|
|
126
|
-
export declare class CommandService implements ICommandService {
|
|
127
|
+
export declare class CommandService extends Disposable implements ICommandService {
|
|
127
128
|
private readonly _injector;
|
|
128
129
|
private readonly _logService;
|
|
129
130
|
protected readonly _commandRegistry: CommandRegistry;
|
|
@@ -133,6 +134,7 @@ export declare class CommandService implements ICommandService {
|
|
|
133
134
|
private _commandExecutingLevel;
|
|
134
135
|
private _commandExecutionStack;
|
|
135
136
|
constructor(_injector: Injector, _logService: ILogService);
|
|
137
|
+
dispose(): void;
|
|
136
138
|
hasCommand(commandId: string): boolean;
|
|
137
139
|
registerCommand(command: ICommand): IDisposable;
|
|
138
140
|
registerMultipleCommand(command: ICommand): IDisposable;
|
|
@@ -3,7 +3,7 @@ import { Nullable } from '../../shared/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* IConfig provides universal configuration for the whole application.
|
|
5
5
|
*/
|
|
6
|
-
export declare const IConfigService: import('
|
|
6
|
+
export declare const IConfigService: import('../../common/di').IdentifierDecorator<IConfigService>;
|
|
7
7
|
export interface IConfigService {
|
|
8
8
|
getConfig<T>(id: string, defaultValue: T): T;
|
|
9
9
|
getConfig<T>(id: string): Nullable<T>;
|
|
@@ -9,7 +9,7 @@ export interface IContextService {
|
|
|
9
9
|
setContextValue(key: string, value: boolean): void;
|
|
10
10
|
subscribeContextValue$(key: string): Observable<boolean>;
|
|
11
11
|
}
|
|
12
|
-
export declare const IContextService: import('
|
|
12
|
+
export declare const IContextService: import('../../common/di').IdentifierDecorator<IContextService>;
|
|
13
13
|
export declare class ContextService extends Disposable implements IContextService {
|
|
14
14
|
private _contextChanged$;
|
|
15
15
|
readonly contextChanged$: Observable<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable, Injector } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { IDisposable, Injector } from '../../common/di';
|
|
3
3
|
import { DocumentDataModel } from '../../docs/data-model/document-data-model';
|
|
4
4
|
import { Nullable } from '../../shared';
|
|
5
5
|
import { Disposable } from '../../shared/lifecycle';
|
|
@@ -47,7 +47,7 @@ export interface IUniverInstanceService {
|
|
|
47
47
|
/** @deprecated */
|
|
48
48
|
getCurrentUniverDocInstance(): Nullable<DocumentDataModel>;
|
|
49
49
|
}
|
|
50
|
-
export declare const IUniverInstanceService: import('
|
|
50
|
+
export declare const IUniverInstanceService: import('../../common/di').IdentifierDecorator<IUniverInstanceService>;
|
|
51
51
|
export declare class UniverInstanceService extends Disposable implements IUniverInstanceService {
|
|
52
52
|
private readonly _injector;
|
|
53
53
|
private readonly _contextService;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Injector } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { Injector } from '../../common/di';
|
|
3
3
|
import { Disposable } from '../../shared/lifecycle';
|
|
4
4
|
import { ILogService } from '../log/log.service';
|
|
5
5
|
import { LifecycleStages } from './lifecycle';
|
|
@@ -33,9 +33,9 @@ export declare class LifecycleService extends Disposable {
|
|
|
33
33
|
* @internal
|
|
34
34
|
*/
|
|
35
35
|
export declare class LifecycleInitializerService extends Disposable {
|
|
36
|
-
private _lifecycleService;
|
|
37
36
|
private readonly _injector;
|
|
38
37
|
private _seenTokens;
|
|
39
|
-
constructor(
|
|
38
|
+
constructor(_injector: Injector);
|
|
40
39
|
initModulesOnStage(stage: LifecycleStages): void;
|
|
41
40
|
}
|
|
41
|
+
export declare function getLifecycleStagesAndBefore(lifecycleStage: LifecycleStages): Observable<LifecycleStages>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ILocalStorageService: import('
|
|
16
|
+
export declare const ILocalStorageService: import('../../common/di').IdentifierDecorator<ILocalStorageService>;
|
|
17
17
|
export type LocalStorageValueTypes = string;
|
|
18
18
|
export interface ILocalStorageService {
|
|
19
19
|
getItem<T>(key: string): Promise<T | null>;
|
|
@@ -15,7 +15,7 @@ export interface ILogService {
|
|
|
15
15
|
error(...args: ArgsType): void;
|
|
16
16
|
setLogLevel(enabled: LogLevel): void;
|
|
17
17
|
}
|
|
18
|
-
export declare const ILogService: import('
|
|
18
|
+
export declare const ILogService: import('../../common/di').IdentifierDecorator<ILogService>;
|
|
19
19
|
export declare class DesktopLogService extends Disposable implements ILogService {
|
|
20
20
|
private _logLevel;
|
|
21
21
|
debug(...args: ArgsType): void;
|
|
@@ -40,4 +40,4 @@ export interface IPermissionService {
|
|
|
40
40
|
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
41
41
|
getAllPermissionPoint(): Map<string, Observable<IPermissionPoint<unknown>>>;
|
|
42
42
|
}
|
|
43
|
-
export declare const IPermissionService: import('
|
|
43
|
+
export declare const IPermissionService: import('../../common/di').IdentifierDecorator<IPermissionService>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dependency, DependencyIdentifier, DependencyItem } from '
|
|
1
|
+
import { Dependency, DependencyIdentifier, DependencyItem } from '../../common/di';
|
|
2
2
|
|
|
3
3
|
export type NullableDependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T> | null];
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisposable, Injector } from '
|
|
1
|
+
import { IDisposable, Injector } from '../../common/di';
|
|
2
2
|
import { Disposable } from '../../shared/lifecycle';
|
|
3
3
|
import { UniverInstanceType } from '../../common/unit';
|
|
4
4
|
import { LifecycleInitializerService, LifecycleService } from '../lifecycle/lifecycle.service';
|
|
@@ -53,6 +53,7 @@ export declare class PluginHolder extends Disposable {
|
|
|
53
53
|
protected readonly _pluginRegistry: PluginRegistry;
|
|
54
54
|
/** Stores initialized plugin instances. */
|
|
55
55
|
protected readonly _pluginStore: PluginStore;
|
|
56
|
+
private readonly _awaitingPlugins;
|
|
56
57
|
constructor(_checkPluginRegistered: (pluginCtor: PluginCtor) => boolean, _registerPlugin: <T extends PluginCtor>(plugin: T, config?: ConstructorParameters<T>[0]) => void, _logService: ILogService, _injector: Injector, _lifecycleService: LifecycleService, _lifecycleInitializerService: LifecycleInitializerService);
|
|
57
58
|
dispose(): void;
|
|
58
59
|
register<T extends PluginCtor<Plugin>>(pluginCtor: T, config?: ConstructorParameters<T>[0]): void;
|
|
@@ -61,4 +62,5 @@ export declare class PluginHolder extends Disposable {
|
|
|
61
62
|
flush(): void;
|
|
62
63
|
private _initPlugin;
|
|
63
64
|
protected _pluginsRunLifecycle(plugins: Plugin[]): void;
|
|
65
|
+
private _runStage;
|
|
64
66
|
}
|
|
@@ -7,4 +7,4 @@ export interface IResourceLoaderService {
|
|
|
7
7
|
saveWorkbook: (workbook: Workbook) => IWorkbookData;
|
|
8
8
|
saveDoc: (doc: DocumentDataModel) => IDocumentData;
|
|
9
9
|
}
|
|
10
|
-
export declare const IResourceLoaderService: import('
|
|
10
|
+
export declare const IResourceLoaderService: import('../../common/di').IdentifierDecorator<IResourceLoaderService>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
3
2
|
import { UniverInstanceType } from '@univerjs/core';
|
|
3
|
+
import { IDisposable } from '../../common/di';
|
|
4
4
|
import { IWorkbookData } from '../../types/interfaces/i-workbook-data';
|
|
5
5
|
|
|
6
6
|
type IBusinessName = 'SHEET' | 'DOC';
|
|
@@ -23,5 +23,5 @@ export interface IResourceManagerService {
|
|
|
23
23
|
loadResources: (unitId: string, resources: IWorkbookData['resources']) => void;
|
|
24
24
|
unloadResources(unitId: string): void;
|
|
25
25
|
}
|
|
26
|
-
export declare const IResourceManagerService: import('@
|
|
26
|
+
export declare const IResourceManagerService: import('@univerjs/core').IdentifierDecorator<IResourceManagerService>;
|
|
27
27
|
export {};
|
|
@@ -6,7 +6,7 @@ import { ILogContext } from '../log/context';
|
|
|
6
6
|
* or load snapshots. This service should be implemented by the host environment.
|
|
7
7
|
* And it shouldn't contain any business logic.
|
|
8
8
|
*/
|
|
9
|
-
export declare const ISnapshotServerService: import('
|
|
9
|
+
export declare const ISnapshotServerService: import('../../common/di').IdentifierDecorator<ISnapshotServerService>;
|
|
10
10
|
export interface ISnapshotServerService {
|
|
11
11
|
/** Load snapshot from a database. */
|
|
12
12
|
getUnitOnRev: (context: ILogContext, params: IGetUnitOnRevRequest) => Promise<IGetUnitOnRevResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IAccessor, IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { IAccessor, IDisposable } from '../../common/di';
|
|
3
3
|
import { Disposable } from '../../shared/lifecycle';
|
|
4
4
|
import { IMutationInfo, CommandType, ICommandService } from '../command/command.service';
|
|
5
5
|
import { IContextService } from '../context/context.service';
|
|
@@ -44,7 +44,7 @@ export interface IUndoRedoCommandInfos {
|
|
|
44
44
|
undos: IMutationInfo[];
|
|
45
45
|
redos: IMutationInfo[];
|
|
46
46
|
}
|
|
47
|
-
export declare const IUndoRedoService: import('
|
|
47
|
+
export declare const IUndoRedoService: import('../../common/di').IdentifierDecorator<IUndoRedoService>;
|
|
48
48
|
export interface IUndoRedoStatus {
|
|
49
49
|
undos: number;
|
|
50
50
|
redos: number;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -5,7 +5,7 @@ import { IRangeWithCoord, ISelectionCell, ISelectionCellWithMergeInfo } from '..
|
|
|
5
5
|
import { IColorStyle, IStyleData } from '../types/interfaces/i-style-data';
|
|
6
6
|
import { Nullable } from './types';
|
|
7
7
|
|
|
8
|
-
export declare function makeCellToSelection(cellInfo:
|
|
8
|
+
export declare function makeCellToSelection(cellInfo: ISelectionCellWithMergeInfo): IRangeWithCoord;
|
|
9
9
|
export declare function makeCellRangeToRangeData(cellInfo: Nullable<ISelectionCell>): Nullable<IRange>;
|
|
10
10
|
export declare function isEmptyCell(cell: Nullable<ICellData>): boolean;
|
|
11
11
|
export declare function isCellCoverable(cell: Nullable<ICellDataForSheetInterceptor>): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Subscription, SubscriptionLike, Subject } from 'rxjs';
|
|
2
|
+
import { IDisposable } from '../common/di';
|
|
3
3
|
|
|
4
4
|
type DisposableLike = IDisposable | SubscriptionLike | (() => void);
|
|
5
5
|
export declare function toDisposable(disposable: IDisposable): IDisposable;
|
|
@@ -26,4 +26,11 @@ export declare class RxDisposable extends Disposable implements IDisposable {
|
|
|
26
26
|
protected dispose$: Subject<void>;
|
|
27
27
|
dispose(): void;
|
|
28
28
|
}
|
|
29
|
+
export declare class RCDisposable extends Disposable {
|
|
30
|
+
private readonly _rootDisposable;
|
|
31
|
+
private _ref;
|
|
32
|
+
constructor(_rootDisposable: IDisposable);
|
|
33
|
+
inc(): void;
|
|
34
|
+
dec(): void;
|
|
35
|
+
}
|
|
29
36
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IDisposable } from '@wendellhu/redi';
|
|
2
1
|
import { Observable } from 'rxjs';
|
|
2
|
+
import { IDisposable } from '../common/di';
|
|
3
3
|
|
|
4
4
|
type CallbackFn<T extends readonly unknown[]> = (cb: (...args: T) => void) => IDisposable;
|
|
5
5
|
/**
|
|
@@ -12,4 +12,8 @@ type CallbackFn<T extends readonly unknown[]> = (cb: (...args: T) => void) => ID
|
|
|
12
12
|
* @returns The observable that will emit when the callback function gets called.
|
|
13
13
|
*/
|
|
14
14
|
export declare function fromCallback<T extends readonly unknown[]>(callback: CallbackFn<T>): Observable<T>;
|
|
15
|
+
/**
|
|
16
|
+
* An operator that would complete the stream once a condition is met. Consider it as a shortcut of `takeUntil`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function takeAfter<T>(callback: (value: T) => boolean): (source: Observable<T>) => Observable<T>;
|
|
15
19
|
export {};
|
|
@@ -9,6 +9,11 @@ export declare class Tools {
|
|
|
9
9
|
static deleteBlank(value?: string): string | undefined;
|
|
10
10
|
static getSystemType(): string;
|
|
11
11
|
static getBrowserType(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Use this method without `Tools`.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
12
17
|
static generateRandomId(n?: number, alphabet?: string): string;
|
|
13
18
|
static getClassName(instance: object): string;
|
|
14
19
|
static deepMerge(target: any, ...sources: any[]): any;
|
|
@@ -37,6 +42,7 @@ export declare class Tools {
|
|
|
37
42
|
static isAndroid(): boolean;
|
|
38
43
|
static isIPhone(): boolean;
|
|
39
44
|
static isLegalUrl(url: string): boolean;
|
|
45
|
+
static normalizeUrl(url: string): string;
|
|
40
46
|
static itCount(count: number): Function;
|
|
41
47
|
static hasLength(target: IArguments | any[] | string, length?: number): boolean;
|
|
42
48
|
static capitalize(str: string): string;
|
|
@@ -108,3 +114,4 @@ export declare class Tools {
|
|
|
108
114
|
static set(data: Record<string, any>, propertyPath: string, value: any): void;
|
|
109
115
|
static clamp(value: number, min: number, max: number): number;
|
|
110
116
|
}
|
|
117
|
+
export declare function generateRandomId(n?: number, alphabet?: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDisposable } from '
|
|
1
|
+
import { IDisposable } from '../common/di';
|
|
2
2
|
import { Nullable } from '../common/type-util';
|
|
3
3
|
import { Disposable } from '../shared/lifecycle';
|
|
4
4
|
import { ICellData, ICellDataForSheetInterceptor } from '../types/interfaces/i-cell-data';
|
|
@@ -63,16 +63,22 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
63
63
|
getConfig(): IWorkbookData;
|
|
64
64
|
getIndexBySheetId(sheetId: string): number;
|
|
65
65
|
/**
|
|
66
|
-
* Get the active sheet
|
|
66
|
+
* Get the active sheet.
|
|
67
67
|
*/
|
|
68
|
-
getActiveSheet():
|
|
68
|
+
getActiveSheet(): Worksheet;
|
|
69
|
+
getActiveSheet(allowNull: true): Nullable<Worksheet>;
|
|
69
70
|
/**
|
|
70
71
|
* If there is no active sheet, the first sheet would
|
|
71
72
|
* be set active.
|
|
72
73
|
* @returns
|
|
73
74
|
*/
|
|
74
75
|
ensureActiveSheet(): Worksheet;
|
|
75
|
-
|
|
76
|
+
/**
|
|
77
|
+
* ActiveSheet should not be null!
|
|
78
|
+
* There is at least one sheet in a workbook. You can not delete all sheets in a workbook.
|
|
79
|
+
* @param worksheet
|
|
80
|
+
*/
|
|
81
|
+
setActiveSheet(worksheet: Worksheet): void;
|
|
76
82
|
removeSheet(sheetId: string): boolean;
|
|
77
83
|
getActiveSheetIndex(): number;
|
|
78
84
|
getSheetSize(): number;
|
|
@@ -106,5 +112,5 @@ export declare class Workbook extends UnitModel<IWorkbookData, UniverInstanceTyp
|
|
|
106
112
|
/**
|
|
107
113
|
* Get Default Sheet
|
|
108
114
|
*/
|
|
109
|
-
private
|
|
115
|
+
private _parseWorksheetSnapshots;
|
|
110
116
|
}
|
|
@@ -13,19 +13,34 @@ export interface IDataValidationRuleBase {
|
|
|
13
13
|
operator?: DataValidationOperator;
|
|
14
14
|
}
|
|
15
15
|
export interface IDataValidationRuleOptions {
|
|
16
|
+
imeMode?: DataValidationImeMode;
|
|
17
|
+
/**
|
|
18
|
+
* for dropdown
|
|
19
|
+
*/
|
|
20
|
+
showDropDown?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* validator error
|
|
23
|
+
*/
|
|
24
|
+
showErrorMessage?: boolean;
|
|
16
25
|
error?: string;
|
|
17
26
|
errorStyle?: DataValidationErrorStyle;
|
|
18
27
|
errorTitle?: string;
|
|
19
|
-
|
|
28
|
+
/**
|
|
29
|
+
* input prompt, not for using now.
|
|
30
|
+
*/
|
|
31
|
+
showInputMessage?: boolean;
|
|
20
32
|
prompt?: string;
|
|
21
33
|
promptTitle?: string;
|
|
22
|
-
showDropDown?: boolean;
|
|
23
|
-
showErrorMessage?: boolean;
|
|
24
|
-
showInputMessage?: boolean;
|
|
25
34
|
/**
|
|
26
35
|
* cell render mode of data validation
|
|
27
36
|
*/
|
|
28
37
|
renderMode?: DataValidationRenderMode;
|
|
38
|
+
/**
|
|
39
|
+
* custom biz info
|
|
40
|
+
*/
|
|
41
|
+
bizInfo?: {
|
|
42
|
+
showTime?: boolean;
|
|
43
|
+
};
|
|
29
44
|
}
|
|
30
45
|
export interface IDataValidationRule extends IDataValidationRuleBase, IDataValidationRuleOptions {
|
|
31
46
|
uid: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICustomDecoration, ICustomRange } from './i-document-data';
|
|
2
|
+
|
|
3
|
+
export interface ICustomRangeForInterceptor extends ICustomRange {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
show?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface ICustomDecorationForInterceptor extends ICustomDecoration {
|
|
8
|
+
active?: boolean;
|
|
9
|
+
show?: boolean;
|
|
10
|
+
}
|