@univerjs/core 0.24.0 → 0.25.0-insiders.20260608-e4336f7
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 +39 -9
- package/lib/cjs/index.js +2916 -2279
- package/lib/es/facade.js +39 -9
- package/lib/es/index.js +2904 -2280
- package/lib/facade.js +39 -9
- package/lib/index.js +2904 -2280
- package/lib/types/base/base-data-model.d.ts +33 -0
- package/lib/types/{shared/coder.d.ts → base/base-performance.d.ts} +4 -2
- package/lib/types/base/index.d.ts +17 -0
- package/lib/types/base/typedef.d.ts +642 -0
- package/lib/types/common/url.d.ts +1 -0
- package/lib/types/docs/data-model/text-x/apply-utils/common.d.ts +3 -1
- package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +0 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +5 -2
- package/lib/types/docs/data-model/types.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +29 -3
- package/lib/types/index.d.ts +3 -2
- package/lib/types/services/resource-manager/resource-manager.service.d.ts +4 -3
- package/lib/types/services/resource-manager/type.d.ts +3 -2
- package/lib/types/shared/index.d.ts +1 -1
- package/lib/types/shared/numfmt.d.ts +2 -1
- package/lib/types/shared/tools.d.ts +5 -0
- package/lib/types/sheets/typedef.d.ts +20 -5
- package/lib/types/types/const/const.d.ts +3 -0
- package/lib/types/types/const/page-size.d.ts +7 -0
- package/lib/types/types/enum/locale-type.d.ts +8 -1
- package/lib/types/types/interfaces/i-document-data.d.ts +50 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +10 -9
- package/package.json +6 -6
- package/LICENSE +0 -176
|
@@ -22,4 +22,5 @@ export declare function normalizeUrl(urlStr: string): string;
|
|
|
22
22
|
* @param {string} baseURL - The base URL to use for resolution.
|
|
23
23
|
* @returns {string} - The resolved URL.
|
|
24
24
|
*/
|
|
25
|
+
export declare function isSafeUrl(url: string): boolean;
|
|
25
26
|
export declare function resolveWithBasePath(url: string, baseURL: string): string;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICustomBlock, ICustomDecoration, ICustomRange, ICustomTable, IDocumentBody, IParagraph, ISectionBreak, ITextRun } from '../../../../types/interfaces';
|
|
16
|
+
import type { ICustomBlock, ICustomDecoration, ICustomRange, ICustomTable, IDocumentBlockRange, IDocumentBody, IParagraph, ISectionBreak, ITextRun } from '../../../../types/interfaces';
|
|
17
17
|
export declare function normalizeTextRuns(textRuns: ITextRun[], reserveEmptyTextRun?: boolean): ITextRun[];
|
|
18
18
|
/**
|
|
19
19
|
* Inserting styled text content into the current document model.
|
|
@@ -35,6 +35,7 @@ export declare function insertParagraphs(body: IDocumentBody, insertBody: IDocum
|
|
|
35
35
|
export declare function insertSectionBreaks(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
36
36
|
export declare function insertCustomBlocks(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
37
37
|
export declare function insertTables(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
38
|
+
export declare function insertBlockRanges(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number): void;
|
|
38
39
|
export declare function sliceByParagraph(body: IDocumentBody): IDocumentBody[];
|
|
39
40
|
export declare function mergeContinuousRanges(ranges: ICustomRange[]): ICustomRange[];
|
|
40
41
|
export declare function splitCustomRangesByIndex(customRanges: ICustomRange[], currentIndex: number): void;
|
|
@@ -49,4 +50,5 @@ export declare function deleteSectionBreaks(body: IDocumentBody, textLength: num
|
|
|
49
50
|
export declare function deleteCustomBlocks(body: IDocumentBody, textLength: number, currentIndex: number): ICustomBlock[];
|
|
50
51
|
export declare function deleteTables(body: IDocumentBody, textLength: number, currentIndex: number): ICustomTable[];
|
|
51
52
|
export declare function deleteCustomRanges(body: IDocumentBody, textLength: number, currentIndex: number): ICustomRange<Record<string, any>>[];
|
|
53
|
+
export declare function deleteBlockRanges(body: IDocumentBody, textLength: number, currentIndex: number): IDocumentBlockRange[];
|
|
52
54
|
export declare function deleteCustomDecorations(body: IDocumentBody, textLength: number, currentIndex: number, needOffset?: boolean): ICustomDecoration[];
|
|
@@ -23,5 +23,4 @@ export interface IAddDrawingParam {
|
|
|
23
23
|
drawings: any[];
|
|
24
24
|
}
|
|
25
25
|
export declare function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[];
|
|
26
|
-
export declare function getRichTextEditPath(docDataModel: DocumentDataModel, segmentId?: string): string[];
|
|
27
26
|
export declare const addDrawing: (param: IAddDrawingParam) => false | JSONXActions;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ICustomDecoration, IDocumentBody, ITextRun } from '../../../types/interfaces/i-document-data';
|
|
16
|
+
import type { ICustomDecoration, IDocumentBlockRange, IDocumentBody, ITextRun } from '../../../types/interfaces/i-document-data';
|
|
17
|
+
import type { DocumentDataModel } from '../../data-model';
|
|
17
18
|
import type { IRetainAction } from './action-types';
|
|
18
19
|
import { UpdateDocsAttributeType } from '../../../shared/command-enum';
|
|
19
20
|
export declare enum SliceBodyType {
|
|
@@ -26,7 +27,8 @@ export declare function getTableSlice(body: IDocumentBody, startOffset: number,
|
|
|
26
27
|
endIndex: number;
|
|
27
28
|
tableId: string;
|
|
28
29
|
}[];
|
|
29
|
-
export declare function
|
|
30
|
+
export declare function getBlockRangeSlice(body: IDocumentBody, startOffset: number, endOffset: number): IDocumentBlockRange[];
|
|
31
|
+
export declare function getParagraphsSlice(body: IDocumentBody, startOffset: number, endOffset: number, type?: SliceBodyType): {
|
|
30
32
|
startIndex: number;
|
|
31
33
|
paragraphStyle?: import("../../..").IParagraphStyle;
|
|
32
34
|
bullet?: import("../../..").IBullet;
|
|
@@ -88,3 +90,4 @@ export declare function getCustomRangeSlice(body: IDocumentBody, startOffset: nu
|
|
|
88
90
|
export declare function getCustomDecorationSlice(body: IDocumentBody, startOffset: number, endOffset: number): ICustomDecoration[] | undefined;
|
|
89
91
|
export declare function composeBody(thisBody: IDocumentBody, otherBody: IDocumentBody, coverType?: UpdateDocsAttributeType): IDocumentBody;
|
|
90
92
|
export declare function isUselessRetainAction(action: IRetainAction): boolean;
|
|
93
|
+
export declare function getRichTextEditPath(docDataModel: DocumentDataModel, segmentId?: string): string[];
|
|
@@ -19,6 +19,7 @@ export declare enum DataStreamTreeNodeType {
|
|
|
19
19
|
TABLE = "TABLE",
|
|
20
20
|
TABLE_ROW = "TABLE_ROW",
|
|
21
21
|
TABLE_CELL = "TABLE_CELL",
|
|
22
|
+
BLOCK = "BLOCK",
|
|
22
23
|
CUSTOM_BLOCK = "CUSTOM_BLOCK"
|
|
23
24
|
}
|
|
24
25
|
export declare enum DataStreamTreeTokenType {
|
|
@@ -30,6 +31,8 @@ export declare enum DataStreamTreeTokenType {
|
|
|
30
31
|
TABLE_CELL_END = "\u001D",// table cell end
|
|
31
32
|
TABLE_ROW_END = "\u000E",// table row end
|
|
32
33
|
TABLE_END = "\u000F",// table end
|
|
34
|
+
BLOCK_START = "\u0010",// block start
|
|
35
|
+
BLOCK_END = "\u0011",// block end
|
|
33
36
|
/**
|
|
34
37
|
* @deprecated
|
|
35
38
|
*/
|
|
@@ -144,6 +144,26 @@ export declare class FUniver extends Disposable {
|
|
|
144
144
|
* ```
|
|
145
145
|
*/
|
|
146
146
|
setLocale(locale: string): void;
|
|
147
|
+
/**
|
|
148
|
+
* Get the current locale.
|
|
149
|
+
* @returns {string} The current locale identifier.
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* const currentLocale = univerAPI.getCurrentLocale();
|
|
153
|
+
* console.log(currentLocale);
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
getCurrentLocale(): string;
|
|
157
|
+
/**
|
|
158
|
+
* Get the locales for the current locale.
|
|
159
|
+
* @returns {ILanguagePack | undefined} The locales object for the current locale, it returns undefined if the locales is not loaded.
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const locales = univerAPI.getLocales();
|
|
163
|
+
* console.log(locales);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
getLocales(): ILanguagePack | undefined;
|
|
147
167
|
/**
|
|
148
168
|
* Register a callback that will be triggered before invoking a command.
|
|
149
169
|
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {})` instead.
|
|
@@ -244,7 +264,9 @@ export declare class FUniver extends Disposable {
|
|
|
244
264
|
* @example
|
|
245
265
|
* ```ts
|
|
246
266
|
* const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
|
|
247
|
-
* const
|
|
267
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
268
|
+
* if (!fWorksheet) return;
|
|
269
|
+
* const range = fWorksheet.getRange('A1');
|
|
248
270
|
* range.setRichTextValueForCell(richText);
|
|
249
271
|
* ```
|
|
250
272
|
*/
|
|
@@ -256,7 +278,9 @@ export declare class FUniver extends Disposable {
|
|
|
256
278
|
* @example
|
|
257
279
|
* ```ts
|
|
258
280
|
* const richTextValue = univerAPI.newRichTextValue({ body: { dataStream: 'Hello World\r\n' } });
|
|
259
|
-
* const
|
|
281
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
282
|
+
* if (!fWorksheet) return;
|
|
283
|
+
* const range = fWorksheet.getRange('A1');
|
|
260
284
|
* range.setRichTextValueForCell(richTextValue);
|
|
261
285
|
* ```
|
|
262
286
|
*/
|
|
@@ -270,7 +294,9 @@ export declare class FUniver extends Disposable {
|
|
|
270
294
|
* const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
|
|
271
295
|
* const paragraphStyle = univerAPI.newParagraphStyle({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
|
|
272
296
|
* richText.insertParagraph(paragraphStyle);
|
|
273
|
-
* const
|
|
297
|
+
* const fWorksheet = univerAPI.getActiveWorkbook().getSheetByName('Sheet1');
|
|
298
|
+
* if (!fWorksheet) return;
|
|
299
|
+
* const range = fWorksheet.getRange('A1');
|
|
274
300
|
* range.setRichTextValueForCell(richText);
|
|
275
301
|
* ```
|
|
276
302
|
*/
|
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 * from './base';
|
|
16
17
|
export { dedupe, dedupeBy, groupBy, makeArray, remove, rotate } from './common/array';
|
|
17
18
|
export * from './common/async';
|
|
18
19
|
export { isBooleanString } from './common/boolean';
|
|
@@ -36,7 +37,7 @@ export { requestImmediateMacroTask } from './common/request-immediate-macro-task
|
|
|
36
37
|
export { type ISequenceExecuteResult, sequence, sequenceAsync } from './common/sequence';
|
|
37
38
|
export { mergeSets } from './common/set';
|
|
38
39
|
export { UnitModel, UniverInstanceType } from './common/unit';
|
|
39
|
-
export { resolveWithBasePath } from './common/url';
|
|
40
|
+
export { isSafeUrl, normalizeUrl, resolveWithBasePath } from './common/url';
|
|
40
41
|
export * from './docs/data-model';
|
|
41
42
|
export { JSON1, JSONX } from './docs/data-model/json-x/json-x';
|
|
42
43
|
export type { JSONXActions, JSONXPath } from './docs/data-model/json-x/json-x';
|
|
@@ -51,7 +52,7 @@ export { updateAttributeByInsert } from './docs/data-model/text-x/apply-utils/in
|
|
|
51
52
|
export { getPlainText } from './docs/data-model/text-x/build-utils/parse';
|
|
52
53
|
export { TextX } from './docs/data-model/text-x/text-x';
|
|
53
54
|
export type { TPriority } from './docs/data-model/text-x/text-x';
|
|
54
|
-
export { composeBody, getBodySlice, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getParagraphsSlice, getSectionBreakSlice, getTableSlice, getTextRunSlice, normalizeBody, SliceBodyType, } from './docs/data-model/text-x/utils';
|
|
55
|
+
export { composeBody, getBodySlice, getCustomBlockSlice, getCustomDecorationSlice, getCustomRangeSlice, getParagraphsSlice, getRichTextEditPath, getSectionBreakSlice, getTableSlice, getTextRunSlice, normalizeBody, SliceBodyType, } from './docs/data-model/text-x/utils';
|
|
55
56
|
export { EventState, EventSubject, fromEventSubject, type IEventObserver } from './observer/observable';
|
|
56
57
|
export { AuthzIoLocalService } from './services/authz-io/authz-io-local.service';
|
|
57
58
|
export { IAuthzIoService } from './services/authz-io/type';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { UniverInstanceType } from '../../common/unit';
|
|
17
|
-
import type { IResourceHook, IResourceManagerService, IResourceName, IResources } from './type';
|
|
17
|
+
import type { IResourceHook, IResourceManagerService, IResourceName, IResources, IResourceSnapshot } from './type';
|
|
18
18
|
import { Disposable } from '../../shared/lifecycle';
|
|
19
19
|
import { ILogService } from '../log/log.service';
|
|
20
20
|
export declare class ResourceManagerService extends Disposable implements IResourceManagerService {
|
|
@@ -27,12 +27,13 @@ export declare class ResourceManagerService extends Disposable implements IResou
|
|
|
27
27
|
getResources(unitId: string): IResources;
|
|
28
28
|
getResources(unitId: string, type: UniverInstanceType): IResources;
|
|
29
29
|
getResourcesByType(unitId: string, type: UniverInstanceType): {
|
|
30
|
-
name: `SHEET_${string}_PLUGIN` | `DOC_${string}_PLUGIN`;
|
|
30
|
+
name: `SHEET_${string}_PLUGIN` | `DOC_${string}_PLUGIN` | `SLIDE_${string}_PLUGIN`;
|
|
31
31
|
data: string;
|
|
32
32
|
}[];
|
|
33
33
|
registerPluginResource<T = unknown>(hook: IResourceHook<T>): import("@wendellhu/redi").IDisposable;
|
|
34
34
|
disposePluginResource(pluginName: IResourceName): void;
|
|
35
|
-
loadResources(unitId: string, resources?:
|
|
35
|
+
loadResources(unitId: string, resources?: IResourceSnapshot): void;
|
|
36
36
|
unloadResources(unitId: string, type: UniverInstanceType): void;
|
|
37
|
+
private _getResourceData;
|
|
37
38
|
dispose(): void;
|
|
38
39
|
}
|
|
@@ -21,7 +21,8 @@ export type IResources = Array<{
|
|
|
21
21
|
name: string;
|
|
22
22
|
data: string;
|
|
23
23
|
}>;
|
|
24
|
-
type
|
|
24
|
+
export type IResourceSnapshot = IResources | Record<string, unknown>;
|
|
25
|
+
type IBusinessName = 'SHEET' | 'DOC' | 'SLIDE';
|
|
25
26
|
export type IResourceName = `${IBusinessName}_${string}_PLUGIN`;
|
|
26
27
|
export interface IResourceHook<T = any> {
|
|
27
28
|
pluginName: IResourceName;
|
|
@@ -38,7 +39,7 @@ export interface IResourceManagerService {
|
|
|
38
39
|
getAllResourceHooks: () => IResourceHook[];
|
|
39
40
|
getResources(unitId: string, type: UniverInstanceType): IResources;
|
|
40
41
|
getResourcesByType: (unitId: string, type: UniverInstanceType) => IResources;
|
|
41
|
-
loadResources: (unitId: string, resources?:
|
|
42
|
+
loadResources: (unitId: string, resources?: IResourceSnapshot) => void;
|
|
42
43
|
unloadResources(unitId: string, type: UniverInstanceType): void;
|
|
43
44
|
}
|
|
44
45
|
export declare const IResourceManagerService: import("@wendellhu/redi").IdentifierDecorator<IResourceManagerService>;
|
|
@@ -32,7 +32,7 @@ export * from './locale';
|
|
|
32
32
|
export { LRUHelper, LRUMap } from './lru/lru-map';
|
|
33
33
|
export * from './max-row-column';
|
|
34
34
|
export type { INumfmtLocaleTag } from './numfmt';
|
|
35
|
-
export { DEFAULT_NUMBER_FORMAT, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, getNumfmtParseValueFilter, isDefaultFormat, isPatternEqualWithoutDecimal, isTextFormat, numfmt, } from './numfmt';
|
|
35
|
+
export { currencySymbols, DEFAULT_NUMBER_FORMAT, DEFAULT_TEXT_FORMAT, DEFAULT_TEXT_FORMAT_EXCEL, getNumfmtParseValueFilter, isDefaultFormat, isPatternEqualWithoutDecimal, isTextFormat, numfmt, } from './numfmt';
|
|
36
36
|
export * from './object-matrix';
|
|
37
37
|
export { queryObjectMatrix } from './object-matrix-query';
|
|
38
38
|
export { moveRangeByOffset, splitIntoGrid } from './range';
|
|
@@ -20,13 +20,14 @@ export declare const DEFAULT_TEXT_FORMAT_EXCEL = "@";
|
|
|
20
20
|
export declare const DEFAULT_NUMBER_FORMAT = "General";
|
|
21
21
|
export declare function isTextFormat(pattern: string | undefined): pattern is "@@@" | "@";
|
|
22
22
|
export declare function isDefaultFormat(pattern?: string | null): pattern is "General" | null | undefined;
|
|
23
|
-
export type INumfmtLocaleTag = 'zh-CN' | 'zh-TW' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr' | 'vi';
|
|
23
|
+
export type INumfmtLocaleTag = 'zh-CN' | 'zh-TW' | 'zh-HK' | 'ar' | 'cs' | 'da' | 'nl' | 'en' | 'fi' | 'fr' | 'de' | 'el' | 'hu' | 'is' | 'id' | 'it' | 'ja' | 'ko' | 'nb' | 'pl' | 'pt' | 'ru' | 'sk' | 'es' | 'sv' | 'th' | 'tr' | 'vi';
|
|
24
24
|
/**
|
|
25
25
|
* Determines whether two patterns are equal, excluding differences in decimal places.
|
|
26
26
|
* This function ignores the decimal part of the patterns and the positive color will be ignored but negative color will be considered.
|
|
27
27
|
* more info can check the test case.
|
|
28
28
|
*/
|
|
29
29
|
export declare const isPatternEqualWithoutDecimal: (patternA: string, patternB: string) => boolean;
|
|
30
|
+
export declare const currencySymbols: string[];
|
|
30
31
|
/**
|
|
31
32
|
* Get the numfmt parse value, and filter out the parse error.
|
|
32
33
|
*/
|
|
@@ -92,3 +92,8 @@ export declare const isNodeEnv: () => boolean;
|
|
|
92
92
|
* @returns {RegExp} The generated regular expression
|
|
93
93
|
*/
|
|
94
94
|
export declare function createREGEXFromWildChar(wildChar: string): RegExp;
|
|
95
|
+
/**
|
|
96
|
+
* Escapes characters that have special meaning in a regular expression so the
|
|
97
|
+
* returned string can be safely embedded in a RegExp pattern as literal text.
|
|
98
|
+
*/
|
|
99
|
+
export declare function escapeRegExp(str: string): string;
|
|
@@ -67,7 +67,10 @@ export interface IWorkbookData {
|
|
|
67
67
|
*/
|
|
68
68
|
resources?: IResources;
|
|
69
69
|
/**
|
|
70
|
-
* User stored custom fields
|
|
70
|
+
* User stored custom fields.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* This field is not recommended for external use. Use it at your own risk.
|
|
71
74
|
*/
|
|
72
75
|
custom?: CustomData;
|
|
73
76
|
}
|
|
@@ -127,7 +130,10 @@ export interface IWorksheetData {
|
|
|
127
130
|
gridlinesColor?: string;
|
|
128
131
|
rightToLeft: BooleanNumber;
|
|
129
132
|
/**
|
|
130
|
-
* User stored custom fields
|
|
133
|
+
* User stored custom fields.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* This field is not recommended for external use. Use it at your own risk.
|
|
131
137
|
*/
|
|
132
138
|
custom?: CustomData;
|
|
133
139
|
}
|
|
@@ -157,7 +163,10 @@ export interface IRowData {
|
|
|
157
163
|
*/
|
|
158
164
|
s?: Nullable<IStyleData | string>;
|
|
159
165
|
/**
|
|
160
|
-
* User stored custom fields
|
|
166
|
+
* User stored custom fields.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* This field is not recommended for external use. Use it at your own risk.
|
|
161
170
|
*/
|
|
162
171
|
custom?: CustomData;
|
|
163
172
|
}
|
|
@@ -182,7 +191,10 @@ export interface IColumnData {
|
|
|
182
191
|
*/
|
|
183
192
|
s?: Nullable<IStyleData | string>;
|
|
184
193
|
/**
|
|
185
|
-
* User stored custom fields
|
|
194
|
+
* User stored custom fields.
|
|
195
|
+
*
|
|
196
|
+
* @remarks
|
|
197
|
+
* This field is not recommended for external use. Use it at your own risk.
|
|
186
198
|
*/
|
|
187
199
|
custom?: CustomData;
|
|
188
200
|
}
|
|
@@ -229,7 +241,10 @@ export interface ICellData {
|
|
|
229
241
|
*/
|
|
230
242
|
si?: Nullable<string>;
|
|
231
243
|
/**
|
|
232
|
-
* User stored custom fields
|
|
244
|
+
* User stored custom fields.
|
|
245
|
+
*
|
|
246
|
+
* @remarks
|
|
247
|
+
* This field is not recommended for external use. Use it at your own risk.
|
|
233
248
|
*/
|
|
234
249
|
custom?: CustomData;
|
|
235
250
|
}
|
|
@@ -157,6 +157,9 @@ export declare const DEFAULT_STYLES: {
|
|
|
157
157
|
};
|
|
158
158
|
export declare const SHEET_EDITOR_UNITS: string[];
|
|
159
159
|
export declare const NAMED_STYLE_MAP: Record<NamedStyleType, Nullable<ITextStyle>>;
|
|
160
|
+
export declare const DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING = 1.5;
|
|
161
|
+
export declare const DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE = 0;
|
|
162
|
+
export declare const DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW = 8;
|
|
160
163
|
export declare const NAMED_STYLE_SPACE_MAP: Record<NamedStyleType, Nullable<IParagraphStyle>>;
|
|
161
164
|
export declare const PRINT_CHART_COMPONENT_KEY = "univer-sheets-chart-print-chart";
|
|
162
165
|
export declare const DOC_DRAWING_PRINTING_COMPONENT_KEY = "univer-docs-drawing-printing";
|
|
@@ -16,3 +16,10 @@
|
|
|
16
16
|
import type { ISize } from '../../shared';
|
|
17
17
|
import { PaperType } from '../interfaces';
|
|
18
18
|
export declare const PAGE_SIZE: Record<PaperType, Required<ISize>>;
|
|
19
|
+
export declare enum ModernDocumentWidthMode {
|
|
20
|
+
NARROW = "narrow",
|
|
21
|
+
MEDIUM = "medium",
|
|
22
|
+
WIDE = "wide"
|
|
23
|
+
}
|
|
24
|
+
export declare const MODERN_DOCUMENT_WIDTH: Record<ModernDocumentWidthMode, number>;
|
|
25
|
+
export declare const MODERN_DOCUMENT_DEFAULT_MARGIN: number;
|
|
@@ -22,11 +22,18 @@ export declare enum LocaleType {
|
|
|
22
22
|
ZH_CN = "zhCN",
|
|
23
23
|
RU_RU = "ruRU",
|
|
24
24
|
ZH_TW = "zhTW",
|
|
25
|
+
ZH_HK = "zhHK",
|
|
25
26
|
VI_VN = "viVN",
|
|
26
27
|
FA_IR = "faIR",
|
|
27
28
|
JA_JP = "jaJP",
|
|
28
29
|
KO_KR = "koKR",
|
|
29
30
|
ES_ES = "esES",
|
|
30
31
|
CA_ES = "caES",
|
|
31
|
-
SK_SK = "skSK"
|
|
32
|
+
SK_SK = "skSK",
|
|
33
|
+
PT_BR = "ptBR",
|
|
34
|
+
DE_DE = "deDE",
|
|
35
|
+
IT_IT = "itIT",
|
|
36
|
+
ID_ID = "idID",
|
|
37
|
+
PL_PL = "plPL",
|
|
38
|
+
AR_SA = "arSA"
|
|
32
39
|
}
|
|
@@ -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
|
+
import type { ImageSourceType } from '../../services/image-io/image-io.service';
|
|
16
17
|
import type { ISize } from '../../shared/shape';
|
|
17
18
|
import type { BooleanNumber, CellValueType, HorizontalAlign, LocaleType, TextDirection, VerticalAlign, WrapStrategy } from '../enum';
|
|
18
19
|
import type { IDrawingParam } from './i-drawing';
|
|
@@ -116,6 +117,7 @@ export interface IDocumentBody {
|
|
|
116
117
|
sectionBreaks?: ISectionBreak[];
|
|
117
118
|
customBlocks?: ICustomBlock[];
|
|
118
119
|
tables?: ICustomTable[];
|
|
120
|
+
blockRanges?: IDocumentBlockRange[];
|
|
119
121
|
customRanges?: ICustomRange[];
|
|
120
122
|
customDecorations?: ICustomDecoration[];
|
|
121
123
|
/**
|
|
@@ -302,6 +304,17 @@ export type IHyperLinkCustomRange = ICustomRange<{
|
|
|
302
304
|
url: string;
|
|
303
305
|
}>;
|
|
304
306
|
export type IMentionCustomRange = ICustomRange<IMention>;
|
|
307
|
+
export declare enum DocumentBlockRangeType {
|
|
308
|
+
CALLOUT = "callout",
|
|
309
|
+
QUOTE = "quote",
|
|
310
|
+
CODE = "code"
|
|
311
|
+
}
|
|
312
|
+
export interface IDocumentBlockRange {
|
|
313
|
+
startIndex: number;
|
|
314
|
+
endIndex: number;
|
|
315
|
+
blockId: string;
|
|
316
|
+
blockType: DocumentBlockRangeType;
|
|
317
|
+
}
|
|
305
318
|
export declare enum CustomRangeType {
|
|
306
319
|
HYPERLINK = 0,
|
|
307
320
|
FIELD = 1,// 17.16 Fields and Hyperlinks
|
|
@@ -548,10 +561,47 @@ export interface IChartProperties {
|
|
|
548
561
|
/**
|
|
549
562
|
* Properties of text style
|
|
550
563
|
*/
|
|
564
|
+
export type DocTextFillType = 'none' | 'solid' | 'gradient' | 'picture';
|
|
565
|
+
export type DocTextFillGradientType = 'linear' | 'radial' | 'angular' | 'diamond';
|
|
566
|
+
export type DocTextFillPictureMode = 'stretch' | 'tile';
|
|
567
|
+
export interface IDocTextFillGradientStop {
|
|
568
|
+
/**
|
|
569
|
+
* Offset in percent. Values in the 0-1 range are also accepted by renderers
|
|
570
|
+
* for compatibility and normalized to percent.
|
|
571
|
+
*/
|
|
572
|
+
offset: number;
|
|
573
|
+
color: string;
|
|
574
|
+
opacity?: number;
|
|
575
|
+
}
|
|
576
|
+
export interface IDocTextFill {
|
|
577
|
+
/**
|
|
578
|
+
* Hidden renderer-level text fill. Normal document UI does not expose it,
|
|
579
|
+
* but rich-text renderers honor it when present on a run style.
|
|
580
|
+
*/
|
|
581
|
+
type: DocTextFillType;
|
|
582
|
+
color?: string;
|
|
583
|
+
opacity?: number;
|
|
584
|
+
gradient?: {
|
|
585
|
+
type?: DocTextFillGradientType;
|
|
586
|
+
angle?: number;
|
|
587
|
+
stops?: IDocTextFillGradientStop[];
|
|
588
|
+
};
|
|
589
|
+
picture?: {
|
|
590
|
+
source?: string;
|
|
591
|
+
sourceType?: ImageSourceType;
|
|
592
|
+
opacity?: number;
|
|
593
|
+
mode?: DocTextFillPictureMode;
|
|
594
|
+
scaleX?: number;
|
|
595
|
+
scaleY?: number;
|
|
596
|
+
offsetX?: number;
|
|
597
|
+
offsetY?: number;
|
|
598
|
+
};
|
|
599
|
+
}
|
|
551
600
|
export interface ITextStyle extends IStyleBase {
|
|
552
601
|
sc?: number;
|
|
553
602
|
pos?: number;
|
|
554
603
|
sa?: number;
|
|
604
|
+
textFill?: IDocTextFill;
|
|
555
605
|
}
|
|
556
606
|
export interface IIndentStart {
|
|
557
607
|
indentFirstLine?: INumberUnit;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade={},e.UniverCore,e.rxjs))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=class extends t.Disposable{static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};let i=Symbol(`initializers`),a=Symbol(`manualInit`);var o=class extends t.Disposable{constructor(e){if(super(),this._injector=e,this.constructor[a])return;let t=this,n=Object.getPrototypeOf(this)[i];n&&n.forEach(function(n){n.apply(t,[e])})}_initialize(e,...t){}_runInitializers(...e){let t=Object.getPrototypeOf(this)[i];t!=null&&t.length&&t.forEach(t=>t.apply(this,e))}static _enableManualInit(){this[a]=!0}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let t=this.prototype[i];t||(t=[],this.prototype[i]=t),t.push(e.prototype._initialize)}else t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};function s(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var l;let u=l=class extends r{constructor(e,t){super(),this._blob=e,this._injector=t}copyBlob(){return this._injector.createInstance(l,this._blob)}getAs(e){let t=this.copyBlob();return t.setContentType(e),t}getDataAsString(e){return this._blob===null?Promise.resolve(``):e===void 0?this._blob.text():new Promise((t,n)=>{this._blob.arrayBuffer().then(n=>{t(new TextDecoder(e).decode(n))}).catch(e=>{n(Error(`Failed to read Blob as ArrayBuffer: ${e.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(e=>new Uint8Array(e)):Promise.reject(Error(`Blob is undefined or null.`))}setBytes(e){return this._blob=new Blob([e.buffer]),this}setDataFromString(e,t){let n=new Blob([e],{type:t==null?`text/plain`:t});return this._blob=n,this}getContentType(){var e;return(e=this._blob)==null?void 0:e.type}setContentType(e){var t;return this._blob=(t=this._blob)==null?void 0:t.slice(0,this._blob.size,e),this}};u=l=c([s(1,(0,t.Inject)(t.Injector))],u);function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get AbsoluteRefType(){return t.AbsoluteRefType}get UniverInstanceType(){return t.UniverInstanceType}get LifecycleStages(){return t.LifecycleStages}get DataValidationType(){return t.DataValidationType}get DataValidationErrorStyle(){return t.DataValidationErrorStyle}get DataValidationRenderMode(){return t.DataValidationRenderMode}get DataValidationOperator(){return t.DataValidationOperator}get DataValidationStatus(){return t.DataValidationStatus}get CommandType(){return t.CommandType}get BaselineOffset(){return t.BaselineOffset}get BooleanNumber(){return t.BooleanNumber}get HorizontalAlign(){return t.HorizontalAlign}get TextDecoration(){return t.TextDecoration}get TextDirection(){return t.TextDirection}get VerticalAlign(){return t.VerticalAlign}get WrapStrategy(){return t.WrapStrategy}get BorderType(){return t.BorderType}get BorderStyleTypes(){return t.BorderStyleTypes}get AutoFillSeries(){return t.AutoFillSeries}get ColorType(){return t.ColorType}get CommonHideTypes(){return t.CommonHideTypes}get CopyPasteType(){return t.CopyPasteType}get DeleteDirection(){return t.DeleteDirection}get DeveloperMetadataVisibility(){return t.DeveloperMetadataVisibility}get Dimension(){return t.Dimension}get Direction(){return t.Direction}get InterpolationPointType(){return t.InterpolationPointType}get LocaleType(){return t.LocaleType}get MentionType(){return t.MentionType}get ProtectionType(){return t.ProtectionType}get RelativeDate(){return t.RelativeDate}get SheetTypes(){return t.SheetTypes}get ThemeColorType(){return t.ThemeColorType}};m(h,`_instance`,void 0);var g=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get DocCreated(){return`DocCreated`}get DocDisposed(){return`DocDisposed`}get LifeCycleChanged(){return`LifeCycleChanged`}get Redo(){return`Redo`}get Undo(){return`Undo`}get BeforeRedo(){return`BeforeRedo`}get BeforeUndo(){return`BeforeUndo`}get CommandExecuted(){return`CommandExecuted`}get BeforeCommandExecute(){return`BeforeCommandExecute`}};m(g,`_instance`,void 0);let _=class extends r{constructor(e,t){super(),this._injector=e,this._lifecycleService=t}onStarting(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Starting)).subscribe(e))}onReady(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Ready)).subscribe(e))}onRendered(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Rendered)).subscribe(e))}onSteady(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Steady)).subscribe(e))}onBeforeUndo(e){return this._injector.get(t.ICommandService).beforeCommandExecuted(n=>{if(n.id===t.UndoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopUndoElement();n&&e(n)}})}onUndo(e){return this._injector.get(t.ICommandService).onCommandExecuted(n=>{if(n.id===t.UndoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopUndoElement();n&&e(n)}})}onBeforeRedo(e){return this._injector.get(t.ICommandService).beforeCommandExecuted(n=>{if(n.id===t.RedoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopRedoElement();n&&e(n)}})}onRedo(e){return this._injector.get(t.ICommandService).onCommandExecuted(n=>{if(n.id===t.RedoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopRedoElement();n&&e(n)}})}};_=c([s(0,(0,t.Inject)(t.Injector)),s(1,(0,t.Inject)(t.LifecycleService))],_);let v=class extends o{constructor(e,t){super(t),this.doc=e}};v=c([s(1,(0,t.Inject)(t.Injector))],v);var y=class{constructor(){m(this,`_eventRegistry`,new Map),m(this,`_eventHandlerMap`,new Map),m(this,`_eventHandlerRegisted`,new Map)}_ensureEventRegistry(e){return this._eventRegistry.has(e)||this._eventRegistry.set(e,new t.Registry),this._eventRegistry.get(e)}registerEventHandler(e,n){let r=this._eventHandlerMap.get(e);return r?r.add(n):this._eventHandlerMap.set(e,new Set([n])),this._ensureEventRegistry(e).getData().length&&this._initEventHandler(e),(0,t.toDisposable)(()=>{var t,r,i;(t=this._eventHandlerMap.get(e))==null||t.delete(n),(r=this._eventHandlerRegisted.get(e))==null||(r=r.get(n))==null||r.dispose(),(i=this._eventHandlerRegisted.get(e))==null||i.delete(n)})}removeEvent(e,t){let n=this._ensureEventRegistry(e);if(n.delete(t),n.getData().length===0){let t=this._eventHandlerRegisted.get(e);t==null||t.forEach(e=>e.dispose()),this._eventHandlerRegisted.delete(e)}}_initEventHandler(e){let n=this._eventHandlerRegisted.get(e),r=this._eventHandlerMap.get(e);r&&(!n||n.size===0)&&(n=new Map,this._eventHandlerRegisted.set(e,n),r==null||r.forEach(e=>{n==null||n.set(e,(0,t.toDisposable)(e()))}))}addEvent(e,n){return this._ensureEventRegistry(e).add(n),this._initEventHandler(e),(0,t.toDisposable)(()=>this.removeEvent(e,n))}fireEvent(e,t){var n;return(n=this._eventRegistry.get(e))==null||n.getData().forEach(e=>{e(t)}),t.cancel}};let b=class extends r{constructor(e,t){super(),this._injector=e,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};b=c([s(0,(0,t.Inject)(t.Injector)),s(1,(0,t.Inject)(t.UserManagerService))],b);var x=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}get rectangle(){return t.Rectangle}get numfmt(){return t.numfmt}get tools(){return t.Tools}};m(x,`_instance`,void 0);var S;let C=Symbol(`initializers`),w=S=class extends t.Disposable{static newAPI(e){return(e instanceof t.Univer?e.__getInjector():e).createInstance(S)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let t=this.prototype[C];t||(t=[],this.prototype[C]=t),t.push(e.prototype._initialize)}else t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(e,n,r,i){super(),this._injector=e,this._commandService=n,this._univerInstanceService=r,this._lifecycleService=i,m(this,`_eventRegistry`,new y),m(this,`registerEventHandler`,(e,t)=>this._eventRegistry.registerEventHandler(e,t)),this.disposeWithMe(this.registerEventHandler(this.Event.LifeCycleChanged,()=>(0,t.toDisposable)(this._lifecycleService.lifecycle$.subscribe(e=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:e})})))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});let a=Object.getPrototypeOf(this)[C];if(a){let t=this;a.forEach(function(n){n.apply(t,[e])})}}_initCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.Redo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Redo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.Undo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Undo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommandExecuted,()=>n.onCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};this.fireEvent(this.Event.CommandExecuted,e)}})))}_initBeforeCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeRedo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeRedo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeUndo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeUndo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommandExecute,()=>n.beforeCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};if(this.fireEvent(this.Event.BeforeCommandExecute,e),e.cancel)throw new t.CanceledError}})))}_initUnitEvent(e){let n=e.get(t.IUniverInstanceService);this.disposeWithMe(this.registerEventHandler(this.Event.DocDisposed,()=>n.unitDisposed$.subscribe(e=>{e.type===t.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:e.getUnitId(),unitType:e.type,snapshot:e.getSnapshot()})}))),this.disposeWithMe(this.registerEventHandler(this.Event.DocCreated,()=>n.unitAdded$.subscribe(n=>{let{unit:r}=n;if(r.type===t.UniverInstanceType.UNIVER_DOC){let t=r,n=e.createInstance(v,t);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:n,unit:n})}})))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(t.LifecycleService).stage}undo(){return this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._commandService.executeCommand(t.RedoCommand.id)}toggleDarkMode(e){this._injector.get(t.ThemeService).setDarkMode(e)}loadLocales(e,n){this._injector.get(t.LocaleService).load({[e]:n})}setLocale(e){this._injector.get(t.LocaleService).setLocale(e)}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted((t,n)=>{e(t,n)})}onCommandExecuted(e){return this._commandService.onCommandExecuted((t,n)=>{e(t,n)})}executeCommand(e,t,n){return this._commandService.executeCommand(e,t,n)}syncExecuteCommand(e,t,n){return this._commandService.syncExecuteCommand(e,t,n)}getHooks(){return this._injector.createInstance(_)}get Enum(){return h.get()}get Event(){return g.get()}get Util(){return x.get()}addEvent(e,t){if(!e||!t)throw Error(`Cannot add empty event`);return this._eventRegistry.addEvent(e,t)}fireEvent(e,t){return this._eventRegistry.fireEvent(e,t)}getUserManager(){return this._injector.createInstance(b)}newBlob(){return this._injector.createInstance(u,null)}newRichText(e){return t.RichTextBuilder.create(e)}newRichTextValue(e){return t.RichTextValue.create(e)}newParagraphStyle(e){return t.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return t.ParagraphStyleValue.create(e)}newTextStyle(e){return t.TextStyleBuilder.create(e)}newTextStyleValue(e){return t.TextStyleValue.create(e)}newTextDecoration(e){return new t.TextDecorationBuilder(e)}};w=S=c([s(0,(0,t.Inject)(t.Injector)),s(1,t.ICommandService),s(2,t.IUniverInstanceService),s(3,(0,t.Inject)(t.LifecycleService))],w),e.FBase=r,e.FBaseInitialable=o,Object.defineProperty(e,`FBlob`,{enumerable:!0,get:function(){return u}}),e.FEnum=h,e.FEventName=g,Object.defineProperty(e,`FHooks`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,`FUniver`,{enumerable:!0,get:function(){return w}}),e.FUtil=x});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@univerjs/core"),require("rxjs")):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCoreFacade={},e.UniverCore,e.rxjs))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=class extends t.Disposable{static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};let i=Symbol(`initializers`),a=Symbol(`manualInit`);var o=class extends t.Disposable{constructor(e){if(super(),this._injector=e,this.constructor[a])return;let t=this,n=Object.getPrototypeOf(this)[i];n&&n.forEach(function(n){n.apply(t,[e])})}_initialize(e,...t){}_runInitializers(...e){let t=Object.getPrototypeOf(this)[i];t!=null&&t.length&&t.forEach(t=>t.apply(this,e))}static _enableManualInit(){this[a]=!0}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let t=this.prototype[i];t||(t=[],this.prototype[i]=t),t.push(e.prototype._initialize)}else t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}};function s(e,t){return function(n,r){t(n,r,e)}}function c(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var l;let u=l=class extends r{constructor(e,t){super(),this._blob=e,this._injector=t}copyBlob(){return this._injector.createInstance(l,this._blob)}getAs(e){let t=this.copyBlob();return t.setContentType(e),t}getDataAsString(e){return this._blob===null?Promise.resolve(``):e===void 0?this._blob.text():new Promise((t,n)=>{this._blob.arrayBuffer().then(n=>{t(new TextDecoder(e).decode(n))}).catch(e=>{n(Error(`Failed to read Blob as ArrayBuffer: ${e.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(e=>new Uint8Array(e)):Promise.reject(Error(`Blob is undefined or null.`))}setBytes(e){return this._blob=new Blob([e.buffer]),this}setDataFromString(e,t){let n=new Blob([e],{type:t==null?`text/plain`:t});return this._blob=n,this}getContentType(){var e;return(e=this._blob)==null?void 0:e.type}setContentType(e){var t;return this._blob=(t=this._blob)==null?void 0:t.slice(0,this._blob.size,e),this}};u=l=c([s(1,(0,t.Inject)(t.Injector))],u);function d(e){"@babel/helpers - typeof";return d=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},d(e)}function f(e,t){if(d(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(d(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return d(t)==`symbol`?t:t+``}function m(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var h=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get AbsoluteRefType(){return t.AbsoluteRefType}get UniverInstanceType(){return t.UniverInstanceType}get LifecycleStages(){return t.LifecycleStages}get DataValidationType(){return t.DataValidationType}get DataValidationErrorStyle(){return t.DataValidationErrorStyle}get DataValidationRenderMode(){return t.DataValidationRenderMode}get DataValidationOperator(){return t.DataValidationOperator}get DataValidationStatus(){return t.DataValidationStatus}get CommandType(){return t.CommandType}get BaselineOffset(){return t.BaselineOffset}get BooleanNumber(){return t.BooleanNumber}get HorizontalAlign(){return t.HorizontalAlign}get TextDecoration(){return t.TextDecoration}get TextDirection(){return t.TextDirection}get VerticalAlign(){return t.VerticalAlign}get WrapStrategy(){return t.WrapStrategy}get BorderType(){return t.BorderType}get BorderStyleTypes(){return t.BorderStyleTypes}get AutoFillSeries(){return t.AutoFillSeries}get ColorType(){return t.ColorType}get CommonHideTypes(){return t.CommonHideTypes}get CopyPasteType(){return t.CopyPasteType}get DeleteDirection(){return t.DeleteDirection}get DeveloperMetadataVisibility(){return t.DeveloperMetadataVisibility}get Dimension(){return t.Dimension}get Direction(){return t.Direction}get InterpolationPointType(){return t.InterpolationPointType}get LocaleType(){return t.LocaleType}get MentionType(){return t.MentionType}get ProtectionType(){return t.ProtectionType}get RelativeDate(){return t.RelativeDate}get SheetTypes(){return t.SheetTypes}get ThemeColorType(){return t.ThemeColorType}};m(h,`_instance`,void 0);var g=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(){for(let t in e.prototype)this[t]=e.prototype[t]}get DocCreated(){return`DocCreated`}get DocDisposed(){return`DocDisposed`}get LifeCycleChanged(){return`LifeCycleChanged`}get Redo(){return`Redo`}get Undo(){return`Undo`}get BeforeRedo(){return`BeforeRedo`}get BeforeUndo(){return`BeforeUndo`}get CommandExecuted(){return`CommandExecuted`}get BeforeCommandExecute(){return`BeforeCommandExecute`}};m(g,`_instance`,void 0);let _=class extends r{constructor(e,t){super(),this._injector=e,this._lifecycleService=t}onStarting(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Starting)).subscribe(e))}onReady(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Ready)).subscribe(e))}onRendered(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Rendered)).subscribe(e))}onSteady(e){return(0,t.toDisposable)(this._lifecycleService.lifecycle$.pipe((0,n.filter)(e=>e===t.LifecycleStages.Steady)).subscribe(e))}onBeforeUndo(e){return this._injector.get(t.ICommandService).beforeCommandExecuted(n=>{if(n.id===t.UndoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopUndoElement();n&&e(n)}})}onUndo(e){return this._injector.get(t.ICommandService).onCommandExecuted(n=>{if(n.id===t.UndoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopUndoElement();n&&e(n)}})}onBeforeRedo(e){return this._injector.get(t.ICommandService).beforeCommandExecuted(n=>{if(n.id===t.RedoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopRedoElement();n&&e(n)}})}onRedo(e){return this._injector.get(t.ICommandService).onCommandExecuted(n=>{if(n.id===t.RedoCommand.id){let n=this._injector.get(t.IUndoRedoService).pitchTopRedoElement();n&&e(n)}})}};_=c([s(0,(0,t.Inject)(t.Injector)),s(1,(0,t.Inject)(t.LifecycleService))],_);let v=class extends o{constructor(e,t){super(t),this.doc=e}};v=c([s(1,(0,t.Inject)(t.Injector))],v);var y=class{constructor(){m(this,`_eventRegistry`,new Map),m(this,`_eventHandlerMap`,new Map),m(this,`_eventHandlerRegisted`,new Map)}_ensureEventRegistry(e){return this._eventRegistry.has(e)||this._eventRegistry.set(e,new t.Registry),this._eventRegistry.get(e)}registerEventHandler(e,n){let r=this._eventHandlerMap.get(e);return r?r.add(n):this._eventHandlerMap.set(e,new Set([n])),this._ensureEventRegistry(e).getData().length&&this._initEventHandler(e),(0,t.toDisposable)(()=>{var t,r,i;(t=this._eventHandlerMap.get(e))==null||t.delete(n),(r=this._eventHandlerRegisted.get(e))==null||(r=r.get(n))==null||r.dispose(),(i=this._eventHandlerRegisted.get(e))==null||i.delete(n)})}removeEvent(e,t){let n=this._ensureEventRegistry(e);if(n.delete(t),n.getData().length===0){let t=this._eventHandlerRegisted.get(e);t==null||t.forEach(e=>e.dispose()),this._eventHandlerRegisted.delete(e)}}_initEventHandler(e){let n=this._eventHandlerRegisted.get(e),r=this._eventHandlerMap.get(e);r&&(!n||n.size===0)&&(n=new Map,this._eventHandlerRegisted.set(e,n),r==null||r.forEach(e=>{n==null||n.set(e,(0,t.toDisposable)(e()))}))}addEvent(e,n){return this._ensureEventRegistry(e).add(n),this._initEventHandler(e),(0,t.toDisposable)(()=>this.removeEvent(e,n))}fireEvent(e,t){var n;return(n=this._eventRegistry.get(e))==null||n.getData().forEach(e=>{e(t)}),t.cancel}};let b=class extends r{constructor(e,t){super(),this._injector=e,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};b=c([s(0,(0,t.Inject)(t.Injector)),s(1,(0,t.Inject)(t.UserManagerService))],b);var x=class e{static get(){if(this._instance)return this._instance;let t=new e;return this._instance=t,t}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}get rectangle(){return t.Rectangle}get numfmt(){return t.numfmt}get tools(){return t.Tools}};m(x,`_instance`,void 0);var S;let C=Symbol(`initializers`),w=S=class extends t.Disposable{static newAPI(e){return(e instanceof t.Univer?e.__getInjector():e).createInstance(S)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`_initialize`){let t=this.prototype[C];t||(t=[],this.prototype[C]=t),t.push(e.prototype._initialize)}else t!==`constructor`&&(this.prototype[t]=e.prototype[t])}),Object.getOwnPropertyNames(e).forEach(t=>{t!==`prototype`&&t!==`name`&&t!==`length`&&(this[t]=e[t])})}constructor(e,n,r,i){super(),this._injector=e,this._commandService=n,this._univerInstanceService=r,this._lifecycleService=i,m(this,`_eventRegistry`,new y),m(this,`registerEventHandler`,(e,t)=>this._eventRegistry.registerEventHandler(e,t)),this.disposeWithMe(this.registerEventHandler(this.Event.LifeCycleChanged,()=>(0,t.toDisposable)(this._lifecycleService.lifecycle$.subscribe(e=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:e})})))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});let a=Object.getPrototypeOf(this)[C];if(a){let t=this;a.forEach(function(n){n.apply(t,[e])})}}_initCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.Redo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Redo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.Undo,()=>n.onCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};this.fireEvent(this.Event.Undo,e)}}))),this.disposeWithMe(this.registerEventHandler(this.Event.CommandExecuted,()=>n.onCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};this.fireEvent(this.Event.CommandExecuted,e)}})))}_initBeforeCommandEvent(e){let n=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.BeforeRedo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.RedoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeRedo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeUndo,()=>n.beforeCommandExecuted(e=>{let{id:n,type:r,params:i}=e;if(e.id===t.UndoCommand.id){let e={id:n,type:r,params:i};if(this.fireEvent(this.Event.BeforeUndo,e),e.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeCommandExecute,()=>n.beforeCommandExecuted((e,n)=>{let{id:r,type:i,params:a}=e;if(e.id!==t.RedoCommand.id&&e.id!==t.UndoCommand.id){let e={id:r,type:i,params:a,options:n};if(this.fireEvent(this.Event.BeforeCommandExecute,e),e.cancel)throw new t.CanceledError}})))}_initUnitEvent(e){let n=e.get(t.IUniverInstanceService);this.disposeWithMe(this.registerEventHandler(this.Event.DocDisposed,()=>n.unitDisposed$.subscribe(e=>{e.type===t.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:e.getUnitId(),unitType:e.type,snapshot:e.getSnapshot()})}))),this.disposeWithMe(this.registerEventHandler(this.Event.DocCreated,()=>n.unitAdded$.subscribe(n=>{let{unit:r}=n;if(r.type===t.UniverInstanceType.UNIVER_DOC){let t=r,n=e.createInstance(v,t);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:n,unit:n})}})))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(t.LifecycleService).stage}undo(){return this._commandService.executeCommand(t.UndoCommand.id)}redo(){return this._commandService.executeCommand(t.RedoCommand.id)}toggleDarkMode(e){this._injector.get(t.ThemeService).setDarkMode(e)}loadLocales(e,n){this._injector.get(t.LocaleService).load({[e]:n})}setLocale(e){this._injector.get(t.LocaleService).setLocale(e)}getCurrentLocale(){return this._injector.get(t.LocaleService).getCurrentLocale()}getLocales(){return this._injector.get(t.LocaleService).getLocales()}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted((t,n)=>{e(t,n)})}onCommandExecuted(e){return this._commandService.onCommandExecuted((t,n)=>{e(t,n)})}executeCommand(e,t,n){return this._commandService.executeCommand(e,t,n)}syncExecuteCommand(e,t,n){return this._commandService.syncExecuteCommand(e,t,n)}getHooks(){return this._injector.createInstance(_)}get Enum(){return h.get()}get Event(){return g.get()}get Util(){return x.get()}addEvent(e,t){if(!e||!t)throw Error(`Cannot add empty event`);return this._eventRegistry.addEvent(e,t)}fireEvent(e,t){return this._eventRegistry.fireEvent(e,t)}getUserManager(){return this._injector.createInstance(b)}newBlob(){return this._injector.createInstance(u,null)}newRichText(e){return t.RichTextBuilder.create(e)}newRichTextValue(e){return t.RichTextValue.create(e)}newParagraphStyle(e){return t.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return t.ParagraphStyleValue.create(e)}newTextStyle(e){return t.TextStyleBuilder.create(e)}newTextStyleValue(e){return t.TextStyleValue.create(e)}newTextDecoration(e){return new t.TextDecorationBuilder(e)}};w=S=c([s(0,(0,t.Inject)(t.Injector)),s(1,t.ICommandService),s(2,t.IUniverInstanceService),s(3,(0,t.Inject)(t.LifecycleService))],w),e.FBase=r,e.FBaseInitialable=o,Object.defineProperty(e,"FBlob",{enumerable:!0,get:function(){return u}}),e.FEnum=h,e.FEventName=g,Object.defineProperty(e,"FHooks",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"FUniver",{enumerable:!0,get:function(){return w}}),e.FUtil=x});
|