@univerjs/engine-render 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +1444 -372
- package/lib/es/index.js +1440 -347
- package/lib/types/basics/cjk-regexp.d.ts +61 -0
- package/lib/types/basics/const.d.ts +4 -0
- package/lib/types/basics/draw.d.ts +4 -4
- package/lib/types/basics/i-document-skeleton-cached.d.ts +10 -0
- package/lib/types/basics/index.d.ts +2 -0
- package/lib/types/basics/interfaces.d.ts +3 -1
- package/lib/types/basics/tools.d.ts +0 -3
- package/lib/types/components/docs/custom-block-render-viewport.d.ts +37 -0
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +3 -1
- package/lib/types/components/docs/layout/doc-no-wrap-measure.d.ts +35 -0
- package/lib/types/components/docs/layout/tools.d.ts +5 -1
- package/lib/types/components/docs/view-model/document-view-model.d.ts +2 -1
- package/lib/types/components/extension.d.ts +2 -0
- package/lib/types/components/sheets/extensions/background.d.ts +2 -1
- package/lib/types/components/sheets/extensions/font.d.ts +2 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +5 -0
- package/lib/types/components/sheets/interfaces.d.ts +3 -0
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +14 -9
- package/lib/types/index.d.ts +3 -0
- package/lib/types/render-manager/render-manager.service.d.ts +1 -1
- package/lib/types/render-manager/render-unit.d.ts +3 -0
- package/lib/types/shape/scroll-bar.d.ts +8 -0
- package/lib/types/shape/text.d.ts +4 -0
- package/lib/types/viewport.d.ts +7 -1
- package/lib/umd/index.js +5 -2
- package/package.json +4 -5
package/lib/cjs/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
4
|
var __exportAll = (all, no_symbols) => {
|
|
10
5
|
let target = {};
|
|
11
6
|
for (var name in all) {
|
|
@@ -19,29 +14,9 @@ var __exportAll = (all, no_symbols) => {
|
|
|
19
14
|
}
|
|
20
15
|
return target;
|
|
21
16
|
};
|
|
22
|
-
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
24
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
25
|
-
key = keys[i];
|
|
26
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
27
|
-
__defProp(to, key, {
|
|
28
|
-
get: ((k) => from[k]).bind(null, key),
|
|
29
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return to;
|
|
35
|
-
};
|
|
36
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
37
|
-
value: mod,
|
|
38
|
-
enumerable: true
|
|
39
|
-
}) : target, mod));
|
|
40
17
|
|
|
41
18
|
//#endregion
|
|
42
19
|
let _univerjs_core = require("@univerjs/core");
|
|
43
|
-
let cjk_regex = require("cjk-regex");
|
|
44
|
-
cjk_regex = __toESM(cjk_regex);
|
|
45
20
|
let rxjs = require("rxjs");
|
|
46
21
|
let opentype_js = require("opentype.js");
|
|
47
22
|
let franc_min = require("franc-min");
|
|
@@ -114,6 +89,10 @@ let CURSOR_TYPE = /* @__PURE__ */ function(CURSOR_TYPE) {
|
|
|
114
89
|
CURSOR_TYPE["SOUTH_WEST_RESIZE"] = "sw-resize";
|
|
115
90
|
CURSOR_TYPE["SOUTH_RESIZE"] = "s-resize";
|
|
116
91
|
CURSOR_TYPE["WEST_RESIZE"] = "w-resize";
|
|
92
|
+
CURSOR_TYPE["EAST_WEST_RESIZE"] = "ew-resize";
|
|
93
|
+
CURSOR_TYPE["NORTH_SOUTH_RESIZE"] = "ns-resize";
|
|
94
|
+
CURSOR_TYPE["NORTH_EAST_SOUTH_WEST_RESIZE"] = "nesw-resize";
|
|
95
|
+
CURSOR_TYPE["NORTH_WEST_SOUTH_EAST_RESIZE"] = "nwse-resize";
|
|
117
96
|
CURSOR_TYPE["TEXT"] = "text";
|
|
118
97
|
CURSOR_TYPE["WAIT"] = "wait";
|
|
119
98
|
CURSOR_TYPE["HELP"] = "help";
|
|
@@ -228,6 +207,7 @@ const cancelRequestFrame = (requestID, requester) => {
|
|
|
228
207
|
};
|
|
229
208
|
const createCanvasElement = () => {
|
|
230
209
|
const canvas = document.createElement("canvas");
|
|
210
|
+
canvas.dir = "ltr";
|
|
231
211
|
try {
|
|
232
212
|
canvas.style = canvas.style || {};
|
|
233
213
|
} catch (e) {
|
|
@@ -319,7 +299,7 @@ function getFontStyleString(textStyle) {
|
|
|
319
299
|
let bold = _univerjs_core.FontStyleType.BOLD;
|
|
320
300
|
if (textStyle.bl === 0 || textStyle.bl === void 0) bold = _univerjs_core.FontStyleType.NORMAL;
|
|
321
301
|
let originFontSize = defaultFontSize;
|
|
322
|
-
if (textStyle.fs) originFontSize =
|
|
302
|
+
if (textStyle.fs) originFontSize = textStyle.fs;
|
|
323
303
|
let fontSize = originFontSize;
|
|
324
304
|
const fontFamilyResult = normalizeFontFamily(textStyle.ff, defaultFont);
|
|
325
305
|
const { va: baselineOffset } = textStyle;
|
|
@@ -343,18 +323,6 @@ function normalizeFontFamily(fontFamily, defaultFont) {
|
|
|
343
323
|
return family.includes(" ") ? `"${family}"` : family;
|
|
344
324
|
}).filter(Boolean).join(", ");
|
|
345
325
|
}
|
|
346
|
-
const CJK_LETTER_REG = cjk_regex.letters().toRegExp();
|
|
347
|
-
function hasCJKText(text) {
|
|
348
|
-
return CJK_LETTER_REG.test(text);
|
|
349
|
-
}
|
|
350
|
-
const CJK_ALL_REG = cjk_regex.all().toRegExp();
|
|
351
|
-
function hasCJK(text) {
|
|
352
|
-
return CJK_ALL_REG.test(text);
|
|
353
|
-
}
|
|
354
|
-
const CJK_PUNCTUATION_REG = cjk_regex.punctuations().toRegExp();
|
|
355
|
-
function hasCJKPunctuation(text) {
|
|
356
|
-
return CJK_PUNCTUATION_REG.test(text);
|
|
357
|
-
}
|
|
358
326
|
function hasAllLatin(text) {
|
|
359
327
|
if (!/[\u0000-\u024F]/gi.exec(text)) return false;
|
|
360
328
|
return true;
|
|
@@ -943,6 +911,220 @@ _defineProperty(FontCache, "_context", void 0);
|
|
|
943
911
|
_defineProperty(FontCache, "_fontDataMap", /* @__PURE__ */ new Map());
|
|
944
912
|
_defineProperty(FontCache, "_globalFontMeasureCache", /* @__PURE__ */ new Map());
|
|
945
913
|
|
|
914
|
+
//#endregion
|
|
915
|
+
//#region src/basics/cjk-regexp.ts
|
|
916
|
+
/**
|
|
917
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
918
|
+
*
|
|
919
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
920
|
+
* you may not use this file except in compliance with the License.
|
|
921
|
+
* You may obtain a copy of the License at
|
|
922
|
+
*
|
|
923
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
924
|
+
*
|
|
925
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
926
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
927
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
928
|
+
* See the License for the specific language governing permissions and
|
|
929
|
+
* limitations under the License.
|
|
930
|
+
*/
|
|
931
|
+
/**
|
|
932
|
+
* Golden regex sources generated from `cjk-regex@3.4.0`.
|
|
933
|
+
*
|
|
934
|
+
* Keep these strings stable unless intentionally upgrading cjk-regex semantics. The tests
|
|
935
|
+
* assert exact source equality so document CJK layout behavior does not drift through
|
|
936
|
+
* manual range edits.
|
|
937
|
+
*/
|
|
938
|
+
const CJK_LETTER_SOURCE = String.raw`[\u1100-\u11ff\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u3005\u3007\u3021-\u3029\u3038-\u303b\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fd-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u321e\u3260-\u327e\u32d0-\u32fe\u3300-\u3357\u3400-\u4dbf\u4e00-\u9fff\ua960-\ua97c\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\uff66-\uff6f\uff71-\uff9d\uffa0-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]|[\ud840-\ud868\ud86a-\ud86d\ud86f-\ud872\ud874-\ud879\ud880-\ud883\ud885-\ud88c][\udc00-\udfff]|\ud81b[\udfe3\udff2-\udff6]|\ud82b[\udff0-\udff3\udff5-\udffb\udffd-\udffe]|\ud82c[\udc00-\udd22\udd32\udd50-\udd52\udd55\udd64-\udd67]|\ud83c[\ude00]|\ud869[\udc00-\udedf\udf00-\udfff]|\ud86e[\udc00-\udc1d\udc20-\udfff]|\ud873[\udc00-\udead\udeb0-\udfff]|\ud87a[\udc00-\udfe0\udff0-\udfff]|\ud87b[\udc00-\ude5d]|\ud87e[\udc00-\ude1d]|\ud884[\udc00-\udf4a\udf50-\udfff]|\ud88d[\udc00-\udc79]`;
|
|
939
|
+
const CJK_PUNCTUATION_SOURCE = String.raw`[\u2ff0-\u3004\u3006\u3008-\u3020\u302a-\u3037\u303c-\u303f\u30a0\u30fb-\u30fc\u3190-\u319f\u31c0-\u31ef\u321f-\u325f\u327f-\u32cf\u32ff\u3358-\u33ff\ufe10-\ufe1f\ufe30-\ufe6f\uff00-\uff65\uff70\uff9e-\uff9f\uffbf-\uffc1\uffc8-\uffc9\uffd0-\uffd1\uffd8-\uffd9\uffdd-\uffef]`;
|
|
940
|
+
const CJK_ALL_SOURCE = String.raw`[\u1100-\u11ff\u2e80-\u2e99\u2e9b-\u2ef3\u2f00-\u2fd5\u2ff0-\u303f\u3041-\u3096\u309d-\u30ff\u3105-\u312f\u3131-\u318e\u3190-\u4dbf\u4e00-\u9fff\ua960-\ua97c\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufe10-\ufe1f\ufe30-\ufe6f\uff00-\uffef]|[\ud840-\ud868\ud86a-\ud86d\ud86f-\ud872\ud874-\ud879\ud880-\ud883\ud885-\ud88c][\udc00-\udfff]|\ud81b[\udfe3\udff2-\udff6]|\ud82b[\udff0-\udff3\udff5-\udffb\udffd-\udffe]|\ud82c[\udc00-\udd22\udd32\udd50-\udd52\udd55\udd64-\udd67]|\ud83c[\ude00]|\ud869[\udc00-\udedf\udf00-\udfff]|\ud86e[\udc00-\udc1d\udc20-\udfff]|\ud873[\udc00-\udead\udeb0-\udfff]|\ud87a[\udc00-\udfe0\udff0-\udfff]|\ud87b[\udc00-\ude5d]|\ud87e[\udc00-\ude1d]|\ud884[\udc00-\udf4a\udf50-\udfff]|\ud88d[\udc00-\udc79]`;
|
|
941
|
+
const CJK_LETTER_REG = new RegExp(CJK_LETTER_SOURCE);
|
|
942
|
+
const CJK_PUNCTUATION_REG = new RegExp(CJK_PUNCTUATION_SOURCE);
|
|
943
|
+
const CJK_ALL_REG = new RegExp(CJK_ALL_SOURCE);
|
|
944
|
+
/**
|
|
945
|
+
* Golden code-point ranges generated from `cjk-regex@3.4.0` snapshots.
|
|
946
|
+
*
|
|
947
|
+
* These are kept alongside the regex sources so compatibility can be checked against
|
|
948
|
+
* both matching behavior and `Charset.data`-style range snapshots.
|
|
949
|
+
*/
|
|
950
|
+
const CJK_LETTER_DATA = [
|
|
951
|
+
[4352, 4607],
|
|
952
|
+
[11904, 11929],
|
|
953
|
+
[11931, 12019],
|
|
954
|
+
[12032, 12245],
|
|
955
|
+
[12293, 12293],
|
|
956
|
+
[12295, 12295],
|
|
957
|
+
[12321, 12329],
|
|
958
|
+
[12344, 12347],
|
|
959
|
+
[12353, 12438],
|
|
960
|
+
[12445, 12447],
|
|
961
|
+
[12449, 12538],
|
|
962
|
+
[12541, 12543],
|
|
963
|
+
[12549, 12591],
|
|
964
|
+
[12593, 12686],
|
|
965
|
+
[12704, 12735],
|
|
966
|
+
[12784, 12830],
|
|
967
|
+
[12896, 12926],
|
|
968
|
+
[13008, 13054],
|
|
969
|
+
[13056, 13143],
|
|
970
|
+
[13312, 19903],
|
|
971
|
+
[19968, 40959],
|
|
972
|
+
[43360, 43388],
|
|
973
|
+
[44032, 55203],
|
|
974
|
+
[55216, 55238],
|
|
975
|
+
[55243, 55291],
|
|
976
|
+
[63744, 64109],
|
|
977
|
+
[64112, 64217],
|
|
978
|
+
[65382, 65391],
|
|
979
|
+
[65393, 65437],
|
|
980
|
+
[65440, 65470],
|
|
981
|
+
[65474, 65479],
|
|
982
|
+
[65482, 65487],
|
|
983
|
+
[65490, 65495],
|
|
984
|
+
[65498, 65500],
|
|
985
|
+
[94179, 94179],
|
|
986
|
+
[94194, 94198],
|
|
987
|
+
[110576, 110579],
|
|
988
|
+
[110581, 110587],
|
|
989
|
+
[110589, 110590],
|
|
990
|
+
[110592, 110882],
|
|
991
|
+
[110898, 110898],
|
|
992
|
+
[110928, 110930],
|
|
993
|
+
[110933, 110933],
|
|
994
|
+
[110948, 110951],
|
|
995
|
+
[127488, 127488],
|
|
996
|
+
[131072, 173791],
|
|
997
|
+
[173824, 178205],
|
|
998
|
+
[178208, 183981],
|
|
999
|
+
[183984, 191456],
|
|
1000
|
+
[191472, 192093],
|
|
1001
|
+
[194560, 195101],
|
|
1002
|
+
[196608, 201546],
|
|
1003
|
+
[201552, 210041]
|
|
1004
|
+
];
|
|
1005
|
+
const CJK_PUNCTUATION_DATA = [
|
|
1006
|
+
[12272, 12292],
|
|
1007
|
+
[12294, 12294],
|
|
1008
|
+
[12296, 12320],
|
|
1009
|
+
[12330, 12343],
|
|
1010
|
+
[12348, 12351],
|
|
1011
|
+
[12448, 12448],
|
|
1012
|
+
[12539, 12540],
|
|
1013
|
+
[12688, 12703],
|
|
1014
|
+
[12736, 12783],
|
|
1015
|
+
[12831, 12895],
|
|
1016
|
+
[12927, 13007],
|
|
1017
|
+
[13055, 13055],
|
|
1018
|
+
[13144, 13311],
|
|
1019
|
+
[65040, 65055],
|
|
1020
|
+
[65072, 65135],
|
|
1021
|
+
[65280, 65381],
|
|
1022
|
+
[65392, 65392],
|
|
1023
|
+
[65438, 65439],
|
|
1024
|
+
[65471, 65473],
|
|
1025
|
+
[65480, 65481],
|
|
1026
|
+
[65488, 65489],
|
|
1027
|
+
[65496, 65497],
|
|
1028
|
+
[65501, 65519]
|
|
1029
|
+
];
|
|
1030
|
+
const CJK_ALL_DATA = [
|
|
1031
|
+
[4352, 4607],
|
|
1032
|
+
[11904, 11929],
|
|
1033
|
+
[11931, 12019],
|
|
1034
|
+
[12032, 12245],
|
|
1035
|
+
[12272, 12351],
|
|
1036
|
+
[12353, 12438],
|
|
1037
|
+
[12445, 12543],
|
|
1038
|
+
[12549, 12591],
|
|
1039
|
+
[12593, 12686],
|
|
1040
|
+
[12688, 19903],
|
|
1041
|
+
[19968, 40959],
|
|
1042
|
+
[43360, 43388],
|
|
1043
|
+
[44032, 55203],
|
|
1044
|
+
[55216, 55238],
|
|
1045
|
+
[55243, 55291],
|
|
1046
|
+
[63744, 64109],
|
|
1047
|
+
[64112, 64217],
|
|
1048
|
+
[65040, 65055],
|
|
1049
|
+
[65072, 65135],
|
|
1050
|
+
[65280, 65519],
|
|
1051
|
+
[94179, 94179],
|
|
1052
|
+
[94194, 94198],
|
|
1053
|
+
[110576, 110579],
|
|
1054
|
+
[110581, 110587],
|
|
1055
|
+
[110589, 110590],
|
|
1056
|
+
[110592, 110882],
|
|
1057
|
+
[110898, 110898],
|
|
1058
|
+
[110928, 110930],
|
|
1059
|
+
[110933, 110933],
|
|
1060
|
+
[110948, 110951],
|
|
1061
|
+
[127488, 127488],
|
|
1062
|
+
[131072, 173791],
|
|
1063
|
+
[173824, 178205],
|
|
1064
|
+
[178208, 183981],
|
|
1065
|
+
[183984, 191456],
|
|
1066
|
+
[191472, 192093],
|
|
1067
|
+
[194560, 195101],
|
|
1068
|
+
[196608, 201546],
|
|
1069
|
+
[201552, 210041]
|
|
1070
|
+
];
|
|
1071
|
+
/**
|
|
1072
|
+
* Returns the CJK letter charset generated from `cjk-regex@3.4.0`.
|
|
1073
|
+
*/
|
|
1074
|
+
function letters() {
|
|
1075
|
+
return _univerjs_core.regexp.charset(...CJK_LETTER_DATA);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* Returns the CJK punctuation charset generated from `cjk-regex@3.4.0`.
|
|
1079
|
+
*/
|
|
1080
|
+
function punctuations() {
|
|
1081
|
+
return _univerjs_core.regexp.charset(...CJK_PUNCTUATION_DATA);
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Returns the combined CJK letter and punctuation charset generated from `cjk-regex@3.4.0`.
|
|
1085
|
+
*/
|
|
1086
|
+
function all() {
|
|
1087
|
+
return _univerjs_core.regexp.charset(...CJK_ALL_DATA);
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns true when text contains CJK letters, excluding punctuation and symbols.
|
|
1091
|
+
*/
|
|
1092
|
+
function hasCJKText(text) {
|
|
1093
|
+
return CJK_LETTER_REG.test(text);
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Returns true when text contains CJK letters or CJK punctuation.
|
|
1097
|
+
*/
|
|
1098
|
+
function hasCJK(text) {
|
|
1099
|
+
return CJK_ALL_REG.test(text);
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Returns true when text contains CJK punctuation, excluding CJK letters.
|
|
1103
|
+
*/
|
|
1104
|
+
function hasCJKPunctuation(text) {
|
|
1105
|
+
return CJK_PUNCTUATION_REG.test(text);
|
|
1106
|
+
}
|
|
1107
|
+
/**
|
|
1108
|
+
* Namespace-style CJK regex API used by document rendering and layout.
|
|
1109
|
+
*/
|
|
1110
|
+
const cjk = {
|
|
1111
|
+
CJK_LETTER_SOURCE,
|
|
1112
|
+
CJK_PUNCTUATION_SOURCE,
|
|
1113
|
+
CJK_ALL_SOURCE,
|
|
1114
|
+
CJK_LETTER_REG,
|
|
1115
|
+
CJK_PUNCTUATION_REG,
|
|
1116
|
+
CJK_ALL_REG,
|
|
1117
|
+
CJK_LETTER_DATA,
|
|
1118
|
+
CJK_PUNCTUATION_DATA,
|
|
1119
|
+
CJK_ALL_DATA,
|
|
1120
|
+
letters,
|
|
1121
|
+
punctuations,
|
|
1122
|
+
all,
|
|
1123
|
+
hasCJKText,
|
|
1124
|
+
hasCJK,
|
|
1125
|
+
hasCJKPunctuation
|
|
1126
|
+
};
|
|
1127
|
+
|
|
946
1128
|
//#endregion
|
|
947
1129
|
//#region src/basics/i-document-skeleton-cached.ts
|
|
948
1130
|
let DocumentSkeletonPageType = /* @__PURE__ */ function(DocumentSkeletonPageType) {
|
|
@@ -4853,6 +5035,13 @@ var SheetExtension = class extends ComponentExtension {
|
|
|
4853
5035
|
super(..._args);
|
|
4854
5036
|
_defineProperty(this, "type", 0);
|
|
4855
5037
|
}
|
|
5038
|
+
/**
|
|
5039
|
+
* Return an isolated instance when this extension is safe to render in a print scene.
|
|
5040
|
+
* Editor-only extensions remain excluded by default.
|
|
5041
|
+
*/
|
|
5042
|
+
copyForPrinting() {
|
|
5043
|
+
return null;
|
|
5044
|
+
}
|
|
4856
5045
|
isRenderDiffRangesByCell(rangeP, diffRanges) {
|
|
4857
5046
|
if (diffRanges == null || diffRanges.length === 0) return true;
|
|
4858
5047
|
for (const range of diffRanges) {
|
|
@@ -4939,6 +5128,11 @@ const UNIQUE_KEY$10 = "DefaultBackgroundExtension";
|
|
|
4939
5128
|
*/
|
|
4940
5129
|
const DOC_EXTENSION_Z_INDEX$3 = 21;
|
|
4941
5130
|
const PRINTING_Z_INDEX = 21;
|
|
5131
|
+
function getRangeCellCount(ranges) {
|
|
5132
|
+
return ranges.reduce((sum, range) => {
|
|
5133
|
+
return sum + Math.max(range.endRow - range.startRow + 1, 0) * Math.max(range.endColumn - range.startColumn + 1, 0);
|
|
5134
|
+
}, 0);
|
|
5135
|
+
}
|
|
4942
5136
|
var Background = class extends SheetExtension {
|
|
4943
5137
|
constructor(..._args) {
|
|
4944
5138
|
super(..._args);
|
|
@@ -4950,7 +5144,7 @@ var Background = class extends SheetExtension {
|
|
|
4950
5144
|
var _this$parent;
|
|
4951
5145
|
return ((_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.isPrinting) ? this.PRINTING_Z_INDEX : this.Z_INDEX;
|
|
4952
5146
|
}
|
|
4953
|
-
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges, { viewRanges, checkOutOfViewBound }) {
|
|
5147
|
+
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges, { viewRanges, checkOutOfViewBound, hasMergeData = true }) {
|
|
4954
5148
|
const { stylesCache, worksheet, rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
|
|
4955
5149
|
const { background: bgMatrixCacheByColor, backgroundPositions } = stylesCache;
|
|
4956
5150
|
if (!worksheet || !bgMatrixCacheByColor) return;
|
|
@@ -4968,15 +5162,19 @@ var Background = class extends SheetExtension {
|
|
|
4968
5162
|
spreadsheetSkeleton
|
|
4969
5163
|
};
|
|
4970
5164
|
const mergeRanges = [];
|
|
4971
|
-
viewRanges.forEach((range) => {
|
|
5165
|
+
if (hasMergeData) viewRanges.forEach((range) => {
|
|
4972
5166
|
const intersectMergeRangesInViewRanges = spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn);
|
|
4973
5167
|
mergeRanges.push(...intersectMergeRangesInViewRanges);
|
|
4974
5168
|
});
|
|
4975
5169
|
const renderBGCore = (rgb) => {
|
|
4976
5170
|
const bgColorMatrix = bgMatrixCacheByColor[rgb];
|
|
5171
|
+
const renderRanges = diffRanges && diffRanges.length > 0 ? diffRanges : viewRanges;
|
|
4977
5172
|
const rangeForEachFn = (row, col, bgConfigParam) => {
|
|
4978
|
-
|
|
4979
|
-
|
|
5173
|
+
var _backgroundPositions$;
|
|
5174
|
+
if (hasMergeData) {
|
|
5175
|
+
if (spreadsheetSkeleton.worksheet.getSpanModel().getMergeDataIndex(row, col) !== -1) return;
|
|
5176
|
+
}
|
|
5177
|
+
const cellInfo = (_backgroundPositions$ = backgroundPositions === null || backgroundPositions === void 0 ? void 0 : backgroundPositions.getValue(row, col)) !== null && _backgroundPositions$ !== void 0 ? _backgroundPositions$ : spreadsheetSkeleton.getCellByIndexWithNoHeader(row, col);
|
|
4980
5178
|
if (!cellInfo) return;
|
|
4981
5179
|
if (bgConfigParam || bgColorMatrix.getValue(row, col)) {
|
|
4982
5180
|
renderBGContext.cellInfo = cellInfo;
|
|
@@ -4992,12 +5190,16 @@ var Background = class extends SheetExtension {
|
|
|
4992
5190
|
renderBGContext.backgroundPaths = backgroundPaths;
|
|
4993
5191
|
ctx.beginPath();
|
|
4994
5192
|
const matrixSize = bgColorMatrix.getSizeOf();
|
|
4995
|
-
if (
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5193
|
+
if (getRangeCellCount(renderRanges) < matrixSize) {
|
|
5194
|
+
renderBGContext.skipRenderRangeCheck = true;
|
|
5195
|
+
renderRanges.forEach((range) => {
|
|
5196
|
+
_univerjs_core.Range.foreach(range, rangeForEachFn);
|
|
5197
|
+
});
|
|
5198
|
+
renderBGContext.skipRenderRangeCheck = false;
|
|
5199
|
+
} else {
|
|
5200
|
+
renderBGContext.skipRenderRangeCheck = false;
|
|
5201
|
+
bgColorMatrix.forValue(rangeForEachFn);
|
|
5202
|
+
}
|
|
5001
5203
|
ctx.fill(backgroundPaths);
|
|
5002
5204
|
ctx.closePath();
|
|
5003
5205
|
};
|
|
@@ -5026,12 +5228,12 @@ var Background = class extends SheetExtension {
|
|
|
5026
5228
|
for (let index = 0; index < rgbList.length; index++) {
|
|
5027
5229
|
const rgb = rgbList[index];
|
|
5028
5230
|
renderBGCore(rgb);
|
|
5029
|
-
renderBGForMergedCells(rgb);
|
|
5231
|
+
if (hasMergeData) renderBGForMergedCells(rgb);
|
|
5030
5232
|
}
|
|
5031
5233
|
ctx.restore();
|
|
5032
5234
|
}
|
|
5033
5235
|
renderBGByCell(bgContext, row, col) {
|
|
5034
|
-
const { spreadsheetSkeleton, backgroundPaths, scaleX, scaleY, viewRanges, diffRanges, cellInfo } = bgContext;
|
|
5236
|
+
const { spreadsheetSkeleton, backgroundPaths, scaleX, scaleY, viewRanges, diffRanges, cellInfo, skipRenderRangeCheck } = bgContext;
|
|
5035
5237
|
let { startY, endY, startX, endX } = cellInfo;
|
|
5036
5238
|
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
5037
5239
|
const renderRange = diffRanges && diffRanges.length > 0 ? diffRanges : viewRanges;
|
|
@@ -5039,7 +5241,7 @@ var Background = class extends SheetExtension {
|
|
|
5039
5241
|
endY = mergeInfo.endY;
|
|
5040
5242
|
startX = mergeInfo.startX;
|
|
5041
5243
|
endX = mergeInfo.endX;
|
|
5042
|
-
if (!isMerged && !isMergedMainCell && !inViewRanges(renderRange, row, col)) return true;
|
|
5244
|
+
if (!skipRenderRangeCheck && !isMerged && !isMergedMainCell && !inViewRanges(renderRange, row, col)) return true;
|
|
5043
5245
|
if (!isMerged && !isMergedMainCell) {
|
|
5044
5246
|
if (!spreadsheetSkeleton.worksheet.getRowVisible(row)) return true;
|
|
5045
5247
|
if (!spreadsheetSkeleton.worksheet.getColVisible(col)) return true;
|
|
@@ -11807,11 +12009,12 @@ var Text = class Text extends Shape {
|
|
|
11807
12009
|
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height);
|
|
11808
12010
|
}
|
|
11809
12011
|
static drawWith(ctx, props, _skeleton) {
|
|
11810
|
-
var _props$color;
|
|
12012
|
+
var _cachedLayout$lines, _cachedLayout$totalHe, _props$color;
|
|
11811
12013
|
const { text, fontStyle, warp, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
11812
|
-
const
|
|
11813
|
-
const
|
|
11814
|
-
const
|
|
12014
|
+
const cachedLayout = !_skeleton && !warp ? Text._getCachedLayout(text, fontStyle) : null;
|
|
12015
|
+
const skeleton = cachedLayout ? null : _skeleton !== null && _skeleton !== void 0 ? _skeleton : new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === _univerjs_core.VerticalAlign.TOP ? height : Infinity);
|
|
12016
|
+
const lines = (_cachedLayout$lines = cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.lines) !== null && _cachedLayout$lines !== void 0 ? _cachedLayout$lines : skeleton.calculate();
|
|
12017
|
+
const totalHeight = (_cachedLayout$totalHe = cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.totalHeight) !== null && _cachedLayout$totalHe !== void 0 ? _cachedLayout$totalHe : skeleton.getTotalHeight();
|
|
11815
12018
|
let lineTop = top + (vAlign === _univerjs_core.VerticalAlign.TOP ? 0 : vAlign === _univerjs_core.VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
11816
12019
|
ctx.save();
|
|
11817
12020
|
ctx.font = fontStyle;
|
|
@@ -11862,6 +12065,46 @@ var Text = class Text extends Shape {
|
|
|
11862
12065
|
ctx.restore();
|
|
11863
12066
|
return totalHeight;
|
|
11864
12067
|
}
|
|
12068
|
+
static drawPlainWith(ctx, props) {
|
|
12069
|
+
var _props$color2;
|
|
12070
|
+
const { text, fontStyle, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12071
|
+
const { lines, totalHeight } = Text._getCachedLayout(text, fontStyle);
|
|
12072
|
+
let lineTop = top + (vAlign === _univerjs_core.VerticalAlign.TOP ? 0 : vAlign === _univerjs_core.VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
12073
|
+
ctx.font = fontStyle;
|
|
12074
|
+
ctx.fillStyle = (_props$color2 = props.color) !== null && _props$color2 !== void 0 ? _props$color2 : COLOR_BLACK_RGB;
|
|
12075
|
+
for (const line of lines) {
|
|
12076
|
+
const lineWidth = line.width;
|
|
12077
|
+
let lineX = 0;
|
|
12078
|
+
if (!(width < lineWidth && cellValueType === _univerjs_core.CellValueType.NUMBER)) switch (hAlign) {
|
|
12079
|
+
case _univerjs_core.HorizontalAlign.CENTER:
|
|
12080
|
+
lineX = (width - lineWidth) / 2;
|
|
12081
|
+
break;
|
|
12082
|
+
case _univerjs_core.HorizontalAlign.RIGHT:
|
|
12083
|
+
lineX = width - lineWidth;
|
|
12084
|
+
break;
|
|
12085
|
+
default: lineX = 0;
|
|
12086
|
+
}
|
|
12087
|
+
ctx.fillText(line.text, left + lineX, lineTop + line.baseline);
|
|
12088
|
+
lineTop += line.height;
|
|
12089
|
+
}
|
|
12090
|
+
return totalHeight;
|
|
12091
|
+
}
|
|
12092
|
+
static _getCachedLayout(text, fontStyle) {
|
|
12093
|
+
const cacheKey = `${fontStyle}\u0000${text}`;
|
|
12094
|
+
const cached = Text._layoutCache.get(cacheKey);
|
|
12095
|
+
if (cached) return cached;
|
|
12096
|
+
const skeleton = new DocSimpleSkeleton(text, fontStyle, false, 0, Infinity);
|
|
12097
|
+
const layout = {
|
|
12098
|
+
lines: skeleton.calculate(),
|
|
12099
|
+
totalHeight: skeleton.getTotalHeight()
|
|
12100
|
+
};
|
|
12101
|
+
Text._layoutCache.set(cacheKey, layout);
|
|
12102
|
+
if (Text._layoutCache.size > Text._MAX_LAYOUT_CACHE_SIZE) {
|
|
12103
|
+
const oldestKey = Text._layoutCache.keys().next().value;
|
|
12104
|
+
if (oldestKey !== void 0) Text._layoutCache.delete(oldestKey);
|
|
12105
|
+
}
|
|
12106
|
+
return layout;
|
|
12107
|
+
}
|
|
11865
12108
|
/**
|
|
11866
12109
|
* Draw text decoration lines (underline, strikethrough, etc.)
|
|
11867
12110
|
*/
|
|
@@ -11994,6 +12237,8 @@ var Text = class Text extends Shape {
|
|
|
11994
12237
|
};
|
|
11995
12238
|
}
|
|
11996
12239
|
};
|
|
12240
|
+
_defineProperty(Text, "_MAX_LAYOUT_CACHE_SIZE", 5e3);
|
|
12241
|
+
_defineProperty(Text, "_layoutCache", /* @__PURE__ */ new Map());
|
|
11997
12242
|
|
|
11998
12243
|
//#endregion
|
|
11999
12244
|
//#region src/components/docs/document-compatibility.ts
|
|
@@ -12471,8 +12716,9 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12471
12716
|
};
|
|
12472
12717
|
}
|
|
12473
12718
|
var DocumentViewModel = class DocumentViewModel {
|
|
12474
|
-
constructor(_documentDataModel) {
|
|
12719
|
+
constructor(_documentDataModel, _tableSource) {
|
|
12475
12720
|
this._documentDataModel = _documentDataModel;
|
|
12721
|
+
this._tableSource = _tableSource;
|
|
12476
12722
|
_defineProperty(this, "_interceptor", null);
|
|
12477
12723
|
_defineProperty(this, "_cacheSize", 1e3);
|
|
12478
12724
|
_defineProperty(this, "_textRunsCache", /* @__PURE__ */ new Map());
|
|
@@ -12650,10 +12896,10 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12650
12896
|
}
|
|
12651
12897
|
}
|
|
12652
12898
|
_buildTableCache() {
|
|
12653
|
-
var _this$getBody4;
|
|
12899
|
+
var _this$getBody4, _this$_tableSource;
|
|
12654
12900
|
this._tableCache.clear();
|
|
12655
12901
|
const tables = (_this$getBody4 = this.getBody()) === null || _this$getBody4 === void 0 ? void 0 : _this$getBody4.tables;
|
|
12656
|
-
const tableConfig = this.getSnapshot().tableSource;
|
|
12902
|
+
const tableConfig = (_this$_tableSource = this._tableSource) !== null && _this$_tableSource !== void 0 ? _this$_tableSource : this.getSnapshot().tableSource;
|
|
12657
12903
|
if (tables == null || tableConfig == null) return;
|
|
12658
12904
|
for (const table of tables) {
|
|
12659
12905
|
const { startIndex, tableId } = table;
|
|
@@ -12695,18 +12941,47 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12695
12941
|
_buildHeaderFooterViewModel() {
|
|
12696
12942
|
const { headerModelMap, footerModelMap } = this._documentDataModel;
|
|
12697
12943
|
const viewModels = [];
|
|
12944
|
+
const tableSource = this.getSnapshot().tableSource;
|
|
12698
12945
|
for (const [headerId, headerModel] of headerModelMap) {
|
|
12699
|
-
this._headerTreeMap.set(headerId, new DocumentViewModel(headerModel));
|
|
12946
|
+
this._headerTreeMap.set(headerId, new DocumentViewModel(headerModel, tableSource));
|
|
12700
12947
|
viewModels.push(this._headerTreeMap.get(headerId));
|
|
12701
12948
|
}
|
|
12702
12949
|
for (const [footerId, footerModel] of footerModelMap) {
|
|
12703
|
-
this._footerTreeMap.set(footerId, new DocumentViewModel(footerModel));
|
|
12950
|
+
this._footerTreeMap.set(footerId, new DocumentViewModel(footerModel, tableSource));
|
|
12704
12951
|
viewModels.push(this._footerTreeMap.get(footerId));
|
|
12705
12952
|
}
|
|
12706
12953
|
this._segmentViewModels$.next(viewModels);
|
|
12707
12954
|
}
|
|
12708
12955
|
};
|
|
12709
12956
|
|
|
12957
|
+
//#endregion
|
|
12958
|
+
//#region src/components/docs/custom-block-render-viewport.ts
|
|
12959
|
+
let docsCustomBlockRenderViewportProvider = null;
|
|
12960
|
+
const docsCustomBlockRenderViewportProviders = /* @__PURE__ */ new Set();
|
|
12961
|
+
function setDocsCustomBlockRenderViewportProvider(provider) {
|
|
12962
|
+
if (provider == null) {
|
|
12963
|
+
docsCustomBlockRenderViewportProvider = null;
|
|
12964
|
+
docsCustomBlockRenderViewportProviders.clear();
|
|
12965
|
+
return () => {};
|
|
12966
|
+
}
|
|
12967
|
+
docsCustomBlockRenderViewportProvider = provider;
|
|
12968
|
+
docsCustomBlockRenderViewportProviders.add(provider);
|
|
12969
|
+
return () => {
|
|
12970
|
+
var _providers;
|
|
12971
|
+
docsCustomBlockRenderViewportProviders.delete(provider);
|
|
12972
|
+
const providers = Array.from(docsCustomBlockRenderViewportProviders);
|
|
12973
|
+
docsCustomBlockRenderViewportProvider = (_providers = providers[providers.length - 1]) !== null && _providers !== void 0 ? _providers : null;
|
|
12974
|
+
};
|
|
12975
|
+
}
|
|
12976
|
+
function getDocsCustomBlockRenderViewport(unitId, blockId, input) {
|
|
12977
|
+
const providers = docsCustomBlockRenderViewportProviders.size ? Array.from(docsCustomBlockRenderViewportProviders).reverse() : docsCustomBlockRenderViewportProvider ? [docsCustomBlockRenderViewportProvider] : [];
|
|
12978
|
+
for (const provider of providers) {
|
|
12979
|
+
const viewport = provider(unitId, blockId, input);
|
|
12980
|
+
if (viewport != null) return viewport;
|
|
12981
|
+
}
|
|
12982
|
+
return null;
|
|
12983
|
+
}
|
|
12984
|
+
|
|
12710
12985
|
//#endregion
|
|
12711
12986
|
//#region src/components/docs/layout/model/glyph.ts
|
|
12712
12987
|
function isSpace(char) {
|
|
@@ -12717,7 +12992,7 @@ function isSpace(char) {
|
|
|
12717
12992
|
].includes(char);
|
|
12718
12993
|
}
|
|
12719
12994
|
function isJustifiable(content) {
|
|
12720
|
-
return isSpace(content) || hasCJKText(content) || isCjkLeftAlignedPunctuation(content) || isCjkRightAlignedPunctuation(content) || isCjkCenterAlignedPunctuation(content);
|
|
12995
|
+
return isSpace(content) || cjk.hasCJKText(content) || isCjkLeftAlignedPunctuation(content) || isCjkRightAlignedPunctuation(content) || isCjkCenterAlignedPunctuation(content);
|
|
12721
12996
|
}
|
|
12722
12997
|
function baseAdjustability(content, width) {
|
|
12723
12998
|
if (isSpace(content)) return {
|
|
@@ -12846,7 +13121,7 @@ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, gly
|
|
|
12846
13121
|
const { width: contentWidth = 0 } = bBox;
|
|
12847
13122
|
let width = glyphWidth !== null && glyphWidth !== void 0 ? glyphWidth : contentWidth;
|
|
12848
13123
|
if (validationGrid(gridType, snapToGrid)) {
|
|
12849
|
-
width = contentWidth + (hasCJK(content) ? charSpace : charSpace / 2);
|
|
13124
|
+
width = contentWidth + (cjk.hasCJK(content) ? charSpace : charSpace / 2);
|
|
12850
13125
|
if (gridType === _univerjs_core.GridType.SNAP_TO_CHARS) xOffset = (width - contentWidth) / 2;
|
|
12851
13126
|
}
|
|
12852
13127
|
if (glyphInfo && glyphInfo.kerning !== 0 && glyphInfo.font) {
|
|
@@ -13742,6 +14017,12 @@ function isBeyondDivideWidth(width, divideWidth) {
|
|
|
13742
14017
|
const tolerance = Math.min(MAX_LINE_WIDTH_TOLERANCE, Math.max(MIN_LINE_WIDTH_TOLERANCE, divideWidth * RELATIVE_LINE_WIDTH_TOLERANCE));
|
|
13743
14018
|
return width - divideWidth > tolerance;
|
|
13744
14019
|
}
|
|
14020
|
+
function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth) {
|
|
14021
|
+
var _glyphGroup$adjustabi, _glyphGroup;
|
|
14022
|
+
const width = __getGlyphGroupWidth(glyphGroup);
|
|
14023
|
+
const trailingShrinkability = (_glyphGroup$adjustabi = (_glyphGroup = glyphGroup[glyphGroup.length - 1]) === null || _glyphGroup === void 0 || (_glyphGroup = _glyphGroup.adjustability) === null || _glyphGroup === void 0 || (_glyphGroup = _glyphGroup.shrinkability) === null || _glyphGroup === void 0 ? void 0 : _glyphGroup[1]) !== null && _glyphGroup$adjustabi !== void 0 ? _glyphGroup$adjustabi : 0;
|
|
14024
|
+
return isBeyondDivideWidth(offsetLeft + width - trailingShrinkability, divideWidth);
|
|
14025
|
+
}
|
|
13745
14026
|
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal") {
|
|
13746
14027
|
if (isParagraphFirstShapedText) if (paragraphConfig.bulletSkeleton) {
|
|
13747
14028
|
var _paragraphProperties$;
|
|
@@ -13818,12 +14099,11 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13818
14099
|
const divideInfo = getLastNotFullDivideInfo(getLastPage(pages));
|
|
13819
14100
|
if (divideInfo) {
|
|
13820
14101
|
var _divide$glyphGroup;
|
|
13821
|
-
const width = __getGlyphGroupWidth(glyphGroup);
|
|
13822
14102
|
const { divide, isLast } = divideInfo;
|
|
13823
14103
|
const lastGlyph = divide === null || divide === void 0 || (_divide$glyphGroup = divide.glyphGroup) === null || _divide$glyphGroup === void 0 ? void 0 : _divide$glyphGroup[divide.glyphGroup.length - 1];
|
|
13824
14104
|
const preOffsetLeft = ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.width) || 0) + ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.left) || 0);
|
|
13825
14105
|
const { hyphenationZone } = sectionBreakConfig;
|
|
13826
|
-
if (
|
|
14106
|
+
if (isGlyphGroupBeyondDivideWidth(glyphGroup, preOffsetLeft, divide.width)) {
|
|
13827
14107
|
if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length > 0 && glyphGroup[0].streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) {
|
|
13828
14108
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13829
14109
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
@@ -13846,7 +14126,7 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13846
14126
|
const sliceGlyphGroup = [];
|
|
13847
14127
|
while (glyphGroup.length) {
|
|
13848
14128
|
sliceGlyphGroup.push(glyphGroup.shift());
|
|
13849
|
-
if (
|
|
14129
|
+
if (isGlyphGroupBeyondDivideWidth(sliceGlyphGroup, 0, divide.width)) {
|
|
13850
14130
|
if (sliceGlyphGroup.length > 1) glyphGroup.unshift(sliceGlyphGroup.pop());
|
|
13851
14131
|
break;
|
|
13852
14132
|
}
|
|
@@ -13897,7 +14177,7 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13897
14177
|
if (anchorDrawings.length > 0) {
|
|
13898
14178
|
var _paragraphConfig$para, _paragraphConfig$pDra;
|
|
13899
14179
|
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, (_paragraphConfig$para = paragraphConfig.paragraphStyle) === null || _paragraphConfig$para === void 0 ? void 0 : _paragraphConfig$para.indentStart);
|
|
13900
|
-
const drawings = __getDrawingPosition(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);
|
|
14180
|
+
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);
|
|
13901
14181
|
__updateDrawingPosition(currentLine.parent, drawings);
|
|
13902
14182
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13903
14183
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
@@ -13997,6 +14277,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13997
14277
|
}
|
|
13998
14278
|
}
|
|
13999
14279
|
let deferredInlineGroupAnchorDrawings = [];
|
|
14280
|
+
let deferredTopBottomAnchorDrawings = [];
|
|
14000
14281
|
if (paragraphNonInlineSkeDrawings != null && paragraphNonInlineSkeDrawings.size > 0) {
|
|
14001
14282
|
var _pDrawingAnchor$get;
|
|
14002
14283
|
let targetDrawings = [...paragraphNonInlineSkeDrawings.values()].filter((drawing) => drawing.drawingOrigin.docTransform.positionV.relativeFrom !== _univerjs_core.ObjectRelativeFromV.LINE);
|
|
@@ -14004,13 +14285,17 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14004
14285
|
deferredInlineGroupAnchorDrawings = targetDrawings.filter((drawing) => glyphGroupCustomBlockIds.has(drawing.drawingId) && drawing.drawingOrigin.docTransform.positionV.relativeFrom === _univerjs_core.ObjectRelativeFromV.LINE);
|
|
14005
14286
|
targetDrawings = targetDrawings.filter((drawing) => !deferredInlineGroupAnchorDrawings.includes(drawing));
|
|
14006
14287
|
}
|
|
14007
|
-
|
|
14288
|
+
deferredTopBottomAnchorDrawings = targetDrawings.filter((drawing) => glyphGroupCustomBlockIds.has(drawing.drawingId) && drawing.drawingOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
|
|
14289
|
+
targetDrawings = targetDrawings.filter((drawing) => drawing.drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
|
|
14290
|
+
__updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get === void 0 ? void 0 : _pDrawingAnchor$get.top, paragraphAnchorLeft, false, deferredTopBottomAnchorDrawings.length > 0);
|
|
14008
14291
|
}
|
|
14009
14292
|
if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
|
|
14010
14293
|
var _pDrawingAnchor$get2;
|
|
14011
14294
|
needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop, lineHeight, lastPage, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
|
|
14012
14295
|
}
|
|
14013
|
-
const
|
|
14296
|
+
const calculatedLineTop = positionedCustomBlockOnly ? lineTop : calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
14297
|
+
const previousTopBottomCustomBlockFlowBottom = deferredTopBottomAnchorDrawings.length > 0 ? paragraphConfig.topBottomCustomBlockFlowBottom : void 0;
|
|
14298
|
+
const newLineTop = previousTopBottomCustomBlockFlowBottom == null ? calculatedLineTop : Math.max(calculatedLineTop, previousTopBottomCustomBlockFlowBottom);
|
|
14014
14299
|
if (lineHeight + newLineTop - section.height > LINE_LAYOUT_OVERFLOW_TOLERANCE && column.lines.length > 0 && lastPage.sections.length > 0 || needOpenNewPageByTableLayout) {
|
|
14015
14300
|
setColumnFullState(column, true);
|
|
14016
14301
|
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
@@ -14044,16 +14329,21 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14044
14329
|
}, column.width, lineIndex, isParagraphFirstShapedText, paragraphConfig, lastPage, headerPage, footerPage);
|
|
14045
14330
|
column.lines.push(newLine);
|
|
14046
14331
|
newLine.parent = column;
|
|
14047
|
-
|
|
14332
|
+
const blockAnchorTop = deferredTopBottomAnchorDrawings.length > 0 ? newLineTop : lineTop;
|
|
14333
|
+
createAndUpdateBlockAnchor(paragraphIndex, newLine, blockAnchorTop, pDrawingAnchor);
|
|
14334
|
+
if (deferredTopBottomAnchorDrawings.length > 0) {
|
|
14335
|
+
__updateAndPositionDrawings(ctx, newLineTop, lineHeight, column, deferredTopBottomAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, blockAnchorTop, paragraphAnchorLeft, true, true);
|
|
14336
|
+
__updateTopBottomCustomBlockFlowBottom(paragraphConfig, deferredTopBottomAnchorDrawings);
|
|
14337
|
+
}
|
|
14048
14338
|
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
14049
14339
|
if (deferredInlineGroupAnchorDrawings.length > 0) {
|
|
14050
14340
|
var _pDrawingAnchor$get3;
|
|
14051
14341
|
__updateAndPositionDrawings(ctx, lineTop, lineHeight, column, deferredInlineGroupAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get3 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get3 === void 0 ? void 0 : _pDrawingAnchor$get3.top, paragraphAnchorLeft, true);
|
|
14052
14342
|
}
|
|
14053
14343
|
}
|
|
14054
|
-
function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphIndex, isParagraphFirstShapedText, drawingAnchorTop, drawingAnchorLeft = 0, skipRelayoutCheck = false) {
|
|
14344
|
+
function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphIndex, isParagraphFirstShapedText, drawingAnchorTop, drawingAnchorLeft = 0, skipRelayoutCheck = false, overwriteTopBottomPosition = false) {
|
|
14055
14345
|
if (targetDrawings.length === 0) return;
|
|
14056
|
-
const drawings = __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
14346
|
+
const drawings = __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
14057
14347
|
if (drawings == null || drawings.size === 0) return;
|
|
14058
14348
|
const floatObjects = [...drawings.values()].filter((drawing) => {
|
|
14059
14349
|
const layoutType = drawing.drawingOrigin.layoutType;
|
|
@@ -14075,7 +14365,7 @@ function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDra
|
|
|
14075
14365
|
};
|
|
14076
14366
|
});
|
|
14077
14367
|
if (!skipRelayoutCheck) _reLayoutCheck(ctx, floatObjects, column, paragraphIndex);
|
|
14078
|
-
__updateDrawingPosition(column, drawings);
|
|
14368
|
+
__updateDrawingPosition(column, drawings, overwriteTopBottomPosition);
|
|
14079
14369
|
}
|
|
14080
14370
|
function __updateWrapTablePosition(ctx, table, lineTop, lineHeight, column, paragraphIndex, drawingAnchorTop) {
|
|
14081
14371
|
const wrapTablePosition = __getWrapTablePosition(table, column, lineTop, lineHeight, drawingAnchorTop);
|
|
@@ -14186,6 +14476,15 @@ function _getCustomBlockIdsInLine(line) {
|
|
|
14186
14476
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) customBlockIds.push(glyph.drawingId);
|
|
14187
14477
|
return customBlockIds;
|
|
14188
14478
|
}
|
|
14479
|
+
function __updateTopBottomCustomBlockFlowBottom(paragraphConfig, drawings) {
|
|
14480
|
+
for (const drawing of drawings) {
|
|
14481
|
+
var _drawingOrigin$distB, _paragraphConfig$topB;
|
|
14482
|
+
const { drawingOrigin } = drawing;
|
|
14483
|
+
if (drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM || drawingOrigin.behindDoc === _univerjs_core.BooleanNumber.TRUE) continue;
|
|
14484
|
+
const bottom = drawing.aTop + drawing.height + ((_drawingOrigin$distB = drawingOrigin.distB) !== null && _drawingOrigin$distB !== void 0 ? _drawingOrigin$distB : 0);
|
|
14485
|
+
paragraphConfig.topBottomCustomBlockFlowBottom = Math.max((_paragraphConfig$topB = paragraphConfig.topBottomCustomBlockFlowBottom) !== null && _paragraphConfig$topB !== void 0 ? _paragraphConfig$topB : Number.NEGATIVE_INFINITY, bottom);
|
|
14486
|
+
}
|
|
14487
|
+
}
|
|
14189
14488
|
function __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14190
14489
|
return __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphNonInlineSkeDrawings).length > 0;
|
|
14191
14490
|
}
|
|
@@ -14389,7 +14688,8 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
14389
14688
|
}
|
|
14390
14689
|
const usesDocumentGrid = spacingRule === _univerjs_core.SpacingRule.AUTO && snapToGrid === _univerjs_core.BooleanNumber.TRUE && gridType !== _univerjs_core.GridType.DEFAULT;
|
|
14391
14690
|
if (spacingRule === _univerjs_core.SpacingRule.AUTO) {
|
|
14392
|
-
|
|
14691
|
+
let lineSpacingApply = usesDocumentGrid ? lineSpacing * linePitch : scaleAutoLineSpacingByGlyphHeight ? lineSpacing * glyphLineHeight : glyphLineHeight;
|
|
14692
|
+
if (!usesDocumentGrid && scaleAutoLineSpacingByGlyphHeight && lineSpacing <= 1.05 && glyphLineHeight >= 30) lineSpacingApply *= 1.18;
|
|
14393
14693
|
const padding = (lineSpacingApply - glyphLineHeight) / 2;
|
|
14394
14694
|
return {
|
|
14395
14695
|
paddingTop: padding,
|
|
@@ -14417,7 +14717,7 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
14417
14717
|
lineSpacingApply: exactLineSpacingApply
|
|
14418
14718
|
};
|
|
14419
14719
|
}
|
|
14420
|
-
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnchorTop, paragraphNonInlineSkeDrawings) {
|
|
14720
|
+
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings) {
|
|
14421
14721
|
var _line$parent, _section$top;
|
|
14422
14722
|
const column = line.parent;
|
|
14423
14723
|
const section = column === null || column === void 0 ? void 0 : column.parent;
|
|
@@ -14429,6 +14729,7 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14429
14729
|
const sectionTop = (_section$top = section === null || section === void 0 ? void 0 : section.top) !== null && _section$top !== void 0 ? _section$top : 0;
|
|
14430
14730
|
const lineTop = sectionTop + top;
|
|
14431
14731
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0) {
|
|
14732
|
+
var _viewport$width, _viewport$height, _viewport$offsetLeft;
|
|
14432
14733
|
const { drawingId } = glyph;
|
|
14433
14734
|
if (drawingId == null) continue;
|
|
14434
14735
|
const drawing = paragraphInlineSkeDrawings === null || paragraphInlineSkeDrawings === void 0 ? void 0 : paragraphInlineSkeDrawings.get(drawingId);
|
|
@@ -14438,7 +14739,19 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14438
14739
|
const { size, angle } = docTransform;
|
|
14439
14740
|
const { width = 0, height = 0 } = size;
|
|
14440
14741
|
const glyphHeight = glyph.bBox.bd + glyph.bBox.ba;
|
|
14441
|
-
|
|
14742
|
+
const glyphLeft = divide.left + divide.paddingLeft + glyph.left;
|
|
14743
|
+
const blockLeft = column.left + glyphLeft;
|
|
14744
|
+
const viewport = getDocsCustomBlockRenderViewport(unitId, drawingId, {
|
|
14745
|
+
blockLeft,
|
|
14746
|
+
fallbackHeight: height,
|
|
14747
|
+
fallbackWidth: width,
|
|
14748
|
+
pageMarginLeft: page.marginLeft,
|
|
14749
|
+
pageMarginRight: page.marginRight,
|
|
14750
|
+
pageWidth: page.pageWidth
|
|
14751
|
+
});
|
|
14752
|
+
const drawingWidth = (_viewport$width = viewport === null || viewport === void 0 ? void 0 : viewport.width) !== null && _viewport$width !== void 0 ? _viewport$width : width;
|
|
14753
|
+
const drawingHeight = (_viewport$height = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height !== void 0 ? _viewport$height : height;
|
|
14754
|
+
drawing.aLeft = viewport ? blockLeft + ((_viewport$offsetLeft = viewport.offsetLeft) !== null && _viewport$offsetLeft !== void 0 ? _viewport$offsetLeft : 0) : blockLeft + .5 * glyph.width - .5 * drawingWidth || 0;
|
|
14442
14755
|
if (glyph.width > divide.width) {
|
|
14443
14756
|
var _paragraphNonInlineSk;
|
|
14444
14757
|
for (const positionedDrawing of (_paragraphNonInlineSk = paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 ? void 0 : paragraphNonInlineSkeDrawings.values()) !== null && _paragraphNonInlineSk !== void 0 ? _paragraphNonInlineSk : []) {
|
|
@@ -14448,17 +14761,25 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14448
14761
|
const lineBottom = lineTop + lineHeight;
|
|
14449
14762
|
if (positionedDrawing.aTop >= lineBottom || positionedBottom <= lineTop) continue;
|
|
14450
14763
|
const positionedRight = positionedDrawing.aLeft + positionedDrawing.width;
|
|
14451
|
-
const drawingRight = drawing.aLeft +
|
|
14764
|
+
const drawingRight = drawing.aLeft + drawingWidth;
|
|
14452
14765
|
if (positionedDrawing.aLeft < drawingRight && positionedRight > drawing.aLeft) {
|
|
14453
14766
|
var _positionedOrigin$dis;
|
|
14454
14767
|
drawing.aLeft = Math.max(drawing.aLeft, positionedDrawing.aLeft + positionedDrawing.width + ((_positionedOrigin$dis = positionedOrigin.distR) !== null && _positionedOrigin$dis !== void 0 ? _positionedOrigin$dis : 0));
|
|
14455
14768
|
}
|
|
14456
14769
|
}
|
|
14457
14770
|
}
|
|
14458
|
-
drawing.
|
|
14459
|
-
drawing.
|
|
14460
|
-
drawing.
|
|
14771
|
+
drawing.width = drawingWidth;
|
|
14772
|
+
drawing.height = drawingHeight;
|
|
14773
|
+
drawing.aTop = lineTop + lineHeight - .5 * glyphHeight - .5 * drawingHeight - marginBottom;
|
|
14461
14774
|
drawing.angle = angle;
|
|
14775
|
+
drawing.customBlockRenderViewport = viewport ? {
|
|
14776
|
+
bleedLeft: viewport.bleedLeft,
|
|
14777
|
+
bleedWidth: viewport.bleedWidth,
|
|
14778
|
+
contentHeight: viewport.contentHeight,
|
|
14779
|
+
contentWidth: viewport.contentWidth,
|
|
14780
|
+
height: viewport.height,
|
|
14781
|
+
viewportHeight: viewport.viewportHeight
|
|
14782
|
+
} : void 0;
|
|
14462
14783
|
drawing.isPageBreak = isPageBreak;
|
|
14463
14784
|
drawing.lineTop = lineTop;
|
|
14464
14785
|
drawing.columnLeft = column.left;
|
|
@@ -14468,7 +14789,7 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14468
14789
|
}
|
|
14469
14790
|
page.skeDrawings = new Map([...page.skeDrawings, ...drawings]);
|
|
14470
14791
|
}
|
|
14471
|
-
function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0) {
|
|
14792
|
+
function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0, normalizeTraditionalColumnAnchor = true) {
|
|
14472
14793
|
var _column$parent3;
|
|
14473
14794
|
const page = (_column$parent3 = column.parent) === null || _column$parent3 === void 0 ? void 0 : _column$parent3.parent;
|
|
14474
14795
|
if (page == null || needPositionDrawings.length === 0) return;
|
|
@@ -14476,22 +14797,42 @@ function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShape
|
|
|
14476
14797
|
const isPageBreak = __checkPageBreak(column);
|
|
14477
14798
|
if (isPageBreak && !isParagraphFirstShapedText) return;
|
|
14478
14799
|
for (const drawing of needPositionDrawings) {
|
|
14479
|
-
var _getPositionHorizon2, _getPositionVertical2;
|
|
14800
|
+
var _ctx$dataModel$getUni, _ctx$dataModel$getUni2, _ctx$dataModel, _viewport$width2, _viewport$height2, _getPositionHorizon2, _getPositionVertical2;
|
|
14480
14801
|
const { drawingOrigin } = drawing;
|
|
14481
14802
|
if (!drawingOrigin) continue;
|
|
14482
14803
|
const { docTransform } = drawingOrigin;
|
|
14483
14804
|
const { positionH, positionV, size, angle } = docTransform;
|
|
14484
|
-
const { width
|
|
14485
|
-
|
|
14805
|
+
const { width, height } = size;
|
|
14806
|
+
const fallbackWidth = width !== null && width !== void 0 ? width : 0;
|
|
14807
|
+
const fallbackHeight = height !== null && height !== void 0 ? height : 0;
|
|
14808
|
+
const viewport = drawingOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM ? getDocsCustomBlockRenderViewport((_ctx$dataModel$getUni = (_ctx$dataModel$getUni2 = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni2 === void 0 ? void 0 : _ctx$dataModel$getUni2.call(_ctx$dataModel)) !== null && _ctx$dataModel$getUni !== void 0 ? _ctx$dataModel$getUni : "", drawing.drawingId, {
|
|
14809
|
+
fallbackHeight,
|
|
14810
|
+
fallbackWidth,
|
|
14811
|
+
pageMarginLeft: page.marginLeft,
|
|
14812
|
+
pageMarginRight: page.marginRight,
|
|
14813
|
+
pageWidth: page.pageWidth
|
|
14814
|
+
}) : null;
|
|
14815
|
+
const drawingWidth = (_viewport$width2 = viewport === null || viewport === void 0 ? void 0 : viewport.width) !== null && _viewport$width2 !== void 0 ? _viewport$width2 : fallbackWidth;
|
|
14816
|
+
const drawingHeight = (_viewport$height2 = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height2 !== void 0 ? _viewport$height2 : fallbackHeight;
|
|
14817
|
+
let aLeft = (_getPositionHorizon2 = getPositionHorizon(positionH, column, page, drawingWidth, isPageBreak)) !== null && _getPositionHorizon2 !== void 0 ? _getPositionHorizon2 : 0;
|
|
14486
14818
|
if (positionH.relativeFrom === _univerjs_core.ObjectRelativeFromH.COLUMN && blockAnchorLeft > 0) {
|
|
14487
14819
|
const renderedColumnOrigin = isPageBreak ? 0 : column.left || page.marginLeft;
|
|
14488
14820
|
aLeft += blockAnchorLeft - renderedColumnOrigin;
|
|
14821
|
+
if (normalizeTraditionalColumnAnchor && ctx.dataModel.documentStyle.documentFlavor === _univerjs_core.DocumentFlavor.TRADITIONAL && positionV.relativeFrom === _univerjs_core.ObjectRelativeFromV.PARAGRAPH) aLeft -= page.marginLeft;
|
|
14489
14822
|
}
|
|
14490
14823
|
drawing.aLeft = aLeft;
|
|
14491
|
-
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page, lineTop, lineHeight,
|
|
14492
|
-
drawing.width =
|
|
14493
|
-
drawing.height =
|
|
14824
|
+
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page, lineTop, lineHeight, drawingHeight, blockAnchorTop, isPageBreak)) !== null && _getPositionVertical2 !== void 0 ? _getPositionVertical2 : 0;
|
|
14825
|
+
drawing.width = drawingWidth;
|
|
14826
|
+
drawing.height = drawingHeight;
|
|
14494
14827
|
drawing.angle = angle;
|
|
14828
|
+
drawing.customBlockRenderViewport = viewport ? {
|
|
14829
|
+
bleedLeft: viewport.bleedLeft,
|
|
14830
|
+
bleedWidth: viewport.bleedWidth,
|
|
14831
|
+
contentHeight: viewport.contentHeight,
|
|
14832
|
+
contentWidth: viewport.contentWidth,
|
|
14833
|
+
height: viewport.height,
|
|
14834
|
+
viewportHeight: viewport.viewportHeight
|
|
14835
|
+
} : void 0;
|
|
14495
14836
|
drawing.initialState = true;
|
|
14496
14837
|
drawing.columnLeft = column.left;
|
|
14497
14838
|
drawing.lineTop = lineTop;
|
|
@@ -14502,16 +14843,18 @@ function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShape
|
|
|
14502
14843
|
}
|
|
14503
14844
|
return drawings;
|
|
14504
14845
|
}
|
|
14505
|
-
function __updateDrawingPosition(column, drawings) {
|
|
14846
|
+
function __updateDrawingPosition(column, drawings, overwriteTopBottomPosition = false) {
|
|
14506
14847
|
var _column$parent4;
|
|
14507
14848
|
const page = (_column$parent4 = column.parent) === null || _column$parent4 === void 0 ? void 0 : _column$parent4.parent;
|
|
14508
14849
|
if (drawings == null || drawings.size === 0 || page == null) return;
|
|
14509
14850
|
for (const drawing of drawings.values()) {
|
|
14510
14851
|
const originDrawing = page.skeDrawings.get(drawing.drawingId);
|
|
14511
|
-
if (originDrawing) if (originDrawing.drawingOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM)
|
|
14852
|
+
if (originDrawing) if (originDrawing.drawingOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) if (overwriteTopBottomPosition) page.skeDrawings.set(drawing.drawingId, drawing);
|
|
14853
|
+
else {
|
|
14512
14854
|
const lowerDrawing = originDrawing.aTop > drawing.aTop ? originDrawing : drawing;
|
|
14513
14855
|
page.skeDrawings.set(drawing.drawingId, lowerDrawing);
|
|
14514
|
-
}
|
|
14856
|
+
}
|
|
14857
|
+
else page.skeDrawings.set(drawing.drawingId, drawing);
|
|
14515
14858
|
else page.skeDrawings.set(drawing.drawingId, drawing);
|
|
14516
14859
|
}
|
|
14517
14860
|
}
|
|
@@ -14840,7 +15183,10 @@ function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
|
14840
15183
|
const affectInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphInlineSkeDrawings;
|
|
14841
15184
|
const affectNonInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphNonInlineSkeDrawings;
|
|
14842
15185
|
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);
|
|
14843
|
-
if (affectInlineDrawings && affectInlineDrawings.size > 0)
|
|
15186
|
+
if (affectInlineDrawings && affectInlineDrawings.size > 0) {
|
|
15187
|
+
var _ctx$dataModel$getUni, _ctx$dataModel$getUni2, _ctx$dataModel;
|
|
15188
|
+
updateInlineDrawingPosition(line, affectInlineDrawings, (_ctx$dataModel$getUni = (_ctx$dataModel$getUni2 = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni2 === void 0 ? void 0 : _ctx$dataModel$getUni2.call(_ctx$dataModel)) !== null && _ctx$dataModel$getUni !== void 0 ? _ctx$dataModel$getUni : "", drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings);
|
|
15189
|
+
}
|
|
14844
15190
|
const paragraphStyle = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphStyle;
|
|
14845
15191
|
const paragraphBackgroundColor = paragraphStyle === null || paragraphStyle === void 0 || (_paragraphStyle$shadi = paragraphStyle.shading) === null || _paragraphStyle$shadi === void 0 ? void 0 : _paragraphStyle$shadi.backgroundColor;
|
|
14846
15192
|
if (paragraphBackgroundColor) line.backgroundColor = paragraphBackgroundColor;
|
|
@@ -14884,10 +15230,10 @@ function lineIterator(pagesOrCells, cb) {
|
|
|
14884
15230
|
}
|
|
14885
15231
|
}
|
|
14886
15232
|
function documentSkeletonTableIterator(pages, options = {}) {
|
|
14887
|
-
const { docsLeft = 0, docsTop = 0, pageMarginTop = 0, resolveViewport = true, tableCellInsetX = 0, unitId = "" } = options;
|
|
15233
|
+
const { docsLeft = 0, docsTop = 0, pageMarginTop = 0, resolveViewport = true, skeFooters, skeHeaders, tableCellInsetX = 0, unitId = "" } = options;
|
|
14888
15234
|
const contexts = [];
|
|
14889
15235
|
pages.forEach((rootPage, pageIndex) => {
|
|
14890
|
-
var _rootPage$skeColumnGr;
|
|
15236
|
+
var _skeHeaders$get, _skeFooters$get, _rootPage$skeColumnGr;
|
|
14891
15237
|
const rootPageTop = ((rootPage.pageHeight === Infinity ? 0 : rootPage.pageHeight) + pageMarginTop) * pageIndex + rootPage.marginTop + docsTop;
|
|
14892
15238
|
const rootPageLeft = rootPage.marginLeft + docsLeft;
|
|
14893
15239
|
collectPageTables({
|
|
@@ -14903,6 +15249,36 @@ function documentSkeletonTableIterator(pages, options = {}) {
|
|
|
14903
15249
|
tableCellInsetX,
|
|
14904
15250
|
unitId
|
|
14905
15251
|
});
|
|
15252
|
+
const rootPageDocumentTop = rootPageTop - rootPage.marginTop;
|
|
15253
|
+
const rootPageDocumentLeft = docsLeft + rootPage.marginLeft;
|
|
15254
|
+
const headerPage = rootPage.headerId == null ? void 0 : skeHeaders === null || skeHeaders === void 0 || (_skeHeaders$get = skeHeaders.get(rootPage.headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(rootPage.pageWidth);
|
|
15255
|
+
if (headerPage != null) collectPageTables({
|
|
15256
|
+
contexts,
|
|
15257
|
+
docsLeft,
|
|
15258
|
+
page: headerPage,
|
|
15259
|
+
pageIndex,
|
|
15260
|
+
pageLeft: rootPageDocumentLeft,
|
|
15261
|
+
pageTop: rootPageDocumentTop + headerPage.marginTop,
|
|
15262
|
+
rootPage,
|
|
15263
|
+
source: "header",
|
|
15264
|
+
resolveViewport,
|
|
15265
|
+
tableCellInsetX,
|
|
15266
|
+
unitId
|
|
15267
|
+
});
|
|
15268
|
+
const footerPage = rootPage.footerId == null ? void 0 : skeFooters === null || skeFooters === void 0 || (_skeFooters$get = skeFooters.get(rootPage.footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(rootPage.pageWidth);
|
|
15269
|
+
if (footerPage != null) collectPageTables({
|
|
15270
|
+
contexts,
|
|
15271
|
+
docsLeft,
|
|
15272
|
+
page: footerPage,
|
|
15273
|
+
pageIndex,
|
|
15274
|
+
pageLeft: rootPageDocumentLeft,
|
|
15275
|
+
pageTop: rootPageDocumentTop + rootPage.pageHeight - footerPage.height - footerPage.marginBottom,
|
|
15276
|
+
rootPage,
|
|
15277
|
+
source: "footer",
|
|
15278
|
+
resolveViewport,
|
|
15279
|
+
tableCellInsetX,
|
|
15280
|
+
unitId
|
|
15281
|
+
});
|
|
14906
15282
|
(_rootPage$skeColumnGr = rootPage.skeColumnGroups) === null || _rootPage$skeColumnGr === void 0 || _rootPage$skeColumnGr.forEach((columnGroup) => {
|
|
14907
15283
|
columnGroup.columns.forEach((columnGroupColumn) => {
|
|
14908
15284
|
const nestedPage = columnGroupColumn.page;
|
|
@@ -15305,6 +15681,12 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
15305
15681
|
if (!hasAddonStyle && originTextRun) fontCreateConfigCache.setValue(st, ed, result);
|
|
15306
15682
|
return result;
|
|
15307
15683
|
}
|
|
15684
|
+
function getCustomRangeGlyphWidth(index, viewModel, paragraphNode, config) {
|
|
15685
|
+
const customRange = viewModel.getCustomRange(index + paragraphNode.startIndex);
|
|
15686
|
+
const glyphWidthEm = customRange === null || customRange === void 0 ? void 0 : customRange.glyphWidthEm;
|
|
15687
|
+
if (typeof glyphWidthEm !== "number" || !Number.isFinite(glyphWidthEm) || glyphWidthEm < 0) return;
|
|
15688
|
+
return glyphWidthEm * config.fontStyle.originFontSize;
|
|
15689
|
+
}
|
|
15308
15690
|
function getNullSkeleton() {
|
|
15309
15691
|
return {
|
|
15310
15692
|
pages: [],
|
|
@@ -15321,6 +15703,7 @@ function setPageParent(pages, parent) {
|
|
|
15321
15703
|
for (const page of pages) page.parent = parent;
|
|
15322
15704
|
}
|
|
15323
15705
|
const DEFAULT_SECTION_BREAK = {
|
|
15706
|
+
sectionId: "section_render_default",
|
|
15324
15707
|
columnProperties: [],
|
|
15325
15708
|
columnSeparatorType: _univerjs_core.ColumnSeparatorType.NONE,
|
|
15326
15709
|
sectionType: _univerjs_core.SectionType.SECTION_TYPE_UNSPECIFIED,
|
|
@@ -15368,6 +15751,11 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15368
15751
|
let { documentStyle } = dataModel;
|
|
15369
15752
|
const { documentFlavor } = documentStyle;
|
|
15370
15753
|
let sectionBreak = viewModel.getSectionBreak(sectionNode.endIndex) || DEFAULT_SECTION_BREAK;
|
|
15754
|
+
const sectionBreaks = viewModel.getChildren().map((node) => viewModel.getSectionBreak(node.endIndex) || DEFAULT_SECTION_BREAK);
|
|
15755
|
+
sectionBreak = {
|
|
15756
|
+
...sectionBreak,
|
|
15757
|
+
...(0, _univerjs_core.resolveSectionHeaderFooterReferences)(documentStyle, sectionBreaks, nodeIndex)
|
|
15758
|
+
};
|
|
15371
15759
|
if (documentFlavor === _univerjs_core.DocumentFlavor.MODERN) {
|
|
15372
15760
|
var _documentStyle$pageSi, _documentStyle$pageSi2;
|
|
15373
15761
|
const modernPageWidth = (_documentStyle$pageSi = (_documentStyle$pageSi2 = documentStyle.pageSize) === null || _documentStyle$pageSi2 === void 0 ? void 0 : _documentStyle$pageSi2.width) !== null && _documentStyle$pageSi !== void 0 ? _documentStyle$pageSi : DEFAULT_MODERN_DOCUMENT_STYLE.pageSize.width;
|
|
@@ -15384,7 +15772,7 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15384
15772
|
vertexAngle: 0,
|
|
15385
15773
|
wrapStrategy: _univerjs_core.WrapStrategy.UNSPECIFIED
|
|
15386
15774
|
} } = documentStyle;
|
|
15387
|
-
const { charSpace = 0, linePitch = 15.6, gridType = _univerjs_core.GridType.LINES, pageNumberStart = global_pageNumberStart, pageSize = global_pageSize, pageOrient = global_pageOrient, marginTop = global_marginTop, marginBottom = global_marginBottom, marginRight = global_marginRight, marginLeft = global_marginLeft, marginHeader = global_marginHeader, marginFooter = global_marginFooter, defaultHeaderId = global_defaultHeaderId, defaultFooterId = global_defaultFooterId, evenPageHeaderId = global_evenPageHeaderId, evenPageFooterId = global_evenPageFooterId, firstPageHeaderId = global_firstPageHeaderId, firstPageFooterId = global_firstPageFooterId, useFirstPageHeaderFooter = global_useFirstPageHeaderFooter, evenAndOddHeaders = global_evenAndOddHeaders, columnProperties = [], columnSeparatorType = _univerjs_core.ColumnSeparatorType.NONE, contentDirection, sectionType, textDirection, renderConfig = global_renderConfig } = sectionBreak;
|
|
15775
|
+
const { sectionId, charSpace = 0, linePitch = 15.6, gridType = _univerjs_core.GridType.LINES, pageNumberStart = global_pageNumberStart, pageSize = global_pageSize, pageOrient = global_pageOrient, marginTop = global_marginTop, marginBottom = global_marginBottom, marginRight = global_marginRight, marginLeft = global_marginLeft, marginHeader = global_marginHeader, marginFooter = global_marginFooter, defaultHeaderId = global_defaultHeaderId, defaultFooterId = global_defaultFooterId, evenPageHeaderId = global_evenPageHeaderId, evenPageFooterId = global_evenPageFooterId, firstPageHeaderId = global_firstPageHeaderId, firstPageFooterId = global_firstPageFooterId, useFirstPageHeaderFooter = global_useFirstPageHeaderFooter, evenAndOddHeaders = global_evenAndOddHeaders, columnProperties = [], columnSeparatorType = _univerjs_core.ColumnSeparatorType.NONE, contentDirection, sectionType, textDirection, renderConfig = global_renderConfig } = sectionBreak;
|
|
15388
15776
|
const sectionNodeNext = viewModel.getChildren()[nodeIndex + 1];
|
|
15389
15777
|
const sectionTypeNext = (_viewModel$getSection = viewModel.getSectionBreak(sectionNodeNext === null || sectionNodeNext === void 0 ? void 0 : sectionNodeNext.endIndex)) === null || _viewModel$getSection === void 0 ? void 0 : _viewModel$getSection.sectionType;
|
|
15390
15778
|
const headerIds = {
|
|
@@ -15400,6 +15788,7 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15400
15788
|
if (pageSize.width === null) pageSize.width = Number.POSITIVE_INFINITY;
|
|
15401
15789
|
if (pageSize.height === null) pageSize.height = Number.POSITIVE_INFINITY;
|
|
15402
15790
|
return {
|
|
15791
|
+
sectionId,
|
|
15403
15792
|
charSpace,
|
|
15404
15793
|
linePitch,
|
|
15405
15794
|
gridType,
|
|
@@ -15444,20 +15833,22 @@ function getPageFromPath(skeletonData, path) {
|
|
|
15444
15833
|
const pageIndex = pathCopy.shift();
|
|
15445
15834
|
page = skeletonData.pages[pageIndex];
|
|
15446
15835
|
} else if (field === "skeTables") {
|
|
15447
|
-
var
|
|
15836
|
+
var _page$skeTables3;
|
|
15837
|
+
if (page == null) return null;
|
|
15448
15838
|
const tableId = pathCopy.shift();
|
|
15449
15839
|
pathCopy.shift();
|
|
15450
15840
|
const rowIndex = pathCopy.shift();
|
|
15451
15841
|
pathCopy.shift();
|
|
15452
15842
|
const cellIndex = pathCopy.shift();
|
|
15453
|
-
page = (
|
|
15843
|
+
page = (_page$skeTables3 = page.skeTables) === null || _page$skeTables3 === void 0 || (_page$skeTables3 = _page$skeTables3.get(tableId)) === null || _page$skeTables3 === void 0 || (_page$skeTables3 = _page$skeTables3.rows[rowIndex]) === null || _page$skeTables3 === void 0 ? void 0 : _page$skeTables3.cells[cellIndex];
|
|
15454
15844
|
} else if (field === "skeColumnGroups") {
|
|
15455
|
-
var
|
|
15845
|
+
var _page$skeColumnGroups2;
|
|
15846
|
+
if (page == null) return null;
|
|
15456
15847
|
const columnGroupId = pathCopy.shift();
|
|
15457
15848
|
pathCopy.shift();
|
|
15458
15849
|
const columnIndex = pathCopy.shift();
|
|
15459
15850
|
pathCopy.shift();
|
|
15460
|
-
page = (
|
|
15851
|
+
page = (_page$skeColumnGroups2 = page.skeColumnGroups) === null || _page$skeColumnGroups2 === void 0 || (_page$skeColumnGroups2 = _page$skeColumnGroups2.get(columnGroupId)) === null || _page$skeColumnGroups2 === void 0 || (_page$skeColumnGroups2 = _page$skeColumnGroups2.columns[columnIndex]) === null || _page$skeColumnGroups2 === void 0 ? void 0 : _page$skeColumnGroups2.page;
|
|
15461
15852
|
}
|
|
15462
15853
|
}
|
|
15463
15854
|
return page;
|
|
@@ -15470,13 +15861,14 @@ function getHeaderFooterMaxHeight(pageHeight) {
|
|
|
15470
15861
|
}
|
|
15471
15862
|
function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, pageNumber = 1, breakType = 0) {
|
|
15472
15863
|
const page = _getNullPage();
|
|
15473
|
-
const { pageNumberStart = 1, pageSize = {
|
|
15864
|
+
const { sectionId, pageNumberStart = 1, pageSize = {
|
|
15474
15865
|
width: Number.POSITIVE_INFINITY,
|
|
15475
15866
|
height: Number.POSITIVE_INFINITY
|
|
15476
15867
|
}, pageOrient = _univerjs_core.PageOrientType.PORTRAIT, headerIds = {}, footerIds = {}, useFirstPageHeaderFooter, evenAndOddHeaders, footerTreeMap, headerTreeMap, columnProperties = [], columnSeparatorType, marginTop = 0, marginBottom = 0, marginHeader: _marginHeader = 0, marginFooter: _marginFooter = 0, marginLeft = 0, marginRight = 0, renderConfig = {} } = sectionBreakConfig;
|
|
15477
15868
|
const { skeHeaders, skeFooters } = skeletonResourceReference;
|
|
15478
15869
|
const { width: pageWidth = Number.POSITIVE_INFINITY, height: pageHeight = Number.POSITIVE_INFINITY } = pageSize;
|
|
15479
15870
|
page.pageNumber = pageNumber;
|
|
15871
|
+
page.sectionId = sectionId;
|
|
15480
15872
|
page.pageNumberStart = pageNumberStart;
|
|
15481
15873
|
page.renderConfig = renderConfig;
|
|
15482
15874
|
page.marginLeft = marginLeft;
|
|
@@ -15524,8 +15916,8 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
15524
15916
|
}
|
|
15525
15917
|
page.originMarginTop = marginTop;
|
|
15526
15918
|
page.originMarginBottom = marginBottom;
|
|
15527
|
-
page.marginTop = _getVerticalMargin(marginTop, header
|
|
15528
|
-
page.marginBottom = _getVerticalMargin(marginBottom, footer
|
|
15919
|
+
page.marginTop = _getVerticalMargin(marginTop, header);
|
|
15920
|
+
page.marginBottom = _getVerticalMargin(marginBottom, footer);
|
|
15529
15921
|
const sections = page.sections;
|
|
15530
15922
|
const lastSection = sections[sections.length - 1];
|
|
15531
15923
|
const { marginTop: curPageMT, marginBottom: curPageMB, marginLeft: curPageML, marginRight: curPageMR } = page;
|
|
@@ -15571,10 +15963,11 @@ function _getNullPage(type = 0, segmentId = "") {
|
|
|
15571
15963
|
}
|
|
15572
15964
|
function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader = true, areaPage, count = 0) {
|
|
15573
15965
|
var _sectionBreakConfig$d;
|
|
15574
|
-
const { lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
15966
|
+
const { sectionId, lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
15575
15967
|
const pageWidth = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || Number.POSITIVE_INFINITY;
|
|
15576
15968
|
const pageHeight = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || Number.POSITIVE_INFINITY;
|
|
15577
15969
|
const headerFooterConfig = {
|
|
15970
|
+
sectionId,
|
|
15578
15971
|
lists,
|
|
15579
15972
|
footerTreeMap,
|
|
15580
15973
|
headerTreeMap,
|
|
@@ -15611,7 +16004,7 @@ function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakC
|
|
|
15611
16004
|
}
|
|
15612
16005
|
function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY) {
|
|
15613
16006
|
var _ref, _cellConfig$margin, _cellConfig$columnSpa;
|
|
15614
|
-
const { lists, footerTreeMap, headerTreeMap, localeService, drawings } = sectionBreakConfig;
|
|
16007
|
+
const { sectionId, lists, footerTreeMap, headerTreeMap, localeService, drawings } = sectionBreakConfig;
|
|
15615
16008
|
const { skeletonResourceReference } = ctx;
|
|
15616
16009
|
const { cellMargin, tableRows, tableColumns, tableId } = tableConfig;
|
|
15617
16010
|
const cellConfig = tableRows[row].tableCells[col];
|
|
@@ -15633,6 +16026,7 @@ function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, avai
|
|
|
15633
16026
|
}
|
|
15634
16027
|
const pageHeight = maxCellPageHeight;
|
|
15635
16028
|
const cellSectionBreakConfig = {
|
|
16029
|
+
sectionId,
|
|
15636
16030
|
lists,
|
|
15637
16031
|
footerTreeMap,
|
|
15638
16032
|
headerTreeMap,
|
|
@@ -15698,8 +16092,10 @@ function applyTrailingBlockRangeSpaceBelow(pages, body, containerEndIndex) {
|
|
|
15698
16092
|
page.height += lastLine.spaceBelowApply || trailingBlockRangeSpace;
|
|
15699
16093
|
}
|
|
15700
16094
|
}
|
|
15701
|
-
function _getVerticalMargin(marginTB,
|
|
15702
|
-
return marginTB;
|
|
16095
|
+
function _getVerticalMargin(marginTB, headerOrFooter) {
|
|
16096
|
+
if (headerOrFooter == null) return marginTB;
|
|
16097
|
+
const { marginTop = 0, height = 0, marginBottom = 0 } = headerOrFooter;
|
|
16098
|
+
return Math.max(marginTB, marginTop + height + marginBottom);
|
|
15703
16099
|
}
|
|
15704
16100
|
|
|
15705
16101
|
//#endregion
|
|
@@ -15791,7 +16187,7 @@ function getDivideStretchability(divide) {
|
|
|
15791
16187
|
function getJustifiables(divide) {
|
|
15792
16188
|
const justifiables = divide.glyphGroup.filter((glyph) => glyph.isJustifiable).length;
|
|
15793
16189
|
const lastGlyph = divide.glyphGroup[divide.glyphGroup.length - 1];
|
|
15794
|
-
if (hasCJK(lastGlyph.content)) return justifiables - 1;
|
|
16190
|
+
if (cjk.hasCJK(lastGlyph.content)) return justifiables - 1;
|
|
15795
16191
|
return justifiables;
|
|
15796
16192
|
}
|
|
15797
16193
|
function adjustGlyphsInDivide(divide, justificationRatio, extraJustification) {
|
|
@@ -15896,7 +16292,7 @@ function horizontalAlignHandler(line, horizontalAlign, allowOverflowHorizontalOf
|
|
|
15896
16292
|
function restoreLastCJKGlyphWidth(line) {
|
|
15897
16293
|
for (const divide of line.divides) {
|
|
15898
16294
|
const lastGlyph = divide.glyphGroup[divide.glyphGroup.length - 1];
|
|
15899
|
-
if (lastGlyph && divide.isFull && hasCJKText(lastGlyph.content) && lastGlyph.width - lastGlyph.xOffset > lastGlyph.bBox.width) {
|
|
16295
|
+
if (lastGlyph && divide.isFull && cjk.hasCJKText(lastGlyph.content) && lastGlyph.width - lastGlyph.xOffset > lastGlyph.bBox.width) {
|
|
15900
16296
|
const shrinkAmount = lastGlyph.width - lastGlyph.xOffset - lastGlyph.bBox.width;
|
|
15901
16297
|
lastGlyph.width -= shrinkAmount;
|
|
15902
16298
|
lastGlyph.adjustability.shrinkability[1] = 0;
|
|
@@ -16169,22 +16565,66 @@ function _isDocxColumnBreakVisuallyBlankColumn(column) {
|
|
|
16169
16565
|
function _hasOnlyCustomBlockGlyphs(glyphs) {
|
|
16170
16566
|
return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK);
|
|
16171
16567
|
}
|
|
16172
|
-
function _mergeAdjacentCustomBlockShapedTexts(shapedTextList) {
|
|
16568
|
+
function _mergeAdjacentCustomBlockShapedTexts(shapedTextList, customBlockDrawings) {
|
|
16173
16569
|
const mergedShapedTextList = [];
|
|
16174
|
-
for (const
|
|
16175
|
-
const
|
|
16176
|
-
|
|
16177
|
-
lastShapedText.
|
|
16178
|
-
lastShapedText.glyphs.
|
|
16179
|
-
|
|
16180
|
-
|
|
16570
|
+
for (const originShapedText of shapedTextList) {
|
|
16571
|
+
const splitShapedTexts = _splitTopBottomCustomBlockShapedText(originShapedText, customBlockDrawings);
|
|
16572
|
+
for (const shapedText of splitShapedTexts) {
|
|
16573
|
+
const lastShapedText = mergedShapedTextList[mergedShapedTextList.length - 1];
|
|
16574
|
+
if (lastShapedText && _hasOnlyCustomBlockGlyphs(lastShapedText.glyphs) && _hasOnlyCustomBlockGlyphs(shapedText.glyphs) && !_hasTopBottomCustomBlockGlyph(lastShapedText.glyphs, customBlockDrawings) && !_hasTopBottomCustomBlockGlyph(shapedText.glyphs, customBlockDrawings)) {
|
|
16575
|
+
lastShapedText.text += shapedText.text;
|
|
16576
|
+
lastShapedText.glyphs.push(...shapedText.glyphs);
|
|
16577
|
+
lastShapedText.breakPointType = shapedText.breakPointType;
|
|
16578
|
+
continue;
|
|
16579
|
+
}
|
|
16580
|
+
mergedShapedTextList.push({
|
|
16581
|
+
...shapedText,
|
|
16582
|
+
glyphs: [...shapedText.glyphs]
|
|
16583
|
+
});
|
|
16181
16584
|
}
|
|
16182
|
-
|
|
16585
|
+
}
|
|
16586
|
+
return mergedShapedTextList;
|
|
16587
|
+
}
|
|
16588
|
+
function _splitTopBottomCustomBlockShapedText(shapedText, customBlockDrawings) {
|
|
16589
|
+
const splitShapedTexts = [];
|
|
16590
|
+
let pendingGlyphs = [];
|
|
16591
|
+
let pendingText = "";
|
|
16592
|
+
let textOffset = 0;
|
|
16593
|
+
const flushPending = () => {
|
|
16594
|
+
if (pendingGlyphs.length === 0) return;
|
|
16595
|
+
splitShapedTexts.push({
|
|
16183
16596
|
...shapedText,
|
|
16184
|
-
|
|
16597
|
+
text: pendingText,
|
|
16598
|
+
glyphs: pendingGlyphs
|
|
16185
16599
|
});
|
|
16600
|
+
pendingGlyphs = [];
|
|
16601
|
+
pendingText = "";
|
|
16602
|
+
};
|
|
16603
|
+
for (const glyph of shapedText.glyphs) {
|
|
16604
|
+
const glyphText = shapedText.text.slice(textOffset, textOffset + glyph.count);
|
|
16605
|
+
textOffset += glyph.count;
|
|
16606
|
+
if (_isTopBottomCustomBlockGlyph(glyph, customBlockDrawings)) {
|
|
16607
|
+
flushPending();
|
|
16608
|
+
splitShapedTexts.push({
|
|
16609
|
+
...shapedText,
|
|
16610
|
+
text: glyphText,
|
|
16611
|
+
glyphs: [glyph]
|
|
16612
|
+
});
|
|
16613
|
+
continue;
|
|
16614
|
+
}
|
|
16615
|
+
pendingGlyphs.push(glyph);
|
|
16616
|
+
pendingText += glyphText;
|
|
16186
16617
|
}
|
|
16187
|
-
|
|
16618
|
+
flushPending();
|
|
16619
|
+
return splitShapedTexts.length > 0 ? splitShapedTexts : [shapedText];
|
|
16620
|
+
}
|
|
16621
|
+
function _hasTopBottomCustomBlockGlyph(glyphs, customBlockDrawings) {
|
|
16622
|
+
return glyphs.some((glyph) => _isTopBottomCustomBlockGlyph(glyph, customBlockDrawings));
|
|
16623
|
+
}
|
|
16624
|
+
function _isTopBottomCustomBlockGlyph(glyph, customBlockDrawings) {
|
|
16625
|
+
var _customBlockDrawings$;
|
|
16626
|
+
if (glyph.streamType !== _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK || glyph.drawingId == null) return false;
|
|
16627
|
+
return ((_customBlockDrawings$ = customBlockDrawings.get(glyph.drawingId)) === null || _customBlockDrawings$ === void 0 ? void 0 : _customBlockDrawings$.drawingOrigin.layoutType) === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM;
|
|
16188
16628
|
}
|
|
16189
16629
|
function _getListLevelAncestors(bullet, listLevel) {
|
|
16190
16630
|
if (!bullet || !listLevel) return;
|
|
@@ -16230,26 +16670,17 @@ function _hasNextAdjacentLayoutBlockRange(blockRanges, blockRange) {
|
|
|
16230
16670
|
const nextBlockRange = _getNextAdjacentBlockRange(blockRanges, blockRange);
|
|
16231
16671
|
return nextBlockRange != null && BLOCK_LAYOUT_OUTER_SPACING_MAP.has(nextBlockRange.blockType) && nextBlockRange.startIndex === blockRange.endIndex + 1;
|
|
16232
16672
|
}
|
|
16233
|
-
function
|
|
16234
|
-
if (style.lineSpacing == null) style.lineSpacing = _univerjs_core.DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING;
|
|
16235
|
-
if (hasBlockRange) return;
|
|
16236
|
-
if (style.spaceAbove == null) style.spaceAbove = { v: _univerjs_core.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE };
|
|
16237
|
-
if (style.spaceBelow == null) style.spaceBelow = { v: _univerjs_core.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW };
|
|
16238
|
-
}
|
|
16239
|
-
function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, shouldApplyDocumentDefaults) {
|
|
16673
|
+
function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, documentStyle, useLegacyModernDefaults) {
|
|
16240
16674
|
var _body$paragraphs, _BLOCK_LAYOUT_OUTER_S;
|
|
16241
|
-
const style = _univerjs_core.Tools.deepClone(paragraphStyle);
|
|
16242
16675
|
const blockRanges = body === null || body === void 0 ? void 0 : body.blockRanges;
|
|
16243
|
-
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) {
|
|
16244
|
-
if (shouldApplyDocumentDefaults) _applyDefaultLayoutParagraphStyle(style, false);
|
|
16245
|
-
return style;
|
|
16246
|
-
}
|
|
16676
|
+
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) return (0, _univerjs_core.resolveDocumentParagraphStyle)(documentStyle, paragraphStyle, { useLegacyModernDefaults });
|
|
16247
16677
|
const blockRange = blockRanges.find((range) => BLOCK_LAYOUT_OUTER_SPACING_MAP.has(range.blockType) && paragraph.startIndex > range.startIndex && paragraph.startIndex < range.endIndex);
|
|
16248
|
-
if (!blockRange) {
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16678
|
+
if (!blockRange) return (0, _univerjs_core.resolveDocumentParagraphStyle)(documentStyle, paragraphStyle, { useLegacyModernDefaults });
|
|
16679
|
+
const style = (0, _univerjs_core.resolveDocumentParagraphStyle)(documentStyle, paragraphStyle, {
|
|
16680
|
+
excludeDocumentOuterSpacing: true,
|
|
16681
|
+
useLegacyModernDefaults
|
|
16682
|
+
});
|
|
16683
|
+
if (style.lineSpacing == null) style.lineSpacing = _univerjs_core.DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING;
|
|
16253
16684
|
const blockParagraphs = ((_body$paragraphs = body === null || body === void 0 ? void 0 : body.paragraphs) !== null && _body$paragraphs !== void 0 ? _body$paragraphs : []).filter((item) => item.startIndex > blockRange.startIndex && item.startIndex < blockRange.endIndex).sort((left, right) => left.startIndex - right.startIndex);
|
|
16254
16685
|
const firstParagraph = blockParagraphs[0];
|
|
16255
16686
|
const lastParagraph = blockParagraphs[blockParagraphs.length - 1];
|
|
@@ -16298,7 +16729,7 @@ function _getNextPageNumber(lastPage) {
|
|
|
16298
16729
|
return lastPage.pageNumber + 1;
|
|
16299
16730
|
}
|
|
16300
16731
|
function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, sectionBreakConfig, tableSkeleton) {
|
|
16301
|
-
var
|
|
16732
|
+
var _viewModel$getSnapsho, _sectionBreakConfig$d, _viewModel$getBody2, _viewModel$getBody3;
|
|
16302
16733
|
const { skeletonResourceReference } = ctx;
|
|
16303
16734
|
const { lists, drawings = {}, localeService } = sectionBreakConfig;
|
|
16304
16735
|
const { endIndex, blocks = [], children } = paragraphNode;
|
|
@@ -16308,7 +16739,8 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16308
16739
|
paragraphId: "para_render_fallback"
|
|
16309
16740
|
};
|
|
16310
16741
|
const { paragraphStyle = {}, bullet } = paragraph;
|
|
16311
|
-
const
|
|
16742
|
+
const documentStyle = (_viewModel$getSnapsho = viewModel.getSnapshot) === null || _viewModel$getSnapsho === void 0 || (_viewModel$getSnapsho = _viewModel$getSnapsho.call(viewModel)) === null || _viewModel$getSnapsho === void 0 ? void 0 : _viewModel$getSnapsho.documentStyle;
|
|
16743
|
+
const documentCompatibilityPolicy = (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor);
|
|
16312
16744
|
const shouldApplyDocumentDefaults = documentCompatibilityPolicy.applyDocumentDefaultParagraphStyle;
|
|
16313
16745
|
const useWordStyleLineHeight = documentCompatibilityPolicy.useWordStyleLineHeight;
|
|
16314
16746
|
const { skeHeaders, skeFooters, skeListLevel, drawingAnchor } = skeletonResourceReference;
|
|
@@ -16324,7 +16756,7 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16324
16756
|
const paragraphConfig = {
|
|
16325
16757
|
paragraphIndex: endIndex,
|
|
16326
16758
|
documentCompatibilityPolicy,
|
|
16327
|
-
paragraphStyle: _applyBlockRangeLayoutParagraphStyle((_viewModel$getBody2 = (_viewModel$getBody3 = viewModel.getBody) === null || _viewModel$getBody3 === void 0 ? void 0 : _viewModel$getBody3.call(viewModel)) !== null && _viewModel$getBody2 !== void 0 ? _viewModel$getBody2 : null, paragraph, paragraphStyle, shouldApplyDocumentDefaults),
|
|
16759
|
+
paragraphStyle: _applyBlockRangeLayoutParagraphStyle((_viewModel$getBody2 = (_viewModel$getBody3 = viewModel.getBody) === null || _viewModel$getBody3 === void 0 ? void 0 : _viewModel$getBody3.call(viewModel)) !== null && _viewModel$getBody2 !== void 0 ? _viewModel$getBody2 : null, paragraph, paragraphStyle, documentStyle, shouldApplyDocumentDefaults),
|
|
16328
16760
|
docxFallbackAnchorLeft: _getFollowingIndentedParagraphAnchorLeft(viewModel, paragraph, paragraphNode, drawings, isTraditionalDocumentCompatibility(documentCompatibilityPolicy)),
|
|
16329
16761
|
useWordStyleLineHeight,
|
|
16330
16762
|
paragraphNonInlineSkeDrawings,
|
|
@@ -16367,7 +16799,7 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16367
16799
|
let allPages = [curPage];
|
|
16368
16800
|
let isParagraphFirstShapedText = true;
|
|
16369
16801
|
let shapedTextOffset = 0;
|
|
16370
|
-
for (const [_index, { text, glyphs, breakPointType }] of _mergeAdjacentCustomBlockShapedTexts(shapedTextList).entries()) {
|
|
16802
|
+
for (const [_index, { text, glyphs, breakPointType }] of _mergeAdjacentCustomBlockShapedTexts(shapedTextList, paragraphNonInlineSkeDrawingsByBlockId).entries()) {
|
|
16371
16803
|
const textStartIndex = paragraphNode.startIndex + shapedTextOffset;
|
|
16372
16804
|
const textGlyphCount = _glyphCount(glyphs);
|
|
16373
16805
|
const textEndIndex = textStartIndex + textGlyphCount;
|
|
@@ -16884,7 +17316,8 @@ function otherHandler(index, charArray, viewModel, paragraphNode, sectionBreakCo
|
|
|
16884
17316
|
const char = (_src$match = src.match(/^[\s\S]/gu)) === null || _src$match === void 0 ? void 0 : _src$match[0];
|
|
16885
17317
|
if (char == null) break;
|
|
16886
17318
|
if (hasSpace(char) || startWithEmoji(charArray.substring(step))) break;
|
|
16887
|
-
const
|
|
17319
|
+
const config = getFontCreateConfig(index + step, viewModel, paragraphNode, sectionBreakConfig, paragraph);
|
|
17320
|
+
const glyph = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphWidth(index + step, viewModel, paragraphNode, config));
|
|
16888
17321
|
glyphGroup.push(glyph);
|
|
16889
17322
|
src = src.substring(char.length);
|
|
16890
17323
|
step += char.length;
|
|
@@ -16960,7 +17393,7 @@ function punctuationSpaceAdjustment(shapedGlyphs) {
|
|
|
16960
17393
|
const nextGlyph = shapedGlyphs[i + 1];
|
|
16961
17394
|
const { width, content } = curGlyph;
|
|
16962
17395
|
const delta = width / 2;
|
|
16963
|
-
if (hasCJKPunctuation(content) && hasCJKPunctuation(nextGlyph.content) && curGlyph.adjustability.shrinkability[1] + nextGlyph.adjustability.shrinkability[0] >= delta) {
|
|
17396
|
+
if (cjk.hasCJKPunctuation(content) && cjk.hasCJKPunctuation(nextGlyph.content) && curGlyph.adjustability.shrinkability[1] + nextGlyph.adjustability.shrinkability[0] >= delta) {
|
|
16964
17397
|
const leftDelta = Math.min(curGlyph.adjustability.shrinkability[1], delta);
|
|
16965
17398
|
glyphShrinkRight(curGlyph, leftDelta);
|
|
16966
17399
|
glyphShrinkLeft(nextGlyph, delta - leftDelta);
|
|
@@ -16976,11 +17409,11 @@ function addCJKLatinSpacing(shapedTextList) {
|
|
|
16976
17409
|
const curGlyph = shapedGlyphs[i];
|
|
16977
17410
|
const nextGlyph = i < len - 1 ? shapedGlyphs[i + 1] : null;
|
|
16978
17411
|
const { width } = curGlyph;
|
|
16979
|
-
if (hasCJKText(curGlyph.content) && nextGlyph && LATIN_REG.test(nextGlyph.content)) {
|
|
17412
|
+
if (cjk.hasCJKText(curGlyph.content) && nextGlyph && LATIN_REG.test(nextGlyph.content)) {
|
|
16980
17413
|
curGlyph.width += width / 4;
|
|
16981
17414
|
curGlyph.adjustability.shrinkability[1] += width / 8;
|
|
16982
17415
|
}
|
|
16983
|
-
if (hasCJKText(curGlyph.content) && prevGlyph && LATIN_REG.test(prevGlyph.content)) {
|
|
17416
|
+
if (cjk.hasCJKText(curGlyph.content) && prevGlyph && LATIN_REG.test(prevGlyph.content)) {
|
|
16984
17417
|
curGlyph.width += width / 4;
|
|
16985
17418
|
curGlyph.xOffset += width / 4;
|
|
16986
17419
|
curGlyph.adjustability.shrinkability[0] += width / 8;
|
|
@@ -17042,7 +17475,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
17042
17475
|
const newSpan = createSkeletonLetterGlyph(char, config);
|
|
17043
17476
|
shapedGlyphs.push(newSpan);
|
|
17044
17477
|
} else {
|
|
17045
|
-
const newSpan = createSkeletonLetterGlyph(char, config,
|
|
17478
|
+
const newSpan = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphWidth(start, viewModel, paragraphNode, config), glyphInfo);
|
|
17046
17479
|
shapedGlyphs.push(newSpan);
|
|
17047
17480
|
}
|
|
17048
17481
|
}
|
|
@@ -17061,24 +17494,29 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
17061
17494
|
const { blockId } = customBlock;
|
|
17062
17495
|
const drawingOrigin = drawings[blockId];
|
|
17063
17496
|
if ((drawingOrigin === null || drawingOrigin === void 0 ? void 0 : drawingOrigin.layoutType) === _univerjs_core.PositionedObjectLayoutType.INLINE) {
|
|
17497
|
+
var _viewModel$getDataMod, _viewModel$getDataMod2, _viewModel$getDataMod3, _boundingBox$height, _boundingBox$width, _ref, _viewport$layoutWidth, _viewport$height;
|
|
17064
17498
|
const { angle } = drawingOrigin.docTransform;
|
|
17065
17499
|
const { width = 0, height = 0 } = drawingOrigin.docTransform.size;
|
|
17066
17500
|
const boundingBox = getBoundingBox(angle, 0, width, 0, height);
|
|
17067
|
-
|
|
17501
|
+
const viewport = getDocsCustomBlockRenderViewport((_viewModel$getDataMod = (_viewModel$getDataMod2 = (_viewModel$getDataMod3 = viewModel.getDataModel()).getUnitId) === null || _viewModel$getDataMod2 === void 0 ? void 0 : _viewModel$getDataMod2.call(_viewModel$getDataMod3)) !== null && _viewModel$getDataMod !== void 0 ? _viewModel$getDataMod : "", drawingOrigin.drawingId, {
|
|
17502
|
+
fallbackHeight: (_boundingBox$height = boundingBox.height) !== null && _boundingBox$height !== void 0 ? _boundingBox$height : 0,
|
|
17503
|
+
fallbackWidth: (_boundingBox$width = boundingBox.width) !== null && _boundingBox$width !== void 0 ? _boundingBox$width : 0
|
|
17504
|
+
});
|
|
17505
|
+
newGlyph = createSkeletonCustomBlockGlyph(config, (_ref = (_viewport$layoutWidth = viewport === null || viewport === void 0 ? void 0 : viewport.layoutWidth) !== null && _viewport$layoutWidth !== void 0 ? _viewport$layoutWidth : viewport === null || viewport === void 0 ? void 0 : viewport.width) !== null && _ref !== void 0 ? _ref : boundingBox.width, (_viewport$height = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height !== void 0 ? _viewport$height : boundingBox.height, drawingOrigin.drawingId);
|
|
17068
17506
|
} else if (drawingOrigin != null) newGlyph = createSkeletonCustomBlockGlyph(config, 0, 0, drawingOrigin.drawingId);
|
|
17069
17507
|
}
|
|
17070
17508
|
if (newGlyph == null) newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17071
17509
|
shapedGlyphs.push(newGlyph);
|
|
17072
17510
|
i += char.length;
|
|
17073
17511
|
src = src.substring(char.length);
|
|
17074
|
-
} else if (/\s/.test(char) || hasCJK(char)) {
|
|
17512
|
+
} else if (/\s/.test(char) || cjk.hasCJK(char)) {
|
|
17075
17513
|
const config = getFontCreateConfig(i, viewModel, paragraphNode, sectionBreakConfig, paragraph);
|
|
17076
17514
|
let newGlyph = null;
|
|
17077
17515
|
if (char === _univerjs_core.DataStreamTreeTokenType.TAB) newGlyph = createSkeletonTabGlyph(config, getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid));
|
|
17078
17516
|
else if (char === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH) {
|
|
17079
17517
|
var _sectionBreakConfig$r;
|
|
17080
17518
|
if (((_sectionBreakConfig$r = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r === void 0 ? void 0 : _sectionBreakConfig$r.zeroWidthParagraphBreak) === _univerjs_core.BooleanNumber.TRUE) newGlyph = createSkeletonLetterGlyph(char, config, 0);
|
|
17081
|
-
else newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17519
|
+
else newGlyph = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphWidth(i, viewModel, paragraphNode, config));
|
|
17082
17520
|
} else newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17083
17521
|
shapedGlyphs.push(newGlyph);
|
|
17084
17522
|
i += char.length;
|
|
@@ -17225,6 +17663,7 @@ function createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig,
|
|
|
17225
17663
|
const page = createSkeletonPage(ctx, columnSectionBreakConfig, ctx.skeletonResourceReference);
|
|
17226
17664
|
page.type = 3;
|
|
17227
17665
|
for (const paragraphNode of getColumnParagraphNodes(columnNode)) dealWidthParagraph(ctx, viewModel, paragraphNode, page, columnSectionBreakConfig);
|
|
17666
|
+
updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
17228
17667
|
updateBlockIndex([page], columnNode.startIndex, (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy());
|
|
17229
17668
|
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);
|
|
17230
17669
|
return page;
|
|
@@ -17871,6 +18310,26 @@ function resolveMostSpecificPageByCharIndex(page, charIndex) {
|
|
|
17871
18310
|
}
|
|
17872
18311
|
return page;
|
|
17873
18312
|
}
|
|
18313
|
+
function getSegmentPageFromRelativePath(skeletonData, segmentPageIndex, path) {
|
|
18314
|
+
var _skeletonData$skeHead, _skeletonData$skeFoot;
|
|
18315
|
+
const rootPage = skeletonData.pages[segmentPageIndex];
|
|
18316
|
+
if (rootPage == null) return null;
|
|
18317
|
+
const { headerId, footerId, pageWidth } = rootPage;
|
|
18318
|
+
const segmentPages = [headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(pageWidth), footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(pageWidth)];
|
|
18319
|
+
for (const segmentPage of segmentPages) {
|
|
18320
|
+
if (segmentPage == null) continue;
|
|
18321
|
+
const page = getPageFromPath({
|
|
18322
|
+
...skeletonData,
|
|
18323
|
+
pages: [segmentPage]
|
|
18324
|
+
}, [
|
|
18325
|
+
"pages",
|
|
18326
|
+
0,
|
|
18327
|
+
...path
|
|
18328
|
+
]);
|
|
18329
|
+
if (page != null) return page;
|
|
18330
|
+
}
|
|
18331
|
+
return null;
|
|
18332
|
+
}
|
|
17874
18333
|
var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
17875
18334
|
constructor(_docViewModel, localeService) {
|
|
17876
18335
|
super(localeService);
|
|
@@ -17965,7 +18424,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17965
18424
|
pageIndex = skeletonData.pages.indexOf(page);
|
|
17966
18425
|
break;
|
|
17967
18426
|
case 3:
|
|
17968
|
-
pageIndex = path[1];
|
|
18427
|
+
pageIndex = typeof path[1] === "number" ? path[1] : segmentPage;
|
|
17969
18428
|
break;
|
|
17970
18429
|
default: throw new Error("Invalid page type");
|
|
17971
18430
|
}
|
|
@@ -18011,7 +18470,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
18011
18470
|
pageIndex = pages.indexOf(page);
|
|
18012
18471
|
break;
|
|
18013
18472
|
case 3:
|
|
18014
|
-
pageIndex = path[1];
|
|
18473
|
+
pageIndex = typeof path[1] === "number" ? path[1] : segmentPageIndex;
|
|
18015
18474
|
break;
|
|
18016
18475
|
default: throw new Error("Invalid page type");
|
|
18017
18476
|
}
|
|
@@ -18054,7 +18513,8 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
18054
18513
|
if (skeFooter == null) return;
|
|
18055
18514
|
else skePage = skeFooter;
|
|
18056
18515
|
}
|
|
18057
|
-
} else skePage =
|
|
18516
|
+
} else if (pageType === 3 && path[0] !== "pages") skePage = getSegmentPageFromRelativePath(skeletonData, segmentPage, path);
|
|
18517
|
+
else skePage = getPageFromPath(skeletonData, path);
|
|
18058
18518
|
if (skePage == null) return;
|
|
18059
18519
|
const glyphGroup = skePage.sections[section].columns[column].lines[line].divides[divide].glyphGroup;
|
|
18060
18520
|
glyph = Math.min(glyph, glyphGroup.length - 1);
|
|
@@ -18562,8 +19022,8 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
18562
19022
|
if (maybeHeaderSke) segmentPage = maybeHeaderSke;
|
|
18563
19023
|
else if (maybeFooterSke) segmentPage = maybeFooterSke;
|
|
18564
19024
|
else continue;
|
|
18565
|
-
|
|
18566
|
-
|
|
19025
|
+
segmentPage = resolveMostSpecificPageByCharIndex(segmentPage, charIndex);
|
|
19026
|
+
} else segmentPage = resolveMostSpecificPageByCharIndex(page, charIndex);
|
|
18567
19027
|
const { sections, st, ed } = segmentPage;
|
|
18568
19028
|
const segmentPageParent = segmentPage.parent;
|
|
18569
19029
|
const isColumnSegmentPage = segmentId === "" && (segmentPageParent === null || segmentPageParent === void 0 ? void 0 : segmentPageParent.page) === segmentPage && ((_segmentPageParent$pa = segmentPageParent.parent) === null || _segmentPageParent$pa === void 0 ? void 0 : _segmentPageParent$pa.columnGroupId);
|
|
@@ -18645,7 +19105,10 @@ function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
|
18645
19105
|
paragraphId: (0, _univerjs_core.createParagraphId)(/* @__PURE__ */ new Set()),
|
|
18646
19106
|
paragraphStyle: { horizontalAlign }
|
|
18647
19107
|
}],
|
|
18648
|
-
sectionBreaks: [{
|
|
19108
|
+
sectionBreaks: [{
|
|
19109
|
+
sectionId: (0, _univerjs_core.createSectionId)(/* @__PURE__ */ new Set()),
|
|
19110
|
+
startIndex: contentLength + 1
|
|
19111
|
+
}]
|
|
18649
19112
|
},
|
|
18650
19113
|
documentStyle: {
|
|
18651
19114
|
pageSize: {
|
|
@@ -18729,6 +19192,36 @@ const DEFAULT_PADDING_DATA = {
|
|
|
18729
19192
|
r: 2
|
|
18730
19193
|
};
|
|
18731
19194
|
const RENDER_RAW_FORMULA_KEY = "RENDER_RAW_FORMULA";
|
|
19195
|
+
function getResolvedRenderHorizontalAlign$1(horizontalAlign, cellData) {
|
|
19196
|
+
if (horizontalAlign !== _univerjs_core.HorizontalAlign.UNSPECIFIED) return horizontalAlign;
|
|
19197
|
+
if ((cellData === null || cellData === void 0 ? void 0 : cellData.t) === _univerjs_core.CellValueType.NUMBER || !_univerjs_core.Tools.isDefine(cellData === null || cellData === void 0 ? void 0 : cellData.t) && typeof (cellData === null || cellData === void 0 ? void 0 : cellData.v) === "number") return _univerjs_core.HorizontalAlign.RIGHT;
|
|
19198
|
+
if ((cellData === null || cellData === void 0 ? void 0 : cellData.t) === _univerjs_core.CellValueType.BOOLEAN) return _univerjs_core.HorizontalAlign.CENTER;
|
|
19199
|
+
return horizontalAlign;
|
|
19200
|
+
}
|
|
19201
|
+
function setRenderTextCache(cacheItem, cellData) {
|
|
19202
|
+
var _cacheItem$horizontal;
|
|
19203
|
+
if (cacheItem.documentSkeleton) {
|
|
19204
|
+
cacheItem.displayText = void 0;
|
|
19205
|
+
cacheItem.resolvedHorizontalAlign = void 0;
|
|
19206
|
+
return;
|
|
19207
|
+
}
|
|
19208
|
+
cacheItem.displayText = (0, _univerjs_core.getDisplayValueFromCell)(cellData);
|
|
19209
|
+
cacheItem.resolvedHorizontalAlign = getResolvedRenderHorizontalAlign$1((_cacheItem$horizontal = cacheItem.horizontalAlign) !== null && _cacheItem$horizontal !== void 0 ? _cacheItem$horizontal : _univerjs_core.HorizontalAlign.UNSPECIFIED, cellData);
|
|
19210
|
+
}
|
|
19211
|
+
function pushRowRange(ranges, row, startColumn, endColumn) {
|
|
19212
|
+
if (endColumn < startColumn) return;
|
|
19213
|
+
const last = ranges[ranges.length - 1];
|
|
19214
|
+
if (last && last.startRow === row && last.endRow === row && last.endColumn + 1 === startColumn) {
|
|
19215
|
+
last.endColumn = endColumn;
|
|
19216
|
+
return;
|
|
19217
|
+
}
|
|
19218
|
+
ranges.push({
|
|
19219
|
+
startRow: row,
|
|
19220
|
+
endRow: row,
|
|
19221
|
+
startColumn,
|
|
19222
|
+
endColumn
|
|
19223
|
+
});
|
|
19224
|
+
}
|
|
18732
19225
|
const CACHE_COUNT = 100;
|
|
18733
19226
|
let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.SheetSkeleton {
|
|
18734
19227
|
constructor(worksheet, _styles, _localeService, _contextService, _configService, _injector) {
|
|
@@ -18742,6 +19235,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
18742
19235
|
_defineProperty(this, "_cacheRangeMap", /* @__PURE__ */ new Map());
|
|
18743
19236
|
_defineProperty(this, "_visibleRangeMap", /* @__PURE__ */ new Map());
|
|
18744
19237
|
_defineProperty(this, "_overflowCache", new _univerjs_core.ObjectMatrix());
|
|
19238
|
+
_defineProperty(this, "_incrementalFontRenderRanges", []);
|
|
18745
19239
|
_defineProperty(this, "_stylesCache", {
|
|
18746
19240
|
background: {},
|
|
18747
19241
|
backgroundPositions: new _univerjs_core.ObjectMatrix(),
|
|
@@ -18799,6 +19293,9 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
18799
19293
|
get overflowCache() {
|
|
18800
19294
|
return this._overflowCache;
|
|
18801
19295
|
}
|
|
19296
|
+
get incrementalFontRenderRanges() {
|
|
19297
|
+
return this._incrementalFontRenderRanges;
|
|
19298
|
+
}
|
|
18802
19299
|
get showGridlines() {
|
|
18803
19300
|
return this._showGridlines;
|
|
18804
19301
|
}
|
|
@@ -18884,7 +19381,31 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
18884
19381
|
this.updateVisibleRange(vpInfo);
|
|
18885
19382
|
const rowColumnSegment = this._drawingRange;
|
|
18886
19383
|
const columnWidthAccumulation = this.columnWidthAccumulation;
|
|
18887
|
-
const
|
|
19384
|
+
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);
|
|
19385
|
+
const hasMergeData = this.worksheet.getMergeData().length > 0;
|
|
19386
|
+
const isScrolling = !!vpInfo && (!!vpInfo.diffX || !!vpInfo.diffY);
|
|
19387
|
+
const shouldRefreshCacheForScroll = isIncrementalScroll && (hasMergeData && isScrolling || !!vpInfo.shouldCacheUpdate && !!vpInfo.diffX);
|
|
19388
|
+
const shouldUseIncrementalStyleRange = isIncrementalScroll && !shouldRefreshCacheForScroll;
|
|
19389
|
+
const styleRanges = shouldUseIncrementalStyleRange ? vpInfo.shouldCacheUpdate ? (_vpInfo$diffCacheBoun2 = (_vpInfo$diffCacheBoun3 = vpInfo.diffCacheBounds) === null || _vpInfo$diffCacheBoun3 === void 0 ? void 0 : _vpInfo$diffCacheBoun3.map((bound) => this.getRangeByViewBound(bound))) !== null && _vpInfo$diffCacheBoun2 !== void 0 ? _vpInfo$diffCacheBoun2 : [] : [] : [rowColumnSegment];
|
|
19390
|
+
const visibleCellOptions = hasMergeData ? null : {
|
|
19391
|
+
cacheItem: {
|
|
19392
|
+
bg: true,
|
|
19393
|
+
border: true
|
|
19394
|
+
},
|
|
19395
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19396
|
+
hasMergeData,
|
|
19397
|
+
rowVisible: true
|
|
19398
|
+
};
|
|
19399
|
+
const overflowCellOptions = hasMergeData ? null : {
|
|
19400
|
+
cacheItem: {
|
|
19401
|
+
bg: false,
|
|
19402
|
+
border: false
|
|
19403
|
+
},
|
|
19404
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19405
|
+
hasMergeData,
|
|
19406
|
+
rowVisible: true
|
|
19407
|
+
};
|
|
19408
|
+
this._incrementalFontRenderRanges = [];
|
|
18888
19409
|
for (const styleRange of styleRanges) {
|
|
18889
19410
|
const { startRow: visibleStartRow, endRow: visibleEndRow, startColumn: visibleStartColumn, endColumn: visibleEndColumn } = styleRange;
|
|
18890
19411
|
if (visibleEndColumn === -1 || visibleEndRow === -1) continue;
|
|
@@ -18909,26 +19430,57 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
18909
19430
|
startColumn: visibleStartColumn,
|
|
18910
19431
|
endColumn: visibleEndColumn
|
|
18911
19432
|
});
|
|
18912
|
-
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c,
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
19433
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, visibleCellOptions !== null && visibleCellOptions !== void 0 ? visibleCellOptions : {
|
|
19434
|
+
cacheItem: {
|
|
19435
|
+
bg: true,
|
|
19436
|
+
border: true
|
|
19437
|
+
},
|
|
19438
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19439
|
+
hasMergeData,
|
|
19440
|
+
rowVisible: true
|
|
19441
|
+
});
|
|
19442
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, visibleStartColumn, visibleEndColumn);
|
|
19443
|
+
for (let c = visibleStartColumn - 1; c >= expandStartCol; c--) {
|
|
19444
|
+
this._setStylesCacheForOneCell(r, c, overflowCellOptions !== null && overflowCellOptions !== void 0 ? overflowCellOptions : {
|
|
19445
|
+
cacheItem: {
|
|
19446
|
+
bg: false,
|
|
19447
|
+
border: false
|
|
19448
|
+
},
|
|
19449
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19450
|
+
hasMergeData,
|
|
19451
|
+
rowVisible: true
|
|
19452
|
+
});
|
|
19453
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, c, c);
|
|
19454
|
+
if (!(0, _univerjs_core.isCellCoverable)(this.worksheet.getCell(r, c)) || hasMergeData && this.intersectMergeRange(r, c)) break;
|
|
19455
|
+
}
|
|
18920
19456
|
if (visibleEndColumn === 0) continue;
|
|
18921
|
-
for (let c = visibleEndColumn + 1; c
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
19457
|
+
for (let c = visibleEndColumn + 1; c <= expandEndCol; c++) {
|
|
19458
|
+
this._setStylesCacheForOneCell(r, c, overflowCellOptions !== null && overflowCellOptions !== void 0 ? overflowCellOptions : {
|
|
19459
|
+
cacheItem: {
|
|
19460
|
+
bg: false,
|
|
19461
|
+
border: false
|
|
19462
|
+
},
|
|
19463
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19464
|
+
hasMergeData,
|
|
19465
|
+
rowVisible: true
|
|
19466
|
+
});
|
|
19467
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, c, c);
|
|
19468
|
+
if (!(0, _univerjs_core.isCellCoverable)(this.worksheet.getCell(r, c)) || hasMergeData && this.intersectMergeRange(r, c)) break;
|
|
19469
|
+
}
|
|
18925
19470
|
}
|
|
18926
19471
|
const mergeRanges = [];
|
|
18927
19472
|
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
18928
19473
|
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
18929
19474
|
mergeRanges.push(...mergeRangeInVisible);
|
|
18930
19475
|
}
|
|
18931
|
-
for (const mergeRange of mergeRanges)
|
|
19476
|
+
for (const mergeRange of mergeRanges) {
|
|
19477
|
+
this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, {
|
|
19478
|
+
mergeRange,
|
|
19479
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19480
|
+
hasMergeData
|
|
19481
|
+
});
|
|
19482
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, mergeRange.startRow, mergeRange.startColumn, mergeRange.startColumn);
|
|
19483
|
+
}
|
|
18932
19484
|
}
|
|
18933
19485
|
return this;
|
|
18934
19486
|
}
|
|
@@ -19213,6 +19765,22 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19213
19765
|
endColumn
|
|
19214
19766
|
};
|
|
19215
19767
|
}
|
|
19768
|
+
_isOverflowBlockedByAdjacentCell(row, column, horizontalAlign, hasMergeData = true) {
|
|
19769
|
+
const leftBlocked = () => this._isOverflowSideBlocked(row, column, -1, hasMergeData);
|
|
19770
|
+
const rightBlocked = () => this._isOverflowSideBlocked(row, column, 1, hasMergeData);
|
|
19771
|
+
if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER) return leftBlocked() && rightBlocked();
|
|
19772
|
+
if (horizontalAlign === _univerjs_core.HorizontalAlign.RIGHT) return leftBlocked();
|
|
19773
|
+
return rightBlocked();
|
|
19774
|
+
}
|
|
19775
|
+
_isOverflowSideBlocked(row, column, direction, hasMergeData = true) {
|
|
19776
|
+
var _this$_stylesCache$fo;
|
|
19777
|
+
const adjacentColumn = column + direction;
|
|
19778
|
+
if (adjacentColumn < 0 || adjacentColumn >= this.getColumnCount()) return true;
|
|
19779
|
+
const rawAdjacentCell = this._cellData.getValue(row, adjacentColumn);
|
|
19780
|
+
if (rawAdjacentCell && !(0, _univerjs_core.isCellCoverable)(rawAdjacentCell)) return true;
|
|
19781
|
+
const cachedAdjacentCell = (_this$_stylesCache$fo = this._stylesCache.fontMatrix.getValue(row, adjacentColumn)) === null || _this$_stylesCache$fo === void 0 ? void 0 : _this$_stylesCache$fo.cellData;
|
|
19782
|
+
return !(0, _univerjs_core.isCellCoverable)(cachedAdjacentCell !== null && cachedAdjacentCell !== void 0 ? cachedAdjacentCell : this.worksheet.getCell(row, adjacentColumn)) || hasMergeData && this.intersectMergeRange(row, adjacentColumn);
|
|
19783
|
+
}
|
|
19216
19784
|
/**
|
|
19217
19785
|
* Get cell by pos(offsetX, offsetY).
|
|
19218
19786
|
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
@@ -19382,7 +19950,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19382
19950
|
* the text content of this cell can be drawn to both sides, not limited by the cell's width.
|
|
19383
19951
|
* Overflow on the left or right is aligned according to the text's horizontal alignment.
|
|
19384
19952
|
*/
|
|
19385
|
-
_calculateOverflowCell(row, column, docsConfig) {
|
|
19953
|
+
_calculateOverflowCell(row, column, docsConfig, hasMergeData = true) {
|
|
19386
19954
|
const { documentSkeleton, vertexAngle = 0, centerAngle = 0, horizontalAlign, wrapStrategy } = docsConfig;
|
|
19387
19955
|
const { t: cellValueType = _univerjs_core.CellValueType.STRING } = this._cellData.getValue(row, column) || {};
|
|
19388
19956
|
let horizontalAlignPos = horizontalAlign;
|
|
@@ -19398,7 +19966,13 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19398
19966
|
* Numerical and Boolean values are not displayed with overflow.
|
|
19399
19967
|
*/
|
|
19400
19968
|
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) {
|
|
19401
|
-
|
|
19969
|
+
var _docsConfig$cellData$, _docsConfig$cellData, _docsConfig$cellData2;
|
|
19970
|
+
docsConfig.textFitsCurrentCell = false;
|
|
19971
|
+
if (hasMergeData && this.intersectMergeRange(row, column)) return true;
|
|
19972
|
+
const columnStart = this.columnWidthAccumulation[column - 1] || 0;
|
|
19973
|
+
const currentColumnWidth = (this.columnWidthAccumulation[column] || columnStart) - columnStart;
|
|
19974
|
+
const rawText = (_docsConfig$cellData$ = (_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) !== null && _docsConfig$cellData$ !== void 0 ? _docsConfig$cellData$ : (_docsConfig$cellData2 = docsConfig.cellData) === null || _docsConfig$cellData2 === void 0 ? void 0 : _docsConfig$cellData2.v;
|
|
19975
|
+
if ((Boolean(documentSkeleton) || `${rawText !== null && rawText !== void 0 ? rawText : ""}`.length * 4 > currentColumnWidth) && this._isOverflowBlockedByAdjacentCell(row, column, horizontalAlignPos, hasMergeData)) return true;
|
|
19402
19976
|
let contentSize;
|
|
19403
19977
|
if (documentSkeleton) contentSize = getDocsSkeletonPageSize(documentSkeleton, vertexAngle);
|
|
19404
19978
|
else {
|
|
@@ -19418,11 +19992,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19418
19992
|
height: cellHeight
|
|
19419
19993
|
};
|
|
19420
19994
|
}
|
|
19995
|
+
if (contentSize.width < currentColumnWidth) {
|
|
19996
|
+
docsConfig.textFitsCurrentCell = true;
|
|
19997
|
+
return true;
|
|
19998
|
+
}
|
|
19421
19999
|
const { startColumn, endColumn } = this.getOverflowPosition(contentSize, horizontalAlignPos, row, column, this.getColumnCount());
|
|
19422
20000
|
if (startColumn === endColumn) return true;
|
|
19423
20001
|
this.appendToOverflowCache(row, column, startColumn, endColumn);
|
|
19424
20002
|
} else if (wrapStrategy === _univerjs_core.WrapStrategy.WRAP && vertexAngle !== 0) {
|
|
19425
|
-
if (this.intersectMergeRange(row, column)) return true;
|
|
20003
|
+
if (hasMergeData && this.intersectMergeRange(row, column)) return true;
|
|
19426
20004
|
const { startY, endY } = this.getCellWithCoordByIndex(row, column);
|
|
19427
20005
|
const cellHeight = endY - startY;
|
|
19428
20006
|
documentSkeleton.getViewModel().getDataModel().updateDocumentDataPageSize(cellHeight);
|
|
@@ -19454,16 +20032,18 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19454
20032
|
const startRow = (0, _univerjs_core.searchArray)(rowHeightAccumulation, Math.round(viewBound.top) - this.columnHeaderHeightAndMarginTop);
|
|
19455
20033
|
const endY = Math.round(viewBound.bottom) - this.columnHeaderHeightAndMarginTop;
|
|
19456
20034
|
let endRow = (0, _univerjs_core.searchArray)(rowHeightAccumulation, endY);
|
|
19457
|
-
|
|
20035
|
+
const isEndYOnBoundary = endRow < lenOfRowData && rowHeightAccumulation[endRow - 1] === endY;
|
|
20036
|
+
if (isEndYOnBoundary) endRow -= 1;
|
|
19458
20037
|
const startColumn = (0, _univerjs_core.searchArray)(columnWidthAccumulation, Math.round(viewBound.left) - this.rowHeaderWidthAndMarginLeft);
|
|
19459
20038
|
const endX = Math.round(viewBound.right) - this.rowHeaderWidthAndMarginLeft;
|
|
19460
20039
|
let endColumn = (0, _univerjs_core.searchArray)(columnWidthAccumulation, endX);
|
|
19461
|
-
|
|
20040
|
+
const isEndXOnBoundary = endColumn < lenOfColData && columnWidthAccumulation[endColumn - 1] === endX;
|
|
20041
|
+
if (isEndXOnBoundary) endColumn -= 1;
|
|
19462
20042
|
if (isPrinting) return {
|
|
19463
20043
|
startRow,
|
|
19464
|
-
endRow: endRow === lenOfRowData - 1 ? endRow : endRow - 1,
|
|
20044
|
+
endRow: endRow === lenOfRowData - 1 || isEndYOnBoundary ? endRow : endRow - 1,
|
|
19465
20045
|
startColumn,
|
|
19466
|
-
endColumn: endColumn === lenOfColData - 1 ? endColumn : endColumn - 1
|
|
20046
|
+
endColumn: endColumn === lenOfColData - 1 || isEndXOnBoundary ? endColumn : endColumn - 1
|
|
19467
20047
|
};
|
|
19468
20048
|
return {
|
|
19469
20049
|
startRow,
|
|
@@ -19514,7 +20094,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19514
20094
|
for (let i = 0; i < ranges.length; i++) {
|
|
19515
20095
|
const range = ranges[i];
|
|
19516
20096
|
_univerjs_core.Range.foreach(range, (row, col) => {
|
|
20097
|
+
var _this$_stylesCache$bo, _this$_stylesCache$ba, _this$_stylesCache$ba2;
|
|
19517
20098
|
this._stylesCache.fontMatrix.realDeleteValue(row, col);
|
|
20099
|
+
(_this$_stylesCache$bo = this._stylesCache.border) === null || _this$_stylesCache$bo === void 0 || _this$_stylesCache$bo.realDeleteValue(row, col);
|
|
20100
|
+
(_this$_stylesCache$ba = this._stylesCache.backgroundPositions) === null || _this$_stylesCache$ba === void 0 || _this$_stylesCache$ba.realDeleteValue(row, col);
|
|
20101
|
+
this._handleBgMatrix.realDeleteValue(row, col);
|
|
20102
|
+
this._handleBorderMatrix.realDeleteValue(row, col);
|
|
20103
|
+
Object.values((_this$_stylesCache$ba2 = this._stylesCache.background) !== null && _this$_stylesCache$ba2 !== void 0 ? _this$_stylesCache$ba2 : {}).forEach((backgroundMatrix) => {
|
|
20104
|
+
backgroundMatrix.realDeleteValue(row, col);
|
|
20105
|
+
});
|
|
19518
20106
|
});
|
|
19519
20107
|
}
|
|
19520
20108
|
this.makeDirty(true);
|
|
@@ -19555,15 +20143,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19555
20143
|
}).bg) return;
|
|
19556
20144
|
this._handleBgMatrix.setValue(row, col, true);
|
|
19557
20145
|
if (style && style.bg && style.bg.rgb) {
|
|
19558
|
-
var _this$_stylesCache$
|
|
20146
|
+
var _this$_stylesCache$ba3;
|
|
19559
20147
|
const rgb = style.bg.rgb;
|
|
19560
20148
|
if (!this._stylesCache.background[rgb]) this._stylesCache.background[rgb] = new _univerjs_core.ObjectMatrix();
|
|
19561
20149
|
this._stylesCache.background[rgb].setValue(row, col, rgb);
|
|
19562
20150
|
const cellInfo = this.getCellWithCoordByIndex(row, col, false);
|
|
19563
|
-
(_this$_stylesCache$
|
|
20151
|
+
(_this$_stylesCache$ba3 = this._stylesCache.backgroundPositions) === null || _this$_stylesCache$ba3 === void 0 || _this$_stylesCache$ba3.setValue(row, col, cellInfo);
|
|
19564
20152
|
}
|
|
19565
20153
|
}
|
|
19566
|
-
_setFontStylesCache(row, col, cellData, style) {
|
|
20154
|
+
_setFontStylesCache(row, col, cellData, style, hasMergeData = true) {
|
|
19567
20155
|
var _style$tr2;
|
|
19568
20156
|
if ((0, _univerjs_core.isNullCell)(cellData)) return;
|
|
19569
20157
|
let config = {
|
|
@@ -19575,6 +20163,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19575
20163
|
else {
|
|
19576
20164
|
const cacheItem = cacheValue;
|
|
19577
20165
|
cacheItem.cellData = cellData;
|
|
20166
|
+
setRenderTextCache(cacheItem, cellData);
|
|
19578
20167
|
this._stylesCache.fontMatrix.setValue(row, col, cacheValue);
|
|
19579
20168
|
return;
|
|
19580
20169
|
}
|
|
@@ -19618,8 +20207,10 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19618
20207
|
style
|
|
19619
20208
|
};
|
|
19620
20209
|
}
|
|
19621
|
-
|
|
19622
|
-
|
|
20210
|
+
const fontCacheItem = config;
|
|
20211
|
+
setRenderTextCache(fontCacheItem, cellData);
|
|
20212
|
+
this._calculateOverflowCell(row, col, fontCacheItem, hasMergeData);
|
|
20213
|
+
this._stylesCache.fontMatrix.setValue(row, col, fontCacheItem);
|
|
19623
20214
|
}
|
|
19624
20215
|
/**
|
|
19625
20216
|
* Set border background and font to this._stylesCache cell by cell.
|
|
@@ -19628,19 +20219,37 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19628
20219
|
* @param options {{ mergeRange: IRange; cacheItem: ICacheItem } | undefined}
|
|
19629
20220
|
*/
|
|
19630
20221
|
_setStylesCacheForOneCell(row, col, options) {
|
|
20222
|
+
var _options$hasMergeData, _options$rowVisible, _options$hasMergeData2;
|
|
19631
20223
|
if (row === -1 || col === -1) return;
|
|
19632
20224
|
if (!options) options = { cacheItem: {
|
|
19633
20225
|
bg: true,
|
|
19634
20226
|
border: true
|
|
19635
20227
|
} };
|
|
19636
|
-
const
|
|
19637
|
-
if (
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
20228
|
+
const cacheItem = options.cacheItem;
|
|
20229
|
+
if (options.reuseExisting && cacheItem && !options.mergeRange) {
|
|
20230
|
+
const bgHandled = !cacheItem.bg || _univerjs_core.Tools.isDefine(this._handleBgMatrix.getValue(row, col));
|
|
20231
|
+
const borderHandled = !cacheItem.border || _univerjs_core.Tools.isDefine(this._handleBorderMatrix.getValue(row, col));
|
|
20232
|
+
if (bgHandled && borderHandled && this._stylesCache.fontMatrix.getValue(row, col)) return;
|
|
20233
|
+
}
|
|
20234
|
+
const hasMergeData = (_options$hasMergeData = options.hasMergeData) !== null && _options$hasMergeData !== void 0 ? _options$hasMergeData : true;
|
|
20235
|
+
let isMerged = false;
|
|
20236
|
+
let isMergedMainCell = false;
|
|
20237
|
+
if (hasMergeData) {
|
|
20238
|
+
const mergeInfo = this.worksheet.getCellInfoInMergeData(row, col);
|
|
20239
|
+
isMerged = mergeInfo.isMerged;
|
|
20240
|
+
isMergedMainCell = mergeInfo.isMergedMainCell;
|
|
20241
|
+
if (isMerged) {
|
|
20242
|
+
const { startRow, startColumn, endRow, endColumn } = mergeInfo;
|
|
20243
|
+
options.mergeRange = {
|
|
20244
|
+
startRow,
|
|
20245
|
+
startColumn,
|
|
20246
|
+
endRow,
|
|
20247
|
+
endColumn
|
|
20248
|
+
};
|
|
20249
|
+
}
|
|
20250
|
+
}
|
|
20251
|
+
const rowVisible = (_options$rowVisible = options.rowVisible) !== null && _options$rowVisible !== void 0 ? _options$rowVisible : this.worksheet.getRowVisible(row);
|
|
20252
|
+
if (this.worksheet.getColVisible(col) === false || rowVisible === false) {
|
|
19644
20253
|
if (isMerged && !isMergedMainCell) return;
|
|
19645
20254
|
else if (!isMergedMainCell) return;
|
|
19646
20255
|
}
|
|
@@ -19652,7 +20261,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends _univerjs_core.Sheet
|
|
|
19652
20261
|
this._setFontStylesCache(row, col, {
|
|
19653
20262
|
...cell,
|
|
19654
20263
|
s: style
|
|
19655
|
-
}, style);
|
|
20264
|
+
}, style, (_options$hasMergeData2 = options.hasMergeData) !== null && _options$hasMergeData2 !== void 0 ? _options$hasMergeData2 : true);
|
|
19656
20265
|
}
|
|
19657
20266
|
/**
|
|
19658
20267
|
* pro/issues/344
|
|
@@ -19865,6 +20474,19 @@ function rotatedBoundingBox(width, height, angleDegrees) {
|
|
|
19865
20474
|
rotatedHeight: Math.abs(width * Math.sin(angle)) + Math.abs(height * Math.cos(angle))
|
|
19866
20475
|
};
|
|
19867
20476
|
}
|
|
20477
|
+
function getResolvedRenderHorizontalAlign(fontCache, cellData) {
|
|
20478
|
+
if (fontCache.resolvedHorizontalAlign !== void 0) return fontCache.resolvedHorizontalAlign;
|
|
20479
|
+
const { horizontalAlign } = fontCache;
|
|
20480
|
+
if (horizontalAlign !== _univerjs_core.HorizontalAlign.UNSPECIFIED) return horizontalAlign;
|
|
20481
|
+
if (cellData.t === _univerjs_core.CellValueType.NUMBER || !_univerjs_core.Tools.isDefine(cellData.t) && typeof cellData.v === "number") return _univerjs_core.HorizontalAlign.RIGHT;
|
|
20482
|
+
if (cellData.t === _univerjs_core.CellValueType.BOOLEAN) return _univerjs_core.HorizontalAlign.CENTER;
|
|
20483
|
+
return horizontalAlign;
|
|
20484
|
+
}
|
|
20485
|
+
function needsFontRenderExtensionBounds(fontCache) {
|
|
20486
|
+
var _fontCache$cellData;
|
|
20487
|
+
const extension = (_fontCache$cellData = fontCache.cellData) === null || _fontCache$cellData === void 0 ? void 0 : _fontCache$cellData.fontRenderExtension;
|
|
20488
|
+
return Boolean((extension === null || extension === void 0 ? void 0 : extension.isSkip) || (extension === null || extension === void 0 ? void 0 : extension.leftOffset) || (extension === null || extension === void 0 ? void 0 : extension.rightOffset));
|
|
20489
|
+
}
|
|
19868
20490
|
var Font = class extends SheetExtension {
|
|
19869
20491
|
constructor() {
|
|
19870
20492
|
super();
|
|
@@ -19895,7 +20517,7 @@ var Font = class extends SheetExtension {
|
|
|
19895
20517
|
const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
|
|
19896
20518
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0 || !worksheet) return;
|
|
19897
20519
|
const scale = this._getScale(parentScale);
|
|
19898
|
-
const { viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
20520
|
+
const { fontRenderRanges, viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
19899
20521
|
const lastRowIndex = spreadsheetSkeleton.getRowCount() - 1;
|
|
19900
20522
|
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
19901
20523
|
const expandedViewRanges = viewRanges.map((range) => clampRange({
|
|
@@ -19903,43 +20525,51 @@ var Font = class extends SheetExtension {
|
|
|
19903
20525
|
startColumn: range.startColumn - 20,
|
|
19904
20526
|
endColumn: range.endColumn + 20
|
|
19905
20527
|
}, lastRowIndex, lastColIndex));
|
|
20528
|
+
const rangesToScan = (fontRenderRanges === null || fontRenderRanges === void 0 ? void 0 : fontRenderRanges.length) ? fontRenderRanges : expandedViewRanges;
|
|
19906
20529
|
const renderFontContext = {
|
|
19907
20530
|
ctx,
|
|
19908
20531
|
scale,
|
|
19909
20532
|
columnTotalWidth,
|
|
19910
20533
|
rowTotalHeight,
|
|
19911
|
-
viewRanges: expandedViewRanges,
|
|
20534
|
+
viewRanges: (fontRenderRanges === null || fontRenderRanges === void 0 ? void 0 : fontRenderRanges.length) ? viewRanges : expandedViewRanges,
|
|
19912
20535
|
checkOutOfViewBound: checkOutOfViewBound || true,
|
|
19913
20536
|
diffRanges,
|
|
19914
20537
|
spreadsheetSkeleton
|
|
19915
20538
|
};
|
|
19916
20539
|
ctx.save();
|
|
20540
|
+
const hasMerge = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
19917
20541
|
const uniqueMergeRanges = [];
|
|
19918
|
-
const mergeRangeIDSet = /* @__PURE__ */ new Set();
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
20542
|
+
const mergeRangeIDSet = hasMerge ? /* @__PURE__ */ new Set() : null;
|
|
20543
|
+
const spanModel = hasMerge ? spreadsheetSkeleton.worksheet.getSpanModel() : null;
|
|
20544
|
+
rangesToScan.forEach((range) => {
|
|
20545
|
+
if (hasMerge && spanModel && mergeRangeIDSet) spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn).forEach((mergeRange) => {
|
|
20546
|
+
const mergeRangeIndex = spanModel.getMergeDataIndex(mergeRange.startRow, mergeRange.startColumn);
|
|
19922
20547
|
if (!mergeRangeIDSet.has(mergeRangeIndex)) {
|
|
19923
20548
|
mergeRangeIDSet.add(mergeRangeIndex);
|
|
19924
20549
|
uniqueMergeRanges.push(mergeRange);
|
|
19925
20550
|
}
|
|
19926
20551
|
});
|
|
19927
|
-
|
|
19928
|
-
|
|
20552
|
+
const { startRow, endRow, startColumn, endColumn } = range;
|
|
20553
|
+
for (let row = startRow; row <= endRow; row++) for (let col = startColumn; col <= endColumn; col++) {
|
|
20554
|
+
const fontCache = fontMatrix.getValue(row, col);
|
|
20555
|
+
if (!fontCache) continue;
|
|
20556
|
+
if (spanModel && spanModel.getMergeDataIndex(row, col) !== -1) continue;
|
|
19929
20557
|
const cellInfo = spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
|
|
19930
|
-
if (!cellInfo)
|
|
20558
|
+
if (!cellInfo) continue;
|
|
19931
20559
|
renderFontContext.cellInfo = cellInfo;
|
|
19932
|
-
this._renderFontEachCell(renderFontContext, row, col, fontMatrix);
|
|
19933
|
-
}
|
|
20560
|
+
this._renderFontEachCell(renderFontContext, row, col, fontMatrix, fontCache);
|
|
20561
|
+
}
|
|
19934
20562
|
});
|
|
19935
20563
|
uniqueMergeRanges.forEach((range) => {
|
|
20564
|
+
const fontCache = fontMatrix.getValue(range.startRow, range.startColumn);
|
|
20565
|
+
if (!fontCache) return;
|
|
19936
20566
|
renderFontContext.cellInfo = spreadsheetSkeleton.getCellWithCoordByIndex(range.startRow, range.startColumn, false);
|
|
19937
|
-
this._renderFontEachCell(renderFontContext, range.startRow, range.startColumn, fontMatrix);
|
|
20567
|
+
this._renderFontEachCell(renderFontContext, range.startRow, range.startColumn, fontMatrix, fontCache);
|
|
19938
20568
|
});
|
|
19939
20569
|
ctx.restore();
|
|
19940
20570
|
}
|
|
19941
|
-
_renderFontEachCell(renderFontCtx, row, col, fontMatrix) {
|
|
19942
|
-
var
|
|
20571
|
+
_renderFontEachCell(renderFontCtx, row, col, fontMatrix, cacheValue) {
|
|
20572
|
+
var _fontCache$cellData2;
|
|
19943
20573
|
const { ctx, viewRanges, diffRanges, spreadsheetSkeleton, cellInfo } = renderFontCtx;
|
|
19944
20574
|
const { startY, endY, startX, endX } = cellInfo;
|
|
19945
20575
|
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
@@ -19954,7 +20584,7 @@ var Font = class extends SheetExtension {
|
|
|
19954
20584
|
renderFontCtx.endX = mergeInfo.endX;
|
|
19955
20585
|
renderFontCtx.endY = mergeInfo.endY;
|
|
19956
20586
|
}
|
|
19957
|
-
const fontCache = fontMatrix.getValue(row, col);
|
|
20587
|
+
const fontCache = cacheValue !== null && cacheValue !== void 0 ? cacheValue : fontMatrix.getValue(row, col);
|
|
19958
20588
|
if (!fontCache) return true;
|
|
19959
20589
|
renderFontCtx.fontCache = fontCache;
|
|
19960
20590
|
const overflowRange = spreadsheetSkeleton.overflowCache.getValue(row, col);
|
|
@@ -19980,8 +20610,19 @@ var Font = class extends SheetExtension {
|
|
|
19980
20610
|
}
|
|
19981
20611
|
if (isAllColHidden) return true;
|
|
19982
20612
|
}
|
|
19983
|
-
|
|
19984
|
-
|
|
20613
|
+
if ((_fontCache$cellData2 = fontCache.cellData) === null || _fontCache$cellData2 === void 0 ? void 0 : _fontCache$cellData2.fontRenderExtension) {
|
|
20614
|
+
var _cellData$fontRenderE;
|
|
20615
|
+
const cellData = spreadsheetSkeleton.worksheet.getCell(row, col) || {};
|
|
20616
|
+
if (cellData === null || cellData === void 0 || (_cellData$fontRenderE = cellData.fontRenderExtension) === null || _cellData$fontRenderE === void 0 ? void 0 : _cellData$fontRenderE.isSkip) return true;
|
|
20617
|
+
}
|
|
20618
|
+
if (this._renderPlainTextWithoutClip(ctx, renderFontCtx, fontCache)) {
|
|
20619
|
+
renderFontCtx.startX = 0;
|
|
20620
|
+
renderFontCtx.startY = 0;
|
|
20621
|
+
renderFontCtx.endX = 0;
|
|
20622
|
+
renderFontCtx.endY = 0;
|
|
20623
|
+
renderFontCtx.overflowRectangle = null;
|
|
20624
|
+
return false;
|
|
20625
|
+
}
|
|
19985
20626
|
ctx.save();
|
|
19986
20627
|
ctx.beginPath();
|
|
19987
20628
|
renderFontCtx.overflowRectangle = overflowRange;
|
|
@@ -19989,7 +20630,6 @@ var Font = class extends SheetExtension {
|
|
|
19989
20630
|
ctx.translate(renderFontCtx.startX + FIX_ONE_PIXEL_BLUR_OFFSET, renderFontCtx.startY + FIX_ONE_PIXEL_BLUR_OFFSET);
|
|
19990
20631
|
if (fontCache.documentSkeleton) this._renderDocuments(ctx, row, col, renderFontCtx, spreadsheetSkeleton.overflowCache);
|
|
19991
20632
|
else this._renderText(ctx, row, col, renderFontCtx, spreadsheetSkeleton.overflowCache);
|
|
19992
|
-
ctx.closePath();
|
|
19993
20633
|
ctx.restore();
|
|
19994
20634
|
if (fontCache.documentSkeleton) {
|
|
19995
20635
|
var _documentDataModel$ge;
|
|
@@ -20009,15 +20649,49 @@ var Font = class extends SheetExtension {
|
|
|
20009
20649
|
renderFontCtx.overflowRectangle = null;
|
|
20010
20650
|
return false;
|
|
20011
20651
|
}
|
|
20652
|
+
_renderPlainTextWithoutClip(ctx, renderFontCtx, fontCache) {
|
|
20653
|
+
var _fontCache$style, _fontCache$style2, _fontCache$style$pd, _fontCache$style3, _padding$l, _padding$r, _padding$t, _padding$b, _fontCache$displayTex, _fontCache$style4;
|
|
20654
|
+
const { cellData, documentSkeleton, textFitsCurrentCell, vertexAngle = 0, centerAngle = 0, wrapStrategy } = fontCache;
|
|
20655
|
+
if (!textFitsCurrentCell) return false;
|
|
20656
|
+
if (documentSkeleton) return false;
|
|
20657
|
+
if (vertexAngle !== 0 || centerAngle !== 0) return false;
|
|
20658
|
+
if (wrapStrategy === _univerjs_core.WrapStrategy.WRAP) return false;
|
|
20659
|
+
if (needsFontRenderExtensionBounds(fontCache)) return false;
|
|
20660
|
+
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;
|
|
20661
|
+
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return false;
|
|
20662
|
+
const padding = (_fontCache$style$pd = (_fontCache$style3 = fontCache.style) === null || _fontCache$style3 === void 0 ? void 0 : _fontCache$style3.pd) !== null && _fontCache$style$pd !== void 0 ? _fontCache$style$pd : DEFAULT_PADDING_DATA;
|
|
20663
|
+
const paddingLeft = (_padding$l = padding.l) !== null && _padding$l !== void 0 ? _padding$l : DEFAULT_PADDING_DATA.l;
|
|
20664
|
+
const paddingRight = (_padding$r = padding.r) !== null && _padding$r !== void 0 ? _padding$r : DEFAULT_PADDING_DATA.r;
|
|
20665
|
+
const paddingTop = (_padding$t = padding.t) !== null && _padding$t !== void 0 ? _padding$t : DEFAULT_PADDING_DATA.t;
|
|
20666
|
+
const paddingBottom = (_padding$b = padding.b) !== null && _padding$b !== void 0 ? _padding$b : DEFAULT_PADDING_DATA.b;
|
|
20667
|
+
const text = (_fontCache$displayTex = fontCache.displayText) !== null && _fontCache$displayTex !== void 0 ? _fontCache$displayTex : (0, _univerjs_core.getDisplayValueFromCell)(cellData);
|
|
20668
|
+
const { startX, startY, endX, endY } = renderFontCtx;
|
|
20669
|
+
const cellWidth = endX - startX - paddingLeft - paddingRight;
|
|
20670
|
+
const cellHeight = endY - startY - paddingTop - paddingBottom;
|
|
20671
|
+
const hAlign = getResolvedRenderHorizontalAlign(fontCache, cellData);
|
|
20672
|
+
Text.drawPlainWith(ctx, {
|
|
20673
|
+
text,
|
|
20674
|
+
fontStyle: fontCache.fontString,
|
|
20675
|
+
hAlign,
|
|
20676
|
+
vAlign: fontCache.verticalAlign,
|
|
20677
|
+
width: cellWidth,
|
|
20678
|
+
height: cellHeight,
|
|
20679
|
+
left: startX + FIX_ONE_PIXEL_BLUR_OFFSET + paddingLeft,
|
|
20680
|
+
top: startY + FIX_ONE_PIXEL_BLUR_OFFSET + paddingTop,
|
|
20681
|
+
color: (_fontCache$style4 = fontCache.style) === null || _fontCache$style4 === void 0 || (_fontCache$style4 = _fontCache$style4.cl) === null || _fontCache$style4 === void 0 ? void 0 : _fontCache$style4.rgb,
|
|
20682
|
+
cellValueType: cellData.t
|
|
20683
|
+
});
|
|
20684
|
+
return true;
|
|
20685
|
+
}
|
|
20012
20686
|
_renderImages(ctx, fontsConfig, startX, startY, endX, endY) {
|
|
20013
|
-
var _fontsConfig$style, _padding$
|
|
20687
|
+
var _fontsConfig$style, _padding$l2, _padding$r2, _padding$t2, _padding$b2, _getSkeletonData;
|
|
20014
20688
|
const { documentSkeleton, verticalAlign, horizontalAlign } = fontsConfig;
|
|
20015
20689
|
const PADDING = 2;
|
|
20016
20690
|
const padding = (_fontsConfig$style = fontsConfig.style) === null || _fontsConfig$style === void 0 ? void 0 : _fontsConfig$style.pd;
|
|
20017
|
-
const paddingLeft = (_padding$
|
|
20018
|
-
const paddingRight = (_padding$
|
|
20019
|
-
const paddingTop = (_padding$
|
|
20020
|
-
const paddingBottom = (_padding$
|
|
20691
|
+
const paddingLeft = (_padding$l2 = padding === null || padding === void 0 ? void 0 : padding.l) !== null && _padding$l2 !== void 0 ? _padding$l2 : PADDING;
|
|
20692
|
+
const paddingRight = (_padding$r2 = padding === null || padding === void 0 ? void 0 : padding.r) !== null && _padding$r2 !== void 0 ? _padding$r2 : PADDING;
|
|
20693
|
+
const paddingTop = (_padding$t2 = padding === null || padding === void 0 ? void 0 : padding.t) !== null && _padding$t2 !== void 0 ? _padding$t2 : PADDING;
|
|
20694
|
+
const paddingBottom = (_padding$b2 = padding === null || padding === void 0 ? void 0 : padding.b) !== null && _padding$b2 !== void 0 ? _padding$b2 : PADDING;
|
|
20021
20695
|
const contentStartX = startX + paddingLeft;
|
|
20022
20696
|
const contentEndX = endX - paddingRight;
|
|
20023
20697
|
const contentStartY = startY + paddingTop;
|
|
@@ -20087,7 +20761,7 @@ var Font = class extends SheetExtension {
|
|
|
20087
20761
|
* @param fontCache
|
|
20088
20762
|
*/
|
|
20089
20763
|
_clipByRenderBounds(renderFontContext, row, col, padding = 0) {
|
|
20090
|
-
var _fontCache$cellData$f, _fontCache$
|
|
20764
|
+
var _fontCache$cellData$f, _fontCache$cellData3, _fontCache$cellData$f2, _fontCache$cellData4;
|
|
20091
20765
|
const { ctx, scale, overflowRectangle, fontCache } = renderFontContext;
|
|
20092
20766
|
let { startX, endX, startY, endY } = renderFontContext;
|
|
20093
20767
|
const { horizontalAlign = 0, vertexAngle = 0, centerAngle = 0 } = fontCache;
|
|
@@ -20096,8 +20770,8 @@ var Font = class extends SheetExtension {
|
|
|
20096
20770
|
if (centerAngle === 90 && vertexAngle === 90) horizontalAlignOverFlow = _univerjs_core.HorizontalAlign.CENTER;
|
|
20097
20771
|
else if (vertexAngle > 0 && vertexAngle !== 90 || vertexAngle === -90) horizontalAlignOverFlow = _univerjs_core.HorizontalAlign.RIGHT;
|
|
20098
20772
|
}
|
|
20099
|
-
const rightOffset = (_fontCache$cellData$f = fontCache === null || fontCache === void 0 || (_fontCache$
|
|
20100
|
-
const leftOffset = (_fontCache$cellData$f2 = fontCache === null || fontCache === void 0 || (_fontCache$
|
|
20773
|
+
const rightOffset = (_fontCache$cellData$f = 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) !== null && _fontCache$cellData$f !== void 0 ? _fontCache$cellData$f : 0;
|
|
20774
|
+
const leftOffset = (_fontCache$cellData$f2 = 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) !== null && _fontCache$cellData$f2 !== void 0 ? _fontCache$cellData$f2 : 0;
|
|
20101
20775
|
let isOverflow = true;
|
|
20102
20776
|
if (vertexAngle === 0) {
|
|
20103
20777
|
startX = startX + leftOffset;
|
|
@@ -20129,26 +20803,22 @@ var Font = class extends SheetExtension {
|
|
|
20129
20803
|
renderFontContext.endY = endY;
|
|
20130
20804
|
}
|
|
20131
20805
|
_renderText(ctx, row, col, renderFontCtx, overflowCache) {
|
|
20132
|
-
var _fontCache$style$
|
|
20806
|
+
var _fontCache$style$pd2, _fontCache$style5, _padding$l3, _padding$r3, _padding$t3, _padding$b3, _fontCache$displayTex2, _fontCache$style6, _fontCache$style7, _fontCache$style8, _fontCache$style9;
|
|
20133
20807
|
const { fontCache } = renderFontCtx;
|
|
20134
20808
|
if (!fontCache) return;
|
|
20135
|
-
const padding = (_fontCache$style$
|
|
20136
|
-
const paddingLeft = (_padding$
|
|
20137
|
-
const paddingRight = (_padding$
|
|
20138
|
-
const paddingTop = (_padding$
|
|
20139
|
-
const paddingBottom = (_padding$
|
|
20809
|
+
const padding = (_fontCache$style$pd2 = (_fontCache$style5 = fontCache.style) === null || _fontCache$style5 === void 0 ? void 0 : _fontCache$style5.pd) !== null && _fontCache$style$pd2 !== void 0 ? _fontCache$style$pd2 : DEFAULT_PADDING_DATA;
|
|
20810
|
+
const paddingLeft = (_padding$l3 = padding.l) !== null && _padding$l3 !== void 0 ? _padding$l3 : DEFAULT_PADDING_DATA.l;
|
|
20811
|
+
const paddingRight = (_padding$r3 = padding.r) !== null && _padding$r3 !== void 0 ? _padding$r3 : DEFAULT_PADDING_DATA.r;
|
|
20812
|
+
const paddingTop = (_padding$t3 = padding.t) !== null && _padding$t3 !== void 0 ? _padding$t3 : DEFAULT_PADDING_DATA.t;
|
|
20813
|
+
const paddingBottom = (_padding$b3 = padding.b) !== null && _padding$b3 !== void 0 ? _padding$b3 : DEFAULT_PADDING_DATA.b;
|
|
20140
20814
|
const { vertexAngle = 0, wrapStrategy, cellData } = fontCache;
|
|
20141
20815
|
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return;
|
|
20142
|
-
const text = (0, _univerjs_core.getDisplayValueFromCell)(cellData);
|
|
20816
|
+
const text = (_fontCache$displayTex2 = fontCache.displayText) !== null && _fontCache$displayTex2 !== void 0 ? _fontCache$displayTex2 : (0, _univerjs_core.getDisplayValueFromCell)(cellData);
|
|
20143
20817
|
const { startX, startY, endX, endY } = renderFontCtx;
|
|
20144
20818
|
const cellWidth = endX - startX - paddingLeft - paddingRight;
|
|
20145
20819
|
const cellHeight = endY - startY - paddingTop - paddingBottom;
|
|
20146
|
-
|
|
20147
|
-
|
|
20148
|
-
if (cellData.t === _univerjs_core.CellValueType.NUMBER || !_univerjs_core.Tools.isDefine(cellData.t) && typeof cellData.v === "number") hAlign = _univerjs_core.HorizontalAlign.RIGHT;
|
|
20149
|
-
else if (cellData.t === _univerjs_core.CellValueType.BOOLEAN) hAlign = _univerjs_core.HorizontalAlign.CENTER;
|
|
20150
|
-
}
|
|
20151
|
-
Text.drawWith(ctx, {
|
|
20820
|
+
const hAlign = getResolvedRenderHorizontalAlign(fontCache, cellData);
|
|
20821
|
+
const textProps = {
|
|
20152
20822
|
text,
|
|
20153
20823
|
fontStyle: fontCache.fontString,
|
|
20154
20824
|
warp: wrapStrategy === _univerjs_core.WrapStrategy.WRAP && vertexAngle === 0,
|
|
@@ -20158,12 +20828,17 @@ var Font = class extends SheetExtension {
|
|
|
20158
20828
|
height: cellHeight,
|
|
20159
20829
|
left: paddingLeft,
|
|
20160
20830
|
top: paddingTop,
|
|
20161
|
-
color: (_fontCache$
|
|
20162
|
-
strokeLine: Boolean((_fontCache$
|
|
20163
|
-
underline: Boolean((_fontCache$
|
|
20164
|
-
underlineType: (_fontCache$
|
|
20831
|
+
color: (_fontCache$style6 = fontCache.style) === null || _fontCache$style6 === void 0 || (_fontCache$style6 = _fontCache$style6.cl) === null || _fontCache$style6 === void 0 ? void 0 : _fontCache$style6.rgb,
|
|
20832
|
+
strokeLine: Boolean((_fontCache$style7 = fontCache.style) === null || _fontCache$style7 === void 0 || (_fontCache$style7 = _fontCache$style7.st) === null || _fontCache$style7 === void 0 ? void 0 : _fontCache$style7.s),
|
|
20833
|
+
underline: Boolean((_fontCache$style8 = fontCache.style) === null || _fontCache$style8 === void 0 || (_fontCache$style8 = _fontCache$style8.ul) === null || _fontCache$style8 === void 0 ? void 0 : _fontCache$style8.s),
|
|
20834
|
+
underlineType: (_fontCache$style9 = fontCache.style) === null || _fontCache$style9 === void 0 || (_fontCache$style9 = _fontCache$style9.ul) === null || _fontCache$style9 === void 0 ? void 0 : _fontCache$style9.t,
|
|
20165
20835
|
cellValueType: cellData.t
|
|
20166
|
-
}
|
|
20836
|
+
};
|
|
20837
|
+
if (!textProps.warp && !textProps.strokeLine && !textProps.underline) {
|
|
20838
|
+
Text.drawPlainWith(ctx, textProps);
|
|
20839
|
+
return;
|
|
20840
|
+
}
|
|
20841
|
+
Text.drawWith(ctx, textProps);
|
|
20167
20842
|
}
|
|
20168
20843
|
_renderDocuments(ctx, row, col, renderFontCtx, overflowCache) {
|
|
20169
20844
|
const documents = this.getDocuments();
|
|
@@ -20233,6 +20908,15 @@ const stringifyRange = (range) => {
|
|
|
20233
20908
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
20234
20909
|
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
20235
20910
|
};
|
|
20911
|
+
function drawTriangleMarker(ctx, color, x, y, x2, y2, x3, y3) {
|
|
20912
|
+
ctx.fillStyle = color;
|
|
20913
|
+
ctx.beginPath();
|
|
20914
|
+
ctx.moveTo(x, y);
|
|
20915
|
+
ctx.lineTo(x2, y2);
|
|
20916
|
+
ctx.lineTo(x3, y3);
|
|
20917
|
+
ctx.closePath();
|
|
20918
|
+
ctx.fill();
|
|
20919
|
+
}
|
|
20236
20920
|
var Marker = class extends SheetExtension {
|
|
20237
20921
|
constructor(..._args) {
|
|
20238
20922
|
super(..._args);
|
|
@@ -20244,11 +20928,15 @@ var Marker = class extends SheetExtension {
|
|
|
20244
20928
|
const { worksheet, rowColumnSegment } = skeleton;
|
|
20245
20929
|
if (!worksheet) return;
|
|
20246
20930
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
20247
|
-
(
|
|
20248
|
-
|
|
20931
|
+
const renderRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment];
|
|
20932
|
+
const hasMerge = worksheet.getMergeData().length > 0;
|
|
20933
|
+
renderRanges.forEach((range) => {
|
|
20934
|
+
const { startRow, endRow, startColumn, endColumn } = range;
|
|
20935
|
+
for (let row = startRow; row <= endRow; row++) for (let col = startColumn; col <= endColumn; col++) {
|
|
20249
20936
|
var _cellData$markers, _cellData$markers2, _cellData$markers3, _cellData$markers4;
|
|
20250
|
-
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col))
|
|
20937
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) continue;
|
|
20251
20938
|
let cellData = worksheet.getCell(row, col);
|
|
20939
|
+
if (!hasMerge && !(cellData === null || cellData === void 0 ? void 0 : cellData.markers)) continue;
|
|
20252
20940
|
const cellInfo = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
20253
20941
|
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
20254
20942
|
let { startY, endY, startX, endX } = cellInfo;
|
|
@@ -20265,74 +20953,38 @@ var Marker = class extends SheetExtension {
|
|
|
20265
20953
|
};
|
|
20266
20954
|
cellData = worksheet.getCell(mainCell.row, mainCell.col);
|
|
20267
20955
|
}
|
|
20268
|
-
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges))
|
|
20956
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) continue;
|
|
20269
20957
|
if (cellInfo.isMerged || cellInfo.isMergedMainCell) {
|
|
20270
20958
|
const rangeStr = stringifyRange(mergeInfo);
|
|
20271
|
-
if (mergeCellRendered.has(rangeStr))
|
|
20959
|
+
if (mergeCellRendered.has(rangeStr)) continue;
|
|
20272
20960
|
mergeCellRendered.add(rangeStr);
|
|
20273
20961
|
}
|
|
20274
|
-
if (!cellData)
|
|
20962
|
+
if (!cellData) continue;
|
|
20275
20963
|
if ((_cellData$markers = cellData.markers) === null || _cellData$markers === void 0 ? void 0 : _cellData$markers.tr) {
|
|
20276
|
-
ctx.save();
|
|
20277
20964
|
const marker = cellData.markers.tr;
|
|
20278
20965
|
const x = endX;
|
|
20279
20966
|
const y = startY;
|
|
20280
|
-
ctx.
|
|
20281
|
-
ctx.moveTo(x, y);
|
|
20282
|
-
ctx.beginPath();
|
|
20283
|
-
ctx.lineTo(x - marker.size, y);
|
|
20284
|
-
ctx.lineTo(x, y + marker.size);
|
|
20285
|
-
ctx.lineTo(x, y);
|
|
20286
|
-
ctx.closePath();
|
|
20287
|
-
ctx.fill();
|
|
20288
|
-
ctx.restore();
|
|
20967
|
+
drawTriangleMarker(ctx, marker.color, x, y, x - marker.size, y, x, y + marker.size);
|
|
20289
20968
|
}
|
|
20290
20969
|
if ((_cellData$markers2 = cellData.markers) === null || _cellData$markers2 === void 0 ? void 0 : _cellData$markers2.tl) {
|
|
20291
|
-
ctx.save();
|
|
20292
20970
|
const marker = cellData.markers.tl;
|
|
20293
20971
|
const x = startX;
|
|
20294
20972
|
const y = startY;
|
|
20295
|
-
ctx.
|
|
20296
|
-
ctx.moveTo(x, y);
|
|
20297
|
-
ctx.beginPath();
|
|
20298
|
-
ctx.lineTo(x + marker.size, y);
|
|
20299
|
-
ctx.lineTo(x, y + marker.size);
|
|
20300
|
-
ctx.lineTo(x, y);
|
|
20301
|
-
ctx.closePath();
|
|
20302
|
-
ctx.fill();
|
|
20303
|
-
ctx.restore();
|
|
20973
|
+
drawTriangleMarker(ctx, marker.color, x, y, x + marker.size, y, x, y + marker.size);
|
|
20304
20974
|
}
|
|
20305
20975
|
if ((_cellData$markers3 = cellData.markers) === null || _cellData$markers3 === void 0 ? void 0 : _cellData$markers3.br) {
|
|
20306
|
-
ctx.save();
|
|
20307
20976
|
const marker = cellData.markers.br;
|
|
20308
20977
|
const x = endX;
|
|
20309
20978
|
const y = endY;
|
|
20310
|
-
ctx.
|
|
20311
|
-
ctx.moveTo(x, y);
|
|
20312
|
-
ctx.beginPath();
|
|
20313
|
-
ctx.lineTo(x - marker.size, y);
|
|
20314
|
-
ctx.lineTo(x, y - marker.size);
|
|
20315
|
-
ctx.lineTo(x, y);
|
|
20316
|
-
ctx.closePath();
|
|
20317
|
-
ctx.fill();
|
|
20318
|
-
ctx.restore();
|
|
20979
|
+
drawTriangleMarker(ctx, marker.color, x, y, x - marker.size, y, x, y - marker.size);
|
|
20319
20980
|
}
|
|
20320
20981
|
if ((_cellData$markers4 = cellData.markers) === null || _cellData$markers4 === void 0 ? void 0 : _cellData$markers4.bl) {
|
|
20321
|
-
ctx.save();
|
|
20322
20982
|
const marker = cellData.markers.bl;
|
|
20323
20983
|
const x = startX;
|
|
20324
20984
|
const y = endY;
|
|
20325
|
-
ctx.
|
|
20326
|
-
ctx.moveTo(x, y);
|
|
20327
|
-
ctx.beginPath();
|
|
20328
|
-
ctx.lineTo(x + marker.size, y);
|
|
20329
|
-
ctx.lineTo(x, y - marker.size);
|
|
20330
|
-
ctx.lineTo(x, y);
|
|
20331
|
-
ctx.closePath();
|
|
20332
|
-
ctx.fill();
|
|
20333
|
-
ctx.restore();
|
|
20985
|
+
drawTriangleMarker(ctx, marker.color, x, y, x + marker.size, y, x, y - marker.size);
|
|
20334
20986
|
}
|
|
20335
|
-
}
|
|
20987
|
+
}
|
|
20336
20988
|
});
|
|
20337
20989
|
}
|
|
20338
20990
|
};
|
|
@@ -22441,6 +23093,7 @@ const MIN_THUMB_SIZE = 17;
|
|
|
22441
23093
|
const DEFAULT_TRACK_SIZE = 10;
|
|
22442
23094
|
const DEFAULT_THUMB_MARGIN = 2;
|
|
22443
23095
|
const HOVER_THUMB_MARGIN = 1;
|
|
23096
|
+
const BAR_DRAG_SCROLL_THROTTLE_MS = 32;
|
|
22444
23097
|
var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
22445
23098
|
constructor(view, props) {
|
|
22446
23099
|
super();
|
|
@@ -22463,6 +23116,10 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
22463
23116
|
_defineProperty(this, "_lastY", -1);
|
|
22464
23117
|
_defineProperty(this, "_isHorizonMove", false);
|
|
22465
23118
|
_defineProperty(this, "_isVerticalMove", false);
|
|
23119
|
+
_defineProperty(this, "_pendingBarDeltaX", 0);
|
|
23120
|
+
_defineProperty(this, "_pendingBarDeltaY", 0);
|
|
23121
|
+
_defineProperty(this, "_pendingBarScrollFrameId", null);
|
|
23122
|
+
_defineProperty(this, "_pendingBarScrollThrottleId", null);
|
|
22466
23123
|
_defineProperty(this, "_horizonPointerMoveSub", void 0);
|
|
22467
23124
|
_defineProperty(this, "_horizonPointerUpSub", void 0);
|
|
22468
23125
|
_defineProperty(this, "_verticalPointerMoveSub", void 0);
|
|
@@ -22600,6 +23257,7 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
22600
23257
|
dispose() {
|
|
22601
23258
|
var _this$horizonScrollTr, _this$horizonThumbRec3, _this$verticalScrollT, _this$verticalThumbRe3, _this$placeholderBarR, _this$_horizonPointer, _this$_horizonPointer2, _this$_verticalPointe, _this$_verticalPointe2;
|
|
22602
23259
|
super.dispose();
|
|
23260
|
+
this._flushPendingBarScroll();
|
|
22603
23261
|
(_this$horizonScrollTr = this.horizonScrollTrack) === null || _this$horizonScrollTr === void 0 || _this$horizonScrollTr.dispose();
|
|
22604
23262
|
(_this$horizonThumbRec3 = this.horizonThumbRect) === null || _this$horizonThumbRec3 === void 0 || _this$horizonThumbRec3.dispose();
|
|
22605
23263
|
(_this$verticalScrollT = this.verticalScrollTrack) === null || _this$verticalScrollT === void 0 || _this$verticalScrollT.dispose();
|
|
@@ -22618,6 +23276,47 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
22618
23276
|
this._mainScene = null;
|
|
22619
23277
|
this._viewport.removeScrollBar();
|
|
22620
23278
|
}
|
|
23279
|
+
_scheduleBarScrollDelta(delta) {
|
|
23280
|
+
var _delta$x, _delta$y;
|
|
23281
|
+
this._pendingBarDeltaX += (_delta$x = delta.x) !== null && _delta$x !== void 0 ? _delta$x : 0;
|
|
23282
|
+
this._pendingBarDeltaY += (_delta$y = delta.y) !== null && _delta$y !== void 0 ? _delta$y : 0;
|
|
23283
|
+
if (this._pendingBarScrollFrameId !== null || this._pendingBarScrollThrottleId !== null) return;
|
|
23284
|
+
this._requestPendingBarScrollFrame();
|
|
23285
|
+
}
|
|
23286
|
+
_requestPendingBarScrollFrame() {
|
|
23287
|
+
this._pendingBarScrollFrameId = requestAnimationFrame(() => {
|
|
23288
|
+
this._pendingBarScrollFrameId = null;
|
|
23289
|
+
this._applyPendingBarScroll({ isBarDragging: true });
|
|
23290
|
+
if (!this._isHorizonMove && !this._isVerticalMove) return;
|
|
23291
|
+
this._pendingBarScrollThrottleId = window.setTimeout(() => {
|
|
23292
|
+
this._pendingBarScrollThrottleId = null;
|
|
23293
|
+
if (this._pendingBarDeltaX !== 0 || this._pendingBarDeltaY !== 0) this._requestPendingBarScrollFrame();
|
|
23294
|
+
}, BAR_DRAG_SCROLL_THROTTLE_MS);
|
|
23295
|
+
});
|
|
23296
|
+
}
|
|
23297
|
+
_flushPendingBarScroll(isBarDragEnd = false) {
|
|
23298
|
+
if (this._pendingBarScrollFrameId !== null) {
|
|
23299
|
+
cancelAnimationFrame(this._pendingBarScrollFrameId);
|
|
23300
|
+
this._pendingBarScrollFrameId = null;
|
|
23301
|
+
}
|
|
23302
|
+
if (this._pendingBarScrollThrottleId !== null) {
|
|
23303
|
+
clearTimeout(this._pendingBarScrollThrottleId);
|
|
23304
|
+
this._pendingBarScrollThrottleId = null;
|
|
23305
|
+
}
|
|
23306
|
+
return this._applyPendingBarScroll({ isBarDragEnd });
|
|
23307
|
+
}
|
|
23308
|
+
_applyPendingBarScroll(options) {
|
|
23309
|
+
const x = this._pendingBarDeltaX;
|
|
23310
|
+
const y = this._pendingBarDeltaY;
|
|
23311
|
+
if (x === 0 && y === 0) return false;
|
|
23312
|
+
this._pendingBarDeltaX = 0;
|
|
23313
|
+
this._pendingBarDeltaY = 0;
|
|
23314
|
+
this._viewport.scrollByBarDeltaValue({
|
|
23315
|
+
...x === 0 ? null : { x },
|
|
23316
|
+
...y === 0 ? null : { y }
|
|
23317
|
+
}, true, options);
|
|
23318
|
+
return true;
|
|
23319
|
+
}
|
|
22621
23320
|
render(ctx, left = 0, top = 0) {
|
|
22622
23321
|
const { scrollX, scrollY } = this._viewport;
|
|
22623
23322
|
ctx.save();
|
|
@@ -22822,12 +23521,14 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
22822
23521
|
var _mainScene$getEngine;
|
|
22823
23522
|
const e = evt;
|
|
22824
23523
|
if (!this._isVerticalMove) return;
|
|
22825
|
-
this.
|
|
23524
|
+
this._scheduleBarScrollDelta({ y: e.offsetY - this._lastY });
|
|
22826
23525
|
this._lastY = e.offsetY;
|
|
22827
23526
|
(_mainScene$getEngine = mainScene.getEngine()) === null || _mainScene$getEngine === void 0 || _mainScene$getEngine.setCapture();
|
|
22828
23527
|
});
|
|
22829
23528
|
this._verticalPointerUpSub = mainScene.onPointerUp$.subscribeEvent((_evt, _state) => {
|
|
23529
|
+
if (!this._isVerticalMove) return;
|
|
22830
23530
|
const srcElement = this.verticalThumbRect;
|
|
23531
|
+
if (!this._flushPendingBarScroll(true)) this._viewport.scrollByBarDeltaValue({ y: 0 }, true, { isBarDragEnd: true });
|
|
22831
23532
|
this._isVerticalMove = false;
|
|
22832
23533
|
mainScene.releaseCapturedObject();
|
|
22833
23534
|
mainScene.enableObjectsEvent();
|
|
@@ -22896,12 +23597,14 @@ var ScrollBar = class ScrollBar extends _univerjs_core.Disposable {
|
|
|
22896
23597
|
var _mainScene$getEngine2;
|
|
22897
23598
|
const e = evt;
|
|
22898
23599
|
if (!this._isHorizonMove) return;
|
|
22899
|
-
this.
|
|
23600
|
+
this._scheduleBarScrollDelta({ x: e.offsetX - this._lastX });
|
|
22900
23601
|
this._lastX = e.offsetX;
|
|
22901
23602
|
(_mainScene$getEngine2 = mainScene.getEngine()) === null || _mainScene$getEngine2 === void 0 || _mainScene$getEngine2.setCapture();
|
|
22902
23603
|
});
|
|
22903
23604
|
this._horizonPointerUpSub = mainScene.onPointerUp$.subscribeEvent((evt, state) => {
|
|
22904
23605
|
var _this$horizonThumbRec11;
|
|
23606
|
+
if (!this._isHorizonMove) return;
|
|
23607
|
+
if (!this._flushPendingBarScroll(true)) this._viewport.scrollByBarDeltaValue({ x: 0 }, true, { isBarDragEnd: true });
|
|
22905
23608
|
this._isHorizonMove = false;
|
|
22906
23609
|
mainScene.releaseCapturedObject();
|
|
22907
23610
|
mainScene.enableObjectsEvent();
|
|
@@ -23117,7 +23820,7 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23117
23820
|
const { vertexAngle, centerAngle } = renderConfig !== null && renderConfig !== void 0 ? renderConfig : {};
|
|
23118
23821
|
const VERTICAL_DEG = 90;
|
|
23119
23822
|
const isVertical = vertexAngle === VERTICAL_DEG && centerAngle === VERTICAL_DEG;
|
|
23120
|
-
if (isVertical && !hasCJK(content)) {
|
|
23823
|
+
if (isVertical && !cjk.hasCJK(content)) {
|
|
23121
23824
|
ctx.save();
|
|
23122
23825
|
ctx.translate(spanStartPoint.x + centerPoint.x, spanStartPoint.y + centerPoint.y);
|
|
23123
23826
|
ctx.rotate(Math.PI / 2);
|
|
@@ -23639,7 +24342,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
23639
24342
|
ctx.restore();
|
|
23640
24343
|
}
|
|
23641
24344
|
_drawBorderBottom(ctx, page, line, left = 0, top = 0) {
|
|
23642
|
-
var _line$borderBottom$pa, _line$borderBottom,
|
|
24345
|
+
var _line$borderBottom$pa, _line$borderBottom, _border$width, _border$color$rgb;
|
|
23643
24346
|
if (this._drawLiquid == null) return;
|
|
23644
24347
|
let { x, y } = this._drawLiquid;
|
|
23645
24348
|
const { pageWidth, marginLeft, marginRight, marginTop } = page;
|
|
@@ -23648,8 +24351,10 @@ var Documents = class Documents extends DocComponent {
|
|
|
23648
24351
|
y -= line.paddingTop;
|
|
23649
24352
|
y += marginTop + top + line.lineHeight + ((_line$borderBottom$pa = (_line$borderBottom = line.borderBottom) === null || _line$borderBottom === void 0 ? void 0 : _line$borderBottom.padding) !== null && _line$borderBottom$pa !== void 0 ? _line$borderBottom$pa : 0);
|
|
23650
24353
|
ctx.save();
|
|
23651
|
-
|
|
23652
|
-
ctx.
|
|
24354
|
+
const border = line.borderBottom;
|
|
24355
|
+
ctx.setLineWidthByPrecision(Math.max(0, (_border$width = border === null || border === void 0 ? void 0 : border.width) !== null && _border$width !== void 0 ? _border$width : 1));
|
|
24356
|
+
ctx.strokeStyle = (_border$color$rgb = border === null || border === void 0 ? void 0 : border.color.rgb) !== null && _border$color$rgb !== void 0 ? _border$color$rgb : "#CDD0D8";
|
|
24357
|
+
setDocsBorderDash(ctx, border === null || border === void 0 ? void 0 : border.dashStyle);
|
|
23653
24358
|
drawLineByBorderType(ctx, "b", 0, {
|
|
23654
24359
|
startX: x,
|
|
23655
24360
|
startY: y,
|
|
@@ -23811,21 +24516,21 @@ var Documents = class Documents extends DocComponent {
|
|
|
23811
24516
|
return DEFAULT_BORDER_COLOR;
|
|
23812
24517
|
}
|
|
23813
24518
|
_isDrawableTableCellBorder(border) {
|
|
23814
|
-
var _border$width$v, _border$
|
|
24519
|
+
var _border$width$v, _border$width2, _border$color$rgb2, _border$color;
|
|
23815
24520
|
if (!border) return false;
|
|
23816
|
-
const lineWidth = (_border$width$v = (_border$
|
|
23817
|
-
const color = (_border$color$
|
|
24521
|
+
const lineWidth = (_border$width$v = (_border$width2 = border.width) === null || _border$width2 === void 0 ? void 0 : _border$width2.v) !== null && _border$width$v !== void 0 ? _border$width$v : 1;
|
|
24522
|
+
const color = (_border$color$rgb2 = (_border$color = border.color) === null || _border$color === void 0 ? void 0 : _border$color.rgb) !== null && _border$color$rgb2 !== void 0 ? _border$color$rgb2 : DEFAULT_BORDER_COLOR.color.rgb;
|
|
23818
24523
|
return lineWidth > 0 && color !== "transparent";
|
|
23819
24524
|
}
|
|
23820
24525
|
_drawTableCellBorder(ctx, border, type, position) {
|
|
23821
|
-
var _border$width$v2, _border$
|
|
24526
|
+
var _border$width$v2, _border$width3, _border$color$rgb3, _border$color2;
|
|
23822
24527
|
if (!border) return;
|
|
23823
|
-
const lineWidth = (_border$width$v2 = (_border$
|
|
23824
|
-
const color = (_border$color$
|
|
24528
|
+
const lineWidth = (_border$width$v2 = (_border$width3 = border.width) === null || _border$width3 === void 0 ? void 0 : _border$width3.v) !== null && _border$width$v2 !== void 0 ? _border$width$v2 : 1;
|
|
24529
|
+
const color = (_border$color$rgb3 = (_border$color2 = border.color) === null || _border$color2 === void 0 ? void 0 : _border$color2.rgb) !== null && _border$color$rgb3 !== void 0 ? _border$color$rgb3 : DEFAULT_BORDER_COLOR.color.rgb;
|
|
23825
24530
|
if (lineWidth <= 0 || color === "transparent") return;
|
|
23826
24531
|
ctx.save();
|
|
23827
24532
|
ctx.setLineWidthByPrecision(lineWidth);
|
|
23828
|
-
|
|
24533
|
+
setDocsBorderDash(ctx, border.dashStyle);
|
|
23829
24534
|
ctx.strokeStyle = color;
|
|
23830
24535
|
drawLineByBorderType(ctx, type, 0, position);
|
|
23831
24536
|
ctx.restore();
|
|
@@ -23834,7 +24539,15 @@ var Documents = class Documents extends DocComponent {
|
|
|
23834
24539
|
if (this._drawLiquid == null) return;
|
|
23835
24540
|
const { sections, skeTables } = page;
|
|
23836
24541
|
const { y: originY } = this._drawLiquid;
|
|
23837
|
-
if (skeTables.size > 0)
|
|
24542
|
+
if (skeTables.size > 0) {
|
|
24543
|
+
const tablePage = {
|
|
24544
|
+
...page,
|
|
24545
|
+
marginLeft: parentPage.marginLeft,
|
|
24546
|
+
marginRight: parentPage.marginRight,
|
|
24547
|
+
marginTop: isHeader ? page.marginTop : page.marginTop + alignOffsetNoAngle.y
|
|
24548
|
+
};
|
|
24549
|
+
this._drawTable(ctx, tablePage, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
24550
|
+
}
|
|
23838
24551
|
for (const section of sections) {
|
|
23839
24552
|
const { columns } = section;
|
|
23840
24553
|
this._drawLiquid.translateSave();
|
|
@@ -23947,7 +24660,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
23947
24660
|
});
|
|
23948
24661
|
}
|
|
23949
24662
|
};
|
|
23950
|
-
function
|
|
24663
|
+
function setDocsBorderDash(ctx, dashStyle) {
|
|
23951
24664
|
if (dashStyle === _univerjs_core.DashStyleType.DOT) {
|
|
23952
24665
|
ctx.setLineDash([2]);
|
|
23953
24666
|
return;
|
|
@@ -23993,6 +24706,85 @@ function rectByPrecisionBounds(ctx, x, y, width, height) {
|
|
|
23993
24706
|
//#endregion
|
|
23994
24707
|
//#region src/components/sheets/spreadsheet.ts
|
|
23995
24708
|
const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__";
|
|
24709
|
+
function pushSparseCellRange(ranges, row, col) {
|
|
24710
|
+
const last = ranges[ranges.length - 1];
|
|
24711
|
+
if (last && last.startRow === row && last.endRow === row && last.endColumn + 1 === col) {
|
|
24712
|
+
last.endColumn = col;
|
|
24713
|
+
return;
|
|
24714
|
+
}
|
|
24715
|
+
ranges.push({
|
|
24716
|
+
startRow: row,
|
|
24717
|
+
endRow: row,
|
|
24718
|
+
startColumn: col,
|
|
24719
|
+
endColumn: col
|
|
24720
|
+
});
|
|
24721
|
+
}
|
|
24722
|
+
function scanSparseExtensionFeatures(spreadsheetSkeleton, ranges) {
|
|
24723
|
+
const { worksheet } = spreadsheetSkeleton;
|
|
24724
|
+
if (!worksheet || !ranges.length || worksheet.getMergeData().length > 0) return null;
|
|
24725
|
+
const flags = {
|
|
24726
|
+
hasCustomRender: false,
|
|
24727
|
+
hasMarkers: false,
|
|
24728
|
+
hasSelectionProtection: false,
|
|
24729
|
+
customRenderRanges: [],
|
|
24730
|
+
markerRanges: [],
|
|
24731
|
+
selectionProtectionRanges: []
|
|
24732
|
+
};
|
|
24733
|
+
for (const range of ranges) for (let row = range.startRow; row <= range.endRow; row++) {
|
|
24734
|
+
if (!worksheet.getRowVisible(row)) continue;
|
|
24735
|
+
for (let col = range.startColumn; col <= range.endColumn; col++) {
|
|
24736
|
+
var _spreadsheetSkeleton$, _cell$customRender, _cell$selectionProtec;
|
|
24737
|
+
if (!worksheet.getColVisible(col)) continue;
|
|
24738
|
+
const cachedCell = (_spreadsheetSkeleton$ = spreadsheetSkeleton.stylesCache.fontMatrix.getValue(row, col)) === null || _spreadsheetSkeleton$ === void 0 ? void 0 : _spreadsheetSkeleton$.cellData;
|
|
24739
|
+
const cell = cachedCell !== null && cachedCell !== void 0 ? cachedCell : worksheet.getCell(row, col);
|
|
24740
|
+
if (!cell) continue;
|
|
24741
|
+
if ((_cell$customRender = cell.customRender) === null || _cell$customRender === void 0 ? void 0 : _cell$customRender.length) {
|
|
24742
|
+
flags.hasCustomRender = true;
|
|
24743
|
+
pushSparseCellRange(flags.customRenderRanges, row, col);
|
|
24744
|
+
}
|
|
24745
|
+
if (cell.markers) {
|
|
24746
|
+
flags.hasMarkers = true;
|
|
24747
|
+
pushSparseCellRange(flags.markerRanges, row, col);
|
|
24748
|
+
}
|
|
24749
|
+
if ((_cell$selectionProtec = cell.selectionProtection) === null || _cell$selectionProtec === void 0 ? void 0 : _cell$selectionProtec.length) {
|
|
24750
|
+
flags.hasSelectionProtection = true;
|
|
24751
|
+
pushSparseCellRange(flags.selectionProtectionRanges, row, col);
|
|
24752
|
+
}
|
|
24753
|
+
}
|
|
24754
|
+
}
|
|
24755
|
+
return flags;
|
|
24756
|
+
}
|
|
24757
|
+
function shouldSkipSparseExtension(uKey, flags) {
|
|
24758
|
+
if (!flags) return false;
|
|
24759
|
+
switch (uKey) {
|
|
24760
|
+
case "DefaultCustomExtension": return !flags.hasCustomRender;
|
|
24761
|
+
case "DefaultMarkerExtension": return !flags.hasMarkers;
|
|
24762
|
+
case "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY":
|
|
24763
|
+
case "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY": return !flags.hasSelectionProtection;
|
|
24764
|
+
default: return false;
|
|
24765
|
+
}
|
|
24766
|
+
}
|
|
24767
|
+
function hasSparseExtension(extensions) {
|
|
24768
|
+
return extensions.some((extension) => {
|
|
24769
|
+
switch (extension.uKey) {
|
|
24770
|
+
case "DefaultCustomExtension":
|
|
24771
|
+
case "DefaultMarkerExtension":
|
|
24772
|
+
case "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY":
|
|
24773
|
+
case "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY": return true;
|
|
24774
|
+
default: return false;
|
|
24775
|
+
}
|
|
24776
|
+
});
|
|
24777
|
+
}
|
|
24778
|
+
function getSparseExtensionDiffRanges(uKey, flags, diffRanges) {
|
|
24779
|
+
if (!flags) return diffRanges;
|
|
24780
|
+
switch (uKey) {
|
|
24781
|
+
case "DefaultCustomExtension": return flags.customRenderRanges;
|
|
24782
|
+
case "DefaultMarkerExtension": return flags.markerRanges;
|
|
24783
|
+
case "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY":
|
|
24784
|
+
case "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY": return flags.selectionProtectionRanges;
|
|
24785
|
+
default: return diffRanges;
|
|
24786
|
+
}
|
|
24787
|
+
}
|
|
23996
24788
|
var Spreadsheet = class extends SheetComponent {
|
|
23997
24789
|
constructor(oKey, spreadsheetSkeleton, _allowCache = true) {
|
|
23998
24790
|
super(oKey, spreadsheetSkeleton);
|
|
@@ -24047,7 +24839,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24047
24839
|
var _viewportInfo$diffBou;
|
|
24048
24840
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
24049
24841
|
if (!spreadsheetSkeleton) return;
|
|
24050
|
-
|
|
24842
|
+
const hasMergeData = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
24843
|
+
this._drawAuxiliary(ctx, hasMergeData);
|
|
24051
24844
|
const parentScale = this.getParentScale();
|
|
24052
24845
|
const diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_viewportInfo$diffBou = viewportInfo.diffBounds) === null || _viewportInfo$diffBou === void 0 ? void 0 : _viewportInfo$diffBou.map((bound) => spreadsheetSkeleton.getRangeByViewBound(bound)) : [];
|
|
24053
24846
|
const cacheRange = spreadsheetSkeleton.getCacheRangeByViewport(viewportInfo, this.isPrinting);
|
|
@@ -24058,14 +24851,19 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24058
24851
|
endColumn: cacheRange.endColumn
|
|
24059
24852
|
})) : viewRanges;
|
|
24060
24853
|
const extensions = this.getExtensionsByOrder();
|
|
24854
|
+
const sparseExtensionFeatures = !hasMergeData && hasSparseExtension(extensions) ? scanSparseExtensionFeatures(spreadsheetSkeleton, viewRanges) : null;
|
|
24061
24855
|
const scene = this.getScene();
|
|
24062
24856
|
for (const extension of extensions) {
|
|
24857
|
+
if (shouldSkipSparseExtension(extension.uKey, sparseExtensionFeatures)) continue;
|
|
24063
24858
|
const extensionViewRanges = extension === this._fontExtension || extension === this._borderExtension ? overflowSafeViewRanges : viewRanges;
|
|
24859
|
+
const extensionDiffRanges = getSparseExtensionDiffRanges(extension.uKey, sparseExtensionFeatures, diffRanges);
|
|
24064
24860
|
const timeKey = `${SHEET_EXTENSION_PREFIX}${extension.uKey}`;
|
|
24065
24861
|
const st = _univerjs_core.Tools.now();
|
|
24066
|
-
extension.draw(ctx, parentScale, spreadsheetSkeleton,
|
|
24862
|
+
extension.draw(ctx, parentScale, spreadsheetSkeleton, extensionDiffRanges, {
|
|
24067
24863
|
viewRanges: extensionViewRanges,
|
|
24068
24864
|
checkOutOfViewBound: true,
|
|
24865
|
+
fontRenderRanges: extension === this._fontExtension ? spreadsheetSkeleton.incrementalFontRenderRanges : void 0,
|
|
24866
|
+
hasMergeData,
|
|
24069
24867
|
viewportKey: viewportInfo.viewportKey,
|
|
24070
24868
|
viewBound: viewportInfo.cacheBound,
|
|
24071
24869
|
diffBounds: viewportInfo.diffBounds
|
|
@@ -24163,7 +24961,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24163
24961
|
this._dirtyBounds = dirtyBounds;
|
|
24164
24962
|
}
|
|
24165
24963
|
renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton) {
|
|
24166
|
-
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty } = viewportInfo;
|
|
24964
|
+
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty, shouldCacheUpdate } = viewportInfo;
|
|
24167
24965
|
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
24168
24966
|
const { a: scaleX = 1, d: scaleY = 1 } = mainCtx.getTransform();
|
|
24169
24967
|
const bufferEdgeSizeX = bufferEdgeX * scaleX / window.devicePixelRatio;
|
|
@@ -24172,8 +24970,10 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24172
24970
|
cacheCtx.save();
|
|
24173
24971
|
const isForceDirty = isViewportForceDirty || this.isForceDirty();
|
|
24174
24972
|
const isDirty = isViewportDirty || this.isDirty();
|
|
24175
|
-
const
|
|
24176
|
-
const
|
|
24973
|
+
const cachePixelRatio = cacheCanvas.getPixelRatio();
|
|
24974
|
+
const isScrollJumpOutsideCache = Math.abs(diffX) * scaleX >= cacheCanvas.getWidth() * cachePixelRatio || Math.abs(diffY) * scaleY >= cacheCanvas.getHeight() * cachePixelRatio;
|
|
24975
|
+
const hasMergeData = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
24976
|
+
const shouldRefreshCache = isDirty || isForceDirty || isScrollJumpOutsideCache || hasMergeData && (diffX !== 0 || diffY !== 0) || shouldCacheUpdate && diffX !== 0;
|
|
24177
24977
|
if (diffBounds.length === 0 || diffX === 0 && diffY === 0 || shouldRefreshCache) {
|
|
24178
24978
|
if (shouldRefreshCache) {
|
|
24179
24979
|
this.addRenderTagToScene("scrolling", false);
|
|
@@ -24267,6 +25067,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24267
25067
|
}
|
|
24268
25068
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
24269
25069
|
if (!spreadsheetSkeleton) return;
|
|
25070
|
+
const { viewportKey } = viewportInfo;
|
|
25071
|
+
if (sheetHeaderViewportKeys.includes(viewportKey)) return this;
|
|
24270
25072
|
spreadsheetSkeleton.setStylesCache(viewportInfo);
|
|
24271
25073
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
24272
25074
|
if (!segment) return;
|
|
@@ -24275,10 +25077,9 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24275
25077
|
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
24276
25078
|
mainCtx.translateWithPrecision(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
24277
25079
|
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
24278
|
-
const { viewportKey } = viewportInfo;
|
|
24279
25080
|
if (sheetContentViewportKeys.includes(viewportKey)) if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
24280
25081
|
else this._draw(mainCtx, viewportInfo);
|
|
24281
|
-
else if (
|
|
25082
|
+
else if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
24282
25083
|
else this._draw(mainCtx, viewportInfo);
|
|
24283
25084
|
mainCtx.restore();
|
|
24284
25085
|
return this;
|
|
@@ -24346,7 +25147,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24346
25147
|
* draw gridlines
|
|
24347
25148
|
* @param ctx
|
|
24348
25149
|
*/
|
|
24349
|
-
_drawAuxiliary(ctx) {
|
|
25150
|
+
_drawAuxiliary(ctx, hasMergeData = true) {
|
|
24350
25151
|
var _ref;
|
|
24351
25152
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
24352
25153
|
if (spreadsheetSkeleton == null) return;
|
|
@@ -24388,22 +25189,24 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24388
25189
|
const mergeVisibleRanges = [];
|
|
24389
25190
|
let mergeVisibleRangeStartRow = startRow;
|
|
24390
25191
|
for (let r = rowStart; r <= rowEnd; r++) {
|
|
24391
|
-
if (
|
|
24392
|
-
if (
|
|
24393
|
-
|
|
24394
|
-
|
|
24395
|
-
|
|
24396
|
-
|
|
24397
|
-
|
|
24398
|
-
|
|
24399
|
-
|
|
24400
|
-
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
25192
|
+
if (hasMergeData) {
|
|
25193
|
+
if (worksheet.getRowVisible(r) === false) {
|
|
25194
|
+
if (mergeVisibleRangeStartRow < r) {
|
|
25195
|
+
mergeVisibleRanges.push({
|
|
25196
|
+
startRow: mergeVisibleRangeStartRow,
|
|
25197
|
+
endRow: r - 1,
|
|
25198
|
+
startColumn,
|
|
25199
|
+
endColumn
|
|
25200
|
+
});
|
|
25201
|
+
mergeVisibleRangeStartRow = r + 1;
|
|
25202
|
+
} else if (mergeVisibleRangeStartRow === r) mergeVisibleRangeStartRow = r + 1;
|
|
25203
|
+
} else if (r === endRow && mergeVisibleRangeStartRow <= r) mergeVisibleRanges.push({
|
|
25204
|
+
startRow: mergeVisibleRangeStartRow,
|
|
25205
|
+
endRow: r,
|
|
25206
|
+
startColumn,
|
|
25207
|
+
endColumn
|
|
25208
|
+
});
|
|
25209
|
+
}
|
|
24407
25210
|
if (r < 0 || r > rowHeightAccumulationLength - 1) continue;
|
|
24408
25211
|
const rowEndPosition = rowHeightAccumulation[r];
|
|
24409
25212
|
ctx.beginPath();
|
|
@@ -24422,7 +25225,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24422
25225
|
ctx.stroke();
|
|
24423
25226
|
}
|
|
24424
25227
|
const mergeCellRanges = [];
|
|
24425
|
-
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
25228
|
+
if (hasMergeData) for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
24426
25229
|
const mergeRangeInVisible = spreadsheetSkeleton.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
24427
25230
|
mergeCellRanges.push(...mergeRangeInVisible);
|
|
24428
25231
|
}
|
|
@@ -25361,6 +26164,164 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
25361
26164
|
}
|
|
25362
26165
|
};
|
|
25363
26166
|
|
|
26167
|
+
//#endregion
|
|
26168
|
+
//#region src/components/docs/layout/doc-no-wrap-measure.ts
|
|
26169
|
+
function splitDocumentNoWrapMeasureLines(text) {
|
|
26170
|
+
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
26171
|
+
}
|
|
26172
|
+
function isDocumentNoWrapMeasureTrailingWhitespace(char) {
|
|
26173
|
+
return char === " " || char === " " || char === "\xA0";
|
|
26174
|
+
}
|
|
26175
|
+
function getDocumentNoWrapMeasureTrailingWhitespaceStart(text) {
|
|
26176
|
+
let index = text.length;
|
|
26177
|
+
while (index > 0 && isDocumentNoWrapMeasureTrailingWhitespace(text[index - 1])) index--;
|
|
26178
|
+
return index;
|
|
26179
|
+
}
|
|
26180
|
+
function isDocumentNoWrapMeasureCJKText(char) {
|
|
26181
|
+
return /[\u2E80-\u9FFF\uF900-\uFAFF]/u.test(char);
|
|
26182
|
+
}
|
|
26183
|
+
function isDocumentNoWrapMeasureLatinText(char) {
|
|
26184
|
+
return /[a-z\d]/i.test(char);
|
|
26185
|
+
}
|
|
26186
|
+
function measureDocumentNoWrapTextByStyle(text, textStyle) {
|
|
26187
|
+
if (!text) return 0;
|
|
26188
|
+
return FontCache.getMeasureText(text, getFontStyleString(textStyle).fontCache).width;
|
|
26189
|
+
}
|
|
26190
|
+
function measureDocumentNoWrapCJKLatinSpacing(segment, textStyle, previous) {
|
|
26191
|
+
let spacing = 0;
|
|
26192
|
+
for (const char of Array.from(segment)) {
|
|
26193
|
+
const isCJK = isDocumentNoWrapMeasureCJKText(char);
|
|
26194
|
+
const cjkWidth = isCJK ? measureDocumentNoWrapTextByStyle(char, textStyle) : 0;
|
|
26195
|
+
if (isCJK && isDocumentNoWrapMeasureLatinText(previous.char)) spacing += cjkWidth / 4;
|
|
26196
|
+
if (isDocumentNoWrapMeasureLatinText(char) && isDocumentNoWrapMeasureCJKText(previous.char)) spacing += previous.cjkWidth / 4;
|
|
26197
|
+
previous.char = char;
|
|
26198
|
+
previous.cjkWidth = cjkWidth;
|
|
26199
|
+
}
|
|
26200
|
+
return spacing;
|
|
26201
|
+
}
|
|
26202
|
+
function measureDocumentNoWrapLineByStyle(text, textStyle) {
|
|
26203
|
+
const visibleText = text.slice(0, getDocumentNoWrapMeasureTrailingWhitespaceStart(text));
|
|
26204
|
+
return measureDocumentNoWrapTextByStyle(visibleText, textStyle) + measureDocumentNoWrapCJKLatinSpacing(visibleText, textStyle, {
|
|
26205
|
+
char: "",
|
|
26206
|
+
cjkWidth: 0
|
|
26207
|
+
});
|
|
26208
|
+
}
|
|
26209
|
+
function measureDocumentNoWrapRunsWidth(dataStream, textRuns, fallbackTextStyle) {
|
|
26210
|
+
let currentLineWidth = 0;
|
|
26211
|
+
let maxLineWidth = 0;
|
|
26212
|
+
let pendingTrailingWhitespaceWidth = 0;
|
|
26213
|
+
const previous = {
|
|
26214
|
+
char: "",
|
|
26215
|
+
cjkWidth: 0
|
|
26216
|
+
};
|
|
26217
|
+
const appendSegment = (segment, textStyle) => {
|
|
26218
|
+
if (!segment) return;
|
|
26219
|
+
const trailingStart = getDocumentNoWrapMeasureTrailingWhitespaceStart(segment);
|
|
26220
|
+
const visibleSegment = segment.slice(0, trailingStart);
|
|
26221
|
+
const trailingWhitespace = segment.slice(trailingStart);
|
|
26222
|
+
if (visibleSegment) {
|
|
26223
|
+
currentLineWidth += pendingTrailingWhitespaceWidth;
|
|
26224
|
+
pendingTrailingWhitespaceWidth = 0;
|
|
26225
|
+
currentLineWidth += measureDocumentNoWrapTextByStyle(visibleSegment, textStyle);
|
|
26226
|
+
currentLineWidth += measureDocumentNoWrapCJKLatinSpacing(visibleSegment, textStyle, previous);
|
|
26227
|
+
}
|
|
26228
|
+
if (trailingWhitespace) {
|
|
26229
|
+
pendingTrailingWhitespaceWidth += measureDocumentNoWrapTextByStyle(trailingWhitespace, textStyle);
|
|
26230
|
+
measureDocumentNoWrapCJKLatinSpacing(trailingWhitespace, textStyle, previous);
|
|
26231
|
+
}
|
|
26232
|
+
};
|
|
26233
|
+
const finishLine = () => {
|
|
26234
|
+
maxLineWidth = Math.max(maxLineWidth, currentLineWidth);
|
|
26235
|
+
currentLineWidth = 0;
|
|
26236
|
+
pendingTrailingWhitespaceWidth = 0;
|
|
26237
|
+
previous.char = "";
|
|
26238
|
+
previous.cjkWidth = 0;
|
|
26239
|
+
};
|
|
26240
|
+
const appendRange = (text, textStyle) => {
|
|
26241
|
+
splitDocumentNoWrapMeasureLines(text).forEach((segment, index) => {
|
|
26242
|
+
if (index > 0) finishLine();
|
|
26243
|
+
appendSegment(segment, textStyle);
|
|
26244
|
+
});
|
|
26245
|
+
};
|
|
26246
|
+
let cursor = 0;
|
|
26247
|
+
[...textRuns].sort((a, b) => a.st - b.st).forEach((run) => {
|
|
26248
|
+
const start = Math.max(0, run.st);
|
|
26249
|
+
const end = Math.max(start, run.ed);
|
|
26250
|
+
if (start > cursor) appendRange(dataStream.slice(cursor, start), fallbackTextStyle);
|
|
26251
|
+
const effectiveStart = Math.max(start, cursor);
|
|
26252
|
+
if (end > effectiveStart) appendRange(dataStream.slice(effectiveStart, end), run.ts);
|
|
26253
|
+
cursor = Math.max(cursor, end);
|
|
26254
|
+
});
|
|
26255
|
+
if (cursor < dataStream.length) appendRange(dataStream.slice(cursor), fallbackTextStyle);
|
|
26256
|
+
return Math.max(maxLineWidth, currentLineWidth);
|
|
26257
|
+
}
|
|
26258
|
+
function measureDocumentNoWrapTextRangeWidth(documentData, start, end) {
|
|
26259
|
+
var _body$dataStream, _body$textRuns, _documentData$documen2;
|
|
26260
|
+
const body = documentData.body;
|
|
26261
|
+
const dataStream = (_body$dataStream = body === null || body === void 0 ? void 0 : body.dataStream) !== null && _body$dataStream !== void 0 ? _body$dataStream : "";
|
|
26262
|
+
const rangeStart = Math.max(0, Math.min(dataStream.length, start));
|
|
26263
|
+
const rangeEnd = Math.max(rangeStart, Math.min(dataStream.length, end));
|
|
26264
|
+
const rangeText = dataStream.slice(rangeStart, rangeEnd);
|
|
26265
|
+
const textRuns = ((_body$textRuns = body === null || body === void 0 ? void 0 : body.textRuns) !== null && _body$textRuns !== void 0 ? _body$textRuns : []).map((run) => {
|
|
26266
|
+
const runStart = Math.max(rangeStart, run.st);
|
|
26267
|
+
const runEnd = Math.min(rangeEnd, run.ed);
|
|
26268
|
+
if (runEnd <= runStart) return null;
|
|
26269
|
+
return {
|
|
26270
|
+
...run,
|
|
26271
|
+
st: runStart - rangeStart,
|
|
26272
|
+
ed: runEnd - rangeStart
|
|
26273
|
+
};
|
|
26274
|
+
}).filter((run) => run !== null);
|
|
26275
|
+
if (textRuns.length) {
|
|
26276
|
+
var _documentData$documen;
|
|
26277
|
+
return measureDocumentNoWrapRunsWidth(rangeText, textRuns, (_documentData$documen = documentData.documentStyle) === null || _documentData$documen === void 0 ? void 0 : _documentData$documen.textStyle);
|
|
26278
|
+
}
|
|
26279
|
+
return measureDocumentNoWrapLineByStyle(rangeText, (_documentData$documen2 = documentData.documentStyle) === null || _documentData$documen2 === void 0 ? void 0 : _documentData$documen2.textStyle);
|
|
26280
|
+
}
|
|
26281
|
+
/**
|
|
26282
|
+
* Measures the widest no-wrap line using the same text-width policy that docs
|
|
26283
|
+
* layout relies on for lightweight shape/text-box autofit flows.
|
|
26284
|
+
*
|
|
26285
|
+
* This is intentionally not a full document layout replacement: callers that
|
|
26286
|
+
* need line breaking, pagination, floating objects, or final line metrics should
|
|
26287
|
+
* use `DocumentSkeleton`. This helper exists for consumers that must size a
|
|
26288
|
+
* no-wrap host before committing a full layout pass. Keep docs-specific glyph
|
|
26289
|
+
* width adjustments here so feature packages do not duplicate paragraph shaping
|
|
26290
|
+
* details such as CJK-Latin spacing.
|
|
26291
|
+
*/
|
|
26292
|
+
function measureDocumentNoWrapTextWidth(documentData) {
|
|
26293
|
+
var _body$dataStream2, _documentData$documen4;
|
|
26294
|
+
const body = documentData === null || documentData === void 0 ? void 0 : documentData.body;
|
|
26295
|
+
const dataStream = (_body$dataStream2 = body === null || body === void 0 ? void 0 : body.dataStream) !== null && _body$dataStream2 !== void 0 ? _body$dataStream2 : "";
|
|
26296
|
+
const textRuns = body === null || body === void 0 ? void 0 : body.textRuns;
|
|
26297
|
+
if (textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) {
|
|
26298
|
+
var _documentData$documen3;
|
|
26299
|
+
return measureDocumentNoWrapRunsWidth(dataStream, textRuns, documentData === null || documentData === void 0 || (_documentData$documen3 = documentData.documentStyle) === null || _documentData$documen3 === void 0 ? void 0 : _documentData$documen3.textStyle);
|
|
26300
|
+
}
|
|
26301
|
+
const fallbackTextStyle = documentData === null || documentData === void 0 || (_documentData$documen4 = documentData.documentStyle) === null || _documentData$documen4 === void 0 ? void 0 : _documentData$documen4.textStyle;
|
|
26302
|
+
return Math.max(0, ...splitDocumentNoWrapMeasureLines(dataStream).map((line) => measureDocumentNoWrapLineByStyle(line, fallbackTextStyle)));
|
|
26303
|
+
}
|
|
26304
|
+
/**
|
|
26305
|
+
* Measures the widest segment that docs line breaking keeps together. This is
|
|
26306
|
+
* useful when a host may wrap normally but still needs enough width to avoid
|
|
26307
|
+
* clipping an individual word, CJK glyph, or punctuation segment.
|
|
26308
|
+
*/
|
|
26309
|
+
function measureDocumentUnbreakableTextWidth(documentData) {
|
|
26310
|
+
var _documentData$body$da, _documentData$body;
|
|
26311
|
+
const dataStream = (_documentData$body$da = documentData === null || documentData === void 0 || (_documentData$body = documentData.body) === null || _documentData$body === void 0 ? void 0 : _documentData$body.dataStream) !== null && _documentData$body$da !== void 0 ? _documentData$body$da : "";
|
|
26312
|
+
if (!documentData || !dataStream) return 0;
|
|
26313
|
+
const breaker = new LineBreaker(dataStream);
|
|
26314
|
+
let start = 0;
|
|
26315
|
+
let maxWidth = 0;
|
|
26316
|
+
let breakPoint = breaker.nextBreakPoint();
|
|
26317
|
+
while (breakPoint) {
|
|
26318
|
+
maxWidth = Math.max(maxWidth, measureDocumentNoWrapTextRangeWidth(documentData, start, breakPoint.position));
|
|
26319
|
+
start = breakPoint.position;
|
|
26320
|
+
breakPoint = breaker.nextBreakPoint();
|
|
26321
|
+
}
|
|
26322
|
+
return maxWidth;
|
|
26323
|
+
}
|
|
26324
|
+
|
|
25364
26325
|
//#endregion
|
|
25365
26326
|
//#region src/custom/custom-object.ts
|
|
25366
26327
|
var CustomObject = class extends BaseObject {
|
|
@@ -26555,7 +27516,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
26555
27516
|
//#endregion
|
|
26556
27517
|
//#region package.json
|
|
26557
27518
|
var name = "@univerjs/engine-render";
|
|
26558
|
-
var version = "1.0.0-alpha.
|
|
27519
|
+
var version = "1.0.0-alpha.3";
|
|
26559
27520
|
|
|
26560
27521
|
//#endregion
|
|
26561
27522
|
//#region src/config/config.ts
|
|
@@ -27908,11 +28869,13 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
27908
28869
|
});
|
|
27909
28870
|
}
|
|
27910
28871
|
_getOutlinePosition(width, height, borderSpacing, borderStrokeWidth) {
|
|
28872
|
+
const offset = borderSpacing + borderStrokeWidth;
|
|
28873
|
+
const strokeOffset = borderStrokeWidth / 2;
|
|
27911
28874
|
return {
|
|
27912
|
-
left:
|
|
27913
|
-
top: -
|
|
27914
|
-
width: width +
|
|
27915
|
-
height: height +
|
|
28875
|
+
left: -offset - strokeOffset,
|
|
28876
|
+
top: -offset - strokeOffset,
|
|
28877
|
+
width: width + offset * 2,
|
|
28878
|
+
height: height + offset * 2
|
|
27916
28879
|
};
|
|
27917
28880
|
}
|
|
27918
28881
|
_getRotateAnchorCursor(type) {
|
|
@@ -27986,7 +28949,7 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
27986
28949
|
top += -borderSpacing - borderStrokeWidth;
|
|
27987
28950
|
break;
|
|
27988
28951
|
case "__SpreadsheetTransformerResizeLM__":
|
|
27989
|
-
left += borderSpacing - borderStrokeWidth;
|
|
28952
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
27990
28953
|
top += height / 2 - longEdge / 2;
|
|
27991
28954
|
break;
|
|
27992
28955
|
case "__SpreadsheetTransformerResizeRM__":
|
|
@@ -27994,7 +28957,7 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
27994
28957
|
top += height / 2 - longEdge / 2;
|
|
27995
28958
|
break;
|
|
27996
28959
|
case "__SpreadsheetTransformerResizeLB__":
|
|
27997
|
-
left += -
|
|
28960
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
27998
28961
|
top += height + borderSpacing - borderStrokeWidth - longEdge;
|
|
27999
28962
|
break;
|
|
28000
28963
|
case "__SpreadsheetTransformerResizeCB__":
|
|
@@ -28034,28 +28997,28 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
28034
28997
|
top += -borderSpacing - borderStrokeWidth;
|
|
28035
28998
|
break;
|
|
28036
28999
|
case "__SpreadsheetTransformerResizeRT__":
|
|
28037
|
-
left += width + borderSpacing
|
|
29000
|
+
left += width + borderSpacing + borderStrokeWidth;
|
|
28038
29001
|
top += -borderSpacing - borderStrokeWidth;
|
|
28039
29002
|
break;
|
|
28040
29003
|
case "__SpreadsheetTransformerResizeLM__":
|
|
28041
|
-
left += borderSpacing - borderStrokeWidth;
|
|
29004
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
28042
29005
|
top += height / 2;
|
|
28043
29006
|
break;
|
|
28044
29007
|
case "__SpreadsheetTransformerResizeRM__":
|
|
28045
|
-
left += width + borderSpacing
|
|
29008
|
+
left += width + borderSpacing + borderStrokeWidth;
|
|
28046
29009
|
top += height / 2;
|
|
28047
29010
|
break;
|
|
28048
29011
|
case "__SpreadsheetTransformerResizeLB__":
|
|
28049
|
-
left += -
|
|
28050
|
-
top += height + borderSpacing
|
|
29012
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
29013
|
+
top += height + borderSpacing + borderStrokeWidth;
|
|
28051
29014
|
break;
|
|
28052
29015
|
case "__SpreadsheetTransformerResizeCB__":
|
|
28053
29016
|
left += width / 2;
|
|
28054
|
-
top += height + borderSpacing
|
|
29017
|
+
top += height + borderSpacing + borderStrokeWidth;
|
|
28055
29018
|
break;
|
|
28056
29019
|
case "__SpreadsheetTransformerResizeRB__":
|
|
28057
|
-
left += width + borderSpacing
|
|
28058
|
-
top += height + borderSpacing
|
|
29020
|
+
left += width + borderSpacing + borderStrokeWidth;
|
|
29021
|
+
top += height + borderSpacing + borderStrokeWidth;
|
|
28059
29022
|
break;
|
|
28060
29023
|
}
|
|
28061
29024
|
return {
|
|
@@ -28094,8 +29057,8 @@ var Transformer = class extends _univerjs_core.Disposable {
|
|
|
28094
29057
|
width: anchorProps.width,
|
|
28095
29058
|
height: anchorProps.height,
|
|
28096
29059
|
radius: anchorProps.radius,
|
|
28097
|
-
left: left + (anchorSize - anchorProps.width) / 2,
|
|
28098
|
-
top: top + (anchorSize - anchorProps.height) / 2,
|
|
29060
|
+
left: left + (anchorSize - anchorProps.width) / 2 - anchorStrokeWidth / 2,
|
|
29061
|
+
top: top + (anchorSize - anchorProps.height) / 2 - anchorStrokeWidth / 2,
|
|
28099
29062
|
shadowColor: anchorShadowColor,
|
|
28100
29063
|
shadowBlur: anchorShadowBlur,
|
|
28101
29064
|
shadowOffsetX: anchorShadowOffsetX,
|
|
@@ -29409,14 +30372,17 @@ let RenderUnit = class RenderUnit extends _univerjs_core.Disposable {
|
|
|
29409
30372
|
return this._renderContext.components;
|
|
29410
30373
|
}
|
|
29411
30374
|
constructor(init, parentInjector) {
|
|
29412
|
-
var _init$createUnitOptio;
|
|
30375
|
+
var _init$createUnitOptio, _init$createUnitOptio2, _init$createUnitOptio3;
|
|
29413
30376
|
super();
|
|
29414
30377
|
_defineProperty(this, "isRenderUnit", true);
|
|
29415
30378
|
_defineProperty(this, "_activated$", new rxjs.BehaviorSubject(true));
|
|
29416
30379
|
_defineProperty(this, "activated$", this._activated$.pipe((0, rxjs.distinctUntilChanged)()));
|
|
29417
30380
|
_defineProperty(this, "_injector", void 0);
|
|
29418
30381
|
_defineProperty(this, "_renderContext", void 0);
|
|
29419
|
-
this
|
|
30382
|
+
_defineProperty(this, "_dependencyService", void 0);
|
|
30383
|
+
const renderParentInjector = (_init$createUnitOptio = (_init$createUnitOptio2 = init.createUnitOptions) === null || _init$createUnitOptio2 === void 0 ? void 0 : _init$createUnitOptio2.renderParentInjector) !== null && _init$createUnitOptio !== void 0 ? _init$createUnitOptio : parentInjector;
|
|
30384
|
+
this._injector = renderParentInjector.createChild();
|
|
30385
|
+
this._dependencyService = new RenderUnitDependencyService(this._injector, () => this._renderContext);
|
|
29420
30386
|
this._renderContext = {
|
|
29421
30387
|
unit: init.unit,
|
|
29422
30388
|
unitId: init.unit.getUnitId(),
|
|
@@ -29430,13 +30396,14 @@ let RenderUnit = class RenderUnit extends _univerjs_core.Disposable {
|
|
|
29430
30396
|
activate: () => this._activated$.next(true),
|
|
29431
30397
|
deactivate: () => this._activated$.next(false)
|
|
29432
30398
|
};
|
|
29433
|
-
if (((_init$
|
|
30399
|
+
if (((_init$createUnitOptio3 = init.createUnitOptions) === null || _init$createUnitOptio3 === void 0 ? void 0 : _init$createUnitOptio3.makeCurrent) === false) this.deactivate();
|
|
29434
30400
|
}
|
|
29435
30401
|
dispose() {
|
|
29436
|
-
this.
|
|
29437
|
-
super.dispose();
|
|
30402
|
+
if (this._disposed) return;
|
|
29438
30403
|
this._activated$.next(false);
|
|
29439
30404
|
this._activated$.complete();
|
|
30405
|
+
super.dispose();
|
|
30406
|
+
this._injector.dispose();
|
|
29440
30407
|
this._renderContext.unit = null;
|
|
29441
30408
|
this._renderContext.components.clear();
|
|
29442
30409
|
}
|
|
@@ -29447,7 +30414,10 @@ let RenderUnit = class RenderUnit extends _univerjs_core.Disposable {
|
|
|
29447
30414
|
* Get a dependency from the RenderUnit's injector.
|
|
29448
30415
|
*/
|
|
29449
30416
|
with(dependency) {
|
|
29450
|
-
return this.
|
|
30417
|
+
return this._dependencyService.resolve(dependency);
|
|
30418
|
+
}
|
|
30419
|
+
getInjector() {
|
|
30420
|
+
return this._injector;
|
|
29451
30421
|
}
|
|
29452
30422
|
/**
|
|
29453
30423
|
* Add render dependencies to the RenderUnit's injector. Note that the dependencies would be initialized immediately
|
|
@@ -29457,16 +30427,8 @@ let RenderUnit = class RenderUnit extends _univerjs_core.Disposable {
|
|
|
29457
30427
|
this._initDependencies(dependencies);
|
|
29458
30428
|
}
|
|
29459
30429
|
_initDependencies(dependencies) {
|
|
29460
|
-
|
|
29461
|
-
|
|
29462
|
-
const [identifier, implOrNull] = Array.isArray(dep) ? dep : [dep, null];
|
|
29463
|
-
if (!implOrNull) j.add([identifier, { useFactory: () => j.createInstance(identifier, this._renderContext) }]);
|
|
29464
|
-
else if ((0, _univerjs_core.isClassDependencyItem)(implOrNull)) j.add([identifier, { useFactory: () => j.createInstance(implOrNull.useClass, this._renderContext) }]);
|
|
29465
|
-
else throw new Error("[RenderUnit]: render dependency could only be an class!");
|
|
29466
|
-
});
|
|
29467
|
-
dependencies.forEach((dep) => {
|
|
29468
|
-
const [identifier] = Array.isArray(dep) ? dep : [dep, null];
|
|
29469
|
-
j.get(identifier);
|
|
30430
|
+
this._dependencyService.register(dependencies).forEach((record) => {
|
|
30431
|
+
this._dependencyService.resolveRecord(record);
|
|
29470
30432
|
});
|
|
29471
30433
|
}
|
|
29472
30434
|
getRenderContext() {
|
|
@@ -29480,6 +30442,86 @@ let RenderUnit = class RenderUnit extends _univerjs_core.Disposable {
|
|
|
29480
30442
|
}
|
|
29481
30443
|
};
|
|
29482
30444
|
RenderUnit = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector))], RenderUnit);
|
|
30445
|
+
var RenderUnitDependencyService = class {
|
|
30446
|
+
constructor(_injector, _getRenderContext) {
|
|
30447
|
+
this._injector = _injector;
|
|
30448
|
+
this._getRenderContext = _getRenderContext;
|
|
30449
|
+
_defineProperty(this, "_records", /* @__PURE__ */ new Map());
|
|
30450
|
+
_defineProperty(this, "_resolved", /* @__PURE__ */ new Map());
|
|
30451
|
+
_defineProperty(this, "_resolving", /* @__PURE__ */ new Set());
|
|
30452
|
+
}
|
|
30453
|
+
register(dependencies) {
|
|
30454
|
+
const records = [];
|
|
30455
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30456
|
+
dependencies.forEach((dependency) => {
|
|
30457
|
+
const parsed = this._parseDependency(dependency);
|
|
30458
|
+
const key = getRenderDependencyIdentifierKey$1(parsed.identifier);
|
|
30459
|
+
const existing = this._records.get(key);
|
|
30460
|
+
const record = existing !== null && existing !== void 0 ? existing : this._addRecord(key, parsed.identifier, parsed.create);
|
|
30461
|
+
if (seen.has(record.key)) return;
|
|
30462
|
+
seen.add(record.key);
|
|
30463
|
+
records.push(record);
|
|
30464
|
+
});
|
|
30465
|
+
return records;
|
|
30466
|
+
}
|
|
30467
|
+
resolve(dependency) {
|
|
30468
|
+
const key = getRenderDependencyIdentifierKey$1(dependency);
|
|
30469
|
+
if (this._resolved.has(key)) return this._resolved.get(key);
|
|
30470
|
+
if (this._resolving.has(key)) return;
|
|
30471
|
+
const record = this._records.get(key);
|
|
30472
|
+
if (record) return this.resolveRecord(record);
|
|
30473
|
+
return this._injector.get(dependency, _univerjs_core.LookUp.SELF);
|
|
30474
|
+
}
|
|
30475
|
+
resolveRecord(record) {
|
|
30476
|
+
if (this._resolved.has(record.key)) return this._resolved.get(record.key);
|
|
30477
|
+
if (this._resolving.has(record.key)) return;
|
|
30478
|
+
this._resolving.add(record.key);
|
|
30479
|
+
try {
|
|
30480
|
+
return this._injector.get(record.identifier, _univerjs_core.LookUp.SELF);
|
|
30481
|
+
} finally {
|
|
30482
|
+
this._resolving.delete(record.key);
|
|
30483
|
+
}
|
|
30484
|
+
}
|
|
30485
|
+
_addRecord(key, identifier, create) {
|
|
30486
|
+
const record = {
|
|
30487
|
+
key,
|
|
30488
|
+
identifier,
|
|
30489
|
+
create
|
|
30490
|
+
};
|
|
30491
|
+
this._records.set(key, record);
|
|
30492
|
+
this._injector.add([identifier, { useFactory: () => this._create(record) }]);
|
|
30493
|
+
return record;
|
|
30494
|
+
}
|
|
30495
|
+
_create(record) {
|
|
30496
|
+
if (this._resolved.has(record.key)) return this._resolved.get(record.key);
|
|
30497
|
+
const alreadyResolving = this._resolving.has(record.key);
|
|
30498
|
+
if (!alreadyResolving) this._resolving.add(record.key);
|
|
30499
|
+
try {
|
|
30500
|
+
const instance = record.create();
|
|
30501
|
+
this._resolved.set(record.key, instance);
|
|
30502
|
+
return instance;
|
|
30503
|
+
} finally {
|
|
30504
|
+
if (!alreadyResolving) this._resolving.delete(record.key);
|
|
30505
|
+
}
|
|
30506
|
+
}
|
|
30507
|
+
_parseDependency(dependency) {
|
|
30508
|
+
const [identifier, implOrNull] = Array.isArray(dependency) ? dependency : [dependency, null];
|
|
30509
|
+
if (!implOrNull) return {
|
|
30510
|
+
identifier,
|
|
30511
|
+
create: () => this._injector.createInstance(identifier, this._getRenderContext())
|
|
30512
|
+
};
|
|
30513
|
+
if ((0, _univerjs_core.isClassDependencyItem)(implOrNull)) return {
|
|
30514
|
+
identifier,
|
|
30515
|
+
create: () => this._injector.createInstance(implOrNull.useClass, this._getRenderContext())
|
|
30516
|
+
};
|
|
30517
|
+
throw new Error("[RenderUnit]: render dependency could only be an class!");
|
|
30518
|
+
}
|
|
30519
|
+
};
|
|
30520
|
+
function getRenderDependencyIdentifierKey$1(identifier) {
|
|
30521
|
+
const decoratorName = identifier === null || identifier === void 0 ? void 0 : identifier.decoratorName;
|
|
30522
|
+
if (typeof decoratorName === "string" && decoratorName) return `identifier:${decoratorName}`;
|
|
30523
|
+
return identifier;
|
|
30524
|
+
}
|
|
29483
30525
|
|
|
29484
30526
|
//#endregion
|
|
29485
30527
|
//#region src/render-manager/render-manager.service.ts
|
|
@@ -29520,10 +30562,11 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
29520
30562
|
registerRenderModules(type, deps) {
|
|
29521
30563
|
if (!this._renderDependencies.has(type)) this._renderDependencies.set(type, []);
|
|
29522
30564
|
const dependencies = this._renderDependencies.get(type);
|
|
29523
|
-
|
|
29524
|
-
|
|
30565
|
+
const registeredDeps = deps.filter((dep) => !hasRenderDependency(dependencies, dep));
|
|
30566
|
+
dependencies.push(...registeredDeps);
|
|
30567
|
+
for (const [_, render] of this._renderMap) if (render.type === type) this._tryAddRenderDependencies(render, registeredDeps);
|
|
29525
30568
|
return (0, _univerjs_core.toDisposable)(() => {
|
|
29526
|
-
|
|
30569
|
+
registeredDeps.forEach((dep) => (0, _univerjs_core.remove)(dependencies, dep));
|
|
29527
30570
|
});
|
|
29528
30571
|
}
|
|
29529
30572
|
/**
|
|
@@ -29534,6 +30577,7 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
29534
30577
|
registerRenderModule(type, depCtor) {
|
|
29535
30578
|
if (!this._renderDependencies.has(type)) this._renderDependencies.set(type, []);
|
|
29536
30579
|
const dependencies = this._renderDependencies.get(type);
|
|
30580
|
+
if (hasRenderDependency(dependencies, depCtor)) return (0, _univerjs_core.toDisposable)(() => {});
|
|
29537
30581
|
dependencies.push(depCtor);
|
|
29538
30582
|
for (const [_, render] of this._renderMap) if (render.type === type) this._tryAddRenderDependencies(render, [depCtor]);
|
|
29539
30583
|
return (0, _univerjs_core.toDisposable)(() => (0, _univerjs_core.remove)(dependencies, depCtor));
|
|
@@ -29566,7 +30610,9 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
29566
30610
|
* @returns renderUnit:IRender
|
|
29567
30611
|
*/
|
|
29568
30612
|
createRender(unitId, createUnitOptions) {
|
|
29569
|
-
|
|
30613
|
+
var _createUnitOptions$re;
|
|
30614
|
+
const parentInjector = (_createUnitOptions$re = createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.renderParentInjector) !== null && _createUnitOptions$re !== void 0 ? _createUnitOptions$re : this._injector;
|
|
30615
|
+
const renderer = this._createRender(unitId, parentInjector.createInstance(Engine, unitId, void 0), (createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.embeddedRender) !== true, createUnitOptions, parentInjector);
|
|
29570
30616
|
this._renderCreated$.next(renderer);
|
|
29571
30617
|
return renderer;
|
|
29572
30618
|
}
|
|
@@ -29590,7 +30636,7 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
29590
30636
|
* @param isMainScene
|
|
29591
30637
|
* @returns renderUnit:IRender
|
|
29592
30638
|
*/
|
|
29593
|
-
_createRender(unitId, engine, isMainScene = true, createUnitOptions) {
|
|
30639
|
+
_createRender(unitId, engine, isMainScene = true, createUnitOptions, parentInjector = this._injector) {
|
|
29594
30640
|
const existItem = this.getRenderById(unitId);
|
|
29595
30641
|
let shouldDestroyEngine = true;
|
|
29596
30642
|
if (existItem != null) {
|
|
@@ -29607,7 +30653,7 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
29607
30653
|
if (unit) {
|
|
29608
30654
|
const type = this._univerInstanceService.getUnitType(unitId);
|
|
29609
30655
|
const ctorOfDeps = this._getRenderDepsByType(type);
|
|
29610
|
-
renderUnit =
|
|
30656
|
+
renderUnit = parentInjector.createInstance(RenderUnit, {
|
|
29611
30657
|
unit,
|
|
29612
30658
|
engine,
|
|
29613
30659
|
scene,
|
|
@@ -29615,7 +30661,16 @@ let RenderManagerService = class RenderManagerService extends _univerjs_core.Dis
|
|
|
29615
30661
|
createUnitOptions
|
|
29616
30662
|
});
|
|
29617
30663
|
this._addRenderUnit(unitId, renderUnit);
|
|
29618
|
-
|
|
30664
|
+
try {
|
|
30665
|
+
this._tryAddRenderDependencies(renderUnit, ctorOfDeps);
|
|
30666
|
+
} catch (error) {
|
|
30667
|
+
try {
|
|
30668
|
+
this._disposeItem(renderUnit);
|
|
30669
|
+
} finally {
|
|
30670
|
+
this._renderMap.delete(unitId);
|
|
30671
|
+
}
|
|
30672
|
+
throw error;
|
|
30673
|
+
}
|
|
29619
30674
|
} else {
|
|
29620
30675
|
renderUnit = {
|
|
29621
30676
|
isThumbNail: true,
|
|
@@ -29678,6 +30733,18 @@ RenderManagerService = __decorate([
|
|
|
29678
30733
|
__decorateParam(1, _univerjs_core.IUniverInstanceService),
|
|
29679
30734
|
__decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService))
|
|
29680
30735
|
], RenderManagerService);
|
|
30736
|
+
function hasRenderDependency(dependencies, dep) {
|
|
30737
|
+
const key = getRenderDependencyIdentifierKey(getRenderDependencyIdentifier(dep));
|
|
30738
|
+
return dependencies.some((registered) => getRenderDependencyIdentifierKey(getRenderDependencyIdentifier(registered)) === key);
|
|
30739
|
+
}
|
|
30740
|
+
function getRenderDependencyIdentifier(dep) {
|
|
30741
|
+
return Array.isArray(dep) ? dep[0] : dep;
|
|
30742
|
+
}
|
|
30743
|
+
function getRenderDependencyIdentifierKey(identifier) {
|
|
30744
|
+
const decoratorName = identifier.decoratorName;
|
|
30745
|
+
if (typeof decoratorName === "string" && decoratorName) return `identifier:${decoratorName}`;
|
|
30746
|
+
return identifier;
|
|
30747
|
+
}
|
|
29681
30748
|
const IRenderManagerService = (0, _univerjs_core.createIdentifier)("engine-render.render-manager.service");
|
|
29682
30749
|
function isDisposable(thing) {
|
|
29683
30750
|
return !!thing && typeof thing.dispose === "function";
|
|
@@ -30106,13 +31173,13 @@ var Viewport = class {
|
|
|
30106
31173
|
* @param delta
|
|
30107
31174
|
* @returns isLimited
|
|
30108
31175
|
*/
|
|
30109
|
-
scrollByBarDeltaValue(delta, isTrigger = true) {
|
|
31176
|
+
scrollByBarDeltaValue(delta, isTrigger = true, options) {
|
|
30110
31177
|
const x = this.scrollX + (delta.x || 0);
|
|
30111
31178
|
const y = this.scrollY + (delta.y || 0);
|
|
30112
31179
|
return this._scrollToBarPosCore({
|
|
30113
31180
|
x,
|
|
30114
31181
|
y
|
|
30115
|
-
}, isTrigger);
|
|
31182
|
+
}, isTrigger, options);
|
|
30116
31183
|
}
|
|
30117
31184
|
/**
|
|
30118
31185
|
* Viewport scroll to certain position.
|
|
@@ -30650,7 +31717,7 @@ var Viewport = class {
|
|
|
30650
31717
|
* @param rawScrollXY Partial<IViewportScrollPosition>
|
|
30651
31718
|
* @param isTrigger
|
|
30652
31719
|
*/
|
|
30653
|
-
_scrollToBarPosCore(rawScrollXY, isTrigger = true) {
|
|
31720
|
+
_scrollToBarPosCore(rawScrollXY, isTrigger = true, options) {
|
|
30654
31721
|
var _this$_scrollBar6, _this$_scrollBar7, _this$_scrollBar8, _this$_scrollBar9, _this$_scrollBar10;
|
|
30655
31722
|
if (this._scrollBar == null) return;
|
|
30656
31723
|
let scrollX = rawScrollXY.x;
|
|
@@ -30671,7 +31738,9 @@ var Viewport = class {
|
|
|
30671
31738
|
rawScrollY: rawScrollXY.y,
|
|
30672
31739
|
limitX: (_this$_scrollBar6 = this._scrollBar) === null || _this$_scrollBar6 === void 0 ? void 0 : _this$_scrollBar6.limitX,
|
|
30673
31740
|
limitY: (_this$_scrollBar7 = this._scrollBar) === null || _this$_scrollBar7 === void 0 ? void 0 : _this$_scrollBar7.limitY,
|
|
30674
|
-
isTrigger
|
|
31741
|
+
isTrigger,
|
|
31742
|
+
isBarDragging: options === null || options === void 0 ? void 0 : options.isBarDragging,
|
|
31743
|
+
isBarDragEnd: options === null || options === void 0 ? void 0 : options.isBarDragEnd
|
|
30675
31744
|
};
|
|
30676
31745
|
(_this$_scrollBar8 = this._scrollBar) === null || _this$_scrollBar8 === void 0 || _this$_scrollBar8.makeDirty(true);
|
|
30677
31746
|
this.onScrollAfter$.emitEvent(scrollSubParam);
|
|
@@ -30684,7 +31753,9 @@ var Viewport = class {
|
|
|
30684
31753
|
viewportScrollY: this.viewportScrollY,
|
|
30685
31754
|
limitX: (_this$_scrollBar9 = this._scrollBar) === null || _this$_scrollBar9 === void 0 ? void 0 : _this$_scrollBar9.limitX,
|
|
30686
31755
|
limitY: (_this$_scrollBar10 = this._scrollBar) === null || _this$_scrollBar10 === void 0 ? void 0 : _this$_scrollBar10.limitY,
|
|
30687
|
-
isTrigger
|
|
31756
|
+
isTrigger,
|
|
31757
|
+
isBarDragging: options === null || options === void 0 ? void 0 : options.isBarDragging,
|
|
31758
|
+
isBarDragEnd: options === null || options === void 0 ? void 0 : options.isBarDragEnd
|
|
30688
31759
|
});
|
|
30689
31760
|
return afterLimit;
|
|
30690
31761
|
}
|
|
@@ -30800,13 +31871,11 @@ var Viewport = class {
|
|
|
30800
31871
|
left: Math.max(prevBound.left, currBound.left),
|
|
30801
31872
|
right: Math.min(prevBound.right, currBound.right)
|
|
30802
31873
|
});
|
|
30803
|
-
const expandX = this.bufferEdgeX;
|
|
30804
|
-
const expandY = this.bufferEdgeY;
|
|
30805
31874
|
for (const bound of additionalAreas) {
|
|
30806
|
-
bound.left = bound.left -
|
|
30807
|
-
bound.right = bound.right +
|
|
30808
|
-
bound.top = bound.top -
|
|
30809
|
-
bound.bottom = bound.bottom +
|
|
31875
|
+
bound.left = bound.left - this.bufferEdgeX;
|
|
31876
|
+
bound.right = bound.right + this.bufferEdgeX;
|
|
31877
|
+
bound.top = bound.top - this.bufferEdgeY;
|
|
31878
|
+
bound.bottom = bound.bottom + this.bufferEdgeY;
|
|
30810
31879
|
}
|
|
30811
31880
|
return additionalAreas;
|
|
30812
31881
|
}
|
|
@@ -31009,6 +32078,7 @@ exports.WatermarkLayer = WatermarkLayer;
|
|
|
31009
32078
|
exports.calculateRectRotate = calculateRectRotate;
|
|
31010
32079
|
exports.cancelRequestFrame = cancelRequestFrame;
|
|
31011
32080
|
exports.checkStyle = checkStyle;
|
|
32081
|
+
exports.cjk = cjk;
|
|
31012
32082
|
exports.clampRange = clampRange;
|
|
31013
32083
|
exports.clearLineByBorderType = clearLineByBorderType;
|
|
31014
32084
|
exports.compareDocumentSkeletonNestedPagePathOrder = compareDocumentSkeletonNestedPagePathOrder;
|
|
@@ -31033,6 +32103,7 @@ exports.getCurrentScrollXY = getCurrentScrollXY;
|
|
|
31033
32103
|
exports.getCurrentTypeOfRenderer = getCurrentTypeOfRenderer;
|
|
31034
32104
|
exports.getDPI = getDPI;
|
|
31035
32105
|
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
32106
|
+
exports.getDocsCustomBlockRenderViewport = getDocsCustomBlockRenderViewport;
|
|
31036
32107
|
exports.getDocsSkeletonPageSize = getDocsSkeletonPageSize;
|
|
31037
32108
|
exports.getDocsTableRenderViewport = getDocsTableRenderViewport;
|
|
31038
32109
|
exports.getDocumentSkeletonColumnPagePathInfo = getDocumentSkeletonColumnPagePathInfo;
|
|
@@ -31066,9 +32137,6 @@ exports.glyphIterator = glyphIterator;
|
|
|
31066
32137
|
exports.hasAllLatin = hasAllLatin;
|
|
31067
32138
|
exports.hasArabic = hasArabic;
|
|
31068
32139
|
exports.hasBasicLatin = hasBasicLatin;
|
|
31069
|
-
exports.hasCJK = hasCJK;
|
|
31070
|
-
exports.hasCJKPunctuation = hasCJKPunctuation;
|
|
31071
|
-
exports.hasCJKText = hasCJKText;
|
|
31072
32140
|
exports.hasLatinExtendedA = hasLatinExtendedA;
|
|
31073
32141
|
exports.hasLatinExtendedB = hasLatinExtendedB;
|
|
31074
32142
|
exports.hasLatinOneSupplement = hasLatinOneSupplement;
|
|
@@ -31097,6 +32165,9 @@ exports.isRegExp = isRegExp;
|
|
|
31097
32165
|
exports.isSameLine = isSameLine;
|
|
31098
32166
|
exports.isString = isString;
|
|
31099
32167
|
exports.lineIterator = lineIterator;
|
|
32168
|
+
exports.measureDocumentNoWrapTextRangeWidth = measureDocumentNoWrapTextRangeWidth;
|
|
32169
|
+
exports.measureDocumentNoWrapTextWidth = measureDocumentNoWrapTextWidth;
|
|
32170
|
+
exports.measureDocumentUnbreakableTextWidth = measureDocumentUnbreakableTextWidth;
|
|
31100
32171
|
exports.mergeInfoOffset = mergeInfoOffset;
|
|
31101
32172
|
exports.parseDataStreamToTree = parseDataStreamToTree;
|
|
31102
32173
|
exports.pixelToPt = pixelToPt;
|
|
@@ -31113,6 +32184,7 @@ exports.renderTextWatermark = renderTextWatermark;
|
|
|
31113
32184
|
exports.renderUserInfoWatermark = renderUserInfoWatermark;
|
|
31114
32185
|
exports.renderWatermark = renderWatermark;
|
|
31115
32186
|
exports.requestNewFrame = requestNewFrame;
|
|
32187
|
+
exports.setDocsCustomBlockRenderViewportProvider = setDocsCustomBlockRenderViewportProvider;
|
|
31116
32188
|
exports.setDocsTableRenderViewportProvider = setDocsTableRenderViewportProvider;
|
|
31117
32189
|
exports.setLineType = setLineType;
|
|
31118
32190
|
exports.sheetContentViewportKeys = sheetContentViewportKeys;
|