@univerjs/engine-render 0.22.1 → 0.23.0-insiders.20260522-ee0b0a4
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 +209 -188
- package/lib/es/index.js +208 -187
- package/lib/types/components/sheets/interfaces.d.ts +2 -2
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as EnUs } from "./en-us-ClVoWMyT.js";
|
|
2
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, MOVE_BUFFER_VALUE, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isClassDependencyItem, isNullCell, isWhiteColor, merge, mergeWith, numberToABC, numberToListABC, registerDependencies, remove, requestImmediateMacroTask, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
2
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, MOVE_BUFFER_VALUE, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isClassDependencyItem, isNullCell, isWhiteColor, merge, mergeWith, noop, numberToABC, numberToListABC, registerDependencies, remove, requestImmediateMacroTask, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
3
3
|
import * as cjk from "cjk-regex";
|
|
4
4
|
import { BehaviorSubject, Observable, Subject, Subscription, debounceTime, distinctUntilChanged, shareReplay, startWith } from "rxjs";
|
|
5
5
|
import { parse } from "opentype.js";
|
|
@@ -4686,8 +4686,9 @@ var SpreadsheetColumnHeader = class extends SpreadsheetHeader {
|
|
|
4686
4686
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
4687
4687
|
if (!segment) return;
|
|
4688
4688
|
if (segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
4689
|
-
const {
|
|
4690
|
-
|
|
4689
|
+
const { columnHeaderHeight, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = spreadsheetSkeleton;
|
|
4690
|
+
const marginTop = columnHeaderHeightAndMarginTop - columnHeaderHeight;
|
|
4691
|
+
ctx.translateWithPrecision(rowHeaderWidthAndMarginLeft, marginTop);
|
|
4691
4692
|
const extensions = this.getExtensionsByOrder();
|
|
4692
4693
|
for (const extension of extensions) extension.draw(ctx, parentScale, spreadsheetSkeleton);
|
|
4693
4694
|
}
|
|
@@ -4695,8 +4696,9 @@ var SpreadsheetColumnHeader = class extends SpreadsheetHeader {
|
|
|
4695
4696
|
const oCoord = this.getInverseCoord(coord);
|
|
4696
4697
|
const skeleton = this.getSkeleton();
|
|
4697
4698
|
if (!skeleton) return false;
|
|
4698
|
-
const {
|
|
4699
|
-
|
|
4699
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeight, columnHeaderHeightAndMarginTop } = skeleton;
|
|
4700
|
+
const marginTop = columnHeaderHeightAndMarginTop - columnHeaderHeight;
|
|
4701
|
+
if (oCoord.x > rowHeaderWidthAndMarginLeft && oCoord.y >= marginTop && oCoord.y <= columnHeaderHeightAndMarginTop) return true;
|
|
4700
4702
|
return false;
|
|
4701
4703
|
}
|
|
4702
4704
|
_initialDefaultExtension() {
|
|
@@ -5445,36 +5447,38 @@ var Custom = class extends SheetExtension {
|
|
|
5445
5447
|
if (!worksheet) return;
|
|
5446
5448
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
5447
5449
|
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
|
-
|
|
5450
|
+
((diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment]).forEach((range) => {
|
|
5451
|
+
Range.foreach(range, (row, col) => {
|
|
5452
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
5453
|
+
let primaryWithCoord = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
5454
|
+
const { mergeInfo } = primaryWithCoord;
|
|
5455
|
+
let cellData = worksheet.getCell(row, col);
|
|
5456
|
+
if (primaryWithCoord.isMerged) cellData = worksheet.getCell(mergeInfo.startRow, mergeInfo.startColumn);
|
|
5457
|
+
if (!(cellData === null || cellData === void 0 ? void 0 : cellData.customRender)) return;
|
|
5458
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) return true;
|
|
5459
|
+
if (primaryWithCoord.isMerged || primaryWithCoord.isMergedMainCell) {
|
|
5460
|
+
const rangeStr = stringifyRange$1(mergeInfo);
|
|
5461
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
5462
|
+
mergeCellRendered.add(rangeStr);
|
|
5463
|
+
}
|
|
5464
|
+
if (primaryWithCoord.isMerged) primaryWithCoord = skeleton.getCellWithCoordByIndex(mergeInfo.startRow, mergeInfo.startColumn, false);
|
|
5465
|
+
const renderInfo = {
|
|
5466
|
+
data: cellData,
|
|
5467
|
+
style: skeleton.getStyles().getStyleByCell(cellData),
|
|
5468
|
+
primaryWithCoord,
|
|
5469
|
+
subUnitId,
|
|
5470
|
+
row,
|
|
5471
|
+
col,
|
|
5472
|
+
worksheet,
|
|
5473
|
+
unitId: worksheet.unitId
|
|
5474
|
+
};
|
|
5475
|
+
const customRender = cellData.customRender.sort(sortRules);
|
|
5476
|
+
ctx.save();
|
|
5477
|
+
customRender.forEach((item) => {
|
|
5478
|
+
item.drawWith(ctx, renderInfo, skeleton, this.parent);
|
|
5479
|
+
});
|
|
5480
|
+
ctx.restore();
|
|
5476
5481
|
});
|
|
5477
|
-
ctx.restore();
|
|
5478
5482
|
});
|
|
5479
5483
|
}
|
|
5480
5484
|
};
|
|
@@ -17265,54 +17269,58 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
17265
17269
|
* @param vpInfo viewBounds
|
|
17266
17270
|
*/
|
|
17267
17271
|
setStylesCache(vpInfo) {
|
|
17272
|
+
var _vpInfo$diffBounds, _vpInfo$diffCacheBoun, _vpInfo$diffCacheBoun2, _vpInfo$diffCacheBoun3;
|
|
17268
17273
|
if (!this._worksheetData) return;
|
|
17269
17274
|
if (!this.rowHeightAccumulation || !this.columnWidthAccumulation) return;
|
|
17270
17275
|
this.updateVisibleRange(vpInfo);
|
|
17271
17276
|
const rowColumnSegment = this._drawingRange;
|
|
17272
17277
|
const columnWidthAccumulation = this.columnWidthAccumulation;
|
|
17273
|
-
const
|
|
17274
|
-
|
|
17275
|
-
|
|
17276
|
-
|
|
17277
|
-
|
|
17278
|
-
|
|
17279
|
-
|
|
17280
|
-
|
|
17281
|
-
|
|
17278
|
+
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];
|
|
17279
|
+
for (const styleRange of styleRanges) {
|
|
17280
|
+
const { startRow: visibleStartRow, endRow: visibleEndRow, startColumn: visibleStartColumn, endColumn: visibleEndColumn } = styleRange;
|
|
17281
|
+
if (visibleEndColumn === -1 || visibleEndRow === -1) continue;
|
|
17282
|
+
const mergeVisibleRanges = [];
|
|
17283
|
+
let mergeVisibleRangeStartRow = visibleStartRow;
|
|
17284
|
+
const expandStartCol = Math.max(0, visibleStartColumn - 20);
|
|
17285
|
+
const expandEndCol = Math.min(columnWidthAccumulation.length - 1, visibleEndColumn + 20);
|
|
17286
|
+
for (let r = visibleStartRow; r <= visibleEndRow; r++) {
|
|
17287
|
+
if (this.worksheet.getRowVisible(r) === false) {
|
|
17288
|
+
if (mergeVisibleRangeStartRow < r) mergeVisibleRanges.push({
|
|
17289
|
+
startRow: mergeVisibleRangeStartRow,
|
|
17290
|
+
endRow: r - 1,
|
|
17291
|
+
startColumn: visibleStartColumn,
|
|
17292
|
+
endColumn: visibleEndColumn
|
|
17293
|
+
});
|
|
17294
|
+
mergeVisibleRangeStartRow = r + 1;
|
|
17295
|
+
continue;
|
|
17296
|
+
}
|
|
17297
|
+
if (r === visibleEndRow) mergeVisibleRanges.push({
|
|
17282
17298
|
startRow: mergeVisibleRangeStartRow,
|
|
17283
|
-
endRow: r
|
|
17299
|
+
endRow: r,
|
|
17284
17300
|
startColumn: visibleStartColumn,
|
|
17285
17301
|
endColumn: visibleEndColumn
|
|
17286
17302
|
});
|
|
17287
|
-
|
|
17288
|
-
|
|
17303
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17304
|
+
bg: true,
|
|
17305
|
+
border: true
|
|
17306
|
+
} });
|
|
17307
|
+
for (let c = expandStartCol; c < visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17308
|
+
bg: false,
|
|
17309
|
+
border: false
|
|
17310
|
+
} });
|
|
17311
|
+
if (visibleEndColumn === 0) continue;
|
|
17312
|
+
for (let c = visibleEndColumn + 1; c < expandEndCol; c++) this._setStylesCacheForOneCell(r, c, { cacheItem: {
|
|
17313
|
+
bg: false,
|
|
17314
|
+
border: false
|
|
17315
|
+
} });
|
|
17289
17316
|
}
|
|
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);
|
|
17317
|
+
const mergeRanges = [];
|
|
17318
|
+
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
17319
|
+
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
17320
|
+
mergeRanges.push(...mergeRangeInVisible);
|
|
17321
|
+
}
|
|
17322
|
+
for (const mergeRange of mergeRanges) this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, { mergeRange });
|
|
17314
17323
|
}
|
|
17315
|
-
for (const mergeRange of mergeRanges) this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, { mergeRange });
|
|
17316
17324
|
return this;
|
|
17317
17325
|
}
|
|
17318
17326
|
/**
|
|
@@ -18279,12 +18287,19 @@ var Font = class extends SheetExtension {
|
|
|
18279
18287
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0 || !worksheet) return;
|
|
18280
18288
|
const scale = this._getScale(parentScale);
|
|
18281
18289
|
const { viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
18290
|
+
const lastRowIndex = spreadsheetSkeleton.getRowCount() - 1;
|
|
18291
|
+
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
18292
|
+
const expandedViewRanges = viewRanges.map((range) => clampRange({
|
|
18293
|
+
...range,
|
|
18294
|
+
startColumn: range.startColumn - 20,
|
|
18295
|
+
endColumn: range.endColumn + 20
|
|
18296
|
+
}, lastRowIndex, lastColIndex));
|
|
18282
18297
|
const renderFontContext = {
|
|
18283
18298
|
ctx,
|
|
18284
18299
|
scale,
|
|
18285
18300
|
columnTotalWidth,
|
|
18286
18301
|
rowTotalHeight,
|
|
18287
|
-
viewRanges,
|
|
18302
|
+
viewRanges: expandedViewRanges,
|
|
18288
18303
|
checkOutOfViewBound: checkOutOfViewBound || true,
|
|
18289
18304
|
diffRanges,
|
|
18290
18305
|
spreadsheetSkeleton
|
|
@@ -18292,12 +18307,7 @@ var Font = class extends SheetExtension {
|
|
|
18292
18307
|
ctx.save();
|
|
18293
18308
|
const uniqueMergeRanges = [];
|
|
18294
18309
|
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);
|
|
18310
|
+
expandedViewRanges.forEach((range) => {
|
|
18301
18311
|
spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn).forEach((mergeRange) => {
|
|
18302
18312
|
const mergeRangeIndex = spreadsheetSkeleton.worksheet.getSpanModel().getMergeDataIndex(mergeRange.startRow, mergeRange.startColumn);
|
|
18303
18313
|
if (!mergeRangeIDSet.has(mergeRangeIndex)) {
|
|
@@ -18625,93 +18635,95 @@ var Marker = class extends SheetExtension {
|
|
|
18625
18635
|
const { worksheet, rowColumnSegment } = skeleton;
|
|
18626
18636
|
if (!worksheet) return;
|
|
18627
18637
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
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
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18638
|
+
((diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment]).forEach((range) => {
|
|
18639
|
+
Range.foreach(range, (row, col) => {
|
|
18640
|
+
var _cellData$markers, _cellData$markers2, _cellData$markers3, _cellData$markers4;
|
|
18641
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) return;
|
|
18642
|
+
let cellData = worksheet.getCell(row, col);
|
|
18643
|
+
const cellInfo = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
18644
|
+
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
18645
|
+
let { startY, endY, startX, endX } = cellInfo;
|
|
18646
|
+
if (isMergedMainCell || isMerged) {
|
|
18647
|
+
startY = mergeInfo.startY;
|
|
18648
|
+
endY = mergeInfo.endY;
|
|
18649
|
+
startX = mergeInfo.startX;
|
|
18650
|
+
endX = mergeInfo.endX;
|
|
18651
|
+
}
|
|
18652
|
+
if (isMerged) {
|
|
18653
|
+
const mainCell = {
|
|
18654
|
+
row: mergeInfo.startRow,
|
|
18655
|
+
col: mergeInfo.startColumn
|
|
18656
|
+
};
|
|
18657
|
+
cellData = worksheet.getCell(mainCell.row, mainCell.col);
|
|
18658
|
+
}
|
|
18659
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) return true;
|
|
18660
|
+
if (cellInfo.isMerged || cellInfo.isMergedMainCell) {
|
|
18661
|
+
const rangeStr = stringifyRange(mergeInfo);
|
|
18662
|
+
if (mergeCellRendered.has(rangeStr)) return;
|
|
18663
|
+
mergeCellRendered.add(rangeStr);
|
|
18664
|
+
}
|
|
18665
|
+
if (!cellData) return;
|
|
18666
|
+
if ((_cellData$markers = cellData.markers) === null || _cellData$markers === void 0 ? void 0 : _cellData$markers.tr) {
|
|
18667
|
+
ctx.save();
|
|
18668
|
+
const marker = cellData.markers.tr;
|
|
18669
|
+
const x = endX;
|
|
18670
|
+
const y = startY;
|
|
18671
|
+
ctx.fillStyle = marker.color;
|
|
18672
|
+
ctx.moveTo(x, y);
|
|
18673
|
+
ctx.beginPath();
|
|
18674
|
+
ctx.lineTo(x - marker.size, y);
|
|
18675
|
+
ctx.lineTo(x, y + marker.size);
|
|
18676
|
+
ctx.lineTo(x, y);
|
|
18677
|
+
ctx.closePath();
|
|
18678
|
+
ctx.fill();
|
|
18679
|
+
ctx.restore();
|
|
18680
|
+
}
|
|
18681
|
+
if ((_cellData$markers2 = cellData.markers) === null || _cellData$markers2 === void 0 ? void 0 : _cellData$markers2.tl) {
|
|
18682
|
+
ctx.save();
|
|
18683
|
+
const marker = cellData.markers.tl;
|
|
18684
|
+
const x = startX;
|
|
18685
|
+
const y = startY;
|
|
18686
|
+
ctx.fillStyle = marker.color;
|
|
18687
|
+
ctx.moveTo(x, y);
|
|
18688
|
+
ctx.beginPath();
|
|
18689
|
+
ctx.lineTo(x + marker.size, y);
|
|
18690
|
+
ctx.lineTo(x, y + marker.size);
|
|
18691
|
+
ctx.lineTo(x, y);
|
|
18692
|
+
ctx.closePath();
|
|
18693
|
+
ctx.fill();
|
|
18694
|
+
ctx.restore();
|
|
18695
|
+
}
|
|
18696
|
+
if ((_cellData$markers3 = cellData.markers) === null || _cellData$markers3 === void 0 ? void 0 : _cellData$markers3.br) {
|
|
18697
|
+
ctx.save();
|
|
18698
|
+
const marker = cellData.markers.br;
|
|
18699
|
+
const x = endX;
|
|
18700
|
+
const y = endY;
|
|
18701
|
+
ctx.fillStyle = marker.color;
|
|
18702
|
+
ctx.moveTo(x, y);
|
|
18703
|
+
ctx.beginPath();
|
|
18704
|
+
ctx.lineTo(x - marker.size, y);
|
|
18705
|
+
ctx.lineTo(x, y - marker.size);
|
|
18706
|
+
ctx.lineTo(x, y);
|
|
18707
|
+
ctx.closePath();
|
|
18708
|
+
ctx.fill();
|
|
18709
|
+
ctx.restore();
|
|
18710
|
+
}
|
|
18711
|
+
if ((_cellData$markers4 = cellData.markers) === null || _cellData$markers4 === void 0 ? void 0 : _cellData$markers4.bl) {
|
|
18712
|
+
ctx.save();
|
|
18713
|
+
const marker = cellData.markers.bl;
|
|
18714
|
+
const x = startX;
|
|
18715
|
+
const y = endY;
|
|
18716
|
+
ctx.fillStyle = marker.color;
|
|
18717
|
+
ctx.moveTo(x, y);
|
|
18718
|
+
ctx.beginPath();
|
|
18719
|
+
ctx.lineTo(x + marker.size, y);
|
|
18720
|
+
ctx.lineTo(x, y - marker.size);
|
|
18721
|
+
ctx.lineTo(x, y);
|
|
18722
|
+
ctx.closePath();
|
|
18723
|
+
ctx.fill();
|
|
18724
|
+
ctx.restore();
|
|
18725
|
+
}
|
|
18726
|
+
});
|
|
18715
18727
|
});
|
|
18716
18728
|
}
|
|
18717
18729
|
};
|
|
@@ -18935,8 +18947,9 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
18935
18947
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
18936
18948
|
if (!segment) return;
|
|
18937
18949
|
if (segment.startRow === -1 && segment.endRow === -1) return;
|
|
18938
|
-
const {
|
|
18939
|
-
|
|
18950
|
+
const { columnHeaderHeightAndMarginTop, rowHeaderWidth, rowHeaderWidthAndMarginLeft } = spreadsheetSkeleton;
|
|
18951
|
+
const marginLeft = rowHeaderWidthAndMarginLeft - rowHeaderWidth;
|
|
18952
|
+
ctx.translateWithPrecision(marginLeft, columnHeaderHeightAndMarginTop);
|
|
18940
18953
|
const extensions = this.getExtensionsByOrder();
|
|
18941
18954
|
for (const extension of extensions) extension.draw(ctx, parentScale, spreadsheetSkeleton);
|
|
18942
18955
|
}
|
|
@@ -18944,8 +18957,9 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
18944
18957
|
const oCoord = this.getInverseCoord(coord);
|
|
18945
18958
|
const skeleton = this.getSkeleton();
|
|
18946
18959
|
if (!skeleton) return false;
|
|
18947
|
-
const { rowHeaderWidth,
|
|
18948
|
-
|
|
18960
|
+
const { rowHeaderWidth, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
18961
|
+
const marginLeft = rowHeaderWidthAndMarginLeft - rowHeaderWidth;
|
|
18962
|
+
if (oCoord.x >= marginLeft && oCoord.x <= rowHeaderWidthAndMarginLeft && oCoord.y > columnHeaderHeightAndMarginTop) return true;
|
|
18949
18963
|
return false;
|
|
18950
18964
|
}
|
|
18951
18965
|
_initialDefaultExtension() {
|
|
@@ -22060,20 +22074,28 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22060
22074
|
this._drawAuxiliary(ctx);
|
|
22061
22075
|
const parentScale = this.getParentScale();
|
|
22062
22076
|
const diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_viewportInfo$diffBou = viewportInfo.diffBounds) === null || _viewportInfo$diffBou === void 0 ? void 0 : _viewportInfo$diffBou.map((bound) => spreadsheetSkeleton.getRangeByViewBound(bound)) : [];
|
|
22063
|
-
const
|
|
22077
|
+
const cacheRange = spreadsheetSkeleton.getCacheRangeByViewport(viewportInfo, this.isPrinting);
|
|
22078
|
+
const viewRanges = this._refreshIncrementalState && diffRanges.length > 0 ? diffRanges : [cacheRange];
|
|
22079
|
+
const overflowSafeViewRanges = this._refreshIncrementalState && diffRanges.length > 0 ? diffRanges.map((range) => ({
|
|
22080
|
+
...range,
|
|
22081
|
+
startColumn: cacheRange.startColumn,
|
|
22082
|
+
endColumn: cacheRange.endColumn
|
|
22083
|
+
})) : viewRanges;
|
|
22064
22084
|
const extensions = this.getExtensionsByOrder();
|
|
22065
22085
|
const scene = this.getScene();
|
|
22066
22086
|
for (const extension of extensions) {
|
|
22087
|
+
const extensionViewRanges = extension === this._fontExtension || extension === this._borderExtension ? overflowSafeViewRanges : viewRanges;
|
|
22067
22088
|
const timeKey = `${SHEET_EXTENSION_PREFIX}${extension.uKey}`;
|
|
22068
22089
|
const st = Tools.now();
|
|
22069
22090
|
extension.draw(ctx, parentScale, spreadsheetSkeleton, diffRanges, {
|
|
22070
|
-
viewRanges,
|
|
22091
|
+
viewRanges: extensionViewRanges,
|
|
22071
22092
|
checkOutOfViewBound: true,
|
|
22072
22093
|
viewportKey: viewportInfo.viewportKey,
|
|
22073
22094
|
viewBound: viewportInfo.cacheBound,
|
|
22074
22095
|
diffBounds: viewportInfo.diffBounds
|
|
22075
22096
|
});
|
|
22076
|
-
|
|
22097
|
+
const cost = Tools.now() - st;
|
|
22098
|
+
this.addRenderFrameTimeMetricToScene(timeKey, cost, scene);
|
|
22077
22099
|
}
|
|
22078
22100
|
}
|
|
22079
22101
|
addRenderFrameTimeMetricToScene(timeKey, val, scene) {
|
|
@@ -22097,8 +22119,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22097
22119
|
const oCoord = this.getInverseCoord(coord);
|
|
22098
22120
|
const skeleton = this.getSkeleton();
|
|
22099
22121
|
if (!skeleton) return false;
|
|
22100
|
-
const {
|
|
22101
|
-
if (oCoord.x >
|
|
22122
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = skeleton;
|
|
22123
|
+
if (oCoord.x > rowHeaderWidthAndMarginLeft && oCoord.y > columnHeaderHeightAndMarginTop) return true;
|
|
22102
22124
|
return false;
|
|
22103
22125
|
}
|
|
22104
22126
|
getNoMergeCellPositionByIndex(rowIndex, columnIndex) {
|
|
@@ -22166,7 +22188,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22166
22188
|
}
|
|
22167
22189
|
renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton) {
|
|
22168
22190
|
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty } = viewportInfo;
|
|
22169
|
-
const {
|
|
22191
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
22170
22192
|
const { a: scaleX = 1, d: scaleY = 1 } = mainCtx.getTransform();
|
|
22171
22193
|
const bufferEdgeSizeX = bufferEdgeX * scaleX / window.devicePixelRatio;
|
|
22172
22194
|
const bufferEdgeSizeY = bufferEdgeY * scaleY / window.devicePixelRatio;
|
|
@@ -22199,20 +22221,20 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22199
22221
|
bufferEdgeY,
|
|
22200
22222
|
scaleX,
|
|
22201
22223
|
scaleY,
|
|
22202
|
-
|
|
22203
|
-
|
|
22224
|
+
columnHeaderHeightAndMarginTop,
|
|
22225
|
+
rowHeaderWidthAndMarginLeft
|
|
22204
22226
|
});
|
|
22205
22227
|
}
|
|
22206
22228
|
const sourceLeft = bufferEdgeSizeX * Math.min(1, window.devicePixelRatio);
|
|
22207
22229
|
const sourceTop = bufferEdgeSizeY * Math.min(1, window.devicePixelRatio);
|
|
22208
22230
|
const { left, top, right, bottom } = viewPortPosition;
|
|
22209
|
-
const dw = right - left +
|
|
22210
|
-
const dh = bottom - top +
|
|
22231
|
+
const dw = right - left + rowHeaderWidthAndMarginLeft;
|
|
22232
|
+
const dh = bottom - top + columnHeaderHeightAndMarginTop;
|
|
22211
22233
|
this._applyCache(cacheCanvas, mainCtx, sourceLeft, sourceTop, dw, dh, left, top, dw, dh);
|
|
22212
22234
|
cacheCtx.restore();
|
|
22213
22235
|
}
|
|
22214
22236
|
paintNewAreaForScrolling(viewportInfo, param) {
|
|
22215
|
-
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY,
|
|
22237
|
+
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = param;
|
|
22216
22238
|
const { shouldCacheUpdate, diffCacheBounds, diffX, diffY } = viewportInfo;
|
|
22217
22239
|
cacheCtx.save();
|
|
22218
22240
|
cacheCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
@@ -22225,8 +22247,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22225
22247
|
cacheCtx.translateWithPrecision(m.e / m.a - leftOrigin + bufferEdgeX, m.f / m.d - topOrigin + bufferEdgeY);
|
|
22226
22248
|
if (shouldCacheUpdate) for (const diffBound of diffCacheBounds) {
|
|
22227
22249
|
const { left: diffLeft, right: diffRight, bottom: diffBottom, top: diffTop } = diffBound;
|
|
22228
|
-
const x = diffLeft -
|
|
22229
|
-
const y = diffTop -
|
|
22250
|
+
const x = diffLeft - rowHeaderWidthAndMarginLeft;
|
|
22251
|
+
const y = diffTop - columnHeaderHeightAndMarginTop;
|
|
22230
22252
|
const w = diffRight - diffLeft;
|
|
22231
22253
|
const h = diffBottom - diffTop;
|
|
22232
22254
|
cacheCtx.clearRectByPrecision(x, y, w, h);
|
|
@@ -22272,9 +22294,9 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
22272
22294
|
if (!segment) return;
|
|
22273
22295
|
if (segment.startRow === -1 && segment.endRow === -1 || segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
22274
22296
|
mainCtx.save();
|
|
22275
|
-
const {
|
|
22276
|
-
mainCtx.translateWithPrecision(
|
|
22277
|
-
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(
|
|
22297
|
+
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
22298
|
+
mainCtx.translateWithPrecision(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
22299
|
+
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
22278
22300
|
const { viewportKey } = viewportInfo;
|
|
22279
22301
|
if (sheetContentViewportKeys.includes(viewportKey)) if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
22280
22302
|
else this._draw(mainCtx, viewportInfo);
|
|
@@ -24411,7 +24433,6 @@ let Engine = class Engine extends Disposable {
|
|
|
24411
24433
|
}
|
|
24412
24434
|
_getPassive() {
|
|
24413
24435
|
let passiveSupported = false;
|
|
24414
|
-
const noop = () => {};
|
|
24415
24436
|
try {
|
|
24416
24437
|
const options = { passive: { get() {
|
|
24417
24438
|
passiveSupported = true;
|
|
@@ -24445,7 +24466,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
24445
24466
|
//#endregion
|
|
24446
24467
|
//#region package.json
|
|
24447
24468
|
var name = "@univerjs/engine-render";
|
|
24448
|
-
var version = "0.
|
|
24469
|
+
var version = "0.23.0-insiders.20260522-ee0b0a4";
|
|
24449
24470
|
|
|
24450
24471
|
//#endregion
|
|
24451
24472
|
//#region src/config/config.ts
|
|
@@ -80,8 +80,8 @@ export interface IPaintForScrolling {
|
|
|
80
80
|
leftOrigin: number;
|
|
81
81
|
bufferEdgeX: number;
|
|
82
82
|
bufferEdgeY: number;
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
rowHeaderWidthAndMarginLeft: number;
|
|
84
|
+
columnHeaderHeightAndMarginTop: number;
|
|
85
85
|
scaleX: number;
|
|
86
86
|
scaleY: number;
|
|
87
87
|
}
|