@univerjs/core 0.5.0 → 0.5.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/index.js +9 -9
- package/lib/es/index.js +6538 -6337
- package/lib/types/common/interceptor.d.ts +4 -0
- package/lib/types/docs/data-model/empty-snapshot.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/build-utils/drawings.d.ts +12 -0
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +3 -0
- package/lib/types/index.d.ts +5 -5
- package/lib/types/services/image-io/image-io.service.d.ts +30 -0
- package/lib/types/services/instance/instance.service.d.ts +3 -3
- package/lib/types/services/undoredo/undoredo.service.d.ts +7 -5
- package/lib/types/shared/cache/image-cache.d.ts +9 -0
- package/lib/types/shared/r-tree.d.ts +1 -1
- package/lib/types/shared/timer.d.ts +1 -0
- package/lib/types/sheets/worksheet.d.ts +2 -0
- package/lib/types/types/enum/index.d.ts +0 -1
- package/lib/types/types/enum/locale-type.d.ts +1 -0
- package/lib/types/types/interfaces/i-data-validation.d.ts +5 -5
- package/lib/types/types/interfaces/i-document-data.d.ts +2 -2
- package/lib/types/types/interfaces/i-slide-data.d.ts +2 -2
- package/lib/umd/index.js +9 -9
- package/package.json +7 -7
- package/lib/types/types/enum/format-type.d.ts +0 -26
|
@@ -29,6 +29,10 @@ export declare class InterceptorManager<P extends Record<string, IInterceptor<an
|
|
|
29
29
|
export declare function createAsyncInterceptorKey<T, C>(key: string): IAsyncInterceptor<T, C>;
|
|
30
30
|
export type AsyncInterceptorHandler<M = unknown, C = unknown> = (value: Nullable<M>, context: C, next: (value: Nullable<M>) => Promise<Nullable<M>>) => Promise<Nullable<M>>;
|
|
31
31
|
export interface IAsyncInterceptor<M, C> {
|
|
32
|
+
/**
|
|
33
|
+
* The priority of the interceptor, the larger the number, the higher the priority.
|
|
34
|
+
* @default 0
|
|
35
|
+
*/
|
|
32
36
|
priority?: number;
|
|
33
37
|
handler: AsyncInterceptorHandler<M, C>;
|
|
34
38
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { LocaleType } from '../../types/enum/locale-type';
|
|
2
1
|
import { IDocumentData } from '../../types/interfaces';
|
|
2
|
+
import { LocaleType } from '../../types/enum/locale-type';
|
|
3
3
|
export declare function getEmptySnapshot(unitID?: string, locale?: LocaleType, title?: string): IDocumentData;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ITextRange, ITextRangeParam } from '../../../../sheets/typedef';
|
|
2
|
+
import { IDocumentBody } from '../../../../types/interfaces';
|
|
3
|
+
import { DocumentDataModel } from '../../document-data-model';
|
|
4
|
+
import { JSONXActions } from '../../json-x/json-x';
|
|
5
|
+
export interface IAddDrawingParam {
|
|
6
|
+
selection: ITextRangeParam;
|
|
7
|
+
documentDataModel: DocumentDataModel;
|
|
8
|
+
drawings: any[];
|
|
9
|
+
}
|
|
10
|
+
export declare function getCustomBlockIdsInSelections(body: IDocumentBody, selections: ITextRange[]): string[];
|
|
11
|
+
export declare function getRichTextEditPath(docDataModel: DocumentDataModel, segmentId?: string): string[];
|
|
12
|
+
export declare const addDrawing: (param: IAddDrawingParam) => false | JSONXActions;
|
|
@@ -36,5 +36,8 @@ export declare class BuildTextUtils {
|
|
|
36
36
|
changeNestLevel: (params: import('./paragraph').IChangeParagraphBulletNestLevelParams) => import('../text-x').TextX;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
+
static drawing: {
|
|
40
|
+
add: (param: import('./drawings').IAddDrawingParam) => false | import('ot-json1').JSONOp;
|
|
41
|
+
};
|
|
39
42
|
}
|
|
40
43
|
export type { IAddCustomRangeTextXParam, IDeleteCustomRangeParam, IReplaceSelectionTextXParams } from './text-x-utils';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -91,21 +91,22 @@ export { cellToRange } from './shared/common';
|
|
|
91
91
|
export { getIntersectRange } from './shared/range';
|
|
92
92
|
export { nameCharacterCheck } from './shared/name';
|
|
93
93
|
export { afterTime, bufferDebounceTime, fromCallback, takeAfter } from './shared/rxjs';
|
|
94
|
-
export { awaitTime } from './shared/timer';
|
|
94
|
+
export { awaitTime, delayAnimationFrame } from './shared/timer';
|
|
95
95
|
export { Range } from './sheets/range';
|
|
96
96
|
export { DEFAULT_WORKSHEET_COLUMN_COUNT, DEFAULT_WORKSHEET_COLUMN_COUNT_KEY, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT, DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY, DEFAULT_WORKSHEET_COLUMN_WIDTH, DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY, DEFAULT_WORKSHEET_ROW_COUNT, DEFAULT_WORKSHEET_ROW_COUNT_KEY, DEFAULT_WORKSHEET_ROW_HEIGHT, DEFAULT_WORKSHEET_ROW_HEIGHT_KEY, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH, DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY, mergeWorksheetSnapshotWithDefault, } from './sheets/sheet-snapshot-utils';
|
|
97
97
|
export { Styles } from './sheets/styles';
|
|
98
98
|
export * from './sheets/typedef';
|
|
99
99
|
export { addLinkToDocumentModel, isRangesEqual, isUnitRangesEqual } from './sheets/util';
|
|
100
100
|
export { SheetViewModel } from './sheets/view-model';
|
|
101
|
+
export { createDocumentModelWithStyle } from './sheets/util';
|
|
102
|
+
export { ImageCacheMap } from './shared/cache/image-cache';
|
|
103
|
+
export { IImageIoService, type IImageIoServiceParam, ImageSourceType, ImageUploadStatusType } from './services/image-io/image-io.service';
|
|
101
104
|
export { getWorksheetUID, Workbook } from './sheets/workbook';
|
|
102
105
|
export { extractPureTextFromCell, getOriginCellValue, Worksheet } from './sheets/worksheet';
|
|
103
106
|
export { SlideDataModel } from './slides/slide-model';
|
|
104
107
|
export * from './types/const';
|
|
105
|
-
export * from './types/const';
|
|
106
108
|
export { skipParseTagNames } from './types/const/clipboard';
|
|
107
109
|
export * from './types/enum';
|
|
108
|
-
export * from './types/enum';
|
|
109
110
|
export { DataValidationErrorStyle } from './types/enum/data-validation-error-style';
|
|
110
111
|
export { DataValidationImeMode } from './types/enum/data-validation-ime-mode';
|
|
111
112
|
export { DataValidationOperator } from './types/enum/data-validation-operator';
|
|
@@ -113,9 +114,8 @@ export { DataValidationRenderMode } from './types/enum/data-validation-render-mo
|
|
|
113
114
|
export { DataValidationStatus } from './types/enum/data-validation-status';
|
|
114
115
|
export { DataValidationType } from './types/enum/data-validation-type';
|
|
115
116
|
export * from './types/interfaces';
|
|
116
|
-
export * from './types/interfaces';
|
|
117
117
|
export type { ICellCustomRender, ICellRenderContext } from './types/interfaces/i-cell-custom-render';
|
|
118
118
|
export type { IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleInfo, IDataValidationRuleOptions, ISheetDataValidationRule } from './types/interfaces/i-data-validation';
|
|
119
|
-
export { type IRTreeItem, RTree } from './shared/r-tree';
|
|
119
|
+
export { type BBox, type IRTreeItem, RBush, RTree } from './shared/r-tree';
|
|
120
120
|
export { type IUniverConfig, Univer } from './univer';
|
|
121
121
|
export { isNodeEnv } from './shared/tools';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { Nullable } from '../../shared/types';
|
|
3
|
+
export declare enum ImageSourceType {
|
|
4
|
+
URL = "URL",
|
|
5
|
+
UUID = "UUID",
|
|
6
|
+
BASE64 = "BASE64"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ImageUploadStatusType {
|
|
9
|
+
SUCCUSS = "0",
|
|
10
|
+
ERROR_EXCEED_SIZE = "1",
|
|
11
|
+
ERROR_IMAGE_TYPE = "2",
|
|
12
|
+
ERROR_UPLOAD_COUNT_LIMIT = "3",
|
|
13
|
+
ERROR_IMAGE = "4"
|
|
14
|
+
}
|
|
15
|
+
export interface IImageIoServiceParam {
|
|
16
|
+
imageId: string;
|
|
17
|
+
imageSourceType: ImageSourceType;
|
|
18
|
+
source: string;
|
|
19
|
+
base64Cache: string;
|
|
20
|
+
status: ImageUploadStatusType;
|
|
21
|
+
}
|
|
22
|
+
export interface IImageIoService {
|
|
23
|
+
change$: Observable<number>;
|
|
24
|
+
setWaitCount(count: number): void;
|
|
25
|
+
getImage(imageId: string): Promise<string>;
|
|
26
|
+
saveImage(imageFile: File): Promise<Nullable<IImageIoServiceParam>>;
|
|
27
|
+
getImageSourceCache(source: string, imageSourceType: ImageSourceType): Nullable<HTMLImageElement>;
|
|
28
|
+
addImageSourceCache(source: string, imageSourceType: ImageSourceType, imageSource: Nullable<HTMLImageElement>): void;
|
|
29
|
+
}
|
|
30
|
+
export declare const IImageIoService: import('@wendellhu/redi').IdentifierDecorator<IImageIoService>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { IDisposable, Injector } from '../../common/di';
|
|
3
|
+
import { UnitModel, UnitType, UniverInstanceType } from '../../common/unit';
|
|
4
|
+
import { Nullable } from '../../shared';
|
|
4
5
|
import { DocumentDataModel } from '../../docs/data-model/document-data-model';
|
|
5
6
|
import { Disposable } from '../../shared/lifecycle';
|
|
6
7
|
import { Workbook } from '../../sheets/workbook';
|
|
7
8
|
import { IContextService } from '../context/context.service';
|
|
8
|
-
import { Nullable } from '../../shared';
|
|
9
9
|
export type UnitCtor = new (...args: any[]) => UnitModel;
|
|
10
10
|
export interface ICreateUnitOptions {
|
|
11
11
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Observable, BehaviorSubject } from 'rxjs';
|
|
2
2
|
import { IAccessor, IDisposable } from '../../common/di';
|
|
3
|
-
import {
|
|
3
|
+
import { Nullable } from '../../shared/types';
|
|
4
4
|
import { IMutationInfo, CommandType, ICommandService } from '../command/command.service';
|
|
5
|
+
import { Disposable } from '../../shared/lifecycle';
|
|
5
6
|
import { IContextService } from '../context/context.service';
|
|
6
7
|
import { IUniverInstanceService } from '../instance/instance.service';
|
|
7
|
-
import { Nullable } from '../../shared/types';
|
|
8
8
|
export interface IUndoRedoItem {
|
|
9
9
|
/** unitID maps to unitId for UniverSheet / UniverDoc / UniverSlide */
|
|
10
10
|
unitID: string;
|
|
@@ -29,14 +29,16 @@ export interface IUndoRedoService {
|
|
|
29
29
|
*/
|
|
30
30
|
__tempBatchingUndoRedo(unitId: string): IDisposable;
|
|
31
31
|
}
|
|
32
|
-
export interface
|
|
32
|
+
export interface IUndoRedoCommandBaseInfosByInterceptor {
|
|
33
|
+
undos: IMutationInfo[];
|
|
34
|
+
redos: IMutationInfo[];
|
|
35
|
+
}
|
|
36
|
+
export interface IUndoRedoCommandInfosByInterceptor extends IUndoRedoCommandBaseInfosByInterceptor {
|
|
33
37
|
/**
|
|
34
38
|
* Sometimes, mutations generated by interceptors need to ensure a certain execution order
|
|
35
39
|
* PreMutations run before user's intent to make sure the undo/redo works correctly.
|
|
36
40
|
*/
|
|
37
41
|
preUndos?: IMutationInfo[];
|
|
38
|
-
undos: IMutationInfo[];
|
|
39
|
-
redos: IMutationInfo[];
|
|
40
42
|
preRedos?: IMutationInfo[];
|
|
41
43
|
}
|
|
42
44
|
export interface IUndoRedoCommandInfos {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Injector } from '@wendellhu/redi';
|
|
2
|
+
import { ImageSourceType } from '../../services/image-io/image-io.service';
|
|
3
|
+
export declare class ImageCacheMap {
|
|
4
|
+
private _injector;
|
|
5
|
+
private _imageCacheMap;
|
|
6
|
+
constructor(_injector: Injector, maxSize?: number);
|
|
7
|
+
private _getImageCacheKey;
|
|
8
|
+
getImage(imageSourceType: ImageSourceType, source: string, onLoad?: () => void, onError?: () => void): HTMLImageElement | null;
|
|
9
|
+
}
|
|
@@ -59,6 +59,8 @@ export declare class Worksheet {
|
|
|
59
59
|
*/
|
|
60
60
|
setMergeData(mergeData: IRange[]): void;
|
|
61
61
|
getSpanModel(): SpanModel;
|
|
62
|
+
getStyleDataByHash(hash: string): Nullable<IStyleData>;
|
|
63
|
+
setStyleData(style: IStyleData): Nullable<string>;
|
|
62
64
|
/**
|
|
63
65
|
* Get the style of the column.
|
|
64
66
|
* @param {number} column The column index
|
|
@@ -22,7 +22,6 @@ export * from './delete-direction';
|
|
|
22
22
|
export * from './developer-metadata-visibility';
|
|
23
23
|
export * from './dimension';
|
|
24
24
|
export * from './direction';
|
|
25
|
-
export * from './format-type';
|
|
26
25
|
export * from './interpolation-point-type';
|
|
27
26
|
export * from './locale-type';
|
|
28
27
|
export * from './mention-type';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DataValidationType } from '../enum/data-validation-type';
|
|
3
|
-
import { DataValidationImeMode } from '../enum/data-validation-ime-mode';
|
|
1
|
+
import { IRange } from '../../sheets/typedef';
|
|
4
2
|
import { DataValidationErrorStyle } from '../enum/data-validation-error-style';
|
|
3
|
+
import { DataValidationImeMode } from '../enum/data-validation-ime-mode';
|
|
4
|
+
import { DataValidationOperator } from '../enum/data-validation-operator';
|
|
5
5
|
import { DataValidationRenderMode } from '../enum/data-validation-render-mode';
|
|
6
|
-
import {
|
|
6
|
+
import { DataValidationType } from '../enum/data-validation-type';
|
|
7
7
|
export interface IDataValidationRuleBase {
|
|
8
8
|
/**
|
|
9
9
|
* data validation type
|
|
10
10
|
*/
|
|
11
|
-
type: DataValidationType;
|
|
11
|
+
type: DataValidationType | string;
|
|
12
12
|
allowBlank?: boolean;
|
|
13
13
|
/**
|
|
14
14
|
* data validation creteria
|
|
@@ -152,7 +152,7 @@ export interface INestingLevel {
|
|
|
152
152
|
glyphFormat: string;
|
|
153
153
|
textStyle?: ITextStyle;
|
|
154
154
|
startNumber: number;
|
|
155
|
-
glyphType?:
|
|
155
|
+
glyphType?: ListGlyphType;
|
|
156
156
|
glyphSymbol?: string;
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
@@ -166,7 +166,7 @@ export declare enum FollowNumberWithType {
|
|
|
166
166
|
/**
|
|
167
167
|
* An enumeration of the supported glyph types.
|
|
168
168
|
*/
|
|
169
|
-
export declare enum
|
|
169
|
+
export declare enum ListGlyphType {
|
|
170
170
|
BULLET = 0,// The glyph type is unspecified or unsupported.
|
|
171
171
|
NONE = 1,// An empty string.
|
|
172
172
|
DECIMAL = 2,// A number, like 1, 2, or 3.
|
|
@@ -71,7 +71,7 @@ interface IHandoutProperties {
|
|
|
71
71
|
interface IMasterProperties {
|
|
72
72
|
name: string;
|
|
73
73
|
}
|
|
74
|
-
export interface
|
|
74
|
+
export interface ISlideRichTextProps extends ITransformState, IStyleBase {
|
|
75
75
|
text?: string;
|
|
76
76
|
rich?: IDocumentData;
|
|
77
77
|
}
|
|
@@ -94,7 +94,7 @@ export interface IPageElement {
|
|
|
94
94
|
type: PageElementType;
|
|
95
95
|
shape?: IShape;
|
|
96
96
|
image?: IImage;
|
|
97
|
-
richText?:
|
|
97
|
+
richText?: ISlideRichTextProps;
|
|
98
98
|
/** @deprecated */
|
|
99
99
|
spreadsheet?: {
|
|
100
100
|
worksheet: IWorksheetData;
|