@univerjs/engine-render 0.4.2-nightly.202410310419 → 0.4.2-nightly.202411011606
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/es/index.js +33 -50
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +1 -1
- package/lib/types/components/docs/layout/block/paragraph/shaping.d.ts +1 -1
- package/lib/types/components/sheets/sheet-skeleton.d.ts +14 -26
- package/lib/umd/index.js +1 -1
- package/package.json +2 -2
package/lib/es/index.js
CHANGED
|
@@ -24936,7 +24936,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24936
24936
|
if (!this._worksheetData || (this._updateLayout(), !this._rowHeightAccumulation || !this._columnWidthAccumulation))
|
|
24937
24937
|
return !1;
|
|
24938
24938
|
if (bounds != null) {
|
|
24939
|
-
const range = this.
|
|
24939
|
+
const range = this.getRangeByBounding(bounds);
|
|
24940
24940
|
this._visibleRange = range, this._visibleRangeMap.set(bounds.viewportKey, range);
|
|
24941
24941
|
}
|
|
24942
24942
|
return !0;
|
|
@@ -25168,8 +25168,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25168
25168
|
const widthByComputation = `${this.worksheet.getRowCount()}`.length * 8;
|
|
25169
25169
|
return Math.max(rowHeader.width, widthByComputation);
|
|
25170
25170
|
}
|
|
25171
|
-
|
|
25172
|
-
return this.
|
|
25171
|
+
getRangeByBounding(bounds) {
|
|
25172
|
+
return this._getRangeByViewBounding(this._rowHeightAccumulation, this._columnWidthAccumulation, bounds == null ? void 0 : bounds.cacheBound);
|
|
25173
25173
|
}
|
|
25174
25174
|
/**
|
|
25175
25175
|
* @deprecated should never expose a property that is provided by another module!
|
|
@@ -25178,8 +25178,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25178
25178
|
getWorksheetConfig() {
|
|
25179
25179
|
return this._worksheetData;
|
|
25180
25180
|
}
|
|
25181
|
-
|
|
25182
|
-
return this.
|
|
25181
|
+
getRangeByViewBound(bound) {
|
|
25182
|
+
return this._getRangeByViewBounding(this._rowHeightAccumulation, this._columnWidthAccumulation, bound);
|
|
25183
25183
|
}
|
|
25184
25184
|
getMergeBounding(startRow, startColumn, endRow, endColumn) {
|
|
25185
25185
|
const mergeData = this._worksheetData.mergeData;
|
|
@@ -25280,21 +25280,6 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25280
25280
|
endX
|
|
25281
25281
|
};
|
|
25282
25282
|
}
|
|
25283
|
-
/**
|
|
25284
|
-
* Get cell by pos(offsetX, offsetY).
|
|
25285
|
-
* @param offsetX HTML coordinate system, mouse position x.
|
|
25286
|
-
* @param offsetY HTML coordinate system, mouse position y.
|
|
25287
|
-
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
25288
|
-
* @param scaleY render scene scale y-axis, scene.getAncestorScale
|
|
25289
|
-
* @param scrollXY render viewport scroll {x, y}, scene.getScrollXYByRelativeCoords, scene.getScrollXY
|
|
25290
|
-
* @param scrollXY.x
|
|
25291
|
-
* @param scrollXY.y
|
|
25292
|
-
* @returns Selection data with coordinates
|
|
25293
|
-
*/
|
|
25294
|
-
calculateCellIndexByPosition(offsetX, offsetY, scaleX, scaleY, scrollXY) {
|
|
25295
|
-
const { row, column } = this.getCellPositionByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY);
|
|
25296
|
-
return this.getCellByIndex(row, column);
|
|
25297
|
-
}
|
|
25298
25283
|
/**
|
|
25299
25284
|
*
|
|
25300
25285
|
* @param offsetX HTML coordinate system, mouse position x.
|
|
@@ -25306,41 +25291,40 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25306
25291
|
* @param scrollXY.y
|
|
25307
25292
|
* @returns Hit cell coordinates
|
|
25308
25293
|
*/
|
|
25309
|
-
getCellPositionByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY,
|
|
25310
|
-
const row = this.getRowPositionByOffsetY(offsetY, scaleY, scrollXY,
|
|
25294
|
+
getCellPositionByOffset(offsetX, offsetY, scaleX, scaleY, scrollXY, options) {
|
|
25295
|
+
const row = this.getRowPositionByOffsetY(offsetY, scaleY, scrollXY, options), column = this.getColumnPositionByOffsetX(offsetX, scaleX, scrollXY, options);
|
|
25311
25296
|
return {
|
|
25312
25297
|
row,
|
|
25313
25298
|
column
|
|
25314
25299
|
};
|
|
25315
25300
|
}
|
|
25316
25301
|
/**
|
|
25317
|
-
*
|
|
25318
|
-
* @param offsetX scaled offset x
|
|
25302
|
+
* Get column index by offsetX
|
|
25303
|
+
* @param offsetX no scaled offset x
|
|
25319
25304
|
* @param scaleX scale x
|
|
25320
25305
|
* @param scrollXY
|
|
25321
|
-
* @returns
|
|
25322
25306
|
*/
|
|
25323
|
-
getColumnPositionByOffsetX(offsetX, scaleX, scrollXY,
|
|
25307
|
+
getColumnPositionByOffsetX(offsetX, scaleX, scrollXY, options) {
|
|
25324
25308
|
var _a10;
|
|
25325
25309
|
offsetX = this.getTransformOffsetX(offsetX, scaleX, scrollXY);
|
|
25326
25310
|
const { columnWidthAccumulation } = this;
|
|
25327
25311
|
let column = searchArray(columnWidthAccumulation, offsetX);
|
|
25328
|
-
return
|
|
25312
|
+
return options != null && options.closeFirst && Math.abs(columnWidthAccumulation[column] - offsetX) < Math.abs(offsetX - ((_a10 = columnWidthAccumulation[column - 1]) != null ? _a10 : 0)) && (column = column + 1), column;
|
|
25329
25313
|
}
|
|
25330
25314
|
/**
|
|
25331
|
-
*
|
|
25315
|
+
* Get row index by offsetY
|
|
25332
25316
|
* @param offsetY scaled offset y
|
|
25333
25317
|
* @param scaleY scale y
|
|
25334
25318
|
* @param scrollXY
|
|
25335
25319
|
* @param scrollXY.x
|
|
25336
25320
|
* @param scrollXY.y
|
|
25337
25321
|
*/
|
|
25338
|
-
getRowPositionByOffsetY(offsetY, scaleY, scrollXY,
|
|
25322
|
+
getRowPositionByOffsetY(offsetY, scaleY, scrollXY, options) {
|
|
25339
25323
|
var _a10;
|
|
25340
25324
|
const { rowHeightAccumulation } = this;
|
|
25341
25325
|
offsetY = this.getTransformOffsetY(offsetY, scaleY, scrollXY);
|
|
25342
|
-
let row = searchArray(rowHeightAccumulation, offsetY);
|
|
25343
|
-
return
|
|
25326
|
+
let row = searchArray(rowHeightAccumulation, offsetY, options == null ? void 0 : options.visibleOnly);
|
|
25327
|
+
return options != null && options.closeFirst && Math.abs(rowHeightAccumulation[row] - offsetY) < Math.abs(offsetY - ((_a10 = rowHeightAccumulation[row - 1]) != null ? _a10 : 0)) && (row = row + 1), row;
|
|
25344
25328
|
}
|
|
25345
25329
|
getTransformOffsetX(offsetX, scaleX, scrollXY) {
|
|
25346
25330
|
const { x: scrollX } = scrollXY;
|
|
@@ -25512,10 +25496,12 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25512
25496
|
};
|
|
25513
25497
|
}
|
|
25514
25498
|
getDecomposedOffset(offsetX, offsetY) {
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
|
|
25518
|
-
|
|
25499
|
+
const column = searchArray(this._columnWidthAccumulation, offsetX);
|
|
25500
|
+
let columnOffset = 0;
|
|
25501
|
+
column === 0 ? columnOffset = offsetX : columnOffset = offsetX - this._columnWidthAccumulation[column - 1];
|
|
25502
|
+
const row = searchArray(this._rowHeightAccumulation, offsetY);
|
|
25503
|
+
let rowOffset = 0;
|
|
25504
|
+
return row === 0 ? rowOffset = offsetY : rowOffset = offsetY - this._rowHeightAccumulation[row - 1], {
|
|
25519
25505
|
row,
|
|
25520
25506
|
column,
|
|
25521
25507
|
columnOffset,
|
|
@@ -25582,30 +25568,27 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25582
25568
|
return !1;
|
|
25583
25569
|
}
|
|
25584
25570
|
/**
|
|
25585
|
-
*
|
|
25571
|
+
* Get the range of the bounding area of the canvas.
|
|
25586
25572
|
* @param rowHeightAccumulation Row layout information
|
|
25587
25573
|
* @param columnWidthAccumulation Column layout information
|
|
25588
25574
|
* @param viewBound The range of the visible area of the canvas
|
|
25589
25575
|
* @returns The range cell index of the canvas visible area
|
|
25590
25576
|
*/
|
|
25591
|
-
|
|
25592
|
-
const
|
|
25577
|
+
_getRangeByViewBounding(rowHeightAccumulation, columnWidthAccumulation, viewBound) {
|
|
25578
|
+
const lenOfRowData = rowHeightAccumulation.length, lenOfColData = columnWidthAccumulation.length;
|
|
25593
25579
|
if (!viewBound)
|
|
25594
25580
|
return {
|
|
25595
25581
|
startRow: 0,
|
|
25596
|
-
endRow:
|
|
25582
|
+
endRow: lenOfRowData - 1,
|
|
25597
25583
|
startColumn: 0,
|
|
25598
|
-
endColumn:
|
|
25584
|
+
endColumn: lenOfColData - 1
|
|
25599
25585
|
};
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25604
|
-
|
|
25605
|
-
|
|
25606
|
-
endRow: dataset_row_ed,
|
|
25607
|
-
startColumn: dataset_col_st,
|
|
25608
|
-
endColumn: dataset_col_ed
|
|
25586
|
+
const startRow = searchArray(rowHeightAccumulation, Math.round(viewBound.top) - this.columnHeaderHeightAndMarginTop), endRow = searchArray(rowHeightAccumulation, Math.round(viewBound.bottom) - this.columnHeaderHeightAndMarginTop), startColumn = searchArray(columnWidthAccumulation, Math.round(viewBound.left) - this.rowHeaderWidthAndMarginLeft), endColumn = searchArray(columnWidthAccumulation, Math.round(viewBound.right) - this.rowHeaderWidthAndMarginLeft);
|
|
25587
|
+
return {
|
|
25588
|
+
startRow,
|
|
25589
|
+
endRow,
|
|
25590
|
+
startColumn,
|
|
25591
|
+
endColumn
|
|
25609
25592
|
};
|
|
25610
25593
|
}
|
|
25611
25594
|
_generateRowMatrixCache(rowCount, rowData, defaultRowHeight) {
|
|
@@ -28728,7 +28711,7 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28728
28711
|
if (!spreadsheetSkeleton)
|
|
28729
28712
|
return;
|
|
28730
28713
|
this._drawAuxiliary(ctx);
|
|
28731
|
-
const parentScale = this.getParentScale(), diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_a10 = viewportInfo.diffBounds) == null ? void 0 : _a10.map((bound) => spreadsheetSkeleton.
|
|
28714
|
+
const parentScale = this.getParentScale(), diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_a10 = viewportInfo.diffBounds) == null ? void 0 : _a10.map((bound) => spreadsheetSkeleton.getRangeByViewBound(bound)) : [], viewRanges = [spreadsheetSkeleton.getRangeByViewBound(viewportInfo.cacheBound)], extensions = this.getExtensionsByOrder(), scene = this.getScene();
|
|
28732
28715
|
for (const extension of extensions) {
|
|
28733
28716
|
const timeKey = `${SHEET_EXTENSION_PREFIX}${extension.uKey}`, st = Tools.now();
|
|
28734
28717
|
extension.draw(ctx, parentScale, spreadsheetSkeleton, diffRanges, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BreakPointType } from '../../line-breaker/break';
|
|
2
1
|
import { IDocumentSkeletonDrawing, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage } from '../../../../../basics/i-document-skeleton-cached';
|
|
3
2
|
import { IParagraphConfig, ISectionBreakConfig } from '../../../../../basics/interfaces';
|
|
4
3
|
import { ILayoutContext } from '../../tools';
|
|
4
|
+
import { BreakPointType } from '../../line-breaker/break';
|
|
5
5
|
export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType): IDocumentSkeletonPage[];
|
|
6
6
|
export declare function updateInlineDrawingPosition(line: IDocumentSkeletonLine, paragraphInlineSkeDrawings?: Map<string, IDocumentSkeletonDrawing>, blockAnchorTop?: number): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BreakPointType } from '../../line-breaker/break';
|
|
2
1
|
import { IDocumentSkeletonGlyph } from '../../../../../basics/i-document-skeleton-cached';
|
|
3
2
|
import { ISectionBreakConfig } from '../../../../../basics/interfaces';
|
|
4
3
|
import { DataStreamTreeNode } from '../../../view-model/data-stream-tree-node';
|
|
5
4
|
import { DocumentViewModel } from '../../../view-model/document-view-model';
|
|
6
5
|
import { ILayoutContext } from '../../tools';
|
|
6
|
+
import { BreakPointType } from '../../line-breaker/break';
|
|
7
7
|
export interface IShapedText {
|
|
8
8
|
text: string;
|
|
9
9
|
glyphs: IDocumentSkeletonGlyph[];
|
|
@@ -32,6 +32,10 @@ export interface ICacheItem {
|
|
|
32
32
|
bg: boolean;
|
|
33
33
|
border: boolean;
|
|
34
34
|
}
|
|
35
|
+
export interface IGetRowColByPosOptions {
|
|
36
|
+
closeFirst?: boolean;
|
|
37
|
+
visibleOnly?: boolean;
|
|
38
|
+
}
|
|
35
39
|
export declare class SpreadsheetSkeleton extends Skeleton {
|
|
36
40
|
readonly worksheet: Worksheet;
|
|
37
41
|
/**
|
|
@@ -146,13 +150,13 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
146
150
|
*/
|
|
147
151
|
private _updateLayout;
|
|
148
152
|
private _dynamicallyUpdateRowHeaderWidth;
|
|
149
|
-
|
|
153
|
+
getRangeByBounding(bounds?: IViewportInfo): IRange;
|
|
150
154
|
/**
|
|
151
155
|
* @deprecated should never expose a property that is provided by another module!
|
|
152
156
|
* @returns
|
|
153
157
|
*/
|
|
154
158
|
getWorksheetConfig(): IWorksheetData;
|
|
155
|
-
|
|
159
|
+
getRangeByViewBound(bound?: IBoundRectNoAngle): IRange;
|
|
156
160
|
getMergeBounding(startRow: number, startColumn: number, endRow: number, endColumn: number): IRange;
|
|
157
161
|
appendToOverflowCache(row: number, column: number, startColumn: number, endColumn: number): void;
|
|
158
162
|
getColumnCount(): number;
|
|
@@ -160,21 +164,6 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
160
164
|
getOverflowPosition(contentSize: Required<ISize>, horizontalAlign: HorizontalAlign, row: number, column: number, columnCount: number): IColumnRange;
|
|
161
165
|
getNoMergeCellPositionByIndex(rowIndex: number, columnIndex: number): IPosition;
|
|
162
166
|
getNoMergeCellPositionByIndexWithNoHeader(rowIndex: number, columnIndex: number): IPosition;
|
|
163
|
-
/**
|
|
164
|
-
* Get cell by pos(offsetX, offsetY).
|
|
165
|
-
* @param offsetX HTML coordinate system, mouse position x.
|
|
166
|
-
* @param offsetY HTML coordinate system, mouse position y.
|
|
167
|
-
* @param scaleX render scene scale x-axis, scene.getAncestorScale
|
|
168
|
-
* @param scaleY render scene scale y-axis, scene.getAncestorScale
|
|
169
|
-
* @param scrollXY render viewport scroll {x, y}, scene.getScrollXYByRelativeCoords, scene.getScrollXY
|
|
170
|
-
* @param scrollXY.x
|
|
171
|
-
* @param scrollXY.y
|
|
172
|
-
* @returns Selection data with coordinates
|
|
173
|
-
*/
|
|
174
|
-
calculateCellIndexByPosition(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
175
|
-
x: number;
|
|
176
|
-
y: number;
|
|
177
|
-
}): Nullable<ISelectionCellWithMergeInfo>;
|
|
178
167
|
/**
|
|
179
168
|
*
|
|
180
169
|
* @param offsetX HTML coordinate system, mouse position x.
|
|
@@ -189,23 +178,22 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
189
178
|
getCellPositionByOffset(offsetX: number, offsetY: number, scaleX: number, scaleY: number, scrollXY: {
|
|
190
179
|
x: number;
|
|
191
180
|
y: number;
|
|
192
|
-
},
|
|
181
|
+
}, options?: IGetRowColByPosOptions): {
|
|
193
182
|
row: number;
|
|
194
183
|
column: number;
|
|
195
184
|
};
|
|
196
185
|
/**
|
|
197
|
-
*
|
|
198
|
-
* @param offsetX scaled offset x
|
|
186
|
+
* Get column index by offsetX
|
|
187
|
+
* @param offsetX no scaled offset x
|
|
199
188
|
* @param scaleX scale x
|
|
200
189
|
* @param scrollXY
|
|
201
|
-
* @returns
|
|
202
190
|
*/
|
|
203
191
|
getColumnPositionByOffsetX(offsetX: number, scaleX: number, scrollXY: {
|
|
204
192
|
x: number;
|
|
205
193
|
y: number;
|
|
206
|
-
},
|
|
194
|
+
}, options?: IGetRowColByPosOptions): number;
|
|
207
195
|
/**
|
|
208
|
-
*
|
|
196
|
+
* Get row index by offsetY
|
|
209
197
|
* @param offsetY scaled offset y
|
|
210
198
|
* @param scaleY scale y
|
|
211
199
|
* @param scrollXY
|
|
@@ -215,7 +203,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
215
203
|
getRowPositionByOffsetY(offsetY: number, scaleY: number, scrollXY: {
|
|
216
204
|
x: number;
|
|
217
205
|
y: number;
|
|
218
|
-
},
|
|
206
|
+
}, options?: IGetRowColByPosOptions): number;
|
|
219
207
|
getTransformOffsetX(offsetX: number, scaleX: number, scrollXY: {
|
|
220
208
|
x: number;
|
|
221
209
|
y: number;
|
|
@@ -271,13 +259,13 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
271
259
|
*/
|
|
272
260
|
private _calculateOverflowCell;
|
|
273
261
|
/**
|
|
274
|
-
*
|
|
262
|
+
* Get the range of the bounding area of the canvas.
|
|
275
263
|
* @param rowHeightAccumulation Row layout information
|
|
276
264
|
* @param columnWidthAccumulation Column layout information
|
|
277
265
|
* @param viewBound The range of the visible area of the canvas
|
|
278
266
|
* @returns The range cell index of the canvas visible area
|
|
279
267
|
*/
|
|
280
|
-
protected
|
|
268
|
+
protected _getRangeByViewBounding(rowHeightAccumulation: number[], columnWidthAccumulation: number[], viewBound?: IBoundRectNoAngle): IRange;
|
|
281
269
|
private _generateRowMatrixCache;
|
|
282
270
|
/**
|
|
283
271
|
* Calc columnWidthAccumulation by columnData
|