@univerjs/engine-render 1.0.0-alpha.0 → 1.0.0-alpha.2
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 +1062 -141
- package/lib/es/index.js +1059 -143
- package/lib/types/basics/const.d.ts +4 -0
- package/lib/types/basics/i-document-skeleton-cached.d.ts +25 -1
- package/lib/types/components/docs/document.d.ts +2 -0
- package/lib/types/components/docs/layout/block/column.d.ts +23 -0
- package/lib/types/components/docs/layout/model/page.d.ts +2 -1
- package/lib/types/components/docs/layout/tools.d.ts +82 -2
- package/lib/types/components/docs/view-model/document-view-model.d.ts +10 -2
- package/lib/types/index.d.ts +2 -1
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
|
@@ -62,6 +62,10 @@ export declare enum CURSOR_TYPE {
|
|
|
62
62
|
SOUTH_WEST_RESIZE = "sw-resize",
|
|
63
63
|
SOUTH_RESIZE = "s-resize",
|
|
64
64
|
WEST_RESIZE = "w-resize",
|
|
65
|
+
EAST_WEST_RESIZE = "ew-resize",
|
|
66
|
+
NORTH_SOUTH_RESIZE = "ns-resize",
|
|
67
|
+
NORTH_EAST_SOUTH_WEST_RESIZE = "nesw-resize",
|
|
68
|
+
NORTH_WEST_SOUTH_EAST_RESIZE = "nwse-resize",
|
|
65
69
|
TEXT = "text",
|
|
66
70
|
WAIT = "wait",
|
|
67
71
|
HELP = "help",
|
|
@@ -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, IColorStyle, 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;
|
|
@@ -46,6 +46,7 @@ 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;
|
|
49
50
|
private _drawTableCellBackgrounds;
|
|
50
51
|
private _getTableViewport;
|
|
51
52
|
private _getRenderUnitId;
|
|
@@ -54,6 +55,7 @@ export declare class Documents extends DocComponent {
|
|
|
54
55
|
private _drawBorderBottom;
|
|
55
56
|
private _drawGlyphGroupBackgrounds;
|
|
56
57
|
private _drawTableCell;
|
|
58
|
+
private _drawNestedPageContent;
|
|
57
59
|
private _drawTableCellBordersAndBg;
|
|
58
60
|
private _getTableCellSource;
|
|
59
61
|
private _resolveTableCellBorder;
|
|
@@ -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,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;
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
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, IDocumentSkeletonSection, ISkeletonResourceReference } from '../../../basics/i-document-skeleton-cached';
|
|
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';
|
|
@@ -64,10 +66,88 @@ export declare function getCharSpaceConfig(sectionBreakConfig: ISectionBreakConf
|
|
|
64
66
|
gridType: GridType;
|
|
65
67
|
snapToGrid: BooleanNumber;
|
|
66
68
|
};
|
|
67
|
-
export declare function updateBlockIndex(pages: IDocumentSkeletonPage[], start?: number): void;
|
|
69
|
+
export declare function updateBlockIndex(pages: IDocumentSkeletonPage[], start?: number, documentCompatibilityPolicy?: IDocumentCompatibilityPolicy): void;
|
|
68
70
|
export declare function updateInlineDrawingCoordsAndBorder(ctx: ILayoutContext, pages: IDocumentSkeletonPage[]): void;
|
|
69
71
|
export declare function glyphIterator(pages: IDocumentSkeletonPage[], cb: (glyph: IDocumentSkeletonGlyph, divide: IDocumentSkeletonDivide, line: IDocumentSkeletonLine, column: IDocumentSkeletonColumn, section: IDocumentSkeletonSection, page: IDocumentSkeletonPage) => void): void;
|
|
70
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' | 'header' | 'footer';
|
|
96
|
+
type HeaderFooterSkeletonMap = Map<string, Map<number, IDocumentSkeletonPage>>;
|
|
97
|
+
export interface IDocumentSkeletonTableCellGeometry {
|
|
98
|
+
cell: IDocumentSkeletonPage;
|
|
99
|
+
cellRect: IBoundRectNoAngle;
|
|
100
|
+
clipLeft: number;
|
|
101
|
+
clipRight: number;
|
|
102
|
+
columnIndex: number;
|
|
103
|
+
pageLeft: number;
|
|
104
|
+
pageTop: number;
|
|
105
|
+
row: IDocumentSkeletonRow;
|
|
106
|
+
rowIndex: number;
|
|
107
|
+
visualLeft: number;
|
|
108
|
+
visualWidth: number;
|
|
109
|
+
}
|
|
110
|
+
export interface IDocumentSkeletonTableContext {
|
|
111
|
+
cells: IDocumentSkeletonTableCellGeometry[];
|
|
112
|
+
page: IDocumentSkeletonPage;
|
|
113
|
+
pageIndex: number;
|
|
114
|
+
pageLeft: number;
|
|
115
|
+
pageTop: number;
|
|
116
|
+
rootPage: IDocumentSkeletonPage;
|
|
117
|
+
source: DocumentSkeletonTableSource;
|
|
118
|
+
table: IDocumentSkeletonTable;
|
|
119
|
+
tableId: string;
|
|
120
|
+
tableRect: IBoundRectNoAngle;
|
|
121
|
+
}
|
|
122
|
+
export interface IDocumentSkeletonTableIteratorOptions {
|
|
123
|
+
docsLeft?: number;
|
|
124
|
+
docsTop?: number;
|
|
125
|
+
pageMarginTop?: number;
|
|
126
|
+
resolveViewport?: boolean;
|
|
127
|
+
skeFooters?: HeaderFooterSkeletonMap;
|
|
128
|
+
skeHeaders?: HeaderFooterSkeletonMap;
|
|
129
|
+
tableCellInsetX?: number;
|
|
130
|
+
unitId?: string;
|
|
131
|
+
}
|
|
132
|
+
export declare function documentSkeletonTableIterator(pages: IDocumentSkeletonPage[], options?: IDocumentSkeletonTableIteratorOptions): IDocumentSkeletonTableContext[];
|
|
133
|
+
export declare function documentSkeletonLineIterator(pages: IDocumentSkeletonPage[], options: IDocumentSkeletonLineIteratorOptions, cb: (context: IDocumentSkeletonLineContext) => void): void;
|
|
134
|
+
export declare function getDocumentSkeletonNestedPageOffset(page: IDocumentSkeletonPage): {
|
|
135
|
+
left: number;
|
|
136
|
+
top: number;
|
|
137
|
+
} | undefined;
|
|
138
|
+
export interface IDocumentSkeletonColumnPagePathInfo {
|
|
139
|
+
columnGroupId: string;
|
|
140
|
+
columnIndex: number;
|
|
141
|
+
pageIndex: number;
|
|
142
|
+
}
|
|
143
|
+
export declare function getDocumentSkeletonColumnPagePathInfo(position: {
|
|
144
|
+
path?: (string | number)[];
|
|
145
|
+
}): IDocumentSkeletonColumnPagePathInfo | undefined;
|
|
146
|
+
export declare function compareDocumentSkeletonNestedPagePathOrder(pos1: {
|
|
147
|
+
path?: (string | number)[];
|
|
148
|
+
}, pos2: {
|
|
149
|
+
path?: (string | number)[];
|
|
150
|
+
}): boolean | undefined;
|
|
71
151
|
export declare function columnIterator(pages: IDocumentSkeletonPage[], iteratorFunction: (column: IDocumentSkeletonColumn) => void): void;
|
|
72
152
|
export declare function getPositionHorizon(positionH: IObjectPositionH, column: IDocumentSkeletonColumn, page: IDocumentSkeletonPage, objectWidth: number, isPageBreak?: boolean): number | undefined;
|
|
73
153
|
export declare function getPositionVertical(positionV: IObjectPositionV, page: IDocumentSkeletonPage, lineTop: number, lineHeight: number, objectHeight: number, blockAnchorTop?: number, isPageBreak?: boolean): number | 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 { 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,8 +35,13 @@ 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;
|
|
44
|
+
private _tableSource?;
|
|
40
45
|
private _interceptor;
|
|
41
46
|
private _cacheSize;
|
|
42
47
|
private _textRunsCache;
|
|
@@ -44,6 +49,7 @@ export declare class DocumentViewModel implements IDisposable {
|
|
|
44
49
|
private _sectionBreakCache;
|
|
45
50
|
private _customBlockCache;
|
|
46
51
|
private _tableCache;
|
|
52
|
+
private _columnGroupCache;
|
|
47
53
|
private _tableNodeCache;
|
|
48
54
|
private _children;
|
|
49
55
|
private _editArea;
|
|
@@ -53,7 +59,7 @@ export declare class DocumentViewModel implements IDisposable {
|
|
|
53
59
|
private _footerTreeMap;
|
|
54
60
|
private readonly _segmentViewModels$;
|
|
55
61
|
readonly segmentViewModels$: import("rxjs").Observable<DocumentViewModel[]>;
|
|
56
|
-
constructor(_documentDataModel: DocumentDataModel);
|
|
62
|
+
constructor(_documentDataModel: DocumentDataModel, _tableSource?: Record<string, ITable> | undefined);
|
|
57
63
|
registerCustomRangeInterceptor(interceptor: ICustomRangeInterceptor): IDisposable;
|
|
58
64
|
dispose(): void;
|
|
59
65
|
getHeaderFooterTreeMap(): {
|
|
@@ -74,6 +80,7 @@ export declare class DocumentViewModel implements IDisposable {
|
|
|
74
80
|
getCustomBlock(index: number): ICustomBlock | undefined;
|
|
75
81
|
getCustomBlockWithoutSetCurrentIndex(index: number): ICustomBlock | undefined;
|
|
76
82
|
getTableByStartIndex(index: number): ITableCoupleCache | undefined;
|
|
83
|
+
getColumnGroupByStartIndex(index: number): IColumnGroupCoupleCache | undefined;
|
|
77
84
|
findTableNodeById(id: string): DataStreamTreeNode | undefined;
|
|
78
85
|
getCustomRangeRaw(index: number): import("@univerjs/core").ICustomRange<Record<string, any>> | undefined;
|
|
79
86
|
getCustomRange(index: number): Nullable<ICustomRangeForInterceptor>;
|
|
@@ -84,6 +91,7 @@ export declare class DocumentViewModel implements IDisposable {
|
|
|
84
91
|
private _buildSectionBreakCache;
|
|
85
92
|
private _buildCustomBlockCache;
|
|
86
93
|
private _buildTableCache;
|
|
94
|
+
private _buildColumnGroupCache;
|
|
87
95
|
private _buildTextRunsCache;
|
|
88
96
|
private _buildHeaderFooterViewModel;
|
|
89
97
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ 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
33
|
export type { DocsTableRenderViewportProvider, IDocsTableRenderViewport, } from './components/docs/table-render-viewport';
|