@univerjs/engine-render 0.5.0-alpha.0 → 0.5.0-beta.0
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 +1 -1
- package/lib/es/index.js +7271 -7171
- package/lib/types/basics/i-document-skeleton-cached.d.ts +2 -1
- package/lib/types/basics/interfaces.d.ts +2 -2
- package/lib/types/basics/tools.d.ts +13 -17
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +0 -1
- package/lib/types/components/docs/layout/block/table.d.ts +5 -1
- package/lib/types/components/docs/layout/model/line.d.ts +3 -2
- package/lib/types/components/docs/layout/model/page.d.ts +1 -1
- package/lib/types/components/docs/layout/tools.d.ts +17 -3
- package/lib/types/components/sheets/column-header.d.ts +1 -1
- package/lib/types/components/sheets/extensions/background.d.ts +3 -3
- package/lib/types/components/sheets/extensions/custom.d.ts +1 -1
- package/lib/types/components/sheets/extensions/font.d.ts +4 -4
- package/lib/types/components/sheets/extensions/marker.d.ts +1 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +2 -14
- package/lib/types/components/sheets/interfaces.d.ts +2 -2
- package/lib/types/components/sheets/sheet-skeleton.d.ts +125 -19
- package/lib/types/scene.d.ts +21 -2
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IDocDrawingBase, IDocumentRenderConfig, INestingLevel, IParagraphProperties, ITable, ITextStyle, PageOrientType } from '@univerjs/core';
|
|
1
|
+
import { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IDocDrawingBase, IDocumentRenderConfig, INestingLevel, IParagraphProperties, ITable, ITableRow, ITextStyle, PageOrientType } from '@univerjs/core';
|
|
2
2
|
import { BreakPointType } from '../components/docs/layout/line-breaker/break';
|
|
3
3
|
export interface IDocumentSkeletonCached extends ISkeletonResourceReference {
|
|
4
4
|
pages: IDocumentSkeletonPage[];
|
|
@@ -85,6 +85,7 @@ export interface IDocumentSkeletonRow {
|
|
|
85
85
|
top: number;
|
|
86
86
|
st: number;
|
|
87
87
|
ed: number;
|
|
88
|
+
rowSource: ITableRow;
|
|
88
89
|
parent?: IDocumentSkeletonTable;
|
|
89
90
|
}
|
|
90
91
|
export interface IDocumentSkeletonColumn {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BooleanNumber, GridType, IDocStyleBase, IDocumentLayout, IOffset, IParagraphStyle, IReferenceSource, IScale, ISectionBreakBase, ISize, ITextStyle, ITransformState, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { DocumentViewModel } from '../components/docs/view-model/document-view-model';
|
|
3
3
|
import { DocumentSkeletonPageType, IDocumentSkeletonBullet, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonHeaderFooter, IDocumentSkeletonTable } from './i-document-skeleton-cached';
|
|
4
|
-
import { Vector2 } from './vector2';
|
|
5
4
|
import { ITransformerConfig } from './transformer-config';
|
|
5
|
+
import { Vector2 } from './vector2';
|
|
6
6
|
export interface IObjectFullState extends ITransformState {
|
|
7
7
|
strokeWidth?: number;
|
|
8
8
|
zIndex?: number;
|
|
@@ -62,7 +62,7 @@ export interface IParagraphTableCache {
|
|
|
62
62
|
}
|
|
63
63
|
export interface IParagraphConfig {
|
|
64
64
|
paragraphIndex: number;
|
|
65
|
-
|
|
65
|
+
paragraphNonInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
|
|
66
66
|
paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>;
|
|
67
67
|
skeTablesInParagraph?: IParagraphTableCache[];
|
|
68
68
|
bulletSkeleton?: IDocumentSkeletonBullet;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICellInfo, ICellWithCoord, IPosition, IRange, IRangeWithCoord, IScale, IStyleBase, Nullable } from '@univerjs/core';
|
|
2
2
|
import { IDocumentSkeletonFontStyle } from './i-document-skeleton-cached';
|
|
3
3
|
import { IBoundRectNoAngle } from './vector2';
|
|
4
4
|
export declare const getColor: (RgbArray: number[], opacity?: number) => string;
|
|
@@ -65,36 +65,32 @@ export declare function pxToPt(px: number): number;
|
|
|
65
65
|
export declare function ptToMM(px: number): number;
|
|
66
66
|
export declare function pxToInch(px: number): number;
|
|
67
67
|
export declare function getScale(parentScale: IScale): number;
|
|
68
|
-
export declare function getCellPositionByIndex(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[]):
|
|
69
|
-
startY: number;
|
|
70
|
-
endY: number;
|
|
71
|
-
startX: number;
|
|
72
|
-
endX: number;
|
|
73
|
-
};
|
|
68
|
+
export declare function getCellPositionByIndex(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[]): IPosition;
|
|
74
69
|
/**
|
|
75
70
|
* @description Get the cell position information of the specified row and column, including the position information of the cell and the merge information of the cell
|
|
76
71
|
* @param {number} row The row index of the cell
|
|
77
72
|
* @param {number} column The column index of the cell
|
|
78
73
|
* @param {number[]} rowHeightAccumulation The accumulated height of each row
|
|
79
74
|
* @param {number[]} columnWidthAccumulation The accumulated width of each column
|
|
80
|
-
* @param {
|
|
81
|
-
* @returns {
|
|
75
|
+
* @param {ICellInfo} mergeData The merge information of the cell
|
|
76
|
+
* @returns {ICellWithCoord} The cell position information of the specified row and column, including the position information of the cell and the merge information of the cell
|
|
82
77
|
*/
|
|
83
|
-
export declare function
|
|
78
|
+
export declare function getCellWithCoordByIndexCore(row: number, column: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], mergeDataInfo: ICellInfo): ICellWithCoord;
|
|
84
79
|
/**
|
|
85
|
-
* @deprecated please use
|
|
80
|
+
* @deprecated please use getCellWithCoordByIndexCore instead
|
|
86
81
|
*/
|
|
87
|
-
|
|
82
|
+
declare const getCellByIndexWithMergeInfo: typeof getCellWithCoordByIndexCore;
|
|
83
|
+
export { getCellByIndexWithMergeInfo };
|
|
88
84
|
/**
|
|
89
|
-
* @deprecated please use _hasUnMergedCellInRow in SpreadsheetSkeleton
|
|
90
85
|
* Determine whether there are any cells in a row that are not in the merged cells, mainly used for the calculation of auto height
|
|
86
|
+
* @deprecated please use SpreadsheetSkeleton@_hasUnMergedCellInRow
|
|
91
87
|
*/
|
|
92
88
|
export declare function hasUnMergedCellInRow(row: number, startColumn: number, endColumn: number, mergeData: IRange[]): boolean;
|
|
93
89
|
export declare function mergeInfoOffset(mergeInfo: IRangeWithCoord, offsetX: number, offsetY: number): {
|
|
94
|
-
startX: number;
|
|
95
90
|
startY: number;
|
|
96
|
-
endX: number;
|
|
97
91
|
endY: number;
|
|
92
|
+
startX: number;
|
|
93
|
+
endX: number;
|
|
98
94
|
rangeType?: import('@univerjs/core').RANGE_TYPE;
|
|
99
95
|
startAbsoluteRefType?: import('@univerjs/core').AbsoluteRefType;
|
|
100
96
|
endAbsoluteRefType?: import('@univerjs/core').AbsoluteRefType;
|
|
@@ -147,10 +143,10 @@ export declare function inRowViewRanges(ranges: IRange[], rowIndex: number): boo
|
|
|
147
143
|
* @param {IRange[]} ranges
|
|
148
144
|
*/
|
|
149
145
|
export declare function expandRangeIfIntersects(mainRanges: IRange[], ranges: IRange[]): IRange[];
|
|
150
|
-
export declare function clampRange(range: IRange): {
|
|
146
|
+
export declare function clampRange(range: IRange, maxRow: number, maxColumn: number): {
|
|
151
147
|
startRow: number;
|
|
152
|
-
startColumn: number;
|
|
153
148
|
endRow: number;
|
|
149
|
+
startColumn: number;
|
|
154
150
|
endColumn: number;
|
|
155
151
|
};
|
|
156
152
|
export declare function getSystemHighlightColor(): import('@univerjs/core').IRgbColor;
|
|
@@ -5,7 +5,6 @@ import { docExtension } from '../doc-extension';
|
|
|
5
5
|
export declare class FontAndBaseLine extends docExtension {
|
|
6
6
|
uKey: string;
|
|
7
7
|
Z_INDEX: number;
|
|
8
|
-
private _preFontString;
|
|
9
8
|
private _preFontColor;
|
|
10
9
|
draw(ctx: UniverRenderingContext, parentScale: IScale, glyph: IDocumentSkeletonGlyph): void;
|
|
11
10
|
private _fillText;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { ITable } from '@univerjs/core';
|
|
1
|
+
import { ITable, Nullable } from '@univerjs/core';
|
|
2
2
|
import { IDocumentSkeletonPage, IDocumentSkeletonTable, ISectionBreakConfig } from '../../../../basics';
|
|
3
3
|
import { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
|
|
4
4
|
import { DocumentViewModel } from '../../view-model/document-view-model';
|
|
5
5
|
import { ILayoutContext } from '../tools';
|
|
6
6
|
export declare function createTableSkeleton(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, tableNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig): IDocumentSkeletonTable;
|
|
7
|
+
export declare function splitTable(tableSke: IDocumentSkeletonTable, availableHeight: number): [
|
|
8
|
+
Nullable<IDocumentSkeletonTable>,
|
|
9
|
+
Nullable<IDocumentSkeletonTable>
|
|
10
|
+
];
|
|
7
11
|
export declare function getNullTableSkeleton(st: number, ed: number, table: ITable): IDocumentSkeletonTable;
|
|
8
12
|
export declare function getTableSliceId(tableId: string, sliceIndex: number): string;
|
|
9
13
|
export declare function getTableIdAndSliceIndex(tableSliceId: string): {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Nullable } from '@univerjs/core';
|
|
2
|
-
import { IDocumentSkeletonDivide, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonLine, IDocumentSkeletonPage, LineType } from '../../../../basics/i-document-skeleton-cached';
|
|
3
2
|
import { IParagraphConfig } from '../../../../basics';
|
|
3
|
+
import { IDocumentSkeletonDivide, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonLine, IDocumentSkeletonPage, LineType } from '../../../../basics/i-document-skeleton-cached';
|
|
4
|
+
import { IFloatObject } from '../tools';
|
|
4
5
|
interface ILineBoundingBox {
|
|
5
6
|
lineHeight: number;
|
|
6
7
|
lineTop: number;
|
|
@@ -16,7 +17,7 @@ export declare function createSkeletonLine(paragraphIndex: number, lineType: Lin
|
|
|
16
17
|
export declare function calculateLineTopByDrawings(lineHeight: number | undefined, lineTop: number | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>): number;
|
|
17
18
|
export declare function updateDivideInfo(divide: IDocumentSkeletonDivide, states: Partial<IDocumentSkeletonDivide>): void;
|
|
18
19
|
export declare function setLineMarginBottom(line: IDocumentSkeletonLine, marginBottom: number): void;
|
|
19
|
-
export declare function collisionDetection(
|
|
20
|
+
export declare function collisionDetection(floatObject: IFloatObject, lineHeight: number, lineTop: number, columnLeft: number, columnWidth: number): boolean;
|
|
20
21
|
export declare function getBoundingBox(angle: number, left: number, width: number, top: number, height: number): import('../../../..').IRect;
|
|
21
22
|
export declare function createAndUpdateBlockAnchor(paragraphIndex: number, line: IDocumentSkeletonLine, top: number, drawingAnchor?: Map<number, IDocumentSkeletonDrawingAnchor>): void;
|
|
22
23
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ITable } from '@univerjs/core';
|
|
2
2
|
import { IDocumentSkeletonPage, ISkeletonResourceReference, BreakType } from '../../../../basics/i-document-skeleton-cached';
|
|
3
3
|
import { ISectionBreakConfig } from '../../../../basics/interfaces';
|
|
4
|
+
import { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
|
|
4
5
|
import { DocumentViewModel } from '../../view-model/document-view-model';
|
|
5
6
|
import { ILayoutContext } from '../tools';
|
|
6
|
-
import { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
|
|
7
7
|
export declare function createSkeletonPage(ctx: ILayoutContext, sectionBreakConfig: ISectionBreakConfig, skeletonResourceReference: ISkeletonResourceReference, pageNumber?: number, breakType?: BreakType): IDocumentSkeletonPage;
|
|
8
8
|
export declare function createSkeletonCellPage(ctx: ILayoutContext, viewModel: DocumentViewModel, cellNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, tableConfig: ITable, row: number, col: number): IDocumentSkeletonPage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DocumentDataModel, INumberUnit, IObjectPositionH, IObjectPositionV, IParagraph, IParagraphStyle, ITextStyle, Nullable, BooleanNumber, GridType, SpacingRule } from '@univerjs/core';
|
|
2
|
-
import { IDocumentSkeletonCached, IDocumentSkeletonColumn, IDocumentSkeletonDivide,
|
|
2
|
+
import { IDocumentSkeletonCached, IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonSection, ISkeletonResourceReference } from '../../../basics/i-document-skeleton-cached';
|
|
3
3
|
import { IDocsConfig, IParagraphConfig, ISectionBreakConfig } from '../../../basics/interfaces';
|
|
4
4
|
import { DataStreamTreeNode } from '../view-model/data-stream-tree-node';
|
|
5
5
|
import { DocumentViewModel } from '../view-model/document-view-model';
|
|
@@ -75,6 +75,20 @@ export declare function getFontConfigFromLastGlyph(glyph: IDocumentSkeletonGlyph
|
|
|
75
75
|
export declare function getFontCreateConfig(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, paragraph: IParagraph): IFontCreateConfig;
|
|
76
76
|
export declare function getNullSkeleton(): IDocumentSkeletonCached;
|
|
77
77
|
export declare function setPageParent(pages: IDocumentSkeletonPage[], parent: IDocumentSkeletonCached): void;
|
|
78
|
+
export declare enum FloatObjectType {
|
|
79
|
+
IMAGE = "IMAGE",
|
|
80
|
+
TABLE = "TABLE"
|
|
81
|
+
}
|
|
82
|
+
export interface IFloatObject {
|
|
83
|
+
id: string;
|
|
84
|
+
top: number;
|
|
85
|
+
left: number;
|
|
86
|
+
width: number;
|
|
87
|
+
height: number;
|
|
88
|
+
angle: number;
|
|
89
|
+
type: FloatObjectType;
|
|
90
|
+
positionV: IObjectPositionV;
|
|
91
|
+
}
|
|
78
92
|
export interface ILayoutContext {
|
|
79
93
|
viewModel: DocumentViewModel;
|
|
80
94
|
dataModel: DocumentDataModel;
|
|
@@ -83,10 +97,10 @@ export interface ILayoutContext {
|
|
|
83
97
|
layoutStartPointer: Record<string, Nullable<number>>;
|
|
84
98
|
isDirty: boolean;
|
|
85
99
|
skeletonResourceReference: ISkeletonResourceReference;
|
|
86
|
-
|
|
100
|
+
floatObjectsCache: Map<string, {
|
|
87
101
|
count: number;
|
|
88
102
|
page: IDocumentSkeletonPage;
|
|
89
|
-
|
|
103
|
+
floatObject: IFloatObject;
|
|
90
104
|
}>;
|
|
91
105
|
paragraphConfigCache: Map<string, Map<number, IParagraphConfig>>;
|
|
92
106
|
sectionBreakConfigCache: Map<number, ISectionBreakConfig>;
|
|
@@ -25,7 +25,7 @@ export declare class SpreadsheetColumnHeader extends SpreadsheetHeader {
|
|
|
25
25
|
isHit(coord: Vector2): boolean;
|
|
26
26
|
private _initialDefaultExtension;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Customize column header, such as custom header text and background.
|
|
29
29
|
* @param cfg
|
|
30
30
|
*/
|
|
31
31
|
setCustomHeader(cfg: IColumnsHeaderCfgParam): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRange, IScale,
|
|
1
|
+
import { ICellWithCoord, IRange, IScale, ObjectMatrix } from '@univerjs/core';
|
|
2
2
|
import { UniverRenderingContext } from '../../../context';
|
|
3
3
|
import { IDrawInfo } from '../../extension';
|
|
4
4
|
import { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
@@ -6,14 +6,14 @@ import { SheetExtension } from './sheet-extension';
|
|
|
6
6
|
interface IRenderBGContext {
|
|
7
7
|
ctx: UniverRenderingContext;
|
|
8
8
|
spreadsheetSkeleton: SpreadsheetSkeleton;
|
|
9
|
-
backgroundPositions: ObjectMatrix<
|
|
9
|
+
backgroundPositions: ObjectMatrix<ICellWithCoord>;
|
|
10
10
|
checkOutOfViewBound: boolean;
|
|
11
11
|
backgroundPaths: Path2D;
|
|
12
12
|
scaleX: number;
|
|
13
13
|
scaleY: number;
|
|
14
14
|
viewRanges: IRange[];
|
|
15
15
|
diffRanges: IRange[];
|
|
16
|
-
cellInfo:
|
|
16
|
+
cellInfo: ICellWithCoord;
|
|
17
17
|
}
|
|
18
18
|
export declare class Background extends SheetExtension {
|
|
19
19
|
uKey: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRange, IScale } from '@univerjs/core';
|
|
2
|
-
import { SheetExtension } from './sheet-extension';
|
|
3
2
|
import { UniverRenderingContext } from '../../../context';
|
|
4
3
|
import { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
4
|
+
import { SheetExtension } from './sheet-extension';
|
|
5
5
|
export declare class Custom extends SheetExtension {
|
|
6
6
|
protected Z_INDEX: number;
|
|
7
7
|
uKey: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellDataForSheetInterceptor, IRange, IScale,
|
|
1
|
+
import { ICellDataForSheetInterceptor, ICellWithCoord, IRange, IScale, Nullable, ObjectMatrix } from '@univerjs/core';
|
|
2
2
|
import { UniverRenderingContext } from '../../../context';
|
|
3
3
|
import { IDrawInfo } from '../../extension';
|
|
4
4
|
import { IFontCacheItem } from '../interfaces';
|
|
@@ -16,19 +16,19 @@ interface IRenderFontContext {
|
|
|
16
16
|
diffRanges: IRange[];
|
|
17
17
|
spreadsheetSkeleton: SpreadsheetSkeleton;
|
|
18
18
|
overflowRectangle: Nullable<IRange>;
|
|
19
|
-
cellData: ICellDataForSheetInterceptor
|
|
19
|
+
cellData: Nullable<ICellDataForSheetInterceptor>;
|
|
20
20
|
startY: number;
|
|
21
21
|
endY: number;
|
|
22
22
|
startX: number;
|
|
23
23
|
endX: number;
|
|
24
|
-
cellInfo:
|
|
24
|
+
cellInfo: ICellWithCoord;
|
|
25
25
|
}
|
|
26
26
|
export declare class Font extends SheetExtension {
|
|
27
27
|
uKey: string;
|
|
28
28
|
Z_INDEX: number;
|
|
29
29
|
getDocuments(): any;
|
|
30
30
|
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], moreBoundsInfo: IDrawInfo): void;
|
|
31
|
-
|
|
31
|
+
_renderFontEachCell(renderFontCtx: IRenderFontContext, row: number, col: number, fontMatrix: ObjectMatrix<IFontCacheItem>): boolean;
|
|
32
32
|
/**
|
|
33
33
|
* Change font render bounds, for overflow and filter icon & custom render.
|
|
34
34
|
* @param renderFontContext
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRange, IScale } from '@univerjs/core';
|
|
2
|
-
import { SheetExtension } from './sheet-extension';
|
|
3
2
|
import { UniverRenderingContext } from '../../../context';
|
|
4
3
|
import { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
4
|
+
import { SheetExtension } from './sheet-extension';
|
|
5
5
|
export declare class Marker extends SheetExtension {
|
|
6
6
|
protected Z_INDEX: number;
|
|
7
7
|
uKey: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRange } from '@univerjs/core';
|
|
2
|
-
import { ComponentExtension } from '../../extension';
|
|
3
2
|
import { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
3
|
+
import { ComponentExtension } from '../../extension';
|
|
4
4
|
export declare enum SHEET_EXTENSION_TYPE {
|
|
5
5
|
GRID = 0
|
|
6
6
|
}
|
|
@@ -10,23 +10,11 @@ export declare enum SHEET_EXTENSION_TYPE {
|
|
|
10
10
|
export declare const SHEET_EXTENSION_PREFIX = "sheet-ext-";
|
|
11
11
|
export declare class SheetExtension extends ComponentExtension<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE, IRange[]> {
|
|
12
12
|
type: SHEET_EXTENSION_TYPE;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated The function maybe cause performance issue, use spreadsheetSkeleton.getCellByIndexWithNoHeader instead.
|
|
15
|
-
* Get ISelectionCellWithMergeInfo by cell rowIndex and cell columnIndex.
|
|
16
|
-
* The startXY in return value does not include rowHeader and columnHeader.
|
|
17
|
-
* @param rowIndex
|
|
18
|
-
* @param columnIndex
|
|
19
|
-
* @param rowHeightAccumulation
|
|
20
|
-
* @param columnWidthAccumulation
|
|
21
|
-
* @param dataMergeCache
|
|
22
|
-
* @returns {ISelectionCellWithMergeInfo} cell Position & mergeInfo
|
|
23
|
-
*/
|
|
24
|
-
getCellByIndex(rowIndex: number, columnIndex: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], dataMergeCache: IRange[]): import('@univerjs/core').ISelectionCellWithMergeInfo;
|
|
25
13
|
isRenderDiffRangesByCell(rangeP: IRange, diffRanges?: IRange[]): boolean;
|
|
26
14
|
isRenderDiffRangesByColumn(curStartColumn: number, curEndColumn: number, diffRanges?: IRange[]): boolean;
|
|
27
15
|
isRenderDiffRangesByRow(curStartRow: number, curEndRow: number, diffRanges?: IRange[]): boolean;
|
|
28
16
|
/**
|
|
29
|
-
*
|
|
17
|
+
* Check if row range is in view ranges
|
|
30
18
|
* @param curStartRow
|
|
31
19
|
* @param curEndRow
|
|
32
20
|
* @param viewranges
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BorderStyleTypes, HorizontalAlign,
|
|
1
|
+
import { BorderStyleTypes, HorizontalAlign, ICellWithCoord, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { BORDER_TYPE as BORDER_LTRB } from '../../basics/const';
|
|
3
3
|
import { Canvas } from '../../canvas';
|
|
4
4
|
import { UniverRenderingContext } from '../../context';
|
|
@@ -22,7 +22,7 @@ export interface IFontCacheItem {
|
|
|
22
22
|
type colorString = string;
|
|
23
23
|
export interface IStylesCache {
|
|
24
24
|
background?: Record<colorString, ObjectMatrix<string>>;
|
|
25
|
-
backgroundPositions?: ObjectMatrix<
|
|
25
|
+
backgroundPositions?: ObjectMatrix<ICellWithCoord>;
|
|
26
26
|
font?: Record<string, ObjectMatrix<IFontCacheItem>>;
|
|
27
27
|
fontMatrix: ObjectMatrix<IFontCacheItem>;
|
|
28
28
|
border?: ObjectMatrix<BorderCache>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICellData, ICellDataForSheetInterceptor, IColAutoWidthInfo, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, IRowRange,
|
|
1
|
+
import { ICellData, ICellDataForSheetInterceptor, ICellInfo, ICellWithCoord, IColAutoWidthInfo, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, IRowRange, ISize, IStyleData, ITextRotation, IWorksheetData, Nullable, Styles, VerticalAlign, Worksheet, BooleanNumber, DocumentDataModel, HorizontalAlign, IConfigService, IContextService, LocaleService, ObjectMatrix, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
import { IBoundRectNoAngle, IViewportInfo } from '../../basics/vector2';
|
|
3
3
|
import { DocumentSkeleton } from '../docs/layout/doc-skeleton';
|
|
4
4
|
import { Skeleton } from '../skeleton';
|
|
@@ -34,7 +34,20 @@ export interface ICacheItem {
|
|
|
34
34
|
}
|
|
35
35
|
export interface IGetRowColByPosOptions {
|
|
36
36
|
closeFirst?: boolean;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* For searchArray(rowHeightAccumulation) & searchArray(colWidthAccumulation)
|
|
39
|
+
* true means return first matched index in matched sequence.
|
|
40
|
+
* default return last index in matched sequence.
|
|
41
|
+
*/
|
|
42
|
+
firstMatch?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface IGetPosByRowColOptions {
|
|
45
|
+
closeFirst?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* for searchArray(rowHeightAccumulation) & searchArray(colWidthAccumulation)
|
|
48
|
+
* true means return first matched index in array
|
|
49
|
+
*/
|
|
50
|
+
firstMatch?: boolean;
|
|
38
51
|
}
|
|
39
52
|
export declare class SpreadsheetSkeleton extends Skeleton {
|
|
40
53
|
readonly worksheet: Worksheet;
|
|
@@ -158,6 +171,12 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
158
171
|
getWorksheetConfig(): IWorksheetData;
|
|
159
172
|
getRangeByViewBound(bound?: IBoundRectNoAngle): IRange;
|
|
160
173
|
getMergeBounding(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange;
|
|
174
|
+
/**
|
|
175
|
+
* expand curr range if it's intersect with merge range.
|
|
176
|
+
* @param range
|
|
177
|
+
* @returns {IRange} expanded range because merge info.
|
|
178
|
+
*/
|
|
179
|
+
expandRangeByMerge(range: IRange): IRange;
|
|
161
180
|
appendToOverflowCache(row: number, column: number, startColumn: number, endColumn: number): void;
|
|
162
181
|
getColumnCount(): number;
|
|
163
182
|
getRowCount(): number;
|
|
@@ -165,42 +184,101 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
165
184
|
getNoMergeCellPositionByIndex(rowIndex: number, columnIndex: number): IPosition;
|
|
166
185
|
getNoMergeCellPositionByIndexWithNoHeader(rowIndex: number, columnIndex: number): IPosition;
|
|
167
186
|
/**
|
|
187
|
+
* Get cell by pos(offsetX, offsetY).
|
|
188
|
+
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
189
|
+
*/
|
|
190
|
+
calculateCellIndexByPosition(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
191
|
+
x: number;
|
|
192
|
+
y: number;
|
|
193
|
+
}): Nullable<ICellWithCoord>;
|
|
194
|
+
/**
|
|
195
|
+
* Get cell by pos(offsetX, offsetY).
|
|
196
|
+
*
|
|
197
|
+
* options.matchFirst true means get cell would skip all invisible cells.
|
|
198
|
+
* @param offsetX position X in viewport.
|
|
199
|
+
* @param offsetY position Y in viewport.
|
|
200
|
+
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
201
|
+
* @param scaleY render scene scale y-axis, scene.getAncestorScale
|
|
202
|
+
* @param scrollXY render viewportScroll {x, y}
|
|
203
|
+
* @param options {IGetRowColByPosOptions}
|
|
204
|
+
* @returns {ICellWithCoord} Selection data with coordinates
|
|
205
|
+
*/
|
|
206
|
+
getCellWithCoordByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
207
|
+
x: number;
|
|
208
|
+
y: number;
|
|
209
|
+
}, options?: IGetRowColByPosOptions): ICellWithCoord;
|
|
210
|
+
/**
|
|
211
|
+
* This method has the same implementation as `getCellIndexByOffset`,
|
|
212
|
+
* but uses a different name to maintain backward compatibility with previous calls.
|
|
168
213
|
*
|
|
169
|
-
* @
|
|
170
|
-
|
|
214
|
+
* @deprecated Please use `getCellIndexByOffset` method instead.
|
|
215
|
+
*/
|
|
216
|
+
getCellPositionByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
217
|
+
x: number;
|
|
218
|
+
y: number;
|
|
219
|
+
}, options?: IGetRowColByPosOptions): {
|
|
220
|
+
row: number;
|
|
221
|
+
column: number;
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Get cell index by offset(o)
|
|
225
|
+
* @param offsetX position X in viewport.
|
|
226
|
+
* @param offsetY position Y in viewport.
|
|
171
227
|
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
172
228
|
* @param scaleY render scene scale y-axis, scene.getAncestorScale
|
|
173
229
|
* @param scrollXY render viewport scroll {x, y}, scene.getScrollXYByRelativeCoords, scene.getScrollXY
|
|
174
230
|
* @param scrollXY.x
|
|
175
231
|
* @param scrollXY.y
|
|
176
|
-
* @returns
|
|
232
|
+
* @returns cell index
|
|
177
233
|
*/
|
|
178
|
-
|
|
234
|
+
getCellIndexByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
179
235
|
x: number;
|
|
180
236
|
y: number;
|
|
181
237
|
}, options?: IGetRowColByPosOptions): {
|
|
182
238
|
row: number;
|
|
183
239
|
column: number;
|
|
184
240
|
};
|
|
241
|
+
getCellByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
242
|
+
x: number;
|
|
243
|
+
y: number;
|
|
244
|
+
}): Nullable<ICellInfo>;
|
|
245
|
+
getCellWithMergeInfoByIndex(row: number, column: number): Nullable<ICellInfo>;
|
|
185
246
|
/**
|
|
186
|
-
*
|
|
187
|
-
* @
|
|
188
|
-
* @param scaleX scale x
|
|
189
|
-
* @param scrollXY
|
|
247
|
+
* Same as getColumnIndexByOffsetX
|
|
248
|
+
* @deprecated Please use `getColumnIndexByOffsetX` method instead.
|
|
190
249
|
*/
|
|
191
250
|
getColumnPositionByOffsetX(offsetX: number, scaleX: number, scrollXY: {
|
|
192
251
|
x: number;
|
|
193
252
|
y: number;
|
|
194
253
|
}, options?: IGetRowColByPosOptions): number;
|
|
195
254
|
/**
|
|
196
|
-
* Get
|
|
255
|
+
* Get column index by offset x.
|
|
256
|
+
* @param offsetX scaled offset x
|
|
257
|
+
* @param scaleX scale x
|
|
258
|
+
* @param scrollXY scrollXY
|
|
259
|
+
* @returns column index
|
|
260
|
+
*/
|
|
261
|
+
getColumnIndexByOffsetX(evtOffsetX: number, scaleX: number, scrollXY: {
|
|
262
|
+
x: number;
|
|
263
|
+
y: number;
|
|
264
|
+
}, options?: IGetRowColByPosOptions): number;
|
|
265
|
+
/**
|
|
266
|
+
* Same as getRowIndexByOffsetY
|
|
267
|
+
* @deprecated Please use `getRowIndexByOffsetY` method instead.
|
|
268
|
+
*/
|
|
269
|
+
getRowPositionByOffsetY(offsetY: number, scaleY: number, scrollXY: {
|
|
270
|
+
x: number;
|
|
271
|
+
y: number;
|
|
272
|
+
}, options?: IGetRowColByPosOptions): number;
|
|
273
|
+
/**
|
|
274
|
+
*
|
|
197
275
|
* @param offsetY scaled offset y
|
|
198
276
|
* @param scaleY scale y
|
|
199
277
|
* @param scrollXY
|
|
200
278
|
* @param scrollXY.x
|
|
201
279
|
* @param scrollXY.y
|
|
202
280
|
*/
|
|
203
|
-
|
|
281
|
+
getRowIndexByOffsetY(offsetY: number, scaleY: number, scrollXY: {
|
|
204
282
|
x: number;
|
|
205
283
|
y: number;
|
|
206
284
|
}, options?: IGetRowColByPosOptions): number;
|
|
@@ -214,33 +292,61 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
214
292
|
}): number;
|
|
215
293
|
getOffsetByPositionX(column: number): number;
|
|
216
294
|
getOffsetByPositionY(row: number): number;
|
|
295
|
+
/**
|
|
296
|
+
* Same as getCellWithCoordByIndex, but uses a different name to maintain backward compatibility with previous calls.
|
|
297
|
+
* @deprecated Please use `getCellWithCoordByIndex` instead.
|
|
298
|
+
*/
|
|
299
|
+
getCellByIndex(row: number, column: number): ICellWithCoord;
|
|
300
|
+
/**
|
|
301
|
+
* @deprecated Please use `getCellWithCoordByIndex(row, col, false)` instead.
|
|
302
|
+
* @param row
|
|
303
|
+
* @param column
|
|
304
|
+
*/
|
|
305
|
+
getCellByIndexWithNoHeader(row: number, column: number): ICellWithCoord;
|
|
217
306
|
/**
|
|
218
307
|
* Return cell information corresponding to the current coordinates, including the merged cell object.
|
|
308
|
+
*
|
|
219
309
|
* @param row Specified Row Coordinate
|
|
220
310
|
* @param column Specified Column Coordinate
|
|
221
311
|
*/
|
|
222
|
-
|
|
312
|
+
getCellWithCoordByIndex(row: number, column: number, header?: boolean): ICellWithCoord;
|
|
223
313
|
/**
|
|
224
|
-
*
|
|
225
|
-
* @param
|
|
226
|
-
* @param
|
|
227
|
-
* @
|
|
314
|
+
* convert canvas content position to physical position in screen
|
|
315
|
+
* @param offsetX
|
|
316
|
+
* @param scaleX
|
|
317
|
+
* @param scrollXY
|
|
228
318
|
*/
|
|
229
|
-
getCellByIndexWithNoHeader(row: number, column: number): ISelectionCellWithMergeInfo;
|
|
230
319
|
convertTransformToOffsetX(offsetX: number, scaleX: number, scrollXY: {
|
|
231
320
|
x: number;
|
|
232
321
|
y: number;
|
|
233
322
|
}): number;
|
|
323
|
+
/**
|
|
324
|
+
* convert canvas content position to physical position in screen
|
|
325
|
+
* @param offsetY
|
|
326
|
+
* @param scaleY
|
|
327
|
+
* @param scrollXY
|
|
328
|
+
*/
|
|
234
329
|
convertTransformToOffsetY(offsetY: number, scaleY: number, scrollXY: {
|
|
235
330
|
x: number;
|
|
236
331
|
y: number;
|
|
237
332
|
}): number;
|
|
238
|
-
|
|
333
|
+
/**
|
|
334
|
+
* Only used for cell edit, and no need to rotate text when edit cell content!
|
|
335
|
+
* @deprecated use same method in worksheet.
|
|
336
|
+
* @param cell
|
|
337
|
+
*/
|
|
239
338
|
getBlankCellDocumentModel(cell: Nullable<ICellData>): IDocumentLayoutObject;
|
|
339
|
+
/**
|
|
340
|
+
* Only used for cell edit, and no need to rotate text when edit cell content!
|
|
341
|
+
* @deprecated use same method in worksheet.
|
|
342
|
+
* @param cell
|
|
343
|
+
*/
|
|
240
344
|
getCellDocumentModelWithFormula(cell: ICellData): Nullable<IDocumentLayoutObject>;
|
|
241
345
|
/**
|
|
242
346
|
* This method generates a document model based on the cell's properties and handles the associated styles and configurations.
|
|
243
347
|
* If the cell does not exist, it will return null.
|
|
348
|
+
*
|
|
349
|
+
* @deprecated use same method in worksheet.
|
|
244
350
|
* PS: This method has significant impact on performance.
|
|
245
351
|
* @param cell
|
|
246
352
|
* @param options
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -148,26 +148,45 @@ export declare class Scene extends ThinScene {
|
|
|
148
148
|
*/
|
|
149
149
|
findViewportByPosToViewport(coord: Vector2): Viewport | undefined;
|
|
150
150
|
getActiveViewportByCoord(coord: Vector2): Viewport | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated use `getScrollXYInfoByViewport` instead.
|
|
153
|
+
* @param pos
|
|
154
|
+
* @param viewPort
|
|
155
|
+
*/
|
|
156
|
+
getVpScrollXYInfoByPosToVp(pos: Vector2, viewPort?: Viewport): {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
};
|
|
151
160
|
/**
|
|
152
161
|
* getViewportScrollXYInfo by viewport under cursor position
|
|
153
162
|
* prev getScrollXYByRelativeCoords
|
|
154
163
|
* @param pos
|
|
155
164
|
* @param viewPort
|
|
156
165
|
*/
|
|
157
|
-
|
|
166
|
+
getScrollXYInfoByViewport(pos: Vector2, viewPort?: Viewport): {
|
|
158
167
|
x: number;
|
|
159
168
|
y: number;
|
|
160
169
|
};
|
|
170
|
+
getDefaultViewport(): Viewport;
|
|
161
171
|
getViewportScrollXY(viewPort: Viewport): {
|
|
162
172
|
x: number;
|
|
163
173
|
y: number;
|
|
164
174
|
};
|
|
165
175
|
/**
|
|
176
|
+
* @deprecated use `getCoordRelativeToViewport` instead
|
|
177
|
+
* @param coord
|
|
178
|
+
* @returns
|
|
179
|
+
*/
|
|
180
|
+
getRelativeToViewportCoord(coord: Vector2): Vector2;
|
|
181
|
+
/**
|
|
182
|
+
* Get coord to active viewport.
|
|
166
183
|
* In a nested scene scenario, it is necessary to obtain the relative offsets layer by layer.
|
|
184
|
+
*
|
|
185
|
+
* origin name: getRelativeToViewportCoord
|
|
167
186
|
* @param coord Coordinates to be converted.
|
|
168
187
|
* @returns
|
|
169
188
|
*/
|
|
170
|
-
|
|
189
|
+
getCoordRelativeToViewport(coord: Vector2): Vector2;
|
|
171
190
|
clearLayer(): void;
|
|
172
191
|
clearViewports(): void;
|
|
173
192
|
getAncestorScale(): {
|