@univerjs/engine-render 1.0.0-alpha.8 → 1.0.0-beta.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/cjs/index.js +1101 -785
- package/lib/es/index.js +1094 -787
- package/lib/index.js +1094 -787
- package/lib/types/alignment-snap.d.ts +67 -0
- package/lib/types/base-object.d.ts +8 -0
- package/lib/types/basics/drawing-effect.d.ts +1 -1
- package/lib/types/basics/i-document-skeleton-cached.d.ts +7 -0
- package/lib/types/basics/interfaces.d.ts +9 -0
- package/lib/types/basics/tools.d.ts +1 -0
- package/lib/types/components/docs/custom-block-render-viewport.d.ts +2 -0
- package/lib/types/components/docs/extensions/line.d.ts +5 -1
- package/lib/types/components/docs/layout/block/paragraph/bullet.d.ts +2 -2
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +1 -1
- package/lib/types/components/docs/layout/doc-no-wrap-measure.d.ts +5 -0
- package/lib/types/{basics/unit-convert.d.ts → components/docs/layout/line-breaker/extensions/east-asian-quote-linebreak-extension.d.ts} +2 -2
- package/lib/types/components/sheets/index.d.ts +2 -0
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +2 -0
- package/lib/types/components/sheets/spreadsheet.d.ts +4 -2
- package/lib/types/components/sheets/util.d.ts +10 -0
- package/lib/types/drawing-group.d.ts +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/shape/scroll-bar.d.ts +6 -0
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
package/lib/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, DocxBreakType, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, LookUp, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, 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, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
1
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, DocxBreakType, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, LookUp, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, 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, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isDefaultFormat, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, numfmt, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { BehaviorSubject, Observable, Subject, Subscription, distinctUntilChanged, shareReplay, startWith } from "rxjs";
|
|
3
3
|
import { franc } from "franc-min";
|
|
4
4
|
import { getOverflowAncestors } from "@floating-ui/dom";
|
|
@@ -63,6 +63,143 @@ function _defineProperty(e, r, t) {
|
|
|
63
63
|
}) : e[r] = t, e;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/alignment-snap.ts
|
|
68
|
+
const DEFAULT_ENTER_THRESHOLD = 6;
|
|
69
|
+
const DEFAULT_EXIT_THRESHOLD = 11;
|
|
70
|
+
const DEFAULT_COOLDOWN_MS = 250;
|
|
71
|
+
function normalizeAlignmentRect(rect) {
|
|
72
|
+
return {
|
|
73
|
+
left: rect.width >= 0 ? rect.left : rect.left + rect.width,
|
|
74
|
+
top: rect.height >= 0 ? rect.top : rect.top + rect.height,
|
|
75
|
+
width: Math.abs(rect.width),
|
|
76
|
+
height: Math.abs(rect.height)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function getAlignmentRectXAnchors(rect) {
|
|
80
|
+
const normalized = normalizeAlignmentRect(rect);
|
|
81
|
+
return [
|
|
82
|
+
normalized.left,
|
|
83
|
+
normalized.left + normalized.width / 2,
|
|
84
|
+
normalized.left + normalized.width
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
function getAlignmentRectYAnchors(rect) {
|
|
88
|
+
const normalized = normalizeAlignmentRect(rect);
|
|
89
|
+
return [
|
|
90
|
+
normalized.top,
|
|
91
|
+
normalized.top + normalized.height / 2,
|
|
92
|
+
normalized.top + normalized.height
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
function getClosestAlignmentOffset(activeAnchors, targetAnchors, threshold) {
|
|
96
|
+
let closestOffset = 0;
|
|
97
|
+
let closestDistance = Number.POSITIVE_INFINITY;
|
|
98
|
+
targetAnchors.forEach((target) => {
|
|
99
|
+
activeAnchors.forEach((active) => {
|
|
100
|
+
const offset = target - active;
|
|
101
|
+
const distance = Math.abs(offset);
|
|
102
|
+
if (distance <= threshold && distance < closestDistance) {
|
|
103
|
+
closestDistance = distance;
|
|
104
|
+
closestOffset = offset;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
return closestDistance === Number.POSITIVE_INFINITY ? 0 : closestOffset;
|
|
109
|
+
}
|
|
110
|
+
var AlignmentSnapSession = class {
|
|
111
|
+
constructor(config = {}) {
|
|
112
|
+
_defineProperty(this, "_enterThreshold", void 0);
|
|
113
|
+
_defineProperty(this, "_exitThreshold", void 0);
|
|
114
|
+
_defineProperty(this, "_breakawayThreshold", void 0);
|
|
115
|
+
_defineProperty(this, "_softThreshold", void 0);
|
|
116
|
+
_defineProperty(this, "_hardThreshold", void 0);
|
|
117
|
+
_defineProperty(this, "_softMaxStrength", void 0);
|
|
118
|
+
_defineProperty(this, "_cooldownMs", void 0);
|
|
119
|
+
_defineProperty(this, "_activeGuideId", null);
|
|
120
|
+
_defineProperty(this, "_activeGuideStartValue", null);
|
|
121
|
+
_defineProperty(this, "_releasedUntil", 0);
|
|
122
|
+
this._enterThreshold = config.enterThreshold ?? DEFAULT_ENTER_THRESHOLD;
|
|
123
|
+
this._exitThreshold = config.exitThreshold ?? DEFAULT_EXIT_THRESHOLD;
|
|
124
|
+
this._breakawayThreshold = config.breakawayThreshold;
|
|
125
|
+
this._softThreshold = config.softThreshold;
|
|
126
|
+
this._hardThreshold = config.hardThreshold ?? this._enterThreshold;
|
|
127
|
+
this._softMaxStrength = clamp$2(config.softMaxStrength ?? .65, 0, 1);
|
|
128
|
+
this._cooldownMs = config.cooldownMs ?? DEFAULT_COOLDOWN_MS;
|
|
129
|
+
}
|
|
130
|
+
reset() {
|
|
131
|
+
this._activeGuideId = null;
|
|
132
|
+
this._activeGuideStartValue = null;
|
|
133
|
+
this._releasedUntil = 0;
|
|
134
|
+
}
|
|
135
|
+
resolveAxisSnap(options) {
|
|
136
|
+
const { value, guide } = options;
|
|
137
|
+
const now = options.now ?? Date.now();
|
|
138
|
+
if (!guide) {
|
|
139
|
+
this._activeGuideId = null;
|
|
140
|
+
this._activeGuideStartValue = null;
|
|
141
|
+
return {
|
|
142
|
+
snapped: false,
|
|
143
|
+
value,
|
|
144
|
+
guide: null
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const distance = Math.abs(value - guide.position);
|
|
148
|
+
if (this._activeGuideId === guide.id) {
|
|
149
|
+
const rawDragDistance = this._activeGuideStartValue === null ? 0 : Math.abs(value - this._activeGuideStartValue);
|
|
150
|
+
const isPastBreakaway = this._breakawayThreshold !== void 0 && rawDragDistance > this._breakawayThreshold;
|
|
151
|
+
const exitThreshold = this._softThreshold ?? this._exitThreshold;
|
|
152
|
+
if (isPastBreakaway || distance > exitThreshold) {
|
|
153
|
+
this._activeGuideId = null;
|
|
154
|
+
this._activeGuideStartValue = null;
|
|
155
|
+
this._releasedUntil = now + this._cooldownMs;
|
|
156
|
+
return {
|
|
157
|
+
snapped: false,
|
|
158
|
+
value,
|
|
159
|
+
guide: null
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
snapped: true,
|
|
164
|
+
value: this._resolveSnappedValue(value, guide.position),
|
|
165
|
+
guide
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (this._releasedUntil > now) return {
|
|
169
|
+
snapped: false,
|
|
170
|
+
value,
|
|
171
|
+
guide: null
|
|
172
|
+
};
|
|
173
|
+
if (distance <= (this._softThreshold ?? this._enterThreshold)) {
|
|
174
|
+
this._activeGuideId = guide.id;
|
|
175
|
+
this._activeGuideStartValue = value;
|
|
176
|
+
return {
|
|
177
|
+
snapped: true,
|
|
178
|
+
value: this._resolveSnappedValue(value, guide.position),
|
|
179
|
+
guide
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
snapped: false,
|
|
184
|
+
value,
|
|
185
|
+
guide: null
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
_resolveSnappedValue(value, guidePosition) {
|
|
189
|
+
if (this._softThreshold === void 0) return guidePosition;
|
|
190
|
+
const distance = Math.abs(value - guidePosition);
|
|
191
|
+
if (distance <= this._hardThreshold) return guidePosition;
|
|
192
|
+
if (distance >= this._softThreshold) return value;
|
|
193
|
+
const span = Math.max(this._softThreshold - this._hardThreshold, .001);
|
|
194
|
+
const progress = clamp$2((this._softThreshold - distance) / span, 0, 1);
|
|
195
|
+
const strength = progress * progress * (3 - 2 * progress) * this._softMaxStrength;
|
|
196
|
+
return value + (guidePosition - value) * strength;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
function clamp$2(value, min, max) {
|
|
200
|
+
return Math.min(Math.max(value, min), max);
|
|
201
|
+
}
|
|
202
|
+
|
|
66
203
|
//#endregion
|
|
67
204
|
//#region src/components/docs/layout/shaping-engine/font-cache.ts
|
|
68
205
|
const DEFAULT_MEASURE_TEXT = "0";
|
|
@@ -743,14 +880,11 @@ function getParagraphByGlyph(glyph, body) {
|
|
|
743
880
|
for (let i = 0; i < paragraphs.length; i++) {
|
|
744
881
|
const paragraph = paragraphs[i];
|
|
745
882
|
const prevParagraph = paragraphs[i - 1];
|
|
746
|
-
if (paragraph.startIndex === line.paragraphIndex) {
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
paragraphEnd: paragraph.startIndex
|
|
752
|
-
};
|
|
753
|
-
}
|
|
883
|
+
if (paragraph.startIndex === line.paragraphIndex) return {
|
|
884
|
+
...paragraph,
|
|
885
|
+
paragraphStart: ((prevParagraph === null || prevParagraph === void 0 ? void 0 : prevParagraph.startIndex) ?? -1) + 1,
|
|
886
|
+
paragraphEnd: paragraph.startIndex
|
|
887
|
+
};
|
|
754
888
|
}
|
|
755
889
|
}
|
|
756
890
|
function isPlaceholderOrSpace(glyph) {
|
|
@@ -777,6 +911,10 @@ const PI_OVER_DEG180 = Math.PI / DEG180;
|
|
|
777
911
|
const DEG180_OVER_PI = DEG180 / Math.PI;
|
|
778
912
|
const RGB_PAREN = "rgb(";
|
|
779
913
|
const RGBA_PAREN = "rgba(";
|
|
914
|
+
const SCROLLABLE_OVERFLOW_EPSILON = .5;
|
|
915
|
+
function hasScrollableOverflow(contentSize, viewportSize) {
|
|
916
|
+
return contentSize - viewportSize > SCROLLABLE_OVERFLOW_EPSILON;
|
|
917
|
+
}
|
|
780
918
|
const getColor = (RgbArray, opacity) => {
|
|
781
919
|
if (!RgbArray) return `${RGB_PAREN}0,0,0)`;
|
|
782
920
|
if (opacity != null) return `${RGBA_PAREN + RgbArray.join(",")},${opacity})`;
|
|
@@ -928,10 +1066,7 @@ function getFontStyleString(textStyle) {
|
|
|
928
1066
|
}
|
|
929
1067
|
function normalizeFontFamily(fontFamily, defaultFont) {
|
|
930
1068
|
if (!(fontFamily === null || fontFamily === void 0 ? void 0 : fontFamily.trim())) return defaultFont;
|
|
931
|
-
return fontFamily.split(",").map((item) => {
|
|
932
|
-
const family = item.trim().replace(/^['"]|['"]$/g, "");
|
|
933
|
-
return family.includes(" ") ? `"${family}"` : family;
|
|
934
|
-
}).filter(Boolean).join(", ");
|
|
1069
|
+
return fontFamily.split(",").map((item) => item.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean).map((family) => /^[\p{L}_-][\p{L}\p{N}_-]*$/u.test(family) ? family : `"${family.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`).join(", ");
|
|
935
1070
|
}
|
|
936
1071
|
function hasAllLatin(text) {
|
|
937
1072
|
if (!/[\u0000-\u024F]/gi.exec(text)) return false;
|
|
@@ -955,8 +1090,8 @@ function hasLatinExtendedB(text) {
|
|
|
955
1090
|
}
|
|
956
1091
|
const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
957
1092
|
function getFirstGrapheme(text) {
|
|
958
|
-
var _it$next$value
|
|
959
|
-
return (
|
|
1093
|
+
var _it$next$value;
|
|
1094
|
+
return ((_it$next$value = segmenter.segment(text)[Symbol.iterator]().next().value) === null || _it$next$value === void 0 ? void 0 : _it$next$value.segment) ?? null;
|
|
960
1095
|
}
|
|
961
1096
|
function isEmojiGrapheme(grapheme) {
|
|
962
1097
|
if (/\p{Extended_Pictographic}/u.test(grapheme)) return true;
|
|
@@ -2605,10 +2740,13 @@ var RollingAverage = class {
|
|
|
2605
2740
|
delta = bottomValue - this.averageFrameTime;
|
|
2606
2741
|
this._m2 -= delta * (bottomValue - this.averageFrameTime);
|
|
2607
2742
|
} else this._sampleCount++;
|
|
2608
|
-
const
|
|
2609
|
-
const
|
|
2610
|
-
|
|
2611
|
-
|
|
2743
|
+
const shouldTrimExtremes = this.isSaturated() && this._sampleCount > 2;
|
|
2744
|
+
const sampleSum = this._samples.reduce((sum, value) => sum + value, 0);
|
|
2745
|
+
if (shouldTrimExtremes) {
|
|
2746
|
+
const min = Math.min(...this._samples);
|
|
2747
|
+
const max = Math.max(...this._samples);
|
|
2748
|
+
this.averageFrameTime = (sampleSum - min - max) / (this._sampleCount - 2);
|
|
2749
|
+
} else this.averageFrameTime = sampleSum / this._sampleCount;
|
|
2612
2750
|
delta = frameDuration - this.averageFrameTime;
|
|
2613
2751
|
this._m2 += delta * (frameDuration - this.averageFrameTime);
|
|
2614
2752
|
this.variance = this._m2 / (this._sampleCount - 1);
|
|
@@ -3021,9 +3159,8 @@ var Transform = class Transform {
|
|
|
3021
3159
|
* @return {number[]} transform matrix
|
|
3022
3160
|
*/
|
|
3023
3161
|
_calcDimensionsMatrix(options) {
|
|
3024
|
-
|
|
3025
|
-
const
|
|
3026
|
-
const scaleY = (_options$scaleY = options.scaleY) !== null && _options$scaleY !== void 0 ? _options$scaleY : 1;
|
|
3162
|
+
const scaleX = options.scaleX ?? 1;
|
|
3163
|
+
const scaleY = options.scaleY ?? 1;
|
|
3027
3164
|
const scaleMatrix = new Transform([
|
|
3028
3165
|
options.flipX ? -scaleX : scaleX,
|
|
3029
3166
|
0,
|
|
@@ -3547,6 +3684,26 @@ var BaseObject = class extends Disposable {
|
|
|
3547
3684
|
flipY: this.flipY
|
|
3548
3685
|
};
|
|
3549
3686
|
}
|
|
3687
|
+
/**
|
|
3688
|
+
* Returns the flip state after composing this object with every ancestor
|
|
3689
|
+
* drawing group whose transform participates in rendering.
|
|
3690
|
+
*/
|
|
3691
|
+
getEffectiveFlipState() {
|
|
3692
|
+
let flipX = this.flipX;
|
|
3693
|
+
let flipY = this.flipY;
|
|
3694
|
+
let isInGroup = this.isInGroup;
|
|
3695
|
+
let parent = this.getParent();
|
|
3696
|
+
while (isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group") {
|
|
3697
|
+
flipX = flipX !== Boolean(parent.flipX);
|
|
3698
|
+
flipY = flipY !== Boolean(parent.flipY);
|
|
3699
|
+
isInGroup = Boolean(parent.isInGroup);
|
|
3700
|
+
parent = parent.getParent();
|
|
3701
|
+
}
|
|
3702
|
+
return {
|
|
3703
|
+
flipX,
|
|
3704
|
+
flipY
|
|
3705
|
+
};
|
|
3706
|
+
}
|
|
3550
3707
|
getRealBound() {
|
|
3551
3708
|
var _this$parent, _this$parent2;
|
|
3552
3709
|
let { width: realWidth, height: realHeight, left: realLeft, top: realTop } = this;
|
|
@@ -3561,16 +3718,21 @@ var BaseObject = class extends Disposable {
|
|
|
3561
3718
|
width: parentRealBound.width || 0,
|
|
3562
3719
|
height: parentRealBound.height || 0
|
|
3563
3720
|
};
|
|
3564
|
-
const
|
|
3721
|
+
const rotatedBound = getRotatedBoundInGroup({
|
|
3565
3722
|
width: realWidth,
|
|
3566
3723
|
height: realHeight,
|
|
3567
3724
|
left: realLeft,
|
|
3568
3725
|
top: realTop
|
|
3569
|
-
});
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3726
|
+
}, this.angle);
|
|
3727
|
+
const mappedRotatedBound = getRenderTransformBaseOnParentBound(baseBound, parentBound, rotatedBound);
|
|
3728
|
+
const normalizedAngle = (this.angle % 360 + 360) % 360;
|
|
3729
|
+
const swapsAxes = normalizedAngle >= 45 && normalizedAngle < 135 || normalizedAngle >= 225 && normalizedAngle < 315;
|
|
3730
|
+
const mappedCenterX = mappedRotatedBound.left + mappedRotatedBound.width / 2;
|
|
3731
|
+
const mappedCenterY = mappedRotatedBound.top + mappedRotatedBound.height / 2;
|
|
3732
|
+
realWidth = swapsAxes ? mappedRotatedBound.height : mappedRotatedBound.width;
|
|
3733
|
+
realHeight = swapsAxes ? mappedRotatedBound.width : mappedRotatedBound.height;
|
|
3734
|
+
realLeft = mappedCenterX - realWidth / 2 - parentBound.left - parentBound.width / 2;
|
|
3735
|
+
realTop = mappedCenterY - realHeight / 2 - parentBound.top - parentBound.height / 2;
|
|
3574
3736
|
}
|
|
3575
3737
|
return {
|
|
3576
3738
|
left: realLeft,
|
|
@@ -3858,6 +4020,10 @@ function colorWithOpacity(color, opacity) {
|
|
|
3858
4020
|
if (!parsedColor.isValid) return color;
|
|
3859
4021
|
return parsedColor.setAlpha(parsedColor.getAlpha() * clamp(opacity, 0, 1)).toRgbString();
|
|
3860
4022
|
}
|
|
4023
|
+
function isTransparentColor(color) {
|
|
4024
|
+
const parsedColor = new ColorKit(color);
|
|
4025
|
+
return parsedColor.isValid && parsedColor.getAlpha() <= 0;
|
|
4026
|
+
}
|
|
3861
4027
|
function cssPixels(value) {
|
|
3862
4028
|
return `${Math.abs(value) < Number.EPSILON ? 0 : value}px`;
|
|
3863
4029
|
}
|
|
@@ -3865,24 +4031,24 @@ function toDropShadowFilter(effect) {
|
|
|
3865
4031
|
return `drop-shadow(${cssPixels(effect.offsetX)} ${cssPixels(effect.offsetY)} ${cssPixels(effect.blurRadius)} ${effect.color})`;
|
|
3866
4032
|
}
|
|
3867
4033
|
function resolveOuterShadowEffect(effect) {
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
const
|
|
3871
|
-
const
|
|
3872
|
-
const
|
|
4034
|
+
if (!(effect === null || effect === void 0 ? void 0 : effect.color) || effect.opacity !== void 0 && effect.opacity <= 0) return;
|
|
4035
|
+
const distance = effect.distance ?? 0;
|
|
4036
|
+
const direction = (effect.direction ?? 0) * Math.PI / 180;
|
|
4037
|
+
const sizeScale = ((effect.sx ?? 1) + (effect.sy ?? 1)) / 2;
|
|
4038
|
+
const color = colorWithOpacity(effect.color, effect.opacity);
|
|
4039
|
+
if (isTransparentColor(color)) return;
|
|
3873
4040
|
return {
|
|
3874
|
-
color
|
|
3875
|
-
blurRadius: Math.max(0,
|
|
4041
|
+
color,
|
|
4042
|
+
blurRadius: Math.max(0, effect.blurRadius ?? 0) * sizeScale,
|
|
3876
4043
|
offsetX: Math.cos(direction) * distance * sizeScale,
|
|
3877
4044
|
offsetY: Math.sin(direction) * distance * sizeScale
|
|
3878
4045
|
};
|
|
3879
4046
|
}
|
|
3880
4047
|
function resolveGlowEffect(effect) {
|
|
3881
|
-
|
|
3882
|
-
if (!(effect === null || effect === void 0 ? void 0 : effect.color)) return;
|
|
4048
|
+
if (!(effect === null || effect === void 0 ? void 0 : effect.color) || (effect.radius ?? 0) <= 0 || isTransparentColor(effect.color)) return;
|
|
3883
4049
|
return {
|
|
3884
4050
|
color: effect.color,
|
|
3885
|
-
blurRadius: Math.max(0,
|
|
4051
|
+
blurRadius: Math.max(0, effect.radius ?? 0) * DRAWINGML_GLOW_BLUR_SCALE,
|
|
3886
4052
|
offsetX: 0,
|
|
3887
4053
|
offsetY: 0
|
|
3888
4054
|
};
|
|
@@ -4165,7 +4331,27 @@ var UniverRenderingContext2D = class {
|
|
|
4165
4331
|
return this._context.createConicGradient(startAngle, x, y);
|
|
4166
4332
|
}
|
|
4167
4333
|
roundRect(x, y, w, h, radii) {
|
|
4168
|
-
this._context.roundRect
|
|
4334
|
+
if (typeof this._context.roundRect === "function") {
|
|
4335
|
+
this._context.roundRect(x, y, w, h, radii);
|
|
4336
|
+
return;
|
|
4337
|
+
}
|
|
4338
|
+
const radius = typeof radii === "number" ? Math.min(radii, w / 2, h / 2) : 0;
|
|
4339
|
+
if (!(radius > 0) || !Number.isFinite(radius)) {
|
|
4340
|
+
this._context.rect(x, y, w, h);
|
|
4341
|
+
return;
|
|
4342
|
+
}
|
|
4343
|
+
const right = x + w;
|
|
4344
|
+
const bottom = y + h;
|
|
4345
|
+
this._context.moveTo(x + radius, y);
|
|
4346
|
+
this._context.lineTo(right - radius, y);
|
|
4347
|
+
this._context.quadraticCurveTo(right, y, right, y + radius);
|
|
4348
|
+
this._context.lineTo(right, bottom - radius);
|
|
4349
|
+
this._context.quadraticCurveTo(right, bottom, right - radius, bottom);
|
|
4350
|
+
this._context.lineTo(x + radius, bottom);
|
|
4351
|
+
this._context.quadraticCurveTo(x, bottom, x, bottom - radius);
|
|
4352
|
+
this._context.lineTo(x, y + radius);
|
|
4353
|
+
this._context.quadraticCurveTo(x, y, x + radius, y);
|
|
4354
|
+
this._context.closePath();
|
|
4169
4355
|
}
|
|
4170
4356
|
roundRectByPrecision(x, y, w, h, radii) {
|
|
4171
4357
|
const { scaleX, scaleY } = this._getScale();
|
|
@@ -5171,11 +5357,10 @@ var Background = class extends SheetExtension {
|
|
|
5171
5357
|
const bgColorMatrix = bgMatrixCacheByColor[rgb];
|
|
5172
5358
|
const renderRanges = diffRanges && diffRanges.length > 0 ? diffRanges : viewRanges;
|
|
5173
5359
|
const rangeForEachFn = (row, col, bgConfigParam) => {
|
|
5174
|
-
var _backgroundPositions$;
|
|
5175
5360
|
if (hasMergeData) {
|
|
5176
5361
|
if (spreadsheetSkeleton.worksheet.getSpanModel().getMergeDataIndex(row, col) !== -1) return;
|
|
5177
5362
|
}
|
|
5178
|
-
const cellInfo = (
|
|
5363
|
+
const cellInfo = (backgroundPositions === null || backgroundPositions === void 0 ? void 0 : backgroundPositions.getValue(row, col)) ?? spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
|
|
5179
5364
|
if (!cellInfo) return;
|
|
5180
5365
|
if (bgConfigParam || bgColorMatrix.getValue(row, col)) {
|
|
5181
5366
|
renderBGContext.cellInfo = cellInfo;
|
|
@@ -5554,26 +5739,22 @@ var ColumnHeaderLayout = class extends SheetExtension {
|
|
|
5554
5739
|
}
|
|
5555
5740
|
configHeaderColumn(cfg, sheetId) {
|
|
5556
5741
|
if (sheetId) {
|
|
5557
|
-
|
|
5558
|
-
this.
|
|
5559
|
-
this.headerStyleOfWorksheet.set(sheetId, (_cfg$headerStyle = cfg.headerStyle) !== null && _cfg$headerStyle !== void 0 ? _cfg$headerStyle : {});
|
|
5742
|
+
this.columnsCfgOfWorksheet.set(sheetId, cfg.columnsCfg ?? {});
|
|
5743
|
+
this.headerStyleOfWorksheet.set(sheetId, cfg.headerStyle ?? {});
|
|
5560
5744
|
} else {
|
|
5561
|
-
|
|
5562
|
-
this.
|
|
5563
|
-
this.headerStyle = (_cfg$headerStyle2 = cfg.headerStyle) !== null && _cfg$headerStyle2 !== void 0 ? _cfg$headerStyle2 : {};
|
|
5745
|
+
this.columnsCfg = cfg.columnsCfg ?? {};
|
|
5746
|
+
this.headerStyle = cfg.headerStyle ?? {};
|
|
5564
5747
|
}
|
|
5565
5748
|
}
|
|
5566
5749
|
getColumnsCfg(sheetId) {
|
|
5567
|
-
|
|
5568
|
-
const columnsCfg = (_this$columnsCfgOfWor = this.columnsCfgOfWorksheet.get(sheetId)) !== null && _this$columnsCfgOfWor !== void 0 ? _this$columnsCfgOfWor : {};
|
|
5750
|
+
const columnsCfg = this.columnsCfgOfWorksheet.get(sheetId) ?? {};
|
|
5569
5751
|
return {
|
|
5570
5752
|
...this.columnsCfg,
|
|
5571
5753
|
...columnsCfg
|
|
5572
5754
|
};
|
|
5573
5755
|
}
|
|
5574
5756
|
getHeaderStyle(sheetId) {
|
|
5575
|
-
|
|
5576
|
-
const headerStyle = (_this$headerStyleOfWo = this.headerStyleOfWorksheet.get(sheetId)) !== null && _this$headerStyleOfWo !== void 0 ? _this$headerStyleOfWo : {};
|
|
5757
|
+
const headerStyle = this.headerStyleOfWorksheet.get(sheetId) ?? {};
|
|
5577
5758
|
return {
|
|
5578
5759
|
...DEFAULT_COLUMN_STYLE,
|
|
5579
5760
|
...this.headerStyle,
|
|
@@ -5624,13 +5805,12 @@ var ColumnHeaderLayout = class extends SheetExtension {
|
|
|
5624
5805
|
let preColumnPosition = 0;
|
|
5625
5806
|
const colGaps = (_spreadsheetSkeleton$ = spreadsheetSkeleton.gapConfig) === null || _spreadsheetSkeleton$ === void 0 ? void 0 : _spreadsheetSkeleton$.colGaps;
|
|
5626
5807
|
for (let c = startColumn - 1; c <= endColumn; c++) {
|
|
5627
|
-
var _colGaps$c
|
|
5808
|
+
var _colGaps$c;
|
|
5628
5809
|
if (c < 0 || c > columnWidthAccumulation.length - 1) continue;
|
|
5629
5810
|
const columnEndPosition = columnWidthAccumulation[c];
|
|
5630
5811
|
if (preColumnPosition === columnEndPosition) continue;
|
|
5631
|
-
const gapSize = (
|
|
5812
|
+
const gapSize = (colGaps === null || colGaps === void 0 || (_colGaps$c = colGaps[c]) === null || _colGaps$c === void 0 ? void 0 : _colGaps$c.size) ?? 0;
|
|
5632
5813
|
if (gapSize > 0) {
|
|
5633
|
-
var _gapItem$color, _gapItem$stripeColor;
|
|
5634
5814
|
const gapItem = colGaps[c];
|
|
5635
5815
|
const gapLeft = preColumnPosition;
|
|
5636
5816
|
const gapRight = preColumnPosition + gapSize;
|
|
@@ -5638,14 +5818,14 @@ var ColumnHeaderLayout = class extends SheetExtension {
|
|
|
5638
5818
|
const defaultBg = defaultBackgroundColor;
|
|
5639
5819
|
const defaultStripe = defaultStripeColor;
|
|
5640
5820
|
ctx.save();
|
|
5641
|
-
ctx.fillStyle =
|
|
5821
|
+
ctx.fillStyle = gapItem.color ?? defaultBg;
|
|
5642
5822
|
ctx.fillRectByPrecision(gapLeft, 0, gapSize, columnHeaderHeight);
|
|
5643
5823
|
ctx.restore();
|
|
5644
5824
|
ctx.save();
|
|
5645
5825
|
ctx.beginPath();
|
|
5646
5826
|
ctx.rectByPrecision(gapLeft, 0, gapSize, columnHeaderHeight);
|
|
5647
5827
|
ctx.clip();
|
|
5648
|
-
ctx.strokeStyle =
|
|
5828
|
+
ctx.strokeStyle = gapItem.stripeColor ?? defaultStripe;
|
|
5649
5829
|
ctx.lineWidth = 1;
|
|
5650
5830
|
ctx.beginPath();
|
|
5651
5831
|
const spacing = 6;
|
|
@@ -11886,7 +12066,7 @@ var Shape = class extends BaseObject {
|
|
|
11886
12066
|
*/
|
|
11887
12067
|
static _renderStroke(ctx, props) {
|
|
11888
12068
|
const { stroke, strokeWidth, strokeScaleEnabled } = props;
|
|
11889
|
-
if (!stroke || strokeWidth === 0) return;
|
|
12069
|
+
if (!stroke || strokeWidth === void 0 || !Number.isFinite(strokeWidth) || strokeWidth <= 0) return;
|
|
11890
12070
|
ctx.save();
|
|
11891
12071
|
this._setStrokeStyles(ctx, props);
|
|
11892
12072
|
ctx.stroke();
|
|
@@ -12039,7 +12219,6 @@ const TEXT_OBJECT_ARRAY = [
|
|
|
12039
12219
|
];
|
|
12040
12220
|
var Text = class Text extends Shape {
|
|
12041
12221
|
constructor(key, props) {
|
|
12042
|
-
var _props$warp, _props$hAlign, _props$vAlign;
|
|
12043
12222
|
super(key, props);
|
|
12044
12223
|
_defineProperty(this, "text", void 0);
|
|
12045
12224
|
_defineProperty(this, "fontStyle", void 0);
|
|
@@ -12051,22 +12230,21 @@ var Text = class Text extends Shape {
|
|
|
12051
12230
|
this.height = props.height;
|
|
12052
12231
|
this.text = props.text;
|
|
12053
12232
|
this.fontStyle = props.fontStyle;
|
|
12054
|
-
this.warp =
|
|
12055
|
-
this.hAlign =
|
|
12056
|
-
this.vAlign =
|
|
12233
|
+
this.warp = props.warp ?? false;
|
|
12234
|
+
this.hAlign = props.hAlign ?? HorizontalAlign.LEFT;
|
|
12235
|
+
this.vAlign = props.vAlign ?? VerticalAlign.TOP;
|
|
12057
12236
|
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height);
|
|
12058
12237
|
}
|
|
12059
12238
|
static drawWith(ctx, props, _skeleton) {
|
|
12060
|
-
var _cachedLayout$lines, _cachedLayout$totalHe, _props$color;
|
|
12061
12239
|
const { text, fontStyle, warp, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12062
12240
|
const cachedLayout = !_skeleton && !warp ? Text._getCachedLayout(text, fontStyle) : null;
|
|
12063
|
-
const skeleton = cachedLayout ? null : _skeleton
|
|
12064
|
-
const lines = (
|
|
12065
|
-
const totalHeight = (
|
|
12241
|
+
const skeleton = cachedLayout ? null : _skeleton ?? new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === VerticalAlign.TOP ? height : Infinity);
|
|
12242
|
+
const lines = (cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.lines) ?? skeleton.calculate();
|
|
12243
|
+
const totalHeight = (cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.totalHeight) ?? skeleton.getTotalHeight();
|
|
12066
12244
|
let lineTop = top + (vAlign === VerticalAlign.TOP ? 0 : vAlign === VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
12067
12245
|
ctx.save();
|
|
12068
12246
|
ctx.font = fontStyle;
|
|
12069
|
-
ctx.fillStyle =
|
|
12247
|
+
ctx.fillStyle = props.color ?? "rgb(0,0,0)";
|
|
12070
12248
|
for (const line of lines) {
|
|
12071
12249
|
const lineHeight = line.height;
|
|
12072
12250
|
const lineWidth = line.width;
|
|
@@ -12089,17 +12267,14 @@ var Text = class Text extends Shape {
|
|
|
12089
12267
|
}
|
|
12090
12268
|
const baselineY = lineTop + line.baseline;
|
|
12091
12269
|
ctx.fillText(line.text, left + lineX, baselineY);
|
|
12092
|
-
if (props.underline) {
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
12099
|
-
|
|
12100
|
-
lineType: (_props$underlineType = props.underlineType) !== null && _props$underlineType !== void 0 ? _props$underlineType : TextDecoration.SINGLE
|
|
12101
|
-
});
|
|
12102
|
-
}
|
|
12270
|
+
if (props.underline) this._drawTextDecoration(ctx, {
|
|
12271
|
+
x: left + lineX,
|
|
12272
|
+
y: lineTop + lineHeight - 1,
|
|
12273
|
+
width: lineWidth,
|
|
12274
|
+
color: props.color || "#000000",
|
|
12275
|
+
lineWidth: 1,
|
|
12276
|
+
lineType: props.underlineType ?? TextDecoration.SINGLE
|
|
12277
|
+
});
|
|
12103
12278
|
if (props.strokeLine) this._drawTextDecoration(ctx, {
|
|
12104
12279
|
x: left + lineX,
|
|
12105
12280
|
y: lineTop + line.baseline - lineHeight * .3,
|
|
@@ -12114,12 +12289,11 @@ var Text = class Text extends Shape {
|
|
|
12114
12289
|
return totalHeight;
|
|
12115
12290
|
}
|
|
12116
12291
|
static drawPlainWith(ctx, props) {
|
|
12117
|
-
var _props$color2;
|
|
12118
12292
|
const { text, fontStyle, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12119
12293
|
const { lines, totalHeight } = Text._getCachedLayout(text, fontStyle);
|
|
12120
12294
|
let lineTop = top + (vAlign === VerticalAlign.TOP ? 0 : vAlign === VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
12121
12295
|
ctx.font = fontStyle;
|
|
12122
|
-
ctx.fillStyle =
|
|
12296
|
+
ctx.fillStyle = props.color ?? "rgb(0,0,0)";
|
|
12123
12297
|
for (const line of lines) {
|
|
12124
12298
|
const lineWidth = line.width;
|
|
12125
12299
|
let lineX = 0;
|
|
@@ -12464,12 +12638,10 @@ function setDocsTableRenderViewportProvider(provider) {
|
|
|
12464
12638
|
docsTableRenderViewportProvider = provider;
|
|
12465
12639
|
}
|
|
12466
12640
|
function getDocsTableRenderViewport(unitId, tableId) {
|
|
12467
|
-
|
|
12468
|
-
return (_docsTableRenderViewp = docsTableRenderViewportProvider === null || docsTableRenderViewportProvider === void 0 ? void 0 : docsTableRenderViewportProvider(unitId, tableId)) !== null && _docsTableRenderViewp !== void 0 ? _docsTableRenderViewp : null;
|
|
12641
|
+
return (docsTableRenderViewportProvider === null || docsTableRenderViewportProvider === void 0 ? void 0 : docsTableRenderViewportProvider(unitId, tableId)) ?? null;
|
|
12469
12642
|
}
|
|
12470
12643
|
function getDocsTableVirtualContentWidth(viewport) {
|
|
12471
|
-
|
|
12472
|
-
return ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0) + viewport.contentWidth + ((_viewport$trailingIns = viewport.trailingInsetRight) !== null && _viewport$trailingIns !== void 0 ? _viewport$trailingIns : 0);
|
|
12644
|
+
return (viewport.leadingInsetLeft ?? 0) + viewport.contentWidth + (viewport.trailingInsetRight ?? 0);
|
|
12473
12645
|
}
|
|
12474
12646
|
function getDocsTableViewportLeft(viewport, fallbackLeft, docsLeft = 0) {
|
|
12475
12647
|
return (viewport === null || viewport === void 0 ? void 0 : viewport.viewportLeft) != null ? viewport.viewportLeft - docsLeft : fallbackLeft;
|
|
@@ -12659,8 +12831,7 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12659
12831
|
const tempParagraphList = getParagraphList();
|
|
12660
12832
|
const lastParagraph = tempParagraphList[tempParagraphList.length - 1];
|
|
12661
12833
|
if (lastParagraph) {
|
|
12662
|
-
|
|
12663
|
-
lastParagraph.content = `${(_lastParagraph$conten = lastParagraph.content) !== null && _lastParagraph$conten !== void 0 ? _lastParagraph$conten : ""}${char}`;
|
|
12834
|
+
lastParagraph.content = `${lastParagraph.content ?? ""}${char}`;
|
|
12664
12835
|
return true;
|
|
12665
12836
|
}
|
|
12666
12837
|
return false;
|
|
@@ -12689,6 +12860,14 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12689
12860
|
} else if (char === DataStreamTreeTokenType.SECTION_BREAK) {
|
|
12690
12861
|
const sectionNode = DataStreamTreeNode.create(DataStreamTreeNodeType.SECTION_BREAK);
|
|
12691
12862
|
const tempParagraphList = tableCellList.length > 0 ? cellParagraphList : columnGroupList.length > 0 ? columnParagraphList : paragraphList;
|
|
12863
|
+
if (tempParagraphList.length > 0 && currentBlocks.length > 0 && content === DataStreamTreeTokenType.CUSTOM_BLOCK.repeat(currentBlocks.length)) {
|
|
12864
|
+
const blockParagraph = DataStreamTreeNode.create(DataStreamTreeNodeType.PARAGRAPH, content);
|
|
12865
|
+
blockParagraph.setIndexRange(i - content.length, i - 1);
|
|
12866
|
+
blockParagraph.addBlocks(currentBlocks);
|
|
12867
|
+
tempParagraphList.push(blockParagraph);
|
|
12868
|
+
currentBlocks.length = 0;
|
|
12869
|
+
content = "";
|
|
12870
|
+
}
|
|
12692
12871
|
if (tempParagraphList.length === 0) {
|
|
12693
12872
|
const emptyParagraph = DataStreamTreeNode.create(DataStreamTreeNodeType.PARAGRAPH, "");
|
|
12694
12873
|
emptyParagraph.setIndexRange(i, i - 1);
|
|
@@ -12920,37 +13099,37 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12920
13099
|
this._buildColumnGroupCache();
|
|
12921
13100
|
}
|
|
12922
13101
|
_buildParagraphCache() {
|
|
12923
|
-
var _this$getBody
|
|
13102
|
+
var _this$getBody;
|
|
12924
13103
|
this._paragraphCache.clear();
|
|
12925
|
-
const paragraphs = (
|
|
13104
|
+
const paragraphs = ((_this$getBody = this.getBody()) === null || _this$getBody === void 0 ? void 0 : _this$getBody.paragraphs) ?? [];
|
|
12926
13105
|
for (const paragraph of paragraphs) {
|
|
12927
13106
|
const { startIndex } = paragraph;
|
|
12928
13107
|
this._paragraphCache.set(startIndex, paragraph);
|
|
12929
13108
|
}
|
|
12930
13109
|
}
|
|
12931
13110
|
_buildSectionBreakCache() {
|
|
12932
|
-
var _this$
|
|
13111
|
+
var _this$getBody2;
|
|
12933
13112
|
this._sectionBreakCache.clear();
|
|
12934
|
-
const sectionBreaks = (
|
|
13113
|
+
const sectionBreaks = ((_this$getBody2 = this.getBody()) === null || _this$getBody2 === void 0 ? void 0 : _this$getBody2.sectionBreaks) ?? [];
|
|
12935
13114
|
for (const sectionBreak of sectionBreaks) {
|
|
12936
13115
|
const { startIndex } = sectionBreak;
|
|
12937
13116
|
this._sectionBreakCache.set(startIndex, sectionBreak);
|
|
12938
13117
|
}
|
|
12939
13118
|
}
|
|
12940
13119
|
_buildCustomBlockCache() {
|
|
12941
|
-
var _this$
|
|
13120
|
+
var _this$getBody3;
|
|
12942
13121
|
this._customBlockCache.clear();
|
|
12943
|
-
const customBlocks = (
|
|
13122
|
+
const customBlocks = ((_this$getBody3 = this.getBody()) === null || _this$getBody3 === void 0 ? void 0 : _this$getBody3.customBlocks) ?? [];
|
|
12944
13123
|
for (const customBlock of customBlocks) {
|
|
12945
13124
|
const { startIndex } = customBlock;
|
|
12946
13125
|
this._customBlockCache.set(startIndex, customBlock);
|
|
12947
13126
|
}
|
|
12948
13127
|
}
|
|
12949
13128
|
_buildTableCache() {
|
|
12950
|
-
var _this$getBody4
|
|
13129
|
+
var _this$getBody4;
|
|
12951
13130
|
this._tableCache.clear();
|
|
12952
13131
|
const tables = (_this$getBody4 = this.getBody()) === null || _this$getBody4 === void 0 ? void 0 : _this$getBody4.tables;
|
|
12953
|
-
const tableConfig =
|
|
13132
|
+
const tableConfig = this._tableSource ?? this.getSnapshot().tableSource;
|
|
12954
13133
|
if (tables == null || tableConfig == null) return;
|
|
12955
13134
|
for (const table of tables) {
|
|
12956
13135
|
const { startIndex, tableId } = table;
|
|
@@ -12977,8 +13156,8 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12977
13156
|
}
|
|
12978
13157
|
}
|
|
12979
13158
|
_buildTextRunsCache() {
|
|
12980
|
-
var _this$
|
|
12981
|
-
const textRuns = (
|
|
13159
|
+
var _this$getBody6;
|
|
13160
|
+
const textRuns = ((_this$getBody6 = this.getBody()) === null || _this$getBody6 === void 0 ? void 0 : _this$getBody6.textRuns) ?? [];
|
|
12982
13161
|
this._textRunsCache.clear();
|
|
12983
13162
|
for (const textRun of textRuns) {
|
|
12984
13163
|
const { st, ed } = textRun;
|
|
@@ -13024,10 +13203,9 @@ function setDocsCustomBlockRenderViewportProvider(provider) {
|
|
|
13024
13203
|
docsCustomBlockRenderViewportProvider = provider;
|
|
13025
13204
|
docsCustomBlockRenderViewportProviders.add(provider);
|
|
13026
13205
|
return () => {
|
|
13027
|
-
var _providers;
|
|
13028
13206
|
docsCustomBlockRenderViewportProviders.delete(provider);
|
|
13029
13207
|
const providers = Array.from(docsCustomBlockRenderViewportProviders);
|
|
13030
|
-
docsCustomBlockRenderViewportProvider =
|
|
13208
|
+
docsCustomBlockRenderViewportProvider = providers[providers.length - 1] ?? null;
|
|
13031
13209
|
};
|
|
13032
13210
|
}
|
|
13033
13211
|
function getDocsCustomBlockRenderViewport(unitId, blockId, input) {
|
|
@@ -13146,7 +13324,6 @@ function createSkeletonCustomBlockGlyph(config, glyphWidth = 0, glyphHeight = 0,
|
|
|
13146
13324
|
};
|
|
13147
13325
|
}
|
|
13148
13326
|
function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth) {
|
|
13149
|
-
var _config$documentCompa;
|
|
13150
13327
|
const { fontStyle, textStyle, charSpace = 1, gridType = GridType.LINES, snapToGrid = BooleanNumber.FALSE } = config;
|
|
13151
13328
|
const skipWidthList = [
|
|
13152
13329
|
DataStreamTreeTokenType.SECTION_BREAK,
|
|
@@ -13200,9 +13377,9 @@ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth) {
|
|
|
13200
13377
|
let bBox = null;
|
|
13201
13378
|
let xOffset = 0;
|
|
13202
13379
|
bBox = FontCache.getTextSize(content, fontStyle);
|
|
13203
|
-
bBox = applyFontMetricCompatibility(content, fontStyle, bBox,
|
|
13380
|
+
bBox = applyFontMetricCompatibility(content, fontStyle, bBox, config.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy());
|
|
13204
13381
|
const { width: contentWidth = 0 } = bBox;
|
|
13205
|
-
let width = glyphWidth
|
|
13382
|
+
let width = glyphWidth ?? contentWidth;
|
|
13206
13383
|
if (validationGrid(gridType, snapToGrid)) {
|
|
13207
13384
|
width = contentWidth + (cjk.hasCJK(content) ? charSpace : charSpace / 2);
|
|
13208
13385
|
if (gridType === GridType.SNAP_TO_CHARS) xOffset = (width - contentWidth) / 2;
|
|
@@ -13293,11 +13470,10 @@ function glyphShrinkLeft(glyph, amount) {
|
|
|
13293
13470
|
//#endregion
|
|
13294
13471
|
//#region src/components/docs/layout/model/line.ts
|
|
13295
13472
|
function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWidth, lineIndex = 0, isParagraphStart = false, paragraphConfig, page, headerPage, footerPage, columnLeft = 0, sectionTop = 0) {
|
|
13296
|
-
var _page$skeDrawings, _page$skeTables;
|
|
13297
13473
|
const { lineHeight = 15.6, lineTop = 0, contentHeight = 0, paddingLeft = 0, paddingRight = 0, paddingTop = 0, paddingBottom = 0, marginTop = 0, spaceBelowApply = 0 } = lineBoundingBox;
|
|
13298
13474
|
const { skeTablesInParagraph } = paragraphConfig;
|
|
13299
|
-
const pageSkeDrawings =
|
|
13300
|
-
const pageSkeTables =
|
|
13475
|
+
const pageSkeDrawings = page.skeDrawings ?? /* @__PURE__ */ new Map();
|
|
13476
|
+
const pageSkeTables = page.skeTables ?? /* @__PURE__ */ new Map();
|
|
13301
13477
|
const headersDrawings = headerPage === null || headerPage === void 0 ? void 0 : headerPage.skeDrawings;
|
|
13302
13478
|
const footersDrawings = footerPage === null || footerPage === void 0 ? void 0 : footerPage.skeDrawings;
|
|
13303
13479
|
const lineSke = _getLineSke(lineType, paragraphIndex);
|
|
@@ -13358,12 +13534,11 @@ function _getLineTopWithFullColumnWrap(drawing, lineHeight, lineTop, columnLeft,
|
|
|
13358
13534
|
let left = aLeft - columnLeft;
|
|
13359
13535
|
let drawingWidth = width;
|
|
13360
13536
|
if (angle !== 0) {
|
|
13361
|
-
var _boundingBox$top, _boundingBox$height, _boundingBox$left, _boundingBox$width;
|
|
13362
13537
|
const boundingBox = getBoundingBox(angle, left, width, top, height);
|
|
13363
|
-
top =
|
|
13364
|
-
drawingHeight =
|
|
13365
|
-
left =
|
|
13366
|
-
drawingWidth =
|
|
13538
|
+
top = boundingBox.top ?? top;
|
|
13539
|
+
drawingHeight = boundingBox.height ?? drawingHeight;
|
|
13540
|
+
left = boundingBox.left ?? left;
|
|
13541
|
+
drawingWidth = boundingBox.width ?? drawingWidth;
|
|
13367
13542
|
}
|
|
13368
13543
|
const newTop = top - (layoutType === PositionedObjectLayoutType.WRAP_SQUARE ? distT : 0);
|
|
13369
13544
|
const newHeight = drawingHeight + (layoutType === PositionedObjectLayoutType.WRAP_SQUARE ? distB + distT : 0);
|
|
@@ -13390,13 +13565,12 @@ function _getLineTopWidthWrapTopBottom(drawing, lineHeight, lineTop, columnLeft,
|
|
|
13390
13565
|
const { layoutType, distT = 0, distB = 0 } = drawingOrigin;
|
|
13391
13566
|
if (layoutType !== PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) return;
|
|
13392
13567
|
if (columnWidth > 0) {
|
|
13393
|
-
var _bounds$left, _bounds$width;
|
|
13394
13568
|
const bounds = angle === 0 ? {
|
|
13395
13569
|
left: aLeft,
|
|
13396
13570
|
width
|
|
13397
13571
|
} : getBoundingBox(angle, aLeft, width, aTop, height);
|
|
13398
|
-
const drawingLeft =
|
|
13399
|
-
if (drawingLeft + (
|
|
13572
|
+
const drawingLeft = bounds.left ?? aLeft;
|
|
13573
|
+
if (drawingLeft + (bounds.width ?? width) <= columnLeft || drawingLeft >= columnLeft + columnWidth) return;
|
|
13400
13574
|
}
|
|
13401
13575
|
if (angle === 0) {
|
|
13402
13576
|
const newAtop = aTop - distT;
|
|
@@ -13811,7 +13985,7 @@ function rollbackListCache(listLevel, table) {
|
|
|
13811
13985
|
}
|
|
13812
13986
|
}
|
|
13813
13987
|
function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakConfig, availableHeight) {
|
|
13814
|
-
var _viewModel$getTableBy2
|
|
13988
|
+
var _viewModel$getTableBy2;
|
|
13815
13989
|
const skeTables = [];
|
|
13816
13990
|
const { startIndex, endIndex, children: rowNodes } = tableNode;
|
|
13817
13991
|
const table = (_viewModel$getTableBy2 = viewModel.getTableByStartIndex(startIndex)) === null || _viewModel$getTableBy2 === void 0 ? void 0 : _viewModel$getTableBy2.tableSource;
|
|
@@ -13834,7 +14008,7 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
|
|
|
13834
14008
|
skeTables.push(curTableSkeleton);
|
|
13835
14009
|
for (const rowNode of rowNodes) dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, rowNodes.indexOf(rowNode), table, createCache);
|
|
13836
14010
|
updateTableSkeletonsPosition(createCache, curPage, skeTables, table);
|
|
13837
|
-
const documentCompatibilityPolicy =
|
|
14011
|
+
const documentCompatibilityPolicy = sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
|
|
13838
14012
|
return {
|
|
13839
14013
|
skeTables,
|
|
13840
14014
|
fromCurrentPage: skeTables[0].height <= availableHeight + documentCompatibilityPolicy.table.currentPageOverflowTolerance
|
|
@@ -13867,10 +14041,9 @@ function getAvailableHeight(curPage, cache, hasRepeatHeader) {
|
|
|
13867
14041
|
return pageContentHeight;
|
|
13868
14042
|
}
|
|
13869
14043
|
function dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, row, table, cache, isRepeatRow = false) {
|
|
13870
|
-
var _sectionBreakConfig$d2;
|
|
13871
14044
|
const pageContentHeight = getAvailableHeight(curPage, cache, false);
|
|
13872
14045
|
const availableHeight = getAvailableHeight(curPage, cache, true);
|
|
13873
|
-
const documentCompatibilityPolicy =
|
|
14046
|
+
const documentCompatibilityPolicy = sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
|
|
13874
14047
|
const { children: cellNodes, startIndex, endIndex } = rowNode;
|
|
13875
14048
|
const rowSource = table.tableRows[row];
|
|
13876
14049
|
const { trHeight, cantSplit } = rowSource;
|
|
@@ -13989,23 +14162,22 @@ function createMergedCoveredCellPage(ctx, sectionBreakConfig, table, row, col, r
|
|
|
13989
14162
|
return createMergedAwareNullCellPage(ctx, sectionBreakConfig, table, row, col, rowSkeleton);
|
|
13990
14163
|
}
|
|
13991
14164
|
function applyMergedCellSpanHeights(tableSkeleton) {
|
|
13992
|
-
var _tableSkeleton$tableS
|
|
13993
|
-
const tableRows = (_tableSkeleton$tableS =
|
|
14165
|
+
var _tableSkeleton$tableS;
|
|
14166
|
+
const tableRows = ((_tableSkeleton$tableS = tableSkeleton.tableSource) === null || _tableSkeleton$tableS === void 0 ? void 0 : _tableSkeleton$tableS.tableRows) ?? [];
|
|
13994
14167
|
if (tableRows.length === 0) return;
|
|
13995
14168
|
const skeletonRowsByIndex = new Map(tableSkeleton.rows.map((row) => [row.index, row]));
|
|
13996
14169
|
tableRows.forEach((rowSource, rowIndex) => {
|
|
13997
14170
|
rowSource.tableCells.forEach((cellConfig, columnIndex) => {
|
|
13998
|
-
|
|
13999
|
-
const
|
|
14000
|
-
const columnSpan = (_cellConfig$columnSpa = cellConfig.columnSpan) !== null && _cellConfig$columnSpa !== void 0 ? _cellConfig$columnSpa : 1;
|
|
14171
|
+
const rowSpan = cellConfig.rowSpan ?? 1;
|
|
14172
|
+
const columnSpan = cellConfig.columnSpan ?? 1;
|
|
14001
14173
|
if (rowSpan <= 1 && columnSpan <= 1) return;
|
|
14002
14174
|
const masterRow = skeletonRowsByIndex.get(rowIndex);
|
|
14003
14175
|
const masterCell = masterRow === null || masterRow === void 0 ? void 0 : masterRow.cells[columnIndex];
|
|
14004
14176
|
if (!masterCell || masterCell.isMergedCellCovered) return;
|
|
14005
14177
|
let pageHeight = 0;
|
|
14006
14178
|
for (let row = rowIndex; row < rowIndex + rowSpan; row++) {
|
|
14007
|
-
var _skeletonRowsByIndex
|
|
14008
|
-
pageHeight += (
|
|
14179
|
+
var _skeletonRowsByIndex$;
|
|
14180
|
+
pageHeight += ((_skeletonRowsByIndex$ = skeletonRowsByIndex.get(row)) === null || _skeletonRowsByIndex$ === void 0 ? void 0 : _skeletonRowsByIndex$.height) ?? 0;
|
|
14009
14181
|
}
|
|
14010
14182
|
if (pageHeight > 0) masterCell.pageHeight = pageHeight;
|
|
14011
14183
|
});
|
|
@@ -14029,11 +14201,10 @@ function findMergedMasterCell(table, row, col) {
|
|
|
14029
14201
|
const rowSource = table.tableRows[rowIndex];
|
|
14030
14202
|
if (rowSource == null) continue;
|
|
14031
14203
|
for (let columnIndex = 0; columnIndex < rowSource.tableCells.length; columnIndex++) {
|
|
14032
|
-
var _cellConfig$rowSpan2, _cellConfig$columnSpa2;
|
|
14033
14204
|
const cellConfig = rowSource.tableCells[columnIndex];
|
|
14034
14205
|
if (isCoveredTableCell(cellConfig)) continue;
|
|
14035
|
-
const rowSpan = Math.max(1,
|
|
14036
|
-
const columnSpan = Math.max(1,
|
|
14206
|
+
const rowSpan = Math.max(1, cellConfig.rowSpan ?? 1);
|
|
14207
|
+
const columnSpan = Math.max(1, cellConfig.columnSpan ?? 1);
|
|
14037
14208
|
if (rowSpan <= 1 && columnSpan <= 1) continue;
|
|
14038
14209
|
const containsRow = row >= rowIndex && row < rowIndex + rowSpan;
|
|
14039
14210
|
const containsColumn = col >= columnIndex && col < columnIndex + columnSpan;
|
|
@@ -14108,15 +14279,16 @@ function isBeyondDivideWidth(width, divideWidth) {
|
|
|
14108
14279
|
const tolerance = Math.min(MAX_LINE_WIDTH_TOLERANCE, Math.max(MIN_LINE_WIDTH_TOLERANCE, divideWidth * RELATIVE_LINE_WIDTH_TOLERANCE));
|
|
14109
14280
|
return width - divideWidth > tolerance;
|
|
14110
14281
|
}
|
|
14111
|
-
function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth) {
|
|
14112
|
-
var
|
|
14282
|
+
function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth, hangingPunctuation = false) {
|
|
14283
|
+
var _trailingGlyph$adjust;
|
|
14113
14284
|
const width = __getGlyphGroupWidth(glyphGroup);
|
|
14114
|
-
const
|
|
14115
|
-
|
|
14285
|
+
const trailingGlyph = glyphGroup[glyphGroup.length - 1];
|
|
14286
|
+
const trailingShrinkability = (trailingGlyph === null || trailingGlyph === void 0 || (_trailingGlyph$adjust = trailingGlyph.adjustability) === null || _trailingGlyph$adjust === void 0 || (_trailingGlyph$adjust = _trailingGlyph$adjust.shrinkability) === null || _trailingGlyph$adjust === void 0 ? void 0 : _trailingGlyph$adjust[1]) ?? 0;
|
|
14287
|
+
const trailingHangingWidth = hangingPunctuation && trailingGlyph && isCjkLeftAlignedPunctuation(trailingGlyph.content) ? trailingGlyph.width : 0;
|
|
14288
|
+
return isBeyondDivideWidth(offsetLeft + width - Math.max(trailingShrinkability, trailingHangingWidth), divideWidth);
|
|
14116
14289
|
}
|
|
14117
14290
|
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal") {
|
|
14118
14291
|
if (isParagraphFirstShapedText) if (paragraphConfig.bulletSkeleton) {
|
|
14119
|
-
var _paragraphProperties$;
|
|
14120
14292
|
const { bulletSkeleton, paragraphStyle = {} } = paragraphConfig;
|
|
14121
14293
|
const { gridType = GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig;
|
|
14122
14294
|
const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
|
|
@@ -14125,9 +14297,11 @@ function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14125
14297
|
const paragraphProperties = bulletSkeleton.paragraphProperties || {};
|
|
14126
14298
|
paragraphConfig.paragraphStyle = {
|
|
14127
14299
|
...paragraphProperties,
|
|
14128
|
-
hanging:
|
|
14300
|
+
hanging: paragraphProperties.hanging ?? { v: bulletGlyph.width },
|
|
14129
14301
|
...paragraphConfig.paragraphStyle
|
|
14130
14302
|
};
|
|
14303
|
+
const hangingWidth = getNumberUnitValue(paragraphConfig.paragraphStyle.hanging, charSpaceApply);
|
|
14304
|
+
if (hangingWidth > 0) bulletGlyph.width = hangingWidth;
|
|
14131
14305
|
_lineOperator(ctx, [bulletGlyph, ...glyphGroup], pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
14132
14306
|
} else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
14133
14307
|
else _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
@@ -14189,12 +14363,13 @@ function _popHyphenSlice(divide) {
|
|
|
14189
14363
|
function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", defaultSpanMetrics) {
|
|
14190
14364
|
const divideInfo = getLastNotFullDivideInfo(getLastPage(pages));
|
|
14191
14365
|
if (divideInfo) {
|
|
14192
|
-
var _divide$glyphGroup;
|
|
14366
|
+
var _divide$glyphGroup, _paragraphConfig$para;
|
|
14193
14367
|
const { divide, isLast } = divideInfo;
|
|
14194
14368
|
const lastGlyph = divide === null || divide === void 0 || (_divide$glyphGroup = divide.glyphGroup) === null || _divide$glyphGroup === void 0 ? void 0 : _divide$glyphGroup[divide.glyphGroup.length - 1];
|
|
14195
14369
|
const preOffsetLeft = ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.width) || 0) + ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.left) || 0);
|
|
14196
14370
|
const { hyphenationZone } = sectionBreakConfig;
|
|
14197
|
-
|
|
14371
|
+
const hangingPunctuation = ((_paragraphConfig$para = paragraphConfig.paragraphStyle) === null || _paragraphConfig$para === void 0 ? void 0 : _paragraphConfig$para.hangingPunctuation) === BooleanNumber.TRUE;
|
|
14372
|
+
if (isGlyphGroupBeyondDivideWidth(glyphGroup, preOffsetLeft, divide.width, hangingPunctuation)) {
|
|
14198
14373
|
if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length > 0 && glyphGroup[0].streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) {
|
|
14199
14374
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
14200
14375
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
@@ -14218,7 +14393,7 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14218
14393
|
const sliceGlyphGroup = [];
|
|
14219
14394
|
while (glyphGroup.length) {
|
|
14220
14395
|
sliceGlyphGroup.push(glyphGroup.shift());
|
|
14221
|
-
if (isGlyphGroupBeyondDivideWidth(sliceGlyphGroup, 0, divide.width)) {
|
|
14396
|
+
if (isGlyphGroupBeyondDivideWidth(sliceGlyphGroup, 0, divide.width, hangingPunctuation)) {
|
|
14222
14397
|
if (sliceGlyphGroup.length > 1) glyphGroup.unshift(sliceGlyphGroup.pop());
|
|
14223
14398
|
break;
|
|
14224
14399
|
}
|
|
@@ -14270,8 +14445,8 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14270
14445
|
if (currentLine === null || currentLine === void 0 ? void 0 : currentLine.parent) {
|
|
14271
14446
|
const anchorDrawings = __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphConfig.paragraphNonInlineSkeDrawings);
|
|
14272
14447
|
if (anchorDrawings.length > 0) {
|
|
14273
|
-
var _paragraphConfig$
|
|
14274
|
-
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, (_paragraphConfig$
|
|
14448
|
+
var _paragraphConfig$para2, _paragraphConfig$pDra;
|
|
14449
|
+
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, (_paragraphConfig$para2 = paragraphConfig.paragraphStyle) === null || _paragraphConfig$para2 === void 0 ? void 0 : _paragraphConfig$para2.indentStart);
|
|
14275
14450
|
const drawings = __getDrawingPosition(ctx, currentLine.top, currentLine.lineHeight, currentLine.parent, true, (_paragraphConfig$pDra = paragraphConfig.pDrawingAnchor) === null || _paragraphConfig$pDra === void 0 || (_paragraphConfig$pDra = _paragraphConfig$pDra.get(paragraphConfig.paragraphIndex)) === null || _paragraphConfig$pDra === void 0 ? void 0 : _paragraphConfig$pDra.top, anchorDrawings, paragraphAnchorLeft, false);
|
|
14276
14451
|
__updateDrawingPosition(currentLine.parent, drawings);
|
|
14277
14452
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
@@ -14286,7 +14461,7 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
14286
14461
|
} else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultSpanMetrics);
|
|
14287
14462
|
}
|
|
14288
14463
|
function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", defaultSpanMetrics) {
|
|
14289
|
-
var
|
|
14464
|
+
var _skeHeaders$get, _skeFooters$get;
|
|
14290
14465
|
let lastPage = getLastPage(pages);
|
|
14291
14466
|
let columnInfo = getLastNotFullColumnInfo(lastPage);
|
|
14292
14467
|
if (!columnInfo || !columnInfo.column) {
|
|
@@ -14323,8 +14498,8 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14323
14498
|
const namedStyle = namedStyleType !== void 0 ? NAMED_STYLE_SPACE_MAP[namedStyleType] : null;
|
|
14324
14499
|
const { spaceAbove, spaceBelow, indentFirstLine, hanging, indentStart, indentEnd } = {
|
|
14325
14500
|
...originParagraphStyle,
|
|
14326
|
-
spaceAbove:
|
|
14327
|
-
spaceBelow:
|
|
14501
|
+
spaceAbove: originParagraphStyle.spaceAbove ?? (namedStyle === null || namedStyle === void 0 ? void 0 : namedStyle.spaceAbove),
|
|
14502
|
+
spaceBelow: originParagraphStyle.spaceBelow ?? (namedStyle === null || namedStyle === void 0 ? void 0 : namedStyle.spaceBelow)
|
|
14328
14503
|
};
|
|
14329
14504
|
const { paragraphLineGapDefault, linePitch, lineSpacing, spacingRule, snapToGrid, gridType } = getLineHeightConfig(sectionBreakConfig, paragraphConfig);
|
|
14330
14505
|
const hasInlineCustomBlock = (defaultSpanMetrics === null || defaultSpanMetrics === void 0 ? void 0 : defaultSpanMetrics.hasInlineCustomBlock) || glyphGroup.some((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0);
|
|
@@ -14365,9 +14540,9 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14365
14540
|
if (preLine) {
|
|
14366
14541
|
const drawingsInLine = _getCustomBlockIdsInLine(preLine);
|
|
14367
14542
|
if (drawingsInLine.length > 0) {
|
|
14368
|
-
var _ctx$paragraphConfigC
|
|
14543
|
+
var _ctx$paragraphConfigC;
|
|
14369
14544
|
const affectDrawings = (_ctx$paragraphConfigC = ctx.paragraphConfigCache.get(segmentId)) === null || _ctx$paragraphConfigC === void 0 || (_ctx$paragraphConfigC = _ctx$paragraphConfigC.get(preLine.paragraphIndex)) === null || _ctx$paragraphConfigC === void 0 ? void 0 : _ctx$paragraphConfigC.paragraphNonInlineSkeDrawings;
|
|
14370
|
-
const relativeLineDrawings = [...(
|
|
14545
|
+
const relativeLineDrawings = [...(affectDrawings === null || affectDrawings === void 0 ? void 0 : affectDrawings.values()) ?? []].filter((drawing) => drawing.drawingOrigin.docTransform.positionV.relativeFrom === ObjectRelativeFromV.LINE).filter((drawing) => drawingsInLine.includes(drawing.drawingId));
|
|
14371
14546
|
if (relativeLineDrawings.length > 0) __updateAndPositionDrawings(ctx, preLine.top, preLine.lineHeight, column, relativeLineDrawings, preLine.paragraphIndex, isParagraphFirstShapedText);
|
|
14372
14547
|
}
|
|
14373
14548
|
}
|
|
@@ -14481,32 +14656,30 @@ function __updateWrapTablePosition(ctx, table, lineTop, lineHeight, column, para
|
|
|
14481
14656
|
table.left = left;
|
|
14482
14657
|
}
|
|
14483
14658
|
function __getWrapTablePosition(table, column, lineTop, lineHeight, drawingAnchorTop) {
|
|
14484
|
-
var _column$parent, _column$
|
|
14659
|
+
var _column$parent, _column$parent2;
|
|
14485
14660
|
const page = (_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : _column$parent.parent;
|
|
14486
|
-
const sectionTop = (
|
|
14661
|
+
const sectionTop = ((_column$parent2 = column.parent) === null || _column$parent2 === void 0 ? void 0 : _column$parent2.top) ?? 0;
|
|
14487
14662
|
if (page == null) return;
|
|
14488
14663
|
const isPageBreak = __checkPageBreak(column);
|
|
14489
14664
|
const { tableSource, width, height } = table;
|
|
14490
14665
|
const { positionH, positionV } = tableSource.position;
|
|
14491
14666
|
return {
|
|
14492
|
-
left:
|
|
14493
|
-
top:
|
|
14667
|
+
left: getPositionHorizon(positionH, column, page, width, isPageBreak) ?? 0,
|
|
14668
|
+
top: getPositionVertical(positionV, page, sectionTop + lineTop, lineHeight, height, drawingAnchorTop == null ? void 0 : sectionTop + drawingAnchorTop, isPageBreak) ?? 0
|
|
14494
14669
|
};
|
|
14495
14670
|
}
|
|
14496
14671
|
function __avoidFlowAffectingDrawingsForTable(table, page, column) {
|
|
14497
|
-
|
|
14498
|
-
const columnLeft = (_column$left = column.left) !== null && _column$left !== void 0 ? _column$left : 0;
|
|
14672
|
+
const columnLeft = column.left ?? 0;
|
|
14499
14673
|
const tableTop = table.top;
|
|
14500
14674
|
const tableBottom = table.top + table.height;
|
|
14501
14675
|
const tableRight = table.left + table.width;
|
|
14502
14676
|
for (const drawing of page.skeDrawings.values()) {
|
|
14503
|
-
var _drawingOrigin$distR;
|
|
14504
14677
|
const drawingOrigin = drawing.drawingOrigin;
|
|
14505
14678
|
if (drawingOrigin == null || drawingOrigin.layoutType === PositionedObjectLayoutType.INLINE || drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_NONE || drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) continue;
|
|
14506
14679
|
const drawingTop = drawing.aTop;
|
|
14507
14680
|
const drawingBottom = drawing.aTop + drawing.height;
|
|
14508
14681
|
if (drawingTop >= tableBottom || drawingBottom <= tableTop) continue;
|
|
14509
|
-
const drawingRight = drawing.aLeft + drawing.width + (
|
|
14682
|
+
const drawingRight = drawing.aLeft + drawing.width + (drawingOrigin.distR ?? 0);
|
|
14510
14683
|
if (drawing.aLeft >= tableRight || drawingRight <= table.left) continue;
|
|
14511
14684
|
if (drawingRight + table.width <= columnLeft + column.width) table.left = Math.max(table.left, drawingRight);
|
|
14512
14685
|
}
|
|
@@ -14578,11 +14751,10 @@ function _getCustomBlockIdsInLine(line) {
|
|
|
14578
14751
|
}
|
|
14579
14752
|
function __updateTopBottomCustomBlockFlowBottom(paragraphConfig, drawings, sectionTop) {
|
|
14580
14753
|
for (const drawing of drawings) {
|
|
14581
|
-
var _drawingOrigin$distB, _paragraphConfig$topB;
|
|
14582
14754
|
const { drawingOrigin } = drawing;
|
|
14583
14755
|
if (drawingOrigin.layoutType !== PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM || drawingOrigin.behindDoc === BooleanNumber.TRUE) continue;
|
|
14584
|
-
const bottom = drawing.aTop + drawing.height + (
|
|
14585
|
-
paragraphConfig.topBottomCustomBlockFlowBottom = Math.max(
|
|
14756
|
+
const bottom = drawing.aTop + drawing.height + (drawingOrigin.distB ?? 0) - sectionTop;
|
|
14757
|
+
paragraphConfig.topBottomCustomBlockFlowBottom = Math.max(paragraphConfig.topBottomCustomBlockFlowBottom ?? Number.NEGATIVE_INFINITY, bottom);
|
|
14586
14758
|
}
|
|
14587
14759
|
}
|
|
14588
14760
|
function __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
@@ -14641,17 +14813,16 @@ function _reLayoutCheck(ctx, floatObjects, column, paragraphIndex) {
|
|
|
14641
14813
|
floatObjectCache.page.skeDrawings.delete(floatObject.id);
|
|
14642
14814
|
ctx.floatObjectsCache.delete(floatObject.id);
|
|
14643
14815
|
lineIterator([floatObjectCache.page], (line) => {
|
|
14644
|
-
var _column$
|
|
14816
|
+
var _column$parent4;
|
|
14645
14817
|
const { lineHeight } = line;
|
|
14646
14818
|
const column = line.parent;
|
|
14647
14819
|
if (needBreakLineIterator || column == null) return;
|
|
14648
14820
|
const { width: columnWidth, left: columnLeft } = column;
|
|
14649
|
-
const top = ((
|
|
14821
|
+
const top = (((_column$parent4 = column.parent) === null || _column$parent4 === void 0 ? void 0 : _column$parent4.top) ?? 0) + line.top;
|
|
14650
14822
|
if (collisionDetection(floatObjectCache.floatObject, lineHeight, top, columnLeft, columnWidth)) {
|
|
14651
|
-
var _ctx$layoutStartPoint;
|
|
14652
14823
|
needBreakLineIterator = true;
|
|
14653
14824
|
ctx.isDirty = true;
|
|
14654
|
-
ctx.layoutStartPointer[floatObjectCache.page.segmentId] = Math.min(line.paragraphIndex,
|
|
14825
|
+
ctx.layoutStartPointer[floatObjectCache.page.segmentId] = Math.min(line.paragraphIndex, ctx.layoutStartPointer[floatObjectCache.page.segmentId] ?? Number.POSITIVE_INFINITY);
|
|
14655
14826
|
ctx.paragraphsOpenNewPage.add(paragraphIndex);
|
|
14656
14827
|
}
|
|
14657
14828
|
});
|
|
@@ -14659,28 +14830,25 @@ function _reLayoutCheck(ctx, floatObjects, column, paragraphIndex) {
|
|
|
14659
14830
|
}
|
|
14660
14831
|
needBreakLineIterator = false;
|
|
14661
14832
|
lineIterator([page], (line) => {
|
|
14662
|
-
var _lineColumn$parent
|
|
14833
|
+
var _lineColumn$parent;
|
|
14663
14834
|
const { lineHeight } = line;
|
|
14664
14835
|
const lineColumn = line.parent;
|
|
14665
14836
|
if (needBreakLineIterator || lineColumn == null) return;
|
|
14666
14837
|
const { width: columnWidth, left: columnLeft } = lineColumn;
|
|
14667
|
-
const top = ((
|
|
14838
|
+
const top = (((_lineColumn$parent = lineColumn.parent) === null || _lineColumn$parent === void 0 ? void 0 : _lineColumn$parent.top) ?? 0) + line.top;
|
|
14668
14839
|
for (const floatObject of flowAffectingFloatObjects.values()) {
|
|
14669
14840
|
let targetObject = floatObject;
|
|
14670
14841
|
if (ctx.floatObjectsCache.has(floatObject.id)) {
|
|
14671
14842
|
const drawingCache = ctx.floatObjectsCache.get(floatObject.id);
|
|
14672
14843
|
const needRePosition = checkRelativeDrawingNeedRePosition(ctx, floatObject);
|
|
14673
14844
|
if ((drawingCache === null || drawingCache === void 0 ? void 0 : drawingCache.page.segmentId) !== page.segmentId) continue;
|
|
14674
|
-
if (needRePosition)
|
|
14675
|
-
|
|
14676
|
-
targetObject = (_drawingCache$floatOb = drawingCache === null || drawingCache === void 0 ? void 0 : drawingCache.floatObject) !== null && _drawingCache$floatOb !== void 0 ? _drawingCache$floatOb : floatObject;
|
|
14677
|
-
} else continue;
|
|
14845
|
+
if (needRePosition) targetObject = (drawingCache === null || drawingCache === void 0 ? void 0 : drawingCache.floatObject) ?? floatObject;
|
|
14846
|
+
else continue;
|
|
14678
14847
|
}
|
|
14679
14848
|
if (collisionDetection(targetObject, lineHeight, top, columnLeft, columnWidth)) {
|
|
14680
|
-
var _ctx$layoutStartPoint2;
|
|
14681
14849
|
needBreakLineIterator = true;
|
|
14682
14850
|
ctx.isDirty = true;
|
|
14683
|
-
ctx.layoutStartPointer[page.segmentId] = Math.min(line.paragraphIndex,
|
|
14851
|
+
ctx.layoutStartPointer[page.segmentId] = Math.min(line.paragraphIndex, ctx.layoutStartPointer[page.segmentId] ?? Number.POSITIVE_INFINITY);
|
|
14684
14852
|
let drawingCache = ctx.floatObjectsCache.get(floatObject.id);
|
|
14685
14853
|
if (drawingCache == null) {
|
|
14686
14854
|
drawingCache = {
|
|
@@ -14832,7 +15000,7 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
14832
15000
|
};
|
|
14833
15001
|
}
|
|
14834
15002
|
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings) {
|
|
14835
|
-
var _line$parent
|
|
15003
|
+
var _line$parent;
|
|
14836
15004
|
const column = line.parent;
|
|
14837
15005
|
const section = column === null || column === void 0 ? void 0 : column.parent;
|
|
14838
15006
|
const page = line === null || line === void 0 || (_line$parent = line.parent) === null || _line$parent === void 0 || (_line$parent = _line$parent.parent) === null || _line$parent === void 0 ? void 0 : _line$parent.parent;
|
|
@@ -14840,10 +15008,9 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
14840
15008
|
const isPageBreak = __checkPageBreak(column);
|
|
14841
15009
|
const drawings = /* @__PURE__ */ new Map();
|
|
14842
15010
|
const { top, lineHeight, marginBottom = 0 } = line;
|
|
14843
|
-
const sectionTop = (
|
|
15011
|
+
const sectionTop = (section === null || section === void 0 ? void 0 : section.top) ?? 0;
|
|
14844
15012
|
const lineTop = sectionTop + top;
|
|
14845
15013
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0) {
|
|
14846
|
-
var _viewport$width, _viewport$height, _viewport$offsetLeft;
|
|
14847
15014
|
const { drawingId } = glyph;
|
|
14848
15015
|
if (drawingId == null) continue;
|
|
14849
15016
|
const drawing = paragraphInlineSkeDrawings === null || paragraphInlineSkeDrawings === void 0 ? void 0 : paragraphInlineSkeDrawings.get(drawingId);
|
|
@@ -14863,24 +15030,18 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
14863
15030
|
pageMarginRight: page.marginRight,
|
|
14864
15031
|
pageWidth: page.pageWidth
|
|
14865
15032
|
});
|
|
14866
|
-
const drawingWidth = (
|
|
14867
|
-
const drawingHeight = (
|
|
14868
|
-
drawing.aLeft = viewport ? blockLeft + (
|
|
14869
|
-
if (glyph.width > divide.width) {
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
const drawingRight = drawing.aLeft + drawingWidth;
|
|
14879
|
-
if (positionedDrawing.aLeft < drawingRight && positionedRight > drawing.aLeft) {
|
|
14880
|
-
var _positionedOrigin$dis;
|
|
14881
|
-
drawing.aLeft = Math.max(drawing.aLeft, positionedDrawing.aLeft + positionedDrawing.width + ((_positionedOrigin$dis = positionedOrigin.distR) !== null && _positionedOrigin$dis !== void 0 ? _positionedOrigin$dis : 0));
|
|
14882
|
-
}
|
|
14883
|
-
}
|
|
15033
|
+
const drawingWidth = (viewport === null || viewport === void 0 ? void 0 : viewport.width) ?? width;
|
|
15034
|
+
const drawingHeight = (viewport === null || viewport === void 0 ? void 0 : viewport.height) ?? height;
|
|
15035
|
+
drawing.aLeft = viewport ? blockLeft + (viewport.offsetLeft ?? 0) : blockLeft + .5 * glyph.width - .5 * drawingWidth || 0;
|
|
15036
|
+
if (glyph.width > divide.width) for (const positionedDrawing of (paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 ? void 0 : paragraphNonInlineSkeDrawings.values()) ?? []) {
|
|
15037
|
+
const positionedOrigin = positionedDrawing.drawingOrigin;
|
|
15038
|
+
if (positionedOrigin == null || positionedOrigin.layoutType === PositionedObjectLayoutType.INLINE || positionedOrigin.layoutType === PositionedObjectLayoutType.WRAP_NONE || positionedOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) continue;
|
|
15039
|
+
const positionedBottom = positionedDrawing.aTop + positionedDrawing.height;
|
|
15040
|
+
const lineBottom = lineTop + lineHeight;
|
|
15041
|
+
if (positionedDrawing.aTop >= lineBottom || positionedBottom <= lineTop) continue;
|
|
15042
|
+
const positionedRight = positionedDrawing.aLeft + positionedDrawing.width;
|
|
15043
|
+
const drawingRight = drawing.aLeft + drawingWidth;
|
|
15044
|
+
if (positionedDrawing.aLeft < drawingRight && positionedRight > drawing.aLeft) drawing.aLeft = Math.max(drawing.aLeft, positionedDrawing.aLeft + positionedDrawing.width + (positionedOrigin.distR ?? 0));
|
|
14884
15045
|
}
|
|
14885
15046
|
drawing.width = drawingWidth;
|
|
14886
15047
|
drawing.height = drawingHeight;
|
|
@@ -14892,6 +15053,8 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
14892
15053
|
contentHeight: viewport.contentHeight,
|
|
14893
15054
|
contentWidth: viewport.contentWidth,
|
|
14894
15055
|
height: viewport.height,
|
|
15056
|
+
pageContentWidth: viewport.pageContentWidth,
|
|
15057
|
+
viewScale: viewport.viewScale,
|
|
14895
15058
|
viewportHeight: viewport.viewportHeight
|
|
14896
15059
|
} : void 0;
|
|
14897
15060
|
drawing.isPageBreak = isPageBreak;
|
|
@@ -14904,41 +15067,41 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
14904
15067
|
page.skeDrawings = new Map([...page.skeDrawings, ...drawings]);
|
|
14905
15068
|
}
|
|
14906
15069
|
function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0, normalizeTraditionalColumnAnchor = true) {
|
|
14907
|
-
var _column$parent5, _column$
|
|
15070
|
+
var _column$parent5, _column$parent6;
|
|
14908
15071
|
const page = (_column$parent5 = column.parent) === null || _column$parent5 === void 0 ? void 0 : _column$parent5.parent;
|
|
14909
15072
|
if (page == null || needPositionDrawings.length === 0) return;
|
|
14910
15073
|
const drawings = /* @__PURE__ */ new Map();
|
|
14911
15074
|
const isPageBreak = __checkPageBreak(column);
|
|
14912
|
-
const sectionTop = (
|
|
15075
|
+
const sectionTop = ((_column$parent6 = column.parent) === null || _column$parent6 === void 0 ? void 0 : _column$parent6.top) ?? 0;
|
|
14913
15076
|
const absoluteLineTop = sectionTop + lineTop;
|
|
14914
15077
|
const absoluteBlockAnchorTop = blockAnchorTop == null ? void 0 : sectionTop + blockAnchorTop;
|
|
14915
15078
|
if (isPageBreak && !isParagraphFirstShapedText) return;
|
|
14916
15079
|
for (const drawing of needPositionDrawings) {
|
|
14917
|
-
var _ctx$dataModel$getUni, _ctx$dataModel
|
|
15080
|
+
var _ctx$dataModel$getUni, _ctx$dataModel;
|
|
14918
15081
|
const { drawingOrigin } = drawing;
|
|
14919
15082
|
if (!drawingOrigin) continue;
|
|
14920
15083
|
const { docTransform } = drawingOrigin;
|
|
14921
15084
|
const { positionH, positionV, size, angle } = docTransform;
|
|
14922
15085
|
const { width, height } = size;
|
|
14923
|
-
const fallbackWidth = width
|
|
14924
|
-
const fallbackHeight = height
|
|
14925
|
-
const viewport = drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM ? getDocsCustomBlockRenderViewport((_ctx$dataModel$getUni = (_ctx$dataModel
|
|
15086
|
+
const fallbackWidth = width ?? 0;
|
|
15087
|
+
const fallbackHeight = height ?? 0;
|
|
15088
|
+
const viewport = drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM ? getDocsCustomBlockRenderViewport(((_ctx$dataModel$getUni = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni === void 0 ? void 0 : _ctx$dataModel$getUni.call(_ctx$dataModel)) ?? "", drawing.drawingId, {
|
|
14926
15089
|
fallbackHeight,
|
|
14927
15090
|
fallbackWidth,
|
|
14928
15091
|
pageMarginLeft: page.marginLeft,
|
|
14929
15092
|
pageMarginRight: page.marginRight,
|
|
14930
15093
|
pageWidth: page.pageWidth
|
|
14931
15094
|
}) : null;
|
|
14932
|
-
const drawingWidth = (
|
|
14933
|
-
const drawingHeight = (
|
|
14934
|
-
let aLeft =
|
|
15095
|
+
const drawingWidth = (viewport === null || viewport === void 0 ? void 0 : viewport.width) ?? fallbackWidth;
|
|
15096
|
+
const drawingHeight = (viewport === null || viewport === void 0 ? void 0 : viewport.height) ?? fallbackHeight;
|
|
15097
|
+
let aLeft = getPositionHorizon(positionH, column, page, drawingWidth, isPageBreak) ?? 0;
|
|
14935
15098
|
if (positionH.relativeFrom === ObjectRelativeFromH.COLUMN && blockAnchorLeft > 0) {
|
|
14936
15099
|
const renderedColumnOrigin = isPageBreak ? 0 : column.left || page.marginLeft;
|
|
14937
15100
|
aLeft += blockAnchorLeft - renderedColumnOrigin;
|
|
14938
15101
|
if (normalizeTraditionalColumnAnchor && ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL && positionV.relativeFrom === ObjectRelativeFromV.PARAGRAPH) aLeft -= page.marginLeft;
|
|
14939
15102
|
}
|
|
14940
15103
|
drawing.aLeft = aLeft;
|
|
14941
|
-
drawing.aTop =
|
|
15104
|
+
drawing.aTop = getPositionVertical(positionV, page, absoluteLineTop, lineHeight, drawingHeight, absoluteBlockAnchorTop, isPageBreak) ?? 0;
|
|
14942
15105
|
drawing.width = drawingWidth;
|
|
14943
15106
|
drawing.height = drawingHeight;
|
|
14944
15107
|
drawing.angle = angle;
|
|
@@ -14948,6 +15111,8 @@ function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirst
|
|
|
14948
15111
|
contentHeight: viewport.contentHeight,
|
|
14949
15112
|
contentWidth: viewport.contentWidth,
|
|
14950
15113
|
height: viewport.height,
|
|
15114
|
+
pageContentWidth: viewport.pageContentWidth,
|
|
15115
|
+
viewScale: viewport.viewScale,
|
|
14951
15116
|
viewportHeight: viewport.viewportHeight
|
|
14952
15117
|
} : void 0;
|
|
14953
15118
|
drawing.initialState = true;
|
|
@@ -14955,7 +15120,7 @@ function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirst
|
|
|
14955
15120
|
drawing.lineTop = absoluteLineTop;
|
|
14956
15121
|
drawing.lineHeight = lineHeight;
|
|
14957
15122
|
drawing.isPageBreak = isPageBreak;
|
|
14958
|
-
drawing.blockAnchorTop = absoluteBlockAnchorTop
|
|
15123
|
+
drawing.blockAnchorTop = absoluteBlockAnchorTop ?? absoluteLineTop;
|
|
14959
15124
|
drawings.set(drawing.drawingId, drawing);
|
|
14960
15125
|
}
|
|
14961
15126
|
return drawings;
|
|
@@ -15040,10 +15205,11 @@ function getCustomDecorationStyle(customDecoration) {
|
|
|
15040
15205
|
//#region src/components/docs/layout/style/custom-range.ts
|
|
15041
15206
|
function getCustomRangeStyle(customRange) {
|
|
15042
15207
|
if (customRange.rangeType === CustomRangeType.HYPERLINK || customRange.rangeType === CustomRangeType.MENTION || customRange.rangeType === CustomRangeType.CUSTOM) {
|
|
15043
|
-
var _customRange$
|
|
15208
|
+
var _customRange$properti;
|
|
15209
|
+
const preserveTextColor = ((_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.textColorMode) === "text";
|
|
15044
15210
|
return {
|
|
15045
|
-
...
|
|
15046
|
-
cl: { rgb: "#274fee" }
|
|
15211
|
+
...customRange.active ?? true ? { ul: { s: BooleanNumber.TRUE } } : null,
|
|
15212
|
+
...preserveTextColor ? null : { cl: { rgb: "#274fee" } }
|
|
15047
15213
|
};
|
|
15048
15214
|
}
|
|
15049
15215
|
return null;
|
|
@@ -15158,11 +15324,11 @@ function getCharSpaceConfig(sectionBreakConfig, paragraphConfig) {
|
|
|
15158
15324
|
const { paragraphStyle = {} } = paragraphConfig;
|
|
15159
15325
|
const { charSpace = 0, gridType = GridType.LINES, defaultTabStop = 36, documentTextStyle = {} } = sectionBreakConfig;
|
|
15160
15326
|
const { fs: documentFontSize = 14 } = documentTextStyle;
|
|
15161
|
-
const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
|
|
15327
|
+
const { snapToGrid = BooleanNumber.TRUE, defaultTabStop: paragraphDefaultTabStop } = paragraphStyle;
|
|
15162
15328
|
return {
|
|
15163
15329
|
charSpace,
|
|
15164
15330
|
documentFontSize,
|
|
15165
|
-
defaultTabStop,
|
|
15331
|
+
defaultTabStop: paragraphDefaultTabStop ?? defaultTabStop,
|
|
15166
15332
|
gridType,
|
|
15167
15333
|
snapToGrid
|
|
15168
15334
|
};
|
|
@@ -15274,24 +15440,20 @@ function updateBlockIndex(pages, start = -1, documentCompatibilityPolicy) {
|
|
|
15274
15440
|
}
|
|
15275
15441
|
}
|
|
15276
15442
|
function collapseRedundantColumnBreakOverflow(section) {
|
|
15277
|
-
var _targetColumn$height;
|
|
15278
15443
|
const expectedColumnCount = section.colCount || section.columns.length;
|
|
15279
15444
|
if (expectedColumnCount <= 0 || section.columns.length <= expectedColumnCount) return;
|
|
15280
15445
|
const targetColumn = section.columns[expectedColumnCount - 1];
|
|
15281
15446
|
if (!targetColumn) return;
|
|
15282
15447
|
const overflowColumns = section.columns.slice(expectedColumnCount);
|
|
15283
15448
|
if (!overflowColumns.some((column) => column.lines.length > 0)) return;
|
|
15284
|
-
const targetHeight =
|
|
15449
|
+
const targetHeight = targetColumn.height ?? 0;
|
|
15285
15450
|
const overflowLines = overflowColumns.flatMap((column) => column.lines);
|
|
15286
15451
|
overflowLines.forEach((line) => {
|
|
15287
15452
|
line.top += targetHeight;
|
|
15288
15453
|
line.parent = targetColumn;
|
|
15289
15454
|
});
|
|
15290
15455
|
targetColumn.lines.push(...overflowLines);
|
|
15291
|
-
targetColumn.height = Math.max(...overflowColumns.map((column) =>
|
|
15292
|
-
var _column$height;
|
|
15293
|
-
return targetHeight + ((_column$height = column.height) !== null && _column$height !== void 0 ? _column$height : 0);
|
|
15294
|
-
}), targetHeight);
|
|
15456
|
+
targetColumn.height = Math.max(...overflowColumns.map((column) => targetHeight + (column.height ?? 0)), targetHeight);
|
|
15295
15457
|
targetColumn.isFull = overflowColumns.some((column) => column.isFull);
|
|
15296
15458
|
section.columns.splice(expectedColumnCount);
|
|
15297
15459
|
}
|
|
@@ -15304,8 +15466,8 @@ function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
|
15304
15466
|
const affectNonInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphNonInlineSkeDrawings;
|
|
15305
15467
|
const drawingAnchor = (_ctx$skeletonResource = ctx.skeletonResourceReference) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.drawingAnchor) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.get(segmentId)) === null || _ctx$skeletonResource === void 0 ? void 0 : _ctx$skeletonResource.get(line.paragraphIndex);
|
|
15306
15468
|
if (affectInlineDrawings && affectInlineDrawings.size > 0) {
|
|
15307
|
-
var _ctx$dataModel$getUni, _ctx$dataModel
|
|
15308
|
-
updateInlineDrawingPosition(line, affectInlineDrawings, (_ctx$dataModel$getUni = (_ctx$dataModel
|
|
15469
|
+
var _ctx$dataModel$getUni, _ctx$dataModel;
|
|
15470
|
+
updateInlineDrawingPosition(line, affectInlineDrawings, ((_ctx$dataModel$getUni = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni === void 0 ? void 0 : _ctx$dataModel$getUni.call(_ctx$dataModel)) ?? "", drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings);
|
|
15309
15471
|
}
|
|
15310
15472
|
const paragraphStyle = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphStyle;
|
|
15311
15473
|
const paragraphBackgroundColor = paragraphStyle === null || paragraphStyle === void 0 || (_paragraphStyle$shadi = paragraphStyle.shading) === null || _paragraphStyle$shadi === void 0 ? void 0 : _paragraphStyle$shadi.backgroundColor;
|
|
@@ -15494,20 +15656,16 @@ function documentSkeletonLineIterator(pages, options, cb) {
|
|
|
15494
15656
|
function getDocumentSkeletonNestedPageOffset(page) {
|
|
15495
15657
|
var _parent$parent, _parent$parent$column;
|
|
15496
15658
|
const parent = page.parent;
|
|
15497
|
-
if ((parent === null || parent === void 0 ? void 0 : parent.page) === page && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.columnGroupId) && ((_parent$parent$column = parent.parent.columns) === null || _parent$parent$column === void 0 ? void 0 : _parent$parent$column.includes(parent))) {
|
|
15498
|
-
|
|
15499
|
-
|
|
15500
|
-
|
|
15501
|
-
top: ((_parent$parent$top = parent.parent.top) !== null && _parent$parent$top !== void 0 ? _parent$parent$top : 0) + ((_parent$top = parent.top) !== null && _parent$top !== void 0 ? _parent$top : 0)
|
|
15502
|
-
};
|
|
15503
|
-
}
|
|
15659
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.page) === page && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.columnGroupId) && ((_parent$parent$column = parent.parent.columns) === null || _parent$parent$column === void 0 ? void 0 : _parent$parent$column.includes(parent))) return {
|
|
15660
|
+
left: (parent.parent.left ?? 0) + (parent.left ?? 0),
|
|
15661
|
+
top: (parent.parent.top ?? 0) + (parent.top ?? 0)
|
|
15662
|
+
};
|
|
15504
15663
|
}
|
|
15505
15664
|
function getDocumentSkeletonColumnPagePathInfo(position) {
|
|
15506
|
-
var _path$indexOf, _path$indexOf2, _path$indexOf3;
|
|
15507
15665
|
const { path } = position;
|
|
15508
|
-
const pagesIndex = (
|
|
15509
|
-
const columnGroupIndex = (
|
|
15510
|
-
const columnsIndex = (
|
|
15666
|
+
const pagesIndex = (path === null || path === void 0 ? void 0 : path.indexOf("pages")) ?? -1;
|
|
15667
|
+
const columnGroupIndex = (path === null || path === void 0 ? void 0 : path.indexOf("skeColumnGroups")) ?? -1;
|
|
15668
|
+
const columnsIndex = (path === null || path === void 0 ? void 0 : path.indexOf("columns")) ?? -1;
|
|
15511
15669
|
if (pagesIndex === -1 || columnGroupIndex === -1 || columnsIndex === -1 || (path === null || path === void 0 ? void 0 : path[columnsIndex + 2]) !== "page") return;
|
|
15512
15670
|
const pageIndex = path === null || path === void 0 ? void 0 : path[pagesIndex + 1];
|
|
15513
15671
|
const columnGroupId = path === null || path === void 0 ? void 0 : path[columnGroupIndex + 1];
|
|
@@ -15528,22 +15686,22 @@ function visitPageLines(page, options, cb) {
|
|
|
15528
15686
|
page.sections.forEach((section) => {
|
|
15529
15687
|
section.columns.forEach((column) => {
|
|
15530
15688
|
column.lines.forEach((line) => {
|
|
15531
|
-
var _options$getBounds
|
|
15689
|
+
var _options$getBounds;
|
|
15532
15690
|
const bounds = (_options$getBounds = options.getBounds) === null || _options$getBounds === void 0 ? void 0 : _options$getBounds.call(options, page, column, section);
|
|
15533
15691
|
cb({
|
|
15534
15692
|
clipLeft: options.clipLeft,
|
|
15535
15693
|
clipRight: options.clipRight,
|
|
15536
15694
|
column,
|
|
15537
15695
|
line,
|
|
15538
|
-
lineWidth: (
|
|
15696
|
+
lineWidth: (bounds === null || bounds === void 0 ? void 0 : bounds.lineWidth) ?? (bounds === null || bounds === void 0 ? void 0 : bounds.visualWidth) ?? getFiniteWidth(column.width),
|
|
15539
15697
|
page,
|
|
15540
15698
|
pageIndex: options.pageIndex,
|
|
15541
15699
|
pageLeft: options.pageLeft,
|
|
15542
15700
|
section,
|
|
15543
15701
|
sectionTop: options.pageTop + section.top,
|
|
15544
15702
|
source: options.source,
|
|
15545
|
-
visualLeft: (
|
|
15546
|
-
visualWidth: (
|
|
15703
|
+
visualLeft: (bounds === null || bounds === void 0 ? void 0 : bounds.visualLeft) ?? options.visualLeft,
|
|
15704
|
+
visualWidth: (bounds === null || bounds === void 0 ? void 0 : bounds.visualWidth) ?? options.visualWidth
|
|
15547
15705
|
});
|
|
15548
15706
|
});
|
|
15549
15707
|
});
|
|
@@ -15565,8 +15723,7 @@ function collectPageTables(options) {
|
|
|
15565
15723
|
var _page$skeTables2;
|
|
15566
15724
|
const { contexts, docsLeft, includeCells, page, pageIndex, pageLeft, pageTop, resolveViewport, rootPage, source, tableCellInsetX, unitId } = options;
|
|
15567
15725
|
(_page$skeTables2 = page.skeTables) === null || _page$skeTables2 === void 0 || _page$skeTables2.forEach((table, tableId) => {
|
|
15568
|
-
|
|
15569
|
-
const effectiveTableId = (_table$tableId = table.tableId) !== null && _table$tableId !== void 0 ? _table$tableId : tableId;
|
|
15726
|
+
const effectiveTableId = table.tableId ?? tableId;
|
|
15570
15727
|
const tableLeft = pageLeft + table.left;
|
|
15571
15728
|
const tableTop = pageTop + table.top;
|
|
15572
15729
|
const sourceTableId = getSourceTableId(effectiveTableId);
|
|
@@ -15578,16 +15735,15 @@ function collectPageTables(options) {
|
|
|
15578
15735
|
const cells = [];
|
|
15579
15736
|
if (includeCells) table.rows.forEach((row, rowIndex) => {
|
|
15580
15737
|
row.cells.forEach((cell, columnIndex) => {
|
|
15581
|
-
var _cell$marginLeft, _cell$marginRight, _cell$marginTop, _cell$marginBottom, _cell$pageWidth, _cell$pageHeight, _row$top, _cell$left;
|
|
15582
15738
|
if (cell.isMergedCellCovered) return;
|
|
15583
|
-
const cellMarginLeft =
|
|
15584
|
-
const cellMarginRight =
|
|
15585
|
-
const cellMarginTop =
|
|
15586
|
-
const cellMarginBottom =
|
|
15587
|
-
const cellPageWidth =
|
|
15588
|
-
const cellPageHeight =
|
|
15589
|
-
const cellTop = tableTop + (
|
|
15590
|
-
const cellLeft = tableLeft + (
|
|
15739
|
+
const cellMarginLeft = cell.marginLeft ?? 0;
|
|
15740
|
+
const cellMarginRight = cell.marginRight ?? 0;
|
|
15741
|
+
const cellMarginTop = cell.marginTop ?? 0;
|
|
15742
|
+
const cellMarginBottom = cell.marginBottom ?? 0;
|
|
15743
|
+
const cellPageWidth = cell.pageWidth ?? 0;
|
|
15744
|
+
const cellPageHeight = cell.pageHeight ?? 0;
|
|
15745
|
+
const cellTop = tableTop + (row.top ?? 0) + cellMarginTop;
|
|
15746
|
+
const cellLeft = tableLeft + (cell.left ?? 0) - tableScrollLeft + cellMarginLeft;
|
|
15591
15747
|
const cellContentRight = cellLeft + cellPageWidth - cellMarginLeft - cellMarginRight;
|
|
15592
15748
|
const visualLeft = cellLeft + tableCellInsetX;
|
|
15593
15749
|
const visualRight = cellContentRight - tableCellInsetX;
|
|
@@ -15754,7 +15910,6 @@ const DEFAULT_TEXT_RUN = {
|
|
|
15754
15910
|
ed: 0
|
|
15755
15911
|
};
|
|
15756
15912
|
function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph) {
|
|
15757
|
-
var _sectionBreakConfig$d;
|
|
15758
15913
|
const { gridType = GridType.LINES, charSpace = 0, documentTextStyle = {}, pageSize = {
|
|
15759
15914
|
width: Number.POSITIVE_INFINITY,
|
|
15760
15915
|
height: Number.POSITIVE_INFINITY
|
|
@@ -15763,7 +15918,7 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
15763
15918
|
const { isRenderStyle } = renderConfig;
|
|
15764
15919
|
const { startIndex } = paragraphNode;
|
|
15765
15920
|
const originTextRun = viewModel.getTextRun(index + startIndex);
|
|
15766
|
-
const textRun = isRenderStyle === BooleanNumber.FALSE ? DEFAULT_TEXT_RUN : originTextRun
|
|
15921
|
+
const textRun = isRenderStyle === BooleanNumber.FALSE ? DEFAULT_TEXT_RUN : originTextRun ?? DEFAULT_TEXT_RUN;
|
|
15767
15922
|
const customDecoration = viewModel.getCustomDecoration(index + startIndex);
|
|
15768
15923
|
const showCustomDecoration = customDecoration && customDecoration.show !== false;
|
|
15769
15924
|
const customDecorationStyle = showCustomDecoration ? getCustomDecorationStyle(customDecoration) : null;
|
|
@@ -15798,7 +15953,7 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
15798
15953
|
charSpace,
|
|
15799
15954
|
gridType,
|
|
15800
15955
|
snapToGrid,
|
|
15801
|
-
documentCompatibilityPolicy:
|
|
15956
|
+
documentCompatibilityPolicy: sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(),
|
|
15802
15957
|
pageWidth
|
|
15803
15958
|
};
|
|
15804
15959
|
if (!hasAddonStyle && originTextRun) fontCreateConfigCache.setValue(st, ed, result);
|
|
@@ -15905,8 +16060,8 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15905
16060
|
...resolveSectionHeaderFooterReferences(documentStyle, sectionBreaks, nodeIndex)
|
|
15906
16061
|
};
|
|
15907
16062
|
if (documentFlavor === DocumentFlavor.MODERN) {
|
|
15908
|
-
var _documentStyle$pageSi
|
|
15909
|
-
const modernPageWidth = (_documentStyle$pageSi =
|
|
16063
|
+
var _documentStyle$pageSi;
|
|
16064
|
+
const modernPageWidth = ((_documentStyle$pageSi = documentStyle.pageSize) === null || _documentStyle$pageSi === void 0 ? void 0 : _documentStyle$pageSi.width) ?? DEFAULT_MODERN_DOCUMENT_STYLE.pageSize.width;
|
|
15910
16065
|
sectionBreak = Object.assign({}, sectionBreak, DEFAULT_MODERN_SECTION_BREAK);
|
|
15911
16066
|
documentStyle = Object.assign({}, documentStyle, DEFAULT_MODERN_DOCUMENT_STYLE, { pageSize: {
|
|
15912
16067
|
...DEFAULT_MODERN_DOCUMENT_STYLE.pageSize,
|
|
@@ -16029,14 +16184,14 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
16029
16184
|
page.pageOrient = pageOrient;
|
|
16030
16185
|
const { defaultHeaderId, evenPageHeaderId, firstPageHeaderId } = headerIds;
|
|
16031
16186
|
const { defaultFooterId, evenPageFooterId, firstPageFooterId } = footerIds;
|
|
16032
|
-
let headerId = defaultHeaderId
|
|
16033
|
-
let footerId = defaultFooterId
|
|
16187
|
+
let headerId = defaultHeaderId ?? "";
|
|
16188
|
+
let footerId = defaultFooterId ?? "";
|
|
16034
16189
|
if (pageNumber === pageNumberStart && useFirstPageHeaderFooter === BooleanNumber.TRUE) {
|
|
16035
|
-
headerId = firstPageHeaderId
|
|
16036
|
-
footerId = firstPageFooterId
|
|
16190
|
+
headerId = firstPageHeaderId ?? "";
|
|
16191
|
+
footerId = firstPageFooterId ?? "";
|
|
16037
16192
|
} else if (pageNumber % 2 === 0 && evenAndOddHeaders === BooleanNumber.TRUE) {
|
|
16038
|
-
headerId = evenPageHeaderId
|
|
16039
|
-
footerId = evenPageFooterId
|
|
16193
|
+
headerId = evenPageHeaderId ?? "";
|
|
16194
|
+
footerId = evenPageFooterId ?? "";
|
|
16040
16195
|
}
|
|
16041
16196
|
let header;
|
|
16042
16197
|
let footer;
|
|
@@ -16110,7 +16265,6 @@ function _getNullPage(type = 0, segmentId = "") {
|
|
|
16110
16265
|
};
|
|
16111
16266
|
}
|
|
16112
16267
|
function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader = true, areaPage, count = 0) {
|
|
16113
|
-
var _sectionBreakConfig$d;
|
|
16114
16268
|
const { sectionId, lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
16115
16269
|
const pageWidth = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || Number.POSITIVE_INFINITY;
|
|
16116
16270
|
const pageHeight = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || Number.POSITIVE_INFINITY;
|
|
@@ -16139,7 +16293,7 @@ function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakC
|
|
|
16139
16293
|
resetContext(ctx);
|
|
16140
16294
|
return _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader, areaPage, count);
|
|
16141
16295
|
}
|
|
16142
|
-
updateBlockIndex([page], -1,
|
|
16296
|
+
updateBlockIndex([page], -1, sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy());
|
|
16143
16297
|
if (isHeader) Object.assign(page, {
|
|
16144
16298
|
marginTop: marginHeader,
|
|
16145
16299
|
marginBottom: 5
|
|
@@ -16151,13 +16305,12 @@ function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakC
|
|
|
16151
16305
|
return page;
|
|
16152
16306
|
}
|
|
16153
16307
|
function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY) {
|
|
16154
|
-
var _ref, _cellConfig$margin, _cellConfig$columnSpa;
|
|
16155
16308
|
const { sectionId, lists, footerTreeMap, headerTreeMap, localeService, drawings } = sectionBreakConfig;
|
|
16156
16309
|
const { skeletonResourceReference } = ctx;
|
|
16157
16310
|
const { cellMargin, tableRows, tableColumns, tableId } = tableConfig;
|
|
16158
16311
|
const cellConfig = tableRows[row].tableCells[col];
|
|
16159
|
-
let { start = { v: 10 }, end = { v: 10 }, top = { v: 5 }, bottom = { v: 5 } } =
|
|
16160
|
-
const columnSpan = Math.max(1,
|
|
16312
|
+
let { start = { v: 10 }, end = { v: 10 }, top = { v: 5 }, bottom = { v: 5 } } = cellConfig.margin ?? cellMargin ?? {};
|
|
16313
|
+
const columnSpan = Math.max(1, cellConfig.columnSpan ?? 1);
|
|
16161
16314
|
const pageWidth = tableColumns.slice(col, col + columnSpan).reduce((sum, column) => sum + column.size.width.v, 0);
|
|
16162
16315
|
if (start.v + end.v >= pageWidth) {
|
|
16163
16316
|
const marginWidth = start.v + end.v;
|
|
@@ -16201,7 +16354,7 @@ function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, avai
|
|
|
16201
16354
|
};
|
|
16202
16355
|
}
|
|
16203
16356
|
function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY) {
|
|
16204
|
-
var
|
|
16357
|
+
var _ctx$dataModel, _ctx$dataModel$getBod;
|
|
16205
16358
|
const sectionNode = cellNode.children[0];
|
|
16206
16359
|
const { page: areaPage, sectionBreakConfig: cellSectionBreakConfig } = createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight, maxCellPageHeight);
|
|
16207
16360
|
const segmentId = tableConfig.tableId;
|
|
@@ -16214,7 +16367,7 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
16214
16367
|
const result = dealWithSection(ctx, viewModel, sectionNode, currentPage, cellSectionBreakConfig, layoutAnchor);
|
|
16215
16368
|
pages = [...retainedPages, ...result.pages];
|
|
16216
16369
|
if (!ctx.isDirty || ctx.layoutStartPointer[segmentId] == null || count === 10) break;
|
|
16217
|
-
const retryPage = pages.
|
|
16370
|
+
const retryPage = pages[pages.length - 1];
|
|
16218
16371
|
if (retryPage == null) break;
|
|
16219
16372
|
retainedPages.splice(0, retainedPages.length, ...pages.slice(0, -1));
|
|
16220
16373
|
currentPage = retryPage;
|
|
@@ -16224,7 +16377,7 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
16224
16377
|
p.type = 3;
|
|
16225
16378
|
p.segmentId = segmentId;
|
|
16226
16379
|
}
|
|
16227
|
-
updateBlockIndex(pages, cellNode.startIndex,
|
|
16380
|
+
updateBlockIndex(pages, cellNode.startIndex, sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy());
|
|
16228
16381
|
applyTrailingBlockRangeSpaceBelow(pages, (_ctx$dataModel = ctx.dataModel) === null || _ctx$dataModel === void 0 || (_ctx$dataModel$getBod = _ctx$dataModel.getBody) === null || _ctx$dataModel$getBod === void 0 ? void 0 : _ctx$dataModel$getBod.call(_ctx$dataModel), cellNode.endIndex);
|
|
16229
16382
|
updateInlineDrawingCoordsAndBorder(ctx, pages);
|
|
16230
16383
|
expandCellPageHeightForInlineDrawings(pages);
|
|
@@ -16234,9 +16387,9 @@ function expandCellPageHeightForInlineDrawings(pages) {
|
|
|
16234
16387
|
for (const page of pages) {
|
|
16235
16388
|
var _page$skeDrawings;
|
|
16236
16389
|
(_page$skeDrawings = page.skeDrawings) === null || _page$skeDrawings === void 0 || _page$skeDrawings.forEach((drawing) => {
|
|
16237
|
-
var _drawing$drawingOrigi
|
|
16390
|
+
var _drawing$drawingOrigi;
|
|
16238
16391
|
if (((_drawing$drawingOrigi = drawing.drawingOrigin) === null || _drawing$drawingOrigi === void 0 ? void 0 : _drawing$drawingOrigi.layoutType) !== PositionedObjectLayoutType.INLINE) return;
|
|
16239
|
-
const drawingBottom = (
|
|
16392
|
+
const drawingBottom = (drawing.aTop ?? 0) + (drawing.height ?? 0);
|
|
16240
16393
|
if (drawingBottom > page.height) page.height = drawingBottom;
|
|
16241
16394
|
});
|
|
16242
16395
|
}
|
|
@@ -16246,8 +16399,10 @@ function applyTrailingBlockRangeSpaceBelow(pages, body, containerEndIndex) {
|
|
|
16246
16399
|
const trailingBlockRangeSpace = 28;
|
|
16247
16400
|
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) return;
|
|
16248
16401
|
for (const page of pages) {
|
|
16249
|
-
var
|
|
16250
|
-
const
|
|
16402
|
+
var _body$paragraphs;
|
|
16403
|
+
const lastSection = page.sections[page.sections.length - 1];
|
|
16404
|
+
const lastColumn = lastSection === null || lastSection === void 0 ? void 0 : lastSection.columns[lastSection.columns.length - 1];
|
|
16405
|
+
const lastLine = lastColumn === null || lastColumn === void 0 ? void 0 : lastColumn.lines[lastColumn.lines.length - 1];
|
|
16251
16406
|
if (!lastLine) continue;
|
|
16252
16407
|
const paragraphIndex = lastLine.paragraphIndex;
|
|
16253
16408
|
if (!blockRanges.some((range) => range.startIndex < paragraphIndex && paragraphIndex < range.endIndex)) continue;
|
|
@@ -16541,6 +16696,7 @@ function generateOrderedSymbol(startIndex, startNumber, glyphType) {
|
|
|
16541
16696
|
if (glyphType === ListGlyphType.LOWER_LETTER) return alpha(startIndex, startNumber);
|
|
16542
16697
|
if (glyphType === ListGlyphType.UPPER_ROMAN) return upperRoman(startIndex, startNumber);
|
|
16543
16698
|
if (glyphType === ListGlyphType.LOWER_ROMAN) return roman(startIndex, startNumber);
|
|
16699
|
+
if (glyphType === ListGlyphType.CHINESE_COUNTING) return chineseCounting(startIndex, startNumber);
|
|
16544
16700
|
return decimal(startIndex, startNumber);
|
|
16545
16701
|
}
|
|
16546
16702
|
function decimal(startIndex, startNumber) {
|
|
@@ -16563,6 +16719,34 @@ function upperRoman(startIndex, startNumber) {
|
|
|
16563
16719
|
function roman(startIndex, startNumber) {
|
|
16564
16720
|
return _convertRoman(startIndex + startNumber, false);
|
|
16565
16721
|
}
|
|
16722
|
+
function chineseCounting(startIndex, startNumber) {
|
|
16723
|
+
const value = startIndex + startNumber;
|
|
16724
|
+
if (value <= 0 || value >= 1e4) return value.toString();
|
|
16725
|
+
const digits = "零一二三四五六七八九";
|
|
16726
|
+
const units = [
|
|
16727
|
+
"",
|
|
16728
|
+
"十",
|
|
16729
|
+
"百",
|
|
16730
|
+
"千"
|
|
16731
|
+
];
|
|
16732
|
+
let result = "";
|
|
16733
|
+
let pendingZero = false;
|
|
16734
|
+
for (let place = 3; place >= 0; place--) {
|
|
16735
|
+
const divisor = 10 ** place;
|
|
16736
|
+
const digit = Math.floor(value / divisor) % 10;
|
|
16737
|
+
if (digit === 0) {
|
|
16738
|
+
pendingZero ||= result.length > 0 && value % divisor > 0;
|
|
16739
|
+
continue;
|
|
16740
|
+
}
|
|
16741
|
+
if (pendingZero) {
|
|
16742
|
+
result += digits[0];
|
|
16743
|
+
pendingZero = false;
|
|
16744
|
+
}
|
|
16745
|
+
if (!(digit === 1 && place === 1 && result.length === 0)) result += digits[digit];
|
|
16746
|
+
result += units[place];
|
|
16747
|
+
}
|
|
16748
|
+
return result;
|
|
16749
|
+
}
|
|
16566
16750
|
function _convertRoman(num, uppercase = false) {
|
|
16567
16751
|
const upperLookup = {
|
|
16568
16752
|
M: 1e3,
|
|
@@ -16605,9 +16789,10 @@ function _convertRoman(num, uppercase = false) {
|
|
|
16605
16789
|
|
|
16606
16790
|
//#endregion
|
|
16607
16791
|
//#region src/components/docs/layout/block/paragraph/bullet.ts
|
|
16608
|
-
function dealWithBullet(bullet, lists, listLevelAncestors, localeService) {
|
|
16792
|
+
function dealWithBullet(bullet, lists, listLevelAncestors, localeService, compactSpacing = false, paragraphTextStyle) {
|
|
16609
16793
|
if (!bullet || !lists) return;
|
|
16610
|
-
const { listId, listType, nestingLevel = 0, textStyle } = bullet;
|
|
16794
|
+
const { listId, listType, nestingLevel = 0, startNumber, image, textStyle } = bullet;
|
|
16795
|
+
const preserveTextLineHeight = compactSpacing;
|
|
16611
16796
|
const list = lists[listType];
|
|
16612
16797
|
if (!list || !list.nestingLevel) {
|
|
16613
16798
|
var _listLevelAncestors$n;
|
|
@@ -16617,7 +16802,10 @@ function dealWithBullet(bullet, lists, listLevelAncestors, localeService) {
|
|
|
16617
16802
|
var _listLevelAncestors$n2;
|
|
16618
16803
|
return getDefaultBulletSke(listId, listLevelAncestors === null || listLevelAncestors === void 0 || (_listLevelAncestors$n2 = listLevelAncestors[nestingLevel]) === null || _listLevelAncestors$n2 === void 0 ? void 0 : _listLevelAncestors$n2.startIndexItem);
|
|
16619
16804
|
}
|
|
16620
|
-
return _getBulletSke(listId, nestingLevel, list.nestingLevel, listLevelAncestors,
|
|
16805
|
+
return _getBulletSke(listId, nestingLevel, list.nestingLevel, listLevelAncestors, startNumber, {
|
|
16806
|
+
...paragraphTextStyle,
|
|
16807
|
+
...textStyle
|
|
16808
|
+
}, localeService, compactSpacing, preserveTextLineHeight, image === null || image === void 0 ? void 0 : image.source);
|
|
16621
16809
|
}
|
|
16622
16810
|
function getDefaultBulletSke(listId, startIndex = 1) {
|
|
16623
16811
|
return {
|
|
@@ -16635,8 +16823,7 @@ function getDefaultBulletSke(listId, startIndex = 1) {
|
|
|
16635
16823
|
}
|
|
16636
16824
|
};
|
|
16637
16825
|
}
|
|
16638
|
-
function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, textStyleConfig, _localeService) {
|
|
16639
|
-
var _listLevelAncestors$n3, _listLevelAncestors$n4;
|
|
16826
|
+
function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, paragraphStartNumber, textStyleConfig, _localeService, compactSpacing = false, preserveTextLineHeight = false, imageSource) {
|
|
16640
16827
|
const nesting = nestings[nestingLevel];
|
|
16641
16828
|
const { bulletAlignment, glyphFormat, textStyle: textStyleFirst = {}, glyphType, glyphSymbol } = nesting;
|
|
16642
16829
|
const textStyle = {
|
|
@@ -16644,38 +16831,59 @@ function _getBulletSke(listId, nestingLevel, nestings, listLevelAncestors, textS
|
|
|
16644
16831
|
...textStyleFirst
|
|
16645
16832
|
};
|
|
16646
16833
|
const fontStyle = getFontStyleString(textStyle);
|
|
16834
|
+
const previousAtLevel = listLevelAncestors === null || listLevelAncestors === void 0 ? void 0 : listLevelAncestors[nestingLevel];
|
|
16835
|
+
const startIndex = paragraphStartNumber === void 0 ? (previousAtLevel === null || previousAtLevel === void 0 ? void 0 : previousAtLevel.startIndexItem) ?? 1 : 1;
|
|
16836
|
+
const effectiveStartNumber = paragraphStartNumber ?? (previousAtLevel === null || previousAtLevel === void 0 ? void 0 : previousAtLevel.startNumber) ?? nesting.startNumber;
|
|
16647
16837
|
let symbolContent;
|
|
16648
|
-
if (glyphSymbol) symbolContent = glyphSymbol;
|
|
16649
|
-
else symbolContent = __generateOrderedListSymbol(glyphFormat, nestingLevel, nestings, listLevelAncestors);
|
|
16650
|
-
const startIndex = (_listLevelAncestors$n3 = listLevelAncestors === null || listLevelAncestors === void 0 || (_listLevelAncestors$n4 = listLevelAncestors[nestingLevel]) === null || _listLevelAncestors$n4 === void 0 ? void 0 : _listLevelAncestors$n4.startIndexItem) !== null && _listLevelAncestors$n3 !== void 0 ? _listLevelAncestors$n3 : 1;
|
|
16838
|
+
if (glyphSymbol) symbolContent = normalizeLegacySymbolFontGlyph(glyphSymbol, textStyle.ff);
|
|
16839
|
+
else symbolContent = __generateOrderedListSymbol(glyphFormat, nestingLevel, nestings, listLevelAncestors, startIndex, effectiveStartNumber);
|
|
16651
16840
|
return {
|
|
16652
16841
|
listId,
|
|
16653
16842
|
symbol: symbolContent,
|
|
16654
16843
|
ts: textStyle,
|
|
16655
16844
|
fontStyle,
|
|
16656
16845
|
startIndexItem: startIndex + 1,
|
|
16846
|
+
startNumber: effectiveStartNumber,
|
|
16657
16847
|
nestingLevel: nesting,
|
|
16658
16848
|
bulletAlign: bulletAlignment,
|
|
16659
16849
|
bulletType: glyphSymbol ? false : !!glyphType,
|
|
16850
|
+
compactSpacing,
|
|
16851
|
+
preserveTextLineHeight,
|
|
16852
|
+
imageSource,
|
|
16660
16853
|
paragraphProperties: nesting.paragraphProperties
|
|
16661
16854
|
};
|
|
16662
16855
|
}
|
|
16663
|
-
|
|
16856
|
+
const LEGACY_SYMBOL_GLYPH_EQUIVALENTS = { wingdings: {
|
|
16857
|
+
167: "▪",
|
|
16858
|
+
216: "➢"
|
|
16859
|
+
} };
|
|
16860
|
+
function normalizeLegacySymbolFontGlyph(symbol, fontFamily) {
|
|
16861
|
+
var _fontFamily$split$;
|
|
16862
|
+
const primaryFontFamily = fontFamily === null || fontFamily === void 0 || (_fontFamily$split$ = fontFamily.split(",")[0]) === null || _fontFamily$split$ === void 0 ? void 0 : _fontFamily$split$.trim().replace(/^['"]|['"]$/g, "").toLowerCase();
|
|
16863
|
+
const equivalents = primaryFontFamily ? LEGACY_SYMBOL_GLYPH_EQUIVALENTS[primaryFontFamily] : void 0;
|
|
16864
|
+
if (!equivalents) return symbol;
|
|
16865
|
+
return Array.from(symbol, (character) => {
|
|
16866
|
+
const codePoint = character.codePointAt(0);
|
|
16867
|
+
return codePoint === void 0 ? character : equivalents[codePoint] ?? character;
|
|
16868
|
+
}).join("");
|
|
16869
|
+
}
|
|
16870
|
+
function __generateOrderedListSymbol(glyphFormat, nestingLevel, nestings, listLevelAncestors, currentStartIndex, currentStartNumber) {
|
|
16664
16871
|
const glyphFormatSplit = glyphFormat.split("%");
|
|
16665
16872
|
const resultSymbol = [glyphFormatSplit[0]];
|
|
16666
16873
|
for (let i = 1; i < glyphFormatSplit.length; i++) {
|
|
16667
|
-
var _listLevelAncestors$l;
|
|
16668
16874
|
const levelAndSuffixPre = glyphFormatSplit[i];
|
|
16669
16875
|
const { level, suffix } = ___getLevelAndSuffix(levelAndSuffixPre);
|
|
16670
|
-
|
|
16671
|
-
|
|
16672
|
-
|
|
16876
|
+
const ancestor = listLevelAncestors === null || listLevelAncestors === void 0 ? void 0 : listLevelAncestors[level];
|
|
16877
|
+
let startIndexItem = level === nestingLevel ? currentStartIndex : (ancestor === null || ancestor === void 0 ? void 0 : ancestor.startIndexItem) || 1;
|
|
16878
|
+
if (level !== nestingLevel && ancestor !== null) startIndexItem -= 1;
|
|
16879
|
+
const startNumber = level === nestingLevel ? currentStartNumber : (ancestor === null || ancestor === void 0 ? void 0 : ancestor.startNumber) ?? nestings[level].startNumber;
|
|
16880
|
+
const singleSymbol = ___getSymbolByBesting(startIndexItem, nestings[level], startNumber);
|
|
16673
16881
|
resultSymbol.push(singleSymbol, suffix);
|
|
16674
16882
|
}
|
|
16675
16883
|
return resultSymbol.join("");
|
|
16676
16884
|
}
|
|
16677
|
-
function ___getSymbolByBesting(startIndex = 1, nesting) {
|
|
16678
|
-
const {
|
|
16885
|
+
function ___getSymbolByBesting(startIndex = 1, nesting, startNumber = nesting.startNumber) {
|
|
16886
|
+
const { glyphType, glyphSymbol } = nesting;
|
|
16679
16887
|
if (glyphSymbol) return glyphSymbol;
|
|
16680
16888
|
if (!glyphType) return "●";
|
|
16681
16889
|
return getBulletOrderedSymbol(startIndex, startNumber, glyphType);
|
|
@@ -16803,9 +17011,9 @@ function _getListLevelAncestors(bullet, listLevel) {
|
|
|
16803
17011
|
if (level < 0) level = 0;
|
|
16804
17012
|
const listLevelAncestors = [];
|
|
16805
17013
|
for (let i = level; i >= 0; i--) if (Array.isArray(sameList === null || sameList === void 0 ? void 0 : sameList[i])) {
|
|
16806
|
-
var _sameList$i
|
|
17014
|
+
var _sameList$i;
|
|
16807
17015
|
const len = sameList[i].length;
|
|
16808
|
-
listLevelAncestors[i] = (
|
|
17016
|
+
listLevelAncestors[i] = ((_sameList$i = sameList[i][len - 1]) === null || _sameList$i === void 0 ? void 0 : _sameList$i.bullet) ?? null;
|
|
16809
17017
|
} else listLevelAncestors[i] = null;
|
|
16810
17018
|
return listLevelAncestors;
|
|
16811
17019
|
}
|
|
@@ -16822,9 +17030,8 @@ function _updateListLevelAncestors(paragraph, bullet, bulletSkeleton, listLevel)
|
|
|
16822
17030
|
listLevel === null || listLevel === void 0 || listLevel.set(listId, cacheItem);
|
|
16823
17031
|
}
|
|
16824
17032
|
function _withMinSpacing(style, key, value) {
|
|
16825
|
-
var _current$v;
|
|
16826
17033
|
const current = style[key];
|
|
16827
|
-
const nextValue = Math.max((
|
|
17034
|
+
const nextValue = Math.max((current === null || current === void 0 ? void 0 : current.v) ?? 0, value);
|
|
16828
17035
|
style[key] = {
|
|
16829
17036
|
...current,
|
|
16830
17037
|
v: nextValue
|
|
@@ -16832,7 +17039,7 @@ function _withMinSpacing(style, key, value) {
|
|
|
16832
17039
|
}
|
|
16833
17040
|
function _getNextAdjacentBlockRange(blockRanges, blockRange) {
|
|
16834
17041
|
let nextBlockRange;
|
|
16835
|
-
for (const range of blockRanges
|
|
17042
|
+
for (const range of blockRanges ?? []) if (range.startIndex > blockRange.endIndex && (!nextBlockRange || range.startIndex < nextBlockRange.startIndex)) nextBlockRange = range;
|
|
16836
17043
|
return nextBlockRange;
|
|
16837
17044
|
}
|
|
16838
17045
|
function _hasNextAdjacentLayoutBlockRange(blockRanges, blockRange) {
|
|
@@ -16840,7 +17047,6 @@ function _hasNextAdjacentLayoutBlockRange(blockRanges, blockRange) {
|
|
|
16840
17047
|
return nextBlockRange != null && BLOCK_LAYOUT_OUTER_SPACING_MAP.has(nextBlockRange.blockType) && nextBlockRange.startIndex === blockRange.endIndex + 1;
|
|
16841
17048
|
}
|
|
16842
17049
|
function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, documentStyle, useLegacyModernDefaults, styles, paragraphStyleId) {
|
|
16843
|
-
var _body$paragraphs, _BLOCK_LAYOUT_OUTER_S;
|
|
16844
17050
|
const blockRanges = body === null || body === void 0 ? void 0 : body.blockRanges;
|
|
16845
17051
|
const resolveOptions = {
|
|
16846
17052
|
useLegacyModernDefaults,
|
|
@@ -16855,18 +17061,18 @@ function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, d
|
|
|
16855
17061
|
excludeDocumentOuterSpacing: true
|
|
16856
17062
|
});
|
|
16857
17063
|
if (style.lineSpacing == null) style.lineSpacing = DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING;
|
|
16858
|
-
const blockParagraphs = ((
|
|
17064
|
+
const blockParagraphs = ((body === null || body === void 0 ? void 0 : body.paragraphs) ?? []).filter((item) => item.startIndex > blockRange.startIndex && item.startIndex < blockRange.endIndex).sort((left, right) => left.startIndex - right.startIndex);
|
|
16859
17065
|
const firstParagraph = blockParagraphs[0];
|
|
16860
17066
|
const lastParagraph = blockParagraphs[blockParagraphs.length - 1];
|
|
16861
|
-
const outerSpacing =
|
|
17067
|
+
const outerSpacing = BLOCK_LAYOUT_OUTER_SPACING_MAP.get(blockRange.blockType) ?? 0;
|
|
16862
17068
|
if ((firstParagraph === null || firstParagraph === void 0 ? void 0 : firstParagraph.startIndex) === paragraph.startIndex) _withMinSpacing(style, "spaceAbove", outerSpacing);
|
|
16863
17069
|
if ((lastParagraph === null || lastParagraph === void 0 ? void 0 : lastParagraph.startIndex) === paragraph.startIndex && !_hasNextAdjacentLayoutBlockRange(blockRanges, blockRange)) _withMinSpacing(style, "spaceBelow", outerSpacing);
|
|
16864
17070
|
return style;
|
|
16865
17071
|
}
|
|
16866
17072
|
function _isOnlyFloatingCustomBlockParagraph(viewModel, paragraphNode, drawings) {
|
|
16867
|
-
var _paragraphNode$blocks
|
|
17073
|
+
var _paragraphNode$blocks;
|
|
16868
17074
|
if (!((_paragraphNode$blocks = paragraphNode.blocks) === null || _paragraphNode$blocks === void 0 ? void 0 : _paragraphNode$blocks.length)) return false;
|
|
16869
|
-
if (!(
|
|
17075
|
+
if (!(paragraphNode.content ?? "").split("").every((char) => char === DataStreamTreeTokenType.CUSTOM_BLOCK || char === DataStreamTreeTokenType.PARAGRAPH || char === DataStreamTreeTokenType.SECTION_BREAK)) return false;
|
|
16870
17076
|
return paragraphNode.blocks.every((charIndex) => {
|
|
16871
17077
|
const customBlock = viewModel.getCustomBlock(charIndex);
|
|
16872
17078
|
const drawing = customBlock == null ? null : drawings[customBlock.blockId];
|
|
@@ -16874,12 +17080,12 @@ function _isOnlyFloatingCustomBlockParagraph(viewModel, paragraphNode, drawings)
|
|
|
16874
17080
|
});
|
|
16875
17081
|
}
|
|
16876
17082
|
function _getFollowingIndentedParagraphAnchorLeft(viewModel, paragraph, paragraphNode, drawings, isTraditionalDocument) {
|
|
16877
|
-
var _paragraph$paragraphS,
|
|
17083
|
+
var _paragraph$paragraphS, _viewModel$getBody, _paragraphs$, _paragraphs$0$paragra;
|
|
16878
17084
|
if (!isTraditionalDocument) return;
|
|
16879
|
-
if (((_paragraph$paragraphS =
|
|
17085
|
+
if ((((_paragraph$paragraphS = paragraph.paragraphStyle) === null || _paragraph$paragraphS === void 0 || (_paragraph$paragraphS = _paragraph$paragraphS.indentStart) === null || _paragraph$paragraphS === void 0 ? void 0 : _paragraph$paragraphS.v) ?? 0) > 0) return;
|
|
16880
17086
|
if (!_isOnlyFloatingCustomBlockParagraph(viewModel, paragraphNode, drawings)) return;
|
|
16881
|
-
const paragraphs = [...(
|
|
16882
|
-
return ((
|
|
17087
|
+
const paragraphs = [...((_viewModel$getBody = viewModel.getBody) === null || _viewModel$getBody === void 0 || (_viewModel$getBody = _viewModel$getBody.call(viewModel)) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.paragraphs) ?? []].filter((item) => item.startIndex > paragraph.startIndex).sort((left, right) => left.startIndex - right.startIndex);
|
|
17088
|
+
return (((_paragraphs$ = paragraphs[0]) === null || _paragraphs$ === void 0 || (_paragraphs$ = _paragraphs$.paragraphStyle) === null || _paragraphs$ === void 0 || (_paragraphs$ = _paragraphs$.indentStart) === null || _paragraphs$ === void 0 ? void 0 : _paragraphs$.v) ?? 0) > 0 ? (_paragraphs$0$paragra = paragraphs[0].paragraphStyle) === null || _paragraphs$0$paragra === void 0 ? void 0 : _paragraphs$0$paragra.indentStart : void 0;
|
|
16883
17089
|
}
|
|
16884
17090
|
function _getDrawingSkeletonFormat(drawingOrigin) {
|
|
16885
17091
|
const { drawingId } = drawingOrigin;
|
|
@@ -16904,32 +17110,26 @@ function _getNextPageNumber(lastPage) {
|
|
|
16904
17110
|
}
|
|
16905
17111
|
function _getParagraphLineRefs(pages, paragraphIndex) {
|
|
16906
17112
|
const refs = [];
|
|
16907
|
-
for (const page of pages) {
|
|
16908
|
-
|
|
16909
|
-
|
|
16910
|
-
|
|
16911
|
-
|
|
16912
|
-
line
|
|
16913
|
-
});
|
|
16914
|
-
}
|
|
17113
|
+
for (const page of pages) for (const section of page.sections ?? []) for (const column of section.columns) for (const line of column.lines) if (line.paragraphIndex === paragraphIndex) refs.push({
|
|
17114
|
+
page,
|
|
17115
|
+
column,
|
|
17116
|
+
line
|
|
17117
|
+
});
|
|
16915
17118
|
return refs;
|
|
16916
17119
|
}
|
|
16917
17120
|
function _hasPageContent(page) {
|
|
16918
|
-
var _page$
|
|
16919
|
-
return (
|
|
17121
|
+
var _page$skeTables;
|
|
17122
|
+
return (page.sections ?? []).some((section) => section.columns.some((column) => !isBlankColumn(column))) || (((_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 ? void 0 : _page$skeTables.size) ?? 0) > 0;
|
|
16920
17123
|
}
|
|
16921
17124
|
function _hasOnlyExplicitPageBoundaryMarkers(page) {
|
|
16922
|
-
var _page$
|
|
16923
|
-
if (((
|
|
16924
|
-
return (
|
|
17125
|
+
var _page$skeTables2;
|
|
17126
|
+
if ((((_page$skeTables2 = page.skeTables) === null || _page$skeTables2 === void 0 ? void 0 : _page$skeTables2.size) ?? 0) > 0) return false;
|
|
17127
|
+
return (page.sections ?? []).every((section) => section.columns.every((column) => column.lines.every((line) => line.divides.every((divide) => divide.glyphGroup.every(({ raw, streamType }) => raw === DataStreamTreeTokenType.PARAGRAPH || streamType === DataStreamTreeTokenType.PARAGRAPH || raw === DataStreamTreeTokenType.PAGE_BREAK || streamType === DataStreamTreeTokenType.PAGE_BREAK)))));
|
|
16925
17128
|
}
|
|
16926
17129
|
function _lineSpanHeight(lines) {
|
|
16927
17130
|
if (lines.length === 0) return 0;
|
|
16928
17131
|
const firstTop = Math.min(...lines.map((line) => line.top));
|
|
16929
|
-
return Math.max(...lines.map((line) =>
|
|
16930
|
-
var _line$spaceBelowApply;
|
|
16931
|
-
return line.top + line.lineHeight + Math.max(0, (_line$spaceBelowApply = line.spaceBelowApply) !== null && _line$spaceBelowApply !== void 0 ? _line$spaceBelowApply : 0);
|
|
16932
|
-
})) - firstTop;
|
|
17132
|
+
return Math.max(...lines.map((line) => line.top + line.lineHeight + Math.max(0, line.spaceBelowApply ?? 0))) - firstTop;
|
|
16933
17133
|
}
|
|
16934
17134
|
function _columnUsedHeight(column) {
|
|
16935
17135
|
return _lineSpanHeight(column.lines);
|
|
@@ -16941,10 +17141,10 @@ function _reindexColumnLines(column) {
|
|
|
16941
17141
|
});
|
|
16942
17142
|
}
|
|
16943
17143
|
function _prependLines(sourceColumn, targetColumn, lines) {
|
|
16944
|
-
var _targetColumn$parent
|
|
17144
|
+
var _targetColumn$parent;
|
|
16945
17145
|
if (lines.length === 0 || lines.some((line) => !sourceColumn.lines.includes(line))) return 0;
|
|
16946
17146
|
const movedHeight = _lineSpanHeight(lines);
|
|
16947
|
-
const targetHeight = (
|
|
17147
|
+
const targetHeight = ((_targetColumn$parent = targetColumn.parent) === null || _targetColumn$parent === void 0 ? void 0 : _targetColumn$parent.height) ?? Number.POSITIVE_INFINITY;
|
|
16948
17148
|
if (movedHeight + _columnUsedHeight(targetColumn) > targetHeight) return 0;
|
|
16949
17149
|
const firstTop = Math.min(...lines.map((line) => line.top));
|
|
16950
17150
|
const moved = lines.map((line) => {
|
|
@@ -17055,7 +17255,7 @@ function _applyWidowControl(pages, paragraphIndex, metrics) {
|
|
|
17055
17255
|
return 0;
|
|
17056
17256
|
}
|
|
17057
17257
|
function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, sectionBreakConfig, tableSkeleton) {
|
|
17058
|
-
var _viewModel$getSnapsho,
|
|
17258
|
+
var _viewModel$getSnapsho, _viewModel$getBody2;
|
|
17059
17259
|
const { skeletonResourceReference } = ctx;
|
|
17060
17260
|
const { lists, drawings = {}, localeService } = sectionBreakConfig;
|
|
17061
17261
|
const { endIndex, blocks = [], children } = paragraphNode;
|
|
@@ -17067,7 +17267,7 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
17067
17267
|
const { paragraphStyle = {}, bullet } = paragraph;
|
|
17068
17268
|
const documentSnapshot = (_viewModel$getSnapsho = viewModel.getSnapshot) === null || _viewModel$getSnapsho === void 0 ? void 0 : _viewModel$getSnapsho.call(viewModel);
|
|
17069
17269
|
const documentStyle = documentSnapshot === null || documentSnapshot === void 0 ? void 0 : documentSnapshot.documentStyle;
|
|
17070
|
-
const documentCompatibilityPolicy =
|
|
17270
|
+
const documentCompatibilityPolicy = sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor);
|
|
17071
17271
|
const shouldApplyDocumentDefaults = documentCompatibilityPolicy.applyDocumentDefaultParagraphStyle;
|
|
17072
17272
|
const useWordStyleLineHeight = documentCompatibilityPolicy.useWordStyleLineHeight;
|
|
17073
17273
|
const { skeHeaders, skeFooters, skeListLevel, drawingAnchor } = skeletonResourceReference;
|
|
@@ -17080,12 +17280,9 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
17080
17280
|
segmentDrawingAnchorCache = /* @__PURE__ */ new Map();
|
|
17081
17281
|
drawingAnchor === null || drawingAnchor === void 0 || drawingAnchor.set(segmentId, segmentDrawingAnchorCache);
|
|
17082
17282
|
}
|
|
17083
|
-
const resolvedParagraphStyle = _applyBlockRangeLayoutParagraphStyle((_viewModel$getBody2 =
|
|
17283
|
+
const resolvedParagraphStyle = _applyBlockRangeLayoutParagraphStyle(((_viewModel$getBody2 = viewModel.getBody) === null || _viewModel$getBody2 === void 0 ? void 0 : _viewModel$getBody2.call(viewModel)) ?? null, paragraph, paragraphStyle, documentStyle, shouldApplyDocumentDefaults, documentSnapshot === null || documentSnapshot === void 0 ? void 0 : documentSnapshot.styles, paragraph.styleId);
|
|
17084
17284
|
const borderBottom = resolvedParagraphStyle.borderBottom;
|
|
17085
|
-
if (borderBottom)
|
|
17086
|
-
var _borderBottom$padding, _borderBottom$width;
|
|
17087
|
-
_withMinSpacing(resolvedParagraphStyle, "spaceBelow", Math.max(0, (_borderBottom$padding = borderBottom.padding) !== null && _borderBottom$padding !== void 0 ? _borderBottom$padding : 0) + Math.max(0, (_borderBottom$width = borderBottom.width) !== null && _borderBottom$width !== void 0 ? _borderBottom$width : 1) / 2);
|
|
17088
|
-
}
|
|
17285
|
+
if (borderBottom) _withMinSpacing(resolvedParagraphStyle, "spaceBelow", Math.max(0, borderBottom.padding ?? 0) + Math.max(0, borderBottom.width ?? 1) / 2);
|
|
17089
17286
|
const paragraphConfig = {
|
|
17090
17287
|
paragraphIndex: endIndex,
|
|
17091
17288
|
documentCompatibilityPolicy,
|
|
@@ -17163,7 +17360,7 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
17163
17360
|
if (columnInfo && !columnInfo.isLast) setColumnFullState(columnInfo.column, true);
|
|
17164
17361
|
else if (columnInfo && columnInfo.isLast && isTraditionalDocumentCompatibility(documentCompatibilityPolicy) && (isBlankColumn(columnInfo.column) || _isDocxColumnBreakVisuallyBlankColumn(columnInfo.column))) {} else if (isTraditionalDocumentCompatibility(documentCompatibilityPolicy)) {
|
|
17165
17362
|
var _getLastSection;
|
|
17166
|
-
const lastColumn = (_getLastSection = getLastSection(lastPage)) === null || _getLastSection === void 0 ? void 0 : _getLastSection.columns.
|
|
17363
|
+
const lastColumn = (_getLastSection = getLastSection(lastPage)) === null || _getLastSection === void 0 ? void 0 : _getLastSection.columns.slice(-1)[0];
|
|
17167
17364
|
if (lastColumn && (isBlankColumn(lastColumn) || _isDocxColumnBreakVisuallyBlankColumn(lastColumn))) setColumnFullState(lastColumn, false);
|
|
17168
17365
|
else allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(lastPage), 2));
|
|
17169
17366
|
} else allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(lastPage), 2));
|
|
@@ -17368,6 +17565,15 @@ function customBlockLineBreakExtension(breaker) {
|
|
|
17368
17565
|
});
|
|
17369
17566
|
}
|
|
17370
17567
|
|
|
17568
|
+
//#endregion
|
|
17569
|
+
//#region src/components/docs/layout/line-breaker/extensions/east-asian-quote-linebreak-extension.ts
|
|
17570
|
+
const EAST_ASIAN_OPENING_QUOTES = /* @__PURE__ */ new Set([8216, 8220]);
|
|
17571
|
+
function eastAsianQuoteLineBreakExtension(breaker) {
|
|
17572
|
+
breaker.addRule("break_before_east_asian_opening_quote", (codePoint) => {
|
|
17573
|
+
return EAST_ASIAN_OPENING_QUOTES.has(codePoint);
|
|
17574
|
+
});
|
|
17575
|
+
}
|
|
17576
|
+
|
|
17371
17577
|
//#endregion
|
|
17372
17578
|
//#region src/components/docs/layout/line-breaker/extensions/tab-linebreak-extension.ts
|
|
17373
17579
|
const TAB_CODE_POINT = 9;
|
|
@@ -17499,11 +17705,11 @@ function hyphenConfig(paragraphStyle, sectionBreakConfig) {
|
|
|
17499
17705
|
return suppressHyphenation === BooleanNumber.FALSE && autoHyphenation === BooleanNumber.TRUE;
|
|
17500
17706
|
}
|
|
17501
17707
|
function collectMeasuredWholeEntityRanges(content, viewModel, paragraphNode) {
|
|
17502
|
-
var _viewModel$getBody
|
|
17708
|
+
var _viewModel$getBody;
|
|
17503
17709
|
const ranges = [];
|
|
17504
17710
|
const contentStartIndex = paragraphNode.startIndex;
|
|
17505
17711
|
const contentEndIndex = contentStartIndex + content.length - 1;
|
|
17506
|
-
const customRanges = (
|
|
17712
|
+
const customRanges = ((_viewModel$getBody = viewModel.getBody()) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.customRanges) ?? [];
|
|
17507
17713
|
for (const customRange of customRanges) {
|
|
17508
17714
|
if (!customRange.wholeEntity || customRange.startIndex < contentStartIndex || customRange.endIndex < customRange.startIndex || customRange.endIndex > contentEndIndex) continue;
|
|
17509
17715
|
const interceptedRange = viewModel.getCustomRange(customRange.startIndex);
|
|
@@ -17544,6 +17750,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
17544
17750
|
const { hyphen, languageDetector } = ctx;
|
|
17545
17751
|
tabLineBreakExtension(lineBreaker);
|
|
17546
17752
|
customBlockLineBreakExtension(lineBreaker);
|
|
17753
|
+
if (cjk.hasCJKText(content)) eastAsianQuoteLineBreakExtension(lineBreaker);
|
|
17547
17754
|
let breaker = new LineBreakerLinkEnhancer(lineBreaker);
|
|
17548
17755
|
const lang = languageDetector.detect(content);
|
|
17549
17756
|
const needHyphen = hyphenConfig(paragraphStyle, sectionBreakConfig);
|
|
@@ -17582,15 +17789,15 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
17582
17789
|
const { blockId } = customBlock;
|
|
17583
17790
|
const drawingOrigin = drawings[blockId];
|
|
17584
17791
|
if ((drawingOrigin === null || drawingOrigin === void 0 ? void 0 : drawingOrigin.layoutType) === PositionedObjectLayoutType.INLINE) {
|
|
17585
|
-
var _viewModel$getDataMod, _viewModel$getDataMod2
|
|
17792
|
+
var _viewModel$getDataMod, _viewModel$getDataMod2;
|
|
17586
17793
|
const { angle } = drawingOrigin.docTransform;
|
|
17587
17794
|
const { width = 0, height = 0 } = drawingOrigin.docTransform.size;
|
|
17588
17795
|
const boundingBox = getBoundingBox(angle, 0, width, 0, height);
|
|
17589
|
-
const viewport = getDocsCustomBlockRenderViewport((_viewModel$getDataMod = (_viewModel$getDataMod2 =
|
|
17590
|
-
fallbackHeight:
|
|
17591
|
-
fallbackWidth:
|
|
17796
|
+
const viewport = getDocsCustomBlockRenderViewport(((_viewModel$getDataMod = (_viewModel$getDataMod2 = viewModel.getDataModel()).getUnitId) === null || _viewModel$getDataMod === void 0 ? void 0 : _viewModel$getDataMod.call(_viewModel$getDataMod2)) ?? "", drawingOrigin.drawingId, {
|
|
17797
|
+
fallbackHeight: boundingBox.height ?? 0,
|
|
17798
|
+
fallbackWidth: boundingBox.width ?? 0
|
|
17592
17799
|
});
|
|
17593
|
-
newGlyph = createSkeletonCustomBlockGlyph(config, (
|
|
17800
|
+
newGlyph = createSkeletonCustomBlockGlyph(config, (viewport === null || viewport === void 0 ? void 0 : viewport.layoutWidth) ?? (viewport === null || viewport === void 0 ? void 0 : viewport.width) ?? boundingBox.width, (viewport === null || viewport === void 0 ? void 0 : viewport.height) ?? boundingBox.height, drawingOrigin.drawingId);
|
|
17594
17801
|
} else if (drawingOrigin != null) newGlyph = createSkeletonCustomBlockGlyph(config, 0, 0, drawingOrigin.drawingId);
|
|
17595
17802
|
}
|
|
17596
17803
|
if (newGlyph == null) newGlyph = createSkeletonLetterGlyph(char, config);
|
|
@@ -17736,7 +17943,7 @@ function appendColumnGroupBlockLine(page, columnGroup) {
|
|
|
17736
17943
|
return true;
|
|
17737
17944
|
}
|
|
17738
17945
|
function createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig, width) {
|
|
17739
|
-
var
|
|
17946
|
+
var _ctx$dataModel, _ctx$dataModel$getBod;
|
|
17740
17947
|
const columnSectionBreakConfig = {
|
|
17741
17948
|
...sectionBreakConfig,
|
|
17742
17949
|
pageSize: {
|
|
@@ -17753,7 +17960,7 @@ function createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig,
|
|
|
17753
17960
|
page.type = 3;
|
|
17754
17961
|
for (const paragraphNode of getColumnParagraphNodes(columnNode)) dealWidthParagraph(ctx, viewModel, paragraphNode, page, columnSectionBreakConfig);
|
|
17755
17962
|
updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
17756
|
-
updateBlockIndex([page], columnNode.startIndex,
|
|
17963
|
+
updateBlockIndex([page], columnNode.startIndex, sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy());
|
|
17757
17964
|
applyTrailingBlockRangeSpaceBelow([page], (_ctx$dataModel = ctx.dataModel) === null || _ctx$dataModel === void 0 || (_ctx$dataModel$getBod = _ctx$dataModel.getBody) === null || _ctx$dataModel$getBod === void 0 ? void 0 : _ctx$dataModel$getBod.call(_ctx$dataModel), columnNode.endIndex);
|
|
17758
17965
|
return page;
|
|
17759
17966
|
}
|
|
@@ -17793,9 +18000,9 @@ function getNextBlockTop(lines) {
|
|
|
17793
18000
|
return lastLine.top + lastLine.lineHeight;
|
|
17794
18001
|
}
|
|
17795
18002
|
function calculateColumnGroupLayout(source, availableWidth, columnHeights) {
|
|
17796
|
-
var _source$gap
|
|
18003
|
+
var _source$gap;
|
|
17797
18004
|
const width = Math.max(0, availableWidth);
|
|
17798
|
-
const gap = Math.max(0, (
|
|
18005
|
+
const gap = Math.max(0, ((_source$gap = source.gap) === null || _source$gap === void 0 ? void 0 : _source$gap.v) ?? 0);
|
|
17799
18006
|
const columns = source.columns;
|
|
17800
18007
|
if (columns.length === 0) return {
|
|
17801
18008
|
mode: "horizontal",
|
|
@@ -17810,14 +18017,13 @@ function calculateColumnGroupLayout(source, availableWidth, columnHeights) {
|
|
|
17810
18017
|
width,
|
|
17811
18018
|
height: sumHeights(columnHeights),
|
|
17812
18019
|
columns: columns.map((column, index) => {
|
|
17813
|
-
var _columnHeights$index;
|
|
17814
18020
|
const layoutColumn = {
|
|
17815
18021
|
columnId: column.columnId,
|
|
17816
18022
|
left: 0,
|
|
17817
18023
|
top,
|
|
17818
18024
|
width
|
|
17819
18025
|
};
|
|
17820
|
-
top += Math.max(0,
|
|
18026
|
+
top += Math.max(0, columnHeights[index] ?? 0);
|
|
17821
18027
|
return layoutColumn;
|
|
17822
18028
|
})
|
|
17823
18029
|
};
|
|
@@ -17845,9 +18051,9 @@ function shouldStack(columns, availableWidth, gap, responsive) {
|
|
|
17845
18051
|
return columns.reduce((sum, column) => sum + getMinWidth(column), 0) + gap * Math.max(0, columns.length - 1) > availableWidth;
|
|
17846
18052
|
}
|
|
17847
18053
|
function getInitialColumnWidth(source, column, availableWidth) {
|
|
17848
|
-
var _source$
|
|
18054
|
+
var _source$gap2;
|
|
17849
18055
|
if (column == null) return availableWidth;
|
|
17850
|
-
const contentWidth = Math.max(0, availableWidth - Math.max(0, (
|
|
18056
|
+
const contentWidth = Math.max(0, availableWidth - Math.max(0, ((_source$gap2 = source.gap) === null || _source$gap2 === void 0 ? void 0 : _source$gap2.v) ?? 0) * Math.max(0, source.columns.length - 1));
|
|
17851
18057
|
const ratioSum = source.columns.reduce((sum, item) => sum + Math.max(0, item.widthRatio || 0), 0) || source.columns.length;
|
|
17852
18058
|
return Math.max(getMinWidth(column), contentWidth * (Math.max(0, column.widthRatio || 0) || 1) / ratioSum);
|
|
17853
18059
|
}
|
|
@@ -17882,8 +18088,8 @@ function getFlexibleIndexes(widths, minWidths) {
|
|
|
17882
18088
|
})).filter((item) => item.shrink > 0);
|
|
17883
18089
|
}
|
|
17884
18090
|
function getMinWidth(column) {
|
|
17885
|
-
var _column$minWidth
|
|
17886
|
-
return Math.max(0, (
|
|
18091
|
+
var _column$minWidth;
|
|
18092
|
+
return Math.max(0, ((_column$minWidth = column.minWidth) === null || _column$minWidth === void 0 ? void 0 : _column$minWidth.v) ?? 0);
|
|
17887
18093
|
}
|
|
17888
18094
|
function sumHeights(heights) {
|
|
17889
18095
|
return heights.reduce((sum, height) => sum + Math.max(0, height), 0);
|
|
@@ -18276,11 +18482,10 @@ var LanguageDetector = class LanguageDetector {
|
|
|
18276
18482
|
return this._instance;
|
|
18277
18483
|
}
|
|
18278
18484
|
detect(text) {
|
|
18279
|
-
var _LANG_MAP_TO_HYPHEN_L;
|
|
18280
18485
|
let lang = this._detectCache.get(text);
|
|
18281
18486
|
if (lang) return lang;
|
|
18282
18487
|
const francLang = franc(text);
|
|
18283
|
-
lang =
|
|
18488
|
+
lang = LANG_MAP_TO_HYPHEN_LANG[francLang] ?? "unknown";
|
|
18284
18489
|
this._detectCache.set(text, lang);
|
|
18285
18490
|
return lang;
|
|
18286
18491
|
}
|
|
@@ -18399,12 +18604,12 @@ function isHitTestAddressableGlyph(glyph) {
|
|
|
18399
18604
|
return Boolean((_glyph$content = glyph.content) === null || _glyph$content === void 0 ? void 0 : _glyph$content.length) || glyph.streamType === DataStreamTreeTokenType.PARAGRAPH && glyph.count > 0;
|
|
18400
18605
|
}
|
|
18401
18606
|
function resolveMostSpecificPageByCharIndex(page, charIndex) {
|
|
18402
|
-
var _page$
|
|
18403
|
-
for (const table of (
|
|
18607
|
+
var _page$skeTables2, _page$skeColumnGroups;
|
|
18608
|
+
for (const table of ((_page$skeTables2 = page.skeTables) === null || _page$skeTables2 === void 0 ? void 0 : _page$skeTables2.values()) ?? []) for (const row of table.rows) for (const cell of row.cells) {
|
|
18404
18609
|
const { st, ed } = cell;
|
|
18405
18610
|
if (charIndex >= st && charIndex <= ed) return resolveMostSpecificPageByCharIndex(cell, charIndex);
|
|
18406
18611
|
}
|
|
18407
|
-
for (const columnGroup of (_page$skeColumnGroups =
|
|
18612
|
+
for (const columnGroup of ((_page$skeColumnGroups = page.skeColumnGroups) === null || _page$skeColumnGroups === void 0 ? void 0 : _page$skeColumnGroups.values()) ?? []) for (const column of columnGroup.columns) {
|
|
18408
18613
|
const { st, ed } = column;
|
|
18409
18614
|
if (charIndex >= st && charIndex <= ed) return resolveMostSpecificPageByCharIndex(column.page, charIndex);
|
|
18410
18615
|
}
|
|
@@ -18462,11 +18667,10 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18462
18667
|
* PS: This method has significant impact on performance.
|
|
18463
18668
|
*/
|
|
18464
18669
|
calculate(bounds) {
|
|
18465
|
-
var _ctx$paginationMetric;
|
|
18466
18670
|
if (!this.dirty) return;
|
|
18467
18671
|
const ctx = this._prepareLayoutContext();
|
|
18468
18672
|
this._skeletonData = this._createSkeleton(ctx, bounds);
|
|
18469
|
-
this._paginationMetrics =
|
|
18673
|
+
this._paginationMetrics = ctx.paginationMetrics ?? null;
|
|
18470
18674
|
this._dirty$.next(true);
|
|
18471
18675
|
}
|
|
18472
18676
|
getSkeletonData() {
|
|
@@ -18694,10 +18898,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18694
18898
|
const headerSke = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(pageWidth);
|
|
18695
18899
|
if (headerSke) exactMatch = this._collectNearestNode(headerSke, 1, page, headerId, pi, cache, x, y, pageLength);
|
|
18696
18900
|
const footerSke = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(pageWidth);
|
|
18697
|
-
if (footerSke)
|
|
18698
|
-
var _exactMatch;
|
|
18699
|
-
exactMatch = (_exactMatch = exactMatch) !== null && _exactMatch !== void 0 ? _exactMatch : this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
18700
|
-
}
|
|
18901
|
+
if (footerSke) exactMatch = exactMatch ?? this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
18701
18902
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
18702
18903
|
if (exactMatch) return exactMatch;
|
|
18703
18904
|
this._translatePage(page, pageLayoutType, pageMarginLeft, pageMarginTop);
|
|
@@ -18713,10 +18914,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18713
18914
|
const headerSke = (_skeHeaders$get3 = skeHeaders.get(headerId)) === null || _skeHeaders$get3 === void 0 ? void 0 : _skeHeaders$get3.get(pageWidth);
|
|
18714
18915
|
if (headerSke) exactMatch = this._collectNearestNode(headerSke, 1, page, headerId, pi, cache, x, y, pageLength);
|
|
18715
18916
|
const footerSke = (_skeFooters$get3 = skeFooters.get(footerId)) === null || _skeFooters$get3 === void 0 ? void 0 : _skeFooters$get3.get(pageWidth);
|
|
18716
|
-
if (footerSke)
|
|
18717
|
-
var _exactMatch2;
|
|
18718
|
-
exactMatch = (_exactMatch2 = exactMatch) !== null && _exactMatch2 !== void 0 ? _exactMatch2 : this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
18719
|
-
}
|
|
18917
|
+
if (footerSke) exactMatch = exactMatch ?? this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
18720
18918
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
18721
18919
|
if (exactMatch) return exactMatch;
|
|
18722
18920
|
this._translatePage(page, pageLayoutType, pageMarginLeft, pageMarginTop);
|
|
@@ -18865,8 +19063,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18865
19063
|
}
|
|
18866
19064
|
let exactMatch = null;
|
|
18867
19065
|
if (skeTables.size > 0) {
|
|
18868
|
-
var _this$_docViewModel$g, _this$_docViewModel$g2
|
|
18869
|
-
const unitId = (_this$_docViewModel$g = (_this$_docViewModel$g2 =
|
|
19066
|
+
var _this$_docViewModel$g, _this$_docViewModel$g2;
|
|
19067
|
+
const unitId = ((_this$_docViewModel$g = (_this$_docViewModel$g2 = this._docViewModel.getDataModel()).getUnitId) === null || _this$_docViewModel$g === void 0 ? void 0 : _this$_docViewModel$g.call(_this$_docViewModel$g2)) ?? "";
|
|
18870
19068
|
for (const table of skeTables.values()) {
|
|
18871
19069
|
var _this$_findLiquid, _this$_findLiquid2, _this$_findLiquid11;
|
|
18872
19070
|
const { top: tableTop, left: tableLeft, rows } = table;
|
|
@@ -18875,8 +19073,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18875
19073
|
(_this$_findLiquid = this._findLiquid) === null || _this$_findLiquid === void 0 || _this$_findLiquid.translateSave();
|
|
18876
19074
|
(_this$_findLiquid2 = this._findLiquid) === null || _this$_findLiquid2 === void 0 || _this$_findLiquid2.translate(tableLeft, tableTop);
|
|
18877
19075
|
if (hasDocsTableHorizontalViewport(viewport)) {
|
|
18878
|
-
var
|
|
18879
|
-
const visibleLeft = this._findLiquid.x + page.marginLeft - (
|
|
19076
|
+
var _this$_findLiquid4;
|
|
19077
|
+
const visibleLeft = this._findLiquid.x + page.marginLeft - (viewport.leadingInsetLeft ?? 0);
|
|
18880
19078
|
const visibleRight = visibleLeft + viewport.viewportWidth;
|
|
18881
19079
|
if (x < visibleLeft || x > visibleRight) {
|
|
18882
19080
|
var _this$_findLiquid3;
|
|
@@ -18892,11 +19090,11 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18892
19090
|
(_this$_findLiquid5 = this._findLiquid) === null || _this$_findLiquid5 === void 0 || _this$_findLiquid5.translateSave();
|
|
18893
19091
|
(_this$_findLiquid6 = this._findLiquid) === null || _this$_findLiquid6 === void 0 || _this$_findLiquid6.translate(0, rowTop);
|
|
18894
19092
|
for (const cell of cells) {
|
|
18895
|
-
var _this$_findLiquid7, _this$_findLiquid8,
|
|
19093
|
+
var _this$_findLiquid7, _this$_findLiquid8, _this$_findLiquid9;
|
|
18896
19094
|
const { left: cellLeft } = cell;
|
|
18897
19095
|
(_this$_findLiquid7 = this._findLiquid) === null || _this$_findLiquid7 === void 0 || _this$_findLiquid7.translateSave();
|
|
18898
19096
|
(_this$_findLiquid8 = this._findLiquid) === null || _this$_findLiquid8 === void 0 || _this$_findLiquid8.translate(cellLeft, 0);
|
|
18899
|
-
exactMatch =
|
|
19097
|
+
exactMatch = exactMatch ?? this._collectNearestNode(cell, 3, cell, segmentId, pi, cache, x, y, pageLength, nestLevel + 1);
|
|
18900
19098
|
(_this$_findLiquid9 = this._findLiquid) === null || _this$_findLiquid9 === void 0 || _this$_findLiquid9.translateRestore();
|
|
18901
19099
|
}
|
|
18902
19100
|
(_this$_findLiquid10 = this._findLiquid) === null || _this$_findLiquid10 === void 0 || _this$_findLiquid10.translateRestore();
|
|
@@ -18913,7 +19111,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18913
19111
|
(_this$_findLiquid12 = this._findLiquid) === null || _this$_findLiquid12 === void 0 || _this$_findLiquid12.translateSave();
|
|
18914
19112
|
(_this$_findLiquid13 = this._findLiquid) === null || _this$_findLiquid13 === void 0 || _this$_findLiquid13.translate(columnGroupLeft, columnGroupTop);
|
|
18915
19113
|
for (const column of columns) {
|
|
18916
|
-
var _this$_findLiquid14, _this$_findLiquid15,
|
|
19114
|
+
var _this$_findLiquid14, _this$_findLiquid15, _this$_findLiquid16;
|
|
18917
19115
|
const absoluteColumnLeft = absoluteColumnGroupLeft + column.left;
|
|
18918
19116
|
const absoluteColumnTop = absoluteColumnGroupTop + column.top;
|
|
18919
19117
|
if (x < absoluteColumnLeft || x > absoluteColumnLeft + column.width || y < absoluteColumnTop || y > absoluteColumnTop + column.height) continue;
|
|
@@ -18923,7 +19121,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
18923
19121
|
};
|
|
18924
19122
|
(_this$_findLiquid14 = this._findLiquid) === null || _this$_findLiquid14 === void 0 || _this$_findLiquid14.translateSave();
|
|
18925
19123
|
(_this$_findLiquid15 = this._findLiquid) === null || _this$_findLiquid15 === void 0 || _this$_findLiquid15.translate(column.left, column.top);
|
|
18926
|
-
exactMatch =
|
|
19124
|
+
exactMatch = exactMatch ?? this._collectNearestNode(column.page, 3, column.page, segmentId, pi, nestedCache, x, y, pageLength, nestLevel + 1) ?? this._getNearestNode(nestedCache.nearestNodeList, nestedCache.nearestNodeDistanceList);
|
|
18927
19125
|
(_this$_findLiquid16 = this._findLiquid) === null || _this$_findLiquid16 === void 0 || _this$_findLiquid16.translateRestore();
|
|
18928
19126
|
}
|
|
18929
19127
|
(_this$_findLiquid17 = this._findLiquid) === null || _this$_findLiquid17 === void 0 || _this$_findLiquid17.translateRestore();
|
|
@@ -19095,7 +19293,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
19095
19293
|
reuseCurrentPage = true;
|
|
19096
19294
|
} else if (reuseNextColumn) reuseCurrentPage = true;
|
|
19097
19295
|
else if (layoutAnchor == null || curSkeletonPage == null) {
|
|
19098
|
-
let nextPageNumber = curSkeletonPage == null ? pageNumberStart : explicitPageNumberStart
|
|
19296
|
+
let nextPageNumber = curSkeletonPage == null ? pageNumberStart : explicitPageNumberStart ?? curSkeletonPage.pageNumber + 1;
|
|
19099
19297
|
if (curSkeletonPage != null && (effectiveSectionType === SectionType.EVEN_PAGE || effectiveSectionType === SectionType.ODD_PAGE) && !isTargetPageParity(nextPageNumber, effectiveSectionType)) {
|
|
19100
19298
|
const fillerPage = createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, nextPageNumber);
|
|
19101
19299
|
allSkeletonPages.push(fillerPage);
|
|
@@ -19140,12 +19338,12 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
19140
19338
|
sections.push(newSection);
|
|
19141
19339
|
}
|
|
19142
19340
|
_addNewSectionByNextColumn(curSkeletonPage, columnProperties, columnSeparatorType) {
|
|
19143
|
-
var _curSkeletonPage$sect
|
|
19341
|
+
var _curSkeletonPage$sect;
|
|
19144
19342
|
const currentColumn = getLastNotFullColumnInfo(curSkeletonPage);
|
|
19145
19343
|
const nextColumnIndex = currentColumn == null ? 0 : currentColumn.index + 1;
|
|
19146
19344
|
if (nextColumnIndex >= (columnProperties.length || 1)) return false;
|
|
19147
19345
|
const { pageWidth, pageHeight, marginTop, marginBottom, marginLeft, marginRight } = curSkeletonPage;
|
|
19148
|
-
const sectionTop = (_curSkeletonPage$sect =
|
|
19346
|
+
const sectionTop = ((_curSkeletonPage$sect = curSkeletonPage.sections[curSkeletonPage.sections.length - 1]) === null || _curSkeletonPage$sect === void 0 ? void 0 : _curSkeletonPage$sect.top) ?? 0;
|
|
19149
19347
|
const newSection = createSkeletonSection(columnProperties, columnSeparatorType, sectionTop, 0, pageWidth - marginLeft - marginRight, pageHeight - marginTop - marginBottom - sectionTop);
|
|
19150
19348
|
newSection.columns.slice(0, nextColumnIndex).forEach((column) => {
|
|
19151
19349
|
column.isFull = true;
|
|
@@ -19272,25 +19470,43 @@ const DEFAULT_PADDING_DATA = {
|
|
|
19272
19470
|
r: 2
|
|
19273
19471
|
};
|
|
19274
19472
|
const RENDER_RAW_FORMULA_KEY = "RENDER_RAW_FORMULA";
|
|
19473
|
+
const GENERAL_NUMBER_MAX_SIGNIFICANT_DIGITS = 15;
|
|
19474
|
+
const GENERAL_NUMBER_RESERVE_GLYPH = "0";
|
|
19275
19475
|
function getShrinkToFitScale(contentWidth, availableWidth, fontSize) {
|
|
19276
19476
|
if (contentWidth <= availableWidth || contentWidth <= 0 || availableWidth <= 0 || fontSize <= 0) return 1;
|
|
19277
19477
|
return Math.max(1 / fontSize, availableWidth / contentWidth);
|
|
19278
19478
|
}
|
|
19479
|
+
function getGeneralNumberDisplayText(value, displayText, fontString, availableWidth) {
|
|
19480
|
+
if (availableWidth <= 0) return displayText;
|
|
19481
|
+
const roundingReserveWidth = FontCache.getMeasureText(GENERAL_NUMBER_RESERVE_GLYPH, fontString).width;
|
|
19482
|
+
if (FontCache.getMeasureText(displayText, fontString).width + roundingReserveWidth <= availableWidth) return displayText;
|
|
19483
|
+
let bestFit = "";
|
|
19484
|
+
for (let decimalPlaces = 0; decimalPlaces < GENERAL_NUMBER_MAX_SIGNIFICANT_DIGITS; decimalPlaces++) {
|
|
19485
|
+
const pattern = decimalPlaces === 0 ? "0E+00" : `0.${"#".repeat(decimalPlaces)}E+00`;
|
|
19486
|
+
const candidate = numfmt.format(pattern, value);
|
|
19487
|
+
if (FontCache.getMeasureText(candidate, fontString).width + roundingReserveWidth > availableWidth) break;
|
|
19488
|
+
bestFit = candidate;
|
|
19489
|
+
}
|
|
19490
|
+
if (bestFit) return bestFit;
|
|
19491
|
+
if (Math.abs(value) < 1 && FontCache.getMeasureText("0", fontString).width < availableWidth) return "0";
|
|
19492
|
+
const hashWidth = FontCache.getMeasureText("#", fontString).width;
|
|
19493
|
+
if (hashWidth <= 0) return "#";
|
|
19494
|
+
return "#".repeat(Math.max(1, Math.floor(availableWidth / hashWidth)));
|
|
19495
|
+
}
|
|
19279
19496
|
function scaleDocumentDataForShrinkToFit(documentData, scale, fallbackFontSize) {
|
|
19280
|
-
var _scaled$
|
|
19497
|
+
var _scaled$body;
|
|
19281
19498
|
const scaled = Tools.deepClone(documentData);
|
|
19282
|
-
const defaultTextStyle =
|
|
19283
|
-
const defaultFontSize =
|
|
19499
|
+
const defaultTextStyle = scaled.documentStyle.textStyle ?? {};
|
|
19500
|
+
const defaultFontSize = defaultTextStyle.fs ?? fallbackFontSize;
|
|
19284
19501
|
scaled.documentStyle.textStyle = {
|
|
19285
19502
|
...defaultTextStyle,
|
|
19286
19503
|
fs: defaultFontSize * scale
|
|
19287
19504
|
};
|
|
19288
19505
|
(_scaled$body = scaled.body) === null || _scaled$body === void 0 || (_scaled$body = _scaled$body.textRuns) === null || _scaled$body === void 0 || _scaled$body.forEach((textRun) => {
|
|
19289
|
-
|
|
19290
|
-
const textStyle = (_textRun$ts = textRun.ts) !== null && _textRun$ts !== void 0 ? _textRun$ts : {};
|
|
19506
|
+
const textStyle = textRun.ts ?? {};
|
|
19291
19507
|
textRun.ts = {
|
|
19292
19508
|
...textStyle,
|
|
19293
|
-
fs: (
|
|
19509
|
+
fs: (textStyle.fs ?? defaultFontSize) * scale
|
|
19294
19510
|
};
|
|
19295
19511
|
});
|
|
19296
19512
|
return scaled;
|
|
@@ -19302,14 +19518,13 @@ function getResolvedRenderHorizontalAlign$1(horizontalAlign, cellData) {
|
|
|
19302
19518
|
return horizontalAlign;
|
|
19303
19519
|
}
|
|
19304
19520
|
function setRenderTextCache(cacheItem, cellData) {
|
|
19305
|
-
var _cacheItem$horizontal;
|
|
19306
19521
|
if (cacheItem.documentSkeleton) {
|
|
19307
19522
|
cacheItem.displayText = void 0;
|
|
19308
19523
|
cacheItem.resolvedHorizontalAlign = void 0;
|
|
19309
19524
|
return;
|
|
19310
19525
|
}
|
|
19311
19526
|
cacheItem.displayText = getDisplayValueFromCell(cellData);
|
|
19312
|
-
cacheItem.resolvedHorizontalAlign = getResolvedRenderHorizontalAlign$1(
|
|
19527
|
+
cacheItem.resolvedHorizontalAlign = getResolvedRenderHorizontalAlign$1(cacheItem.horizontalAlign ?? HorizontalAlign.UNSPECIFIED, cellData);
|
|
19313
19528
|
}
|
|
19314
19529
|
function pushRowRange(ranges, row, startColumn, endColumn) {
|
|
19315
19530
|
if (endColumn < startColumn) return;
|
|
@@ -19360,8 +19575,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19360
19575
|
}
|
|
19361
19576
|
registerGetCellHeight() {
|
|
19362
19577
|
this.disposeWithMe(this.worksheet.__registerGetCellHeight((row, col) => {
|
|
19363
|
-
|
|
19364
|
-
return (_this$calculateAutoHe = this.calculateAutoHeightForCell(row, col)) !== null && _this$calculateAutoHe !== void 0 ? _this$calculateAutoHe : 0;
|
|
19578
|
+
return this.calculateAutoHeightForCell(row, col) ?? 0;
|
|
19365
19579
|
}));
|
|
19366
19580
|
}
|
|
19367
19581
|
setScene(scene) {
|
|
@@ -19472,7 +19686,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19472
19686
|
* @param vpInfo viewBounds
|
|
19473
19687
|
*/
|
|
19474
19688
|
setStylesCache(vpInfo) {
|
|
19475
|
-
var _vpInfo$diffBounds, _vpInfo$diffCacheBoun, _vpInfo$diffCacheBoun2
|
|
19689
|
+
var _vpInfo$diffBounds, _vpInfo$diffCacheBoun, _vpInfo$diffCacheBoun2;
|
|
19476
19690
|
if (!this._worksheetData) return;
|
|
19477
19691
|
if (!this.rowHeightAccumulation || !this.columnWidthAccumulation) return;
|
|
19478
19692
|
this.updateVisibleRange(vpInfo);
|
|
@@ -19480,25 +19694,24 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19480
19694
|
const columnWidthAccumulation = this.columnWidthAccumulation;
|
|
19481
19695
|
const isIncrementalScroll = !!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);
|
|
19482
19696
|
const hasMergeData = this.worksheet.getMergeData().length > 0;
|
|
19483
|
-
const
|
|
19484
|
-
const shouldRefreshCacheForScroll = isIncrementalScroll && (hasMergeData && isScrolling || !!vpInfo.shouldCacheUpdate && !!vpInfo.diffX);
|
|
19697
|
+
const shouldRefreshCacheForScroll = isIncrementalScroll && !!vpInfo.shouldCacheUpdate && !!vpInfo.diffX;
|
|
19485
19698
|
const shouldUseIncrementalStyleRange = isIncrementalScroll && !shouldRefreshCacheForScroll;
|
|
19486
|
-
const styleRanges = shouldUseIncrementalStyleRange ? vpInfo.shouldCacheUpdate ? (_vpInfo$diffCacheBoun2 =
|
|
19487
|
-
const visibleCellOptions =
|
|
19699
|
+
const styleRanges = shouldUseIncrementalStyleRange ? vpInfo.shouldCacheUpdate ? ((_vpInfo$diffCacheBoun2 = vpInfo.diffCacheBounds) === null || _vpInfo$diffCacheBoun2 === void 0 ? void 0 : _vpInfo$diffCacheBoun2.map((bound) => this.getRangeByViewBound(bound))) ?? [] : [] : [rowColumnSegment];
|
|
19700
|
+
const visibleCellOptions = {
|
|
19488
19701
|
cacheItem: {
|
|
19489
19702
|
bg: true,
|
|
19490
19703
|
border: true
|
|
19491
19704
|
},
|
|
19492
|
-
reuseExisting:
|
|
19705
|
+
reuseExisting: isIncrementalScroll,
|
|
19493
19706
|
hasMergeData,
|
|
19494
19707
|
rowVisible: true
|
|
19495
19708
|
};
|
|
19496
|
-
const overflowCellOptions =
|
|
19709
|
+
const overflowCellOptions = {
|
|
19497
19710
|
cacheItem: {
|
|
19498
19711
|
bg: false,
|
|
19499
19712
|
border: false
|
|
19500
19713
|
},
|
|
19501
|
-
reuseExisting:
|
|
19714
|
+
reuseExisting: isIncrementalScroll,
|
|
19502
19715
|
hasMergeData,
|
|
19503
19716
|
rowVisible: true
|
|
19504
19717
|
};
|
|
@@ -19527,40 +19740,16 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19527
19740
|
startColumn: visibleStartColumn,
|
|
19528
19741
|
endColumn: visibleEndColumn
|
|
19529
19742
|
});
|
|
19530
|
-
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, visibleCellOptions
|
|
19531
|
-
cacheItem: {
|
|
19532
|
-
bg: true,
|
|
19533
|
-
border: true
|
|
19534
|
-
},
|
|
19535
|
-
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19536
|
-
hasMergeData,
|
|
19537
|
-
rowVisible: true
|
|
19538
|
-
});
|
|
19743
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, visibleCellOptions);
|
|
19539
19744
|
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, visibleStartColumn, visibleEndColumn);
|
|
19540
19745
|
for (let c = visibleStartColumn - 1; c >= expandStartCol; c--) {
|
|
19541
|
-
this._setStylesCacheForOneCell(r, c, overflowCellOptions
|
|
19542
|
-
cacheItem: {
|
|
19543
|
-
bg: false,
|
|
19544
|
-
border: false
|
|
19545
|
-
},
|
|
19546
|
-
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19547
|
-
hasMergeData,
|
|
19548
|
-
rowVisible: true
|
|
19549
|
-
});
|
|
19746
|
+
this._setStylesCacheForOneCell(r, c, overflowCellOptions);
|
|
19550
19747
|
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, c, c);
|
|
19551
19748
|
if (!isCellCoverable(this.worksheet.getCell(r, c)) || hasMergeData && this.intersectMergeRange(r, c)) break;
|
|
19552
19749
|
}
|
|
19553
19750
|
if (visibleEndColumn === 0) continue;
|
|
19554
19751
|
for (let c = visibleEndColumn + 1; c <= expandEndCol; c++) {
|
|
19555
|
-
this._setStylesCacheForOneCell(r, c, overflowCellOptions
|
|
19556
|
-
cacheItem: {
|
|
19557
|
-
bg: false,
|
|
19558
|
-
border: false
|
|
19559
|
-
},
|
|
19560
|
-
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19561
|
-
hasMergeData,
|
|
19562
|
-
rowVisible: true
|
|
19563
|
-
});
|
|
19752
|
+
this._setStylesCacheForOneCell(r, c, overflowCellOptions);
|
|
19564
19753
|
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, c, c);
|
|
19565
19754
|
if (!isCellCoverable(this.worksheet.getCell(r, c)) || hasMergeData && this.intersectMergeRange(r, c)) break;
|
|
19566
19755
|
}
|
|
@@ -19573,7 +19762,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19573
19762
|
for (const mergeRange of mergeRanges) {
|
|
19574
19763
|
this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, {
|
|
19575
19764
|
mergeRange,
|
|
19576
|
-
reuseExisting:
|
|
19765
|
+
reuseExisting: isIncrementalScroll,
|
|
19577
19766
|
hasMergeData
|
|
19578
19767
|
});
|
|
19579
19768
|
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, mergeRange.startRow, mergeRange.startColumn, mergeRange.startColumn);
|
|
@@ -19605,10 +19794,9 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19605
19794
|
let maxPrev = 0;
|
|
19606
19795
|
let maxCurrent = 0;
|
|
19607
19796
|
for (let colIndex = startColumn; colIndex <= endColumn; colIndex++) {
|
|
19608
|
-
|
|
19609
|
-
const autoHeight = (_currentCellHeights$g = currentCellHeights.getValue(rowIndex, colIndex)) !== null && _currentCellHeights$g !== void 0 ? _currentCellHeights$g : 0;
|
|
19797
|
+
const autoHeight = currentCellHeights.getValue(rowIndex, colIndex) ?? 0;
|
|
19610
19798
|
maxPrev = Math.max(maxPrev, autoHeight);
|
|
19611
|
-
const currentHeight =
|
|
19799
|
+
const currentHeight = this.calculateAutoHeightForCell(rowIndex, colIndex) ?? this._worksheetData.defaultRowHeight;
|
|
19612
19800
|
maxCurrent = Math.max(maxCurrent, currentHeight);
|
|
19613
19801
|
}
|
|
19614
19802
|
if (maxPrev < currentAutoHeight) {
|
|
@@ -19644,7 +19832,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19644
19832
|
return results;
|
|
19645
19833
|
}
|
|
19646
19834
|
calculateAutoHeightForCell(row, col) {
|
|
19647
|
-
var _cell$fontRenderExten, _cell$fontRenderExten2,
|
|
19835
|
+
var _cell$fontRenderExten, _cell$fontRenderExten2, _columnData$col;
|
|
19648
19836
|
const { columnData, defaultColumnWidth } = this._worksheetData;
|
|
19649
19837
|
const cellMergeInfo = this.worksheet.getCellInfoInMergeData(row, col);
|
|
19650
19838
|
if (this._skipAutoHeightForMergedCells) {
|
|
@@ -19656,21 +19844,20 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19656
19844
|
const cellHeight = cell.interceptorAutoHeight();
|
|
19657
19845
|
if (cellHeight) return cellHeight;
|
|
19658
19846
|
}
|
|
19659
|
-
const sideGap = ((
|
|
19660
|
-
const { vertexAngle, centerAngle } = convertTextRotation((
|
|
19847
|
+
const sideGap = ((cell === null || cell === void 0 || (_cell$fontRenderExten = cell.fontRenderExtension) === null || _cell$fontRenderExten === void 0 ? void 0 : _cell$fontRenderExten.leftOffset) ?? 0) + ((cell === null || cell === void 0 || (_cell$fontRenderExten2 = cell.fontRenderExtension) === null || _cell$fontRenderExten2 === void 0 ? void 0 : _cell$fontRenderExten2.rightOffset) ?? 0);
|
|
19848
|
+
const { vertexAngle, centerAngle } = convertTextRotation((style === null || style === void 0 ? void 0 : style.tr) ?? { a: 0 });
|
|
19661
19849
|
const isRichText = (cell === null || cell === void 0 ? void 0 : cell.p) || vertexAngle || centerAngle;
|
|
19662
|
-
let colWidth = (
|
|
19850
|
+
let colWidth = ((_columnData$col = columnData[col]) === null || _columnData$col === void 0 ? void 0 : _columnData$col.w) ?? defaultColumnWidth;
|
|
19663
19851
|
if (cellMergeInfo.isMergedMainCell) {
|
|
19664
19852
|
const mergeCellStartCol = cellMergeInfo.startColumn;
|
|
19665
19853
|
const mergeCellEndCol = cellMergeInfo.endColumn;
|
|
19666
19854
|
colWidth = Array.from({ length: mergeCellEndCol - mergeCellStartCol + 1 }, (_, index) => mergeCellStartCol + index).reduce((sum, colIndex) => {
|
|
19667
|
-
var _columnData$colIndex
|
|
19668
|
-
return sum + ((
|
|
19855
|
+
var _columnData$colIndex;
|
|
19856
|
+
return sum + (((_columnData$colIndex = columnData[colIndex]) === null || _columnData$colIndex === void 0 ? void 0 : _columnData$colIndex.w) ?? defaultColumnWidth);
|
|
19669
19857
|
}, 0);
|
|
19670
19858
|
}
|
|
19671
19859
|
colWidth -= sideGap;
|
|
19672
19860
|
if (isRichText) {
|
|
19673
|
-
var _getDocsSkeletonPageS;
|
|
19674
19861
|
const modelObject = cell && this.worksheet.getCellDocumentModel(cell, style);
|
|
19675
19862
|
if (modelObject == null) return;
|
|
19676
19863
|
const { documentModel, textRotation, wrapStrategy } = modelObject;
|
|
@@ -19680,7 +19867,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19680
19867
|
if (typeof colWidth === "number" && wrapStrategy === WrapStrategy.WRAP) documentModel.updateDocumentDataPageSize(colWidth);
|
|
19681
19868
|
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
19682
19869
|
documentSkeleton.calculate();
|
|
19683
|
-
let { height: h = 0 } =
|
|
19870
|
+
let { height: h = 0 } = getDocsSkeletonPageSize(documentSkeleton, angle) ?? {};
|
|
19684
19871
|
if (documentSkeleton) {
|
|
19685
19872
|
const skeletonData = documentSkeleton.getSkeletonData();
|
|
19686
19873
|
const { marginTop: t, marginBottom: b, marginLeft: l, marginRight: r } = skeletonData.pages[skeletonData.pages.length - 1];
|
|
@@ -19689,12 +19876,12 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19689
19876
|
}
|
|
19690
19877
|
return h;
|
|
19691
19878
|
} else {
|
|
19692
|
-
var _style$pd
|
|
19879
|
+
var _style$pd, _style$pd2, _style$pd3, _style$pd4;
|
|
19693
19880
|
if ((cell === null || cell === void 0 ? void 0 : cell.v) === void 0 || (cell === null || cell === void 0 ? void 0 : cell.v) === null) return;
|
|
19694
|
-
const paddingLeft = (
|
|
19695
|
-
const paddingRight = (
|
|
19696
|
-
const paddingTop = (
|
|
19697
|
-
const paddingBottom = (
|
|
19881
|
+
const paddingLeft = ((_style$pd = style.pd) === null || _style$pd === void 0 ? void 0 : _style$pd.l) ?? DEFAULT_PADDING_DATA.l;
|
|
19882
|
+
const paddingRight = ((_style$pd2 = style.pd) === null || _style$pd2 === void 0 ? void 0 : _style$pd2.r) ?? DEFAULT_PADDING_DATA.r;
|
|
19883
|
+
const paddingTop = ((_style$pd3 = style.pd) === null || _style$pd3 === void 0 ? void 0 : _style$pd3.t) ?? DEFAULT_PADDING_DATA.t;
|
|
19884
|
+
const paddingBottom = ((_style$pd4 = style.pd) === null || _style$pd4 === void 0 ? void 0 : _style$pd4.b) ?? DEFAULT_PADDING_DATA.b;
|
|
19698
19885
|
if ((style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP) {
|
|
19699
19886
|
const skeleton = new DocSimpleSkeleton(getDisplayValueFromCell(cell), getFontStyleString(style).fontCache, (style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP, colWidth - paddingLeft - paddingRight, Infinity);
|
|
19700
19887
|
skeleton.calculate();
|
|
@@ -19773,8 +19960,8 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19773
19960
|
}
|
|
19774
19961
|
let measuredWidth = this._getMeasuredWidthByCell(cell, row, colIndex, currColWidth);
|
|
19775
19962
|
if (cell.fontRenderExtension) {
|
|
19776
|
-
var _cell$
|
|
19777
|
-
measuredWidth += (((_cell$
|
|
19963
|
+
var _cell$fontRenderExten3, _cell$fontRenderExten4;
|
|
19964
|
+
measuredWidth += (((_cell$fontRenderExten3 = cell.fontRenderExtension) === null || _cell$fontRenderExten3 === void 0 ? void 0 : _cell$fontRenderExten3.leftOffset) || 0) + (((_cell$fontRenderExten4 = cell.fontRenderExtension) === null || _cell$fontRenderExten4 === void 0 ? void 0 : _cell$fontRenderExten4.rightOffset) || 0);
|
|
19778
19965
|
}
|
|
19779
19966
|
colWidth = Math.max(colWidth, measuredWidth);
|
|
19780
19967
|
if (colWidth >= 2e3) return MAXIMUM_COL_WIDTH;
|
|
@@ -19796,9 +19983,9 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19796
19983
|
* @returns {number} currColWidth
|
|
19797
19984
|
*/
|
|
19798
19985
|
_getMeasuredWidthByCell(cell, row, column, currColWidth) {
|
|
19799
|
-
var _cell$
|
|
19986
|
+
var _cell$fontRenderExten5;
|
|
19800
19987
|
let measuredWidth = 0;
|
|
19801
|
-
if (((_cell$
|
|
19988
|
+
if (((_cell$fontRenderExten5 = cell.fontRenderExtension) === null || _cell$fontRenderExten5 === void 0 ? void 0 : _cell$fontRenderExten5.isSkip) && (cell === null || cell === void 0 ? void 0 : cell.interceptorAutoWidth)) {
|
|
19802
19989
|
var _cell$interceptorAuto;
|
|
19803
19990
|
const cellWidth = (_cell$interceptorAuto = cell.interceptorAutoWidth) === null || _cell$interceptorAuto === void 0 ? void 0 : _cell$interceptorAuto.call(cell);
|
|
19804
19991
|
if (cellWidth) return cellWidth;
|
|
@@ -19814,7 +20001,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19814
20001
|
else documentModel.updateDocumentDataPageSize(Infinity, Infinity);
|
|
19815
20002
|
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
19816
20003
|
documentSkeleton.calculate();
|
|
19817
|
-
measuredWidth = (
|
|
20004
|
+
measuredWidth = (getDocsSkeletonPageSize(documentSkeleton, angle) ?? { width: 0 }).width;
|
|
19818
20005
|
if (documentSkeleton) {
|
|
19819
20006
|
const skeletonData = documentSkeleton.getSkeletonData();
|
|
19820
20007
|
const { marginTop: t, marginBottom: b, marginLeft: l, marginRight: r } = skeletonData.pages[skeletonData.pages.length - 1];
|
|
@@ -19841,8 +20028,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19841
20028
|
});
|
|
19842
20029
|
}
|
|
19843
20030
|
getOverflowPosition(contentSize, horizontalAlign, row, column, columnCount) {
|
|
19844
|
-
|
|
19845
|
-
const contentWidth = (_contentSize$width = contentSize === null || contentSize === void 0 ? void 0 : contentSize.width) !== null && _contentSize$width !== void 0 ? _contentSize$width : 0;
|
|
20031
|
+
const contentWidth = (contentSize === null || contentSize === void 0 ? void 0 : contentSize.width) ?? 0;
|
|
19846
20032
|
let startColumn = column;
|
|
19847
20033
|
let endColumn = column;
|
|
19848
20034
|
if (horizontalAlign === HorizontalAlign.CENTER) {
|
|
@@ -19868,8 +20054,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19868
20054
|
if (adjacentColumn < 0 || adjacentColumn >= this.getColumnCount()) return true;
|
|
19869
20055
|
const rawAdjacentCell = this._cellData.getValue(row, adjacentColumn);
|
|
19870
20056
|
if (rawAdjacentCell && !isCellCoverable(rawAdjacentCell)) return true;
|
|
19871
|
-
|
|
19872
|
-
return !isCellCoverable(cachedAdjacentCell !== null && cachedAdjacentCell !== void 0 ? cachedAdjacentCell : this.worksheet.getCell(row, adjacentColumn)) || hasMergeData && this.intersectMergeRange(row, adjacentColumn);
|
|
20057
|
+
return !isCellCoverable(((_this$_stylesCache$fo = this._stylesCache.fontMatrix.getValue(row, adjacentColumn)) === null || _this$_stylesCache$fo === void 0 ? void 0 : _this$_stylesCache$fo.cellData) ?? this.worksheet.getCell(row, adjacentColumn)) || hasMergeData && this.intersectMergeRange(row, adjacentColumn);
|
|
19873
20058
|
}
|
|
19874
20059
|
getCellWithMergeInfoByIndex(row, column) {
|
|
19875
20060
|
return this.worksheet.getCellInfoInMergeData(row, column);
|
|
@@ -19895,13 +20080,13 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19895
20080
|
* Numerical and Boolean values are not displayed with overflow.
|
|
19896
20081
|
*/
|
|
19897
20082
|
if ((wrapStrategy === WrapStrategy.OVERFLOW || wrapStrategy === WrapStrategy.UNSPECIFIED) && cellValueType !== CellValueType.NUMBER && cellValueType !== CellValueType.BOOLEAN && horizontalAlign !== HorizontalAlign.JUSTIFIED) {
|
|
19898
|
-
var _docsConfig$cellData
|
|
20083
|
+
var _docsConfig$cellData, _docsConfig$cellData2;
|
|
19899
20084
|
docsConfig.textFitsCurrentCell = false;
|
|
19900
20085
|
if (hasMergeData && this.intersectMergeRange(row, column)) return true;
|
|
19901
20086
|
const columnStart = this.columnWidthAccumulation[column - 1] || 0;
|
|
19902
20087
|
const currentColumnWidth = (this.columnWidthAccumulation[column] || columnStart) - columnStart;
|
|
19903
|
-
const rawText = (
|
|
19904
|
-
if ((Boolean(documentSkeleton) || `${rawText
|
|
20088
|
+
const rawText = ((_docsConfig$cellData = docsConfig.cellData) === null || _docsConfig$cellData === void 0 || (_docsConfig$cellData = _docsConfig$cellData.p) === null || _docsConfig$cellData === void 0 || (_docsConfig$cellData = _docsConfig$cellData.body) === null || _docsConfig$cellData === void 0 ? void 0 : _docsConfig$cellData.dataStream) ?? ((_docsConfig$cellData2 = docsConfig.cellData) === null || _docsConfig$cellData2 === void 0 ? void 0 : _docsConfig$cellData2.v);
|
|
20089
|
+
if ((Boolean(documentSkeleton) || `${rawText ?? ""}`.length * 4 > currentColumnWidth) && this._isOverflowBlockedByAdjacentCell(row, column, horizontalAlignPos, hasMergeData)) return true;
|
|
19905
20090
|
let contentSize;
|
|
19906
20091
|
if (documentSkeleton) contentSize = getDocsSkeletonPageSize(documentSkeleton, vertexAngle);
|
|
19907
20092
|
else {
|
|
@@ -20023,13 +20208,13 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20023
20208
|
for (let i = 0; i < ranges.length; i++) {
|
|
20024
20209
|
const range = ranges[i];
|
|
20025
20210
|
Range.foreach(range, (row, col) => {
|
|
20026
|
-
var _this$_stylesCache$bo, _this$_stylesCache$ba
|
|
20211
|
+
var _this$_stylesCache$bo, _this$_stylesCache$ba;
|
|
20027
20212
|
this._stylesCache.fontMatrix.realDeleteValue(row, col);
|
|
20028
20213
|
(_this$_stylesCache$bo = this._stylesCache.border) === null || _this$_stylesCache$bo === void 0 || _this$_stylesCache$bo.realDeleteValue(row, col);
|
|
20029
20214
|
(_this$_stylesCache$ba = this._stylesCache.backgroundPositions) === null || _this$_stylesCache$ba === void 0 || _this$_stylesCache$ba.realDeleteValue(row, col);
|
|
20030
20215
|
this._handleBgMatrix.realDeleteValue(row, col);
|
|
20031
20216
|
this._handleBorderMatrix.realDeleteValue(row, col);
|
|
20032
|
-
Object.values(
|
|
20217
|
+
Object.values(this._stylesCache.background ?? {}).forEach((backgroundMatrix) => {
|
|
20033
20218
|
backgroundMatrix.realDeleteValue(row, col);
|
|
20034
20219
|
});
|
|
20035
20220
|
});
|
|
@@ -20072,25 +20257,25 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20072
20257
|
}).bg) return;
|
|
20073
20258
|
this._handleBgMatrix.setValue(row, col, true);
|
|
20074
20259
|
if (style && style.bg && style.bg.rgb) {
|
|
20075
|
-
var _this$_stylesCache$
|
|
20260
|
+
var _this$_stylesCache$ba2;
|
|
20076
20261
|
const rgb = style.bg.rgb;
|
|
20077
20262
|
if (!this._stylesCache.background[rgb]) this._stylesCache.background[rgb] = new ObjectMatrix();
|
|
20078
20263
|
this._stylesCache.background[rgb].setValue(row, col, rgb);
|
|
20079
20264
|
const cellInfo = this.getCellWithCoordByIndex(row, col, false);
|
|
20080
|
-
(_this$_stylesCache$
|
|
20265
|
+
(_this$_stylesCache$ba2 = this._stylesCache.backgroundPositions) === null || _this$_stylesCache$ba2 === void 0 || _this$_stylesCache$ba2.setValue(row, col, cellInfo);
|
|
20081
20266
|
}
|
|
20082
20267
|
}
|
|
20083
20268
|
_applyShrinkToFit(row, col, fontCache, style) {
|
|
20084
|
-
var
|
|
20269
|
+
var _fontCache$cellData;
|
|
20085
20270
|
if (style.stf !== BooleanNumber.TRUE) return;
|
|
20086
20271
|
const cellInfo = this.getCellWithCoordByIndex(row, col, false);
|
|
20087
20272
|
const startX = cellInfo.isMergedMainCell ? cellInfo.mergeInfo.startX : cellInfo.startX;
|
|
20088
20273
|
const endX = cellInfo.isMergedMainCell ? cellInfo.mergeInfo.endX : cellInfo.endX;
|
|
20089
|
-
const padding =
|
|
20274
|
+
const padding = style.pd ?? DEFAULT_PADDING_DATA;
|
|
20090
20275
|
const extension = (_fontCache$cellData = fontCache.cellData) === null || _fontCache$cellData === void 0 ? void 0 : _fontCache$cellData.fontRenderExtension;
|
|
20091
|
-
const availableWidth = endX - startX - (
|
|
20092
|
-
const fallbackFontSize =
|
|
20093
|
-
const scale = getShrinkToFitScale(fontCache.documentSkeleton ? (
|
|
20276
|
+
const availableWidth = endX - startX - (padding.l ?? DEFAULT_PADDING_DATA.l) - (padding.r ?? DEFAULT_PADDING_DATA.r) - ((extension === null || extension === void 0 ? void 0 : extension.leftOffset) ?? 0) - ((extension === null || extension === void 0 ? void 0 : extension.rightOffset) ?? 0);
|
|
20277
|
+
const fallbackFontSize = style.fs ?? DEFAULT_STYLES.fs;
|
|
20278
|
+
const scale = getShrinkToFitScale(fontCache.documentSkeleton ? (getDocsSkeletonPageSize(fontCache.documentSkeleton, fontCache.vertexAngle) ?? { width: 0 }).width : FontCache.getMeasureText(fontCache.displayText ?? getDisplayValueFromCell(fontCache.cellData), fontCache.fontString).width, availableWidth, fallbackFontSize);
|
|
20094
20279
|
if (scale >= 1) return;
|
|
20095
20280
|
fontCache.shrinkScale = scale;
|
|
20096
20281
|
if (fontCache.documentSkeleton) {
|
|
@@ -20103,8 +20288,23 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20103
20288
|
fs: fallbackFontSize * scale
|
|
20104
20289
|
}).fontCache;
|
|
20105
20290
|
}
|
|
20291
|
+
_applyGeneralNumberDisplay(row, col, fontCache, style) {
|
|
20292
|
+
var _style$n;
|
|
20293
|
+
const cellData = fontCache.cellData;
|
|
20294
|
+
if (!cellData || style.stf === BooleanNumber.TRUE || fontCache.documentSkeleton) return;
|
|
20295
|
+
if (!isDefaultFormat((_style$n = style.n) === null || _style$n === void 0 ? void 0 : _style$n.pattern)) return;
|
|
20296
|
+
if (cellData.t !== CellValueType.NUMBER && (Tools.isDefine(cellData.t) || typeof cellData.v !== "number")) return;
|
|
20297
|
+
const value = Number(cellData.v);
|
|
20298
|
+
if (!Number.isFinite(value)) return;
|
|
20299
|
+
const cellInfo = this.getCellWithCoordByIndex(row, col, false);
|
|
20300
|
+
const startX = cellInfo.isMergedMainCell ? cellInfo.mergeInfo.startX : cellInfo.startX;
|
|
20301
|
+
const endX = cellInfo.isMergedMainCell ? cellInfo.mergeInfo.endX : cellInfo.endX;
|
|
20302
|
+
const padding = style.pd ?? DEFAULT_PADDING_DATA;
|
|
20303
|
+
const extension = cellData.fontRenderExtension;
|
|
20304
|
+
const availableWidth = endX - startX - (padding.l ?? DEFAULT_PADDING_DATA.l) - (padding.r ?? DEFAULT_PADDING_DATA.r) - ((extension === null || extension === void 0 ? void 0 : extension.leftOffset) ?? 0) - ((extension === null || extension === void 0 ? void 0 : extension.rightOffset) ?? 0);
|
|
20305
|
+
fontCache.displayText = getGeneralNumberDisplayText(value, fontCache.displayText ?? getDisplayValueFromCell(cellData), fontCache.fontString, availableWidth);
|
|
20306
|
+
}
|
|
20106
20307
|
_setFontStylesCache(row, col, cellData, style, hasMergeData = true) {
|
|
20107
|
-
var _style$tr2;
|
|
20108
20308
|
if (isNullCell(cellData)) return;
|
|
20109
20309
|
let config = {
|
|
20110
20310
|
cellData,
|
|
@@ -20116,10 +20316,11 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20116
20316
|
const cacheItem = cacheValue;
|
|
20117
20317
|
cacheItem.cellData = cellData;
|
|
20118
20318
|
setRenderTextCache(cacheItem, cellData);
|
|
20319
|
+
this._applyGeneralNumberDisplay(row, col, cacheItem, style);
|
|
20119
20320
|
this._stylesCache.fontMatrix.setValue(row, col, cacheValue);
|
|
20120
20321
|
return;
|
|
20121
20322
|
}
|
|
20122
|
-
const { vertexAngle, centerAngle } = convertTextRotation((
|
|
20323
|
+
const { vertexAngle, centerAngle } = convertTextRotation((style === null || style === void 0 ? void 0 : style.tr) ?? { a: 0 });
|
|
20123
20324
|
const modelObject = (cellData === null || cellData === void 0 ? void 0 : cellData.p) || vertexAngle || centerAngle ? this.worksheet.getCellDocumentModel(cellData, style, { displayRawFormula: this._renderRawFormula }) : null;
|
|
20124
20325
|
if (modelObject) {
|
|
20125
20326
|
const { documentModel } = modelObject;
|
|
@@ -20144,15 +20345,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20144
20345
|
}
|
|
20145
20346
|
}
|
|
20146
20347
|
} else {
|
|
20147
|
-
const fontString = getFontStyleString(style
|
|
20148
|
-
const { vt: verticalAlign, ht: horizontalAlign, tb: wrapStrategy } = style
|
|
20348
|
+
const fontString = getFontStyleString(style ?? void 0).fontCache;
|
|
20349
|
+
const { vt: verticalAlign, ht: horizontalAlign, tb: wrapStrategy } = style ?? {};
|
|
20149
20350
|
config = {
|
|
20150
20351
|
documentSkeleton: void 0,
|
|
20151
20352
|
vertexAngle,
|
|
20152
20353
|
centerAngle,
|
|
20153
|
-
verticalAlign: verticalAlign
|
|
20154
|
-
horizontalAlign: horizontalAlign
|
|
20155
|
-
wrapStrategy: wrapStrategy
|
|
20354
|
+
verticalAlign: verticalAlign ?? VerticalAlign.UNSPECIFIED,
|
|
20355
|
+
horizontalAlign: horizontalAlign ?? HorizontalAlign.UNSPECIFIED,
|
|
20356
|
+
wrapStrategy: wrapStrategy ?? WrapStrategy.OVERFLOW,
|
|
20156
20357
|
imageCacheMap: this._imageCacheMap,
|
|
20157
20358
|
cellData,
|
|
20158
20359
|
fontString,
|
|
@@ -20161,6 +20362,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20161
20362
|
}
|
|
20162
20363
|
const fontCacheItem = config;
|
|
20163
20364
|
setRenderTextCache(fontCacheItem, cellData);
|
|
20365
|
+
this._applyGeneralNumberDisplay(row, col, fontCacheItem, style);
|
|
20164
20366
|
this._applyShrinkToFit(row, col, fontCacheItem, style);
|
|
20165
20367
|
this._calculateOverflowCell(row, col, fontCacheItem, hasMergeData);
|
|
20166
20368
|
this._stylesCache.fontMatrix.setValue(row, col, fontCacheItem);
|
|
@@ -20172,7 +20374,6 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20172
20374
|
* @param options {{ mergeRange: IRange; cacheItem: ICacheItem } | undefined}
|
|
20173
20375
|
*/
|
|
20174
20376
|
_setStylesCacheForOneCell(row, col, options) {
|
|
20175
|
-
var _options$hasMergeData, _options$rowVisible, _options$hasMergeData2;
|
|
20176
20377
|
if (row === -1 || col === -1) return;
|
|
20177
20378
|
if (!options) options = { cacheItem: {
|
|
20178
20379
|
bg: true,
|
|
@@ -20184,24 +20385,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20184
20385
|
const borderHandled = !cacheItem.border || Tools.isDefine(this._handleBorderMatrix.getValue(row, col));
|
|
20185
20386
|
if (bgHandled && borderHandled && this._stylesCache.fontMatrix.getValue(row, col)) return;
|
|
20186
20387
|
}
|
|
20187
|
-
const hasMergeData =
|
|
20388
|
+
const hasMergeData = options.hasMergeData ?? true;
|
|
20188
20389
|
let isMerged = false;
|
|
20189
20390
|
let isMergedMainCell = false;
|
|
20190
20391
|
if (hasMergeData) {
|
|
20191
20392
|
const mergeInfo = this.worksheet.getCellInfoInMergeData(row, col);
|
|
20192
20393
|
isMerged = mergeInfo.isMerged;
|
|
20193
20394
|
isMergedMainCell = mergeInfo.isMergedMainCell;
|
|
20194
|
-
if (isMerged) {
|
|
20195
|
-
const { startRow, startColumn, endRow, endColumn } = mergeInfo;
|
|
20196
|
-
options.mergeRange = {
|
|
20197
|
-
startRow,
|
|
20198
|
-
startColumn,
|
|
20199
|
-
endRow,
|
|
20200
|
-
endColumn
|
|
20201
|
-
};
|
|
20202
|
-
}
|
|
20203
20395
|
}
|
|
20204
|
-
const rowVisible =
|
|
20396
|
+
const rowVisible = options.rowVisible ?? this.worksheet.getRowVisible(row);
|
|
20205
20397
|
if (this.worksheet.getColVisible(col) === false || rowVisible === false) {
|
|
20206
20398
|
if (isMerged && !isMergedMainCell) return;
|
|
20207
20399
|
else if (!isMergedMainCell) return;
|
|
@@ -20214,7 +20406,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20214
20406
|
this._setFontStylesCache(row, col, {
|
|
20215
20407
|
...cell,
|
|
20216
20408
|
s: style
|
|
20217
|
-
}, style,
|
|
20409
|
+
}, style, options.hasMergeData ?? true);
|
|
20218
20410
|
}
|
|
20219
20411
|
/**
|
|
20220
20412
|
* pro/issues/344
|
|
@@ -20245,7 +20437,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20245
20437
|
forEnd = mergeRange.endRow;
|
|
20246
20438
|
}
|
|
20247
20439
|
for (let i = forStart; i <= forEnd; i++) {
|
|
20248
|
-
var _cell$themeStyle, _style$bd
|
|
20440
|
+
var _cell$themeStyle, _style$bd;
|
|
20249
20441
|
if (type === "t") column = i;
|
|
20250
20442
|
else if (type === "b") column = i;
|
|
20251
20443
|
else if (type === "l") row = i;
|
|
@@ -20255,7 +20447,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
20255
20447
|
const themeStyleBackground = (_cell$themeStyle = cell.themeStyle) === null || _cell$themeStyle === void 0 ? void 0 : _cell$themeStyle.bd;
|
|
20256
20448
|
const style = this.worksheet.getComposedCellStyleByCellData(row, column, cell);
|
|
20257
20449
|
if (!style && !themeStyleBackground) break;
|
|
20258
|
-
const props = (
|
|
20450
|
+
const props = (style === null || style === void 0 || (_style$bd = style.bd) === null || _style$bd === void 0 ? void 0 : _style$bd[type]) ?? (themeStyleBackground === null || themeStyleBackground === void 0 ? void 0 : themeStyleBackground[type]);
|
|
20259
20451
|
if (props) {
|
|
20260
20452
|
const rgb = getColorStyle(props.cl) || "rgb(0,0,0)";
|
|
20261
20453
|
borders.push({
|
|
@@ -20402,6 +20594,29 @@ function getDocsSkeletonPageSize(documentSkeleton, angleInDegree = 0) {
|
|
|
20402
20594
|
};
|
|
20403
20595
|
}
|
|
20404
20596
|
|
|
20597
|
+
//#endregion
|
|
20598
|
+
//#region src/components/sheets/util.ts
|
|
20599
|
+
const DEFAULT_CELL_IMAGE_PADDING = 2;
|
|
20600
|
+
function calculateCellImageRect(config) {
|
|
20601
|
+
const { cellRect, imageWidth, imageHeight, horizontalAlign, verticalAlign, padding } = config;
|
|
20602
|
+
const contentLeft = cellRect.left + ((padding === null || padding === void 0 ? void 0 : padding.l) ?? DEFAULT_CELL_IMAGE_PADDING);
|
|
20603
|
+
const contentRight = cellRect.right - ((padding === null || padding === void 0 ? void 0 : padding.r) ?? DEFAULT_CELL_IMAGE_PADDING);
|
|
20604
|
+
const contentTop = cellRect.top + ((padding === null || padding === void 0 ? void 0 : padding.t) ?? DEFAULT_CELL_IMAGE_PADDING);
|
|
20605
|
+
const contentBottom = cellRect.bottom - ((padding === null || padding === void 0 ? void 0 : padding.b) ?? DEFAULT_CELL_IMAGE_PADDING);
|
|
20606
|
+
let left = contentLeft;
|
|
20607
|
+
if (horizontalAlign === HorizontalAlign.RIGHT) left = contentRight - imageWidth;
|
|
20608
|
+
else if (horizontalAlign === HorizontalAlign.CENTER) left = (contentLeft + contentRight - imageWidth) / 2;
|
|
20609
|
+
let top = contentBottom - imageHeight;
|
|
20610
|
+
if (verticalAlign === VerticalAlign.TOP) top = contentTop;
|
|
20611
|
+
else if (verticalAlign === VerticalAlign.MIDDLE) top = (contentTop + contentBottom - imageHeight) / 2;
|
|
20612
|
+
return {
|
|
20613
|
+
left,
|
|
20614
|
+
top,
|
|
20615
|
+
right: left + imageWidth,
|
|
20616
|
+
bottom: top + imageHeight
|
|
20617
|
+
};
|
|
20618
|
+
}
|
|
20619
|
+
|
|
20405
20620
|
//#endregion
|
|
20406
20621
|
//#region src/components/sheets/extensions/font.ts
|
|
20407
20622
|
const UNIQUE_KEY$6 = "DefaultFontExtension";
|
|
@@ -20524,7 +20739,7 @@ var Font = class extends SheetExtension {
|
|
|
20524
20739
|
renderFontCtx.endX = mergeInfo.endX;
|
|
20525
20740
|
renderFontCtx.endY = mergeInfo.endY;
|
|
20526
20741
|
}
|
|
20527
|
-
const fontCache = cacheValue
|
|
20742
|
+
const fontCache = cacheValue ?? fontMatrix.getValue(row, col);
|
|
20528
20743
|
if (!fontCache) return true;
|
|
20529
20744
|
renderFontCtx.fontCache = fontCache;
|
|
20530
20745
|
const overflowRange = spreadsheetSkeleton.overflowCache.getValue(row, col);
|
|
@@ -20590,7 +20805,7 @@ var Font = class extends SheetExtension {
|
|
|
20590
20805
|
return false;
|
|
20591
20806
|
}
|
|
20592
20807
|
_renderPlainTextWithoutClip(ctx, renderFontCtx, fontCache) {
|
|
20593
|
-
var _fontCache$style, _fontCache$style2, _fontCache$
|
|
20808
|
+
var _fontCache$style, _fontCache$style2, _fontCache$style3, _fontCache$style4;
|
|
20594
20809
|
const { cellData, documentSkeleton, textFitsCurrentCell, vertexAngle = 0, centerAngle = 0, wrapStrategy } = fontCache;
|
|
20595
20810
|
if (!textFitsCurrentCell) return false;
|
|
20596
20811
|
if (documentSkeleton) return false;
|
|
@@ -20599,12 +20814,12 @@ var Font = class extends SheetExtension {
|
|
|
20599
20814
|
if (needsFontRenderExtensionBounds(fontCache)) return false;
|
|
20600
20815
|
if (((_fontCache$style = fontCache.style) === null || _fontCache$style === void 0 || (_fontCache$style = _fontCache$style.st) === null || _fontCache$style === void 0 ? void 0 : _fontCache$style.s) || ((_fontCache$style2 = fontCache.style) === null || _fontCache$style2 === void 0 || (_fontCache$style2 = _fontCache$style2.ul) === null || _fontCache$style2 === void 0 ? void 0 : _fontCache$style2.s)) return false;
|
|
20601
20816
|
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return false;
|
|
20602
|
-
const padding = (
|
|
20603
|
-
const paddingLeft =
|
|
20604
|
-
const paddingRight =
|
|
20605
|
-
const paddingTop =
|
|
20606
|
-
const paddingBottom =
|
|
20607
|
-
const text =
|
|
20817
|
+
const padding = ((_fontCache$style3 = fontCache.style) === null || _fontCache$style3 === void 0 ? void 0 : _fontCache$style3.pd) ?? DEFAULT_PADDING_DATA;
|
|
20818
|
+
const paddingLeft = padding.l ?? DEFAULT_PADDING_DATA.l;
|
|
20819
|
+
const paddingRight = padding.r ?? DEFAULT_PADDING_DATA.r;
|
|
20820
|
+
const paddingTop = padding.t ?? DEFAULT_PADDING_DATA.t;
|
|
20821
|
+
const paddingBottom = padding.b ?? DEFAULT_PADDING_DATA.b;
|
|
20822
|
+
const text = fontCache.displayText ?? getDisplayValueFromCell(cellData);
|
|
20608
20823
|
const { startX, startY, endX, endY } = renderFontCtx;
|
|
20609
20824
|
const cellWidth = endX - startX - paddingLeft - paddingRight;
|
|
20610
20825
|
const cellHeight = endY - startY - paddingTop - paddingBottom;
|
|
@@ -20624,24 +20839,14 @@ var Font = class extends SheetExtension {
|
|
|
20624
20839
|
return true;
|
|
20625
20840
|
}
|
|
20626
20841
|
_renderImages(ctx, fontsConfig, startX, startY, endX, endY) {
|
|
20627
|
-
var
|
|
20842
|
+
var _getSkeletonData;
|
|
20628
20843
|
const { documentSkeleton, verticalAlign, horizontalAlign } = fontsConfig;
|
|
20629
|
-
const PADDING = 2;
|
|
20630
|
-
const padding = (_fontsConfig$style = fontsConfig.style) === null || _fontsConfig$style === void 0 ? void 0 : _fontsConfig$style.pd;
|
|
20631
|
-
const paddingLeft = (_padding$l2 = padding === null || padding === void 0 ? void 0 : padding.l) !== null && _padding$l2 !== void 0 ? _padding$l2 : PADDING;
|
|
20632
|
-
const paddingRight = (_padding$r2 = padding === null || padding === void 0 ? void 0 : padding.r) !== null && _padding$r2 !== void 0 ? _padding$r2 : PADDING;
|
|
20633
|
-
const paddingTop = (_padding$t2 = padding === null || padding === void 0 ? void 0 : padding.t) !== null && _padding$t2 !== void 0 ? _padding$t2 : PADDING;
|
|
20634
|
-
const paddingBottom = (_padding$b2 = padding === null || padding === void 0 ? void 0 : padding.b) !== null && _padding$b2 !== void 0 ? _padding$b2 : PADDING;
|
|
20635
|
-
const contentStartX = startX + paddingLeft;
|
|
20636
|
-
const contentEndX = endX - paddingRight;
|
|
20637
|
-
const contentStartY = startY + paddingTop;
|
|
20638
|
-
const contentEndY = endY - paddingBottom;
|
|
20639
20844
|
const drawingDatas = documentSkeleton.getViewModel().getDataModel().getDrawings();
|
|
20640
20845
|
const drawings = (_getSkeletonData = documentSkeleton.getSkeletonData()) === null || _getSkeletonData === void 0 ? void 0 : _getSkeletonData.pages[0].skeDrawings;
|
|
20641
20846
|
drawings === null || drawings === void 0 || drawings.forEach((drawing) => {
|
|
20642
20847
|
const drawingData = drawingDatas === null || drawingDatas === void 0 ? void 0 : drawingDatas[drawing.drawingId];
|
|
20643
20848
|
if (drawingData) {
|
|
20644
|
-
var _drawingData$docTrans, _drawingData$docTrans2, _drawingData$docTrans3,
|
|
20849
|
+
var _drawingData$docTrans, _drawingData$docTrans2, _drawingData$docTrans3, _fontsConfig$style;
|
|
20645
20850
|
const image = fontsConfig.imageCacheMap.getImage(drawingData.imageSourceType, drawingData.source, () => {
|
|
20646
20851
|
var _this$parent;
|
|
20647
20852
|
(_this$parent = this.parent) === null || _this$parent === void 0 || _this$parent.makeDirty();
|
|
@@ -20649,33 +20854,22 @@ var Font = class extends SheetExtension {
|
|
|
20649
20854
|
var _this$parent2;
|
|
20650
20855
|
(_this$parent2 = this.parent) === null || _this$parent2 === void 0 || _this$parent2.makeDirty();
|
|
20651
20856
|
});
|
|
20652
|
-
const width = (_drawingData$docTrans =
|
|
20653
|
-
const height = (
|
|
20654
|
-
const angle = (
|
|
20655
|
-
|
|
20656
|
-
|
|
20657
|
-
|
|
20658
|
-
|
|
20659
|
-
|
|
20660
|
-
|
|
20661
|
-
|
|
20662
|
-
|
|
20663
|
-
|
|
20664
|
-
|
|
20665
|
-
|
|
20666
|
-
|
|
20667
|
-
}
|
|
20668
|
-
switch (horizontalAlign) {
|
|
20669
|
-
case HorizontalAlign.RIGHT:
|
|
20670
|
-
x = contentEndX - width;
|
|
20671
|
-
break;
|
|
20672
|
-
case HorizontalAlign.CENTER:
|
|
20673
|
-
x = (contentStartX + contentEndX) / 2 - width / 2;
|
|
20674
|
-
break;
|
|
20675
|
-
default:
|
|
20676
|
-
x = contentStartX;
|
|
20677
|
-
break;
|
|
20678
|
-
}
|
|
20857
|
+
const width = ((_drawingData$docTrans = drawingData.docTransform) === null || _drawingData$docTrans === void 0 ? void 0 : _drawingData$docTrans.size.width) ?? drawing.width;
|
|
20858
|
+
const height = ((_drawingData$docTrans2 = drawingData.docTransform) === null || _drawingData$docTrans2 === void 0 ? void 0 : _drawingData$docTrans2.size.height) ?? drawing.height;
|
|
20859
|
+
const angle = ((_drawingData$docTrans3 = drawingData.docTransform) === null || _drawingData$docTrans3 === void 0 ? void 0 : _drawingData$docTrans3.angle) ?? drawing.angle;
|
|
20860
|
+
const { left: x, top: y } = calculateCellImageRect({
|
|
20861
|
+
cellRect: {
|
|
20862
|
+
left: startX,
|
|
20863
|
+
top: startY,
|
|
20864
|
+
right: endX,
|
|
20865
|
+
bottom: endY
|
|
20866
|
+
},
|
|
20867
|
+
imageWidth: width,
|
|
20868
|
+
imageHeight: height,
|
|
20869
|
+
horizontalAlign,
|
|
20870
|
+
verticalAlign,
|
|
20871
|
+
padding: (_fontsConfig$style = fontsConfig.style) === null || _fontsConfig$style === void 0 ? void 0 : _fontsConfig$style.pd
|
|
20872
|
+
});
|
|
20679
20873
|
const { rotatedHeight, rotatedWidth } = rotatedBoundingBox(width, height, angle);
|
|
20680
20874
|
if (image && image.complete) {
|
|
20681
20875
|
const angleRadians = angle * Math.PI / 180;
|
|
@@ -20701,7 +20895,7 @@ var Font = class extends SheetExtension {
|
|
|
20701
20895
|
* @param fontCache
|
|
20702
20896
|
*/
|
|
20703
20897
|
_clipByRenderBounds(renderFontContext, row, col, padding = 0) {
|
|
20704
|
-
var _fontCache$
|
|
20898
|
+
var _fontCache$cellData3, _fontCache$cellData4;
|
|
20705
20899
|
const { ctx, scale, overflowRectangle, fontCache } = renderFontContext;
|
|
20706
20900
|
let { startX, endX, startY, endY } = renderFontContext;
|
|
20707
20901
|
const { horizontalAlign = 0, vertexAngle = 0, centerAngle = 0 } = fontCache;
|
|
@@ -20710,8 +20904,8 @@ var Font = class extends SheetExtension {
|
|
|
20710
20904
|
if (centerAngle === 90 && vertexAngle === 90) horizontalAlignOverFlow = HorizontalAlign.CENTER;
|
|
20711
20905
|
else if (vertexAngle > 0 && vertexAngle !== 90 || vertexAngle === -90) horizontalAlignOverFlow = HorizontalAlign.RIGHT;
|
|
20712
20906
|
}
|
|
20713
|
-
const rightOffset = (
|
|
20714
|
-
const leftOffset = (
|
|
20907
|
+
const rightOffset = (fontCache === null || fontCache === void 0 || (_fontCache$cellData3 = fontCache.cellData) === null || _fontCache$cellData3 === void 0 || (_fontCache$cellData3 = _fontCache$cellData3.fontRenderExtension) === null || _fontCache$cellData3 === void 0 ? void 0 : _fontCache$cellData3.rightOffset) ?? 0;
|
|
20908
|
+
const leftOffset = (fontCache === null || fontCache === void 0 || (_fontCache$cellData4 = fontCache.cellData) === null || _fontCache$cellData4 === void 0 || (_fontCache$cellData4 = _fontCache$cellData4.fontRenderExtension) === null || _fontCache$cellData4 === void 0 ? void 0 : _fontCache$cellData4.leftOffset) ?? 0;
|
|
20715
20909
|
let isOverflow = true;
|
|
20716
20910
|
if (vertexAngle === 0) {
|
|
20717
20911
|
startX = startX + leftOffset;
|
|
@@ -20743,17 +20937,17 @@ var Font = class extends SheetExtension {
|
|
|
20743
20937
|
renderFontContext.endY = endY;
|
|
20744
20938
|
}
|
|
20745
20939
|
_renderText(ctx, row, col, renderFontCtx, overflowCache) {
|
|
20746
|
-
var _fontCache$
|
|
20940
|
+
var _fontCache$style5, _fontCache$style6, _fontCache$style7, _fontCache$style8, _fontCache$style9;
|
|
20747
20941
|
const { fontCache } = renderFontCtx;
|
|
20748
20942
|
if (!fontCache) return;
|
|
20749
|
-
const padding = (
|
|
20750
|
-
const paddingLeft =
|
|
20751
|
-
const paddingRight =
|
|
20752
|
-
const paddingTop =
|
|
20753
|
-
const paddingBottom =
|
|
20943
|
+
const padding = ((_fontCache$style5 = fontCache.style) === null || _fontCache$style5 === void 0 ? void 0 : _fontCache$style5.pd) ?? DEFAULT_PADDING_DATA;
|
|
20944
|
+
const paddingLeft = padding.l ?? DEFAULT_PADDING_DATA.l;
|
|
20945
|
+
const paddingRight = padding.r ?? DEFAULT_PADDING_DATA.r;
|
|
20946
|
+
const paddingTop = padding.t ?? DEFAULT_PADDING_DATA.t;
|
|
20947
|
+
const paddingBottom = padding.b ?? DEFAULT_PADDING_DATA.b;
|
|
20754
20948
|
const { vertexAngle = 0, wrapStrategy, cellData } = fontCache;
|
|
20755
20949
|
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return;
|
|
20756
|
-
const text =
|
|
20950
|
+
const text = fontCache.displayText ?? getDisplayValueFromCell(cellData);
|
|
20757
20951
|
const { startX, startY, endX, endY } = renderFontCtx;
|
|
20758
20952
|
const cellWidth = endX - startX - paddingLeft - paddingRight;
|
|
20759
20953
|
const cellHeight = endY - startY - paddingTop - paddingBottom;
|
|
@@ -20963,26 +21157,22 @@ var RowHeaderLayout = class extends SheetExtension {
|
|
|
20963
21157
|
}
|
|
20964
21158
|
configHeaderRow(cfg, sheetId) {
|
|
20965
21159
|
if (sheetId) {
|
|
20966
|
-
|
|
20967
|
-
this.
|
|
20968
|
-
this.headerStyleOfWorksheet.set(sheetId, (_cfg$headerStyle = cfg.headerStyle) !== null && _cfg$headerStyle !== void 0 ? _cfg$headerStyle : {});
|
|
21160
|
+
this.rowsCfgOfWorksheet.set(sheetId, cfg.rowsCfg ?? {});
|
|
21161
|
+
this.headerStyleOfWorksheet.set(sheetId, cfg.headerStyle ?? {});
|
|
20969
21162
|
} else {
|
|
20970
|
-
|
|
20971
|
-
this.
|
|
20972
|
-
this.headerStyle = (_cfg$headerStyle2 = cfg.headerStyle) !== null && _cfg$headerStyle2 !== void 0 ? _cfg$headerStyle2 : {};
|
|
21163
|
+
this.rowsCfg = cfg.rowsCfg ?? {};
|
|
21164
|
+
this.headerStyle = cfg.headerStyle ?? {};
|
|
20973
21165
|
}
|
|
20974
21166
|
}
|
|
20975
21167
|
getRowsCfg(sheetId) {
|
|
20976
|
-
|
|
20977
|
-
const rowsCfg = (_this$rowsCfgOfWorksh = this.rowsCfgOfWorksheet.get(sheetId)) !== null && _this$rowsCfgOfWorksh !== void 0 ? _this$rowsCfgOfWorksh : {};
|
|
21168
|
+
const rowsCfg = this.rowsCfgOfWorksheet.get(sheetId) ?? {};
|
|
20978
21169
|
return {
|
|
20979
21170
|
...this.rowsCfg,
|
|
20980
21171
|
...rowsCfg
|
|
20981
21172
|
};
|
|
20982
21173
|
}
|
|
20983
21174
|
getHeaderStyle(sheetId) {
|
|
20984
|
-
|
|
20985
|
-
const headerStyle = (_this$headerStyleOfWo = this.headerStyleOfWorksheet.get(sheetId)) !== null && _this$headerStyleOfWo !== void 0 ? _this$headerStyleOfWo : {};
|
|
21175
|
+
const headerStyle = this.headerStyleOfWorksheet.get(sheetId) ?? {};
|
|
20986
21176
|
return {
|
|
20987
21177
|
...DEFAULT_ROW_STYLE,
|
|
20988
21178
|
...this.headerStyle,
|
|
@@ -21034,13 +21224,12 @@ var RowHeaderLayout = class extends SheetExtension {
|
|
|
21034
21224
|
const rowHeightAccumulationLength = rowHeightAccumulation.length;
|
|
21035
21225
|
const rowGaps = (_spreadsheetSkeleton$ = spreadsheetSkeleton.gapConfig) === null || _spreadsheetSkeleton$ === void 0 ? void 0 : _spreadsheetSkeleton$.rowGaps;
|
|
21036
21226
|
for (let r = startRow - 1; r <= endRow; r++) {
|
|
21037
|
-
var _rowGaps$r
|
|
21227
|
+
var _rowGaps$r;
|
|
21038
21228
|
if (r < 0 || r > rowHeightAccumulationLength - 1) continue;
|
|
21039
21229
|
const rowEndPosition = rowHeightAccumulation[r];
|
|
21040
21230
|
if (preRowPosition === rowEndPosition) continue;
|
|
21041
|
-
const gapSize = (
|
|
21231
|
+
const gapSize = (rowGaps === null || rowGaps === void 0 || (_rowGaps$r = rowGaps[r]) === null || _rowGaps$r === void 0 ? void 0 : _rowGaps$r.size) ?? 0;
|
|
21042
21232
|
if (gapSize > 0) {
|
|
21043
|
-
var _gapItem$color, _gapItem$stripeColor;
|
|
21044
21233
|
const gapItem = rowGaps[r];
|
|
21045
21234
|
const gapTop = preRowPosition;
|
|
21046
21235
|
const gapBottom = preRowPosition + gapSize;
|
|
@@ -21048,14 +21237,14 @@ var RowHeaderLayout = class extends SheetExtension {
|
|
|
21048
21237
|
const defaultBg = defaultBackgroundColor;
|
|
21049
21238
|
const defaultStripe = defaultStripeColor;
|
|
21050
21239
|
ctx.save();
|
|
21051
|
-
ctx.fillStyle =
|
|
21240
|
+
ctx.fillStyle = gapItem.color ?? defaultBg;
|
|
21052
21241
|
ctx.fillRectByPrecision(0, gapTop, rowHeaderWidth, gapSize);
|
|
21053
21242
|
ctx.restore();
|
|
21054
21243
|
ctx.save();
|
|
21055
21244
|
ctx.beginPath();
|
|
21056
21245
|
ctx.rectByPrecision(0, gapTop, rowHeaderWidth, gapSize);
|
|
21057
21246
|
ctx.clip();
|
|
21058
|
-
ctx.strokeStyle =
|
|
21247
|
+
ctx.strokeStyle = gapItem.stripeColor ?? defaultStripe;
|
|
21059
21248
|
ctx.lineWidth = 1;
|
|
21060
21249
|
ctx.beginPath();
|
|
21061
21250
|
const spacing = 6;
|
|
@@ -21469,9 +21658,8 @@ var Circle = class Circle extends Shape {
|
|
|
21469
21658
|
return this._radius;
|
|
21470
21659
|
}
|
|
21471
21660
|
static drawWith(ctx, props) {
|
|
21472
|
-
var _radius;
|
|
21473
21661
|
let { radius } = props;
|
|
21474
|
-
radius =
|
|
21662
|
+
radius = radius ?? 10;
|
|
21475
21663
|
ctx.beginPath();
|
|
21476
21664
|
if (props.strokeDashArray) ctx.setLineDash(props.strokeDashArray);
|
|
21477
21665
|
ctx.beginPath();
|
|
@@ -21553,11 +21741,10 @@ var Rect = class Rect extends Shape {
|
|
|
21553
21741
|
this._opacity = opacity;
|
|
21554
21742
|
}
|
|
21555
21743
|
static drawWith(ctx, props) {
|
|
21556
|
-
var _radius, _width, _height;
|
|
21557
21744
|
let { radius, width, height } = props;
|
|
21558
|
-
radius =
|
|
21559
|
-
width =
|
|
21560
|
-
height =
|
|
21745
|
+
radius = radius ?? 0;
|
|
21746
|
+
width = width ?? 0;
|
|
21747
|
+
height = height ?? 0;
|
|
21561
21748
|
ctx.save();
|
|
21562
21749
|
ctx.beginPath();
|
|
21563
21750
|
if (props.strokeDashArray) ctx.setLineDash(props.strokeDashArray);
|
|
@@ -21609,13 +21796,12 @@ var Rect = class Rect extends Shape {
|
|
|
21609
21796
|
//#region src/shape/dashedrect.ts
|
|
21610
21797
|
var DashedRect = class DashedRect extends Rect {
|
|
21611
21798
|
static drawWith(ctx, props) {
|
|
21612
|
-
var _radius, _width, _height, _left, _top;
|
|
21613
21799
|
let { radius, left, top, width, height } = props;
|
|
21614
|
-
radius =
|
|
21615
|
-
width =
|
|
21616
|
-
height =
|
|
21617
|
-
left =
|
|
21618
|
-
top =
|
|
21800
|
+
radius = radius ?? 0;
|
|
21801
|
+
width = width ?? 0;
|
|
21802
|
+
height = height ?? 0;
|
|
21803
|
+
left = left ?? 0;
|
|
21804
|
+
top = top ?? 0;
|
|
21619
21805
|
ctx.beginPath();
|
|
21620
21806
|
ctx.setLineDash(props.strokeDashArray);
|
|
21621
21807
|
if (!radius) ctx.rect(left, top, width, height);
|
|
@@ -21746,8 +21932,7 @@ var Image$1 = class extends Shape {
|
|
|
21746
21932
|
return this._props.prstGeom;
|
|
21747
21933
|
}
|
|
21748
21934
|
get opacity() {
|
|
21749
|
-
|
|
21750
|
-
return (_this$_props$opacity = this._props.opacity) !== null && _this$_props$opacity !== void 0 ? _this$_props$opacity : 1;
|
|
21935
|
+
return this._props.opacity ?? 1;
|
|
21751
21936
|
}
|
|
21752
21937
|
get clipBounds() {
|
|
21753
21938
|
return this._props.clipBounds;
|
|
@@ -21902,8 +22087,8 @@ var Image$1 = class extends Shape {
|
|
|
21902
22087
|
}
|
|
21903
22088
|
_draw(ctx, _bounds, renderWidth, renderHeight) {
|
|
21904
22089
|
if (this._native == null) return;
|
|
21905
|
-
const w = renderWidth
|
|
21906
|
-
const h = renderHeight
|
|
22090
|
+
const w = renderWidth ?? this.width;
|
|
22091
|
+
const h = renderHeight ?? this.height;
|
|
21907
22092
|
if (this.prstGeom && this._clipService) {
|
|
21908
22093
|
ctx.save();
|
|
21909
22094
|
ctx.translate(-w / 2, -h / 2);
|
|
@@ -21916,8 +22101,8 @@ var Image$1 = class extends Shape {
|
|
|
21916
22101
|
const drawHeight = clipBounds.height;
|
|
21917
22102
|
if (!this._renderByCropper && this.srcRect) {
|
|
21918
22103
|
const { left = 0, top = 0, right = 0, bottom = 0 } = this.srcRect;
|
|
21919
|
-
const scaleW = drawWidth /
|
|
21920
|
-
const scaleH = drawHeight /
|
|
22104
|
+
const scaleW = this.width > 0 ? drawWidth / this.width : 1;
|
|
22105
|
+
const scaleH = this.height > 0 ? drawHeight / this.height : 1;
|
|
21921
22106
|
ctx.drawImage(this._native, drawLeft - left * scaleW, drawTop - top * scaleH, drawWidth + (right + left) * scaleW, drawHeight + (bottom + top) * scaleH);
|
|
21922
22107
|
} else ctx.drawImage(this._native, drawLeft, drawTop, drawWidth, drawHeight);
|
|
21923
22108
|
ctx.restore();
|
|
@@ -21927,10 +22112,12 @@ var Image$1 = class extends Shape {
|
|
|
21927
22112
|
}
|
|
21928
22113
|
if (!this._renderByCropper && this.srcRect) {
|
|
21929
22114
|
const { left = 0, top = 0, right = 0, bottom = 0 } = this.srcRect;
|
|
22115
|
+
const scaleW = this.width > 0 ? w / this.width : 1;
|
|
22116
|
+
const scaleH = this.height > 0 ? h / this.height : 1;
|
|
21930
22117
|
ctx.beginPath();
|
|
21931
22118
|
ctx.rect(-w / 2, -h / 2, w, h);
|
|
21932
22119
|
ctx.clip();
|
|
21933
|
-
ctx.drawImage(this._native, -left - w / 2, -top - h / 2, w + right + left, h + bottom + top);
|
|
22120
|
+
ctx.drawImage(this._native, -left * scaleW - w / 2, -top * scaleH - h / 2, w + (right + left) * scaleW, h + (bottom + top) * scaleH);
|
|
21934
22121
|
} else ctx.drawImage(this._native, -w / 2, -h / 2, w, h);
|
|
21935
22122
|
}
|
|
21936
22123
|
_init() {
|
|
@@ -22022,16 +22209,15 @@ function normalizeLinePosition(position) {
|
|
|
22022
22209
|
*/
|
|
22023
22210
|
var Line = class Line extends Shape {
|
|
22024
22211
|
constructor(key, props) {
|
|
22025
|
-
var _props$startX, _props$startY, _props$endX, _props$endY;
|
|
22026
22212
|
const position = {
|
|
22027
|
-
startX: (
|
|
22028
|
-
startY: (
|
|
22029
|
-
endX: (
|
|
22030
|
-
endY: (
|
|
22213
|
+
startX: (props === null || props === void 0 ? void 0 : props.startX) ?? 0,
|
|
22214
|
+
startY: (props === null || props === void 0 ? void 0 : props.startY) ?? 0,
|
|
22215
|
+
endX: (props === null || props === void 0 ? void 0 : props.endX) ?? 0,
|
|
22216
|
+
endY: (props === null || props === void 0 ? void 0 : props.endY) ?? 0
|
|
22031
22217
|
};
|
|
22032
22218
|
const geometry = normalizeLinePosition(position);
|
|
22033
22219
|
const normalizedProps = {
|
|
22034
|
-
...props
|
|
22220
|
+
...props ?? position,
|
|
22035
22221
|
left: geometry.left,
|
|
22036
22222
|
top: geometry.top,
|
|
22037
22223
|
width: geometry.width,
|
|
@@ -22077,13 +22263,12 @@ var Line = class Line extends Shape {
|
|
|
22077
22263
|
return this;
|
|
22078
22264
|
}
|
|
22079
22265
|
setProps(props) {
|
|
22080
|
-
var _props$startX2, _props$startY2, _props$endX2, _props$endY2;
|
|
22081
22266
|
if (!props) return this;
|
|
22082
22267
|
const position = {
|
|
22083
|
-
startX:
|
|
22084
|
-
startY:
|
|
22085
|
-
endX:
|
|
22086
|
-
endY:
|
|
22268
|
+
startX: props.startX ?? this.startX,
|
|
22269
|
+
startY: props.startY ?? this.startY,
|
|
22270
|
+
endX: props.endX ?? this.endX,
|
|
22271
|
+
endY: props.endY ?? this.endY
|
|
22087
22272
|
};
|
|
22088
22273
|
const lineProps = {
|
|
22089
22274
|
...props,
|
|
@@ -22834,9 +23019,8 @@ var RegularPolygon = class RegularPolygon extends Shape {
|
|
|
22834
23019
|
return this._pointsGroup;
|
|
22835
23020
|
}
|
|
22836
23021
|
static drawWith(ctx, props) {
|
|
22837
|
-
var _pointsGroup;
|
|
22838
23022
|
let { pointsGroup } = props;
|
|
22839
|
-
pointsGroup =
|
|
23023
|
+
pointsGroup = pointsGroup ?? [[]];
|
|
22840
23024
|
if (props.strokeDashArray) ctx.setLineDash(props.strokeDashArray);
|
|
22841
23025
|
ctx.beginPath();
|
|
22842
23026
|
for (const points of pointsGroup) {
|
|
@@ -23175,6 +23359,7 @@ var RichText = class extends BaseObject {
|
|
|
23175
23359
|
//#region src/shape/scroll-bar.ts
|
|
23176
23360
|
const MIN_THUMB_SIZE = 17;
|
|
23177
23361
|
const DEFAULT_TRACK_SIZE = 10;
|
|
23362
|
+
const DEFAULT_TRACK_BORDER_SIZE = 1;
|
|
23178
23363
|
const DEFAULT_THUMB_MARGIN = 2;
|
|
23179
23364
|
const HOVER_THUMB_MARGIN = 1;
|
|
23180
23365
|
const BAR_DRAG_SCROLL_THROTTLE_MS = 32;
|
|
@@ -23183,6 +23368,7 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23183
23368
|
super();
|
|
23184
23369
|
_defineProperty(this, "_enableHorizontal", true);
|
|
23185
23370
|
_defineProperty(this, "_enableVertical", true);
|
|
23371
|
+
_defineProperty(this, "_hideTrackWhenUnscrollable", false);
|
|
23186
23372
|
_defineProperty(this, "horizontalThumbSize", 0);
|
|
23187
23373
|
_defineProperty(this, "horizontalMinusMiniThumb", 0);
|
|
23188
23374
|
_defineProperty(this, "horizontalTrackWidth", 0);
|
|
@@ -23216,7 +23402,7 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23216
23402
|
_defineProperty(this, "_trackThickness", DEFAULT_TRACK_SIZE);
|
|
23217
23403
|
_defineProperty(this, "_vThumbMargin", DEFAULT_THUMB_MARGIN);
|
|
23218
23404
|
_defineProperty(this, "_hThumbMargin", DEFAULT_THUMB_MARGIN);
|
|
23219
|
-
_defineProperty(this, "_trackBorderThickness",
|
|
23405
|
+
_defineProperty(this, "_trackBorderThickness", DEFAULT_TRACK_BORDER_SIZE);
|
|
23220
23406
|
_defineProperty(this, "_thumbLengthRatio", 1);
|
|
23221
23407
|
_defineProperty(this, "_minThumbSizeH", MIN_THUMB_SIZE);
|
|
23222
23408
|
_defineProperty(this, "_minThumbSizeV", MIN_THUMB_SIZE);
|
|
@@ -23260,6 +23446,17 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23260
23446
|
set enableVertical(val) {
|
|
23261
23447
|
this._enableVertical = val;
|
|
23262
23448
|
}
|
|
23449
|
+
get hideTrackWhenUnscrollable() {
|
|
23450
|
+
return this._hideTrackWhenUnscrollable;
|
|
23451
|
+
}
|
|
23452
|
+
set hideTrackWhenUnscrollable(val) {
|
|
23453
|
+
if (this._hideTrackWhenUnscrollable === val) return;
|
|
23454
|
+
this._hideTrackWhenUnscrollable = val;
|
|
23455
|
+
this._resizeHorizontal();
|
|
23456
|
+
this._resizeVertical();
|
|
23457
|
+
this._resizeRightBottomCorner();
|
|
23458
|
+
this.makeDirty(true);
|
|
23459
|
+
}
|
|
23263
23460
|
get limitX() {
|
|
23264
23461
|
var _this$horizonThumbRec;
|
|
23265
23462
|
if (!((_this$horizonThumbRec = this.horizonThumbRect) === null || _this$horizonThumbRec === void 0 ? void 0 : _this$horizonThumbRec.visible)) return 0;
|
|
@@ -23361,9 +23558,8 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23361
23558
|
this._viewport.removeScrollBar();
|
|
23362
23559
|
}
|
|
23363
23560
|
_scheduleBarScrollDelta(delta) {
|
|
23364
|
-
|
|
23365
|
-
this.
|
|
23366
|
-
this._pendingBarDeltaY += (_delta$y = delta.y) !== null && _delta$y !== void 0 ? _delta$y : 0;
|
|
23561
|
+
this._pendingBarDeltaX += delta.x ?? 0;
|
|
23562
|
+
this._pendingBarDeltaY += delta.y ?? 0;
|
|
23367
23563
|
if (this._pendingBarScrollFrameId !== null || this._pendingBarScrollThrottleId !== null) return;
|
|
23368
23564
|
this._requestPendingBarScrollFrame();
|
|
23369
23565
|
}
|
|
@@ -23425,7 +23621,7 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23425
23621
|
ctx.restore();
|
|
23426
23622
|
}
|
|
23427
23623
|
_resizeHorizontal() {
|
|
23428
|
-
var _this$horizonScrollTr2;
|
|
23624
|
+
var _this$horizonScrollTr2, _this$horizonScrollTr3;
|
|
23429
23625
|
const viewportH = this._viewportH;
|
|
23430
23626
|
const viewportW = this._viewportW;
|
|
23431
23627
|
const contentWidth = this._contentW;
|
|
@@ -23443,7 +23639,9 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23443
23639
|
width: this.horizontalTrackWidth,
|
|
23444
23640
|
height: Math.max(0, this._trackThickness - this._trackBorderThickness)
|
|
23445
23641
|
});
|
|
23446
|
-
|
|
23642
|
+
const scrollable = hasScrollableOverflow(contentWidth, viewportW);
|
|
23643
|
+
(_this$horizonScrollTr3 = this.horizonScrollTrack) === null || _this$horizonScrollTr3 === void 0 || _this$horizonScrollTr3.setProps({ visible: !this._hideTrackWhenUnscrollable || scrollable });
|
|
23644
|
+
if (!scrollable) {
|
|
23447
23645
|
var _this$horizonThumbRec4;
|
|
23448
23646
|
(_this$horizonThumbRec4 = this.horizonThumbRect) === null || _this$horizonThumbRec4 === void 0 || _this$horizonThumbRec4.setProps({ visible: false });
|
|
23449
23647
|
} else {
|
|
@@ -23461,7 +23659,7 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23461
23659
|
}
|
|
23462
23660
|
}
|
|
23463
23661
|
_resizeVertical() {
|
|
23464
|
-
var _this$verticalScrollT2;
|
|
23662
|
+
var _this$verticalScrollT2, _this$verticalScrollT3;
|
|
23465
23663
|
const viewportH = this._viewportH;
|
|
23466
23664
|
const viewportW = this._viewportW;
|
|
23467
23665
|
const contentHeight = this._contentH;
|
|
@@ -23479,7 +23677,9 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23479
23677
|
width: Math.max(0, this._trackThickness - this._trackBorderThickness),
|
|
23480
23678
|
height: this.verticalTrackHeight
|
|
23481
23679
|
});
|
|
23482
|
-
|
|
23680
|
+
const scrollable = hasScrollableOverflow(contentHeight, viewportH);
|
|
23681
|
+
(_this$verticalScrollT3 = this.verticalScrollTrack) === null || _this$verticalScrollT3 === void 0 || _this$verticalScrollT3.setProps({ visible: !this._hideTrackWhenUnscrollable || scrollable });
|
|
23682
|
+
if (!scrollable) {
|
|
23483
23683
|
var _this$verticalThumbRe4;
|
|
23484
23684
|
(_this$verticalThumbRe4 = this.verticalThumbRect) === null || _this$verticalThumbRe4 === void 0 || _this$verticalThumbRe4.setProps({ visible: false });
|
|
23485
23685
|
} else {
|
|
@@ -23500,8 +23700,9 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23500
23700
|
const viewportH = this._viewportH;
|
|
23501
23701
|
const viewportW = this._viewportW;
|
|
23502
23702
|
if (this._enableHorizontal && this._enableVertical) {
|
|
23503
|
-
var _this$placeholderBarR2;
|
|
23504
|
-
(_this$placeholderBarR2 = this.placeholderBarRect) === null || _this$placeholderBarR2 === void 0 || _this$placeholderBarR2.
|
|
23703
|
+
var _this$placeholderBarR2, _this$horizonScrollTr4, _this$verticalScrollT4, _this$placeholderBarR3;
|
|
23704
|
+
(_this$placeholderBarR2 = this.placeholderBarRect) === null || _this$placeholderBarR2 === void 0 || _this$placeholderBarR2.setProps({ visible: !this._hideTrackWhenUnscrollable || Boolean(((_this$horizonScrollTr4 = this.horizonScrollTrack) === null || _this$horizonScrollTr4 === void 0 ? void 0 : _this$horizonScrollTr4.visible) && ((_this$verticalScrollT4 = this.verticalScrollTrack) === null || _this$verticalScrollT4 === void 0 ? void 0 : _this$verticalScrollT4.visible)) });
|
|
23705
|
+
(_this$placeholderBarR3 = this.placeholderBarRect) === null || _this$placeholderBarR3 === void 0 || _this$placeholderBarR3.transformByState({
|
|
23505
23706
|
left: viewportW - this._trackThickness,
|
|
23506
23707
|
top: viewportH - this._trackThickness,
|
|
23507
23708
|
width: Math.max(0, this._trackThickness - this._trackBorderThickness),
|
|
@@ -23527,23 +23728,23 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23527
23728
|
this._resizeRightBottomCorner();
|
|
23528
23729
|
}
|
|
23529
23730
|
makeDirty(state) {
|
|
23530
|
-
var _this$
|
|
23531
|
-
(_this$
|
|
23731
|
+
var _this$horizonScrollTr5, _this$horizonThumbRec8, _this$verticalScrollT5, _this$verticalThumbRe8, _this$placeholderBarR4;
|
|
23732
|
+
(_this$horizonScrollTr5 = this.horizonScrollTrack) === null || _this$horizonScrollTr5 === void 0 || _this$horizonScrollTr5.makeDirty(state);
|
|
23532
23733
|
(_this$horizonThumbRec8 = this.horizonThumbRect) === null || _this$horizonThumbRec8 === void 0 || _this$horizonThumbRec8.makeDirty(state);
|
|
23533
|
-
(_this$
|
|
23734
|
+
(_this$verticalScrollT5 = this.verticalScrollTrack) === null || _this$verticalScrollT5 === void 0 || _this$verticalScrollT5.makeDirty(state);
|
|
23534
23735
|
(_this$verticalThumbRe8 = this.verticalThumbRect) === null || _this$verticalThumbRe8 === void 0 || _this$verticalThumbRe8.makeDirty(state);
|
|
23535
|
-
(_this$
|
|
23736
|
+
(_this$placeholderBarR4 = this.placeholderBarRect) === null || _this$placeholderBarR4 === void 0 || _this$placeholderBarR4.makeDirty(state);
|
|
23536
23737
|
this.makeViewDirty(state);
|
|
23537
23738
|
}
|
|
23538
23739
|
makeViewDirty(state) {
|
|
23539
23740
|
(this._mainScene || this._viewport.scene).makeDirty(state);
|
|
23540
23741
|
}
|
|
23541
23742
|
pick(coord) {
|
|
23542
|
-
var _this$horizonThumbRec9, _this$verticalThumbRe9, _this$
|
|
23743
|
+
var _this$horizonThumbRec9, _this$verticalThumbRe9, _this$horizonScrollTr6, _this$verticalScrollT6;
|
|
23543
23744
|
if ((_this$horizonThumbRec9 = this.horizonThumbRect) === null || _this$horizonThumbRec9 === void 0 ? void 0 : _this$horizonThumbRec9.isHit(coord)) return this.horizonThumbRect;
|
|
23544
23745
|
if ((_this$verticalThumbRe9 = this.verticalThumbRect) === null || _this$verticalThumbRe9 === void 0 ? void 0 : _this$verticalThumbRe9.isHit(coord)) return this.verticalThumbRect;
|
|
23545
|
-
if ((_this$
|
|
23546
|
-
if ((_this$
|
|
23746
|
+
if ((_this$horizonScrollTr6 = this.horizonScrollTrack) === null || _this$horizonScrollTr6 === void 0 ? void 0 : _this$horizonScrollTr6.isHit(coord)) return this.horizonScrollTrack;
|
|
23747
|
+
if ((_this$verticalScrollT6 = this.verticalScrollTrack) === null || _this$verticalScrollT6 === void 0 ? void 0 : _this$verticalScrollT6.isHit(coord)) return this.verticalScrollTrack;
|
|
23547
23748
|
return null;
|
|
23548
23749
|
}
|
|
23549
23750
|
_initialScrollRect() {
|
|
@@ -23697,6 +23898,7 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
23697
23898
|
});
|
|
23698
23899
|
}
|
|
23699
23900
|
};
|
|
23901
|
+
_defineProperty(ScrollBar, "DEFAULT_TOTAL_SIZE", 11);
|
|
23700
23902
|
|
|
23701
23903
|
//#endregion
|
|
23702
23904
|
//#region src/components/docs/extensions/font-and-base-line.ts
|
|
@@ -23754,14 +23956,19 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23754
23956
|
drawText();
|
|
23755
23957
|
return;
|
|
23756
23958
|
}
|
|
23757
|
-
const
|
|
23758
|
-
if (
|
|
23959
|
+
const effects = [resolveGlowEffect(glow), resolveOuterShadowEffect(outerShadow)].filter((effect) => effect != null);
|
|
23960
|
+
if (effects.length === 0) {
|
|
23759
23961
|
drawText();
|
|
23760
23962
|
return;
|
|
23761
23963
|
}
|
|
23762
23964
|
ctx.save();
|
|
23763
|
-
|
|
23764
|
-
|
|
23965
|
+
for (const effect of effects) {
|
|
23966
|
+
ctx.shadowColor = effect.color;
|
|
23967
|
+
ctx.shadowBlur = effect.blurRadius;
|
|
23968
|
+
ctx.shadowOffsetX = effect.offsetX;
|
|
23969
|
+
ctx.shadowOffsetY = effect.offsetY;
|
|
23970
|
+
drawText();
|
|
23971
|
+
}
|
|
23765
23972
|
ctx.restore();
|
|
23766
23973
|
}
|
|
23767
23974
|
_fillTextWithTextFill(ctx, glyph, spanPointWithFont, textFill, fallbackColor) {
|
|
@@ -23769,7 +23976,7 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23769
23976
|
const { content, glyphType } = glyph;
|
|
23770
23977
|
if (content == null || glyphType === 2) return false;
|
|
23771
23978
|
const { renderConfig } = this.extensionOffset;
|
|
23772
|
-
const { vertexAngle, centerAngle } = renderConfig
|
|
23979
|
+
const { vertexAngle, centerAngle } = renderConfig ?? {};
|
|
23773
23980
|
const VERTICAL_DEG = 90;
|
|
23774
23981
|
if (vertexAngle === VERTICAL_DEG && centerAngle === VERTICAL_DEG) return false;
|
|
23775
23982
|
const bounds = this._getGlyphPaintBounds(glyph, spanPointWithFont);
|
|
@@ -23808,10 +24015,9 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23808
24015
|
};
|
|
23809
24016
|
}
|
|
23810
24017
|
_createTextGradient(ctx, bounds, textFill, fallbackColor) {
|
|
23811
|
-
var _gradient$type, _gradient$angle, _context;
|
|
23812
24018
|
const gradient = textFill.gradient;
|
|
23813
|
-
const type = (
|
|
23814
|
-
const angle = (
|
|
24019
|
+
const type = (gradient === null || gradient === void 0 ? void 0 : gradient.type) ?? "linear";
|
|
24020
|
+
const angle = (gradient === null || gradient === void 0 ? void 0 : gradient.angle) ?? 0;
|
|
23815
24021
|
const stops = this._normalizeGradientStops(gradient === null || gradient === void 0 ? void 0 : gradient.stops, textFill.color || fallbackColor);
|
|
23816
24022
|
const centerX = bounds.left + bounds.width / 2;
|
|
23817
24023
|
const centerY = bounds.top + bounds.height / 2;
|
|
@@ -23819,10 +24025,8 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23819
24025
|
if (type === "radial") {
|
|
23820
24026
|
const radius = Math.max(bounds.width, bounds.height) / 2;
|
|
23821
24027
|
canvasGradient = ctx.createRadialGradient(centerX, centerY, 0, centerX, centerY, radius);
|
|
23822
|
-
} else if (type === "angular" && "createConicGradient" in (
|
|
23823
|
-
|
|
23824
|
-
canvasGradient = ((_context2 = ctx._context) !== null && _context2 !== void 0 ? _context2 : ctx).createConicGradient((angle - 90) * Math.PI / 180, centerX, centerY);
|
|
23825
|
-
} else if (type === "diamond") {
|
|
24028
|
+
} else if (type === "angular" && "createConicGradient" in (ctx._context ?? ctx)) canvasGradient = (ctx._context ?? ctx).createConicGradient((angle - 90) * Math.PI / 180, centerX, centerY);
|
|
24029
|
+
else if (type === "diamond") {
|
|
23826
24030
|
const radius = Math.max(bounds.width, bounds.height) / 2;
|
|
23827
24031
|
canvasGradient = ctx.createRadialGradient(centerX, centerY, 0, centerX, centerY, radius);
|
|
23828
24032
|
} else {
|
|
@@ -23830,14 +24034,13 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23830
24034
|
canvasGradient = ctx.createLinearGradient(line.x0, line.y0, line.x1, line.y1);
|
|
23831
24035
|
}
|
|
23832
24036
|
for (const stop of stops) {
|
|
23833
|
-
|
|
23834
|
-
const opacity = ((_textFill$opacity = textFill.opacity) !== null && _textFill$opacity !== void 0 ? _textFill$opacity : 1) * ((_stop$opacity = stop.opacity) !== null && _stop$opacity !== void 0 ? _stop$opacity : 1);
|
|
24037
|
+
const opacity = (textFill.opacity ?? 1) * (stop.opacity ?? 1);
|
|
23835
24038
|
canvasGradient.addColorStop(stop.offset, this._colorWithOpacity(stop.color, opacity));
|
|
23836
24039
|
}
|
|
23837
24040
|
return canvasGradient;
|
|
23838
24041
|
}
|
|
23839
24042
|
_createTextPicturePattern(ctx, bounds, textFill) {
|
|
23840
|
-
var _textFill$picture,
|
|
24043
|
+
var _textFill$picture, _textFill$picture2, _textFill$picture3, _pattern$setTransform;
|
|
23841
24044
|
const source = (_textFill$picture = textFill.picture) === null || _textFill$picture === void 0 ? void 0 : _textFill$picture.source;
|
|
23842
24045
|
if (!source) return null;
|
|
23843
24046
|
const image = this._getTextFillImage(source);
|
|
@@ -23847,15 +24050,14 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23847
24050
|
canvas.height = Math.max(1, Math.ceil(bounds.height));
|
|
23848
24051
|
const canvasContext = canvas.getContext("2d");
|
|
23849
24052
|
if (!canvasContext) return null;
|
|
23850
|
-
canvasContext.globalAlpha = this._clamp((
|
|
24053
|
+
canvasContext.globalAlpha = this._clamp(((_textFill$picture2 = textFill.picture) === null || _textFill$picture2 === void 0 ? void 0 : _textFill$picture2.opacity) ?? textFill.opacity ?? 1, 0, 1);
|
|
23851
24054
|
if (((_textFill$picture3 = textFill.picture) === null || _textFill$picture3 === void 0 ? void 0 : _textFill$picture3.mode) === "tile") {
|
|
23852
|
-
|
|
23853
|
-
const
|
|
23854
|
-
const scaleY = (_textFill$picture$sca2 = textFill.picture.scaleY) !== null && _textFill$picture$sca2 !== void 0 ? _textFill$picture$sca2 : 1;
|
|
24055
|
+
const scaleX = textFill.picture.scaleX ?? 1;
|
|
24056
|
+
const scaleY = textFill.picture.scaleY ?? 1;
|
|
23855
24057
|
const cellWidth = Math.max(1, (image.naturalWidth || image.width) * scaleX);
|
|
23856
24058
|
const cellHeight = Math.max(1, (image.naturalHeight || image.height) * scaleY);
|
|
23857
|
-
const offsetX =
|
|
23858
|
-
const offsetY =
|
|
24059
|
+
const offsetX = textFill.picture.offsetX ?? 0;
|
|
24060
|
+
const offsetY = textFill.picture.offsetY ?? 0;
|
|
23859
24061
|
for (let x = (offsetX % cellWidth + cellWidth) % cellWidth - cellWidth; x < canvas.width; x += cellWidth) for (let y = (offsetY % cellHeight + cellHeight) % cellHeight - cellHeight; y < canvas.height; y += cellHeight) canvasContext.drawImage(image, x, y, cellWidth, cellHeight);
|
|
23860
24062
|
} else canvasContext.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
23861
24063
|
const pattern = ctx.createPattern(canvas, "no-repeat");
|
|
@@ -23939,7 +24141,7 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23939
24141
|
const { content, width, bBox } = glyph;
|
|
23940
24142
|
const { aba, abd } = bBox;
|
|
23941
24143
|
if (content == null || spanStartPoint == null || centerPoint == null) return;
|
|
23942
|
-
const { vertexAngle, centerAngle } = renderConfig
|
|
24144
|
+
const { vertexAngle, centerAngle } = renderConfig ?? {};
|
|
23943
24145
|
const VERTICAL_DEG = 90;
|
|
23944
24146
|
const isVertical = vertexAngle === VERTICAL_DEG && centerAngle === VERTICAL_DEG;
|
|
23945
24147
|
if (isVertical && !cjk.hasCJK(content)) {
|
|
@@ -23952,8 +24154,8 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23952
24154
|
} else {
|
|
23953
24155
|
const CHECKED_GLYPH = "☑";
|
|
23954
24156
|
if ((content === "☐" || content === CHECKED_GLYPH) && glyph.glyphType === 2) {
|
|
23955
|
-
var _glyph$ts
|
|
23956
|
-
const size = Math.ceil(((
|
|
24157
|
+
var _glyph$ts;
|
|
24158
|
+
const size = Math.ceil((((_glyph$ts = glyph.ts) === null || _glyph$ts === void 0 ? void 0 : _glyph$ts.fs) ?? 12) * 1.2);
|
|
23957
24159
|
ctx.save();
|
|
23958
24160
|
const fontHeight = glyph.bBox.aba - glyph.bBox.abd;
|
|
23959
24161
|
const bottom = spanPointWithFont.y;
|
|
@@ -23998,7 +24200,7 @@ var Line$1 = class extends docExtension {
|
|
|
23998
24200
|
_defineProperty(this, "Z_INDEX", DOC_EXTENSION_Z_INDEX);
|
|
23999
24201
|
_defineProperty(this, "_preBackgroundColor", "");
|
|
24000
24202
|
}
|
|
24001
|
-
draw(ctx, parentScale, glyph) {
|
|
24203
|
+
draw(ctx, parentScale, glyph, _diff, more) {
|
|
24002
24204
|
var _glyph$parent;
|
|
24003
24205
|
const line = (_glyph$parent = glyph.parent) === null || _glyph$parent === void 0 ? void 0 : _glyph$parent.parent;
|
|
24004
24206
|
const { ts: textStyle, bBox, content } = glyph;
|
|
@@ -24010,7 +24212,7 @@ var Line$1 = class extends docExtension {
|
|
|
24010
24212
|
const { ul: underline, st: strikethrough, ol: overline, va: baselineOffset, bbl: bottomBorderLine } = textStyle;
|
|
24011
24213
|
if (underline) {
|
|
24012
24214
|
const startY = asc + dsc;
|
|
24013
|
-
this._drawLine(ctx, glyph, underline, startY, scale);
|
|
24215
|
+
this._drawLine(ctx, glyph, underline, startY, scale, 1, more === null || more === void 0 ? void 0 : more.viewBound);
|
|
24014
24216
|
}
|
|
24015
24217
|
if (bottomBorderLine) {
|
|
24016
24218
|
const startY = asc + dsc + 3;
|
|
@@ -24037,22 +24239,27 @@ var Line$1 = class extends docExtension {
|
|
|
24037
24239
|
clearCache() {
|
|
24038
24240
|
this._preBackgroundColor = "";
|
|
24039
24241
|
}
|
|
24040
|
-
_drawLine(ctx, glyph, line, startY, _scale, lineWidth = 1) {
|
|
24242
|
+
_drawLine(ctx, glyph, line, startY, _scale, lineWidth = 1, viewBound) {
|
|
24041
24243
|
var _glyph$ts;
|
|
24042
24244
|
let { s: show, cl: colorStyle, t: lineType, c = BooleanNumber.TRUE } = line;
|
|
24043
24245
|
if (show !== BooleanNumber.TRUE) return;
|
|
24044
24246
|
if (c == null) c = BooleanNumber.TRUE;
|
|
24045
24247
|
const { originTranslate = Vector2.create(0, 0), alignOffset = Vector2.create(0, 0), renderConfig = {} } = this.extensionOffset;
|
|
24046
24248
|
const { left, width } = glyph;
|
|
24249
|
+
const isAccounting = this._isAccounting(lineType);
|
|
24250
|
+
if (isAccounting && !this._isFirstAccountingGlyph(glyph)) return;
|
|
24251
|
+
const lineLeft = isAccounting ? (viewBound === null || viewBound === void 0 ? void 0 : viewBound.left) ?? left : left;
|
|
24252
|
+
const lineRight = isAccounting ? (viewBound === null || viewBound === void 0 ? void 0 : viewBound.right) ?? left + width : left + width;
|
|
24253
|
+
const lineAlignOffset = isAccounting ? Vector2.create(0, alignOffset.y) : alignOffset;
|
|
24047
24254
|
const { centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0 } = renderConfig;
|
|
24048
24255
|
ctx.save();
|
|
24049
24256
|
ctx.strokeStyle = (c === BooleanNumber.TRUE ? getColorStyle((_glyph$ts = glyph.ts) === null || _glyph$ts === void 0 ? void 0 : _glyph$ts.cl) : getColorStyle(colorStyle)) || "rgb(0,0,0)";
|
|
24050
|
-
this._setLineType(ctx, lineType
|
|
24257
|
+
this._setLineType(ctx, lineType ?? TextDecoration.SINGLE, lineWidth);
|
|
24051
24258
|
startY += this._isDouble(lineType) ? -.8 : 0;
|
|
24052
24259
|
const centerAngle = degToRad(centerAngleDeg);
|
|
24053
24260
|
const vertexAngle = degToRad(vertexAngleDeg);
|
|
24054
|
-
const start = calculateRectRotate(originTranslate.addByPoint(
|
|
24055
|
-
const end = calculateRectRotate(originTranslate.addByPoint(
|
|
24261
|
+
const start = calculateRectRotate(originTranslate.addByPoint(lineLeft, startY), Vector2.create(0, 0), centerAngle, vertexAngle, lineAlignOffset);
|
|
24262
|
+
const end = calculateRectRotate(originTranslate.addByPoint(lineRight, startY), Vector2.create(0, 0), centerAngle, vertexAngle, lineAlignOffset);
|
|
24056
24263
|
ctx.beginPath();
|
|
24057
24264
|
ctx.moveTo(start.x, start.y);
|
|
24058
24265
|
this._drawLineTo(ctx, start.x, end.x, end.y, lineType);
|
|
@@ -24071,6 +24278,8 @@ var Line$1 = class extends docExtension {
|
|
|
24071
24278
|
switch (style) {
|
|
24072
24279
|
case TextDecoration.SINGLE:
|
|
24073
24280
|
case TextDecoration.DOUBLE:
|
|
24281
|
+
case TextDecoration.SINGLE_ACCOUNTING:
|
|
24282
|
+
case TextDecoration.DOUBLE_ACCOUNTING:
|
|
24074
24283
|
ctx.lineWidth = 1;
|
|
24075
24284
|
ctx.setLineDash([0]);
|
|
24076
24285
|
return;
|
|
@@ -24154,7 +24363,19 @@ var Line$1 = class extends docExtension {
|
|
|
24154
24363
|
return lineType === TextDecoration.WAVE || lineType === TextDecoration.WAVY_HEAVY || lineType === TextDecoration.WAVY_DOUBLE;
|
|
24155
24364
|
}
|
|
24156
24365
|
_isDouble(lineType) {
|
|
24157
|
-
return lineType === TextDecoration.DOUBLE || lineType === TextDecoration.WAVY_DOUBLE;
|
|
24366
|
+
return lineType === TextDecoration.DOUBLE || lineType === TextDecoration.WAVY_DOUBLE || lineType === TextDecoration.DOUBLE_ACCOUNTING;
|
|
24367
|
+
}
|
|
24368
|
+
_isAccounting(lineType) {
|
|
24369
|
+
return lineType === TextDecoration.SINGLE_ACCOUNTING || lineType === TextDecoration.DOUBLE_ACCOUNTING;
|
|
24370
|
+
}
|
|
24371
|
+
_isFirstAccountingGlyph(glyph) {
|
|
24372
|
+
var _glyph$parent2;
|
|
24373
|
+
const line = (_glyph$parent2 = glyph.parent) === null || _glyph$parent2 === void 0 ? void 0 : _glyph$parent2.parent;
|
|
24374
|
+
for (const divide of (line === null || line === void 0 ? void 0 : line.divides) ?? []) for (const candidate of divide.glyphGroup) {
|
|
24375
|
+
var _candidate$ts;
|
|
24376
|
+
if (this._isAccounting((_candidate$ts = candidate.ts) === null || _candidate$ts === void 0 || (_candidate$ts = _candidate$ts.ul) === null || _candidate$ts === void 0 ? void 0 : _candidate$ts.t)) return candidate === glyph;
|
|
24377
|
+
}
|
|
24378
|
+
return true;
|
|
24158
24379
|
}
|
|
24159
24380
|
};
|
|
24160
24381
|
DocumentsSpanAndLineExtensionRegistry.add(new Line$1());
|
|
@@ -24228,10 +24449,9 @@ var Documents = class Documents extends DocComponent {
|
|
|
24228
24449
|
skeHeaders,
|
|
24229
24450
|
unitId
|
|
24230
24451
|
}).some(({ tableId, tableRect }) => {
|
|
24231
|
-
var _viewport$leadingInse;
|
|
24232
24452
|
const sourceTableId = getTableIdAndSliceIndex(tableId).tableId;
|
|
24233
24453
|
const viewport = getDocsTableRenderViewport(unitId, sourceTableId);
|
|
24234
|
-
const projectedLeft = hasDocsTableHorizontalViewport(viewport) ? getDocsTableViewportLeft(viewport, tableRect.left - (
|
|
24454
|
+
const projectedLeft = hasDocsTableHorizontalViewport(viewport) ? getDocsTableViewportLeft(viewport, tableRect.left - (viewport.leadingInsetLeft ?? 0), docsLeft) : tableRect.left;
|
|
24235
24455
|
const projectedRight = hasDocsTableHorizontalViewport(viewport) ? projectedLeft + viewport.viewportWidth : tableRect.right;
|
|
24236
24456
|
return localCoord.x >= projectedLeft - TABLE_OVERFLOW_INTERACTION_PADDING && localCoord.x <= projectedRight + TABLE_OVERFLOW_INTERACTION_PADDING && localCoord.y >= tableRect.top - TABLE_OVERFLOW_INTERACTION_PADDING && localCoord.y <= tableRect.bottom + TABLE_OVERFLOW_INTERACTION_PADDING;
|
|
24237
24457
|
});
|
|
@@ -24257,7 +24477,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24257
24477
|
let pageTop = 0;
|
|
24258
24478
|
let pageLeft = 0;
|
|
24259
24479
|
for (let i = 0, len = pages.length; i < len; i++) {
|
|
24260
|
-
var _skeHeaders$get,
|
|
24480
|
+
var _skeHeaders$get, _skeFooters$get;
|
|
24261
24481
|
const page = pages[i];
|
|
24262
24482
|
const { sections, marginTop: pagePaddingTop = 0, marginBottom: pagePaddingBottom = 0, marginLeft: pagePaddingLeft = 0, marginRight: pagePaddingRight = 0, width: actualWidth, height: actualHeight, pageWidth, headerId, footerId, renderConfig = {}, skeTables, skeColumnGroups = /* @__PURE__ */ new Map() } = page;
|
|
24263
24483
|
const { verticalAlign = VerticalAlign.TOP, horizontalAlign = HorizontalAlign.LEFT, centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0, wrapStrategy = WrapStrategy.UNSPECIFIED, cellValueType } = renderConfig;
|
|
@@ -24276,14 +24496,14 @@ var Documents = class Documents extends DocComponent {
|
|
|
24276
24496
|
}
|
|
24277
24497
|
if (skeTables.size > 0) this._drawTable(ctx, page, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
24278
24498
|
const headerSkeletonPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
24279
|
-
const headerAlignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, (
|
|
24499
|
+
const headerAlignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, (headerSkeletonPage === null || headerSkeletonPage === void 0 ? void 0 : headerSkeletonPage.marginTop) ?? 0);
|
|
24280
24500
|
if (headerSkeletonPage) this._drawHeaderFooter(headerSkeletonPage, ctx, extensions, backgroundExtension, glyphExtensionsExcludeBackground, headerAlignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale, page, true);
|
|
24281
24501
|
this._startRotation(ctx, finalAngle);
|
|
24282
24502
|
for (const [sectionIndex, section] of sections.entries()) {
|
|
24283
24503
|
var _sections$slice$find;
|
|
24284
24504
|
const { columns } = section;
|
|
24285
24505
|
const nextSectionTop = (_sections$slice$find = sections.slice(sectionIndex + 1).find((candidate) => candidate.top > section.top)) === null || _sections$slice$find === void 0 ? void 0 : _sections$slice$find.top;
|
|
24286
|
-
const separatorHeight = Math.max(0, (nextSectionTop
|
|
24506
|
+
const separatorHeight = Math.max(0, (nextSectionTop ?? page.pageHeight - pagePaddingTop - pagePaddingBottom) - section.top);
|
|
24287
24507
|
this._drawLiquid.translateSave();
|
|
24288
24508
|
this._drawLiquid.translateSection(section);
|
|
24289
24509
|
drawSectionColumnSeparators(ctx, section, separatorHeight, alignOffsetNoAngle.x, alignOffsetNoAngle.y);
|
|
@@ -24394,9 +24614,8 @@ var Documents = class Documents extends DocComponent {
|
|
|
24394
24614
|
drawLiquid.translateSave();
|
|
24395
24615
|
drawLiquid.translate(tableLeft, tableTop);
|
|
24396
24616
|
if (hasDocsTableHorizontalViewport(viewport)) {
|
|
24397
|
-
var _viewport$leadingInse2;
|
|
24398
24617
|
const { x, y } = drawLiquid;
|
|
24399
|
-
const clipLeft = x + page.marginLeft - (
|
|
24618
|
+
const clipLeft = x + page.marginLeft - (viewport.leadingInsetLeft ?? 0);
|
|
24400
24619
|
ctx.save();
|
|
24401
24620
|
ctx.beginPath();
|
|
24402
24621
|
ctx.rectByPrecision(clipLeft - TABLE_VIEWPORT_BORDER_CLIP_PADDING, y + page.marginTop - TABLE_VIEWPORT_BORDER_CLIP_PADDING, viewport.viewportWidth + TABLE_VIEWPORT_BORDER_CLIP_PADDING * 2, tableSkeleton.height + TABLE_VIEWPORT_BORDER_CLIP_PADDING * 2);
|
|
@@ -24444,13 +24663,13 @@ var Documents = class Documents extends DocComponent {
|
|
|
24444
24663
|
const tableX = this._drawLiquid.x + page.marginLeft;
|
|
24445
24664
|
const tableY = this._drawLiquid.y + page.marginTop;
|
|
24446
24665
|
for (const row of tableSkeleton.rows) row.cells.forEach((cell, index) => {
|
|
24447
|
-
var _cellSource$backgroun
|
|
24666
|
+
var _cellSource$backgroun;
|
|
24448
24667
|
if (cell.isMergedCellCovered) return;
|
|
24449
24668
|
const cellSource = row.rowSource.tableCells[index];
|
|
24450
24669
|
if (!cellSource || cellSource.rowSpan === 0 || cellSource.columnSpan === 0) return;
|
|
24451
24670
|
const color = (_cellSource$backgroun = cellSource.backgroundColor) === null || _cellSource$backgroun === void 0 ? void 0 : _cellSource$backgroun.rgb;
|
|
24452
24671
|
if (!color) return;
|
|
24453
|
-
const rects =
|
|
24672
|
+
const rects = backgrounds.get(color) ?? [];
|
|
24454
24673
|
rects.push({
|
|
24455
24674
|
x: tableX + cell.left,
|
|
24456
24675
|
y: tableY + row.top,
|
|
@@ -24485,11 +24704,11 @@ var Documents = class Documents extends DocComponent {
|
|
|
24485
24704
|
};
|
|
24486
24705
|
}
|
|
24487
24706
|
_getRenderUnitId() {
|
|
24488
|
-
var _skeleton$getViewMode, _viewModel$getDataMod, _dataModel$getUnitId
|
|
24707
|
+
var _skeleton$getViewMode, _viewModel$getDataMod, _dataModel$getUnitId;
|
|
24489
24708
|
const skeleton = this.getSkeleton();
|
|
24490
24709
|
const viewModel = skeleton === null || skeleton === void 0 || (_skeleton$getViewMode = skeleton.getViewModel) === null || _skeleton$getViewMode === void 0 ? void 0 : _skeleton$getViewMode.call(skeleton);
|
|
24491
24710
|
const dataModel = viewModel === null || viewModel === void 0 || (_viewModel$getDataMod = viewModel.getDataModel) === null || _viewModel$getDataMod === void 0 ? void 0 : _viewModel$getDataMod.call(viewModel);
|
|
24492
|
-
return (
|
|
24711
|
+
return (dataModel === null || dataModel === void 0 || (_dataModel$getUnitId = dataModel.getUnitId) === null || _dataModel$getUnitId === void 0 ? void 0 : _dataModel$getUnitId.call(dataModel)) ?? this.oKey;
|
|
24493
24712
|
}
|
|
24494
24713
|
_getDocumentCompatibilityPolicy() {
|
|
24495
24714
|
var _skeleton$getViewMode2, _skeleton$getViewMode3;
|
|
@@ -24502,7 +24721,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24502
24721
|
if (!color || this._drawLiquid == null) return;
|
|
24503
24722
|
let { x, y } = this._drawLiquid;
|
|
24504
24723
|
const { marginLeft, marginTop } = page;
|
|
24505
|
-
x += marginLeft + (left
|
|
24724
|
+
x += marginLeft + (left ?? 0);
|
|
24506
24725
|
y -= line.marginTop;
|
|
24507
24726
|
y -= line.paddingTop;
|
|
24508
24727
|
y += marginTop + top;
|
|
@@ -24512,18 +24731,18 @@ var Documents = class Documents extends DocComponent {
|
|
|
24512
24731
|
ctx.restore();
|
|
24513
24732
|
}
|
|
24514
24733
|
_drawBorderBottom(ctx, page, line, width = page.pageWidth - page.marginLeft - page.marginRight, left = 0, top = 0) {
|
|
24515
|
-
var _line$borderBottom
|
|
24734
|
+
var _line$borderBottom;
|
|
24516
24735
|
if (this._drawLiquid == null) return;
|
|
24517
24736
|
let { x, y } = this._drawLiquid;
|
|
24518
24737
|
const { marginLeft, marginTop } = page;
|
|
24519
|
-
x += marginLeft + (left
|
|
24738
|
+
x += marginLeft + (left ?? 0);
|
|
24520
24739
|
y -= line.marginTop;
|
|
24521
24740
|
y -= line.paddingTop;
|
|
24522
|
-
y += marginTop + top + line.lineHeight - line.marginBottom + ((
|
|
24741
|
+
y += marginTop + top + line.lineHeight - line.marginBottom + (((_line$borderBottom = line.borderBottom) === null || _line$borderBottom === void 0 ? void 0 : _line$borderBottom.padding) ?? 0);
|
|
24523
24742
|
ctx.save();
|
|
24524
24743
|
const border = line.borderBottom;
|
|
24525
|
-
ctx.setLineWidthByPrecision(Math.max(0, (
|
|
24526
|
-
ctx.strokeStyle = (
|
|
24744
|
+
ctx.setLineWidthByPrecision(Math.max(0, (border === null || border === void 0 ? void 0 : border.width) ?? 1));
|
|
24745
|
+
ctx.strokeStyle = (border === null || border === void 0 ? void 0 : border.color.rgb) ?? "#CDD0D8";
|
|
24527
24746
|
setDocsBorderDash(ctx, border === null || border === void 0 ? void 0 : border.dashStyle);
|
|
24528
24747
|
drawLineByBorderType(ctx, "b", 0, {
|
|
24529
24748
|
startX: x,
|
|
@@ -24641,7 +24860,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24641
24860
|
ctx.restore();
|
|
24642
24861
|
}
|
|
24643
24862
|
_drawTableCellBordersAndBg(ctx, page, cell, drawBackground = true) {
|
|
24644
|
-
var
|
|
24863
|
+
var _cellSource$backgroun2;
|
|
24645
24864
|
const { marginLeft, marginTop } = page;
|
|
24646
24865
|
const { pageWidth, pageHeight } = cell;
|
|
24647
24866
|
const rowSke = cell.parent;
|
|
@@ -24650,7 +24869,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24650
24869
|
const cellSource = rowSke.rowSource.tableCells[index];
|
|
24651
24870
|
const tableSke = rowSke.parent;
|
|
24652
24871
|
const rowIndexInTable = tableSke === null || tableSke === void 0 ? void 0 : tableSke.rows.indexOf(rowSke);
|
|
24653
|
-
const rowIndex = rowIndexInTable == null || rowIndexInTable < 0 ?
|
|
24872
|
+
const rowIndex = rowIndexInTable == null || rowIndexInTable < 0 ? rowSke.index ?? 0 : rowIndexInTable;
|
|
24654
24873
|
if (!cellSource || cellSource.rowSpan === 0 || cellSource.columnSpan === 0) return;
|
|
24655
24874
|
if (this._drawLiquid == null) return;
|
|
24656
24875
|
let { x, y } = this._drawLiquid;
|
|
@@ -24676,8 +24895,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
24676
24895
|
if (index <= 0) this._drawTableCellBorder(ctx, this._resolveTableCellBorder(cellSource.borderLeft), "l", position);
|
|
24677
24896
|
}
|
|
24678
24897
|
_getTableCellSource(row, column) {
|
|
24679
|
-
|
|
24680
|
-
return (_row$rowSource$tableC = row === null || row === void 0 ? void 0 : row.rowSource.tableCells[column]) !== null && _row$rowSource$tableC !== void 0 ? _row$rowSource$tableC : null;
|
|
24898
|
+
return (row === null || row === void 0 ? void 0 : row.rowSource.tableCells[column]) ?? null;
|
|
24681
24899
|
}
|
|
24682
24900
|
_resolveTableCellBorder(primary, secondary) {
|
|
24683
24901
|
if (this._isDrawableTableCellBorder(primary)) return primary;
|
|
@@ -24686,17 +24904,17 @@ var Documents = class Documents extends DocComponent {
|
|
|
24686
24904
|
return DEFAULT_BORDER_COLOR;
|
|
24687
24905
|
}
|
|
24688
24906
|
_isDrawableTableCellBorder(border) {
|
|
24689
|
-
var _border$width
|
|
24907
|
+
var _border$width, _border$color;
|
|
24690
24908
|
if (!border) return false;
|
|
24691
|
-
const lineWidth = (_border$width
|
|
24692
|
-
const color = (
|
|
24909
|
+
const lineWidth = ((_border$width = border.width) === null || _border$width === void 0 ? void 0 : _border$width.v) ?? 1;
|
|
24910
|
+
const color = ((_border$color = border.color) === null || _border$color === void 0 ? void 0 : _border$color.rgb) ?? DEFAULT_BORDER_COLOR.color.rgb;
|
|
24693
24911
|
return lineWidth > 0 && color !== "transparent";
|
|
24694
24912
|
}
|
|
24695
24913
|
_drawTableCellBorder(ctx, border, type, position) {
|
|
24696
|
-
var _border$
|
|
24914
|
+
var _border$width2, _border$color2;
|
|
24697
24915
|
if (!border) return;
|
|
24698
|
-
const lineWidth = (
|
|
24699
|
-
const color = (
|
|
24916
|
+
const lineWidth = ((_border$width2 = border.width) === null || _border$width2 === void 0 ? void 0 : _border$width2.v) ?? 1;
|
|
24917
|
+
const color = ((_border$color2 = border.color) === null || _border$color2 === void 0 ? void 0 : _border$color2.rgb) ?? DEFAULT_BORDER_COLOR.color.rgb;
|
|
24700
24918
|
if (lineWidth <= 0 || color === "transparent") return;
|
|
24701
24919
|
ctx.save();
|
|
24702
24920
|
ctx.setLineWidthByPrecision(lineWidth);
|
|
@@ -24876,6 +25094,11 @@ function rectByPrecisionBounds(ctx, x, y, width, height) {
|
|
|
24876
25094
|
//#endregion
|
|
24877
25095
|
//#region src/components/sheets/spreadsheet.ts
|
|
24878
25096
|
const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__";
|
|
25097
|
+
const MERGE_REPAIR_CACHE_REFRESH_RATIO = .6;
|
|
25098
|
+
const CUSTOM_EXTENSION_KEY = "DefaultCustomExtension";
|
|
25099
|
+
const MARKER_EXTENSION_KEY = "DefaultMarkerExtension";
|
|
25100
|
+
const RANGE_PROTECTION_VIEW_EXTENSION_KEY = "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY";
|
|
25101
|
+
const RANGE_PROTECTION_HIDDEN_EXTENSION_KEY = "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY";
|
|
24879
25102
|
function pushSparseCellRange(ranges, row, col) {
|
|
24880
25103
|
const last = ranges[ranges.length - 1];
|
|
24881
25104
|
if (last && last.startRow === row && last.endRow === row && last.endColumn + 1 === col) {
|
|
@@ -24891,7 +25114,7 @@ function pushSparseCellRange(ranges, row, col) {
|
|
|
24891
25114
|
}
|
|
24892
25115
|
function scanSparseExtensionFeatures(spreadsheetSkeleton, ranges) {
|
|
24893
25116
|
const { worksheet } = spreadsheetSkeleton;
|
|
24894
|
-
if (!worksheet || !ranges.length
|
|
25117
|
+
if (!worksheet || !ranges.length) return null;
|
|
24895
25118
|
const flags = {
|
|
24896
25119
|
hasCustomRender: false,
|
|
24897
25120
|
hasMarkers: false,
|
|
@@ -24905,8 +25128,7 @@ function scanSparseExtensionFeatures(spreadsheetSkeleton, ranges) {
|
|
|
24905
25128
|
for (let col = range.startColumn; col <= range.endColumn; col++) {
|
|
24906
25129
|
var _spreadsheetSkeleton$, _cell$customRender, _cell$selectionProtec;
|
|
24907
25130
|
if (!worksheet.getColVisible(col)) continue;
|
|
24908
|
-
const
|
|
24909
|
-
const cell = cachedCell !== null && cachedCell !== void 0 ? cachedCell : worksheet.getCell(row, col);
|
|
25131
|
+
const cell = ((_spreadsheetSkeleton$ = spreadsheetSkeleton.stylesCache.fontMatrix.getValue(row, col)) === null || _spreadsheetSkeleton$ === void 0 ? void 0 : _spreadsheetSkeleton$.cellData) ?? worksheet.getCell(row, col);
|
|
24910
25132
|
if (!cell) continue;
|
|
24911
25133
|
if ((_cell$customRender = cell.customRender) === null || _cell$customRender === void 0 ? void 0 : _cell$customRender.length) {
|
|
24912
25134
|
flags.hasCustomRender = true;
|
|
@@ -24927,20 +25149,20 @@ function scanSparseExtensionFeatures(spreadsheetSkeleton, ranges) {
|
|
|
24927
25149
|
function shouldSkipSparseExtension(uKey, flags) {
|
|
24928
25150
|
if (!flags) return false;
|
|
24929
25151
|
switch (uKey) {
|
|
24930
|
-
case
|
|
24931
|
-
case
|
|
24932
|
-
case
|
|
24933
|
-
case
|
|
25152
|
+
case CUSTOM_EXTENSION_KEY: return !flags.hasCustomRender;
|
|
25153
|
+
case MARKER_EXTENSION_KEY: return !flags.hasMarkers;
|
|
25154
|
+
case RANGE_PROTECTION_VIEW_EXTENSION_KEY:
|
|
25155
|
+
case RANGE_PROTECTION_HIDDEN_EXTENSION_KEY: return !flags.hasSelectionProtection;
|
|
24934
25156
|
default: return false;
|
|
24935
25157
|
}
|
|
24936
25158
|
}
|
|
24937
25159
|
function hasSparseExtension(extensions) {
|
|
24938
25160
|
return extensions.some((extension) => {
|
|
24939
25161
|
switch (extension.uKey) {
|
|
24940
|
-
case
|
|
24941
|
-
case
|
|
24942
|
-
case
|
|
24943
|
-
case
|
|
25162
|
+
case CUSTOM_EXTENSION_KEY:
|
|
25163
|
+
case MARKER_EXTENSION_KEY:
|
|
25164
|
+
case RANGE_PROTECTION_VIEW_EXTENSION_KEY:
|
|
25165
|
+
case RANGE_PROTECTION_HIDDEN_EXTENSION_KEY: return true;
|
|
24944
25166
|
default: return false;
|
|
24945
25167
|
}
|
|
24946
25168
|
});
|
|
@@ -24948,13 +25170,24 @@ function hasSparseExtension(extensions) {
|
|
|
24948
25170
|
function getSparseExtensionDiffRanges(uKey, flags, diffRanges) {
|
|
24949
25171
|
if (!flags) return diffRanges;
|
|
24950
25172
|
switch (uKey) {
|
|
24951
|
-
case
|
|
24952
|
-
case
|
|
24953
|
-
case
|
|
24954
|
-
case
|
|
25173
|
+
case CUSTOM_EXTENSION_KEY: return flags.customRenderRanges;
|
|
25174
|
+
case MARKER_EXTENSION_KEY: return flags.markerRanges;
|
|
25175
|
+
case RANGE_PROTECTION_VIEW_EXTENSION_KEY:
|
|
25176
|
+
case RANGE_PROTECTION_HIDDEN_EXTENSION_KEY: return flags.selectionProtectionRanges;
|
|
24955
25177
|
default: return diffRanges;
|
|
24956
25178
|
}
|
|
24957
25179
|
}
|
|
25180
|
+
function boundsOverlap(a, b) {
|
|
25181
|
+
return a.left <= b.right && a.right >= b.left && a.top <= b.bottom && a.bottom >= b.top;
|
|
25182
|
+
}
|
|
25183
|
+
function getClippedBoundArea(bound, clipBound) {
|
|
25184
|
+
return Math.max(0, Math.min(bound.right, clipBound.right) - Math.max(bound.left, clipBound.left)) * Math.max(0, Math.min(bound.bottom, clipBound.bottom) - Math.max(bound.top, clipBound.top));
|
|
25185
|
+
}
|
|
25186
|
+
function exceedsMergeRepairThreshold(cacheBound, repaintBounds, hasMergeRepair) {
|
|
25187
|
+
if (!hasMergeRepair) return false;
|
|
25188
|
+
const cacheArea = getClippedBoundArea(cacheBound, cacheBound);
|
|
25189
|
+
return repaintBounds.reduce((area, repaintBound) => area + getClippedBoundArea(repaintBound.bound, cacheBound), 0) >= cacheArea * MERGE_REPAIR_CACHE_REFRESH_RATIO;
|
|
25190
|
+
}
|
|
24958
25191
|
/**
|
|
24959
25192
|
* Clip a blit source rectangle to the source canvas bounds and shrink the destination
|
|
24960
25193
|
* rectangle proportionally, as required by the HTML spec:
|
|
@@ -25062,7 +25295,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25062
25295
|
* @param ctx
|
|
25063
25296
|
* @param viewportInfo
|
|
25064
25297
|
*/
|
|
25065
|
-
draw(ctx, viewportInfo) {
|
|
25298
|
+
draw(ctx, viewportInfo, isMergeRepair = false) {
|
|
25066
25299
|
var _viewportInfo$diffBou;
|
|
25067
25300
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
25068
25301
|
if (!spreadsheetSkeleton) return;
|
|
@@ -25078,7 +25311,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25078
25311
|
endColumn: cacheRange.endColumn
|
|
25079
25312
|
})) : viewRanges;
|
|
25080
25313
|
const extensions = this.getExtensionsByOrder();
|
|
25081
|
-
const sparseExtensionFeatures = !
|
|
25314
|
+
const sparseExtensionFeatures = !isMergeRepair && hasSparseExtension(extensions) ? scanSparseExtensionFeatures(spreadsheetSkeleton, viewRanges) : null;
|
|
25082
25315
|
const scene = this.getScene();
|
|
25083
25316
|
for (const extension of extensions) {
|
|
25084
25317
|
if (shouldSkipSparseExtension(extension.uKey, sparseExtensionFeatures)) continue;
|
|
@@ -25089,7 +25322,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25089
25322
|
extension.draw(ctx, parentScale, spreadsheetSkeleton, extensionDiffRanges, {
|
|
25090
25323
|
viewRanges: extensionViewRanges,
|
|
25091
25324
|
checkOutOfViewBound: true,
|
|
25092
|
-
fontRenderRanges: extension === this._fontExtension ? spreadsheetSkeleton.incrementalFontRenderRanges : void 0,
|
|
25325
|
+
fontRenderRanges: extension === this._fontExtension && !isMergeRepair ? spreadsheetSkeleton.incrementalFontRenderRanges : void 0,
|
|
25093
25326
|
hasMergeData,
|
|
25094
25327
|
viewportKey: viewportInfo.viewportKey,
|
|
25095
25328
|
viewBound: viewportInfo.cacheBound,
|
|
@@ -25100,13 +25333,11 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25100
25333
|
}
|
|
25101
25334
|
}
|
|
25102
25335
|
addRenderFrameTimeMetricToScene(timeKey, val, scene) {
|
|
25103
|
-
|
|
25104
|
-
scene = (_scene = scene) !== null && _scene !== void 0 ? _scene : this.getScene();
|
|
25336
|
+
scene = scene ?? this.getScene();
|
|
25105
25337
|
scene.getEngine().renderFrameTimeMetric$.next([timeKey, val]);
|
|
25106
25338
|
}
|
|
25107
25339
|
addRenderTagToScene(renderKey, val, scene) {
|
|
25108
|
-
|
|
25109
|
-
scene = (_scene2 = scene) !== null && _scene2 !== void 0 ? _scene2 : this.getScene();
|
|
25340
|
+
scene = scene ?? this.getScene();
|
|
25110
25341
|
scene.getEngine().renderFrameTags$.next([renderKey, val]);
|
|
25111
25342
|
}
|
|
25112
25343
|
/**
|
|
@@ -25200,7 +25431,11 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25200
25431
|
const cachePixelRatio = cacheCanvas.getPixelRatio();
|
|
25201
25432
|
const isScrollJumpOutsideCache = Math.abs(diffX) * scaleX >= cacheCanvas.getWidth() * cachePixelRatio || Math.abs(diffY) * scaleY >= cacheCanvas.getHeight() * cachePixelRatio;
|
|
25202
25433
|
const hasMergeData = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
25203
|
-
const
|
|
25434
|
+
const isScrolling = diffX !== 0 || diffY !== 0;
|
|
25435
|
+
const mergeRepairBounds = this._getMergeRepairBounds(spreadsheetSkeleton, viewportInfo, hasMergeData, isScrolling);
|
|
25436
|
+
const repaintBounds = this._getRepaintBounds(viewportInfo, mergeRepairBounds);
|
|
25437
|
+
const shouldRefreshForMergeRepairArea = exceedsMergeRepairThreshold(viewportInfo.cacheBound, repaintBounds, mergeRepairBounds.length > 0);
|
|
25438
|
+
const shouldRefreshCache = isDirty || isForceDirty || isScrollJumpOutsideCache || shouldRefreshForMergeRepairArea || shouldCacheUpdate && diffX !== 0;
|
|
25204
25439
|
if (diffBounds.length === 0 || diffX === 0 && diffY === 0 || shouldRefreshCache) {
|
|
25205
25440
|
if (shouldRefreshCache) {
|
|
25206
25441
|
this.addRenderTagToScene("scrolling", false);
|
|
@@ -25228,7 +25463,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25228
25463
|
scaleY,
|
|
25229
25464
|
columnHeaderHeightAndMarginTop,
|
|
25230
25465
|
rowHeaderWidthAndMarginLeft
|
|
25231
|
-
});
|
|
25466
|
+
}, mergeRepairBounds);
|
|
25232
25467
|
}
|
|
25233
25468
|
const sourceLeft = bufferEdgeSizeX * Math.min(1, window.devicePixelRatio);
|
|
25234
25469
|
const sourceTop = bufferEdgeSizeY * Math.min(1, window.devicePixelRatio);
|
|
@@ -25238,9 +25473,52 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25238
25473
|
this._applyCache(cacheCanvas, mainCtx, sourceLeft, sourceTop, dw, dh, left, top, dw, dh);
|
|
25239
25474
|
cacheCtx.restore();
|
|
25240
25475
|
}
|
|
25241
|
-
|
|
25476
|
+
_getMergeRepairBounds(spreadsheetSkeleton, viewportInfo, hasMergeData, isScrolling) {
|
|
25477
|
+
if (!hasMergeData || !isScrolling) return [];
|
|
25478
|
+
const { columnWidthAccumulation, rowHeightAccumulation, rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
25479
|
+
const dirtyBounds = viewportInfo.shouldCacheUpdate ? viewportInfo.diffCacheBounds : viewportInfo.diffBounds;
|
|
25480
|
+
const mergeBounds = [];
|
|
25481
|
+
const visited = /* @__PURE__ */ new Set();
|
|
25482
|
+
for (const dirtyBound of dirtyBounds) {
|
|
25483
|
+
const range = spreadsheetSkeleton.getRangeByViewBound(dirtyBound);
|
|
25484
|
+
const mergeRanges = spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn);
|
|
25485
|
+
for (const mergeRange of mergeRanges) {
|
|
25486
|
+
const key = `${mergeRange.startRow}:${mergeRange.startColumn}`;
|
|
25487
|
+
if (visited.has(key)) continue;
|
|
25488
|
+
visited.add(key);
|
|
25489
|
+
mergeBounds.push({
|
|
25490
|
+
left: (columnWidthAccumulation[mergeRange.startColumn - 1] ?? 0) + rowHeaderWidthAndMarginLeft,
|
|
25491
|
+
top: (rowHeightAccumulation[mergeRange.startRow - 1] ?? 0) + columnHeaderHeightAndMarginTop,
|
|
25492
|
+
right: columnWidthAccumulation[mergeRange.endColumn] + rowHeaderWidthAndMarginLeft,
|
|
25493
|
+
bottom: rowHeightAccumulation[mergeRange.endRow] + columnHeaderHeightAndMarginTop
|
|
25494
|
+
});
|
|
25495
|
+
}
|
|
25496
|
+
}
|
|
25497
|
+
return mergeBounds;
|
|
25498
|
+
}
|
|
25499
|
+
_getRepaintBounds(viewportInfo, mergeRepairBounds) {
|
|
25500
|
+
const repaintBounds = viewportInfo.shouldCacheUpdate ? viewportInfo.diffCacheBounds.map((bound) => ({
|
|
25501
|
+
bound: { ...bound },
|
|
25502
|
+
repairsMerge: false
|
|
25503
|
+
})) : [];
|
|
25504
|
+
for (const mergeRepairBound of mergeRepairBounds) {
|
|
25505
|
+
const overlappingBound = repaintBounds.find(({ bound }) => boundsOverlap(bound, mergeRepairBound));
|
|
25506
|
+
if (overlappingBound) {
|
|
25507
|
+
overlappingBound.bound.left = Math.min(overlappingBound.bound.left, mergeRepairBound.left);
|
|
25508
|
+
overlappingBound.bound.top = Math.min(overlappingBound.bound.top, mergeRepairBound.top);
|
|
25509
|
+
overlappingBound.bound.right = Math.max(overlappingBound.bound.right, mergeRepairBound.right);
|
|
25510
|
+
overlappingBound.bound.bottom = Math.max(overlappingBound.bound.bottom, mergeRepairBound.bottom);
|
|
25511
|
+
overlappingBound.repairsMerge = true;
|
|
25512
|
+
} else repaintBounds.push({
|
|
25513
|
+
bound: { ...mergeRepairBound },
|
|
25514
|
+
repairsMerge: true
|
|
25515
|
+
});
|
|
25516
|
+
}
|
|
25517
|
+
return repaintBounds;
|
|
25518
|
+
}
|
|
25519
|
+
paintNewAreaForScrolling(viewportInfo, param, mergeRepairBounds = []) {
|
|
25242
25520
|
const { cacheCanvas, cacheCtx, mainCtx, topOrigin, leftOrigin, bufferEdgeX, bufferEdgeY, scaleX, scaleY, columnHeaderHeightAndMarginTop, rowHeaderWidthAndMarginLeft } = param;
|
|
25243
|
-
const {
|
|
25521
|
+
const { diffX, diffY } = viewportInfo;
|
|
25244
25522
|
cacheCtx.save();
|
|
25245
25523
|
cacheCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
25246
25524
|
cacheCtx.globalCompositeOperation = "copy";
|
|
@@ -25250,7 +25528,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25250
25528
|
const m = mainCtx.getTransform();
|
|
25251
25529
|
cacheCtx.setTransform(m.a, m.b, m.c, m.d, 0, 0);
|
|
25252
25530
|
cacheCtx.translateWithPrecision(m.e / m.a - leftOrigin + bufferEdgeX, m.f / m.d - topOrigin + bufferEdgeY);
|
|
25253
|
-
|
|
25531
|
+
const repaintBounds = this._getRepaintBounds(viewportInfo, mergeRepairBounds);
|
|
25532
|
+
if (repaintBounds.length) for (const { bound: diffBound, repairsMerge } of repaintBounds) {
|
|
25254
25533
|
const { left: diffLeft, right: diffRight, bottom: diffBottom, top: diffTop } = diffBound;
|
|
25255
25534
|
const x = diffLeft - rowHeaderWidthAndMarginLeft;
|
|
25256
25535
|
const y = diffTop - columnHeaderHeightAndMarginTop;
|
|
@@ -25265,7 +25544,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25265
25544
|
this.draw(cacheCtx, {
|
|
25266
25545
|
...viewportInfo,
|
|
25267
25546
|
diffBounds: [diffBound]
|
|
25268
|
-
});
|
|
25547
|
+
}, repairsMerge);
|
|
25269
25548
|
cacheCtx.restore();
|
|
25270
25549
|
}
|
|
25271
25550
|
this._refreshIncrementalState = false;
|
|
@@ -25390,7 +25669,6 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25390
25669
|
* @param ctx
|
|
25391
25670
|
*/
|
|
25392
25671
|
_drawAuxiliary(ctx, hasMergeData = true) {
|
|
25393
|
-
var _ref;
|
|
25394
25672
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
25395
25673
|
if (spreadsheetSkeleton == null) return;
|
|
25396
25674
|
const { rowColumnSegment, overflowCache, showGridlines, gridlinesColor, worksheet } = spreadsheetSkeleton;
|
|
@@ -25400,7 +25678,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25400
25678
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0) return;
|
|
25401
25679
|
ctx.save();
|
|
25402
25680
|
ctx.setLineWidthByPrecision(1);
|
|
25403
|
-
ctx.strokeStyle =
|
|
25681
|
+
ctx.strokeStyle = gridlinesColor ?? ctx.renderConfig.gridlinesColor ?? getColor([
|
|
25404
25682
|
214,
|
|
25405
25683
|
216,
|
|
25406
25684
|
219
|
|
@@ -25482,12 +25760,11 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25482
25760
|
_clearRectangle(ctx, rowHeightAccumulation, columnWidthAccumulation, cellRanges) {
|
|
25483
25761
|
if (cellRanges == null) return;
|
|
25484
25762
|
for (const range of cellRanges) {
|
|
25485
|
-
var _rowHeightAccumulatio, _rowHeightAccumulatio2, _columnWidthAccumulat, _columnWidthAccumulat2;
|
|
25486
25763
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
25487
|
-
const startY =
|
|
25488
|
-
const endY =
|
|
25489
|
-
const startX =
|
|
25490
|
-
const endX =
|
|
25764
|
+
const startY = rowHeightAccumulation[startRow - 1] ?? 0;
|
|
25765
|
+
const endY = rowHeightAccumulation[endRow] ?? rowHeightAccumulation[rowHeightAccumulation.length - 1];
|
|
25766
|
+
const startX = columnWidthAccumulation[startColumn - 1] ?? 0;
|
|
25767
|
+
const endX = columnWidthAccumulation[endColumn] ?? columnWidthAccumulation[columnWidthAccumulation.length - 1];
|
|
25491
25768
|
ctx.clearRectByPrecision(startX, startY, endX - startX, endY - startY);
|
|
25492
25769
|
ctx.beginPath();
|
|
25493
25770
|
ctx.moveToByPrecision(startX, startY);
|
|
@@ -25511,17 +25788,17 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25511
25788
|
const defaultBg = defaultBackgroundColor;
|
|
25512
25789
|
const defaultStripe = defaultStripeColor;
|
|
25513
25790
|
if (rowGaps) for (let r = rowStart; r <= rowEnd; r++) {
|
|
25514
|
-
var _rowGaps$r
|
|
25515
|
-
const gapSize = (
|
|
25791
|
+
var _rowGaps$r;
|
|
25792
|
+
const gapSize = ((_rowGaps$r = rowGaps[r]) === null || _rowGaps$r === void 0 ? void 0 : _rowGaps$r.size) ?? 0;
|
|
25516
25793
|
if (gapSize <= 0) continue;
|
|
25517
|
-
const gapTop =
|
|
25794
|
+
const gapTop = rowHeightAccumulation[r - 1] ?? 0;
|
|
25518
25795
|
this._drawSingleGapRect(ctx, rowGaps[r], viewStartX, gapTop, viewEndX - viewStartX, gapSize, defaultBg, defaultStripe);
|
|
25519
25796
|
}
|
|
25520
25797
|
if (colGaps) for (let c = columnStart; c <= columnEnd; c++) {
|
|
25521
|
-
var _colGaps$c
|
|
25522
|
-
const gapSize = (
|
|
25798
|
+
var _colGaps$c;
|
|
25799
|
+
const gapSize = ((_colGaps$c = colGaps[c]) === null || _colGaps$c === void 0 ? void 0 : _colGaps$c.size) ?? 0;
|
|
25523
25800
|
if (gapSize <= 0) continue;
|
|
25524
|
-
const gapLeft =
|
|
25801
|
+
const gapLeft = columnWidthAccumulation[c - 1] ?? 0;
|
|
25525
25802
|
this._drawSingleGapRect(ctx, colGaps[c], gapLeft, viewStartY, gapSize, viewEndY - viewStartY, defaultBg, defaultStripe);
|
|
25526
25803
|
}
|
|
25527
25804
|
}
|
|
@@ -25529,13 +25806,12 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
25529
25806
|
* Render a single gap rectangle: clear gridlines, fill background, draw diagonal stripes.
|
|
25530
25807
|
*/
|
|
25531
25808
|
_drawSingleGapRect(ctx, gapItem, x, y, w, h, defaultBg, defaultStripe) {
|
|
25532
|
-
var _gapItem$color, _gapItem$stripeColor;
|
|
25533
25809
|
ctx.clearRectByPrecision(x, y, w, h);
|
|
25534
25810
|
ctx.save();
|
|
25535
|
-
ctx.fillStyle =
|
|
25811
|
+
ctx.fillStyle = gapItem.color ?? defaultBg;
|
|
25536
25812
|
ctx.fillRectByPrecision(x, y, w, h);
|
|
25537
25813
|
ctx.restore();
|
|
25538
|
-
const stripeColor =
|
|
25814
|
+
const stripeColor = gapItem.stripeColor ?? defaultStripe;
|
|
25539
25815
|
ctx.save();
|
|
25540
25816
|
ctx.beginPath();
|
|
25541
25817
|
ctx.rectByPrecision(x, y, w, h);
|
|
@@ -26267,12 +26543,12 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
26267
26543
|
this.makeDirty(true);
|
|
26268
26544
|
}
|
|
26269
26545
|
draw(ctx, bounds) {
|
|
26270
|
-
var _this$getSkeleton, _this$getSkeleton2
|
|
26546
|
+
var _this$getSkeleton, _this$getSkeleton2;
|
|
26271
26547
|
const skeletonData = (_this$getSkeleton = this.getSkeleton()) === null || _this$getSkeleton === void 0 ? void 0 : _this$getSkeleton.getSkeletonData();
|
|
26272
26548
|
const docDataModel = (_this$getSkeleton2 = this.getSkeleton()) === null || _this$getSkeleton2 === void 0 ? void 0 : _this$getSkeleton2.getViewModel().getDataModel();
|
|
26273
26549
|
if (skeletonData == null || docDataModel == null) return;
|
|
26274
26550
|
const { documentFlavor, background } = docDataModel.getSnapshot().documentStyle;
|
|
26275
|
-
const workspaceFill =
|
|
26551
|
+
const workspaceFill = this._backgroundFillColor ?? (documentFlavor === DocumentFlavor.MODERN ? PAGE_FILL_COLOR : DOCS_WORKSPACE_FILL_COLOR);
|
|
26276
26552
|
this._drawWorkspaceBackground(ctx, workspaceFill, bounds);
|
|
26277
26553
|
if (documentFlavor === DocumentFlavor.MODERN) return;
|
|
26278
26554
|
this._drawLiquid.reset();
|
|
@@ -26280,7 +26556,6 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
26280
26556
|
let pageTop = 0;
|
|
26281
26557
|
let pageLeft = 0;
|
|
26282
26558
|
for (let i = 0, len = pages.length; i < len; i++) {
|
|
26283
|
-
var _this$_pageStrokeColo, _this$_pageFillColor, _this$_marginStrokeCo;
|
|
26284
26559
|
const page = pages[i];
|
|
26285
26560
|
if (this.isSkipByDiffBounds(page, pageTop, pageLeft, bounds)) {
|
|
26286
26561
|
const { x, y } = this._drawLiquid.translatePage(page, this.pageLayoutType, this.pageMarginLeft, this.pageMarginTop);
|
|
@@ -26292,15 +26567,15 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
26292
26567
|
ctx.save();
|
|
26293
26568
|
ctx.translate(pageLeft - .5, pageTop - .5);
|
|
26294
26569
|
const backgroundOptions = {
|
|
26295
|
-
width: pageWidth
|
|
26296
|
-
height: pageHeight
|
|
26570
|
+
width: pageWidth ?? width,
|
|
26571
|
+
height: pageHeight ?? height,
|
|
26297
26572
|
strokeWidth: 1,
|
|
26298
|
-
stroke:
|
|
26299
|
-
fill:
|
|
26573
|
+
stroke: this._pageStrokeColor ?? PAGE_STROKE_COLOR,
|
|
26574
|
+
fill: this._pageFillColor ?? PAGE_FILL_COLOR,
|
|
26300
26575
|
zIndex: 3
|
|
26301
26576
|
};
|
|
26302
26577
|
Rect.drawWith(ctx, backgroundOptions);
|
|
26303
|
-
this._drawPageBackgroundImage(ctx, background === null || background === void 0 ? void 0 : background.source, pageWidth
|
|
26578
|
+
this._drawPageBackgroundImage(ctx, background === null || background === void 0 ? void 0 : background.source, pageWidth ?? width, pageHeight ?? height);
|
|
26304
26579
|
const IDENTIFIER_WIDTH = 15;
|
|
26305
26580
|
const marginIdentification = {
|
|
26306
26581
|
dataArray: [
|
|
@@ -26354,7 +26629,7 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
26354
26629
|
}
|
|
26355
26630
|
],
|
|
26356
26631
|
strokeWidth: 1.5,
|
|
26357
|
-
stroke:
|
|
26632
|
+
stroke: this._marginStrokeColor ?? MARGIN_STROKE_COLOR
|
|
26358
26633
|
};
|
|
26359
26634
|
Path.drawWith(ctx, marginIdentification);
|
|
26360
26635
|
ctx.restore();
|
|
@@ -26364,10 +26639,9 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
26364
26639
|
}
|
|
26365
26640
|
}
|
|
26366
26641
|
_drawWorkspaceBackground(ctx, fill, bounds) {
|
|
26367
|
-
|
|
26368
|
-
const
|
|
26369
|
-
const
|
|
26370
|
-
const top = (_visibleBound$top = visibleBound === null || visibleBound === void 0 ? void 0 : visibleBound.top) !== null && _visibleBound$top !== void 0 ? _visibleBound$top : 0;
|
|
26642
|
+
const visibleBound = (bounds === null || bounds === void 0 ? void 0 : bounds.cacheBound) ?? (bounds === null || bounds === void 0 ? void 0 : bounds.viewBound);
|
|
26643
|
+
const left = (visibleBound === null || visibleBound === void 0 ? void 0 : visibleBound.left) ?? 0;
|
|
26644
|
+
const top = (visibleBound === null || visibleBound === void 0 ? void 0 : visibleBound.top) ?? 0;
|
|
26371
26645
|
const width = visibleBound == null ? this.width : visibleBound.right - visibleBound.left;
|
|
26372
26646
|
const height = visibleBound == null ? this.height : visibleBound.bottom - visibleBound.top;
|
|
26373
26647
|
if (width <= 0 || height <= 0) return;
|
|
@@ -26498,13 +26772,13 @@ function measureDocumentNoWrapRunsWidth(dataStream, textRuns, fallbackTextStyle)
|
|
|
26498
26772
|
return Math.max(maxLineWidth, currentLineWidth);
|
|
26499
26773
|
}
|
|
26500
26774
|
function measureDocumentNoWrapTextRangeWidth(documentData, start, end) {
|
|
26501
|
-
var
|
|
26775
|
+
var _documentData$documen2;
|
|
26502
26776
|
const body = documentData.body;
|
|
26503
|
-
const dataStream = (
|
|
26777
|
+
const dataStream = (body === null || body === void 0 ? void 0 : body.dataStream) ?? "";
|
|
26504
26778
|
const rangeStart = Math.max(0, Math.min(dataStream.length, start));
|
|
26505
26779
|
const rangeEnd = Math.max(rangeStart, Math.min(dataStream.length, end));
|
|
26506
26780
|
const rangeText = dataStream.slice(rangeStart, rangeEnd);
|
|
26507
|
-
const textRuns = ((
|
|
26781
|
+
const textRuns = ((body === null || body === void 0 ? void 0 : body.textRuns) ?? []).map((run) => {
|
|
26508
26782
|
const runStart = Math.max(rangeStart, run.st);
|
|
26509
26783
|
const runEnd = Math.min(rangeEnd, run.ed);
|
|
26510
26784
|
if (runEnd <= runStart) return null;
|
|
@@ -26532,9 +26806,9 @@ function measureDocumentNoWrapTextRangeWidth(documentData, start, end) {
|
|
|
26532
26806
|
* details such as CJK-Latin spacing.
|
|
26533
26807
|
*/
|
|
26534
26808
|
function measureDocumentNoWrapTextWidth(documentData) {
|
|
26535
|
-
var
|
|
26809
|
+
var _documentData$documen4;
|
|
26536
26810
|
const body = documentData === null || documentData === void 0 ? void 0 : documentData.body;
|
|
26537
|
-
const dataStream = (
|
|
26811
|
+
const dataStream = (body === null || body === void 0 ? void 0 : body.dataStream) ?? "";
|
|
26538
26812
|
const textRuns = body === null || body === void 0 ? void 0 : body.textRuns;
|
|
26539
26813
|
if (textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) {
|
|
26540
26814
|
var _documentData$documen3;
|
|
@@ -26544,13 +26818,52 @@ function measureDocumentNoWrapTextWidth(documentData) {
|
|
|
26544
26818
|
return Math.max(0, ...splitDocumentNoWrapMeasureLines(dataStream).map((line) => measureDocumentNoWrapLineByStyle(line, fallbackTextStyle)));
|
|
26545
26819
|
}
|
|
26546
26820
|
/**
|
|
26821
|
+
* Measures the widest line after applying the docs Unicode break policy
|
|
26822
|
+
* within a fixed-width host.
|
|
26823
|
+
*/
|
|
26824
|
+
function measureDocumentWrappedTextWidth(documentData, maxLineWidth) {
|
|
26825
|
+
var _documentData$body;
|
|
26826
|
+
const dataStream = (documentData === null || documentData === void 0 || (_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream) ?? "";
|
|
26827
|
+
if (!documentData || !dataStream || !Number.isFinite(maxLineWidth) || maxLineWidth <= 0) return 0;
|
|
26828
|
+
const breaker = new LineBreaker(dataStream);
|
|
26829
|
+
let lineStart = 0;
|
|
26830
|
+
let lastFittingEnd = 0;
|
|
26831
|
+
let widestLine = 0;
|
|
26832
|
+
let breakPoint = breaker.nextBreakPoint();
|
|
26833
|
+
while (breakPoint) {
|
|
26834
|
+
const candidateEnd = breakPoint.position;
|
|
26835
|
+
const candidateWidth = measureDocumentNoWrapTextRangeWidth(documentData, lineStart, candidateEnd);
|
|
26836
|
+
if (candidateWidth <= maxLineWidth) {
|
|
26837
|
+
lastFittingEnd = candidateEnd;
|
|
26838
|
+
if (breakPoint.type === "Mandatory") {
|
|
26839
|
+
widestLine = Math.max(widestLine, candidateWidth);
|
|
26840
|
+
lineStart = candidateEnd;
|
|
26841
|
+
lastFittingEnd = candidateEnd;
|
|
26842
|
+
}
|
|
26843
|
+
breakPoint = breaker.nextBreakPoint();
|
|
26844
|
+
continue;
|
|
26845
|
+
}
|
|
26846
|
+
if (lastFittingEnd > lineStart) {
|
|
26847
|
+
widestLine = Math.max(widestLine, measureDocumentNoWrapTextRangeWidth(documentData, lineStart, lastFittingEnd));
|
|
26848
|
+
lineStart = lastFittingEnd;
|
|
26849
|
+
continue;
|
|
26850
|
+
}
|
|
26851
|
+
widestLine = Math.max(widestLine, maxLineWidth);
|
|
26852
|
+
lineStart = candidateEnd;
|
|
26853
|
+
lastFittingEnd = candidateEnd;
|
|
26854
|
+
breakPoint = breaker.nextBreakPoint();
|
|
26855
|
+
}
|
|
26856
|
+
if (lineStart < dataStream.length) widestLine = Math.max(widestLine, Math.min(maxLineWidth, measureDocumentNoWrapTextRangeWidth(documentData, lineStart, dataStream.length)));
|
|
26857
|
+
return widestLine;
|
|
26858
|
+
}
|
|
26859
|
+
/**
|
|
26547
26860
|
* Measures the widest segment that docs line breaking keeps together. This is
|
|
26548
26861
|
* useful when a host may wrap normally but still needs enough width to avoid
|
|
26549
26862
|
* clipping an individual word, CJK glyph, or punctuation segment.
|
|
26550
26863
|
*/
|
|
26551
26864
|
function measureDocumentUnbreakableTextWidth(documentData) {
|
|
26552
|
-
var _documentData$
|
|
26553
|
-
const dataStream = (
|
|
26865
|
+
var _documentData$body2;
|
|
26866
|
+
const dataStream = (documentData === null || documentData === void 0 || (_documentData$body2 = documentData.body) === null || _documentData$body2 === void 0 ? void 0 : _documentData$body2.dataStream) ?? "";
|
|
26554
26867
|
if (!documentData || !dataStream) return 0;
|
|
26555
26868
|
const breaker = new LineBreaker(dataStream);
|
|
26556
26869
|
let start = 0;
|
|
@@ -27095,9 +27408,8 @@ let CanvasColorService = class CanvasColorService extends Disposable {
|
|
|
27095
27408
|
};
|
|
27096
27409
|
CanvasColorService = __decorate([__decorateParam(0, Inject(ThemeService))], CanvasColorService);
|
|
27097
27410
|
function getDarkRenderColorOverride(color) {
|
|
27098
|
-
var _DARK_RENDER_COLOR_OV;
|
|
27099
27411
|
const normalized = normalizeRenderColor(color);
|
|
27100
|
-
return
|
|
27412
|
+
return DARK_RENDER_COLOR_OVERRIDES[normalized] ?? null;
|
|
27101
27413
|
}
|
|
27102
27414
|
function normalizeRenderColor(color) {
|
|
27103
27415
|
const trimmed = color.trim().toLowerCase();
|
|
@@ -27226,7 +27538,7 @@ let Engine = class Engine extends Disposable {
|
|
|
27226
27538
|
if (this._renderFrameTasks.length > 0) this._requestNewFrameHandler = requestNewFrame(this._renderFunction);
|
|
27227
27539
|
else this._renderingQueueLaunched = false;
|
|
27228
27540
|
});
|
|
27229
|
-
this._unitId = unitId
|
|
27541
|
+
this._unitId = unitId ?? "";
|
|
27230
27542
|
const options = Object.assign({}, {
|
|
27231
27543
|
elementHeight: 1,
|
|
27232
27544
|
elementWidth: 1,
|
|
@@ -27768,7 +28080,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
27768
28080
|
//#endregion
|
|
27769
28081
|
//#region package.json
|
|
27770
28082
|
var name = "@univerjs/engine-render";
|
|
27771
|
-
var version = "1.0.0-
|
|
28083
|
+
var version = "1.0.0-beta.0";
|
|
27772
28084
|
|
|
27773
28085
|
//#endregion
|
|
27774
28086
|
//#region src/config/config.ts
|
|
@@ -27944,13 +28256,12 @@ var InputManager = class InputManager extends Disposable {
|
|
|
27944
28256
|
if (!(currentObject === null || currentObject === void 0 ? void 0 : currentObject.triggerDrop(evt)) && this._shouldDispatchEventToScene(currentObject)) this._scene.onDrop$.emitEvent(evt);
|
|
27945
28257
|
}
|
|
27946
28258
|
attachControl(options) {
|
|
27947
|
-
|
|
27948
|
-
const
|
|
27949
|
-
const
|
|
27950
|
-
const
|
|
27951
|
-
const
|
|
27952
|
-
const
|
|
27953
|
-
const enableLeave = (_options$enableLeave = options === null || options === void 0 ? void 0 : options.enableLeave) !== null && _options$enableLeave !== void 0 ? _options$enableLeave : true;
|
|
28259
|
+
const enableDown = (options === null || options === void 0 ? void 0 : options.enableDown) ?? true;
|
|
28260
|
+
const enableUp = (options === null || options === void 0 ? void 0 : options.enableUp) ?? true;
|
|
28261
|
+
const enableMove = (options === null || options === void 0 ? void 0 : options.enableMove) ?? true;
|
|
28262
|
+
const enableWheel = (options === null || options === void 0 ? void 0 : options.enableWheel) ?? true;
|
|
28263
|
+
const enableEnter = (options === null || options === void 0 ? void 0 : options.enableEnter) ?? true;
|
|
28264
|
+
const enableLeave = (options === null || options === void 0 ? void 0 : options.enableLeave) ?? true;
|
|
27954
28265
|
const engine = this._scene.getEngine();
|
|
27955
28266
|
if (!engine) return;
|
|
27956
28267
|
this._onInput$ = engine.onInputChanged$.subscribeEvent((eventData) => {
|
|
@@ -28431,53 +28742,52 @@ var Transformer = class extends Disposable {
|
|
|
28431
28742
|
const objectTransformerConfig = applyObject.transformerConfig;
|
|
28432
28743
|
let { isCropper, hoverEnabled, hoverEnterFunc, hoverLeaveFunc, resizeEnabled, rotateEnabled, rotationSnaps, rotationSnapTolerance, rotateAnchorOffset, rotateAnchorPosition, rotateLineEnabled, rotateSize, rotateCornerRadius, rotateFill, rotateStroke, rotateStrokeWidth, rotateIconEnabled, rotateIconStroke, rotateIconStrokeWidth, borderEnabled, borderStroke, borderStrokeWidth, borderDash, borderSpacing, anchorFill, anchorStroke, anchorStrokeWidth, anchorSize, anchorCornerRadius, anchorStyle, anchorSideLongSize, anchorSideShortSize, anchorSideCornerRadius, anchorShadowColor, anchorShadowBlur, anchorShadowOffsetX, anchorShadowOffsetY, keepRatio, centeredScaling, enabledAnchors, flipEnabled, ignoreStroke, boundBoxFunc, useSingleNodeRotation, shouldOverdrawWholeArea, moveBoundaryEnabled } = this;
|
|
28433
28744
|
if (objectTransformerConfig != null) {
|
|
28434
|
-
|
|
28435
|
-
|
|
28436
|
-
|
|
28437
|
-
|
|
28438
|
-
|
|
28439
|
-
|
|
28440
|
-
|
|
28441
|
-
|
|
28442
|
-
|
|
28443
|
-
|
|
28444
|
-
|
|
28445
|
-
|
|
28446
|
-
|
|
28447
|
-
|
|
28448
|
-
|
|
28449
|
-
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28453
|
-
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
|
|
28457
|
-
|
|
28458
|
-
|
|
28459
|
-
|
|
28460
|
-
|
|
28461
|
-
|
|
28462
|
-
|
|
28463
|
-
|
|
28464
|
-
|
|
28465
|
-
|
|
28466
|
-
|
|
28467
|
-
|
|
28468
|
-
|
|
28469
|
-
|
|
28470
|
-
|
|
28471
|
-
|
|
28472
|
-
|
|
28473
|
-
|
|
28474
|
-
|
|
28475
|
-
|
|
28476
|
-
|
|
28477
|
-
|
|
28478
|
-
|
|
28479
|
-
|
|
28480
|
-
moveBoundaryEnabled = (_objectTransformerCon46 = objectTransformerConfig.moveBoundaryEnabled) !== null && _objectTransformerCon46 !== void 0 ? _objectTransformerCon46 : moveBoundaryEnabled;
|
|
28745
|
+
isCropper = objectTransformerConfig.isCropper ?? isCropper;
|
|
28746
|
+
hoverEnabled = objectTransformerConfig.hoverEnabled ?? hoverEnabled;
|
|
28747
|
+
hoverEnterFunc = objectTransformerConfig.hoverEnterFunc ?? hoverEnterFunc;
|
|
28748
|
+
hoverLeaveFunc = objectTransformerConfig.hoverLeaveFunc ?? hoverLeaveFunc;
|
|
28749
|
+
resizeEnabled = objectTransformerConfig.resizeEnabled ?? resizeEnabled;
|
|
28750
|
+
rotateEnabled = objectTransformerConfig.rotateEnabled ?? rotateEnabled;
|
|
28751
|
+
rotationSnaps = objectTransformerConfig.rotationSnaps ?? rotationSnaps;
|
|
28752
|
+
rotationSnapTolerance = objectTransformerConfig.rotationSnapTolerance ?? rotationSnapTolerance;
|
|
28753
|
+
rotateAnchorOffset = objectTransformerConfig.rotateAnchorOffset ?? rotateAnchorOffset;
|
|
28754
|
+
rotateAnchorPosition = objectTransformerConfig.rotateAnchorPosition ?? rotateAnchorPosition;
|
|
28755
|
+
rotateLineEnabled = objectTransformerConfig.rotateLineEnabled ?? rotateLineEnabled;
|
|
28756
|
+
rotateSize = objectTransformerConfig.rotateSize ?? rotateSize;
|
|
28757
|
+
rotateCornerRadius = objectTransformerConfig.rotateCornerRadius ?? rotateCornerRadius;
|
|
28758
|
+
rotateFill = objectTransformerConfig.rotateFill ?? rotateFill;
|
|
28759
|
+
rotateStroke = objectTransformerConfig.rotateStroke ?? rotateStroke;
|
|
28760
|
+
rotateStrokeWidth = objectTransformerConfig.rotateStrokeWidth ?? rotateStrokeWidth;
|
|
28761
|
+
rotateIconEnabled = objectTransformerConfig.rotateIconEnabled ?? rotateIconEnabled;
|
|
28762
|
+
rotateIconStroke = objectTransformerConfig.rotateIconStroke ?? rotateIconStroke;
|
|
28763
|
+
rotateIconStrokeWidth = objectTransformerConfig.rotateIconStrokeWidth ?? rotateIconStrokeWidth;
|
|
28764
|
+
borderEnabled = objectTransformerConfig.borderEnabled ?? borderEnabled;
|
|
28765
|
+
borderStroke = objectTransformerConfig.borderStroke ?? borderStroke;
|
|
28766
|
+
borderStrokeWidth = objectTransformerConfig.borderStrokeWidth ?? borderStrokeWidth;
|
|
28767
|
+
borderDash = objectTransformerConfig.borderDash ?? borderDash;
|
|
28768
|
+
borderSpacing = objectTransformerConfig.borderSpacing ?? borderSpacing;
|
|
28769
|
+
anchorFill = objectTransformerConfig.anchorFill ?? anchorFill;
|
|
28770
|
+
anchorStroke = objectTransformerConfig.anchorStroke ?? anchorStroke;
|
|
28771
|
+
anchorStrokeWidth = objectTransformerConfig.anchorStrokeWidth ?? anchorStrokeWidth;
|
|
28772
|
+
anchorSize = objectTransformerConfig.anchorSize ?? anchorSize;
|
|
28773
|
+
anchorCornerRadius = objectTransformerConfig.anchorCornerRadius ?? anchorCornerRadius;
|
|
28774
|
+
anchorStyle = objectTransformerConfig.anchorStyle ?? anchorStyle;
|
|
28775
|
+
anchorSideLongSize = objectTransformerConfig.anchorSideLongSize ?? anchorSideLongSize;
|
|
28776
|
+
anchorSideShortSize = objectTransformerConfig.anchorSideShortSize ?? anchorSideShortSize;
|
|
28777
|
+
anchorSideCornerRadius = objectTransformerConfig.anchorSideCornerRadius ?? anchorSideCornerRadius;
|
|
28778
|
+
anchorShadowColor = objectTransformerConfig.anchorShadowColor ?? anchorShadowColor;
|
|
28779
|
+
anchorShadowBlur = objectTransformerConfig.anchorShadowBlur ?? anchorShadowBlur;
|
|
28780
|
+
anchorShadowOffsetX = objectTransformerConfig.anchorShadowOffsetX ?? anchorShadowOffsetX;
|
|
28781
|
+
anchorShadowOffsetY = objectTransformerConfig.anchorShadowOffsetY ?? anchorShadowOffsetY;
|
|
28782
|
+
keepRatio = objectTransformerConfig.keepRatio ?? keepRatio;
|
|
28783
|
+
centeredScaling = objectTransformerConfig.centeredScaling ?? centeredScaling;
|
|
28784
|
+
enabledAnchors = objectTransformerConfig.enabledAnchors ?? enabledAnchors;
|
|
28785
|
+
flipEnabled = objectTransformerConfig.flipEnabled ?? flipEnabled;
|
|
28786
|
+
ignoreStroke = objectTransformerConfig.ignoreStroke ?? ignoreStroke;
|
|
28787
|
+
boundBoxFunc = objectTransformerConfig.boundBoxFunc ?? boundBoxFunc;
|
|
28788
|
+
useSingleNodeRotation = objectTransformerConfig.useSingleNodeRotation ?? useSingleNodeRotation;
|
|
28789
|
+
shouldOverdrawWholeArea = objectTransformerConfig.shouldOverdrawWholeArea ?? shouldOverdrawWholeArea;
|
|
28790
|
+
moveBoundaryEnabled = objectTransformerConfig.moveBoundaryEnabled ?? moveBoundaryEnabled;
|
|
28481
28791
|
}
|
|
28482
28792
|
return {
|
|
28483
28793
|
isCropper,
|
|
@@ -29162,7 +29472,7 @@ var Transformer = class extends Disposable {
|
|
|
29162
29472
|
width: iconSize,
|
|
29163
29473
|
height: iconSize,
|
|
29164
29474
|
fill: null,
|
|
29165
|
-
stroke: rotateIconStroke
|
|
29475
|
+
stroke: rotateIconStroke ?? borderStroke,
|
|
29166
29476
|
strokeWidth: rotateIconStrokeWidth,
|
|
29167
29477
|
strokeLineCap: "round",
|
|
29168
29478
|
strokeLineJoin: "round"
|
|
@@ -29577,7 +29887,7 @@ var Transformer = class extends Disposable {
|
|
|
29577
29887
|
endY: lineTop + rotateAnchorOffset,
|
|
29578
29888
|
strokeWidth: borderStrokeWidth,
|
|
29579
29889
|
strokeLineCap: "butt",
|
|
29580
|
-
stroke: rotateStroke
|
|
29890
|
+
stroke: rotateStroke ?? borderStroke
|
|
29581
29891
|
});
|
|
29582
29892
|
const { left: rotateLeft, top: rotateTop } = this._getRotateAnchorPosition("__SpreadsheetTransformerRotate__", height, width, applyObject);
|
|
29583
29893
|
const cursor = this._getRotateAnchorCursor("__SpreadsheetTransformerRotate__");
|
|
@@ -29589,8 +29899,8 @@ var Transformer = class extends Disposable {
|
|
|
29589
29899
|
width: rotateSize,
|
|
29590
29900
|
radius: rotateCornerRadius,
|
|
29591
29901
|
fill: rotateFill,
|
|
29592
|
-
strokeWidth: rotateStrokeWidth
|
|
29593
|
-
stroke: rotateStroke
|
|
29902
|
+
strokeWidth: rotateStrokeWidth ?? borderStrokeWidth * 2,
|
|
29903
|
+
stroke: rotateStroke ?? borderStroke,
|
|
29594
29904
|
shadowColor: anchorShadowColor,
|
|
29595
29905
|
shadowBlur: anchorShadowBlur,
|
|
29596
29906
|
shadowOffsetX: anchorShadowOffsetX,
|
|
@@ -30554,7 +30864,7 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
30554
30864
|
return this._renderContext.components;
|
|
30555
30865
|
}
|
|
30556
30866
|
constructor(init, parentInjector) {
|
|
30557
|
-
var _init$createUnitOptio, _init$createUnitOptio2
|
|
30867
|
+
var _init$createUnitOptio, _init$createUnitOptio2;
|
|
30558
30868
|
super();
|
|
30559
30869
|
_defineProperty(this, "isRenderUnit", true);
|
|
30560
30870
|
_defineProperty(this, "_activated$", new BehaviorSubject(true));
|
|
@@ -30562,7 +30872,7 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
30562
30872
|
_defineProperty(this, "_injector", void 0);
|
|
30563
30873
|
_defineProperty(this, "_renderContext", void 0);
|
|
30564
30874
|
_defineProperty(this, "_dependencyService", void 0);
|
|
30565
|
-
const renderParentInjector = (_init$createUnitOptio =
|
|
30875
|
+
const renderParentInjector = ((_init$createUnitOptio = init.createUnitOptions) === null || _init$createUnitOptio === void 0 ? void 0 : _init$createUnitOptio.renderParentInjector) ?? parentInjector;
|
|
30566
30876
|
this._injector = renderParentInjector.createChild();
|
|
30567
30877
|
this._dependencyService = new RenderUnitDependencyService(this._injector, () => this._renderContext);
|
|
30568
30878
|
this._renderContext = {
|
|
@@ -30578,7 +30888,7 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
30578
30888
|
activate: () => this._activated$.next(true),
|
|
30579
30889
|
deactivate: () => this._activated$.next(false)
|
|
30580
30890
|
};
|
|
30581
|
-
if (((_init$
|
|
30891
|
+
if (((_init$createUnitOptio2 = init.createUnitOptions) === null || _init$createUnitOptio2 === void 0 ? void 0 : _init$createUnitOptio2.makeCurrent) === false) this.deactivate();
|
|
30582
30892
|
}
|
|
30583
30893
|
dispose() {
|
|
30584
30894
|
if (this._disposed) return;
|
|
@@ -30638,8 +30948,7 @@ var RenderUnitDependencyService = class {
|
|
|
30638
30948
|
dependencies.forEach((dependency) => {
|
|
30639
30949
|
const parsed = this._parseDependency(dependency);
|
|
30640
30950
|
const key = getRenderDependencyIdentifierKey$1(parsed.identifier);
|
|
30641
|
-
const
|
|
30642
|
-
const record = existing !== null && existing !== void 0 ? existing : this._addRecord(key, parsed.identifier, parsed.create);
|
|
30951
|
+
const record = this._records.get(key) ?? this._addRecord(key, parsed.identifier, parsed.create);
|
|
30643
30952
|
if (seen.has(record.key)) return;
|
|
30644
30953
|
seen.add(record.key);
|
|
30645
30954
|
records.push(record);
|
|
@@ -30768,8 +31077,7 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
30768
31077
|
* @returns Dependency[]
|
|
30769
31078
|
*/
|
|
30770
31079
|
_getRenderDepsByType(type) {
|
|
30771
|
-
|
|
30772
|
-
return Array.from((_this$_renderDependen = this._renderDependencies.get(type)) !== null && _this$_renderDependen !== void 0 ? _this$_renderDependen : []);
|
|
31080
|
+
return Array.from(this._renderDependencies.get(type) ?? []);
|
|
30773
31081
|
}
|
|
30774
31082
|
_initDarkModeListener() {
|
|
30775
31083
|
this.disposeWithMe(this._themeService.darkMode$.subscribe(() => {
|
|
@@ -30787,8 +31095,7 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
30787
31095
|
* @returns renderUnit:IRender
|
|
30788
31096
|
*/
|
|
30789
31097
|
createRender(unitId, createUnitOptions) {
|
|
30790
|
-
|
|
30791
|
-
const parentInjector = (_createUnitOptions$re = createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.renderParentInjector) !== null && _createUnitOptions$re !== void 0 ? _createUnitOptions$re : this._injector;
|
|
31098
|
+
const parentInjector = (createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.renderParentInjector) ?? this._injector;
|
|
30792
31099
|
const renderer = this._createRender(unitId, parentInjector.createInstance(Engine, unitId, void 0), (createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.embeddedRender) !== true, createUnitOptions, parentInjector);
|
|
30793
31100
|
this._renderCreated$.next(renderer);
|
|
30794
31101
|
return renderer;
|
|
@@ -31686,18 +31993,18 @@ var Viewport = class {
|
|
|
31686
31993
|
this._scene.removeViewport(this._viewportKey);
|
|
31687
31994
|
}
|
|
31688
31995
|
limitedScroll(scrollX, scrollY) {
|
|
31689
|
-
var
|
|
31996
|
+
var _this$_scrollBar2, _this$_scrollBar3;
|
|
31690
31997
|
if (!this._scrollBar) return {
|
|
31691
31998
|
scrollX: 0,
|
|
31692
31999
|
scrollY: 0,
|
|
31693
32000
|
isLimitedX: false,
|
|
31694
32001
|
isLimitedY: false
|
|
31695
32002
|
};
|
|
31696
|
-
scrollX =
|
|
31697
|
-
scrollY =
|
|
32003
|
+
scrollX = scrollX ?? this.scrollX;
|
|
32004
|
+
scrollY = scrollY ?? this.scrollY;
|
|
31698
32005
|
const { height, width } = this._calcViewPortSize();
|
|
31699
|
-
if (this._sceneWCurrVpAfterScale
|
|
31700
|
-
if (this._sceneHCurrVpAfterScale
|
|
32006
|
+
if (!hasScrollableOverflow(this._sceneWCurrVpAfterScale, width)) scrollX = 0;
|
|
32007
|
+
if (!hasScrollableOverflow(this._sceneHCurrVpAfterScale, height)) scrollY = 0;
|
|
31701
32008
|
const limitX = (_this$_scrollBar2 = this._scrollBar) === null || _this$_scrollBar2 === void 0 ? void 0 : _this$_scrollBar2.limitX;
|
|
31702
32009
|
const limitY = (_this$_scrollBar3 = this._scrollBar) === null || _this$_scrollBar3 === void 0 ? void 0 : _this$_scrollBar3.limitY;
|
|
31703
32010
|
let isLimitedX = false;
|
|
@@ -31719,13 +32026,13 @@ var Viewport = class {
|
|
|
31719
32026
|
* @param viewportScrollY
|
|
31720
32027
|
*/
|
|
31721
32028
|
_limitViewportScroll(viewportScrollX, viewportScrollY) {
|
|
31722
|
-
var _this$getScrollBar
|
|
32029
|
+
var _this$getScrollBar;
|
|
31723
32030
|
const { width, height } = this._calcViewPortSize();
|
|
31724
32031
|
const freezeHeight = this._paddingEndY - this._paddingStartY;
|
|
31725
32032
|
const freezeWidth = this._paddingEndX - this._paddingStartX;
|
|
31726
32033
|
const scaleY = this.scene.scaleY;
|
|
31727
32034
|
const scaleX = this.scene.scaleX;
|
|
31728
|
-
const scrollBarThicknessTotalSize = (
|
|
32035
|
+
const scrollBarThicknessTotalSize = ((_this$getScrollBar = this.getScrollBar()) === null || _this$getScrollBar === void 0 ? void 0 : _this$getScrollBar.totalSize) ?? 0;
|
|
31729
32036
|
const maxViewportScrollX = this._sceneWidthAfterScale - this._marginLeft * scaleX - freezeWidth * scaleX - width + scrollBarThicknessTotalSize;
|
|
31730
32037
|
const maxViewportScrollY = this._sceneHeightAfterScale - this._marginTop * scaleY - freezeHeight * scaleY - height + scrollBarThicknessTotalSize;
|
|
31731
32038
|
return {
|
|
@@ -31892,10 +32199,10 @@ var Viewport = class {
|
|
|
31892
32199
|
* @param isTrigger
|
|
31893
32200
|
*/
|
|
31894
32201
|
_scrollToViewportPosCore(scrollVpPos, isTrigger = true) {
|
|
31895
|
-
var
|
|
32202
|
+
var _this$_scrollBar11, _this$_scrollBar12, _this$_scrollBar13;
|
|
31896
32203
|
if (this._scrollBar == null) return;
|
|
31897
|
-
let viewportScrollX =
|
|
31898
|
-
let viewportScrollY =
|
|
32204
|
+
let viewportScrollX = scrollVpPos.viewportScrollX ?? this.viewportScrollX;
|
|
32205
|
+
let viewportScrollY = scrollVpPos.viewportScrollY ?? this.viewportScrollY;
|
|
31899
32206
|
const rawScrollXY = this.transViewportScroll2ScrollValue(viewportScrollX, viewportScrollY);
|
|
31900
32207
|
const afterLimitViewportXY = this._limitViewportScroll(viewportScrollX, viewportScrollY);
|
|
31901
32208
|
viewportScrollX = afterLimitViewportXY.viewportScrollX;
|
|
@@ -32029,4 +32336,4 @@ var Viewport = class {
|
|
|
32029
32336
|
};
|
|
32030
32337
|
|
|
32031
32338
|
//#endregion
|
|
32032
|
-
export { BASE_OBJECT_ARRAY, BG_Z_INDEX, BORDER_TYPE, BORDER_Z_INDEX, Background, BaseObject, Border, BreakType, CHECK_OBJECT_ARRAY, CIRCLE_OBJECT_ARRAY, COLOR_BLACK_RGB, CURSOR_TYPE, Canvas, CanvasColorService, CanvasRenderMode, CheckboxShape, Circle, ColumnHeaderLayout, ComponentExtension, Control, Custom, CustomObject, DEFAULT_DOCUMENT_FONTSIZE, DEFAULT_FONTFACE_PLANE, DEFAULT_FRAME_LIST_SIZE, DEFAULT_FRAME_SAMPLE_SIZE, DEFAULT_MEASURE_TEXT, DEFAULT_OFFSET_SPACING, DEFAULT_PADDING_DATA, DEFAULT_SKELETON_FOOTER, DEFAULT_SKELETON_HEADER, DOCUMENT_CONTEXT_CLIP_TYPE, DRAWING_OBJECT_LAYER_INDEX, DRAWING_OBJECT_LOWER_LAYER_INDEX, DRAWING_OBJECT_UPPER_LAYER_INDEX, DashedRect, DataStreamTreeNode, DeviceInputEventType, DeviceType, DocBackground, DocSimpleSkeleton, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, DocumentsSpanAndLineExtensionRegistry, Drawing, DrawingGroupObject, DumbCanvasColorService, EXPAND_SIZE_FOR_RENDER_OVERFLOW, Engine, EventConstants, FIX_ONE_PIXEL_BLUR_OFFSET, FONT_EXTENSION_Z_INDEX, Font, FontCache, GlyphType, Group, HitCanvas, ICanvasColorService, INITIAL_MATRIX, INITIAL_Path2, IRenderManagerService, IWatermarkTypeEnum, Image$1 as Image, IsSafari, LINK_VIEW_PORT_TYPE, Layer, Line, LineType, Liquid, MAIN_VIEW_PORT_KEY, MAXIMUM_COL_WIDTH, MAXIMUM_ROW_HEIGHT, MEASURE_EXTENT, MEASURE_EXTENT_FOR_PARAGRAPH, MIDDLE_CELL_POS_MAGIC_NUMBER, MIN_COL_WIDTH, Marker, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ORIENTATION_TYPE, ObjectType, PATH_OBJECT_ARRAY, PRINTING_BG_Z_INDEX, PageLayoutType, Path, Path2, PerformanceMonitor, PointerInput, RECT_OBJECT_ARRAY, REGULAR_POLYGON_OBJECT_ARRAY, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, RICHTEXT_OBJECT_ARRAY, Rect, RegularPolygon, RenderComponent, RenderManagerService, RenderUnit, RichText, RollingAverage, RowHeaderLayout, SHAPE_OBJECT_ARRAY, SHAPE_TYPE, SHEET_EXTENSION_PREFIX, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SLIDE_NAVIGATION_KEY, Scene, SceneCanvas, SceneViewer, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetColumnHeaderExtensionRegistry, SheetComponent, SheetExtension, SheetRowHeaderExtensionRegistry, ShowGridlinesState, SkeletonType, Slide, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetExtensionRegistry, SpreadsheetHeader, SpreadsheetRowHeader, SpreadsheetSkeleton, TEXT_OBJECT_ARRAY, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Text, Transform, UNIVER_WATERMARK_LAYER_INDEX, UNIVER_WATERMARK_STORAGE_KEY, UniverPrintingContext, UniverRenderEnginePlugin, UniverRenderingContext, UniverRenderingContext2D, VERTICAL_ROTATE_ANGLE, Vector2, Viewport, WatermarkLayer, calculateRectRotate, cancelRequestFrame, checkStyle, cjk, clampRange, clearLineByBorderType, combineDrawingEffectFilter, compareDocumentSkeletonNestedPagePathOrder, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, createCanvasElement, createDrawingEffectFilter, createImageElement, degToRad, documentSkeletonLineIterator, documentSkeletonTableIterator, drawDiagonalLineByBorderType, drawLineByBorderType, expandDrawingEffectBounds, expandRangeIfIntersects, fixLineWidthByScale, generateRandomKey, getCellPositionByIndex, getCharSpaceApply, getColor, getCurrentScrollXY, getCurrentTypeOfRenderer, getDPI, getDevicePixelRatio, getDocsCustomBlockRenderViewport, getDocsSkeletonPageSize, getDocsTableRenderViewport, getDocsTableViewportLeft, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getDrawingGroupState, getFirstGrapheme, getFontStyleString, getGroupState, getLastColumn, getLastLine, getLineOffset, getLineWidth, getLineWith, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getPointerPrefix, getRenderTransformBaseOnParentBound, getRotateOffsetAndFarthestHypotenuse, getRotateOrientation, getRotatedBoundInGroup, getScale, getShrinkToFitScale, getSizeForDom, getSystemHighlightColor, getTableIdAndSliceIndex, getTranslateInSpreadContextWithPixelRatio, getValueType, glyphIterator, hasAllLatin, hasArabic, hasBasicLatin, hasLatinExtendedA, hasLatinExtendedB, hasLatinOneSupplement, hasListGlyph, hasSpace, hasThai, hasTibetan, inViewRanges, injectStyle, isArray, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, isDate, isEmojiGrapheme, isFirstGlyph, isFunction, isIndentByGlyph, isLastGlyph, isNumber, isObject, isPlaceholderOrSpace, isRectIntersect, isRegExp, isSameLine, isString, lineIterator, measureDocumentNoWrapTextRangeWidth, measureDocumentNoWrapTextWidth, measureDocumentUnbreakableTextWidth, mergeInfoOffset, parseDataStreamToTree, pixelToPt, precisionTo, ptToMM, ptToPixel, ptToPx, pxToInch, pxToNum, pxToPt, radToDeg, renderImageWatermark, renderTextWatermark, renderUserInfoWatermark, renderWatermark, requestNewFrame, resolveDrawingEffectMasks, resolveGlowEffect, resolveOuterShadowEffect, scaleDocumentDataForShrinkToFit, setDocsCustomBlockRenderViewportProvider, setDocsTableRenderViewportProvider, setLineType, sheetContentViewportKeys, sheetHeaderViewportKeys, startWithEmoji, toPx, transformObjectOutOfGroup, withCurrentTypeOfRenderer };
|
|
32339
|
+
export { AlignmentSnapSession, BASE_OBJECT_ARRAY, BG_Z_INDEX, BORDER_TYPE, BORDER_Z_INDEX, Background, BaseObject, Border, BreakType, CHECK_OBJECT_ARRAY, CIRCLE_OBJECT_ARRAY, COLOR_BLACK_RGB, CURSOR_TYPE, Canvas, CanvasColorService, CanvasRenderMode, CheckboxShape, Circle, ColumnHeaderLayout, ComponentExtension, Control, Custom, CustomObject, DEFAULT_DOCUMENT_FONTSIZE, DEFAULT_FONTFACE_PLANE, DEFAULT_FRAME_LIST_SIZE, DEFAULT_FRAME_SAMPLE_SIZE, DEFAULT_MEASURE_TEXT, DEFAULT_OFFSET_SPACING, DEFAULT_PADDING_DATA, DEFAULT_SKELETON_FOOTER, DEFAULT_SKELETON_HEADER, DOCUMENT_CONTEXT_CLIP_TYPE, DRAWING_OBJECT_LAYER_INDEX, DRAWING_OBJECT_LOWER_LAYER_INDEX, DRAWING_OBJECT_UPPER_LAYER_INDEX, DashedRect, DataStreamTreeNode, DeviceInputEventType, DeviceType, DocBackground, DocSimpleSkeleton, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, DocumentsSpanAndLineExtensionRegistry, Drawing, DrawingGroupObject, DumbCanvasColorService, EXPAND_SIZE_FOR_RENDER_OVERFLOW, Engine, EventConstants, FIX_ONE_PIXEL_BLUR_OFFSET, FONT_EXTENSION_Z_INDEX, Font, FontCache, GlyphType, Group, HitCanvas, ICanvasColorService, INITIAL_MATRIX, INITIAL_Path2, IRenderManagerService, IWatermarkTypeEnum, Image$1 as Image, IsSafari, LINK_VIEW_PORT_TYPE, Layer, Line, LineType, Liquid, MAIN_VIEW_PORT_KEY, MAXIMUM_COL_WIDTH, MAXIMUM_ROW_HEIGHT, MEASURE_EXTENT, MEASURE_EXTENT_FOR_PARAGRAPH, MIDDLE_CELL_POS_MAGIC_NUMBER, MIN_COL_WIDTH, Marker, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ORIENTATION_TYPE, ObjectType, PATH_OBJECT_ARRAY, PRINTING_BG_Z_INDEX, PageLayoutType, Path, Path2, PerformanceMonitor, PointerInput, RECT_OBJECT_ARRAY, REGULAR_POLYGON_OBJECT_ARRAY, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, RICHTEXT_OBJECT_ARRAY, Rect, RegularPolygon, RenderComponent, RenderManagerService, RenderUnit, RichText, RollingAverage, RowHeaderLayout, SHAPE_OBJECT_ARRAY, SHAPE_TYPE, SHEET_EXTENSION_PREFIX, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SLIDE_NAVIGATION_KEY, Scene, SceneCanvas, SceneViewer, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetColumnHeaderExtensionRegistry, SheetComponent, SheetExtension, SheetRowHeaderExtensionRegistry, ShowGridlinesState, SkeletonType, Slide, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetExtensionRegistry, SpreadsheetHeader, SpreadsheetRowHeader, SpreadsheetSkeleton, TEXT_OBJECT_ARRAY, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Text, Transform, UNIVER_WATERMARK_LAYER_INDEX, UNIVER_WATERMARK_STORAGE_KEY, UniverPrintingContext, UniverRenderEnginePlugin, UniverRenderingContext, UniverRenderingContext2D, VERTICAL_ROTATE_ANGLE, Vector2, Viewport, WatermarkLayer, calculateCellImageRect, calculateRectRotate, cancelRequestFrame, checkStyle, cjk, clampRange, clearLineByBorderType, combineDrawingEffectFilter, compareDocumentSkeletonNestedPagePathOrder, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, createCanvasElement, createDrawingEffectFilter, createImageElement, degToRad, documentSkeletonLineIterator, documentSkeletonTableIterator, drawDiagonalLineByBorderType, drawLineByBorderType, expandDrawingEffectBounds, expandRangeIfIntersects, fixLineWidthByScale, generateRandomKey, getAlignmentRectXAnchors, getAlignmentRectYAnchors, getCellPositionByIndex, getCharSpaceApply, getClosestAlignmentOffset, getColor, getCurrentScrollXY, getCurrentTypeOfRenderer, getDPI, getDevicePixelRatio, getDocsCustomBlockRenderViewport, getDocsSkeletonPageSize, getDocsTableRenderViewport, getDocsTableViewportLeft, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getDrawingGroupState, getFirstGrapheme, getFontStyleString, getGeneralNumberDisplayText, getGroupState, getLastColumn, getLastLine, getLineOffset, getLineWidth, getLineWith, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getPointerPrefix, getRenderTransformBaseOnParentBound, getRotateOffsetAndFarthestHypotenuse, getRotateOrientation, getRotatedBoundInGroup, getScale, getShrinkToFitScale, getSizeForDom, getSystemHighlightColor, getTableIdAndSliceIndex, getTranslateInSpreadContextWithPixelRatio, getValueType, glyphIterator, hasAllLatin, hasArabic, hasBasicLatin, hasLatinExtendedA, hasLatinExtendedB, hasLatinOneSupplement, hasListGlyph, hasScrollableOverflow, hasSpace, hasThai, hasTibetan, inViewRanges, injectStyle, isArray, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, isDate, isEmojiGrapheme, isFirstGlyph, isFunction, isIndentByGlyph, isLastGlyph, isNumber, isObject, isPlaceholderOrSpace, isRectIntersect, isRegExp, isSameLine, isString, lineIterator, measureDocumentNoWrapTextRangeWidth, measureDocumentNoWrapTextWidth, measureDocumentUnbreakableTextWidth, measureDocumentWrappedTextWidth, mergeInfoOffset, normalizeAlignmentRect, parseDataStreamToTree, pixelToPt, precisionTo, ptToMM, ptToPixel, ptToPx, pxToInch, pxToNum, pxToPt, radToDeg, renderImageWatermark, renderTextWatermark, renderUserInfoWatermark, renderWatermark, requestNewFrame, resolveDrawingEffectMasks, resolveGlowEffect, resolveOuterShadowEffect, scaleDocumentDataForShrinkToFit, setDocsCustomBlockRenderViewportProvider, setDocsTableRenderViewportProvider, setLineType, sheetContentViewportKeys, sheetHeaderViewportKeys, startWithEmoji, toPx, transformObjectOutOfGroup, withCurrentTypeOfRenderer };
|