@univerjs/engine-render 0.22.0 → 0.22.1-insiders.20260516-8900c44
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 +225 -201
- package/lib/es/index.js +225 -201
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
- package/LICENSE +0 -176
package/lib/cjs/index.js
CHANGED
|
@@ -5474,36 +5474,38 @@ var Custom = class extends SheetExtension {
|
|
|
5474
5474
|
if (!worksheet) return;
|
|
5475
5475
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
5476
5476
|
const subUnitId = worksheet.getSheetId();
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5477
|
+
((diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment]).forEach((range) => {
|
|
5478
|
+
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
5479
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
5480
|
+
let primaryWithCoord = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
5481
|
+
const { mergeInfo } = primaryWithCoord;
|
|
5482
|
+
let cellData = worksheet.getCell(row, col);
|
|
5483
|
+
if (primaryWithCoord.isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
|
|
5484
|
+
if (!(cellData === null || cellData === void 0 ? void 0 : cellData.customRender)) return;
|
|
5485
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) return true;
|
|
5486
|
+
if (primaryWithCoord.isMerged || primaryWithCoord.isMergedMainCell) {
|
|
5487
|
+
const rangeStr = stringifyRange$1(mergeInfo);
|
|
5488
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
5489
|
+
mergeCellRendered.add(rangeStr);
|
|
5490
|
+
}
|
|
5491
|
+
if (primaryWithCoord.isMerged) primaryWithCoord = skeleton.getCellWithCoordByIndex(mergeInfo.startRow, mergeInfo.startColumn, false);
|
|
5492
|
+
const renderInfo = {
|
|
5493
|
+
data: cellData,
|
|
5494
|
+
style: skeleton.getStyles().getStyleByCell(cellData),
|
|
5495
|
+
primaryWithCoord,
|
|
5496
|
+
subUnitId,
|
|
5497
|
+
row,
|
|
5498
|
+
col,
|
|
5499
|
+
worksheet,
|
|
5500
|
+
unitId: worksheet.unitId
|
|
5501
|
+
};
|
|
5502
|
+
const customRender = cellData.customRender.sort(_univerjs_core.sortRules);
|
|
5503
|
+
ctx.save();
|
|
5504
|
+
customRender.forEach((item) => {
|
|
5505
|
+
item.drawWith(ctx, renderInfo, skeleton, this.parent);
|
|
5506
|
+
});
|
|
5507
|
+
ctx.restore();
|
|
5505
5508
|
});
|
|
5506
|
-
ctx.restore();
|
|
5507
5509
|
});
|
|
5508
5510
|
}
|
|
5509
5511
|
};
|
|
@@ -17294,54 +17296,58 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
17294
17296
|
* @param vpInfo viewBounds
|
|
17295
17297
|
*/
|
|
17296
17298
|
setStylesCache(vpInfo) {
|
|
17299
|
+
var _vpInfo$diffBounds, _vpInfo$diffCacheBoun, _vpInfo$diffCacheBoun2, _vpInfo$diffCacheBoun3;
|
|
17297
17300
|
if (!this._worksheetData) return;
|
|
17298
17301
|
if (!this.rowHeightAccumulation || !this.columnWidthAccumulation) return;
|
|
17299
17302
|
this.updateVisibleRange(vpInfo);
|
|
17300
17303
|
const rowColumnSegment = this._drawingRange;
|
|
17301
17304
|
const columnWidthAccumulation = this.columnWidthAccumulation;
|
|
17302
|
-
const
|
|
17303
|
-
|
|
17304
|
-
|
|
17305
|
-
|
|
17306
|
-
|
|
17307
|
-
|
|
17308
|
-
|
|
17309
|
-
|
|
17310
|
-
|
|
17305
|
+
const styleRanges = !!vpInfo && !vpInfo.isDirty && !vpInfo.isForceDirty && (!!((_vpInfo$diffBounds = vpInfo.diffBounds) === null || _vpInfo$diffBounds === void 0 ? void 0 : _vpInfo$diffBounds.length) || !!((_vpInfo$diffCacheBoun = vpInfo.diffCacheBounds) === null || _vpInfo$diffCacheBoun === void 0 ? void 0 : _vpInfo$diffCacheBoun.length) || !!vpInfo.diffX || !!vpInfo.diffY) ? vpInfo.shouldCacheUpdate ? (_vpInfo$diffCacheBoun2 = (_vpInfo$diffCacheBoun3 = vpInfo.diffCacheBounds) === null || _vpInfo$diffCacheBoun3 === void 0 ? void 0 : _vpInfo$diffCacheBoun3.map((bound) => this.getRangeByViewBound(bound))) !== null && _vpInfo$diffCacheBoun2 !== void 0 ? _vpInfo$diffCacheBoun2 : [] : [] : [rowColumnSegment];
|
|
17306
|
+
for (const styleRange of styleRanges) {
|
|
17307
|
+
const { startRow: visibleStartRow, endRow: visibleEndRow, startColumn: visibleStartColumn, endColumn: visibleEndColumn } = styleRange;
|
|
17308
|
+
if (visibleEndColumn === -1 || visibleEndRow === -1) continue;
|
|
17309
|
+
const mergeVisibleRanges = [];
|
|
17310
|
+
let mergeVisibleRangeStartRow = visibleStartRow;
|
|
17311
|
+
const expandStartCol = Math.max(0, visibleStartColumn - 20);
|
|
17312
|
+
const expandEndCol = Math.min(columnWidthAccumulation.length - 1, visibleEndColumn + 20);
|
|
17313
|
+
for (let r = visibleStartRow; r <= visibleEndRow; r++) {
|
|
17314
|
+
if (this.worksheet.getRowVisible(r) === false) {
|
|
17315
|
+
if (mergeVisibleRangeStartRow < r) mergeVisibleRanges.push({
|
|
17316
|
+
startRow: mergeVisibleRangeStartRow,
|
|
17317
|
+
endRow: r - 1,
|
|
17318
|
+
startColumn: visibleStartColumn,
|
|
17319
|
+
endColumn: visibleEndColumn
|
|
17320
|
+
});
|
|
17321
|
+
mergeVisibleRangeStartRow = r + 1;
|
|
17322
|
+
continue;
|
|
17323
|
+
}
|
|
17324
|
+
if (r === visibleEndRow) mergeVisibleRanges.push({
|
|
17311
17325
|
startRow: mergeVisibleRangeStartRow,
|
|
17312
|
-
endRow: r
|
|
17326
|
+
endRow: r,
|
|
17313
17327
|
startColumn: visibleStartColumn,
|
|
17314
17328
|
endColumn: visibleEndColumn
|
|
17315
17329
|
});
|
|
17316
|
-
|
|
17317
|
-
|
|
17330
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17331
|
+
bg: true,
|
|
17332
|
+
border: true
|
|
17333
|
+
} });
|
|
17334
|
+
for (let c = expandStartCol; c < visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17335
|
+
bg: false,
|
|
17336
|
+
border: false
|
|
17337
|
+
} });
|
|
17338
|
+
if (visibleEndColumn === 0) continue;
|
|
17339
|
+
for (let c = visibleEndColumn + 1; c < expandEndCol; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17340
|
+
bg: false,
|
|
17341
|
+
border: false
|
|
17342
|
+
} });
|
|
17318
17343
|
}
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
});
|
|
17325
|
-
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17326
|
-
bg: true,
|
|
17327
|
-
border: true
|
|
17328
|
-
} });
|
|
17329
|
-
for (let c = expandStartCol; c < visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17330
|
-
bg: false,
|
|
17331
|
-
border: false
|
|
17332
|
-
} });
|
|
17333
|
-
if (visibleEndColumn === 0) continue;
|
|
17334
|
-
for (let c = visibleEndColumn + 1; c < expandEndCol; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17335
|
-
bg: false,
|
|
17336
|
-
border: false
|
|
17337
|
-
} });
|
|
17338
|
-
}
|
|
17339
|
-
const mergeRanges = [];
|
|
17340
|
-
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
17341
|
-
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
17342
|
-
mergeRanges.push(...mergeRangeInVisible);
|
|
17344
|
+
const mergeRanges = [];
|
|
17345
|
+
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
17346
|
+
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
17347
|
+
mergeRanges.push(...mergeRangeInVisible);
|
|
17348
|
+
}
|
|
17349
|
+
for (const mergeRange of mergeRanges) this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, { mergeRange });
|
|
17343
17350
|
}
|
|
17344
|
-
for (const mergeRange of mergeRanges) this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, { mergeRange });
|
|
17345
17351
|
return this;
|
|
17346
17352
|
}
|
|
17347
17353
|
/**
|
|
@@ -18308,12 +18314,19 @@ var Font = class extends SheetExtension {
|
|
|
18308
18314
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0 || !worksheet) return;
|
|
18309
18315
|
const scale = this._getScale(parentScale);
|
|
18310
18316
|
const { viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
18317
|
+
const lastRowIndex = spreadsheetSkeleton.getRowCount() - 1;
|
|
18318
|
+
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
18319
|
+
const expandedViewRanges = viewRanges.map((range) => clampRange({
|
|
18320
|
+
...range,
|
|
18321
|
+
startColumn: range.startColumn - 20,
|
|
18322
|
+
endColumn: range.endColumn + 20
|
|
18323
|
+
}, lastRowIndex, lastColIndex));
|
|
18311
18324
|
const renderFontContext = {
|
|
18312
18325
|
ctx,
|
|
18313
18326
|
scale,
|
|
18314
18327
|
columnTotalWidth,
|
|
18315
18328
|
rowTotalHeight,
|
|
18316
|
-
viewRanges,
|
|
18329
|
+
viewRanges: expandedViewRanges,
|
|
18317
18330
|
checkOutOfViewBound: checkOutOfViewBound || true,
|
|
18318
18331
|
diffRanges,
|
|
18319
18332
|
spreadsheetSkeleton
|
|
@@ -18321,12 +18334,7 @@ var Font = class extends SheetExtension {
|
|
|
18321
18334
|
ctx.save();
|
|
18322
18335
|
const uniqueMergeRanges = [];
|
|
18323
18336
|
const mergeRangeIDSet = /* @__PURE__ */ new Set();
|
|
18324
|
-
|
|
18325
|
-
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
18326
|
-
viewRanges.forEach((range) => {
|
|
18327
|
-
range.startColumn -= 20;
|
|
18328
|
-
range.endColumn += 20;
|
|
18329
|
-
range = clampRange(range, lastRowIndex, lastColIndex);
|
|
18337
|
+
expandedViewRanges.forEach((range) => {
|
|
18330
18338
|
spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn).forEach((mergeRange) => {
|
|
18331
18339
|
const mergeRangeIndex = spreadsheetSkeleton.worksheet.getSpanModel().getMergeDataIndex(mergeRange.startRow, mergeRange.startColumn);
|
|
18332
18340
|
if (!mergeRangeIDSet.has(mergeRangeIndex)) {
|
|
@@ -18420,40 +18428,24 @@ var Font = class extends SheetExtension {
|
|
|
18420
18428
|
return false;
|
|
18421
18429
|
}
|
|
18422
18430
|
_renderImages(ctx, fontsConfig, startX, startY, endX, endY) {
|
|
18423
|
-
var _getSkeletonData;
|
|
18431
|
+
var _fontsConfig$style, _padding$l, _padding$r, _padding$t, _padding$b, _getSkeletonData;
|
|
18424
18432
|
const { documentSkeleton, verticalAlign, horizontalAlign } = fontsConfig;
|
|
18425
|
-
const fontHeight = documentSkeleton.getSkeletonData().pages[0].height;
|
|
18426
|
-
const fontWidth = documentSkeleton.getSkeletonData().pages[0].width;
|
|
18427
18433
|
const PADDING = 2;
|
|
18428
|
-
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18436
|
-
|
|
18437
|
-
default:
|
|
18438
|
-
fontY = endY - fontHeight - PADDING;
|
|
18439
|
-
break;
|
|
18440
|
-
}
|
|
18441
|
-
switch (horizontalAlign) {
|
|
18442
|
-
case _univerjs_core.HorizontalAlign.RIGHT:
|
|
18443
|
-
fontX = endX - fontWidth - PADDING;
|
|
18444
|
-
break;
|
|
18445
|
-
case _univerjs_core.HorizontalAlign.CENTER:
|
|
18446
|
-
fontX = (startX + endX) / 2 - fontWidth / 2;
|
|
18447
|
-
break;
|
|
18448
|
-
default:
|
|
18449
|
-
fontX = startX + PADDING;
|
|
18450
|
-
break;
|
|
18451
|
-
}
|
|
18434
|
+
const padding = (_fontsConfig$style = fontsConfig.style) === null || _fontsConfig$style === void 0 ? void 0 : _fontsConfig$style.pd;
|
|
18435
|
+
const paddingLeft = (_padding$l = padding === null || padding === void 0 ? void 0 : padding.l) !== null && _padding$l !== void 0 ? _padding$l : PADDING;
|
|
18436
|
+
const paddingRight = (_padding$r = padding === null || padding === void 0 ? void 0 : padding.r) !== null && _padding$r !== void 0 ? _padding$r : PADDING;
|
|
18437
|
+
const paddingTop = (_padding$t = padding === null || padding === void 0 ? void 0 : padding.t) !== null && _padding$t !== void 0 ? _padding$t : PADDING;
|
|
18438
|
+
const paddingBottom = (_padding$b = padding === null || padding === void 0 ? void 0 : padding.b) !== null && _padding$b !== void 0 ? _padding$b : PADDING;
|
|
18439
|
+
const contentStartX = startX + paddingLeft;
|
|
18440
|
+
const contentEndX = endX - paddingRight;
|
|
18441
|
+
const contentStartY = startY + paddingTop;
|
|
18442
|
+
const contentEndY = endY - paddingBottom;
|
|
18452
18443
|
const drawingDatas = documentSkeleton.getViewModel().getDataModel().getDrawings();
|
|
18453
18444
|
const drawings = (_getSkeletonData = documentSkeleton.getSkeletonData()) === null || _getSkeletonData === void 0 ? void 0 : _getSkeletonData.pages[0].skeDrawings;
|
|
18454
18445
|
drawings === null || drawings === void 0 || drawings.forEach((drawing) => {
|
|
18455
18446
|
const drawingData = drawingDatas === null || drawingDatas === void 0 ? void 0 : drawingDatas[drawing.drawingId];
|
|
18456
18447
|
if (drawingData) {
|
|
18448
|
+
var _drawingData$docTrans, _drawingData$docTrans2, _drawingData$docTrans3, _drawingData$docTrans4, _drawingData$docTrans5, _drawingData$docTrans6;
|
|
18457
18449
|
const image = fontsConfig.imageCacheMap.getImage(drawingData.imageSourceType, drawingData.source, () => {
|
|
18458
18450
|
var _this$parent;
|
|
18459
18451
|
(_this$parent = this.parent) === null || _this$parent === void 0 || _this$parent.makeDirty();
|
|
@@ -18461,11 +18453,33 @@ var Font = class extends SheetExtension {
|
|
|
18461
18453
|
var _this$parent2;
|
|
18462
18454
|
(_this$parent2 = this.parent) === null || _this$parent2 === void 0 || _this$parent2.makeDirty();
|
|
18463
18455
|
});
|
|
18464
|
-
const
|
|
18465
|
-
const
|
|
18466
|
-
const
|
|
18467
|
-
|
|
18468
|
-
|
|
18456
|
+
const width = (_drawingData$docTrans = (_drawingData$docTrans2 = drawingData.docTransform) === null || _drawingData$docTrans2 === void 0 ? void 0 : _drawingData$docTrans2.size.width) !== null && _drawingData$docTrans !== void 0 ? _drawingData$docTrans : drawing.width;
|
|
18457
|
+
const height = (_drawingData$docTrans3 = (_drawingData$docTrans4 = drawingData.docTransform) === null || _drawingData$docTrans4 === void 0 ? void 0 : _drawingData$docTrans4.size.height) !== null && _drawingData$docTrans3 !== void 0 ? _drawingData$docTrans3 : drawing.height;
|
|
18458
|
+
const angle = (_drawingData$docTrans5 = (_drawingData$docTrans6 = drawingData.docTransform) === null || _drawingData$docTrans6 === void 0 ? void 0 : _drawingData$docTrans6.angle) !== null && _drawingData$docTrans5 !== void 0 ? _drawingData$docTrans5 : drawing.angle;
|
|
18459
|
+
let x = startX;
|
|
18460
|
+
let y = startY;
|
|
18461
|
+
switch (verticalAlign) {
|
|
18462
|
+
case _univerjs_core.VerticalAlign.TOP:
|
|
18463
|
+
y = contentStartY;
|
|
18464
|
+
break;
|
|
18465
|
+
case _univerjs_core.VerticalAlign.MIDDLE:
|
|
18466
|
+
y = (contentStartY + contentEndY) / 2 - height / 2;
|
|
18467
|
+
break;
|
|
18468
|
+
default:
|
|
18469
|
+
y = contentEndY - height;
|
|
18470
|
+
break;
|
|
18471
|
+
}
|
|
18472
|
+
switch (horizontalAlign) {
|
|
18473
|
+
case _univerjs_core.HorizontalAlign.RIGHT:
|
|
18474
|
+
x = contentEndX - width;
|
|
18475
|
+
break;
|
|
18476
|
+
case _univerjs_core.HorizontalAlign.CENTER:
|
|
18477
|
+
x = (contentStartX + contentEndX) / 2 - width / 2;
|
|
18478
|
+
break;
|
|
18479
|
+
default:
|
|
18480
|
+
x = contentStartX;
|
|
18481
|
+
break;
|
|
18482
|
+
}
|
|
18469
18483
|
const { rotatedHeight, rotatedWidth } = rotatedBoundingBox(width, height, angle);
|
|
18470
18484
|
if (image && image.complete) {
|
|
18471
18485
|
const angleRadians = angle * Math.PI / 180;
|
|
@@ -18533,14 +18547,14 @@ var Font = class extends SheetExtension {
|
|
|
18533
18547
|
renderFontContext.endY = endY;
|
|
18534
18548
|
}
|
|
18535
18549
|
_renderText(ctx, row, col, renderFontCtx, overflowCache) {
|
|
18536
|
-
var _fontCache$style$pd, _fontCache$style, _padding$
|
|
18550
|
+
var _fontCache$style$pd, _fontCache$style, _padding$l2, _padding$r2, _padding$t2, _padding$b2, _fontCache$style2, _fontCache$style3, _fontCache$style4, _fontCache$style5;
|
|
18537
18551
|
const { fontCache } = renderFontCtx;
|
|
18538
18552
|
if (!fontCache) return;
|
|
18539
18553
|
const padding = (_fontCache$style$pd = (_fontCache$style = fontCache.style) === null || _fontCache$style === void 0 ? void 0 : _fontCache$style.pd) !== null && _fontCache$style$pd !== void 0 ? _fontCache$style$pd : DEFAULT_PADDING_DATA;
|
|
18540
|
-
const paddingLeft = (_padding$
|
|
18541
|
-
const paddingRight = (_padding$
|
|
18542
|
-
const paddingTop = (_padding$
|
|
18543
|
-
const paddingBottom = (_padding$
|
|
18554
|
+
const paddingLeft = (_padding$l2 = padding.l) !== null && _padding$l2 !== void 0 ? _padding$l2 : DEFAULT_PADDING_DATA.l;
|
|
18555
|
+
const paddingRight = (_padding$r2 = padding.r) !== null && _padding$r2 !== void 0 ? _padding$r2 : DEFAULT_PADDING_DATA.r;
|
|
18556
|
+
const paddingTop = (_padding$t2 = padding.t) !== null && _padding$t2 !== void 0 ? _padding$t2 : DEFAULT_PADDING_DATA.t;
|
|
18557
|
+
const paddingBottom = (_padding$b2 = padding.b) !== null && _padding$b2 !== void 0 ? _padding$b2 : DEFAULT_PADDING_DATA.b;
|
|
18544
18558
|
const { vertexAngle = 0, wrapStrategy, cellData } = fontCache;
|
|
18545
18559
|
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return;
|
|
18546
18560
|
const text = (0, _univerjs_core.getDisplayValueFromCell)(cellData);
|
|
@@ -18648,93 +18662,95 @@ var Marker = class extends SheetExtension {
|
|
|
18648
18662
|
const { worksheet, rowColumnSegment } = skeleton;
|
|
18649
18663
|
if (!worksheet) return;
|
|
18650
18664
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
|
|
18737
|
-
|
|
18665
|
+
((diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment]).forEach((range) => {
|
|
18666
|
+
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
18667
|
+
var _cellData$markers, _cellData$markers2, _cellData$markers3, _cellData$markers4;
|
|
18668
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
18669
|
+
let cellData = worksheet.getCell(row, col);
|
|
18670
|
+
const cellInfo = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
18671
|
+
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
18672
|
+
let { startY, endY, startX, endX } = cellInfo;
|
|
18673
|
+
if (isMergedMainCell || isMerged) {
|
|
18674
|
+
startY = mergeInfo.startY;
|
|
18675
|
+
endY = mergeInfo.endY;
|
|
18676
|
+
startX = mergeInfo.startX;
|
|
18677
|
+
endX = mergeInfo.endX;
|
|
18678
|
+
}
|
|
18679
|
+
if (isMerged) {
|
|
18680
|
+
const mainCell = {
|
|
18681
|
+
row: mergeInfo.startRow,
|
|
18682
|
+
col: mergeInfo.startColumn
|
|
18683
|
+
};
|
|
18684
|
+
cellData = worksheet.getCell(mainCell.row, mainCell.col);
|
|
18685
|
+
}
|
|
18686
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) return true;
|
|
18687
|
+
if (cellInfo.isMerged || cellInfo.isMergedMainCell) {
|
|
18688
|
+
const rangeStr = stringifyRange(mergeInfo);
|
|
18689
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
18690
|
+
mergeCellRendered.add(rangeStr);
|
|
18691
|
+
}
|
|
18692
|
+
if (!cellData) return;
|
|
18693
|
+
if ((_cellData$markers = cellData.markers) === null || _cellData$markers === void 0 ? void 0 : _cellData$markers.tr) {
|
|
18694
|
+
ctx.save();
|
|
18695
|
+
const marker = cellData.markers.tr;
|
|
18696
|
+
const x = endX;
|
|
18697
|
+
const y = startY;
|
|
18698
|
+
ctx.fillStyle = marker.color;
|
|
18699
|
+
ctx.moveTo(x, y);
|
|
18700
|
+
ctx.beginPath();
|
|
18701
|
+
ctx.lineTo(x - marker.size, y);
|
|
18702
|
+
ctx.lineTo(x, y + marker.size);
|
|
18703
|
+
ctx.lineTo(x, y);
|
|
18704
|
+
ctx.closePath();
|
|
18705
|
+
ctx.fill();
|
|
18706
|
+
ctx.restore();
|
|
18707
|
+
}
|
|
18708
|
+
if ((_cellData$markers2 = cellData.markers) === null || _cellData$markers2 === void 0 ? void 0 : _cellData$markers2.tl) {
|
|
18709
|
+
ctx.save();
|
|
18710
|
+
const marker = cellData.markers.tl;
|
|
18711
|
+
const x = startX;
|
|
18712
|
+
const y = startY;
|
|
18713
|
+
ctx.fillStyle = marker.color;
|
|
18714
|
+
ctx.moveTo(x, y);
|
|
18715
|
+
ctx.beginPath();
|
|
18716
|
+
ctx.lineTo(x + marker.size, y);
|
|
18717
|
+
ctx.lineTo(x, y + marker.size);
|
|
18718
|
+
ctx.lineTo(x, y);
|
|
18719
|
+
ctx.closePath();
|
|
18720
|
+
ctx.fill();
|
|
18721
|
+
ctx.restore();
|
|
18722
|
+
}
|
|
18723
|
+
if ((_cellData$markers3 = cellData.markers) === null || _cellData$markers3 === void 0 ? void 0 : _cellData$markers3.br) {
|
|
18724
|
+
ctx.save();
|
|
18725
|
+
const marker = cellData.markers.br;
|
|
18726
|
+
const x = endX;
|
|
18727
|
+
const y = endY;
|
|
18728
|
+
ctx.fillStyle = marker.color;
|
|
18729
|
+
ctx.moveTo(x, y);
|
|
18730
|
+
ctx.beginPath();
|
|
18731
|
+
ctx.lineTo(x - marker.size, y);
|
|
18732
|
+
ctx.lineTo(x, y - marker.size);
|
|
18733
|
+
ctx.lineTo(x, y);
|
|
18734
|
+
ctx.closePath();
|
|
18735
|
+
ctx.fill();
|
|
18736
|
+
ctx.restore();
|
|
18737
|
+
}
|
|
18738
|
+
if ((_cellData$markers4 = cellData.markers) === null || _cellData$markers4 === void 0 ? void 0 : _cellData$markers4.bl) {
|
|
18739
|
+
ctx.save();
|
|
18740
|
+
const marker = cellData.markers.bl;
|
|
18741
|
+
const x = startX;
|
|
18742
|
+
const y = endY;
|
|
18743
|
+
ctx.fillStyle = marker.color;
|
|
18744
|
+
ctx.moveTo(x, y);
|
|
18745
|
+
ctx.beginPath();
|
|
18746
|
+
ctx.lineTo(x + marker.size, y);
|
|
18747
|
+
ctx.lineTo(x, y - marker.size);
|
|
18748
|
+
ctx.lineTo(x, y);
|
|
18749
|
+
ctx.closePath();
|
|
18750
|
+
ctx.fill();
|
|
18751
|
+
ctx.restore();
|
|
18752
|
+
}
|
|
18753
|
+
});
|
|
18738
18754
|
});
|
|
18739
18755
|
}
|
|
18740
18756
|
};
|
|
@@ -22083,20 +22099,28 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22083
22099
|
this._drawAuxiliary(ctx);
|
|
22084
22100
|
const parentScale = this.getParentScale();
|
|
22085
22101
|
const diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_viewportInfo$diffBou = viewportInfo.diffBounds) === null || _viewportInfo$diffBou === void 0 ? void 0 : _viewportInfo$diffBou.map((bound) => spreadsheetSkeleton.getRangeByViewBound(bound)) : [];
|
|
22086
|
-
const
|
|
22102
|
+
const cacheRange = spreadsheetSkeleton.getCacheRangeByViewport(viewportInfo, this.isPrinting);
|
|
22103
|
+
const viewRanges = this._refreshIncrementalState && diffRanges.length > 0 ? diffRanges : [cacheRange];
|
|
22104
|
+
const overflowSafeViewRanges = this._refreshIncrementalState && diffRanges.length > 0 ? diffRanges.map((range) => ({
|
|
22105
|
+
...range,
|
|
22106
|
+
startColumn: cacheRange.startColumn,
|
|
22107
|
+
endColumn: cacheRange.endColumn
|
|
22108
|
+
})) : viewRanges;
|
|
22087
22109
|
const extensions = this.getExtensionsByOrder();
|
|
22088
22110
|
const scene = this.getScene();
|
|
22089
22111
|
for (const extension of extensions) {
|
|
22112
|
+
const extensionViewRanges = extension === this._fontExtension || extension === this._borderExtension ? overflowSafeViewRanges : viewRanges;
|
|
22090
22113
|
const timeKey = `${SHEET_EXTENSION_PREFIX}${extension.uKey}`;
|
|
22091
22114
|
const st = _univerjs_core.Tools.now();
|
|
22092
22115
|
extension.draw(ctx, parentScale, spreadsheetSkeleton, diffRanges, {
|
|
22093
|
-
viewRanges,
|
|
22116
|
+
viewRanges: extensionViewRanges,
|
|
22094
22117
|
checkOutOfViewBound: true,
|
|
22095
22118
|
viewportKey: viewportInfo.viewportKey,
|
|
22096
22119
|
viewBound: viewportInfo.cacheBound,
|
|
22097
22120
|
diffBounds: viewportInfo.diffBounds
|
|
22098
22121
|
});
|
|
22099
|
-
|
|
22122
|
+
const cost = _univerjs_core.Tools.now() - st;
|
|
22123
|
+
this.addRenderFrameTimeMetricToScene(timeKey, cost, scene);
|
|
22100
22124
|
}
|
|
22101
22125
|
}
|
|
22102
22126
|
addRenderFrameTimeMetricToScene(timeKey, val, scene) {
|
|
@@ -24468,7 +24492,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
24468
24492
|
//#endregion
|
|
24469
24493
|
//#region package.json
|
|
24470
24494
|
var name = "@univerjs/engine-render";
|
|
24471
|
-
var version = "0.22.
|
|
24495
|
+
var version = "0.22.1-insiders.20260516-8900c44";
|
|
24472
24496
|
|
|
24473
24497
|
//#endregion
|
|
24474
24498
|
//#region src/config/config.ts
|