@univerjs/engine-render 0.25.1 → 1.0.0-alpha.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.
Files changed (27) hide show
  1. package/lib/cjs/index.js +2100 -319
  2. package/lib/es/index.js +2097 -321
  3. package/lib/types/basics/document-node-tools.d.ts +1 -0
  4. package/lib/types/basics/i-document-skeleton-cached.d.ts +26 -1
  5. package/lib/types/basics/interfaces.d.ts +6 -0
  6. package/lib/types/basics/transformer-config.d.ts +17 -0
  7. package/lib/types/components/docs/doc-background.d.ts +4 -0
  8. package/lib/types/components/docs/document-compatibility.d.ts +43 -0
  9. package/lib/types/components/docs/document.d.ts +6 -0
  10. package/lib/types/components/docs/extensions/background-runs.d.ts +22 -0
  11. package/lib/types/components/docs/extensions/font-and-base-line.d.ts +10 -0
  12. package/lib/types/components/docs/layout/block/column.d.ts +23 -0
  13. package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +17 -3
  14. package/lib/types/components/docs/layout/model/line.d.ts +1 -1
  15. package/lib/types/components/docs/layout/model/page.d.ts +2 -1
  16. package/lib/types/components/docs/layout/tools.d.ts +83 -3
  17. package/lib/types/components/docs/table-render-viewport.d.ts +4 -0
  18. package/lib/types/components/docs/view-model/document-view-model.d.ts +8 -1
  19. package/lib/types/components/sheets/extensions/border.d.ts +2 -2
  20. package/lib/types/components/sheets/interfaces.d.ts +6 -6
  21. package/lib/types/index.d.ts +7 -5
  22. package/lib/types/render-manager/render-manager.service.d.ts +1 -0
  23. package/lib/types/scene.transformer.d.ts +20 -0
  24. package/lib/types/services/canvas-color.service.d.ts +1 -0
  25. package/lib/types/shape/image.d.ts +3 -0
  26. package/lib/umd/index.js +2 -2
  27. package/package.json +8 -8
@@ -23,6 +23,7 @@ export declare function getParagraphByGlyph(glyph: Nullable<IDocumentSkeletonGly
23
23
  paragraphStart: number;
24
24
  paragraphEnd: number;
25
25
  startIndex: number;
26
+ paragraphId: string;
26
27
  paragraphStyle?: import("@univerjs/core").IParagraphStyle;
27
28
  bullet?: import("@univerjs/core").IBullet;
28
29
  } | undefined;
@@ -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 { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IDocDrawingBase, IDocumentRenderConfig, INestingLevel, IParagraph, IParagraphBorder, IParagraphProperties, ITable, ITableRow, ITextStyle, PageOrientType } from '@univerjs/core';
16
+ import type { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IColorStyle, IColumnGroup, IDocDrawingBase, IDocumentRenderConfig, INestingLevel, IParagraph, IParagraphBorder, IParagraphProperties, ITable, ITableRow, ITextStyle, PageOrientType } from '@univerjs/core';
17
17
  import type { BreakPointType } from '../components/docs/layout/line-breaker/break';
18
18
  export interface IDocumentSkeletonCached extends ISkeletonResourceReference {
19
19
  pages: IDocumentSkeletonPage[];
@@ -69,6 +69,7 @@ export interface IDocumentSkeletonPage {
69
69
  ed: number;
70
70
  skeDrawings: Map<string, IDocumentSkeletonDrawing>;
71
71
  skeTables: Map<string, IDocumentSkeletonTable>;
72
+ skeColumnGroups: Map<string, IDocumentSkeletonColumnGroup>;
72
73
  segmentId: string;
73
74
  type: DocumentSkeletonPageType;
74
75
  renderConfig?: IDocumentRenderConfig;
@@ -108,6 +109,29 @@ export interface IDocumentSkeletonRow {
108
109
  parent?: IDocumentSkeletonTable;
109
110
  isRepeatRow: boolean;
110
111
  }
112
+ export interface IDocumentSkeletonColumnGroup {
113
+ columns: IDocumentSkeletonColumnGroupColumn[];
114
+ width: number;
115
+ height: number;
116
+ top: number;
117
+ left: number;
118
+ st: number;
119
+ ed: number;
120
+ columnGroupId: string;
121
+ columnGroupSource: IColumnGroup;
122
+ parent?: IDocumentSkeletonPage;
123
+ }
124
+ export interface IDocumentSkeletonColumnGroupColumn {
125
+ columnId: string;
126
+ left: number;
127
+ top: number;
128
+ width: number;
129
+ height: number;
130
+ st: number;
131
+ ed: number;
132
+ page: IDocumentSkeletonPage;
133
+ parent?: IDocumentSkeletonColumnGroup;
134
+ }
111
135
  export interface IDocumentSkeletonColumn {
112
136
  lines: IDocumentSkeletonLine[];
113
137
  left: number;
@@ -143,6 +167,7 @@ export interface IDocumentSkeletonLine {
143
167
  isBehindTable: boolean;
144
168
  tableId: string;
145
169
  borderBottom?: IParagraphBorder;
170
+ backgroundColor?: IColorStyle;
146
171
  bullet?: IDocumentSkeletonBullet;
147
172
  width?: number;
148
173
  parent?: IDocumentSkeletonColumn;
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { BooleanNumber, GridType, IDocStyleBase, IDocumentLayout, IOffset, IParagraphStyle, IReferenceSource, IScale, ISectionBreakBase, ISize, ITextStyle, ITransformState, LocaleService } from '@univerjs/core';
17
17
  import type { DataStreamTreeNode } from '../components/docs/view-model/data-stream-tree-node';
18
+ import type { IDocumentCompatibilityPolicy } from '../components/docs/document-compatibility';
18
19
  import type { DocumentViewModel } from '../components/docs/view-model/document-view-model';
19
20
  import type { DocumentSkeletonPageType, IDocumentSkeletonBullet, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonHeaderFooter, IDocumentSkeletonTable } from './i-document-skeleton-cached';
20
21
  import type { ITransformerConfig } from './transformer-config';
@@ -61,6 +62,7 @@ export interface IFontLocale {
61
62
  export interface IDocsConfig extends IReferenceSource, IDocumentLayout {
62
63
  localeService: LocaleService;
63
64
  documentTextStyle?: ITextStyle;
65
+ documentCompatibilityPolicy?: IDocumentCompatibilityPolicy;
64
66
  headerTreeMap: Map<string, DocumentViewModel>;
65
67
  footerTreeMap: Map<string, DocumentViewModel>;
66
68
  }
@@ -89,6 +91,9 @@ export interface IParagraphTableCache {
89
91
  }
90
92
  export interface IParagraphConfig {
91
93
  paragraphIndex: number;
94
+ documentCompatibilityPolicy?: IDocumentCompatibilityPolicy;
95
+ useWordStyleLineHeight?: boolean;
96
+ docxFallbackAnchorLeft?: IParagraphStyle['indentStart'];
92
97
  paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
93
98
  paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
94
99
  skeTablesInParagraph?: IParagraphTableCache[];
@@ -103,6 +108,7 @@ export interface IFontCreateConfig {
103
108
  textStyle: ITextStyle;
104
109
  charSpace: number;
105
110
  snapToGrid: BooleanNumber;
111
+ documentCompatibilityPolicy?: IDocumentCompatibilityPolicy;
106
112
  gridType?: GridType;
107
113
  pageWidth?: number;
108
114
  }
@@ -25,8 +25,16 @@ export interface ITransformerConfig {
25
25
  rotationSnaps?: number[];
26
26
  rotationSnapTolerance?: number;
27
27
  rotateAnchorOffset?: number;
28
+ rotateAnchorPosition?: 'top' | 'bottom';
29
+ rotateLineEnabled?: boolean;
28
30
  rotateSize?: number;
29
31
  rotateCornerRadius?: number;
32
+ rotateFill?: string;
33
+ rotateStroke?: string;
34
+ rotateStrokeWidth?: number;
35
+ rotateIconEnabled?: boolean;
36
+ rotateIconStroke?: string;
37
+ rotateIconStrokeWidth?: number;
30
38
  borderEnabled?: boolean;
31
39
  borderStroke?: string;
32
40
  borderStrokeWidth?: number;
@@ -39,6 +47,14 @@ export interface ITransformerConfig {
39
47
  anchorStrokeWidth?: number;
40
48
  anchorSize?: number;
41
49
  anchorCornerRadius?: number;
50
+ anchorStyle?: 'default' | 'canva';
51
+ anchorSideLongSize?: number;
52
+ anchorSideShortSize?: number;
53
+ anchorSideCornerRadius?: number;
54
+ anchorShadowColor?: string;
55
+ anchorShadowBlur?: number;
56
+ anchorShadowOffsetX?: number;
57
+ anchorShadowOffsetY?: number;
42
58
  keepRatio?: boolean;
43
59
  centeredScaling?: boolean;
44
60
  flipEnabled?: boolean;
@@ -48,4 +64,5 @@ export interface ITransformerConfig {
48
64
  shouldOverdrawWholeArea?: boolean;
49
65
  zeroLeft?: number;
50
66
  zeroTop?: number;
67
+ moveBoundaryEnabled?: boolean;
51
68
  }
@@ -24,11 +24,15 @@ export declare class DocBackground extends DocComponent {
24
24
  private _pageFillColor?;
25
25
  private _pageStrokeColor?;
26
26
  private _marginStrokeColor?;
27
+ private _pageBackgroundSource?;
28
+ private _pageBackgroundImage?;
27
29
  constructor(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig);
28
30
  static create(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig): DocBackground;
29
31
  setFillColors(backgroundFillColor?: string, pageFillColor?: string, pageStrokeColor?: string, marginStrokeColor?: string): void;
30
32
  draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
31
33
  private _drawWorkspaceBackground;
34
+ private _drawPageBackgroundImage;
35
+ private _getPageBackgroundImage;
32
36
  changeSkeleton(newSkeleton: DocumentSkeleton): this;
33
37
  protected _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
34
38
  }
@@ -0,0 +1,43 @@
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 { ITable } from '@univerjs/core';
17
+ import type { IDocumentSkeletonBoundingBox, IDocumentSkeletonFontStyle } from '../../basics/i-document-skeleton-cached';
18
+ import { DocumentFlavor } from '@univerjs/core';
19
+ interface IFontMetricScaleRule {
20
+ fontFamily: RegExp;
21
+ minFontSize?: number;
22
+ fontString?: RegExp;
23
+ content?: RegExp;
24
+ widthScale?: number;
25
+ }
26
+ export interface IDocumentCompatibilityPolicy {
27
+ mode: 'modern' | 'traditional' | 'unspecified';
28
+ applyDocumentDefaultParagraphStyle: boolean;
29
+ useWordStyleLineHeight: boolean;
30
+ font: {
31
+ metricScaleRules: IFontMetricScaleRule[];
32
+ };
33
+ table: {
34
+ currentPageOverflowTolerance: number;
35
+ rowOverflowTolerance: number;
36
+ allowImportedTableMarginOverflow: boolean;
37
+ };
38
+ }
39
+ export declare function getDocumentCompatibilityPolicy(documentFlavor?: DocumentFlavor): IDocumentCompatibilityPolicy;
40
+ export declare function applyFontMetricCompatibility(content: string, fontStyle: IDocumentSkeletonFontStyle, bBox: IDocumentSkeletonBoundingBox, policy: IDocumentCompatibilityPolicy): IDocumentSkeletonBoundingBox;
41
+ export declare function isTraditionalDocumentCompatibility(policy: IDocumentCompatibilityPolicy): boolean;
42
+ export declare function shouldAllowImportedTableMarginOverflow(policy: IDocumentCompatibilityPolicy, tableSource: ITable | unknown): boolean;
43
+ export {};
@@ -46,10 +46,16 @@ export declare class Documents extends DocComponent {
46
46
  protected _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
47
47
  draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
48
48
  private _drawTable;
49
+ private _drawColumnGroups;
50
+ private _drawTableCellBackgrounds;
49
51
  private _getTableViewport;
50
52
  private _getRenderUnitId;
53
+ private _getDocumentCompatibilityPolicy;
54
+ private _drawLineBackground;
51
55
  private _drawBorderBottom;
56
+ private _drawGlyphGroupBackgrounds;
52
57
  private _drawTableCell;
58
+ private _drawNestedPageContent;
53
59
  private _drawTableCellBordersAndBg;
54
60
  private _getTableCellSource;
55
61
  private _resolveTableCellBorder;
@@ -0,0 +1,22 @@
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 { IDocumentSkeletonGlyph } from '../../../basics/i-document-skeleton-cached';
17
+ export interface IBackgroundGlyphRun {
18
+ glyph: IDocumentSkeletonGlyph;
19
+ left: number;
20
+ width: number;
21
+ }
22
+ export declare function collectBackgroundGlyphRuns(glyphGroup: IDocumentSkeletonGlyph[]): IBackgroundGlyphRun[];
@@ -32,8 +32,18 @@ export declare class FontAndBaseLine extends docExtension {
32
32
  * so we need a map to store actual value and set value
33
33
  */
34
34
  actualFontMap: Record<string, string>;
35
+ private _textFillImageCache;
35
36
  constructor();
36
37
  draw(ctx: UniverRenderingContext, _parentScale: IScale, glyph: IDocumentSkeletonGlyph, _?: IBoundRectNoAngle, _more?: IDrawInfo): void;
38
+ private _fillTextWithTextFill;
39
+ private _getGlyphPaintBounds;
40
+ private _createTextGradient;
41
+ private _createTextPicturePattern;
42
+ private _getTextFillImage;
43
+ private _normalizeGradientStops;
44
+ private _getLinearGradientLine;
45
+ private _colorWithOpacity;
46
+ private _clamp;
37
47
  private _fillText;
38
48
  clearCache(): void;
39
49
  }
@@ -0,0 +1,23 @@
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 { Nullable } from '@univerjs/core';
17
+ import type { IDocumentSkeletonColumnGroup, IDocumentSkeletonPage } from '../../../../basics/i-document-skeleton-cached';
18
+ import type { ISectionBreakConfig } from '../../../../basics/interfaces';
19
+ import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
20
+ import type { DocumentViewModel } from '../../view-model/document-view-model';
21
+ import type { ILayoutContext } from '../tools';
22
+ export declare function createColumnGroupSkeleton(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, columnGroupNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): Nullable<IDocumentSkeletonColumnGroup>;
23
+ export declare function appendColumnGroupBlockLine(page: IDocumentSkeletonPage, columnGroup: IDocumentSkeletonColumnGroup): boolean;
@@ -13,9 +13,23 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { IDocumentSkeletonDrawing, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage } from '../../../../../basics/i-document-skeleton-cached';
16
+ import type { IDocumentSkeletonColumn, IDocumentSkeletonDrawing, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonTable } from '../../../../../basics/i-document-skeleton-cached';
17
17
  import type { IParagraphConfig, ISectionBreakConfig } from '../../../../../basics/interfaces';
18
- import type { ILayoutContext } from '../../tools';
18
+ import type { IFloatObject, ILayoutContext } from '../../tools';
19
+ import { BooleanNumber, GridType, SpacingRule } from '@univerjs/core';
19
20
  import { BreakPointType } from '../../line-breaker/break';
20
21
  export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType): IDocumentSkeletonPage[];
21
- export declare function updateInlineDrawingPosition(line: IDocumentSkeletonLine, paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>, blockAnchorTop?: number): void;
22
+ declare function __avoidFlowAffectingDrawingsForTable(table: IDocumentSkeletonTable, page: IDocumentSkeletonPage, column: IDocumentSkeletonColumn): void;
23
+ declare function _reLayoutCheck(ctx: ILayoutContext, floatObjects: IFloatObject[], column: IDocumentSkeletonColumn, paragraphIndex: number): void;
24
+ export declare const __testing: {
25
+ reLayoutCheck: typeof _reLayoutCheck;
26
+ avoidFlowAffectingDrawingsForTable: typeof __avoidFlowAffectingDrawingsForTable;
27
+ };
28
+ export declare function getLineHeightMetrics(glyphLineHeight: number, paragraphLineGapDefault: number, linePitch: number, gridType: GridType, lineSpacing: number, spacingRule: SpacingRule, snapToGrid: BooleanNumber, useWordStyleLineHeight?: boolean, scaleAutoLineSpacingByGlyphHeight?: boolean): {
29
+ paddingTop: number;
30
+ paddingBottom: number;
31
+ contentHeight: number;
32
+ lineSpacingApply: number;
33
+ };
34
+ export declare function updateInlineDrawingPosition(line: IDocumentSkeletonLine, paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>, blockAnchorTop?: number, paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>): void;
35
+ export {};
@@ -29,7 +29,7 @@ interface ILineBoundingBox {
29
29
  spaceBelowApply?: number;
30
30
  }
31
31
  export declare function createSkeletonLine(paragraphIndex: number, lineType: LineType, lineBoundingBox: ILineBoundingBox, columnWidth: number, lineIndex: number | undefined, isParagraphStart: boolean | undefined, paragraphConfig: IParagraphConfig, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>): IDocumentSkeletonLine;
32
- export declare function calculateLineTopByDrawings(lineHeight: number | undefined, lineTop: number | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>): number;
32
+ export declare function calculateLineTopByDrawings(lineHeight: number | undefined, lineTop: number | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>, columnLeft?: number, columnWidth?: number): number;
33
33
  export declare function updateDivideInfo(divide: IDocumentSkeletonDivide, states: Partial<IDocumentSkeletonDivide>): void;
34
34
  export declare function setLineMarginBottom(line: IDocumentSkeletonLine, marginBottom: number): void;
35
35
  export declare function collisionDetection(floatObject: IFloatObject, lineHeight: number, lineTop: number, columnLeft: number, columnWidth: number): boolean;
@@ -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 { ITable } from '@univerjs/core';
16
+ import type { IDocumentBody, ITable, Nullable } from '@univerjs/core';
17
17
  import type { IDocumentSkeletonPage, ISkeletonResourceReference } from '../../../../basics/i-document-skeleton-cached';
18
18
  import type { ISectionBreakConfig } from '../../../../basics/interfaces';
19
19
  import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
@@ -27,3 +27,4 @@ export declare function createNullCellPage(ctx: ILayoutContext, sectionBreakConf
27
27
  };
28
28
  export declare function createSkeletonCellPages(ctx: ILayoutContext, viewModel: DocumentViewModel, cellNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number, availableHeight?: number, maxCellPageHeight?: number): IDocumentSkeletonPage[];
29
29
  export declare function expandCellPageHeightForInlineDrawings(pages: IDocumentSkeletonPage[]): void;
30
+ export declare function applyTrailingBlockRangeSpaceBelow(pages: IDocumentSkeletonPage[], body: Nullable<IDocumentBody>, containerEndIndex: number): void;
@@ -13,9 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { DocumentDataModel, INumberUnit, IObjectPositionH, IObjectPositionV, IParagraph, IParagraphStyle, ITextStyle, Nullable } from '@univerjs/core';
17
- import type { IDocumentSkeletonCached, IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonSection, ISkeletonResourceReference } from '../../../basics/i-document-skeleton-cached';
16
+ import type { DocumentDataModel, INumberUnit, IObjectPositionH, IObjectPositionV, IParagraph, IParagraphStyle, ITextStyle, Nullable, PositionedObjectLayoutType } from '@univerjs/core';
17
+ import type { IDocumentSkeletonCached, IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonSection, IDocumentSkeletonTable, ISkeletonResourceReference } from '../../../basics/i-document-skeleton-cached';
18
18
  import type { IDocsConfig, IParagraphConfig, ISectionBreakConfig } from '../../../basics/interfaces';
19
+ import type { IBoundRectNoAngle } from '../../../basics/vector2';
20
+ import type { IDocumentCompatibilityPolicy } from '../document-compatibility';
19
21
  import type { DataStreamTreeNode } from '../view-model/data-stream-tree-node';
20
22
  import type { DocumentViewModel } from '../view-model/document-view-model';
21
23
  import type { Hyphen } from './hyphenation/hyphen';
@@ -55,6 +57,7 @@ export declare function getLineHeightConfig(sectionBreakConfig: ISectionBreakCon
55
57
  lineSpacing: number;
56
58
  spacingRule: SpacingRule;
57
59
  snapToGrid: BooleanNumber;
60
+ useWordStyleLineHeight: boolean;
58
61
  };
59
62
  export declare function getCharSpaceConfig(sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig): {
60
63
  charSpace: number;
@@ -63,10 +66,85 @@ export declare function getCharSpaceConfig(sectionBreakConfig: ISectionBreakConf
63
66
  gridType: GridType;
64
67
  snapToGrid: BooleanNumber;
65
68
  };
66
- export declare function updateBlockIndex(pages: IDocumentSkeletonPage[], start?: number): void;
69
+ export declare function updateBlockIndex(pages: IDocumentSkeletonPage[], start?: number, documentCompatibilityPolicy?: IDocumentCompatibilityPolicy): void;
67
70
  export declare function updateInlineDrawingCoordsAndBorder(ctx: ILayoutContext, pages: IDocumentSkeletonPage[]): void;
68
71
  export declare function glyphIterator(pages: IDocumentSkeletonPage[], cb: (glyph: IDocumentSkeletonGlyph, divide: IDocumentSkeletonDivide, line: IDocumentSkeletonLine, column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, page: IDocumentSkeletonPage) => void): void;
69
72
  export declare function lineIterator(pagesOrCells: (IDocumentSkeletonPage)[], cb: (line: IDocumentSkeletonLine, column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, page: IDocumentSkeletonPage) => void): void;
73
+ export type DocumentSkeletonLineSource = 'page' | 'table-cell' | 'column';
74
+ export interface IDocumentSkeletonLineIteratorOptions {
75
+ docsLeft?: number;
76
+ pageMarginTop?: number;
77
+ tableCellInsetX?: number;
78
+ unitId?: string;
79
+ }
80
+ export interface IDocumentSkeletonLineContext {
81
+ clipLeft?: number;
82
+ clipRight?: number;
83
+ column: IDocumentSkeletonColumn;
84
+ line: IDocumentSkeletonLine;
85
+ lineWidth: number;
86
+ page: IDocumentSkeletonPage;
87
+ pageIndex: number;
88
+ pageLeft: number;
89
+ section: IDocumentSkeletonSection;
90
+ sectionTop: number;
91
+ source: DocumentSkeletonLineSource;
92
+ visualLeft?: number;
93
+ visualWidth?: number;
94
+ }
95
+ export type DocumentSkeletonTableSource = 'page' | 'column';
96
+ export interface IDocumentSkeletonTableCellGeometry {
97
+ cell: IDocumentSkeletonPage;
98
+ cellRect: IBoundRectNoAngle;
99
+ clipLeft: number;
100
+ clipRight: number;
101
+ columnIndex: number;
102
+ pageLeft: number;
103
+ pageTop: number;
104
+ row: IDocumentSkeletonRow;
105
+ rowIndex: number;
106
+ visualLeft: number;
107
+ visualWidth: number;
108
+ }
109
+ export interface IDocumentSkeletonTableContext {
110
+ cells: IDocumentSkeletonTableCellGeometry[];
111
+ page: IDocumentSkeletonPage;
112
+ pageIndex: number;
113
+ pageLeft: number;
114
+ pageTop: number;
115
+ rootPage: IDocumentSkeletonPage;
116
+ source: DocumentSkeletonTableSource;
117
+ table: IDocumentSkeletonTable;
118
+ tableId: string;
119
+ tableRect: IBoundRectNoAngle;
120
+ }
121
+ export interface IDocumentSkeletonTableIteratorOptions {
122
+ docsLeft?: number;
123
+ docsTop?: number;
124
+ pageMarginTop?: number;
125
+ resolveViewport?: boolean;
126
+ tableCellInsetX?: number;
127
+ unitId?: string;
128
+ }
129
+ export declare function documentSkeletonTableIterator(pages: IDocumentSkeletonPage[], options?: IDocumentSkeletonTableIteratorOptions): IDocumentSkeletonTableContext[];
130
+ export declare function documentSkeletonLineIterator(pages: IDocumentSkeletonPage[], options: IDocumentSkeletonLineIteratorOptions, cb: (context: IDocumentSkeletonLineContext) => void): void;
131
+ export declare function getDocumentSkeletonNestedPageOffset(page: IDocumentSkeletonPage): {
132
+ left: number;
133
+ top: number;
134
+ } | undefined;
135
+ export interface IDocumentSkeletonColumnPagePathInfo {
136
+ columnGroupId: string;
137
+ columnIndex: number;
138
+ pageIndex: number;
139
+ }
140
+ export declare function getDocumentSkeletonColumnPagePathInfo(position: {
141
+ path?: (string | number)[];
142
+ }): IDocumentSkeletonColumnPagePathInfo | undefined;
143
+ export declare function compareDocumentSkeletonNestedPagePathOrder(pos1: {
144
+ path?: (string | number)[];
145
+ }, pos2: {
146
+ path?: (string | number)[];
147
+ }): boolean | undefined;
70
148
  export declare function columnIterator(pages: IDocumentSkeletonPage[], iteratorFunction: (column: IDocumentSkeletonColumn) => void): void;
71
149
  export declare function getPositionHorizon(positionH: IObjectPositionH, column: IDocumentSkeletonColumn, page: IDocumentSkeletonPage, objectWidth: number, isPageBreak?: boolean): number | undefined;
72
150
  export declare function getPositionVertical(positionV: IObjectPositionV, page: IDocumentSkeletonPage, lineTop: number, lineHeight: number, objectHeight: number, blockAnchorTop?: number, isPageBreak?: boolean): number | undefined;
@@ -102,6 +180,8 @@ export interface IFloatObject {
102
180
  width: number;
103
181
  height: number;
104
182
  angle: number;
183
+ behindDoc?: BooleanNumber;
184
+ layoutType?: PositionedObjectLayoutType;
105
185
  type: FloatObjectType;
106
186
  positionV: IObjectPositionV;
107
187
  }
@@ -15,9 +15,13 @@
15
15
  */
16
16
  export interface IDocsTableRenderViewport {
17
17
  contentWidth: number;
18
+ leadingInsetLeft?: number;
18
19
  scrollLeft: number;
20
+ trailingInsetRight?: number;
19
21
  viewportWidth: number;
20
22
  }
21
23
  export type DocsTableRenderViewportProvider = (unitId: string, tableId: string) => IDocsTableRenderViewport | null | undefined;
22
24
  export declare function setDocsTableRenderViewportProvider(provider: DocsTableRenderViewportProvider | null): void;
23
25
  export declare function getDocsTableRenderViewport(unitId: string, tableId: string): IDocsTableRenderViewport | null;
26
+ export declare function getDocsTableVirtualContentWidth(viewport: IDocsTableRenderViewport): number;
27
+ export declare function hasDocsTableHorizontalViewport(viewport: IDocsTableRenderViewport | null | undefined): viewport is IDocsTableRenderViewport;
@@ -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 { DocumentDataModel, ICustomBlock, ICustomDecorationForInterceptor, ICustomRangeForInterceptor, ICustomTable, IDisposable, IParagraph, ISectionBreak, ITable, ITextRun, Nullable } from '@univerjs/core';
16
+ import type { DocumentDataModel, IColumnGroup, ICustomBlock, ICustomColumnGroup, ICustomDecorationForInterceptor, ICustomRangeForInterceptor, ICustomTable, IDisposable, IParagraph, ISectionBreak, ITable, ITextRun, Nullable } from '@univerjs/core';
17
17
  import { DataStreamTreeNode } from './data-stream-tree-node';
18
18
  interface ITableNodeCache {
19
19
  table: DataStreamTreeNode;
@@ -35,6 +35,10 @@ interface ITableCoupleCache {
35
35
  table: ICustomTable;
36
36
  tableSource: ITable;
37
37
  }
38
+ interface IColumnGroupCoupleCache {
39
+ columnGroup: ICustomColumnGroup;
40
+ columnGroupSource: IColumnGroup;
41
+ }
38
42
  export declare class DocumentViewModel implements IDisposable {
39
43
  private _documentDataModel;
40
44
  private _interceptor;
@@ -44,6 +48,7 @@ export declare class DocumentViewModel implements IDisposable {
44
48
  private _sectionBreakCache;
45
49
  private _customBlockCache;
46
50
  private _tableCache;
51
+ private _columnGroupCache;
47
52
  private _tableNodeCache;
48
53
  private _children;
49
54
  private _editArea;
@@ -74,6 +79,7 @@ export declare class DocumentViewModel implements IDisposable {
74
79
  getCustomBlock(index: number): ICustomBlock | undefined;
75
80
  getCustomBlockWithoutSetCurrentIndex(index: number): ICustomBlock | undefined;
76
81
  getTableByStartIndex(index: number): ITableCoupleCache | undefined;
82
+ getColumnGroupByStartIndex(index: number): IColumnGroupCoupleCache | undefined;
77
83
  findTableNodeById(id: string): DataStreamTreeNode | undefined;
78
84
  getCustomRangeRaw(index: number): import("@univerjs/core").ICustomRange<Record<string, any>> | undefined;
79
85
  getCustomRange(index: number): Nullable<ICustomRangeForInterceptor>;
@@ -84,6 +90,7 @@ export declare class DocumentViewModel implements IDisposable {
84
90
  private _buildSectionBreakCache;
85
91
  private _buildCustomBlockCache;
86
92
  private _buildTableCache;
93
+ private _buildColumnGroupCache;
87
94
  private _buildTextRunsCache;
88
95
  private _buildHeaderFooterViewModel;
89
96
  }
@@ -16,7 +16,7 @@
16
16
  import type { IRange, IScale, ObjectMatrix } from '@univerjs/core';
17
17
  import type { UniverRenderingContext } from '../../../context';
18
18
  import type { IDrawInfo } from '../../extension';
19
- import type { BorderCache } from '../interfaces';
19
+ import type { IBorderCache } from '../interfaces';
20
20
  import type { SpreadsheetSkeleton } from '../sheet.render-skeleton';
21
21
  import { BorderStyleTypes } from '@univerjs/core';
22
22
  import { SheetExtension } from './sheet-extension';
@@ -34,7 +34,7 @@ export declare class Border extends SheetExtension {
34
34
  preStyle: BorderStyleTypes;
35
35
  preColor: string;
36
36
  draw(ctx: UniverRenderingContext, _parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], { viewRanges }: IDrawInfo): void;
37
- renderBorderByCell(renderBorderContext: IRenderBorderContext, row: number, col: number, borderCacheItem: BorderCache): true | undefined;
37
+ renderBorderByCell(renderBorderContext: IRenderBorderContext, row: number, col: number, borderCacheItem: IBorderCache): true | undefined;
38
38
  private _getOverflowExclusion;
39
39
  private _renderDoubleBorder;
40
40
  private _getSpecificCellBorder;
@@ -14,15 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { BorderStyleTypes, HorizontalAlign, ICellDataForSheetInterceptor, ICellWithCoord, ImageCacheMap, IStyleData, Nullable, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
17
- import type { BORDER_TYPE as BORDER_LTRB } from '../../basics/const';
17
+ import type { BORDER_TYPE } from '../../basics/const';
18
18
  import type { Canvas } from '../../canvas';
19
19
  import type { UniverRenderingContext } from '../../context';
20
20
  import type { DocumentSkeleton } from '../docs/layout/doc-skeleton';
21
- export interface BorderCache {
22
- [key: string]: BorderCacheItem | {};
21
+ export interface IBorderCache {
22
+ [key: string]: IBorderCacheItem | {};
23
23
  }
24
- export interface BorderCacheItem {
25
- type: BORDER_LTRB;
24
+ export interface IBorderCacheItem {
25
+ type: BORDER_TYPE;
26
26
  style: BorderStyleTypes;
27
27
  color: string;
28
28
  }
@@ -46,7 +46,7 @@ export interface IStylesCache {
46
46
  * Get value from getCell in skeleton and this value is used in font extension
47
47
  */
48
48
  fontMatrix: ObjectMatrix<IFontCacheItem>;
49
- border?: ObjectMatrix<BorderCache>;
49
+ border?: ObjectMatrix<IBorderCache>;
50
50
  }
51
51
  export declare enum ShowGridlinesState {
52
52
  OFF = 0,
@@ -26,11 +26,12 @@ export { getTableIdAndSliceIndex } from './components/docs/layout/block/table';
26
26
  export * from './components/docs/layout/doc-simple-skeleton';
27
27
  export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
28
28
  export type { IFindNodeRestrictions } from './components/docs/layout/doc-skeleton';
29
- export { getCharSpaceApply, getLastLine, getNumberUnitValue, getPageFromPath, glyphIterator, lineIterator } from './components/docs/layout/tools';
29
+ export { compareDocumentSkeletonNestedPagePathOrder, documentSkeletonLineIterator, documentSkeletonTableIterator, getCharSpaceApply, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getLastLine, getNumberUnitValue, getPageFromPath, glyphIterator, lineIterator, } from './components/docs/layout/tools';
30
+ export type { IDocumentSkeletonColumnPagePathInfo, IDocumentSkeletonLineContext, IDocumentSkeletonLineIteratorOptions, IDocumentSkeletonTableCellGeometry, IDocumentSkeletonTableContext, IDocumentSkeletonTableIteratorOptions } from './components/docs/layout/tools';
30
31
  export { getLastColumn } from './components/docs/layout/tools';
31
32
  export { Liquid } from './components/docs/liquid';
32
- export type { DocsTableRenderViewportProvider, IDocsTableRenderViewport } from './components/docs/table-render-viewport';
33
- export { getDocsTableRenderViewport, setDocsTableRenderViewportProvider } from './components/docs/table-render-viewport';
33
+ export type { DocsTableRenderViewportProvider, IDocsTableRenderViewport, } from './components/docs/table-render-viewport';
34
+ export { getDocsTableRenderViewport, setDocsTableRenderViewportProvider, } from './components/docs/table-render-viewport';
34
35
  export { DataStreamTreeNode } from './components/docs/view-model/data-stream-tree-node';
35
36
  export { DocumentViewModel } from './components/docs/view-model/document-view-model';
36
37
  export { DocumentEditArea } from './components/docs/view-model/document-view-model';
@@ -44,9 +45,10 @@ export * from './engine';
44
45
  export * from './group';
45
46
  export * from './layer';
46
47
  export { IRenderingEngine, UniverRenderEnginePlugin } from './plugin';
47
- export { getCurrentTypeOfRenderer, IRenderManagerService, RenderManagerService, withCurrentTypeOfRenderer } from './render-manager/render-manager.service';
48
+ export { getCurrentTypeOfRenderer, IRenderManagerService, RenderManagerService, withCurrentTypeOfRenderer, } from './render-manager/render-manager.service';
48
49
  export { type RenderComponentType } from './render-manager/render-manager.service';
49
- export { type IRender, type IRenderContext, type IRenderModule, RenderUnit } from './render-manager/render-unit';
50
+ export { RenderUnit } from './render-manager/render-unit';
51
+ export type { IRender, IRenderContext, IRenderModule } from './render-manager/render-unit';
50
52
  export * from './scene';
51
53
  export * from './scene-viewer';
52
54
  export { type IChangeObserverConfig } from './scene.transformer';
@@ -34,6 +34,7 @@ export interface IRenderManagerService extends IDisposable {
34
34
  createRender(unitId: string, createUnitOptions?: ICreateUnitOptions): IRender;
35
35
  removeRender(unitId: string): void;
36
36
  /**
37
+ * @deprecated use getRenderUnitById instead
37
38
  * Get RenderUnit By Id, RenderUnit implements IRender
38
39
  * @param unitId
39
40
  */