@univerjs/engine-render 1.0.0-alpha.2 → 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 +1353 -351
- package/lib/es/index.js +1349 -326
- package/lib/types/basics/cjk-regexp.d.ts +61 -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 +1 -0
- 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/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING,
|
|
2
|
-
import * as cjk from "cjk-regex";
|
|
1
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, LookUp, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, createParagraphId, createSectionId, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
3
2
|
import { BehaviorSubject, Observable, Subject, Subscription, debounceTime, distinctUntilChanged, shareReplay, startWith } from "rxjs";
|
|
4
3
|
import { parse } from "opentype.js";
|
|
5
4
|
import { franc } from "franc-min";
|
|
@@ -299,7 +298,7 @@ function getFontStyleString(textStyle) {
|
|
|
299
298
|
let bold = FontStyleType.BOLD;
|
|
300
299
|
if (textStyle.bl === 0 || textStyle.bl === void 0) bold = FontStyleType.NORMAL;
|
|
301
300
|
let originFontSize = defaultFontSize;
|
|
302
|
-
if (textStyle.fs) originFontSize =
|
|
301
|
+
if (textStyle.fs) originFontSize = textStyle.fs;
|
|
303
302
|
let fontSize = originFontSize;
|
|
304
303
|
const fontFamilyResult = normalizeFontFamily(textStyle.ff, defaultFont);
|
|
305
304
|
const { va: baselineOffset } = textStyle;
|
|
@@ -323,18 +322,6 @@ function normalizeFontFamily(fontFamily, defaultFont) {
|
|
|
323
322
|
return family.includes(" ") ? `"${family}"` : family;
|
|
324
323
|
}).filter(Boolean).join(", ");
|
|
325
324
|
}
|
|
326
|
-
const CJK_LETTER_REG = cjk.letters().toRegExp();
|
|
327
|
-
function hasCJKText(text) {
|
|
328
|
-
return CJK_LETTER_REG.test(text);
|
|
329
|
-
}
|
|
330
|
-
const CJK_ALL_REG = cjk.all().toRegExp();
|
|
331
|
-
function hasCJK(text) {
|
|
332
|
-
return CJK_ALL_REG.test(text);
|
|
333
|
-
}
|
|
334
|
-
const CJK_PUNCTUATION_REG = cjk.punctuations().toRegExp();
|
|
335
|
-
function hasCJKPunctuation(text) {
|
|
336
|
-
return CJK_PUNCTUATION_REG.test(text);
|
|
337
|
-
}
|
|
338
325
|
function hasAllLatin(text) {
|
|
339
326
|
if (!/[\u0000-\u024F]/gi.exec(text)) return false;
|
|
340
327
|
return true;
|
|
@@ -923,6 +910,220 @@ _defineProperty(FontCache, "_context", void 0);
|
|
|
923
910
|
_defineProperty(FontCache, "_fontDataMap", /* @__PURE__ */ new Map());
|
|
924
911
|
_defineProperty(FontCache, "_globalFontMeasureCache", /* @__PURE__ */ new Map());
|
|
925
912
|
|
|
913
|
+
//#endregion
|
|
914
|
+
//#region src/basics/cjk-regexp.ts
|
|
915
|
+
/**
|
|
916
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
917
|
+
*
|
|
918
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
919
|
+
* you may not use this file except in compliance with the License.
|
|
920
|
+
* You may obtain a copy of the License at
|
|
921
|
+
*
|
|
922
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
923
|
+
*
|
|
924
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
925
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
926
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
927
|
+
* See the License for the specific language governing permissions and
|
|
928
|
+
* limitations under the License.
|
|
929
|
+
*/
|
|
930
|
+
/**
|
|
931
|
+
* Golden regex sources generated from `cjk-regex@3.4.0`.
|
|
932
|
+
*
|
|
933
|
+
* Keep these strings stable unless intentionally upgrading cjk-regex semantics. The tests
|
|
934
|
+
* assert exact source equality so document CJK layout behavior does not drift through
|
|
935
|
+
* manual range edits.
|
|
936
|
+
*/
|
|
937
|
+
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]`;
|
|
938
|
+
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]`;
|
|
939
|
+
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]`;
|
|
940
|
+
const CJK_LETTER_REG = new RegExp(CJK_LETTER_SOURCE);
|
|
941
|
+
const CJK_PUNCTUATION_REG = new RegExp(CJK_PUNCTUATION_SOURCE);
|
|
942
|
+
const CJK_ALL_REG = new RegExp(CJK_ALL_SOURCE);
|
|
943
|
+
/**
|
|
944
|
+
* Golden code-point ranges generated from `cjk-regex@3.4.0` snapshots.
|
|
945
|
+
*
|
|
946
|
+
* These are kept alongside the regex sources so compatibility can be checked against
|
|
947
|
+
* both matching behavior and `Charset.data`-style range snapshots.
|
|
948
|
+
*/
|
|
949
|
+
const CJK_LETTER_DATA = [
|
|
950
|
+
[4352, 4607],
|
|
951
|
+
[11904, 11929],
|
|
952
|
+
[11931, 12019],
|
|
953
|
+
[12032, 12245],
|
|
954
|
+
[12293, 12293],
|
|
955
|
+
[12295, 12295],
|
|
956
|
+
[12321, 12329],
|
|
957
|
+
[12344, 12347],
|
|
958
|
+
[12353, 12438],
|
|
959
|
+
[12445, 12447],
|
|
960
|
+
[12449, 12538],
|
|
961
|
+
[12541, 12543],
|
|
962
|
+
[12549, 12591],
|
|
963
|
+
[12593, 12686],
|
|
964
|
+
[12704, 12735],
|
|
965
|
+
[12784, 12830],
|
|
966
|
+
[12896, 12926],
|
|
967
|
+
[13008, 13054],
|
|
968
|
+
[13056, 13143],
|
|
969
|
+
[13312, 19903],
|
|
970
|
+
[19968, 40959],
|
|
971
|
+
[43360, 43388],
|
|
972
|
+
[44032, 55203],
|
|
973
|
+
[55216, 55238],
|
|
974
|
+
[55243, 55291],
|
|
975
|
+
[63744, 64109],
|
|
976
|
+
[64112, 64217],
|
|
977
|
+
[65382, 65391],
|
|
978
|
+
[65393, 65437],
|
|
979
|
+
[65440, 65470],
|
|
980
|
+
[65474, 65479],
|
|
981
|
+
[65482, 65487],
|
|
982
|
+
[65490, 65495],
|
|
983
|
+
[65498, 65500],
|
|
984
|
+
[94179, 94179],
|
|
985
|
+
[94194, 94198],
|
|
986
|
+
[110576, 110579],
|
|
987
|
+
[110581, 110587],
|
|
988
|
+
[110589, 110590],
|
|
989
|
+
[110592, 110882],
|
|
990
|
+
[110898, 110898],
|
|
991
|
+
[110928, 110930],
|
|
992
|
+
[110933, 110933],
|
|
993
|
+
[110948, 110951],
|
|
994
|
+
[127488, 127488],
|
|
995
|
+
[131072, 173791],
|
|
996
|
+
[173824, 178205],
|
|
997
|
+
[178208, 183981],
|
|
998
|
+
[183984, 191456],
|
|
999
|
+
[191472, 192093],
|
|
1000
|
+
[194560, 195101],
|
|
1001
|
+
[196608, 201546],
|
|
1002
|
+
[201552, 210041]
|
|
1003
|
+
];
|
|
1004
|
+
const CJK_PUNCTUATION_DATA = [
|
|
1005
|
+
[12272, 12292],
|
|
1006
|
+
[12294, 12294],
|
|
1007
|
+
[12296, 12320],
|
|
1008
|
+
[12330, 12343],
|
|
1009
|
+
[12348, 12351],
|
|
1010
|
+
[12448, 12448],
|
|
1011
|
+
[12539, 12540],
|
|
1012
|
+
[12688, 12703],
|
|
1013
|
+
[12736, 12783],
|
|
1014
|
+
[12831, 12895],
|
|
1015
|
+
[12927, 13007],
|
|
1016
|
+
[13055, 13055],
|
|
1017
|
+
[13144, 13311],
|
|
1018
|
+
[65040, 65055],
|
|
1019
|
+
[65072, 65135],
|
|
1020
|
+
[65280, 65381],
|
|
1021
|
+
[65392, 65392],
|
|
1022
|
+
[65438, 65439],
|
|
1023
|
+
[65471, 65473],
|
|
1024
|
+
[65480, 65481],
|
|
1025
|
+
[65488, 65489],
|
|
1026
|
+
[65496, 65497],
|
|
1027
|
+
[65501, 65519]
|
|
1028
|
+
];
|
|
1029
|
+
const CJK_ALL_DATA = [
|
|
1030
|
+
[4352, 4607],
|
|
1031
|
+
[11904, 11929],
|
|
1032
|
+
[11931, 12019],
|
|
1033
|
+
[12032, 12245],
|
|
1034
|
+
[12272, 12351],
|
|
1035
|
+
[12353, 12438],
|
|
1036
|
+
[12445, 12543],
|
|
1037
|
+
[12549, 12591],
|
|
1038
|
+
[12593, 12686],
|
|
1039
|
+
[12688, 19903],
|
|
1040
|
+
[19968, 40959],
|
|
1041
|
+
[43360, 43388],
|
|
1042
|
+
[44032, 55203],
|
|
1043
|
+
[55216, 55238],
|
|
1044
|
+
[55243, 55291],
|
|
1045
|
+
[63744, 64109],
|
|
1046
|
+
[64112, 64217],
|
|
1047
|
+
[65040, 65055],
|
|
1048
|
+
[65072, 65135],
|
|
1049
|
+
[65280, 65519],
|
|
1050
|
+
[94179, 94179],
|
|
1051
|
+
[94194, 94198],
|
|
1052
|
+
[110576, 110579],
|
|
1053
|
+
[110581, 110587],
|
|
1054
|
+
[110589, 110590],
|
|
1055
|
+
[110592, 110882],
|
|
1056
|
+
[110898, 110898],
|
|
1057
|
+
[110928, 110930],
|
|
1058
|
+
[110933, 110933],
|
|
1059
|
+
[110948, 110951],
|
|
1060
|
+
[127488, 127488],
|
|
1061
|
+
[131072, 173791],
|
|
1062
|
+
[173824, 178205],
|
|
1063
|
+
[178208, 183981],
|
|
1064
|
+
[183984, 191456],
|
|
1065
|
+
[191472, 192093],
|
|
1066
|
+
[194560, 195101],
|
|
1067
|
+
[196608, 201546],
|
|
1068
|
+
[201552, 210041]
|
|
1069
|
+
];
|
|
1070
|
+
/**
|
|
1071
|
+
* Returns the CJK letter charset generated from `cjk-regex@3.4.0`.
|
|
1072
|
+
*/
|
|
1073
|
+
function letters() {
|
|
1074
|
+
return regexp.charset(...CJK_LETTER_DATA);
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* Returns the CJK punctuation charset generated from `cjk-regex@3.4.0`.
|
|
1078
|
+
*/
|
|
1079
|
+
function punctuations() {
|
|
1080
|
+
return regexp.charset(...CJK_PUNCTUATION_DATA);
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Returns the combined CJK letter and punctuation charset generated from `cjk-regex@3.4.0`.
|
|
1084
|
+
*/
|
|
1085
|
+
function all() {
|
|
1086
|
+
return regexp.charset(...CJK_ALL_DATA);
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Returns true when text contains CJK letters, excluding punctuation and symbols.
|
|
1090
|
+
*/
|
|
1091
|
+
function hasCJKText(text) {
|
|
1092
|
+
return CJK_LETTER_REG.test(text);
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Returns true when text contains CJK letters or CJK punctuation.
|
|
1096
|
+
*/
|
|
1097
|
+
function hasCJK(text) {
|
|
1098
|
+
return CJK_ALL_REG.test(text);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* Returns true when text contains CJK punctuation, excluding CJK letters.
|
|
1102
|
+
*/
|
|
1103
|
+
function hasCJKPunctuation(text) {
|
|
1104
|
+
return CJK_PUNCTUATION_REG.test(text);
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Namespace-style CJK regex API used by document rendering and layout.
|
|
1108
|
+
*/
|
|
1109
|
+
const cjk = {
|
|
1110
|
+
CJK_LETTER_SOURCE,
|
|
1111
|
+
CJK_PUNCTUATION_SOURCE,
|
|
1112
|
+
CJK_ALL_SOURCE,
|
|
1113
|
+
CJK_LETTER_REG,
|
|
1114
|
+
CJK_PUNCTUATION_REG,
|
|
1115
|
+
CJK_ALL_REG,
|
|
1116
|
+
CJK_LETTER_DATA,
|
|
1117
|
+
CJK_PUNCTUATION_DATA,
|
|
1118
|
+
CJK_ALL_DATA,
|
|
1119
|
+
letters,
|
|
1120
|
+
punctuations,
|
|
1121
|
+
all,
|
|
1122
|
+
hasCJKText,
|
|
1123
|
+
hasCJK,
|
|
1124
|
+
hasCJKPunctuation
|
|
1125
|
+
};
|
|
1126
|
+
|
|
926
1127
|
//#endregion
|
|
927
1128
|
//#region src/basics/i-document-skeleton-cached.ts
|
|
928
1129
|
let DocumentSkeletonPageType = /* @__PURE__ */ function(DocumentSkeletonPageType) {
|
|
@@ -4833,6 +5034,13 @@ var SheetExtension = class extends ComponentExtension {
|
|
|
4833
5034
|
super(..._args);
|
|
4834
5035
|
_defineProperty(this, "type", 0);
|
|
4835
5036
|
}
|
|
5037
|
+
/**
|
|
5038
|
+
* Return an isolated instance when this extension is safe to render in a print scene.
|
|
5039
|
+
* Editor-only extensions remain excluded by default.
|
|
5040
|
+
*/
|
|
5041
|
+
copyForPrinting() {
|
|
5042
|
+
return null;
|
|
5043
|
+
}
|
|
4836
5044
|
isRenderDiffRangesByCell(rangeP, diffRanges) {
|
|
4837
5045
|
if (diffRanges == null || diffRanges.length === 0) return true;
|
|
4838
5046
|
for (const range of diffRanges) {
|
|
@@ -4919,6 +5127,11 @@ const UNIQUE_KEY$10 = "DefaultBackgroundExtension";
|
|
|
4919
5127
|
*/
|
|
4920
5128
|
const DOC_EXTENSION_Z_INDEX$3 = 21;
|
|
4921
5129
|
const PRINTING_Z_INDEX = 21;
|
|
5130
|
+
function getRangeCellCount(ranges) {
|
|
5131
|
+
return ranges.reduce((sum, range) => {
|
|
5132
|
+
return sum + Math.max(range.endRow - range.startRow + 1, 0) * Math.max(range.endColumn - range.startColumn + 1, 0);
|
|
5133
|
+
}, 0);
|
|
5134
|
+
}
|
|
4922
5135
|
var Background = class extends SheetExtension {
|
|
4923
5136
|
constructor(..._args) {
|
|
4924
5137
|
super(..._args);
|
|
@@ -4930,7 +5143,7 @@ var Background = class extends SheetExtension {
|
|
|
4930
5143
|
var _this$parent;
|
|
4931
5144
|
return ((_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.isPrinting) ? this.PRINTING_Z_INDEX : this.Z_INDEX;
|
|
4932
5145
|
}
|
|
4933
|
-
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges, { viewRanges, checkOutOfViewBound }) {
|
|
5146
|
+
draw(ctx, _parentScale, spreadsheetSkeleton, diffRanges, { viewRanges, checkOutOfViewBound, hasMergeData = true }) {
|
|
4934
5147
|
const { stylesCache, worksheet, rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
|
|
4935
5148
|
const { background: bgMatrixCacheByColor, backgroundPositions } = stylesCache;
|
|
4936
5149
|
if (!worksheet || !bgMatrixCacheByColor) return;
|
|
@@ -4948,15 +5161,19 @@ var Background = class extends SheetExtension {
|
|
|
4948
5161
|
spreadsheetSkeleton
|
|
4949
5162
|
};
|
|
4950
5163
|
const mergeRanges = [];
|
|
4951
|
-
viewRanges.forEach((range) => {
|
|
5164
|
+
if (hasMergeData) viewRanges.forEach((range) => {
|
|
4952
5165
|
const intersectMergeRangesInViewRanges = spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn);
|
|
4953
5166
|
mergeRanges.push(...intersectMergeRangesInViewRanges);
|
|
4954
5167
|
});
|
|
4955
5168
|
const renderBGCore = (rgb) => {
|
|
4956
5169
|
const bgColorMatrix = bgMatrixCacheByColor[rgb];
|
|
5170
|
+
const renderRanges = diffRanges && diffRanges.length > 0 ? diffRanges : viewRanges;
|
|
4957
5171
|
const rangeForEachFn = (row, col, bgConfigParam) => {
|
|
4958
|
-
|
|
4959
|
-
|
|
5172
|
+
var _backgroundPositions$;
|
|
5173
|
+
if (hasMergeData) {
|
|
5174
|
+
if (spreadsheetSkeleton.worksheet.getSpanModel().getMergeDataIndex(row, col) !== -1) return;
|
|
5175
|
+
}
|
|
5176
|
+
const cellInfo = (_backgroundPositions$ = backgroundPositions === null || backgroundPositions === void 0 ? void 0 : backgroundPositions.getValue(row, col)) !== null && _backgroundPositions$ !== void 0 ? _backgroundPositions$ : spreadsheetSkeleton.getCellByIndexWithNoHeader(row, col);
|
|
4960
5177
|
if (!cellInfo) return;
|
|
4961
5178
|
if (bgConfigParam || bgColorMatrix.getValue(row, col)) {
|
|
4962
5179
|
renderBGContext.cellInfo = cellInfo;
|
|
@@ -4972,12 +5189,16 @@ var Background = class extends SheetExtension {
|
|
|
4972
5189
|
renderBGContext.backgroundPaths = backgroundPaths;
|
|
4973
5190
|
ctx.beginPath();
|
|
4974
5191
|
const matrixSize = bgColorMatrix.getSizeOf();
|
|
4975
|
-
if (
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
5192
|
+
if (getRangeCellCount(renderRanges) < matrixSize) {
|
|
5193
|
+
renderBGContext.skipRenderRangeCheck = true;
|
|
5194
|
+
renderRanges.forEach((range) => {
|
|
5195
|
+
Range.foreach(range, rangeForEachFn);
|
|
5196
|
+
});
|
|
5197
|
+
renderBGContext.skipRenderRangeCheck = false;
|
|
5198
|
+
} else {
|
|
5199
|
+
renderBGContext.skipRenderRangeCheck = false;
|
|
5200
|
+
bgColorMatrix.forValue(rangeForEachFn);
|
|
5201
|
+
}
|
|
4981
5202
|
ctx.fill(backgroundPaths);
|
|
4982
5203
|
ctx.closePath();
|
|
4983
5204
|
};
|
|
@@ -5006,12 +5227,12 @@ var Background = class extends SheetExtension {
|
|
|
5006
5227
|
for (let index = 0; index < rgbList.length; index++) {
|
|
5007
5228
|
const rgb = rgbList[index];
|
|
5008
5229
|
renderBGCore(rgb);
|
|
5009
|
-
renderBGForMergedCells(rgb);
|
|
5230
|
+
if (hasMergeData) renderBGForMergedCells(rgb);
|
|
5010
5231
|
}
|
|
5011
5232
|
ctx.restore();
|
|
5012
5233
|
}
|
|
5013
5234
|
renderBGByCell(bgContext, row, col) {
|
|
5014
|
-
const { spreadsheetSkeleton, backgroundPaths, scaleX, scaleY, viewRanges, diffRanges, cellInfo } = bgContext;
|
|
5235
|
+
const { spreadsheetSkeleton, backgroundPaths, scaleX, scaleY, viewRanges, diffRanges, cellInfo, skipRenderRangeCheck } = bgContext;
|
|
5015
5236
|
let { startY, endY, startX, endX } = cellInfo;
|
|
5016
5237
|
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
5017
5238
|
const renderRange = diffRanges && diffRanges.length > 0 ? diffRanges : viewRanges;
|
|
@@ -5019,7 +5240,7 @@ var Background = class extends SheetExtension {
|
|
|
5019
5240
|
endY = mergeInfo.endY;
|
|
5020
5241
|
startX = mergeInfo.startX;
|
|
5021
5242
|
endX = mergeInfo.endX;
|
|
5022
|
-
if (!isMerged && !isMergedMainCell && !inViewRanges(renderRange, row, col)) return true;
|
|
5243
|
+
if (!skipRenderRangeCheck && !isMerged && !isMergedMainCell && !inViewRanges(renderRange, row, col)) return true;
|
|
5023
5244
|
if (!isMerged && !isMergedMainCell) {
|
|
5024
5245
|
if (!spreadsheetSkeleton.worksheet.getRowVisible(row)) return true;
|
|
5025
5246
|
if (!spreadsheetSkeleton.worksheet.getColVisible(col)) return true;
|
|
@@ -11787,11 +12008,12 @@ var Text = class Text extends Shape {
|
|
|
11787
12008
|
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height);
|
|
11788
12009
|
}
|
|
11789
12010
|
static drawWith(ctx, props, _skeleton) {
|
|
11790
|
-
var _props$color;
|
|
12011
|
+
var _cachedLayout$lines, _cachedLayout$totalHe, _props$color;
|
|
11791
12012
|
const { text, fontStyle, warp, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
11792
|
-
const
|
|
11793
|
-
const
|
|
11794
|
-
const
|
|
12013
|
+
const cachedLayout = !_skeleton && !warp ? Text._getCachedLayout(text, fontStyle) : null;
|
|
12014
|
+
const skeleton = cachedLayout ? null : _skeleton !== null && _skeleton !== void 0 ? _skeleton : new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === VerticalAlign.TOP ? height : Infinity);
|
|
12015
|
+
const lines = (_cachedLayout$lines = cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.lines) !== null && _cachedLayout$lines !== void 0 ? _cachedLayout$lines : skeleton.calculate();
|
|
12016
|
+
const totalHeight = (_cachedLayout$totalHe = cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.totalHeight) !== null && _cachedLayout$totalHe !== void 0 ? _cachedLayout$totalHe : skeleton.getTotalHeight();
|
|
11795
12017
|
let lineTop = top + (vAlign === VerticalAlign.TOP ? 0 : vAlign === VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
11796
12018
|
ctx.save();
|
|
11797
12019
|
ctx.font = fontStyle;
|
|
@@ -11842,6 +12064,46 @@ var Text = class Text extends Shape {
|
|
|
11842
12064
|
ctx.restore();
|
|
11843
12065
|
return totalHeight;
|
|
11844
12066
|
}
|
|
12067
|
+
static drawPlainWith(ctx, props) {
|
|
12068
|
+
var _props$color2;
|
|
12069
|
+
const { text, fontStyle, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12070
|
+
const { lines, totalHeight } = Text._getCachedLayout(text, fontStyle);
|
|
12071
|
+
let lineTop = top + (vAlign === VerticalAlign.TOP ? 0 : vAlign === VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
12072
|
+
ctx.font = fontStyle;
|
|
12073
|
+
ctx.fillStyle = (_props$color2 = props.color) !== null && _props$color2 !== void 0 ? _props$color2 : COLOR_BLACK_RGB;
|
|
12074
|
+
for (const line of lines) {
|
|
12075
|
+
const lineWidth = line.width;
|
|
12076
|
+
let lineX = 0;
|
|
12077
|
+
if (!(width < lineWidth && cellValueType === CellValueType.NUMBER)) switch (hAlign) {
|
|
12078
|
+
case HorizontalAlign.CENTER:
|
|
12079
|
+
lineX = (width - lineWidth) / 2;
|
|
12080
|
+
break;
|
|
12081
|
+
case HorizontalAlign.RIGHT:
|
|
12082
|
+
lineX = width - lineWidth;
|
|
12083
|
+
break;
|
|
12084
|
+
default: lineX = 0;
|
|
12085
|
+
}
|
|
12086
|
+
ctx.fillText(line.text, left + lineX, lineTop + line.baseline);
|
|
12087
|
+
lineTop += line.height;
|
|
12088
|
+
}
|
|
12089
|
+
return totalHeight;
|
|
12090
|
+
}
|
|
12091
|
+
static _getCachedLayout(text, fontStyle) {
|
|
12092
|
+
const cacheKey = `${fontStyle}\u0000${text}`;
|
|
12093
|
+
const cached = Text._layoutCache.get(cacheKey);
|
|
12094
|
+
if (cached) return cached;
|
|
12095
|
+
const skeleton = new DocSimpleSkeleton(text, fontStyle, false, 0, Infinity);
|
|
12096
|
+
const layout = {
|
|
12097
|
+
lines: skeleton.calculate(),
|
|
12098
|
+
totalHeight: skeleton.getTotalHeight()
|
|
12099
|
+
};
|
|
12100
|
+
Text._layoutCache.set(cacheKey, layout);
|
|
12101
|
+
if (Text._layoutCache.size > Text._MAX_LAYOUT_CACHE_SIZE) {
|
|
12102
|
+
const oldestKey = Text._layoutCache.keys().next().value;
|
|
12103
|
+
if (oldestKey !== void 0) Text._layoutCache.delete(oldestKey);
|
|
12104
|
+
}
|
|
12105
|
+
return layout;
|
|
12106
|
+
}
|
|
11845
12107
|
/**
|
|
11846
12108
|
* Draw text decoration lines (underline, strikethrough, etc.)
|
|
11847
12109
|
*/
|
|
@@ -11974,6 +12236,8 @@ var Text = class Text extends Shape {
|
|
|
11974
12236
|
};
|
|
11975
12237
|
}
|
|
11976
12238
|
};
|
|
12239
|
+
_defineProperty(Text, "_MAX_LAYOUT_CACHE_SIZE", 5e3);
|
|
12240
|
+
_defineProperty(Text, "_layoutCache", /* @__PURE__ */ new Map());
|
|
11977
12241
|
|
|
11978
12242
|
//#endregion
|
|
11979
12243
|
//#region src/components/docs/document-compatibility.ts
|
|
@@ -12689,6 +12953,34 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12689
12953
|
}
|
|
12690
12954
|
};
|
|
12691
12955
|
|
|
12956
|
+
//#endregion
|
|
12957
|
+
//#region src/components/docs/custom-block-render-viewport.ts
|
|
12958
|
+
let docsCustomBlockRenderViewportProvider = null;
|
|
12959
|
+
const docsCustomBlockRenderViewportProviders = /* @__PURE__ */ new Set();
|
|
12960
|
+
function setDocsCustomBlockRenderViewportProvider(provider) {
|
|
12961
|
+
if (provider == null) {
|
|
12962
|
+
docsCustomBlockRenderViewportProvider = null;
|
|
12963
|
+
docsCustomBlockRenderViewportProviders.clear();
|
|
12964
|
+
return () => {};
|
|
12965
|
+
}
|
|
12966
|
+
docsCustomBlockRenderViewportProvider = provider;
|
|
12967
|
+
docsCustomBlockRenderViewportProviders.add(provider);
|
|
12968
|
+
return () => {
|
|
12969
|
+
var _providers;
|
|
12970
|
+
docsCustomBlockRenderViewportProviders.delete(provider);
|
|
12971
|
+
const providers = Array.from(docsCustomBlockRenderViewportProviders);
|
|
12972
|
+
docsCustomBlockRenderViewportProvider = (_providers = providers[providers.length - 1]) !== null && _providers !== void 0 ? _providers : null;
|
|
12973
|
+
};
|
|
12974
|
+
}
|
|
12975
|
+
function getDocsCustomBlockRenderViewport(unitId, blockId, input) {
|
|
12976
|
+
const providers = docsCustomBlockRenderViewportProviders.size ? Array.from(docsCustomBlockRenderViewportProviders).reverse() : docsCustomBlockRenderViewportProvider ? [docsCustomBlockRenderViewportProvider] : [];
|
|
12977
|
+
for (const provider of providers) {
|
|
12978
|
+
const viewport = provider(unitId, blockId, input);
|
|
12979
|
+
if (viewport != null) return viewport;
|
|
12980
|
+
}
|
|
12981
|
+
return null;
|
|
12982
|
+
}
|
|
12983
|
+
|
|
12692
12984
|
//#endregion
|
|
12693
12985
|
//#region src/components/docs/layout/model/glyph.ts
|
|
12694
12986
|
function isSpace(char) {
|
|
@@ -12699,7 +12991,7 @@ function isSpace(char) {
|
|
|
12699
12991
|
].includes(char);
|
|
12700
12992
|
}
|
|
12701
12993
|
function isJustifiable(content) {
|
|
12702
|
-
return isSpace(content) || hasCJKText(content) || isCjkLeftAlignedPunctuation(content) || isCjkRightAlignedPunctuation(content) || isCjkCenterAlignedPunctuation(content);
|
|
12994
|
+
return isSpace(content) || cjk.hasCJKText(content) || isCjkLeftAlignedPunctuation(content) || isCjkRightAlignedPunctuation(content) || isCjkCenterAlignedPunctuation(content);
|
|
12703
12995
|
}
|
|
12704
12996
|
function baseAdjustability(content, width) {
|
|
12705
12997
|
if (isSpace(content)) return {
|
|
@@ -12828,7 +13120,7 @@ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, gly
|
|
|
12828
13120
|
const { width: contentWidth = 0 } = bBox;
|
|
12829
13121
|
let width = glyphWidth !== null && glyphWidth !== void 0 ? glyphWidth : contentWidth;
|
|
12830
13122
|
if (validationGrid(gridType, snapToGrid)) {
|
|
12831
|
-
width = contentWidth + (hasCJK(content) ? charSpace : charSpace / 2);
|
|
13123
|
+
width = contentWidth + (cjk.hasCJK(content) ? charSpace : charSpace / 2);
|
|
12832
13124
|
if (gridType === GridType.SNAP_TO_CHARS) xOffset = (width - contentWidth) / 2;
|
|
12833
13125
|
}
|
|
12834
13126
|
if (glyphInfo && glyphInfo.kerning !== 0 && glyphInfo.font) {
|
|
@@ -13724,6 +14016,12 @@ function isBeyondDivideWidth(width, divideWidth) {
|
|
|
13724
14016
|
const tolerance = Math.min(MAX_LINE_WIDTH_TOLERANCE, Math.max(MIN_LINE_WIDTH_TOLERANCE, divideWidth * RELATIVE_LINE_WIDTH_TOLERANCE));
|
|
13725
14017
|
return width - divideWidth > tolerance;
|
|
13726
14018
|
}
|
|
14019
|
+
function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth) {
|
|
14020
|
+
var _glyphGroup$adjustabi, _glyphGroup;
|
|
14021
|
+
const width = __getGlyphGroupWidth(glyphGroup);
|
|
14022
|
+
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;
|
|
14023
|
+
return isBeyondDivideWidth(offsetLeft + width - trailingShrinkability, divideWidth);
|
|
14024
|
+
}
|
|
13727
14025
|
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal") {
|
|
13728
14026
|
if (isParagraphFirstShapedText) if (paragraphConfig.bulletSkeleton) {
|
|
13729
14027
|
var _paragraphProperties$;
|
|
@@ -13800,12 +14098,11 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13800
14098
|
const divideInfo = getLastNotFullDivideInfo(getLastPage(pages));
|
|
13801
14099
|
if (divideInfo) {
|
|
13802
14100
|
var _divide$glyphGroup;
|
|
13803
|
-
const width = __getGlyphGroupWidth(glyphGroup);
|
|
13804
14101
|
const { divide, isLast } = divideInfo;
|
|
13805
14102
|
const lastGlyph = divide === null || divide === void 0 || (_divide$glyphGroup = divide.glyphGroup) === null || _divide$glyphGroup === void 0 ? void 0 : _divide$glyphGroup[divide.glyphGroup.length - 1];
|
|
13806
14103
|
const preOffsetLeft = ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.width) || 0) + ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.left) || 0);
|
|
13807
14104
|
const { hyphenationZone } = sectionBreakConfig;
|
|
13808
|
-
if (
|
|
14105
|
+
if (isGlyphGroupBeyondDivideWidth(glyphGroup, preOffsetLeft, divide.width)) {
|
|
13809
14106
|
if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length > 0 && glyphGroup[0].streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) {
|
|
13810
14107
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13811
14108
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
@@ -13828,7 +14125,7 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13828
14125
|
const sliceGlyphGroup = [];
|
|
13829
14126
|
while (glyphGroup.length) {
|
|
13830
14127
|
sliceGlyphGroup.push(glyphGroup.shift());
|
|
13831
|
-
if (
|
|
14128
|
+
if (isGlyphGroupBeyondDivideWidth(sliceGlyphGroup, 0, divide.width)) {
|
|
13832
14129
|
if (sliceGlyphGroup.length > 1) glyphGroup.unshift(sliceGlyphGroup.pop());
|
|
13833
14130
|
break;
|
|
13834
14131
|
}
|
|
@@ -13879,7 +14176,7 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13879
14176
|
if (anchorDrawings.length > 0) {
|
|
13880
14177
|
var _paragraphConfig$para, _paragraphConfig$pDra;
|
|
13881
14178
|
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, (_paragraphConfig$para = paragraphConfig.paragraphStyle) === null || _paragraphConfig$para === void 0 ? void 0 : _paragraphConfig$para.indentStart);
|
|
13882
|
-
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);
|
|
14179
|
+
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);
|
|
13883
14180
|
__updateDrawingPosition(currentLine.parent, drawings);
|
|
13884
14181
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13885
14182
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
@@ -13979,6 +14276,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13979
14276
|
}
|
|
13980
14277
|
}
|
|
13981
14278
|
let deferredInlineGroupAnchorDrawings = [];
|
|
14279
|
+
let deferredTopBottomAnchorDrawings = [];
|
|
13982
14280
|
if (paragraphNonInlineSkeDrawings != null && paragraphNonInlineSkeDrawings.size > 0) {
|
|
13983
14281
|
var _pDrawingAnchor$get;
|
|
13984
14282
|
let targetDrawings = [...paragraphNonInlineSkeDrawings.values()].filter((drawing) => drawing.drawingOrigin.docTransform.positionV.relativeFrom !== ObjectRelativeFromV.LINE);
|
|
@@ -13986,13 +14284,17 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13986
14284
|
deferredInlineGroupAnchorDrawings = targetDrawings.filter((drawing) => glyphGroupCustomBlockIds.has(drawing.drawingId) && drawing.drawingOrigin.docTransform.positionV.relativeFrom === ObjectRelativeFromV.LINE);
|
|
13987
14285
|
targetDrawings = targetDrawings.filter((drawing) => !deferredInlineGroupAnchorDrawings.includes(drawing));
|
|
13988
14286
|
}
|
|
13989
|
-
|
|
14287
|
+
deferredTopBottomAnchorDrawings = targetDrawings.filter((drawing) => glyphGroupCustomBlockIds.has(drawing.drawingId) && drawing.drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
|
|
14288
|
+
targetDrawings = targetDrawings.filter((drawing) => drawing.drawingOrigin.layoutType !== PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
|
|
14289
|
+
__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);
|
|
13990
14290
|
}
|
|
13991
14291
|
if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
|
|
13992
14292
|
var _pDrawingAnchor$get2;
|
|
13993
14293
|
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);
|
|
13994
14294
|
}
|
|
13995
|
-
const
|
|
14295
|
+
const calculatedLineTop = positionedCustomBlockOnly ? lineTop : calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
14296
|
+
const previousTopBottomCustomBlockFlowBottom = deferredTopBottomAnchorDrawings.length > 0 ? paragraphConfig.topBottomCustomBlockFlowBottom : void 0;
|
|
14297
|
+
const newLineTop = previousTopBottomCustomBlockFlowBottom == null ? calculatedLineTop : Math.max(calculatedLineTop, previousTopBottomCustomBlockFlowBottom);
|
|
13996
14298
|
if (lineHeight + newLineTop - section.height > LINE_LAYOUT_OVERFLOW_TOLERANCE && column.lines.length > 0 && lastPage.sections.length > 0 || needOpenNewPageByTableLayout) {
|
|
13997
14299
|
setColumnFullState(column, true);
|
|
13998
14300
|
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
@@ -14026,16 +14328,21 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
14026
14328
|
}, column.width, lineIndex, isParagraphFirstShapedText, paragraphConfig, lastPage, headerPage, footerPage);
|
|
14027
14329
|
column.lines.push(newLine);
|
|
14028
14330
|
newLine.parent = column;
|
|
14029
|
-
|
|
14331
|
+
const blockAnchorTop = deferredTopBottomAnchorDrawings.length > 0 ? newLineTop : lineTop;
|
|
14332
|
+
createAndUpdateBlockAnchor(paragraphIndex, newLine, blockAnchorTop, pDrawingAnchor);
|
|
14333
|
+
if (deferredTopBottomAnchorDrawings.length > 0) {
|
|
14334
|
+
__updateAndPositionDrawings(ctx, newLineTop, lineHeight, column, deferredTopBottomAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, blockAnchorTop, paragraphAnchorLeft, true, true);
|
|
14335
|
+
__updateTopBottomCustomBlockFlowBottom(paragraphConfig, deferredTopBottomAnchorDrawings);
|
|
14336
|
+
}
|
|
14030
14337
|
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
14031
14338
|
if (deferredInlineGroupAnchorDrawings.length > 0) {
|
|
14032
14339
|
var _pDrawingAnchor$get3;
|
|
14033
14340
|
__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);
|
|
14034
14341
|
}
|
|
14035
14342
|
}
|
|
14036
|
-
function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphIndex, isParagraphFirstShapedText, drawingAnchorTop, drawingAnchorLeft = 0, skipRelayoutCheck = false) {
|
|
14343
|
+
function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphIndex, isParagraphFirstShapedText, drawingAnchorTop, drawingAnchorLeft = 0, skipRelayoutCheck = false, overwriteTopBottomPosition = false) {
|
|
14037
14344
|
if (targetDrawings.length === 0) return;
|
|
14038
|
-
const drawings = __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
14345
|
+
const drawings = __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
14039
14346
|
if (drawings == null || drawings.size === 0) return;
|
|
14040
14347
|
const floatObjects = [...drawings.values()].filter((drawing) => {
|
|
14041
14348
|
const layoutType = drawing.drawingOrigin.layoutType;
|
|
@@ -14057,7 +14364,7 @@ function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDra
|
|
|
14057
14364
|
};
|
|
14058
14365
|
});
|
|
14059
14366
|
if (!skipRelayoutCheck) _reLayoutCheck(ctx, floatObjects, column, paragraphIndex);
|
|
14060
|
-
__updateDrawingPosition(column, drawings);
|
|
14367
|
+
__updateDrawingPosition(column, drawings, overwriteTopBottomPosition);
|
|
14061
14368
|
}
|
|
14062
14369
|
function __updateWrapTablePosition(ctx, table, lineTop, lineHeight, column, paragraphIndex, drawingAnchorTop) {
|
|
14063
14370
|
const wrapTablePosition = __getWrapTablePosition(table, column, lineTop, lineHeight, drawingAnchorTop);
|
|
@@ -14168,6 +14475,15 @@ function _getCustomBlockIdsInLine(line) {
|
|
|
14168
14475
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) customBlockIds.push(glyph.drawingId);
|
|
14169
14476
|
return customBlockIds;
|
|
14170
14477
|
}
|
|
14478
|
+
function __updateTopBottomCustomBlockFlowBottom(paragraphConfig, drawings) {
|
|
14479
|
+
for (const drawing of drawings) {
|
|
14480
|
+
var _drawingOrigin$distB, _paragraphConfig$topB;
|
|
14481
|
+
const { drawingOrigin } = drawing;
|
|
14482
|
+
if (drawingOrigin.layoutType !== PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM || drawingOrigin.behindDoc === BooleanNumber.TRUE) continue;
|
|
14483
|
+
const bottom = drawing.aTop + drawing.height + ((_drawingOrigin$distB = drawingOrigin.distB) !== null && _drawingOrigin$distB !== void 0 ? _drawingOrigin$distB : 0);
|
|
14484
|
+
paragraphConfig.topBottomCustomBlockFlowBottom = Math.max((_paragraphConfig$topB = paragraphConfig.topBottomCustomBlockFlowBottom) !== null && _paragraphConfig$topB !== void 0 ? _paragraphConfig$topB : Number.NEGATIVE_INFINITY, bottom);
|
|
14485
|
+
}
|
|
14486
|
+
}
|
|
14171
14487
|
function __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14172
14488
|
return __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphNonInlineSkeDrawings).length > 0;
|
|
14173
14489
|
}
|
|
@@ -14371,7 +14687,8 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
14371
14687
|
}
|
|
14372
14688
|
const usesDocumentGrid = spacingRule === SpacingRule.AUTO && snapToGrid === BooleanNumber.TRUE && gridType !== GridType.DEFAULT;
|
|
14373
14689
|
if (spacingRule === SpacingRule.AUTO) {
|
|
14374
|
-
|
|
14690
|
+
let lineSpacingApply = usesDocumentGrid ? lineSpacing * linePitch : scaleAutoLineSpacingByGlyphHeight ? lineSpacing * glyphLineHeight : glyphLineHeight;
|
|
14691
|
+
if (!usesDocumentGrid && scaleAutoLineSpacingByGlyphHeight && lineSpacing <= 1.05 && glyphLineHeight >= 30) lineSpacingApply *= 1.18;
|
|
14375
14692
|
const padding = (lineSpacingApply - glyphLineHeight) / 2;
|
|
14376
14693
|
return {
|
|
14377
14694
|
paddingTop: padding,
|
|
@@ -14399,7 +14716,7 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
14399
14716
|
lineSpacingApply: exactLineSpacingApply
|
|
14400
14717
|
};
|
|
14401
14718
|
}
|
|
14402
|
-
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnchorTop, paragraphNonInlineSkeDrawings) {
|
|
14719
|
+
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings) {
|
|
14403
14720
|
var _line$parent, _section$top;
|
|
14404
14721
|
const column = line.parent;
|
|
14405
14722
|
const section = column === null || column === void 0 ? void 0 : column.parent;
|
|
@@ -14411,6 +14728,7 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14411
14728
|
const sectionTop = (_section$top = section === null || section === void 0 ? void 0 : section.top) !== null && _section$top !== void 0 ? _section$top : 0;
|
|
14412
14729
|
const lineTop = sectionTop + top;
|
|
14413
14730
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0) {
|
|
14731
|
+
var _viewport$width, _viewport$height, _viewport$offsetLeft;
|
|
14414
14732
|
const { drawingId } = glyph;
|
|
14415
14733
|
if (drawingId == null) continue;
|
|
14416
14734
|
const drawing = paragraphInlineSkeDrawings === null || paragraphInlineSkeDrawings === void 0 ? void 0 : paragraphInlineSkeDrawings.get(drawingId);
|
|
@@ -14420,7 +14738,19 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14420
14738
|
const { size, angle } = docTransform;
|
|
14421
14739
|
const { width = 0, height = 0 } = size;
|
|
14422
14740
|
const glyphHeight = glyph.bBox.bd + glyph.bBox.ba;
|
|
14423
|
-
|
|
14741
|
+
const glyphLeft = divide.left + divide.paddingLeft + glyph.left;
|
|
14742
|
+
const blockLeft = column.left + glyphLeft;
|
|
14743
|
+
const viewport = getDocsCustomBlockRenderViewport(unitId, drawingId, {
|
|
14744
|
+
blockLeft,
|
|
14745
|
+
fallbackHeight: height,
|
|
14746
|
+
fallbackWidth: width,
|
|
14747
|
+
pageMarginLeft: page.marginLeft,
|
|
14748
|
+
pageMarginRight: page.marginRight,
|
|
14749
|
+
pageWidth: page.pageWidth
|
|
14750
|
+
});
|
|
14751
|
+
const drawingWidth = (_viewport$width = viewport === null || viewport === void 0 ? void 0 : viewport.width) !== null && _viewport$width !== void 0 ? _viewport$width : width;
|
|
14752
|
+
const drawingHeight = (_viewport$height = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height !== void 0 ? _viewport$height : height;
|
|
14753
|
+
drawing.aLeft = viewport ? blockLeft + ((_viewport$offsetLeft = viewport.offsetLeft) !== null && _viewport$offsetLeft !== void 0 ? _viewport$offsetLeft : 0) : blockLeft + .5 * glyph.width - .5 * drawingWidth || 0;
|
|
14424
14754
|
if (glyph.width > divide.width) {
|
|
14425
14755
|
var _paragraphNonInlineSk;
|
|
14426
14756
|
for (const positionedDrawing of (_paragraphNonInlineSk = paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 ? void 0 : paragraphNonInlineSkeDrawings.values()) !== null && _paragraphNonInlineSk !== void 0 ? _paragraphNonInlineSk : []) {
|
|
@@ -14430,17 +14760,25 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14430
14760
|
const lineBottom = lineTop + lineHeight;
|
|
14431
14761
|
if (positionedDrawing.aTop >= lineBottom || positionedBottom <= lineTop) continue;
|
|
14432
14762
|
const positionedRight = positionedDrawing.aLeft + positionedDrawing.width;
|
|
14433
|
-
const drawingRight = drawing.aLeft +
|
|
14763
|
+
const drawingRight = drawing.aLeft + drawingWidth;
|
|
14434
14764
|
if (positionedDrawing.aLeft < drawingRight && positionedRight > drawing.aLeft) {
|
|
14435
14765
|
var _positionedOrigin$dis;
|
|
14436
14766
|
drawing.aLeft = Math.max(drawing.aLeft, positionedDrawing.aLeft + positionedDrawing.width + ((_positionedOrigin$dis = positionedOrigin.distR) !== null && _positionedOrigin$dis !== void 0 ? _positionedOrigin$dis : 0));
|
|
14437
14767
|
}
|
|
14438
14768
|
}
|
|
14439
14769
|
}
|
|
14440
|
-
drawing.
|
|
14441
|
-
drawing.
|
|
14442
|
-
drawing.
|
|
14770
|
+
drawing.width = drawingWidth;
|
|
14771
|
+
drawing.height = drawingHeight;
|
|
14772
|
+
drawing.aTop = lineTop + lineHeight - .5 * glyphHeight - .5 * drawingHeight - marginBottom;
|
|
14443
14773
|
drawing.angle = angle;
|
|
14774
|
+
drawing.customBlockRenderViewport = viewport ? {
|
|
14775
|
+
bleedLeft: viewport.bleedLeft,
|
|
14776
|
+
bleedWidth: viewport.bleedWidth,
|
|
14777
|
+
contentHeight: viewport.contentHeight,
|
|
14778
|
+
contentWidth: viewport.contentWidth,
|
|
14779
|
+
height: viewport.height,
|
|
14780
|
+
viewportHeight: viewport.viewportHeight
|
|
14781
|
+
} : void 0;
|
|
14444
14782
|
drawing.isPageBreak = isPageBreak;
|
|
14445
14783
|
drawing.lineTop = lineTop;
|
|
14446
14784
|
drawing.columnLeft = column.left;
|
|
@@ -14450,7 +14788,7 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14450
14788
|
}
|
|
14451
14789
|
page.skeDrawings = new Map([...page.skeDrawings, ...drawings]);
|
|
14452
14790
|
}
|
|
14453
|
-
function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0) {
|
|
14791
|
+
function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0, normalizeTraditionalColumnAnchor = true) {
|
|
14454
14792
|
var _column$parent3;
|
|
14455
14793
|
const page = (_column$parent3 = column.parent) === null || _column$parent3 === void 0 ? void 0 : _column$parent3.parent;
|
|
14456
14794
|
if (page == null || needPositionDrawings.length === 0) return;
|
|
@@ -14458,22 +14796,42 @@ function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShape
|
|
|
14458
14796
|
const isPageBreak = __checkPageBreak(column);
|
|
14459
14797
|
if (isPageBreak && !isParagraphFirstShapedText) return;
|
|
14460
14798
|
for (const drawing of needPositionDrawings) {
|
|
14461
|
-
var _getPositionHorizon2, _getPositionVertical2;
|
|
14799
|
+
var _ctx$dataModel$getUni, _ctx$dataModel$getUni2, _ctx$dataModel, _viewport$width2, _viewport$height2, _getPositionHorizon2, _getPositionVertical2;
|
|
14462
14800
|
const { drawingOrigin } = drawing;
|
|
14463
14801
|
if (!drawingOrigin) continue;
|
|
14464
14802
|
const { docTransform } = drawingOrigin;
|
|
14465
14803
|
const { positionH, positionV, size, angle } = docTransform;
|
|
14466
|
-
const { width
|
|
14467
|
-
|
|
14804
|
+
const { width, height } = size;
|
|
14805
|
+
const fallbackWidth = width !== null && width !== void 0 ? width : 0;
|
|
14806
|
+
const fallbackHeight = height !== null && height !== void 0 ? height : 0;
|
|
14807
|
+
const viewport = drawingOrigin.layoutType === 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, {
|
|
14808
|
+
fallbackHeight,
|
|
14809
|
+
fallbackWidth,
|
|
14810
|
+
pageMarginLeft: page.marginLeft,
|
|
14811
|
+
pageMarginRight: page.marginRight,
|
|
14812
|
+
pageWidth: page.pageWidth
|
|
14813
|
+
}) : null;
|
|
14814
|
+
const drawingWidth = (_viewport$width2 = viewport === null || viewport === void 0 ? void 0 : viewport.width) !== null && _viewport$width2 !== void 0 ? _viewport$width2 : fallbackWidth;
|
|
14815
|
+
const drawingHeight = (_viewport$height2 = viewport === null || viewport === void 0 ? void 0 : viewport.height) !== null && _viewport$height2 !== void 0 ? _viewport$height2 : fallbackHeight;
|
|
14816
|
+
let aLeft = (_getPositionHorizon2 = getPositionHorizon(positionH, column, page, drawingWidth, isPageBreak)) !== null && _getPositionHorizon2 !== void 0 ? _getPositionHorizon2 : 0;
|
|
14468
14817
|
if (positionH.relativeFrom === ObjectRelativeFromH.COLUMN && blockAnchorLeft > 0) {
|
|
14469
14818
|
const renderedColumnOrigin = isPageBreak ? 0 : column.left || page.marginLeft;
|
|
14470
14819
|
aLeft += blockAnchorLeft - renderedColumnOrigin;
|
|
14820
|
+
if (normalizeTraditionalColumnAnchor && ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL && positionV.relativeFrom === ObjectRelativeFromV.PARAGRAPH) aLeft -= page.marginLeft;
|
|
14471
14821
|
}
|
|
14472
14822
|
drawing.aLeft = aLeft;
|
|
14473
|
-
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page, lineTop, lineHeight,
|
|
14474
|
-
drawing.width =
|
|
14475
|
-
drawing.height =
|
|
14823
|
+
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page, lineTop, lineHeight, drawingHeight, blockAnchorTop, isPageBreak)) !== null && _getPositionVertical2 !== void 0 ? _getPositionVertical2 : 0;
|
|
14824
|
+
drawing.width = drawingWidth;
|
|
14825
|
+
drawing.height = drawingHeight;
|
|
14476
14826
|
drawing.angle = angle;
|
|
14827
|
+
drawing.customBlockRenderViewport = viewport ? {
|
|
14828
|
+
bleedLeft: viewport.bleedLeft,
|
|
14829
|
+
bleedWidth: viewport.bleedWidth,
|
|
14830
|
+
contentHeight: viewport.contentHeight,
|
|
14831
|
+
contentWidth: viewport.contentWidth,
|
|
14832
|
+
height: viewport.height,
|
|
14833
|
+
viewportHeight: viewport.viewportHeight
|
|
14834
|
+
} : void 0;
|
|
14477
14835
|
drawing.initialState = true;
|
|
14478
14836
|
drawing.columnLeft = column.left;
|
|
14479
14837
|
drawing.lineTop = lineTop;
|
|
@@ -14484,16 +14842,18 @@ function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShape
|
|
|
14484
14842
|
}
|
|
14485
14843
|
return drawings;
|
|
14486
14844
|
}
|
|
14487
|
-
function __updateDrawingPosition(column, drawings) {
|
|
14845
|
+
function __updateDrawingPosition(column, drawings, overwriteTopBottomPosition = false) {
|
|
14488
14846
|
var _column$parent4;
|
|
14489
14847
|
const page = (_column$parent4 = column.parent) === null || _column$parent4 === void 0 ? void 0 : _column$parent4.parent;
|
|
14490
14848
|
if (drawings == null || drawings.size === 0 || page == null) return;
|
|
14491
14849
|
for (const drawing of drawings.values()) {
|
|
14492
14850
|
const originDrawing = page.skeDrawings.get(drawing.drawingId);
|
|
14493
|
-
if (originDrawing) if (originDrawing.drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM)
|
|
14851
|
+
if (originDrawing) if (originDrawing.drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) if (overwriteTopBottomPosition) page.skeDrawings.set(drawing.drawingId, drawing);
|
|
14852
|
+
else {
|
|
14494
14853
|
const lowerDrawing = originDrawing.aTop > drawing.aTop ? originDrawing : drawing;
|
|
14495
14854
|
page.skeDrawings.set(drawing.drawingId, lowerDrawing);
|
|
14496
|
-
}
|
|
14855
|
+
}
|
|
14856
|
+
else page.skeDrawings.set(drawing.drawingId, drawing);
|
|
14497
14857
|
else page.skeDrawings.set(drawing.drawingId, drawing);
|
|
14498
14858
|
}
|
|
14499
14859
|
}
|
|
@@ -14822,7 +15182,10 @@ function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
|
14822
15182
|
const affectInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphInlineSkeDrawings;
|
|
14823
15183
|
const affectNonInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphNonInlineSkeDrawings;
|
|
14824
15184
|
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);
|
|
14825
|
-
if (affectInlineDrawings && affectInlineDrawings.size > 0)
|
|
15185
|
+
if (affectInlineDrawings && affectInlineDrawings.size > 0) {
|
|
15186
|
+
var _ctx$dataModel$getUni, _ctx$dataModel$getUni2, _ctx$dataModel;
|
|
15187
|
+
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);
|
|
15188
|
+
}
|
|
14826
15189
|
const paragraphStyle = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphStyle;
|
|
14827
15190
|
const paragraphBackgroundColor = paragraphStyle === null || paragraphStyle === void 0 || (_paragraphStyle$shadi = paragraphStyle.shading) === null || _paragraphStyle$shadi === void 0 ? void 0 : _paragraphStyle$shadi.backgroundColor;
|
|
14828
15191
|
if (paragraphBackgroundColor) line.backgroundColor = paragraphBackgroundColor;
|
|
@@ -15317,6 +15680,12 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
15317
15680
|
if (!hasAddonStyle && originTextRun) fontCreateConfigCache.setValue(st, ed, result);
|
|
15318
15681
|
return result;
|
|
15319
15682
|
}
|
|
15683
|
+
function getCustomRangeGlyphWidth(index, viewModel, paragraphNode, config) {
|
|
15684
|
+
const customRange = viewModel.getCustomRange(index + paragraphNode.startIndex);
|
|
15685
|
+
const glyphWidthEm = customRange === null || customRange === void 0 ? void 0 : customRange.glyphWidthEm;
|
|
15686
|
+
if (typeof glyphWidthEm !== "number" || !Number.isFinite(glyphWidthEm) || glyphWidthEm < 0) return;
|
|
15687
|
+
return glyphWidthEm * config.fontStyle.originFontSize;
|
|
15688
|
+
}
|
|
15320
15689
|
function getNullSkeleton() {
|
|
15321
15690
|
return {
|
|
15322
15691
|
pages: [],
|
|
@@ -15333,6 +15702,7 @@ function setPageParent(pages, parent) {
|
|
|
15333
15702
|
for (const page of pages) page.parent = parent;
|
|
15334
15703
|
}
|
|
15335
15704
|
const DEFAULT_SECTION_BREAK = {
|
|
15705
|
+
sectionId: "section_render_default",
|
|
15336
15706
|
columnProperties: [],
|
|
15337
15707
|
columnSeparatorType: ColumnSeparatorType.NONE,
|
|
15338
15708
|
sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,
|
|
@@ -15380,6 +15750,11 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15380
15750
|
let { documentStyle } = dataModel;
|
|
15381
15751
|
const { documentFlavor } = documentStyle;
|
|
15382
15752
|
let sectionBreak = viewModel.getSectionBreak(sectionNode.endIndex) || DEFAULT_SECTION_BREAK;
|
|
15753
|
+
const sectionBreaks = viewModel.getChildren().map((node) => viewModel.getSectionBreak(node.endIndex) || DEFAULT_SECTION_BREAK);
|
|
15754
|
+
sectionBreak = {
|
|
15755
|
+
...sectionBreak,
|
|
15756
|
+
...resolveSectionHeaderFooterReferences(documentStyle, sectionBreaks, nodeIndex)
|
|
15757
|
+
};
|
|
15383
15758
|
if (documentFlavor === DocumentFlavor.MODERN) {
|
|
15384
15759
|
var _documentStyle$pageSi, _documentStyle$pageSi2;
|
|
15385
15760
|
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;
|
|
@@ -15396,7 +15771,7 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15396
15771
|
vertexAngle: 0,
|
|
15397
15772
|
wrapStrategy: WrapStrategy.UNSPECIFIED
|
|
15398
15773
|
} } = documentStyle;
|
|
15399
|
-
const { charSpace = 0, linePitch = 15.6, gridType = 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 = ColumnSeparatorType.NONE, contentDirection, sectionType, textDirection, renderConfig = global_renderConfig } = sectionBreak;
|
|
15774
|
+
const { sectionId, charSpace = 0, linePitch = 15.6, gridType = 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 = ColumnSeparatorType.NONE, contentDirection, sectionType, textDirection, renderConfig = global_renderConfig } = sectionBreak;
|
|
15400
15775
|
const sectionNodeNext = viewModel.getChildren()[nodeIndex + 1];
|
|
15401
15776
|
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;
|
|
15402
15777
|
const headerIds = {
|
|
@@ -15412,6 +15787,7 @@ function prepareSectionBreakConfig(ctx, nodeIndex) {
|
|
|
15412
15787
|
if (pageSize.width === null) pageSize.width = Number.POSITIVE_INFINITY;
|
|
15413
15788
|
if (pageSize.height === null) pageSize.height = Number.POSITIVE_INFINITY;
|
|
15414
15789
|
return {
|
|
15790
|
+
sectionId,
|
|
15415
15791
|
charSpace,
|
|
15416
15792
|
linePitch,
|
|
15417
15793
|
gridType,
|
|
@@ -15484,13 +15860,14 @@ function getHeaderFooterMaxHeight(pageHeight) {
|
|
|
15484
15860
|
}
|
|
15485
15861
|
function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, pageNumber = 1, breakType = 0) {
|
|
15486
15862
|
const page = _getNullPage();
|
|
15487
|
-
const { pageNumberStart = 1, pageSize = {
|
|
15863
|
+
const { sectionId, pageNumberStart = 1, pageSize = {
|
|
15488
15864
|
width: Number.POSITIVE_INFINITY,
|
|
15489
15865
|
height: Number.POSITIVE_INFINITY
|
|
15490
15866
|
}, pageOrient = 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;
|
|
15491
15867
|
const { skeHeaders, skeFooters } = skeletonResourceReference;
|
|
15492
15868
|
const { width: pageWidth = Number.POSITIVE_INFINITY, height: pageHeight = Number.POSITIVE_INFINITY } = pageSize;
|
|
15493
15869
|
page.pageNumber = pageNumber;
|
|
15870
|
+
page.sectionId = sectionId;
|
|
15494
15871
|
page.pageNumberStart = pageNumberStart;
|
|
15495
15872
|
page.renderConfig = renderConfig;
|
|
15496
15873
|
page.marginLeft = marginLeft;
|
|
@@ -15585,10 +15962,11 @@ function _getNullPage(type = 0, segmentId = "") {
|
|
|
15585
15962
|
}
|
|
15586
15963
|
function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader = true, areaPage, count = 0) {
|
|
15587
15964
|
var _sectionBreakConfig$d;
|
|
15588
|
-
const { lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
15965
|
+
const { sectionId, lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
15589
15966
|
const pageWidth = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || Number.POSITIVE_INFINITY;
|
|
15590
15967
|
const pageHeight = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || Number.POSITIVE_INFINITY;
|
|
15591
15968
|
const headerFooterConfig = {
|
|
15969
|
+
sectionId,
|
|
15592
15970
|
lists,
|
|
15593
15971
|
footerTreeMap,
|
|
15594
15972
|
headerTreeMap,
|
|
@@ -15625,7 +16003,7 @@ function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakC
|
|
|
15625
16003
|
}
|
|
15626
16004
|
function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY) {
|
|
15627
16005
|
var _ref, _cellConfig$margin, _cellConfig$columnSpa;
|
|
15628
|
-
const { lists, footerTreeMap, headerTreeMap, localeService, drawings } = sectionBreakConfig;
|
|
16006
|
+
const { sectionId, lists, footerTreeMap, headerTreeMap, localeService, drawings } = sectionBreakConfig;
|
|
15629
16007
|
const { skeletonResourceReference } = ctx;
|
|
15630
16008
|
const { cellMargin, tableRows, tableColumns, tableId } = tableConfig;
|
|
15631
16009
|
const cellConfig = tableRows[row].tableCells[col];
|
|
@@ -15647,6 +16025,7 @@ function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, avai
|
|
|
15647
16025
|
}
|
|
15648
16026
|
const pageHeight = maxCellPageHeight;
|
|
15649
16027
|
const cellSectionBreakConfig = {
|
|
16028
|
+
sectionId,
|
|
15650
16029
|
lists,
|
|
15651
16030
|
footerTreeMap,
|
|
15652
16031
|
headerTreeMap,
|
|
@@ -15807,7 +16186,7 @@ function getDivideStretchability(divide) {
|
|
|
15807
16186
|
function getJustifiables(divide) {
|
|
15808
16187
|
const justifiables = divide.glyphGroup.filter((glyph) => glyph.isJustifiable).length;
|
|
15809
16188
|
const lastGlyph = divide.glyphGroup[divide.glyphGroup.length - 1];
|
|
15810
|
-
if (hasCJK(lastGlyph.content)) return justifiables - 1;
|
|
16189
|
+
if (cjk.hasCJK(lastGlyph.content)) return justifiables - 1;
|
|
15811
16190
|
return justifiables;
|
|
15812
16191
|
}
|
|
15813
16192
|
function adjustGlyphsInDivide(divide, justificationRatio, extraJustification) {
|
|
@@ -15912,7 +16291,7 @@ function horizontalAlignHandler(line, horizontalAlign, allowOverflowHorizontalOf
|
|
|
15912
16291
|
function restoreLastCJKGlyphWidth(line) {
|
|
15913
16292
|
for (const divide of line.divides) {
|
|
15914
16293
|
const lastGlyph = divide.glyphGroup[divide.glyphGroup.length - 1];
|
|
15915
|
-
if (lastGlyph && divide.isFull && hasCJKText(lastGlyph.content) && lastGlyph.width - lastGlyph.xOffset > lastGlyph.bBox.width) {
|
|
16294
|
+
if (lastGlyph && divide.isFull && cjk.hasCJKText(lastGlyph.content) && lastGlyph.width - lastGlyph.xOffset > lastGlyph.bBox.width) {
|
|
15916
16295
|
const shrinkAmount = lastGlyph.width - lastGlyph.xOffset - lastGlyph.bBox.width;
|
|
15917
16296
|
lastGlyph.width -= shrinkAmount;
|
|
15918
16297
|
lastGlyph.adjustability.shrinkability[1] = 0;
|
|
@@ -16185,22 +16564,66 @@ function _isDocxColumnBreakVisuallyBlankColumn(column) {
|
|
|
16185
16564
|
function _hasOnlyCustomBlockGlyphs(glyphs) {
|
|
16186
16565
|
return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK);
|
|
16187
16566
|
}
|
|
16188
|
-
function _mergeAdjacentCustomBlockShapedTexts(shapedTextList) {
|
|
16567
|
+
function _mergeAdjacentCustomBlockShapedTexts(shapedTextList, customBlockDrawings) {
|
|
16189
16568
|
const mergedShapedTextList = [];
|
|
16190
|
-
for (const
|
|
16191
|
-
const
|
|
16192
|
-
|
|
16193
|
-
lastShapedText.
|
|
16194
|
-
lastShapedText.glyphs.
|
|
16195
|
-
|
|
16196
|
-
|
|
16569
|
+
for (const originShapedText of shapedTextList) {
|
|
16570
|
+
const splitShapedTexts = _splitTopBottomCustomBlockShapedText(originShapedText, customBlockDrawings);
|
|
16571
|
+
for (const shapedText of splitShapedTexts) {
|
|
16572
|
+
const lastShapedText = mergedShapedTextList[mergedShapedTextList.length - 1];
|
|
16573
|
+
if (lastShapedText && _hasOnlyCustomBlockGlyphs(lastShapedText.glyphs) && _hasOnlyCustomBlockGlyphs(shapedText.glyphs) && !_hasTopBottomCustomBlockGlyph(lastShapedText.glyphs, customBlockDrawings) && !_hasTopBottomCustomBlockGlyph(shapedText.glyphs, customBlockDrawings)) {
|
|
16574
|
+
lastShapedText.text += shapedText.text;
|
|
16575
|
+
lastShapedText.glyphs.push(...shapedText.glyphs);
|
|
16576
|
+
lastShapedText.breakPointType = shapedText.breakPointType;
|
|
16577
|
+
continue;
|
|
16578
|
+
}
|
|
16579
|
+
mergedShapedTextList.push({
|
|
16580
|
+
...shapedText,
|
|
16581
|
+
glyphs: [...shapedText.glyphs]
|
|
16582
|
+
});
|
|
16197
16583
|
}
|
|
16198
|
-
|
|
16584
|
+
}
|
|
16585
|
+
return mergedShapedTextList;
|
|
16586
|
+
}
|
|
16587
|
+
function _splitTopBottomCustomBlockShapedText(shapedText, customBlockDrawings) {
|
|
16588
|
+
const splitShapedTexts = [];
|
|
16589
|
+
let pendingGlyphs = [];
|
|
16590
|
+
let pendingText = "";
|
|
16591
|
+
let textOffset = 0;
|
|
16592
|
+
const flushPending = () => {
|
|
16593
|
+
if (pendingGlyphs.length === 0) return;
|
|
16594
|
+
splitShapedTexts.push({
|
|
16199
16595
|
...shapedText,
|
|
16200
|
-
|
|
16596
|
+
text: pendingText,
|
|
16597
|
+
glyphs: pendingGlyphs
|
|
16201
16598
|
});
|
|
16599
|
+
pendingGlyphs = [];
|
|
16600
|
+
pendingText = "";
|
|
16601
|
+
};
|
|
16602
|
+
for (const glyph of shapedText.glyphs) {
|
|
16603
|
+
const glyphText = shapedText.text.slice(textOffset, textOffset + glyph.count);
|
|
16604
|
+
textOffset += glyph.count;
|
|
16605
|
+
if (_isTopBottomCustomBlockGlyph(glyph, customBlockDrawings)) {
|
|
16606
|
+
flushPending();
|
|
16607
|
+
splitShapedTexts.push({
|
|
16608
|
+
...shapedText,
|
|
16609
|
+
text: glyphText,
|
|
16610
|
+
glyphs: [glyph]
|
|
16611
|
+
});
|
|
16612
|
+
continue;
|
|
16613
|
+
}
|
|
16614
|
+
pendingGlyphs.push(glyph);
|
|
16615
|
+
pendingText += glyphText;
|
|
16202
16616
|
}
|
|
16203
|
-
|
|
16617
|
+
flushPending();
|
|
16618
|
+
return splitShapedTexts.length > 0 ? splitShapedTexts : [shapedText];
|
|
16619
|
+
}
|
|
16620
|
+
function _hasTopBottomCustomBlockGlyph(glyphs, customBlockDrawings) {
|
|
16621
|
+
return glyphs.some((glyph) => _isTopBottomCustomBlockGlyph(glyph, customBlockDrawings));
|
|
16622
|
+
}
|
|
16623
|
+
function _isTopBottomCustomBlockGlyph(glyph, customBlockDrawings) {
|
|
16624
|
+
var _customBlockDrawings$;
|
|
16625
|
+
if (glyph.streamType !== DataStreamTreeTokenType.CUSTOM_BLOCK || glyph.drawingId == null) return false;
|
|
16626
|
+
return ((_customBlockDrawings$ = customBlockDrawings.get(glyph.drawingId)) === null || _customBlockDrawings$ === void 0 ? void 0 : _customBlockDrawings$.drawingOrigin.layoutType) === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM;
|
|
16204
16627
|
}
|
|
16205
16628
|
function _getListLevelAncestors(bullet, listLevel) {
|
|
16206
16629
|
if (!bullet || !listLevel) return;
|
|
@@ -16246,26 +16669,17 @@ function _hasNextAdjacentLayoutBlockRange(blockRanges, blockRange) {
|
|
|
16246
16669
|
const nextBlockRange = _getNextAdjacentBlockRange(blockRanges, blockRange);
|
|
16247
16670
|
return nextBlockRange != null && BLOCK_LAYOUT_OUTER_SPACING_MAP.has(nextBlockRange.blockType) && nextBlockRange.startIndex === blockRange.endIndex + 1;
|
|
16248
16671
|
}
|
|
16249
|
-
function
|
|
16250
|
-
if (style.lineSpacing == null) style.lineSpacing = DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING;
|
|
16251
|
-
if (hasBlockRange) return;
|
|
16252
|
-
if (style.spaceAbove == null) style.spaceAbove = { v: DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE };
|
|
16253
|
-
if (style.spaceBelow == null) style.spaceBelow = { v: DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW };
|
|
16254
|
-
}
|
|
16255
|
-
function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, shouldApplyDocumentDefaults) {
|
|
16672
|
+
function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, documentStyle, useLegacyModernDefaults) {
|
|
16256
16673
|
var _body$paragraphs, _BLOCK_LAYOUT_OUTER_S;
|
|
16257
|
-
const style = Tools.deepClone(paragraphStyle);
|
|
16258
16674
|
const blockRanges = body === null || body === void 0 ? void 0 : body.blockRanges;
|
|
16259
|
-
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) {
|
|
16260
|
-
if (shouldApplyDocumentDefaults) _applyDefaultLayoutParagraphStyle(style, false);
|
|
16261
|
-
return style;
|
|
16262
|
-
}
|
|
16675
|
+
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) return resolveDocumentParagraphStyle(documentStyle, paragraphStyle, { useLegacyModernDefaults });
|
|
16263
16676
|
const blockRange = blockRanges.find((range) => BLOCK_LAYOUT_OUTER_SPACING_MAP.has(range.blockType) && paragraph.startIndex > range.startIndex && paragraph.startIndex < range.endIndex);
|
|
16264
|
-
if (!blockRange) {
|
|
16265
|
-
|
|
16266
|
-
|
|
16267
|
-
|
|
16268
|
-
|
|
16677
|
+
if (!blockRange) return resolveDocumentParagraphStyle(documentStyle, paragraphStyle, { useLegacyModernDefaults });
|
|
16678
|
+
const style = resolveDocumentParagraphStyle(documentStyle, paragraphStyle, {
|
|
16679
|
+
excludeDocumentOuterSpacing: true,
|
|
16680
|
+
useLegacyModernDefaults
|
|
16681
|
+
});
|
|
16682
|
+
if (style.lineSpacing == null) style.lineSpacing = DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING;
|
|
16269
16683
|
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);
|
|
16270
16684
|
const firstParagraph = blockParagraphs[0];
|
|
16271
16685
|
const lastParagraph = blockParagraphs[blockParagraphs.length - 1];
|
|
@@ -16314,7 +16728,7 @@ function _getNextPageNumber(lastPage) {
|
|
|
16314
16728
|
return lastPage.pageNumber + 1;
|
|
16315
16729
|
}
|
|
16316
16730
|
function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, sectionBreakConfig, tableSkeleton) {
|
|
16317
|
-
var
|
|
16731
|
+
var _viewModel$getSnapsho, _sectionBreakConfig$d, _viewModel$getBody2, _viewModel$getBody3;
|
|
16318
16732
|
const { skeletonResourceReference } = ctx;
|
|
16319
16733
|
const { lists, drawings = {}, localeService } = sectionBreakConfig;
|
|
16320
16734
|
const { endIndex, blocks = [], children } = paragraphNode;
|
|
@@ -16324,7 +16738,8 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16324
16738
|
paragraphId: "para_render_fallback"
|
|
16325
16739
|
};
|
|
16326
16740
|
const { paragraphStyle = {}, bullet } = paragraph;
|
|
16327
|
-
const
|
|
16741
|
+
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;
|
|
16742
|
+
const documentCompatibilityPolicy = (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy(documentStyle === null || documentStyle === void 0 ? void 0 : documentStyle.documentFlavor);
|
|
16328
16743
|
const shouldApplyDocumentDefaults = documentCompatibilityPolicy.applyDocumentDefaultParagraphStyle;
|
|
16329
16744
|
const useWordStyleLineHeight = documentCompatibilityPolicy.useWordStyleLineHeight;
|
|
16330
16745
|
const { skeHeaders, skeFooters, skeListLevel, drawingAnchor } = skeletonResourceReference;
|
|
@@ -16340,7 +16755,7 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16340
16755
|
const paragraphConfig = {
|
|
16341
16756
|
paragraphIndex: endIndex,
|
|
16342
16757
|
documentCompatibilityPolicy,
|
|
16343
|
-
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),
|
|
16758
|
+
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),
|
|
16344
16759
|
docxFallbackAnchorLeft: _getFollowingIndentedParagraphAnchorLeft(viewModel, paragraph, paragraphNode, drawings, isTraditionalDocumentCompatibility(documentCompatibilityPolicy)),
|
|
16345
16760
|
useWordStyleLineHeight,
|
|
16346
16761
|
paragraphNonInlineSkeDrawings,
|
|
@@ -16383,7 +16798,7 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
16383
16798
|
let allPages = [curPage];
|
|
16384
16799
|
let isParagraphFirstShapedText = true;
|
|
16385
16800
|
let shapedTextOffset = 0;
|
|
16386
|
-
for (const [_index, { text, glyphs, breakPointType }] of _mergeAdjacentCustomBlockShapedTexts(shapedTextList).entries()) {
|
|
16801
|
+
for (const [_index, { text, glyphs, breakPointType }] of _mergeAdjacentCustomBlockShapedTexts(shapedTextList, paragraphNonInlineSkeDrawingsByBlockId).entries()) {
|
|
16387
16802
|
const textStartIndex = paragraphNode.startIndex + shapedTextOffset;
|
|
16388
16803
|
const textGlyphCount = _glyphCount(glyphs);
|
|
16389
16804
|
const textEndIndex = textStartIndex + textGlyphCount;
|
|
@@ -16900,7 +17315,8 @@ function otherHandler(index, charArray, viewModel, paragraphNode, sectionBreakCo
|
|
|
16900
17315
|
const char = (_src$match = src.match(/^[\s\S]/gu)) === null || _src$match === void 0 ? void 0 : _src$match[0];
|
|
16901
17316
|
if (char == null) break;
|
|
16902
17317
|
if (hasSpace(char) || startWithEmoji(charArray.substring(step))) break;
|
|
16903
|
-
const
|
|
17318
|
+
const config = getFontCreateConfig(index + step, viewModel, paragraphNode, sectionBreakConfig, paragraph);
|
|
17319
|
+
const glyph = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphWidth(index + step, viewModel, paragraphNode, config));
|
|
16904
17320
|
glyphGroup.push(glyph);
|
|
16905
17321
|
src = src.substring(char.length);
|
|
16906
17322
|
step += char.length;
|
|
@@ -16976,7 +17392,7 @@ function punctuationSpaceAdjustment(shapedGlyphs) {
|
|
|
16976
17392
|
const nextGlyph = shapedGlyphs[i + 1];
|
|
16977
17393
|
const { width, content } = curGlyph;
|
|
16978
17394
|
const delta = width / 2;
|
|
16979
|
-
if (hasCJKPunctuation(content) && hasCJKPunctuation(nextGlyph.content) && curGlyph.adjustability.shrinkability[1] + nextGlyph.adjustability.shrinkability[0] >= delta) {
|
|
17395
|
+
if (cjk.hasCJKPunctuation(content) && cjk.hasCJKPunctuation(nextGlyph.content) && curGlyph.adjustability.shrinkability[1] + nextGlyph.adjustability.shrinkability[0] >= delta) {
|
|
16980
17396
|
const leftDelta = Math.min(curGlyph.adjustability.shrinkability[1], delta);
|
|
16981
17397
|
glyphShrinkRight(curGlyph, leftDelta);
|
|
16982
17398
|
glyphShrinkLeft(nextGlyph, delta - leftDelta);
|
|
@@ -16992,11 +17408,11 @@ function addCJKLatinSpacing(shapedTextList) {
|
|
|
16992
17408
|
const curGlyph = shapedGlyphs[i];
|
|
16993
17409
|
const nextGlyph = i < len - 1 ? shapedGlyphs[i + 1] : null;
|
|
16994
17410
|
const { width } = curGlyph;
|
|
16995
|
-
if (hasCJKText(curGlyph.content) && nextGlyph && LATIN_REG.test(nextGlyph.content)) {
|
|
17411
|
+
if (cjk.hasCJKText(curGlyph.content) && nextGlyph && LATIN_REG.test(nextGlyph.content)) {
|
|
16996
17412
|
curGlyph.width += width / 4;
|
|
16997
17413
|
curGlyph.adjustability.shrinkability[1] += width / 8;
|
|
16998
17414
|
}
|
|
16999
|
-
if (hasCJKText(curGlyph.content) && prevGlyph && LATIN_REG.test(prevGlyph.content)) {
|
|
17415
|
+
if (cjk.hasCJKText(curGlyph.content) && prevGlyph && LATIN_REG.test(prevGlyph.content)) {
|
|
17000
17416
|
curGlyph.width += width / 4;
|
|
17001
17417
|
curGlyph.xOffset += width / 4;
|
|
17002
17418
|
curGlyph.adjustability.shrinkability[0] += width / 8;
|
|
@@ -17058,7 +17474,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
17058
17474
|
const newSpan = createSkeletonLetterGlyph(char, config);
|
|
17059
17475
|
shapedGlyphs.push(newSpan);
|
|
17060
17476
|
} else {
|
|
17061
|
-
const newSpan = createSkeletonLetterGlyph(char, config,
|
|
17477
|
+
const newSpan = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphWidth(start, viewModel, paragraphNode, config), glyphInfo);
|
|
17062
17478
|
shapedGlyphs.push(newSpan);
|
|
17063
17479
|
}
|
|
17064
17480
|
}
|
|
@@ -17077,24 +17493,29 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
17077
17493
|
const { blockId } = customBlock;
|
|
17078
17494
|
const drawingOrigin = drawings[blockId];
|
|
17079
17495
|
if ((drawingOrigin === null || drawingOrigin === void 0 ? void 0 : drawingOrigin.layoutType) === PositionedObjectLayoutType.INLINE) {
|
|
17496
|
+
var _viewModel$getDataMod, _viewModel$getDataMod2, _viewModel$getDataMod3, _boundingBox$height, _boundingBox$width, _ref, _viewport$layoutWidth, _viewport$height;
|
|
17080
17497
|
const { angle } = drawingOrigin.docTransform;
|
|
17081
17498
|
const { width = 0, height = 0 } = drawingOrigin.docTransform.size;
|
|
17082
17499
|
const boundingBox = getBoundingBox(angle, 0, width, 0, height);
|
|
17083
|
-
|
|
17500
|
+
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, {
|
|
17501
|
+
fallbackHeight: (_boundingBox$height = boundingBox.height) !== null && _boundingBox$height !== void 0 ? _boundingBox$height : 0,
|
|
17502
|
+
fallbackWidth: (_boundingBox$width = boundingBox.width) !== null && _boundingBox$width !== void 0 ? _boundingBox$width : 0
|
|
17503
|
+
});
|
|
17504
|
+
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);
|
|
17084
17505
|
} else if (drawingOrigin != null) newGlyph = createSkeletonCustomBlockGlyph(config, 0, 0, drawingOrigin.drawingId);
|
|
17085
17506
|
}
|
|
17086
17507
|
if (newGlyph == null) newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17087
17508
|
shapedGlyphs.push(newGlyph);
|
|
17088
17509
|
i += char.length;
|
|
17089
17510
|
src = src.substring(char.length);
|
|
17090
|
-
} else if (/\s/.test(char) || hasCJK(char)) {
|
|
17511
|
+
} else if (/\s/.test(char) || cjk.hasCJK(char)) {
|
|
17091
17512
|
const config = getFontCreateConfig(i, viewModel, paragraphNode, sectionBreakConfig, paragraph);
|
|
17092
17513
|
let newGlyph = null;
|
|
17093
17514
|
if (char === DataStreamTreeTokenType.TAB) newGlyph = createSkeletonTabGlyph(config, getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid));
|
|
17094
17515
|
else if (char === DataStreamTreeTokenType.PARAGRAPH) {
|
|
17095
17516
|
var _sectionBreakConfig$r;
|
|
17096
17517
|
if (((_sectionBreakConfig$r = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r === void 0 ? void 0 : _sectionBreakConfig$r.zeroWidthParagraphBreak) === BooleanNumber.TRUE) newGlyph = createSkeletonLetterGlyph(char, config, 0);
|
|
17097
|
-
else newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17518
|
+
else newGlyph = createSkeletonLetterGlyph(char, config, getCustomRangeGlyphWidth(i, viewModel, paragraphNode, config));
|
|
17098
17519
|
} else newGlyph = createSkeletonLetterGlyph(char, config);
|
|
17099
17520
|
shapedGlyphs.push(newGlyph);
|
|
17100
17521
|
i += char.length;
|
|
@@ -17241,6 +17662,7 @@ function createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig,
|
|
|
17241
17662
|
const page = createSkeletonPage(ctx, columnSectionBreakConfig, ctx.skeletonResourceReference);
|
|
17242
17663
|
page.type = 3;
|
|
17243
17664
|
for (const paragraphNode of getColumnParagraphNodes(columnNode)) dealWidthParagraph(ctx, viewModel, paragraphNode, page, columnSectionBreakConfig);
|
|
17665
|
+
updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
17244
17666
|
updateBlockIndex([page], columnNode.startIndex, (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy());
|
|
17245
17667
|
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);
|
|
17246
17668
|
return page;
|
|
@@ -18682,7 +19104,10 @@ function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
|
18682
19104
|
paragraphId: createParagraphId(/* @__PURE__ */ new Set()),
|
|
18683
19105
|
paragraphStyle: { horizontalAlign }
|
|
18684
19106
|
}],
|
|
18685
|
-
sectionBreaks: [{
|
|
19107
|
+
sectionBreaks: [{
|
|
19108
|
+
sectionId: createSectionId(/* @__PURE__ */ new Set()),
|
|
19109
|
+
startIndex: contentLength + 1
|
|
19110
|
+
}]
|
|
18686
19111
|
},
|
|
18687
19112
|
documentStyle: {
|
|
18688
19113
|
pageSize: {
|
|
@@ -18766,6 +19191,36 @@ const DEFAULT_PADDING_DATA = {
|
|
|
18766
19191
|
r: 2
|
|
18767
19192
|
};
|
|
18768
19193
|
const RENDER_RAW_FORMULA_KEY = "RENDER_RAW_FORMULA";
|
|
19194
|
+
function getResolvedRenderHorizontalAlign$1(horizontalAlign, cellData) {
|
|
19195
|
+
if (horizontalAlign !== HorizontalAlign.UNSPECIFIED) return horizontalAlign;
|
|
19196
|
+
if ((cellData === null || cellData === void 0 ? void 0 : cellData.t) === CellValueType.NUMBER || !Tools.isDefine(cellData === null || cellData === void 0 ? void 0 : cellData.t) && typeof (cellData === null || cellData === void 0 ? void 0 : cellData.v) === "number") return HorizontalAlign.RIGHT;
|
|
19197
|
+
if ((cellData === null || cellData === void 0 ? void 0 : cellData.t) === CellValueType.BOOLEAN) return HorizontalAlign.CENTER;
|
|
19198
|
+
return horizontalAlign;
|
|
19199
|
+
}
|
|
19200
|
+
function setRenderTextCache(cacheItem, cellData) {
|
|
19201
|
+
var _cacheItem$horizontal;
|
|
19202
|
+
if (cacheItem.documentSkeleton) {
|
|
19203
|
+
cacheItem.displayText = void 0;
|
|
19204
|
+
cacheItem.resolvedHorizontalAlign = void 0;
|
|
19205
|
+
return;
|
|
19206
|
+
}
|
|
19207
|
+
cacheItem.displayText = getDisplayValueFromCell(cellData);
|
|
19208
|
+
cacheItem.resolvedHorizontalAlign = getResolvedRenderHorizontalAlign$1((_cacheItem$horizontal = cacheItem.horizontalAlign) !== null && _cacheItem$horizontal !== void 0 ? _cacheItem$horizontal : HorizontalAlign.UNSPECIFIED, cellData);
|
|
19209
|
+
}
|
|
19210
|
+
function pushRowRange(ranges, row, startColumn, endColumn) {
|
|
19211
|
+
if (endColumn < startColumn) return;
|
|
19212
|
+
const last = ranges[ranges.length - 1];
|
|
19213
|
+
if (last && last.startRow === row && last.endRow === row && last.endColumn + 1 === startColumn) {
|
|
19214
|
+
last.endColumn = endColumn;
|
|
19215
|
+
return;
|
|
19216
|
+
}
|
|
19217
|
+
ranges.push({
|
|
19218
|
+
startRow: row,
|
|
19219
|
+
endRow: row,
|
|
19220
|
+
startColumn,
|
|
19221
|
+
endColumn
|
|
19222
|
+
});
|
|
19223
|
+
}
|
|
18769
19224
|
const CACHE_COUNT = 100;
|
|
18770
19225
|
let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
18771
19226
|
constructor(worksheet, _styles, _localeService, _contextService, _configService, _injector) {
|
|
@@ -18779,6 +19234,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
18779
19234
|
_defineProperty(this, "_cacheRangeMap", /* @__PURE__ */ new Map());
|
|
18780
19235
|
_defineProperty(this, "_visibleRangeMap", /* @__PURE__ */ new Map());
|
|
18781
19236
|
_defineProperty(this, "_overflowCache", new ObjectMatrix());
|
|
19237
|
+
_defineProperty(this, "_incrementalFontRenderRanges", []);
|
|
18782
19238
|
_defineProperty(this, "_stylesCache", {
|
|
18783
19239
|
background: {},
|
|
18784
19240
|
backgroundPositions: new ObjectMatrix(),
|
|
@@ -18836,6 +19292,9 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
18836
19292
|
get overflowCache() {
|
|
18837
19293
|
return this._overflowCache;
|
|
18838
19294
|
}
|
|
19295
|
+
get incrementalFontRenderRanges() {
|
|
19296
|
+
return this._incrementalFontRenderRanges;
|
|
19297
|
+
}
|
|
18839
19298
|
get showGridlines() {
|
|
18840
19299
|
return this._showGridlines;
|
|
18841
19300
|
}
|
|
@@ -18921,7 +19380,31 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
18921
19380
|
this.updateVisibleRange(vpInfo);
|
|
18922
19381
|
const rowColumnSegment = this._drawingRange;
|
|
18923
19382
|
const columnWidthAccumulation = this.columnWidthAccumulation;
|
|
18924
|
-
const
|
|
19383
|
+
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);
|
|
19384
|
+
const hasMergeData = this.worksheet.getMergeData().length > 0;
|
|
19385
|
+
const isScrolling = !!vpInfo && (!!vpInfo.diffX || !!vpInfo.diffY);
|
|
19386
|
+
const shouldRefreshCacheForScroll = isIncrementalScroll && (hasMergeData && isScrolling || !!vpInfo.shouldCacheUpdate && !!vpInfo.diffX);
|
|
19387
|
+
const shouldUseIncrementalStyleRange = isIncrementalScroll && !shouldRefreshCacheForScroll;
|
|
19388
|
+
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];
|
|
19389
|
+
const visibleCellOptions = hasMergeData ? null : {
|
|
19390
|
+
cacheItem: {
|
|
19391
|
+
bg: true,
|
|
19392
|
+
border: true
|
|
19393
|
+
},
|
|
19394
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19395
|
+
hasMergeData,
|
|
19396
|
+
rowVisible: true
|
|
19397
|
+
};
|
|
19398
|
+
const overflowCellOptions = hasMergeData ? null : {
|
|
19399
|
+
cacheItem: {
|
|
19400
|
+
bg: false,
|
|
19401
|
+
border: false
|
|
19402
|
+
},
|
|
19403
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19404
|
+
hasMergeData,
|
|
19405
|
+
rowVisible: true
|
|
19406
|
+
};
|
|
19407
|
+
this._incrementalFontRenderRanges = [];
|
|
18925
19408
|
for (const styleRange of styleRanges) {
|
|
18926
19409
|
const { startRow: visibleStartRow, endRow: visibleEndRow, startColumn: visibleStartColumn, endColumn: visibleEndColumn } = styleRange;
|
|
18927
19410
|
if (visibleEndColumn === -1 || visibleEndRow === -1) continue;
|
|
@@ -18946,26 +19429,57 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
18946
19429
|
startColumn: visibleStartColumn,
|
|
18947
19430
|
endColumn: visibleEndColumn
|
|
18948
19431
|
});
|
|
18949
|
-
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c,
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
|
|
18956
|
-
|
|
19432
|
+
for (let c = visibleStartColumn; c <= visibleEndColumn; c++) this._setStylesCacheForOneCell(r, c, visibleCellOptions !== null && visibleCellOptions !== void 0 ? visibleCellOptions : {
|
|
19433
|
+
cacheItem: {
|
|
19434
|
+
bg: true,
|
|
19435
|
+
border: true
|
|
19436
|
+
},
|
|
19437
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19438
|
+
hasMergeData,
|
|
19439
|
+
rowVisible: true
|
|
19440
|
+
});
|
|
19441
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, visibleStartColumn, visibleEndColumn);
|
|
19442
|
+
for (let c = visibleStartColumn - 1; c >= expandStartCol; c--) {
|
|
19443
|
+
this._setStylesCacheForOneCell(r, c, overflowCellOptions !== null && overflowCellOptions !== void 0 ? overflowCellOptions : {
|
|
19444
|
+
cacheItem: {
|
|
19445
|
+
bg: false,
|
|
19446
|
+
border: false
|
|
19447
|
+
},
|
|
19448
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19449
|
+
hasMergeData,
|
|
19450
|
+
rowVisible: true
|
|
19451
|
+
});
|
|
19452
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, c, c);
|
|
19453
|
+
if (!isCellCoverable(this.worksheet.getCell(r, c)) || hasMergeData && this.intersectMergeRange(r, c)) break;
|
|
19454
|
+
}
|
|
18957
19455
|
if (visibleEndColumn === 0) continue;
|
|
18958
|
-
for (let c = visibleEndColumn + 1; c
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
19456
|
+
for (let c = visibleEndColumn + 1; c <= expandEndCol; c++) {
|
|
19457
|
+
this._setStylesCacheForOneCell(r, c, overflowCellOptions !== null && overflowCellOptions !== void 0 ? overflowCellOptions : {
|
|
19458
|
+
cacheItem: {
|
|
19459
|
+
bg: false,
|
|
19460
|
+
border: false
|
|
19461
|
+
},
|
|
19462
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19463
|
+
hasMergeData,
|
|
19464
|
+
rowVisible: true
|
|
19465
|
+
});
|
|
19466
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, r, c, c);
|
|
19467
|
+
if (!isCellCoverable(this.worksheet.getCell(r, c)) || hasMergeData && this.intersectMergeRange(r, c)) break;
|
|
19468
|
+
}
|
|
18962
19469
|
}
|
|
18963
19470
|
const mergeRanges = [];
|
|
18964
19471
|
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
18965
19472
|
const mergeRangeInVisible = this.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
18966
19473
|
mergeRanges.push(...mergeRangeInVisible);
|
|
18967
19474
|
}
|
|
18968
|
-
for (const mergeRange of mergeRanges)
|
|
19475
|
+
for (const mergeRange of mergeRanges) {
|
|
19476
|
+
this._setStylesCacheForOneCell(mergeRange.startRow, mergeRange.startColumn, {
|
|
19477
|
+
mergeRange,
|
|
19478
|
+
reuseExisting: shouldUseIncrementalStyleRange,
|
|
19479
|
+
hasMergeData
|
|
19480
|
+
});
|
|
19481
|
+
if (shouldUseIncrementalStyleRange) pushRowRange(this._incrementalFontRenderRanges, mergeRange.startRow, mergeRange.startColumn, mergeRange.startColumn);
|
|
19482
|
+
}
|
|
18969
19483
|
}
|
|
18970
19484
|
return this;
|
|
18971
19485
|
}
|
|
@@ -19250,6 +19764,22 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19250
19764
|
endColumn
|
|
19251
19765
|
};
|
|
19252
19766
|
}
|
|
19767
|
+
_isOverflowBlockedByAdjacentCell(row, column, horizontalAlign, hasMergeData = true) {
|
|
19768
|
+
const leftBlocked = () => this._isOverflowSideBlocked(row, column, -1, hasMergeData);
|
|
19769
|
+
const rightBlocked = () => this._isOverflowSideBlocked(row, column, 1, hasMergeData);
|
|
19770
|
+
if (horizontalAlign === HorizontalAlign.CENTER) return leftBlocked() && rightBlocked();
|
|
19771
|
+
if (horizontalAlign === HorizontalAlign.RIGHT) return leftBlocked();
|
|
19772
|
+
return rightBlocked();
|
|
19773
|
+
}
|
|
19774
|
+
_isOverflowSideBlocked(row, column, direction, hasMergeData = true) {
|
|
19775
|
+
var _this$_stylesCache$fo;
|
|
19776
|
+
const adjacentColumn = column + direction;
|
|
19777
|
+
if (adjacentColumn < 0 || adjacentColumn >= this.getColumnCount()) return true;
|
|
19778
|
+
const rawAdjacentCell = this._cellData.getValue(row, adjacentColumn);
|
|
19779
|
+
if (rawAdjacentCell && !isCellCoverable(rawAdjacentCell)) return true;
|
|
19780
|
+
const cachedAdjacentCell = (_this$_stylesCache$fo = this._stylesCache.fontMatrix.getValue(row, adjacentColumn)) === null || _this$_stylesCache$fo === void 0 ? void 0 : _this$_stylesCache$fo.cellData;
|
|
19781
|
+
return !isCellCoverable(cachedAdjacentCell !== null && cachedAdjacentCell !== void 0 ? cachedAdjacentCell : this.worksheet.getCell(row, adjacentColumn)) || hasMergeData && this.intersectMergeRange(row, adjacentColumn);
|
|
19782
|
+
}
|
|
19253
19783
|
/**
|
|
19254
19784
|
* Get cell by pos(offsetX, offsetY).
|
|
19255
19785
|
* @deprecated Please use `getCellWithCoordByOffset` instead.
|
|
@@ -19419,7 +19949,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19419
19949
|
* the text content of this cell can be drawn to both sides, not limited by the cell's width.
|
|
19420
19950
|
* Overflow on the left or right is aligned according to the text's horizontal alignment.
|
|
19421
19951
|
*/
|
|
19422
|
-
_calculateOverflowCell(row, column, docsConfig) {
|
|
19952
|
+
_calculateOverflowCell(row, column, docsConfig, hasMergeData = true) {
|
|
19423
19953
|
const { documentSkeleton, vertexAngle = 0, centerAngle = 0, horizontalAlign, wrapStrategy } = docsConfig;
|
|
19424
19954
|
const { t: cellValueType = CellValueType.STRING } = this._cellData.getValue(row, column) || {};
|
|
19425
19955
|
let horizontalAlignPos = horizontalAlign;
|
|
@@ -19435,7 +19965,13 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19435
19965
|
* Numerical and Boolean values are not displayed with overflow.
|
|
19436
19966
|
*/
|
|
19437
19967
|
if ((wrapStrategy === WrapStrategy.OVERFLOW || wrapStrategy === WrapStrategy.UNSPECIFIED) && cellValueType !== CellValueType.NUMBER && cellValueType !== CellValueType.BOOLEAN && horizontalAlign !== HorizontalAlign.JUSTIFIED) {
|
|
19438
|
-
|
|
19968
|
+
var _docsConfig$cellData$, _docsConfig$cellData, _docsConfig$cellData2;
|
|
19969
|
+
docsConfig.textFitsCurrentCell = false;
|
|
19970
|
+
if (hasMergeData && this.intersectMergeRange(row, column)) return true;
|
|
19971
|
+
const columnStart = this.columnWidthAccumulation[column - 1] || 0;
|
|
19972
|
+
const currentColumnWidth = (this.columnWidthAccumulation[column] || columnStart) - columnStart;
|
|
19973
|
+
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;
|
|
19974
|
+
if ((Boolean(documentSkeleton) || `${rawText !== null && rawText !== void 0 ? rawText : ""}`.length * 4 > currentColumnWidth) && this._isOverflowBlockedByAdjacentCell(row, column, horizontalAlignPos, hasMergeData)) return true;
|
|
19439
19975
|
let contentSize;
|
|
19440
19976
|
if (documentSkeleton) contentSize = getDocsSkeletonPageSize(documentSkeleton, vertexAngle);
|
|
19441
19977
|
else {
|
|
@@ -19455,11 +19991,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19455
19991
|
height: cellHeight
|
|
19456
19992
|
};
|
|
19457
19993
|
}
|
|
19994
|
+
if (contentSize.width < currentColumnWidth) {
|
|
19995
|
+
docsConfig.textFitsCurrentCell = true;
|
|
19996
|
+
return true;
|
|
19997
|
+
}
|
|
19458
19998
|
const { startColumn, endColumn } = this.getOverflowPosition(contentSize, horizontalAlignPos, row, column, this.getColumnCount());
|
|
19459
19999
|
if (startColumn === endColumn) return true;
|
|
19460
20000
|
this.appendToOverflowCache(row, column, startColumn, endColumn);
|
|
19461
20001
|
} else if (wrapStrategy === WrapStrategy.WRAP && vertexAngle !== 0) {
|
|
19462
|
-
if (this.intersectMergeRange(row, column)) return true;
|
|
20002
|
+
if (hasMergeData && this.intersectMergeRange(row, column)) return true;
|
|
19463
20003
|
const { startY, endY } = this.getCellWithCoordByIndex(row, column);
|
|
19464
20004
|
const cellHeight = endY - startY;
|
|
19465
20005
|
documentSkeleton.getViewModel().getDataModel().updateDocumentDataPageSize(cellHeight);
|
|
@@ -19491,16 +20031,18 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19491
20031
|
const startRow = searchArray(rowHeightAccumulation, Math.round(viewBound.top) - this.columnHeaderHeightAndMarginTop);
|
|
19492
20032
|
const endY = Math.round(viewBound.bottom) - this.columnHeaderHeightAndMarginTop;
|
|
19493
20033
|
let endRow = searchArray(rowHeightAccumulation, endY);
|
|
19494
|
-
|
|
20034
|
+
const isEndYOnBoundary = endRow < lenOfRowData && rowHeightAccumulation[endRow - 1] === endY;
|
|
20035
|
+
if (isEndYOnBoundary) endRow -= 1;
|
|
19495
20036
|
const startColumn = searchArray(columnWidthAccumulation, Math.round(viewBound.left) - this.rowHeaderWidthAndMarginLeft);
|
|
19496
20037
|
const endX = Math.round(viewBound.right) - this.rowHeaderWidthAndMarginLeft;
|
|
19497
20038
|
let endColumn = searchArray(columnWidthAccumulation, endX);
|
|
19498
|
-
|
|
20039
|
+
const isEndXOnBoundary = endColumn < lenOfColData && columnWidthAccumulation[endColumn - 1] === endX;
|
|
20040
|
+
if (isEndXOnBoundary) endColumn -= 1;
|
|
19499
20041
|
if (isPrinting) return {
|
|
19500
20042
|
startRow,
|
|
19501
|
-
endRow: endRow === lenOfRowData - 1 ? endRow : endRow - 1,
|
|
20043
|
+
endRow: endRow === lenOfRowData - 1 || isEndYOnBoundary ? endRow : endRow - 1,
|
|
19502
20044
|
startColumn,
|
|
19503
|
-
endColumn: endColumn === lenOfColData - 1 ? endColumn : endColumn - 1
|
|
20045
|
+
endColumn: endColumn === lenOfColData - 1 || isEndXOnBoundary ? endColumn : endColumn - 1
|
|
19504
20046
|
};
|
|
19505
20047
|
return {
|
|
19506
20048
|
startRow,
|
|
@@ -19551,7 +20093,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19551
20093
|
for (let i = 0; i < ranges.length; i++) {
|
|
19552
20094
|
const range = ranges[i];
|
|
19553
20095
|
Range.foreach(range, (row, col) => {
|
|
20096
|
+
var _this$_stylesCache$bo, _this$_stylesCache$ba, _this$_stylesCache$ba2;
|
|
19554
20097
|
this._stylesCache.fontMatrix.realDeleteValue(row, col);
|
|
20098
|
+
(_this$_stylesCache$bo = this._stylesCache.border) === null || _this$_stylesCache$bo === void 0 || _this$_stylesCache$bo.realDeleteValue(row, col);
|
|
20099
|
+
(_this$_stylesCache$ba = this._stylesCache.backgroundPositions) === null || _this$_stylesCache$ba === void 0 || _this$_stylesCache$ba.realDeleteValue(row, col);
|
|
20100
|
+
this._handleBgMatrix.realDeleteValue(row, col);
|
|
20101
|
+
this._handleBorderMatrix.realDeleteValue(row, col);
|
|
20102
|
+
Object.values((_this$_stylesCache$ba2 = this._stylesCache.background) !== null && _this$_stylesCache$ba2 !== void 0 ? _this$_stylesCache$ba2 : {}).forEach((backgroundMatrix) => {
|
|
20103
|
+
backgroundMatrix.realDeleteValue(row, col);
|
|
20104
|
+
});
|
|
19555
20105
|
});
|
|
19556
20106
|
}
|
|
19557
20107
|
this.makeDirty(true);
|
|
@@ -19592,15 +20142,15 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19592
20142
|
}).bg) return;
|
|
19593
20143
|
this._handleBgMatrix.setValue(row, col, true);
|
|
19594
20144
|
if (style && style.bg && style.bg.rgb) {
|
|
19595
|
-
var _this$_stylesCache$
|
|
20145
|
+
var _this$_stylesCache$ba3;
|
|
19596
20146
|
const rgb = style.bg.rgb;
|
|
19597
20147
|
if (!this._stylesCache.background[rgb]) this._stylesCache.background[rgb] = new ObjectMatrix();
|
|
19598
20148
|
this._stylesCache.background[rgb].setValue(row, col, rgb);
|
|
19599
20149
|
const cellInfo = this.getCellWithCoordByIndex(row, col, false);
|
|
19600
|
-
(_this$_stylesCache$
|
|
20150
|
+
(_this$_stylesCache$ba3 = this._stylesCache.backgroundPositions) === null || _this$_stylesCache$ba3 === void 0 || _this$_stylesCache$ba3.setValue(row, col, cellInfo);
|
|
19601
20151
|
}
|
|
19602
20152
|
}
|
|
19603
|
-
_setFontStylesCache(row, col, cellData, style) {
|
|
20153
|
+
_setFontStylesCache(row, col, cellData, style, hasMergeData = true) {
|
|
19604
20154
|
var _style$tr2;
|
|
19605
20155
|
if (isNullCell(cellData)) return;
|
|
19606
20156
|
let config = {
|
|
@@ -19612,6 +20162,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19612
20162
|
else {
|
|
19613
20163
|
const cacheItem = cacheValue;
|
|
19614
20164
|
cacheItem.cellData = cellData;
|
|
20165
|
+
setRenderTextCache(cacheItem, cellData);
|
|
19615
20166
|
this._stylesCache.fontMatrix.setValue(row, col, cacheValue);
|
|
19616
20167
|
return;
|
|
19617
20168
|
}
|
|
@@ -19655,8 +20206,10 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19655
20206
|
style
|
|
19656
20207
|
};
|
|
19657
20208
|
}
|
|
19658
|
-
|
|
19659
|
-
|
|
20209
|
+
const fontCacheItem = config;
|
|
20210
|
+
setRenderTextCache(fontCacheItem, cellData);
|
|
20211
|
+
this._calculateOverflowCell(row, col, fontCacheItem, hasMergeData);
|
|
20212
|
+
this._stylesCache.fontMatrix.setValue(row, col, fontCacheItem);
|
|
19660
20213
|
}
|
|
19661
20214
|
/**
|
|
19662
20215
|
* Set border background and font to this._stylesCache cell by cell.
|
|
@@ -19665,19 +20218,37 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19665
20218
|
* @param options {{ mergeRange: IRange; cacheItem: ICacheItem } | undefined}
|
|
19666
20219
|
*/
|
|
19667
20220
|
_setStylesCacheForOneCell(row, col, options) {
|
|
20221
|
+
var _options$hasMergeData, _options$rowVisible, _options$hasMergeData2;
|
|
19668
20222
|
if (row === -1 || col === -1) return;
|
|
19669
20223
|
if (!options) options = { cacheItem: {
|
|
19670
20224
|
bg: true,
|
|
19671
20225
|
border: true
|
|
19672
20226
|
} };
|
|
19673
|
-
const
|
|
19674
|
-
if (
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
20227
|
+
const cacheItem = options.cacheItem;
|
|
20228
|
+
if (options.reuseExisting && cacheItem && !options.mergeRange) {
|
|
20229
|
+
const bgHandled = !cacheItem.bg || Tools.isDefine(this._handleBgMatrix.getValue(row, col));
|
|
20230
|
+
const borderHandled = !cacheItem.border || Tools.isDefine(this._handleBorderMatrix.getValue(row, col));
|
|
20231
|
+
if (bgHandled && borderHandled && this._stylesCache.fontMatrix.getValue(row, col)) return;
|
|
20232
|
+
}
|
|
20233
|
+
const hasMergeData = (_options$hasMergeData = options.hasMergeData) !== null && _options$hasMergeData !== void 0 ? _options$hasMergeData : true;
|
|
20234
|
+
let isMerged = false;
|
|
20235
|
+
let isMergedMainCell = false;
|
|
20236
|
+
if (hasMergeData) {
|
|
20237
|
+
const mergeInfo = this.worksheet.getCellInfoInMergeData(row, col);
|
|
20238
|
+
isMerged = mergeInfo.isMerged;
|
|
20239
|
+
isMergedMainCell = mergeInfo.isMergedMainCell;
|
|
20240
|
+
if (isMerged) {
|
|
20241
|
+
const { startRow, startColumn, endRow, endColumn } = mergeInfo;
|
|
20242
|
+
options.mergeRange = {
|
|
20243
|
+
startRow,
|
|
20244
|
+
startColumn,
|
|
20245
|
+
endRow,
|
|
20246
|
+
endColumn
|
|
20247
|
+
};
|
|
20248
|
+
}
|
|
20249
|
+
}
|
|
20250
|
+
const rowVisible = (_options$rowVisible = options.rowVisible) !== null && _options$rowVisible !== void 0 ? _options$rowVisible : this.worksheet.getRowVisible(row);
|
|
20251
|
+
if (this.worksheet.getColVisible(col) === false || rowVisible === false) {
|
|
19681
20252
|
if (isMerged && !isMergedMainCell) return;
|
|
19682
20253
|
else if (!isMergedMainCell) return;
|
|
19683
20254
|
}
|
|
@@ -19689,7 +20260,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
19689
20260
|
this._setFontStylesCache(row, col, {
|
|
19690
20261
|
...cell,
|
|
19691
20262
|
s: style
|
|
19692
|
-
}, style);
|
|
20263
|
+
}, style, (_options$hasMergeData2 = options.hasMergeData) !== null && _options$hasMergeData2 !== void 0 ? _options$hasMergeData2 : true);
|
|
19693
20264
|
}
|
|
19694
20265
|
/**
|
|
19695
20266
|
* pro/issues/344
|
|
@@ -19902,6 +20473,19 @@ function rotatedBoundingBox(width, height, angleDegrees) {
|
|
|
19902
20473
|
rotatedHeight: Math.abs(width * Math.sin(angle)) + Math.abs(height * Math.cos(angle))
|
|
19903
20474
|
};
|
|
19904
20475
|
}
|
|
20476
|
+
function getResolvedRenderHorizontalAlign(fontCache, cellData) {
|
|
20477
|
+
if (fontCache.resolvedHorizontalAlign !== void 0) return fontCache.resolvedHorizontalAlign;
|
|
20478
|
+
const { horizontalAlign } = fontCache;
|
|
20479
|
+
if (horizontalAlign !== HorizontalAlign.UNSPECIFIED) return horizontalAlign;
|
|
20480
|
+
if (cellData.t === CellValueType.NUMBER || !Tools.isDefine(cellData.t) && typeof cellData.v === "number") return HorizontalAlign.RIGHT;
|
|
20481
|
+
if (cellData.t === CellValueType.BOOLEAN) return HorizontalAlign.CENTER;
|
|
20482
|
+
return horizontalAlign;
|
|
20483
|
+
}
|
|
20484
|
+
function needsFontRenderExtensionBounds(fontCache) {
|
|
20485
|
+
var _fontCache$cellData;
|
|
20486
|
+
const extension = (_fontCache$cellData = fontCache.cellData) === null || _fontCache$cellData === void 0 ? void 0 : _fontCache$cellData.fontRenderExtension;
|
|
20487
|
+
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));
|
|
20488
|
+
}
|
|
19905
20489
|
var Font = class extends SheetExtension {
|
|
19906
20490
|
constructor() {
|
|
19907
20491
|
super();
|
|
@@ -19932,7 +20516,7 @@ var Font = class extends SheetExtension {
|
|
|
19932
20516
|
const { rowHeightAccumulation, columnTotalWidth, columnWidthAccumulation, rowTotalHeight } = spreadsheetSkeleton;
|
|
19933
20517
|
if (!rowHeightAccumulation || !columnWidthAccumulation || columnTotalWidth === void 0 || rowTotalHeight === void 0 || !worksheet) return;
|
|
19934
20518
|
const scale = this._getScale(parentScale);
|
|
19935
|
-
const { viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
20519
|
+
const { fontRenderRanges, viewRanges = [], checkOutOfViewBound } = moreBoundsInfo;
|
|
19936
20520
|
const lastRowIndex = spreadsheetSkeleton.getRowCount() - 1;
|
|
19937
20521
|
const lastColIndex = spreadsheetSkeleton.getColumnCount() - 1;
|
|
19938
20522
|
const expandedViewRanges = viewRanges.map((range) => clampRange({
|
|
@@ -19940,43 +20524,51 @@ var Font = class extends SheetExtension {
|
|
|
19940
20524
|
startColumn: range.startColumn - 20,
|
|
19941
20525
|
endColumn: range.endColumn + 20
|
|
19942
20526
|
}, lastRowIndex, lastColIndex));
|
|
20527
|
+
const rangesToScan = (fontRenderRanges === null || fontRenderRanges === void 0 ? void 0 : fontRenderRanges.length) ? fontRenderRanges : expandedViewRanges;
|
|
19943
20528
|
const renderFontContext = {
|
|
19944
20529
|
ctx,
|
|
19945
20530
|
scale,
|
|
19946
20531
|
columnTotalWidth,
|
|
19947
20532
|
rowTotalHeight,
|
|
19948
|
-
viewRanges: expandedViewRanges,
|
|
20533
|
+
viewRanges: (fontRenderRanges === null || fontRenderRanges === void 0 ? void 0 : fontRenderRanges.length) ? viewRanges : expandedViewRanges,
|
|
19949
20534
|
checkOutOfViewBound: checkOutOfViewBound || true,
|
|
19950
20535
|
diffRanges,
|
|
19951
20536
|
spreadsheetSkeleton
|
|
19952
20537
|
};
|
|
19953
20538
|
ctx.save();
|
|
20539
|
+
const hasMerge = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
19954
20540
|
const uniqueMergeRanges = [];
|
|
19955
|
-
const mergeRangeIDSet = /* @__PURE__ */ new Set();
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
20541
|
+
const mergeRangeIDSet = hasMerge ? /* @__PURE__ */ new Set() : null;
|
|
20542
|
+
const spanModel = hasMerge ? spreadsheetSkeleton.worksheet.getSpanModel() : null;
|
|
20543
|
+
rangesToScan.forEach((range) => {
|
|
20544
|
+
if (hasMerge && spanModel && mergeRangeIDSet) spreadsheetSkeleton.worksheet.getMergedCellRange(range.startRow, range.startColumn, range.endRow, range.endColumn).forEach((mergeRange) => {
|
|
20545
|
+
const mergeRangeIndex = spanModel.getMergeDataIndex(mergeRange.startRow, mergeRange.startColumn);
|
|
19959
20546
|
if (!mergeRangeIDSet.has(mergeRangeIndex)) {
|
|
19960
20547
|
mergeRangeIDSet.add(mergeRangeIndex);
|
|
19961
20548
|
uniqueMergeRanges.push(mergeRange);
|
|
19962
20549
|
}
|
|
19963
20550
|
});
|
|
19964
|
-
|
|
19965
|
-
|
|
20551
|
+
const { startRow, endRow, startColumn, endColumn } = range;
|
|
20552
|
+
for (let row = startRow; row <= endRow; row++) for (let col = startColumn; col <= endColumn; col++) {
|
|
20553
|
+
const fontCache = fontMatrix.getValue(row, col);
|
|
20554
|
+
if (!fontCache) continue;
|
|
20555
|
+
if (spanModel && spanModel.getMergeDataIndex(row, col) !== -1) continue;
|
|
19966
20556
|
const cellInfo = spreadsheetSkeleton.getCellWithCoordByIndex(row, col, false);
|
|
19967
|
-
if (!cellInfo)
|
|
20557
|
+
if (!cellInfo) continue;
|
|
19968
20558
|
renderFontContext.cellInfo = cellInfo;
|
|
19969
|
-
this._renderFontEachCell(renderFontContext, row, col, fontMatrix);
|
|
19970
|
-
}
|
|
20559
|
+
this._renderFontEachCell(renderFontContext, row, col, fontMatrix, fontCache);
|
|
20560
|
+
}
|
|
19971
20561
|
});
|
|
19972
20562
|
uniqueMergeRanges.forEach((range) => {
|
|
20563
|
+
const fontCache = fontMatrix.getValue(range.startRow, range.startColumn);
|
|
20564
|
+
if (!fontCache) return;
|
|
19973
20565
|
renderFontContext.cellInfo = spreadsheetSkeleton.getCellWithCoordByIndex(range.startRow, range.startColumn, false);
|
|
19974
|
-
this._renderFontEachCell(renderFontContext, range.startRow, range.startColumn, fontMatrix);
|
|
20566
|
+
this._renderFontEachCell(renderFontContext, range.startRow, range.startColumn, fontMatrix, fontCache);
|
|
19975
20567
|
});
|
|
19976
20568
|
ctx.restore();
|
|
19977
20569
|
}
|
|
19978
|
-
_renderFontEachCell(renderFontCtx, row, col, fontMatrix) {
|
|
19979
|
-
var
|
|
20570
|
+
_renderFontEachCell(renderFontCtx, row, col, fontMatrix, cacheValue) {
|
|
20571
|
+
var _fontCache$cellData2;
|
|
19980
20572
|
const { ctx, viewRanges, diffRanges, spreadsheetSkeleton, cellInfo } = renderFontCtx;
|
|
19981
20573
|
const { startY, endY, startX, endX } = cellInfo;
|
|
19982
20574
|
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
@@ -19991,7 +20583,7 @@ var Font = class extends SheetExtension {
|
|
|
19991
20583
|
renderFontCtx.endX = mergeInfo.endX;
|
|
19992
20584
|
renderFontCtx.endY = mergeInfo.endY;
|
|
19993
20585
|
}
|
|
19994
|
-
const fontCache = fontMatrix.getValue(row, col);
|
|
20586
|
+
const fontCache = cacheValue !== null && cacheValue !== void 0 ? cacheValue : fontMatrix.getValue(row, col);
|
|
19995
20587
|
if (!fontCache) return true;
|
|
19996
20588
|
renderFontCtx.fontCache = fontCache;
|
|
19997
20589
|
const overflowRange = spreadsheetSkeleton.overflowCache.getValue(row, col);
|
|
@@ -20017,8 +20609,19 @@ var Font = class extends SheetExtension {
|
|
|
20017
20609
|
}
|
|
20018
20610
|
if (isAllColHidden) return true;
|
|
20019
20611
|
}
|
|
20020
|
-
|
|
20021
|
-
|
|
20612
|
+
if ((_fontCache$cellData2 = fontCache.cellData) === null || _fontCache$cellData2 === void 0 ? void 0 : _fontCache$cellData2.fontRenderExtension) {
|
|
20613
|
+
var _cellData$fontRenderE;
|
|
20614
|
+
const cellData = spreadsheetSkeleton.worksheet.getCell(row, col) || {};
|
|
20615
|
+
if (cellData === null || cellData === void 0 || (_cellData$fontRenderE = cellData.fontRenderExtension) === null || _cellData$fontRenderE === void 0 ? void 0 : _cellData$fontRenderE.isSkip) return true;
|
|
20616
|
+
}
|
|
20617
|
+
if (this._renderPlainTextWithoutClip(ctx, renderFontCtx, fontCache)) {
|
|
20618
|
+
renderFontCtx.startX = 0;
|
|
20619
|
+
renderFontCtx.startY = 0;
|
|
20620
|
+
renderFontCtx.endX = 0;
|
|
20621
|
+
renderFontCtx.endY = 0;
|
|
20622
|
+
renderFontCtx.overflowRectangle = null;
|
|
20623
|
+
return false;
|
|
20624
|
+
}
|
|
20022
20625
|
ctx.save();
|
|
20023
20626
|
ctx.beginPath();
|
|
20024
20627
|
renderFontCtx.overflowRectangle = overflowRange;
|
|
@@ -20026,7 +20629,6 @@ var Font = class extends SheetExtension {
|
|
|
20026
20629
|
ctx.translate(renderFontCtx.startX + FIX_ONE_PIXEL_BLUR_OFFSET, renderFontCtx.startY + FIX_ONE_PIXEL_BLUR_OFFSET);
|
|
20027
20630
|
if (fontCache.documentSkeleton) this._renderDocuments(ctx, row, col, renderFontCtx, spreadsheetSkeleton.overflowCache);
|
|
20028
20631
|
else this._renderText(ctx, row, col, renderFontCtx, spreadsheetSkeleton.overflowCache);
|
|
20029
|
-
ctx.closePath();
|
|
20030
20632
|
ctx.restore();
|
|
20031
20633
|
if (fontCache.documentSkeleton) {
|
|
20032
20634
|
var _documentDataModel$ge;
|
|
@@ -20046,15 +20648,49 @@ var Font = class extends SheetExtension {
|
|
|
20046
20648
|
renderFontCtx.overflowRectangle = null;
|
|
20047
20649
|
return false;
|
|
20048
20650
|
}
|
|
20651
|
+
_renderPlainTextWithoutClip(ctx, renderFontCtx, fontCache) {
|
|
20652
|
+
var _fontCache$style, _fontCache$style2, _fontCache$style$pd, _fontCache$style3, _padding$l, _padding$r, _padding$t, _padding$b, _fontCache$displayTex, _fontCache$style4;
|
|
20653
|
+
const { cellData, documentSkeleton, textFitsCurrentCell, vertexAngle = 0, centerAngle = 0, wrapStrategy } = fontCache;
|
|
20654
|
+
if (!textFitsCurrentCell) return false;
|
|
20655
|
+
if (documentSkeleton) return false;
|
|
20656
|
+
if (vertexAngle !== 0 || centerAngle !== 0) return false;
|
|
20657
|
+
if (wrapStrategy === WrapStrategy.WRAP) return false;
|
|
20658
|
+
if (needsFontRenderExtensionBounds(fontCache)) return false;
|
|
20659
|
+
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;
|
|
20660
|
+
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return false;
|
|
20661
|
+
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;
|
|
20662
|
+
const paddingLeft = (_padding$l = padding.l) !== null && _padding$l !== void 0 ? _padding$l : DEFAULT_PADDING_DATA.l;
|
|
20663
|
+
const paddingRight = (_padding$r = padding.r) !== null && _padding$r !== void 0 ? _padding$r : DEFAULT_PADDING_DATA.r;
|
|
20664
|
+
const paddingTop = (_padding$t = padding.t) !== null && _padding$t !== void 0 ? _padding$t : DEFAULT_PADDING_DATA.t;
|
|
20665
|
+
const paddingBottom = (_padding$b = padding.b) !== null && _padding$b !== void 0 ? _padding$b : DEFAULT_PADDING_DATA.b;
|
|
20666
|
+
const text = (_fontCache$displayTex = fontCache.displayText) !== null && _fontCache$displayTex !== void 0 ? _fontCache$displayTex : getDisplayValueFromCell(cellData);
|
|
20667
|
+
const { startX, startY, endX, endY } = renderFontCtx;
|
|
20668
|
+
const cellWidth = endX - startX - paddingLeft - paddingRight;
|
|
20669
|
+
const cellHeight = endY - startY - paddingTop - paddingBottom;
|
|
20670
|
+
const hAlign = getResolvedRenderHorizontalAlign(fontCache, cellData);
|
|
20671
|
+
Text.drawPlainWith(ctx, {
|
|
20672
|
+
text,
|
|
20673
|
+
fontStyle: fontCache.fontString,
|
|
20674
|
+
hAlign,
|
|
20675
|
+
vAlign: fontCache.verticalAlign,
|
|
20676
|
+
width: cellWidth,
|
|
20677
|
+
height: cellHeight,
|
|
20678
|
+
left: startX + FIX_ONE_PIXEL_BLUR_OFFSET + paddingLeft,
|
|
20679
|
+
top: startY + FIX_ONE_PIXEL_BLUR_OFFSET + paddingTop,
|
|
20680
|
+
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,
|
|
20681
|
+
cellValueType: cellData.t
|
|
20682
|
+
});
|
|
20683
|
+
return true;
|
|
20684
|
+
}
|
|
20049
20685
|
_renderImages(ctx, fontsConfig, startX, startY, endX, endY) {
|
|
20050
|
-
var _fontsConfig$style, _padding$
|
|
20686
|
+
var _fontsConfig$style, _padding$l2, _padding$r2, _padding$t2, _padding$b2, _getSkeletonData;
|
|
20051
20687
|
const { documentSkeleton, verticalAlign, horizontalAlign } = fontsConfig;
|
|
20052
20688
|
const PADDING = 2;
|
|
20053
20689
|
const padding = (_fontsConfig$style = fontsConfig.style) === null || _fontsConfig$style === void 0 ? void 0 : _fontsConfig$style.pd;
|
|
20054
|
-
const paddingLeft = (_padding$
|
|
20055
|
-
const paddingRight = (_padding$
|
|
20056
|
-
const paddingTop = (_padding$
|
|
20057
|
-
const paddingBottom = (_padding$
|
|
20690
|
+
const paddingLeft = (_padding$l2 = padding === null || padding === void 0 ? void 0 : padding.l) !== null && _padding$l2 !== void 0 ? _padding$l2 : PADDING;
|
|
20691
|
+
const paddingRight = (_padding$r2 = padding === null || padding === void 0 ? void 0 : padding.r) !== null && _padding$r2 !== void 0 ? _padding$r2 : PADDING;
|
|
20692
|
+
const paddingTop = (_padding$t2 = padding === null || padding === void 0 ? void 0 : padding.t) !== null && _padding$t2 !== void 0 ? _padding$t2 : PADDING;
|
|
20693
|
+
const paddingBottom = (_padding$b2 = padding === null || padding === void 0 ? void 0 : padding.b) !== null && _padding$b2 !== void 0 ? _padding$b2 : PADDING;
|
|
20058
20694
|
const contentStartX = startX + paddingLeft;
|
|
20059
20695
|
const contentEndX = endX - paddingRight;
|
|
20060
20696
|
const contentStartY = startY + paddingTop;
|
|
@@ -20124,7 +20760,7 @@ var Font = class extends SheetExtension {
|
|
|
20124
20760
|
* @param fontCache
|
|
20125
20761
|
*/
|
|
20126
20762
|
_clipByRenderBounds(renderFontContext, row, col, padding = 0) {
|
|
20127
|
-
var _fontCache$cellData$f, _fontCache$
|
|
20763
|
+
var _fontCache$cellData$f, _fontCache$cellData3, _fontCache$cellData$f2, _fontCache$cellData4;
|
|
20128
20764
|
const { ctx, scale, overflowRectangle, fontCache } = renderFontContext;
|
|
20129
20765
|
let { startX, endX, startY, endY } = renderFontContext;
|
|
20130
20766
|
const { horizontalAlign = 0, vertexAngle = 0, centerAngle = 0 } = fontCache;
|
|
@@ -20133,8 +20769,8 @@ var Font = class extends SheetExtension {
|
|
|
20133
20769
|
if (centerAngle === 90 && vertexAngle === 90) horizontalAlignOverFlow = HorizontalAlign.CENTER;
|
|
20134
20770
|
else if (vertexAngle > 0 && vertexAngle !== 90 || vertexAngle === -90) horizontalAlignOverFlow = HorizontalAlign.RIGHT;
|
|
20135
20771
|
}
|
|
20136
|
-
const rightOffset = (_fontCache$cellData$f = fontCache === null || fontCache === void 0 || (_fontCache$
|
|
20137
|
-
const leftOffset = (_fontCache$cellData$f2 = fontCache === null || fontCache === void 0 || (_fontCache$
|
|
20772
|
+
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;
|
|
20773
|
+
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;
|
|
20138
20774
|
let isOverflow = true;
|
|
20139
20775
|
if (vertexAngle === 0) {
|
|
20140
20776
|
startX = startX + leftOffset;
|
|
@@ -20166,26 +20802,22 @@ var Font = class extends SheetExtension {
|
|
|
20166
20802
|
renderFontContext.endY = endY;
|
|
20167
20803
|
}
|
|
20168
20804
|
_renderText(ctx, row, col, renderFontCtx, overflowCache) {
|
|
20169
|
-
var _fontCache$style$
|
|
20805
|
+
var _fontCache$style$pd2, _fontCache$style5, _padding$l3, _padding$r3, _padding$t3, _padding$b3, _fontCache$displayTex2, _fontCache$style6, _fontCache$style7, _fontCache$style8, _fontCache$style9;
|
|
20170
20806
|
const { fontCache } = renderFontCtx;
|
|
20171
20807
|
if (!fontCache) return;
|
|
20172
|
-
const padding = (_fontCache$style$
|
|
20173
|
-
const paddingLeft = (_padding$
|
|
20174
|
-
const paddingRight = (_padding$
|
|
20175
|
-
const paddingTop = (_padding$
|
|
20176
|
-
const paddingBottom = (_padding$
|
|
20808
|
+
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;
|
|
20809
|
+
const paddingLeft = (_padding$l3 = padding.l) !== null && _padding$l3 !== void 0 ? _padding$l3 : DEFAULT_PADDING_DATA.l;
|
|
20810
|
+
const paddingRight = (_padding$r3 = padding.r) !== null && _padding$r3 !== void 0 ? _padding$r3 : DEFAULT_PADDING_DATA.r;
|
|
20811
|
+
const paddingTop = (_padding$t3 = padding.t) !== null && _padding$t3 !== void 0 ? _padding$t3 : DEFAULT_PADDING_DATA.t;
|
|
20812
|
+
const paddingBottom = (_padding$b3 = padding.b) !== null && _padding$b3 !== void 0 ? _padding$b3 : DEFAULT_PADDING_DATA.b;
|
|
20177
20813
|
const { vertexAngle = 0, wrapStrategy, cellData } = fontCache;
|
|
20178
20814
|
if ((cellData === null || cellData === void 0 ? void 0 : cellData.v) === void 0 || (cellData === null || cellData === void 0 ? void 0 : cellData.v) === null) return;
|
|
20179
|
-
const text = getDisplayValueFromCell(cellData);
|
|
20815
|
+
const text = (_fontCache$displayTex2 = fontCache.displayText) !== null && _fontCache$displayTex2 !== void 0 ? _fontCache$displayTex2 : getDisplayValueFromCell(cellData);
|
|
20180
20816
|
const { startX, startY, endX, endY } = renderFontCtx;
|
|
20181
20817
|
const cellWidth = endX - startX - paddingLeft - paddingRight;
|
|
20182
20818
|
const cellHeight = endY - startY - paddingTop - paddingBottom;
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
if (cellData.t === CellValueType.NUMBER || !Tools.isDefine(cellData.t) && typeof cellData.v === "number") hAlign = HorizontalAlign.RIGHT;
|
|
20186
|
-
else if (cellData.t === CellValueType.BOOLEAN) hAlign = HorizontalAlign.CENTER;
|
|
20187
|
-
}
|
|
20188
|
-
Text.drawWith(ctx, {
|
|
20819
|
+
const hAlign = getResolvedRenderHorizontalAlign(fontCache, cellData);
|
|
20820
|
+
const textProps = {
|
|
20189
20821
|
text,
|
|
20190
20822
|
fontStyle: fontCache.fontString,
|
|
20191
20823
|
warp: wrapStrategy === WrapStrategy.WRAP && vertexAngle === 0,
|
|
@@ -20195,12 +20827,17 @@ var Font = class extends SheetExtension {
|
|
|
20195
20827
|
height: cellHeight,
|
|
20196
20828
|
left: paddingLeft,
|
|
20197
20829
|
top: paddingTop,
|
|
20198
|
-
color: (_fontCache$
|
|
20199
|
-
strokeLine: Boolean((_fontCache$
|
|
20200
|
-
underline: Boolean((_fontCache$
|
|
20201
|
-
underlineType: (_fontCache$
|
|
20830
|
+
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,
|
|
20831
|
+
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),
|
|
20832
|
+
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),
|
|
20833
|
+
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,
|
|
20202
20834
|
cellValueType: cellData.t
|
|
20203
|
-
}
|
|
20835
|
+
};
|
|
20836
|
+
if (!textProps.warp && !textProps.strokeLine && !textProps.underline) {
|
|
20837
|
+
Text.drawPlainWith(ctx, textProps);
|
|
20838
|
+
return;
|
|
20839
|
+
}
|
|
20840
|
+
Text.drawWith(ctx, textProps);
|
|
20204
20841
|
}
|
|
20205
20842
|
_renderDocuments(ctx, row, col, renderFontCtx, overflowCache) {
|
|
20206
20843
|
const documents = this.getDocuments();
|
|
@@ -20270,6 +20907,15 @@ const stringifyRange = (range) => {
|
|
|
20270
20907
|
const { startRow, endRow, startColumn, endColumn } = range;
|
|
20271
20908
|
return `${startRow}-${endRow}-${startColumn}-${endColumn}`;
|
|
20272
20909
|
};
|
|
20910
|
+
function drawTriangleMarker(ctx, color, x, y, x2, y2, x3, y3) {
|
|
20911
|
+
ctx.fillStyle = color;
|
|
20912
|
+
ctx.beginPath();
|
|
20913
|
+
ctx.moveTo(x, y);
|
|
20914
|
+
ctx.lineTo(x2, y2);
|
|
20915
|
+
ctx.lineTo(x3, y3);
|
|
20916
|
+
ctx.closePath();
|
|
20917
|
+
ctx.fill();
|
|
20918
|
+
}
|
|
20273
20919
|
var Marker = class extends SheetExtension {
|
|
20274
20920
|
constructor(..._args) {
|
|
20275
20921
|
super(..._args);
|
|
@@ -20281,11 +20927,15 @@ var Marker = class extends SheetExtension {
|
|
|
20281
20927
|
const { worksheet, rowColumnSegment } = skeleton;
|
|
20282
20928
|
if (!worksheet) return;
|
|
20283
20929
|
const mergeCellRendered = /* @__PURE__ */ new Set();
|
|
20284
|
-
(
|
|
20285
|
-
|
|
20930
|
+
const renderRanges = (diffRanges === null || diffRanges === void 0 ? void 0 : diffRanges.length) ? diffRanges : [rowColumnSegment];
|
|
20931
|
+
const hasMerge = worksheet.getMergeData().length > 0;
|
|
20932
|
+
renderRanges.forEach((range) => {
|
|
20933
|
+
const { startRow, endRow, startColumn, endColumn } = range;
|
|
20934
|
+
for (let row = startRow; row <= endRow; row++) for (let col = startColumn; col <= endColumn; col++) {
|
|
20286
20935
|
var _cellData$markers, _cellData$markers2, _cellData$markers3, _cellData$markers4;
|
|
20287
|
-
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col))
|
|
20936
|
+
if (!worksheet.getRowVisible(row) || !worksheet.getColVisible(col)) continue;
|
|
20288
20937
|
let cellData = worksheet.getCell(row, col);
|
|
20938
|
+
if (!hasMerge && !(cellData === null || cellData === void 0 ? void 0 : cellData.markers)) continue;
|
|
20289
20939
|
const cellInfo = skeleton.getCellWithCoordByIndex(row, col, false);
|
|
20290
20940
|
const { isMerged, isMergedMainCell, mergeInfo } = cellInfo;
|
|
20291
20941
|
let { startY, endY, startX, endX } = cellInfo;
|
|
@@ -20302,74 +20952,38 @@ var Marker = class extends SheetExtension {
|
|
|
20302
20952
|
};
|
|
20303
20953
|
cellData = worksheet.getCell(mainCell.row, mainCell.col);
|
|
20304
20954
|
}
|
|
20305
|
-
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges))
|
|
20955
|
+
if (!this.isRenderDiffRangesByRow(mergeInfo.startRow, mergeInfo.endRow, diffRanges)) continue;
|
|
20306
20956
|
if (cellInfo.isMerged || cellInfo.isMergedMainCell) {
|
|
20307
20957
|
const rangeStr = stringifyRange(mergeInfo);
|
|
20308
|
-
if (mergeCellRendered.has(rangeStr))
|
|
20958
|
+
if (mergeCellRendered.has(rangeStr)) continue;
|
|
20309
20959
|
mergeCellRendered.add(rangeStr);
|
|
20310
20960
|
}
|
|
20311
|
-
if (!cellData)
|
|
20961
|
+
if (!cellData) continue;
|
|
20312
20962
|
if ((_cellData$markers = cellData.markers) === null || _cellData$markers === void 0 ? void 0 : _cellData$markers.tr) {
|
|
20313
|
-
ctx.save();
|
|
20314
20963
|
const marker = cellData.markers.tr;
|
|
20315
20964
|
const x = endX;
|
|
20316
20965
|
const y = startY;
|
|
20317
|
-
ctx.
|
|
20318
|
-
ctx.moveTo(x, y);
|
|
20319
|
-
ctx.beginPath();
|
|
20320
|
-
ctx.lineTo(x - marker.size, y);
|
|
20321
|
-
ctx.lineTo(x, y + marker.size);
|
|
20322
|
-
ctx.lineTo(x, y);
|
|
20323
|
-
ctx.closePath();
|
|
20324
|
-
ctx.fill();
|
|
20325
|
-
ctx.restore();
|
|
20966
|
+
drawTriangleMarker(ctx, marker.color, x, y, x - marker.size, y, x, y + marker.size);
|
|
20326
20967
|
}
|
|
20327
20968
|
if ((_cellData$markers2 = cellData.markers) === null || _cellData$markers2 === void 0 ? void 0 : _cellData$markers2.tl) {
|
|
20328
|
-
ctx.save();
|
|
20329
20969
|
const marker = cellData.markers.tl;
|
|
20330
20970
|
const x = startX;
|
|
20331
20971
|
const y = startY;
|
|
20332
|
-
ctx.
|
|
20333
|
-
ctx.moveTo(x, y);
|
|
20334
|
-
ctx.beginPath();
|
|
20335
|
-
ctx.lineTo(x + marker.size, y);
|
|
20336
|
-
ctx.lineTo(x, y + marker.size);
|
|
20337
|
-
ctx.lineTo(x, y);
|
|
20338
|
-
ctx.closePath();
|
|
20339
|
-
ctx.fill();
|
|
20340
|
-
ctx.restore();
|
|
20972
|
+
drawTriangleMarker(ctx, marker.color, x, y, x + marker.size, y, x, y + marker.size);
|
|
20341
20973
|
}
|
|
20342
20974
|
if ((_cellData$markers3 = cellData.markers) === null || _cellData$markers3 === void 0 ? void 0 : _cellData$markers3.br) {
|
|
20343
|
-
ctx.save();
|
|
20344
20975
|
const marker = cellData.markers.br;
|
|
20345
20976
|
const x = endX;
|
|
20346
20977
|
const y = endY;
|
|
20347
|
-
ctx.
|
|
20348
|
-
ctx.moveTo(x, y);
|
|
20349
|
-
ctx.beginPath();
|
|
20350
|
-
ctx.lineTo(x - marker.size, y);
|
|
20351
|
-
ctx.lineTo(x, y - marker.size);
|
|
20352
|
-
ctx.lineTo(x, y);
|
|
20353
|
-
ctx.closePath();
|
|
20354
|
-
ctx.fill();
|
|
20355
|
-
ctx.restore();
|
|
20978
|
+
drawTriangleMarker(ctx, marker.color, x, y, x - marker.size, y, x, y - marker.size);
|
|
20356
20979
|
}
|
|
20357
20980
|
if ((_cellData$markers4 = cellData.markers) === null || _cellData$markers4 === void 0 ? void 0 : _cellData$markers4.bl) {
|
|
20358
|
-
ctx.save();
|
|
20359
20981
|
const marker = cellData.markers.bl;
|
|
20360
20982
|
const x = startX;
|
|
20361
20983
|
const y = endY;
|
|
20362
|
-
ctx.
|
|
20363
|
-
ctx.moveTo(x, y);
|
|
20364
|
-
ctx.beginPath();
|
|
20365
|
-
ctx.lineTo(x + marker.size, y);
|
|
20366
|
-
ctx.lineTo(x, y - marker.size);
|
|
20367
|
-
ctx.lineTo(x, y);
|
|
20368
|
-
ctx.closePath();
|
|
20369
|
-
ctx.fill();
|
|
20370
|
-
ctx.restore();
|
|
20984
|
+
drawTriangleMarker(ctx, marker.color, x, y, x + marker.size, y, x, y - marker.size);
|
|
20371
20985
|
}
|
|
20372
|
-
}
|
|
20986
|
+
}
|
|
20373
20987
|
});
|
|
20374
20988
|
}
|
|
20375
20989
|
};
|
|
@@ -22478,6 +23092,7 @@ const MIN_THUMB_SIZE = 17;
|
|
|
22478
23092
|
const DEFAULT_TRACK_SIZE = 10;
|
|
22479
23093
|
const DEFAULT_THUMB_MARGIN = 2;
|
|
22480
23094
|
const HOVER_THUMB_MARGIN = 1;
|
|
23095
|
+
const BAR_DRAG_SCROLL_THROTTLE_MS = 32;
|
|
22481
23096
|
var ScrollBar = class ScrollBar extends Disposable {
|
|
22482
23097
|
constructor(view, props) {
|
|
22483
23098
|
super();
|
|
@@ -22500,6 +23115,10 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
22500
23115
|
_defineProperty(this, "_lastY", -1);
|
|
22501
23116
|
_defineProperty(this, "_isHorizonMove", false);
|
|
22502
23117
|
_defineProperty(this, "_isVerticalMove", false);
|
|
23118
|
+
_defineProperty(this, "_pendingBarDeltaX", 0);
|
|
23119
|
+
_defineProperty(this, "_pendingBarDeltaY", 0);
|
|
23120
|
+
_defineProperty(this, "_pendingBarScrollFrameId", null);
|
|
23121
|
+
_defineProperty(this, "_pendingBarScrollThrottleId", null);
|
|
22503
23122
|
_defineProperty(this, "_horizonPointerMoveSub", void 0);
|
|
22504
23123
|
_defineProperty(this, "_horizonPointerUpSub", void 0);
|
|
22505
23124
|
_defineProperty(this, "_verticalPointerMoveSub", void 0);
|
|
@@ -22637,6 +23256,7 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
22637
23256
|
dispose() {
|
|
22638
23257
|
var _this$horizonScrollTr, _this$horizonThumbRec3, _this$verticalScrollT, _this$verticalThumbRe3, _this$placeholderBarR, _this$_horizonPointer, _this$_horizonPointer2, _this$_verticalPointe, _this$_verticalPointe2;
|
|
22639
23258
|
super.dispose();
|
|
23259
|
+
this._flushPendingBarScroll();
|
|
22640
23260
|
(_this$horizonScrollTr = this.horizonScrollTrack) === null || _this$horizonScrollTr === void 0 || _this$horizonScrollTr.dispose();
|
|
22641
23261
|
(_this$horizonThumbRec3 = this.horizonThumbRect) === null || _this$horizonThumbRec3 === void 0 || _this$horizonThumbRec3.dispose();
|
|
22642
23262
|
(_this$verticalScrollT = this.verticalScrollTrack) === null || _this$verticalScrollT === void 0 || _this$verticalScrollT.dispose();
|
|
@@ -22655,6 +23275,47 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
22655
23275
|
this._mainScene = null;
|
|
22656
23276
|
this._viewport.removeScrollBar();
|
|
22657
23277
|
}
|
|
23278
|
+
_scheduleBarScrollDelta(delta) {
|
|
23279
|
+
var _delta$x, _delta$y;
|
|
23280
|
+
this._pendingBarDeltaX += (_delta$x = delta.x) !== null && _delta$x !== void 0 ? _delta$x : 0;
|
|
23281
|
+
this._pendingBarDeltaY += (_delta$y = delta.y) !== null && _delta$y !== void 0 ? _delta$y : 0;
|
|
23282
|
+
if (this._pendingBarScrollFrameId !== null || this._pendingBarScrollThrottleId !== null) return;
|
|
23283
|
+
this._requestPendingBarScrollFrame();
|
|
23284
|
+
}
|
|
23285
|
+
_requestPendingBarScrollFrame() {
|
|
23286
|
+
this._pendingBarScrollFrameId = requestAnimationFrame(() => {
|
|
23287
|
+
this._pendingBarScrollFrameId = null;
|
|
23288
|
+
this._applyPendingBarScroll({ isBarDragging: true });
|
|
23289
|
+
if (!this._isHorizonMove && !this._isVerticalMove) return;
|
|
23290
|
+
this._pendingBarScrollThrottleId = window.setTimeout(() => {
|
|
23291
|
+
this._pendingBarScrollThrottleId = null;
|
|
23292
|
+
if (this._pendingBarDeltaX !== 0 || this._pendingBarDeltaY !== 0) this._requestPendingBarScrollFrame();
|
|
23293
|
+
}, BAR_DRAG_SCROLL_THROTTLE_MS);
|
|
23294
|
+
});
|
|
23295
|
+
}
|
|
23296
|
+
_flushPendingBarScroll(isBarDragEnd = false) {
|
|
23297
|
+
if (this._pendingBarScrollFrameId !== null) {
|
|
23298
|
+
cancelAnimationFrame(this._pendingBarScrollFrameId);
|
|
23299
|
+
this._pendingBarScrollFrameId = null;
|
|
23300
|
+
}
|
|
23301
|
+
if (this._pendingBarScrollThrottleId !== null) {
|
|
23302
|
+
clearTimeout(this._pendingBarScrollThrottleId);
|
|
23303
|
+
this._pendingBarScrollThrottleId = null;
|
|
23304
|
+
}
|
|
23305
|
+
return this._applyPendingBarScroll({ isBarDragEnd });
|
|
23306
|
+
}
|
|
23307
|
+
_applyPendingBarScroll(options) {
|
|
23308
|
+
const x = this._pendingBarDeltaX;
|
|
23309
|
+
const y = this._pendingBarDeltaY;
|
|
23310
|
+
if (x === 0 && y === 0) return false;
|
|
23311
|
+
this._pendingBarDeltaX = 0;
|
|
23312
|
+
this._pendingBarDeltaY = 0;
|
|
23313
|
+
this._viewport.scrollByBarDeltaValue({
|
|
23314
|
+
...x === 0 ? null : { x },
|
|
23315
|
+
...y === 0 ? null : { y }
|
|
23316
|
+
}, true, options);
|
|
23317
|
+
return true;
|
|
23318
|
+
}
|
|
22658
23319
|
render(ctx, left = 0, top = 0) {
|
|
22659
23320
|
const { scrollX, scrollY } = this._viewport;
|
|
22660
23321
|
ctx.save();
|
|
@@ -22859,12 +23520,14 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
22859
23520
|
var _mainScene$getEngine;
|
|
22860
23521
|
const e = evt;
|
|
22861
23522
|
if (!this._isVerticalMove) return;
|
|
22862
|
-
this.
|
|
23523
|
+
this._scheduleBarScrollDelta({ y: e.offsetY - this._lastY });
|
|
22863
23524
|
this._lastY = e.offsetY;
|
|
22864
23525
|
(_mainScene$getEngine = mainScene.getEngine()) === null || _mainScene$getEngine === void 0 || _mainScene$getEngine.setCapture();
|
|
22865
23526
|
});
|
|
22866
23527
|
this._verticalPointerUpSub = mainScene.onPointerUp$.subscribeEvent((_evt, _state) => {
|
|
23528
|
+
if (!this._isVerticalMove) return;
|
|
22867
23529
|
const srcElement = this.verticalThumbRect;
|
|
23530
|
+
if (!this._flushPendingBarScroll(true)) this._viewport.scrollByBarDeltaValue({ y: 0 }, true, { isBarDragEnd: true });
|
|
22868
23531
|
this._isVerticalMove = false;
|
|
22869
23532
|
mainScene.releaseCapturedObject();
|
|
22870
23533
|
mainScene.enableObjectsEvent();
|
|
@@ -22933,12 +23596,14 @@ var ScrollBar = class ScrollBar extends Disposable {
|
|
|
22933
23596
|
var _mainScene$getEngine2;
|
|
22934
23597
|
const e = evt;
|
|
22935
23598
|
if (!this._isHorizonMove) return;
|
|
22936
|
-
this.
|
|
23599
|
+
this._scheduleBarScrollDelta({ x: e.offsetX - this._lastX });
|
|
22937
23600
|
this._lastX = e.offsetX;
|
|
22938
23601
|
(_mainScene$getEngine2 = mainScene.getEngine()) === null || _mainScene$getEngine2 === void 0 || _mainScene$getEngine2.setCapture();
|
|
22939
23602
|
});
|
|
22940
23603
|
this._horizonPointerUpSub = mainScene.onPointerUp$.subscribeEvent((evt, state) => {
|
|
22941
23604
|
var _this$horizonThumbRec11;
|
|
23605
|
+
if (!this._isHorizonMove) return;
|
|
23606
|
+
if (!this._flushPendingBarScroll(true)) this._viewport.scrollByBarDeltaValue({ x: 0 }, true, { isBarDragEnd: true });
|
|
22942
23607
|
this._isHorizonMove = false;
|
|
22943
23608
|
mainScene.releaseCapturedObject();
|
|
22944
23609
|
mainScene.enableObjectsEvent();
|
|
@@ -23154,7 +23819,7 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
23154
23819
|
const { vertexAngle, centerAngle } = renderConfig !== null && renderConfig !== void 0 ? renderConfig : {};
|
|
23155
23820
|
const VERTICAL_DEG = 90;
|
|
23156
23821
|
const isVertical = vertexAngle === VERTICAL_DEG && centerAngle === VERTICAL_DEG;
|
|
23157
|
-
if (isVertical && !hasCJK(content)) {
|
|
23822
|
+
if (isVertical && !cjk.hasCJK(content)) {
|
|
23158
23823
|
ctx.save();
|
|
23159
23824
|
ctx.translate(spanStartPoint.x + centerPoint.x, spanStartPoint.y + centerPoint.y);
|
|
23160
23825
|
ctx.rotate(Math.PI / 2);
|
|
@@ -23676,7 +24341,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
23676
24341
|
ctx.restore();
|
|
23677
24342
|
}
|
|
23678
24343
|
_drawBorderBottom(ctx, page, line, left = 0, top = 0) {
|
|
23679
|
-
var _line$borderBottom$pa, _line$borderBottom,
|
|
24344
|
+
var _line$borderBottom$pa, _line$borderBottom, _border$width, _border$color$rgb;
|
|
23680
24345
|
if (this._drawLiquid == null) return;
|
|
23681
24346
|
let { x, y } = this._drawLiquid;
|
|
23682
24347
|
const { pageWidth, marginLeft, marginRight, marginTop } = page;
|
|
@@ -23685,8 +24350,10 @@ var Documents = class Documents extends DocComponent {
|
|
|
23685
24350
|
y -= line.paddingTop;
|
|
23686
24351
|
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);
|
|
23687
24352
|
ctx.save();
|
|
23688
|
-
|
|
23689
|
-
ctx.
|
|
24353
|
+
const border = line.borderBottom;
|
|
24354
|
+
ctx.setLineWidthByPrecision(Math.max(0, (_border$width = border === null || border === void 0 ? void 0 : border.width) !== null && _border$width !== void 0 ? _border$width : 1));
|
|
24355
|
+
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";
|
|
24356
|
+
setDocsBorderDash(ctx, border === null || border === void 0 ? void 0 : border.dashStyle);
|
|
23690
24357
|
drawLineByBorderType(ctx, "b", 0, {
|
|
23691
24358
|
startX: x,
|
|
23692
24359
|
startY: y,
|
|
@@ -23848,21 +24515,21 @@ var Documents = class Documents extends DocComponent {
|
|
|
23848
24515
|
return DEFAULT_BORDER_COLOR;
|
|
23849
24516
|
}
|
|
23850
24517
|
_isDrawableTableCellBorder(border) {
|
|
23851
|
-
var _border$width$v, _border$
|
|
24518
|
+
var _border$width$v, _border$width2, _border$color$rgb2, _border$color;
|
|
23852
24519
|
if (!border) return false;
|
|
23853
|
-
const lineWidth = (_border$width$v = (_border$
|
|
23854
|
-
const color = (_border$color$
|
|
24520
|
+
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;
|
|
24521
|
+
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;
|
|
23855
24522
|
return lineWidth > 0 && color !== "transparent";
|
|
23856
24523
|
}
|
|
23857
24524
|
_drawTableCellBorder(ctx, border, type, position) {
|
|
23858
|
-
var _border$width$v2, _border$
|
|
24525
|
+
var _border$width$v2, _border$width3, _border$color$rgb3, _border$color2;
|
|
23859
24526
|
if (!border) return;
|
|
23860
|
-
const lineWidth = (_border$width$v2 = (_border$
|
|
23861
|
-
const color = (_border$color$
|
|
24527
|
+
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;
|
|
24528
|
+
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;
|
|
23862
24529
|
if (lineWidth <= 0 || color === "transparent") return;
|
|
23863
24530
|
ctx.save();
|
|
23864
24531
|
ctx.setLineWidthByPrecision(lineWidth);
|
|
23865
|
-
|
|
24532
|
+
setDocsBorderDash(ctx, border.dashStyle);
|
|
23866
24533
|
ctx.strokeStyle = color;
|
|
23867
24534
|
drawLineByBorderType(ctx, type, 0, position);
|
|
23868
24535
|
ctx.restore();
|
|
@@ -23992,7 +24659,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
23992
24659
|
});
|
|
23993
24660
|
}
|
|
23994
24661
|
};
|
|
23995
|
-
function
|
|
24662
|
+
function setDocsBorderDash(ctx, dashStyle) {
|
|
23996
24663
|
if (dashStyle === DashStyleType.DOT) {
|
|
23997
24664
|
ctx.setLineDash([2]);
|
|
23998
24665
|
return;
|
|
@@ -24038,6 +24705,85 @@ function rectByPrecisionBounds(ctx, x, y, width, height) {
|
|
|
24038
24705
|
//#endregion
|
|
24039
24706
|
//#region src/components/sheets/spreadsheet.ts
|
|
24040
24707
|
const OBJECT_KEY = "__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__";
|
|
24708
|
+
function pushSparseCellRange(ranges, row, col) {
|
|
24709
|
+
const last = ranges[ranges.length - 1];
|
|
24710
|
+
if (last && last.startRow === row && last.endRow === row && last.endColumn + 1 === col) {
|
|
24711
|
+
last.endColumn = col;
|
|
24712
|
+
return;
|
|
24713
|
+
}
|
|
24714
|
+
ranges.push({
|
|
24715
|
+
startRow: row,
|
|
24716
|
+
endRow: row,
|
|
24717
|
+
startColumn: col,
|
|
24718
|
+
endColumn: col
|
|
24719
|
+
});
|
|
24720
|
+
}
|
|
24721
|
+
function scanSparseExtensionFeatures(spreadsheetSkeleton, ranges) {
|
|
24722
|
+
const { worksheet } = spreadsheetSkeleton;
|
|
24723
|
+
if (!worksheet || !ranges.length || worksheet.getMergeData().length > 0) return null;
|
|
24724
|
+
const flags = {
|
|
24725
|
+
hasCustomRender: false,
|
|
24726
|
+
hasMarkers: false,
|
|
24727
|
+
hasSelectionProtection: false,
|
|
24728
|
+
customRenderRanges: [],
|
|
24729
|
+
markerRanges: [],
|
|
24730
|
+
selectionProtectionRanges: []
|
|
24731
|
+
};
|
|
24732
|
+
for (const range of ranges) for (let row = range.startRow; row <= range.endRow; row++) {
|
|
24733
|
+
if (!worksheet.getRowVisible(row)) continue;
|
|
24734
|
+
for (let col = range.startColumn; col <= range.endColumn; col++) {
|
|
24735
|
+
var _spreadsheetSkeleton$, _cell$customRender, _cell$selectionProtec;
|
|
24736
|
+
if (!worksheet.getColVisible(col)) continue;
|
|
24737
|
+
const cachedCell = (_spreadsheetSkeleton$ = spreadsheetSkeleton.stylesCache.fontMatrix.getValue(row, col)) === null || _spreadsheetSkeleton$ === void 0 ? void 0 : _spreadsheetSkeleton$.cellData;
|
|
24738
|
+
const cell = cachedCell !== null && cachedCell !== void 0 ? cachedCell : worksheet.getCell(row, col);
|
|
24739
|
+
if (!cell) continue;
|
|
24740
|
+
if ((_cell$customRender = cell.customRender) === null || _cell$customRender === void 0 ? void 0 : _cell$customRender.length) {
|
|
24741
|
+
flags.hasCustomRender = true;
|
|
24742
|
+
pushSparseCellRange(flags.customRenderRanges, row, col);
|
|
24743
|
+
}
|
|
24744
|
+
if (cell.markers) {
|
|
24745
|
+
flags.hasMarkers = true;
|
|
24746
|
+
pushSparseCellRange(flags.markerRanges, row, col);
|
|
24747
|
+
}
|
|
24748
|
+
if ((_cell$selectionProtec = cell.selectionProtection) === null || _cell$selectionProtec === void 0 ? void 0 : _cell$selectionProtec.length) {
|
|
24749
|
+
flags.hasSelectionProtection = true;
|
|
24750
|
+
pushSparseCellRange(flags.selectionProtectionRanges, row, col);
|
|
24751
|
+
}
|
|
24752
|
+
}
|
|
24753
|
+
}
|
|
24754
|
+
return flags;
|
|
24755
|
+
}
|
|
24756
|
+
function shouldSkipSparseExtension(uKey, flags) {
|
|
24757
|
+
if (!flags) return false;
|
|
24758
|
+
switch (uKey) {
|
|
24759
|
+
case "DefaultCustomExtension": return !flags.hasCustomRender;
|
|
24760
|
+
case "DefaultMarkerExtension": return !flags.hasMarkers;
|
|
24761
|
+
case "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY":
|
|
24762
|
+
case "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY": return !flags.hasSelectionProtection;
|
|
24763
|
+
default: return false;
|
|
24764
|
+
}
|
|
24765
|
+
}
|
|
24766
|
+
function hasSparseExtension(extensions) {
|
|
24767
|
+
return extensions.some((extension) => {
|
|
24768
|
+
switch (extension.uKey) {
|
|
24769
|
+
case "DefaultCustomExtension":
|
|
24770
|
+
case "DefaultMarkerExtension":
|
|
24771
|
+
case "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY":
|
|
24772
|
+
case "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY": return true;
|
|
24773
|
+
default: return false;
|
|
24774
|
+
}
|
|
24775
|
+
});
|
|
24776
|
+
}
|
|
24777
|
+
function getSparseExtensionDiffRanges(uKey, flags, diffRanges) {
|
|
24778
|
+
if (!flags) return diffRanges;
|
|
24779
|
+
switch (uKey) {
|
|
24780
|
+
case "DefaultCustomExtension": return flags.customRenderRanges;
|
|
24781
|
+
case "DefaultMarkerExtension": return flags.markerRanges;
|
|
24782
|
+
case "RANGE_PROTECTION_CAN_VIEW_RENDER_EXTENSION_KEY":
|
|
24783
|
+
case "RANGE_PROTECTION_CAN_NOT_VIEW_RENDER_EXTENSION_KEY": return flags.selectionProtectionRanges;
|
|
24784
|
+
default: return diffRanges;
|
|
24785
|
+
}
|
|
24786
|
+
}
|
|
24041
24787
|
var Spreadsheet = class extends SheetComponent {
|
|
24042
24788
|
constructor(oKey, spreadsheetSkeleton, _allowCache = true) {
|
|
24043
24789
|
super(oKey, spreadsheetSkeleton);
|
|
@@ -24092,7 +24838,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24092
24838
|
var _viewportInfo$diffBou;
|
|
24093
24839
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
24094
24840
|
if (!spreadsheetSkeleton) return;
|
|
24095
|
-
|
|
24841
|
+
const hasMergeData = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
24842
|
+
this._drawAuxiliary(ctx, hasMergeData);
|
|
24096
24843
|
const parentScale = this.getParentScale();
|
|
24097
24844
|
const diffRanges = this._refreshIncrementalState && viewportInfo.diffBounds ? (_viewportInfo$diffBou = viewportInfo.diffBounds) === null || _viewportInfo$diffBou === void 0 ? void 0 : _viewportInfo$diffBou.map((bound) => spreadsheetSkeleton.getRangeByViewBound(bound)) : [];
|
|
24098
24845
|
const cacheRange = spreadsheetSkeleton.getCacheRangeByViewport(viewportInfo, this.isPrinting);
|
|
@@ -24103,14 +24850,19 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24103
24850
|
endColumn: cacheRange.endColumn
|
|
24104
24851
|
})) : viewRanges;
|
|
24105
24852
|
const extensions = this.getExtensionsByOrder();
|
|
24853
|
+
const sparseExtensionFeatures = !hasMergeData && hasSparseExtension(extensions) ? scanSparseExtensionFeatures(spreadsheetSkeleton, viewRanges) : null;
|
|
24106
24854
|
const scene = this.getScene();
|
|
24107
24855
|
for (const extension of extensions) {
|
|
24856
|
+
if (shouldSkipSparseExtension(extension.uKey, sparseExtensionFeatures)) continue;
|
|
24108
24857
|
const extensionViewRanges = extension === this._fontExtension || extension === this._borderExtension ? overflowSafeViewRanges : viewRanges;
|
|
24858
|
+
const extensionDiffRanges = getSparseExtensionDiffRanges(extension.uKey, sparseExtensionFeatures, diffRanges);
|
|
24109
24859
|
const timeKey = `${SHEET_EXTENSION_PREFIX}${extension.uKey}`;
|
|
24110
24860
|
const st = Tools.now();
|
|
24111
|
-
extension.draw(ctx, parentScale, spreadsheetSkeleton,
|
|
24861
|
+
extension.draw(ctx, parentScale, spreadsheetSkeleton, extensionDiffRanges, {
|
|
24112
24862
|
viewRanges: extensionViewRanges,
|
|
24113
24863
|
checkOutOfViewBound: true,
|
|
24864
|
+
fontRenderRanges: extension === this._fontExtension ? spreadsheetSkeleton.incrementalFontRenderRanges : void 0,
|
|
24865
|
+
hasMergeData,
|
|
24114
24866
|
viewportKey: viewportInfo.viewportKey,
|
|
24115
24867
|
viewBound: viewportInfo.cacheBound,
|
|
24116
24868
|
diffBounds: viewportInfo.diffBounds
|
|
@@ -24208,7 +24960,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24208
24960
|
this._dirtyBounds = dirtyBounds;
|
|
24209
24961
|
}
|
|
24210
24962
|
renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton) {
|
|
24211
|
-
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty } = viewportInfo;
|
|
24963
|
+
const { diffBounds, diffX, diffY, viewPortPosition, cacheCanvas, leftOrigin, topOrigin, bufferEdgeX, bufferEdgeY, isDirty: isViewportDirty, isForceDirty: isViewportForceDirty, shouldCacheUpdate } = viewportInfo;
|
|
24212
24964
|
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
24213
24965
|
const { a: scaleX = 1, d: scaleY = 1 } = mainCtx.getTransform();
|
|
24214
24966
|
const bufferEdgeSizeX = bufferEdgeX * scaleX / window.devicePixelRatio;
|
|
@@ -24217,8 +24969,10 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24217
24969
|
cacheCtx.save();
|
|
24218
24970
|
const isForceDirty = isViewportForceDirty || this.isForceDirty();
|
|
24219
24971
|
const isDirty = isViewportDirty || this.isDirty();
|
|
24220
|
-
const
|
|
24221
|
-
const
|
|
24972
|
+
const cachePixelRatio = cacheCanvas.getPixelRatio();
|
|
24973
|
+
const isScrollJumpOutsideCache = Math.abs(diffX) * scaleX >= cacheCanvas.getWidth() * cachePixelRatio || Math.abs(diffY) * scaleY >= cacheCanvas.getHeight() * cachePixelRatio;
|
|
24974
|
+
const hasMergeData = spreadsheetSkeleton.worksheet.getMergeData().length > 0;
|
|
24975
|
+
const shouldRefreshCache = isDirty || isForceDirty || isScrollJumpOutsideCache || hasMergeData && (diffX !== 0 || diffY !== 0) || shouldCacheUpdate && diffX !== 0;
|
|
24222
24976
|
if (diffBounds.length === 0 || diffX === 0 && diffY === 0 || shouldRefreshCache) {
|
|
24223
24977
|
if (shouldRefreshCache) {
|
|
24224
24978
|
this.addRenderTagToScene("scrolling", false);
|
|
@@ -24312,6 +25066,8 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24312
25066
|
}
|
|
24313
25067
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
24314
25068
|
if (!spreadsheetSkeleton) return;
|
|
25069
|
+
const { viewportKey } = viewportInfo;
|
|
25070
|
+
if (sheetHeaderViewportKeys.includes(viewportKey)) return this;
|
|
24315
25071
|
spreadsheetSkeleton.setStylesCache(viewportInfo);
|
|
24316
25072
|
const segment = spreadsheetSkeleton.rowColumnSegment;
|
|
24317
25073
|
if (!segment) return;
|
|
@@ -24320,10 +25076,9 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24320
25076
|
const { rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop } = spreadsheetSkeleton;
|
|
24321
25077
|
mainCtx.translateWithPrecision(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
24322
25078
|
(_this$getScene = this.getScene()) === null || _this$getScene === void 0 || _this$getScene.updateTransformerZero(rowHeaderWidthAndMarginLeft, columnHeaderHeightAndMarginTop);
|
|
24323
|
-
const { viewportKey } = viewportInfo;
|
|
24324
25079
|
if (sheetContentViewportKeys.includes(viewportKey)) if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
24325
25080
|
else this._draw(mainCtx, viewportInfo);
|
|
24326
|
-
else if (
|
|
25081
|
+
else if (viewportInfo && viewportInfo.cacheCanvas) this.renderByViewports(mainCtx, viewportInfo, spreadsheetSkeleton);
|
|
24327
25082
|
else this._draw(mainCtx, viewportInfo);
|
|
24328
25083
|
mainCtx.restore();
|
|
24329
25084
|
return this;
|
|
@@ -24391,7 +25146,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24391
25146
|
* draw gridlines
|
|
24392
25147
|
* @param ctx
|
|
24393
25148
|
*/
|
|
24394
|
-
_drawAuxiliary(ctx) {
|
|
25149
|
+
_drawAuxiliary(ctx, hasMergeData = true) {
|
|
24395
25150
|
var _ref;
|
|
24396
25151
|
const spreadsheetSkeleton = this.getSkeleton();
|
|
24397
25152
|
if (spreadsheetSkeleton == null) return;
|
|
@@ -24433,22 +25188,24 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24433
25188
|
const mergeVisibleRanges = [];
|
|
24434
25189
|
let mergeVisibleRangeStartRow = startRow;
|
|
24435
25190
|
for (let r = rowStart; r <= rowEnd; r++) {
|
|
24436
|
-
if (
|
|
24437
|
-
if (
|
|
24438
|
-
|
|
24439
|
-
|
|
24440
|
-
|
|
24441
|
-
|
|
24442
|
-
|
|
24443
|
-
|
|
24444
|
-
|
|
24445
|
-
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24450
|
-
|
|
24451
|
-
|
|
25191
|
+
if (hasMergeData) {
|
|
25192
|
+
if (worksheet.getRowVisible(r) === false) {
|
|
25193
|
+
if (mergeVisibleRangeStartRow < r) {
|
|
25194
|
+
mergeVisibleRanges.push({
|
|
25195
|
+
startRow: mergeVisibleRangeStartRow,
|
|
25196
|
+
endRow: r - 1,
|
|
25197
|
+
startColumn,
|
|
25198
|
+
endColumn
|
|
25199
|
+
});
|
|
25200
|
+
mergeVisibleRangeStartRow = r + 1;
|
|
25201
|
+
} else if (mergeVisibleRangeStartRow === r) mergeVisibleRangeStartRow = r + 1;
|
|
25202
|
+
} else if (r === endRow && mergeVisibleRangeStartRow <= r) mergeVisibleRanges.push({
|
|
25203
|
+
startRow: mergeVisibleRangeStartRow,
|
|
25204
|
+
endRow: r,
|
|
25205
|
+
startColumn,
|
|
25206
|
+
endColumn
|
|
25207
|
+
});
|
|
25208
|
+
}
|
|
24452
25209
|
if (r < 0 || r > rowHeightAccumulationLength - 1) continue;
|
|
24453
25210
|
const rowEndPosition = rowHeightAccumulation[r];
|
|
24454
25211
|
ctx.beginPath();
|
|
@@ -24467,7 +25224,7 @@ var Spreadsheet = class extends SheetComponent {
|
|
|
24467
25224
|
ctx.stroke();
|
|
24468
25225
|
}
|
|
24469
25226
|
const mergeCellRanges = [];
|
|
24470
|
-
for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
25227
|
+
if (hasMergeData) for (const mergeVisibleRange of mergeVisibleRanges) {
|
|
24471
25228
|
const mergeRangeInVisible = spreadsheetSkeleton.getCurrentRowColumnSegmentMergeData(mergeVisibleRange);
|
|
24472
25229
|
mergeCellRanges.push(...mergeRangeInVisible);
|
|
24473
25230
|
}
|
|
@@ -25406,6 +26163,164 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
25406
26163
|
}
|
|
25407
26164
|
};
|
|
25408
26165
|
|
|
26166
|
+
//#endregion
|
|
26167
|
+
//#region src/components/docs/layout/doc-no-wrap-measure.ts
|
|
26168
|
+
function splitDocumentNoWrapMeasureLines(text) {
|
|
26169
|
+
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
26170
|
+
}
|
|
26171
|
+
function isDocumentNoWrapMeasureTrailingWhitespace(char) {
|
|
26172
|
+
return char === " " || char === " " || char === "\xA0";
|
|
26173
|
+
}
|
|
26174
|
+
function getDocumentNoWrapMeasureTrailingWhitespaceStart(text) {
|
|
26175
|
+
let index = text.length;
|
|
26176
|
+
while (index > 0 && isDocumentNoWrapMeasureTrailingWhitespace(text[index - 1])) index--;
|
|
26177
|
+
return index;
|
|
26178
|
+
}
|
|
26179
|
+
function isDocumentNoWrapMeasureCJKText(char) {
|
|
26180
|
+
return /[\u2E80-\u9FFF\uF900-\uFAFF]/u.test(char);
|
|
26181
|
+
}
|
|
26182
|
+
function isDocumentNoWrapMeasureLatinText(char) {
|
|
26183
|
+
return /[a-z\d]/i.test(char);
|
|
26184
|
+
}
|
|
26185
|
+
function measureDocumentNoWrapTextByStyle(text, textStyle) {
|
|
26186
|
+
if (!text) return 0;
|
|
26187
|
+
return FontCache.getMeasureText(text, getFontStyleString(textStyle).fontCache).width;
|
|
26188
|
+
}
|
|
26189
|
+
function measureDocumentNoWrapCJKLatinSpacing(segment, textStyle, previous) {
|
|
26190
|
+
let spacing = 0;
|
|
26191
|
+
for (const char of Array.from(segment)) {
|
|
26192
|
+
const isCJK = isDocumentNoWrapMeasureCJKText(char);
|
|
26193
|
+
const cjkWidth = isCJK ? measureDocumentNoWrapTextByStyle(char, textStyle) : 0;
|
|
26194
|
+
if (isCJK && isDocumentNoWrapMeasureLatinText(previous.char)) spacing += cjkWidth / 4;
|
|
26195
|
+
if (isDocumentNoWrapMeasureLatinText(char) && isDocumentNoWrapMeasureCJKText(previous.char)) spacing += previous.cjkWidth / 4;
|
|
26196
|
+
previous.char = char;
|
|
26197
|
+
previous.cjkWidth = cjkWidth;
|
|
26198
|
+
}
|
|
26199
|
+
return spacing;
|
|
26200
|
+
}
|
|
26201
|
+
function measureDocumentNoWrapLineByStyle(text, textStyle) {
|
|
26202
|
+
const visibleText = text.slice(0, getDocumentNoWrapMeasureTrailingWhitespaceStart(text));
|
|
26203
|
+
return measureDocumentNoWrapTextByStyle(visibleText, textStyle) + measureDocumentNoWrapCJKLatinSpacing(visibleText, textStyle, {
|
|
26204
|
+
char: "",
|
|
26205
|
+
cjkWidth: 0
|
|
26206
|
+
});
|
|
26207
|
+
}
|
|
26208
|
+
function measureDocumentNoWrapRunsWidth(dataStream, textRuns, fallbackTextStyle) {
|
|
26209
|
+
let currentLineWidth = 0;
|
|
26210
|
+
let maxLineWidth = 0;
|
|
26211
|
+
let pendingTrailingWhitespaceWidth = 0;
|
|
26212
|
+
const previous = {
|
|
26213
|
+
char: "",
|
|
26214
|
+
cjkWidth: 0
|
|
26215
|
+
};
|
|
26216
|
+
const appendSegment = (segment, textStyle) => {
|
|
26217
|
+
if (!segment) return;
|
|
26218
|
+
const trailingStart = getDocumentNoWrapMeasureTrailingWhitespaceStart(segment);
|
|
26219
|
+
const visibleSegment = segment.slice(0, trailingStart);
|
|
26220
|
+
const trailingWhitespace = segment.slice(trailingStart);
|
|
26221
|
+
if (visibleSegment) {
|
|
26222
|
+
currentLineWidth += pendingTrailingWhitespaceWidth;
|
|
26223
|
+
pendingTrailingWhitespaceWidth = 0;
|
|
26224
|
+
currentLineWidth += measureDocumentNoWrapTextByStyle(visibleSegment, textStyle);
|
|
26225
|
+
currentLineWidth += measureDocumentNoWrapCJKLatinSpacing(visibleSegment, textStyle, previous);
|
|
26226
|
+
}
|
|
26227
|
+
if (trailingWhitespace) {
|
|
26228
|
+
pendingTrailingWhitespaceWidth += measureDocumentNoWrapTextByStyle(trailingWhitespace, textStyle);
|
|
26229
|
+
measureDocumentNoWrapCJKLatinSpacing(trailingWhitespace, textStyle, previous);
|
|
26230
|
+
}
|
|
26231
|
+
};
|
|
26232
|
+
const finishLine = () => {
|
|
26233
|
+
maxLineWidth = Math.max(maxLineWidth, currentLineWidth);
|
|
26234
|
+
currentLineWidth = 0;
|
|
26235
|
+
pendingTrailingWhitespaceWidth = 0;
|
|
26236
|
+
previous.char = "";
|
|
26237
|
+
previous.cjkWidth = 0;
|
|
26238
|
+
};
|
|
26239
|
+
const appendRange = (text, textStyle) => {
|
|
26240
|
+
splitDocumentNoWrapMeasureLines(text).forEach((segment, index) => {
|
|
26241
|
+
if (index > 0) finishLine();
|
|
26242
|
+
appendSegment(segment, textStyle);
|
|
26243
|
+
});
|
|
26244
|
+
};
|
|
26245
|
+
let cursor = 0;
|
|
26246
|
+
[...textRuns].sort((a, b) => a.st - b.st).forEach((run) => {
|
|
26247
|
+
const start = Math.max(0, run.st);
|
|
26248
|
+
const end = Math.max(start, run.ed);
|
|
26249
|
+
if (start > cursor) appendRange(dataStream.slice(cursor, start), fallbackTextStyle);
|
|
26250
|
+
const effectiveStart = Math.max(start, cursor);
|
|
26251
|
+
if (end > effectiveStart) appendRange(dataStream.slice(effectiveStart, end), run.ts);
|
|
26252
|
+
cursor = Math.max(cursor, end);
|
|
26253
|
+
});
|
|
26254
|
+
if (cursor < dataStream.length) appendRange(dataStream.slice(cursor), fallbackTextStyle);
|
|
26255
|
+
return Math.max(maxLineWidth, currentLineWidth);
|
|
26256
|
+
}
|
|
26257
|
+
function measureDocumentNoWrapTextRangeWidth(documentData, start, end) {
|
|
26258
|
+
var _body$dataStream, _body$textRuns, _documentData$documen2;
|
|
26259
|
+
const body = documentData.body;
|
|
26260
|
+
const dataStream = (_body$dataStream = body === null || body === void 0 ? void 0 : body.dataStream) !== null && _body$dataStream !== void 0 ? _body$dataStream : "";
|
|
26261
|
+
const rangeStart = Math.max(0, Math.min(dataStream.length, start));
|
|
26262
|
+
const rangeEnd = Math.max(rangeStart, Math.min(dataStream.length, end));
|
|
26263
|
+
const rangeText = dataStream.slice(rangeStart, rangeEnd);
|
|
26264
|
+
const textRuns = ((_body$textRuns = body === null || body === void 0 ? void 0 : body.textRuns) !== null && _body$textRuns !== void 0 ? _body$textRuns : []).map((run) => {
|
|
26265
|
+
const runStart = Math.max(rangeStart, run.st);
|
|
26266
|
+
const runEnd = Math.min(rangeEnd, run.ed);
|
|
26267
|
+
if (runEnd <= runStart) return null;
|
|
26268
|
+
return {
|
|
26269
|
+
...run,
|
|
26270
|
+
st: runStart - rangeStart,
|
|
26271
|
+
ed: runEnd - rangeStart
|
|
26272
|
+
};
|
|
26273
|
+
}).filter((run) => run !== null);
|
|
26274
|
+
if (textRuns.length) {
|
|
26275
|
+
var _documentData$documen;
|
|
26276
|
+
return measureDocumentNoWrapRunsWidth(rangeText, textRuns, (_documentData$documen = documentData.documentStyle) === null || _documentData$documen === void 0 ? void 0 : _documentData$documen.textStyle);
|
|
26277
|
+
}
|
|
26278
|
+
return measureDocumentNoWrapLineByStyle(rangeText, (_documentData$documen2 = documentData.documentStyle) === null || _documentData$documen2 === void 0 ? void 0 : _documentData$documen2.textStyle);
|
|
26279
|
+
}
|
|
26280
|
+
/**
|
|
26281
|
+
* Measures the widest no-wrap line using the same text-width policy that docs
|
|
26282
|
+
* layout relies on for lightweight shape/text-box autofit flows.
|
|
26283
|
+
*
|
|
26284
|
+
* This is intentionally not a full document layout replacement: callers that
|
|
26285
|
+
* need line breaking, pagination, floating objects, or final line metrics should
|
|
26286
|
+
* use `DocumentSkeleton`. This helper exists for consumers that must size a
|
|
26287
|
+
* no-wrap host before committing a full layout pass. Keep docs-specific glyph
|
|
26288
|
+
* width adjustments here so feature packages do not duplicate paragraph shaping
|
|
26289
|
+
* details such as CJK-Latin spacing.
|
|
26290
|
+
*/
|
|
26291
|
+
function measureDocumentNoWrapTextWidth(documentData) {
|
|
26292
|
+
var _body$dataStream2, _documentData$documen4;
|
|
26293
|
+
const body = documentData === null || documentData === void 0 ? void 0 : documentData.body;
|
|
26294
|
+
const dataStream = (_body$dataStream2 = body === null || body === void 0 ? void 0 : body.dataStream) !== null && _body$dataStream2 !== void 0 ? _body$dataStream2 : "";
|
|
26295
|
+
const textRuns = body === null || body === void 0 ? void 0 : body.textRuns;
|
|
26296
|
+
if (textRuns === null || textRuns === void 0 ? void 0 : textRuns.length) {
|
|
26297
|
+
var _documentData$documen3;
|
|
26298
|
+
return measureDocumentNoWrapRunsWidth(dataStream, textRuns, documentData === null || documentData === void 0 || (_documentData$documen3 = documentData.documentStyle) === null || _documentData$documen3 === void 0 ? void 0 : _documentData$documen3.textStyle);
|
|
26299
|
+
}
|
|
26300
|
+
const fallbackTextStyle = documentData === null || documentData === void 0 || (_documentData$documen4 = documentData.documentStyle) === null || _documentData$documen4 === void 0 ? void 0 : _documentData$documen4.textStyle;
|
|
26301
|
+
return Math.max(0, ...splitDocumentNoWrapMeasureLines(dataStream).map((line) => measureDocumentNoWrapLineByStyle(line, fallbackTextStyle)));
|
|
26302
|
+
}
|
|
26303
|
+
/**
|
|
26304
|
+
* Measures the widest segment that docs line breaking keeps together. This is
|
|
26305
|
+
* useful when a host may wrap normally but still needs enough width to avoid
|
|
26306
|
+
* clipping an individual word, CJK glyph, or punctuation segment.
|
|
26307
|
+
*/
|
|
26308
|
+
function measureDocumentUnbreakableTextWidth(documentData) {
|
|
26309
|
+
var _documentData$body$da, _documentData$body;
|
|
26310
|
+
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 : "";
|
|
26311
|
+
if (!documentData || !dataStream) return 0;
|
|
26312
|
+
const breaker = new LineBreaker(dataStream);
|
|
26313
|
+
let start = 0;
|
|
26314
|
+
let maxWidth = 0;
|
|
26315
|
+
let breakPoint = breaker.nextBreakPoint();
|
|
26316
|
+
while (breakPoint) {
|
|
26317
|
+
maxWidth = Math.max(maxWidth, measureDocumentNoWrapTextRangeWidth(documentData, start, breakPoint.position));
|
|
26318
|
+
start = breakPoint.position;
|
|
26319
|
+
breakPoint = breaker.nextBreakPoint();
|
|
26320
|
+
}
|
|
26321
|
+
return maxWidth;
|
|
26322
|
+
}
|
|
26323
|
+
|
|
25409
26324
|
//#endregion
|
|
25410
26325
|
//#region src/custom/custom-object.ts
|
|
25411
26326
|
var CustomObject = class extends BaseObject {
|
|
@@ -26600,7 +27515,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
26600
27515
|
//#endregion
|
|
26601
27516
|
//#region package.json
|
|
26602
27517
|
var name = "@univerjs/engine-render";
|
|
26603
|
-
var version = "1.0.0-alpha.
|
|
27518
|
+
var version = "1.0.0-alpha.3";
|
|
26604
27519
|
|
|
26605
27520
|
//#endregion
|
|
26606
27521
|
//#region src/config/config.ts
|
|
@@ -27953,11 +28868,13 @@ var Transformer = class extends Disposable {
|
|
|
27953
28868
|
});
|
|
27954
28869
|
}
|
|
27955
28870
|
_getOutlinePosition(width, height, borderSpacing, borderStrokeWidth) {
|
|
28871
|
+
const offset = borderSpacing + borderStrokeWidth;
|
|
28872
|
+
const strokeOffset = borderStrokeWidth / 2;
|
|
27956
28873
|
return {
|
|
27957
|
-
left:
|
|
27958
|
-
top: -
|
|
27959
|
-
width: width +
|
|
27960
|
-
height: height +
|
|
28874
|
+
left: -offset - strokeOffset,
|
|
28875
|
+
top: -offset - strokeOffset,
|
|
28876
|
+
width: width + offset * 2,
|
|
28877
|
+
height: height + offset * 2
|
|
27961
28878
|
};
|
|
27962
28879
|
}
|
|
27963
28880
|
_getRotateAnchorCursor(type) {
|
|
@@ -28031,7 +28948,7 @@ var Transformer = class extends Disposable {
|
|
|
28031
28948
|
top += -borderSpacing - borderStrokeWidth;
|
|
28032
28949
|
break;
|
|
28033
28950
|
case "__SpreadsheetTransformerResizeLM__":
|
|
28034
|
-
left += borderSpacing - borderStrokeWidth;
|
|
28951
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
28035
28952
|
top += height / 2 - longEdge / 2;
|
|
28036
28953
|
break;
|
|
28037
28954
|
case "__SpreadsheetTransformerResizeRM__":
|
|
@@ -28039,7 +28956,7 @@ var Transformer = class extends Disposable {
|
|
|
28039
28956
|
top += height / 2 - longEdge / 2;
|
|
28040
28957
|
break;
|
|
28041
28958
|
case "__SpreadsheetTransformerResizeLB__":
|
|
28042
|
-
left += -
|
|
28959
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
28043
28960
|
top += height + borderSpacing - borderStrokeWidth - longEdge;
|
|
28044
28961
|
break;
|
|
28045
28962
|
case "__SpreadsheetTransformerResizeCB__":
|
|
@@ -28079,28 +28996,28 @@ var Transformer = class extends Disposable {
|
|
|
28079
28996
|
top += -borderSpacing - borderStrokeWidth;
|
|
28080
28997
|
break;
|
|
28081
28998
|
case "__SpreadsheetTransformerResizeRT__":
|
|
28082
|
-
left += width + borderSpacing
|
|
28999
|
+
left += width + borderSpacing + borderStrokeWidth;
|
|
28083
29000
|
top += -borderSpacing - borderStrokeWidth;
|
|
28084
29001
|
break;
|
|
28085
29002
|
case "__SpreadsheetTransformerResizeLM__":
|
|
28086
|
-
left += borderSpacing - borderStrokeWidth;
|
|
29003
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
28087
29004
|
top += height / 2;
|
|
28088
29005
|
break;
|
|
28089
29006
|
case "__SpreadsheetTransformerResizeRM__":
|
|
28090
|
-
left += width + borderSpacing
|
|
29007
|
+
left += width + borderSpacing + borderStrokeWidth;
|
|
28091
29008
|
top += height / 2;
|
|
28092
29009
|
break;
|
|
28093
29010
|
case "__SpreadsheetTransformerResizeLB__":
|
|
28094
|
-
left += -
|
|
28095
|
-
top += height + borderSpacing
|
|
29011
|
+
left += -borderSpacing - borderStrokeWidth;
|
|
29012
|
+
top += height + borderSpacing + borderStrokeWidth;
|
|
28096
29013
|
break;
|
|
28097
29014
|
case "__SpreadsheetTransformerResizeCB__":
|
|
28098
29015
|
left += width / 2;
|
|
28099
|
-
top += height + borderSpacing
|
|
29016
|
+
top += height + borderSpacing + borderStrokeWidth;
|
|
28100
29017
|
break;
|
|
28101
29018
|
case "__SpreadsheetTransformerResizeRB__":
|
|
28102
|
-
left += width + borderSpacing
|
|
28103
|
-
top += height + borderSpacing
|
|
29019
|
+
left += width + borderSpacing + borderStrokeWidth;
|
|
29020
|
+
top += height + borderSpacing + borderStrokeWidth;
|
|
28104
29021
|
break;
|
|
28105
29022
|
}
|
|
28106
29023
|
return {
|
|
@@ -28139,8 +29056,8 @@ var Transformer = class extends Disposable {
|
|
|
28139
29056
|
width: anchorProps.width,
|
|
28140
29057
|
height: anchorProps.height,
|
|
28141
29058
|
radius: anchorProps.radius,
|
|
28142
|
-
left: left + (anchorSize - anchorProps.width) / 2,
|
|
28143
|
-
top: top + (anchorSize - anchorProps.height) / 2,
|
|
29059
|
+
left: left + (anchorSize - anchorProps.width) / 2 - anchorStrokeWidth / 2,
|
|
29060
|
+
top: top + (anchorSize - anchorProps.height) / 2 - anchorStrokeWidth / 2,
|
|
28144
29061
|
shadowColor: anchorShadowColor,
|
|
28145
29062
|
shadowBlur: anchorShadowBlur,
|
|
28146
29063
|
shadowOffsetX: anchorShadowOffsetX,
|
|
@@ -29454,14 +30371,17 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
29454
30371
|
return this._renderContext.components;
|
|
29455
30372
|
}
|
|
29456
30373
|
constructor(init, parentInjector) {
|
|
29457
|
-
var _init$createUnitOptio;
|
|
30374
|
+
var _init$createUnitOptio, _init$createUnitOptio2, _init$createUnitOptio3;
|
|
29458
30375
|
super();
|
|
29459
30376
|
_defineProperty(this, "isRenderUnit", true);
|
|
29460
30377
|
_defineProperty(this, "_activated$", new BehaviorSubject(true));
|
|
29461
30378
|
_defineProperty(this, "activated$", this._activated$.pipe(distinctUntilChanged()));
|
|
29462
30379
|
_defineProperty(this, "_injector", void 0);
|
|
29463
30380
|
_defineProperty(this, "_renderContext", void 0);
|
|
29464
|
-
this
|
|
30381
|
+
_defineProperty(this, "_dependencyService", void 0);
|
|
30382
|
+
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;
|
|
30383
|
+
this._injector = renderParentInjector.createChild();
|
|
30384
|
+
this._dependencyService = new RenderUnitDependencyService(this._injector, () => this._renderContext);
|
|
29465
30385
|
this._renderContext = {
|
|
29466
30386
|
unit: init.unit,
|
|
29467
30387
|
unitId: init.unit.getUnitId(),
|
|
@@ -29475,13 +30395,14 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
29475
30395
|
activate: () => this._activated$.next(true),
|
|
29476
30396
|
deactivate: () => this._activated$.next(false)
|
|
29477
30397
|
};
|
|
29478
|
-
if (((_init$
|
|
30398
|
+
if (((_init$createUnitOptio3 = init.createUnitOptions) === null || _init$createUnitOptio3 === void 0 ? void 0 : _init$createUnitOptio3.makeCurrent) === false) this.deactivate();
|
|
29479
30399
|
}
|
|
29480
30400
|
dispose() {
|
|
29481
|
-
this.
|
|
29482
|
-
super.dispose();
|
|
30401
|
+
if (this._disposed) return;
|
|
29483
30402
|
this._activated$.next(false);
|
|
29484
30403
|
this._activated$.complete();
|
|
30404
|
+
super.dispose();
|
|
30405
|
+
this._injector.dispose();
|
|
29485
30406
|
this._renderContext.unit = null;
|
|
29486
30407
|
this._renderContext.components.clear();
|
|
29487
30408
|
}
|
|
@@ -29492,7 +30413,10 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
29492
30413
|
* Get a dependency from the RenderUnit's injector.
|
|
29493
30414
|
*/
|
|
29494
30415
|
with(dependency) {
|
|
29495
|
-
return this.
|
|
30416
|
+
return this._dependencyService.resolve(dependency);
|
|
30417
|
+
}
|
|
30418
|
+
getInjector() {
|
|
30419
|
+
return this._injector;
|
|
29496
30420
|
}
|
|
29497
30421
|
/**
|
|
29498
30422
|
* Add render dependencies to the RenderUnit's injector. Note that the dependencies would be initialized immediately
|
|
@@ -29502,16 +30426,8 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
29502
30426
|
this._initDependencies(dependencies);
|
|
29503
30427
|
}
|
|
29504
30428
|
_initDependencies(dependencies) {
|
|
29505
|
-
|
|
29506
|
-
|
|
29507
|
-
const [identifier, implOrNull] = Array.isArray(dep) ? dep : [dep, null];
|
|
29508
|
-
if (!implOrNull) j.add([identifier, { useFactory: () => j.createInstance(identifier, this._renderContext) }]);
|
|
29509
|
-
else if (isClassDependencyItem(implOrNull)) j.add([identifier, { useFactory: () => j.createInstance(implOrNull.useClass, this._renderContext) }]);
|
|
29510
|
-
else throw new Error("[RenderUnit]: render dependency could only be an class!");
|
|
29511
|
-
});
|
|
29512
|
-
dependencies.forEach((dep) => {
|
|
29513
|
-
const [identifier] = Array.isArray(dep) ? dep : [dep, null];
|
|
29514
|
-
j.get(identifier);
|
|
30429
|
+
this._dependencyService.register(dependencies).forEach((record) => {
|
|
30430
|
+
this._dependencyService.resolveRecord(record);
|
|
29515
30431
|
});
|
|
29516
30432
|
}
|
|
29517
30433
|
getRenderContext() {
|
|
@@ -29525,6 +30441,86 @@ let RenderUnit = class RenderUnit extends Disposable {
|
|
|
29525
30441
|
}
|
|
29526
30442
|
};
|
|
29527
30443
|
RenderUnit = __decorate([__decorateParam(1, Inject(Injector))], RenderUnit);
|
|
30444
|
+
var RenderUnitDependencyService = class {
|
|
30445
|
+
constructor(_injector, _getRenderContext) {
|
|
30446
|
+
this._injector = _injector;
|
|
30447
|
+
this._getRenderContext = _getRenderContext;
|
|
30448
|
+
_defineProperty(this, "_records", /* @__PURE__ */ new Map());
|
|
30449
|
+
_defineProperty(this, "_resolved", /* @__PURE__ */ new Map());
|
|
30450
|
+
_defineProperty(this, "_resolving", /* @__PURE__ */ new Set());
|
|
30451
|
+
}
|
|
30452
|
+
register(dependencies) {
|
|
30453
|
+
const records = [];
|
|
30454
|
+
const seen = /* @__PURE__ */ new Set();
|
|
30455
|
+
dependencies.forEach((dependency) => {
|
|
30456
|
+
const parsed = this._parseDependency(dependency);
|
|
30457
|
+
const key = getRenderDependencyIdentifierKey$1(parsed.identifier);
|
|
30458
|
+
const existing = this._records.get(key);
|
|
30459
|
+
const record = existing !== null && existing !== void 0 ? existing : this._addRecord(key, parsed.identifier, parsed.create);
|
|
30460
|
+
if (seen.has(record.key)) return;
|
|
30461
|
+
seen.add(record.key);
|
|
30462
|
+
records.push(record);
|
|
30463
|
+
});
|
|
30464
|
+
return records;
|
|
30465
|
+
}
|
|
30466
|
+
resolve(dependency) {
|
|
30467
|
+
const key = getRenderDependencyIdentifierKey$1(dependency);
|
|
30468
|
+
if (this._resolved.has(key)) return this._resolved.get(key);
|
|
30469
|
+
if (this._resolving.has(key)) return;
|
|
30470
|
+
const record = this._records.get(key);
|
|
30471
|
+
if (record) return this.resolveRecord(record);
|
|
30472
|
+
return this._injector.get(dependency, LookUp.SELF);
|
|
30473
|
+
}
|
|
30474
|
+
resolveRecord(record) {
|
|
30475
|
+
if (this._resolved.has(record.key)) return this._resolved.get(record.key);
|
|
30476
|
+
if (this._resolving.has(record.key)) return;
|
|
30477
|
+
this._resolving.add(record.key);
|
|
30478
|
+
try {
|
|
30479
|
+
return this._injector.get(record.identifier, LookUp.SELF);
|
|
30480
|
+
} finally {
|
|
30481
|
+
this._resolving.delete(record.key);
|
|
30482
|
+
}
|
|
30483
|
+
}
|
|
30484
|
+
_addRecord(key, identifier, create) {
|
|
30485
|
+
const record = {
|
|
30486
|
+
key,
|
|
30487
|
+
identifier,
|
|
30488
|
+
create
|
|
30489
|
+
};
|
|
30490
|
+
this._records.set(key, record);
|
|
30491
|
+
this._injector.add([identifier, { useFactory: () => this._create(record) }]);
|
|
30492
|
+
return record;
|
|
30493
|
+
}
|
|
30494
|
+
_create(record) {
|
|
30495
|
+
if (this._resolved.has(record.key)) return this._resolved.get(record.key);
|
|
30496
|
+
const alreadyResolving = this._resolving.has(record.key);
|
|
30497
|
+
if (!alreadyResolving) this._resolving.add(record.key);
|
|
30498
|
+
try {
|
|
30499
|
+
const instance = record.create();
|
|
30500
|
+
this._resolved.set(record.key, instance);
|
|
30501
|
+
return instance;
|
|
30502
|
+
} finally {
|
|
30503
|
+
if (!alreadyResolving) this._resolving.delete(record.key);
|
|
30504
|
+
}
|
|
30505
|
+
}
|
|
30506
|
+
_parseDependency(dependency) {
|
|
30507
|
+
const [identifier, implOrNull] = Array.isArray(dependency) ? dependency : [dependency, null];
|
|
30508
|
+
if (!implOrNull) return {
|
|
30509
|
+
identifier,
|
|
30510
|
+
create: () => this._injector.createInstance(identifier, this._getRenderContext())
|
|
30511
|
+
};
|
|
30512
|
+
if (isClassDependencyItem(implOrNull)) return {
|
|
30513
|
+
identifier,
|
|
30514
|
+
create: () => this._injector.createInstance(implOrNull.useClass, this._getRenderContext())
|
|
30515
|
+
};
|
|
30516
|
+
throw new Error("[RenderUnit]: render dependency could only be an class!");
|
|
30517
|
+
}
|
|
30518
|
+
};
|
|
30519
|
+
function getRenderDependencyIdentifierKey$1(identifier) {
|
|
30520
|
+
const decoratorName = identifier === null || identifier === void 0 ? void 0 : identifier.decoratorName;
|
|
30521
|
+
if (typeof decoratorName === "string" && decoratorName) return `identifier:${decoratorName}`;
|
|
30522
|
+
return identifier;
|
|
30523
|
+
}
|
|
29528
30524
|
|
|
29529
30525
|
//#endregion
|
|
29530
30526
|
//#region src/render-manager/render-manager.service.ts
|
|
@@ -29565,10 +30561,11 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
29565
30561
|
registerRenderModules(type, deps) {
|
|
29566
30562
|
if (!this._renderDependencies.has(type)) this._renderDependencies.set(type, []);
|
|
29567
30563
|
const dependencies = this._renderDependencies.get(type);
|
|
29568
|
-
|
|
29569
|
-
|
|
30564
|
+
const registeredDeps = deps.filter((dep) => !hasRenderDependency(dependencies, dep));
|
|
30565
|
+
dependencies.push(...registeredDeps);
|
|
30566
|
+
for (const [_, render] of this._renderMap) if (render.type === type) this._tryAddRenderDependencies(render, registeredDeps);
|
|
29570
30567
|
return toDisposable(() => {
|
|
29571
|
-
|
|
30568
|
+
registeredDeps.forEach((dep) => remove(dependencies, dep));
|
|
29572
30569
|
});
|
|
29573
30570
|
}
|
|
29574
30571
|
/**
|
|
@@ -29579,6 +30576,7 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
29579
30576
|
registerRenderModule(type, depCtor) {
|
|
29580
30577
|
if (!this._renderDependencies.has(type)) this._renderDependencies.set(type, []);
|
|
29581
30578
|
const dependencies = this._renderDependencies.get(type);
|
|
30579
|
+
if (hasRenderDependency(dependencies, depCtor)) return toDisposable(() => {});
|
|
29582
30580
|
dependencies.push(depCtor);
|
|
29583
30581
|
for (const [_, render] of this._renderMap) if (render.type === type) this._tryAddRenderDependencies(render, [depCtor]);
|
|
29584
30582
|
return toDisposable(() => remove(dependencies, depCtor));
|
|
@@ -29611,7 +30609,9 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
29611
30609
|
* @returns renderUnit:IRender
|
|
29612
30610
|
*/
|
|
29613
30611
|
createRender(unitId, createUnitOptions) {
|
|
29614
|
-
|
|
30612
|
+
var _createUnitOptions$re;
|
|
30613
|
+
const parentInjector = (_createUnitOptions$re = createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.renderParentInjector) !== null && _createUnitOptions$re !== void 0 ? _createUnitOptions$re : this._injector;
|
|
30614
|
+
const renderer = this._createRender(unitId, parentInjector.createInstance(Engine, unitId, void 0), (createUnitOptions === null || createUnitOptions === void 0 ? void 0 : createUnitOptions.embeddedRender) !== true, createUnitOptions, parentInjector);
|
|
29615
30615
|
this._renderCreated$.next(renderer);
|
|
29616
30616
|
return renderer;
|
|
29617
30617
|
}
|
|
@@ -29635,7 +30635,7 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
29635
30635
|
* @param isMainScene
|
|
29636
30636
|
* @returns renderUnit:IRender
|
|
29637
30637
|
*/
|
|
29638
|
-
_createRender(unitId, engine, isMainScene = true, createUnitOptions) {
|
|
30638
|
+
_createRender(unitId, engine, isMainScene = true, createUnitOptions, parentInjector = this._injector) {
|
|
29639
30639
|
const existItem = this.getRenderById(unitId);
|
|
29640
30640
|
let shouldDestroyEngine = true;
|
|
29641
30641
|
if (existItem != null) {
|
|
@@ -29652,7 +30652,7 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
29652
30652
|
if (unit) {
|
|
29653
30653
|
const type = this._univerInstanceService.getUnitType(unitId);
|
|
29654
30654
|
const ctorOfDeps = this._getRenderDepsByType(type);
|
|
29655
|
-
renderUnit =
|
|
30655
|
+
renderUnit = parentInjector.createInstance(RenderUnit, {
|
|
29656
30656
|
unit,
|
|
29657
30657
|
engine,
|
|
29658
30658
|
scene,
|
|
@@ -29660,7 +30660,16 @@ let RenderManagerService = class RenderManagerService extends Disposable {
|
|
|
29660
30660
|
createUnitOptions
|
|
29661
30661
|
});
|
|
29662
30662
|
this._addRenderUnit(unitId, renderUnit);
|
|
29663
|
-
|
|
30663
|
+
try {
|
|
30664
|
+
this._tryAddRenderDependencies(renderUnit, ctorOfDeps);
|
|
30665
|
+
} catch (error) {
|
|
30666
|
+
try {
|
|
30667
|
+
this._disposeItem(renderUnit);
|
|
30668
|
+
} finally {
|
|
30669
|
+
this._renderMap.delete(unitId);
|
|
30670
|
+
}
|
|
30671
|
+
throw error;
|
|
30672
|
+
}
|
|
29664
30673
|
} else {
|
|
29665
30674
|
renderUnit = {
|
|
29666
30675
|
isThumbNail: true,
|
|
@@ -29723,6 +30732,18 @@ RenderManagerService = __decorate([
|
|
|
29723
30732
|
__decorateParam(1, IUniverInstanceService),
|
|
29724
30733
|
__decorateParam(2, Inject(ThemeService))
|
|
29725
30734
|
], RenderManagerService);
|
|
30735
|
+
function hasRenderDependency(dependencies, dep) {
|
|
30736
|
+
const key = getRenderDependencyIdentifierKey(getRenderDependencyIdentifier(dep));
|
|
30737
|
+
return dependencies.some((registered) => getRenderDependencyIdentifierKey(getRenderDependencyIdentifier(registered)) === key);
|
|
30738
|
+
}
|
|
30739
|
+
function getRenderDependencyIdentifier(dep) {
|
|
30740
|
+
return Array.isArray(dep) ? dep[0] : dep;
|
|
30741
|
+
}
|
|
30742
|
+
function getRenderDependencyIdentifierKey(identifier) {
|
|
30743
|
+
const decoratorName = identifier.decoratorName;
|
|
30744
|
+
if (typeof decoratorName === "string" && decoratorName) return `identifier:${decoratorName}`;
|
|
30745
|
+
return identifier;
|
|
30746
|
+
}
|
|
29726
30747
|
const IRenderManagerService = createIdentifier("engine-render.render-manager.service");
|
|
29727
30748
|
function isDisposable(thing) {
|
|
29728
30749
|
return !!thing && typeof thing.dispose === "function";
|
|
@@ -30151,13 +31172,13 @@ var Viewport = class {
|
|
|
30151
31172
|
* @param delta
|
|
30152
31173
|
* @returns isLimited
|
|
30153
31174
|
*/
|
|
30154
|
-
scrollByBarDeltaValue(delta, isTrigger = true) {
|
|
31175
|
+
scrollByBarDeltaValue(delta, isTrigger = true, options) {
|
|
30155
31176
|
const x = this.scrollX + (delta.x || 0);
|
|
30156
31177
|
const y = this.scrollY + (delta.y || 0);
|
|
30157
31178
|
return this._scrollToBarPosCore({
|
|
30158
31179
|
x,
|
|
30159
31180
|
y
|
|
30160
|
-
}, isTrigger);
|
|
31181
|
+
}, isTrigger, options);
|
|
30161
31182
|
}
|
|
30162
31183
|
/**
|
|
30163
31184
|
* Viewport scroll to certain position.
|
|
@@ -30695,7 +31716,7 @@ var Viewport = class {
|
|
|
30695
31716
|
* @param rawScrollXY Partial<IViewportScrollPosition>
|
|
30696
31717
|
* @param isTrigger
|
|
30697
31718
|
*/
|
|
30698
|
-
_scrollToBarPosCore(rawScrollXY, isTrigger = true) {
|
|
31719
|
+
_scrollToBarPosCore(rawScrollXY, isTrigger = true, options) {
|
|
30699
31720
|
var _this$_scrollBar6, _this$_scrollBar7, _this$_scrollBar8, _this$_scrollBar9, _this$_scrollBar10;
|
|
30700
31721
|
if (this._scrollBar == null) return;
|
|
30701
31722
|
let scrollX = rawScrollXY.x;
|
|
@@ -30716,7 +31737,9 @@ var Viewport = class {
|
|
|
30716
31737
|
rawScrollY: rawScrollXY.y,
|
|
30717
31738
|
limitX: (_this$_scrollBar6 = this._scrollBar) === null || _this$_scrollBar6 === void 0 ? void 0 : _this$_scrollBar6.limitX,
|
|
30718
31739
|
limitY: (_this$_scrollBar7 = this._scrollBar) === null || _this$_scrollBar7 === void 0 ? void 0 : _this$_scrollBar7.limitY,
|
|
30719
|
-
isTrigger
|
|
31740
|
+
isTrigger,
|
|
31741
|
+
isBarDragging: options === null || options === void 0 ? void 0 : options.isBarDragging,
|
|
31742
|
+
isBarDragEnd: options === null || options === void 0 ? void 0 : options.isBarDragEnd
|
|
30720
31743
|
};
|
|
30721
31744
|
(_this$_scrollBar8 = this._scrollBar) === null || _this$_scrollBar8 === void 0 || _this$_scrollBar8.makeDirty(true);
|
|
30722
31745
|
this.onScrollAfter$.emitEvent(scrollSubParam);
|
|
@@ -30729,7 +31752,9 @@ var Viewport = class {
|
|
|
30729
31752
|
viewportScrollY: this.viewportScrollY,
|
|
30730
31753
|
limitX: (_this$_scrollBar9 = this._scrollBar) === null || _this$_scrollBar9 === void 0 ? void 0 : _this$_scrollBar9.limitX,
|
|
30731
31754
|
limitY: (_this$_scrollBar10 = this._scrollBar) === null || _this$_scrollBar10 === void 0 ? void 0 : _this$_scrollBar10.limitY,
|
|
30732
|
-
isTrigger
|
|
31755
|
+
isTrigger,
|
|
31756
|
+
isBarDragging: options === null || options === void 0 ? void 0 : options.isBarDragging,
|
|
31757
|
+
isBarDragEnd: options === null || options === void 0 ? void 0 : options.isBarDragEnd
|
|
30733
31758
|
});
|
|
30734
31759
|
return afterLimit;
|
|
30735
31760
|
}
|
|
@@ -30845,13 +31870,11 @@ var Viewport = class {
|
|
|
30845
31870
|
left: Math.max(prevBound.left, currBound.left),
|
|
30846
31871
|
right: Math.min(prevBound.right, currBound.right)
|
|
30847
31872
|
});
|
|
30848
|
-
const expandX = this.bufferEdgeX;
|
|
30849
|
-
const expandY = this.bufferEdgeY;
|
|
30850
31873
|
for (const bound of additionalAreas) {
|
|
30851
|
-
bound.left = bound.left -
|
|
30852
|
-
bound.right = bound.right +
|
|
30853
|
-
bound.top = bound.top -
|
|
30854
|
-
bound.bottom = bound.bottom +
|
|
31874
|
+
bound.left = bound.left - this.bufferEdgeX;
|
|
31875
|
+
bound.right = bound.right + this.bufferEdgeX;
|
|
31876
|
+
bound.top = bound.top - this.bufferEdgeY;
|
|
31877
|
+
bound.bottom = bound.bottom + this.bufferEdgeY;
|
|
30855
31878
|
}
|
|
30856
31879
|
return additionalAreas;
|
|
30857
31880
|
}
|
|
@@ -30878,4 +31901,4 @@ var Viewport = class {
|
|
|
30878
31901
|
};
|
|
30879
31902
|
|
|
30880
31903
|
//#endregion
|
|
30881
|
-
export { BASE_OBJECT_ARRAY, BG_Z_INDEX, BORDER_TYPE, BORDER_Z_INDEX, Background, BaseObject, Border, BreakType, CHECK_OBJECT_ARRAY, CIRCLE_OBJECT_ARRAY, COLOR_BLACK_RGB, CURSOR_TYPE, Canvas, CanvasColorService, CanvasRenderMode, CheckboxShape, Circle, ColumnHeaderLayout, ComponentExtension, Control, Custom, CustomObject, DEFAULT_DOCUMENT_FONTSIZE, DEFAULT_FONTFACE_PLANE, DEFAULT_FRAME_LIST_SIZE, DEFAULT_FRAME_SAMPLE_SIZE, DEFAULT_MEASURE_TEXT, DEFAULT_OFFSET_SPACING, DEFAULT_PADDING_DATA, DEFAULT_SKELETON_FOOTER, DEFAULT_SKELETON_HEADER, DOCUMENT_CONTEXT_CLIP_TYPE, DRAWING_OBJECT_LAYER_INDEX, DRAWING_OBJECT_LOWER_LAYER_INDEX, DRAWING_OBJECT_UPPER_LAYER_INDEX, DashedRect, DataStreamTreeNode, DeviceInputEventType, DeviceType, DocBackground, DocSimpleSkeleton, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, DocumentsSpanAndLineExtensionRegistry, Drawing, DrawingGroupObject, DumbCanvasColorService, EXPAND_SIZE_FOR_RENDER_OVERFLOW, Engine, EventConstants, FIX_ONE_PIXEL_BLUR_OFFSET, FONT_EXTENSION_Z_INDEX, Font, FontCache, GlyphType, Group, HitCanvas, ICanvasColorService, INITIAL_MATRIX, INITIAL_Path2, IRenderManagerService, IRenderingEngine, IWatermarkTypeEnum, Image$1 as Image, IsSafari, LINK_VIEW_PORT_TYPE, Layer, LineType, Liquid, MAIN_VIEW_PORT_KEY, MAXIMUM_COL_WIDTH, MAXIMUM_ROW_HEIGHT, MEASURE_EXTENT, MEASURE_EXTENT_FOR_PARAGRAPH, MIDDLE_CELL_POS_MAGIC_NUMBER, MIN_COL_WIDTH, Marker, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ORIENTATION_TYPE, ObjectType, PATH_OBJECT_ARRAY, PRINTING_BG_Z_INDEX, PageLayoutType, Path, Path2, PerformanceMonitor, PointerInput, RECT_OBJECT_ARRAY, REGULAR_POLYGON_OBJECT_ARRAY, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, RICHTEXT_OBJECT_ARRAY, Rect, RegularPolygon, RenderComponent, RenderManagerService, RenderUnit, RichText, RollingAverage, RowHeaderLayout, SHAPE_OBJECT_ARRAY, SHAPE_TYPE, SHEET_EXTENSION_PREFIX, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SLIDE_NAVIGATION_KEY, Scene, SceneCanvas, SceneViewer, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetColumnHeaderExtensionRegistry, SheetComponent, SheetExtension, SheetRowHeaderExtensionRegistry, ShowGridlinesState, SkeletonType, Slide, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetExtensionRegistry, SpreadsheetHeader, SpreadsheetRowHeader, SpreadsheetSkeleton, TEXT_OBJECT_ARRAY, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Text, Transform, UNIVER_WATERMARK_LAYER_INDEX, UNIVER_WATERMARK_STORAGE_KEY, UniverPrintingContext, UniverRenderEnginePlugin, UniverRenderingContext, UniverRenderingContext2D, VERTICAL_ROTATE_ANGLE, Vector2, Viewport, WatermarkLayer, calculateRectRotate, cancelRequestFrame, checkStyle, clampRange, clearLineByBorderType, compareDocumentSkeletonNestedPagePathOrder, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, createCanvasElement, createImageElement, degToRad, documentSkeletonLineIterator, documentSkeletonTableIterator, drawDiagonalLineByBorderType, drawLineByBorderType, expandRangeIfIntersects, fixLineWidthByScale, generateRandomKey, getCellByIndexWithMergeInfo, getCellPositionByIndex, getCharSpaceApply, getColor, getCurrentScrollXY, getCurrentTypeOfRenderer, getDPI, getDevicePixelRatio, getDocsSkeletonPageSize, getDocsTableRenderViewport, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getDrawingGroupState, getFirstGrapheme, getFontStyleString, getGroupState, getLastColumn, getLastLine, getLineOffset, getLineWidth, getLineWith, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getPointerPrefix, getRenderTransformBaseOnParentBound, getRotateOffsetAndFarthestHypotenuse, getRotateOrientation, getRotatedBoundInGroup, getScale, getSizeForDom, getSystemHighlightColor, getTableIdAndSliceIndex, getTranslateInSpreadContextWithPixelRatio, getValueType, glyphIterator, hasAllLatin, hasArabic, hasBasicLatin,
|
|
31904
|
+
export { BASE_OBJECT_ARRAY, BG_Z_INDEX, BORDER_TYPE, BORDER_Z_INDEX, Background, BaseObject, Border, BreakType, CHECK_OBJECT_ARRAY, CIRCLE_OBJECT_ARRAY, COLOR_BLACK_RGB, CURSOR_TYPE, Canvas, CanvasColorService, CanvasRenderMode, CheckboxShape, Circle, ColumnHeaderLayout, ComponentExtension, Control, Custom, CustomObject, DEFAULT_DOCUMENT_FONTSIZE, DEFAULT_FONTFACE_PLANE, DEFAULT_FRAME_LIST_SIZE, DEFAULT_FRAME_SAMPLE_SIZE, DEFAULT_MEASURE_TEXT, DEFAULT_OFFSET_SPACING, DEFAULT_PADDING_DATA, DEFAULT_SKELETON_FOOTER, DEFAULT_SKELETON_HEADER, DOCUMENT_CONTEXT_CLIP_TYPE, DRAWING_OBJECT_LAYER_INDEX, DRAWING_OBJECT_LOWER_LAYER_INDEX, DRAWING_OBJECT_UPPER_LAYER_INDEX, DashedRect, DataStreamTreeNode, DeviceInputEventType, DeviceType, DocBackground, DocSimpleSkeleton, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, DocumentsSpanAndLineExtensionRegistry, Drawing, DrawingGroupObject, DumbCanvasColorService, EXPAND_SIZE_FOR_RENDER_OVERFLOW, Engine, EventConstants, FIX_ONE_PIXEL_BLUR_OFFSET, FONT_EXTENSION_Z_INDEX, Font, FontCache, GlyphType, Group, HitCanvas, ICanvasColorService, INITIAL_MATRIX, INITIAL_Path2, IRenderManagerService, IRenderingEngine, IWatermarkTypeEnum, Image$1 as Image, IsSafari, LINK_VIEW_PORT_TYPE, Layer, LineType, Liquid, MAIN_VIEW_PORT_KEY, MAXIMUM_COL_WIDTH, MAXIMUM_ROW_HEIGHT, MEASURE_EXTENT, MEASURE_EXTENT_FOR_PARAGRAPH, MIDDLE_CELL_POS_MAGIC_NUMBER, MIN_COL_WIDTH, Marker, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ORIENTATION_TYPE, ObjectType, PATH_OBJECT_ARRAY, PRINTING_BG_Z_INDEX, PageLayoutType, Path, Path2, PerformanceMonitor, PointerInput, RECT_OBJECT_ARRAY, REGULAR_POLYGON_OBJECT_ARRAY, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, RICHTEXT_OBJECT_ARRAY, Rect, RegularPolygon, RenderComponent, RenderManagerService, RenderUnit, RichText, RollingAverage, RowHeaderLayout, SHAPE_OBJECT_ARRAY, SHAPE_TYPE, SHEET_EXTENSION_PREFIX, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SLIDE_NAVIGATION_KEY, Scene, SceneCanvas, SceneViewer, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetColumnHeaderExtensionRegistry, SheetComponent, SheetExtension, SheetRowHeaderExtensionRegistry, ShowGridlinesState, SkeletonType, Slide, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetExtensionRegistry, SpreadsheetHeader, SpreadsheetRowHeader, SpreadsheetSkeleton, TEXT_OBJECT_ARRAY, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Text, Transform, UNIVER_WATERMARK_LAYER_INDEX, UNIVER_WATERMARK_STORAGE_KEY, UniverPrintingContext, UniverRenderEnginePlugin, UniverRenderingContext, UniverRenderingContext2D, VERTICAL_ROTATE_ANGLE, Vector2, Viewport, WatermarkLayer, calculateRectRotate, cancelRequestFrame, checkStyle, cjk, clampRange, clearLineByBorderType, compareDocumentSkeletonNestedPagePathOrder, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, createCanvasElement, createImageElement, degToRad, documentSkeletonLineIterator, documentSkeletonTableIterator, drawDiagonalLineByBorderType, drawLineByBorderType, expandRangeIfIntersects, fixLineWidthByScale, generateRandomKey, getCellByIndexWithMergeInfo, getCellPositionByIndex, getCharSpaceApply, getColor, getCurrentScrollXY, getCurrentTypeOfRenderer, getDPI, getDevicePixelRatio, getDocsCustomBlockRenderViewport, getDocsSkeletonPageSize, getDocsTableRenderViewport, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getDrawingGroupState, getFirstGrapheme, getFontStyleString, getGroupState, getLastColumn, getLastLine, getLineOffset, getLineWidth, getLineWith, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getPointerPrefix, getRenderTransformBaseOnParentBound, getRotateOffsetAndFarthestHypotenuse, getRotateOrientation, getRotatedBoundInGroup, getScale, getSizeForDom, getSystemHighlightColor, getTableIdAndSliceIndex, getTranslateInSpreadContextWithPixelRatio, getValueType, glyphIterator, hasAllLatin, hasArabic, hasBasicLatin, hasLatinExtendedA, hasLatinExtendedB, hasLatinOneSupplement, hasListGlyph, hasSpace, hasThai, hasTibetan, hasUnMergedCellInRow, inViewRanges, injectStyle, isArray, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, isDate, isEmojiGrapheme, isFirstGlyph, isFunction, isIndentByGlyph, isLastGlyph, isNumber, isObject, isPlaceholderOrSpace, isRectIntersect, isRegExp, isSameLine, isString, lineIterator, measureDocumentNoWrapTextRangeWidth, measureDocumentNoWrapTextWidth, measureDocumentUnbreakableTextWidth, mergeInfoOffset, parseDataStreamToTree, pixelToPt, precisionTo, ptToMM, ptToPixel, ptToPx, pxToInch, pxToNum, pxToPt, radToDeg, renderImageWatermark, renderTextWatermark, renderUserInfoWatermark, renderWatermark, requestNewFrame, setDocsCustomBlockRenderViewportProvider, setDocsTableRenderViewportProvider, setLineType, sheetContentViewportKeys, sheetHeaderViewportKeys, startWithEmoji, toPx, transformObjectOutOfGroup, withCurrentTypeOfRenderer };
|