@univerjs/core 1.0.0-rc.0 → 1.0.1
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/facade.js +96 -40
- package/lib/cjs/index.js +985 -362
- package/lib/es/facade.js +97 -41
- package/lib/es/index.js +979 -362
- package/lib/facade.js +97 -41
- package/lib/index.js +979 -362
- package/lib/types/docs/data-model/text-x/action-types.d.ts +19 -1
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply-utils/delete-apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply-utils/insert-apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/apply.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +2 -1
- package/lib/types/docs/data-model/text-x/custom-range-update.d.ts +30 -0
- package/lib/types/docs/data-model/text-x/structure-validator.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/text-x.d.ts +7 -3
- package/lib/types/docs/data-model/text-x/utils.d.ts +7 -1
- package/lib/types/docs/sdt-binding.d.ts +19 -0
- package/lib/types/facade/f-blob.d.ts +11 -11
- package/lib/types/facade/f-enum.d.ts +9 -1
- package/lib/types/facade/f-event-registry.d.ts +18 -6
- package/lib/types/facade/f-event.d.ts +4 -0
- package/lib/types/facade/f-univer.d.ts +43 -19
- package/lib/types/index.d.ts +2 -0
- package/lib/types/sheets/typedef.d.ts +38 -7
- package/lib/types/sheets/workbook.d.ts +1 -1
- package/lib/types/sheets/worksheet.d.ts +8 -7
- package/lib/types/types/enum/record-filter.d.ts +30 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +256 -9
- package/lib/types/types/interfaces/i-drawing.d.ts +9 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +26 -26
- package/package.json +7 -7
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
17
|
-
import type { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
17
|
+
import type { ICustomRange, IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
18
18
|
export declare const PRESERVE_INSERTED_PARAGRAPH_IDS = "__textXPreserveParagraphIds";
|
|
19
19
|
export declare enum TextXActionType {
|
|
20
20
|
RETAIN = "r",
|
|
@@ -30,6 +30,20 @@ export interface IRetainAction {
|
|
|
30
30
|
body?: IDocumentBody;
|
|
31
31
|
oldBody?: IDocumentBody;
|
|
32
32
|
coverType?: UpdateDocsAttributeType;
|
|
33
|
+
/**
|
|
34
|
+
* Identity edits applied after the text operation, with absolute result-document offsets.
|
|
35
|
+
* nextRangeId restores array order by identity (null means the end), including coincident SDT nesting.
|
|
36
|
+
* Collaboration peers must support this extension; legacy TextX implementations ignore it.
|
|
37
|
+
*/
|
|
38
|
+
rangeUpdates?: Array<{
|
|
39
|
+
rangeId: string;
|
|
40
|
+
range: ICustomRange | null;
|
|
41
|
+
nextRangeId?: string | null;
|
|
42
|
+
/** Only these property paths are written; missing values remove properties. Arrays are atomic. */
|
|
43
|
+
propertyPaths?: string[][];
|
|
44
|
+
}>;
|
|
45
|
+
/** Before-document values captured by makeInvertible; never persisted in a document body. */
|
|
46
|
+
oldRangeUpdates?: IRetainAction['rangeUpdates'];
|
|
33
47
|
}
|
|
34
48
|
/**
|
|
35
49
|
* Insert mutation is used to insert text (maybe with rich text properties) at the given position.
|
|
@@ -38,6 +52,8 @@ export interface IInsertAction {
|
|
|
38
52
|
t: TextXActionType.INSERT;
|
|
39
53
|
body: IDocumentBody;
|
|
40
54
|
len: number;
|
|
55
|
+
/** Scalar selection intent, not snapshot data. All collaboration peers must support this extension. */
|
|
56
|
+
valueRangeId?: string;
|
|
41
57
|
}
|
|
42
58
|
/**
|
|
43
59
|
* Delete mutation is used to delete text at the given position.
|
|
@@ -46,5 +62,7 @@ export interface IDeleteAction {
|
|
|
46
62
|
t: TextXActionType.DELETE;
|
|
47
63
|
len: number;
|
|
48
64
|
body?: IDocumentBody;
|
|
65
|
+
/** Preserved through inversion so undo participates in scalar conflict resolution. */
|
|
66
|
+
valueRangeId?: string;
|
|
49
67
|
}
|
|
50
68
|
export type TextXAction = IRetainAction | IInsertAction | IDeleteAction;
|
|
@@ -32,7 +32,7 @@ export declare function insertTextRuns(body: IDocumentBody, insertBody: IDocumen
|
|
|
32
32
|
* @param textLength The length of the inserted content text.
|
|
33
33
|
* @param currentIndex Determining the index where the content will be inserted into the current content.
|
|
34
34
|
*/
|
|
35
|
-
export declare function insertParagraphs(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number,
|
|
35
|
+
export declare function insertParagraphs(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number, isUpdate?: boolean, originalDataStream?: string): void;
|
|
36
36
|
export declare function normalizeInsertedParagraphIdsForDocument(paragraphs: IParagraph[] | undefined, insertParagraphs: IParagraph[] | undefined, currentIndex: number, options: {
|
|
37
37
|
freshenSplitParagraph: boolean;
|
|
38
38
|
preserveExplicitSplitParagraphIds?: boolean;
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IDocumentBody } from '../../../../types/interfaces';
|
|
16
|
+
import type { IDocumentBody } from '../../../../types/interfaces/i-document-data';
|
|
17
17
|
export declare function updateAttributeByDelete(body: IDocumentBody, textLength: number, currentIndex: number): IDocumentBody;
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IDocumentBody } from '../../../../types/interfaces';
|
|
16
|
+
import type { IDocumentBody } from '../../../../types/interfaces/i-document-data';
|
|
17
17
|
export declare function updateAttributeByInsert(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IDocumentBody } from '../../../types/interfaces';
|
|
16
|
+
import type { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
17
17
|
import type { TextXAction } from './action-types';
|
|
18
18
|
export declare function textXApply(doc: IDocumentBody, actions: TextXAction[]): IDocumentBody;
|
|
@@ -20,6 +20,7 @@ import type { CustomRangeType, IDocumentBody } from '../../../../types/interface
|
|
|
20
20
|
import type { DocumentDataModel } from '../../document-data-model';
|
|
21
21
|
import type { TextXAction } from '../action-types';
|
|
22
22
|
import type { TextXSelection } from '../text-x';
|
|
23
|
+
import { DocumentFlavor } from '../../../../types/interfaces/i-document-data';
|
|
23
24
|
import { TextX } from '../text-x';
|
|
24
25
|
export interface IDeleteCustomRangeParam {
|
|
25
26
|
rangeId: string;
|
|
@@ -40,7 +41,7 @@ export interface IAddCustomRangeTextXParam {
|
|
|
40
41
|
export declare function addCustomRangeTextX(param: IAddCustomRangeTextXParam): false | (TextX & {
|
|
41
42
|
selections?: ITextRange[];
|
|
42
43
|
});
|
|
43
|
-
export declare function deleteSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number, insertBody?: Nullable<IDocumentBody>, keepBullet?: boolean): Array<TextXAction>;
|
|
44
|
+
export declare function deleteSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number, insertBody?: Nullable<IDocumentBody>, keepBullet?: boolean, documentFlavor?: DocumentFlavor): Array<TextXAction>;
|
|
44
45
|
export declare function retainSelectionTextX(selections: ITextRange[], body: IDocumentBody, memoryCursor?: number): TextXAction[];
|
|
45
46
|
export interface IReplaceSelectionTextXParams {
|
|
46
47
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { ICustomRange, IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
17
|
+
import type { IRetainAction, TextXAction } from './action-types';
|
|
18
|
+
export declare function getChangedPropertyPaths(before: unknown, after: unknown, path?: string[]): string[][];
|
|
19
|
+
export declare function composeRangeUpdate(first: NonNullable<IRetainAction['rangeUpdates']>[number] | undefined, second: NonNullable<IRetainAction['rangeUpdates']>[number]): NonNullable<IRetainAction['rangeUpdates']>[number];
|
|
20
|
+
export declare function transformRangeUpdate(update: NonNullable<IRetainAction['rangeUpdates']>[number], concurrent: NonNullable<IRetainAction['rangeUpdates']>[number] | undefined, priority: 'left' | 'right'): NonNullable<IRetainAction['rangeUpdates']>;
|
|
21
|
+
export declare function getRangeUpdates(actions: TextXAction[]): NonNullable<IRetainAction['rangeUpdates']>;
|
|
22
|
+
export declare function withoutRangeUpdates(actions: TextXAction[]): TextXAction[];
|
|
23
|
+
export declare function appendRangeUpdates(actions: TextXAction[], updates: IRetainAction['rangeUpdates']): TextXAction[];
|
|
24
|
+
export declare function validateRangeUpdates(updates: IRetainAction['rangeUpdates'], resultLength: number): void;
|
|
25
|
+
export declare function applyRangeUpdates(doc: IDocumentBody, updates: IRetainAction['rangeUpdates']): void;
|
|
26
|
+
export declare function moveRangeUpdates(updates: NonNullable<IRetainAction['rangeUpdates']>, actions: TextXAction[], preserveProperties?: boolean): NonNullable<IRetainAction['rangeUpdates']>;
|
|
27
|
+
/** A concurrent metadata payload must not resurrect an explicitly removed identity. */
|
|
28
|
+
export declare function reconcileRangeUpdates(actions: TextXAction[], updates: IRetainAction['rangeUpdates']): TextXAction[];
|
|
29
|
+
/** Dropping a concurrent restoration also drops its delimiters, not its text. */
|
|
30
|
+
export declare function dropRemovedRangeAnchors(actions: TextXAction[], suppressed: ICustomRange[], updates: NonNullable<IRetainAction['rangeUpdates']>): TextXAction[];
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { IDocumentBody, IDocumentData } from '../../../types/interfaces/i-document-data';
|
|
17
|
-
export type DocStructureIssueCode = 'missing-note' | 'invalid-note-reference' | 'nested-note' | 'invalid-note-body' | 'invalid-note-id' | 'duplicate-note-reference' | 'missing-root-paragraph' | 'missing-root-section-break' | 'paragraph-token-mismatch' | 'duplicate-paragraph-metadata' | 'section-break-token-mismatch' | 'duplicate-section-break-metadata' | 'missing-section-id' | 'duplicate-section-id' | 'table-start-token-mismatch' | 'table-end-token-mismatch' | 'missing-table-metadata' | 'overlapping-table' | 'block-range-token-mismatch' | 'missing-block-range-metadata' | 'overlapping-block-range' | 'unbalanced-block' | 'column-group-range-token-mismatch' | 'missing-column-group-metadata' | 'overlapping-column-group' | 'column-group-column-count-mismatch' | 'custom-block-token-mismatch' | 'missing-custom-block-metadata' | 'duplicate-custom-block-metadata' | 'empty-column' | 'empty-table-cell' | 'unbalanced-column-group' | 'unbalanced-table';
|
|
17
|
+
export type DocStructureIssueCode = 'missing-note' | 'invalid-note-reference' | 'nested-note' | 'invalid-note-body' | 'invalid-note-id' | 'duplicate-note-reference' | 'missing-root-paragraph' | 'missing-root-section-break' | 'paragraph-token-mismatch' | 'duplicate-paragraph-metadata' | 'section-break-token-mismatch' | 'duplicate-section-break-metadata' | 'missing-section-id' | 'duplicate-section-id' | 'table-start-token-mismatch' | 'table-end-token-mismatch' | 'missing-table-metadata' | 'overlapping-table' | 'block-range-token-mismatch' | 'missing-block-range-metadata' | 'overlapping-block-range' | 'unbalanced-block' | 'column-group-range-token-mismatch' | 'missing-column-group-metadata' | 'overlapping-column-group' | 'column-group-column-count-mismatch' | 'custom-block-token-mismatch' | 'missing-custom-block-metadata' | 'duplicate-custom-block-metadata' | 'custom-range-token-mismatch' | 'missing-custom-range-metadata' | 'duplicate-custom-range-id' | 'crossing-custom-range' | 'unbalanced-custom-range' | 'empty-column' | 'empty-table-cell' | 'unbalanced-column-group' | 'unbalanced-table';
|
|
18
18
|
export interface IDocStructureIssue {
|
|
19
19
|
code: DocStructureIssueCode;
|
|
20
20
|
segmentType: 'body' | 'header' | 'footer' | 'note';
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { ITextRange } from '../../../sheets/typedef';
|
|
17
|
-
import type { IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
18
|
-
import type { TextXAction } from './action-types';
|
|
17
|
+
import type { ICustomRange, IDocumentBody } from '../../../types/interfaces/i-document-data';
|
|
18
|
+
import type { IRetainAction, TextXAction } from './action-types';
|
|
19
19
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
20
20
|
export type TPriority = 'left' | 'right';
|
|
21
21
|
export declare class TextX {
|
|
@@ -48,7 +48,7 @@ export declare class TextX {
|
|
|
48
48
|
* 2) If the other body property exists, then execute the TransformBody logic to override it
|
|
49
49
|
*/
|
|
50
50
|
static transform(thisActions: TextXAction[], otherActions: TextXAction[], priority?: TPriority): TextXAction[];
|
|
51
|
-
static _transform(thisActions: TextXAction[], otherActions: TextXAction[], priority?: TPriority): TextXAction[];
|
|
51
|
+
static _transform(thisActions: TextXAction[], otherActions: TextXAction[], priority?: TPriority, rangeAnchorAffinity?: boolean): TextXAction[];
|
|
52
52
|
/**
|
|
53
53
|
* Used to transform selection. Why not named transformSelection?
|
|
54
54
|
* Because Univer Doc supports multiple Selections in one document, user need to encapsulate transformSelections at the application layer.
|
|
@@ -58,6 +58,10 @@ export declare class TextX {
|
|
|
58
58
|
static invert(actions: TextXAction[]): TextXAction[];
|
|
59
59
|
static makeInvertible(actions: TextXAction[], doc: IDocumentBody): TextXAction[];
|
|
60
60
|
private _actions;
|
|
61
|
+
/** Edits only changed property leaves; does not replace range identity, bounds or peer properties. */
|
|
62
|
+
updateCustomRangeProperties(range: ICustomRange, properties: NonNullable<ICustomRange['properties']>): this;
|
|
63
|
+
/** Updates identities after all text edits; range positions refer to the resulting document. */
|
|
64
|
+
updateCustomRanges(updates: NonNullable<IRetainAction['rangeUpdates']>): this;
|
|
61
65
|
insert(len: number, body: IDocumentBody): this;
|
|
62
66
|
retain(len: number, body?: IDocumentBody, coverType?: UpdateDocsAttributeType): this;
|
|
63
67
|
delete(len: number): this;
|
|
@@ -17,6 +17,7 @@ import type { ICustomColumnGroup, ICustomDecoration, IDocumentBlockRange, IDocum
|
|
|
17
17
|
import type { DocumentDataModel } from '../../data-model';
|
|
18
18
|
import type { IRetainAction } from './action-types';
|
|
19
19
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
20
|
+
import { CustomRangeType } from '../../../types/interfaces/i-document-data';
|
|
20
21
|
export declare enum SliceBodyType {
|
|
21
22
|
copy = 0,
|
|
22
23
|
cut = 1
|
|
@@ -40,10 +41,13 @@ export declare function getParagraphsSlice(body: IDocumentBody, startOffset: num
|
|
|
40
41
|
styleId?: string;
|
|
41
42
|
paragraphStyle?: import("../../..").IParagraphStyle;
|
|
42
43
|
bullet?: import("../../..").IBullet;
|
|
44
|
+
sourceBullet?: import("../../..").IBullet | null;
|
|
45
|
+
directBullet?: import("../../..").IBullet | null;
|
|
43
46
|
}[] | undefined;
|
|
44
47
|
export declare function getSectionBreakSlice(body: IDocumentBody, startOffset: number, endOffset: number): {
|
|
45
48
|
startIndex: number;
|
|
46
49
|
sectionId: string;
|
|
50
|
+
pageBorders?: import("../../..").IPageBorders;
|
|
47
51
|
pageNumberStart?: number;
|
|
48
52
|
pageSize?: import("../../..").ISize;
|
|
49
53
|
pageOrient?: import("../../..").PageOrientType;
|
|
@@ -79,6 +83,8 @@ export declare function getCustomBlockSlice(body: IDocumentBody, startOffset: nu
|
|
|
79
83
|
startIndex: number;
|
|
80
84
|
blockType?: import("../../..").BlockType;
|
|
81
85
|
blockId: string;
|
|
86
|
+
noteType?: "footnote" | "endnote" | "separator" | "continuationSeparator";
|
|
87
|
+
noteId?: string;
|
|
82
88
|
docxRawXml?: string;
|
|
83
89
|
docxExportTs?: import("../../..").ITextStyle;
|
|
84
90
|
}[] | undefined;
|
|
@@ -95,7 +101,7 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
|
|
|
95
101
|
startIndex: number;
|
|
96
102
|
endIndex: number;
|
|
97
103
|
rangeId: string;
|
|
98
|
-
rangeType:
|
|
104
|
+
rangeType: CustomRangeType | number;
|
|
99
105
|
wholeEntity?: boolean;
|
|
100
106
|
properties?: Record<string, any> | undefined;
|
|
101
107
|
}[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
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
|
+
import type { IDocumentBody, ISdtCustomRange } from '../types/interfaces/i-document-data';
|
|
17
|
+
export declare function getSdtBindingKey(range: ISdtCustomRange): string | undefined;
|
|
18
|
+
/** Scalar XML values, independent of the control's display label or date format. */
|
|
19
|
+
export declare function getSdtBindingValue(body: IDocumentBody, range: ISdtCustomRange): string | undefined;
|
|
@@ -22,7 +22,7 @@ export interface IFBlobSource {
|
|
|
22
22
|
*/
|
|
23
23
|
getBlob(): FBlob;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Returns a copy labeled with the specified MIME type. The data bytes are not converted or re-encoded.
|
|
26
26
|
* @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
|
|
27
27
|
*/
|
|
28
28
|
getAs(contentType: string): FBlob;
|
|
@@ -46,9 +46,9 @@ export declare class FBlob extends FBase {
|
|
|
46
46
|
*/
|
|
47
47
|
copyBlob(): FBlob;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* Returns a copy labeled with the specified MIME type. The data bytes are not converted or re-encoded.
|
|
50
50
|
* @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
|
|
51
|
-
* @returns
|
|
51
|
+
* @returns {FBlob} A new facade containing the same data with the specified MIME type.
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts
|
|
54
54
|
* const blob = univerAPI.newBlob();
|
|
@@ -59,7 +59,7 @@ export declare class FBlob extends FBase {
|
|
|
59
59
|
getAs(contentType: string): FBlob;
|
|
60
60
|
/**
|
|
61
61
|
* Get the blob as a string.
|
|
62
|
-
* @returns
|
|
62
|
+
* @returns {Promise<string>} A promise resolving to decoded text; an unset blob returns an empty string.
|
|
63
63
|
* @example
|
|
64
64
|
* ```ts
|
|
65
65
|
* const blob = univerAPI.newBlob();
|
|
@@ -70,8 +70,8 @@ export declare class FBlob extends FBase {
|
|
|
70
70
|
getDataAsString(): Promise<string>;
|
|
71
71
|
/**
|
|
72
72
|
* Get the blob as a string.
|
|
73
|
-
* @param charset
|
|
74
|
-
* @returns
|
|
73
|
+
* @param {string} [charset] TextDecoder encoding label. Defaults to UTF-8.
|
|
74
|
+
* @returns {Promise<string>} A promise resolving to decoded text; an unset blob returns an empty string.
|
|
75
75
|
* @example
|
|
76
76
|
* ```ts
|
|
77
77
|
* const blob = univerAPI.newBlob();
|
|
@@ -82,10 +82,10 @@ export declare class FBlob extends FBase {
|
|
|
82
82
|
getDataAsString(charset?: string): Promise<string>;
|
|
83
83
|
/**
|
|
84
84
|
* Gets the data stored in this blob.
|
|
85
|
-
* @returns the
|
|
85
|
+
* @returns {Promise<Uint8Array>} A promise resolving to the bytes; rejects if no blob data is set.
|
|
86
86
|
* @example
|
|
87
87
|
* ```ts
|
|
88
|
-
* const blob = univerAPI.newBlob();
|
|
88
|
+
* const blob = univerAPI.newBlob().setDataFromString('Hello, World!');
|
|
89
89
|
* const bytes = await blob.getBytes();
|
|
90
90
|
* console.log(bytes);
|
|
91
91
|
* ```
|
|
@@ -117,7 +117,7 @@ export declare class FBlob extends FBase {
|
|
|
117
117
|
/**
|
|
118
118
|
* Sets the data stored in this blob.
|
|
119
119
|
* @param data a string
|
|
120
|
-
* @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
|
|
120
|
+
* @param [contentType] the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
|
|
121
121
|
* @returns the blob object
|
|
122
122
|
* @example
|
|
123
123
|
* ```ts
|
|
@@ -128,7 +128,7 @@ export declare class FBlob extends FBase {
|
|
|
128
128
|
setDataFromString(data: string, contentType?: string): FBlob;
|
|
129
129
|
/**
|
|
130
130
|
* Gets the content type of the data stored in this blob.
|
|
131
|
-
* @returns
|
|
131
|
+
* @returns {string | undefined} The MIME type, or `undefined` if no blob data is set.
|
|
132
132
|
* @example
|
|
133
133
|
* ```ts
|
|
134
134
|
* const blob = univerAPI.newBlob();
|
|
@@ -138,7 +138,7 @@ export declare class FBlob extends FBase {
|
|
|
138
138
|
*/
|
|
139
139
|
getContentType(): string | undefined;
|
|
140
140
|
/**
|
|
141
|
-
* Sets the
|
|
141
|
+
* Sets the MIME type without converting or re-encoding the data bytes. Has no effect when no blob data is set.
|
|
142
142
|
* @param contentType the content type refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types/Common_types
|
|
143
143
|
* @returns the blob object
|
|
144
144
|
* @example
|
|
@@ -13,15 +13,23 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, HorizontalAlign, ImageSourceType, InterpolationPointType, LifecycleStages, LocaleType, MentionType, NamedStyleType, NumberUnitType, PresetListType, ProtectionType, RelativeDate, SheetTypes, SpacingRule, TextDecoration, TextDirection, ThemeColorType, UniverInstanceType, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
16
|
+
import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, FormulaType, HorizontalAlign, ImageSourceType, InterpolationPointType, LifecycleStages, LocaleType, MentionType, NamedStyleType, NumberUnitType, PresetListType, ProtectionType, RelativeDate, SheetTypes, SpacingRule, TextDecoration, TextDirection, ThemeColorType, UniverInstanceType, VerticalAlign, WorksheetHiddenState, WrapStrategy } from '@univerjs/core';
|
|
17
17
|
/**
|
|
18
18
|
* @hideconstructor
|
|
19
19
|
*/
|
|
20
20
|
export declare class FEnum {
|
|
21
|
+
/** SpreadsheetML formula types. */
|
|
22
|
+
get FormulaType(): typeof FormulaType;
|
|
23
|
+
/** Worksheet hiding states: VISIBLE (0), HIDDEN (1), VERY_HIDDEN (2). */
|
|
24
|
+
get WorksheetHiddenState(): typeof WorksheetHiddenState;
|
|
21
25
|
/**
|
|
22
26
|
* @ignore
|
|
23
27
|
*/
|
|
24
28
|
static _instance: FEnum | null;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the shared registry of Facade enum values.
|
|
31
|
+
* @returns {FEnum} The registry also exposed by `univerAPI.Enum`.
|
|
32
|
+
*/
|
|
25
33
|
static get(): FEnum;
|
|
26
34
|
/**
|
|
27
35
|
* @ignore
|
|
@@ -22,14 +22,26 @@ export declare class FEventRegistry {
|
|
|
22
22
|
protected _eventHandlerMap: Map<string, Set<() => IDisposable | Subscription>>;
|
|
23
23
|
protected _eventHandlerRegisted: Map<string, Map<() => IDisposable | Subscription, IDisposable>>;
|
|
24
24
|
protected _ensureEventRegistry(event: string): Registry<(param: any) => void>;
|
|
25
|
+
/**
|
|
26
|
+
* Registers a factory for the underlying subscription that produces an event.
|
|
27
|
+
* The factory starts when the event has listeners; its subscription is disposed when the last listener is removed.
|
|
28
|
+
* @param {string} event The event name.
|
|
29
|
+
* @param {() => IDisposable | Subscription} handler Creates the underlying event subscription.
|
|
30
|
+
* @returns {IDisposable} Unregisters the factory and disposes its active subscription.
|
|
31
|
+
*/
|
|
25
32
|
registerEventHandler(event: string, handler: () => IDisposable | Subscription): IDisposable;
|
|
33
|
+
/**
|
|
34
|
+
* Removes one event listener and stops underlying subscriptions when no listeners remain.
|
|
35
|
+
* @param {T} event The event name.
|
|
36
|
+
* @param {(params: IEventParamConfig[T]) => void} callback The previously registered callback.
|
|
37
|
+
*/
|
|
26
38
|
removeEvent<T extends keyof IEventParamConfig>(event: T, callback: (params: IEventParamConfig[T]) => void): void;
|
|
27
39
|
private _initEventHandler;
|
|
28
40
|
/**
|
|
29
41
|
* Add an event listener
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {(params: IEventParamConfig[
|
|
32
|
-
* @returns {
|
|
42
|
+
* @param {T} event key of event
|
|
43
|
+
* @param {(params: IEventParamConfig[T]) => void} callback callback when event triggered
|
|
44
|
+
* @returns {IDisposable} A disposable that removes the event listener.
|
|
33
45
|
* @example
|
|
34
46
|
* ```ts
|
|
35
47
|
* univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
|
|
@@ -41,9 +53,9 @@ export declare class FEventRegistry {
|
|
|
41
53
|
addEvent<T extends keyof IEventParamConfig>(event: T, callback: (params: IEventParamConfig[T]) => void): IDisposable;
|
|
42
54
|
/**
|
|
43
55
|
* Fire an event, used in internal only.
|
|
44
|
-
* @param {
|
|
45
|
-
* @param {
|
|
46
|
-
* @returns {boolean}
|
|
56
|
+
* @param {T} event key of event
|
|
57
|
+
* @param {IEventParamConfig[T]} params params of event
|
|
58
|
+
* @returns {boolean | undefined} The event's `cancel` value after listeners run; `undefined` if it was not set.
|
|
47
59
|
* @example
|
|
48
60
|
* ```ts
|
|
49
61
|
* this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
|
|
@@ -84,6 +84,10 @@ export declare class FEventName {
|
|
|
84
84
|
* @ignore
|
|
85
85
|
*/
|
|
86
86
|
static _instance: FEventName | null;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the shared registry of Facade event names.
|
|
89
|
+
* @returns {FEventName} The registry also exposed by `univerAPI.Event`.
|
|
90
|
+
*/
|
|
87
91
|
static get(): FEventName;
|
|
88
92
|
/**
|
|
89
93
|
* @ignore
|
|
@@ -40,7 +40,7 @@ export declare class FUniver extends Disposable {
|
|
|
40
40
|
protected readonly _univerInstanceService: IUniverInstanceService;
|
|
41
41
|
protected readonly _lifecycleService: LifecycleService;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Creates a Facade API instance for an existing Univer instance or its injector.
|
|
44
44
|
* @static
|
|
45
45
|
* @param {Univer | Injector} wrapped - The Univer instance or injector instance.
|
|
46
46
|
* @returns {FUniver} - The FUniver instance.
|
|
@@ -63,14 +63,21 @@ export declare class FUniver extends Disposable {
|
|
|
63
63
|
prototype: object;
|
|
64
64
|
}): void;
|
|
65
65
|
protected _eventRegistry: FEventRegistry;
|
|
66
|
+
/**
|
|
67
|
+
* Registers a factory for the subscription that produces an event.
|
|
68
|
+
* The factory starts when listeners exist and its subscription is disposed when the last listener is removed.
|
|
69
|
+
* @param event The event name.
|
|
70
|
+
* @param handler Creates the underlying event subscription.
|
|
71
|
+
* @returns A disposable that unregisters the factory and disposes its active subscription.
|
|
72
|
+
*/
|
|
66
73
|
registerEventHandler: (event: string, handler: () => IDisposable | Subscription) => IDisposable;
|
|
67
74
|
constructor(_injector: Injector, _commandService: ICommandService, _univerInstanceService: IUniverInstanceService, _lifecycleService: LifecycleService);
|
|
68
75
|
private _initCommandEvent;
|
|
69
76
|
private _initBeforeCommandEvent;
|
|
70
77
|
private _initUnitEvent;
|
|
71
78
|
/**
|
|
72
|
-
*
|
|
73
|
-
* @param unitId The
|
|
79
|
+
* Disposes the document, workbook, or other Univer unit identified by `unitId`, unloading it from the application.
|
|
80
|
+
* @param unitId The ID of the unit to dispose.
|
|
74
81
|
* @returns Whether the Univer instance is disposed successfully.
|
|
75
82
|
*
|
|
76
83
|
* @example
|
|
@@ -233,9 +240,9 @@ export declare class FUniver extends Disposable {
|
|
|
233
240
|
/**
|
|
234
241
|
* Execute a command with the given id and parameters.
|
|
235
242
|
* @param id Identifier of the command.
|
|
236
|
-
* @param params Parameters of this execution.
|
|
237
|
-
* @param options Options of this execution.
|
|
238
|
-
* @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
|
|
243
|
+
* @param [params] Parameters of this execution.
|
|
244
|
+
* @param [options] Options of this execution.
|
|
245
|
+
* @returns {Promise<R>} The result of the execution. It is a boolean value by default which indicates the command is executed.
|
|
239
246
|
*
|
|
240
247
|
* @example
|
|
241
248
|
* ```ts
|
|
@@ -249,8 +256,8 @@ export declare class FUniver extends Disposable {
|
|
|
249
256
|
/**
|
|
250
257
|
* Execute a command with the given id and parameters synchronously.
|
|
251
258
|
* @param id Identifier of the command.
|
|
252
|
-
* @param params Parameters of this execution.
|
|
253
|
-
* @param options Options of this execution.
|
|
259
|
+
* @param [params] Parameters of this execution.
|
|
260
|
+
* @param [options] Options of this execution.
|
|
254
261
|
* @returns The result of the execution. It is a boolean value by default which indicates the command is executed.
|
|
255
262
|
*
|
|
256
263
|
* @example
|
|
@@ -262,14 +269,23 @@ export declare class FUniver extends Disposable {
|
|
|
262
269
|
* ```
|
|
263
270
|
*/
|
|
264
271
|
syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): R;
|
|
272
|
+
/**
|
|
273
|
+
* Enums exposed by the registered Facade extensions.
|
|
274
|
+
*/
|
|
265
275
|
get Enum(): FEnum;
|
|
276
|
+
/**
|
|
277
|
+
* Event names to use with `addEvent`.
|
|
278
|
+
*/
|
|
266
279
|
get Event(): FEventName;
|
|
280
|
+
/**
|
|
281
|
+
* Utility functions exposed by the registered Facade extensions.
|
|
282
|
+
*/
|
|
267
283
|
get Util(): FUtil;
|
|
268
284
|
/**
|
|
269
285
|
* Add an event listener
|
|
270
|
-
* @param {
|
|
271
|
-
* @param {(params: IEventParamConfig[
|
|
272
|
-
* @returns {
|
|
286
|
+
* @param {T} event key of event
|
|
287
|
+
* @param {(params: IEventParamConfig[T]) => void} callback callback when event triggered
|
|
288
|
+
* @returns {IDisposable} A disposable that removes the event listener.
|
|
273
289
|
* @example
|
|
274
290
|
* ```ts
|
|
275
291
|
* // Add life cycle changed event listener
|
|
@@ -284,15 +300,23 @@ export declare class FUniver extends Disposable {
|
|
|
284
300
|
addEvent<T extends keyof IEventParamConfig>(event: T, callback: (params: IEventParamConfig[T]) => void): IDisposable;
|
|
285
301
|
/**
|
|
286
302
|
* Fire an event, used in internal only.
|
|
287
|
-
* @param {
|
|
288
|
-
* @param {
|
|
289
|
-
* @returns {boolean}
|
|
303
|
+
* @param {T} event key of event
|
|
304
|
+
* @param {IEventParamConfig[T]} params params of event
|
|
305
|
+
* @returns {boolean | undefined} The event's `cancel` value after listeners run; `undefined` if it was not set.
|
|
290
306
|
* @example
|
|
291
307
|
* ```ts
|
|
292
308
|
* this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
|
|
293
309
|
* ```
|
|
294
310
|
*/
|
|
295
311
|
fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* Gets the facade for reading the current user.
|
|
314
|
+
* @returns {FUserManager} The user manager facade.
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* const user = univerAPI.getUserManager().getCurrentUser();
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
296
320
|
getUserManager(): FUserManager;
|
|
297
321
|
/**
|
|
298
322
|
* Create a new blob.
|
|
@@ -343,14 +367,14 @@ export declare class FUniver extends Disposable {
|
|
|
343
367
|
* This is an advanced document-model API. Application and agent code should normally use
|
|
344
368
|
* `newRichText().paragraph({ ... })`.
|
|
345
369
|
*
|
|
346
|
-
* @param {IParagraphStyle} style The paragraph style
|
|
370
|
+
* @param {IParagraphStyle} [style] The paragraph style
|
|
347
371
|
* @returns {ParagraphStyleBuilder} The new paragraph style instance
|
|
348
372
|
* @advanced
|
|
349
373
|
*/
|
|
350
374
|
newParagraphStyle(style?: IParagraphStyle): ParagraphStyleBuilder;
|
|
351
375
|
/**
|
|
352
376
|
* Create a new paragraph style value.
|
|
353
|
-
* @param {IParagraphStyle} style - The paragraph style
|
|
377
|
+
* @param {IParagraphStyle} [style] - The paragraph style
|
|
354
378
|
* @returns {ParagraphStyleValue} The new paragraph style value instance
|
|
355
379
|
* @example
|
|
356
380
|
* ```ts
|
|
@@ -360,7 +384,7 @@ export declare class FUniver extends Disposable {
|
|
|
360
384
|
newParagraphStyleValue(style?: IParagraphStyle): ParagraphStyleValue;
|
|
361
385
|
/**
|
|
362
386
|
* Create a new text style.
|
|
363
|
-
* @param {ITextStyle} style - The text style
|
|
387
|
+
* @param {ITextStyle} [style] - The text style
|
|
364
388
|
* @returns {TextStyleBuilder} The new text style instance
|
|
365
389
|
* @example
|
|
366
390
|
* ```ts
|
|
@@ -370,7 +394,7 @@ export declare class FUniver extends Disposable {
|
|
|
370
394
|
newTextStyle(style?: ITextStyle): TextStyleBuilder;
|
|
371
395
|
/**
|
|
372
396
|
* Create a new text style value.
|
|
373
|
-
* @param {ITextStyle} style - The text style
|
|
397
|
+
* @param {ITextStyle} [style] - The text style
|
|
374
398
|
* @returns {TextStyleValue} The new text style value instance
|
|
375
399
|
* @example
|
|
376
400
|
* ```ts
|
|
@@ -380,7 +404,7 @@ export declare class FUniver extends Disposable {
|
|
|
380
404
|
newTextStyleValue(style?: ITextStyle): TextStyleValue;
|
|
381
405
|
/**
|
|
382
406
|
* Create a new text decoration.
|
|
383
|
-
* @param {ITextDecoration} decoration - The text decoration
|
|
407
|
+
* @param {ITextDecoration} [decoration] - The text decoration
|
|
384
408
|
* @returns {TextDecorationBuilder} The new text decoration instance
|
|
385
409
|
* @example
|
|
386
410
|
* ```ts
|
package/lib/types/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export { mergeSets } from './common/set';
|
|
|
42
42
|
export { UnitModel, UniverInstanceType } from './common/unit';
|
|
43
43
|
export { isSafeUrl, normalizeUrl, resolveWithBasePath } from './common/url';
|
|
44
44
|
export * from './docs';
|
|
45
|
+
export { getSdtBindingKey, getSdtBindingValue } from './docs/sdt-binding';
|
|
45
46
|
export { EventState, EventSubject, fromEventSubject } from './observer/observable';
|
|
46
47
|
export type { IEventObserver } from './observer/observable';
|
|
47
48
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
@@ -115,6 +116,7 @@ export { DataValidationOperator } from './types/enum/data-validation-operator';
|
|
|
115
116
|
export { DataValidationRenderMode } from './types/enum/data-validation-render-mode';
|
|
116
117
|
export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
117
118
|
export { DataValidationType } from './types/enum/data-validation-type';
|
|
119
|
+
export { FilterSelectionMode, RecordValueType } from './types/enum/record-filter';
|
|
118
120
|
export * from './types/interfaces';
|
|
119
121
|
export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
|
|
120
122
|
export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule, } from './types/interfaces/i-data-validation';
|