@univerjs/engine-render 1.0.0-alpha.2 → 1.0.0-alpha.3
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 +1353 -351
- package/lib/es/index.js +1349 -326
- package/lib/types/basics/cjk-regexp.d.ts +61 -0
- package/lib/types/basics/draw.d.ts +4 -4
- package/lib/types/basics/i-document-skeleton-cached.d.ts +10 -0
- package/lib/types/basics/index.d.ts +2 -0
- package/lib/types/basics/interfaces.d.ts +3 -1
- package/lib/types/basics/tools.d.ts +0 -3
- package/lib/types/components/docs/custom-block-render-viewport.d.ts +37 -0
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +3 -1
- package/lib/types/components/docs/layout/doc-no-wrap-measure.d.ts +35 -0
- package/lib/types/components/docs/layout/tools.d.ts +1 -0
- package/lib/types/components/extension.d.ts +2 -0
- package/lib/types/components/sheets/extensions/background.d.ts +2 -1
- package/lib/types/components/sheets/extensions/font.d.ts +2 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +5 -0
- package/lib/types/components/sheets/interfaces.d.ts +3 -0
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +14 -9
- package/lib/types/index.d.ts +3 -0
- package/lib/types/render-manager/render-manager.service.d.ts +1 -1
- package/lib/types/render-manager/render-unit.d.ts +3 -0
- package/lib/types/shape/scroll-bar.d.ts +8 -0
- package/lib/types/shape/text.d.ts +4 -0
- package/lib/types/viewport.d.ts +7 -1
- package/lib/umd/index.js +5 -2
- package/package.json +4 -5
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
type CharsetDataUnit = [number, number];
|
|
17
|
+
/**
|
|
18
|
+
* Returns the CJK letter charset generated from `cjk-regex@3.4.0`.
|
|
19
|
+
*/
|
|
20
|
+
declare function letters(): import("@univerjs/core/common/regexp/charset.js").Charset;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the CJK punctuation charset generated from `cjk-regex@3.4.0`.
|
|
23
|
+
*/
|
|
24
|
+
declare function punctuations(): import("@univerjs/core/common/regexp/charset.js").Charset;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the combined CJK letter and punctuation charset generated from `cjk-regex@3.4.0`.
|
|
27
|
+
*/
|
|
28
|
+
declare function all(): import("@univerjs/core/common/regexp/charset.js").Charset;
|
|
29
|
+
/**
|
|
30
|
+
* Returns true when text contains CJK letters, excluding punctuation and symbols.
|
|
31
|
+
*/
|
|
32
|
+
declare function hasCJKText(text: string): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Returns true when text contains CJK letters or CJK punctuation.
|
|
35
|
+
*/
|
|
36
|
+
declare function hasCJK(text: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns true when text contains CJK punctuation, excluding CJK letters.
|
|
39
|
+
*/
|
|
40
|
+
declare function hasCJKPunctuation(text: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Namespace-style CJK regex API used by document rendering and layout.
|
|
43
|
+
*/
|
|
44
|
+
export declare const cjk: {
|
|
45
|
+
CJK_LETTER_SOURCE: string;
|
|
46
|
+
CJK_PUNCTUATION_SOURCE: string;
|
|
47
|
+
CJK_ALL_SOURCE: string;
|
|
48
|
+
CJK_LETTER_REG: RegExp;
|
|
49
|
+
CJK_PUNCTUATION_REG: RegExp;
|
|
50
|
+
CJK_ALL_REG: RegExp;
|
|
51
|
+
CJK_LETTER_DATA: CharsetDataUnit[];
|
|
52
|
+
CJK_PUNCTUATION_DATA: CharsetDataUnit[];
|
|
53
|
+
CJK_ALL_DATA: CharsetDataUnit[];
|
|
54
|
+
letters: typeof letters;
|
|
55
|
+
punctuations: typeof punctuations;
|
|
56
|
+
all: typeof all;
|
|
57
|
+
hasCJKText: typeof hasCJKText;
|
|
58
|
+
hasCJK: typeof hasCJK;
|
|
59
|
+
hasCJKPunctuation: typeof hasCJKPunctuation;
|
|
60
|
+
};
|
|
61
|
+
export {};
|
|
@@ -17,7 +17,7 @@ import type { IPosition } from '@univerjs/core';
|
|
|
17
17
|
import type { UniverRenderingContext } from '../context';
|
|
18
18
|
import type { IDocumentSkeletonLine } from './i-document-skeleton-cached';
|
|
19
19
|
import { BorderStyleTypes } from '@univerjs/core';
|
|
20
|
-
import { BORDER_TYPE
|
|
20
|
+
import { BORDER_TYPE, ORIENTATION_TYPE } from './const';
|
|
21
21
|
import { Vector2 } from './vector2';
|
|
22
22
|
export interface IContext2D extends CanvasRenderingContext2D {
|
|
23
23
|
webkitBackingStorePixelRatio: number;
|
|
@@ -34,9 +34,9 @@ export declare function getDevicePixelRatio(): number;
|
|
|
34
34
|
* @param lineWidthBuffer Solving the problem of mitered corners in the drawing of borders thicker than 2 pixels, caused by the line segments being centered.
|
|
35
35
|
* @param position border draw position
|
|
36
36
|
*/
|
|
37
|
-
export declare function drawLineByBorderType(ctx: UniverRenderingContext, type:
|
|
38
|
-
export declare function drawDiagonalLineByBorderType(ctx: UniverRenderingContext, style: BorderStyleTypes, type:
|
|
39
|
-
export declare function clearLineByBorderType(ctx: UniverRenderingContext, type:
|
|
37
|
+
export declare function drawLineByBorderType(ctx: UniverRenderingContext, type: BORDER_TYPE, lineWidthBuffer: number, position: IPosition): void;
|
|
38
|
+
export declare function drawDiagonalLineByBorderType(ctx: UniverRenderingContext, style: BorderStyleTypes, type: BORDER_TYPE, position: IPosition): void;
|
|
39
|
+
export declare function clearLineByBorderType(ctx: UniverRenderingContext, type: BORDER_TYPE, position: IPosition): void;
|
|
40
40
|
export declare function setLineType(ctx: UniverRenderingContext, style: BorderStyleTypes): void;
|
|
41
41
|
export declare function getLineOffset(): number;
|
|
42
42
|
export declare function getLineWith(width: number): number;
|
|
@@ -45,6 +45,8 @@ export declare enum DocumentSkeletonPageType {
|
|
|
45
45
|
CELL = 3
|
|
46
46
|
}
|
|
47
47
|
export interface IDocumentSkeletonPage {
|
|
48
|
+
/** Stable id of the document section that owns this body page. */
|
|
49
|
+
sectionId?: string;
|
|
48
50
|
sections: IDocumentSkeletonSection[];
|
|
49
51
|
headerId: string;
|
|
50
52
|
footerId: string;
|
|
@@ -233,6 +235,14 @@ export interface IDocumentSkeletonDrawing {
|
|
|
233
235
|
lineTop: number;
|
|
234
236
|
lineHeight: number;
|
|
235
237
|
blockAnchorTop: number;
|
|
238
|
+
customBlockRenderViewport?: {
|
|
239
|
+
bleedLeft?: number;
|
|
240
|
+
bleedWidth?: number;
|
|
241
|
+
contentHeight?: number;
|
|
242
|
+
contentWidth?: number;
|
|
243
|
+
height?: number;
|
|
244
|
+
viewportHeight?: number;
|
|
245
|
+
};
|
|
236
246
|
}
|
|
237
247
|
export interface IDocumentSkeletonFontStyle {
|
|
238
248
|
fontString: string;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export * from '../components/docs/layout/shaping-engine/font-cache';
|
|
17
17
|
export * from './cell-data';
|
|
18
|
+
export { cjk } from './cjk-regexp';
|
|
18
19
|
export * from './const';
|
|
19
20
|
export * from './document-node-tools';
|
|
20
21
|
export * from './draw';
|
|
@@ -29,5 +30,6 @@ export * from './scroll-xy';
|
|
|
29
30
|
export * from './text-rotation';
|
|
30
31
|
export * from './tools';
|
|
31
32
|
export * from './transform';
|
|
33
|
+
export type { ITransformerConfig } from './transformer-config';
|
|
32
34
|
export * from './vector2';
|
|
33
35
|
export * from './zoom';
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { BooleanNumber, GridType, IDocStyleBase, IDocumentLayout, IOffset, IParagraphStyle, IReferenceSource, IScale, ISectionBreakBase, ISize, ITextStyle, ITransformState, LocaleService } from '@univerjs/core';
|
|
17
|
-
import type { DataStreamTreeNode } from '../components/docs/view-model/data-stream-tree-node';
|
|
18
17
|
import type { IDocumentCompatibilityPolicy } from '../components/docs/document-compatibility';
|
|
18
|
+
import type { DataStreamTreeNode } from '../components/docs/view-model/data-stream-tree-node';
|
|
19
19
|
import type { DocumentViewModel } from '../components/docs/view-model/document-view-model';
|
|
20
20
|
import type { DocumentSkeletonPageType, IDocumentSkeletonBullet, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonHeaderFooter, IDocumentSkeletonTable } from './i-document-skeleton-cached';
|
|
21
21
|
import type { ITransformerConfig } from './transformer-config';
|
|
@@ -77,6 +77,7 @@ export interface IFooterIds {
|
|
|
77
77
|
firstPageFooterId?: string;
|
|
78
78
|
}
|
|
79
79
|
export interface ISectionBreakConfig extends IDocStyleBase, ISectionBreakBase, IDocsConfig {
|
|
80
|
+
sectionId: string;
|
|
80
81
|
headerIds?: IHeaderIds;
|
|
81
82
|
footerIds?: IFooterIds;
|
|
82
83
|
useFirstPageHeaderFooter?: BooleanNumber;
|
|
@@ -96,6 +97,7 @@ export interface IParagraphConfig {
|
|
|
96
97
|
docxFallbackAnchorLeft?: IParagraphStyle['indentStart'];
|
|
97
98
|
paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
|
|
98
99
|
paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
|
|
100
|
+
topBottomCustomBlockFlowBottom?: number;
|
|
99
101
|
skeTablesInParagraph?: IParagraphTableCache[];
|
|
100
102
|
bulletSkeleton?: IDocumentSkeletonBullet;
|
|
101
103
|
paragraphStyle?: IParagraphStyle;
|
|
@@ -58,9 +58,6 @@ export declare function precisionTo(num: number, accurate: number): number;
|
|
|
58
58
|
*/
|
|
59
59
|
export declare function fixLineWidthByScale(num: number, scale: number): number;
|
|
60
60
|
export declare function getFontStyleString(textStyle?: Nullable<IStyleBase>): IDocumentSkeletonFontStyle;
|
|
61
|
-
export declare function hasCJKText(text: string): boolean;
|
|
62
|
-
export declare function hasCJK(text: string): boolean;
|
|
63
|
-
export declare function hasCJKPunctuation(text: string): boolean;
|
|
64
61
|
export declare function hasAllLatin(text: string): boolean;
|
|
65
62
|
export declare function hasBasicLatin(text: string): boolean;
|
|
66
63
|
export declare function hasLatinOneSupplement(text: string): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export interface IDocsCustomBlockRenderViewportInput {
|
|
17
|
+
blockLeft?: number;
|
|
18
|
+
fallbackHeight: number;
|
|
19
|
+
fallbackWidth: number;
|
|
20
|
+
pageMarginLeft?: number;
|
|
21
|
+
pageMarginRight?: number;
|
|
22
|
+
pageWidth?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface IDocsCustomBlockRenderViewport {
|
|
25
|
+
bleedLeft?: number;
|
|
26
|
+
bleedWidth?: number;
|
|
27
|
+
contentHeight?: number;
|
|
28
|
+
contentWidth?: number;
|
|
29
|
+
height: number;
|
|
30
|
+
layoutWidth?: number;
|
|
31
|
+
offsetLeft?: number;
|
|
32
|
+
viewportHeight?: number;
|
|
33
|
+
width: number;
|
|
34
|
+
}
|
|
35
|
+
export type DocsCustomBlockRenderViewportProvider = (unitId: string, blockId: string, input: IDocsCustomBlockRenderViewportInput) => IDocsCustomBlockRenderViewport | null | undefined;
|
|
36
|
+
export declare function setDocsCustomBlockRenderViewportProvider(provider: DocsCustomBlockRenderViewportProvider | null): () => void;
|
|
37
|
+
export declare function getDocsCustomBlockRenderViewport(unitId: string, blockId: string, input: IDocsCustomBlockRenderViewportInput): IDocsCustomBlockRenderViewport | null;
|
|
@@ -18,12 +18,14 @@ import type { IParagraphConfig, ISectionBreakConfig } from '../../../../../basic
|
|
|
18
18
|
import type { IFloatObject, ILayoutContext } from '../../tools';
|
|
19
19
|
import { BooleanNumber, GridType, SpacingRule } from '@univerjs/core';
|
|
20
20
|
import { BreakPointType } from '../../line-breaker/break';
|
|
21
|
+
declare function isGlyphGroupBeyondDivideWidth(glyphGroup: IDocumentSkeletonGlyph[], offsetLeft: number, divideWidth: number): boolean;
|
|
21
22
|
export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType): IDocumentSkeletonPage[];
|
|
22
23
|
declare function __avoidFlowAffectingDrawingsForTable(table: IDocumentSkeletonTable, page: IDocumentSkeletonPage, column: IDocumentSkeletonColumn): void;
|
|
23
24
|
declare function _reLayoutCheck(ctx: ILayoutContext, floatObjects: IFloatObject[], column: IDocumentSkeletonColumn, paragraphIndex: number): void;
|
|
24
25
|
export declare const __testing: {
|
|
25
26
|
reLayoutCheck: typeof _reLayoutCheck;
|
|
26
27
|
avoidFlowAffectingDrawingsForTable: typeof __avoidFlowAffectingDrawingsForTable;
|
|
28
|
+
isGlyphGroupBeyondDivideWidth: typeof isGlyphGroupBeyondDivideWidth;
|
|
27
29
|
};
|
|
28
30
|
export declare function getLineHeightMetrics(glyphLineHeight: number, paragraphLineGapDefault: number, linePitch: number, gridType: GridType, lineSpacing: number, spacingRule: SpacingRule, snapToGrid: BooleanNumber, useWordStyleLineHeight?: boolean, scaleAutoLineSpacingByGlyphHeight?: boolean): {
|
|
29
31
|
paddingTop: number;
|
|
@@ -31,5 +33,5 @@ export declare function getLineHeightMetrics(glyphLineHeight: number, paragraphL
|
|
|
31
33
|
contentHeight: number;
|
|
32
34
|
lineSpacingApply: number;
|
|
33
35
|
};
|
|
34
|
-
export declare function updateInlineDrawingPosition(line: IDocumentSkeletonLine, paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>, blockAnchorTop?: number, paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>): void;
|
|
36
|
+
export declare function updateInlineDrawingPosition(line: IDocumentSkeletonLine, paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>, unitId?: string, blockAnchorTop?: number, paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>): void;
|
|
35
37
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { IDocumentData } from '@univerjs/core';
|
|
17
|
+
export declare function measureDocumentNoWrapTextRangeWidth(documentData: IDocumentData, start: number, end: number): number;
|
|
18
|
+
/**
|
|
19
|
+
* Measures the widest no-wrap line using the same text-width policy that docs
|
|
20
|
+
* layout relies on for lightweight shape/text-box autofit flows.
|
|
21
|
+
*
|
|
22
|
+
* This is intentionally not a full document layout replacement: callers that
|
|
23
|
+
* need line breaking, pagination, floating objects, or final line metrics should
|
|
24
|
+
* use `DocumentSkeleton`. This helper exists for consumers that must size a
|
|
25
|
+
* no-wrap host before committing a full layout pass. Keep docs-specific glyph
|
|
26
|
+
* width adjustments here so feature packages do not duplicate paragraph shaping
|
|
27
|
+
* details such as CJK-Latin spacing.
|
|
28
|
+
*/
|
|
29
|
+
export declare function measureDocumentNoWrapTextWidth(documentData: IDocumentData | null | undefined): number;
|
|
30
|
+
/**
|
|
31
|
+
* Measures the widest segment that docs line breaking keeps together. This is
|
|
32
|
+
* useful when a host may wrap normally but still needs enough width to avoid
|
|
33
|
+
* clipping an individual word, CJK glyph, or punctuation segment.
|
|
34
|
+
*/
|
|
35
|
+
export declare function measureDocumentUnbreakableTextWidth(documentData: IDocumentData | null | undefined): number;
|
|
@@ -170,6 +170,7 @@ export declare function getFontConfigFromLastGlyph(glyph: IDocumentSkeletonGlyph
|
|
|
170
170
|
pageWidth: number;
|
|
171
171
|
};
|
|
172
172
|
export declare function getFontCreateConfig(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, paragraph: IParagraph): IFontCreateConfig;
|
|
173
|
+
export declare function getCustomRangeGlyphWidth(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, config: IFontCreateConfig): number | undefined;
|
|
173
174
|
export declare function getNullSkeleton(): IDocumentSkeletonCached;
|
|
174
175
|
export declare function setPageParent(pages: IDocumentSkeletonPage[], parent: IDocumentSkeletonCached): void;
|
|
175
176
|
export declare enum FloatObjectType {
|
|
@@ -30,6 +30,8 @@ export interface IDrawInfo {
|
|
|
30
30
|
viewRanges: IRange[];
|
|
31
31
|
viewportKey: string;
|
|
32
32
|
checkOutOfViewBound?: boolean;
|
|
33
|
+
fontRenderRanges?: IRange[];
|
|
34
|
+
hasMergeData?: boolean;
|
|
33
35
|
viewBound?: IBoundRectNoAngle;
|
|
34
36
|
}
|
|
35
37
|
export declare class ComponentExtension<T, U, V> {
|
|
@@ -29,13 +29,14 @@ interface IRenderBGContext {
|
|
|
29
29
|
viewRanges: IRange[];
|
|
30
30
|
diffRanges: IRange[];
|
|
31
31
|
cellInfo: ICellWithCoord;
|
|
32
|
+
skipRenderRangeCheck?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export declare class Background extends SheetExtension {
|
|
34
35
|
uKey: string;
|
|
35
36
|
Z_INDEX: number;
|
|
36
37
|
PRINTING_Z_INDEX: number;
|
|
37
38
|
get zIndex(): number;
|
|
38
|
-
draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], { viewRanges, checkOutOfViewBound }: IDrawInfo): void;
|
|
39
|
+
draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], { viewRanges, checkOutOfViewBound, hasMergeData }: IDrawInfo): void;
|
|
39
40
|
renderBGByCell(bgContext: IRenderBGContext, row: number, col: number): true | undefined;
|
|
40
41
|
}
|
|
41
42
|
export {};
|
|
@@ -63,7 +63,8 @@ export declare class Font extends SheetExtension {
|
|
|
63
63
|
*/
|
|
64
64
|
private _drawFallbackImage;
|
|
65
65
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], moreBoundsInfo: IDrawInfo): void;
|
|
66
|
-
_renderFontEachCell(renderFontCtx: IRenderFontContext, row: number, col: number, fontMatrix: ObjectMatrix<IFontCacheItem
|
|
66
|
+
_renderFontEachCell(renderFontCtx: IRenderFontContext, row: number, col: number, fontMatrix: ObjectMatrix<IFontCacheItem>, cacheValue?: IFontCacheItem): boolean;
|
|
67
|
+
private _renderPlainTextWithoutClip;
|
|
67
68
|
private _renderImages;
|
|
68
69
|
/**
|
|
69
70
|
* Change font render bounds, for overflow and filter icon & custom render.
|
|
@@ -25,6 +25,11 @@ export declare enum SHEET_EXTENSION_TYPE {
|
|
|
25
25
|
export declare const SHEET_EXTENSION_PREFIX = "sheet-ext-";
|
|
26
26
|
export declare class SheetExtension extends ComponentExtension<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE, IRange[]> {
|
|
27
27
|
type: SHEET_EXTENSION_TYPE;
|
|
28
|
+
/**
|
|
29
|
+
* Return an isolated instance when this extension is safe to render in a print scene.
|
|
30
|
+
* Editor-only extensions remain excluded by default.
|
|
31
|
+
*/
|
|
32
|
+
copyForPrinting(): SheetExtension | null;
|
|
28
33
|
isRenderDiffRangesByCell(rangeP: IRange, diffRanges?: IRange[]): boolean;
|
|
29
34
|
isRenderDiffRangesByColumn(curStartColumn: number, curEndColumn: number, diffRanges?: IRange[]): boolean;
|
|
30
35
|
isRenderDiffRangesByRow(curStartRow: number, curEndRow: number, diffRanges?: IRange[]): boolean;
|
|
@@ -37,6 +37,9 @@ export interface IFontCacheItem {
|
|
|
37
37
|
cellData: Nullable<ICellDataForSheetInterceptor>;
|
|
38
38
|
fontString: string;
|
|
39
39
|
style?: Nullable<IStyleData>;
|
|
40
|
+
displayText?: string;
|
|
41
|
+
resolvedHorizontalAlign?: HorizontalAlign;
|
|
42
|
+
textFitsCurrentCell?: boolean;
|
|
40
43
|
}
|
|
41
44
|
type colorString = string;
|
|
42
45
|
export interface IStylesCache {
|
|
@@ -43,6 +43,13 @@ export interface ICacheItem {
|
|
|
43
43
|
bg: boolean;
|
|
44
44
|
border: boolean;
|
|
45
45
|
}
|
|
46
|
+
interface ISetStylesCacheForOneCellOptions {
|
|
47
|
+
mergeRange?: IRange;
|
|
48
|
+
cacheItem?: ICacheItem;
|
|
49
|
+
reuseExisting?: boolean;
|
|
50
|
+
hasMergeData?: boolean;
|
|
51
|
+
rowVisible?: boolean;
|
|
52
|
+
}
|
|
46
53
|
export interface IGetPosByRowColOptions {
|
|
47
54
|
closeFirst?: boolean;
|
|
48
55
|
/**
|
|
@@ -60,6 +67,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
60
67
|
private _cacheRangeMap;
|
|
61
68
|
private _visibleRangeMap;
|
|
62
69
|
private _overflowCache;
|
|
70
|
+
private _incrementalFontRenderRanges;
|
|
63
71
|
private _stylesCache;
|
|
64
72
|
private _clearTaskId;
|
|
65
73
|
/** A matrix to store if a (row, column) position has render cache. */
|
|
@@ -84,6 +92,7 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
84
92
|
visibleRangeByViewportKey(viewportKey: SHEET_VIEWPORT_KEY): Nullable<IRowColumnRange>;
|
|
85
93
|
get stylesCache(): IStylesCache;
|
|
86
94
|
get overflowCache(): ObjectMatrix<IRange>;
|
|
95
|
+
get incrementalFontRenderRanges(): IRange[];
|
|
87
96
|
get showGridlines(): BooleanNumber;
|
|
88
97
|
get gridlinesColor(): string | undefined;
|
|
89
98
|
dispose(): void;
|
|
@@ -144,6 +153,8 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
144
153
|
getRangeByViewBound(bound?: IBoundRectNoAngle): IRange;
|
|
145
154
|
appendToOverflowCache(row: number, column: number, startColumn: number, endColumn: number): void;
|
|
146
155
|
getOverflowPosition(contentSize: Required<ISize>, horizontalAlign: HorizontalAlign, row: number, column: number, columnCount: number): IColumnRange;
|
|
156
|
+
private _isOverflowBlockedByAdjacentCell;
|
|
157
|
+
private _isOverflowSideBlocked;
|
|
147
158
|
/**
|
|
148
159
|
* Get cell by pos(offsetX, offsetY).
|
|
149
160
|
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
@@ -240,15 +251,9 @@ export declare class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
240
251
|
*/
|
|
241
252
|
_resetCache(): void;
|
|
242
253
|
resetRangeCache(ranges: IRange[]): void;
|
|
243
|
-
_setBorderStylesCache(row: number, col: number, style: Nullable<IStyleData>, options:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
} | undefined): void;
|
|
247
|
-
_setBgStylesCache(row: number, col: number, style: Nullable<IStyleData>, options: {
|
|
248
|
-
mergeRange?: IRange;
|
|
249
|
-
cacheItem?: ICacheItem;
|
|
250
|
-
} | undefined): void;
|
|
251
|
-
_setFontStylesCache(row: number, col: number, cellData: Nullable<ICellDataForSheetInterceptor>, style: IStyleData): void;
|
|
254
|
+
_setBorderStylesCache(row: number, col: number, style: Nullable<IStyleData>, options: ISetStylesCacheForOneCellOptions | undefined): void;
|
|
255
|
+
_setBgStylesCache(row: number, col: number, style: Nullable<IStyleData>, options: ISetStylesCacheForOneCellOptions | undefined): void;
|
|
256
|
+
_setFontStylesCache(row: number, col: number, cellData: Nullable<ICellDataForSheetInterceptor>, style: IStyleData, hasMergeData?: boolean): void;
|
|
252
257
|
/**
|
|
253
258
|
* Set border background and font to this._stylesCache cell by cell.
|
|
254
259
|
* @param row {number}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,11 +18,14 @@ export * from './basics';
|
|
|
18
18
|
export { getOffsetRectForDom } from './basics/position';
|
|
19
19
|
export * from './canvas';
|
|
20
20
|
export * from './components';
|
|
21
|
+
export type { DocsCustomBlockRenderViewportProvider, IDocsCustomBlockRenderViewport, IDocsCustomBlockRenderViewportInput } from './components/docs/custom-block-render-viewport';
|
|
22
|
+
export { getDocsCustomBlockRenderViewport, setDocsCustomBlockRenderViewportProvider } from './components/docs/custom-block-render-viewport';
|
|
21
23
|
export { DocBackground } from './components/docs/doc-background';
|
|
22
24
|
export { Documents } from './components/docs/document';
|
|
23
25
|
export type { IPageRenderConfig } from './components/docs/document';
|
|
24
26
|
export type { IDocumentOffsetConfig } from './components/docs/document';
|
|
25
27
|
export { getTableIdAndSliceIndex } from './components/docs/layout/block/table';
|
|
28
|
+
export { measureDocumentNoWrapTextRangeWidth, measureDocumentNoWrapTextWidth, measureDocumentUnbreakableTextWidth, } from './components/docs/layout/doc-no-wrap-measure';
|
|
26
29
|
export * from './components/docs/layout/doc-simple-skeleton';
|
|
27
30
|
export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
|
|
28
31
|
export type { IFindNodeRestrictions } from './components/docs/layout/doc-skeleton';
|
|
@@ -113,7 +113,7 @@ export declare class RenderManagerService extends Disposable implements IRenderM
|
|
|
113
113
|
* @param isMainScene
|
|
114
114
|
* @returns renderUnit:IRender
|
|
115
115
|
*/
|
|
116
|
-
protected _createRender(unitId: string, engine: Engine, isMainScene?: boolean, createUnitOptions?: ICreateUnitOptions): IRender;
|
|
116
|
+
protected _createRender(unitId: string, engine: Engine, isMainScene?: boolean, createUnitOptions?: ICreateUnitOptions, parentInjector?: Injector): IRender;
|
|
117
117
|
addRender(unitId: string, renderUnit: IRender): void;
|
|
118
118
|
private _addRenderUnit;
|
|
119
119
|
removeRender(unitId: string): void;
|
|
@@ -39,6 +39,7 @@ export interface IRender {
|
|
|
39
39
|
*/
|
|
40
40
|
activated$: Observable<boolean>;
|
|
41
41
|
with<T>(dependency: DependencyIdentifier<T>): T;
|
|
42
|
+
getInjector?(): Injector;
|
|
42
43
|
getRenderContext?(): IRenderContext;
|
|
43
44
|
/**
|
|
44
45
|
* Deactivate the render unit, means the render unit would be freezed and not updated,
|
|
@@ -77,6 +78,7 @@ export declare class RenderUnit extends Disposable implements IRender {
|
|
|
77
78
|
get type(): UniverInstanceType;
|
|
78
79
|
private readonly _injector;
|
|
79
80
|
private _renderContext;
|
|
81
|
+
private readonly _dependencyService;
|
|
80
82
|
set isMainScene(is: boolean);
|
|
81
83
|
get isMainScene(): boolean;
|
|
82
84
|
set engine(engine: Engine);
|
|
@@ -95,6 +97,7 @@ export declare class RenderUnit extends Disposable implements IRender {
|
|
|
95
97
|
* Get a dependency from the RenderUnit's injector.
|
|
96
98
|
*/
|
|
97
99
|
with<T>(dependency: DependencyIdentifier<T>): T;
|
|
100
|
+
getInjector(): Injector;
|
|
98
101
|
/**
|
|
99
102
|
* Add render dependencies to the RenderUnit's injector. Note that the dependencies would be initialized immediately
|
|
100
103
|
* after being added.
|
|
@@ -68,6 +68,10 @@ export declare class ScrollBar extends Disposable {
|
|
|
68
68
|
private _lastY;
|
|
69
69
|
private _isHorizonMove;
|
|
70
70
|
private _isVerticalMove;
|
|
71
|
+
private _pendingBarDeltaX;
|
|
72
|
+
private _pendingBarDeltaY;
|
|
73
|
+
private _pendingBarScrollFrameId;
|
|
74
|
+
private _pendingBarScrollThrottleId;
|
|
71
75
|
private _horizonPointerMoveSub;
|
|
72
76
|
private _horizonPointerUpSub;
|
|
73
77
|
private _verticalPointerMoveSub;
|
|
@@ -132,6 +136,10 @@ export declare class ScrollBar extends Disposable {
|
|
|
132
136
|
get totalSize(): number;
|
|
133
137
|
static attachTo(view: Viewport, props?: IScrollBarProps): ScrollBar;
|
|
134
138
|
dispose(): void;
|
|
139
|
+
private _scheduleBarScrollDelta;
|
|
140
|
+
private _requestPendingBarScrollFrame;
|
|
141
|
+
private _flushPendingBarScroll;
|
|
142
|
+
private _applyPendingBarScroll;
|
|
135
143
|
render(ctx: UniverRenderingContext, left?: number, top?: number): void;
|
|
136
144
|
private _resizeHorizontal;
|
|
137
145
|
private _resizeVertical;
|
|
@@ -35,6 +35,8 @@ export interface ITextProps extends IShapeProps {
|
|
|
35
35
|
}
|
|
36
36
|
export declare const TEXT_OBJECT_ARRAY: string[];
|
|
37
37
|
export declare class Text extends Shape<ITextProps> {
|
|
38
|
+
private static readonly _MAX_LAYOUT_CACHE_SIZE;
|
|
39
|
+
private static readonly _layoutCache;
|
|
38
40
|
text: string;
|
|
39
41
|
fontStyle: string;
|
|
40
42
|
warp: boolean;
|
|
@@ -43,6 +45,8 @@ export declare class Text extends Shape<ITextProps> {
|
|
|
43
45
|
skeleton: DocSimpleSkeleton;
|
|
44
46
|
constructor(key: string, props: ITextProps);
|
|
45
47
|
static drawWith(ctx: UniverRenderingContext, props: ITextProps, _skeleton?: DocSimpleSkeleton): number;
|
|
48
|
+
static drawPlainWith(ctx: UniverRenderingContext, props: ITextProps): number;
|
|
49
|
+
private static _getCachedLayout;
|
|
46
50
|
/**
|
|
47
51
|
* Draw text decoration lines (underline, strikethrough, etc.)
|
|
48
52
|
*/
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export interface IScrollObserverParam {
|
|
|
72
72
|
limitX?: number;
|
|
73
73
|
limitY?: number;
|
|
74
74
|
isTrigger?: boolean;
|
|
75
|
+
isBarDragging?: boolean;
|
|
76
|
+
isBarDragEnd?: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface IScrollByBarOptions {
|
|
79
|
+
isBarDragging?: boolean;
|
|
80
|
+
isBarDragEnd?: boolean;
|
|
75
81
|
}
|
|
76
82
|
interface IScrollBarPosition {
|
|
77
83
|
x: number;
|
|
@@ -284,7 +290,7 @@ export declare class Viewport {
|
|
|
284
290
|
* @param delta
|
|
285
291
|
* @returns isLimited
|
|
286
292
|
*/
|
|
287
|
-
scrollByBarDeltaValue(delta: Partial<IScrollBarPosition>, isTrigger?: boolean): {
|
|
293
|
+
scrollByBarDeltaValue(delta: Partial<IScrollBarPosition>, isTrigger?: boolean, options?: IScrollByBarOptions): {
|
|
288
294
|
scrollX: number;
|
|
289
295
|
scrollY: number;
|
|
290
296
|
isLimitedX: boolean;
|