@univerjs/core 0.2.6 → 0.2.8
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 +2025 -244
- package/lib/types/common/const.d.ts +1 -1
- package/lib/types/common/equal.d.ts +0 -1
- package/lib/types/common/error.d.ts +18 -0
- package/lib/types/common/interceptor.d.ts +0 -1
- package/lib/types/common/unit.d.ts +3 -1
- package/lib/types/docs/data-model/document-data-model.d.ts +4 -4
- package/lib/types/docs/data-model/empty-snapshot.d.ts +0 -1
- package/lib/types/docs/data-model/json-x/json-x.d.ts +2 -2
- package/lib/types/docs/data-model/preset-list-type.d.ts +54 -5
- package/lib/types/docs/data-model/replacement.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/__tests__/transform-position.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/__tests__/transform.spec.d.ts +16 -0
- package/lib/types/docs/data-model/text-x/action-iterator.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/action-types.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +2 -3
- package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/apply-utils/update-apply.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/apply.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/text-x.d.ts +31 -2
- package/lib/types/docs/data-model/text-x/transform-utils.d.ts +2 -0
- package/lib/types/docs/data-model/text-x/utils.d.ts +0 -1
- package/lib/types/docs/data-model/types.d.ts +12 -10
- package/lib/types/index.d.ts +2 -1
- package/lib/types/observer/observable.d.ts +0 -1
- package/lib/types/services/__tests__/index.d.ts +0 -1
- package/lib/types/services/authz-io/authz-io-local.service.d.ts +2 -3
- package/lib/types/services/authz-io/type.d.ts +0 -1
- package/lib/types/services/command/command.service.d.ts +0 -1
- package/lib/types/services/config/config.service.d.ts +0 -1
- package/lib/types/services/context/context.d.ts +3 -1
- package/lib/types/services/context/context.service.d.ts +0 -1
- package/lib/types/services/error/error.service.d.ts +0 -1
- package/lib/types/services/instance/instance.service.d.ts +18 -7
- package/lib/types/services/lifecycle/lifecycle.d.ts +0 -1
- package/lib/types/services/lifecycle/lifecycle.service.d.ts +0 -1
- package/lib/types/services/locale/locale.service.d.ts +0 -1
- package/lib/types/services/log/log.service.d.ts +0 -1
- package/lib/types/services/permission/permission.service.d.ts +0 -1
- package/lib/types/services/permission/type.d.ts +0 -1
- package/lib/types/services/plugin/plugin-override.d.ts +0 -1
- package/lib/types/services/plugin/plugin.d.ts +0 -1
- package/lib/types/services/plugin/plugin.service.d.ts +0 -1
- package/lib/types/services/resource-loader/resource-loader.service.d.ts +0 -1
- package/lib/types/services/resource-loader/type.d.ts +0 -1
- package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -7
- package/lib/types/services/resource-manager/type.d.ts +8 -5
- package/lib/types/services/snapshot/__tests__/snapshot-mock.d.ts +0 -1
- package/lib/types/services/snapshot/snapshot-server.service.d.ts +0 -1
- package/lib/types/services/snapshot/snapshot-transform.d.ts +3 -1
- package/lib/types/services/snapshot/snapshot-utils.d.ts +0 -1
- package/lib/types/services/theme/theme.service.d.ts +0 -1
- package/lib/types/services/undoredo/undoredo.service.d.ts +0 -1
- package/lib/types/services/user-manager/const.d.ts +0 -1
- package/lib/types/shared/after-init-apply.d.ts +0 -1
- package/lib/types/shared/check-if-move.d.ts +0 -1
- package/lib/types/shared/clipboard.d.ts +0 -1
- package/lib/types/shared/color/color.d.ts +0 -1
- package/lib/types/shared/common.d.ts +0 -1
- package/lib/types/shared/compare.d.ts +0 -1
- package/lib/types/shared/doc-tool.d.ts +0 -1
- package/lib/types/shared/index.d.ts +1 -0
- package/lib/types/shared/lifecycle.d.ts +0 -1
- package/lib/types/shared/lru/lru-map.d.ts +0 -1
- package/lib/types/shared/numfmt.d.ts +2 -0
- package/lib/types/shared/object-matrix-query.d.ts +0 -1
- package/lib/types/shared/object-matrix.d.ts +6 -1
- package/lib/types/shared/range.d.ts +0 -1
- package/lib/types/shared/rectangle.d.ts +0 -1
- package/lib/types/shared/rxjs.d.ts +0 -1
- package/lib/types/shared/shape.d.ts +6 -0
- package/lib/types/shared/tools.d.ts +11 -1
- package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +0 -1
- package/lib/types/sheets/column-manager.d.ts +0 -1
- package/lib/types/sheets/empty-snapshot.d.ts +0 -1
- package/lib/types/sheets/range.d.ts +0 -1
- package/lib/types/sheets/row-manager.d.ts +0 -1
- package/lib/types/sheets/sheet-snapshot-utils.d.ts +0 -1
- package/lib/types/sheets/styles.d.ts +0 -1
- package/lib/types/sheets/view-model.d.ts +0 -1
- package/lib/types/sheets/workbook.d.ts +1 -1
- package/lib/types/sheets/worksheet.d.ts +0 -1
- package/lib/types/slides/slide-model.d.ts +18 -4
- package/lib/types/types/const/const.d.ts +1 -1
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -1
- package/lib/types/types/interfaces/i-cell-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-cell-validation-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-column-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-data-validation.d.ts +0 -1
- package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +5 -2
- package/lib/types/types/interfaces/i-document-data.d.ts +93 -47
- package/lib/types/types/interfaces/i-placeholder.d.ts +0 -1
- package/lib/types/types/interfaces/i-row-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-selection-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-shape-properties.d.ts +0 -1
- package/lib/types/types/interfaces/i-slide-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-style-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-univer-data.d.ts +0 -1
- package/lib/types/types/interfaces/i-workbook-data.d.ts +6 -6
- package/lib/types/types/interfaces/i-worksheet-data.d.ts +0 -1
- package/lib/types/univer.d.ts +0 -1
- package/lib/umd/index.js +9 -9
- package/package.json +11 -7
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_NORMAL";
|
|
17
17
|
export declare const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__DOCS_FORMULA_BAR";
|
|
18
|
-
export declare const DOCS_ZEN_EDITOR_UNIT_ID_KEY = "
|
|
18
|
+
export declare const DOCS_ZEN_EDITOR_UNIT_ID_KEY = "__INTERNAL_EDITOR__ZEN_EDITOR";
|
|
19
19
|
export declare const DEFAULT_EMPTY_DOCUMENT_VALUE = "\r\n";
|
|
20
20
|
export declare function createInternalEditorID(id: string): string;
|
|
21
21
|
export declare function isInternalEditorID(id: string): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CustomCommandExecutionError extends Error {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { UniverType } from '@univerjs/protocol';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
2
3
|
import { Disposable } from '../shared';
|
|
3
|
-
|
|
4
4
|
export { UniverType as UniverInstanceType } from '@univerjs/protocol';
|
|
5
5
|
export type UnitType = UniverType | number;
|
|
6
6
|
export declare abstract class UnitModel<_D = object, T extends UnitType = UnitType> extends Disposable {
|
|
7
7
|
abstract readonly type: T;
|
|
8
8
|
abstract getUnitId(): string;
|
|
9
|
+
abstract name$: Observable<string>;
|
|
10
|
+
abstract setName(name: string): void;
|
|
9
11
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
1
2
|
import { Nullable } from '../../shared';
|
|
2
3
|
import { IDocumentBody, IDocumentData, IDocumentRenderConfig, IDocumentStyle, IDrawings } from '../../types/interfaces/i-document-data';
|
|
3
4
|
import { IPaddingData } from '../../types/interfaces/i-style-data';
|
|
4
5
|
import { UnitModel, UniverInstanceType } from '../../common/unit';
|
|
5
6
|
import { SliceBodyType } from './text-x/utils';
|
|
6
7
|
import { JSONXActions } from './json-x/json-x';
|
|
7
|
-
|
|
8
8
|
export declare const DEFAULT_DOC: {
|
|
9
9
|
id: string;
|
|
10
10
|
documentStyle: {};
|
|
@@ -18,8 +18,11 @@ interface IDrawingUpdateConfig {
|
|
|
18
18
|
declare class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverInstanceType.UNIVER_DOC> {
|
|
19
19
|
type: UniverInstanceType.UNIVER_DOC;
|
|
20
20
|
getUnitId(): string;
|
|
21
|
+
protected readonly _name$: BehaviorSubject<string>;
|
|
22
|
+
name$: import('rxjs').Observable<string>;
|
|
21
23
|
protected snapshot: IDocumentData;
|
|
22
24
|
constructor(snapshot: Partial<IDocumentData>);
|
|
25
|
+
setName(name: string): void;
|
|
23
26
|
get drawings(): IDrawings | undefined;
|
|
24
27
|
get documentStyle(): IDocumentStyle;
|
|
25
28
|
get lists(): import('../../types/interfaces/i-document-data').ILists | undefined;
|
|
@@ -41,10 +44,7 @@ export declare class DocumentDataModel extends DocumentDataModelSimple {
|
|
|
41
44
|
private _unitId;
|
|
42
45
|
headerModelMap: Map<string, DocumentDataModel>;
|
|
43
46
|
footerModelMap: Map<string, DocumentDataModel>;
|
|
44
|
-
private _name$;
|
|
45
|
-
readonly name$: import('rxjs').Observable<string>;
|
|
46
47
|
constructor(snapshot: Partial<IDocumentData>);
|
|
47
|
-
setName(name: string): void;
|
|
48
48
|
dispose(): void;
|
|
49
49
|
getDrawings(): IDrawings | undefined;
|
|
50
50
|
getDrawingsOrder(): string[] | undefined;
|
|
@@ -2,7 +2,6 @@ import { Doc, JSONOp, Path } from 'ot-json1';
|
|
|
2
2
|
import { IDocumentBody, IDocumentData } from '../../../types/interfaces';
|
|
3
3
|
import { TPriority } from '../text-x/text-x';
|
|
4
4
|
import { TextXAction } from '../text-x/action-types';
|
|
5
|
-
|
|
6
5
|
import * as json1 from 'ot-json1';
|
|
7
6
|
export interface ISubType {
|
|
8
7
|
name: string;
|
|
@@ -25,7 +24,8 @@ export declare class JSONX {
|
|
|
25
24
|
[k: string]: Doc;
|
|
26
25
|
} | null | undefined;
|
|
27
26
|
static compose(thisActions: JSONOp, otherActions: JSONOp): JSONOp;
|
|
28
|
-
static transform(
|
|
27
|
+
static transform(thisActions: JSONOp, otherActions: JSONOp, priority: TPriority): json1.JSONOpList | null | undefined;
|
|
28
|
+
static transformPosition(thisActions: JSONOp, index: number, priority?: TPriority): number;
|
|
29
29
|
static invertWithDoc(actions: JSONOp, doc: IDocumentData): JSONOp;
|
|
30
30
|
static isNoop(actions: JSONOp): boolean;
|
|
31
31
|
private static _instance;
|
|
@@ -1,10 +1,59 @@
|
|
|
1
1
|
import { IListData } from '../../types/interfaces/i-document-data';
|
|
2
|
-
|
|
2
|
+
export declare enum QuickListType {
|
|
3
|
+
ORDER_LIST_QUICK_1 = "1.",
|
|
4
|
+
ORDER_LIST_QUICK_2 = "a)",
|
|
5
|
+
ORDER_LIST_QUICK_3 = "a.",
|
|
6
|
+
ORDER_LIST_QUICK_4 = "i.",
|
|
7
|
+
ORDER_LIST_QUICK_5 = "A.",
|
|
8
|
+
ORDER_LIST_QUICK_6 = "I.",
|
|
9
|
+
ORDER_LIST_QUICK_7 = "01."
|
|
10
|
+
}
|
|
3
11
|
export declare enum PresetListType {
|
|
4
12
|
BULLET_LIST = "BULLET_LIST",
|
|
5
|
-
|
|
13
|
+
BULLET_LIST_1 = "BULLET_LIST_1",
|
|
14
|
+
BULLET_LIST_2 = "BULLET_LIST_2",
|
|
15
|
+
BULLET_LIST_3 = "BULLET_LIST_3",
|
|
16
|
+
BULLET_LIST_4 = "BULLET_LIST_4",
|
|
17
|
+
BULLET_LIST_5 = "BULLET_LIST_5",
|
|
18
|
+
/**
|
|
19
|
+
* 1 a i
|
|
20
|
+
*/
|
|
21
|
+
ORDER_LIST = "ORDER_LIST",
|
|
22
|
+
/**
|
|
23
|
+
* 1) a) i)
|
|
24
|
+
*/
|
|
25
|
+
ORDER_LIST_1 = "ORDER_LIST_1",
|
|
26
|
+
/**
|
|
27
|
+
* 1. 1.1. 1.1.1.
|
|
28
|
+
*/
|
|
29
|
+
ORDER_LIST_2 = "ORDER_LIST_2",
|
|
30
|
+
/**
|
|
31
|
+
* A a i
|
|
32
|
+
*/
|
|
33
|
+
ORDER_LIST_3 = "ORDER_LIST_3",
|
|
34
|
+
/**
|
|
35
|
+
* A 1 i
|
|
36
|
+
*/
|
|
37
|
+
ORDER_LIST_4 = "ORDER_LIST_4",
|
|
38
|
+
/**
|
|
39
|
+
* 01 a i
|
|
40
|
+
*/
|
|
41
|
+
ORDER_LIST_5 = "ORDER_LIST_5",
|
|
42
|
+
ORDER_LIST_QUICK_2 = "ORDER_LIST_QUICK_2",
|
|
43
|
+
ORDER_LIST_QUICK_3 = "ORDER_LIST_QUICK_3",
|
|
44
|
+
ORDER_LIST_QUICK_4 = "ORDER_LIST_QUICK_4",
|
|
45
|
+
ORDER_LIST_QUICK_5 = "ORDER_LIST_QUICK_5",
|
|
46
|
+
ORDER_LIST_QUICK_6 = "ORDER_LIST_QUICK_6",
|
|
47
|
+
CHECK_LIST = "CHECK_LIST",
|
|
48
|
+
CHECK_LIST_CHECKED = "CHECK_LIST_CHECKED"
|
|
6
49
|
}
|
|
7
|
-
export declare const PRESET_LIST_TYPE:
|
|
8
|
-
|
|
9
|
-
|
|
50
|
+
export declare const PRESET_LIST_TYPE: Record<string, IListData>;
|
|
51
|
+
export declare const QuickListTypeMap: {
|
|
52
|
+
"1.": PresetListType;
|
|
53
|
+
"a)": PresetListType;
|
|
54
|
+
"a.": PresetListType;
|
|
55
|
+
"i.": PresetListType;
|
|
56
|
+
"A.": PresetListType;
|
|
57
|
+
"I.": PresetListType;
|
|
58
|
+
"01.": PresetListType;
|
|
10
59
|
};
|
|
@@ -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,4 @@
|
|
|
1
|
-
import { ICustomBlock, ICustomDecoration, ICustomRange, IDocumentBody, IParagraph, ISectionBreak,
|
|
2
|
-
|
|
1
|
+
import { ICustomBlock, ICustomDecoration, ICustomRange, ICustomTable, IDocumentBody, IParagraph, ISectionBreak, ITextRun } from '../../../../types/interfaces';
|
|
3
2
|
export declare function normalizeTextRuns(textRuns: ITextRun[]): ITextRun[];
|
|
4
3
|
/**
|
|
5
4
|
* Inserting styled text content into the current document model.
|
|
@@ -28,6 +27,6 @@ export declare function deleteTextRuns(body: IDocumentBody, textLength: number,
|
|
|
28
27
|
export declare function deleteParagraphs(body: IDocumentBody, textLength: number, currentIndex: number): IParagraph[];
|
|
29
28
|
export declare function deleteSectionBreaks(body: IDocumentBody, textLength: number, currentIndex: number): ISectionBreak[];
|
|
30
29
|
export declare function deleteCustomBlocks(body: IDocumentBody, textLength: number, currentIndex: number): ICustomBlock[];
|
|
31
|
-
export declare function deleteTables(body: IDocumentBody, textLength: number, currentIndex: number):
|
|
30
|
+
export declare function deleteTables(body: IDocumentBody, textLength: number, currentIndex: number): ICustomTable[];
|
|
32
31
|
export declare function deleteCustomRanges(body: IDocumentBody, textLength: number, currentIndex: number): ICustomRange[];
|
|
33
32
|
export declare function deleteCustomDecorations(body: IDocumentBody, textLength: number, currentIndex: number, needOffset?: boolean): ICustomDecoration[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UpdateDocsAttributeType } from '../../../../shared';
|
|
2
2
|
import { IDocumentBody, ITextRun } from '../../../../types/interfaces';
|
|
3
|
-
|
|
4
3
|
export declare function updateAttribute(body: IDocumentBody, updateBody: IDocumentBody, textLength: number, currentIndex: number, coverType: UpdateDocsAttributeType): IDocumentBody;
|
|
5
4
|
export declare function coverTextRuns(updateDataTextRuns: ITextRun[], removeTextRuns: ITextRun[], coverType: UpdateDocsAttributeType): ITextRun[];
|
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
2
2
|
import { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
3
3
|
import { TextXAction } from './action-types';
|
|
4
|
-
|
|
5
4
|
export type TPriority = 'left' | 'right';
|
|
6
5
|
export declare class TextX {
|
|
7
6
|
static id: string;
|
|
8
7
|
static uri: string;
|
|
9
8
|
static apply(doc: IDocumentBody, actions: TextXAction[]): IDocumentBody;
|
|
10
9
|
static compose(thisActions: TextXAction[], otherActions: TextXAction[]): TextXAction[];
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* |(this↓ \| other→) | **insert** | **retain** | **delete** |
|
|
12
|
+
* | ---------------- | ---------- | ---------- | ---------- |
|
|
13
|
+
* | **insert** | Case 1 | Case 2 | Case 2 |
|
|
14
|
+
* | **retain** | Case 1 | Case 5 | Case 4 |
|
|
15
|
+
* | **delete** | Case 1 | Case 3 | Case 3 |
|
|
16
|
+
*
|
|
17
|
+
* Case 1: When the other action type is an insert operation,
|
|
18
|
+
* the insert operation is retained regardless of the type of action this action
|
|
19
|
+
* Case 2: When this action type is an insert operation and the other action type is a
|
|
20
|
+
* non-insert operation, you need to retain the length of this action insert
|
|
21
|
+
* Case 3: When this action is a delete operation, there are two scenarios:
|
|
22
|
+
* 1) When other is a delete operation, since it is a delete operation, this has
|
|
23
|
+
* already been deleted, so the target does not need to be in delete, and it can
|
|
24
|
+
* be continued directly
|
|
25
|
+
* 2) When other is the retain operation, although this action delete occurs first,
|
|
26
|
+
* the delete priority is higher, so the delete operation is retained, and the origin
|
|
27
|
+
* delete has been applied, so it is directly continued
|
|
28
|
+
* Case 4: other is the delete operation, this is the retain operation, and the target delete operation
|
|
29
|
+
* is kept
|
|
30
|
+
* Case 5: When both other and this are retain operations
|
|
31
|
+
* 1) If the other body attribute does not exist, directly retain length
|
|
32
|
+
* 2) If the other body property exists, then execute the TransformBody logic to override it
|
|
33
|
+
*/
|
|
34
|
+
static transform(thisActions: TextXAction[], otherActions: TextXAction[], priority?: TPriority): TextXAction[];
|
|
35
|
+
static _transform(thisActions: TextXAction[], otherActions: TextXAction[], priority?: TPriority): TextXAction[];
|
|
36
|
+
/**
|
|
37
|
+
* Used to transform selection. Why not named transformSelection?
|
|
38
|
+
* Because Univer Doc supports multiple Selections in one document, user need to encapsulate transformSelections at the application layer.
|
|
39
|
+
*/
|
|
40
|
+
static transformPosition(thisActions: TextXAction[], index: number, priority?: boolean): number;
|
|
12
41
|
static isNoop(actions: TextXAction[]): boolean;
|
|
13
42
|
static invert(actions: TextXAction[]): TextXAction[];
|
|
14
43
|
static makeInvertible(actions: TextXAction[], doc: IDocumentBody): TextXAction[];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
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
|
-
|
|
5
4
|
export declare enum SliceBodyType {
|
|
6
5
|
copy = 0,
|
|
7
6
|
cut = 1
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
export declare enum DataStreamTreeNodeType {
|
|
17
|
-
PARAGRAPH =
|
|
18
|
-
SECTION_BREAK =
|
|
19
|
-
TABLE =
|
|
20
|
-
TABLE_ROW =
|
|
21
|
-
TABLE_CELL =
|
|
22
|
-
CUSTOM_BLOCK =
|
|
17
|
+
PARAGRAPH = "PARAGRAPH",// \r 段落
|
|
18
|
+
SECTION_BREAK = "SECTION_BREAK",// \n 章节
|
|
19
|
+
TABLE = "TABLE",
|
|
20
|
+
TABLE_ROW = "TABLE_ROW",
|
|
21
|
+
TABLE_CELL = "TABLE_CELL",
|
|
22
|
+
CUSTOM_BLOCK = "CUSTOM_BLOCK"
|
|
23
23
|
}
|
|
24
24
|
export declare enum DataStreamTreeTokenType {
|
|
25
25
|
PARAGRAPH = "\r",// 段落
|
|
26
26
|
SECTION_BREAK = "\n",// 章节
|
|
27
27
|
TABLE_START = "\u001A",// 表格开始
|
|
28
|
-
TABLE_ROW_START = "\u001B",//
|
|
29
|
-
TABLE_CELL_START = "\u001C",//
|
|
30
|
-
TABLE_CELL_END = "\u001D",//
|
|
31
|
-
TABLE_ROW_END = "\u000E",//
|
|
28
|
+
TABLE_ROW_START = "\u001B",// 表格行开始
|
|
29
|
+
TABLE_CELL_START = "\u001C",// 表格单元格开始
|
|
30
|
+
TABLE_CELL_END = "\u001D",// 表格单元格结束
|
|
31
|
+
TABLE_ROW_END = "\u000E",// 表格行结束
|
|
32
32
|
TABLE_END = "\u000F",// 表格结束
|
|
33
33
|
CUSTOM_RANGE_START = "\u001F",// 自定义范围开始
|
|
34
34
|
CUSTOM_RANGE_END = "\u001E",// 自定义范围结束
|
|
@@ -40,3 +40,5 @@ export declare enum DataStreamTreeTokenType {
|
|
|
40
40
|
LETTER = "",
|
|
41
41
|
SPACE = " "
|
|
42
42
|
}
|
|
43
|
+
/** Wrap your stream in a pair of custom range tokens. */
|
|
44
|
+
export declare function makeCustomRangeStream(stream: string): string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type { Serializable } from './common/json';
|
|
|
17
17
|
export { DEFAULT_DOCUMENT_SUB_COMPONENT_ID } from './docs/data-model/subdocument';
|
|
18
18
|
export { type UnitType, UnitModel, UniverInstanceType } from './common/unit';
|
|
19
19
|
export { Registry, RegistryAsMap } from './common/registry';
|
|
20
|
+
export { CustomCommandExecutionError } from './common/error';
|
|
20
21
|
export { Univer } from './univer';
|
|
21
22
|
export { shallowEqual, isRangesEqual, isUnitRangesEqual } from './common/equal';
|
|
22
23
|
export { isNumeric, isSafeNumeric } from './common/number';
|
|
@@ -86,7 +87,7 @@ export * from './types/const';
|
|
|
86
87
|
export * from './types/enum';
|
|
87
88
|
export * from './types/interfaces';
|
|
88
89
|
export { ISnapshotServerService } from './services/snapshot/snapshot-server.service';
|
|
89
|
-
export { transformSnapshotToWorkbookData, transformWorkbookDataToSnapshot, transformDocumentDataToSnapshot, transformSnapshotToDocumentData, generateTemporarySnap, } from './services/snapshot/snapshot-transform';
|
|
90
|
+
export { transformSnapshotToWorkbookData, transformWorkbookDataToSnapshot, transformDocumentDataToSnapshot, transformSnapshotToDocumentData, generateTemporarySnap, generateTempDocumentSnapshot, } from './services/snapshot/snapshot-transform';
|
|
90
91
|
export { textEncoder, textDecoder } from './services/snapshot/snapshot-utils';
|
|
91
92
|
export { type ILogContext } from './services/log/context';
|
|
92
93
|
export { b64DecodeUnicode, b64EncodeUnicode } from './shared/coder';
|
|
@@ -2,7 +2,6 @@ import { IActionInfo, IAllowedRequest, IBatchAllowedResponse, ICollaborator, ICr
|
|
|
2
2
|
import { IResourceManagerService } from '../resource-manager/type';
|
|
3
3
|
import { UserManagerService } from '../user-manager/user-manager.service';
|
|
4
4
|
import { IAuthzIoService } from './type';
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* Do not use the mock implementation in a production environment as it is a minimal version.
|
|
8
7
|
*/
|
|
@@ -15,8 +14,8 @@ export declare class AuthzIoLocalService implements IAuthzIoService {
|
|
|
15
14
|
private _getRole;
|
|
16
15
|
private _initSnapshot;
|
|
17
16
|
create(config: ICreateRequest): Promise<string>;
|
|
18
|
-
allowed(
|
|
19
|
-
batchAllowed(
|
|
17
|
+
allowed(_config: IAllowedRequest): Promise<IActionInfo[]>;
|
|
18
|
+
batchAllowed(_config: IAllowedRequest[]): Promise<IBatchAllowedResponse['objectActions']>;
|
|
20
19
|
list(config: IListPermPointRequest): Promise<IPermissionPoint[]>;
|
|
21
20
|
listCollaborators(): Promise<ICollaborator[]>;
|
|
22
21
|
listRoles(): Promise<{
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ILogContext } from '@univerjs/core';
|
|
2
2
|
import { IAllowedRequest, IAllowedResponse, IBatchAllowedResponse, ICreateCollaboratorRequest, ICreateRequest, ICreateResponse, IDeleteCollaboratorRequest, IListCollaboratorRequest, IListCollaboratorResponse, IListPermPointRequest, IListPermPointResponse, IListRolesRequest, IListRolesResponse, IPutCollaboratorsRequest, IUpdateCollaboratorRequest, IUpdatePermPointRequest } from '@univerjs/protocol';
|
|
3
|
-
|
|
4
3
|
export interface IAuthzIoService {
|
|
5
4
|
create(config: ICreateRequest, context?: ILogContext): Promise<ICreateResponse['objectID']>;
|
|
6
5
|
allowed(config: IAllowedRequest, context?: ILogContext): Promise<IAllowedResponse['actions']>;
|
|
@@ -2,7 +2,6 @@ import { IAccessor, IDisposable, Injector } from '../../common/di';
|
|
|
2
2
|
import { Disposable } from '../../shared/lifecycle';
|
|
3
3
|
import { IContextService } from '../context/context.service';
|
|
4
4
|
import { ILogService } from '../log/log.service';
|
|
5
|
-
|
|
6
5
|
export declare enum CommandType {
|
|
7
6
|
/** Command could generate some operations or mutations. */
|
|
8
7
|
COMMAND = 0,
|
|
@@ -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 declare const FOCUSING_UNIT = "FOCUSING_UNIT";
|
|
16
17
|
export declare const FOCUSING_SHEET = "FOCUSING_SHEET";
|
|
17
18
|
export declare const FOCUSING_DOC = "FOCUSING_DOC";
|
|
18
19
|
export declare const FOCUSING_SLIDE = "FOCUSING_SLIDE";
|
|
@@ -21,7 +22,7 @@ export declare const FOCUSING_EDITOR_BUT_HIDDEN = "FOCUSING_EDITOR_BUT_HIDDEN";
|
|
|
21
22
|
export declare const EDITOR_ACTIVATED = "EDITOR_ACTIVATED";
|
|
22
23
|
export declare const FOCUSING_EDITOR_INPUT_FORMULA = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
23
24
|
/** The focusing state of the formula editor (Fx bar). */
|
|
24
|
-
export declare const
|
|
25
|
+
export declare const FOCUSING_FX_BAR_EDITOR = "FOCUSING_FX_BAR_EDITOR";
|
|
25
26
|
export declare const FOCUSING_UNIVER_EDITOR = "FOCUSING_UNIVER_EDITOR";
|
|
26
27
|
export declare const FOCUSING_EDITOR_STANDALONE = "FOCUSING_EDITOR_INPUT_FORMULA";
|
|
27
28
|
export declare const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = "FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";
|
|
@@ -29,3 +30,4 @@ export declare const FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE = "FOCUSING_U
|
|
|
29
30
|
* The focusing state of the common drawings.
|
|
30
31
|
*/
|
|
31
32
|
export declare const FOCUSING_COMMON_DRAWINGS = "FOCUSING_COMMON_DRAWINGS";
|
|
33
|
+
export declare const FORMULA_EDITOR_ACTIVATED = "FORMULA_EDITOR_ACTIVATED";
|
|
@@ -6,7 +6,15 @@ import { Disposable } from '../../shared/lifecycle';
|
|
|
6
6
|
import { Workbook } from '../../sheets/workbook';
|
|
7
7
|
import { IContextService } from '../context/context.service';
|
|
8
8
|
import { UnitModel, UnitType, UniverInstanceType } from '../../common/unit';
|
|
9
|
-
|
|
9
|
+
export type UnitCtor = new (...args: any[]) => UnitModel;
|
|
10
|
+
export interface ICreateUnitOptions {
|
|
11
|
+
/**
|
|
12
|
+
* If Univer should make the new unit as current of its type.
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
makeCurrent?: boolean;
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* IUniverInstanceService holds all the current univer instances and provides a set of
|
|
12
20
|
* methods to add and remove univer instances.
|
|
@@ -24,14 +32,16 @@ export interface IUniverInstanceService {
|
|
|
24
32
|
unitDisposed$: Observable<UnitModel>;
|
|
25
33
|
/** Subscribe to curtain type of units' disposing. */
|
|
26
34
|
getTypeOfUnitDisposed$<T extends UnitModel>(type: UnitType): Observable<T>;
|
|
35
|
+
/** An observable value that emits the id of the focused unit. */
|
|
27
36
|
focused$: Observable<Nullable<string>>;
|
|
37
|
+
/** Focus a unit. */
|
|
28
38
|
focusUnit(unitId: string | null): void;
|
|
29
39
|
getFocusedUnit(): Nullable<UnitModel>;
|
|
30
40
|
getCurrentUnitForType<T extends UnitModel>(type: UnitType): Nullable<T>;
|
|
31
41
|
setCurrentUnitForType(unitId: string): void;
|
|
32
42
|
getCurrentTypeOfUnit$<T extends UnitModel>(type: UnitType): Observable<Nullable<T>>;
|
|
33
43
|
/** Create a unit with snapshot info. */
|
|
34
|
-
createUnit<T, U extends UnitModel>(type: UnitType, data: Partial<T
|
|
44
|
+
createUnit<T, U extends UnitModel>(type: UnitType, data: Partial<T>, options?: ICreateUnitOptions): U;
|
|
35
45
|
/** Dispose a unit */
|
|
36
46
|
disposeUnit(unitId: string): boolean;
|
|
37
47
|
registerCtorForType<T extends UnitModel>(type: UnitType, ctor: new (...args: any[]) => T): IDisposable;
|
|
@@ -55,17 +65,16 @@ export declare class UniverInstanceService extends Disposable implements IUniver
|
|
|
55
65
|
constructor(_injector: Injector, _contextService: IContextService);
|
|
56
66
|
dispose(): void;
|
|
57
67
|
private _createHandler;
|
|
58
|
-
__setCreateHandler(handler: (type: UnitType, data: unknown, ctor:
|
|
59
|
-
createUnit<T, U extends UnitModel>(type: UnitType, data: T): U;
|
|
68
|
+
__setCreateHandler(handler: (type: UnitType, data: unknown, ctor: UnitCtor, options?: ICreateUnitOptions) => UnitModel): void;
|
|
69
|
+
createUnit<T, U extends UnitModel>(type: UnitType, data: T, options?: ICreateUnitOptions): U;
|
|
60
70
|
private readonly _ctorByType;
|
|
61
71
|
registerCtorForType<T extends UnitModel>(type: UnitType, ctor: new () => T): IDisposable;
|
|
62
72
|
private _currentUnits;
|
|
63
73
|
private readonly _currentUnits$;
|
|
64
74
|
readonly currentUnits$: Observable<Map<number, Nullable<UnitModel<object, number>>>>;
|
|
65
75
|
getCurrentTypeOfUnit$<T>(type: number): Observable<Nullable<T>>;
|
|
66
|
-
getCurrentUnitForType<T>(type: UnitType): Nullable<T>;
|
|
76
|
+
getCurrentUnitForType<T extends UnitModel>(type: UnitType): Nullable<T>;
|
|
67
77
|
setCurrentUnitForType(unitId: string): void;
|
|
68
|
-
private _removeCurrentUnitForType;
|
|
69
78
|
private readonly _unitAdded$;
|
|
70
79
|
readonly unitAdded$: Observable<UnitModel<object, number>>;
|
|
71
80
|
getTypeOfUnitAdded$<T extends UnitModel<object, number>>(type: UnitType): Observable<T>;
|
|
@@ -76,7 +85,7 @@ export declare class UniverInstanceService extends Disposable implements IUniver
|
|
|
76
85
|
*
|
|
77
86
|
* @param unit The unit to be added.
|
|
78
87
|
*/
|
|
79
|
-
__addUnit(unit: UnitModel): void;
|
|
88
|
+
__addUnit(unit: UnitModel, options?: ICreateUnitOptions): void;
|
|
80
89
|
private _unitDisposed$;
|
|
81
90
|
readonly unitDisposed$: Observable<UnitModel<object, number>>;
|
|
82
91
|
getTypeOfUnitDisposed$<T extends UnitModel<object, number>>(type: UniverInstanceType): Observable<T>;
|
|
@@ -93,5 +102,7 @@ export declare class UniverInstanceService extends Disposable implements IUniver
|
|
|
93
102
|
getFocusedUnit(): Nullable<UnitModel>;
|
|
94
103
|
getUnitType(unitId: string): UniverInstanceType;
|
|
95
104
|
disposeUnit(unitId: string): boolean;
|
|
105
|
+
private _tryRemoveCurrentUnitForType;
|
|
106
|
+
private _tryBlurUnitOnRemoval;
|
|
96
107
|
private _getUnitById;
|
|
97
108
|
}
|
|
@@ -3,7 +3,6 @@ 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';
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* This service controls the lifecycle of a Univer instance. Other modules can
|
|
9
8
|
* inject this service to read the current lifecycle stage or subscribe to
|
|
@@ -2,7 +2,6 @@ import { Subject } from 'rxjs';
|
|
|
2
2
|
import { Disposable } from '../../shared/lifecycle';
|
|
3
3
|
import { ILanguagePack, ILocales, LanguageValue } from '../../shared/locale';
|
|
4
4
|
import { LocaleType } from '../../types/enum/locale-type';
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* This service provides i18n and timezone / location features to other modules.
|
|
8
7
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
2
2
|
import { Disposable } from '../../shared';
|
|
3
3
|
import { IPermissionPoint, IPermissionService } from './type';
|
|
4
|
-
|
|
5
4
|
export declare class PermissionService extends Disposable implements IPermissionService {
|
|
6
5
|
private _permissionPointMap;
|
|
7
6
|
private _permissionPointUpdate$;
|
|
@@ -2,7 +2,6 @@ import { BehaviorSubject, Observable } from 'rxjs';
|
|
|
2
2
|
import { UnitAction, UnitObject } from '@univerjs/protocol';
|
|
3
3
|
import { Nullable } from '../../common/type-utils';
|
|
4
4
|
import { IRange } from '../../types/interfaces';
|
|
5
|
-
|
|
6
5
|
export declare enum PermissionStatus {
|
|
7
6
|
INIT = "init",
|
|
8
7
|
FETCHING = "fetching",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Dependency, DependencyIdentifier, DependencyItem } from '../../common/di';
|
|
2
|
-
|
|
3
2
|
export type NullableDependencyPair<T> = [DependencyIdentifier<T>, DependencyItem<T> | null];
|
|
4
3
|
/**
|
|
5
4
|
* Overrides the dependencies defined in the plugin. Only dependencies that are identified by `IdentifierDecorator` can be overridden.
|