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