@univerjs/engine-render 0.3.0-alpha.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/index.js
CHANGED
|
@@ -24586,8 +24586,9 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24586
24586
|
border: new ObjectMatrix()
|
|
24587
24587
|
});
|
|
24588
24588
|
/** A matrix to store if a (row, column) position has render cache. */
|
|
24589
|
-
__publicField(this, "
|
|
24590
|
-
__publicField(this, "
|
|
24589
|
+
__publicField(this, "_handleBgMatrix", new ObjectMatrix());
|
|
24590
|
+
__publicField(this, "_handleBorderMatrix", new ObjectMatrix());
|
|
24591
|
+
__publicField(this, "_handleFontMatrix", new ObjectMatrix());
|
|
24591
24592
|
__publicField(this, "_showGridlines", BooleanNumber.TRUE);
|
|
24592
24593
|
__publicField(this, "_marginTop", 0);
|
|
24593
24594
|
__publicField(this, "_marginLeft", 0);
|
|
@@ -24651,7 +24652,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24651
24652
|
font: {},
|
|
24652
24653
|
fontMatrix: new ObjectMatrix(),
|
|
24653
24654
|
border: new ObjectMatrix()
|
|
24654
|
-
}, this.
|
|
24655
|
+
}, this._handleBgMatrix.reset(), this._handleBorderMatrix.reset(), this._overflowCache.reset(), this._worksheetData = null, this._cellData = null, this._styles = null;
|
|
24655
24656
|
}
|
|
24656
24657
|
/**
|
|
24657
24658
|
* @deprecated should never expose a property that is provided by another module!
|
|
@@ -25383,29 +25384,29 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25383
25384
|
font: {},
|
|
25384
25385
|
fontMatrix: new ObjectMatrix(),
|
|
25385
25386
|
border: new ObjectMatrix()
|
|
25386
|
-
}, this.
|
|
25387
|
+
}, this._handleBgMatrix.reset(), this._handleBorderMatrix.reset(), this._overflowCache.reset();
|
|
25387
25388
|
}
|
|
25388
25389
|
_makeDocumentSkeletonDirty(row, col) {
|
|
25389
25390
|
var _a10;
|
|
25390
25391
|
this._stylesCache.fontMatrix != null && ((_a10 = this._stylesCache.fontMatrix.getValue(row, col)) == null || _a10.documentSkeleton.makeDirty(!0));
|
|
25391
25392
|
}
|
|
25392
25393
|
_setBorderStylesCache(row, col, style, options) {
|
|
25393
|
-
if (!(!((options == null ? void 0 : options.cacheItem) || { bg: !0, border: !0 }).border
|
|
25394
|
+
if (!(Tools.isDefine(this._handleBorderMatrix.getValue(row, col)) || !((options == null ? void 0 : options.cacheItem) || { bg: !0, border: !0 }).border) && (this._handleBorderMatrix.setValue(row, col, !0), style && style.bd)) {
|
|
25394
25395
|
const mergeRange = options == null ? void 0 : options.mergeRange;
|
|
25395
25396
|
mergeRange ? (this._setMergeBorderProps(BORDER_TYPE.TOP, this._stylesCache, mergeRange), this._setMergeBorderProps(BORDER_TYPE.BOTTOM, this._stylesCache, mergeRange), this._setMergeBorderProps(BORDER_TYPE.LEFT, this._stylesCache, mergeRange), this._setMergeBorderProps(BORDER_TYPE.RIGHT, this._stylesCache, mergeRange)) : this.intersectMergeRange(row, col) || (this._setBorderProps(row, col, BORDER_TYPE.TOP, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.BOTTOM, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.LEFT, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.RIGHT, style, this._stylesCache)), this._setBorderProps(row, col, BORDER_TYPE.TL_BR, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.TL_BC, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.TL_MR, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.BL_TR, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.ML_TR, style, this._stylesCache), this._setBorderProps(row, col, BORDER_TYPE.BC_TR, style, this._stylesCache);
|
|
25396
25397
|
}
|
|
25397
25398
|
}
|
|
25398
25399
|
_setBgStylesCache(row, col, style, options) {
|
|
25399
25400
|
var _a10;
|
|
25400
|
-
if (!(!((options == null ? void 0 : options.cacheItem) || { bg: !0, border: !0 }).bg
|
|
25401
|
+
if (!(Tools.isDefine(this._handleBgMatrix.getValue(row, col)) || !((options == null ? void 0 : options.cacheItem) || { bg: !0, border: !0 }).bg) && (this._handleBgMatrix.setValue(row, col, !0), style && style.bg && style.bg.rgb)) {
|
|
25401
25402
|
const rgb = style.bg.rgb;
|
|
25402
25403
|
this._stylesCache.background[rgb] || (this._stylesCache.background[rgb] = new ObjectMatrix()), this._stylesCache.background[rgb].setValue(row, col, rgb);
|
|
25403
25404
|
const cellInfo = this.getCellByIndexWithNoHeader(row, col);
|
|
25404
25405
|
(_a10 = this._stylesCache.backgroundPositions) == null || _a10.setValue(row, col, cellInfo);
|
|
25405
25406
|
}
|
|
25406
25407
|
}
|
|
25407
|
-
_setFontStylesCache(
|
|
25408
|
-
if (isNullCell(cell) || this._stylesCache.fontMatrix.getValue(row, col)) return;
|
|
25408
|
+
_setFontStylesCache(row, col, cell) {
|
|
25409
|
+
if (isNullCell(cell) || (this._handleFontMatrix.setValue(row, col, !0), this._stylesCache.fontMatrix.getValue(row, col))) return;
|
|
25409
25410
|
const modelObject = this._getCellDocumentModel(cell, {
|
|
25410
25411
|
displayRawFormula: this._renderRawFormula
|
|
25411
25412
|
});
|
|
@@ -25436,8 +25437,9 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25436
25437
|
_setStylesCache(row, col, options) {
|
|
25437
25438
|
if (row === -1 || col === -1)
|
|
25438
25439
|
return;
|
|
25439
|
-
const
|
|
25440
|
-
if (
|
|
25440
|
+
const handledBgCell = Tools.isDefine(this._handleBgMatrix.getValue(row, col)), handledBorderCell = Tools.isDefine(this._handleBorderMatrix.getValue(row, col));
|
|
25441
|
+
if (handledBgCell && handledBorderCell)
|
|
25442
|
+
return;
|
|
25441
25443
|
options || (options = { cacheItem: { bg: !0, border: !0 } });
|
|
25442
25444
|
const { isMerged, isMergedMainCell, startRow, startColumn, endRow, endColumn } = this._getCellMergeInfo(row, col);
|
|
25443
25445
|
if (options && (options.mergeRange = { startRow, startColumn, endRow, endColumn }), this.worksheet.getColVisible(col) === !1 || this.worksheet.getRowVisible(row) === !1) {
|
|
@@ -25446,8 +25448,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25446
25448
|
if (!isMergedMainCell)
|
|
25447
25449
|
return;
|
|
25448
25450
|
}
|
|
25449
|
-
const style = this._styles.getStyleByCell(cell);
|
|
25450
|
-
this._setBgStylesCache(row, col, style, options), this._setBorderStylesCache(row, col, style, options), this._setFontStylesCache(
|
|
25451
|
+
const cell = this.worksheet.getCell(row, col) || this.worksheet.getCellRaw(row, col), style = this._styles.getStyleByCell(cell);
|
|
25452
|
+
this._setBgStylesCache(row, col, style, options), this._setBorderStylesCache(row, col, style, options), this._setFontStylesCache(row, col, cell);
|
|
25451
25453
|
}
|
|
25452
25454
|
_updateConfigAndGetDocumentModel(documentData, horizontalAlign, paddingData, renderConfig) {
|
|
25453
25455
|
var _a10, _b, _c, _d, _e;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DocumentSkeleton } from '../docs/layout/doc-skeleton';
|
|
3
|
-
import { Skeleton } from '../skeleton';
|
|
1
|
+
import { ICellData, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, IRowRange, ISelectionCellWithMergeInfo, ISize, IStyleData, ITextRotation, IWorksheetData, Nullable, Styles, Worksheet, BooleanNumber, DocumentDataModel, HorizontalAlign, IContextService, LocaleService, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
4
2
|
import { IBoundRectNoAngle, IViewportInfo } from '../../basics/vector2';
|
|
5
3
|
import { IFontCacheItem, IStylesCache } from './interfaces';
|
|
4
|
+
import { DocumentSkeleton } from '../docs/layout/doc-skeleton';
|
|
5
|
+
import { Skeleton } from '../skeleton';
|
|
6
6
|
/**
|
|
7
7
|
* Obtain the height and width of a cell's text, taking into account scenarios with rotated text.
|
|
8
8
|
* @param documentSkeleton Data of the document's ViewModel
|
|
@@ -55,8 +55,9 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
55
55
|
private _overflowCache;
|
|
56
56
|
private _stylesCache;
|
|
57
57
|
/** A matrix to store if a (row, column) position has render cache. */
|
|
58
|
-
private
|
|
59
|
-
private
|
|
58
|
+
private _handleBgMatrix;
|
|
59
|
+
private _handleBorderMatrix;
|
|
60
|
+
private _handleFontMatrix;
|
|
60
61
|
private _showGridlines;
|
|
61
62
|
private _marginTop;
|
|
62
63
|
private _marginLeft;
|
|
@@ -265,7 +266,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
265
266
|
mergeRange?: IRange;
|
|
266
267
|
cacheItem?: ICacheItem;
|
|
267
268
|
} | undefined): void;
|
|
268
|
-
_setFontStylesCache(
|
|
269
|
+
_setFontStylesCache(row: number, col: number, cell: Nullable<ICellData>): void;
|
|
269
270
|
/**
|
|
270
271
|
* Set border background and font to this._stylesCache
|
|
271
272
|
* @param row {number}
|