@univerjs/engine-render 0.4.1 → 0.4.2
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 +1 -1
- package/lib/es/index.js +355 -175
- package/lib/types/base-object.d.ts +6 -5
- package/lib/types/basics/const.d.ts +1 -0
- package/lib/types/components/docs/document.d.ts +0 -2
- package/lib/types/components/sheets/column-header.d.ts +1 -1
- package/lib/types/components/sheets/constants.d.ts +3 -15
- package/lib/types/components/sheets/extensions/row-header-layout.d.ts +1 -1
- package/lib/types/components/sheets/row-header.d.ts +1 -1
- package/lib/types/components/sheets/sheet-component.d.ts +1 -1
- package/lib/types/components/sheets/sheet-skeleton.d.ts +46 -11
- package/lib/types/components/sheets/spreadsheet.d.ts +1 -6
- package/lib/types/context.d.ts +14 -29
- package/lib/types/index.d.ts +2 -1
- package/lib/types/layer.d.ts +2 -2
- package/lib/types/scene.transformer.d.ts +6 -1
- package/lib/types/services/render-config.d.ts +18 -0
- package/lib/types/services/render-config.service.d.ts +26 -0
- package/lib/types/shape/rect.d.ts +1 -0
- package/lib/types/shape/shape.d.ts +1 -0
- package/lib/types/viewport.d.ts +2 -0
- package/lib/umd/index.js +1 -1
- package/package.json +3 -3
- package/lib/types/{render-engine.d.ts → plugin.d.ts} +1 -1
package/lib/es/index.js
CHANGED
|
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, Range, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, mergeWith, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, getColorStyle, isWhiteColor, IContextService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, TextDecoration, COLORS,
|
|
6
|
-
import { BehaviorSubject, Subject, startWith, distinctUntilChanged, Subscription, Observable, shareReplay } from "rxjs";
|
|
5
|
+
import { Tools, DEFAULT_STYLES, FontStyleType, BaselineOffset, getCellInfoInMergeData, Rectangle, ColorKit, Disposable, EventSubject, checkParagraphHasIndentByStyle, DataStreamTreeTokenType, BorderStyleTypes, BooleanNumber, DisposableCollection, toDisposable, sortRules, Registry, Range, numberToABC, Inject, LocaleService, insertTextToContent, horizontalLineSegmentsSubtraction, deleteContent, DataStreamTreeNodeType, DocumentDataModel, GridType, BulletAlignment, PositionedObjectLayoutType, WrapTextType, ColumnSeparatorType, TableAlignmentType, ObjectRelativeFromV, TableTextWrapType, SpacingRule, CustomDecorationType, CustomRangeType, ObjectMatrix, SectionType, NumberUnitType, DocumentFlavor, PageOrientType, HorizontalAlign, VerticalAlign, WrapStrategy, AlignTypeH, ObjectRelativeFromH, AlignTypeV, mergeWith, GlyphType as GlyphType$1, numberToListABC, PRESET_LIST_TYPE, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, searchArray, extractPureTextFromCell, CellValueType, isCellCoverable, isNullCell, composeStyles, getColorStyle, isWhiteColor, IContextService, IConfigService, BuildTextUtils, TextX, DEFAULT_EMPTY_DOCUMENT_VALUE, TextDecoration, COLORS, requestImmediateMacroTask, MOVE_BUFFER_VALUE, sortRulesByDesc, Injector, isClassDependencyItem, createIdentifier, remove, UniverInstanceType, IUniverInstanceService, Plugin, registerDependencies } from "@univerjs/core";
|
|
6
|
+
import { BehaviorSubject, Subject, startWith, distinctUntilChanged, Subscription, debounceTime, Observable, shareReplay } from "rxjs";
|
|
7
7
|
var SHAPE_TYPE = /* @__PURE__ */ ((SHAPE_TYPE2) => (SHAPE_TYPE2.RECT = "rect", SHAPE_TYPE2.CIRCLE = "circle", SHAPE_TYPE2.PATH = "path", SHAPE_TYPE2))(SHAPE_TYPE || {}), LINK_VIEW_PORT_TYPE = /* @__PURE__ */ ((LINK_VIEW_PORT_TYPE2) => (LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.XY = 0] = "XY", LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.X = 1] = "X", LINK_VIEW_PORT_TYPE2[LINK_VIEW_PORT_TYPE2.Y = 2] = "Y", LINK_VIEW_PORT_TYPE2))(LINK_VIEW_PORT_TYPE || {});
|
|
8
8
|
const MIDDLE_CELL_POS_MAGIC_NUMBER = 1, DEFAULT_FONTFACE_PLANE = '"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif', DEFAULT_SKELETON_HEADER_FOOTER = {
|
|
9
9
|
lines: [],
|
|
@@ -22,7 +22,7 @@ const MIDDLE_CELL_POS_MAGIC_NUMBER = 1, DEFAULT_FONTFACE_PLANE = '"Helvetica Neu
|
|
|
22
22
|
var CURSOR_TYPE = /* @__PURE__ */ ((CURSOR_TYPE2) => (CURSOR_TYPE2.DEFAULT = "default", CURSOR_TYPE2.AUTO = "auto", CURSOR_TYPE2.CROSSHAIR = "crosshair", CURSOR_TYPE2.POINTER = "pointer", CURSOR_TYPE2.MOVE = "move", CURSOR_TYPE2.EAST_RESIZE = "e-resize", CURSOR_TYPE2.NORTH_EAST_RESIZE = "ne-resize", CURSOR_TYPE2.NORTH_WEST_RESIZE = "nw-resize", CURSOR_TYPE2.NORTH_RESIZE = "n-resize", CURSOR_TYPE2.SOUTH_EAST_RESIZE = "se-resize", CURSOR_TYPE2.SOUTH_WEST_RESIZE = "sw-resize", CURSOR_TYPE2.SOUTH_RESIZE = "s-resize", CURSOR_TYPE2.WEST_RESIZE = "w-resize", CURSOR_TYPE2.TEXT = "text", CURSOR_TYPE2.WAIT = "wait", CURSOR_TYPE2.HELP = "help", CURSOR_TYPE2.CELL = "cell", CURSOR_TYPE2.NONE = "none", CURSOR_TYPE2.VERTICAL_TEXT = "vertical-text", CURSOR_TYPE2.NO_DROP = "no-drop", CURSOR_TYPE2.GRAB = "grab", CURSOR_TYPE2.GRABBING = "grabbing", CURSOR_TYPE2.ALL_SCROLL = "all-scroll", CURSOR_TYPE2.COLUMN_RESIZE = "col-resize", CURSOR_TYPE2.ROW_RESIZE = "row-resize", CURSOR_TYPE2.PROGRESS = "progress", CURSOR_TYPE2.NOT_ALLOWED = "not-allowed", CURSOR_TYPE2.ZOOM_IN = "zoom-in", CURSOR_TYPE2.ZOOM_OUT = "zoom-out", CURSOR_TYPE2))(CURSOR_TYPE || {}), DOCUMENT_CONTEXT_CLIP_TYPE = /* @__PURE__ */ ((DOCUMENT_CONTEXT_CLIP_TYPE2) => (DOCUMENT_CONTEXT_CLIP_TYPE2[DOCUMENT_CONTEXT_CLIP_TYPE2.noClip = 0] = "noClip", DOCUMENT_CONTEXT_CLIP_TYPE2[DOCUMENT_CONTEXT_CLIP_TYPE2.DOC_SIZE = 1] = "DOC_SIZE", DOCUMENT_CONTEXT_CLIP_TYPE2[DOCUMENT_CONTEXT_CLIP_TYPE2.CONTENT_SIZE_LEFT = 2] = "CONTENT_SIZE_LEFT", DOCUMENT_CONTEXT_CLIP_TYPE2[DOCUMENT_CONTEXT_CLIP_TYPE2.CONTENT_SIZE_CENTER = 3] = "CONTENT_SIZE_CENTER", DOCUMENT_CONTEXT_CLIP_TYPE2[DOCUMENT_CONTEXT_CLIP_TYPE2.CONTENT_SIZE_Right = 4] = "CONTENT_SIZE_Right", DOCUMENT_CONTEXT_CLIP_TYPE2))(DOCUMENT_CONTEXT_CLIP_TYPE || {});
|
|
23
23
|
const COLOR_BLACK_RGB = "rgb(0,0,0)";
|
|
24
24
|
var BORDER_TYPE = /* @__PURE__ */ ((BORDER_TYPE2) => (BORDER_TYPE2.TOP = "t", BORDER_TYPE2.BOTTOM = "b", BORDER_TYPE2.LEFT = "l", BORDER_TYPE2.RIGHT = "r", BORDER_TYPE2.TL_BR = "tl_br", BORDER_TYPE2.TL_BC = "tl_bc", BORDER_TYPE2.TL_MR = "tl_mr", BORDER_TYPE2.BL_TR = "bl_tr", BORDER_TYPE2.ML_TR = "ml_tr", BORDER_TYPE2.BC_TR = "bc_tr", BORDER_TYPE2))(BORDER_TYPE || {}), ORIENTATION_TYPE = /* @__PURE__ */ ((ORIENTATION_TYPE2) => (ORIENTATION_TYPE2[ORIENTATION_TYPE2.UP = 0] = "UP", ORIENTATION_TYPE2[ORIENTATION_TYPE2.DOWN = 1] = "DOWN", ORIENTATION_TYPE2))(ORIENTATION_TYPE || {}), RENDER_CLASS_TYPE = /* @__PURE__ */ ((RENDER_CLASS_TYPE2) => (RENDER_CLASS_TYPE2.ENGINE = "Engine", RENDER_CLASS_TYPE2.SCENE = "Scene", RENDER_CLASS_TYPE2.BASE_OBJECT = "BaseObject", RENDER_CLASS_TYPE2.SCENE_VIEWER = "SceneViewer", RENDER_CLASS_TYPE2.CANVAS = "Canvas", RENDER_CLASS_TYPE2.VIEWPORT = "Viewport", RENDER_CLASS_TYPE2.LAYER = "Layer", RENDER_CLASS_TYPE2.GROUP = "Group", RENDER_CLASS_TYPE2.IMAGE = "Image", RENDER_CLASS_TYPE2.SHAPE = "Shape", RENDER_CLASS_TYPE2.TEXT = "Text", RENDER_CLASS_TYPE2))(RENDER_CLASS_TYPE || {});
|
|
25
|
-
const MAXIMUM_ROW_HEIGHT = 2e3, FIX_ONE_PIXEL_BLUR_OFFSET = 0.5, DRAWING_OBJECT_LOWER_LAYER_INDEX = 3, DRAWING_OBJECT_LAYER_INDEX = 4, DRAWING_OBJECT_UPPER_LAYER_INDEX = 5;
|
|
25
|
+
const MAXIMUM_ROW_HEIGHT = 2e3, MAXIMUM_COL_WIDTH = 2e3, FIX_ONE_PIXEL_BLUR_OFFSET = 0.5, DRAWING_OBJECT_LOWER_LAYER_INDEX = 3, DRAWING_OBJECT_LAYER_INDEX = 4, DRAWING_OBJECT_UPPER_LAYER_INDEX = 5;
|
|
26
26
|
var TRANSFORM_CHANGE_OBSERVABLE_TYPE = /* @__PURE__ */ ((TRANSFORM_CHANGE_OBSERVABLE_TYPE2) => (TRANSFORM_CHANGE_OBSERVABLE_TYPE2[TRANSFORM_CHANGE_OBSERVABLE_TYPE2.translate = 0] = "translate", TRANSFORM_CHANGE_OBSERVABLE_TYPE2[TRANSFORM_CHANGE_OBSERVABLE_TYPE2.resize = 1] = "resize", TRANSFORM_CHANGE_OBSERVABLE_TYPE2[TRANSFORM_CHANGE_OBSERVABLE_TYPE2.scale = 2] = "scale", TRANSFORM_CHANGE_OBSERVABLE_TYPE2[TRANSFORM_CHANGE_OBSERVABLE_TYPE2.skew = 3] = "skew", TRANSFORM_CHANGE_OBSERVABLE_TYPE2[TRANSFORM_CHANGE_OBSERVABLE_TYPE2.flip = 4] = "flip", TRANSFORM_CHANGE_OBSERVABLE_TYPE2[TRANSFORM_CHANGE_OBSERVABLE_TYPE2.all = 5] = "all", TRANSFORM_CHANGE_OBSERVABLE_TYPE2))(TRANSFORM_CHANGE_OBSERVABLE_TYPE || {});
|
|
27
27
|
const _Base = class _Base {
|
|
28
28
|
isEmpty() {
|
|
@@ -2593,7 +2593,7 @@ const BASE_OBJECT_ARRAY = [
|
|
|
2593
2593
|
"flipY",
|
|
2594
2594
|
"strokeWidth"
|
|
2595
2595
|
];
|
|
2596
|
-
var ObjectType = /* @__PURE__ */ ((ObjectType2) => (ObjectType2[ObjectType2.UNKNOWN = 0] = "UNKNOWN", ObjectType2[ObjectType2.RICH_TEXT = 1] = "RICH_TEXT", ObjectType2[ObjectType2.SHAPE = 2] = "SHAPE", ObjectType2[ObjectType2.IMAGE = 3] = "IMAGE", ObjectType2[ObjectType2.RECT = 4] = "RECT", ObjectType2[ObjectType2.CIRCLE = 5] = "CIRCLE", ObjectType2))(ObjectType || {});
|
|
2596
|
+
var ObjectType = /* @__PURE__ */ ((ObjectType2) => (ObjectType2[ObjectType2.UNKNOWN = 0] = "UNKNOWN", ObjectType2[ObjectType2.RICH_TEXT = 1] = "RICH_TEXT", ObjectType2[ObjectType2.SHAPE = 2] = "SHAPE", ObjectType2[ObjectType2.IMAGE = 3] = "IMAGE", ObjectType2[ObjectType2.RECT = 4] = "RECT", ObjectType2[ObjectType2.CIRCLE = 5] = "CIRCLE", ObjectType2[ObjectType2.CHART = 6] = "CHART", ObjectType2))(ObjectType || {});
|
|
2597
2597
|
const _BaseObject = class _BaseObject extends Disposable {
|
|
2598
2598
|
// TODO: @DR-Univer. Belong to layer
|
|
2599
2599
|
constructor(key) {
|
|
@@ -3625,14 +3625,20 @@ __name(getOffsetRectForDom, "getOffsetRectForDom");
|
|
|
3625
3625
|
const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
3626
3626
|
constructor(context) {
|
|
3627
3627
|
__publicField(this, "__mode", "rendering");
|
|
3628
|
-
__publicField(this, "_system");
|
|
3629
|
-
__publicField(this, "_browser");
|
|
3630
3628
|
__publicField(this, "_transformCache");
|
|
3631
3629
|
__publicField(this, "canvas");
|
|
3632
3630
|
__publicField(this, "_context");
|
|
3633
3631
|
__publicField(this, "_systemType");
|
|
3634
3632
|
__publicField(this, "_browserType");
|
|
3635
|
-
this
|
|
3633
|
+
__publicField(this, "renderConfig", {});
|
|
3634
|
+
__publicField(this, "_id");
|
|
3635
|
+
this.canvas = context.canvas, this._context = context;
|
|
3636
|
+
}
|
|
3637
|
+
getId() {
|
|
3638
|
+
return this._id;
|
|
3639
|
+
}
|
|
3640
|
+
setId(id) {
|
|
3641
|
+
this._id = id;
|
|
3636
3642
|
}
|
|
3637
3643
|
isContextLost() {
|
|
3638
3644
|
return this._context.isContextLost();
|
|
@@ -3823,11 +3829,15 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
3823
3829
|
set textBaseline(val) {
|
|
3824
3830
|
this._context.textBaseline = val;
|
|
3825
3831
|
}
|
|
3832
|
+
/**
|
|
3833
|
+
* Get scale from ctx.
|
|
3834
|
+
* DOMMatrix.a DOMMatrix.d would affect by ctx.rotate()
|
|
3835
|
+
*/
|
|
3826
3836
|
_getScale() {
|
|
3827
|
-
const
|
|
3828
|
-
return
|
|
3829
|
-
scaleX
|
|
3830
|
-
scaleY
|
|
3837
|
+
const transform = this.getTransform(), { a, b, c, d } = transform, scaleX = Math.sqrt(a * a + b * b), scaleY = Math.sqrt(c * c + d * d);
|
|
3838
|
+
return {
|
|
3839
|
+
scaleX,
|
|
3840
|
+
scaleY
|
|
3831
3841
|
};
|
|
3832
3842
|
}
|
|
3833
3843
|
getScale() {
|
|
@@ -3850,7 +3860,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
3850
3860
|
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), w = fixLineWidthByScale(w, scaleX), h = fixLineWidthByScale(h, scaleY), this.roundRect(x, y, w, h, radii);
|
|
3851
3861
|
}
|
|
3852
3862
|
getTransform() {
|
|
3853
|
-
return this._context.getTransform();
|
|
3863
|
+
return this._transformCache || this._context.getTransform();
|
|
3854
3864
|
}
|
|
3855
3865
|
resetTransform() {
|
|
3856
3866
|
this._transformCache = null, this._context.resetTransform();
|
|
@@ -4089,6 +4099,10 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4089
4099
|
const { scaleX, scaleY } = this._getScale();
|
|
4090
4100
|
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this.moveTo(x, y);
|
|
4091
4101
|
}
|
|
4102
|
+
moveToByPrecisionLog(x, y) {
|
|
4103
|
+
const { scaleX, scaleY } = this._getScale(), afterX = fixLineWidthByScale(x, scaleX), afterY = fixLineWidthByScale(y, scaleY);
|
|
4104
|
+
this.moveTo(afterX, afterY);
|
|
4105
|
+
}
|
|
4092
4106
|
/**
|
|
4093
4107
|
* rect function.
|
|
4094
4108
|
* @method
|
|
@@ -4130,7 +4144,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4130
4144
|
* @method
|
|
4131
4145
|
*/
|
|
4132
4146
|
rotate(angle) {
|
|
4133
|
-
this._context.rotate(angle);
|
|
4147
|
+
this._transformCache = null, this._context.rotate(angle);
|
|
4134
4148
|
}
|
|
4135
4149
|
/**
|
|
4136
4150
|
* save function.
|
|
@@ -4144,7 +4158,7 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4144
4158
|
* @method
|
|
4145
4159
|
*/
|
|
4146
4160
|
scale(x, y) {
|
|
4147
|
-
this._context.scale(x, y);
|
|
4161
|
+
this._transformCache = null, this._context.scale(x, y);
|
|
4148
4162
|
}
|
|
4149
4163
|
/**
|
|
4150
4164
|
* setLineDash function.
|
|
@@ -4190,20 +4204,21 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4190
4204
|
* @method
|
|
4191
4205
|
*/
|
|
4192
4206
|
transform(a, b, c, d, e, f) {
|
|
4193
|
-
this._context.transform(a, b, c, d, e, f)
|
|
4207
|
+
this._transformCache = null, this._context.transform(a, b, c, d, e, f);
|
|
4194
4208
|
}
|
|
4195
4209
|
/**
|
|
4196
4210
|
* translate function.
|
|
4197
4211
|
* @method
|
|
4198
4212
|
*/
|
|
4199
4213
|
translate(x, y) {
|
|
4200
|
-
this._context.translate(x, y);
|
|
4214
|
+
this._transformCache = null, this._context.translate(x, y);
|
|
4201
4215
|
}
|
|
4202
4216
|
translateWithPrecision(x, y) {
|
|
4203
4217
|
const { scaleX, scaleY } = this._getScale();
|
|
4204
|
-
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this._context.translate(x, y);
|
|
4218
|
+
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), this._transformCache = null, this._context.translate(x, y);
|
|
4205
4219
|
}
|
|
4206
4220
|
translateWithPrecisionRatio(x, y) {
|
|
4221
|
+
this._transformCache = null;
|
|
4207
4222
|
const { scaleX, scaleY } = this._getScale();
|
|
4208
4223
|
this._context.translate(x / scaleX, y / scaleY);
|
|
4209
4224
|
}
|
|
@@ -4216,14 +4231,6 @@ const _UniverRenderingContext2D = class _UniverRenderingContext2D {
|
|
|
4216
4231
|
};
|
|
4217
4232
|
__name(_UniverRenderingContext2D, "UniverRenderingContext2D");
|
|
4218
4233
|
let UniverRenderingContext2D = _UniverRenderingContext2D;
|
|
4219
|
-
const _UniverRenderingContextWebGL = class _UniverRenderingContextWebGL {
|
|
4220
|
-
};
|
|
4221
|
-
__name(_UniverRenderingContextWebGL, "UniverRenderingContextWebGL");
|
|
4222
|
-
let UniverRenderingContextWebGL = _UniverRenderingContextWebGL;
|
|
4223
|
-
const _UniverRenderingContextWebGPU = class _UniverRenderingContextWebGPU {
|
|
4224
|
-
};
|
|
4225
|
-
__name(_UniverRenderingContextWebGPU, "UniverRenderingContextWebGPU");
|
|
4226
|
-
let UniverRenderingContextWebGPU = _UniverRenderingContextWebGPU;
|
|
4227
4234
|
const _UniverRenderingContext = class _UniverRenderingContext extends UniverRenderingContext2D {
|
|
4228
4235
|
};
|
|
4229
4236
|
__name(_UniverRenderingContext, "UniverRenderingContext");
|
|
@@ -4233,15 +4240,8 @@ const _UniverPrintingContext = class _UniverPrintingContext extends UniverRender
|
|
|
4233
4240
|
super(...arguments);
|
|
4234
4241
|
__publicField(this, "__mode", "printing");
|
|
4235
4242
|
}
|
|
4236
|
-
__getScale() {
|
|
4237
|
-
const m = this.getTransform();
|
|
4238
|
-
return {
|
|
4239
|
-
scaleX: m.a,
|
|
4240
|
-
scaleY: m.d
|
|
4241
|
-
};
|
|
4242
|
-
}
|
|
4243
4243
|
clearRect(x, y, width, height) {
|
|
4244
|
-
const { scaleX, scaleY } = this.
|
|
4244
|
+
const { scaleX, scaleY } = this._getScale();
|
|
4245
4245
|
x = fixLineWidthByScale(x, scaleX), y = fixLineWidthByScale(y, scaleY), width = fixLineWidthByScale(width, scaleX), height = fixLineWidthByScale(height, scaleY), this._context.save(), this._context.fillStyle = getColor([255, 255, 255]), this._context.fillRect(x, y, width, height), this._context.restore();
|
|
4246
4246
|
}
|
|
4247
4247
|
clearRectForTexture(x, y, width, height) {
|
|
@@ -4470,7 +4470,7 @@ const _SpreadsheetColumnHeader = class _SpreadsheetColumnHeader extends Spreadsh
|
|
|
4470
4470
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
4471
4471
|
if (!spreadsheetSkeleton) return;
|
|
4472
4472
|
const parentScale = this.getParentScale();
|
|
4473
|
-
spreadsheetSkeleton.
|
|
4473
|
+
spreadsheetSkeleton.updateVisibleRange(bounds);
|
|
4474
4474
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
4475
4475
|
if (!segment || segment.startColumn === -1 && segment.endColumn === -1) return;
|
|
4476
4476
|
const { rowHeaderWidth } = spreadsheetSkeleton;
|
|
@@ -4918,7 +4918,8 @@ const UNIQUE_KEY$7 = "DefaultCustomExtension", Z_INDEX$1 = 55, stringifyRange$1
|
|
|
4918
4918
|
__name(_Custom, "Custom");
|
|
4919
4919
|
let Custom = _Custom;
|
|
4920
4920
|
SpreadsheetExtensionRegistry.add(Custom);
|
|
4921
|
-
|
|
4921
|
+
var ShowGridlinesState = /* @__PURE__ */ ((ShowGridlinesState2) => (ShowGridlinesState2[ShowGridlinesState2.OFF = 0] = "OFF", ShowGridlinesState2[ShowGridlinesState2.ON = 1] = "ON", ShowGridlinesState2))(ShowGridlinesState || {}), SHEET_VIEWPORT_KEY = /* @__PURE__ */ ((SHEET_VIEWPORT_KEY2) => (SHEET_VIEWPORT_KEY2.VIEW_MAIN = "viewMain", SHEET_VIEWPORT_KEY2.VIEW_MAIN_LEFT_TOP = "viewMainLeftTop", SHEET_VIEWPORT_KEY2.VIEW_MAIN_TOP = "viewMainTop", SHEET_VIEWPORT_KEY2.VIEW_MAIN_LEFT = "viewMainLeft", SHEET_VIEWPORT_KEY2.VIEW_ROW_TOP = "viewRowTop", SHEET_VIEWPORT_KEY2.VIEW_ROW_BOTTOM = "viewRowBottom", SHEET_VIEWPORT_KEY2.VIEW_COLUMN_LEFT = "viewColumnLeft", SHEET_VIEWPORT_KEY2.VIEW_COLUMN_RIGHT = "viewColumnRight", SHEET_VIEWPORT_KEY2.VIEW_LEFT_TOP = "viewLeftTop", SHEET_VIEWPORT_KEY2))(SHEET_VIEWPORT_KEY || {});
|
|
4922
|
+
const FONT_EXTENSION_Z_INDEX = 45, EXPAND_SIZE_FOR_RENDER_OVERFLOW = 20, sheetContentViewportKeys = [SHEET_VIEWPORT_KEY.VIEW_MAIN, SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP, SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP, SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT], sheetHeaderViewportKeys = [SHEET_VIEWPORT_KEY.VIEW_ROW_TOP, SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM, SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT, SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT, SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP];
|
|
4922
4923
|
var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
4923
4924
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
4924
4925
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -7321,10 +7322,46 @@ const DEFAULT_SECTION_BREAK = {
|
|
|
7321
7322
|
columnSeparatorType: ColumnSeparatorType.NONE,
|
|
7322
7323
|
sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,
|
|
7323
7324
|
startIndex: 0
|
|
7324
|
-
}, DEFAULT_PAGE_SIZE = { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY }
|
|
7325
|
+
}, DEFAULT_PAGE_SIZE = { width: Number.POSITIVE_INFINITY, height: Number.POSITIVE_INFINITY }, DEFAULT_MODERN_DOCUMENT_STYLE = {
|
|
7326
|
+
pageNumberStart: 1,
|
|
7327
|
+
pageSize: {
|
|
7328
|
+
width: ptToPixel(595),
|
|
7329
|
+
height: Number.POSITIVE_INFINITY
|
|
7330
|
+
},
|
|
7331
|
+
marginTop: ptToPixel(50),
|
|
7332
|
+
marginBottom: ptToPixel(50),
|
|
7333
|
+
marginRight: ptToPixel(50),
|
|
7334
|
+
marginLeft: ptToPixel(50),
|
|
7335
|
+
renderConfig: {
|
|
7336
|
+
vertexAngle: 0,
|
|
7337
|
+
centerAngle: 0,
|
|
7338
|
+
background: {
|
|
7339
|
+
rgb: "#FFFFFF"
|
|
7340
|
+
}
|
|
7341
|
+
},
|
|
7342
|
+
defaultHeaderId: "",
|
|
7343
|
+
defaultFooterId: "",
|
|
7344
|
+
evenPageHeaderId: "",
|
|
7345
|
+
evenPageFooterId: "",
|
|
7346
|
+
firstPageHeaderId: "",
|
|
7347
|
+
firstPageFooterId: "",
|
|
7348
|
+
evenAndOddHeaders: BooleanNumber.FALSE,
|
|
7349
|
+
useFirstPageHeaderFooter: BooleanNumber.FALSE,
|
|
7350
|
+
marginHeader: 0,
|
|
7351
|
+
marginFooter: 0
|
|
7352
|
+
}, DEFAULT_MODERN_SECTION_BREAK = {
|
|
7353
|
+
columnProperties: [],
|
|
7354
|
+
columnSeparatorType: ColumnSeparatorType.NONE,
|
|
7355
|
+
sectionType: SectionType.SECTION_TYPE_UNSPECIFIED
|
|
7356
|
+
};
|
|
7325
7357
|
function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
7326
7358
|
var _a10;
|
|
7327
|
-
const { viewModel, dataModel, docsConfig } = ctx, sectionNode = viewModel.children[nodeIndex]
|
|
7359
|
+
const { viewModel, dataModel, docsConfig } = ctx, sectionNode = viewModel.children[nodeIndex];
|
|
7360
|
+
let { documentStyle } = dataModel;
|
|
7361
|
+
const { documentFlavor } = documentStyle;
|
|
7362
|
+
let sectionBreak = viewModel.getSectionBreak(sectionNode.endIndex) || DEFAULT_SECTION_BREAK;
|
|
7363
|
+
documentFlavor === DocumentFlavor.MODERN && (sectionBreak = Object.assign({}, sectionBreak, DEFAULT_MODERN_SECTION_BREAK), documentStyle = Object.assign({}, documentStyle, DEFAULT_MODERN_DOCUMENT_STYLE));
|
|
7364
|
+
const {
|
|
7328
7365
|
pageNumberStart: global_pageNumberStart = 1,
|
|
7329
7366
|
// pageNumberStart
|
|
7330
7367
|
pageSize: global_pageSize = DEFAULT_PAGE_SIZE,
|
|
@@ -13826,7 +13863,13 @@ function compareFontInfoDistance(a, b) {
|
|
|
13826
13863
|
__name(compareFontInfoDistance, "compareFontInfoDistance");
|
|
13827
13864
|
async function checkLocalFontsPermission() {
|
|
13828
13865
|
var _a10;
|
|
13829
|
-
|
|
13866
|
+
if (typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope || typeof window > "u" || window.navigator == null || ((_a10 = window.navigator) == null ? void 0 : _a10.permissions) == null)
|
|
13867
|
+
return !1;
|
|
13868
|
+
try {
|
|
13869
|
+
return (await window.navigator.permissions.query({ name: "local-fonts" })).state === "granted";
|
|
13870
|
+
} catch {
|
|
13871
|
+
return !1;
|
|
13872
|
+
}
|
|
13830
13873
|
}
|
|
13831
13874
|
__name(checkLocalFontsPermission, "checkLocalFontsPermission");
|
|
13832
13875
|
const _FontLibrary = class _FontLibrary {
|
|
@@ -24658,7 +24701,8 @@ const DEFAULT_CELL_DOCUMENT_MODEL_OPTION = {
|
|
|
24658
24701
|
}, RENDER_RAW_FORMULA_KEY = "RENDER_RAW_FORMULA";
|
|
24659
24702
|
var _a6;
|
|
24660
24703
|
let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
24661
|
-
constructor(worksheet, _worksheetData, _cellData, _styles, _localeService, _contextService) {
|
|
24704
|
+
constructor(worksheet, _worksheetData, _cellData, _styles, _localeService, _contextService, _configService) {
|
|
24705
|
+
var _a10;
|
|
24662
24706
|
super(_localeService);
|
|
24663
24707
|
__publicField(this, "_rowHeightAccumulation", []);
|
|
24664
24708
|
__publicField(this, "_columnWidthAccumulation", []);
|
|
@@ -24667,7 +24711,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24667
24711
|
__publicField(this, "_rowHeaderWidth", 0);
|
|
24668
24712
|
__publicField(this, "_columnHeaderHeight", 0);
|
|
24669
24713
|
/**
|
|
24670
|
-
* Range
|
|
24714
|
+
* Range viewBounds. only update by viewBounds.
|
|
24715
|
+
* It would change multiple times in one frame if there is multiple viewport (after freeze row&col)
|
|
24671
24716
|
*/
|
|
24672
24717
|
__publicField(this, "_visibleRange", {
|
|
24673
24718
|
startRow: -1,
|
|
@@ -24675,6 +24720,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24675
24720
|
startColumn: -1,
|
|
24676
24721
|
endColumn: -1
|
|
24677
24722
|
});
|
|
24723
|
+
__publicField(this, "_visibleRangeMap", /* @__PURE__ */ new Map());
|
|
24678
24724
|
// private _dataMergeCache: IRange[] = [];
|
|
24679
24725
|
__publicField(this, "_overflowCache", new ObjectMatrix());
|
|
24680
24726
|
__publicField(this, "_stylesCache", {
|
|
@@ -24691,8 +24737,12 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24691
24737
|
__publicField(this, "_showGridlines", BooleanNumber.TRUE);
|
|
24692
24738
|
__publicField(this, "_marginTop", 0);
|
|
24693
24739
|
__publicField(this, "_marginLeft", 0);
|
|
24740
|
+
/**
|
|
24741
|
+
* Whether the row style precedes the column style.
|
|
24742
|
+
*/
|
|
24743
|
+
__publicField(this, "_isRowStylePrecedeColumnStyle", !1);
|
|
24694
24744
|
__publicField(this, "_renderRawFormula", !1);
|
|
24695
|
-
this.worksheet = worksheet, this._worksheetData = _worksheetData, this._cellData = _cellData, this._styles = _styles, this._contextService = _contextService, this._updateLayout(), this._initContextListener();
|
|
24745
|
+
this.worksheet = worksheet, this._worksheetData = _worksheetData, this._cellData = _cellData, this._styles = _styles, this._contextService = _contextService, this._configService = _configService, this._updateLayout(), this._initContextListener(), this._isRowStylePrecedeColumnStyle = (_a10 = this._configService.getConfig(IS_ROW_STYLE_PRECEDE_COLUMN_STYLE)) != null ? _a10 : !1;
|
|
24696
24746
|
}
|
|
24697
24747
|
get rowHeightAccumulation() {
|
|
24698
24748
|
return this._rowHeightAccumulation;
|
|
@@ -24718,8 +24768,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24718
24768
|
get rowColumnSegment() {
|
|
24719
24769
|
return this._visibleRange;
|
|
24720
24770
|
}
|
|
24721
|
-
|
|
24722
|
-
return this.
|
|
24771
|
+
visibleRangeByViewportKey(viewportKey) {
|
|
24772
|
+
return this._visibleRangeMap.get(viewportKey);
|
|
24723
24773
|
}
|
|
24724
24774
|
// get dataMergeCache(): IRange[] {
|
|
24725
24775
|
// return this._dataMergeCache;
|
|
@@ -24800,16 +24850,61 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24800
24850
|
* @param bounds
|
|
24801
24851
|
* @returns boolean
|
|
24802
24852
|
*/
|
|
24803
|
-
|
|
24804
|
-
|
|
24853
|
+
updateVisibleRange(bounds) {
|
|
24854
|
+
if (!this._worksheetData || (this._updateLayout(), !this._rowHeightAccumulation || !this._columnWidthAccumulation))
|
|
24855
|
+
return !1;
|
|
24856
|
+
if (bounds != null) {
|
|
24857
|
+
const range = this.getRowColumnSegment(bounds);
|
|
24858
|
+
this._visibleRange = range, this._visibleRangeMap.set(bounds.viewportKey, range);
|
|
24859
|
+
}
|
|
24860
|
+
return !0;
|
|
24805
24861
|
}
|
|
24806
|
-
|
|
24807
|
-
|
|
24808
|
-
|
|
24862
|
+
/**
|
|
24863
|
+
* Set border background and font to this._stylesCache by visible range, which derives from bounds)
|
|
24864
|
+
* @param bounds viewBounds
|
|
24865
|
+
*/
|
|
24866
|
+
setStylesCache(bounds) {
|
|
24867
|
+
if (!this.updateVisibleRange(bounds))
|
|
24868
|
+
return;
|
|
24869
|
+
const rowColumnSegment = this._visibleRange, columnWidthAccumulation = this.columnWidthAccumulation, { startRow: visibleStartRow, endRow: visibleEndRow, startColumn: visibleStartColumn, endColumn: visibleEndColumn } = rowColumnSegment;
|
|
24870
|
+
if (visibleEndColumn === -1 || visibleEndRow === -1) return;
|
|
24871
|
+
const mergeRanges = this.getCurrentRowColumnSegmentMergeData(this._visibleRange);
|
|
24872
|
+
for (const mergeRange of mergeRanges)
|
|
24873
|
+
this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, {
|
|
24874
|
+
mergeRange
|
|
24875
|
+
});
|
|
24876
|
+
const expandStartCol = Math.max(0, visibleStartColumn - EXPAND_SIZE_FOR_RENDER_OVERFLOW), expandEndCol = Math.min(columnWidthAccumulation.length - 1, visibleEndColumn + EXPAND_SIZE_FOR_RENDER_OVERFLOW);
|
|
24877
|
+
for (let r = visibleStartRow; r <= visibleEndRow; r++)
|
|
24878
|
+
if (this.worksheet.getRowVisible(r) !== !1) {
|
|
24879
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++)
|
|
24880
|
+
this._setStylesCacheForOneCell(r, c, { cacheItem: { bg: !0, border: !0 } });
|
|
24881
|
+
for (let c = expandStartCol; c < visibleEndColumn; c++)
|
|
24882
|
+
this._setStylesCacheForOneCell(r, c, { cacheItem: { bg: !1, border: !1 } });
|
|
24883
|
+
if (visibleEndColumn !== 0)
|
|
24884
|
+
for (let c = visibleEndColumn + 1; c < expandEndCol; c++)
|
|
24885
|
+
this._setStylesCacheForOneCell(r, c, { cacheItem: { bg: !1, border: !1 } });
|
|
24886
|
+
}
|
|
24887
|
+
return this;
|
|
24809
24888
|
}
|
|
24810
24889
|
calculate(bounds) {
|
|
24811
|
-
return this._resetCache(), this.
|
|
24890
|
+
return this._resetCache(), this.setStylesCache(bounds), this;
|
|
24891
|
+
}
|
|
24892
|
+
_hasUnMergedCellInRow(rowIndex, startColumn, endColumn) {
|
|
24893
|
+
if (!this.worksheet.getMergeData())
|
|
24894
|
+
return !1;
|
|
24895
|
+
for (let i = startColumn; i <= endColumn; i++) {
|
|
24896
|
+
const { isMerged, isMergedMainCell } = this._getCellMergeInfo(rowIndex, i);
|
|
24897
|
+
if (!isMerged && !isMergedMainCell)
|
|
24898
|
+
return !0;
|
|
24899
|
+
}
|
|
24900
|
+
return !1;
|
|
24812
24901
|
}
|
|
24902
|
+
//#region auto height
|
|
24903
|
+
/**
|
|
24904
|
+
* Calc all auto height by getDocsSkeletonPageSize in ranges
|
|
24905
|
+
* @param ranges
|
|
24906
|
+
* @returns {IRowAutoHeightInfo[]} result
|
|
24907
|
+
*/
|
|
24813
24908
|
calculateAutoHeightInRange(ranges) {
|
|
24814
24909
|
var _a10;
|
|
24815
24910
|
if (!Tools.isArray(ranges))
|
|
@@ -24831,24 +24926,10 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24831
24926
|
}
|
|
24832
24927
|
return results;
|
|
24833
24928
|
}
|
|
24834
|
-
_hasUnMergedCellInRow(rowIndex, startColumn, endColumn) {
|
|
24835
|
-
if (!this.worksheet.getMergeData())
|
|
24836
|
-
return !1;
|
|
24837
|
-
for (let i = startColumn; i <= endColumn; i++) {
|
|
24838
|
-
const { isMerged, isMergedMainCell } = this._getCellMergeInfo(rowIndex, i);
|
|
24839
|
-
if (!isMerged && !isMergedMainCell)
|
|
24840
|
-
return !0;
|
|
24841
|
-
}
|
|
24842
|
-
return !1;
|
|
24843
|
-
}
|
|
24844
|
-
// TODO: auto height
|
|
24845
24929
|
_calculateRowAutoHeight(rowNum) {
|
|
24846
24930
|
var _a10, _b, _c;
|
|
24847
|
-
const { columnCount, columnData, defaultRowHeight, defaultColumnWidth } = this._worksheetData;
|
|
24931
|
+
const worksheet = this.worksheet, { columnCount, columnData, defaultRowHeight, defaultColumnWidth } = this._worksheetData;
|
|
24848
24932
|
let height = defaultRowHeight;
|
|
24849
|
-
const worksheet = this.worksheet;
|
|
24850
|
-
if (!worksheet)
|
|
24851
|
-
return height;
|
|
24852
24933
|
for (let i = 0; i < columnCount; i++) {
|
|
24853
24934
|
const { isMerged, isMergedMainCell } = this._getCellMergeInfo(rowNum, i);
|
|
24854
24935
|
if (isMerged || isMergedMainCell)
|
|
@@ -24885,6 +24966,95 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
24885
24966
|
}
|
|
24886
24967
|
return Math.min(height, MAXIMUM_ROW_HEIGHT);
|
|
24887
24968
|
}
|
|
24969
|
+
//#endregion
|
|
24970
|
+
//#region calculate auto width
|
|
24971
|
+
calculateAutoWidthInRange(ranges) {
|
|
24972
|
+
if (!Tools.isArray(ranges))
|
|
24973
|
+
return [];
|
|
24974
|
+
const results = [], calculatedCols = /* @__PURE__ */ new Set();
|
|
24975
|
+
for (const range of ranges) {
|
|
24976
|
+
const { startColumn, endColumn } = range;
|
|
24977
|
+
for (let colIndex = startColumn; colIndex <= endColumn; colIndex++) {
|
|
24978
|
+
if (!this.worksheet.getColVisible(colIndex) || calculatedCols.has(colIndex)) continue;
|
|
24979
|
+
const autoWidth = this._calculateColWidth(colIndex);
|
|
24980
|
+
calculatedCols.add(colIndex), results.push({
|
|
24981
|
+
col: colIndex,
|
|
24982
|
+
width: autoWidth
|
|
24983
|
+
});
|
|
24984
|
+
}
|
|
24985
|
+
}
|
|
24986
|
+
return results;
|
|
24987
|
+
}
|
|
24988
|
+
/**
|
|
24989
|
+
* Iterate rows in visible area(and rows around it) and return column width of the specified column(by column index)
|
|
24990
|
+
*
|
|
24991
|
+
* @param colIndex
|
|
24992
|
+
* @returns {number} width
|
|
24993
|
+
*/
|
|
24994
|
+
_calculateColWidth(colIndex) {
|
|
24995
|
+
var _a10, _b;
|
|
24996
|
+
const worksheet = this.worksheet;
|
|
24997
|
+
let colWidth = 0;
|
|
24998
|
+
const visibleRangeViewMain = this.visibleRangeByViewportKey(SHEET_VIEWPORT_KEY.VIEW_MAIN);
|
|
24999
|
+
if (!visibleRangeViewMain) return colWidth;
|
|
25000
|
+
const { startRow: startRowOfViewMain, endRow: endRowOfViewMain } = visibleRangeViewMain, rowCount = this.worksheet.getRowCount(), checkStart = Math.max(0, startRowOfViewMain - 1e4), checkEnd = Math.min(rowCount, endRowOfViewMain + 1e4), otherRowIndex = /* @__PURE__ */ new Set();
|
|
25001
|
+
otherRowIndex.add(0), otherRowIndex.add(rowCount - 1);
|
|
25002
|
+
const visibleRangeViewMainTop = this.visibleRangeByViewportKey(SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP);
|
|
25003
|
+
if (visibleRangeViewMainTop) {
|
|
25004
|
+
const { startRow: startRowOfViewMainTop, endRow: endRowOfViewMainTop } = visibleRangeViewMainTop;
|
|
25005
|
+
for (let i = startRowOfViewMainTop; i <= endRowOfViewMainTop; i++)
|
|
25006
|
+
otherRowIndex.add(i);
|
|
25007
|
+
}
|
|
25008
|
+
const rowIdxArr = (/* @__PURE__ */ __name((start, end, additionalArr) => [...Array.from(
|
|
25009
|
+
{ length: end - start + 1 },
|
|
25010
|
+
(_2, i) => i + start
|
|
25011
|
+
), ...additionalArr], "createRowSequence"))(checkStart, checkEnd, otherRowIndex), preColIndex = Math.max(0, colIndex - 1), currColWidth = this._columnWidthAccumulation[colIndex] - this._columnWidthAccumulation[preColIndex];
|
|
25012
|
+
for (let i = 0; i < rowIdxArr.length; i++) {
|
|
25013
|
+
const row = rowIdxArr[i], { isMerged, isMergedMainCell } = this._getCellMergeInfo(colIndex, row);
|
|
25014
|
+
if (isMerged && !isMergedMainCell || !this.worksheet.getRowVisible(row)) continue;
|
|
25015
|
+
const cell = worksheet.getCell(row, colIndex);
|
|
25016
|
+
if (!cell || cell.p && (row + 1e3 <= startRowOfViewMain || row - 1e3 >= endRowOfViewMain))
|
|
25017
|
+
continue;
|
|
25018
|
+
let measuredWidth = this._getMeasuredWidthByCell(cell, currColWidth);
|
|
25019
|
+
if (cell.fontRenderExtension && (measuredWidth += (((_a10 = cell.fontRenderExtension) == null ? void 0 : _a10.leftOffset) || 0) + (((_b = cell.fontRenderExtension) == null ? void 0 : _b.rightOffset) || 0)), colWidth = Math.max(colWidth, measuredWidth), colWidth >= MAXIMUM_COL_WIDTH)
|
|
25020
|
+
return MAXIMUM_COL_WIDTH;
|
|
25021
|
+
}
|
|
25022
|
+
return colWidth === 0 ? currColWidth : colWidth;
|
|
25023
|
+
}
|
|
25024
|
+
/**
|
|
25025
|
+
* For _calculateColMaxWidth
|
|
25026
|
+
* @param cell
|
|
25027
|
+
* @returns {number} width
|
|
25028
|
+
*/
|
|
25029
|
+
_getMeasuredWidthByCell(cell, currColWidth) {
|
|
25030
|
+
var _a10, _b, _c;
|
|
25031
|
+
let measuredWidth = 0;
|
|
25032
|
+
if ((_a10 = cell.fontRenderExtension) != null && _a10.isSkip && (cell != null && cell.interceptorAutoWidth)) {
|
|
25033
|
+
const cellWidth = (_b = cell.interceptorAutoWidth) == null ? void 0 : _b.call(cell);
|
|
25034
|
+
if (cellWidth)
|
|
25035
|
+
return cellWidth;
|
|
25036
|
+
}
|
|
25037
|
+
const modelObject = this._getCellDocumentModel(cell);
|
|
25038
|
+
if (modelObject == null)
|
|
25039
|
+
return measuredWidth;
|
|
25040
|
+
const { documentModel, textRotation } = modelObject;
|
|
25041
|
+
if (documentModel == null)
|
|
25042
|
+
return measuredWidth;
|
|
25043
|
+
const documentViewModel = new DocumentViewModel(documentModel), { vertexAngle: angle } = convertTextRotation(textRotation), cellStyle = this._styles.getStyleByCell(cell);
|
|
25044
|
+
(cellStyle == null ? void 0 : cellStyle.tb) === WrapStrategy.WRAP ? documentModel.updateDocumentDataPageSize(currColWidth, 1 / 0) : documentModel.updateDocumentDataPageSize(1 / 0, 1 / 0);
|
|
25045
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localService);
|
|
25046
|
+
if (documentSkeleton.calculate(), measuredWidth = ((_c = getDocsSkeletonPageSize(documentSkeleton, angle)) != null ? _c : { width: 0 }).width, documentSkeleton) {
|
|
25047
|
+
const skeletonData = documentSkeleton.getSkeletonData(), {
|
|
25048
|
+
marginTop: t,
|
|
25049
|
+
marginBottom: b,
|
|
25050
|
+
marginLeft: l,
|
|
25051
|
+
marginRight: r
|
|
25052
|
+
} = skeletonData.pages[skeletonData.pages.length - 1], absAngleInRad = Math.abs(degToRad(angle));
|
|
25053
|
+
measuredWidth += t * Math.sin(absAngleInRad) + r * Math.cos(absAngleInRad) + b * Math.sin(absAngleInRad) + l * Math.cos(absAngleInRad);
|
|
25054
|
+
}
|
|
25055
|
+
return measuredWidth;
|
|
25056
|
+
}
|
|
25057
|
+
//#endregion
|
|
24888
25058
|
/**
|
|
24889
25059
|
* Calculate data for row col & cell position, then update position value to this._rowHeaderWidth & this._rowHeightAccumulation & this._columnHeaderHeight & this._columnWidthAccumulation.
|
|
24890
25060
|
*/
|
|
@@ -25379,6 +25549,12 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25379
25549
|
rowHeightAccumulation
|
|
25380
25550
|
};
|
|
25381
25551
|
}
|
|
25552
|
+
/**
|
|
25553
|
+
* Calc columnWidthAccumulation by columnData
|
|
25554
|
+
* @param colCount
|
|
25555
|
+
* @param columnData
|
|
25556
|
+
* @param defaultColumnWidth
|
|
25557
|
+
*/
|
|
25382
25558
|
_generateColumnMatrixCache(colCount, columnData, defaultColumnWidth) {
|
|
25383
25559
|
let columnTotalWidth = 0;
|
|
25384
25560
|
const columnWidthAccumulation = [], data2 = columnData;
|
|
@@ -25461,25 +25637,6 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25461
25637
|
startColumn: 0
|
|
25462
25638
|
} : range = { startRow: 0, startColumn: 0, endRow: this.rowHeightAccumulation.length - 1, endColumn: endColumnLast }, this.worksheet.getSpanModel().getMergedCellRangeForSkeleton(range.startRow, range.startColumn, range.endRow, range.endColumn);
|
|
25463
25639
|
}
|
|
25464
|
-
_calculateStylesCache() {
|
|
25465
|
-
const rowColumnSegment = this._visibleRange, columnWidthAccumulation = this.columnWidthAccumulation, { startRow, endRow, startColumn, endColumn } = rowColumnSegment;
|
|
25466
|
-
if (endColumn === -1 || endRow === -1) return;
|
|
25467
|
-
const mergeRanges = this.getCurrentRowColumnSegmentMergeData(this._visibleRange);
|
|
25468
|
-
for (const mergeRange of mergeRanges)
|
|
25469
|
-
this._setStylesCache(mergeRange.startRow, mergeRange.startColumn, {
|
|
25470
|
-
mergeRange
|
|
25471
|
-
});
|
|
25472
|
-
for (let r = startRow; r <= endRow; r++)
|
|
25473
|
-
if (this.worksheet.getRowVisible(r) !== !1) {
|
|
25474
|
-
for (let c = startColumn; c <= endColumn; c++)
|
|
25475
|
-
this._setStylesCache(r, c, { cacheItem: { bg: !0, border: !0 } });
|
|
25476
|
-
for (let c = 0; c < startColumn; c++)
|
|
25477
|
-
this._setStylesCache(r, c, { cacheItem: { bg: !1, border: !1 } });
|
|
25478
|
-
if (endColumn !== 0)
|
|
25479
|
-
for (let c = endColumn + 1; c < columnWidthAccumulation.length; c++)
|
|
25480
|
-
this._setStylesCache(r, c, { cacheItem: { bg: !1, border: !1 } });
|
|
25481
|
-
}
|
|
25482
|
-
}
|
|
25483
25640
|
resetCache() {
|
|
25484
25641
|
this._resetCache();
|
|
25485
25642
|
}
|
|
@@ -25538,12 +25695,12 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25538
25695
|
}
|
|
25539
25696
|
}
|
|
25540
25697
|
/**
|
|
25541
|
-
* Set border background and font to this._stylesCache
|
|
25698
|
+
* Set border background and font to this._stylesCache cell by cell.
|
|
25542
25699
|
* @param row {number}
|
|
25543
25700
|
* @param col {number}
|
|
25544
25701
|
* @param options {{ mergeRange: IRange; cacheItem: ICacheItem } | undefined}
|
|
25545
25702
|
*/
|
|
25546
|
-
|
|
25703
|
+
_setStylesCacheForOneCell(row, col, options) {
|
|
25547
25704
|
if (row === -1 || col === -1)
|
|
25548
25705
|
return;
|
|
25549
25706
|
const handledBgCell = Tools.isDefine(this._handleBgMatrix.getValue(row, col)), handledBorderCell = Tools.isDefine(this._handleBorderMatrix.getValue(row, col));
|
|
@@ -25557,7 +25714,7 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25557
25714
|
if (!isMergedMainCell)
|
|
25558
25715
|
return;
|
|
25559
25716
|
}
|
|
25560
|
-
const cell = this.worksheet.getCell(row, col) || this.worksheet.getCellRaw(row, col),
|
|
25717
|
+
const cell = this.worksheet.getCell(row, col) || this.worksheet.getCellRaw(row, col), cellStyle = this._styles.getStyleByCell(cell), columnStyle = this.worksheet.getColumnStyle(col), rowStyle = this.worksheet.getRowStyle(row), defaultStyle = this.worksheet.getDefaultCellStyleInternal(), style = this._isRowStylePrecedeColumnStyle ? composeStyles(defaultStyle, columnStyle, rowStyle, cellStyle) : composeStyles(defaultStyle, rowStyle, columnStyle, cellStyle);
|
|
25561
25718
|
this._setBgStylesCache(row, col, style, options), this._setBorderStylesCache(row, col, style, options), this._setFontStylesCache(row, col, cell);
|
|
25562
25719
|
}
|
|
25563
25720
|
_updateConfigAndGetDocumentModel(documentData, horizontalAlign, paddingData, renderConfig) {
|
|
@@ -25765,7 +25922,8 @@ let SpreadsheetSkeleton = (_a6 = class extends Skeleton {
|
|
|
25765
25922
|
}, __name(_a6, "SpreadsheetSkeleton"), _a6);
|
|
25766
25923
|
SpreadsheetSkeleton = __decorateClass$3([
|
|
25767
25924
|
__decorateParam$3(4, Inject(LocaleService)),
|
|
25768
|
-
__decorateParam$3(5, IContextService)
|
|
25925
|
+
__decorateParam$3(5, IContextService),
|
|
25926
|
+
__decorateParam$3(6, IConfigService)
|
|
25769
25927
|
], SpreadsheetSkeleton);
|
|
25770
25928
|
const UNIQUE_KEY$6 = "DefaultFontExtension", _Font = class _Font extends SheetExtension {
|
|
25771
25929
|
constructor() {
|
|
@@ -25814,12 +25972,10 @@ const UNIQUE_KEY$6 = "DefaultFontExtension", _Font = class _Font extends SheetEx
|
|
|
25814
25972
|
}
|
|
25815
25973
|
renderFontEachCell(renderFontCtx, row, col, fontMatrix) {
|
|
25816
25974
|
var _a10;
|
|
25817
|
-
const { ctx, viewRanges, diffRanges, spreadsheetSkeleton, cellInfo } = renderFontCtx;
|
|
25818
|
-
|
|
25819
|
-
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
25820
|
-
if (isMerged && !isMergedMainCell)
|
|
25975
|
+
const { ctx, viewRanges, diffRanges, spreadsheetSkeleton, cellInfo } = renderFontCtx, { startY, endY, startX, endX } = cellInfo, { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
25976
|
+
if (renderFontCtx.startX = startX, renderFontCtx.startY = startY, renderFontCtx.endX = endX, renderFontCtx.endY = endY, isMerged && !isMergedMainCell)
|
|
25821
25977
|
return !0;
|
|
25822
|
-
isMergedMainCell && (
|
|
25978
|
+
isMergedMainCell && (renderFontCtx.startX = mergeInfo.startX, renderFontCtx.startY = mergeInfo.startY, renderFontCtx.endX = mergeInfo.endX, renderFontCtx.endY = mergeInfo.endY);
|
|
25823
25979
|
const fontsConfig = fontMatrix.getValue(row, col);
|
|
25824
25980
|
if (!fontsConfig) return !0;
|
|
25825
25981
|
const overflowRange = spreadsheetSkeleton.overflowCache.getValue(row, col), renderRange = diffRanges && diffRanges.length > 0 ? diffRanges : viewRanges;
|
|
@@ -25830,7 +25986,7 @@ const UNIQUE_KEY$6 = "DefaultFontExtension", _Font = class _Font extends SheetEx
|
|
|
25830
25986
|
const cellData = spreadsheetSkeleton.worksheet.getCell(row, col) || {};
|
|
25831
25987
|
if ((_a10 = cellData.fontRenderExtension) != null && _a10.isSkip)
|
|
25832
25988
|
return !0;
|
|
25833
|
-
ctx.save(), ctx.beginPath(), renderFontCtx.overflowRectangle = overflowRange, renderFontCtx.cellData = cellData,
|
|
25989
|
+
ctx.save(), ctx.beginPath(), renderFontCtx.overflowRectangle = overflowRange, renderFontCtx.cellData = cellData, this._setFontRenderBounds(renderFontCtx, row, col, fontMatrix), ctx.translate(renderFontCtx.startX + FIX_ONE_PIXEL_BLUR_OFFSET, renderFontCtx.startY + FIX_ONE_PIXEL_BLUR_OFFSET), this._renderDocuments(ctx, fontsConfig, renderFontCtx.startX, renderFontCtx.startY, renderFontCtx.endX, renderFontCtx.endY, row, col, spreadsheetSkeleton.overflowCache), ctx.closePath(), ctx.restore();
|
|
25834
25990
|
}
|
|
25835
25991
|
/**
|
|
25836
25992
|
* Change font render bounds, for overflow and filter icon & custom render.
|
|
@@ -26066,7 +26222,6 @@ const UNIQUE_KEY$4 = "DefaultRowHeaderLayoutExtension", DEFAULT_ROW_STYLE = {
|
|
|
26066
26222
|
__name(_RowHeaderLayout, "RowHeaderLayout");
|
|
26067
26223
|
let RowHeaderLayout = _RowHeaderLayout;
|
|
26068
26224
|
SheetRowHeaderExtensionRegistry.add(new RowHeaderLayout());
|
|
26069
|
-
var ShowGridlinesState = /* @__PURE__ */ ((ShowGridlinesState2) => (ShowGridlinesState2[ShowGridlinesState2.OFF = 0] = "OFF", ShowGridlinesState2[ShowGridlinesState2.ON = 1] = "ON", ShowGridlinesState2))(ShowGridlinesState || {}), SHEET_VIEWPORT_KEY = /* @__PURE__ */ ((SHEET_VIEWPORT_KEY2) => (SHEET_VIEWPORT_KEY2.VIEW_MAIN = "viewMain", SHEET_VIEWPORT_KEY2.VIEW_MAIN_LEFT_TOP = "viewMainLeftTop", SHEET_VIEWPORT_KEY2.VIEW_MAIN_TOP = "viewMainTop", SHEET_VIEWPORT_KEY2.VIEW_MAIN_LEFT = "viewMainLeft", SHEET_VIEWPORT_KEY2.VIEW_ROW_TOP = "viewRowTop", SHEET_VIEWPORT_KEY2.VIEW_ROW_BOTTOM = "viewRowBottom", SHEET_VIEWPORT_KEY2.VIEW_COLUMN_LEFT = "viewColumnLeft", SHEET_VIEWPORT_KEY2.VIEW_COLUMN_RIGHT = "viewColumnRight", SHEET_VIEWPORT_KEY2.VIEW_LEFT_TOP = "viewLeftTop", SHEET_VIEWPORT_KEY2))(SHEET_VIEWPORT_KEY || {});
|
|
26070
26225
|
const _SpreadsheetRowHeader = class _SpreadsheetRowHeader extends SpreadsheetHeader {
|
|
26071
26226
|
constructor(oKey, spreadsheetSkeleton) {
|
|
26072
26227
|
super(oKey, spreadsheetSkeleton);
|
|
@@ -26090,7 +26245,7 @@ const _SpreadsheetRowHeader = class _SpreadsheetRowHeader extends SpreadsheetHea
|
|
|
26090
26245
|
if (!spreadsheetSkeleton)
|
|
26091
26246
|
return;
|
|
26092
26247
|
const parentScale = this.getParentScale();
|
|
26093
|
-
spreadsheetSkeleton.
|
|
26248
|
+
spreadsheetSkeleton.updateVisibleRange(bounds);
|
|
26094
26249
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
26095
26250
|
if (!segment || segment.startRow === -1 && segment.endRow === -1)
|
|
26096
26251
|
return;
|
|
@@ -26444,10 +26599,10 @@ const BASE_OBJECT_ARRAY_Set = new Set(BASE_OBJECT_ARRAY), SHAPE_OBJECT_ARRAY = [
|
|
|
26444
26599
|
return;
|
|
26445
26600
|
const transformState = {};
|
|
26446
26601
|
let hasTransformState = !1;
|
|
26447
|
-
const hasRotateEnabled = (props == null ? void 0 : props.rotateEnabled) !== void 0, hasResizeEnabled = (props == null ? void 0 : props.resizeEnabled) !== void 0;
|
|
26448
|
-
if (hasRotateEnabled || hasResizeEnabled) {
|
|
26602
|
+
const hasRotateEnabled = (props == null ? void 0 : props.rotateEnabled) !== void 0, hasResizeEnabled = (props == null ? void 0 : props.resizeEnabled) !== void 0, hasBorderEnabled = (props == null ? void 0 : props.borderEnabled) !== void 0;
|
|
26603
|
+
if (hasRotateEnabled || hasResizeEnabled || hasBorderEnabled) {
|
|
26449
26604
|
const transformerConfig = this.transformerConfig || {};
|
|
26450
|
-
hasRotateEnabled && (transformerConfig.rotateEnabled = props == null ? void 0 : props.rotateEnabled), hasResizeEnabled && (transformerConfig.resizeEnabled = props == null ? void 0 : props.resizeEnabled), this.transformerConfig = { ...transformerConfig };
|
|
26605
|
+
hasRotateEnabled && (transformerConfig.rotateEnabled = props == null ? void 0 : props.rotateEnabled), hasResizeEnabled && (transformerConfig.resizeEnabled = props == null ? void 0 : props.resizeEnabled), hasBorderEnabled && (transformerConfig.borderEnabled = props == null ? void 0 : props.borderEnabled), this.transformerConfig = { ...transformerConfig };
|
|
26451
26606
|
}
|
|
26452
26607
|
themeKeys.forEach((key) => {
|
|
26453
26608
|
if (props[key] === void 0)
|
|
@@ -26552,6 +26707,9 @@ const RECT_OBJECT_ARRAY = ["radius"], _Rect = class _Rect extends Shape {
|
|
|
26552
26707
|
get radius() {
|
|
26553
26708
|
return this._radius;
|
|
26554
26709
|
}
|
|
26710
|
+
setObjectType(type) {
|
|
26711
|
+
this.objectType = type;
|
|
26712
|
+
}
|
|
26555
26713
|
static drawWith(ctx, props) {
|
|
26556
26714
|
let { radius, width, height } = props;
|
|
26557
26715
|
if (radius = radius != null ? radius : 0, width = width != null ? width : 0, height = height != null ? height : 0, ctx.save(), ctx.beginPath(), props.strokeDashArray && ctx.setLineDash(props.strokeDashArray), props.visualHeight && (ctx.translate(0, (height - (props.visualHeight || 0)) / 2), height = props.visualHeight), props.visualWidth && (ctx.translate((width - (props.visualWidth || 0)) / 2, 0), width = props.visualWidth), !radius)
|
|
@@ -27952,11 +28110,11 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
|
|
|
27952
28110
|
}
|
|
27953
28111
|
draw(ctx, parentScale, glyph) {
|
|
27954
28112
|
var _a10;
|
|
27955
|
-
const line2 = (_a10 = glyph.parent) == null ? void 0 : _a10.parent, {
|
|
28113
|
+
const line2 = (_a10 = glyph.parent) == null ? void 0 : _a10.parent, { ts: textStyle, bBox, content } = glyph;
|
|
27956
28114
|
if (line2 == null || textStyle == null || content === "\r")
|
|
27957
28115
|
return;
|
|
27958
28116
|
const { asc, dsc } = line2, { sp: strikeoutPosition, spo, sbo, bd } = bBox, scale = getScale(parentScale), DELTA = 0.5, { ul: underline, st: strikethrough, ol: overline, va: baselineOffset, bbl: bottomBorderLine } = textStyle;
|
|
27959
|
-
if (
|
|
28117
|
+
if (underline) {
|
|
27960
28118
|
const startY = asc + dsc;
|
|
27961
28119
|
this._drawLine(ctx, glyph, underline, startY, scale);
|
|
27962
28120
|
}
|
|
@@ -27964,7 +28122,7 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
|
|
|
27964
28122
|
const startY = asc + dsc + 3;
|
|
27965
28123
|
this._drawLine(ctx, glyph, bottomBorderLine, startY, scale, 2);
|
|
27966
28124
|
}
|
|
27967
|
-
if (
|
|
28125
|
+
if (strikethrough) {
|
|
27968
28126
|
let startY = asc + bd - strikeoutPosition - DELTA;
|
|
27969
28127
|
baselineOffset === BaselineOffset.SUPERSCRIPT ? startY -= spo : baselineOffset === BaselineOffset.SUBSCRIPT && (startY += sbo), this._drawLine(ctx, glyph, strikethrough, startY, scale);
|
|
27970
28128
|
}
|
|
@@ -27986,11 +28144,11 @@ const UNIQUE_KEY = "DefaultDocsLineExtension", DOC_EXTENSION_Z_INDEX = 40, _Line
|
|
|
27986
28144
|
originTranslate = Vector2.create(0, 0),
|
|
27987
28145
|
alignOffset = Vector2.create(0, 0),
|
|
27988
28146
|
renderConfig = {}
|
|
27989
|
-
} = this.extensionOffset, { left, width } = glyph, { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig
|
|
27990
|
-
ctx.save()
|
|
28147
|
+
} = this.extensionOffset, { left, width } = glyph, { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig;
|
|
28148
|
+
ctx.save();
|
|
27991
28149
|
const color = (c === BooleanNumber.TRUE ? getColorStyle((_a10 = glyph.ts) == null ? void 0 : _a10.cl) : getColorStyle(colorStyle)) || COLOR_BLACK_RGB;
|
|
27992
28150
|
ctx.strokeStyle = color, ctx.lineWidth = lineWidth, this._setLineType(ctx, lineType || TextDecoration.SINGLE);
|
|
27993
|
-
const start = calculateRectRotate(
|
|
28151
|
+
const centerAngle = degToRad(centerAngleDeg), vertexAngle = degToRad(vertexAngleDeg), start = calculateRectRotate(
|
|
27994
28152
|
originTranslate.addByPoint(left, startY),
|
|
27995
28153
|
Vector2.create(0, 0),
|
|
27996
28154
|
centerAngle,
|
|
@@ -28017,8 +28175,6 @@ const _Documents = class _Documents extends DocComponent {
|
|
|
28017
28175
|
super(oKey, documentSkeleton, config);
|
|
28018
28176
|
__publicField(this, "_pageRender$", new Subject());
|
|
28019
28177
|
__publicField(this, "pageRender$", this._pageRender$.asObservable());
|
|
28020
|
-
__publicField(this, "docsLeft", 0);
|
|
28021
|
-
__publicField(this, "docsTop", 0);
|
|
28022
28178
|
__publicField(this, "_drawLiquid", new Liquid());
|
|
28023
28179
|
this._initialDefaultExtension(), this.makeDirty(!0);
|
|
28024
28180
|
}
|
|
@@ -28564,9 +28720,6 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28564
28720
|
get forceDisableGridlines() {
|
|
28565
28721
|
return this._forceDisableGridlines;
|
|
28566
28722
|
}
|
|
28567
|
-
/**
|
|
28568
|
-
* TODO: DR-Univer, fix as unknown as
|
|
28569
|
-
*/
|
|
28570
28723
|
dispose() {
|
|
28571
28724
|
var _a10;
|
|
28572
28725
|
super.dispose(), (_a10 = this._documents) == null || _a10.dispose(), this._documents = null, this._backgroundExtension = null, this._borderExtension = null, this._fontExtension = null;
|
|
@@ -28721,7 +28874,7 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28721
28874
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
28722
28875
|
if (!spreadsheetSkeleton)
|
|
28723
28876
|
return;
|
|
28724
|
-
spreadsheetSkeleton.
|
|
28877
|
+
spreadsheetSkeleton.setStylesCache(viewportInfo);
|
|
28725
28878
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
28726
28879
|
if (!segment || segment.startRow === -1 && segment.endRow === -1 || segment.startColumn === -1 && segment.endColumn === -1)
|
|
28727
28880
|
return;
|
|
@@ -28729,7 +28882,7 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28729
28882
|
const { rowHeaderWidth, columnHeaderHeight } = spreadsheetSkeleton;
|
|
28730
28883
|
mainCtx.translateWithPrecision(rowHeaderWidth, columnHeaderHeight);
|
|
28731
28884
|
const { viewportKey } = viewportInfo;
|
|
28732
|
-
return
|
|
28885
|
+
return sheetContentViewportKeys.includes(viewportKey) ? viewportInfo && viewportInfo.cacheCanvas ? this.renderByViewport(mainCtx, viewportInfo, spreadsheetSkeleton) : this._draw(mainCtx, viewportInfo) : sheetHeaderViewportKeys.includes(viewportKey) || (viewportInfo && viewportInfo.cacheCanvas ? this.renderByViewport(mainCtx, viewportInfo, spreadsheetSkeleton) : this._draw(mainCtx, viewportInfo)), mainCtx.restore(), this;
|
|
28733
28886
|
}
|
|
28734
28887
|
/**
|
|
28735
28888
|
* applyCache from cache canvas
|
|
@@ -28801,6 +28954,7 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28801
28954
|
*/
|
|
28802
28955
|
// eslint-disable-next-line max-lines-per-function
|
|
28803
28956
|
_drawAuxiliary(ctx) {
|
|
28957
|
+
var _a10;
|
|
28804
28958
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
28805
28959
|
if (spreadsheetSkeleton == null)
|
|
28806
28960
|
return;
|
|
@@ -28810,7 +28964,7 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28810
28964
|
const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
|
|
28811
28965
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0)
|
|
28812
28966
|
return;
|
|
28813
|
-
ctx.save(), ctx.setLineWidthByPrecision(1), ctx.strokeStyle = getColor([214, 216, 219]);
|
|
28967
|
+
ctx.save(), ctx.setLineWidthByPrecision(1), ctx.strokeStyle = (_a10 = ctx.renderConfig.gridlineColor) != null ? _a10 : getColor([214, 216, 219]);
|
|
28814
28968
|
const columnWidthAccumulationLength = columnWidthAccumulation.length, rowHeightAccumulationLength = rowHeightAccumulation.length, EXTRA_BOUND = 0.4, rowCount = endRow - startRow + 1, columnCount = endColumn - startColumn + 1, extraRowCount = Math.ceil(rowCount * EXTRA_BOUND), extraColumnCount = Math.ceil(columnCount * EXTRA_BOUND), rowStart = Math.max(Math.floor(startRow - extraRowCount), 0), rowEnd = Math.min(Math.ceil(endRow + extraRowCount), rowHeightAccumulationLength - 1), columnEnd = Math.min(Math.ceil(endColumn + extraColumnCount), columnWidthAccumulationLength - 1), columnStart = Math.max(Math.floor(startColumn - extraColumnCount), 0), startX = columnWidthAccumulation[columnStart - 1] || 0, startY = rowHeightAccumulation[rowStart - 1] || 0, endX = columnWidthAccumulation[columnEnd], endY = rowHeightAccumulation[rowEnd];
|
|
28815
28969
|
ctx.translateWithPrecisionRatio(FIX_ONE_PIXEL_BLUR_OFFSET, FIX_ONE_PIXEL_BLUR_OFFSET), ctx.beginPath(), ctx.moveToByPrecision(startX, startY), ctx.lineToByPrecision(endX, startY), ctx.moveToByPrecision(startX, startY), ctx.lineToByPrecision(startX, endY), ctx.closePathByEnv(), ctx.stroke();
|
|
28816
28970
|
for (let r = rowStart; r <= rowEnd; r++) {
|
|
@@ -28847,12 +29001,6 @@ const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__", _Spreadsheet =
|
|
|
28847
29001
|
isMergedMainCell && (startY = mergeInfo.startY, endY = mergeInfo.endY, startX = mergeInfo.startX, endX = mergeInfo.endX), ctx.clearRectForTexture(startX, startY, endX - startX + 0.5, endY - startY + 0.5);
|
|
28848
29002
|
});
|
|
28849
29003
|
}
|
|
28850
|
-
sheetContentViewport() {
|
|
28851
|
-
return [SHEET_VIEWPORT_KEY.VIEW_MAIN, SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT_TOP, SHEET_VIEWPORT_KEY.VIEW_MAIN_TOP, SHEET_VIEWPORT_KEY.VIEW_MAIN_LEFT];
|
|
28852
|
-
}
|
|
28853
|
-
sheetHeaderViewport() {
|
|
28854
|
-
return [SHEET_VIEWPORT_KEY.VIEW_ROW_TOP, SHEET_VIEWPORT_KEY.VIEW_ROW_BOTTOM, SHEET_VIEWPORT_KEY.VIEW_COLUMN_LEFT, SHEET_VIEWPORT_KEY.VIEW_COLUMN_RIGHT, SHEET_VIEWPORT_KEY.VIEW_LEFT_TOP];
|
|
28855
|
-
}
|
|
28856
29004
|
testShowRuler(cacheCtx, viewportInfo) {
|
|
28857
29005
|
const { cacheBound } = viewportInfo, spreadsheetSkeleton = this.getSkeleton(), { rowHeaderWidth, columnHeaderHeight } = spreadsheetSkeleton, { left, top, right, bottom } = cacheBound, findClosestHundred = /* @__PURE__ */ __name((number) => {
|
|
28858
29006
|
const remainder = number % 100;
|
|
@@ -29108,6 +29256,27 @@ const arrowPath = "M512 1024C229.248 1024 0 794.752 0 512S229.248 0 512 0s512 22
|
|
|
29108
29256
|
};
|
|
29109
29257
|
__name(_Slide, "Slide");
|
|
29110
29258
|
let Slide = _Slide;
|
|
29259
|
+
const _UniverRenderConfigService = class _UniverRenderConfigService {
|
|
29260
|
+
constructor() {
|
|
29261
|
+
__publicField(this, "_renderConfig", {
|
|
29262
|
+
ok: "111"
|
|
29263
|
+
});
|
|
29264
|
+
__publicField(this, "_updateSignal$", new Subject());
|
|
29265
|
+
__publicField(this, "updateSignal$", this._updateSignal$.pipe(debounceTime(4)));
|
|
29266
|
+
}
|
|
29267
|
+
setRenderConfig(key, value) {
|
|
29268
|
+
if (value == null) {
|
|
29269
|
+
delete this._renderConfig[key];
|
|
29270
|
+
return;
|
|
29271
|
+
}
|
|
29272
|
+
this._renderConfig[key] = value;
|
|
29273
|
+
}
|
|
29274
|
+
getRenderConfig() {
|
|
29275
|
+
return this._renderConfig;
|
|
29276
|
+
}
|
|
29277
|
+
};
|
|
29278
|
+
__name(_UniverRenderConfigService, "UniverRenderConfigService");
|
|
29279
|
+
let UniverRenderConfigService = _UniverRenderConfigService;
|
|
29111
29280
|
const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255, 255, 255, 1)", MARGIN_STROKE_COLOR = "rgba(158, 158, 158, 1)", _DocBackground = class _DocBackground extends DocComponent {
|
|
29112
29281
|
constructor(oKey, documentSkeleton, config) {
|
|
29113
29282
|
super(oKey, documentSkeleton, config);
|
|
@@ -29122,7 +29291,9 @@ const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255,
|
|
|
29122
29291
|
const skeletonData = (_a10 = this.getSkeleton()) == null ? void 0 : _a10.getSkeletonData(), docDataModel = (_b = this.getSkeleton()) == null ? void 0 : _b.getViewModel().getDataModel();
|
|
29123
29292
|
if (skeletonData == null || docDataModel == null)
|
|
29124
29293
|
return;
|
|
29125
|
-
const documentFlavor = docDataModel.getSnapshot().documentStyle
|
|
29294
|
+
const { documentFlavor } = docDataModel.getSnapshot().documentStyle;
|
|
29295
|
+
if (documentFlavor !== DocumentFlavor.TRADITIONAL)
|
|
29296
|
+
return;
|
|
29126
29297
|
this._drawLiquid.reset();
|
|
29127
29298
|
const { pages } = skeletonData;
|
|
29128
29299
|
let pageTop = 0, pageLeft = 0;
|
|
@@ -29148,51 +29319,49 @@ const PAGE_STROKE_COLOR = "rgba(198, 198, 198, 1)", PAGE_FILL_COLOR = "rgba(255,
|
|
|
29148
29319
|
fill: PAGE_FILL_COLOR,
|
|
29149
29320
|
zIndex: 3
|
|
29150
29321
|
};
|
|
29151
|
-
|
|
29152
|
-
|
|
29153
|
-
|
|
29154
|
-
|
|
29155
|
-
|
|
29156
|
-
|
|
29157
|
-
|
|
29158
|
-
|
|
29159
|
-
|
|
29160
|
-
|
|
29161
|
-
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29170
|
-
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29176
|
-
|
|
29177
|
-
|
|
29178
|
-
|
|
29179
|
-
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
}
|
|
29195
|
-
ctx.restore();
|
|
29322
|
+
Rect.drawWith(ctx, backgroundOptions);
|
|
29323
|
+
const IDENTIFIER_WIDTH = 15, marginIdentification = {
|
|
29324
|
+
dataArray: [{
|
|
29325
|
+
command: "M",
|
|
29326
|
+
points: [marginLeft - IDENTIFIER_WIDTH, originMarginTop]
|
|
29327
|
+
}, {
|
|
29328
|
+
command: "L",
|
|
29329
|
+
points: [marginLeft, originMarginTop]
|
|
29330
|
+
}, {
|
|
29331
|
+
command: "L",
|
|
29332
|
+
points: [marginLeft, originMarginTop - IDENTIFIER_WIDTH]
|
|
29333
|
+
}, {
|
|
29334
|
+
command: "M",
|
|
29335
|
+
points: [pageWidth - marginRight + IDENTIFIER_WIDTH, originMarginTop]
|
|
29336
|
+
}, {
|
|
29337
|
+
command: "L",
|
|
29338
|
+
points: [pageWidth - marginRight, originMarginTop]
|
|
29339
|
+
}, {
|
|
29340
|
+
command: "L",
|
|
29341
|
+
points: [pageWidth - marginRight, originMarginTop - IDENTIFIER_WIDTH]
|
|
29342
|
+
}, {
|
|
29343
|
+
command: "M",
|
|
29344
|
+
points: [marginLeft - IDENTIFIER_WIDTH, pageHeight - originMarginBottom]
|
|
29345
|
+
}, {
|
|
29346
|
+
command: "L",
|
|
29347
|
+
points: [marginLeft, pageHeight - originMarginBottom]
|
|
29348
|
+
}, {
|
|
29349
|
+
command: "L",
|
|
29350
|
+
points: [marginLeft, pageHeight - originMarginBottom + IDENTIFIER_WIDTH]
|
|
29351
|
+
}, {
|
|
29352
|
+
command: "M",
|
|
29353
|
+
points: [pageWidth - marginRight + IDENTIFIER_WIDTH, pageHeight - originMarginBottom]
|
|
29354
|
+
}, {
|
|
29355
|
+
command: "L",
|
|
29356
|
+
points: [pageWidth - marginRight, pageHeight - originMarginBottom]
|
|
29357
|
+
}, {
|
|
29358
|
+
command: "L",
|
|
29359
|
+
points: [pageWidth - marginRight, pageHeight - originMarginBottom + IDENTIFIER_WIDTH]
|
|
29360
|
+
}],
|
|
29361
|
+
strokeWidth: 1.5,
|
|
29362
|
+
stroke: MARGIN_STROKE_COLOR
|
|
29363
|
+
};
|
|
29364
|
+
Path.drawWith(ctx, marginIdentification), ctx.restore();
|
|
29196
29365
|
const { x, y } = this._drawLiquid.translatePage(
|
|
29197
29366
|
page,
|
|
29198
29367
|
this.pageLayoutType,
|
|
@@ -30162,7 +30331,7 @@ const _Layer = class _Layer extends Disposable {
|
|
|
30162
30331
|
};
|
|
30163
30332
|
__name(_Layer, "Layer");
|
|
30164
30333
|
let Layer = _Layer;
|
|
30165
|
-
const _InputManager = class _InputManager extends Disposable {
|
|
30334
|
+
const PLUGIN_CONFIG_KEY = "engine-render.config", defaultPluginConfig = {}, _InputManager = class _InputManager extends Disposable {
|
|
30166
30335
|
constructor(scene) {
|
|
30167
30336
|
super();
|
|
30168
30337
|
__publicField(this, "_scene");
|
|
@@ -30439,7 +30608,9 @@ const TransformerManagerTypeArray = [
|
|
|
30439
30608
|
"__SpreadsheetTransformerResizeCB__",
|
|
30440
30609
|
"__SpreadsheetTransformerResizeRB__"
|
|
30441
30610
|
/* RESIZE_RB */
|
|
30442
|
-
], DEFAULT_TRANSFORMER_LAYER_INDEX = 2, MINI_WIDTH_LIMIT = 20, MINI_HEIGHT_LIMIT = 20, DEFAULT_CONTROL_PLUS_INDEX = 5e3,
|
|
30611
|
+
], DEFAULT_TRANSFORMER_LAYER_INDEX = 2, MINI_WIDTH_LIMIT = 20, MINI_HEIGHT_LIMIT = 20, DEFAULT_CONTROL_PLUS_INDEX = 5e3, SINGLE_ACTIVE_OBJECT_TYPE_MAP = /* @__PURE__ */ new Set([
|
|
30612
|
+
ObjectType.CHART
|
|
30613
|
+
]), _Transformer = class _Transformer extends Disposable {
|
|
30443
30614
|
constructor(_scene, config) {
|
|
30444
30615
|
super();
|
|
30445
30616
|
__publicField(this, "isCropper", !1);
|
|
@@ -31336,6 +31507,15 @@ const TransformerManagerTypeArray = [
|
|
|
31336
31507
|
_clearControls(changeSelf = !1) {
|
|
31337
31508
|
this._clearControlMap(), this._clearControl$.next(changeSelf);
|
|
31338
31509
|
}
|
|
31510
|
+
/**
|
|
31511
|
+
* @description Clear the control of the object with the specified id
|
|
31512
|
+
* @param {string[]} ids the id of the object to be cleared
|
|
31513
|
+
*/
|
|
31514
|
+
clearControlByIds(ids) {
|
|
31515
|
+
for (const id of ids)
|
|
31516
|
+
this._selectedObjectMap.delete(id);
|
|
31517
|
+
this.refreshControls();
|
|
31518
|
+
}
|
|
31339
31519
|
_clearControlMap() {
|
|
31340
31520
|
this._transformerControlMap.forEach((control) => {
|
|
31341
31521
|
control.dispose();
|
|
@@ -31414,7 +31594,7 @@ const TransformerManagerTypeArray = [
|
|
|
31414
31594
|
}
|
|
31415
31595
|
_updateActiveObjectList(applyObject, evt) {
|
|
31416
31596
|
const { isCropper } = this._getConfig(applyObject);
|
|
31417
|
-
applyObject = this._findGroupObject(applyObject), !this._selectedObjectMap.has(applyObject.oKey) && (evt.ctrlKey || (this._selectedObjectMap.clear(), this._clearControlMap()), isCropper || this._selectedObjectMap.set(applyObject.oKey, applyObject), this._createControl(applyObject));
|
|
31597
|
+
applyObject = this._findGroupObject(applyObject), !this._selectedObjectMap.has(applyObject.oKey) && ((!evt.ctrlKey || SINGLE_ACTIVE_OBJECT_TYPE_MAP.has(applyObject.objectType)) && (this._selectedObjectMap.clear(), this._clearControlMap()), isCropper || this._selectedObjectMap.set(applyObject.oKey, applyObject), this._createControl(applyObject));
|
|
31418
31598
|
}
|
|
31419
31599
|
_findGroupObject(applyObject) {
|
|
31420
31600
|
if (!applyObject.isInGroup)
|
|
@@ -32455,7 +32635,6 @@ function isDisposable(thing) {
|
|
|
32455
32635
|
return !!thing && typeof thing.dispose == "function";
|
|
32456
32636
|
}
|
|
32457
32637
|
__name(isDisposable, "isDisposable");
|
|
32458
|
-
const PLUGIN_CONFIG_KEY = "engine-render.config", defaultPluginConfig = {};
|
|
32459
32638
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
32460
32639
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
32461
32640
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
@@ -32467,11 +32646,9 @@ let UniverRenderEnginePlugin = (_a9 = class extends Plugin {
|
|
|
32467
32646
|
constructor(_config = defaultPluginConfig, _injector, _configService) {
|
|
32468
32647
|
super(), this._config = _config, this._injector = _injector, this._configService = _configService;
|
|
32469
32648
|
const { ...rest } = this._config;
|
|
32470
|
-
this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._injector
|
|
32471
|
-
|
|
32472
|
-
{
|
|
32473
|
-
useClass: RenderManagerService
|
|
32474
|
-
}
|
|
32649
|
+
this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), registerDependencies(this._injector, [
|
|
32650
|
+
[IRenderingEngine, { useFactory: /* @__PURE__ */ __name(() => new Engine(), "useFactory") }],
|
|
32651
|
+
[IRenderManagerService, { useClass: RenderManagerService }]
|
|
32475
32652
|
]);
|
|
32476
32653
|
}
|
|
32477
32654
|
}, __name(_a9, "UniverRenderEnginePlugin"), __publicField(_a9, "pluginName", PLUGIN_NAME), _a9);
|
|
@@ -32746,6 +32923,9 @@ const MOUSE_WHEEL_SPEED_SMOOTHING_FACTOR = 3, _Viewport = class _Viewport {
|
|
|
32746
32923
|
get _deltaViewportScrollY() {
|
|
32747
32924
|
return this.viewportScrollY - this._preViewportScrollY;
|
|
32748
32925
|
}
|
|
32926
|
+
get canvas() {
|
|
32927
|
+
return this._cacheCanvas;
|
|
32928
|
+
}
|
|
32749
32929
|
enable() {
|
|
32750
32930
|
this._active = !0;
|
|
32751
32931
|
}
|
|
@@ -33406,6 +33586,7 @@ export {
|
|
|
33406
33586
|
Layer,
|
|
33407
33587
|
LineType,
|
|
33408
33588
|
Liquid,
|
|
33589
|
+
MAXIMUM_COL_WIDTH,
|
|
33409
33590
|
MAXIMUM_ROW_HEIGHT,
|
|
33410
33591
|
MIDDLE_CELL_POS_MAGIC_NUMBER,
|
|
33411
33592
|
Marker,
|
|
@@ -33463,11 +33644,10 @@ export {
|
|
|
33463
33644
|
ThinScene,
|
|
33464
33645
|
Transform,
|
|
33465
33646
|
UniverPrintingContext,
|
|
33647
|
+
UniverRenderConfigService,
|
|
33466
33648
|
UniverRenderEnginePlugin,
|
|
33467
33649
|
UniverRenderingContext,
|
|
33468
33650
|
UniverRenderingContext2D,
|
|
33469
|
-
UniverRenderingContextWebGL,
|
|
33470
|
-
UniverRenderingContextWebGPU,
|
|
33471
33651
|
VERTICAL_ROTATE_ANGLE,
|
|
33472
33652
|
Vector2,
|
|
33473
33653
|
Viewport,
|