@univerjs/engine-render 1.0.3 → 1.0.4
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 +224 -53
- package/lib/es/index.js +224 -53
- package/lib/index.js +224 -53
- package/lib/types/basics/i-document-skeleton-cached.d.ts +6 -2
- package/lib/types/basics/interfaces.d.ts +2 -2
- package/lib/types/components/docs/document.d.ts +2 -3
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +3 -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/tools.d.ts +10 -1
- package/lib/types/worker-layout.d.ts +1 -0
- package/lib/umd/index.js +4 -4
- package/package.json +3 -3
package/lib/es/index.js
CHANGED
|
@@ -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;
|
|
@@ -13911,6 +13911,26 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
13911
13911
|
}
|
|
13912
13912
|
};
|
|
13913
13913
|
|
|
13914
|
+
//#endregion
|
|
13915
|
+
//#region src/components/docs/layout/header-footer-field.ts
|
|
13916
|
+
function resolveHeaderFooterFieldGlyph(glyph, startIndex, endIndex, customRanges, pageNumber, pageCount) {
|
|
13917
|
+
var _fieldRange$propertie, _fieldRange$propertie2;
|
|
13918
|
+
if (!glyph.content || glyph.raw === DataStreamTreeTokenType.CUSTOM_RANGE_START || glyph.raw === DataStreamTreeTokenType.CUSTOM_RANGE_END) return glyph;
|
|
13919
|
+
const fieldRange = customRanges.find((customRange) => {
|
|
13920
|
+
var _customRange$properti;
|
|
13921
|
+
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";
|
|
13922
|
+
});
|
|
13923
|
+
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();
|
|
13924
|
+
if (!fieldRange || ((_fieldRange$propertie2 = fieldRange.properties) === null || _fieldRange$propertie2 === void 0 ? void 0 : _fieldRange$propertie2.locked) === BooleanNumber.TRUE || fieldType !== "PAGE" && fieldType !== "NUMPAGES") return glyph;
|
|
13925
|
+
if (fieldType === "NUMPAGES" && pageCount == null) return glyph;
|
|
13926
|
+
let content = "";
|
|
13927
|
+
if (startIndex === fieldRange.startIndex + 1) content = String(fieldType === "PAGE" ? pageNumber : pageCount);
|
|
13928
|
+
return content === glyph.content ? glyph : {
|
|
13929
|
+
...glyph,
|
|
13930
|
+
content
|
|
13931
|
+
};
|
|
13932
|
+
}
|
|
13933
|
+
|
|
13914
13934
|
//#endregion
|
|
13915
13935
|
//#region src/components/docs/layout/line-breaker/enhancers/utils.ts
|
|
13916
13936
|
/**
|
|
@@ -17049,27 +17069,75 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
17049
17069
|
let header;
|
|
17050
17070
|
let footer;
|
|
17051
17071
|
if (headerId) {
|
|
17052
|
-
var _skeHeaders$get;
|
|
17053
|
-
|
|
17072
|
+
var _headerTreeMap$get, _skeHeaders$get;
|
|
17073
|
+
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;
|
|
17074
|
+
const dynamic = fieldRanges === null || fieldRanges === void 0 ? void 0 : fieldRanges.some((range) => {
|
|
17075
|
+
var _range$properties, _range$properties2, _range$properties3;
|
|
17076
|
+
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");
|
|
17077
|
+
});
|
|
17078
|
+
const key = dynamic ? JSON.stringify([
|
|
17079
|
+
sectionId,
|
|
17080
|
+
pageNumber,
|
|
17081
|
+
pageWidth,
|
|
17082
|
+
marginLeft,
|
|
17083
|
+
marginRight,
|
|
17084
|
+
ctx.hasNumPagesFields ? ctx.fieldPageCount : void 0
|
|
17085
|
+
]) : pageWidth;
|
|
17086
|
+
if (typeof key === "string") page.headerLayoutKey = key;
|
|
17087
|
+
if ((_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.has(key)) {
|
|
17054
17088
|
var _skeHeaders$get2;
|
|
17055
|
-
header = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(
|
|
17089
|
+
header = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(key);
|
|
17056
17090
|
} else if (headerTreeMap && headerTreeMap.has(headerId)) {
|
|
17057
|
-
|
|
17091
|
+
const previousFieldContext = ctx.headerFooterFieldContext;
|
|
17092
|
+
ctx.headerFooterFieldContext = dynamic ? {
|
|
17093
|
+
pageNumber,
|
|
17094
|
+
pageCount: ctx.fieldPageCount
|
|
17095
|
+
} : void 0;
|
|
17096
|
+
try {
|
|
17097
|
+
header = _createSkeletonHeaderFooter(ctx, headerTreeMap.get(headerId), sectionBreakConfig, skeletonResourceReference, headerId, true);
|
|
17098
|
+
header.fieldsResolved = Boolean(dynamic);
|
|
17099
|
+
} finally {
|
|
17100
|
+
ctx.headerFooterFieldContext = previousFieldContext;
|
|
17101
|
+
}
|
|
17058
17102
|
const widths = skeHeaders.get(headerId) ?? /* @__PURE__ */ new Map();
|
|
17059
|
-
widths.set(
|
|
17103
|
+
widths.set(key, header);
|
|
17060
17104
|
skeHeaders.set(headerId, widths);
|
|
17061
17105
|
}
|
|
17062
17106
|
page.headerId = headerId;
|
|
17063
17107
|
}
|
|
17064
17108
|
if (footerId) {
|
|
17065
|
-
var _skeFooters$get;
|
|
17066
|
-
|
|
17109
|
+
var _footerTreeMap$get, _skeFooters$get;
|
|
17110
|
+
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;
|
|
17111
|
+
const dynamic = fieldRanges === null || fieldRanges === void 0 ? void 0 : fieldRanges.some((range) => {
|
|
17112
|
+
var _range$properties4, _range$properties5, _range$properties6;
|
|
17113
|
+
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");
|
|
17114
|
+
});
|
|
17115
|
+
const key = dynamic ? JSON.stringify([
|
|
17116
|
+
sectionId,
|
|
17117
|
+
pageNumber,
|
|
17118
|
+
pageWidth,
|
|
17119
|
+
marginLeft,
|
|
17120
|
+
marginRight,
|
|
17121
|
+
ctx.hasNumPagesFields ? ctx.fieldPageCount : void 0
|
|
17122
|
+
]) : pageWidth;
|
|
17123
|
+
if (typeof key === "string") page.footerLayoutKey = key;
|
|
17124
|
+
if ((_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.has(key)) {
|
|
17067
17125
|
var _skeFooters$get2;
|
|
17068
|
-
footer = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(
|
|
17126
|
+
footer = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(key);
|
|
17069
17127
|
} else if (footerTreeMap && footerTreeMap.has(footerId)) {
|
|
17070
|
-
|
|
17128
|
+
const previousFieldContext = ctx.headerFooterFieldContext;
|
|
17129
|
+
ctx.headerFooterFieldContext = dynamic ? {
|
|
17130
|
+
pageNumber,
|
|
17131
|
+
pageCount: ctx.fieldPageCount
|
|
17132
|
+
} : void 0;
|
|
17133
|
+
try {
|
|
17134
|
+
footer = _createSkeletonHeaderFooter(ctx, footerTreeMap.get(footerId), sectionBreakConfig, skeletonResourceReference, footerId, false);
|
|
17135
|
+
footer.fieldsResolved = Boolean(dynamic);
|
|
17136
|
+
} finally {
|
|
17137
|
+
ctx.headerFooterFieldContext = previousFieldContext;
|
|
17138
|
+
}
|
|
17071
17139
|
const widths = skeFooters.get(footerId) ?? /* @__PURE__ */ new Map();
|
|
17072
|
-
widths.set(
|
|
17140
|
+
widths.set(key, footer);
|
|
17073
17141
|
skeFooters.set(footerId, widths);
|
|
17074
17142
|
}
|
|
17075
17143
|
page.footerId = footerId;
|
|
@@ -17078,6 +17146,29 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
17078
17146
|
page.originMarginBottom = marginBottom;
|
|
17079
17147
|
page.marginTop = _getVerticalMargin(marginTop, header);
|
|
17080
17148
|
page.marginBottom = _getVerticalMargin(marginBottom, footer);
|
|
17149
|
+
if (ctx.headerFooterMinimumMargins) for (const [id, layoutKey, margin] of [[
|
|
17150
|
+
headerId,
|
|
17151
|
+
page.headerLayoutKey,
|
|
17152
|
+
"marginTop"
|
|
17153
|
+
], [
|
|
17154
|
+
footerId,
|
|
17155
|
+
page.footerLayoutKey,
|
|
17156
|
+
"marginBottom"
|
|
17157
|
+
]]) {
|
|
17158
|
+
if (layoutKey == null) continue;
|
|
17159
|
+
const key = JSON.stringify([
|
|
17160
|
+
id,
|
|
17161
|
+
sectionId,
|
|
17162
|
+
pageNumber,
|
|
17163
|
+
pageWidth,
|
|
17164
|
+
marginLeft,
|
|
17165
|
+
marginRight,
|
|
17166
|
+
margin
|
|
17167
|
+
]);
|
|
17168
|
+
const maximum = Math.max(page[margin], ctx.headerFooterMinimumMargins.get(key) ?? 0);
|
|
17169
|
+
ctx.headerFooterMinimumMargins.set(key, maximum);
|
|
17170
|
+
if (ctx.fieldCountCycle) page[margin] = maximum;
|
|
17171
|
+
}
|
|
17081
17172
|
const sections = page.sections;
|
|
17082
17173
|
const lastSection = sections[sections.length - 1];
|
|
17083
17174
|
const { marginTop: curPageMT, marginBottom: curPageMB, marginLeft: curPageML, marginRight: curPageMR } = page;
|
|
@@ -18277,8 +18368,8 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
18277
18368
|
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
18369
|
const lineTop = preLineHeight + ((preLine === null || preLine === void 0 ? void 0 : preLine.top) ?? initialFootnoteTop);
|
|
18279
18370
|
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);
|
|
18371
|
+
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);
|
|
18372
|
+
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
18373
|
let needOpenNewPageByTableLayout = false;
|
|
18283
18374
|
const { deferredInlineGroupAnchorDrawings, deferredTopBottomAnchorDrawings } = _positionLineDrawings(ctx, glyphGroup, column, lastPage, paragraphConfig, lineTop, lineHeight, paragraphAnchorLeft, hasInlineCustomBlock, isParagraphFirstShapedText);
|
|
18284
18375
|
if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
|
|
@@ -19484,7 +19575,7 @@ function documentSkeletonTableIterator(pages, options = {}) {
|
|
|
19484
19575
|
unitId
|
|
19485
19576
|
});
|
|
19486
19577
|
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);
|
|
19578
|
+
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
19579
|
if (headerPage != null) collectPageTables({
|
|
19489
19580
|
contexts,
|
|
19490
19581
|
docsLeft,
|
|
@@ -19499,7 +19590,7 @@ function documentSkeletonTableIterator(pages, options = {}) {
|
|
|
19499
19590
|
tableCellInsetX,
|
|
19500
19591
|
unitId
|
|
19501
19592
|
});
|
|
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);
|
|
19593
|
+
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
19594
|
if (footerPage != null) collectPageTables({
|
|
19504
19595
|
contexts,
|
|
19505
19596
|
docsLeft,
|
|
@@ -21095,6 +21186,26 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
21095
21186
|
for (const glyph of shapedGlyphs) if (isCjkLeftAlignedPunctuation(glyph.content) || isCjkRightAlignedPunctuation(glyph.content) || isCjkCenterAlignedPunctuation(glyph.content)) glyph.adjustability.shrinkability = [0, 0];
|
|
21096
21187
|
}
|
|
21097
21188
|
if (((_sectionBreakConfig$r5 = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r5 === void 0 ? void 0 : _sectionBreakConfig$r5.preservePunctuationSpacing) !== BooleanNumber.TRUE && (!traditionalLayout || fixedPunctuationPairs)) punctuationSpaceAdjustment(shapedGlyphs, fixedPunctuationPairs);
|
|
21189
|
+
if (ctx.headerFooterFieldContext) {
|
|
21190
|
+
let index = paragraphNode.contentStartIndex + last;
|
|
21191
|
+
for (let glyphIndex = 0; glyphIndex < shapedGlyphs.length; glyphIndex++) {
|
|
21192
|
+
var _viewModel$getBody3, _glyph$fontStyle, _glyph$ts2;
|
|
21193
|
+
const glyph = shapedGlyphs[glyphIndex];
|
|
21194
|
+
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);
|
|
21195
|
+
index += glyph.count;
|
|
21196
|
+
if (resolved === glyph) continue;
|
|
21197
|
+
const font = (_glyph$fontStyle = glyph.fontStyle) === null || _glyph$fontStyle === void 0 ? void 0 : _glyph$fontStyle.fontString;
|
|
21198
|
+
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;
|
|
21199
|
+
shapedGlyphs[glyphIndex] = {
|
|
21200
|
+
...resolved,
|
|
21201
|
+
width: Math.max(0, glyph.width + widthDelta),
|
|
21202
|
+
bBox: {
|
|
21203
|
+
...glyph.bBox,
|
|
21204
|
+
width: Math.max(0, glyph.bBox.width + widthDelta)
|
|
21205
|
+
}
|
|
21206
|
+
};
|
|
21207
|
+
}
|
|
21208
|
+
}
|
|
21098
21209
|
appendShapedText(shapedTextList, shapedGlyphs, bk.type, paragraphStyle.fixedTabStops === BooleanNumber.TRUE);
|
|
21099
21210
|
last = bk.position;
|
|
21100
21211
|
}
|
|
@@ -23202,6 +23313,8 @@ function serializePaginatedContinuationCheckpoint(page) {
|
|
|
23202
23313
|
sectionId: page.sectionId,
|
|
23203
23314
|
headerId: page.headerId,
|
|
23204
23315
|
footerId: page.footerId,
|
|
23316
|
+
headerLayoutKey: page.headerLayoutKey,
|
|
23317
|
+
footerLayoutKey: page.footerLayoutKey,
|
|
23205
23318
|
pageWidth: page.pageWidth,
|
|
23206
23319
|
pageHeight: page.pageHeight,
|
|
23207
23320
|
pageOrient: page.pageOrient,
|
|
@@ -23278,7 +23391,7 @@ function getSegmentPageFromRelativePath(skeletonData, segmentPageIndex, path) {
|
|
|
23278
23391
|
const rootPage = skeletonData.pages[segmentPageIndex];
|
|
23279
23392
|
if (rootPage == null) return null;
|
|
23280
23393
|
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)];
|
|
23394
|
+
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
23395
|
for (const segmentPage of segmentPages) {
|
|
23283
23396
|
if (segmentPage == null) continue;
|
|
23284
23397
|
const page = getPageFromPath({
|
|
@@ -23309,6 +23422,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23309
23422
|
_defineProperty(this, "_languageDetector", LanguageDetector.getInstance());
|
|
23310
23423
|
_defineProperty(this, "_initialWidth", 0);
|
|
23311
23424
|
_defineProperty(this, "_paginationMetrics", null);
|
|
23425
|
+
_defineProperty(this, "_completedPageCount", void 0);
|
|
23312
23426
|
_defineProperty(this, "_lastCompleteSkeletonData", null);
|
|
23313
23427
|
_defineProperty(this, "_pendingInvalidationAnchor", null);
|
|
23314
23428
|
_defineProperty(this, "_layoutGeneration", 0);
|
|
@@ -23333,6 +23447,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23333
23447
|
this._layoutPageMaterialized$.complete();
|
|
23334
23448
|
this._skeletonData = null;
|
|
23335
23449
|
this._lastCompleteSkeletonData = null;
|
|
23450
|
+
this._completedPageCount = void 0;
|
|
23336
23451
|
this._pendingInvalidationAnchor = null;
|
|
23337
23452
|
this._externalLayoutProgress = null;
|
|
23338
23453
|
this._externalProtectedPages = null;
|
|
@@ -23350,14 +23465,21 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23350
23465
|
* PS: This method has significant impact on performance.
|
|
23351
23466
|
*/
|
|
23352
23467
|
calculate(bounds) {
|
|
23468
|
+
var _this$_skeletonData;
|
|
23353
23469
|
if (!this.dirty) return;
|
|
23354
23470
|
this.cancelIncrementalLayout();
|
|
23355
23471
|
this._externalLayoutProgress = null;
|
|
23356
23472
|
this._externalProtectedPages = null;
|
|
23357
23473
|
this._externalProtectedContinuousLayout = null;
|
|
23358
|
-
|
|
23359
|
-
|
|
23474
|
+
let ctx = this._prepareLayoutContext();
|
|
23475
|
+
while (true) {
|
|
23476
|
+
this._skeletonData = this._createSkeleton(ctx, bounds);
|
|
23477
|
+
const retry = this._prepareFieldCountRetry(ctx);
|
|
23478
|
+
if (retry == null) break;
|
|
23479
|
+
ctx = retry;
|
|
23480
|
+
}
|
|
23360
23481
|
this._lastCompleteSkeletonData = this._skeletonData;
|
|
23482
|
+
this._completedPageCount = (_this$_skeletonData = this._skeletonData) === null || _this$_skeletonData === void 0 ? void 0 : _this$_skeletonData.pages.length;
|
|
23361
23483
|
this._pendingInvalidationAnchor = null;
|
|
23362
23484
|
this._paginationMetrics = ctx.paginationMetrics ?? null;
|
|
23363
23485
|
this._dirty$.next(true);
|
|
@@ -23431,6 +23553,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23431
23553
|
lastPublishedBlockCount: incrementalStart.processedBlockCount,
|
|
23432
23554
|
publicationRevision: 0,
|
|
23433
23555
|
reuseUnaffectedTail: (options === null || options === void 0 ? void 0 : options.reuseUnaffectedTail) !== false,
|
|
23556
|
+
paginationRevision: 0,
|
|
23434
23557
|
allowMetadataOnlyStructuralTailReuse: (options === null || options === void 0 ? void 0 : options.allowMetadataOnlyStructuralTailReuse) === true,
|
|
23435
23558
|
reusedTail: false,
|
|
23436
23559
|
tailConvergencePageCount: incrementalStart.ctx.skeleton.pages.length,
|
|
@@ -23477,7 +23600,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23477
23600
|
const hasEarlierOverlappingRange = anchorPageIndex > 0 && previousSkeleton.pages.slice(0, anchorPageIndex).some((page) => previousAnchor >= page.st && previousAnchor <= page.ed);
|
|
23478
23601
|
const anchorBlockOwnsTable = blocks[anchorBlockIndex].block.children.some((child) => child.nodeType === DataStreamTreeNodeType.TABLE && anchor >= child.startIndex && anchor <= child.endIndex);
|
|
23479
23602
|
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)) {
|
|
23603
|
+
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
23604
|
const interactionPreviousAnchor = mapCurrentOffsetToPrevious(anchor, invalidation);
|
|
23482
23605
|
const interactionPageIndex = interactionSkeleton == null ? -1 : this._findBodyPageIndex(interactionSkeleton.pages, interactionPreviousAnchor);
|
|
23483
23606
|
const paginatedPrefix = this._preparePaginatedParagraphPrefix(ctx, interactionSkeleton ?? previousSkeleton, blocks[anchorBlockIndex], anchorBlockIndex, interactionPageIndex, invalidation);
|
|
@@ -23807,11 +23930,13 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23807
23930
|
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
23931
|
let didPublish = false;
|
|
23809
23932
|
let didPublishAnchor = false;
|
|
23810
|
-
if (!state.cancelled && canPublish && (!suppressPreAnchorPublication || shouldPublishPriority || state.complete)) {
|
|
23933
|
+
if (!state.cancelled && canPublish && (state.ctx.fieldCountCandidates == null || state.complete) && (!suppressPreAnchorPublication || shouldPublishPriority || state.complete)) {
|
|
23811
23934
|
if (state.mode === "paginated") this._finalizePaginatedPagesForPublication(state, publishedPageCount);
|
|
23812
23935
|
const isFinalPublication = state.complete && publishedPageCount >= pageCount;
|
|
23813
23936
|
if (isFinalPublication) {
|
|
23937
|
+
var _state$ctx$skeleton;
|
|
23814
23938
|
this._lastCompleteSkeletonData = state.ctx.skeleton;
|
|
23939
|
+
this._completedPageCount = (_state$ctx$skeleton = state.ctx.skeleton) === null || _state$ctx$skeleton === void 0 ? void 0 : _state$ctx$skeleton.pages.length;
|
|
23815
23940
|
this._pendingInvalidationAnchor = null;
|
|
23816
23941
|
}
|
|
23817
23942
|
this._skeletonData = isFinalPublication ? state.ctx.skeleton : !this._isolateIncrementalPublications && state.mode === "paginated" ? this._createSharedPublishablePartialSkeleton(state, publishedPageCount) : this._createPublishablePartialSkeleton(state, publishedPageCount);
|
|
@@ -23953,9 +24078,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
23953
24078
|
* page or block range while the external executor publishes a newer tail.
|
|
23954
24079
|
*/
|
|
23955
24080
|
beginExternalLayout(options) {
|
|
23956
|
-
var _this$
|
|
24081
|
+
var _this$_skeletonData2;
|
|
23957
24082
|
this.cancelIncrementalLayout();
|
|
23958
|
-
const pages = ((_this$
|
|
24083
|
+
const pages = ((_this$_skeletonData2 = this._skeletonData) === null || _this$_skeletonData2 === void 0 ? void 0 : _this$_skeletonData2.pages) ?? [];
|
|
23959
24084
|
const protectedRange = options.protectedRange;
|
|
23960
24085
|
const protectedPageRange = (protectedRange === null || protectedRange === void 0 ? void 0 : protectedRange.mode) === "paginated" ? protectedRange : void 0;
|
|
23961
24086
|
if (protectedPageRange == null) this._externalProtectedPages = null;
|
|
@@ -24112,6 +24237,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24112
24237
|
if (progress.complete) {
|
|
24113
24238
|
setPageParent(skeletonData.pages, skeletonData);
|
|
24114
24239
|
this._lastCompleteSkeletonData = skeletonData;
|
|
24240
|
+
this._completedPageCount = skeletonData === null || skeletonData === void 0 ? void 0 : skeletonData.pages.length;
|
|
24115
24241
|
this._pendingInvalidationAnchor = null;
|
|
24116
24242
|
this._externalProtectedContinuousLayout = null;
|
|
24117
24243
|
}
|
|
@@ -24181,6 +24307,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24181
24307
|
if (publicationToApply.resources.drawingAnchor != null) skeletonData.drawingAnchor = hydrateDrawingAnchors(publicationToApply.resources.drawingAnchor);
|
|
24182
24308
|
setPageParent(skeletonData.pages, skeletonData);
|
|
24183
24309
|
this._lastCompleteSkeletonData = skeletonData;
|
|
24310
|
+
this._completedPageCount = skeletonData === null || skeletonData === void 0 ? void 0 : skeletonData.pages.length;
|
|
24184
24311
|
this._pendingInvalidationAnchor = null;
|
|
24185
24312
|
this._externalProtectedPages = null;
|
|
24186
24313
|
this._externalProtectedContinuousLayout = null;
|
|
@@ -24390,8 +24517,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24390
24517
|
};
|
|
24391
24518
|
}
|
|
24392
24519
|
findBodyPageIndexByCharIndex(charIndex) {
|
|
24393
|
-
var _this$
|
|
24394
|
-
return this._findBodyPageIndex(((_this$
|
|
24520
|
+
var _this$_skeletonData3;
|
|
24521
|
+
return this._findBodyPageIndex(((_this$_skeletonData3 = this._skeletonData) === null || _this$_skeletonData3 === void 0 ? void 0 : _this$_skeletonData3.pages) ?? [], charIndex);
|
|
24395
24522
|
}
|
|
24396
24523
|
findNodeByCharIndex(charIndex, segmentId = "", segmentPageIndex = -1) {
|
|
24397
24524
|
const nodes = this._findNodeByIndex(charIndex, segmentId, segmentPageIndex);
|
|
@@ -24410,12 +24537,12 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24410
24537
|
const { headerId, footerId, pageWidth } = skePage;
|
|
24411
24538
|
if (pageType === 1) {
|
|
24412
24539
|
var _skeHeaders$get;
|
|
24413
|
-
const skeHeader = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
24540
|
+
const skeHeader = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(skePage.headerLayoutKey ?? pageWidth);
|
|
24414
24541
|
if (skeHeader == null) return;
|
|
24415
24542
|
else skePage = skeHeader;
|
|
24416
24543
|
} else if (pageType === 2) {
|
|
24417
24544
|
var _skeFooters$get;
|
|
24418
|
-
const skeFooter = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
24545
|
+
const skeFooter = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(skePage.footerLayoutKey ?? pageWidth);
|
|
24419
24546
|
if (skeFooter == null) return;
|
|
24420
24547
|
else skePage = skeFooter;
|
|
24421
24548
|
}
|
|
@@ -24523,9 +24650,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24523
24650
|
let exactMatch = null;
|
|
24524
24651
|
if (editArea === "HEADER" || editArea === "FOOTER") {
|
|
24525
24652
|
var _skeHeaders$get2, _skeFooters$get2;
|
|
24526
|
-
const headerSke = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(pageWidth);
|
|
24653
|
+
const headerSke = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(page.headerLayoutKey ?? pageWidth);
|
|
24527
24654
|
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);
|
|
24655
|
+
const footerSke = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(page.footerLayoutKey ?? pageWidth);
|
|
24529
24656
|
if (footerSke) exactMatch = exactMatch ?? this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
24530
24657
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
24531
24658
|
if (exactMatch) return exactMatch;
|
|
@@ -24547,9 +24674,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24547
24674
|
const { headerId, footerId, pageWidth } = page;
|
|
24548
24675
|
if (segmentId !== "" && !this._docViewModel.getNoteTreeMap().has(segmentId)) {
|
|
24549
24676
|
var _skeHeaders$get3, _skeFooters$get3;
|
|
24550
|
-
const headerSke = (_skeHeaders$get3 = skeHeaders.get(headerId)) === null || _skeHeaders$get3 === void 0 ? void 0 : _skeHeaders$get3.get(pageWidth);
|
|
24677
|
+
const headerSke = (_skeHeaders$get3 = skeHeaders.get(headerId)) === null || _skeHeaders$get3 === void 0 ? void 0 : _skeHeaders$get3.get(page.headerLayoutKey ?? pageWidth);
|
|
24551
24678
|
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);
|
|
24679
|
+
const footerSke = (_skeFooters$get3 = skeFooters.get(footerId)) === null || _skeFooters$get3 === void 0 ? void 0 : _skeFooters$get3.get(page.footerLayoutKey ?? pageWidth);
|
|
24553
24680
|
if (footerSke) exactMatch = exactMatch ?? this._collectNearestNode(footerSke, 2, page, footerId, pi, cache, x, y, pageLength);
|
|
24554
24681
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
24555
24682
|
if (exactMatch) return exactMatch;
|
|
@@ -24564,7 +24691,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24564
24691
|
continue;
|
|
24565
24692
|
}
|
|
24566
24693
|
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);
|
|
24694
|
+
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
24695
|
if (segmentSke) exactMatch = this._collectNearestNode(segmentSke, segmentId === headerId ? 1 : 2, page, segmentId, segmentPage, cache, x, y, pageLength);
|
|
24569
24696
|
} else exactMatch = this._collectNearestNode(page, 0, page, "", pi, cache, x, y, pageLength);
|
|
24570
24697
|
if (exactMatch) return exactMatch;
|
|
@@ -24891,6 +25018,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
24891
25018
|
return {
|
|
24892
25019
|
generation: state.generation,
|
|
24893
25020
|
publicationRevision: state.publicationRevision,
|
|
25021
|
+
paginationRevision: state.paginationRevision,
|
|
24894
25022
|
didPublish,
|
|
24895
25023
|
didPublishAnchor,
|
|
24896
25024
|
publishedPageCount: state.lastPublishedPageCount,
|
|
@@ -25410,10 +25538,52 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25410
25538
|
}
|
|
25411
25539
|
for (const hSkeMap of skeleton.skeHeaders.values()) for (const page of hSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
25412
25540
|
for (const fSkeMap of skeleton.skeFooters.values()) for (const page of fSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
25541
|
+
const retry = this._prepareFieldCountRetry(ctx);
|
|
25542
|
+
if (retry != null) {
|
|
25543
|
+
state.paginationRevision++;
|
|
25544
|
+
state.ctx = retry;
|
|
25545
|
+
state.sectionIndex = 0;
|
|
25546
|
+
state.paragraphIndex = 0;
|
|
25547
|
+
state.sectionInitialized = false;
|
|
25548
|
+
state.sectionBreakConfig = null;
|
|
25549
|
+
state.layoutAnchor = null;
|
|
25550
|
+
state.laidOutThrough = -1;
|
|
25551
|
+
state.stableLaidOutThrough = -1;
|
|
25552
|
+
state.processedBlockCount = 0;
|
|
25553
|
+
state.pendingTableBuild = null;
|
|
25554
|
+
state.pendingSlicedTableBuild = null;
|
|
25555
|
+
state.pendingParagraphCheckpoint = null;
|
|
25556
|
+
state.stablePageCount = 0;
|
|
25557
|
+
state.finalizedPageCount = 0;
|
|
25558
|
+
state.lastPublishedPageCount = 0;
|
|
25559
|
+
state.lastPublishedBlockCount = 0;
|
|
25560
|
+
state.anchorPublished = false;
|
|
25561
|
+
state.reuseUnaffectedTail = false;
|
|
25562
|
+
state.reusedTail = false;
|
|
25563
|
+
state.tailConvergencePageCount = 0;
|
|
25564
|
+
state.interactionPageTail = null;
|
|
25565
|
+
state.interactionPageComplete = false;
|
|
25566
|
+
state.interactionWindowComplete = false;
|
|
25567
|
+
state.interactionWindowResume = null;
|
|
25568
|
+
return;
|
|
25569
|
+
}
|
|
25413
25570
|
setPageParent(skeleton.pages, skeleton);
|
|
25414
25571
|
state.complete = true;
|
|
25415
25572
|
state.stableLaidOutThrough = state.laidOutThrough;
|
|
25416
25573
|
}
|
|
25574
|
+
getCompletedPageCount() {
|
|
25575
|
+
return this._completedPageCount;
|
|
25576
|
+
}
|
|
25577
|
+
_prepareFieldCountRetry(ctx) {
|
|
25578
|
+
if (!ctx.hasNumPagesFields || ctx.fieldPageCount === ctx.skeleton.pages.length) return null;
|
|
25579
|
+
const retry = this._prepareLayoutContext();
|
|
25580
|
+
retry.fieldPageCount = ctx.skeleton.pages.length;
|
|
25581
|
+
retry.headerFooterMinimumMargins = ctx.headerFooterMinimumMargins;
|
|
25582
|
+
retry.fieldCountCandidates = ctx.fieldCountCandidates ?? /* @__PURE__ */ new Set();
|
|
25583
|
+
if (ctx.fieldPageCount != null) retry.fieldCountCandidates.add(ctx.fieldPageCount);
|
|
25584
|
+
retry.fieldCountCycle = ctx.fieldCountCycle || retry.fieldCountCandidates.has(retry.fieldPageCount);
|
|
25585
|
+
return retry;
|
|
25586
|
+
}
|
|
25417
25587
|
_prepareLayoutContext() {
|
|
25418
25588
|
var _ctx$noteReferences;
|
|
25419
25589
|
const viewModel = this.getViewModel();
|
|
@@ -25445,7 +25615,17 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25445
25615
|
skeListLevel,
|
|
25446
25616
|
drawingAnchor
|
|
25447
25617
|
};
|
|
25618
|
+
const hasNumPagesFields = [...headerTreeMap.values(), ...footerTreeMap.values()].some((story) => {
|
|
25619
|
+
var _story$getBody;
|
|
25620
|
+
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) => {
|
|
25621
|
+
var _range$properties;
|
|
25622
|
+
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;
|
|
25623
|
+
});
|
|
25624
|
+
});
|
|
25448
25625
|
const ctx = {
|
|
25626
|
+
fieldPageCount: this.getCompletedPageCount(),
|
|
25627
|
+
hasNumPagesFields,
|
|
25628
|
+
headerFooterMinimumMargins: hasNumPagesFields ? /* @__PURE__ */ new Map() : void 0,
|
|
25449
25629
|
viewModel,
|
|
25450
25630
|
dataModel,
|
|
25451
25631
|
noteReferences: documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL ? resolveNoteReferences(dataModel.getSnapshot()) : void 0,
|
|
@@ -25641,8 +25821,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
25641
25821
|
let segmentPage = page;
|
|
25642
25822
|
if (segmentId) {
|
|
25643
25823
|
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);
|
|
25824
|
+
const maybeHeaderSke = (_skeHeaders$get5 = skeHeaders.get(segmentId)) === null || _skeHeaders$get5 === void 0 ? void 0 : _skeHeaders$get5.get(page.headerLayoutKey ?? pageWidth);
|
|
25825
|
+
const maybeFooterSke = (_skeFooters$get5 = skeFooters.get(segmentId)) === null || _skeFooters$get5 === void 0 ? void 0 : _skeFooters$get5.get(page.footerLayoutKey ?? pageWidth);
|
|
25646
25826
|
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
25827
|
if (note) segmentPage = note.page;
|
|
25648
25828
|
else if (maybeHeaderSke) segmentPage = maybeHeaderSke;
|
|
@@ -28780,22 +28960,6 @@ function getVisibleContinuousLineRange(lines, viewportTop, viewportBottom, flowT
|
|
|
28780
28960
|
end: low
|
|
28781
28961
|
};
|
|
28782
28962
|
}
|
|
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
28963
|
function resolveHeaderFooterFieldGlyphGroup(divide, context) {
|
|
28800
28964
|
var _context$viewModel;
|
|
28801
28965
|
const { glyphGroup } = divide;
|
|
@@ -29023,7 +29187,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
29023
29187
|
this._drawTable(ctx, page, skeTables, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
29024
29188
|
ctx.restore();
|
|
29025
29189
|
}
|
|
29026
|
-
const headerSkeletonPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(pageWidth);
|
|
29190
|
+
const headerSkeletonPage = (_skeHeaders$get = skeHeaders.get(headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(page.headerLayoutKey ?? pageWidth);
|
|
29027
29191
|
const headerAlignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, (headerSkeletonPage === null || headerSkeletonPage === void 0 ? void 0 : headerSkeletonPage.marginTop) ?? 0);
|
|
29028
29192
|
if (headerSkeletonPage) this._drawHeaderFooter(headerSkeletonPage, ctx, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, headerAlignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale, page, true, pages.length, void 0, headerFooterOpacity);
|
|
29029
29193
|
ctx.save();
|
|
@@ -29037,7 +29201,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
29037
29201
|
var _this$getSkeleton6;
|
|
29038
29202
|
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
29203
|
}
|
|
29040
|
-
const footerSkeletonPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
29204
|
+
const footerSkeletonPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(page.footerLayoutKey ?? pageWidth);
|
|
29041
29205
|
if (footerSkeletonPage) {
|
|
29042
29206
|
const footerAlignOffsetNoAngle = Vector2.create(horizontalOffsetNoAngle, page.pageHeight - (footerSkeletonPage === null || footerSkeletonPage === void 0 ? void 0 : footerSkeletonPage.height) - footerSkeletonPage.marginBottom);
|
|
29043
29207
|
this._drawHeaderFooter(footerSkeletonPage, ctx, extensions, backgroundExtension, preTextBackgroundExtensions, glyphExtensionsExcludeBackground, footerAlignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale, page, false, pages.length, void 0, headerFooterOpacity);
|
|
@@ -29641,7 +29805,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
29641
29805
|
const skeleton = this.getSkeleton();
|
|
29642
29806
|
const viewModel = typeof (skeleton === null || skeleton === void 0 ? void 0 : skeleton.getViewModel) === "function" ? skeleton.getViewModel().getSelfOrHeaderFooterViewModel(page.segmentId) : void 0;
|
|
29643
29807
|
const fieldContext = {
|
|
29644
|
-
customRanges: customRangesOverride ?? (viewModel === null || viewModel === void 0 || (_viewModel$getBody = viewModel.getBody()) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.customRanges) ?? [],
|
|
29808
|
+
customRanges: page.fieldsResolved ? [] : customRangesOverride ?? (viewModel === null || viewModel === void 0 || (_viewModel$getBody = viewModel.getBody()) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.customRanges) ?? [],
|
|
29645
29809
|
pageNumber: parentPage.pageNumber,
|
|
29646
29810
|
pageCount,
|
|
29647
29811
|
viewModel
|
|
@@ -35364,7 +35528,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
35364
35528
|
//#endregion
|
|
35365
35529
|
//#region package.json
|
|
35366
35530
|
var name = "@univerjs/engine-render";
|
|
35367
|
-
var version = "1.0.
|
|
35531
|
+
var version = "1.0.4";
|
|
35368
35532
|
|
|
35369
35533
|
//#endregion
|
|
35370
35534
|
//#region src/config/config.ts
|
|
@@ -40035,6 +40199,7 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40035
40199
|
_defineProperty(this, "_viewModel", void 0);
|
|
40036
40200
|
_defineProperty(this, "_skeleton", void 0);
|
|
40037
40201
|
_defineProperty(this, "_lastPublishedPageCount", 0);
|
|
40202
|
+
_defineProperty(this, "_paginationRevision", 0);
|
|
40038
40203
|
_defineProperty(this, "_layoutReason", "initial");
|
|
40039
40204
|
_defineProperty(this, "_didPublishEditAnchor", false);
|
|
40040
40205
|
_defineProperty(this, "_continuousPageSnapshot", null);
|
|
@@ -40050,6 +40215,7 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40050
40215
|
var _options$invalidation;
|
|
40051
40216
|
this._lastPublishedPageCount = 0;
|
|
40052
40217
|
this._layoutReason = (options === null || options === void 0 ? void 0 : options.reason) ?? "initial";
|
|
40218
|
+
this._paginationRevision = 0;
|
|
40053
40219
|
this._didPublishEditAnchor = false;
|
|
40054
40220
|
this._publishedHeaderPages.clear();
|
|
40055
40221
|
this._publishedFooterPages.clear();
|
|
@@ -40130,6 +40296,11 @@ var DocumentLayoutSession = class extends Disposable {
|
|
|
40130
40296
|
}
|
|
40131
40297
|
_collectPublications(initialProgress) {
|
|
40132
40298
|
let progress = initialProgress;
|
|
40299
|
+
if ((progress.paginationRevision ?? 0) !== this._paginationRevision) {
|
|
40300
|
+
this._paginationRevision = progress.paginationRevision ?? 0;
|
|
40301
|
+
this._lastPublishedPageCount = 0;
|
|
40302
|
+
this._didPublishEditAnchor = false;
|
|
40303
|
+
}
|
|
40133
40304
|
if (!progress.didPublish) return {
|
|
40134
40305
|
progress,
|
|
40135
40306
|
publication: null
|