@univerjs/engine-render 0.1.0-beta.4 → 0.1.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/README.md +1 -0
- package/lib/cjs/index.js +3 -3
- package/lib/es/index.js +6567 -6406
- package/lib/types/basics/i-document-skeleton-cached.d.ts +1 -1
- package/lib/types/basics/index.d.ts +1 -0
- package/lib/types/basics/text-rotation.d.ts +21 -0
- package/lib/types/basics/tools.d.ts +4 -0
- package/lib/types/basics/transform.d.ts +18 -18
- package/lib/types/canvas.d.ts +23 -7
- package/lib/types/components/docs/common/tools.d.ts +0 -1
- package/lib/types/components/docs/document.d.ts +1 -0
- package/lib/types/components/docs/extensions/background.d.ts +1 -1
- package/lib/types/components/docs/extensions/border.d.ts +1 -1
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +1 -1
- package/lib/types/components/docs/extensions/line.d.ts +1 -1
- package/lib/types/components/docs/text-selection-render-manager.d.ts +13 -10
- package/lib/types/components/extension.d.ts +6 -5
- package/lib/types/components/sheets/extensions/background.d.ts +3 -1
- package/lib/types/components/sheets/extensions/border.d.ts +1 -1
- package/lib/types/components/sheets/extensions/column-header-layout.d.ts +1 -1
- package/lib/types/components/sheets/extensions/font.d.ts +3 -1
- package/lib/types/components/sheets/extensions/row-header-layout.d.ts +1 -1
- package/lib/types/components/sheets/sheet-skeleton.d.ts +8 -15
- package/lib/types/components/sheets/spreadsheet.d.ts +5 -0
- package/lib/types/context.d.ts +9 -0
- package/lib/types/engine.d.ts +3 -3
- package/lib/types/layer.d.ts +2 -1
- package/lib/types/render-manager.service.d.ts +11 -2
- package/lib/types/scene.-transformer.d.ts +2 -2
- package/lib/types/scene.input-manager.d.ts +2 -1
- package/lib/types/shape/base-scroll-bar.d.ts +2 -2
- package/lib/types/shape/path.d.ts +3 -3
- package/lib/types/thin-scene.d.ts +2 -2
- package/lib/umd/index.js +3 -3
- package/package.json +22 -9
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { type ITextRotation } from '@univerjs/core';
|
|
17
|
+
export declare const VERTICAL_ROTATE_ANGLE = 90;
|
|
18
|
+
export declare function convertTextRotation(textRotation: ITextRotation): {
|
|
19
|
+
centerAngle: number;
|
|
20
|
+
vertexAngle: number;
|
|
21
|
+
};
|
|
@@ -56,6 +56,8 @@ export declare function precisionTo(num: number, accurate: number): number;
|
|
|
56
56
|
* var time = performance.now(); for(let i=0;i<100000000;i++){ fixLineWidthByScale(i, 0.666); }; console.log(performance.now()-time);
|
|
57
57
|
*/
|
|
58
58
|
export declare function fixLineWidthByScale(num: number, scale: number): number;
|
|
59
|
+
export declare const UNIVER_GLOBAL_DEFAULT_FONT_SIZE = 11;
|
|
60
|
+
export declare const UNIVER_GLOBAL_DEFAULT_FONT_FAMILY = "Arial";
|
|
59
61
|
export declare function getFontStyleString(textStyle?: IStyleBase, localeService?: LocaleService): {
|
|
60
62
|
fontCache: string;
|
|
61
63
|
fontString: string;
|
|
@@ -120,3 +122,5 @@ export declare function getSizeForDom(dom: HTMLElement): {
|
|
|
120
122
|
width: number;
|
|
121
123
|
height: number;
|
|
122
124
|
};
|
|
125
|
+
export declare function ptToPixel(pt: number): number;
|
|
126
|
+
export declare function pixelToPt(px: number): number;
|
|
@@ -37,16 +37,16 @@ export declare class Transform {
|
|
|
37
37
|
* Transform point
|
|
38
38
|
* @method
|
|
39
39
|
* @name UniverSheet.Transform#point
|
|
40
|
-
* @param {
|
|
41
|
-
* @returns {
|
|
40
|
+
* @param {object} point 2D point(x, y)
|
|
41
|
+
* @returns {object} 2D point(x, y)
|
|
42
42
|
*/
|
|
43
43
|
applyPoint(point: Vector2, ignoreOffset?: boolean): Vector2;
|
|
44
44
|
/**
|
|
45
45
|
* Apply translation
|
|
46
46
|
* @method
|
|
47
47
|
* @name universheet.Transform#translate
|
|
48
|
-
* @param {
|
|
49
|
-
* @param {
|
|
48
|
+
* @param {number} x
|
|
49
|
+
* @param {number} y
|
|
50
50
|
* @returns {UniverSheet.Transform}
|
|
51
51
|
*/
|
|
52
52
|
translate(x: number, y: number): this;
|
|
@@ -54,8 +54,8 @@ export declare class Transform {
|
|
|
54
54
|
* Apply scale
|
|
55
55
|
* @method
|
|
56
56
|
* @name UniverSheet.Transform#scale
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
57
|
+
* @param {number} sx
|
|
58
|
+
* @param {number} sy
|
|
59
59
|
* @returns {UniverSheet.Transform}
|
|
60
60
|
*/
|
|
61
61
|
scale(sx: number, sy: number): this;
|
|
@@ -63,7 +63,7 @@ export declare class Transform {
|
|
|
63
63
|
* Apply rotation
|
|
64
64
|
* @method
|
|
65
65
|
* @name UniverSheet.Transform#rotate
|
|
66
|
-
* @param {
|
|
66
|
+
* @param {number} Degree Angle in Degree
|
|
67
67
|
* @returns {UniverSheet.Transform}
|
|
68
68
|
*/
|
|
69
69
|
rotate(deg: number): this;
|
|
@@ -71,7 +71,7 @@ export declare class Transform {
|
|
|
71
71
|
* Returns the translation
|
|
72
72
|
* @method
|
|
73
73
|
* @name UniverSheet.Transform#getTranslation
|
|
74
|
-
* @returns {
|
|
74
|
+
* @returns {object} 2D point(x, y)
|
|
75
75
|
*/
|
|
76
76
|
getTranslation(): {
|
|
77
77
|
x: number;
|
|
@@ -81,8 +81,8 @@ export declare class Transform {
|
|
|
81
81
|
* Apply skew
|
|
82
82
|
* @method
|
|
83
83
|
* @name UniverSheet.Transform#skew
|
|
84
|
-
* @param {
|
|
85
|
-
* @param {
|
|
84
|
+
* @param {number} sx
|
|
85
|
+
* @param {number} sy
|
|
86
86
|
* @returns {UniverSheet.Transform}
|
|
87
87
|
*/
|
|
88
88
|
skew(sx: number, sy: number): this;
|
|
@@ -144,14 +144,14 @@ export declare class Transform {
|
|
|
144
144
|
* transformations from an object that is not enLived yet.
|
|
145
145
|
* is called DimensionsTransformMatrix because those properties are the one that influence
|
|
146
146
|
* the size of the resulting box of the object.
|
|
147
|
-
* @param {
|
|
148
|
-
* @param {
|
|
149
|
-
* @param {
|
|
150
|
-
* @param {
|
|
151
|
-
* @param {
|
|
152
|
-
* @param {
|
|
153
|
-
* @param {
|
|
154
|
-
* @return {
|
|
147
|
+
* @param {object} options
|
|
148
|
+
* @param {number} [options.scaleX]
|
|
149
|
+
* @param {number} [options.scaleY]
|
|
150
|
+
* @param {boolean} [options.flipX]
|
|
151
|
+
* @param {boolean} [options.flipY]
|
|
152
|
+
* @param {number} [options.skewX]
|
|
153
|
+
* @param {number} [options.skewX]
|
|
154
|
+
* @return {number[]} transform matrix
|
|
155
155
|
*/
|
|
156
156
|
private _calcDimensionsMatrix;
|
|
157
157
|
}
|
package/lib/types/canvas.d.ts
CHANGED
|
@@ -14,20 +14,36 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { UniverRenderingContext } from './context';
|
|
17
|
+
/**
|
|
18
|
+
* canvas render mode
|
|
19
|
+
*/
|
|
20
|
+
export declare enum CanvasRenderMode {
|
|
21
|
+
/**
|
|
22
|
+
* Normal canvas render mode
|
|
23
|
+
*/
|
|
24
|
+
Rendering = 0,
|
|
25
|
+
/**
|
|
26
|
+
* Printing render mode,
|
|
27
|
+
* in case of to generate high dpi pdf,
|
|
28
|
+
* some canvas api was disabled by some unknown reason.
|
|
29
|
+
*/
|
|
30
|
+
Printing = 1
|
|
31
|
+
}
|
|
17
32
|
interface ICanvasProps {
|
|
18
33
|
width?: number;
|
|
19
34
|
height?: number;
|
|
20
35
|
pixelRatio?: number;
|
|
36
|
+
mode?: CanvasRenderMode;
|
|
21
37
|
}
|
|
22
38
|
/**
|
|
23
39
|
* View Renderer constructor. It is a wrapper around native canvas element.
|
|
24
40
|
* Usually you don't need to use it manually.
|
|
25
41
|
* @constructor
|
|
26
42
|
* @abstract
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
43
|
+
* @param {object} props
|
|
44
|
+
* @param {number} props.width
|
|
45
|
+
* @param {number} props.height
|
|
46
|
+
* @param {number} props.pixelRatio
|
|
31
47
|
*/
|
|
32
48
|
export declare class Canvas {
|
|
33
49
|
isCache: boolean;
|
|
@@ -54,9 +70,9 @@ export declare class Canvas {
|
|
|
54
70
|
/**
|
|
55
71
|
* to data url
|
|
56
72
|
* @method
|
|
57
|
-
* @param {
|
|
58
|
-
* @param {
|
|
59
|
-
* @returns {
|
|
73
|
+
* @param {string} mimeType
|
|
74
|
+
* @param {number} quality between 0 and 1 for jpg mime types
|
|
75
|
+
* @returns {string} data url string
|
|
60
76
|
*/
|
|
61
77
|
toDataURL(mimeType: string, quality: number): string;
|
|
62
78
|
}
|
|
@@ -43,7 +43,6 @@ export declare function getLastSpan(page: IDocumentSkeletonPage): IDocumentSkele
|
|
|
43
43
|
export declare function isColumnFull(page: IDocumentSkeletonPage): boolean;
|
|
44
44
|
export declare function isBlankPage(page: IDocumentSkeletonPage): boolean;
|
|
45
45
|
export declare function isBlankColumn(column: IDocumentSkeletonColumn): boolean;
|
|
46
|
-
export declare function reCalculateLineDivide(): void;
|
|
47
46
|
export declare function getNumberUnitValue(unitValue: number | INumberUnit, benchMark: number): number;
|
|
48
47
|
export declare function getCharSpaceApply(charSpace: number | undefined, defaultTabStop: number, gridType?: GridType, snapToGrid?: BooleanNumber): number;
|
|
49
48
|
export declare function validationGrid(gridType?: GridType, snapToGrid?: BooleanNumber): boolean;
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import './extensions';
|
|
16
17
|
import type { Nullable } from '@univerjs/core';
|
|
17
18
|
import { Observable } from '@univerjs/core';
|
|
18
19
|
import type { IDocumentSkeletonPage } from '../../basics/i-document-skeleton-cached';
|
|
@@ -19,7 +19,7 @@ import type { UniverRenderingContext } from '../../../context';
|
|
|
19
19
|
import { docExtension } from '../doc-extension';
|
|
20
20
|
export declare class Background extends docExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
private _preBackgroundColor;
|
|
24
24
|
draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
|
|
25
25
|
clearCache(): void;
|
|
@@ -19,7 +19,7 @@ import type { UniverRenderingContext } from '../../../context';
|
|
|
19
19
|
import { docExtension } from '../doc-extension';
|
|
20
20
|
export declare class Border extends docExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
private _preBorderStyle;
|
|
24
24
|
private _preBorderColor;
|
|
25
25
|
draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
|
|
@@ -19,7 +19,7 @@ import type { UniverRenderingContext } from '../../../context';
|
|
|
19
19
|
import { docExtension } from '../doc-extension';
|
|
20
20
|
export declare class FontAndBaseLine extends docExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
private _preFontString;
|
|
24
24
|
private _preFontColor;
|
|
25
25
|
draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
|
|
@@ -19,7 +19,7 @@ import type { UniverRenderingContext } from '../../../context';
|
|
|
19
19
|
import { docExtension } from '../doc-extension';
|
|
20
20
|
export declare class Line extends docExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
private _preBackgroundColor;
|
|
24
24
|
draw(ctx: UniverRenderingContext, parentScale: IScale, span: IDocumentSkeletonSpan): void;
|
|
25
25
|
clearCache(): void;
|
|
@@ -24,19 +24,15 @@ import type { Scene } from '../../scene';
|
|
|
24
24
|
import type { Viewport } from '../../viewport';
|
|
25
25
|
import { TextRange } from './common/text-range';
|
|
26
26
|
import type { DocumentSkeleton } from './doc-skeleton';
|
|
27
|
-
import type { Documents
|
|
27
|
+
import type { Documents } from './document';
|
|
28
28
|
export declare function getCanvasOffsetByEngine(engine: Nullable<Engine>): {
|
|
29
29
|
left: number;
|
|
30
30
|
top: number;
|
|
31
31
|
};
|
|
32
|
-
interface IAddTextRangesConfig {
|
|
33
|
-
scene: Scene;
|
|
34
|
-
skeleton: DocumentSkeleton;
|
|
35
|
-
documentOffsetConfig: IDocumentOffsetConfig;
|
|
36
|
-
}
|
|
37
32
|
export interface ITextSelectionInnerParam {
|
|
38
33
|
textRanges: TextRange[];
|
|
39
34
|
segmentId: string;
|
|
35
|
+
isEditing: boolean;
|
|
40
36
|
style: ITextSelectionStyle;
|
|
41
37
|
}
|
|
42
38
|
export interface IActiveTextRange {
|
|
@@ -58,6 +54,8 @@ export interface ITextSelectionRenderManager {
|
|
|
58
54
|
readonly onCompositionend$: Observable<Nullable<IEditorInputConfig>>;
|
|
59
55
|
readonly onSelectionStart$: Observable<Nullable<INodePosition>>;
|
|
60
56
|
readonly onPaste$: Observable<Nullable<IEditorInputConfig>>;
|
|
57
|
+
readonly onFocus$: Observable<Nullable<IEditorInputConfig>>;
|
|
58
|
+
readonly onBlur$: Observable<Nullable<IEditorInputConfig>>;
|
|
61
59
|
readonly textSelectionInner$: Observable<Nullable<ITextSelectionInnerParam>>;
|
|
62
60
|
__getEditorContainer(): HTMLElement;
|
|
63
61
|
getViewPort(): Viewport;
|
|
@@ -67,12 +65,13 @@ export interface ITextSelectionRenderManager {
|
|
|
67
65
|
setStyle(style: ITextSelectionStyle): void;
|
|
68
66
|
resetStyle(): void;
|
|
69
67
|
removeAllTextRanges(): void;
|
|
70
|
-
addTextRanges(ranges: ISuccinctTextRangeParam[],
|
|
68
|
+
addTextRanges(ranges: ISuccinctTextRangeParam[], isEditing?: boolean): void;
|
|
71
69
|
sync(): void;
|
|
72
70
|
activate(x: number, y: number): void;
|
|
71
|
+
deactivate(): void;
|
|
72
|
+
hasFocus(): boolean;
|
|
73
73
|
focus(): void;
|
|
74
74
|
blur(): void;
|
|
75
|
-
deactivate(): void;
|
|
76
75
|
changeRuntime(docSkeleton: DocumentSkeleton, scene: Scene, document: Documents): void;
|
|
77
76
|
dispose(): void;
|
|
78
77
|
handleDblClick(evt: IPointerEvent | IMouseEvent): void;
|
|
@@ -105,6 +104,10 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
105
104
|
readonly onPaste$: Observable<Nullable<IEditorInputConfig>>;
|
|
106
105
|
private readonly _textSelectionInner$;
|
|
107
106
|
readonly textSelectionInner$: Observable<Nullable<ITextSelectionInnerParam>>;
|
|
107
|
+
private readonly _onFocus$;
|
|
108
|
+
readonly onFocus$: Observable<Nullable<IEditorInputConfig>>;
|
|
109
|
+
private readonly _onBlur$;
|
|
110
|
+
readonly onBlur$: Observable<Nullable<IEditorInputConfig>>;
|
|
108
111
|
private _container;
|
|
109
112
|
private _inputParent;
|
|
110
113
|
private _input;
|
|
@@ -131,9 +134,10 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
131
134
|
resetStyle(): void;
|
|
132
135
|
enableSelection(): void;
|
|
133
136
|
disableSelection(): void;
|
|
134
|
-
addTextRanges(ranges: ISuccinctTextRangeParam[]): void;
|
|
137
|
+
addTextRanges(ranges: ISuccinctTextRangeParam[], isEditing?: boolean): void;
|
|
135
138
|
sync(): void;
|
|
136
139
|
activate(x: number, y: number): void;
|
|
140
|
+
hasFocus(): boolean;
|
|
137
141
|
focus(): void;
|
|
138
142
|
blur(): void;
|
|
139
143
|
deactivate(): void;
|
|
@@ -171,4 +175,3 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
171
175
|
private _activeSelectionRefresh;
|
|
172
176
|
}
|
|
173
177
|
export declare const ITextSelectionRenderManager: import("@wendellhu/redi").IdentifierDecorator<TextSelectionRenderManager>;
|
|
174
|
-
export {};
|
|
@@ -29,16 +29,17 @@ export interface IExtensionConfig {
|
|
|
29
29
|
export declare class ComponentExtension<T, U, V> {
|
|
30
30
|
uKey: string;
|
|
31
31
|
type: U;
|
|
32
|
-
|
|
32
|
+
protected Z_INDEX: number;
|
|
33
33
|
parent: Nullable<BaseObject>;
|
|
34
34
|
translateX: number;
|
|
35
35
|
translateY: number;
|
|
36
36
|
extensionOffset: IExtensionConfig;
|
|
37
|
+
get zIndex(): number;
|
|
37
38
|
draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: T, diffBounds?: V): void;
|
|
38
39
|
clearCache(): void;
|
|
39
40
|
protected _getScale(parentScale: IScale): number;
|
|
40
41
|
}
|
|
41
|
-
export declare const SpreadsheetExtensionRegistry: Registry
|
|
42
|
-
export declare const SheetRowHeaderExtensionRegistry: Registry
|
|
43
|
-
export declare const SheetColumnHeaderExtensionRegistry: Registry
|
|
44
|
-
export declare const DocumentsSpanAndLineExtensionRegistry: Registry
|
|
42
|
+
export declare const SpreadsheetExtensionRegistry: Registry<any>;
|
|
43
|
+
export declare const SheetRowHeaderExtensionRegistry: Registry<any>;
|
|
44
|
+
export declare const SheetColumnHeaderExtensionRegistry: Registry<any>;
|
|
45
|
+
export declare const DocumentsSpanAndLineExtensionRegistry: Registry<any>;
|
|
@@ -19,6 +19,8 @@ import type { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
|
19
19
|
import { SheetExtension } from './sheet-extension';
|
|
20
20
|
export declare class Background extends SheetExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
|
+
PRINTING_Z_INDEX: number;
|
|
24
|
+
get zIndex(): number;
|
|
23
25
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
|
|
24
26
|
}
|
|
@@ -19,7 +19,7 @@ import type { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
|
19
19
|
import { SheetExtension } from './sheet-extension';
|
|
20
20
|
export declare class Border extends SheetExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
|
|
24
24
|
private _getOverflowExclusion;
|
|
25
25
|
}
|
|
@@ -19,6 +19,6 @@ import type { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
|
19
19
|
import { SheetExtension } from './sheet-extension';
|
|
20
20
|
export declare class ColumnHeaderLayout extends SheetExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton): void;
|
|
24
24
|
}
|
|
@@ -17,11 +17,13 @@ import type { IColorStyle, IRange, IScale } from '@univerjs/core';
|
|
|
17
17
|
import { ObjectMatrix } from '@univerjs/core';
|
|
18
18
|
import type { UniverRenderingContext } from '../../../context';
|
|
19
19
|
import { type SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
20
|
+
import type { Spreadsheet } from '../spreadsheet';
|
|
20
21
|
import { SheetExtension } from './sheet-extension';
|
|
21
22
|
export declare class Font extends SheetExtension {
|
|
22
23
|
uKey: string;
|
|
23
|
-
|
|
24
|
+
Z_INDEX: number;
|
|
24
25
|
changeFontColor: ObjectMatrix<IColorStyle>;
|
|
26
|
+
get spreadsheet(): Spreadsheet;
|
|
25
27
|
getDocuments(): any;
|
|
26
28
|
setChangeFontColor(r: number, c: number, color: IColorStyle): void;
|
|
27
29
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
|
|
@@ -19,6 +19,6 @@ import type { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
|
19
19
|
import { SheetExtension } from './sheet-extension';
|
|
20
20
|
export declare class RowHeaderLayout extends SheetExtension {
|
|
21
21
|
uKey: string;
|
|
22
|
-
|
|
22
|
+
Z_INDEX: number;
|
|
23
23
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton): void;
|
|
24
24
|
}
|
|
@@ -23,7 +23,6 @@ import type { IStylesCache } from './interfaces';
|
|
|
23
23
|
* Obtain the height and width of a cell's text, taking into account scenarios with rotated text.
|
|
24
24
|
* @param documentSkeleton Data of the document's ViewModel
|
|
25
25
|
* @param angleInDegree The rotation angle of an Excel cell, it's **degree**
|
|
26
|
-
* @returns
|
|
27
26
|
*/
|
|
28
27
|
export declare function getDocsSkeletonPageSize(documentSkeleton: DocumentSkeleton, angleInDegree?: number): {
|
|
29
28
|
width: number;
|
|
@@ -85,26 +84,18 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
85
84
|
get columnHeaderHeightAndMarginTop(): number;
|
|
86
85
|
/**
|
|
87
86
|
* @deprecated
|
|
88
|
-
* @param config
|
|
89
|
-
* @param cellData
|
|
90
|
-
* @param styles
|
|
91
|
-
* @param LocaleService
|
|
92
|
-
* @returns
|
|
93
87
|
*/
|
|
94
88
|
static create(worksheet: Worksheet | undefined, config: IWorksheetData, cellData: ObjectMatrix<Nullable<ICellData>>, styles: Styles, LocaleService: LocaleService): SpreadsheetSkeleton;
|
|
95
89
|
/**
|
|
96
90
|
* @deprecated should never expose a property that is provided by another module!
|
|
97
|
-
* @returns
|
|
98
91
|
*/
|
|
99
92
|
getWorksheetConfig(): IWorksheetData;
|
|
100
93
|
/**
|
|
101
94
|
* @deprecated should never expose a property that is provided by another module!
|
|
102
|
-
* @returns
|
|
103
95
|
*/
|
|
104
96
|
getCellData(): ObjectMatrix<Nullable<ICellData>>;
|
|
105
97
|
/**
|
|
106
98
|
* @deprecated should never expose a property that is provided by another module!
|
|
107
|
-
* @returns
|
|
108
99
|
*/
|
|
109
100
|
getsStyles(): Styles;
|
|
110
101
|
setOverflowCache(value: ObjectMatrix<IRange>): void;
|
|
@@ -162,7 +153,9 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
162
153
|
* @param offsetY HTML coordinate system, mouse position y.
|
|
163
154
|
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
164
155
|
* @param scaleY render scene scale y-axis, scene.getAncestorScale
|
|
165
|
-
* @param scrollXY
|
|
156
|
+
* @param scrollXY render viewport scroll {x, y}, scene.getScrollXYByRelativeCoords, scene.getScrollXY
|
|
157
|
+
* @param scrollXY.x
|
|
158
|
+
* @param scrollXY.y
|
|
166
159
|
* @returns Selection data with coordinates
|
|
167
160
|
*/
|
|
168
161
|
calculateCellIndexByPosition(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
@@ -176,6 +169,8 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
176
169
|
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
177
170
|
* @param scaleY render scene scale y-axis, scene.getAncestorScale
|
|
178
171
|
* @param scrollXY render viewport scroll {x, y}, scene.getScrollXYByRelativeCoords, scene.getScrollXY
|
|
172
|
+
* @param scrollXY.x
|
|
173
|
+
* @param scrollXY.y
|
|
179
174
|
* @returns Hit cell coordinates
|
|
180
175
|
*/
|
|
181
176
|
getCellPositionByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
@@ -201,7 +196,8 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
201
196
|
* @param offsetY scaled offset y
|
|
202
197
|
* @param scaleY scale y
|
|
203
198
|
* @param scrollXY
|
|
204
|
-
* @
|
|
199
|
+
* @param scrollXY.x
|
|
200
|
+
* @param scrollXY.y
|
|
205
201
|
*/
|
|
206
202
|
getRowPositionByOffsetY(offsetY: number, scaleY: number, scrollXY: {
|
|
207
203
|
x: number;
|
|
@@ -221,8 +217,6 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
221
217
|
* Return cell information corresponding to the current coordinates, including the merged cell object.
|
|
222
218
|
* @param row Specified Row Coordinate
|
|
223
219
|
* @param column Specified Column Coordinate
|
|
224
|
-
* @param scaleX render scene scale x-axis, current Horizontal Scale, scene.getAncestorScale
|
|
225
|
-
* @param scaleY render scene scale y-axis, current Vertical Scale, scene.getAncestorScale
|
|
226
220
|
*/
|
|
227
221
|
getCellByIndex(row: number, column: number): ISelectionCellWithCoord;
|
|
228
222
|
getCellByIndexWithNoHeader(row: number, column: number): {
|
|
@@ -281,7 +275,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
281
275
|
*
|
|
282
276
|
* @param rowHeightAccumulation Row layout information
|
|
283
277
|
* @param columnWidthAccumulation Column layout information
|
|
284
|
-
* @param
|
|
278
|
+
* @param viewBound The range of the visible area of the canvas
|
|
285
279
|
* @returns The range cell index of the canvas visible area
|
|
286
280
|
*/
|
|
287
281
|
protected _getBounding(rowHeightAccumulation: number[], columnWidthAccumulation: number[], viewBound?: IBoundRectNoAngle): {
|
|
@@ -307,7 +301,6 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
307
301
|
* Cache the merged cells on the current screen to improve computational performance.
|
|
308
302
|
* @param mergeData all marge data
|
|
309
303
|
* @param rowColumnSegment current screen range, include row and column
|
|
310
|
-
* @returns
|
|
311
304
|
*/
|
|
312
305
|
private _getMergeCells;
|
|
313
306
|
}
|
|
@@ -32,12 +32,16 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
32
32
|
private _overflowCacheRuntime;
|
|
33
33
|
private _overflowCacheRuntimeRange;
|
|
34
34
|
private _overflowCacheRuntimeTimeout;
|
|
35
|
+
private _forceDisableGridlines;
|
|
35
36
|
private _documents;
|
|
37
|
+
isPrinting: boolean;
|
|
36
38
|
constructor(oKey: string, spreadsheetSkeleton?: SpreadsheetSkeleton, _allowCache?: boolean);
|
|
37
39
|
get backgroundExtension(): Background;
|
|
38
40
|
get borderExtension(): Border;
|
|
39
41
|
get fontExtension(): Font;
|
|
40
42
|
getDocuments(): Documents;
|
|
43
|
+
get allowCache(): boolean;
|
|
44
|
+
get forceDisableGridlines(): boolean;
|
|
41
45
|
draw(ctx: UniverRenderingContext, bounds?: IViewportBound): void;
|
|
42
46
|
isHit(coord: Vector2): boolean;
|
|
43
47
|
getNoMergeCellPositionByIndex(rowIndex: number, columnIndex: number): {
|
|
@@ -51,6 +55,7 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
51
55
|
y: number;
|
|
52
56
|
};
|
|
53
57
|
makeForceDirty(state?: boolean): void;
|
|
58
|
+
setForceDisableGridlines(disabled: boolean): void;
|
|
54
59
|
getSelectionBounding(startRow: number, startColumn: number, endRow: number, endColumn: number): {
|
|
55
60
|
startRow: number;
|
|
56
61
|
startColumn: number;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
39
39
|
set lineJoin(val: CanvasLineJoin);
|
|
40
40
|
get lineWidth(): number;
|
|
41
41
|
set lineWidth(val: number);
|
|
42
|
+
setLineWidthNative(val: number): void;
|
|
42
43
|
get miterLimit(): number;
|
|
43
44
|
set miterLimit(val: number);
|
|
44
45
|
get shadowBlur(): number;
|
|
@@ -269,6 +270,8 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
269
270
|
translate(x: number, y: number): void;
|
|
270
271
|
translateWithPrecision(x: number, y: number): void;
|
|
271
272
|
translateWithPrecisionRatio(x: number, y: number): void;
|
|
273
|
+
clearRectForTexture(x: number, y: number, width: number, height: number): void;
|
|
274
|
+
setGlobalCompositeOperation(val: GlobalCompositeOperation): void;
|
|
272
275
|
}
|
|
273
276
|
/**
|
|
274
277
|
* TODO
|
|
@@ -282,3 +285,9 @@ export declare class UniverRenderingContextWebGPU {
|
|
|
282
285
|
}
|
|
283
286
|
export declare class UniverRenderingContext extends UniverRenderingContext2D {
|
|
284
287
|
}
|
|
288
|
+
export declare class UniverPrintingContext extends UniverRenderingContext2D {
|
|
289
|
+
private __getScale;
|
|
290
|
+
clearRect(x: number, y: number, width: number, height: number): void;
|
|
291
|
+
clearRectForTexture(x: number, y: number, width: number, height: number): void;
|
|
292
|
+
setGlobalCompositeOperation(val: GlobalCompositeOperation): void;
|
|
293
|
+
}
|
package/lib/types/engine.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Observable } from '@univerjs/core';
|
|
17
17
|
import type { CURSOR_TYPE } from './basics/const';
|
|
18
|
-
import { Canvas } from './canvas';
|
|
18
|
+
import { Canvas, type CanvasRenderMode } from './canvas';
|
|
19
19
|
import type { Scene } from './scene';
|
|
20
20
|
import { ThinEngine } from './thin-engine';
|
|
21
21
|
export declare class Engine extends ThinEngine<Scene> {
|
|
@@ -52,7 +52,7 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
52
52
|
private pointer;
|
|
53
53
|
private _mouseId;
|
|
54
54
|
private _isUsingFirefox;
|
|
55
|
-
constructor(elemWidth?: number, elemHeight?: number);
|
|
55
|
+
constructor(elemWidth?: number, elemHeight?: number, pixelRatio?: number, mode?: CanvasRenderMode);
|
|
56
56
|
get width(): number;
|
|
57
57
|
get height(): number;
|
|
58
58
|
get requestNewFrameHandler(): number;
|
|
@@ -70,7 +70,7 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
70
70
|
*/
|
|
71
71
|
setRemainCapture(): void;
|
|
72
72
|
getPixelRatio(): number;
|
|
73
|
-
setContainer(elem: HTMLElement): void;
|
|
73
|
+
setContainer(elem: HTMLElement, resize?: boolean): void;
|
|
74
74
|
resize(): void;
|
|
75
75
|
resizeBySize(width: number, height: number): void;
|
|
76
76
|
dispose(): void;
|
package/lib/types/layer.d.ts
CHANGED
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Disposable } from '@univerjs/core';
|
|
16
17
|
import { BaseObject } from './base-object';
|
|
17
18
|
import type { UniverRenderingContext } from './context';
|
|
18
19
|
import type { ThinScene } from './thin-scene';
|
|
19
|
-
export declare class Layer {
|
|
20
|
+
export declare class Layer extends Disposable {
|
|
20
21
|
private _scene;
|
|
21
22
|
private _zIndex;
|
|
22
23
|
private _allowCache;
|
|
@@ -23,16 +23,20 @@ import { Engine } from './engine';
|
|
|
23
23
|
import { Scene } from './scene';
|
|
24
24
|
export interface IRenderManagerService {
|
|
25
25
|
currentRender$: Observable<Nullable<string>>;
|
|
26
|
+
createRender$: Observable<Nullable<string>>;
|
|
26
27
|
dispose(): void;
|
|
27
28
|
createRenderWithParent(unitId: string, parentUnitId: string): IRender;
|
|
28
29
|
createRender(unitId: string): IRender;
|
|
29
30
|
addItem(unitId: string, item: IRender): void;
|
|
30
31
|
removeItem(unitId: string): void;
|
|
31
32
|
setCurrent(unitId: string): void;
|
|
32
|
-
getCurrent(): Nullable<IRender>;
|
|
33
33
|
getRenderById(unitId: string): Nullable<IRender>;
|
|
34
34
|
getRenderAll(): Map<string, IRender>;
|
|
35
35
|
defaultEngine: Engine;
|
|
36
|
+
create(unitId: Nullable<string>): void;
|
|
37
|
+
getCurrent(): Nullable<IRender>;
|
|
38
|
+
getFirst(): Nullable<IRender>;
|
|
39
|
+
has(unitId: string): boolean;
|
|
36
40
|
}
|
|
37
41
|
export type RenderComponentType = SheetComponent | DocComponent | Slide | BaseObject;
|
|
38
42
|
export interface IRender {
|
|
@@ -49,15 +53,20 @@ export declare class RenderManagerService implements IRenderManagerService {
|
|
|
49
53
|
private _renderMap;
|
|
50
54
|
private readonly _currentRender$;
|
|
51
55
|
readonly currentRender$: Observable<Nullable<string>>;
|
|
56
|
+
private readonly _createRender$;
|
|
57
|
+
readonly createRender$: Observable<Nullable<string>>;
|
|
52
58
|
get defaultEngine(): Engine;
|
|
53
59
|
dispose(): void;
|
|
54
60
|
createRenderWithParent(unitId: string, parentUnitId: string): IRender;
|
|
61
|
+
create(unitId: Nullable<string>): void;
|
|
55
62
|
createRender(unitId: string): IRender;
|
|
56
63
|
private _createRender;
|
|
57
64
|
addItem(unitId: string, item: IRender): void;
|
|
58
65
|
removeItem(unitId: string): void;
|
|
66
|
+
has(unitId: string): boolean;
|
|
59
67
|
setCurrent(unitId: string): void;
|
|
60
|
-
getCurrent():
|
|
68
|
+
getCurrent(): IRender | undefined;
|
|
69
|
+
getFirst(): IRender;
|
|
61
70
|
getRenderById(unitId: string): Nullable<IRender>;
|
|
62
71
|
getRenderAll(): Map<string, IRender>;
|
|
63
72
|
private _disposeItem;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { Nullable } from '@univerjs/core';
|
|
17
|
-
import { Observable } from '@univerjs/core';
|
|
17
|
+
import { Disposable, Observable } from '@univerjs/core';
|
|
18
18
|
import type { BaseObject } from './base-object';
|
|
19
19
|
import type { IMouseEvent, IPointerEvent } from './basics/i-events';
|
|
20
20
|
import { Group } from './group';
|
|
@@ -65,7 +65,7 @@ export interface ITransformerConfig {
|
|
|
65
65
|
* primitives and shapes. Transforming tool is not changing `width` and `height` properties of nodes
|
|
66
66
|
* when you resize them. Instead it changes `scaleX` and `scaleY` properties.
|
|
67
67
|
*/
|
|
68
|
-
export declare class Transformer implements ITransformerConfig {
|
|
68
|
+
export declare class Transformer extends Disposable implements ITransformerConfig {
|
|
69
69
|
private _scene;
|
|
70
70
|
hoverEnabled: boolean;
|
|
71
71
|
hoverEnterFunc: Nullable<(e: IPointerEvent | IMouseEvent) => void>;
|