@univerjs/core 0.1.12 → 0.1.13
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 +9 -9
- package/lib/es/index.js +5370 -3723
- package/lib/types/docs/data-model/document-data-model.d.ts +10 -12
- package/lib/types/docs/data-model/json-x/json-x.d.ts +38 -0
- package/lib/types/{shared/permission/index.d.ts → docs/data-model/subdocument.d.ts} +1 -12
- package/lib/types/docs/data-model/text-x/__tests__/common.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/invert.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/action-iterator.d.ts +1 -1
- package/lib/types/docs/data-model/{action-types.d.ts → text-x/action-types.d.ts} +4 -2
- package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/common.d.ts +1 -1
- package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/delete-apply.d.ts +1 -1
- package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/insert-apply.d.ts +1 -1
- package/lib/types/docs/data-model/{apply-utils → text-x/apply-utils}/update-apply.d.ts +2 -2
- package/lib/types/docs/data-model/text-x/apply.d.ts +4 -0
- package/lib/types/docs/data-model/text-x/text-x.d.ts +10 -2
- package/lib/types/docs/data-model/text-x/utils.d.ts +2 -2
- package/lib/types/index.d.ts +13 -5
- package/lib/types/observer/__tests__/observable.spec.d.ts +16 -0
- package/lib/types/observer/observable.d.ts +1 -20
- package/lib/types/services/__test__/index.d.ts +18 -0
- package/lib/types/services/__test__/permission.spec.d.ts +16 -0
- package/lib/types/services/authz-io/authz-io-local.service.d.ts +30 -0
- package/lib/types/services/authz-io/type.d.ts +20 -0
- package/lib/types/services/context/context.d.ts +4 -0
- package/lib/types/services/permission/permission.service.d.ts +12 -24
- package/lib/types/services/permission/type.d.ts +43 -0
- package/lib/types/services/user-manager/const.d.ts +4 -0
- package/lib/types/services/{permission → user-manager}/index.d.ts +1 -3
- package/lib/types/services/user-manager/user-manager.service.d.ts +7 -4
- package/lib/types/shared/check-if-move.d.ts +6 -0
- package/lib/types/shared/index.d.ts +2 -1
- package/lib/types/shared/rectangle.d.ts +12 -0
- package/lib/types/{services/floating-object/floating-object-interfaces.d.ts → shared/shape.d.ts} +5 -6
- package/lib/types/sheets/sheet-snapshot-utils.d.ts +2 -2
- package/lib/types/sheets/workbook.d.ts +6 -3
- package/lib/types/slides/slide-model.d.ts +1 -1
- package/lib/types/types/enum/index.d.ts +1 -1
- package/lib/types/types/enum/prst-geom-type.d.ts +118 -0
- package/lib/types/types/interfaces/i-cell-data.d.ts +1 -0
- package/lib/types/types/interfaces/i-cell-validation-data.d.ts +1 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +56 -6
- package/lib/types/types/interfaces/i-slide-data.d.ts +3 -3
- package/lib/umd/index.js +8 -8
- package/package.json +6 -6
- package/lib/types/services/floating-object/floating-object-manager.service.d.ts +0 -82
- package/lib/types/services/permission/permission-point.d.ts +0 -9
- package/lib/types/services/permission/univer.permission.service.d.ts +0 -12
- package/lib/types/types/enum/shape-type.d.ts +0 -160
- /package/lib/types/docs/data-model/{__tests__/apply-utils.spec.d.ts → json-x/__tests__/json-x.spec.d.ts} +0 -0
- /package/lib/types/docs/data-model/{__tests__/common.spec.d.ts → text-x/__tests__/apply-utils.spec.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Nullable } from '../../shared';
|
|
2
|
-
import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle } from '../../types/interfaces/i-document-data';
|
|
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 {
|
|
5
|
+
import { JSONXActions } from './json-x/json-x';
|
|
6
6
|
|
|
7
7
|
export declare const DEFAULT_DOC: {
|
|
8
8
|
id: string;
|
|
@@ -17,16 +17,13 @@ interface IDrawingUpdateConfig {
|
|
|
17
17
|
declare class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverInstanceType.UNIVER_DOC> {
|
|
18
18
|
type: UniverInstanceType.UNIVER_DOC;
|
|
19
19
|
getUnitId(): string;
|
|
20
|
-
snapshot: IDocumentData;
|
|
20
|
+
protected snapshot: IDocumentData;
|
|
21
21
|
constructor(snapshot: Partial<IDocumentData>);
|
|
22
|
-
get drawings():
|
|
22
|
+
get drawings(): IDrawings | undefined;
|
|
23
23
|
get documentStyle(): IDocumentStyle;
|
|
24
24
|
get lists(): import('../../types/interfaces/i-document-data').ILists | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated use getBody to instead.
|
|
27
|
-
*/
|
|
28
|
-
get body(): IDocumentBody | undefined;
|
|
29
25
|
get zoomRatio(): number;
|
|
26
|
+
resetDrawing(drawings: IDrawings, drawingsOrder: string[]): void;
|
|
30
27
|
getBody(): IDocumentBody | undefined;
|
|
31
28
|
getShouldRenderLoopImmediately(): boolean;
|
|
32
29
|
getContainer(): string | undefined;
|
|
@@ -45,17 +42,18 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
|
|
|
45
42
|
footerModelMap: Map<string, DocumentDataModel>;
|
|
46
43
|
constructor(snapshot: Partial<IDocumentData>);
|
|
47
44
|
dispose(): void;
|
|
45
|
+
getDrawings(): IDrawings | undefined;
|
|
46
|
+
getDrawingsOrder(): string[] | undefined;
|
|
48
47
|
getRev(): number;
|
|
49
48
|
incrementRev(): void;
|
|
50
49
|
getSettings(): import('../../types/interfaces/i-document-data').IDocumentSettings | undefined;
|
|
51
50
|
reset(snapshot: Partial<IDocumentData>): void;
|
|
52
51
|
getSelfOrHeaderFooterModel(segmentId?: string): DocumentDataModel;
|
|
53
52
|
getUnitId(): string;
|
|
54
|
-
apply(actions:
|
|
53
|
+
apply(actions: JSONXActions): string | number | boolean | import('ot-json1').Doc[] | {
|
|
54
|
+
[k: string]: import('ot-json1').Doc;
|
|
55
|
+
} | null | undefined;
|
|
55
56
|
sliceBody(startOffset: number, endOffset: number): Nullable<IDocumentBody>;
|
|
56
|
-
private _updateApply;
|
|
57
|
-
private _deleteApply;
|
|
58
|
-
private _insertApply;
|
|
59
57
|
private _initializeHeaderFooterModel;
|
|
60
58
|
updateDocumentId(unitId: string): void;
|
|
61
59
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Doc, JSONOp, Path } from 'ot-json1';
|
|
2
|
+
import { IDocumentBody, IDocumentData } from '../../../types/interfaces';
|
|
3
|
+
import { TPriority } from '../text-x/text-x';
|
|
4
|
+
import { TextXAction } from '../text-x/action-types';
|
|
5
|
+
|
|
6
|
+
import * as json1 from 'ot-json1';
|
|
7
|
+
export interface ISubType {
|
|
8
|
+
name: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
uri?: string;
|
|
11
|
+
apply(doc: IDocumentBody, actions: TextXAction[]): IDocumentBody;
|
|
12
|
+
compose(thisActions: TextXAction[], otherActions: TextXAction[]): TextXAction[];
|
|
13
|
+
transform(thisActions: TextXAction[], otherActions: TextXAction[], priority: 'left' | 'right'): TextXAction[];
|
|
14
|
+
invert?: (actions: TextXAction[]) => TextXAction[];
|
|
15
|
+
isNoop?: (actions: TextXAction[]) => boolean;
|
|
16
|
+
makeInvertible?: (actions: TextXAction[], doc: IDocumentBody) => TextXAction[];
|
|
17
|
+
[k: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export { JSONOp as JSONXActions, Path as JSONXPath, json1 as JSON1 };
|
|
20
|
+
export declare class JSONX {
|
|
21
|
+
static uri: string;
|
|
22
|
+
private static _subTypes;
|
|
23
|
+
static registerSubtype(subType: ISubType): void;
|
|
24
|
+
static apply(doc: IDocumentData, actions: JSONOp): string | number | boolean | Doc[] | {
|
|
25
|
+
[k: string]: Doc;
|
|
26
|
+
} | null | undefined;
|
|
27
|
+
static compose(thisActions: JSONOp, otherActions: JSONOp): JSONOp;
|
|
28
|
+
static transform(_thisActions: JSONOp, _otherActions: JSONOp, _priority: TPriority): void;
|
|
29
|
+
static invertWithDoc(actions: JSONOp, doc: IDocumentData): JSONOp;
|
|
30
|
+
static isNoop(actions: JSONOp): boolean;
|
|
31
|
+
private static _instance;
|
|
32
|
+
static getInstance(): JSONX;
|
|
33
|
+
removeOp(path: Path, value?: any): JSONOp;
|
|
34
|
+
moveOp(from: Path, to: Path): JSONOp;
|
|
35
|
+
insertOp(path: Path, value: any): JSONOp;
|
|
36
|
+
replaceOp(path: Path, oldVal: any, newVal: any): JSONOp;
|
|
37
|
+
editOp(subOp: TextXAction[]): JSONOp;
|
|
38
|
+
}
|
|
@@ -13,15 +13,4 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
17
|
-
INIT = "init",
|
|
18
|
-
FETCHING = "fetching",
|
|
19
|
-
DONE = "done"
|
|
20
|
-
}
|
|
21
|
-
export declare abstract class PermissionPoint<T = any> {
|
|
22
|
-
abstract id: string;
|
|
23
|
-
abstract value: T;
|
|
24
|
-
abstract unitID: string;
|
|
25
|
-
status: PermissionStatus;
|
|
26
|
-
}
|
|
27
|
-
export declare const getTypeFromPermissionItemList: (list: PermissionPoint[]) => PermissionStatus;
|
|
16
|
+
export declare const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = "__default_document_sub_component_id20231101__";
|
|
@@ -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,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 {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UpdateDocsAttributeType } from '
|
|
2
|
-
import { IDocumentBody } from '
|
|
1
|
+
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
|
+
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
3
3
|
|
|
4
4
|
export declare enum TextXActionType {
|
|
5
5
|
RETAIN = "r",
|
|
@@ -13,6 +13,7 @@ export interface IRetainAction {
|
|
|
13
13
|
t: TextXActionType.RETAIN;
|
|
14
14
|
len: number;
|
|
15
15
|
body?: IDocumentBody;
|
|
16
|
+
oldBody?: IDocumentBody;
|
|
16
17
|
coverType?: UpdateDocsAttributeType;
|
|
17
18
|
segmentId?: string;
|
|
18
19
|
}
|
|
@@ -33,6 +34,7 @@ export interface IDeleteAction {
|
|
|
33
34
|
t: TextXActionType.DELETE;
|
|
34
35
|
len: number;
|
|
35
36
|
line: number;
|
|
37
|
+
body?: IDocumentBody;
|
|
36
38
|
segmentId?: string;
|
|
37
39
|
}
|
|
38
40
|
export type TextXAction = IRetainAction | IInsertAction | IDeleteAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICustomBlock, ICustomRange, IDocumentBody, IParagraph, ISectionBreak, ITable, ITextRun } from '
|
|
1
|
+
import { ICustomBlock, ICustomRange, IDocumentBody, IParagraph, ISectionBreak, ITable, ITextRun } from '../../../../types/interfaces';
|
|
2
2
|
|
|
3
3
|
export declare function normalizeTextRuns(textRuns: ITextRun[]): ITextRun[];
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UpdateDocsAttributeType } from '
|
|
2
|
-
import { IDocumentBody, ITextRun } from '
|
|
1
|
+
import { UpdateDocsAttributeType } from '../../../../shared';
|
|
2
|
+
import { IDocumentBody, ITextRun } from '../../../../types/interfaces';
|
|
3
3
|
|
|
4
4
|
export declare function updateAttribute(body: IDocumentBody, updateBody: IDocumentBody, textLength: number, currentIndex: number, coverType: UpdateDocsAttributeType): IDocumentBody;
|
|
5
5
|
export declare function coverTextRuns(updateDataTextRuns: ITextRun[], removeTextRuns: ITextRun[], coverType: UpdateDocsAttributeType): ITextRun[];
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
2
|
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
3
|
-
import { TextXAction } from '
|
|
3
|
+
import { TextXAction } from './action-types';
|
|
4
4
|
|
|
5
|
+
export type TPriority = 'left' | 'right';
|
|
5
6
|
export declare class TextX {
|
|
7
|
+
static id: string;
|
|
8
|
+
static uri: string;
|
|
9
|
+
static apply(doc: IDocumentBody, actions: TextXAction[]): IDocumentBody;
|
|
6
10
|
static compose(thisActions: TextXAction[], otherActions: TextXAction[]): TextXAction[];
|
|
11
|
+
static transform(_thisActions: TextXAction[], _otherActions: TextXAction[], _priority: TPriority): TextXAction[];
|
|
12
|
+
static isNoop(actions: TextXAction[]): boolean;
|
|
13
|
+
static invert(actions: TextXAction[]): TextXAction[];
|
|
14
|
+
static makeInvertible(actions: TextXAction[], doc: IDocumentBody): TextXAction[];
|
|
7
15
|
private _actions;
|
|
8
16
|
insert(len: number, body: IDocumentBody, segmentId?: string): this;
|
|
9
17
|
retain(len: number, segmentId?: string, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
|
|
10
18
|
delete(len: number, segmentId?: string): this;
|
|
11
19
|
serialize(): TextXAction[];
|
|
12
20
|
push(...args: TextXAction[]): this;
|
|
13
|
-
trimEndUselessRetainAction(): this;
|
|
21
|
+
protected trimEndUselessRetainAction(): this;
|
|
14
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
2
|
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
3
|
-
import { IRetainAction } from '
|
|
3
|
+
import { IRetainAction } from './action-types';
|
|
4
4
|
|
|
5
|
-
export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number): IDocumentBody;
|
|
5
|
+
export declare function getBodySlice(body: IDocumentBody, startOffset: number, endOffset: number, returnEmptyTextRun?: boolean): IDocumentBody;
|
|
6
6
|
export declare function composeBody(thisBody: IDocumentBody, otherBody: IDocumentBody, coverType?: UpdateDocsAttributeType): IDocumentBody;
|
|
7
7
|
export declare function isUselessRetainAction(action: IRetainAction): boolean;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
|
|
16
17
|
export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
|
|
17
18
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
18
19
|
export { Univer } from './univer';
|
|
@@ -28,11 +29,14 @@ export { MemoryCursor } from './common/memory-cursor';
|
|
|
28
29
|
export { requestImmediateMacroTask } from './common/request-immediate-macro-task';
|
|
29
30
|
export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
|
|
30
31
|
export * from './docs/data-model';
|
|
31
|
-
export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/action-types';
|
|
32
|
+
export { TextXActionType, type TextXAction, type IDeleteAction, type IInsertAction, type IRetainAction, } from './docs/data-model/text-x/action-types';
|
|
32
33
|
export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
|
|
33
34
|
export { ActionIterator } from './docs/data-model/text-x/action-iterator';
|
|
34
35
|
export { getBodySlice, composeBody } from './docs/data-model/text-x/utils';
|
|
35
36
|
export { TextX } from './docs/data-model/text-x/text-x';
|
|
37
|
+
export type { TPriority } from './docs/data-model/text-x/text-x';
|
|
38
|
+
export { JSONX, JSON1 } from './docs/data-model/json-x/json-x';
|
|
39
|
+
export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
|
|
36
40
|
export { replaceInDocumentBody } from './docs/data-model/replacement';
|
|
37
41
|
export * from './observer';
|
|
38
42
|
export { Plugin } from './services/plugin/plugin';
|
|
@@ -42,15 +46,15 @@ export { IConfigService } from './services/config/config.service';
|
|
|
42
46
|
export * from './services/context/context';
|
|
43
47
|
export { ContextService, IContextService } from './services/context/context.service';
|
|
44
48
|
export { ErrorService, type IError } from './services/error/error.service';
|
|
45
|
-
export type { IOffset, IScale, ISize, ITransformState } from './services/floating-object/floating-object-interfaces';
|
|
46
|
-
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID, FloatingObjectManagerService, type IFloatingObjectManagerParam, type IFloatingObjectManagerSearchItemParam, IFloatingObjectManagerService, } from './services/floating-object/floating-object-manager.service';
|
|
47
49
|
export { IUniverInstanceService } from './services/instance/instance.service';
|
|
48
50
|
export { LifecycleStages, OnLifecycle, runOnLifecycle } from './services/lifecycle/lifecycle';
|
|
49
51
|
export { LifecycleService } from './services/lifecycle/lifecycle.service';
|
|
50
52
|
export { ILocalStorageService } from './services/local-storage/local-storage.service';
|
|
51
53
|
export { LocaleService } from './services/locale/locale.service';
|
|
52
54
|
export { DesktopLogService, ILogService, LogLevel } from './services/log/log.service';
|
|
53
|
-
export { IPermissionService,
|
|
55
|
+
export { IPermissionService, PermissionStatus, } from './services/permission/type';
|
|
56
|
+
export type { IPermissionParam } from './services/permission/type';
|
|
57
|
+
export type { IPermissionPoint } from './services/permission/type';
|
|
54
58
|
export { IResourceLoaderService } from './services/resource-loader/type';
|
|
55
59
|
export { ResourceManagerService } from './services/resource-manager/resource-manager.service';
|
|
56
60
|
export type { IResourceHook } from './services/resource-manager/type';
|
|
@@ -62,7 +66,7 @@ export { fromCallback } from './shared/rxjs';
|
|
|
62
66
|
export { UserManagerService } from './services/user-manager/user-manager.service';
|
|
63
67
|
export type { IComposeInterceptors, IInterceptor, InterceptorHandler } from './common/interceptor';
|
|
64
68
|
export { composeInterceptors, createInterceptorKey, InterceptorManager } from './common/interceptor';
|
|
65
|
-
export { normalizeTextRuns } from './docs/data-model/apply-utils/common';
|
|
69
|
+
export { normalizeTextRuns } from './docs/data-model/text-x/apply-utils/common';
|
|
66
70
|
export type { PluginCtor } from './services/plugin/plugin';
|
|
67
71
|
export { type DependencyOverride, mergeOverrideWithDependencies } from './services/plugin/plugin-override';
|
|
68
72
|
export * from './types/const';
|
|
@@ -97,3 +101,7 @@ export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
|
|
|
97
101
|
export { DataValidationOperator } from './types/enum/data-validation-operator';
|
|
98
102
|
export { DataValidationType } from './types/enum/data-validation-type';
|
|
99
103
|
export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
104
|
+
export type { IPermissionTypes } from './services/permission/type';
|
|
105
|
+
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
106
|
+
export { IAuthzIoService } from './services/authz-io/type';
|
|
107
|
+
export { createDefaultUser } from './services/user-manager/const';
|
|
@@ -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 {};
|
|
@@ -48,12 +48,6 @@ export declare class Observer<T = void> {
|
|
|
48
48
|
*/
|
|
49
49
|
callback: (eventData: T, eventState: EventState) => void;
|
|
50
50
|
observable: Observable<T>;
|
|
51
|
-
/** @hidden */
|
|
52
|
-
_willBeUnregistered: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Gets or sets a property defining that the observer as to be unregistered after the next notification
|
|
55
|
-
*/
|
|
56
|
-
unregisterOnNextCall: boolean;
|
|
57
51
|
dispose(): void;
|
|
58
52
|
/**
|
|
59
53
|
* Creates a new observer
|
|
@@ -97,25 +91,13 @@ export declare class Observable<T> {
|
|
|
97
91
|
* @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification
|
|
98
92
|
* @returns the new observer created for the callback
|
|
99
93
|
*/
|
|
100
|
-
add(callback: (eventData: T, eventState: EventState) => void, insertFirst?: boolean
|
|
101
|
-
/**
|
|
102
|
-
* Create a new WorkBookObserver with the specified callback and unregisters after the next notification
|
|
103
|
-
* @param callback the callback that will be executed for that WorkBookObserver
|
|
104
|
-
* @returns the new observer created for the callback
|
|
105
|
-
*/
|
|
106
|
-
addOnce(callback: (eventData: T, eventState: EventState) => void): Nullable<Observer<T>>;
|
|
94
|
+
add(callback: (eventData: T, eventState: EventState) => void, insertFirst?: boolean): Nullable<Observer<T>>;
|
|
107
95
|
/**
|
|
108
96
|
* Remove an WorkBookObserver from the Observable object
|
|
109
97
|
* @param observer the instance of the WorkBookObserver to remove
|
|
110
98
|
* @returns false if it doesn't belong to this Observable
|
|
111
99
|
*/
|
|
112
100
|
remove(observer: Nullable<Observer<T>>): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Remove a callback from the Observable object
|
|
115
|
-
* @param callback the callback to remove
|
|
116
|
-
* @returns false if it doesn't belong to this Observable
|
|
117
|
-
*/
|
|
118
|
-
removeCallback(callback: (eventData: T, eventState: EventState) => void): boolean;
|
|
119
101
|
/**
|
|
120
102
|
* Moves the observable to the top of the observer list making it get called first when notified
|
|
121
103
|
* @param observer the observer to move
|
|
@@ -164,7 +146,6 @@ export declare class Observable<T> {
|
|
|
164
146
|
* @returns a new observable
|
|
165
147
|
*/
|
|
166
148
|
clone(): Observable<T>;
|
|
167
|
-
private _deferUnregister;
|
|
168
149
|
private _remove;
|
|
169
150
|
}
|
|
170
151
|
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ICommandService, Univer } from '@univerjs/core';
|
|
2
|
+
import { Dependency } from '@wendellhu/redi';
|
|
3
|
+
|
|
4
|
+
export declare const createTestBed: (dependencies?: Dependency[]) => {
|
|
5
|
+
univer: Univer;
|
|
6
|
+
get: {
|
|
7
|
+
<T>(id: import('@wendellhu/redi').DependencyIdentifier<T>, lookUp?: import('@wendellhu/redi').LookUp | undefined): T;
|
|
8
|
+
<T_1>(id: import('@wendellhu/redi').DependencyIdentifier<T_1>, quantity: import("@wendellhu/redi").Quantity.MANY, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_1[];
|
|
9
|
+
<T_2>(id: import('@wendellhu/redi').DependencyIdentifier<T_2>, quantity: import("@wendellhu/redi").Quantity.OPTIONAL, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_2 | null;
|
|
10
|
+
<T_3>(id: import('@wendellhu/redi').DependencyIdentifier<T_3>, quantity: import("@wendellhu/redi").Quantity.REQUIRED, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_3;
|
|
11
|
+
<T_4>(id: import('@wendellhu/redi').DependencyIdentifier<T_4>, quantity?: import('@wendellhu/redi').Quantity | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_4 | T_4[] | null;
|
|
12
|
+
<T_5>(id: import('@wendellhu/redi').DependencyIdentifier<T_5>, quantityOrLookup?: import('@wendellhu/redi').Quantity | import('@wendellhu/redi').LookUp | undefined, lookUp?: import('@wendellhu/redi').LookUp | undefined): T_5 | T_5[] | null;
|
|
13
|
+
};
|
|
14
|
+
workbook: import('@univerjs/core').Workbook;
|
|
15
|
+
unitId: string;
|
|
16
|
+
subUnitId: string;
|
|
17
|
+
commandService: ICommandService;
|
|
18
|
+
};
|
|
@@ -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,30 @@
|
|
|
1
|
+
import { IActionInfo, IAllowedRequest, IBatchAllowedResponse, ICollaborator, ICreateRequest, IListPermPointRequest, IPermissionPoint, IPutCollaboratorsRequest, IUnitRoleKV, IUpdatePermPointRequest, UnitAction } from '@univerjs/protocol';
|
|
2
|
+
import { IResourceManagerService } from '../resource-manager/type';
|
|
3
|
+
import { UserManagerService } from '../user-manager/user-manager.service';
|
|
4
|
+
import { IAuthzIoService } from './type';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Do not use the mock implementation in a production environment as it is a minimal version.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AuthzIoLocalService implements IAuthzIoService {
|
|
10
|
+
private _resourceManagerService;
|
|
11
|
+
private _userManagerService;
|
|
12
|
+
private _permissionMap;
|
|
13
|
+
constructor(_resourceManagerService: IResourceManagerService, _userManagerService: UserManagerService);
|
|
14
|
+
private _getRole;
|
|
15
|
+
private _initSnapshot;
|
|
16
|
+
create(config: ICreateRequest): Promise<string>;
|
|
17
|
+
allowed(config: IAllowedRequest): Promise<IActionInfo[]>;
|
|
18
|
+
batchAllowed(config: IAllowedRequest[]): Promise<IBatchAllowedResponse['objectActions']>;
|
|
19
|
+
list(config: IListPermPointRequest): Promise<IPermissionPoint[]>;
|
|
20
|
+
listCollaborators(): Promise<ICollaborator[]>;
|
|
21
|
+
listRoles(): Promise<{
|
|
22
|
+
roles: IUnitRoleKV[];
|
|
23
|
+
actions: UnitAction[];
|
|
24
|
+
}>;
|
|
25
|
+
deleteCollaborator(): Promise<void>;
|
|
26
|
+
update(config: IUpdatePermPointRequest): Promise<void>;
|
|
27
|
+
updateCollaborator(): Promise<void>;
|
|
28
|
+
createCollaborator(): Promise<void>;
|
|
29
|
+
putCollaborators(config: IPutCollaboratorsRequest): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ILogContext } from '@univerjs/core';
|
|
2
|
+
import { IAllowedRequest, IAllowedResponse, IBatchAllowedResponse, ICreateCollaboratorRequest, ICreateRequest, ICreateResponse, IDeleteCollaboratorRequest, IListCollaboratorRequest, IListCollaboratorResponse, IListPermPointRequest, IListPermPointResponse, IListRolesRequest, IListRolesResponse, IPutCollaboratorsRequest, IUpdateCollaboratorRequest, IUpdatePermPointRequest } from '@univerjs/protocol';
|
|
3
|
+
|
|
4
|
+
export interface IAuthzIoService {
|
|
5
|
+
create(config: ICreateRequest, context?: ILogContext): Promise<ICreateResponse['objectID']>;
|
|
6
|
+
allowed(config: IAllowedRequest, context?: ILogContext): Promise<IAllowedResponse['actions']>;
|
|
7
|
+
batchAllowed(config: IAllowedRequest[], context?: ILogContext): Promise<IBatchAllowedResponse['objectActions']>;
|
|
8
|
+
list(config: IListPermPointRequest, context?: ILogContext): Promise<IListPermPointResponse['objects']>;
|
|
9
|
+
listRoles(config: IListRolesRequest, context?: ILogContext): Promise<{
|
|
10
|
+
roles: IListRolesResponse['roles'];
|
|
11
|
+
actions: IListRolesResponse['actions'];
|
|
12
|
+
}>;
|
|
13
|
+
update(config: IUpdatePermPointRequest, context?: ILogContext): Promise<void>;
|
|
14
|
+
listCollaborators(config: IListCollaboratorRequest, context?: ILogContext): Promise<IListCollaboratorResponse['collaborators']>;
|
|
15
|
+
updateCollaborator(config: IUpdateCollaboratorRequest, context?: ILogContext): Promise<void>;
|
|
16
|
+
deleteCollaborator(config: IDeleteCollaboratorRequest, context?: ILogContext): Promise<void>;
|
|
17
|
+
createCollaborator(config: ICreateCollaboratorRequest, context?: ILogContext): Promise<void>;
|
|
18
|
+
putCollaborators(config: IPutCollaboratorsRequest, context?: ILogContext): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare const IAuthzIoService: import('@wendellhu/redi').IdentifierDecorator<IAuthzIoService>;
|
|
@@ -25,3 +25,7 @@ export declare const FOCUSING_FORMULA_EDITOR = "FOCUSING_FORMULA_EDITOR";
|
|
|
25
25
|
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
|
|
26
26
|
export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
27
27
|
export declare const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
|
|
28
|
+
/**
|
|
29
|
+
* The focusing state of the common drawings.
|
|
30
|
+
*/
|
|
31
|
+
export declare const FOCUSING_COMMON_DRAWINGS = "FOCUSING_COMMON_DRAWINGS";
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { IUniverInstanceService } from '../instance/instance.service';
|
|
5
|
-
import { IResourceManagerService } from '../resource-manager/type';
|
|
2
|
+
import { Disposable } from '../../shared';
|
|
3
|
+
import { IPermissionPoint, IPermissionService } from './type';
|
|
6
4
|
|
|
7
|
-
export interface IPermissionService {
|
|
8
|
-
deletePermissionPoint(unitID: string, id: string): void;
|
|
9
|
-
addPermissionPoint(unitID: string, item: PermissionPoint): boolean;
|
|
10
|
-
updatePermissionPoint(unitID: string, id: string, value: any): void;
|
|
11
|
-
getPermissionPoint(unitID: string, id: string): Nullable<PermissionPoint>;
|
|
12
|
-
composePermission$(unitID: string, permissionIdList: string[]): Observable<PermissionPoint[]>;
|
|
13
|
-
composePermission(unitID: string, permissionIdList: string[]): PermissionPoint[];
|
|
14
|
-
}
|
|
15
|
-
export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
|
|
16
5
|
export declare class PermissionService extends Disposable implements IPermissionService {
|
|
17
|
-
private _resourceManagerService;
|
|
18
|
-
private _univerInstanceService;
|
|
19
6
|
private _permissionPointMap;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
getPermissionPoint
|
|
27
|
-
|
|
28
|
-
composePermission(
|
|
7
|
+
private _permissionPointUpdate$;
|
|
8
|
+
permissionPointUpdate$: Observable<IPermissionPoint<unknown>>;
|
|
9
|
+
deletePermissionPoint(permissionId: string): void;
|
|
10
|
+
addPermissionPoint<T = boolean>(item: IPermissionPoint<T>): boolean;
|
|
11
|
+
updatePermissionPoint<T = boolean>(permissionId: string, value: T): void;
|
|
12
|
+
clearPermissionMap(): void;
|
|
13
|
+
getPermissionPoint<T = boolean>(permissionId: string): IPermissionPoint<T> | undefined;
|
|
14
|
+
getPermissionPoint$<T = boolean>(permissionId: string): Observable<IPermissionPoint<T>> | undefined;
|
|
15
|
+
composePermission$(permissionIdList: string[]): Observable<IPermissionPoint<unknown>[]>;
|
|
16
|
+
composePermission(permissionIdList: string[]): IPermissionPoint<unknown>[];
|
|
29
17
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { UnitAction, UnitObject } from '@univerjs/protocol';
|
|
3
|
+
import { Nullable } from '../../common/type-utils';
|
|
4
|
+
import { IRange } from '../../types/interfaces';
|
|
5
|
+
|
|
6
|
+
export declare enum PermissionStatus {
|
|
7
|
+
INIT = "init",
|
|
8
|
+
FETCHING = "fetching",
|
|
9
|
+
DONE = "done"
|
|
10
|
+
}
|
|
11
|
+
type WorkbookPermissionPointConstructor = new (unitId: string) => IPermissionPoint;
|
|
12
|
+
type WorkSheetPermissionPointConstructor = new (unitId: string, subUnitId: string) => IPermissionPoint;
|
|
13
|
+
type RangePermissionPointConstructor = new (unitId: string, subUnitId: string, permissionId: string) => IPermissionPoint;
|
|
14
|
+
export interface IPermissionTypes {
|
|
15
|
+
rangeTypes?: RangePermissionPointConstructor[];
|
|
16
|
+
worksheetTypes?: WorkSheetPermissionPointConstructor[];
|
|
17
|
+
workbookTypes?: WorkbookPermissionPointConstructor[];
|
|
18
|
+
}
|
|
19
|
+
export interface IPermissionPoint<V = boolean> {
|
|
20
|
+
type: UnitObject;
|
|
21
|
+
id: string;
|
|
22
|
+
status: PermissionStatus;
|
|
23
|
+
subType: UnitAction;
|
|
24
|
+
value: V;
|
|
25
|
+
}
|
|
26
|
+
export interface IPermissionParam {
|
|
27
|
+
unitId: string;
|
|
28
|
+
subUnitId: string;
|
|
29
|
+
range?: IRange;
|
|
30
|
+
}
|
|
31
|
+
export interface IPermissionService {
|
|
32
|
+
permissionPointUpdate$: Observable<IPermissionPoint<unknown>>;
|
|
33
|
+
deletePermissionPoint(permissionId: string): void;
|
|
34
|
+
addPermissionPoint<T = boolean>(permissionPoint: IPermissionPoint<T>): boolean;
|
|
35
|
+
updatePermissionPoint<T = boolean>(permissionId: string, value: T): void;
|
|
36
|
+
getPermissionPoint<T = boolean>(permissionId: string): Nullable<IPermissionPoint<T>>;
|
|
37
|
+
getPermissionPoint$<T = boolean>(permissionId: string): Nullable<Observable<IPermissionPoint<T>>>;
|
|
38
|
+
clearPermissionMap(): void;
|
|
39
|
+
composePermission$(permissionId: string[]): Observable<IPermissionPoint<unknown>[]>;
|
|
40
|
+
composePermission(permissionId: string[]): IPermissionPoint<unknown>[];
|
|
41
|
+
}
|
|
42
|
+
export declare const IPermissionService: import('@wendellhu/redi').IdentifierDecorator<IPermissionService>;
|
|
43
|
+
export {};
|
|
@@ -13,6 +13,4 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export {
|
|
17
|
-
export { UniverEditablePermission, UniverEditablePermissionPoint } from './permission-point';
|
|
18
|
-
export { UniverPermissionService } from './univer.permission.service';
|
|
16
|
+
export { createDefaultUser } from './const';
|
|
@@ -9,11 +9,14 @@ export declare class UserManagerService {
|
|
|
9
9
|
} | {
|
|
10
10
|
type: 'clear';
|
|
11
11
|
}>;
|
|
12
|
-
private _currentUser;
|
|
13
12
|
private _currentUser$;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* When the current user undergoes a switch or change
|
|
15
|
+
* @memberof UserManagerService
|
|
16
|
+
*/
|
|
17
|
+
currentUser$: import('rxjs').Observable<IUser>;
|
|
18
|
+
get currentUser(): IUser;
|
|
19
|
+
set currentUser(user: IUser);
|
|
17
20
|
addUser(user: IUser): void;
|
|
18
21
|
getUser(userId: string, callBack?: () => void): IUser | undefined;
|
|
19
22
|
delete(userId: string): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Nullable } from '../common/type-util';
|
|
2
|
+
import { ITransformState } from '../types/interfaces/i-document-data';
|
|
3
|
+
|
|
4
|
+
export declare const MOVE_BUFFER_VALUE = 2;
|
|
5
|
+
export declare const ROTATE_BUFFER_VALUE = 1;
|
|
6
|
+
export declare function checkIfMove(transform: Nullable<ITransformState>, previousTransform: Nullable<ITransformState>): boolean;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { checkIfMove, MOVE_BUFFER_VALUE, ROTATE_BUFFER_VALUE } from './check-if-move';
|
|
16
17
|
export * from './array-search';
|
|
17
18
|
export * from './blob';
|
|
18
19
|
export * from './color/color';
|
|
@@ -27,12 +28,12 @@ export * from './lifecycle';
|
|
|
27
28
|
export * from './locale';
|
|
28
29
|
export * from './lru/index';
|
|
29
30
|
export * from './object-matrix';
|
|
30
|
-
export * from './permission';
|
|
31
31
|
export * from './rectangle';
|
|
32
32
|
export { RefAlias } from './ref-alias';
|
|
33
33
|
export * from './row-col-iter';
|
|
34
34
|
export * from './sequence';
|
|
35
35
|
export * from './sort-rules';
|
|
36
|
+
export * from './shape';
|
|
36
37
|
export * from './tools';
|
|
37
38
|
export * from './types';
|
|
38
39
|
export * from './debounce';
|