@univerjs/engine-render 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +615 -390
- package/lib/es/index.js +610 -385
- package/lib/index.js +610 -385
- package/lib/types/basics/i-document-skeleton-cached.d.ts +10 -2
- package/lib/types/basics/interfaces.d.ts +5 -2
- package/lib/types/components/docs/document.d.ts +3 -3
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +1 -1
- package/lib/types/components/docs/layout/block/section.d.ts +1 -0
- package/lib/types/components/docs/layout/doc-simple-skeleton.d.ts +2 -1
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +6 -0
- package/lib/types/components/docs/layout/document-layout-publication.d.ts +2 -2
- package/lib/types/components/docs/layout/document-layout-types.d.ts +2 -0
- package/lib/types/components/docs/layout/header-footer-field.d.ts +18 -0
- package/lib/types/components/docs/layout/model/page.d.ts +2 -2
- package/lib/types/components/docs/layout/tools.d.ts +10 -1
- package/lib/types/components/sheets/extensions/font.d.ts +1 -1
- package/lib/types/components/sheets/sheet.render-skeleton.d.ts +1 -0
- package/lib/types/shape/text.d.ts +2 -0
- package/lib/types/worker-layout.d.ts +1 -0
- package/lib/umd/index.js +5 -5
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, DocxBreakType, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, JSON1, 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, TabStopAlignment, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextDecoration, TextX, TextXActionType, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, characterSpacingControlType, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, getColorStyle, getDisplayValueFromCell, getRichTextEditPath, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isDefaultFormat, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, numfmt, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
1
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, DocxBreakType, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, JSON1, 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, SHEET_TEXT_LINE_GAP, SectionType, SheetSkeleton, Skeleton, SpacingRule, TabStopAlignment, TableAlignmentType, TableRowHeightRule, TableSizeType, TableTextWrapType, TextDecoration, TextX, TextXActionType, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, characterSpacingControlType, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, getColorStyle, getDisplayValueFromCell, getRichTextEditPath, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isCellCoverable, isClassDependencyItem, isDefaultFormat, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, numfmt, regexp, registerDependencies, remove, requestImmediateMacroTask, resolveDocumentParagraphStyle, resolveSectionHeaderFooterReferences, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { BehaviorSubject, Observable, Subject, Subscription, distinctUntilChanged, merge as merge$1, shareReplay, startWith } from "rxjs";
|
|
3
3
|
import { franc } from "franc-min";
|
|
4
4
|
import { getOverflowAncestors } from "@floating-ui/dom";
|
|
@@ -22,7 +22,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region \0@oxc-project+runtime@0.
|
|
25
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
26
26
|
function _typeof(o) {
|
|
27
27
|
"@babel/helpers - typeof";
|
|
28
28
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -33,7 +33,7 @@ function _typeof(o) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region \0@oxc-project+runtime@0.
|
|
36
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
37
37
|
function toPrimitive(t, r) {
|
|
38
38
|
if ("object" != _typeof(t) || !t) return t;
|
|
39
39
|
var e = t[Symbol.toPrimitive];
|
|
@@ -46,14 +46,14 @@ function toPrimitive(t, r) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region \0@oxc-project+runtime@0.
|
|
49
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
50
50
|
function toPropertyKey(t) {
|
|
51
51
|
var i = toPrimitive(t, "string");
|
|
52
52
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
//#endregion
|
|
56
|
-
//#region \0@oxc-project+runtime@0.
|
|
56
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
57
57
|
function _defineProperty(e, r, t) {
|
|
58
58
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
59
59
|
value: t,
|
|
@@ -5695,7 +5695,7 @@ var Border = class extends SheetExtension {
|
|
|
5695
5695
|
let startX = cellStartX;
|
|
5696
5696
|
let endX = cellEndX;
|
|
5697
5697
|
if (type !== "t" && type !== "b" && type !== "l" && type !== "r") {
|
|
5698
|
-
if (isMerged)
|
|
5698
|
+
if (isMerged) continue;
|
|
5699
5699
|
if (isMergedMainCell) {
|
|
5700
5700
|
startY = mergeInfo.startY;
|
|
5701
5701
|
endY = mergeInfo.endY;
|
|
@@ -11919,12 +11919,13 @@ var LineBreaker = class {
|
|
|
11919
11919
|
* limitations under the License.
|
|
11920
11920
|
*/
|
|
11921
11921
|
var DocSimpleSkeleton = class {
|
|
11922
|
-
constructor(_text, _fontStyle, _warp, _width, _height) {
|
|
11922
|
+
constructor(_text, _fontStyle, _warp, _width, _height, _lineGap = 0) {
|
|
11923
11923
|
this._text = _text;
|
|
11924
11924
|
this._fontStyle = _fontStyle;
|
|
11925
11925
|
this._warp = _warp;
|
|
11926
11926
|
this._width = _width;
|
|
11927
11927
|
this._height = _height;
|
|
11928
|
+
this._lineGap = _lineGap;
|
|
11928
11929
|
_defineProperty(this, "_lineBreaker", void 0);
|
|
11929
11930
|
_defineProperty(this, "_lines", []);
|
|
11930
11931
|
_defineProperty(this, "_dirty", true);
|
|
@@ -11976,7 +11977,7 @@ var DocSimpleSkeleton = class {
|
|
|
11976
11977
|
if (textSize.width > this._width) {
|
|
11977
11978
|
if (currentLine.text.length > 0) {
|
|
11978
11979
|
this._lines.push(currentLine);
|
|
11979
|
-
totalHeight += currentLine.height;
|
|
11980
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
11980
11981
|
if (totalHeight > this._height) break;
|
|
11981
11982
|
currentLine = {
|
|
11982
11983
|
text: "",
|
|
@@ -12032,7 +12033,7 @@ var DocSimpleSkeleton = class {
|
|
|
12032
12033
|
remainingText = remainingText.slice(charCount);
|
|
12033
12034
|
if (remainingText.length > 0) {
|
|
12034
12035
|
this._lines.push(currentLine);
|
|
12035
|
-
totalHeight += currentLine.height;
|
|
12036
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
12036
12037
|
if (totalHeight > this._height) break;
|
|
12037
12038
|
currentLine = {
|
|
12038
12039
|
text: "",
|
|
@@ -12045,7 +12046,7 @@ var DocSimpleSkeleton = class {
|
|
|
12045
12046
|
}
|
|
12046
12047
|
} else if (currentLine.text.length > 0) {
|
|
12047
12048
|
this._lines.push(currentLine);
|
|
12048
|
-
totalHeight += currentLine.height;
|
|
12049
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
12049
12050
|
if (totalHeight > this._height) break;
|
|
12050
12051
|
currentLine = {
|
|
12051
12052
|
text,
|
|
@@ -12068,7 +12069,7 @@ var DocSimpleSkeleton = class {
|
|
|
12068
12069
|
}
|
|
12069
12070
|
if (isMandatoryBreak) {
|
|
12070
12071
|
this._lines.push(currentLine);
|
|
12071
|
-
totalHeight += currentLine.height;
|
|
12072
|
+
totalHeight += currentLine.height + (this._lines.length > 1 ? this._lineGap : 0);
|
|
12072
12073
|
if (totalHeight > this._height) break;
|
|
12073
12074
|
currentLine = {
|
|
12074
12075
|
text: "",
|
|
@@ -12086,7 +12087,7 @@ var DocSimpleSkeleton = class {
|
|
|
12086
12087
|
return this._lines;
|
|
12087
12088
|
}
|
|
12088
12089
|
getTotalHeight() {
|
|
12089
|
-
return this._lines.reduce((acc, line) => acc + line.height, 0);
|
|
12090
|
+
return this._lines.reduce((acc, line) => acc + line.height, 0) + Math.max(0, this._lines.length - 1) * this._lineGap;
|
|
12090
12091
|
}
|
|
12091
12092
|
getTotalWidth() {
|
|
12092
12093
|
return this._lines.reduce((acc, line) => Math.max(acc, line.width), 0);
|
|
@@ -12440,6 +12441,7 @@ const TEXT_OBJECT_ARRAY = [
|
|
|
12440
12441
|
"text",
|
|
12441
12442
|
"fontStyle",
|
|
12442
12443
|
"warp",
|
|
12444
|
+
"lineGap",
|
|
12443
12445
|
"hAlign",
|
|
12444
12446
|
"vAlign",
|
|
12445
12447
|
"width",
|
|
@@ -12452,6 +12454,7 @@ var Text = class Text extends Shape {
|
|
|
12452
12454
|
_defineProperty(this, "text", void 0);
|
|
12453
12455
|
_defineProperty(this, "fontStyle", void 0);
|
|
12454
12456
|
_defineProperty(this, "warp", void 0);
|
|
12457
|
+
_defineProperty(this, "lineGap", void 0);
|
|
12455
12458
|
_defineProperty(this, "hAlign", void 0);
|
|
12456
12459
|
_defineProperty(this, "vAlign", void 0);
|
|
12457
12460
|
_defineProperty(this, "skeleton", void 0);
|
|
@@ -12460,14 +12463,15 @@ var Text = class Text extends Shape {
|
|
|
12460
12463
|
this.text = props.text;
|
|
12461
12464
|
this.fontStyle = props.fontStyle;
|
|
12462
12465
|
this.warp = props.warp ?? false;
|
|
12466
|
+
this.lineGap = props.lineGap ?? 0;
|
|
12463
12467
|
this.hAlign = props.hAlign ?? HorizontalAlign.LEFT;
|
|
12464
12468
|
this.vAlign = props.vAlign ?? VerticalAlign.TOP;
|
|
12465
|
-
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height);
|
|
12469
|
+
this.skeleton = new DocSimpleSkeleton(props.text, props.fontStyle, Boolean(props.warp), props.width, props.height, this.lineGap);
|
|
12466
12470
|
}
|
|
12467
12471
|
static drawWith(ctx, props, _skeleton) {
|
|
12468
|
-
const { text, fontStyle, warp, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12472
|
+
const { text, fontStyle, warp, lineGap = 0, hAlign, vAlign, width, height, left = 0, top = 0, cellValueType } = props;
|
|
12469
12473
|
const cachedLayout = !_skeleton && !warp ? Text._getCachedLayout(text, fontStyle) : null;
|
|
12470
|
-
const skeleton = cachedLayout ? null : _skeleton ?? new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === VerticalAlign.TOP ? height : Infinity);
|
|
12474
|
+
const skeleton = cachedLayout ? null : _skeleton ?? new DocSimpleSkeleton(text, fontStyle, Boolean(warp), width, vAlign === VerticalAlign.TOP ? height : Infinity, lineGap);
|
|
12471
12475
|
const lines = (cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.lines) ?? skeleton.calculate();
|
|
12472
12476
|
const totalHeight = (cachedLayout === null || cachedLayout === void 0 ? void 0 : cachedLayout.totalHeight) ?? skeleton.getTotalHeight();
|
|
12473
12477
|
let lineTop = top + (vAlign === VerticalAlign.TOP ? 0 : vAlign === VerticalAlign.MIDDLE ? (height - totalHeight) / 2 : height - totalHeight);
|
|
@@ -12512,7 +12516,7 @@ var Text = class Text extends Shape {
|
|
|
12512
12516
|
lineWidth: 1,
|
|
12513
12517
|
lineType: TextDecoration.SINGLE
|
|
12514
12518
|
});
|
|
12515
|
-
lineTop = lineTop + lineHeight;
|
|
12519
|
+
lineTop = lineTop + lineHeight + lineGap;
|
|
12516
12520
|
}
|
|
12517
12521
|
ctx.restore();
|
|
12518
12522
|
return totalHeight;
|
|
@@ -13911,6 +13915,26 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
13911
13915
|
}
|
|
13912
13916
|
};
|
|
13913
13917
|
|
|
13918
|
+
//#endregion
|
|
13919
|
+
//#region src/components/docs/layout/header-footer-field.ts
|
|
13920
|
+
function resolveHeaderFooterFieldGlyph(glyph, startIndex, endIndex, customRanges, pageNumber, pageCount) {
|
|
13921
|
+
var _fieldRange$propertie, _fieldRange$propertie2;
|
|
13922
|
+
if (!glyph.content || glyph.raw === DataStreamTreeTokenType.CUSTOM_RANGE_START || glyph.raw === DataStreamTreeTokenType.CUSTOM_RANGE_END) return glyph;
|
|
13923
|
+
const fieldRange = customRanges.find((customRange) => {
|
|
13924
|
+
var _customRange$properti;
|
|
13925
|
+
return customRange.rangeType === CustomRangeType.FIELD && customRange.startIndex <= startIndex && customRange.endIndex >= endIndex && typeof ((_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.fieldType) === "string";
|
|
13926
|
+
});
|
|
13927
|
+
const fieldType = fieldRange === null || fieldRange === void 0 || (_fieldRange$propertie = fieldRange.properties) === null || _fieldRange$propertie === void 0 || (_fieldRange$propertie = _fieldRange$propertie.fieldType) === null || _fieldRange$propertie === void 0 ? void 0 : _fieldRange$propertie.toUpperCase();
|
|
13928
|
+
if (!fieldRange || ((_fieldRange$propertie2 = fieldRange.properties) === null || _fieldRange$propertie2 === void 0 ? void 0 : _fieldRange$propertie2.locked) === BooleanNumber.TRUE || fieldType !== "PAGE" && fieldType !== "NUMPAGES") return glyph;
|
|
13929
|
+
if (fieldType === "NUMPAGES" && pageCount == null) return glyph;
|
|
13930
|
+
let content = "";
|
|
13931
|
+
if (startIndex === fieldRange.startIndex + 1) content = String(fieldType === "PAGE" ? pageNumber : pageCount);
|
|
13932
|
+
return content === glyph.content ? glyph : {
|
|
13933
|
+
...glyph,
|
|
13934
|
+
content
|
|
13935
|
+
};
|
|
13936
|
+
}
|
|
13937
|
+
|
|
13914
13938
|
//#endregion
|
|
13915
13939
|
//#region src/components/docs/layout/line-breaker/enhancers/utils.ts
|
|
13916
13940
|
/**
|
|
@@ -16957,7 +16981,7 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
16957
16981
|
if (ctx.isDirty) break;
|
|
16958
16982
|
}
|
|
16959
16983
|
const { segmentId } = curPage;
|
|
16960
|
-
if (ctx.isDirty && ctx.layoutStartPointer[segmentId] != null)
|
|
16984
|
+
if (ctx.isDirty && ctx.layoutStartPointer[segmentId] != null) rollbackSectionPages(ctx.layoutStartPointer[segmentId], allCurrentSkeletonPages);
|
|
16961
16985
|
return {
|
|
16962
16986
|
pages: allCurrentSkeletonPages,
|
|
16963
16987
|
renderedBlockIdMap,
|
|
@@ -16965,7 +16989,7 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
16965
16989
|
complete: paragraphEndIndex >= sectionNode.children.length
|
|
16966
16990
|
};
|
|
16967
16991
|
}
|
|
16968
|
-
function
|
|
16992
|
+
function rollbackSectionPages(paragraphIndex, allCurrentSkeletonPages) {
|
|
16969
16993
|
let findFirstDirtyLine = false;
|
|
16970
16994
|
for (let pageIndex = 0; pageIndex < allCurrentSkeletonPages.length; pageIndex++) {
|
|
16971
16995
|
const page = allCurrentSkeletonPages[pageIndex];
|
|
@@ -17049,27 +17073,75 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
17049
17073
|
let header;
|
|
17050
17074
|
let footer;
|
|
17051
17075
|
if (headerId) {
|
|
17052
|
-
var _skeHeaders$get;
|
|
17053
|
-
|
|
17076
|
+
var _headerTreeMap$get, _skeHeaders$get;
|
|
17077
|
+
const fieldRanges = headerTreeMap === null || headerTreeMap === void 0 || (_headerTreeMap$get = headerTreeMap.get(headerId)) === null || _headerTreeMap$get === void 0 || (_headerTreeMap$get = _headerTreeMap$get.getBody()) === null || _headerTreeMap$get === void 0 ? void 0 : _headerTreeMap$get.customRanges;
|
|
17078
|
+
const dynamic = fieldRanges === null || fieldRanges === void 0 ? void 0 : fieldRanges.some((range) => {
|
|
17079
|
+
var _range$properties, _range$properties2, _range$properties3;
|
|
17080
|
+
return range.rangeType === CustomRangeType.FIELD && ((_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.locked) !== BooleanNumber.TRUE && (((_range$properties2 = range.properties) === null || _range$properties2 === void 0 ? void 0 : _range$properties2.fieldType) === "PAGE" || ((_range$properties3 = range.properties) === null || _range$properties3 === void 0 ? void 0 : _range$properties3.fieldType) === "NUMPAGES");
|
|
17081
|
+
});
|
|
17082
|
+
const key = dynamic ? JSON.stringify([
|
|
17083
|
+
sectionId,
|
|
17084
|
+
pageNumber,
|
|
17085
|
+
pageWidth,
|
|
17086
|
+
marginLeft,
|
|
17087
|
+
marginRight,
|
|
17088
|
+
ctx.hasNumPagesFields ? ctx.fieldPageCount : void 0
|
|
17089
|
+
]) : pageWidth;
|
|
17090
|
+
if (typeof key === "string") page.headerLayoutKey = key;
|
|
17091
|
+
if ((_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.has(key)) {
|
|
17054
17092
|
var _skeHeaders$get2;
|
|
17055
|
-
header = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(
|
|
17093
|
+
header = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(key);
|
|
17056
17094
|
} else if (headerTreeMap && headerTreeMap.has(headerId)) {
|
|
17057
|
-
|
|
17095
|
+
const previousFieldContext = ctx.headerFooterFieldContext;
|
|
17096
|
+
ctx.headerFooterFieldContext = dynamic ? {
|
|
17097
|
+
pageNumber,
|
|
17098
|
+
pageCount: ctx.fieldPageCount
|
|
17099
|
+
} : void 0;
|
|
17100
|
+
try {
|
|
17101
|
+
header = _createSkeletonHeaderFooter(ctx, headerTreeMap.get(headerId), sectionBreakConfig, skeletonResourceReference, headerId, true);
|
|
17102
|
+
header.fieldsResolved = Boolean(dynamic);
|
|
17103
|
+
} finally {
|
|
17104
|
+
ctx.headerFooterFieldContext = previousFieldContext;
|
|
17105
|
+
}
|
|
17058
17106
|
const widths = skeHeaders.get(headerId) ?? /* @__PURE__ */ new Map();
|
|
17059
|
-
widths.set(
|
|
17107
|
+
widths.set(key, header);
|
|
17060
17108
|
skeHeaders.set(headerId, widths);
|
|
17061
17109
|
}
|
|
17062
17110
|
page.headerId = headerId;
|
|
17063
17111
|
}
|
|
17064
17112
|
if (footerId) {
|
|
17065
|
-
var _skeFooters$get;
|
|
17066
|
-
|
|
17113
|
+
var _footerTreeMap$get, _skeFooters$get;
|
|
17114
|
+
const fieldRanges = footerTreeMap === null || footerTreeMap === void 0 || (_footerTreeMap$get = footerTreeMap.get(footerId)) === null || _footerTreeMap$get === void 0 || (_footerTreeMap$get = _footerTreeMap$get.getBody()) === null || _footerTreeMap$get === void 0 ? void 0 : _footerTreeMap$get.customRanges;
|
|
17115
|
+
const dynamic = fieldRanges === null || fieldRanges === void 0 ? void 0 : fieldRanges.some((range) => {
|
|
17116
|
+
var _range$properties4, _range$properties5, _range$properties6;
|
|
17117
|
+
return range.rangeType === CustomRangeType.FIELD && ((_range$properties4 = range.properties) === null || _range$properties4 === void 0 ? void 0 : _range$properties4.locked) !== BooleanNumber.TRUE && (((_range$properties5 = range.properties) === null || _range$properties5 === void 0 ? void 0 : _range$properties5.fieldType) === "PAGE" || ((_range$properties6 = range.properties) === null || _range$properties6 === void 0 ? void 0 : _range$properties6.fieldType) === "NUMPAGES");
|
|
17118
|
+
});
|
|
17119
|
+
const key = dynamic ? JSON.stringify([
|
|
17120
|
+
sectionId,
|
|
17121
|
+
pageNumber,
|
|
17122
|
+
pageWidth,
|
|
17123
|
+
marginLeft,
|
|
17124
|
+
marginRight,
|
|
17125
|
+
ctx.hasNumPagesFields ? ctx.fieldPageCount : void 0
|
|
17126
|
+
]) : pageWidth;
|
|
17127
|
+
if (typeof key === "string") page.footerLayoutKey = key;
|
|
17128
|
+
if ((_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.has(key)) {
|
|
17067
17129
|
var _skeFooters$get2;
|
|
17068
|
-
footer = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(
|
|
17130
|
+
footer = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(key);
|
|
17069
17131
|
} else if (footerTreeMap && footerTreeMap.has(footerId)) {
|
|
17070
|
-
|
|
17132
|
+
const previousFieldContext = ctx.headerFooterFieldContext;
|
|
17133
|
+
ctx.headerFooterFieldContext = dynamic ? {
|
|
17134
|
+
pageNumber,
|
|
17135
|
+
pageCount: ctx.fieldPageCount
|
|
17136
|
+
} : void 0;
|
|
17137
|
+
try {
|
|
17138
|
+
footer = _createSkeletonHeaderFooter(ctx, footerTreeMap.get(footerId), sectionBreakConfig, skeletonResourceReference, footerId, false);
|
|
17139
|
+
footer.fieldsResolved = Boolean(dynamic);
|
|
17140
|
+
} finally {
|
|
17141
|
+
ctx.headerFooterFieldContext = previousFieldContext;
|
|
17142
|
+
}
|
|
17071
17143
|
const widths = skeFooters.get(footerId) ?? /* @__PURE__ */ new Map();
|
|
17072
|
-
widths.set(
|
|
17144
|
+
widths.set(key, footer);
|
|
17073
17145
|
skeFooters.set(footerId, widths);
|
|
17074
17146
|
}
|
|
17075
17147
|
page.footerId = footerId;
|
|
@@ -17078,6 +17150,29 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
17078
17150
|
page.originMarginBottom = marginBottom;
|
|
17079
17151
|
page.marginTop = _getVerticalMargin(marginTop, header);
|
|
17080
17152
|
page.marginBottom = _getVerticalMargin(marginBottom, footer);
|
|
17153
|
+
if (ctx.headerFooterMinimumMargins) for (const [id, layoutKey, margin] of [[
|
|
17154
|
+
headerId,
|
|
17155
|
+
page.headerLayoutKey,
|
|
17156
|
+
"marginTop"
|
|
17157
|
+
], [
|
|
17158
|
+
footerId,
|
|
17159
|
+
page.footerLayoutKey,
|
|
17160
|
+
"marginBottom"
|
|
17161
|
+
]]) {
|
|
17162
|
+
if (layoutKey == null) continue;
|
|
17163
|
+
const key = JSON.stringify([
|
|
17164
|
+
id,
|
|
17165
|
+
sectionId,
|
|
17166
|
+
pageNumber,
|
|
17167
|
+
pageWidth,
|
|
17168
|
+
marginLeft,
|
|
17169
|
+
marginRight,
|
|
17170
|
+
margin
|
|
17171
|
+
]);
|
|
17172
|
+
const maximum = Math.max(page[margin], ctx.headerFooterMinimumMargins.get(key) ?? 0);
|
|
17173
|
+
ctx.headerFooterMinimumMargins.set(key, maximum);
|
|
17174
|
+
if (ctx.fieldCountCycle) page[margin] = maximum;
|
|
17175
|
+
}
|
|
17081
17176
|
const sections = page.sections;
|
|
17082
17177
|
const lastSection = sections[sections.length - 1];
|
|
17083
17178
|
const { marginTop: curPageMT, marginBottom: curPageMB, marginLeft: curPageML, marginRight: curPageMR } = page;
|
|
@@ -17394,8 +17489,13 @@ function resetCellDrawingAnchors(ctx, cellNode, tableId) {
|
|
|
17394
17489
|
if (!anchors) return;
|
|
17395
17490
|
for (const paragraph of cellNode.children[0].children) anchors.delete(paragraph.endIndex);
|
|
17396
17491
|
}
|
|
17397
|
-
function createSkeletonCellPages(
|
|
17492
|
+
function createSkeletonCellPages(parentContext, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY, cellPageHeights) {
|
|
17398
17493
|
var _ctx$dataModel, _ctx$dataModel$getBod;
|
|
17494
|
+
const ctx = {
|
|
17495
|
+
...parentContext,
|
|
17496
|
+
isDirty: false,
|
|
17497
|
+
layoutStartPointer: { ...parentContext.layoutStartPointer }
|
|
17498
|
+
};
|
|
17399
17499
|
const sectionNode = cellNode.children[0];
|
|
17400
17500
|
const body = (_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);
|
|
17401
17501
|
const { enableDocumentTableLineGrid, inheritDocumentLinePitch } = getCellLineGridOptions(sectionBreakConfig);
|
|
@@ -17434,7 +17534,12 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
17434
17534
|
finishVerticalCellLayout(pages, verticalCellWidth);
|
|
17435
17535
|
return pages;
|
|
17436
17536
|
}
|
|
17437
|
-
function startSkeletonCellPagesBuild(
|
|
17537
|
+
function startSkeletonCellPagesBuild(parentContext, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY, cellPageHeights) {
|
|
17538
|
+
const ctx = {
|
|
17539
|
+
...parentContext,
|
|
17540
|
+
isDirty: false,
|
|
17541
|
+
layoutStartPointer: { ...parentContext.layoutStartPointer }
|
|
17542
|
+
};
|
|
17438
17543
|
const sectionNode = cellNode.children[0];
|
|
17439
17544
|
const { enableDocumentTableLineGrid, inheritDocumentLinePitch } = getCellLineGridOptions(sectionBreakConfig);
|
|
17440
17545
|
const { page, sectionBreakConfig: cellSectionBreakConfig, verticalCellWidth } = createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight, maxCellPageHeight, inheritDocumentLinePitch, enableDocumentTableLineGrid, cellPageHeights);
|
|
@@ -18140,6 +18245,7 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
|
|
|
18140
18245
|
marginTop: 0,
|
|
18141
18246
|
spaceBelowApply: (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0
|
|
18142
18247
|
} : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, preLine, _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
|
|
18248
|
+
if (preLine) marginTop += sectionBreakConfig.lineGap ?? 0;
|
|
18143
18249
|
if (startingSection && marginTop > 0 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy)) marginTop = _collapseSectionBeforeSpacing(ctx, startingSection.children[0].startIndex - 2, marginTop);
|
|
18144
18250
|
if (positionedCustomBlockOnly) spaceBelowApply = 0;
|
|
18145
18251
|
const isHiddenCellEndMark = lastPage.type === 3 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy) && sectionBreakConfig.cellHiddenEndMarkIndex === paragraphIndex && paragraphConfig.bulletSkeleton == null && glyphGroup.length > 0 && glyphGroup.every(__isStructuralTerminatorGlyph);
|
|
@@ -18277,8 +18383,8 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
18277
18383
|
const initialFootnoteTop = lastPage.type === 4 && lastPage.pageNumber === 1 && columnInfo.index === ((_ctx$footnoteFirstCol = ctx.footnoteFirstColumn) === null || _ctx$footnoteFirstCol === void 0 ? void 0 : _ctx$footnoteFirstCol.index) ? ctx.footnoteFirstColumn.top : 0;
|
|
18278
18384
|
const lineTop = preLineHeight + ((preLine === null || preLine === void 0 ? void 0 : preLine.top) ?? initialFootnoteTop);
|
|
18279
18385
|
const { pageWidth, headerId, footerId } = lastPage;
|
|
18280
|
-
const headerPage = skeHeaders === null || skeHeaders === void 0 || (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
18281
|
-
const footerPage = skeFooters === null || skeFooters === void 0 || (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
18386
|
+
const headerPage = skeHeaders === null || skeHeaders === void 0 || (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(lastPage.headerLayoutKey ?? pageWidth);
|
|
18387
|
+
const footerPage = skeFooters === null || skeFooters === void 0 || (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(lastPage.footerLayoutKey ?? pageWidth);
|
|
18282
18388
|
let needOpenNewPageByTableLayout = false;
|
|
18283
18389
|
const { deferredInlineGroupAnchorDrawings, deferredTopBottomAnchorDrawings } = _positionLineDrawings(ctx, glyphGroup, column, lastPage, paragraphConfig, lineTop, lineHeight, paragraphAnchorLeft, hasInlineCustomBlock, isParagraphFirstShapedText);
|
|
18284
18390
|
if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
|
|
@@ -18339,7 +18445,11 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
18339
18445
|
if (borderTopSpace > 0) newLine.borderTopSpace = borderTopSpace;
|
|
18340
18446
|
if (borderBottomSpace > 0) newLine.borderBottomSpace = borderBottomSpace;
|
|
18341
18447
|
const blockAnchorTop = deferredTopBottomAnchorDrawings.length > 0 ? newLineTop : lineTop;
|
|
18342
|
-
if (!isStandalonePageBoundary)
|
|
18448
|
+
if (!isStandalonePageBoundary) {
|
|
18449
|
+
createAndUpdateBlockAnchor(paragraphIndex, newLine, blockAnchorTop, pDrawingAnchor);
|
|
18450
|
+
const paragraphDrawingAnchor = pDrawingAnchor === null || pDrawingAnchor === void 0 ? void 0 : pDrawingAnchor.get(paragraphIndex);
|
|
18451
|
+
if (paragraphDrawingAnchor) paragraphDrawingAnchor.left = paragraphAnchorLeft;
|
|
18452
|
+
}
|
|
18343
18453
|
if (deferredTopBottomAnchorDrawings.length > 0) {
|
|
18344
18454
|
__updateAndPositionDrawings(ctx, newLineTop, lineHeight, column, deferredTopBottomAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, blockAnchorTop, paragraphAnchorLeft, false, true);
|
|
18345
18455
|
__updateTopBottomCustomBlockFlowBottom(paragraphConfig, deferredTopBottomAnchorDrawings, section.top);
|
|
@@ -18354,6 +18464,10 @@ function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDra
|
|
|
18354
18464
|
if (targetDrawings.length === 0) return;
|
|
18355
18465
|
const drawings = __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
18356
18466
|
if (drawings == null || drawings.size === 0) return;
|
|
18467
|
+
for (const drawing of drawings.values()) if (drawing.drawingOrigin.docTransform.positionV.relativeFrom === ObjectRelativeFromV.LINE) {
|
|
18468
|
+
var _ctx$skeletonResource;
|
|
18469
|
+
drawing.blockAnchorLeft = ((_ctx$skeletonResource = ctx.skeletonResourceReference) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.drawingAnchor) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.get(column.parent.parent.segmentId)) === null || _ctx$skeletonResource === void 0 || (_ctx$skeletonResource = _ctx$skeletonResource.get(paragraphIndex)) === null || _ctx$skeletonResource === void 0 ? void 0 : _ctx$skeletonResource.left) ?? drawing.blockAnchorLeft;
|
|
18470
|
+
}
|
|
18357
18471
|
const floatObjects = [...drawings.values()].filter((drawing) => {
|
|
18358
18472
|
const layoutType = drawing.drawingOrigin.layoutType;
|
|
18359
18473
|
return layoutType !== PositionedObjectLayoutType.INLINE && layoutType !== PositionedObjectLayoutType.WRAP_NONE;
|
|
@@ -18826,7 +18940,7 @@ function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitc
|
|
|
18826
18940
|
lineSpacingApply: exactLineSpacingApply
|
|
18827
18941
|
};
|
|
18828
18942
|
}
|
|
18829
|
-
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings, documentCompatibilityPolicy) {
|
|
18943
|
+
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId = "", blockAnchorTop, paragraphNonInlineSkeDrawings, documentCompatibilityPolicy, blockAnchorLeft = 0, normalizeTraditionalColumnAnchor = false) {
|
|
18830
18944
|
var _line$parent;
|
|
18831
18945
|
const column = line.parent;
|
|
18832
18946
|
const section = column === null || column === void 0 ? void 0 : column.parent;
|
|
@@ -18892,6 +19006,9 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, unitId =
|
|
|
18892
19006
|
drawing.lineTop = lineTop;
|
|
18893
19007
|
drawing.columnLeft = column.left;
|
|
18894
19008
|
drawing.blockAnchorTop = blockAnchorTop == null ? lineTop : sectionTop + blockAnchorTop;
|
|
19009
|
+
drawing.blockAnchorLeft = blockAnchorLeft;
|
|
19010
|
+
drawing.normalizeTraditionalColumnAnchor = normalizeTraditionalColumnAnchor;
|
|
19011
|
+
drawing.pageAnchorLeft = normalizeTraditionalColumnAnchor ? page.marginLeft : 0;
|
|
18895
19012
|
drawing.lineHeight = line.lineHeight;
|
|
18896
19013
|
drawings.set(drawing.drawingId, drawing);
|
|
18897
19014
|
}
|
|
@@ -18949,6 +19066,9 @@ function __getDrawingPosition(ctx, lineTop, lineHeight, column, isParagraphFirst
|
|
|
18949
19066
|
} : void 0;
|
|
18950
19067
|
drawing.initialState = true;
|
|
18951
19068
|
drawing.columnLeft = column.left;
|
|
19069
|
+
drawing.blockAnchorLeft = blockAnchorLeft;
|
|
19070
|
+
drawing.normalizeTraditionalColumnAnchor = normalizeTraditionalColumnAnchor && ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL;
|
|
19071
|
+
drawing.pageAnchorLeft = ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL ? page.marginLeft : 0;
|
|
18952
19072
|
drawing.lineTop = absoluteLineTop;
|
|
18953
19073
|
drawing.lineHeight = lineHeight;
|
|
18954
19074
|
drawing.isPageBreak = isPageBreak;
|
|
@@ -19364,7 +19484,7 @@ function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
|
19364
19484
|
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);
|
|
19365
19485
|
if (affectInlineDrawings && affectInlineDrawings.size > 0) {
|
|
19366
19486
|
var _ctx$dataModel$getUni, _ctx$dataModel;
|
|
19367
|
-
updateInlineDrawingPosition(line, affectInlineDrawings, ((_ctx$dataModel$getUni = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni === void 0 ? void 0 : _ctx$dataModel$getUni.call(_ctx$dataModel)) ?? "", drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings, paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.documentCompatibilityPolicy);
|
|
19487
|
+
updateInlineDrawingPosition(line, affectInlineDrawings, ((_ctx$dataModel$getUni = (_ctx$dataModel = ctx.dataModel).getUnitId) === null || _ctx$dataModel$getUni === void 0 ? void 0 : _ctx$dataModel$getUni.call(_ctx$dataModel)) ?? "", drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings, paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.documentCompatibilityPolicy, drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.left, ctx.dataModel.documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL);
|
|
19368
19488
|
}
|
|
19369
19489
|
const paragraphStyle = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphStyle;
|
|
19370
19490
|
const paragraphBackgroundColor = paragraphStyle === null || paragraphStyle === void 0 || (_paragraphStyle$shadi = paragraphStyle.shading) === null || _paragraphStyle$shadi === void 0 ? void 0 : _paragraphStyle$shadi.backgroundColor;
|
|
@@ -19484,7 +19604,7 @@ function documentSkeletonTableIterator(pages, options = {}) {
|
|
|
19484
19604
|
unitId
|
|
19485
19605
|
});
|
|
19486
19606
|
const rootPageDocumentLeft = docsLeft + rootPage.marginLeft;
|
|
19487
|
-
const headerPage = rootPage.headerId == null ? void 0 : skeHeaders === null || skeHeaders === void 0 || (_skeHeaders$get = skeHeaders.get(rootPage.headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(rootPage.pageWidth);
|
|
19607
|
+
const headerPage = rootPage.headerId == null ? void 0 : skeHeaders === null || skeHeaders === void 0 || (_skeHeaders$get = skeHeaders.get(rootPage.headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(rootPage.headerLayoutKey ?? rootPage.pageWidth);
|
|
19488
19608
|
if (headerPage != null) collectPageTables({
|
|
19489
19609
|
contexts,
|
|
19490
19610
|
docsLeft,
|
|
@@ -19499,7 +19619,7 @@ function documentSkeletonTableIterator(pages, options = {}) {
|
|
|
19499
19619
|
tableCellInsetX,
|
|
19500
19620
|
unitId
|
|
19501
19621
|
});
|
|
19502
|
-
const footerPage = rootPage.footerId == null ? void 0 : skeFooters === null || skeFooters === void 0 || (_skeFooters$get = skeFooters.get(rootPage.footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(rootPage.pageWidth);
|
|
19622
|
+
const footerPage = rootPage.footerId == null ? void 0 : skeFooters === null || skeFooters === void 0 || (_skeFooters$get = skeFooters.get(rootPage.footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(rootPage.footerLayoutKey ?? rootPage.pageWidth);
|
|
19503
19623
|
if (footerPage != null) collectPageTables({
|
|
19504
19624
|
contexts,
|
|
19505
19625
|
docsLeft,
|
|
@@ -21095,6 +21215,26 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
21095
21215
|
for (const glyph of shapedGlyphs) if (isCjkLeftAlignedPunctuation(glyph.content) || isCjkRightAlignedPunctuation(glyph.content) || isCjkCenterAlignedPunctuation(glyph.content)) glyph.adjustability.shrinkability = [0, 0];
|
|
21096
21216
|
}
|
|
21097
21217
|
if (((_sectionBreakConfig$r5 = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r5 === void 0 ? void 0 : _sectionBreakConfig$r5.preservePunctuationSpacing) !== BooleanNumber.TRUE && (!traditionalLayout || fixedPunctuationPairs)) punctuationSpaceAdjustment(shapedGlyphs, fixedPunctuationPairs);
|
|
21218
|
+
if (ctx.headerFooterFieldContext) {
|
|
21219
|
+
let index = paragraphNode.contentStartIndex + last;
|
|
21220
|
+
for (let glyphIndex = 0; glyphIndex < shapedGlyphs.length; glyphIndex++) {
|
|
21221
|
+
var _viewModel$getBody3, _glyph$fontStyle, _glyph$ts2;
|
|
21222
|
+
const glyph = shapedGlyphs[glyphIndex];
|
|
21223
|
+
const resolved = resolveHeaderFooterFieldGlyph(glyph, index, index + glyph.count - 1, ((_viewModel$getBody3 = viewModel.getBody()) === null || _viewModel$getBody3 === void 0 ? void 0 : _viewModel$getBody3.customRanges) ?? [], ctx.headerFooterFieldContext.pageNumber, ctx.headerFooterFieldContext.pageCount);
|
|
21224
|
+
index += glyph.count;
|
|
21225
|
+
if (resolved === glyph) continue;
|
|
21226
|
+
const font = (_glyph$fontStyle = glyph.fontStyle) === null || _glyph$fontStyle === void 0 ? void 0 : _glyph$fontStyle.fontString;
|
|
21227
|
+
const widthDelta = resolved.content && font ? (FontCache.getMeasureText(resolved.content, font).width - FontCache.getMeasureText(glyph.content, font).width) * getTextHorizontalScale((_glyph$ts2 = glyph.ts) === null || _glyph$ts2 === void 0 ? void 0 : _glyph$ts2.sa) : -glyph.width;
|
|
21228
|
+
shapedGlyphs[glyphIndex] = {
|
|
21229
|
+
...resolved,
|
|
21230
|
+
width: Math.max(0, glyph.width + widthDelta),
|
|
21231
|
+
bBox: {
|
|
21232
|
+
...glyph.bBox,
|
|
21233
|
+
width: Math.max(0, glyph.bBox.width + widthDelta)
|
|
21234
|
+
}
|
|
21235
|
+
};
|
|
21236
|
+
}
|
|
21237
|
+
}
|
|
21098
21238
|
appendShapedText(shapedTextList, shapedGlyphs, bk.type, paragraphStyle.fixedTabStops === BooleanNumber.TRUE);
|
|
21099
21239
|
last = bk.position;
|
|
21100
21240
|
}
|
|
@@ -21106,8 +21246,7 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
21106
21246
|
//#endregion
|
|
21107
21247
|
//#region src/components/docs/layout/document-layout-page-patch.ts
|
|
21108
21248
|
function withoutParent(value) {
|
|
21109
|
-
const
|
|
21110
|
-
delete copy.parent;
|
|
21249
|
+
const { parent: _parent, ...copy } = value;
|
|
21111
21250
|
return copy;
|
|
21112
21251
|
}
|
|
21113
21252
|
function serializeDivide(source) {
|
|
@@ -21175,10 +21314,10 @@ function serializeDocumentSkeletonPage(source, omitResourceSources = false) {
|
|
|
21175
21314
|
return {
|
|
21176
21315
|
...geometry,
|
|
21177
21316
|
sections: source.sections.map(serializeSection),
|
|
21178
|
-
noteDecorations
|
|
21317
|
+
...noteDecorations == null ? {} : { noteDecorations: noteDecorations.map((decoration) => ({
|
|
21179
21318
|
...decoration,
|
|
21180
21319
|
page: serializeDocumentSkeletonPage(decoration.page, omitResourceSources)
|
|
21181
|
-
})),
|
|
21320
|
+
})) },
|
|
21182
21321
|
...notes == null ? {} : { notes: notes.map((note) => ({
|
|
21183
21322
|
...withoutParent(note),
|
|
21184
21323
|
page: serializeDocumentSkeletonPage(note.page, omitResourceSources)
|
|
@@ -21318,18 +21457,18 @@ function hydrateDocumentSkeletonPageMaterializationPlaceholder(source, parent) {
|
|
|
21318
21457
|
return placeholder;
|
|
21319
21458
|
}
|
|
21320
21459
|
function hydrateDocumentSkeletonPageInternal(source, parent, snapshot, resourceSegmentId) {
|
|
21321
|
-
|
|
21460
|
+
const { notes, noteDecorations, ...geometry } = source;
|
|
21322
21461
|
const page = {
|
|
21323
|
-
...
|
|
21462
|
+
...geometry,
|
|
21324
21463
|
sections: [],
|
|
21325
|
-
noteDecorations
|
|
21464
|
+
...noteDecorations == null ? {} : { noteDecorations: noteDecorations.map((decoration) => ({
|
|
21326
21465
|
...decoration,
|
|
21327
21466
|
page: hydrateDocumentSkeletonPageInternal(decoration.page, void 0, snapshot, decoration.page.segmentId)
|
|
21328
|
-
})),
|
|
21329
|
-
notes
|
|
21467
|
+
})) },
|
|
21468
|
+
...notes == null ? {} : { notes: notes.map((note) => ({
|
|
21330
21469
|
...note,
|
|
21331
21470
|
page: hydrateDocumentSkeletonPageInternal(note.page, void 0, snapshot, note.noteId)
|
|
21332
|
-
})),
|
|
21471
|
+
})) },
|
|
21333
21472
|
skeDrawings: new Map(source.skeDrawings.map(([drawingId, drawing]) => [drawingId, hydrateDrawing(drawing, snapshot, resourceSegmentId)])),
|
|
21334
21473
|
skeTables: /* @__PURE__ */ new Map(),
|
|
21335
21474
|
skeColumnGroups: /* @__PURE__ */ new Map(),
|
|
@@ -23202,6 +23341,8 @@ function serializePaginatedContinuationCheckpoint(page) {
|
|
|
23202
23341
|
sectionId: page.sectionId,
|
|
23203
23342
|
headerId: page.headerId,
|
|
23204
23343
|
footerId: page.footerId,
|
|
23344
|
+
headerLayoutKey: page.headerLayoutKey,
|
|
23345
|
+
footerLayoutKey: page.footerLayoutKey,
|
|
23205
23346
|
pageWidth: page.pageWidth,
|
|
23206
23347
|
pageHeight: page.pageHeight,
|
|
23207
23348
|
pageOrient: page.pageOrient,
|
|
@@ -23278,7 +23419,7 @@ function getSegmentPageFromRelativePath(skeletonData, segmentPageIndex, path) {
|
|
|
23278
23419
|
const rootPage = skeletonData.pages[segmentPageIndex];
|
|
23279
23420
|
if (rootPage == null) return null;
|
|
23280
23421
|
const { headerId, footerId, pageWidth } = rootPage;
|
|
23281
|
-
const segmentPages = [headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(pageWidth), footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(pageWidth)];
|
|
23422
|
+
const segmentPages = [headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(rootPage.headerLayoutKey ?? pageWidth), footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(rootPage.footerLayoutKey ?? pageWidth)];
|
|
23282
23423
|
for (const segmentPage of segmentPages) {
|
|
23283
23424
|
if (segmentPage == null) continue;
|
|
23284
23425
|
const page = getPageFromPath({
|
|
@@ -23309,6 +23450,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23309
23450
|
_defineProperty(this, "_languageDetector", LanguageDetector.getInstance());
|
|
23310
23451
|
_defineProperty(this, "_initialWidth", 0);
|
|
23311
23452
|
_defineProperty(this, "_paginationMetrics", null);
|
|
23453
|
+
_defineProperty(this, "_completedPageCount", void 0);
|
|
23312
23454
|
_defineProperty(this, "_lastCompleteSkeletonData", null);
|
|
23313
23455
|
_defineProperty(this, "_pendingInvalidationAnchor", null);
|
|
23314
23456
|
_defineProperty(this, "_layoutGeneration", 0);
|
|
@@ -23321,7 +23463,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23321
23463
|
_defineProperty(this, "_isolateIncrementalPublications", void 0);
|
|
23322
23464
|
_defineProperty(this, "_modernPageWidth", void 0);
|
|
23323
23465
|
_defineProperty(this, "_modernHorizontalMargin", void 0);
|
|
23466
|
+
_defineProperty(this, "_lineGap", void 0);
|
|
23324
23467
|
this._isolateIncrementalPublications = options.isolateIncrementalPublications !== false;
|
|
23468
|
+
this._lineGap = options.lineGap ?? 0;
|
|
23325
23469
|
}
|
|
23326
23470
|
static create(docViewModel, localeService, options) {
|
|
23327
23471
|
return new DocumentSkeleton(docViewModel, localeService, options);
|
|
@@ -23333,6 +23477,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23333
23477
|
this._layoutPageMaterialized$.complete();
|
|
23334
23478
|
this._skeletonData = null;
|
|
23335
23479
|
this._lastCompleteSkeletonData = null;
|
|
23480
|
+
this._completedPageCount = void 0;
|
|
23336
23481
|
this._pendingInvalidationAnchor = null;
|
|
23337
23482
|
this._externalLayoutProgress = null;
|
|
23338
23483
|
this._externalProtectedPages = null;
|
|
@@ -23350,14 +23495,21 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23350
23495
|
* PS: This method has significant impact on performance.
|
|
23351
23496
|
*/
|
|
23352
23497
|
calculate(bounds) {
|
|
23498
|
+
var _this$_skeletonData;
|
|
23353
23499
|
if (!this.dirty) return;
|
|
23354
23500
|
this.cancelIncrementalLayout();
|
|
23355
23501
|
this._externalLayoutProgress = null;
|
|
23356
23502
|
this._externalProtectedPages = null;
|
|
23357
23503
|
this._externalProtectedContinuousLayout = null;
|
|
23358
|
-
|
|
23359
|
-
|
|
23504
|
+
let ctx = this._prepareLayoutContext();
|
|
23505
|
+
while (true) {
|
|
23506
|
+
this._skeletonData = this._createSkeleton(ctx, bounds);
|
|
23507
|
+
const retry = this._prepareFieldCountRetry(ctx);
|
|
23508
|
+
if (retry == null) break;
|
|
23509
|
+
ctx = retry;
|
|
23510
|
+
}
|
|
23360
23511
|
this._lastCompleteSkeletonData = this._skeletonData;
|
|
23512
|
+
this._completedPageCount = (_this$_skeletonData = this._skeletonData) === null || _this$_skeletonData === void 0 ? void 0 : _this$_skeletonData.pages.length;
|
|
23361
23513
|
this._pendingInvalidationAnchor = null;
|
|
23362
23514
|
this._paginationMetrics = ctx.paginationMetrics ?? null;
|
|
23363
23515
|
this._dirty$.next(true);
|
|
@@ -23431,6 +23583,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23431
23583
|
lastPublishedBlockCount: incrementalStart.processedBlockCount,
|
|
23432
23584
|
publicationRevision: 0,
|
|
23433
23585
|
reuseUnaffectedTail: (options === null || options === void 0 ? void 0 : options.reuseUnaffectedTail) !== false,
|
|
23586
|
+
paginationRevision: 0,
|
|
23434
23587
|
allowMetadataOnlyStructuralTailReuse: (options === null || options === void 0 ? void 0 : options.allowMetadataOnlyStructuralTailReuse) === true,
|
|
23435
23588
|
reusedTail: false,
|
|
23436
23589
|
tailConvergencePageCount: incrementalStart.ctx.skeleton.pages.length,
|
|
@@ -23477,7 +23630,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23477
23630
|
const hasEarlierOverlappingRange = anchorPageIndex > 0 && previousSkeleton.pages.slice(0, anchorPageIndex).some((page) => previousAnchor >= page.st && previousAnchor <= page.ed);
|
|
23478
23631
|
const anchorBlockOwnsTable = blocks[anchorBlockIndex].block.children.some((child) => child.nodeType === DataStreamTreeNodeType.TABLE && anchor >= child.startIndex && anchor <= child.endIndex);
|
|
23479
23632
|
const canResumePlainParagraph = blocks[anchorBlockIndex].block.nodeType === DataStreamTreeNodeType.PARAGRAPH && blocks[anchorBlockIndex].block.children.length === 0;
|
|
23480
|
-
if (mode === "paginated" && reuseInteractionPagePrefix && canResumePlainParagraph && !((_previousSkeleton$pag = previousSkeleton.pages[anchorPageIndex]) === null || _previousSkeleton$pag === void 0 || (_previousSkeleton$pag = _previousSkeleton$pag.notes) === null || _previousSkeleton$pag === void 0 ? void 0 : _previousSkeleton$pag.length)) {
|
|
23633
|
+
if (mode === "paginated" && reuseInteractionPagePrefix && invalidation != null && canResumePlainParagraph && !((_previousSkeleton$pag = previousSkeleton.pages[anchorPageIndex]) === null || _previousSkeleton$pag === void 0 || (_previousSkeleton$pag = _previousSkeleton$pag.notes) === null || _previousSkeleton$pag === void 0 ? void 0 : _previousSkeleton$pag.length)) {
|
|
23481
23634
|
const interactionPreviousAnchor = mapCurrentOffsetToPrevious(anchor, invalidation);
|
|
23482
23635
|
const interactionPageIndex = interactionSkeleton == null ? -1 : this._findBodyPageIndex(interactionSkeleton.pages, interactionPreviousAnchor);
|
|
23483
23636
|
const paginatedPrefix = this._preparePaginatedParagraphPrefix(ctx, interactionSkeleton ?? previousSkeleton, blocks[anchorBlockIndex], anchorBlockIndex, interactionPageIndex, invalidation);
|
|
@@ -23807,11 +23960,13 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23807
23960
|
const publishedPageCount = state.mode === "continuous" ? pageCount : state.complete ? state.reusedTail ? pageCount : shouldPublishPriority ? Math.max(state.lastPublishedPageCount, priorityPublishedPageCount) : Math.min(pageCount, state.lastPublishedPageCount + 1) : shouldPublishPriority ? Math.max(state.lastPublishedPageCount, priorityPublishedPageCount) : Math.min(stableComputedPageCount, state.lastPublishedPageCount + 1);
|
|
23808
23961
|
let didPublish = false;
|
|
23809
23962
|
let didPublishAnchor = false;
|
|
23810
|
-
if (!state.cancelled && canPublish && (!suppressPreAnchorPublication || shouldPublishPriority || state.complete)) {
|
|
23963
|
+
if (!state.cancelled && canPublish && (state.ctx.fieldCountCandidates == null || state.complete) && (!suppressPreAnchorPublication || shouldPublishPriority || state.complete)) {
|
|
23811
23964
|
if (state.mode === "paginated") this._finalizePaginatedPagesForPublication(state, publishedPageCount);
|
|
23812
23965
|
const isFinalPublication = state.complete && publishedPageCount >= pageCount;
|
|
23813
23966
|
if (isFinalPublication) {
|
|
23967
|
+
var _state$ctx$skeleton;
|
|
23814
23968
|
this._lastCompleteSkeletonData = state.ctx.skeleton;
|
|
23969
|
+
this._completedPageCount = (_state$ctx$skeleton = state.ctx.skeleton) === null || _state$ctx$skeleton === void 0 ? void 0 : _state$ctx$skeleton.pages.length;
|
|
23815
23970
|
this._pendingInvalidationAnchor = null;
|
|
23816
23971
|
}
|
|
23817
23972
|
this._skeletonData = isFinalPublication ? state.ctx.skeleton : !this._isolateIncrementalPublications && state.mode === "paginated" ? this._createSharedPublishablePartialSkeleton(state, publishedPageCount) : this._createPublishablePartialSkeleton(state, publishedPageCount);
|
|
@@ -23953,9 +24108,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23953
24108
|
* page or block range while the external executor publishes a newer tail.
|
|
23954
24109
|
*/
|
|
23955
24110
|
beginExternalLayout(options) {
|
|
23956
|
-
var _this$
|
|
24111
|
+
var _this$_skeletonData2;
|
|
23957
24112
|
this.cancelIncrementalLayout();
|
|
23958
|
-
const pages = ((_this$
|
|
24113
|
+
const pages = ((_this$_skeletonData2 = this._skeletonData) === null || _this$_skeletonData2 === void 0 ? void 0 : _this$_skeletonData2.pages) ?? [];
|
|
23959
24114
|
const protectedRange = options.protectedRange;
|
|
23960
24115
|
const protectedPageRange = (protectedRange === null || protectedRange === void 0 ? void 0 : protectedRange.mode) === "paginated" ? protectedRange : void 0;
|
|
23961
24116
|
if (protectedPageRange == null) this._externalProtectedPages = null;
|
|
@@ -24112,6 +24267,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24112
24267
|
if (progress.complete) {
|
|
24113
24268
|
setPageParent(skeletonData.pages, skeletonData);
|
|
24114
24269
|
this._lastCompleteSkeletonData = skeletonData;
|
|
24270
|
+
this._completedPageCount = skeletonData === null || skeletonData === void 0 ? void 0 : skeletonData.pages.length;
|
|
24115
24271
|
this._pendingInvalidationAnchor = null;
|
|
24116
24272
|
this._externalProtectedContinuousLayout = null;
|
|
24117
24273
|
}
|
|
@@ -24181,6 +24337,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24181
24337
|
if (publicationToApply.resources.drawingAnchor != null) skeletonData.drawingAnchor = hydrateDrawingAnchors(publicationToApply.resources.drawingAnchor);
|
|
24182
24338
|
setPageParent(skeletonData.pages, skeletonData);
|
|
24183
24339
|
this._lastCompleteSkeletonData = skeletonData;
|
|
24340
|
+
this._completedPageCount = skeletonData === null || skeletonData === void 0 ? void 0 : skeletonData.pages.length;
|
|
24184
24341
|
this._pendingInvalidationAnchor = null;
|
|
24185
24342
|
this._externalProtectedPages = null;
|
|
24186
24343
|
this._externalProtectedContinuousLayout = null;
|
|
@@ -24390,8 +24547,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24390
24547
|
};
|
|
24391
24548
|
}
|
|
24392
24549
|
findBodyPageIndexByCharIndex(charIndex) {
|
|
24393
|
-
var _this$
|
|
24394
|
-
return this._findBodyPageIndex(((_this$
|
|
24550
|
+
var _this$_skeletonData3;
|
|
24551
|
+
return this._findBodyPageIndex(((_this$_skeletonData3 = this._skeletonData) === null || _this$_skeletonData3 === void 0 ? void 0 : _this$_skeletonData3.pages) ?? [], charIndex);
|
|
24395
24552
|
}
|
|
24396
24553
|
findNodeByCharIndex(charIndex, segmentId = "", segmentPageIndex = -1) {
|
|
24397
24554
|
const nodes = this._findNodeByIndex(charIndex, segmentId, segmentPageIndex);
|
|
@@ -24410,12 +24567,12 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24410
24567
|
const { headerId, footerId, pageWidth } = skePage;
|
|
24411
24568
|
if (pageType === 1) {
|
|
24412
24569
|
var _skeHeaders$get;
|
|
24413
|
-
const skeHeader = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
24570
|
+
const skeHeader = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(skePage.headerLayoutKey ?? pageWidth);
|
|
24414
24571
|
if (skeHeader == null) return;
|
|
24415
24572
|
else skePage = skeHeader;
|
|
24416
24573
|
} else if (pageType === 2) {
|
|
24417
24574
|
var _skeFooters$get;
|
|
24418
|
-
const skeFooter = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
24575
|
+
const skeFooter = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(skePage.footerLayoutKey ?? pageWidth);
|
|
24419
24576
|
if (skeFooter == null) return;
|
|
24420
24577
|
else skePage = skeFooter;
|
|
24421
24578
|
}
|
|
@@ -24523,9 +24680,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24523
24680
|
let exactMatch = null;
|
|
24524
24681
|
if (editArea === "HEADER" || editArea === "FOOTER") {
|
|
24525
24682
|
var _skeHeaders$get2, _skeFooters$get2;
|
|
24526
|
-
const headerSke = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(pageWidth);
|
|
24683
|
+
const headerSke = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(page.headerLayoutKey ?? pageWidth);
|
|
24527
24684
|
if (headerSke) exactMatch = this._collectNearestNode(headerSke, 1, page, headerId, pi, cache, x, y, pageLength);
|
|
24528
|
-
const footerSke = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(pageWidth);
|
|
24685
|
+
const footerSke = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(page.footerLayoutKey ?? pageWidth);
|
|
24529
24686
|
if (footerSke) exactMatch = exactMatch ?? this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
24530
24687
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
24531
24688
|
if (exactMatch) return exactMatch;
|
|
@@ -24547,9 +24704,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24547
24704
|
const { headerId, footerId, pageWidth } = page;
|
|
24548
24705
|
if (segmentId !== "" && !this._docViewModel.getNoteTreeMap().has(segmentId)) {
|
|
24549
24706
|
var _skeHeaders$get3, _skeFooters$get3;
|
|
24550
|
-
const headerSke = (_skeHeaders$get3 = skeHeaders.get(headerId)) === null || _skeHeaders$get3 === void 0 ? void 0 : _skeHeaders$get3.get(pageWidth);
|
|
24707
|
+
const headerSke = (_skeHeaders$get3 = skeHeaders.get(headerId)) === null || _skeHeaders$get3 === void 0 ? void 0 : _skeHeaders$get3.get(page.headerLayoutKey ?? pageWidth);
|
|
24551
24708
|
if (headerSke) exactMatch = this._collectNearestNode(headerSke, 1, page, headerId, pi, cache, x, y, pageLength);
|
|
24552
|
-
const footerSke = (_skeFooters$get3 = skeFooters.get(footerId)) === null || _skeFooters$get3 === void 0 ? void 0 : _skeFooters$get3.get(pageWidth);
|
|
24709
|
+
const footerSke = (_skeFooters$get3 = skeFooters.get(footerId)) === null || _skeFooters$get3 === void 0 ? void 0 : _skeFooters$get3.get(page.footerLayoutKey ?? pageWidth);
|
|
24553
24710
|
if (footerSke) exactMatch = exactMatch ?? this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
24554
24711
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
24555
24712
|
if (exactMatch) return exactMatch;
|
|
@@ -24564,7 +24721,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24564
24721
|
continue;
|
|
24565
24722
|
}
|
|
24566
24723
|
const { headerId, pageWidth } = page;
|
|
24567
|
-
const segmentSke = segmentId === headerId ? (_skeHeaders$get4 = skeHeaders.get(segmentId)) === null || _skeHeaders$get4 === void 0 ? void 0 : _skeHeaders$get4.get(pageWidth) : (_skeFooters$get4 = skeFooters.get(segmentId)) === null || _skeFooters$get4 === void 0 ? void 0 : _skeFooters$get4.get(pageWidth);
|
|
24724
|
+
const segmentSke = segmentId === headerId ? (_skeHeaders$get4 = skeHeaders.get(segmentId)) === null || _skeHeaders$get4 === void 0 ? void 0 : _skeHeaders$get4.get(page.headerLayoutKey ?? pageWidth) : (_skeFooters$get4 = skeFooters.get(segmentId)) === null || _skeFooters$get4 === void 0 ? void 0 : _skeFooters$get4.get(page.footerLayoutKey ?? pageWidth);
|
|
24568
24725
|
if (segmentSke) exactMatch = this._collectNearestNode(segmentSke, segmentId === headerId ? 1 : 2, page, segmentId, segmentPage, cache, x, y, pageLength);
|
|
24569
24726
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
24570
24727
|
if (exactMatch) return exactMatch;
|
|
@@ -24734,11 +24891,13 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24734
24891
|
if (!isHitTestAddressableGlyph(glyph)) continue;
|
|
24735
24892
|
const startX = divideLeft + glyph.left;
|
|
24736
24893
|
const endX = startX + glyph.width;
|
|
24894
|
+
const contentTop = startY + (line.marginTop ?? 0) + (line.paddingTop ?? 0);
|
|
24737
24895
|
const node = {
|
|
24738
24896
|
node: glyph,
|
|
24739
24897
|
...segment,
|
|
24740
24898
|
ratioX: x / (startX + endX),
|
|
24741
|
-
ratioY: y / (startY + endY)
|
|
24899
|
+
ratioY: y / (startY + endY),
|
|
24900
|
+
isInsideGlyph: x >= startX && x <= endX && y >= contentTop && y <= contentTop + line.contentHeight
|
|
24742
24901
|
};
|
|
24743
24902
|
if (sameLine && x >= startX && x <= endX) return node;
|
|
24744
24903
|
if (distanceY < nearestDistanceY) {
|
|
@@ -24789,7 +24948,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24789
24948
|
node: glyph,
|
|
24790
24949
|
...segment,
|
|
24791
24950
|
ratioX: x / (startX + endX),
|
|
24792
|
-
ratioY: y / (startY + endY)
|
|
24951
|
+
ratioY: y / (startY + endY),
|
|
24952
|
+
isInsideGlyph: x >= startX && x <= endX && sameLine
|
|
24793
24953
|
};
|
|
24794
24954
|
const hitsGlyphAdvance = x >= startX && x <= endX;
|
|
24795
24955
|
if (sameLine) {
|
|
@@ -24891,6 +25051,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24891
25051
|
return {
|
|
24892
25052
|
generation: state.generation,
|
|
24893
25053
|
publicationRevision: state.publicationRevision,
|
|
25054
|
+
paginationRevision: state.paginationRevision,
|
|
24894
25055
|
didPublish,
|
|
24895
25056
|
didPublishAnchor,
|
|
24896
25057
|
publishedPageCount: state.lastPublishedPageCount,
|
|
@@ -25358,6 +25519,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25358
25519
|
const section = sections[sectionIndex];
|
|
25359
25520
|
const paragraphIndex = Math.max(0, (section === null || section === void 0 ? void 0 : section.children.findIndex(({ endIndex }) => endIndex === layoutAnchor)) ?? 0);
|
|
25360
25521
|
const processedBeforeSection = sections.slice(0, sectionIndex).reduce((count, item) => count + item.children.length, 0);
|
|
25522
|
+
rollbackSectionPages(layoutAnchor, ctx.skeleton.pages);
|
|
25361
25523
|
state.sectionIndex = sectionIndex;
|
|
25362
25524
|
state.paragraphIndex = paragraphIndex;
|
|
25363
25525
|
state.sectionInitialized = false;
|
|
@@ -25410,10 +25572,52 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25410
25572
|
}
|
|
25411
25573
|
for (const hSkeMap of skeleton.skeHeaders.values()) for (const page of hSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
25412
25574
|
for (const fSkeMap of skeleton.skeFooters.values()) for (const page of fSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
25575
|
+
const retry = this._prepareFieldCountRetry(ctx);
|
|
25576
|
+
if (retry != null) {
|
|
25577
|
+
state.paginationRevision++;
|
|
25578
|
+
state.ctx = retry;
|
|
25579
|
+
state.sectionIndex = 0;
|
|
25580
|
+
state.paragraphIndex = 0;
|
|
25581
|
+
state.sectionInitialized = false;
|
|
25582
|
+
state.sectionBreakConfig = null;
|
|
25583
|
+
state.layoutAnchor = null;
|
|
25584
|
+
state.laidOutThrough = -1;
|
|
25585
|
+
state.stableLaidOutThrough = -1;
|
|
25586
|
+
state.processedBlockCount = 0;
|
|
25587
|
+
state.pendingTableBuild = null;
|
|
25588
|
+
state.pendingSlicedTableBuild = null;
|
|
25589
|
+
state.pendingParagraphCheckpoint = null;
|
|
25590
|
+
state.stablePageCount = 0;
|
|
25591
|
+
state.finalizedPageCount = 0;
|
|
25592
|
+
state.lastPublishedPageCount = 0;
|
|
25593
|
+
state.lastPublishedBlockCount = 0;
|
|
25594
|
+
state.anchorPublished = false;
|
|
25595
|
+
state.reuseUnaffectedTail = false;
|
|
25596
|
+
state.reusedTail = false;
|
|
25597
|
+
state.tailConvergencePageCount = 0;
|
|
25598
|
+
state.interactionPageTail = null;
|
|
25599
|
+
state.interactionPageComplete = false;
|
|
25600
|
+
state.interactionWindowComplete = false;
|
|
25601
|
+
state.interactionWindowResume = null;
|
|
25602
|
+
return;
|
|
25603
|
+
}
|
|
25413
25604
|
setPageParent(skeleton.pages, skeleton);
|
|
25414
25605
|
state.complete = true;
|
|
25415
25606
|
state.stableLaidOutThrough = state.laidOutThrough;
|
|
25416
25607
|
}
|
|
25608
|
+
getCompletedPageCount() {
|
|
25609
|
+
return this._completedPageCount;
|
|
25610
|
+
}
|
|
25611
|
+
_prepareFieldCountRetry(ctx) {
|
|
25612
|
+
if (!ctx.hasNumPagesFields || ctx.fieldPageCount === ctx.skeleton.pages.length) return null;
|
|
25613
|
+
const retry = this._prepareLayoutContext();
|
|
25614
|
+
retry.fieldPageCount = ctx.skeleton.pages.length;
|
|
25615
|
+
retry.headerFooterMinimumMargins = ctx.headerFooterMinimumMargins;
|
|
25616
|
+
retry.fieldCountCandidates = ctx.fieldCountCandidates ?? /* @__PURE__ */ new Set();
|
|
25617
|
+
if (ctx.fieldPageCount != null) retry.fieldCountCandidates.add(ctx.fieldPageCount);
|
|
25618
|
+
retry.fieldCountCycle = ctx.fieldCountCycle || retry.fieldCountCandidates.has(retry.fieldPageCount);
|
|
25619
|
+
return retry;
|
|
25620
|
+
}
|
|
25417
25621
|
_prepareLayoutContext() {
|
|
25418
25622
|
var _ctx$noteReferences;
|
|
25419
25623
|
const viewModel = this.getViewModel();
|
|
@@ -25426,6 +25630,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25426
25630
|
};
|
|
25427
25631
|
const { paragraphLineGapDefault = 0, defaultTabStop = 10.5, textStyle = {}, adjustLineHeightInTable = BooleanNumber.FALSE } = documentStyle;
|
|
25428
25632
|
const docsConfig = {
|
|
25633
|
+
lineGap: this._lineGap,
|
|
25429
25634
|
headerTreeMap,
|
|
25430
25635
|
footerTreeMap,
|
|
25431
25636
|
lists,
|
|
@@ -25445,7 +25650,17 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25445
25650
|
skeListLevel,
|
|
25446
25651
|
drawingAnchor
|
|
25447
25652
|
};
|
|
25653
|
+
const hasNumPagesFields = [...headerTreeMap.values(), ...footerTreeMap.values()].some((story) => {
|
|
25654
|
+
var _story$getBody;
|
|
25655
|
+
return (_story$getBody = story.getBody()) === null || _story$getBody === void 0 || (_story$getBody = _story$getBody.customRanges) === null || _story$getBody === void 0 ? void 0 : _story$getBody.some((range) => {
|
|
25656
|
+
var _range$properties;
|
|
25657
|
+
return range.rangeType === CustomRangeType.FIELD && ((_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.fieldType) === "NUMPAGES" && range.properties.locked !== BooleanNumber.TRUE;
|
|
25658
|
+
});
|
|
25659
|
+
});
|
|
25448
25660
|
const ctx = {
|
|
25661
|
+
fieldPageCount: this.getCompletedPageCount(),
|
|
25662
|
+
hasNumPagesFields,
|
|
25663
|
+
headerFooterMinimumMargins: hasNumPagesFields ? /* @__PURE__ */ new Map() : void 0,
|
|
25449
25664
|
viewModel,
|
|
25450
25665
|
dataModel,
|
|
25451
25666
|
noteReferences: documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL ? resolveNoteReferences(dataModel.getSnapshot()) : void 0,
|
|
@@ -25641,8 +25856,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25641
25856
|
let segmentPage = page;
|
|
25642
25857
|
if (segmentId) {
|
|
25643
25858
|
var _skeHeaders$get5, _skeFooters$get5, _page$notes3;
|
|
25644
|
-
const maybeHeaderSke = (_skeHeaders$get5 = skeHeaders.get(segmentId)) === null || _skeHeaders$get5 === void 0 ? void 0 : _skeHeaders$get5.get(pageWidth);
|
|
25645
|
-
const maybeFooterSke = (_skeFooters$get5 = skeFooters.get(segmentId)) === null || _skeFooters$get5 === void 0 ? void 0 : _skeFooters$get5.get(pageWidth);
|
|
25859
|
+
const maybeHeaderSke = (_skeHeaders$get5 = skeHeaders.get(segmentId)) === null || _skeHeaders$get5 === void 0 ? void 0 : _skeHeaders$get5.get(page.headerLayoutKey ?? pageWidth);
|
|
25860
|
+
const maybeFooterSke = (_skeFooters$get5 = skeFooters.get(segmentId)) === null || _skeFooters$get5 === void 0 ? void 0 : _skeFooters$get5.get(page.footerLayoutKey ?? pageWidth);
|
|
25646
25861
|
const note = (_page$notes3 = page.notes) === null || _page$notes3 === void 0 ? void 0 : _page$notes3.find((fragment) => fragment.noteId === segmentId && fragment.page.st <= charIndex && charIndex <= fragment.page.ed);
|
|
25647
25862
|
if (note) segmentPage = note.page;
|
|
25648
25863
|
else if (maybeHeaderSke) segmentPage = maybeHeaderSke;
|
|
@@ -25711,7 +25926,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25711
25926
|
};
|
|
25712
25927
|
|
|
25713
25928
|
//#endregion
|
|
25714
|
-
//#region \0@oxc-project+runtime@0.
|
|
25929
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
25715
25930
|
function __decorateParam(paramIndex, decorator) {
|
|
25716
25931
|
return function(target, key) {
|
|
25717
25932
|
decorator(target, key, paramIndex);
|
|
@@ -25719,7 +25934,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
25719
25934
|
}
|
|
25720
25935
|
|
|
25721
25936
|
//#endregion
|
|
25722
|
-
//#region \0@oxc-project+runtime@0.
|
|
25937
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
25723
25938
|
function __decorate(decorators, target, key, desc) {
|
|
25724
25939
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
25725
25940
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -25846,6 +26061,8 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
25846
26061
|
_defineProperty(this, "_gridlinesColor", void 0);
|
|
25847
26062
|
_defineProperty(this, "_defaultGridlinesColor", void 0);
|
|
25848
26063
|
_defineProperty(this, "_scene", null);
|
|
26064
|
+
_defineProperty(this, "textLineGap", void 0);
|
|
26065
|
+
this.textLineGap = _configService.getConfig(SHEET_TEXT_LINE_GAP) ?? 0;
|
|
25849
26066
|
const themeService = _injector.get(ThemeService);
|
|
25850
26067
|
this.disposeWithMe(themeService.currentTheme$.subscribe(() => {
|
|
25851
26068
|
var _this$_scene, _this$_scene2;
|
|
@@ -26176,7 +26393,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26176
26393
|
const documentViewModel = new DocumentViewModel(documentModel);
|
|
26177
26394
|
const { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
26178
26395
|
if (typeof colWidth === "number" && wrapStrategy === WrapStrategy.WRAP) documentModel.updateDocumentDataPageSize(colWidth);
|
|
26179
|
-
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
26396
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: this.textLineGap });
|
|
26180
26397
|
documentSkeleton.calculate();
|
|
26181
26398
|
let { height: h = 0 } = getDocsSkeletonPageSize(documentSkeleton, angle) ?? {};
|
|
26182
26399
|
if (documentSkeleton) {
|
|
@@ -26194,7 +26411,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26194
26411
|
const paddingTop = ((_style$pd3 = style.pd) === null || _style$pd3 === void 0 ? void 0 : _style$pd3.t) ?? DEFAULT_PADDING_DATA.t;
|
|
26195
26412
|
const paddingBottom = ((_style$pd4 = style.pd) === null || _style$pd4 === void 0 ? void 0 : _style$pd4.b) ?? DEFAULT_PADDING_DATA.b;
|
|
26196
26413
|
if ((style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP) {
|
|
26197
|
-
const skeleton = new DocSimpleSkeleton(getDisplayValueFromCell(cell), getFontStyleString(style).fontCache, (style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP, colWidth - paddingLeft - paddingRight, Infinity);
|
|
26414
|
+
const skeleton = new DocSimpleSkeleton(getDisplayValueFromCell(cell), getFontStyleString(style).fontCache, (style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP, colWidth - paddingLeft - paddingRight, Infinity, this.textLineGap);
|
|
26198
26415
|
skeleton.calculate();
|
|
26199
26416
|
return skeleton.getTotalHeight() + paddingTop + paddingBottom;
|
|
26200
26417
|
} else {
|
|
@@ -26310,7 +26527,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26310
26527
|
const { vertexAngle: angle } = convertTextRotation(textRotation);
|
|
26311
26528
|
if ((style === null || style === void 0 ? void 0 : style.tb) === WrapStrategy.WRAP) documentModel.updateDocumentDataPageSize(currColWidth, Infinity);
|
|
26312
26529
|
else documentModel.updateDocumentDataPageSize(Infinity, Infinity);
|
|
26313
|
-
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
26530
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: this.textLineGap });
|
|
26314
26531
|
documentSkeleton.calculate();
|
|
26315
26532
|
measuredWidth = (getDocsSkeletonPageSize(documentSkeleton, angle) ?? { width: 0 }).width;
|
|
26316
26533
|
if (documentSkeleton) {
|
|
@@ -26593,7 +26810,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26593
26810
|
if (fontCache.documentSkeleton) {
|
|
26594
26811
|
const snapshot = fontCache.documentSkeleton.getViewModel().getDataModel().getSnapshot();
|
|
26595
26812
|
const documentModel = new DocumentDataModel(scaleDocumentDataForShrinkToFit(snapshot, scale, fallbackFontSize));
|
|
26596
|
-
const documentSkeleton = DocumentSkeleton.create(new DocumentViewModel(documentModel), this._localeService);
|
|
26813
|
+
const documentSkeleton = DocumentSkeleton.create(new DocumentViewModel(documentModel), this._localeService, { lineGap: this.textLineGap });
|
|
26597
26814
|
documentSkeleton.calculate();
|
|
26598
26815
|
fontCache.documentSkeleton = documentSkeleton;
|
|
26599
26816
|
} else fontCache.fontString = getFontStyleString({
|
|
@@ -26646,7 +26863,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
26646
26863
|
if (FULL_WIDTH_HORIZONTAL_ALIGNMENTS.has(horizontalAlign)) updateDocumentPageWidth(documentModel, this.getCellWithCoordByIndex(row, col, false));
|
|
26647
26864
|
const documentViewModel = new DocumentViewModel(documentModel);
|
|
26648
26865
|
if (documentViewModel) {
|
|
26649
|
-
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService);
|
|
26866
|
+
const documentSkeleton = DocumentSkeleton.create(documentViewModel, this._localeService, { lineGap: this.textLineGap });
|
|
26650
26867
|
documentSkeleton.calculate();
|
|
26651
26868
|
config = {
|
|
26652
26869
|
documentSkeleton,
|
|
@@ -27110,7 +27327,7 @@ var Font = class extends SheetExtension {
|
|
|
27110
27327
|
this._clipByRenderBounds(renderFontCtx, row, col);
|
|
27111
27328
|
ctx.translate(renderFontCtx.startX + FIX_ONE_PIXEL_BLUR_OFFSET, renderFontCtx.startY + FIX_ONE_PIXEL_BLUR_OFFSET);
|
|
27112
27329
|
if (fontCache.documentSkeleton) this._renderDocuments(ctx, row, col, renderFontCtx, spreadsheetSkeleton.overflowCache);
|
|
27113
|
-
else this._renderText(ctx,
|
|
27330
|
+
else this._renderText(ctx, renderFontCtx);
|
|
27114
27331
|
ctx.restore();
|
|
27115
27332
|
if (fontCache.documentSkeleton) {
|
|
27116
27333
|
var _documentDataModel$ge;
|
|
@@ -27205,7 +27422,7 @@ var Font = class extends SheetExtension {
|
|
|
27205
27422
|
if (image.getAttribute("data-error") === "true") this._drawFallbackImage(ctx, -rotatedWidth / 2, -rotatedHeight / 2, width, height);
|
|
27206
27423
|
else try {
|
|
27207
27424
|
ctx.drawImage(image, -rotatedWidth / 2, -rotatedHeight / 2, width, height);
|
|
27208
|
-
} catch
|
|
27425
|
+
} catch {
|
|
27209
27426
|
this._drawFallbackImage(ctx, -rotatedWidth / 2, -rotatedHeight / 2, width, height);
|
|
27210
27427
|
}
|
|
27211
27428
|
ctx.restore();
|
|
@@ -27218,7 +27435,7 @@ var Font = class extends SheetExtension {
|
|
|
27218
27435
|
* @param renderFontContext
|
|
27219
27436
|
* @param row
|
|
27220
27437
|
* @param col
|
|
27221
|
-
* @param
|
|
27438
|
+
* @param padding
|
|
27222
27439
|
*/
|
|
27223
27440
|
_clipByRenderBounds(renderFontContext, row, col, padding = 0) {
|
|
27224
27441
|
var _fontCache$cellData3, _fontCache$cellData4;
|
|
@@ -27262,7 +27479,7 @@ var Font = class extends SheetExtension {
|
|
|
27262
27479
|
renderFontContext.endX = endX;
|
|
27263
27480
|
renderFontContext.endY = endY;
|
|
27264
27481
|
}
|
|
27265
|
-
_renderText(ctx,
|
|
27482
|
+
_renderText(ctx, renderFontCtx) {
|
|
27266
27483
|
var _fontCache$style5, _fontCache$style6, _fontCache$style7, _fontCache$style8, _fontCache$style9;
|
|
27267
27484
|
const { fontCache } = renderFontCtx;
|
|
27268
27485
|
if (!fontCache) return;
|
|
@@ -27282,6 +27499,7 @@ var Font = class extends SheetExtension {
|
|
|
27282
27499
|
text,
|
|
27283
27500
|
fontStyle: fontCache.fontString,
|
|
27284
27501
|
warp: wrapStrategy === WrapStrategy.WRAP && vertexAngle === 0,
|
|
27502
|
+
lineGap: renderFontCtx.spreadsheetSkeleton.textLineGap,
|
|
27285
27503
|
hAlign,
|
|
27286
27504
|
vAlign: fontCache.verticalAlign,
|
|
27287
27505
|
width: cellWidth,
|
|
@@ -27705,6 +27923,290 @@ var SpreadsheetRowHeader = class extends SpreadsheetHeader {
|
|
|
27705
27923
|
}
|
|
27706
27924
|
};
|
|
27707
27925
|
|
|
27926
|
+
//#endregion
|
|
27927
|
+
//#region src/group.ts
|
|
27928
|
+
var Group = class extends BaseObject {
|
|
27929
|
+
constructor(key, ...objects) {
|
|
27930
|
+
super(key);
|
|
27931
|
+
_defineProperty(this, "_objects", []);
|
|
27932
|
+
_defineProperty(this, "_selfSizeMode", false);
|
|
27933
|
+
this.addObjects(...objects);
|
|
27934
|
+
}
|
|
27935
|
+
get classType() {
|
|
27936
|
+
return "Group";
|
|
27937
|
+
}
|
|
27938
|
+
set cursor(val) {
|
|
27939
|
+
this.setCursor(val);
|
|
27940
|
+
}
|
|
27941
|
+
getState() {
|
|
27942
|
+
if (this._selfSizeMode) return super.getState();
|
|
27943
|
+
return getGroupState(this.left, this.top, this._objects.map((o) => o.getState()));
|
|
27944
|
+
}
|
|
27945
|
+
get width() {
|
|
27946
|
+
if (this._selfSizeMode) return super.width;
|
|
27947
|
+
return this.getState().width || 0;
|
|
27948
|
+
}
|
|
27949
|
+
get height() {
|
|
27950
|
+
if (this._selfSizeMode) return super.height;
|
|
27951
|
+
return this.getState().height || 0;
|
|
27952
|
+
}
|
|
27953
|
+
set width(val) {
|
|
27954
|
+
if (this._selfSizeMode) {
|
|
27955
|
+
super.width = val;
|
|
27956
|
+
return;
|
|
27957
|
+
}
|
|
27958
|
+
const numDelta = val - this.width;
|
|
27959
|
+
this._objects.forEach((o) => {
|
|
27960
|
+
o.resize(o.width + numDelta);
|
|
27961
|
+
});
|
|
27962
|
+
}
|
|
27963
|
+
set height(val) {
|
|
27964
|
+
if (this._selfSizeMode) {
|
|
27965
|
+
super.height = val;
|
|
27966
|
+
return;
|
|
27967
|
+
}
|
|
27968
|
+
const numDelta = val - this.height;
|
|
27969
|
+
this._objects.forEach((o) => {
|
|
27970
|
+
o.resize(void 0, o.height + numDelta);
|
|
27971
|
+
});
|
|
27972
|
+
}
|
|
27973
|
+
get maxZIndex() {
|
|
27974
|
+
let maxZIndex = 0;
|
|
27975
|
+
for (const object of this._objects) maxZIndex = Math.max(maxZIndex, object.zIndex);
|
|
27976
|
+
return maxZIndex;
|
|
27977
|
+
}
|
|
27978
|
+
openSelfSizeMode() {
|
|
27979
|
+
this._selfSizeMode = true;
|
|
27980
|
+
}
|
|
27981
|
+
closeSelfSizeMode() {
|
|
27982
|
+
this._selfSizeMode = false;
|
|
27983
|
+
}
|
|
27984
|
+
reCalculateObjects() {
|
|
27985
|
+
if (this._selfSizeMode) return;
|
|
27986
|
+
const { left = 0, top = 0 } = this.getState();
|
|
27987
|
+
for (const object of this._objects) object.transformByState({
|
|
27988
|
+
left: object.left - left,
|
|
27989
|
+
top: object.top - top
|
|
27990
|
+
});
|
|
27991
|
+
this.transformByState({
|
|
27992
|
+
left,
|
|
27993
|
+
top
|
|
27994
|
+
});
|
|
27995
|
+
}
|
|
27996
|
+
addObjects(...objects) {
|
|
27997
|
+
for (const object of objects) this.addObject(object);
|
|
27998
|
+
}
|
|
27999
|
+
addObject(o) {
|
|
28000
|
+
let object = o;
|
|
28001
|
+
if (isString(o)) {
|
|
28002
|
+
const scene = this.getScene();
|
|
28003
|
+
object = scene === null || scene === void 0 ? void 0 : scene.getObject(o);
|
|
28004
|
+
if (!object) return;
|
|
28005
|
+
object.parent = this;
|
|
28006
|
+
object.isInGroup = true;
|
|
28007
|
+
object.groupKey = this.oKey;
|
|
28008
|
+
this._objects.push(object);
|
|
28009
|
+
} else {
|
|
28010
|
+
o.parent = this;
|
|
28011
|
+
o.isInGroup = true;
|
|
28012
|
+
o.groupKey = this.oKey;
|
|
28013
|
+
this._objects.push(o);
|
|
28014
|
+
}
|
|
28015
|
+
}
|
|
28016
|
+
removeObject(object) {
|
|
28017
|
+
const objects = this.getObjects();
|
|
28018
|
+
const objectsLength = objects.length;
|
|
28019
|
+
if (isString(object)) for (let i = 0; i < objectsLength; i++) {
|
|
28020
|
+
const o = objects[i];
|
|
28021
|
+
if (o.oKey === object) {
|
|
28022
|
+
objects.splice(i, 1);
|
|
28023
|
+
this.parent.removeObject(o);
|
|
28024
|
+
return;
|
|
28025
|
+
}
|
|
28026
|
+
}
|
|
28027
|
+
else for (let i = 0; i < objectsLength; i++) {
|
|
28028
|
+
const o = objects[i];
|
|
28029
|
+
if (o === object) {
|
|
28030
|
+
objects.splice(i, 1);
|
|
28031
|
+
this.parent.removeObject(o);
|
|
28032
|
+
return;
|
|
28033
|
+
}
|
|
28034
|
+
}
|
|
28035
|
+
}
|
|
28036
|
+
removeSelfObjectAndTransform(oKey, width, height, isTransform = false) {
|
|
28037
|
+
const objects = [...this.getObjects()];
|
|
28038
|
+
const objectsLength = objects.length;
|
|
28039
|
+
if (width == null) width = this.width;
|
|
28040
|
+
if (height == null) height = this.height;
|
|
28041
|
+
for (let i = 0; i < objectsLength; i++) {
|
|
28042
|
+
const o = objects[i];
|
|
28043
|
+
if (o.oKey === oKey) {
|
|
28044
|
+
objects.splice(i, 1);
|
|
28045
|
+
isTransform && this._transformObject(o, width, height);
|
|
28046
|
+
o.parent = this.parent;
|
|
28047
|
+
o.groupKey = void 0;
|
|
28048
|
+
o.isInGroup = false;
|
|
28049
|
+
this._objects = objects;
|
|
28050
|
+
return;
|
|
28051
|
+
}
|
|
28052
|
+
}
|
|
28053
|
+
}
|
|
28054
|
+
_transformObject(object, groupWidth, groupHeight) {
|
|
28055
|
+
const transform = transformObjectOutOfGroup(object.getState(), this.getState(), groupWidth, groupHeight);
|
|
28056
|
+
if (object.classType === "Group") object.transformByState({
|
|
28057
|
+
left: transform.left,
|
|
28058
|
+
top: transform.top
|
|
28059
|
+
});
|
|
28060
|
+
else object.transformByState(transform);
|
|
28061
|
+
}
|
|
28062
|
+
getObjectsByOrder() {
|
|
28063
|
+
const objects = [];
|
|
28064
|
+
this._objects.sort(sortRules);
|
|
28065
|
+
for (const o of this._objects) if (o.visible) objects.push(o);
|
|
28066
|
+
return objects;
|
|
28067
|
+
}
|
|
28068
|
+
getObjects() {
|
|
28069
|
+
return this._objects;
|
|
28070
|
+
}
|
|
28071
|
+
render(ctx, bounds) {
|
|
28072
|
+
ctx.save();
|
|
28073
|
+
const m = this.transform.getMatrix();
|
|
28074
|
+
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
28075
|
+
const objects = this.getObjectsByOrder();
|
|
28076
|
+
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
28077
|
+
ctx.restore();
|
|
28078
|
+
}
|
|
28079
|
+
_clear() {
|
|
28080
|
+
this._objects = [];
|
|
28081
|
+
}
|
|
28082
|
+
dispose() {
|
|
28083
|
+
[...this.getObjects()].forEach((o) => {
|
|
28084
|
+
o.dispose();
|
|
28085
|
+
});
|
|
28086
|
+
this._clear();
|
|
28087
|
+
super.dispose();
|
|
28088
|
+
}
|
|
28089
|
+
};
|
|
28090
|
+
|
|
28091
|
+
//#endregion
|
|
28092
|
+
//#region src/drawing-group.ts
|
|
28093
|
+
var DrawingGroupObject = class extends Group {
|
|
28094
|
+
constructor(..._args) {
|
|
28095
|
+
super(..._args);
|
|
28096
|
+
_defineProperty(this, "_selfSizeMode", true);
|
|
28097
|
+
_defineProperty(this, "_baseBound", {
|
|
28098
|
+
left: 0,
|
|
28099
|
+
top: 0,
|
|
28100
|
+
width: 0,
|
|
28101
|
+
height: 0
|
|
28102
|
+
});
|
|
28103
|
+
_defineProperty(this, "_outerShadow", void 0);
|
|
28104
|
+
_defineProperty(this, "_glow", void 0);
|
|
28105
|
+
}
|
|
28106
|
+
setOuterShadow(shadow) {
|
|
28107
|
+
this._outerShadow = shadow;
|
|
28108
|
+
this.makeDirty(true);
|
|
28109
|
+
}
|
|
28110
|
+
setGlow(glow) {
|
|
28111
|
+
this._glow = glow;
|
|
28112
|
+
this.makeDirty(true);
|
|
28113
|
+
}
|
|
28114
|
+
/**
|
|
28115
|
+
* Set the baseBound (chOff/chExt in OOXML) for this group.
|
|
28116
|
+
* This defines the coordinate space of children within the group.
|
|
28117
|
+
* When set, the group automatically enters selfSizeMode so its dimensions
|
|
28118
|
+
* are tracked independently of children.
|
|
28119
|
+
*/
|
|
28120
|
+
setBaseBound(bound) {
|
|
28121
|
+
this._baseBound = { ...bound };
|
|
28122
|
+
}
|
|
28123
|
+
/**
|
|
28124
|
+
* Get the baseBound (chOff/chExt in OOXML) for this group.
|
|
28125
|
+
*/
|
|
28126
|
+
getBaseBound() {
|
|
28127
|
+
return { ...this._baseBound };
|
|
28128
|
+
}
|
|
28129
|
+
/**
|
|
28130
|
+
* Override ancestorTransform to use the same render transform as render(),
|
|
28131
|
+
* which uses [m[0], m[1], m[2], m[3], centerX, centerY] from realBound
|
|
28132
|
+
* instead of the standard transform translation.
|
|
28133
|
+
* This ensures children (e.g., Image.isHit) that compose with
|
|
28134
|
+
* parent.ancestorTransform get the correct coordinate space.
|
|
28135
|
+
*/
|
|
28136
|
+
get ancestorTransform() {
|
|
28137
|
+
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
28138
|
+
const m = this.transform.getMatrix();
|
|
28139
|
+
const centerX = realLeft + realWidth / 2;
|
|
28140
|
+
const centerY = realTop + realHeight / 2;
|
|
28141
|
+
const renderTransform = new Transform([
|
|
28142
|
+
m[0],
|
|
28143
|
+
m[1],
|
|
28144
|
+
m[2],
|
|
28145
|
+
m[3],
|
|
28146
|
+
centerX,
|
|
28147
|
+
centerY
|
|
28148
|
+
]);
|
|
28149
|
+
const parent = this.getParent();
|
|
28150
|
+
if (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group") return parent.ancestorTransform.multiply(renderTransform);
|
|
28151
|
+
return renderTransform;
|
|
28152
|
+
}
|
|
28153
|
+
render(ctx, bounds) {
|
|
28154
|
+
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
28155
|
+
ctx.save();
|
|
28156
|
+
const m = this.transform.getMatrix();
|
|
28157
|
+
const centerX = realLeft + realWidth / 2;
|
|
28158
|
+
const centerY = realTop + realHeight / 2;
|
|
28159
|
+
ctx.transform(m[0], m[1], m[2], m[3], centerX, centerY);
|
|
28160
|
+
const effectFilter = createDrawingEffectFilter(this._glow, void 0);
|
|
28161
|
+
if (effectFilter) ctx.filter = combineDrawingEffectFilter(ctx.filter, effectFilter);
|
|
28162
|
+
if (this._outerShadow) {
|
|
28163
|
+
ctx.shadowColor = this._outerShadow.shadowColor;
|
|
28164
|
+
ctx.shadowBlur = this._outerShadow.shadowBlur;
|
|
28165
|
+
ctx.shadowOffsetX = this._outerShadow.shadowOffsetX;
|
|
28166
|
+
ctx.shadowOffsetY = this._outerShadow.shadowOffsetY;
|
|
28167
|
+
}
|
|
28168
|
+
const objects = this.getObjectsByOrder();
|
|
28169
|
+
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
28170
|
+
ctx.restore();
|
|
28171
|
+
}
|
|
28172
|
+
addObjects(...objects) {
|
|
28173
|
+
for (const object of objects) this.addObject(object);
|
|
28174
|
+
}
|
|
28175
|
+
isHit(coord) {
|
|
28176
|
+
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
28177
|
+
const m = this.transform.getMatrix();
|
|
28178
|
+
const centerX = realLeft + realWidth / 2;
|
|
28179
|
+
const centerY = realTop + realHeight / 2;
|
|
28180
|
+
const renderTransform = new Transform([
|
|
28181
|
+
m[0],
|
|
28182
|
+
m[1],
|
|
28183
|
+
m[2],
|
|
28184
|
+
m[3],
|
|
28185
|
+
centerX,
|
|
28186
|
+
centerY
|
|
28187
|
+
]);
|
|
28188
|
+
const parent = this.getParent();
|
|
28189
|
+
const oCoord = (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group" ? parent.ancestorTransform.multiply(renderTransform) : renderTransform).invert().applyPoint(coord);
|
|
28190
|
+
const halfWidth = realWidth / 2;
|
|
28191
|
+
const halfHeight = realHeight / 2;
|
|
28192
|
+
if (oCoord.x < -halfWidth || oCoord.x > halfWidth || oCoord.y < -halfHeight || oCoord.y > halfHeight) return false;
|
|
28193
|
+
const objects = this.getObjectsByOrder();
|
|
28194
|
+
for (let i = 0; i < objects.length; i++) if (objects[i].isHit(coord)) return true;
|
|
28195
|
+
return false;
|
|
28196
|
+
}
|
|
28197
|
+
dispose() {
|
|
28198
|
+
const objects = [...this.getObjects()];
|
|
28199
|
+
const scene = this.getScene();
|
|
28200
|
+
objects.forEach((o) => {
|
|
28201
|
+
o.dispose();
|
|
28202
|
+
scene === null || scene === void 0 || scene.removeObject(o);
|
|
28203
|
+
});
|
|
28204
|
+
this._objects = [];
|
|
28205
|
+
super.dispose();
|
|
28206
|
+
scene === null || scene === void 0 || scene.removeObject(this);
|
|
28207
|
+
}
|
|
28208
|
+
};
|
|
28209
|
+
|
|
27708
28210
|
//#endregion
|
|
27709
28211
|
//#region src/components/docs/doc-component.ts
|
|
27710
28212
|
var DocComponent = class extends RenderComponent {
|
|
@@ -28151,7 +28653,9 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
28151
28653
|
const { ts: textStyle, content, fontStyle, bBox } = glyph;
|
|
28152
28654
|
const { spanPointWithFont = Vector2.create(0, 0) } = this.extensionOffset;
|
|
28153
28655
|
if (content == null) return;
|
|
28154
|
-
|
|
28656
|
+
const currentKerning = ctx.fontKerning;
|
|
28657
|
+
const fontKerning = (fontStyle === null || fontStyle === void 0 ? void 0 : fontStyle.fontKerning) ?? "auto";
|
|
28658
|
+
if (currentKerning != null && currentKerning !== fontKerning) ctx.fontKerning = fontKerning;
|
|
28155
28659
|
if (!textStyle) {
|
|
28156
28660
|
this._fillText(ctx, glyph, spanPointWithFont);
|
|
28157
28661
|
return;
|
|
@@ -28780,22 +29284,6 @@ function getVisibleContinuousLineRange(lines, viewportTop, viewportBottom, flowT
|
|
|
28780
29284
|
end: low
|
|
28781
29285
|
};
|
|
28782
29286
|
}
|
|
28783
|
-
function resolveHeaderFooterFieldGlyph(glyph, startIndex, endIndex, customRanges, pageNumber, pageCount) {
|
|
28784
|
-
var _fieldRange$propertie;
|
|
28785
|
-
if (!glyph.content || glyph.raw === DataStreamTreeTokenType.CUSTOM_RANGE_START || glyph.raw === DataStreamTreeTokenType.CUSTOM_RANGE_END) return glyph;
|
|
28786
|
-
const fieldRange = customRanges.find((customRange) => {
|
|
28787
|
-
var _customRange$properti;
|
|
28788
|
-
return customRange.startIndex <= startIndex && customRange.endIndex >= endIndex && typeof ((_customRange$properti = customRange.properties) === null || _customRange$properti === void 0 ? void 0 : _customRange$properti.fieldType) === "string";
|
|
28789
|
-
});
|
|
28790
|
-
const fieldType = fieldRange === null || fieldRange === void 0 || (_fieldRange$propertie = fieldRange.properties) === null || _fieldRange$propertie === void 0 || (_fieldRange$propertie = _fieldRange$propertie.fieldType) === null || _fieldRange$propertie === void 0 ? void 0 : _fieldRange$propertie.toUpperCase();
|
|
28791
|
-
if (!fieldRange || fieldType !== "PAGE" && fieldType !== "NUMPAGES") return glyph;
|
|
28792
|
-
let content = "";
|
|
28793
|
-
if (startIndex === fieldRange.startIndex + 1) content = String(fieldType === "PAGE" ? pageNumber : pageCount);
|
|
28794
|
-
return content === glyph.content ? glyph : {
|
|
28795
|
-
...glyph,
|
|
28796
|
-
content
|
|
28797
|
-
};
|
|
28798
|
-
}
|
|
28799
29287
|
function resolveHeaderFooterFieldGlyphGroup(divide, context) {
|
|
28800
29288
|
var _context$viewModel;
|
|
28801
29289
|
const { glyphGroup } = divide;
|
|
@@ -28929,8 +29417,21 @@ var Documents = class Documents extends DocComponent {
|
|
|
28929
29417
|
return this.getScene().getEngine();
|
|
28930
29418
|
}
|
|
28931
29419
|
isHit(coord) {
|
|
29420
|
+
if (super.isHit(coord)) {
|
|
29421
|
+
var _this$getScene;
|
|
29422
|
+
const drawingHit = (_this$getScene = this.getScene()) === null || _this$getScene === void 0 ? void 0 : _this$getScene.getAllObjectsByOrderForPick().some((object) => (object.isDrawingObject || object instanceof DrawingGroupObject) && !object.isInGroup && object.visible && object.evented && object.isHit(coord));
|
|
29423
|
+
const skeleton = this.getSkeleton();
|
|
29424
|
+
if (drawingHit && skeleton) {
|
|
29425
|
+
const node = skeleton.findNodeByCoord(this.getInverseCoord(coord), this.pageLayoutType, this.pageMarginLeft, this.pageMarginTop);
|
|
29426
|
+
if (node === null || node === void 0 ? void 0 : node.isInsideGlyph) return true;
|
|
29427
|
+
return this._isHitTable(coord);
|
|
29428
|
+
}
|
|
29429
|
+
return true;
|
|
29430
|
+
}
|
|
29431
|
+
return this._isHitTable(coord);
|
|
29432
|
+
}
|
|
29433
|
+
_isHitTable(coord) {
|
|
28932
29434
|
var _this$getSkeleton;
|
|
28933
|
-
if (super.isHit(coord)) return true;
|
|
28934
29435
|
const skeletonData = (_this$getSkeleton = this.getSkeleton()) === null || _this$getSkeleton === void 0 ? void 0 : _this$getSkeleton.getSkeletonData();
|
|
28935
29436
|
if (!skeletonData) return false;
|
|
28936
29437
|
const localCoord = this.getInverseCoord(coord);
|
|
@@ -29023,7 +29524,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
29023
29524
|
this._drawTable(ctx, page, skeTables, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
29024
29525
|
ctx.restore();
|
|
29025
29526
|
}
|
|
29026
|
-
const headerSkeletonPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
29527
|
+
const headerSkeletonPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(page.headerLayoutKey ?? pageWidth);
|
|
29027
29528
|
const headerAlignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, (headerSkeletonPage === null || headerSkeletonPage === void 0 ? void 0 : headerSkeletonPage.marginTop) ?? 0);
|
|
29028
29529
|
if (headerSkeletonPage) this._drawHeaderFooter(headerSkeletonPage, ctx, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, headerAlignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale, page, true, pages.length, void 0, headerFooterOpacity);
|
|
29029
29530
|
ctx.save();
|
|
@@ -29037,7 +29538,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
29037
29538
|
var _this$getSkeleton6;
|
|
29038
29539
|
this._drawHeaderFooter(note.page, ctx, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, Vector2.create(horizontalOffsetNoAngle + note.left - page.marginLeft, note.top), centerAngle, vertexAngle, renderConfig, parentScale, page, false, pages.length, "kind" in note ? ((_this$getSkeleton6 = this.getSkeleton()) === null || _this$getSkeleton6 === void 0 || (_this$getSkeleton6 = _this$getSkeleton6.getViewModel().getSnapshot().noteSettings) === null || _this$getSkeleton6 === void 0 || (_this$getSkeleton6 = _this$getSkeleton6[note.noteType ?? "footnote"]) === null || _this$getSkeleton6 === void 0 || (_this$getSkeleton6 = _this$getSkeleton6[note.kind]) === null || _this$getSkeleton6 === void 0 ? void 0 : _this$getSkeleton6.customRanges) ?? [] : void 0);
|
|
29039
29540
|
}
|
|
29040
|
-
const footerSkeletonPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
29541
|
+
const footerSkeletonPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(page.footerLayoutKey ?? pageWidth);
|
|
29041
29542
|
if (footerSkeletonPage) {
|
|
29042
29543
|
const footerAlignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, page.pageHeight - (footerSkeletonPage === null || footerSkeletonPage === void 0 ? void 0 : footerSkeletonPage.height) - footerSkeletonPage.marginBottom);
|
|
29043
29544
|
this._drawHeaderFooter(footerSkeletonPage, ctx, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, footerAlignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale, page, false, pages.length, void 0, headerFooterOpacity);
|
|
@@ -29641,7 +30142,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
29641
30142
|
const skeleton = this.getSkeleton();
|
|
29642
30143
|
const viewModel = typeof (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getViewModel) === "function" ? skeleton.getViewModel().getSelfOrHeaderFooterViewModel(page.segmentId) : void 0;
|
|
29643
30144
|
const fieldContext = {
|
|
29644
|
-
customRanges: customRangesOverride ?? (viewModel === null || viewModel === void 0 || (_viewModel$getBody = viewModel.getBody()) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.customRanges) ?? [],
|
|
30145
|
+
customRanges: page.fieldsResolved ? [] : customRangesOverride ?? (viewModel === null || viewModel === void 0 || (_viewModel$getBody = viewModel.getBody()) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.customRanges) ?? [],
|
|
29645
30146
|
pageNumber: parentPage.pageNumber,
|
|
29646
30147
|
pageCount,
|
|
29647
30148
|
viewModel
|
|
@@ -34238,290 +34739,6 @@ var CustomObject = class extends BaseObject {
|
|
|
34238
34739
|
}
|
|
34239
34740
|
};
|
|
34240
34741
|
|
|
34241
|
-
//#endregion
|
|
34242
|
-
//#region src/group.ts
|
|
34243
|
-
var Group = class extends BaseObject {
|
|
34244
|
-
constructor(key, ...objects) {
|
|
34245
|
-
super(key);
|
|
34246
|
-
_defineProperty(this, "_objects", []);
|
|
34247
|
-
_defineProperty(this, "_selfSizeMode", false);
|
|
34248
|
-
this.addObjects(...objects);
|
|
34249
|
-
}
|
|
34250
|
-
get classType() {
|
|
34251
|
-
return "Group";
|
|
34252
|
-
}
|
|
34253
|
-
set cursor(val) {
|
|
34254
|
-
this.setCursor(val);
|
|
34255
|
-
}
|
|
34256
|
-
getState() {
|
|
34257
|
-
if (this._selfSizeMode) return super.getState();
|
|
34258
|
-
return getGroupState(this.left, this.top, this._objects.map((o) => o.getState()));
|
|
34259
|
-
}
|
|
34260
|
-
get width() {
|
|
34261
|
-
if (this._selfSizeMode) return super.width;
|
|
34262
|
-
return this.getState().width || 0;
|
|
34263
|
-
}
|
|
34264
|
-
get height() {
|
|
34265
|
-
if (this._selfSizeMode) return super.height;
|
|
34266
|
-
return this.getState().height || 0;
|
|
34267
|
-
}
|
|
34268
|
-
set width(val) {
|
|
34269
|
-
if (this._selfSizeMode) {
|
|
34270
|
-
super.width = val;
|
|
34271
|
-
return;
|
|
34272
|
-
}
|
|
34273
|
-
const numDelta = val - this.width;
|
|
34274
|
-
this._objects.forEach((o) => {
|
|
34275
|
-
o.resize(o.width + numDelta);
|
|
34276
|
-
});
|
|
34277
|
-
}
|
|
34278
|
-
set height(val) {
|
|
34279
|
-
if (this._selfSizeMode) {
|
|
34280
|
-
super.height = val;
|
|
34281
|
-
return;
|
|
34282
|
-
}
|
|
34283
|
-
const numDelta = val - this.height;
|
|
34284
|
-
this._objects.forEach((o) => {
|
|
34285
|
-
o.resize(void 0, o.height + numDelta);
|
|
34286
|
-
});
|
|
34287
|
-
}
|
|
34288
|
-
get maxZIndex() {
|
|
34289
|
-
let maxZIndex = 0;
|
|
34290
|
-
for (const object of this._objects) maxZIndex = Math.max(maxZIndex, object.zIndex);
|
|
34291
|
-
return maxZIndex;
|
|
34292
|
-
}
|
|
34293
|
-
openSelfSizeMode() {
|
|
34294
|
-
this._selfSizeMode = true;
|
|
34295
|
-
}
|
|
34296
|
-
closeSelfSizeMode() {
|
|
34297
|
-
this._selfSizeMode = false;
|
|
34298
|
-
}
|
|
34299
|
-
reCalculateObjects() {
|
|
34300
|
-
if (this._selfSizeMode) return;
|
|
34301
|
-
const { left = 0, top = 0 } = this.getState();
|
|
34302
|
-
for (const object of this._objects) object.transformByState({
|
|
34303
|
-
left: object.left - left,
|
|
34304
|
-
top: object.top - top
|
|
34305
|
-
});
|
|
34306
|
-
this.transformByState({
|
|
34307
|
-
left,
|
|
34308
|
-
top
|
|
34309
|
-
});
|
|
34310
|
-
}
|
|
34311
|
-
addObjects(...objects) {
|
|
34312
|
-
for (const object of objects) this.addObject(object);
|
|
34313
|
-
}
|
|
34314
|
-
addObject(o) {
|
|
34315
|
-
let object = o;
|
|
34316
|
-
if (isString(o)) {
|
|
34317
|
-
const scene = this.getScene();
|
|
34318
|
-
object = scene === null || scene === void 0 ? void 0 : scene.getObject(o);
|
|
34319
|
-
if (!object) return;
|
|
34320
|
-
object.parent = this;
|
|
34321
|
-
object.isInGroup = true;
|
|
34322
|
-
object.groupKey = this.oKey;
|
|
34323
|
-
this._objects.push(object);
|
|
34324
|
-
} else {
|
|
34325
|
-
o.parent = this;
|
|
34326
|
-
o.isInGroup = true;
|
|
34327
|
-
o.groupKey = this.oKey;
|
|
34328
|
-
this._objects.push(o);
|
|
34329
|
-
}
|
|
34330
|
-
}
|
|
34331
|
-
removeObject(object) {
|
|
34332
|
-
const objects = this.getObjects();
|
|
34333
|
-
const objectsLength = objects.length;
|
|
34334
|
-
if (isString(object)) for (let i = 0; i < objectsLength; i++) {
|
|
34335
|
-
const o = objects[i];
|
|
34336
|
-
if (o.oKey === object) {
|
|
34337
|
-
objects.splice(i, 1);
|
|
34338
|
-
this.parent.removeObject(o);
|
|
34339
|
-
return;
|
|
34340
|
-
}
|
|
34341
|
-
}
|
|
34342
|
-
else for (let i = 0; i < objectsLength; i++) {
|
|
34343
|
-
const o = objects[i];
|
|
34344
|
-
if (o === object) {
|
|
34345
|
-
objects.splice(i, 1);
|
|
34346
|
-
this.parent.removeObject(o);
|
|
34347
|
-
return;
|
|
34348
|
-
}
|
|
34349
|
-
}
|
|
34350
|
-
}
|
|
34351
|
-
removeSelfObjectAndTransform(oKey, width, height, isTransform = false) {
|
|
34352
|
-
const objects = [...this.getObjects()];
|
|
34353
|
-
const objectsLength = objects.length;
|
|
34354
|
-
if (width == null) width = this.width;
|
|
34355
|
-
if (height == null) height = this.height;
|
|
34356
|
-
for (let i = 0; i < objectsLength; i++) {
|
|
34357
|
-
const o = objects[i];
|
|
34358
|
-
if (o.oKey === oKey) {
|
|
34359
|
-
objects.splice(i, 1);
|
|
34360
|
-
isTransform && this._transformObject(o, width, height);
|
|
34361
|
-
o.parent = this.parent;
|
|
34362
|
-
o.groupKey = void 0;
|
|
34363
|
-
o.isInGroup = false;
|
|
34364
|
-
this._objects = objects;
|
|
34365
|
-
return;
|
|
34366
|
-
}
|
|
34367
|
-
}
|
|
34368
|
-
}
|
|
34369
|
-
_transformObject(object, groupWidth, groupHeight) {
|
|
34370
|
-
const transform = transformObjectOutOfGroup(object.getState(), this.getState(), groupWidth, groupHeight);
|
|
34371
|
-
if (object.classType === "Group") object.transformByState({
|
|
34372
|
-
left: transform.left,
|
|
34373
|
-
top: transform.top
|
|
34374
|
-
});
|
|
34375
|
-
else object.transformByState(transform);
|
|
34376
|
-
}
|
|
34377
|
-
getObjectsByOrder() {
|
|
34378
|
-
const objects = [];
|
|
34379
|
-
this._objects.sort(sortRules);
|
|
34380
|
-
for (const o of this._objects) if (o.visible) objects.push(o);
|
|
34381
|
-
return objects;
|
|
34382
|
-
}
|
|
34383
|
-
getObjects() {
|
|
34384
|
-
return this._objects;
|
|
34385
|
-
}
|
|
34386
|
-
render(ctx, bounds) {
|
|
34387
|
-
ctx.save();
|
|
34388
|
-
const m = this.transform.getMatrix();
|
|
34389
|
-
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
|
34390
|
-
const objects = this.getObjectsByOrder();
|
|
34391
|
-
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
34392
|
-
ctx.restore();
|
|
34393
|
-
}
|
|
34394
|
-
_clear() {
|
|
34395
|
-
this._objects = [];
|
|
34396
|
-
}
|
|
34397
|
-
dispose() {
|
|
34398
|
-
[...this.getObjects()].forEach((o) => {
|
|
34399
|
-
o.dispose();
|
|
34400
|
-
});
|
|
34401
|
-
this._clear();
|
|
34402
|
-
super.dispose();
|
|
34403
|
-
}
|
|
34404
|
-
};
|
|
34405
|
-
|
|
34406
|
-
//#endregion
|
|
34407
|
-
//#region src/drawing-group.ts
|
|
34408
|
-
var DrawingGroupObject = class extends Group {
|
|
34409
|
-
constructor(..._args) {
|
|
34410
|
-
super(..._args);
|
|
34411
|
-
_defineProperty(this, "_selfSizeMode", true);
|
|
34412
|
-
_defineProperty(this, "_baseBound", {
|
|
34413
|
-
left: 0,
|
|
34414
|
-
top: 0,
|
|
34415
|
-
width: 0,
|
|
34416
|
-
height: 0
|
|
34417
|
-
});
|
|
34418
|
-
_defineProperty(this, "_outerShadow", void 0);
|
|
34419
|
-
_defineProperty(this, "_glow", void 0);
|
|
34420
|
-
}
|
|
34421
|
-
setOuterShadow(shadow) {
|
|
34422
|
-
this._outerShadow = shadow;
|
|
34423
|
-
this.makeDirty(true);
|
|
34424
|
-
}
|
|
34425
|
-
setGlow(glow) {
|
|
34426
|
-
this._glow = glow;
|
|
34427
|
-
this.makeDirty(true);
|
|
34428
|
-
}
|
|
34429
|
-
/**
|
|
34430
|
-
* Set the baseBound (chOff/chExt in OOXML) for this group.
|
|
34431
|
-
* This defines the coordinate space of children within the group.
|
|
34432
|
-
* When set, the group automatically enters selfSizeMode so its dimensions
|
|
34433
|
-
* are tracked independently of children.
|
|
34434
|
-
*/
|
|
34435
|
-
setBaseBound(bound) {
|
|
34436
|
-
this._baseBound = { ...bound };
|
|
34437
|
-
}
|
|
34438
|
-
/**
|
|
34439
|
-
* Get the baseBound (chOff/chExt in OOXML) for this group.
|
|
34440
|
-
*/
|
|
34441
|
-
getBaseBound() {
|
|
34442
|
-
return { ...this._baseBound };
|
|
34443
|
-
}
|
|
34444
|
-
/**
|
|
34445
|
-
* Override ancestorTransform to use the same render transform as render(),
|
|
34446
|
-
* which uses [m[0], m[1], m[2], m[3], centerX, centerY] from realBound
|
|
34447
|
-
* instead of the standard transform translation.
|
|
34448
|
-
* This ensures children (e.g., Image.isHit) that compose with
|
|
34449
|
-
* parent.ancestorTransform get the correct coordinate space.
|
|
34450
|
-
*/
|
|
34451
|
-
get ancestorTransform() {
|
|
34452
|
-
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
34453
|
-
const m = this.transform.getMatrix();
|
|
34454
|
-
const centerX = realLeft + realWidth / 2;
|
|
34455
|
-
const centerY = realTop + realHeight / 2;
|
|
34456
|
-
const renderTransform = new Transform([
|
|
34457
|
-
m[0],
|
|
34458
|
-
m[1],
|
|
34459
|
-
m[2],
|
|
34460
|
-
m[3],
|
|
34461
|
-
centerX,
|
|
34462
|
-
centerY
|
|
34463
|
-
]);
|
|
34464
|
-
const parent = this.getParent();
|
|
34465
|
-
if (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group") return parent.ancestorTransform.multiply(renderTransform);
|
|
34466
|
-
return renderTransform;
|
|
34467
|
-
}
|
|
34468
|
-
render(ctx, bounds) {
|
|
34469
|
-
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
34470
|
-
ctx.save();
|
|
34471
|
-
const m = this.transform.getMatrix();
|
|
34472
|
-
const centerX = realLeft + realWidth / 2;
|
|
34473
|
-
const centerY = realTop + realHeight / 2;
|
|
34474
|
-
ctx.transform(m[0], m[1], m[2], m[3], centerX, centerY);
|
|
34475
|
-
const effectFilter = createDrawingEffectFilter(this._glow, void 0);
|
|
34476
|
-
if (effectFilter) ctx.filter = combineDrawingEffectFilter(ctx.filter, effectFilter);
|
|
34477
|
-
if (this._outerShadow) {
|
|
34478
|
-
ctx.shadowColor = this._outerShadow.shadowColor;
|
|
34479
|
-
ctx.shadowBlur = this._outerShadow.shadowBlur;
|
|
34480
|
-
ctx.shadowOffsetX = this._outerShadow.shadowOffsetX;
|
|
34481
|
-
ctx.shadowOffsetY = this._outerShadow.shadowOffsetY;
|
|
34482
|
-
}
|
|
34483
|
-
const objects = this.getObjectsByOrder();
|
|
34484
|
-
for (let i = 0; i < objects.length; i++) objects[i].render(ctx, bounds);
|
|
34485
|
-
ctx.restore();
|
|
34486
|
-
}
|
|
34487
|
-
addObjects(...objects) {
|
|
34488
|
-
for (const object of objects) this.addObject(object);
|
|
34489
|
-
}
|
|
34490
|
-
isHit(coord) {
|
|
34491
|
-
const { left: realLeft, top: realTop, width: realWidth, height: realHeight } = this.getRealBound();
|
|
34492
|
-
const m = this.transform.getMatrix();
|
|
34493
|
-
const centerX = realLeft + realWidth / 2;
|
|
34494
|
-
const centerY = realTop + realHeight / 2;
|
|
34495
|
-
const renderTransform = new Transform([
|
|
34496
|
-
m[0],
|
|
34497
|
-
m[1],
|
|
34498
|
-
m[2],
|
|
34499
|
-
m[3],
|
|
34500
|
-
centerX,
|
|
34501
|
-
centerY
|
|
34502
|
-
]);
|
|
34503
|
-
const parent = this.getParent();
|
|
34504
|
-
const oCoord = (this.isInGroup && (parent === null || parent === void 0 ? void 0 : parent.classType) === "Group" ? parent.ancestorTransform.multiply(renderTransform) : renderTransform).invert().applyPoint(coord);
|
|
34505
|
-
const halfWidth = realWidth / 2;
|
|
34506
|
-
const halfHeight = realHeight / 2;
|
|
34507
|
-
if (oCoord.x < -halfWidth || oCoord.x > halfWidth || oCoord.y < -halfHeight || oCoord.y > halfHeight) return false;
|
|
34508
|
-
const objects = this.getObjectsByOrder();
|
|
34509
|
-
for (let i = 0; i < objects.length; i++) if (objects[i].isHit(coord)) return true;
|
|
34510
|
-
return false;
|
|
34511
|
-
}
|
|
34512
|
-
dispose() {
|
|
34513
|
-
const objects = [...this.getObjects()];
|
|
34514
|
-
const scene = this.getScene();
|
|
34515
|
-
objects.forEach((o) => {
|
|
34516
|
-
o.dispose();
|
|
34517
|
-
scene === null || scene === void 0 || scene.removeObject(o);
|
|
34518
|
-
});
|
|
34519
|
-
this._objects = [];
|
|
34520
|
-
super.dispose();
|
|
34521
|
-
scene === null || scene === void 0 || scene.removeObject(this);
|
|
34522
|
-
}
|
|
34523
|
-
};
|
|
34524
|
-
|
|
34525
34742
|
//#endregion
|
|
34526
34743
|
//#region src/floating/util.ts
|
|
34527
34744
|
/**
|
|
@@ -35364,7 +35581,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
35364
35581
|
//#endregion
|
|
35365
35582
|
//#region package.json
|
|
35366
35583
|
var name = "@univerjs/engine-render";
|
|
35367
|
-
var version = "1.0
|
|
35584
|
+
var version = "1.1.0";
|
|
35368
35585
|
|
|
35369
35586
|
//#endregion
|
|
35370
35587
|
//#region src/config/config.ts
|
|
@@ -40035,6 +40252,7 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40035
40252
|
_defineProperty(this, "_viewModel", void 0);
|
|
40036
40253
|
_defineProperty(this, "_skeleton", void 0);
|
|
40037
40254
|
_defineProperty(this, "_lastPublishedPageCount", 0);
|
|
40255
|
+
_defineProperty(this, "_paginationRevision", 0);
|
|
40038
40256
|
_defineProperty(this, "_layoutReason", "initial");
|
|
40039
40257
|
_defineProperty(this, "_didPublishEditAnchor", false);
|
|
40040
40258
|
_defineProperty(this, "_continuousPageSnapshot", null);
|
|
@@ -40050,6 +40268,7 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40050
40268
|
var _options$invalidation;
|
|
40051
40269
|
this._lastPublishedPageCount = 0;
|
|
40052
40270
|
this._layoutReason = (options === null || options === void 0 ? void 0 : options.reason) ?? "initial";
|
|
40271
|
+
this._paginationRevision = 0;
|
|
40053
40272
|
this._didPublishEditAnchor = false;
|
|
40054
40273
|
this._publishedHeaderPages.clear();
|
|
40055
40274
|
this._publishedFooterPages.clear();
|
|
@@ -40130,6 +40349,11 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40130
40349
|
}
|
|
40131
40350
|
_collectPublications(initialProgress) {
|
|
40132
40351
|
let progress = initialProgress;
|
|
40352
|
+
if ((progress.paginationRevision ?? 0) !== this._paginationRevision) {
|
|
40353
|
+
this._paginationRevision = progress.paginationRevision ?? 0;
|
|
40354
|
+
this._lastPublishedPageCount = 0;
|
|
40355
|
+
this._didPublishEditAnchor = false;
|
|
40356
|
+
}
|
|
40133
40357
|
if (!progress.didPublish) return {
|
|
40134
40358
|
progress,
|
|
40135
40359
|
publication: null
|
|
@@ -40243,7 +40467,8 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40243
40467
|
})))]) : null,
|
|
40244
40468
|
drawingAnchor: complete ? [...skeletonData.drawingAnchor ?? []].map(([segmentId, anchors]) => [segmentId, [...anchors].map(([paragraphIndex, anchor]) => [paragraphIndex, {
|
|
40245
40469
|
paragraphIndex: anchor.paragraphIndex,
|
|
40246
|
-
top: anchor.top
|
|
40470
|
+
top: anchor.top,
|
|
40471
|
+
...anchor.left == null ? {} : { left: anchor.left }
|
|
40247
40472
|
}])]) : null
|
|
40248
40473
|
};
|
|
40249
40474
|
}
|