@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/es/index.js
CHANGED
|
@@ -5445,36 +5445,38 @@ var Custom = class extends SheetExtension {
|
|
|
5445
5445
|
if (!worksheet) return;
|
|
5446
5446
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
5447
5447
|
const subUnitId = worksheet.getSheetId();
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5448
|
+
((diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment]).forEach((range) => {
|
|
5449
|
+
Range.foreach(range, (row, col) => {
|
|
5450
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
5451
|
+
let primaryWithCoord = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
5452
|
+
const { mergeInfo } = primaryWithCoord;
|
|
5453
|
+
let cellData = worksheet.getCell(row, col);
|
|
5454
|
+
if (primaryWithCoord.isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
|
|
5455
|
+
if (!(cellData === null || cellData === void 0 ? void 0 : cellData.customRender)) return;
|
|
5456
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) return true;
|
|
5457
|
+
if (primaryWithCoord.isMerged || primaryWithCoord.isMergedMainCell) {
|
|
5458
|
+
const rangeStr = stringifyRange$1(mergeInfo);
|
|
5459
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
5460
|
+
mergeCellRendered.add(rangeStr);
|
|
5461
|
+
}
|
|
5462
|
+
if (primaryWithCoord.isMerged) primaryWithCoord = skeleton.getCellWithCoordByIndex(mergeInfo.startRow, mergeInfo.startColumn, false);
|
|
5463
|
+
const renderInfo = {
|
|
5464
|
+
data: cellData,
|
|
5465
|
+
style: skeleton.getStyles().getStyleByCell(cellData),
|
|
5466
|
+
primaryWithCoord,
|
|
5467
|
+
subUnitId,
|
|
5468
|
+
row,
|
|
5469
|
+
col,
|
|
5470
|
+
worksheet,
|
|
5471
|
+
unitId: worksheet.unitId
|
|
5472
|
+
};
|
|
5473
|
+
const customRender = cellData.customRender.sort(sortRules);
|
|
5474
|
+
ctx.save();
|
|
5475
|
+
customRender.forEach((item) => {
|
|
5476
|
+
item.drawWith(ctx, renderInfo, skeleton, this.parent);
|
|
5477
|
+
});
|
|
5478
|
+
ctx.restore();
|
|
5476
5479
|
});
|
|
5477
|
-
ctx.restore();
|
|
5478
5480
|
});
|
|
5479
5481
|
}
|
|
5480
5482
|
};
|
|
@@ -17265,54 +17267,58 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
17265
17267
|
* @param vpInfo viewBounds
|
|
17266
17268
|
*/
|
|
17267
17269
|
setStylesCache(vpInfo) {
|
|
17270
|
+
var _vpInfo$diffBounds, _vpInfo$diffCacheBoun, _vpInfo$diffCacheBoun2, _vpInfo$diffCacheBoun3;
|
|
17268
17271
|
if (!this._worksheetData) return;
|
|
17269
17272
|
if (!this.rowHeightAccumulation || !this.columnWidthAccumulation) return;
|
|
17270
17273
|
this.updateVisibleRange(vpInfo);
|
|
17271
17274
|
const rowColumnSegment = this._drawingRange;
|
|
17272
17275
|
const columnWidthAccumulation = this.columnWidthAccumulation;
|
|
17273
|
-
const
|
|
17274
|
-
|
|
17275
|
-
|
|
17276
|
-
|
|
17277
|
-
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17276
|
+
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];
|
|
17277
|
+
for (const styleRange of styleRanges) {
|
|
17278
|
+
const { startRow: visibleStartRow, endRow: visibleEndRow, startColumn: visibleStartColumn, endColumn: visibleEndColumn } = styleRange;
|
|
17279
|
+
if (visibleEndColumn === -1 || visibleEndRow === -1) continue;
|
|
17280
|
+
const mergeVisibleRanges = [];
|
|
17281
|
+
let mergeVisibleRangeStartRow = visibleStartRow;
|
|
17282
|
+
const expandStartCol = Math.max(0, visibleStartColumn - 20);
|
|
17283
|
+
const expandEndCol = Math.min(columnWidthAccumulation.length - 1, visibleEndColumn + 20);
|
|
17284
|
+
for (let r = visibleStartRow; r <= visibleEndRow; r++) {
|
|
17285
|
+
if (this.worksheet.getRowVisible(r) === false) {
|
|
17286
|
+
if (mergeVisibleRangeStartRow < r) mergeVisibleRanges.push({
|
|
17287
|
+
startRow: mergeVisibleRangeStartRow,
|
|
17288
|
+
endRow: r - 1,
|
|
17289
|
+
startColumn: visibleStartColumn,
|
|
17290
|
+
endColumn: visibleEndColumn
|
|
17291
|
+
});
|
|
17292
|
+
mergeVisibleRangeStartRow = r + 1;
|
|
17293
|
+
continue;
|
|
17294
|
+
}
|
|
17295
|
+
if (r === visibleEndRow) mergeVisibleRanges.push({
|
|
17282
17296
|
startRow: mergeVisibleRangeStartRow,
|
|
17283
|
-
endRow: r
|
|
17297
|
+
endRow: r,
|
|
17284
17298
|
startColumn: visibleStartColumn,
|
|
17285
17299
|
endColumn: visibleEndColumn
|
|
17286
17300
|
});
|
|
17287
|
-
|
|
17288
|
-
|
|
17301
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17302
|
+
bg: true,
|
|
17303
|
+
border: true
|
|
17304
|
+
} });
|
|
17305
|
+
for (let c = expandStartCol; c < visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17306
|
+
bg: false,
|
|
17307
|
+
border: false
|
|
17308
|
+
} });
|
|
17309
|
+
if (visibleEndColumn === 0) continue;
|
|
17310
|
+
for (let c = visibleEndColumn + 1; c < expandEndCol; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17311
|
+
bg: false,
|
|
17312
|
+
border: false
|
|
17313
|
+
} });
|
|
17289
17314
|
}
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
|
|
17294
|
-
|
|
17295
|
-
});
|
|
17296
|
-
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17297
|
-
bg: true,
|
|
17298
|
-
border: true
|
|
17299
|
-
} });
|
|
17300
|
-
for (let c = expandStartCol; c < visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17301
|
-
bg: false,
|
|
17302
|
-
border: false
|
|
17303
|
-
} });
|
|
17304
|
-
if (visibleEndColumn === 0) continue;
|
|
17305
|
-
for (let c = visibleEndColumn + 1; c < expandEndCol; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17306
|
-
bg: false,
|
|
17307
|
-
border: false
|
|
17308
|
-
} });
|
|
17309
|
-
}
|
|
17310
|
-
const mergeRanges = [];
|
|
17311
|
-
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
17312
|
-
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
17313
|
-
mergeRanges.push(...mergeRangeInVisible);
|
|
17315
|
+
const mergeRanges = [];
|
|
17316
|
+
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
17317
|
+
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
17318
|
+
mergeRanges.push(...mergeRangeInVisible);
|
|
17319
|
+
}
|
|
17320
|
+
for (const mergeRange of mergeRanges) this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, { mergeRange });
|
|
17314
17321
|
}
|
|
17315
|
-
for (const mergeRange of mergeRanges) this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, { mergeRange });
|
|
17316
17322
|
return this;
|
|
17317
17323
|
}
|
|
17318
17324
|
/**
|
|
@@ -18279,12 +18285,19 @@ var Font = class extends SheetExtension {
|
|
|
18279
18285
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0 || !worksheet) return;
|
|
18280
18286
|
const scale = this._getScale(parentScale);
|
|
18281
18287
|
const { viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
18288
|
+
const lastRowIndex = spreadsheetSkeleton.getRowCount() - 1;
|
|
18289
|
+
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
18290
|
+
const expandedViewRanges = viewRanges.map((range) => clampRange({
|
|
18291
|
+
...range,
|
|
18292
|
+
startColumn: range.startColumn - 20,
|
|
18293
|
+
endColumn: range.endColumn + 20
|
|
18294
|
+
}, lastRowIndex, lastColIndex));
|
|
18282
18295
|
const renderFontContext = {
|
|
18283
18296
|
ctx,
|
|
18284
18297
|
scale,
|
|
18285
18298
|
columnTotalWidth,
|
|
18286
18299
|
rowTotalHeight,
|
|
18287
|
-
viewRanges,
|
|
18300
|
+
viewRanges: expandedViewRanges,
|
|
18288
18301
|
checkOutOfViewBound: checkOutOfViewBound || true,
|
|
18289
18302
|
diffRanges,
|
|
18290
18303
|
spreadsheetSkeleton
|
|
@@ -18292,12 +18305,7 @@ var Font = class extends SheetExtension {
|
|
|
18292
18305
|
ctx.save();
|
|
18293
18306
|
const uniqueMergeRanges = [];
|
|
18294
18307
|
const mergeRangeIDSet = /* @__PURE__ */ new Set();
|
|
18295
|
-
|
|
18296
|
-
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
18297
|
-
viewRanges.forEach((range) => {
|
|
18298
|
-
range.startColumn -= 20;
|
|
18299
|
-
range.endColumn += 20;
|
|
18300
|
-
range = clampRange(range, lastRowIndex, lastColIndex);
|
|
18308
|
+
expandedViewRanges.forEach((range) => {
|
|
18301
18309
|
spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn).forEach((mergeRange) => {
|
|
18302
18310
|
const mergeRangeIndex = spreadsheetSkeleton.worksheet.getSpanModel().getMergeDataIndex(mergeRange.startRow, mergeRange.startColumn);
|
|
18303
18311
|
if (!mergeRangeIDSet.has(mergeRangeIndex)) {
|
|
@@ -18391,40 +18399,24 @@ var Font = class extends SheetExtension {
|
|
|
18391
18399
|
return false;
|
|
18392
18400
|
}
|
|
18393
18401
|
_renderImages(ctx, fontsConfig, startX, startY, endX, endY) {
|
|
18394
|
-
var _getSkeletonData;
|
|
18402
|
+
var _fontsConfig$style, _padding$l, _padding$r, _padding$t, _padding$b, _getSkeletonData;
|
|
18395
18403
|
const { documentSkeleton, verticalAlign, horizontalAlign } = fontsConfig;
|
|
18396
|
-
const fontHeight = documentSkeleton.getSkeletonData().pages[0].height;
|
|
18397
|
-
const fontWidth = documentSkeleton.getSkeletonData().pages[0].width;
|
|
18398
18404
|
const PADDING = 2;
|
|
18399
|
-
|
|
18400
|
-
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
|
|
18404
|
-
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
default:
|
|
18409
|
-
fontY = endY - fontHeight - PADDING;
|
|
18410
|
-
break;
|
|
18411
|
-
}
|
|
18412
|
-
switch (horizontalAlign) {
|
|
18413
|
-
case HorizontalAlign.RIGHT:
|
|
18414
|
-
fontX = endX - fontWidth - PADDING;
|
|
18415
|
-
break;
|
|
18416
|
-
case HorizontalAlign.CENTER:
|
|
18417
|
-
fontX = (startX + endX) / 2 - fontWidth / 2;
|
|
18418
|
-
break;
|
|
18419
|
-
default:
|
|
18420
|
-
fontX = startX + PADDING;
|
|
18421
|
-
break;
|
|
18422
|
-
}
|
|
18405
|
+
const padding = (_fontsConfig$style = fontsConfig.style) === null || _fontsConfig$style === void 0 ? void 0 : _fontsConfig$style.pd;
|
|
18406
|
+
const paddingLeft = (_padding$l = padding === null || padding === void 0 ? void 0 : padding.l) !== null && _padding$l !== void 0 ? _padding$l : PADDING;
|
|
18407
|
+
const paddingRight = (_padding$r = padding === null || padding === void 0 ? void 0 : padding.r) !== null && _padding$r !== void 0 ? _padding$r : PADDING;
|
|
18408
|
+
const paddingTop = (_padding$t = padding === null || padding === void 0 ? void 0 : padding.t) !== null && _padding$t !== void 0 ? _padding$t : PADDING;
|
|
18409
|
+
const paddingBottom = (_padding$b = padding === null || padding === void 0 ? void 0 : padding.b) !== null && _padding$b !== void 0 ? _padding$b : PADDING;
|
|
18410
|
+
const contentStartX = startX + paddingLeft;
|
|
18411
|
+
const contentEndX = endX - paddingRight;
|
|
18412
|
+
const contentStartY = startY + paddingTop;
|
|
18413
|
+
const contentEndY = endY - paddingBottom;
|
|
18423
18414
|
const drawingDatas = documentSkeleton.getViewModel().getDataModel().getDrawings();
|
|
18424
18415
|
const drawings = (_getSkeletonData = documentSkeleton.getSkeletonData()) === null || _getSkeletonData === void 0 ? void 0 : _getSkeletonData.pages[0].skeDrawings;
|
|
18425
18416
|
drawings === null || drawings === void 0 || drawings.forEach((drawing) => {
|
|
18426
18417
|
const drawingData = drawingDatas === null || drawingDatas === void 0 ? void 0 : drawingDatas[drawing.drawingId];
|
|
18427
18418
|
if (drawingData) {
|
|
18419
|
+
var _drawingData$docTrans, _drawingData$docTrans2, _drawingData$docTrans3, _drawingData$docTrans4, _drawingData$docTrans5, _drawingData$docTrans6;
|
|
18428
18420
|
const image = fontsConfig.imageCacheMap.getImage(drawingData.imageSourceType, drawingData.source, () => {
|
|
18429
18421
|
var _this$parent;
|
|
18430
18422
|
(_this$parent = this.parent) === null || _this$parent === void 0 || _this$parent.makeDirty();
|
|
@@ -18432,11 +18424,33 @@ var Font = class extends SheetExtension {
|
|
|
18432
18424
|
var _this$parent2;
|
|
18433
18425
|
(_this$parent2 = this.parent) === null || _this$parent2 === void 0 || _this$parent2.makeDirty();
|
|
18434
18426
|
});
|
|
18435
|
-
const
|
|
18436
|
-
const
|
|
18437
|
-
const
|
|
18438
|
-
|
|
18439
|
-
|
|
18427
|
+
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;
|
|
18428
|
+
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;
|
|
18429
|
+
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;
|
|
18430
|
+
let x = startX;
|
|
18431
|
+
let y = startY;
|
|
18432
|
+
switch (verticalAlign) {
|
|
18433
|
+
case VerticalAlign.TOP:
|
|
18434
|
+
y = contentStartY;
|
|
18435
|
+
break;
|
|
18436
|
+
case VerticalAlign.MIDDLE:
|
|
18437
|
+
y = (contentStartY + contentEndY) / 2 - height / 2;
|
|
18438
|
+
break;
|
|
18439
|
+
default:
|
|
18440
|
+
y = contentEndY - height;
|
|
18441
|
+
break;
|
|
18442
|
+
}
|
|
18443
|
+
switch (horizontalAlign) {
|
|
18444
|
+
case HorizontalAlign.RIGHT:
|
|
18445
|
+
x = contentEndX - width;
|
|
18446
|
+
break;
|
|
18447
|
+
case HorizontalAlign.CENTER:
|
|
18448
|
+
x = (contentStartX + contentEndX) / 2 - width / 2;
|
|
18449
|
+
break;
|
|
18450
|
+
default:
|
|
18451
|
+
x = contentStartX;
|
|
18452
|
+
break;
|
|
18453
|
+
}
|
|
18440
18454
|
const { rotatedHeight, rotatedWidth } = rotatedBoundingBox(width, height, angle);
|
|
18441
18455
|
if (image && image.complete) {
|
|
18442
18456
|
const angleRadians = angle * Math.PI / 180;
|
|
@@ -18504,14 +18518,14 @@ var Font = class extends SheetExtension {
|
|
|
18504
18518
|
renderFontContext.endY = endY;
|
|
18505
18519
|
}
|
|
18506
18520
|
_renderText(ctx, row, col, renderFontCtx, overflowCache) {
|
|
18507
|
-
var _fontCache$style$pd, _fontCache$style, _padding$
|
|
18521
|
+
var _fontCache$style$pd, _fontCache$style, _padding$l2, _padding$r2, _padding$t2, _padding$b2, _fontCache$style2, _fontCache$style3, _fontCache$style4, _fontCache$style5;
|
|
18508
18522
|
const { fontCache } = renderFontCtx;
|
|
18509
18523
|
if (!fontCache) return;
|
|
18510
18524
|
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;
|
|
18511
|
-
const paddingLeft = (_padding$
|
|
18512
|
-
const paddingRight = (_padding$
|
|
18513
|
-
const paddingTop = (_padding$
|
|
18514
|
-
const paddingBottom = (_padding$
|
|
18525
|
+
const paddingLeft = (_padding$l2 = padding.l) !== null && _padding$l2 !== void 0 ? _padding$l2 : DEFAULT_PADDING_DATA.l;
|
|
18526
|
+
const paddingRight = (_padding$r2 = padding.r) !== null && _padding$r2 !== void 0 ? _padding$r2 : DEFAULT_PADDING_DATA.r;
|
|
18527
|
+
const paddingTop = (_padding$t2 = padding.t) !== null && _padding$t2 !== void 0 ? _padding$t2 : DEFAULT_PADDING_DATA.t;
|
|
18528
|
+
const paddingBottom = (_padding$b2 = padding.b) !== null && _padding$b2 !== void 0 ? _padding$b2 : DEFAULT_PADDING_DATA.b;
|
|
18515
18529
|
const { vertexAngle = 0, wrapStrategy, cellData } = fontCache;
|
|
18516
18530
|
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return;
|
|
18517
18531
|
const text = getDisplayValueFromCell(cellData);
|
|
@@ -18619,93 +18633,95 @@ var Marker = class extends SheetExtension {
|
|
|
18619
18633
|
const { worksheet, rowColumnSegment } = skeleton;
|
|
18620
18634
|
if (!worksheet) return;
|
|
18621
18635
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18633
|
-
|
|
18634
|
-
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
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
|
-
|
|
18636
|
+
((diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment]).forEach((range) => {
|
|
18637
|
+
Range.foreach(range, (row, col) => {
|
|
18638
|
+
var _cellData$markers, _cellData$markers2, _cellData$markers3, _cellData$markers4;
|
|
18639
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
18640
|
+
let cellData = worksheet.getCell(row, col);
|
|
18641
|
+
const cellInfo = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
18642
|
+
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
18643
|
+
let { startY, endY, startX, endX } = cellInfo;
|
|
18644
|
+
if (isMergedMainCell || isMerged) {
|
|
18645
|
+
startY = mergeInfo.startY;
|
|
18646
|
+
endY = mergeInfo.endY;
|
|
18647
|
+
startX = mergeInfo.startX;
|
|
18648
|
+
endX = mergeInfo.endX;
|
|
18649
|
+
}
|
|
18650
|
+
if (isMerged) {
|
|
18651
|
+
const mainCell = {
|
|
18652
|
+
row: mergeInfo.startRow,
|
|
18653
|
+
col: mergeInfo.startColumn
|
|
18654
|
+
};
|
|
18655
|
+
cellData = worksheet.getCell(mainCell.row, mainCell.col);
|
|
18656
|
+
}
|
|
18657
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) return true;
|
|
18658
|
+
if (cellInfo.isMerged || cellInfo.isMergedMainCell) {
|
|
18659
|
+
const rangeStr = stringifyRange(mergeInfo);
|
|
18660
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
18661
|
+
mergeCellRendered.add(rangeStr);
|
|
18662
|
+
}
|
|
18663
|
+
if (!cellData) return;
|
|
18664
|
+
if ((_cellData$markers = cellData.markers) === null || _cellData$markers === void 0 ? void 0 : _cellData$markers.tr) {
|
|
18665
|
+
ctx.save();
|
|
18666
|
+
const marker = cellData.markers.tr;
|
|
18667
|
+
const x = endX;
|
|
18668
|
+
const y = startY;
|
|
18669
|
+
ctx.fillStyle = marker.color;
|
|
18670
|
+
ctx.moveTo(x, y);
|
|
18671
|
+
ctx.beginPath();
|
|
18672
|
+
ctx.lineTo(x - marker.size, y);
|
|
18673
|
+
ctx.lineTo(x, y + marker.size);
|
|
18674
|
+
ctx.lineTo(x, y);
|
|
18675
|
+
ctx.closePath();
|
|
18676
|
+
ctx.fill();
|
|
18677
|
+
ctx.restore();
|
|
18678
|
+
}
|
|
18679
|
+
if ((_cellData$markers2 = cellData.markers) === null || _cellData$markers2 === void 0 ? void 0 : _cellData$markers2.tl) {
|
|
18680
|
+
ctx.save();
|
|
18681
|
+
const marker = cellData.markers.tl;
|
|
18682
|
+
const x = startX;
|
|
18683
|
+
const y = startY;
|
|
18684
|
+
ctx.fillStyle = marker.color;
|
|
18685
|
+
ctx.moveTo(x, y);
|
|
18686
|
+
ctx.beginPath();
|
|
18687
|
+
ctx.lineTo(x + marker.size, y);
|
|
18688
|
+
ctx.lineTo(x, y + marker.size);
|
|
18689
|
+
ctx.lineTo(x, y);
|
|
18690
|
+
ctx.closePath();
|
|
18691
|
+
ctx.fill();
|
|
18692
|
+
ctx.restore();
|
|
18693
|
+
}
|
|
18694
|
+
if ((_cellData$markers3 = cellData.markers) === null || _cellData$markers3 === void 0 ? void 0 : _cellData$markers3.br) {
|
|
18695
|
+
ctx.save();
|
|
18696
|
+
const marker = cellData.markers.br;
|
|
18697
|
+
const x = endX;
|
|
18698
|
+
const y = endY;
|
|
18699
|
+
ctx.fillStyle = marker.color;
|
|
18700
|
+
ctx.moveTo(x, y);
|
|
18701
|
+
ctx.beginPath();
|
|
18702
|
+
ctx.lineTo(x - marker.size, y);
|
|
18703
|
+
ctx.lineTo(x, y - marker.size);
|
|
18704
|
+
ctx.lineTo(x, y);
|
|
18705
|
+
ctx.closePath();
|
|
18706
|
+
ctx.fill();
|
|
18707
|
+
ctx.restore();
|
|
18708
|
+
}
|
|
18709
|
+
if ((_cellData$markers4 = cellData.markers) === null || _cellData$markers4 === void 0 ? void 0 : _cellData$markers4.bl) {
|
|
18710
|
+
ctx.save();
|
|
18711
|
+
const marker = cellData.markers.bl;
|
|
18712
|
+
const x = startX;
|
|
18713
|
+
const y = endY;
|
|
18714
|
+
ctx.fillStyle = marker.color;
|
|
18715
|
+
ctx.moveTo(x, y);
|
|
18716
|
+
ctx.beginPath();
|
|
18717
|
+
ctx.lineTo(x + marker.size, y);
|
|
18718
|
+
ctx.lineTo(x, y - marker.size);
|
|
18719
|
+
ctx.lineTo(x, y);
|
|
18720
|
+
ctx.closePath();
|
|
18721
|
+
ctx.fill();
|
|
18722
|
+
ctx.restore();
|
|
18723
|
+
}
|
|
18724
|
+
});
|
|
18709
18725
|
});
|
|
18710
18726
|
}
|
|
18711
18727
|
};
|
|
@@ -22054,20 +22070,28 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22054
22070
|
this._drawAuxiliary(ctx);
|
|
22055
22071
|
const parentScale = this.getParentScale();
|
|
22056
22072
|
const diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_viewportInfo$diffBou = viewportInfo.diffBounds) === null || _viewportInfo$diffBou === void 0 ? void 0 : _viewportInfo$diffBou.map((bound) => spreadsheetSkeleton.getRangeByViewBound(bound)) : [];
|
|
22057
|
-
const
|
|
22073
|
+
const cacheRange = spreadsheetSkeleton.getCacheRangeByViewport(viewportInfo, this.isPrinting);
|
|
22074
|
+
const viewRanges = this._refreshIncrementalState && diffRanges.length > 0 ? diffRanges : [cacheRange];
|
|
22075
|
+
const overflowSafeViewRanges = this._refreshIncrementalState && diffRanges.length > 0 ? diffRanges.map((range) => ({
|
|
22076
|
+
...range,
|
|
22077
|
+
startColumn: cacheRange.startColumn,
|
|
22078
|
+
endColumn: cacheRange.endColumn
|
|
22079
|
+
})) : viewRanges;
|
|
22058
22080
|
const extensions = this.getExtensionsByOrder();
|
|
22059
22081
|
const scene = this.getScene();
|
|
22060
22082
|
for (const extension of extensions) {
|
|
22083
|
+
const extensionViewRanges = extension === this._fontExtension || extension === this._borderExtension ? overflowSafeViewRanges : viewRanges;
|
|
22061
22084
|
const timeKey = `${SHEET_EXTENSION_PREFIX}${extension.uKey}`;
|
|
22062
22085
|
const st = Tools.now();
|
|
22063
22086
|
extension.draw(ctx, parentScale, spreadsheetSkeleton, diffRanges, {
|
|
22064
|
-
viewRanges,
|
|
22087
|
+
viewRanges: extensionViewRanges,
|
|
22065
22088
|
checkOutOfViewBound: true,
|
|
22066
22089
|
viewportKey: viewportInfo.viewportKey,
|
|
22067
22090
|
viewBound: viewportInfo.cacheBound,
|
|
22068
22091
|
diffBounds: viewportInfo.diffBounds
|
|
22069
22092
|
});
|
|
22070
|
-
|
|
22093
|
+
const cost = Tools.now() - st;
|
|
22094
|
+
this.addRenderFrameTimeMetricToScene(timeKey, cost, scene);
|
|
22071
22095
|
}
|
|
22072
22096
|
}
|
|
22073
22097
|
addRenderFrameTimeMetricToScene(timeKey, val, scene) {
|
|
@@ -24439,7 +24463,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
24439
24463
|
//#endregion
|
|
24440
24464
|
//#region package.json
|
|
24441
24465
|
var name = "@univerjs/engine-render";
|
|
24442
|
-
var version = "0.22.
|
|
24466
|
+
var version = "0.22.1-insiders.20260516-8900c44";
|
|
24443
24467
|
|
|
24444
24468
|
//#endregion
|
|
24445
24469
|
//#region src/config/config.ts
|