@univerjs/engine-render 0.1.0-beta.5 → 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/lib/cjs/index.js +3 -3
- package/lib/es/index.js +6107 -6007
- package/lib/types/basics/tools.d.ts +4 -0
- 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/text-selection-render-manager.d.ts +13 -10
- package/lib/types/components/sheets/sheet-skeleton.d.ts +8 -15
- 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/thin-scene.d.ts +2 -2
- package/lib/umd/index.js +3 -3
- package/package.json +4 -4
|
@@ -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;
|
|
@@ -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';
|
|
@@ -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 {};
|
|
@@ -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
|
}
|
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>;
|
|
@@ -13,9 +13,10 @@
|
|
|
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 type { IMouseEvent } from './basics/i-events';
|
|
17
18
|
import type { ThinScene } from './thin-scene';
|
|
18
|
-
export declare class InputManager {
|
|
19
|
+
export declare class InputManager extends Disposable {
|
|
19
20
|
/** The distance in pixel that you have to move to prevent some events */
|
|
20
21
|
static DragMovementThreshold: number;
|
|
21
22
|
/** Time in milliseconds to wait to raise long press events if button is still pressed */
|
|
@@ -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
|
|
16
|
+
import { Disposable, type Nullable } from '@univerjs/core';
|
|
17
17
|
import type { Vector2 } from '../basics/vector2';
|
|
18
18
|
import type { UniverRenderingContext } from '../context';
|
|
19
19
|
import type { ThinScene } from '../thin-scene';
|
|
@@ -32,7 +32,7 @@ export interface IScrollBarProps {
|
|
|
32
32
|
enableVertical?: boolean;
|
|
33
33
|
mainScene?: ThinScene;
|
|
34
34
|
}
|
|
35
|
-
export declare class BaseScrollBar {
|
|
35
|
+
export declare class BaseScrollBar extends Disposable {
|
|
36
36
|
enableHorizontal: boolean;
|
|
37
37
|
enableVertical: boolean;
|
|
38
38
|
horizontalThumbWidth: number;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { EventState, Nullable, Observer } 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 { EVENT_TYPE } from './basics/const';
|
|
20
20
|
import { RENDER_CLASS_TYPE } from './basics/const';
|
|
@@ -23,7 +23,7 @@ import type { ITransformChangeState } from './basics/interfaces';
|
|
|
23
23
|
import { Transform } from './basics/transform';
|
|
24
24
|
import type { IViewportBound, Vector2 } from './basics/vector2';
|
|
25
25
|
import type { UniverRenderingContext } from './context';
|
|
26
|
-
export declare abstract class ThinScene {
|
|
26
|
+
export declare abstract class ThinScene extends Disposable {
|
|
27
27
|
onTransformChangeObservable: Observable<ITransformChangeState>;
|
|
28
28
|
onPointerDownObserver: Observable<IMouseEvent | IPointerEvent>;
|
|
29
29
|
onPointerMoveObserver: Observable<IMouseEvent | IPointerEvent>;
|