@univerjs/engine-render 1.2.0 → 1.3.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 +54 -21
- package/lib/es/index.js +54 -21
- package/lib/index.js +54 -21
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +2 -2
- package/lib/types/components/docs/layout/block/table.d.ts +2 -2
- package/lib/types/components/docs/layout/tools.d.ts +1 -1
- package/lib/umd/index.js +4 -4
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -14850,7 +14850,7 @@ function _finishTableSkeletonBuild(state) {
|
|
|
14850
14850
|
applyTableOuterBorderSpacing(tableSkeleton, state.sectionBreakConfig);
|
|
14851
14851
|
for (const rowSkeleton of tableSkeleton.rows) _verticalAlignInCell(rowSkeleton, table.tableRows[rowSkeleton.index]);
|
|
14852
14852
|
const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
|
|
14853
|
-
tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, state.tableWidth, table.align, table.indent);
|
|
14853
|
+
tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, state.tableWidth, table.align, table.indent, shouldAllowImportedTableMarginOverflow(state.sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), table));
|
|
14854
14854
|
state.complete = true;
|
|
14855
14855
|
}
|
|
14856
14856
|
function applyMergedCellContentHeights(tableSkeleton, mergedCellContentHeights) {
|
|
@@ -15005,7 +15005,7 @@ function cachePrecomputedSlicedTableSkeletons(ctx, tableNode, availableHeight, r
|
|
|
15005
15005
|
});
|
|
15006
15006
|
}
|
|
15007
15007
|
function _finishTableSkeletonsBuild(state) {
|
|
15008
|
-
updateTableSkeletonsPosition(state.createCache, state.curPage, state.skeTables, state.table);
|
|
15008
|
+
updateTableSkeletonsPosition(state.createCache, state.curPage, state.skeTables, state.table, state.sectionBreakConfig);
|
|
15009
15009
|
state.skeTables.forEach((table) => applyTableOuterBorderSpacing(table, state.sectionBreakConfig));
|
|
15010
15010
|
const policy = state.sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
|
|
15011
15011
|
state.result = {
|
|
@@ -15064,7 +15064,7 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
|
|
|
15064
15064
|
cellPageHeights = dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, row, table, createCache, false, precomputedTable === null || precomputedTable === void 0 ? void 0 : precomputedTable.rows[row], void 0, cellPageHeights);
|
|
15065
15065
|
while (cellPageHeights);
|
|
15066
15066
|
}
|
|
15067
|
-
updateTableSkeletonsPosition(createCache, curPage, skeTables, table);
|
|
15067
|
+
updateTableSkeletonsPosition(createCache, curPage, skeTables, table, sectionBreakConfig);
|
|
15068
15068
|
skeTables.forEach((table) => applyTableOuterBorderSpacing(table, sectionBreakConfig));
|
|
15069
15069
|
const documentCompatibilityPolicy = sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
|
|
15070
15070
|
return {
|
|
@@ -15072,10 +15072,10 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
|
|
|
15072
15072
|
fromCurrentPage: createCache.fromCurrentPage !== false && skeTables[0].height <= availableHeight + documentCompatibilityPolicy.table.currentPageOverflowTolerance
|
|
15073
15073
|
};
|
|
15074
15074
|
}
|
|
15075
|
-
function updateTableSkeletonsPosition(cache, curPage, skeTables, table) {
|
|
15075
|
+
function updateTableSkeletonsPosition(cache, curPage, skeTables, table, sectionBreakConfig) {
|
|
15076
15076
|
const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
|
|
15077
15077
|
const { tableWidth } = cache;
|
|
15078
|
-
const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent);
|
|
15078
|
+
const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent, shouldAllowImportedTableMarginOverflow(sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), table));
|
|
15079
15079
|
const rowFragments = /* @__PURE__ */ new Map();
|
|
15080
15080
|
for (const part of skeTables) for (const row of part.rows) if (!row.isRepeatRow) rowFragments.set(row.index, (rowFragments.get(row.index) ?? 0) + 1);
|
|
15081
15081
|
let tableIndex = 0;
|
|
@@ -15409,11 +15409,11 @@ function resolveTableLayoutColumns(table, availableWidth, traditional = false) {
|
|
|
15409
15409
|
}))
|
|
15410
15410
|
};
|
|
15411
15411
|
}
|
|
15412
|
-
function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }) {
|
|
15412
|
+
function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }, allowMarginOverflow = false) {
|
|
15413
15413
|
switch (align) {
|
|
15414
15414
|
case TableAlignmentType.START: return indent.v;
|
|
15415
|
-
case TableAlignmentType.END: return Math.max(0, pageWidth - tableWidth);
|
|
15416
|
-
case TableAlignmentType.CENTER: return Math.max(0, (pageWidth - tableWidth) / 2);
|
|
15415
|
+
case TableAlignmentType.END: return allowMarginOverflow ? pageWidth - tableWidth : Math.max(0, pageWidth - tableWidth);
|
|
15416
|
+
case TableAlignmentType.CENTER: return allowMarginOverflow ? (pageWidth - tableWidth) / 2 : Math.max(0, (pageWidth - tableWidth) / 2);
|
|
15417
15417
|
default: throw new Error("Unknown table alignment type");
|
|
15418
15418
|
}
|
|
15419
15419
|
}
|
|
@@ -16050,6 +16050,19 @@ function _isDocxColumnBreakVisuallyBlankColumn(column) {
|
|
|
16050
16050
|
function _hasOnlyCustomBlockGlyphs(glyphs) {
|
|
16051
16051
|
return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK);
|
|
16052
16052
|
}
|
|
16053
|
+
function _mergeTrailingBlockEndShapedTexts(shapedTextList) {
|
|
16054
|
+
const result = [];
|
|
16055
|
+
for (const shapedText of shapedTextList) {
|
|
16056
|
+
const previous = result[result.length - 1];
|
|
16057
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.breakPointType) === "Mandatory" && _endsWithToken(previous.text, previous.glyphs, DataStreamTreeTokenType.PARAGRAPH) && shapedText.glyphs.length > 0 && shapedText.glyphs.some((glyph) => glyph.streamType === DataStreamTreeTokenType.BLOCK_END) && shapedText.glyphs.every((glyph, index) => glyph.width === 0 && (glyph.streamType === DataStreamTreeTokenType.BLOCK_END || index === shapedText.glyphs.length - 1 && glyph.streamType === DataStreamTreeTokenType.SECTION_BREAK))) result[result.length - 1] = {
|
|
16058
|
+
...previous,
|
|
16059
|
+
text: previous.text + shapedText.text,
|
|
16060
|
+
glyphs: [...previous.glyphs, ...shapedText.glyphs]
|
|
16061
|
+
};
|
|
16062
|
+
else result.push(shapedText);
|
|
16063
|
+
}
|
|
16064
|
+
return result;
|
|
16065
|
+
}
|
|
16053
16066
|
function _mergeAdjacentCustomBlockShapedTexts(shapedTextList, customBlockDrawings) {
|
|
16054
16067
|
const mergedShapedTextList = [];
|
|
16055
16068
|
for (const originShapedText of shapedTextList) {
|
|
@@ -16532,7 +16545,7 @@ function _prepareLineBreaking(ctx, viewModel, curPage, paragraphNode, sectionBre
|
|
|
16532
16545
|
...getFontCreateConfig(endIndex - paragraphNode.contentStartIndex, viewModel, paragraphNode, sectionBreakConfig, {
|
|
16533
16546
|
...paragraph,
|
|
16534
16547
|
paragraphStyle: resolvedParagraphStyle
|
|
16535
|
-
}).textStyle,
|
|
16548
|
+
}, false).textStyle,
|
|
16536
16549
|
ul: { s: BooleanNumber.FALSE }
|
|
16537
16550
|
} : void 0;
|
|
16538
16551
|
const bulletSkeleton = dealWithBullet(bullet, lists, listLevelAncestors, localeService, false, markerTextStyle);
|
|
@@ -16601,7 +16614,7 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
|
|
|
16601
16614
|
let deferredRenderedMarkers = [];
|
|
16602
16615
|
const retainedBreaks = (_ctx$footnoteLayout = ctx.footnoteLayout) === null || _ctx$footnoteLayout === void 0 ? void 0 : _ctx$footnoteLayout.getReferencePageBreaks(paragraphNode.endIndex);
|
|
16603
16616
|
const referencePageBreaks = retainedBreaks ? new Set(retainedBreaks.map((offset) => offset - paragraphNode.contentStartIndex)) : void 0;
|
|
16604
|
-
const mergedShapedTextList = _mergeAdjacentCustomBlockShapedTexts(_splitAtReferencePageBreaks(shapedTextList, referencePageBreaks), paragraphNonInlineSkeDrawingsByBlockId);
|
|
16617
|
+
const mergedShapedTextList = _mergeTrailingBlockEndShapedTexts(_mergeAdjacentCustomBlockShapedTexts(_splitAtReferencePageBreaks(shapedTextList, referencePageBreaks), paragraphNonInlineSkeDrawingsByBlockId));
|
|
16605
16618
|
for (let shapedIndex = 0; shapedIndex < mergedShapedTextList.length; shapedIndex++) {
|
|
16606
16619
|
const { text, glyphs, breakPointType } = mergedShapedTextList[shapedIndex];
|
|
16607
16620
|
const textStartIndex = paragraphNode.contentStartIndex + shapedTextOffset;
|
|
@@ -16611,6 +16624,7 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
|
|
|
16611
16624
|
const textEndIndex = textStartIndex + textGlyphCount;
|
|
16612
16625
|
const pushPending = (pendingGlyphs = glyphs, layoutBreakPointType = breakPointType) => {
|
|
16613
16626
|
if (pendingGlyphs.length === 0) return;
|
|
16627
|
+
const markerSourceIndex = textStartIndex - paragraphNode.contentStartIndex - _glyphCount(deferredRenderedMarkers);
|
|
16614
16628
|
if (deferredRenderedMarkers.length > 0) {
|
|
16615
16629
|
pendingGlyphs = [...deferredRenderedMarkers, ...pendingGlyphs];
|
|
16616
16630
|
deferredRenderedMarkers = [];
|
|
@@ -16618,7 +16632,16 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
|
|
|
16618
16632
|
syncActiveParagraphDrawings(pendingGlyphs, paragraphNonInlineSkeDrawings, paragraphInlineSkeDrawings, paragraphNonInlineSkeDrawingsByBlockId, paragraphInlineSkeDrawingsByBlockId);
|
|
16619
16633
|
const nonFlowAnchor = isNonFlowFloatingAnchor(pendingGlyphs, paragraphNonInlineSkeDrawings);
|
|
16620
16634
|
const preserveParagraphStart = nonFlowAnchor && mergedShapedTextList.slice(shapedIndex + 1).some(({ glyphs }) => glyphs.some((glyph) => glyph.width > 0 && glyph.streamType !== DataStreamTreeTokenType.PARAGRAPH && glyph.streamType !== DataStreamTreeTokenType.SECTION_BREAK && glyph.streamType !== DataStreamTreeTokenType.DOCS_END));
|
|
16621
|
-
|
|
16635
|
+
const renderBullet = renderParagraphBullet && !preserveParagraphStart;
|
|
16636
|
+
const paragraph = renderBullet && paragraphConfig.bulletSkeleton ? viewModel.getParagraph(paragraphNode.endIndex) : void 0;
|
|
16637
|
+
const markerTextStyle = paragraph ? getFontCreateConfig(markerSourceIndex, viewModel, paragraphNode, sectionBreakConfig, {
|
|
16638
|
+
...paragraph,
|
|
16639
|
+
paragraphStyle: paragraphConfig.paragraphStyle
|
|
16640
|
+
}, false).textStyle : void 0;
|
|
16641
|
+
allPages = layoutParagraph(ctx, pendingGlyphs, allPages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText || !nonFlowAnchor && hasOnlyFloatingCustomBlockGlyphs(pendingGlyphs, paragraphNonInlineSkeDrawingsByBlockId), layoutBreakPointType, renderBullet, startNewLine, markerTextStyle ? {
|
|
16642
|
+
cl: markerTextStyle.cl,
|
|
16643
|
+
ul: markerTextStyle.ul
|
|
16644
|
+
} : void 0);
|
|
16622
16645
|
if (!preserveParagraphStart) {
|
|
16623
16646
|
isParagraphFirstShapedText = false;
|
|
16624
16647
|
renderParagraphBullet = false;
|
|
@@ -17818,7 +17841,7 @@ function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth, hang
|
|
|
17818
17841
|
const shrinkability = precedingGlyphs !== void 0 && (wordFitsWithPunctuationCompression || spacedWesternWordFits || !precedingLineCanStretch && offsetLeft + width - trailingShrinkability - hangingExtra - divideWidth <= divideWidth - offsetLeft) && !precedingGlyphs.some((glyph) => glyph.glyphType === 4) && !glyphGroup.some((glyph) => glyph.glyphType === 4) ? getGlyphGroupShrinkability(precedingGlyphs) + getGlyphGroupShrinkability(glyphGroup) - (trailingAutoSpacing + leadingAutoSpacing) / 2 : trailingShrinkability;
|
|
17819
17842
|
return isBeyondDivideWidth(offsetLeft + width - shrinkability - hangingExtra, divideWidth, lineWrapTolerance);
|
|
17820
17843
|
}
|
|
17821
|
-
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", renderBullet = isParagraphFirstShapedText, startNewLine = false) {
|
|
17844
|
+
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", renderBullet = isParagraphFirstShapedText, startNewLine = false, markerTextStyle) {
|
|
17822
17845
|
paragraphConfig.documentCompatibilityPolicy ??= sectionBreakConfig.documentCompatibilityPolicy;
|
|
17823
17846
|
if (isParagraphFirstShapedText || startNewLine) {
|
|
17824
17847
|
if (renderBullet && paragraphConfig.bulletSkeleton) {
|
|
@@ -17827,7 +17850,14 @@ function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
17827
17850
|
const { gridType = GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig;
|
|
17828
17851
|
const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
|
|
17829
17852
|
const charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid);
|
|
17830
|
-
const
|
|
17853
|
+
const resolvedBulletSkeleton = markerTextStyle ? {
|
|
17854
|
+
...bulletSkeleton,
|
|
17855
|
+
ts: {
|
|
17856
|
+
...markerTextStyle,
|
|
17857
|
+
...bulletSkeleton.ts
|
|
17858
|
+
}
|
|
17859
|
+
} : bulletSkeleton;
|
|
17860
|
+
const bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], resolvedBulletSkeleton, charSpaceApply, paragraphConfig.documentCompatibilityPolicy ?? sectionBreakConfig.documentCompatibilityPolicy);
|
|
17831
17861
|
const paragraphProperties = bulletSkeleton.paragraphProperties || {};
|
|
17832
17862
|
paragraphConfig.paragraphStyle = {
|
|
17833
17863
|
...paragraphProperties,
|
|
@@ -18331,7 +18361,7 @@ function _getParagraphContentMetrics(ctx, glyphGroup, lastPage, column, sectionB
|
|
|
18331
18361
|
};
|
|
18332
18362
|
}
|
|
18333
18363
|
function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics) {
|
|
18334
|
-
var _sectionBreakConfig$d2;
|
|
18364
|
+
var _paragraphConfig$skeT, _sectionBreakConfig$d2;
|
|
18335
18365
|
const metrics = _getParagraphContentMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
|
|
18336
18366
|
const { preLine, paragraphIndex, paragraphStyle, spaceAbove, spaceBelow, spacingRule, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, drawingMLLineHeight, drawingMLBaselineHeight, isZeroWidthNonFlowFloatingAnchorLine, isStructuralTableAnchorLine, isEmptyFramedParagraph, isStandalonePageBoundary, wordAutoLeading } = metrics;
|
|
18337
18367
|
let { paddingTop, paddingBottom, contentHeight, lineSpacingApply } = metrics;
|
|
@@ -18345,10 +18375,12 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
|
|
|
18345
18375
|
var _section$children$;
|
|
18346
18376
|
return index > 0 && ((_section$children$ = section.children[0]) === null || _section$children$ === void 0 ? void 0 : _section$children$.endIndex) === paragraphIndex;
|
|
18347
18377
|
}) : void 0;
|
|
18378
|
+
const hasInlineTableBoundary = isParagraphFirstShapedText && ((_paragraphConfig$skeT = paragraphConfig.skeTablesInParagraph) === null || _paragraphConfig$skeT === void 0 || (_paragraphConfig$skeT = _paragraphConfig$skeT.find((item) => !item.hasPositioned)) === null || _paragraphConfig$skeT === void 0 ? void 0 : _paragraphConfig$skeT.table.tableSource.textWrap) === TableTextWrapType.NONE;
|
|
18379
|
+
const spaceBeforeTable = hasInlineTableBoundary ? Math.max(0, (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0) : 0;
|
|
18348
18380
|
let { marginTop, spaceBelowApply } = isHiddenParagraph ? {
|
|
18349
18381
|
marginTop: 0,
|
|
18350
18382
|
spaceBelowApply: (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0
|
|
18351
|
-
} : __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);
|
|
18383
|
+
} : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, hasInlineTableBoundary ? void 0 : preLine, !hasInlineTableBoundary && _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
|
|
18352
18384
|
if (preLine) marginTop += sectionBreakConfig.lineGap ?? 0;
|
|
18353
18385
|
if (startingSection && marginTop > 0 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy)) marginTop = _collapseSectionBeforeSpacing(ctx, startingSection.children[0].startIndex - 2, marginTop);
|
|
18354
18386
|
if (positionedCustomBlockOnly) spaceBelowApply = 0;
|
|
@@ -18387,6 +18419,7 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
|
|
|
18387
18419
|
paddingBottom,
|
|
18388
18420
|
contentHeight,
|
|
18389
18421
|
marginTop,
|
|
18422
|
+
spaceBeforeTable,
|
|
18390
18423
|
spaceBelowApply,
|
|
18391
18424
|
borderTopSpace,
|
|
18392
18425
|
borderBottomSpace,
|
|
@@ -18475,7 +18508,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
18475
18508
|
const previousLineHeight = preLine === null || preLine === void 0 ? void 0 : preLine.lineHeight;
|
|
18476
18509
|
const previousLineMarginBottom = preLine === null || preLine === void 0 ? void 0 : preLine.marginBottom;
|
|
18477
18510
|
const { paragraphNonInlineSkeDrawings, skeTablesInParagraph, skeHeaders, skeFooters, pDrawingAnchor, paragraphIndex } = paragraphConfig;
|
|
18478
|
-
const { paragraphStyle, spacingRule, drawingMLLineHeight, drawingMLBaselineHeight, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, isStandalonePageBoundary, paddingTop, paddingBottom, contentHeight, marginTop, spaceBelowApply, borderTopSpace, borderBottomSpace, wordAutoLeading } = _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
|
|
18511
|
+
const { paragraphStyle, spacingRule, drawingMLLineHeight, drawingMLBaselineHeight, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, isStandalonePageBoundary, paddingTop, paddingBottom, contentHeight, marginTop, spaceBeforeTable, spaceBelowApply, borderTopSpace, borderBottomSpace, wordAutoLeading } = _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
|
|
18479
18512
|
const { indentFirstLine, hanging, indentStart, indentEnd } = paragraphStyle;
|
|
18480
18513
|
const lineHeight = marginTop + paddingTop + contentHeight + paddingBottom;
|
|
18481
18514
|
const { charSpace, defaultTabStop } = getCharSpaceConfig(sectionBreakConfig, paragraphConfig);
|
|
@@ -18493,7 +18526,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
18493
18526
|
const { deferredInlineGroupAnchorDrawings, deferredTopBottomAnchorDrawings } = _positionLineDrawings(ctx, glyphGroup, column, lastPage, paragraphConfig, lineTop, lineHeight, paragraphAnchorLeft, hasInlineCustomBlock, isParagraphFirstShapedText);
|
|
18494
18527
|
if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
|
|
18495
18528
|
var _pDrawingAnchor$get2;
|
|
18496
|
-
needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop, lineHeight, lastPage, pages, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
|
|
18529
|
+
needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop + spaceBeforeTable, lineHeight, lastPage, pages, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
|
|
18497
18530
|
}
|
|
18498
18531
|
const hasSameParagraphTopBottomDrawingWithInline = hasInlineCustomBlock && paragraphNonInlineSkeDrawings != null && [...paragraphNonInlineSkeDrawings.values()].some((drawing) => drawing.drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
|
|
18499
18532
|
let tableFlowTop = lineTop;
|
|
@@ -18672,7 +18705,7 @@ function _updateAndPositionTable(ctx, lineTop, lineHeight, page, pages, column,
|
|
|
18672
18705
|
if (firstUnPositionedTable.isSlideTable === false || tableSource.textWrap === TableTextWrapType.NONE) switch (tableSource.textWrap) {
|
|
18673
18706
|
case TableTextWrapType.NONE:
|
|
18674
18707
|
table.top = section.top + lineTop;
|
|
18675
|
-
table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent);
|
|
18708
|
+
table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent, shouldAllowImportedTableMarginOverflow(sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), tableSource));
|
|
18676
18709
|
__avoidFlowAffectingDrawingsForTable(table, page, column);
|
|
18677
18710
|
__avoidNonOverlappingFloatingTables(table, page);
|
|
18678
18711
|
break;
|
|
@@ -20112,7 +20145,7 @@ const DEFAULT_TEXT_RUN = {
|
|
|
20112
20145
|
st: 0,
|
|
20113
20146
|
ed: 0
|
|
20114
20147
|
};
|
|
20115
|
-
function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph) {
|
|
20148
|
+
function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph, includeCustomRangeStyle = true) {
|
|
20116
20149
|
var _textStyle$eastAsiaFo;
|
|
20117
20150
|
const { gridType = GridType.LINES, charSpace = 0, documentTextStyle = {}, pageSize = {
|
|
20118
20151
|
width: Number.POSITIVE_INFINITY,
|
|
@@ -20126,7 +20159,7 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
20126
20159
|
const customDecoration = viewModel.getCustomDecoration(index + startIndex);
|
|
20127
20160
|
const showCustomDecoration = customDecoration && customDecoration.show !== false;
|
|
20128
20161
|
const customDecorationStyle = showCustomDecoration ? getCustomDecorationStyle(customDecoration) : null;
|
|
20129
|
-
const customRange = viewModel.getCustomRange(index + startIndex);
|
|
20162
|
+
const customRange = includeCustomRangeStyle ? viewModel.getCustomRange(index + startIndex) : null;
|
|
20130
20163
|
const showCustomRange = customRange && customRange.show !== false;
|
|
20131
20164
|
const customRangeStyle = showCustomRange ? getCustomRangeStyle(customRange) : null;
|
|
20132
20165
|
const hasAddonStyle = showCustomRange || showCustomDecoration || !!bullet || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.namedStyleType) || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.textStyle) != null || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.paragraphMarkTextStyle) != null;
|
|
@@ -35743,7 +35776,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
35743
35776
|
//#endregion
|
|
35744
35777
|
//#region package.json
|
|
35745
35778
|
var name = "@univerjs/engine-render";
|
|
35746
|
-
var version = "1.
|
|
35779
|
+
var version = "1.3.0";
|
|
35747
35780
|
|
|
35748
35781
|
//#endregion
|
|
35749
35782
|
//#region src/config/config.ts
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { ITabStop } from '@univerjs/core';
|
|
16
|
+
import type { ITabStop, ITextStyle } from '@univerjs/core';
|
|
17
17
|
import { BooleanNumber, GridType, SpacingRule } from '@univerjs/core';
|
|
18
18
|
import type { IDocumentSkeletonColumn, IDocumentSkeletonDivide, IDocumentSkeletonDrawing, IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, IDocumentSkeletonSection, IDocumentSkeletonTable } from '../../../../../basics/i-document-skeleton-cached';
|
|
19
19
|
import type { IParagraphConfig, IParagraphTableCache, ISectionBreakConfig } from '../../../../../basics/interfaces';
|
|
20
20
|
import type { IFloatObject, ILayoutContext } from '../../tools';
|
|
21
21
|
import { BreakPointType } from '../../line-breaker/break';
|
|
22
22
|
declare function isGlyphGroupBeyondDivideWidth(glyphGroup: IDocumentSkeletonGlyph[], offsetLeft: number, divideWidth: number, hangingPunctuation?: boolean, precedingGlyphs?: IDocumentSkeletonGlyph[], preserveWordSpacing?: boolean, lineWrapTolerance?: number, includeParagraphMark?: boolean, justifyWordSpacing?: boolean): boolean;
|
|
23
|
-
export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType, renderBullet?: boolean, startNewLine?: boolean): IDocumentSkeletonPage[];
|
|
23
|
+
export declare function layoutParagraph(ctx: ILayoutContext, glyphGroup: IDocumentSkeletonGlyph[], pages: IDocumentSkeletonPage[], sectionBreakConfig: ISectionBreakConfig, paragraphConfig: IParagraphConfig, isParagraphFirstShapedText: boolean, breakPointType?: BreakPointType, renderBullet?: boolean, startNewLine?: boolean, markerTextStyle?: Pick<ITextStyle, 'cl' | 'ul'>): IDocumentSkeletonPage[];
|
|
24
24
|
declare function _adjustExplicitTabStop(divide: IDocumentSkeletonDivide, followingGlyphs: IDocumentSkeletonGlyph[], paragraphConfig: IParagraphConfig, tabStops?: ITabStop[] | undefined): void;
|
|
25
25
|
declare function __getWrapTablePosition(table: IDocumentSkeletonTable, column: IDocumentSkeletonColumn, lineTop: number, lineHeight: number, drawingAnchorTop?: number): {
|
|
26
26
|
left: number;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { INumberUnit, ITable, Nullable } from '@univerjs/core';
|
|
17
|
+
import { TableAlignmentType } from '@univerjs/core';
|
|
17
18
|
import type { IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable } from '../../../../basics/i-document-skeleton-cached';
|
|
18
19
|
import type { ISectionBreakConfig } from '../../../../basics/interfaces';
|
|
19
20
|
import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';
|
|
@@ -21,7 +22,6 @@ import type { DocumentViewModel } from '../../view-model/document-view-model';
|
|
|
21
22
|
import type { DocumentFootnoteLayout } from '../footnote-layout';
|
|
22
23
|
import type { ICellSkeletonBuildState } from '../model/page';
|
|
23
24
|
import type { ILayoutContext } from '../tools';
|
|
24
|
-
import { TableAlignmentType } from '@univerjs/core';
|
|
25
25
|
export interface ITableSkeletonBuildState {
|
|
26
26
|
ctx: ILayoutContext;
|
|
27
27
|
curPage: IDocumentSkeletonPage;
|
|
@@ -82,7 +82,7 @@ export declare function stepTableSkeletonsBuild(state: ISlicedTableSkeletonBuild
|
|
|
82
82
|
export declare function cachePrecomputedSlicedTableSkeletons(ctx: ILayoutContext, tableNode: DataStreamTreeNode, availableHeight: number, result: ISlicedTableSkeletonParams): void;
|
|
83
83
|
export declare function createTableSkeletons(ctx: ILayoutContext, curPage: IDocumentSkeletonPage, viewModel: DocumentViewModel, tableNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, availableHeight: number): ISlicedTableSkeletonParams;
|
|
84
84
|
export declare function resolveTableLayoutColumns(table: ITable, availableWidth: number, traditional?: boolean): ITable;
|
|
85
|
-
export declare function getTableLeft(pageWidth: number, tableWidth: number, align: TableAlignmentType, indent?: INumberUnit): number;
|
|
85
|
+
export declare function getTableLeft(pageWidth: number, tableWidth: number, align: TableAlignmentType, indent?: INumberUnit, allowMarginOverflow?: boolean): number;
|
|
86
86
|
export declare function getNullTableSkeleton(st: number, ed: number, table: ITable): IDocumentSkeletonTable;
|
|
87
87
|
export declare function getTableSliceId(tableId: string, sliceIndex: number): string;
|
|
88
88
|
export declare function getTableIdAndSliceIndex(tableSliceId: string): {
|
|
@@ -184,7 +184,7 @@ export declare function getFontConfigFromLastGlyph(glyph: IDocumentSkeletonGlyph
|
|
|
184
184
|
snapToGrid: BooleanNumber;
|
|
185
185
|
pageWidth: number;
|
|
186
186
|
};
|
|
187
|
-
export declare function getFontCreateConfig(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, paragraph: IDocumentLayoutParagraph): IFontCreateConfig;
|
|
187
|
+
export declare function getFontCreateConfig(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, sectionBreakConfig: ISectionBreakConfig, paragraph: IDocumentLayoutParagraph, includeCustomRangeStyle?: boolean): IFontCreateConfig;
|
|
188
188
|
export declare function getCustomRangeGlyphWidth(index: number, viewModel: DocumentViewModel, paragraphNode: DataStreamTreeNode, config: IFontCreateConfig): number | undefined;
|
|
189
189
|
/**
|
|
190
190
|
* Returns whether a custom range should occupy one measured glyph in the
|