@univerjs/engine-render 0.25.1 → 1.0.0-alpha.1
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 +2100 -319
- package/lib/es/index.js +2097 -321
- package/lib/types/basics/document-node-tools.d.ts +1 -0
- package/lib/types/basics/i-document-skeleton-cached.d.ts +26 -1
- package/lib/types/basics/interfaces.d.ts +6 -0
- package/lib/types/basics/transformer-config.d.ts +17 -0
- package/lib/types/components/docs/doc-background.d.ts +4 -0
- package/lib/types/components/docs/document-compatibility.d.ts +43 -0
- package/lib/types/components/docs/document.d.ts +6 -0
- package/lib/types/components/docs/extensions/background-runs.d.ts +22 -0
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +10 -0
- package/lib/types/components/docs/layout/block/column.d.ts +23 -0
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +17 -3
- package/lib/types/components/docs/layout/model/line.d.ts +1 -1
- package/lib/types/components/docs/layout/model/page.d.ts +2 -1
- package/lib/types/components/docs/layout/tools.d.ts +83 -3
- package/lib/types/components/docs/table-render-viewport.d.ts +4 -0
- package/lib/types/components/docs/view-model/document-view-model.d.ts +8 -1
- package/lib/types/components/sheets/extensions/border.d.ts +2 -2
- package/lib/types/components/sheets/interfaces.d.ts +6 -6
- package/lib/types/index.d.ts +7 -5
- package/lib/types/render-manager/render-manager.service.d.ts +1 -0
- package/lib/types/scene.transformer.d.ts +20 -0
- package/lib/types/services/canvas-color.service.d.ts +1 -0
- package/lib/types/shape/image.d.ts +3 -0
- package/lib/umd/index.js +2 -2
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isClassDependencyItem, isNullCell, isWhiteColor, merge,
|
|
1
|
+
import { AlignTypeH, AlignTypeV, BaselineOffset, BooleanNumber, BorderStyleTypes, BulletAlignment, COLORS, CellValueType, ColorKit, ColumnResponsiveType, ColumnSeparatorType, CustomDecorationType, CustomRangeType, DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE, DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW, DEFAULT_EMPTY_DOCUMENT_VALUE, DEFAULT_STYLES, DashStyleType, DataStreamTreeNodeType, DataStreamTreeTokenType, Disposable, DisposableCollection, DocumentBlockRangeType, DocumentDataModel, DocumentFlavor, EventSubject, FontStyleType, GridType, HorizontalAlign, IConfigService, IContextService, IUniverInstanceService, Inject, Injector, ListGlyphType, LocaleService, MODERN_DOCUMENT_DEFAULT_MARGIN, MODERN_DOCUMENT_WIDTH, MOVE_BUFFER_VALUE, ModernDocumentWidthMode, NAMED_STYLE_MAP, NAMED_STYLE_SPACE_MAP, NumberUnitType, ObjectMatrix, ObjectRelativeFromH, ObjectRelativeFromV, PRESET_LIST_TYPE, PageOrientType, Plugin, PositionedObjectLayoutType, Range, Rectangle, Registry, SectionType, SheetSkeleton, Skeleton, SpacingRule, TableAlignmentType, TableRowHeightRule, TableTextWrapType, TextDecoration, ThemeService, Tools, UniverInstanceType, VerticalAlign, VerticalAlignmentType, WrapStrategy, WrapTextType, addLinkToDocumentModel, checkParagraphHasIndentByStyle, createIdentifier, createParagraphId, deleteContent, extractPureTextFromCell, getCellInfoInMergeData, getColorStyle, getDisplayValueFromCell, horizontalLineSegmentsSubtraction, insertTextToContent, invertColorByMatrix, isClassDependencyItem, isNullCell, isWhiteColor, merge, noop, numberToABC, numberToListABC, registerDependencies, remove, requestImmediateMacroTask, searchArray, sortRules, sortRulesByDesc, toDisposable } from "@univerjs/core";
|
|
2
2
|
import * as cjk from "cjk-regex";
|
|
3
3
|
import { BehaviorSubject, Observable, Subject, Subscription, debounceTime, distinctUntilChanged, shareReplay, startWith } from "rxjs";
|
|
4
4
|
import { parse } from "opentype.js";
|
|
@@ -640,7 +640,7 @@ function getSystemHighlightColor() {
|
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
//#endregion
|
|
643
|
-
//#region \0@oxc-project+runtime@0.
|
|
643
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
|
|
644
644
|
function _typeof(o) {
|
|
645
645
|
"@babel/helpers - typeof";
|
|
646
646
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -651,7 +651,7 @@ function _typeof(o) {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
//#endregion
|
|
654
|
-
//#region \0@oxc-project+runtime@0.
|
|
654
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
|
|
655
655
|
function toPrimitive(t, r) {
|
|
656
656
|
if ("object" != _typeof(t) || !t) return t;
|
|
657
657
|
var e = t[Symbol.toPrimitive];
|
|
@@ -664,14 +664,14 @@ function toPrimitive(t, r) {
|
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
//#endregion
|
|
667
|
-
//#region \0@oxc-project+runtime@0.
|
|
667
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
|
|
668
668
|
function toPropertyKey(t) {
|
|
669
669
|
var i = toPrimitive(t, "string");
|
|
670
670
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
//#endregion
|
|
674
|
-
//#region \0@oxc-project+runtime@0.
|
|
674
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
|
|
675
675
|
function _defineProperty(e, r, t) {
|
|
676
676
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
677
677
|
value: t,
|
|
@@ -2288,8 +2288,8 @@ var Path2 = class {
|
|
|
2288
2288
|
const from = this._lines[o - 1];
|
|
2289
2289
|
const to = this._lines[o];
|
|
2290
2290
|
for (let n = 1; n < lines.length; n++) {
|
|
2291
|
-
const contrastFrom =
|
|
2292
|
-
const contrastTo =
|
|
2291
|
+
const contrastFrom = lines[n - 1];
|
|
2292
|
+
const contrastTo = lines[n];
|
|
2293
2293
|
const point = this._intersection({
|
|
2294
2294
|
from,
|
|
2295
2295
|
to
|
|
@@ -3435,11 +3435,12 @@ var BaseObject = class extends Disposable {
|
|
|
3435
3435
|
if (this.isInGroup && ((_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.classType) === "Group" && ((_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.getBaseBound)) baseBound = this.parent.getBaseBound();
|
|
3436
3436
|
if (baseBound) {
|
|
3437
3437
|
const parentState = this.getParent();
|
|
3438
|
+
const parentRealBound = typeof parentState.getRealBound === "function" ? parentState.getRealBound() : parentState;
|
|
3438
3439
|
const parentBound = {
|
|
3439
|
-
top:
|
|
3440
|
-
left:
|
|
3441
|
-
width:
|
|
3442
|
-
height:
|
|
3440
|
+
top: parentRealBound.top || 0,
|
|
3441
|
+
left: parentRealBound.left,
|
|
3442
|
+
width: parentRealBound.width || 0,
|
|
3443
|
+
height: parentRealBound.height || 0
|
|
3443
3444
|
};
|
|
3444
3445
|
const realBound = getRenderTransformBaseOnParentBound(baseBound, parentBound, {
|
|
3445
3446
|
width: realWidth,
|
|
@@ -10853,8 +10854,8 @@ const TINF_OK = 0;
|
|
|
10853
10854
|
const TINF_DATA_ERROR = -3;
|
|
10854
10855
|
var Tree = class {
|
|
10855
10856
|
constructor() {
|
|
10856
|
-
_defineProperty(this, "table", new Uint16Array(16));
|
|
10857
|
-
_defineProperty(this, "trans", new Uint16Array(288));
|
|
10857
|
+
_defineProperty(this, "table", /* @__PURE__ */ new Uint16Array(16));
|
|
10858
|
+
_defineProperty(this, "trans", /* @__PURE__ */ new Uint16Array(288));
|
|
10858
10859
|
}
|
|
10859
10860
|
};
|
|
10860
10861
|
var Data = class {
|
|
@@ -10879,10 +10880,10 @@ var Data = class {
|
|
|
10879
10880
|
};
|
|
10880
10881
|
const sltree = new Tree();
|
|
10881
10882
|
const sdtree = new Tree();
|
|
10882
|
-
const length_bits = new Uint8Array(30);
|
|
10883
|
-
const length_base = new Uint16Array(30);
|
|
10884
|
-
const dist_bits = new Uint8Array(30);
|
|
10885
|
-
const dist_base = new Uint16Array(30);
|
|
10883
|
+
const length_bits = /* @__PURE__ */ new Uint8Array(30);
|
|
10884
|
+
const length_base = /* @__PURE__ */ new Uint16Array(30);
|
|
10885
|
+
const dist_bits = /* @__PURE__ */ new Uint8Array(30);
|
|
10886
|
+
const dist_base = /* @__PURE__ */ new Uint16Array(30);
|
|
10886
10887
|
const clcidx = new Uint8Array([
|
|
10887
10888
|
16,
|
|
10888
10889
|
17,
|
|
@@ -10905,7 +10906,7 @@ const clcidx = new Uint8Array([
|
|
|
10905
10906
|
15
|
|
10906
10907
|
]);
|
|
10907
10908
|
const code_tree = new Tree();
|
|
10908
|
-
const lengths = new Uint8Array(320);
|
|
10909
|
+
const lengths = /* @__PURE__ */ new Uint8Array(320);
|
|
10909
10910
|
function tinf_build_bits_base(bits, base, delta, first) {
|
|
10910
10911
|
let i;
|
|
10911
10912
|
let sum;
|
|
@@ -10930,7 +10931,7 @@ function tinf_build_fixed_trees(lt, dt) {
|
|
|
10930
10931
|
dt.table[5] = 32;
|
|
10931
10932
|
for (i = 0; i < 32; ++i) dt.trans[i] = i;
|
|
10932
10933
|
}
|
|
10933
|
-
const offs = new Uint16Array(16);
|
|
10934
|
+
const offs = /* @__PURE__ */ new Uint16Array(16);
|
|
10934
10935
|
function tinf_build_tree(t, lengths, off, num) {
|
|
10935
10936
|
let i;
|
|
10936
10937
|
let sum;
|
|
@@ -11969,6 +11970,68 @@ var Text = class Text extends Shape {
|
|
|
11969
11970
|
}
|
|
11970
11971
|
};
|
|
11971
11972
|
|
|
11973
|
+
//#endregion
|
|
11974
|
+
//#region src/components/docs/document-compatibility.ts
|
|
11975
|
+
const MODERN_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
11976
|
+
mode: "modern",
|
|
11977
|
+
applyDocumentDefaultParagraphStyle: true,
|
|
11978
|
+
useWordStyleLineHeight: true,
|
|
11979
|
+
font: { metricScaleRules: [] },
|
|
11980
|
+
table: {
|
|
11981
|
+
currentPageOverflowTolerance: 0,
|
|
11982
|
+
rowOverflowTolerance: 0,
|
|
11983
|
+
allowImportedTableMarginOverflow: false
|
|
11984
|
+
}
|
|
11985
|
+
};
|
|
11986
|
+
const TRADITIONAL_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
11987
|
+
mode: "traditional",
|
|
11988
|
+
applyDocumentDefaultParagraphStyle: false,
|
|
11989
|
+
useWordStyleLineHeight: true,
|
|
11990
|
+
font: { metricScaleRules: [{
|
|
11991
|
+
fontFamily: /^calibri$/i,
|
|
11992
|
+
minFontSize: 20,
|
|
11993
|
+
fontString: /\bbold\b/i,
|
|
11994
|
+
content: /^[\d/]+$/u,
|
|
11995
|
+
widthScale: .92
|
|
11996
|
+
}] },
|
|
11997
|
+
table: {
|
|
11998
|
+
currentPageOverflowTolerance: 12,
|
|
11999
|
+
rowOverflowTolerance: 4,
|
|
12000
|
+
allowImportedTableMarginOverflow: true
|
|
12001
|
+
}
|
|
12002
|
+
};
|
|
12003
|
+
const UNSPECIFIED_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12004
|
+
mode: "unspecified",
|
|
12005
|
+
applyDocumentDefaultParagraphStyle: false,
|
|
12006
|
+
useWordStyleLineHeight: false,
|
|
12007
|
+
font: { metricScaleRules: [] },
|
|
12008
|
+
table: {
|
|
12009
|
+
currentPageOverflowTolerance: 0,
|
|
12010
|
+
rowOverflowTolerance: 0,
|
|
12011
|
+
allowImportedTableMarginOverflow: false
|
|
12012
|
+
}
|
|
12013
|
+
};
|
|
12014
|
+
function getDocumentCompatibilityPolicy(documentFlavor) {
|
|
12015
|
+
if (documentFlavor === DocumentFlavor.MODERN) return MODERN_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12016
|
+
if (documentFlavor === DocumentFlavor.TRADITIONAL) return TRADITIONAL_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12017
|
+
return UNSPECIFIED_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12018
|
+
}
|
|
12019
|
+
function applyFontMetricCompatibility(content, fontStyle, bBox, policy) {
|
|
12020
|
+
const fontFamilies = fontStyle.fontFamily.split(",").map((item) => item.trim().replace(/^['"]|['"]$/g, ""));
|
|
12021
|
+
const rule = policy.font.metricScaleRules.find((rule) => (rule.minFontSize == null || fontStyle.originFontSize >= rule.minFontSize) && (rule.fontString == null || rule.fontString.test(fontStyle.fontString)) && (rule.content == null || rule.content.test(content)) && fontFamilies.some((family) => rule.fontFamily.test(family)));
|
|
12022
|
+
if ((rule === null || rule === void 0 ? void 0 : rule.widthScale) == null) return bBox;
|
|
12023
|
+
return {
|
|
12024
|
+
...bBox,
|
|
12025
|
+
width: bBox.width * rule.widthScale
|
|
12026
|
+
};
|
|
12027
|
+
}
|
|
12028
|
+
function isTraditionalDocumentCompatibility(policy) {
|
|
12029
|
+
return policy.mode === "traditional";
|
|
12030
|
+
}
|
|
12031
|
+
function shouldAllowImportedTableMarginOverflow(policy, tableSource) {
|
|
12032
|
+
return policy.table.allowImportedTableMarginOverflow && tableSource != null && typeof tableSource === "object" && "docxWidth" in tableSource;
|
|
12033
|
+
}
|
|
12034
|
+
|
|
11972
12035
|
//#endregion
|
|
11973
12036
|
//#region src/components/docs/liquid.ts
|
|
11974
12037
|
var Liquid = class {
|
|
@@ -12086,6 +12149,13 @@ function getDocsTableRenderViewport(unitId, tableId) {
|
|
|
12086
12149
|
var _docsTableRenderViewp;
|
|
12087
12150
|
return (_docsTableRenderViewp = docsTableRenderViewportProvider === null || docsTableRenderViewportProvider === void 0 ? void 0 : docsTableRenderViewportProvider(unitId, tableId)) !== null && _docsTableRenderViewp !== void 0 ? _docsTableRenderViewp : null;
|
|
12088
12151
|
}
|
|
12152
|
+
function getDocsTableVirtualContentWidth(viewport) {
|
|
12153
|
+
var _viewport$leadingInse, _viewport$trailingIns;
|
|
12154
|
+
return ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0) + viewport.contentWidth + ((_viewport$trailingIns = viewport.trailingInsetRight) !== null && _viewport$trailingIns !== void 0 ? _viewport$trailingIns : 0);
|
|
12155
|
+
}
|
|
12156
|
+
function hasDocsTableHorizontalViewport(viewport) {
|
|
12157
|
+
return viewport != null && getDocsTableVirtualContentWidth(viewport) > viewport.viewportWidth;
|
|
12158
|
+
}
|
|
12089
12159
|
|
|
12090
12160
|
//#endregion
|
|
12091
12161
|
//#region src/components/docs/view-model/data-stream-tree-node.ts
|
|
@@ -12254,8 +12324,16 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12254
12324
|
const tableList = [];
|
|
12255
12325
|
const tableRowList = [];
|
|
12256
12326
|
const tableCellList = [];
|
|
12327
|
+
const columnGroupList = [];
|
|
12328
|
+
const columnList = [];
|
|
12329
|
+
const columnParagraphList = [];
|
|
12330
|
+
const columnSectionList = [];
|
|
12257
12331
|
const currentBlocks = [];
|
|
12258
|
-
const getParagraphList = () =>
|
|
12332
|
+
const getParagraphList = () => {
|
|
12333
|
+
if (tableCellList.length > 0) return cellParagraphList;
|
|
12334
|
+
if (columnGroupList.length > 0) return columnParagraphList;
|
|
12335
|
+
return paragraphList;
|
|
12336
|
+
};
|
|
12259
12337
|
const appendToPreviousParagraph = (char) => {
|
|
12260
12338
|
const tempParagraphList = getParagraphList();
|
|
12261
12339
|
const lastParagraph = tempParagraphList[tempParagraphList.length - 1];
|
|
@@ -12285,10 +12363,11 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12285
12363
|
currentBlocks.length = 0;
|
|
12286
12364
|
content = "";
|
|
12287
12365
|
if (tableCellList.length > 0) cellParagraphList.push(paragraphNode);
|
|
12366
|
+
else if (columnGroupList.length > 0) columnParagraphList.push(paragraphNode);
|
|
12288
12367
|
else paragraphList.push(paragraphNode);
|
|
12289
12368
|
} else if (char === DataStreamTreeTokenType.SECTION_BREAK) {
|
|
12290
12369
|
const sectionNode = DataStreamTreeNode.create(DataStreamTreeNodeType.SECTION_BREAK);
|
|
12291
|
-
const tempParagraphList = tableCellList.length > 0 ? cellParagraphList : paragraphList;
|
|
12370
|
+
const tempParagraphList = tableCellList.length > 0 ? cellParagraphList : columnGroupList.length > 0 ? columnParagraphList : paragraphList;
|
|
12292
12371
|
if (tempParagraphList.length === 0) {
|
|
12293
12372
|
const emptyParagraph = DataStreamTreeNode.create(DataStreamTreeNodeType.PARAGRAPH, "");
|
|
12294
12373
|
emptyParagraph.setIndexRange(i, i - 1);
|
|
@@ -12300,7 +12379,8 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12300
12379
|
if (tableCellList.length > 0) {
|
|
12301
12380
|
const lastCell = tableCellList[tableCellList.length - 1];
|
|
12302
12381
|
batchParent(lastCell, [sectionNode], DataStreamTreeNodeType.TABLE_CELL);
|
|
12303
|
-
} else
|
|
12382
|
+
} else if (columnGroupList.length > 0) columnSectionList.push(sectionNode);
|
|
12383
|
+
else sectionList.push(sectionNode);
|
|
12304
12384
|
tempParagraphList.length = 0;
|
|
12305
12385
|
} else if (char === DataStreamTreeTokenType.TABLE_START) {
|
|
12306
12386
|
const tableNode = DataStreamTreeNode.create(DataStreamTreeNodeType.TABLE);
|
|
@@ -12326,6 +12406,32 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12326
12406
|
const cellNode = tableCellList.pop();
|
|
12327
12407
|
const lastRow = tableRowList[tableRowList.length - 1];
|
|
12328
12408
|
batchParent(lastRow, [cellNode], DataStreamTreeNodeType.TABLE_ROW);
|
|
12409
|
+
} else if (char === DataStreamTreeTokenType.COLUMN_GROUP_START) {
|
|
12410
|
+
const columnGroupNode = DataStreamTreeNode.create(DataStreamTreeNodeType.COLUMN_GROUP);
|
|
12411
|
+
columnGroupNode.setIndexRange(i, i);
|
|
12412
|
+
columnGroupList.push(columnGroupNode);
|
|
12413
|
+
} else if (char === DataStreamTreeTokenType.COLUMN_START) {
|
|
12414
|
+
const columnNode = DataStreamTreeNode.create(DataStreamTreeNodeType.COLUMN);
|
|
12415
|
+
columnNode.setIndexRange(i, i);
|
|
12416
|
+
columnList.push(columnNode);
|
|
12417
|
+
} else if (char === DataStreamTreeTokenType.COLUMN_END) {
|
|
12418
|
+
const columnNode = columnList[columnList.length - 1];
|
|
12419
|
+
const columnChildren = columnSectionList.length > 0 ? columnSectionList : columnParagraphList;
|
|
12420
|
+
const columnStartIndex = columnNode.startIndex;
|
|
12421
|
+
batchParent(columnNode, columnChildren, DataStreamTreeNodeType.COLUMN);
|
|
12422
|
+
columnNode.setIndexRange(columnStartIndex, i);
|
|
12423
|
+
columnParagraphList.length = 0;
|
|
12424
|
+
columnSectionList.length = 0;
|
|
12425
|
+
} else if (char === DataStreamTreeTokenType.COLUMN_GROUP_END) {
|
|
12426
|
+
const columnGroupNode = columnGroupList.pop();
|
|
12427
|
+
const columnGroupStartIndex = columnGroupNode.startIndex;
|
|
12428
|
+
batchParent(columnGroupNode, columnList, DataStreamTreeNodeType.COLUMN_GROUP);
|
|
12429
|
+
columnGroupNode.setIndexRange(columnGroupStartIndex, i);
|
|
12430
|
+
paragraphList.push(columnGroupNode);
|
|
12431
|
+
columnList.length = 0;
|
|
12432
|
+
columnParagraphList.length = 0;
|
|
12433
|
+
columnSectionList.length = 0;
|
|
12434
|
+
content = "";
|
|
12329
12435
|
} else if (char === DataStreamTreeTokenType.BLOCK_START) content += char;
|
|
12330
12436
|
else if (char === DataStreamTreeTokenType.BLOCK_END) {
|
|
12331
12437
|
if (content.length > 0 || !appendToPreviousParagraph(char)) content += char;
|
|
@@ -12349,6 +12455,7 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12349
12455
|
_defineProperty(this, "_sectionBreakCache", /* @__PURE__ */ new Map());
|
|
12350
12456
|
_defineProperty(this, "_customBlockCache", /* @__PURE__ */ new Map());
|
|
12351
12457
|
_defineProperty(this, "_tableCache", /* @__PURE__ */ new Map());
|
|
12458
|
+
_defineProperty(this, "_columnGroupCache", /* @__PURE__ */ new Map());
|
|
12352
12459
|
_defineProperty(this, "_tableNodeCache", /* @__PURE__ */ new Map());
|
|
12353
12460
|
_defineProperty(this, "_children", []);
|
|
12354
12461
|
_defineProperty(this, "_editArea", "BODY");
|
|
@@ -12379,6 +12486,7 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12379
12486
|
this._sectionBreakCache.clear();
|
|
12380
12487
|
this._customBlockCache.clear();
|
|
12381
12488
|
this._tableCache.clear();
|
|
12489
|
+
this._columnGroupCache.clear();
|
|
12382
12490
|
this._tableNodeCache.clear();
|
|
12383
12491
|
this._segmentViewModels$.complete();
|
|
12384
12492
|
this._editAreaChange$.complete();
|
|
@@ -12450,6 +12558,9 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12450
12558
|
getTableByStartIndex(index) {
|
|
12451
12559
|
return this._tableCache.get(index);
|
|
12452
12560
|
}
|
|
12561
|
+
getColumnGroupByStartIndex(index) {
|
|
12562
|
+
return this._columnGroupCache.get(index);
|
|
12563
|
+
}
|
|
12453
12564
|
findTableNodeById(id) {
|
|
12454
12565
|
var _this$_tableNodeCache;
|
|
12455
12566
|
return (_this$_tableNodeCache = this._tableNodeCache.get(id)) === null || _this$_tableNodeCache === void 0 ? void 0 : _this$_tableNodeCache.table;
|
|
@@ -12484,6 +12595,7 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12484
12595
|
this._buildSectionBreakCache();
|
|
12485
12596
|
this._buildCustomBlockCache();
|
|
12486
12597
|
this._buildTableCache();
|
|
12598
|
+
this._buildColumnGroupCache();
|
|
12487
12599
|
}
|
|
12488
12600
|
_buildParagraphCache() {
|
|
12489
12601
|
var _this$getBody$paragra, _this$getBody;
|
|
@@ -12528,9 +12640,23 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12528
12640
|
});
|
|
12529
12641
|
}
|
|
12530
12642
|
}
|
|
12643
|
+
_buildColumnGroupCache() {
|
|
12644
|
+
var _this$getBody5;
|
|
12645
|
+
this._columnGroupCache.clear();
|
|
12646
|
+
const columnGroups = (_this$getBody5 = this.getBody()) === null || _this$getBody5 === void 0 ? void 0 : _this$getBody5.columnGroups;
|
|
12647
|
+
if (columnGroups == null) return;
|
|
12648
|
+
for (const columnGroup of columnGroups) {
|
|
12649
|
+
const { startIndex } = columnGroup;
|
|
12650
|
+
if (!columnGroup.columns) continue;
|
|
12651
|
+
this._columnGroupCache.set(startIndex, {
|
|
12652
|
+
columnGroup,
|
|
12653
|
+
columnGroupSource: columnGroup
|
|
12654
|
+
});
|
|
12655
|
+
}
|
|
12656
|
+
}
|
|
12531
12657
|
_buildTextRunsCache() {
|
|
12532
|
-
var _this$getBody$textRun, _this$
|
|
12533
|
-
const textRuns = (_this$getBody$textRun = (_this$
|
|
12658
|
+
var _this$getBody$textRun, _this$getBody6;
|
|
12659
|
+
const textRuns = (_this$getBody$textRun = (_this$getBody6 = this.getBody()) === null || _this$getBody6 === void 0 ? void 0 : _this$getBody6.textRuns) !== null && _this$getBody$textRun !== void 0 ? _this$getBody$textRun : [];
|
|
12534
12660
|
this._textRunsCache.clear();
|
|
12535
12661
|
for (const textRun of textRuns) {
|
|
12536
12662
|
const { st, ed } = textRun;
|
|
@@ -12636,6 +12762,7 @@ function createSkeletonCustomBlockGlyph(config, glyphWidth = 0, glyphHeight = 0,
|
|
|
12636
12762
|
};
|
|
12637
12763
|
}
|
|
12638
12764
|
function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, glyphInfo) {
|
|
12765
|
+
var _config$documentCompa;
|
|
12639
12766
|
const { fontStyle, textStyle, charSpace = 1, gridType = GridType.LINES, snapToGrid = BooleanNumber.FALSE } = config;
|
|
12640
12767
|
const skipWidthList = [
|
|
12641
12768
|
DataStreamTreeTokenType.SECTION_BREAK,
|
|
@@ -12645,6 +12772,10 @@ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, gly
|
|
|
12645
12772
|
DataStreamTreeTokenType.TABLE_ROW_END,
|
|
12646
12773
|
DataStreamTreeTokenType.TABLE_CELL_START,
|
|
12647
12774
|
DataStreamTreeTokenType.TABLE_CELL_END,
|
|
12775
|
+
DataStreamTreeTokenType.COLUMN_GROUP_START,
|
|
12776
|
+
DataStreamTreeTokenType.COLUMN_START,
|
|
12777
|
+
DataStreamTreeTokenType.COLUMN_END,
|
|
12778
|
+
DataStreamTreeTokenType.COLUMN_GROUP_END,
|
|
12648
12779
|
DataStreamTreeTokenType.BLOCK_START,
|
|
12649
12780
|
DataStreamTreeTokenType.BLOCK_END,
|
|
12650
12781
|
DataStreamTreeTokenType.CUSTOM_RANGE_START,
|
|
@@ -12686,6 +12817,7 @@ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, gly
|
|
|
12686
12817
|
let xOffset = 0;
|
|
12687
12818
|
if (glyphInfo && glyphInfo.boundingBox && glyphInfo.font) bBox = FontCache.getBBoxFromGlyphInfo(glyphInfo, fontStyle);
|
|
12688
12819
|
else bBox = FontCache.getTextSize(content, fontStyle);
|
|
12820
|
+
bBox = applyFontMetricCompatibility(content, fontStyle, bBox, (_config$documentCompa = config.documentCompatibilityPolicy) !== null && _config$documentCompa !== void 0 ? _config$documentCompa : getDocumentCompatibilityPolicy());
|
|
12689
12821
|
const { width: contentWidth = 0 } = bBox;
|
|
12690
12822
|
let width = glyphWidth !== null && glyphWidth !== void 0 ? glyphWidth : contentWidth;
|
|
12691
12823
|
if (validationGrid(gridType, snapToGrid)) {
|
|
@@ -12806,11 +12938,13 @@ function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWid
|
|
|
12806
12938
|
lineSke.isBehindTable = true;
|
|
12807
12939
|
lineSke.tableId = tableId;
|
|
12808
12940
|
}
|
|
12809
|
-
|
|
12941
|
+
const affectSkeDrawings = new Map(Array.from(pageSkeDrawings).filter(([_, drawing]) => drawing.drawingOrigin.layoutType !== PositionedObjectLayoutType.INLINE && drawing.drawingOrigin.layoutType !== PositionedObjectLayoutType.WRAP_NONE));
|
|
12942
|
+
const wrapTypeTables = new Map(Array.from(pageSkeTables).filter(([_, table]) => table.tableSource.textWrap === TableTextWrapType.WRAP));
|
|
12943
|
+
lineSke.divides = lineHeight <= .01 ? [__getDivideSKe(0, columnWidth)] : _calculateDividesByDrawings(lineHeight, lineTop, columnWidth, paddingLeft, paddingRight, page, headerPage, footerPage, affectSkeDrawings, headersDrawings, footersDrawings, wrapTypeTables);
|
|
12810
12944
|
for (const divide of lineSke.divides) divide.parent = lineSke;
|
|
12811
12945
|
return lineSke;
|
|
12812
12946
|
}
|
|
12813
|
-
function calculateLineTopByDrawings(lineHeight = 15.6, lineTop = 0, page, headerPage, footerPage) {
|
|
12947
|
+
function calculateLineTopByDrawings(lineHeight = 15.6, lineTop = 0, page, headerPage, footerPage, columnLeft = 0, columnWidth = 0) {
|
|
12814
12948
|
let maxTop = lineTop;
|
|
12815
12949
|
const pageSkeDrawings = page.skeDrawings;
|
|
12816
12950
|
const skeNonWrapTables = new Map(Array.from(page.skeTables).filter(([_, table]) => table.tableSource.textWrap === TableTextWrapType.NONE));
|
|
@@ -12827,6 +12961,8 @@ function calculateLineTopByDrawings(lineHeight = 15.6, lineTop = 0, page, header
|
|
|
12827
12961
|
pageSkeDrawings === null || pageSkeDrawings === void 0 || pageSkeDrawings.forEach((drawing) => {
|
|
12828
12962
|
const top = _getLineTopWidthWrapTopBottom(drawing, lineHeight, lineTop);
|
|
12829
12963
|
if (top) maxTop = Math.max(maxTop, top);
|
|
12964
|
+
const blockingWrapTop = _getLineTopWithFullColumnWrap(drawing, lineHeight, lineTop, columnLeft, columnWidth);
|
|
12965
|
+
if (blockingWrapTop) maxTop = Math.max(maxTop, blockingWrapTop);
|
|
12830
12966
|
});
|
|
12831
12967
|
skeNonWrapTables === null || skeNonWrapTables === void 0 || skeNonWrapTables.forEach((table) => {
|
|
12832
12968
|
const top = _getLineTopWidthWrapNone(table, lineHeight, lineTop);
|
|
@@ -12834,6 +12970,37 @@ function calculateLineTopByDrawings(lineHeight = 15.6, lineTop = 0, page, header
|
|
|
12834
12970
|
});
|
|
12835
12971
|
return maxTop;
|
|
12836
12972
|
}
|
|
12973
|
+
function _getLineTopWithFullColumnWrap(drawing, lineHeight, lineTop, columnLeft, columnWidth) {
|
|
12974
|
+
if (columnWidth <= 0) return;
|
|
12975
|
+
const { aTop, height, aLeft, width, angle = 0, drawingOrigin } = drawing;
|
|
12976
|
+
const { layoutType, distL = 0, distT = 0, distB = 0, distR = 0, wrapText } = drawingOrigin;
|
|
12977
|
+
if (layoutType === PositionedObjectLayoutType.INLINE || layoutType === PositionedObjectLayoutType.WRAP_NONE || layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) return;
|
|
12978
|
+
let top = aTop;
|
|
12979
|
+
let drawingHeight = height;
|
|
12980
|
+
let left = aLeft - columnLeft;
|
|
12981
|
+
let drawingWidth = width;
|
|
12982
|
+
if (angle !== 0) {
|
|
12983
|
+
var _boundingBox$top, _boundingBox$height, _boundingBox$left, _boundingBox$width;
|
|
12984
|
+
const boundingBox = getBoundingBox(angle, left, width, top, height);
|
|
12985
|
+
top = (_boundingBox$top = boundingBox.top) !== null && _boundingBox$top !== void 0 ? _boundingBox$top : top;
|
|
12986
|
+
drawingHeight = (_boundingBox$height = boundingBox.height) !== null && _boundingBox$height !== void 0 ? _boundingBox$height : drawingHeight;
|
|
12987
|
+
left = (_boundingBox$left = boundingBox.left) !== null && _boundingBox$left !== void 0 ? _boundingBox$left : left;
|
|
12988
|
+
drawingWidth = (_boundingBox$width = boundingBox.width) !== null && _boundingBox$width !== void 0 ? _boundingBox$width : drawingWidth;
|
|
12989
|
+
}
|
|
12990
|
+
const newTop = top - (layoutType === PositionedObjectLayoutType.WRAP_SQUARE ? distT : 0);
|
|
12991
|
+
const newHeight = drawingHeight + (layoutType === PositionedObjectLayoutType.WRAP_SQUARE ? distB + distT : 0);
|
|
12992
|
+
const bottom = newTop + newHeight;
|
|
12993
|
+
if (bottom <= lineTop) return;
|
|
12994
|
+
const split = __getSplitWidthNoAngle(top, drawingHeight, left, drawingWidth, newTop, Math.max(1, newHeight), columnWidth, {
|
|
12995
|
+
distL,
|
|
12996
|
+
distT,
|
|
12997
|
+
distB,
|
|
12998
|
+
distR
|
|
12999
|
+
}, layoutType, wrapText);
|
|
13000
|
+
if (!split) return;
|
|
13001
|
+
if (split.left > 0 || split.left + split.width < columnWidth) return;
|
|
13002
|
+
return bottom;
|
|
13003
|
+
}
|
|
12837
13004
|
function _getLineTopWidthWrapNone(table, lineHeight, lineTop) {
|
|
12838
13005
|
const { top, height } = table;
|
|
12839
13006
|
if (top + height < lineTop || top > lineHeight + lineTop) return;
|
|
@@ -13012,6 +13179,8 @@ function ___getWrapTextRuler(wrapText, resultLeft, resultWidth, columnWidth) {
|
|
|
13012
13179
|
return ruler;
|
|
13013
13180
|
}
|
|
13014
13181
|
function _calculateDivideByDrawings(columnWidth, drawingSplit) {
|
|
13182
|
+
if (!Number.isFinite(columnWidth) || columnWidth <= 0) return [__getDivideSKe(0, Math.max(1, columnWidth || 1))];
|
|
13183
|
+
drawingSplit = drawingSplit.filter(({ left, width }) => Number.isFinite(left) && Number.isFinite(width) && width > 0 && left < columnWidth && left + width > 0);
|
|
13015
13184
|
drawingSplit.sort((pre, next) => {
|
|
13016
13185
|
if (pre.left > next.left) return 1;
|
|
13017
13186
|
return -1;
|
|
@@ -13033,6 +13202,7 @@ function _calculateDivideByDrawings(columnWidth, drawingSplit) {
|
|
|
13033
13202
|
divideSkeleton.push(divide);
|
|
13034
13203
|
}
|
|
13035
13204
|
}
|
|
13205
|
+
if (divideSkeleton.length === 0 && columnWidth > 0) return [__getDivideSKe(0, columnWidth)];
|
|
13036
13206
|
return divideSkeleton;
|
|
13037
13207
|
}
|
|
13038
13208
|
function __getDivideSKe(left, width) {
|
|
@@ -13089,17 +13259,11 @@ function createSkeletonSection(columnProperties = [], columnSeparatorType = Colu
|
|
|
13089
13259
|
let colWidth = 0;
|
|
13090
13260
|
let spaceWidth = 0;
|
|
13091
13261
|
if (columnProperties.length === 0) columns.push(_getSkeletonColumn(left, sectionWidth, 0, ColumnSeparatorType.NONE));
|
|
13092
|
-
else for (
|
|
13093
|
-
const { width, paddingEnd } = columnProperties[i];
|
|
13262
|
+
else for (const { width, paddingEnd } of _fitColumnProperties(columnProperties, sectionWidth)) {
|
|
13094
13263
|
spaceWidth = paddingEnd;
|
|
13095
13264
|
colWidth = width;
|
|
13096
13265
|
columns.push(_getSkeletonColumn(left, colWidth, spaceWidth, columnSeparatorType));
|
|
13097
13266
|
left += colWidth + spaceWidth;
|
|
13098
|
-
if (i === columnProperties.length - 1) {
|
|
13099
|
-
colWidth = sectionWidth !== Number.POSITIVE_INFINITY ? sectionWidth - colWidth : width;
|
|
13100
|
-
spaceWidth = 0;
|
|
13101
|
-
columns.push(_getSkeletonColumn(left, colWidth, spaceWidth, columnSeparatorType));
|
|
13102
|
-
}
|
|
13103
13267
|
}
|
|
13104
13268
|
const newSection = {
|
|
13105
13269
|
columns,
|
|
@@ -13114,6 +13278,42 @@ function createSkeletonSection(columnProperties = [], columnSeparatorType = Colu
|
|
|
13114
13278
|
});
|
|
13115
13279
|
return newSection;
|
|
13116
13280
|
}
|
|
13281
|
+
function _fitColumnProperties(columnProperties, sectionWidth) {
|
|
13282
|
+
if (sectionWidth === Number.POSITIVE_INFINITY || columnProperties.length === 0) return columnProperties;
|
|
13283
|
+
const safeSectionWidth = Math.max(0, sectionWidth);
|
|
13284
|
+
const widths = columnProperties.map(({ width }) => Math.max(0, width));
|
|
13285
|
+
const spaces = columnProperties.map(({ paddingEnd }, index) => index === columnProperties.length - 1 ? 0 : Math.max(0, paddingEnd));
|
|
13286
|
+
const totalWidth = widths.reduce((sum, width) => sum + width, 0);
|
|
13287
|
+
if (safeSectionWidth === 0) return columnProperties.map((columnProperty) => ({
|
|
13288
|
+
...columnProperty,
|
|
13289
|
+
width: 0,
|
|
13290
|
+
paddingEnd: 0
|
|
13291
|
+
}));
|
|
13292
|
+
if (totalWidth <= 0) {
|
|
13293
|
+
const equalWidth = safeSectionWidth / columnProperties.length;
|
|
13294
|
+
return columnProperties.map((columnProperty, index) => ({
|
|
13295
|
+
...columnProperty,
|
|
13296
|
+
width: equalWidth,
|
|
13297
|
+
paddingEnd: 0
|
|
13298
|
+
}));
|
|
13299
|
+
}
|
|
13300
|
+
if (totalWidth > safeSectionWidth) {
|
|
13301
|
+
const scale = safeSectionWidth / totalWidth;
|
|
13302
|
+
return columnProperties.map((columnProperty, index) => ({
|
|
13303
|
+
...columnProperty,
|
|
13304
|
+
width: widths[index] * scale,
|
|
13305
|
+
paddingEnd: 0
|
|
13306
|
+
}));
|
|
13307
|
+
}
|
|
13308
|
+
const spaceBudget = safeSectionWidth - totalWidth;
|
|
13309
|
+
const totalSpace = spaces.reduce((sum, space) => sum + space, 0);
|
|
13310
|
+
const fittedSpaces = totalSpace > spaceBudget && totalSpace > 0 ? spaces.map((space) => space / totalSpace * spaceBudget) : spaces;
|
|
13311
|
+
return columnProperties.map((columnProperty, index) => ({
|
|
13312
|
+
...columnProperty,
|
|
13313
|
+
width: widths[index],
|
|
13314
|
+
paddingEnd: fittedSpaces[index]
|
|
13315
|
+
}));
|
|
13316
|
+
}
|
|
13117
13317
|
function setColumnFullState(column, state) {
|
|
13118
13318
|
column.isFull = state;
|
|
13119
13319
|
}
|
|
@@ -13214,12 +13414,13 @@ function createTableSkeleton(ctx, curPage, viewModel, tableNode, sectionBreakCon
|
|
|
13214
13414
|
function rollbackListCache(listLevel, table) {
|
|
13215
13415
|
const { startIndex, endIndex } = table;
|
|
13216
13416
|
for (const paragraphLists of listLevel.values()) for (const paragraphList of paragraphLists) {
|
|
13417
|
+
if (paragraphList == null) continue;
|
|
13217
13418
|
const paragraphListIndex = paragraphList.findIndex((p) => p.paragraph.startIndex > startIndex && p.paragraph.startIndex < endIndex);
|
|
13218
13419
|
if (paragraphListIndex > -1) paragraphList.splice(paragraphListIndex);
|
|
13219
13420
|
}
|
|
13220
13421
|
}
|
|
13221
13422
|
function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakConfig, availableHeight) {
|
|
13222
|
-
var _viewModel$getTableBy2;
|
|
13423
|
+
var _viewModel$getTableBy2, _sectionBreakConfig$d;
|
|
13223
13424
|
const skeTables = [];
|
|
13224
13425
|
const { startIndex, endIndex, children: rowNodes } = tableNode;
|
|
13225
13426
|
const table = (_viewModel$getTableBy2 = viewModel.getTableByStartIndex(startIndex)) === null || _viewModel$getTableBy2 === void 0 ? void 0 : _viewModel$getTableBy2.tableSource;
|
|
@@ -13242,9 +13443,10 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
|
|
|
13242
13443
|
skeTables.push(curTableSkeleton);
|
|
13243
13444
|
for (const rowNode of rowNodes) dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, rowNodes.indexOf(rowNode), table, createCache);
|
|
13244
13445
|
updateTableSkeletonsPosition(createCache, curPage, skeTables, table);
|
|
13446
|
+
const documentCompatibilityPolicy = (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy();
|
|
13245
13447
|
return {
|
|
13246
13448
|
skeTables,
|
|
13247
|
-
fromCurrentPage: skeTables[0].height <= availableHeight
|
|
13449
|
+
fromCurrentPage: skeTables[0].height <= availableHeight + documentCompatibilityPolicy.table.currentPageOverflowTolerance
|
|
13248
13450
|
};
|
|
13249
13451
|
}
|
|
13250
13452
|
function updateTableSkeletonsPosition(cache, curPage, skeTables, table) {
|
|
@@ -13274,14 +13476,16 @@ function getAvailableHeight(curPage, cache, hasRepeatHeader) {
|
|
|
13274
13476
|
return pageContentHeight;
|
|
13275
13477
|
}
|
|
13276
13478
|
function dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, row, table, cache, isRepeatRow = false) {
|
|
13479
|
+
var _sectionBreakConfig$d2;
|
|
13277
13480
|
const pageContentHeight = getAvailableHeight(curPage, cache, false);
|
|
13278
13481
|
const availableHeight = getAvailableHeight(curPage, cache, true);
|
|
13482
|
+
const documentCompatibilityPolicy = (_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d2 !== void 0 ? _sectionBreakConfig$d2 : getDocumentCompatibilityPolicy();
|
|
13279
13483
|
const { children: cellNodes, startIndex, endIndex } = rowNode;
|
|
13280
13484
|
const rowSource = table.tableRows[row];
|
|
13281
13485
|
const { trHeight, cantSplit } = rowSource;
|
|
13282
13486
|
const rowSkeletons = [];
|
|
13283
13487
|
const { hRule, val } = trHeight;
|
|
13284
|
-
const canRowSplit = cantSplit
|
|
13488
|
+
const canRowSplit = cantSplit !== BooleanNumber.TRUE && trHeight.hRule === TableRowHeightRule.AUTO;
|
|
13285
13489
|
const MAX_FONT_SIZE = 72;
|
|
13286
13490
|
const needOpenNewTable = cache.remainHeight <= MAX_FONT_SIZE;
|
|
13287
13491
|
let curTableSkeleton = getCurTableSkeleton(skeTables);
|
|
@@ -13327,7 +13531,8 @@ function dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig
|
|
|
13327
13531
|
while (rowSkeletons.length > 0) {
|
|
13328
13532
|
const rowSkeleton = rowSkeletons.shift();
|
|
13329
13533
|
const lastRow = curTableSkeleton.rows[curTableSkeleton.rows.length - 1];
|
|
13330
|
-
|
|
13534
|
+
const rowOverflowHeight = rowSkeleton.height - cache.remainHeight;
|
|
13535
|
+
if (cache.remainHeight < MAX_FONT_SIZE || rowOverflowHeight > documentCompatibilityPolicy.table.rowOverflowTolerance) {
|
|
13331
13536
|
cache.remainHeight = getAvailableHeight(curPage, cache, row !== 0 && rowSkeleton.index !== lastRow.index);
|
|
13332
13537
|
cache.rowTop = 0;
|
|
13333
13538
|
if (curTableSkeleton.rows.length > 0) {
|
|
@@ -13503,18 +13708,29 @@ function getTableIdAndSliceIndex(tableSliceId) {
|
|
|
13503
13708
|
|
|
13504
13709
|
//#endregion
|
|
13505
13710
|
//#region src/components/docs/layout/block/paragraph/layout-ruler.ts
|
|
13711
|
+
const LINE_LAYOUT_OVERFLOW_TOLERANCE = 2;
|
|
13712
|
+
const FLOAT_OBJECT_RELAYOUT_LIMIT = 5;
|
|
13713
|
+
const MIN_LINE_WIDTH_TOLERANCE = 1;
|
|
13714
|
+
const MAX_LINE_WIDTH_TOLERANCE = 3;
|
|
13715
|
+
const RELATIVE_LINE_WIDTH_TOLERANCE = .01;
|
|
13716
|
+
function isBeyondDivideWidth(width, divideWidth) {
|
|
13717
|
+
const tolerance = Math.min(MAX_LINE_WIDTH_TOLERANCE, Math.max(MIN_LINE_WIDTH_TOLERANCE, divideWidth * RELATIVE_LINE_WIDTH_TOLERANCE));
|
|
13718
|
+
return width - divideWidth > tolerance;
|
|
13719
|
+
}
|
|
13506
13720
|
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal") {
|
|
13507
13721
|
if (isParagraphFirstShapedText) if (paragraphConfig.bulletSkeleton) {
|
|
13722
|
+
var _paragraphProperties$;
|
|
13508
13723
|
const { bulletSkeleton, paragraphStyle = {} } = paragraphConfig;
|
|
13509
13724
|
const { gridType = GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig;
|
|
13510
13725
|
const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
|
|
13511
13726
|
const charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid);
|
|
13512
13727
|
const bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], bulletSkeleton, charSpaceApply);
|
|
13513
13728
|
const paragraphProperties = bulletSkeleton.paragraphProperties || {};
|
|
13514
|
-
paragraphConfig.paragraphStyle =
|
|
13729
|
+
paragraphConfig.paragraphStyle = {
|
|
13515
13730
|
...paragraphProperties,
|
|
13516
|
-
hanging: { v: bulletGlyph.width }
|
|
13517
|
-
|
|
13731
|
+
hanging: (_paragraphProperties$ = paragraphProperties.hanging) !== null && _paragraphProperties$ !== void 0 ? _paragraphProperties$ : { v: bulletGlyph.width },
|
|
13732
|
+
...paragraphConfig.paragraphStyle
|
|
13733
|
+
};
|
|
13518
13734
|
_lineOperator(ctx, [bulletGlyph, ...glyphGroup], pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
13519
13735
|
} else _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
13520
13736
|
else _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType);
|
|
@@ -13543,6 +13759,11 @@ function isGlyphGroupBeyondContentBox(glyphGroup, left, divideWidth) {
|
|
|
13543
13759
|
}
|
|
13544
13760
|
return isBeyondContentBox;
|
|
13545
13761
|
}
|
|
13762
|
+
function shouldKeepOverflowingTextOnLine(sectionBreakConfig) {
|
|
13763
|
+
var _sectionBreakConfig$r;
|
|
13764
|
+
const wrapStrategy = (_sectionBreakConfig$r = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r === void 0 ? void 0 : _sectionBreakConfig$r.wrapStrategy;
|
|
13765
|
+
return wrapStrategy === WrapStrategy.CLIP || wrapStrategy === WrapStrategy.OVERFLOW;
|
|
13766
|
+
}
|
|
13546
13767
|
function _getConsecutiveHyphenLineCount(divide) {
|
|
13547
13768
|
var _divide$parent;
|
|
13548
13769
|
const column = (_divide$parent = divide.parent) === null || _divide$parent === void 0 ? void 0 : _divide$parent.parent;
|
|
@@ -13577,17 +13798,30 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13577
13798
|
const lastGlyph = divide === null || divide === void 0 || (_divide$glyphGroup = divide.glyphGroup) === null || _divide$glyphGroup === void 0 ? void 0 : _divide$glyphGroup[divide.glyphGroup.length - 1];
|
|
13578
13799
|
const preOffsetLeft = ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.width) || 0) + ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.left) || 0);
|
|
13579
13800
|
const { hyphenationZone } = sectionBreakConfig;
|
|
13580
|
-
if (preOffsetLeft + width
|
|
13801
|
+
if (isBeyondDivideWidth(preOffsetLeft + width, divide.width)) {
|
|
13802
|
+
if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length > 0 && glyphGroup[0].streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) {
|
|
13803
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13804
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13805
|
+
return;
|
|
13806
|
+
}
|
|
13807
|
+
if (shouldKeepOverflowingTextOnLine(sectionBreakConfig)) {
|
|
13808
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13809
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13810
|
+
return;
|
|
13811
|
+
}
|
|
13581
13812
|
updateDivideInfo(divide, { isFull: true });
|
|
13582
13813
|
const hyphenLineCount = _getConsecutiveHyphenLineCount(divideInfo.divide);
|
|
13583
13814
|
const { consecutiveHyphenLimit = Number.POSITIVE_INFINITY } = sectionBreakConfig;
|
|
13584
13815
|
if (divideInfo.isLast && glyphGroup.length === 1 && (glyphGroup[0].content === DataStreamTreeTokenType.SPACE || glyphGroup[0].content === DataStreamTreeTokenType.PARAGRAPH)) addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13585
13816
|
else if (divideInfo.isLast && !isGlyphGroupBeyondContentBox(glyphGroup, preOffsetLeft, divide.width) && isGlyphGroupEndWithWhiteSpaces(glyphGroup)) addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13586
|
-
else if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0) {
|
|
13817
|
+
else if (!isLast && (divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length === 1 && glyphGroup[0].streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyphGroup[0].width > divide.width) {
|
|
13818
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13819
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13820
|
+
} else if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0) {
|
|
13587
13821
|
const sliceGlyphGroup = [];
|
|
13588
13822
|
while (glyphGroup.length) {
|
|
13589
13823
|
sliceGlyphGroup.push(glyphGroup.shift());
|
|
13590
|
-
if (__getGlyphGroupWidth(sliceGlyphGroup)
|
|
13824
|
+
if (isBeyondDivideWidth(__getGlyphGroupWidth(sliceGlyphGroup), divide.width)) {
|
|
13591
13825
|
if (sliceGlyphGroup.length > 1) glyphGroup.unshift(sliceGlyphGroup.pop());
|
|
13592
13826
|
break;
|
|
13593
13827
|
}
|
|
@@ -13608,11 +13842,16 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13608
13842
|
} else {
|
|
13609
13843
|
const currentLine = divide.parent;
|
|
13610
13844
|
const maxBox = __maxFontBoundingBoxByGlyphGroup(glyphGroup);
|
|
13611
|
-
if (currentLine &&
|
|
13845
|
+
if (currentLine && __isZeroWidthNonFlowFloatingAnchorLine(__getGlyphGroupByLine(currentLine), paragraphConfig.paragraphNonInlineSkeDrawings) && __hasFlowGlyph(glyphGroup)) {
|
|
13846
|
+
for (const lineDivide of currentLine.divides) updateDivideInfo(lineDivide, { isFull: true });
|
|
13847
|
+
_lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, false, breakPointType);
|
|
13848
|
+
return;
|
|
13849
|
+
}
|
|
13850
|
+
if (currentLine && maxBox && !__isNullLine(currentLine) && __hasFlowGlyph(__getGlyphGroupByLine(currentLine)) && !__isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphConfig.paragraphNonInlineSkeDrawings)) {
|
|
13612
13851
|
const { paragraphLineGapDefault, linePitch, lineSpacing, spacingRule, snapToGrid, gridType } = getLineHeightConfig(sectionBreakConfig, paragraphConfig);
|
|
13613
13852
|
const { boundingBoxAscent, boundingBoxDescent } = maxBox;
|
|
13614
|
-
const { contentHeight } =
|
|
13615
|
-
if (currentLine.contentHeight
|
|
13853
|
+
const { contentHeight } = getLineHeightMetrics(boundingBoxAscent + boundingBoxDescent, paragraphLineGapDefault, linePitch, gridType, lineSpacing, spacingRule, snapToGrid, paragraphConfig.useWordStyleLineHeight);
|
|
13854
|
+
if (contentHeight - currentLine.contentHeight > LINE_LAYOUT_OVERFLOW_TOLERANCE) {
|
|
13616
13855
|
const spanGroupCached = __getGlyphGroupByLine(currentLine);
|
|
13617
13856
|
const spanGroupCachedLen = spanGroupCached.length;
|
|
13618
13857
|
let newGlyphGroup = [];
|
|
@@ -13628,6 +13867,19 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13628
13867
|
return;
|
|
13629
13868
|
}
|
|
13630
13869
|
}
|
|
13870
|
+
if (currentLine === null || currentLine === void 0 ? void 0 : currentLine.parent) {
|
|
13871
|
+
const anchorDrawings = __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphConfig.paragraphNonInlineSkeDrawings);
|
|
13872
|
+
if (anchorDrawings.length > 0) {
|
|
13873
|
+
var _paragraphConfig$para, _paragraphConfig$pDra;
|
|
13874
|
+
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, (_paragraphConfig$para = paragraphConfig.paragraphStyle) === null || _paragraphConfig$para === void 0 ? void 0 : _paragraphConfig$para.indentStart);
|
|
13875
|
+
const drawings = __getDrawingPosition(currentLine.top, currentLine.lineHeight, currentLine.parent, true, (_paragraphConfig$pDra = paragraphConfig.pDrawingAnchor) === null || _paragraphConfig$pDra === void 0 || (_paragraphConfig$pDra = _paragraphConfig$pDra.get(paragraphConfig.paragraphIndex)) === null || _paragraphConfig$pDra === void 0 ? void 0 : _paragraphConfig$pDra.top, anchorDrawings, paragraphAnchorLeft);
|
|
13876
|
+
__updateDrawingPosition(currentLine.parent, drawings);
|
|
13877
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13878
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13879
|
+
glyphGroup.length = 0;
|
|
13880
|
+
return;
|
|
13881
|
+
}
|
|
13882
|
+
}
|
|
13631
13883
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13632
13884
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13633
13885
|
}
|
|
@@ -13637,6 +13889,19 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13637
13889
|
var _originParagraphStyle, _originParagraphStyle2, _skeHeaders$get, _skeFooters$get;
|
|
13638
13890
|
let lastPage = getLastPage(pages);
|
|
13639
13891
|
let columnInfo = getLastNotFullColumnInfo(lastPage);
|
|
13892
|
+
if (!columnInfo || !columnInfo.column) {
|
|
13893
|
+
const lastSection = getLastSection(lastPage);
|
|
13894
|
+
const lastColumnIndex = lastSection.columns.length - 1;
|
|
13895
|
+
const lastColumn = lastSection.columns[lastColumnIndex];
|
|
13896
|
+
if (lastColumn && isBlankColumn(lastColumn)) {
|
|
13897
|
+
setColumnFullState(lastColumn, false);
|
|
13898
|
+
columnInfo = {
|
|
13899
|
+
column: lastColumn,
|
|
13900
|
+
index: lastColumnIndex,
|
|
13901
|
+
isLast: true
|
|
13902
|
+
};
|
|
13903
|
+
}
|
|
13904
|
+
}
|
|
13640
13905
|
if (!columnInfo || !columnInfo.column) {
|
|
13641
13906
|
_pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, true, breakPointType);
|
|
13642
13907
|
lastPage = getLastPage(pages);
|
|
@@ -13653,6 +13918,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13653
13918
|
const descent = Math.max(...glyphGroup.map((glyph) => glyph.bBox.bd));
|
|
13654
13919
|
const glyphLineHeight = defaultGlyphLineHeight || ascent + descent;
|
|
13655
13920
|
const { paragraphStyle: originParagraphStyle = {}, paragraphNonInlineSkeDrawings, skeTablesInParagraph, skeHeaders, skeFooters, pDrawingAnchor, paragraphIndex } = paragraphConfig;
|
|
13921
|
+
const isZeroWidthNonFlowFloatingAnchorLine = __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings);
|
|
13656
13922
|
const { namedStyleType } = originParagraphStyle;
|
|
13657
13923
|
const namedStyle = namedStyleType !== void 0 ? NAMED_STYLE_SPACE_MAP[namedStyleType] : null;
|
|
13658
13924
|
const { spaceAbove, spaceBelow, indentFirstLine, hanging, indentStart, indentEnd } = {
|
|
@@ -13661,9 +13927,34 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13661
13927
|
spaceBelow: (_originParagraphStyle2 = originParagraphStyle.spaceBelow) !== null && _originParagraphStyle2 !== void 0 ? _originParagraphStyle2 : namedStyle === null || namedStyle === void 0 ? void 0 : namedStyle.spaceBelow
|
|
13662
13928
|
};
|
|
13663
13929
|
const { paragraphLineGapDefault, linePitch, lineSpacing, spacingRule, snapToGrid, gridType } = getLineHeightConfig(sectionBreakConfig, paragraphConfig);
|
|
13664
|
-
const
|
|
13665
|
-
const
|
|
13930
|
+
const hasInlineCustomBlock = glyphGroup.some((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0);
|
|
13931
|
+
const positionedCustomBlockOnly = glyphGroup.length > 0 && paragraphNonInlineSkeDrawings != null && paragraphNonInlineSkeDrawings.size > 0 && glyphGroup.every((glyph) => {
|
|
13932
|
+
if (!glyph) return false;
|
|
13933
|
+
if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) return [...paragraphNonInlineSkeDrawings.values()].some((drawing) => drawing.drawingId === glyph.drawingId);
|
|
13934
|
+
return glyph.streamType === DataStreamTreeTokenType.PARAGRAPH || glyph.raw === DataStreamTreeTokenType.PARAGRAPH;
|
|
13935
|
+
});
|
|
13936
|
+
const glyphGroupCustomBlockIds = new Set(glyphGroup.filter((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.drawingId != null).map((glyph) => glyph.drawingId));
|
|
13937
|
+
let { paddingTop, paddingBottom, contentHeight, lineSpacingApply } = getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitch, gridType, lineSpacing, spacingRule, snapToGrid, paragraphConfig.useWordStyleLineHeight, !hasInlineCustomBlock);
|
|
13938
|
+
if (positionedCustomBlockOnly) {
|
|
13939
|
+
paddingTop = 0;
|
|
13940
|
+
paddingBottom = 0;
|
|
13941
|
+
contentHeight = .01;
|
|
13942
|
+
lineSpacingApply = .01;
|
|
13943
|
+
}
|
|
13944
|
+
let { marginTop, spaceBelowApply } = __getParagraphSpace(ctx, lineSpacingApply, spaceAbove, spaceBelow, isParagraphFirstShapedText, preLine);
|
|
13945
|
+
if (positionedCustomBlockOnly) spaceBelowApply = 0;
|
|
13946
|
+
if (isZeroWidthNonFlowFloatingAnchorLine) {
|
|
13947
|
+
paddingTop = 0;
|
|
13948
|
+
paddingBottom = 0;
|
|
13949
|
+
contentHeight = 0;
|
|
13950
|
+
lineSpacingApply = 0;
|
|
13951
|
+
marginTop = 0;
|
|
13952
|
+
spaceBelowApply = 0;
|
|
13953
|
+
}
|
|
13666
13954
|
const lineHeight = marginTop + paddingTop + contentHeight + paddingBottom;
|
|
13955
|
+
const { charSpace, defaultTabStop } = getCharSpaceConfig(sectionBreakConfig, paragraphConfig);
|
|
13956
|
+
const charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid);
|
|
13957
|
+
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, indentStart);
|
|
13667
13958
|
let section = column.parent;
|
|
13668
13959
|
if (!section) section = getLastSection(lastPage);
|
|
13669
13960
|
const lineTop = ((preLine === null || preLine === void 0 ? void 0 : preLine.lineHeight) || 0) + ((preLine === null || preLine === void 0 ? void 0 : preLine.top) || 0);
|
|
@@ -13680,16 +13971,22 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13680
13971
|
if (relativeLineDrawings.length > 0) __updateAndPositionDrawings(ctx, preLine.top, preLine.lineHeight, column, relativeLineDrawings, preLine.paragraphIndex, isParagraphFirstShapedText);
|
|
13681
13972
|
}
|
|
13682
13973
|
}
|
|
13974
|
+
let deferredInlineGroupAnchorDrawings = [];
|
|
13683
13975
|
if (paragraphNonInlineSkeDrawings != null && paragraphNonInlineSkeDrawings.size > 0) {
|
|
13684
13976
|
var _pDrawingAnchor$get;
|
|
13685
|
-
|
|
13977
|
+
let targetDrawings = [...paragraphNonInlineSkeDrawings.values()].filter((drawing) => drawing.drawingOrigin.docTransform.positionV.relativeFrom !== ObjectRelativeFromV.LINE);
|
|
13978
|
+
if (hasInlineCustomBlock) {
|
|
13979
|
+
deferredInlineGroupAnchorDrawings = targetDrawings.filter((drawing) => glyphGroupCustomBlockIds.has(drawing.drawingId) && drawing.drawingOrigin.docTransform.positionV.relativeFrom === ObjectRelativeFromV.LINE);
|
|
13980
|
+
targetDrawings = targetDrawings.filter((drawing) => !deferredInlineGroupAnchorDrawings.includes(drawing));
|
|
13981
|
+
}
|
|
13982
|
+
__updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get === void 0 ? void 0 : _pDrawingAnchor$get.top, paragraphAnchorLeft);
|
|
13686
13983
|
}
|
|
13687
13984
|
if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
|
|
13688
13985
|
var _pDrawingAnchor$get2;
|
|
13689
13986
|
needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop, lineHeight, lastPage, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
|
|
13690
13987
|
}
|
|
13691
|
-
const newLineTop = calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
13692
|
-
if (lineHeight + newLineTop
|
|
13988
|
+
const newLineTop = positionedCustomBlockOnly ? lineTop : calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
13989
|
+
if (lineHeight + newLineTop - section.height > LINE_LAYOUT_OVERFLOW_TOLERANCE && column.lines.length > 0 && lastPage.sections.length > 0 || needOpenNewPageByTableLayout) {
|
|
13693
13990
|
setColumnFullState(column, true);
|
|
13694
13991
|
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
13695
13992
|
if (isParagraphFirstShapedText && paragraphNonInlineSkeDrawings && paragraphNonInlineSkeDrawings.size > 0) for (const drawing of paragraphNonInlineSkeDrawings.values()) {
|
|
@@ -13703,8 +14000,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13703
14000
|
return;
|
|
13704
14001
|
}
|
|
13705
14002
|
const lineIndex = preLine ? preLine.lineIndex + 1 : 0;
|
|
13706
|
-
|
|
13707
|
-
let { paddingLeft, paddingRight } = __getIndentPadding(indentFirstLine, hanging, indentStart, indentEnd, getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid), isParagraphFirstShapedText);
|
|
14003
|
+
let { paddingLeft, paddingRight } = __getIndentPadding(indentFirstLine, hanging, indentStart, indentEnd, charSpaceApply, isParagraphFirstShapedText);
|
|
13708
14004
|
if (paddingLeft + paddingRight >= column.width) {
|
|
13709
14005
|
const leftPercent = paddingLeft / (paddingLeft + paddingRight);
|
|
13710
14006
|
paddingLeft = column.width * leftPercent - .5;
|
|
@@ -13725,12 +14021,16 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13725
14021
|
newLine.parent = column;
|
|
13726
14022
|
createAndUpdateBlockAnchor(paragraphIndex, newLine, lineTop, pDrawingAnchor);
|
|
13727
14023
|
_divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
14024
|
+
if (deferredInlineGroupAnchorDrawings.length > 0) {
|
|
14025
|
+
var _pDrawingAnchor$get3;
|
|
14026
|
+
__updateAndPositionDrawings(ctx, lineTop, lineHeight, column, deferredInlineGroupAnchorDrawings, paragraphConfig.paragraphIndex, isParagraphFirstShapedText, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get3 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get3 === void 0 ? void 0 : _pDrawingAnchor$get3.top, paragraphAnchorLeft, true);
|
|
14027
|
+
}
|
|
13728
14028
|
}
|
|
13729
|
-
function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphIndex, isParagraphFirstShapedText, drawingAnchorTop) {
|
|
14029
|
+
function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDrawings, paragraphIndex, isParagraphFirstShapedText, drawingAnchorTop, drawingAnchorLeft = 0, skipRelayoutCheck = false) {
|
|
13730
14030
|
if (targetDrawings.length === 0) return;
|
|
13731
|
-
const drawings = __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings);
|
|
14031
|
+
const drawings = __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, drawingAnchorTop, targetDrawings, drawingAnchorLeft);
|
|
13732
14032
|
if (drawings == null || drawings.size === 0) return;
|
|
13733
|
-
|
|
14033
|
+
const floatObjects = [...drawings.values()].filter((drawing) => {
|
|
13734
14034
|
const layoutType = drawing.drawingOrigin.layoutType;
|
|
13735
14035
|
return layoutType !== PositionedObjectLayoutType.INLINE && layoutType !== PositionedObjectLayoutType.WRAP_NONE;
|
|
13736
14036
|
}).map((drawing) => {
|
|
@@ -13743,10 +14043,13 @@ function __updateAndPositionDrawings(ctx, lineTop, lineHeight, column, targetDra
|
|
|
13743
14043
|
width,
|
|
13744
14044
|
height,
|
|
13745
14045
|
angle,
|
|
14046
|
+
behindDoc: drawingOrigin.behindDoc,
|
|
14047
|
+
layoutType: drawingOrigin.layoutType,
|
|
13746
14048
|
type: "IMAGE",
|
|
13747
14049
|
positionV
|
|
13748
14050
|
};
|
|
13749
|
-
})
|
|
14051
|
+
});
|
|
14052
|
+
if (!skipRelayoutCheck) _reLayoutCheck(ctx, floatObjects, column, paragraphIndex);
|
|
13750
14053
|
__updateDrawingPosition(column, drawings);
|
|
13751
14054
|
}
|
|
13752
14055
|
function __updateWrapTablePosition(ctx, table, lineTop, lineHeight, column, paragraphIndex, drawingAnchorTop) {
|
|
@@ -13779,6 +14082,22 @@ function __getWrapTablePosition(table, column, lineTop, lineHeight, drawingAncho
|
|
|
13779
14082
|
top: (_getPositionVertical = getPositionVertical(positionV, page, lineTop, lineHeight, height, drawingAnchorTop, isPageBreak)) !== null && _getPositionVertical !== void 0 ? _getPositionVertical : 0
|
|
13780
14083
|
};
|
|
13781
14084
|
}
|
|
14085
|
+
function __avoidFlowAffectingDrawingsForTable(table, page, column) {
|
|
14086
|
+
const tableTop = table.top;
|
|
14087
|
+
const tableBottom = table.top + table.height;
|
|
14088
|
+
const tableRight = table.left + table.width;
|
|
14089
|
+
for (const drawing of page.skeDrawings.values()) {
|
|
14090
|
+
var _drawingOrigin$distR;
|
|
14091
|
+
const drawingOrigin = drawing.drawingOrigin;
|
|
14092
|
+
if (drawingOrigin == null || drawingOrigin.layoutType === PositionedObjectLayoutType.INLINE || drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_NONE || drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) continue;
|
|
14093
|
+
const drawingTop = drawing.aTop;
|
|
14094
|
+
const drawingBottom = drawing.aTop + drawing.height;
|
|
14095
|
+
if (drawingTop >= tableBottom || drawingBottom <= tableTop) continue;
|
|
14096
|
+
const drawingRight = drawing.aLeft + drawing.width + ((_drawingOrigin$distR = drawingOrigin.distR) !== null && _drawingOrigin$distR !== void 0 ? _drawingOrigin$distR : 0);
|
|
14097
|
+
if (drawing.aLeft >= tableRight || drawingRight <= table.left) continue;
|
|
14098
|
+
if (drawingRight + table.width <= column.width) table.left = Math.max(table.left, drawingRight);
|
|
14099
|
+
}
|
|
14100
|
+
}
|
|
13782
14101
|
function _updateAndPositionTable(ctx, lineTop, lineHeight, page, column, section, skeTablesInParagraph, paragraphIndex, sectionBreakConfig, drawingAnchorTop) {
|
|
13783
14102
|
if (skeTablesInParagraph.length === 0) return false;
|
|
13784
14103
|
const firstUnPositionedTable = skeTablesInParagraph.find((table) => table.hasPositioned === false);
|
|
@@ -13788,6 +14107,7 @@ function _updateAndPositionTable(ctx, lineTop, lineHeight, page, column, section
|
|
|
13788
14107
|
if (firstUnPositionedTable.isSlideTable === false) switch (tableSource.textWrap) {
|
|
13789
14108
|
case TableTextWrapType.NONE:
|
|
13790
14109
|
table.top = lineTop;
|
|
14110
|
+
__avoidFlowAffectingDrawingsForTable(table, page, column);
|
|
13791
14111
|
break;
|
|
13792
14112
|
case TableTextWrapType.WRAP:
|
|
13793
14113
|
__updateWrapTablePosition(ctx, table, lineTop, lineHeight, column, paragraphIndex, drawingAnchorTop);
|
|
@@ -13841,15 +14161,47 @@ function _getCustomBlockIdsInLine(line) {
|
|
|
13841
14161
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) customBlockIds.push(glyph.drawingId);
|
|
13842
14162
|
return customBlockIds;
|
|
13843
14163
|
}
|
|
14164
|
+
function __isZeroWidthNonFlowFloatingAnchorLine(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14165
|
+
return __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphNonInlineSkeDrawings).length > 0;
|
|
14166
|
+
}
|
|
14167
|
+
function __getZeroWidthNonFlowFloatingAnchorDrawings(glyphGroup, paragraphNonInlineSkeDrawings) {
|
|
14168
|
+
const drawings = [];
|
|
14169
|
+
for (const glyph of glyphGroup) {
|
|
14170
|
+
if (__isStructuralTerminatorGlyph(glyph)) continue;
|
|
14171
|
+
if (__isIgnorableZeroSizeGlyph(glyph)) continue;
|
|
14172
|
+
if (glyph.streamType !== DataStreamTreeTokenType.CUSTOM_BLOCK || glyph.width !== 0 || glyph.drawingId == null) return [];
|
|
14173
|
+
const drawing = paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 ? void 0 : paragraphNonInlineSkeDrawings.get(glyph.drawingId);
|
|
14174
|
+
const drawingOrigin = drawing === null || drawing === void 0 ? void 0 : drawing.drawingOrigin;
|
|
14175
|
+
if (drawing == null || drawingOrigin == null) return [];
|
|
14176
|
+
if (drawingOrigin.layoutType !== PositionedObjectLayoutType.WRAP_NONE) return [];
|
|
14177
|
+
drawings.push(drawing);
|
|
14178
|
+
}
|
|
14179
|
+
return drawings;
|
|
14180
|
+
}
|
|
14181
|
+
function __isIgnorableZeroSizeGlyph(glyph) {
|
|
14182
|
+
return glyph.content === "" && glyph.drawingId == null && glyph.width === 0 && glyph.bBox.ba + glyph.bBox.bd === 0;
|
|
14183
|
+
}
|
|
14184
|
+
function __isStructuralTerminatorGlyph(glyph) {
|
|
14185
|
+
return glyph.streamType === DataStreamTreeTokenType.PARAGRAPH || glyph.streamType === DataStreamTreeTokenType.SECTION_BREAK || glyph.streamType === DataStreamTreeTokenType.DOCS_END;
|
|
14186
|
+
}
|
|
14187
|
+
function __hasFlowGlyph(glyphGroup) {
|
|
14188
|
+
return glyphGroup.some((glyph) => {
|
|
14189
|
+
if (__isStructuralTerminatorGlyph(glyph)) return false;
|
|
14190
|
+
if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK) return glyph.width !== 0;
|
|
14191
|
+
return glyph.content !== "" || glyph.width > 0 || glyph.bBox.ba + glyph.bBox.bd > 0;
|
|
14192
|
+
});
|
|
14193
|
+
}
|
|
13844
14194
|
function _reLayoutCheck(ctx, floatObjects, column, paragraphIndex) {
|
|
13845
14195
|
var _column$parent2;
|
|
13846
14196
|
const page = (_column$parent2 = column.parent) === null || _column$parent2 === void 0 ? void 0 : _column$parent2.parent;
|
|
13847
|
-
|
|
14197
|
+
const flowAffectingFloatObjects = floatObjects.filter((floatObject) => floatObject.behindDoc !== BooleanNumber.TRUE || floatObject.layoutType != null && floatObject.layoutType !== PositionedObjectLayoutType.WRAP_NONE);
|
|
14198
|
+
if (flowAffectingFloatObjects.length === 0 || page == null) return;
|
|
13848
14199
|
let needBreakLineIterator = false;
|
|
13849
|
-
for (const floatObject of
|
|
14200
|
+
for (const floatObject of flowAffectingFloatObjects) {
|
|
13850
14201
|
var _floatObjectCache$pag, _page$sections$;
|
|
13851
14202
|
const floatObjectCache = ctx.floatObjectsCache.get(floatObject.id);
|
|
13852
14203
|
if (floatObjectCache == null || floatObjectCache.page.segmentId !== page.segmentId) continue;
|
|
14204
|
+
if (floatObjectCache.count >= FLOAT_OBJECT_RELAYOUT_LIMIT) continue;
|
|
13853
14205
|
const cachePageStartParagraphIndex = (_floatObjectCache$pag = floatObjectCache.page.sections[0]) === null || _floatObjectCache$pag === void 0 || (_floatObjectCache$pag = _floatObjectCache$pag.columns[0]) === null || _floatObjectCache$pag === void 0 || (_floatObjectCache$pag = _floatObjectCache$pag.lines[0]) === null || _floatObjectCache$pag === void 0 ? void 0 : _floatObjectCache$pag.paragraphIndex;
|
|
13854
14206
|
const startIndex = (_page$sections$ = page.sections[0]) === null || _page$sections$ === void 0 || (_page$sections$ = _page$sections$.columns[0]) === null || _page$sections$ === void 0 || (_page$sections$ = _page$sections$.lines[0]) === null || _page$sections$ === void 0 ? void 0 : _page$sections$.paragraphIndex;
|
|
13855
14207
|
if (floatObjectCache.page && cachePageStartParagraphIndex && startIndex && cachePageStartParagraphIndex !== startIndex) {
|
|
@@ -13875,7 +14227,7 @@ function _reLayoutCheck(ctx, floatObjects, column, paragraphIndex) {
|
|
|
13875
14227
|
const { lineHeight, top } = line;
|
|
13876
14228
|
const { width: columnWidth, left: columnLeft } = column;
|
|
13877
14229
|
if (needBreakLineIterator) return;
|
|
13878
|
-
for (const floatObject of
|
|
14230
|
+
for (const floatObject of flowAffectingFloatObjects.values()) {
|
|
13879
14231
|
let targetObject = floatObject;
|
|
13880
14232
|
if (ctx.floatObjectsCache.has(floatObject.id)) {
|
|
13881
14233
|
const drawingCache = ctx.floatObjectsCache.get(floatObject.id);
|
|
@@ -13913,7 +14265,7 @@ function checkRelativeDrawingNeedRePosition(ctx, floatObject) {
|
|
|
13913
14265
|
if (drawingCache == null) return false;
|
|
13914
14266
|
if (relativeFrom === ObjectRelativeFromV.PARAGRAPH || relativeFrom === ObjectRelativeFromV.LINE) {
|
|
13915
14267
|
const { count, floatObject: prevObject } = drawingCache;
|
|
13916
|
-
if (count <
|
|
14268
|
+
if (count < FLOAT_OBJECT_RELAYOUT_LIMIT && Math.abs(floatObject.top - prevObject.top) > 5) return true;
|
|
13917
14269
|
}
|
|
13918
14270
|
return false;
|
|
13919
14271
|
}
|
|
@@ -13970,43 +14322,87 @@ function __getParagraphSpace(ctx, lineSpacing = 0, spaceAbove, spaceBelow, isPar
|
|
|
13970
14322
|
spaceBelowApply
|
|
13971
14323
|
};
|
|
13972
14324
|
}
|
|
13973
|
-
function
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
14325
|
+
function __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, indentStart) {
|
|
14326
|
+
const { paragraphStyle = {} } = paragraphConfig;
|
|
14327
|
+
const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
|
|
14328
|
+
const { gridType = GridType.LINES } = sectionBreakConfig;
|
|
14329
|
+
const { charSpace, defaultTabStop } = getCharSpaceConfig(sectionBreakConfig, paragraphConfig);
|
|
14330
|
+
const charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid);
|
|
14331
|
+
const paragraphAnchorLeft = getNumberUnitValue(indentStart, charSpaceApply);
|
|
14332
|
+
if (paragraphAnchorLeft > 0) return paragraphAnchorLeft;
|
|
14333
|
+
return getNumberUnitValue(paragraphConfig.docxFallbackAnchorLeft, charSpaceApply);
|
|
14334
|
+
}
|
|
14335
|
+
function getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitch, gridType, lineSpacing, spacingRule, snapToGrid, useWordStyleLineHeight = true, scaleAutoLineSpacingByGlyphHeight = true) {
|
|
14336
|
+
if (!useWordStyleLineHeight) {
|
|
14337
|
+
let paddingTop = paragraphLineGapDefault;
|
|
14338
|
+
let paddingBottom = paragraphLineGapDefault;
|
|
14339
|
+
if (gridType === GridType.DEFAULT || snapToGrid === BooleanNumber.FALSE) {
|
|
14340
|
+
if (spacingRule === SpacingRule.AUTO) return {
|
|
14341
|
+
paddingTop,
|
|
14342
|
+
paddingBottom,
|
|
14343
|
+
contentHeight: lineSpacing * glyphLineHeight,
|
|
14344
|
+
lineSpacingApply: glyphLineHeight
|
|
14345
|
+
};
|
|
14346
|
+
return {
|
|
14347
|
+
paddingTop,
|
|
14348
|
+
paddingBottom,
|
|
14349
|
+
contentHeight: Math.max(lineSpacing, glyphLineHeight),
|
|
14350
|
+
lineSpacingApply: lineSpacing
|
|
14351
|
+
};
|
|
14352
|
+
}
|
|
14353
|
+
let lineSpacingApply = 0;
|
|
14354
|
+
if (spacingRule === SpacingRule.AUTO) lineSpacingApply = lineSpacing * linePitch;
|
|
14355
|
+
else lineSpacingApply = lineSpacing;
|
|
14356
|
+
if (glyphLineHeight + paragraphLineGapDefault * 2 < lineSpacingApply) paddingTop = paddingBottom = (lineSpacingApply - glyphLineHeight) / 2;
|
|
14357
|
+
else lineSpacingApply = glyphLineHeight;
|
|
14358
|
+
return {
|
|
13978
14359
|
paddingTop,
|
|
13979
14360
|
paddingBottom,
|
|
13980
|
-
contentHeight:
|
|
13981
|
-
lineSpacingApply
|
|
14361
|
+
contentHeight: glyphLineHeight,
|
|
14362
|
+
lineSpacingApply
|
|
13982
14363
|
};
|
|
14364
|
+
}
|
|
14365
|
+
const usesDocumentGrid = spacingRule === SpacingRule.AUTO && snapToGrid === BooleanNumber.TRUE && gridType !== GridType.DEFAULT;
|
|
14366
|
+
if (spacingRule === SpacingRule.AUTO) {
|
|
14367
|
+
const lineSpacingApply = usesDocumentGrid ? lineSpacing * linePitch : scaleAutoLineSpacingByGlyphHeight ? lineSpacing * glyphLineHeight : glyphLineHeight;
|
|
14368
|
+
const padding = (lineSpacingApply - glyphLineHeight) / 2;
|
|
13983
14369
|
return {
|
|
13984
|
-
paddingTop,
|
|
13985
|
-
paddingBottom,
|
|
13986
|
-
contentHeight:
|
|
13987
|
-
lineSpacingApply
|
|
14370
|
+
paddingTop: padding,
|
|
14371
|
+
paddingBottom: padding,
|
|
14372
|
+
contentHeight: glyphLineHeight,
|
|
14373
|
+
lineSpacingApply
|
|
13988
14374
|
};
|
|
13989
14375
|
}
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
14376
|
+
if (spacingRule === SpacingRule.AT_LEAST) {
|
|
14377
|
+
const lineSpacingApply = Math.max(lineSpacing, glyphLineHeight);
|
|
14378
|
+
const padding = (lineSpacingApply - glyphLineHeight) / 2;
|
|
14379
|
+
return {
|
|
14380
|
+
paddingTop: padding,
|
|
14381
|
+
paddingBottom: padding,
|
|
14382
|
+
contentHeight: glyphLineHeight,
|
|
14383
|
+
lineSpacingApply
|
|
14384
|
+
};
|
|
14385
|
+
}
|
|
14386
|
+
const exactLineSpacingApply = snapToGrid === BooleanNumber.TRUE && gridType !== GridType.DEFAULT ? Math.max(lineSpacing, linePitch) : lineSpacing;
|
|
14387
|
+
const exactPadding = (exactLineSpacingApply - glyphLineHeight) / 2;
|
|
13995
14388
|
return {
|
|
13996
|
-
paddingTop,
|
|
13997
|
-
paddingBottom,
|
|
14389
|
+
paddingTop: exactPadding,
|
|
14390
|
+
paddingBottom: exactPadding,
|
|
13998
14391
|
contentHeight: glyphLineHeight,
|
|
13999
|
-
lineSpacingApply
|
|
14392
|
+
lineSpacingApply: exactLineSpacingApply
|
|
14000
14393
|
};
|
|
14001
14394
|
}
|
|
14002
|
-
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnchorTop) {
|
|
14003
|
-
var _line$parent;
|
|
14395
|
+
function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnchorTop, paragraphNonInlineSkeDrawings) {
|
|
14396
|
+
var _line$parent, _section$top;
|
|
14004
14397
|
const column = line.parent;
|
|
14398
|
+
const section = column === null || column === void 0 ? void 0 : column.parent;
|
|
14005
14399
|
const page = line === null || line === void 0 || (_line$parent = line.parent) === null || _line$parent === void 0 || (_line$parent = _line$parent.parent) === null || _line$parent === void 0 ? void 0 : _line$parent.parent;
|
|
14006
14400
|
if (page == null || column == null) return;
|
|
14007
14401
|
const isPageBreak = __checkPageBreak(column);
|
|
14008
14402
|
const drawings = /* @__PURE__ */ new Map();
|
|
14009
14403
|
const { top, lineHeight, marginBottom = 0 } = line;
|
|
14404
|
+
const sectionTop = (_section$top = section === null || section === void 0 ? void 0 : section.top) !== null && _section$top !== void 0 ? _section$top : 0;
|
|
14405
|
+
const lineTop = sectionTop + top;
|
|
14010
14406
|
for (const divide of line.divides) for (const glyph of divide.glyphGroup) if (glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0) {
|
|
14011
14407
|
const { drawingId } = glyph;
|
|
14012
14408
|
if (drawingId == null) continue;
|
|
@@ -14017,21 +14413,37 @@ function updateInlineDrawingPosition(line, paragraphInlineSkeDrawings, blockAnch
|
|
|
14017
14413
|
const { size, angle } = docTransform;
|
|
14018
14414
|
const { width = 0, height = 0 } = size;
|
|
14019
14415
|
const glyphHeight = glyph.bBox.bd + glyph.bBox.ba;
|
|
14020
|
-
drawing.aLeft = divide.left + divide.paddingLeft + glyph.left + .5 * glyph.width - .5 * width || 0;
|
|
14021
|
-
|
|
14416
|
+
drawing.aLeft = column.left + divide.left + divide.paddingLeft + glyph.left + .5 * glyph.width - .5 * width || 0;
|
|
14417
|
+
if (glyph.width > divide.width) {
|
|
14418
|
+
var _paragraphNonInlineSk;
|
|
14419
|
+
for (const positionedDrawing of (_paragraphNonInlineSk = paragraphNonInlineSkeDrawings === null || paragraphNonInlineSkeDrawings === void 0 ? void 0 : paragraphNonInlineSkeDrawings.values()) !== null && _paragraphNonInlineSk !== void 0 ? _paragraphNonInlineSk : []) {
|
|
14420
|
+
const positionedOrigin = positionedDrawing.drawingOrigin;
|
|
14421
|
+
if (positionedOrigin == null || positionedOrigin.layoutType === PositionedObjectLayoutType.INLINE || positionedOrigin.layoutType === PositionedObjectLayoutType.WRAP_NONE || positionedOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM) continue;
|
|
14422
|
+
const positionedBottom = positionedDrawing.aTop + positionedDrawing.height;
|
|
14423
|
+
const lineBottom = lineTop + lineHeight;
|
|
14424
|
+
if (positionedDrawing.aTop >= lineBottom || positionedBottom <= lineTop) continue;
|
|
14425
|
+
const positionedRight = positionedDrawing.aLeft + positionedDrawing.width;
|
|
14426
|
+
const drawingRight = drawing.aLeft + width;
|
|
14427
|
+
if (positionedDrawing.aLeft < drawingRight && positionedRight > drawing.aLeft) {
|
|
14428
|
+
var _positionedOrigin$dis;
|
|
14429
|
+
drawing.aLeft = Math.max(drawing.aLeft, positionedDrawing.aLeft + positionedDrawing.width + ((_positionedOrigin$dis = positionedOrigin.distR) !== null && _positionedOrigin$dis !== void 0 ? _positionedOrigin$dis : 0));
|
|
14430
|
+
}
|
|
14431
|
+
}
|
|
14432
|
+
}
|
|
14433
|
+
drawing.aTop = lineTop + lineHeight - .5 * glyphHeight - .5 * height - marginBottom;
|
|
14022
14434
|
drawing.width = width;
|
|
14023
14435
|
drawing.height = height;
|
|
14024
14436
|
drawing.angle = angle;
|
|
14025
14437
|
drawing.isPageBreak = isPageBreak;
|
|
14026
|
-
drawing.lineTop =
|
|
14438
|
+
drawing.lineTop = lineTop;
|
|
14027
14439
|
drawing.columnLeft = column.left;
|
|
14028
|
-
drawing.blockAnchorTop = blockAnchorTop
|
|
14440
|
+
drawing.blockAnchorTop = blockAnchorTop == null ? lineTop : sectionTop + blockAnchorTop;
|
|
14029
14441
|
drawing.lineHeight = line.lineHeight;
|
|
14030
14442
|
drawings.set(drawing.drawingId, drawing);
|
|
14031
14443
|
}
|
|
14032
14444
|
page.skeDrawings = new Map([...page.skeDrawings, ...drawings]);
|
|
14033
14445
|
}
|
|
14034
|
-
function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = []) {
|
|
14446
|
+
function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShapedText, blockAnchorTop, needPositionDrawings = [], blockAnchorLeft = 0) {
|
|
14035
14447
|
var _column$parent3;
|
|
14036
14448
|
const page = (_column$parent3 = column.parent) === null || _column$parent3 === void 0 ? void 0 : _column$parent3.parent;
|
|
14037
14449
|
if (page == null || needPositionDrawings.length === 0) return;
|
|
@@ -14045,7 +14457,12 @@ function __getDrawingPosition(lineTop, lineHeight, column, isParagraphFirstShape
|
|
|
14045
14457
|
const { docTransform } = drawingOrigin;
|
|
14046
14458
|
const { positionH, positionV, size, angle } = docTransform;
|
|
14047
14459
|
const { width = 0, height = 0 } = size;
|
|
14048
|
-
|
|
14460
|
+
let aLeft = (_getPositionHorizon2 = getPositionHorizon(positionH, column, page, width, isPageBreak)) !== null && _getPositionHorizon2 !== void 0 ? _getPositionHorizon2 : 0;
|
|
14461
|
+
if (positionH.relativeFrom === ObjectRelativeFromH.COLUMN && blockAnchorLeft > 0) {
|
|
14462
|
+
const renderedColumnOrigin = isPageBreak ? 0 : column.left || page.marginLeft;
|
|
14463
|
+
aLeft += blockAnchorLeft - renderedColumnOrigin;
|
|
14464
|
+
}
|
|
14465
|
+
drawing.aLeft = aLeft;
|
|
14049
14466
|
drawing.aTop = (_getPositionVertical2 = getPositionVertical(positionV, page, lineTop, lineHeight, height, blockAnchorTop, isPageBreak)) !== null && _getPositionVertical2 !== void 0 ? _getPositionVertical2 : 0;
|
|
14050
14467
|
drawing.width = width;
|
|
14051
14468
|
drawing.height = height;
|
|
@@ -14114,7 +14531,7 @@ function __getGlyphGroupByLine({ divides }) {
|
|
|
14114
14531
|
return divides.flatMap((divide) => divide.glyphGroup);
|
|
14115
14532
|
}
|
|
14116
14533
|
function __isNullLine(line) {
|
|
14117
|
-
return
|
|
14534
|
+
return __getGlyphGroupByLine(line).every((glyph) => !glyph.content && !glyph.drawingId);
|
|
14118
14535
|
}
|
|
14119
14536
|
|
|
14120
14537
|
//#endregion
|
|
@@ -14194,9 +14611,29 @@ function isColumnFull(page) {
|
|
|
14194
14611
|
for (let i = 0; i < columnsLen; i++) if (!section.columns[i].isFull) return false;
|
|
14195
14612
|
return true;
|
|
14196
14613
|
}
|
|
14614
|
+
function isBlankColumn(column) {
|
|
14615
|
+
const lines = column.lines;
|
|
14616
|
+
if (lines.length > 1) return false;
|
|
14617
|
+
const line = lines[lines.length - 1];
|
|
14618
|
+
return isLineBlank(line);
|
|
14619
|
+
}
|
|
14620
|
+
function isLineBlank(line) {
|
|
14621
|
+
if (!line) return true;
|
|
14622
|
+
for (let i = 0; i < line.divides.length; i++) {
|
|
14623
|
+
const spanCount = line.divides[i].glyphGroup.length;
|
|
14624
|
+
if (spanCount > 1) return false;
|
|
14625
|
+
if (spanCount === 1) {
|
|
14626
|
+
const { glyphType, raw, streamType, width } = line.divides[i].glyphGroup[0];
|
|
14627
|
+
const isZeroWidthColumnBreak = width === 0 && (raw === DataStreamTreeTokenType.COLUMN_BREAK || streamType === DataStreamTreeTokenType.COLUMN_BREAK);
|
|
14628
|
+
if (glyphType !== 4 && glyphType !== 2 && !isZeroWidthColumnBreak) return false;
|
|
14629
|
+
}
|
|
14630
|
+
}
|
|
14631
|
+
return true;
|
|
14632
|
+
}
|
|
14197
14633
|
function getNumberUnitValue(unitValue, benchMark) {
|
|
14198
14634
|
if (!unitValue) return 0;
|
|
14199
14635
|
const { v: value, u: unit } = unitValue;
|
|
14636
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return 0;
|
|
14200
14637
|
if (!unit) return value;
|
|
14201
14638
|
if (unit === NumberUnitType.PIXEL) return value;
|
|
14202
14639
|
return value * benchMark;
|
|
@@ -14211,18 +14648,22 @@ function validationGrid(gridType = GridType.LINES, snapToGrid = BooleanNumber.FA
|
|
|
14211
14648
|
return snapToGrid === BooleanNumber.TRUE && (gridType === GridType.LINES_AND_CHARS || gridType === GridType.SNAP_TO_CHARS);
|
|
14212
14649
|
}
|
|
14213
14650
|
function getLineHeightConfig(sectionBreakConfig, paragraphConfig) {
|
|
14214
|
-
const { paragraphStyle = {} } = paragraphConfig;
|
|
14651
|
+
const { paragraphStyle = {}, useWordStyleLineHeight = false } = paragraphConfig;
|
|
14215
14652
|
const { linePitch = 15.6, gridType = GridType.LINES, paragraphLineGapDefault = 0 } = sectionBreakConfig;
|
|
14216
|
-
const
|
|
14653
|
+
const hasDocumentGrid = gridType === GridType.LINES_AND_CHARS || gridType === GridType.SNAP_TO_CHARS;
|
|
14654
|
+
const defaultSnapToGrid = useWordStyleLineHeight && !hasDocumentGrid ? BooleanNumber.FALSE : BooleanNumber.TRUE;
|
|
14655
|
+
const { lineSpacing = 0, spacingRule = SpacingRule.AUTO, snapToGrid = defaultSnapToGrid } = paragraphStyle;
|
|
14217
14656
|
let lineSpacingApply = lineSpacing;
|
|
14218
|
-
if (
|
|
14657
|
+
if (useWordStyleLineHeight && lineSpacing === 0 && spacingRule === SpacingRule.AUTO) lineSpacingApply = 1;
|
|
14658
|
+
else if (!useWordStyleLineHeight && (gridType === GridType.LINES || gridType === GridType.LINES_AND_CHARS) && lineSpacing === 0 && spacingRule === SpacingRule.AUTO) lineSpacingApply = 1;
|
|
14219
14659
|
return {
|
|
14220
14660
|
paragraphLineGapDefault,
|
|
14221
14661
|
linePitch,
|
|
14222
14662
|
gridType,
|
|
14223
14663
|
lineSpacing: lineSpacingApply,
|
|
14224
14664
|
spacingRule,
|
|
14225
|
-
snapToGrid
|
|
14665
|
+
snapToGrid,
|
|
14666
|
+
useWordStyleLineHeight
|
|
14226
14667
|
};
|
|
14227
14668
|
}
|
|
14228
14669
|
function getCharSpaceConfig(sectionBreakConfig, paragraphConfig) {
|
|
@@ -14238,15 +14679,17 @@ function getCharSpaceConfig(sectionBreakConfig, paragraphConfig) {
|
|
|
14238
14679
|
snapToGrid
|
|
14239
14680
|
};
|
|
14240
14681
|
}
|
|
14241
|
-
function updateBlockIndex(pages, start = -1) {
|
|
14682
|
+
function updateBlockIndex(pages, start = -1, documentCompatibilityPolicy) {
|
|
14242
14683
|
let prePageStartIndex = start;
|
|
14684
|
+
const shouldUseLayoutColumnWidth = (documentCompatibilityPolicy === null || documentCompatibilityPolicy === void 0 ? void 0 : documentCompatibilityPolicy.mode) !== "unspecified";
|
|
14243
14685
|
for (const page of pages) {
|
|
14244
|
-
const { sections, skeTables } = page;
|
|
14686
|
+
const { sections, skeTables, skeColumnGroups = /* @__PURE__ */ new Map() } = page;
|
|
14245
14687
|
const pageStartIndex = prePageStartIndex;
|
|
14246
14688
|
let preSectionStartIndex = pageStartIndex;
|
|
14247
14689
|
let maxContentWidth = Number.NEGATIVE_INFINITY;
|
|
14248
14690
|
let contentHeight = 0;
|
|
14249
14691
|
for (const section of sections) {
|
|
14692
|
+
collapseRedundantColumnBreakOverflow(section);
|
|
14250
14693
|
const { columns } = section;
|
|
14251
14694
|
const sectionStartIndex = preSectionStartIndex;
|
|
14252
14695
|
let preColumnStartIndex = sectionStartIndex;
|
|
@@ -14265,6 +14708,16 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14265
14708
|
const table = skeTables.get(tableId);
|
|
14266
14709
|
if (table) lineStartIndex = table.ed;
|
|
14267
14710
|
}
|
|
14711
|
+
if (line.type === 1 && divides.length === 0) {
|
|
14712
|
+
line.st = Math.max(line.st, lineStartIndex + 1);
|
|
14713
|
+
line.ed = Math.max(line.ed, line.st);
|
|
14714
|
+
line.width = 0;
|
|
14715
|
+
line.asc = 0;
|
|
14716
|
+
line.dsc = 0;
|
|
14717
|
+
columnHeight = top + lineHeight;
|
|
14718
|
+
preLineStartIndex = Math.max(preLineStartIndex, line.ed);
|
|
14719
|
+
continue;
|
|
14720
|
+
}
|
|
14268
14721
|
let preDivideStartIndex = lineStartIndex;
|
|
14269
14722
|
let actualWidth = 0;
|
|
14270
14723
|
let maxLineAsc = 0;
|
|
@@ -14304,8 +14757,9 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14304
14757
|
column.st = columStartIndex + 1;
|
|
14305
14758
|
column.ed = preLineStartIndex >= column.st ? preLineStartIndex : column.st;
|
|
14306
14759
|
column.height = columnHeight;
|
|
14307
|
-
column.width
|
|
14308
|
-
|
|
14760
|
+
const measuredColumnWidth = shouldUseLayoutColumnWidth && Number.isFinite(column.width) && column.width > 0 ? column.width : maxColumnWidth;
|
|
14761
|
+
column.width = measuredColumnWidth;
|
|
14762
|
+
sectionWidth += measuredColumnWidth;
|
|
14309
14763
|
maxSectionHeight = Math.max(maxSectionHeight, column.height);
|
|
14310
14764
|
preColumnStartIndex = column.ed;
|
|
14311
14765
|
}
|
|
@@ -14320,6 +14774,10 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14320
14774
|
const { ed } = table;
|
|
14321
14775
|
preSectionStartIndex = Math.max(preSectionStartIndex, ed);
|
|
14322
14776
|
}
|
|
14777
|
+
for (const columnGroup of skeColumnGroups.values()) {
|
|
14778
|
+
const { ed } = columnGroup;
|
|
14779
|
+
preSectionStartIndex = Math.max(preSectionStartIndex, ed);
|
|
14780
|
+
}
|
|
14323
14781
|
page.st = pageStartIndex + 1;
|
|
14324
14782
|
page.ed = preSectionStartIndex >= page.st ? preSectionStartIndex : page.st;
|
|
14325
14783
|
page.height = contentHeight;
|
|
@@ -14327,15 +14785,40 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14327
14785
|
prePageStartIndex = page.ed;
|
|
14328
14786
|
}
|
|
14329
14787
|
}
|
|
14788
|
+
function collapseRedundantColumnBreakOverflow(section) {
|
|
14789
|
+
var _targetColumn$height;
|
|
14790
|
+
const expectedColumnCount = section.colCount || section.columns.length;
|
|
14791
|
+
if (expectedColumnCount <= 0 || section.columns.length <= expectedColumnCount) return;
|
|
14792
|
+
const targetColumn = section.columns[expectedColumnCount - 1];
|
|
14793
|
+
if (!targetColumn) return;
|
|
14794
|
+
const overflowColumns = section.columns.slice(expectedColumnCount);
|
|
14795
|
+
if (!overflowColumns.some((column) => column.lines.length > 0)) return;
|
|
14796
|
+
const targetHeight = (_targetColumn$height = targetColumn.height) !== null && _targetColumn$height !== void 0 ? _targetColumn$height : 0;
|
|
14797
|
+
const overflowLines = overflowColumns.flatMap((column) => column.lines);
|
|
14798
|
+
overflowLines.forEach((line) => {
|
|
14799
|
+
line.top += targetHeight;
|
|
14800
|
+
line.parent = targetColumn;
|
|
14801
|
+
});
|
|
14802
|
+
targetColumn.lines.push(...overflowLines);
|
|
14803
|
+
targetColumn.height = Math.max(...overflowColumns.map((column) => {
|
|
14804
|
+
var _column$height;
|
|
14805
|
+
return targetHeight + ((_column$height = column.height) !== null && _column$height !== void 0 ? _column$height : 0);
|
|
14806
|
+
}), targetHeight);
|
|
14807
|
+
targetColumn.isFull = overflowColumns.some((column) => column.isFull);
|
|
14808
|
+
section.columns.splice(expectedColumnCount);
|
|
14809
|
+
}
|
|
14330
14810
|
function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
14331
14811
|
lineIterator(pages, (line, _, __, page) => {
|
|
14332
|
-
var _ctx$paragraphConfigC, _ctx$skeletonResource;
|
|
14812
|
+
var _ctx$paragraphConfigC, _ctx$skeletonResource, _paragraphStyle$shadi;
|
|
14333
14813
|
const { segmentId } = page;
|
|
14334
14814
|
const paragraphConfig = (_ctx$paragraphConfigC = ctx.paragraphConfigCache.get(segmentId)) === null || _ctx$paragraphConfigC === void 0 ? void 0 : _ctx$paragraphConfigC.get(line.paragraphIndex);
|
|
14335
14815
|
const affectInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphInlineSkeDrawings;
|
|
14816
|
+
const affectNonInlineDrawings = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphNonInlineSkeDrawings;
|
|
14336
14817
|
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);
|
|
14337
|
-
if (affectInlineDrawings && affectInlineDrawings.size > 0) updateInlineDrawingPosition(line, affectInlineDrawings, drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top);
|
|
14818
|
+
if (affectInlineDrawings && affectInlineDrawings.size > 0) updateInlineDrawingPosition(line, affectInlineDrawings, drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.top, affectNonInlineDrawings);
|
|
14338
14819
|
const paragraphStyle = paragraphConfig === null || paragraphConfig === void 0 ? void 0 : paragraphConfig.paragraphStyle;
|
|
14820
|
+
const paragraphBackgroundColor = paragraphStyle === null || paragraphStyle === void 0 || (_paragraphStyle$shadi = paragraphStyle.shading) === null || _paragraphStyle$shadi === void 0 ? void 0 : _paragraphStyle$shadi.backgroundColor;
|
|
14821
|
+
if (paragraphBackgroundColor) line.backgroundColor = paragraphBackgroundColor;
|
|
14339
14822
|
if (line.divides.length > 0) {
|
|
14340
14823
|
const lastDivide = line.divides[line.divides.length - 1];
|
|
14341
14824
|
const lastGlyph = lastDivide.glyphGroup[lastDivide.glyphGroup.length - 1];
|
|
@@ -14375,6 +14858,264 @@ function lineIterator(pagesOrCells, cb) {
|
|
|
14375
14858
|
}
|
|
14376
14859
|
}
|
|
14377
14860
|
}
|
|
14861
|
+
function documentSkeletonTableIterator(pages, options = {}) {
|
|
14862
|
+
const { docsLeft = 0, docsTop = 0, pageMarginTop = 0, resolveViewport = true, tableCellInsetX = 0, unitId = "" } = options;
|
|
14863
|
+
const contexts = [];
|
|
14864
|
+
pages.forEach((rootPage, pageIndex) => {
|
|
14865
|
+
var _rootPage$skeColumnGr;
|
|
14866
|
+
const rootPageTop = ((rootPage.pageHeight === Infinity ? 0 : rootPage.pageHeight) + pageMarginTop) * pageIndex + rootPage.marginTop + docsTop;
|
|
14867
|
+
const rootPageLeft = rootPage.marginLeft + docsLeft;
|
|
14868
|
+
collectPageTables({
|
|
14869
|
+
contexts,
|
|
14870
|
+
docsLeft,
|
|
14871
|
+
page: rootPage,
|
|
14872
|
+
pageIndex,
|
|
14873
|
+
pageLeft: rootPageLeft,
|
|
14874
|
+
pageTop: rootPageTop,
|
|
14875
|
+
rootPage,
|
|
14876
|
+
source: "page",
|
|
14877
|
+
resolveViewport,
|
|
14878
|
+
tableCellInsetX,
|
|
14879
|
+
unitId
|
|
14880
|
+
});
|
|
14881
|
+
(_rootPage$skeColumnGr = rootPage.skeColumnGroups) === null || _rootPage$skeColumnGr === void 0 || _rootPage$skeColumnGr.forEach((columnGroup) => {
|
|
14882
|
+
columnGroup.columns.forEach((columnGroupColumn) => {
|
|
14883
|
+
const nestedPage = columnGroupColumn.page;
|
|
14884
|
+
collectPageTables({
|
|
14885
|
+
contexts,
|
|
14886
|
+
docsLeft,
|
|
14887
|
+
page: nestedPage,
|
|
14888
|
+
pageIndex,
|
|
14889
|
+
pageLeft: rootPageLeft + columnGroup.left + columnGroupColumn.left + nestedPage.marginLeft,
|
|
14890
|
+
pageTop: rootPageTop + columnGroup.top + columnGroupColumn.top + nestedPage.marginTop,
|
|
14891
|
+
rootPage,
|
|
14892
|
+
source: "column",
|
|
14893
|
+
resolveViewport,
|
|
14894
|
+
tableCellInsetX,
|
|
14895
|
+
unitId
|
|
14896
|
+
});
|
|
14897
|
+
});
|
|
14898
|
+
});
|
|
14899
|
+
});
|
|
14900
|
+
return contexts;
|
|
14901
|
+
}
|
|
14902
|
+
function documentSkeletonLineIterator(pages, options, cb) {
|
|
14903
|
+
const { docsLeft = 0, pageMarginTop = 0, tableCellInsetX = 0, unitId = "" } = options;
|
|
14904
|
+
pages.forEach((page, pageIndex) => {
|
|
14905
|
+
var _page$skeTables, _page$skeColumnGroups;
|
|
14906
|
+
const pageTop = ((page.pageHeight === Infinity ? 0 : page.pageHeight) + pageMarginTop) * pageIndex + page.marginTop;
|
|
14907
|
+
const pageLeft = page.marginLeft;
|
|
14908
|
+
visitPageLines(page, {
|
|
14909
|
+
pageIndex,
|
|
14910
|
+
pageLeft,
|
|
14911
|
+
pageTop,
|
|
14912
|
+
source: "page",
|
|
14913
|
+
getBounds: (linePage, column, section) => getPageLineBounds(linePage, column, section.columns.length, pageLeft)
|
|
14914
|
+
}, cb);
|
|
14915
|
+
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table) => {
|
|
14916
|
+
const viewport = getDocsTableRenderViewport(unitId, getSourceTableId(table.tableId));
|
|
14917
|
+
const hasHorizontalViewport = hasDocsTableHorizontalViewport(viewport);
|
|
14918
|
+
const tableViewportLeft = getTableViewportLeft(pageLeft, table.left, viewport, docsLeft);
|
|
14919
|
+
const tableViewportRight = tableViewportLeft + (hasHorizontalViewport ? viewport.viewportWidth : table.width);
|
|
14920
|
+
const tableScrollLeft = hasHorizontalViewport ? viewport.scrollLeft : 0;
|
|
14921
|
+
table.rows.forEach((row) => {
|
|
14922
|
+
row.cells.forEach((cell) => {
|
|
14923
|
+
const cellTop = pageTop + table.top + row.top + cell.marginTop;
|
|
14924
|
+
const cellLeft = pageLeft + table.left + cell.left - tableScrollLeft + cell.marginLeft;
|
|
14925
|
+
const cellContentRight = cellLeft + cell.pageWidth - cell.marginLeft - cell.marginRight;
|
|
14926
|
+
const visualLeft = cellLeft + tableCellInsetX;
|
|
14927
|
+
const visualRight = cellContentRight - tableCellInsetX;
|
|
14928
|
+
const visualWidth = Math.max(0, visualRight - visualLeft);
|
|
14929
|
+
const clipLeft = tableViewportLeft;
|
|
14930
|
+
const clipRight = Math.min(cellContentRight, tableViewportRight);
|
|
14931
|
+
if (visualWidth <= 0 || Math.min(visualRight, clipRight) <= Math.max(visualLeft, clipLeft)) return;
|
|
14932
|
+
visitPageLines(cell, {
|
|
14933
|
+
clipLeft,
|
|
14934
|
+
clipRight,
|
|
14935
|
+
pageIndex,
|
|
14936
|
+
pageLeft: cellLeft,
|
|
14937
|
+
pageTop: cellTop,
|
|
14938
|
+
source: "table-cell",
|
|
14939
|
+
visualLeft,
|
|
14940
|
+
visualWidth
|
|
14941
|
+
}, cb);
|
|
14942
|
+
});
|
|
14943
|
+
});
|
|
14944
|
+
});
|
|
14945
|
+
(_page$skeColumnGroups = page.skeColumnGroups) === null || _page$skeColumnGroups === void 0 || _page$skeColumnGroups.forEach((columnGroup) => {
|
|
14946
|
+
columnGroup.columns.forEach((columnGroupColumn) => {
|
|
14947
|
+
const nestedPage = columnGroupColumn.page;
|
|
14948
|
+
const nestedPageLeft = pageLeft + columnGroup.left + columnGroupColumn.left + nestedPage.marginLeft;
|
|
14949
|
+
const nestedPageTop = pageTop + columnGroup.top + columnGroupColumn.top + nestedPage.marginTop;
|
|
14950
|
+
const visualWidth = Math.max(0, columnGroupColumn.width - nestedPage.marginLeft - nestedPage.marginRight);
|
|
14951
|
+
visitPageLines(nestedPage, {
|
|
14952
|
+
pageIndex,
|
|
14953
|
+
pageLeft: nestedPageLeft,
|
|
14954
|
+
pageTop: nestedPageTop,
|
|
14955
|
+
source: "column",
|
|
14956
|
+
getBounds: (_linePage, column) => ({
|
|
14957
|
+
lineWidth: Math.max(getFiniteWidth(column.width), visualWidth - column.left),
|
|
14958
|
+
visualLeft: nestedPageLeft + column.left,
|
|
14959
|
+
visualWidth: Math.max(getFiniteWidth(column.width), visualWidth - column.left)
|
|
14960
|
+
})
|
|
14961
|
+
}, cb);
|
|
14962
|
+
});
|
|
14963
|
+
});
|
|
14964
|
+
});
|
|
14965
|
+
}
|
|
14966
|
+
function getDocumentSkeletonNestedPageOffset(page) {
|
|
14967
|
+
var _parent$parent, _parent$parent$column;
|
|
14968
|
+
const parent = page.parent;
|
|
14969
|
+
if ((parent === null || parent === void 0 ? void 0 : parent.page) === page && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.columnGroupId) && ((_parent$parent$column = parent.parent.columns) === null || _parent$parent$column === void 0 ? void 0 : _parent$parent$column.includes(parent))) {
|
|
14970
|
+
var _parent$parent$left, _parent$left, _parent$parent$top, _parent$top;
|
|
14971
|
+
return {
|
|
14972
|
+
left: ((_parent$parent$left = parent.parent.left) !== null && _parent$parent$left !== void 0 ? _parent$parent$left : 0) + ((_parent$left = parent.left) !== null && _parent$left !== void 0 ? _parent$left : 0),
|
|
14973
|
+
top: ((_parent$parent$top = parent.parent.top) !== null && _parent$parent$top !== void 0 ? _parent$parent$top : 0) + ((_parent$top = parent.top) !== null && _parent$top !== void 0 ? _parent$top : 0)
|
|
14974
|
+
};
|
|
14975
|
+
}
|
|
14976
|
+
}
|
|
14977
|
+
function getDocumentSkeletonColumnPagePathInfo(position) {
|
|
14978
|
+
var _path$indexOf, _path$indexOf2, _path$indexOf3;
|
|
14979
|
+
const { path } = position;
|
|
14980
|
+
const pagesIndex = (_path$indexOf = path === null || path === void 0 ? void 0 : path.indexOf("pages")) !== null && _path$indexOf !== void 0 ? _path$indexOf : -1;
|
|
14981
|
+
const columnGroupIndex = (_path$indexOf2 = path === null || path === void 0 ? void 0 : path.indexOf("skeColumnGroups")) !== null && _path$indexOf2 !== void 0 ? _path$indexOf2 : -1;
|
|
14982
|
+
const columnsIndex = (_path$indexOf3 = path === null || path === void 0 ? void 0 : path.indexOf("columns")) !== null && _path$indexOf3 !== void 0 ? _path$indexOf3 : -1;
|
|
14983
|
+
if (pagesIndex === -1 || columnGroupIndex === -1 || columnsIndex === -1 || (path === null || path === void 0 ? void 0 : path[columnsIndex + 2]) !== "page") return;
|
|
14984
|
+
const pageIndex = path === null || path === void 0 ? void 0 : path[pagesIndex + 1];
|
|
14985
|
+
const columnGroupId = path === null || path === void 0 ? void 0 : path[columnGroupIndex + 1];
|
|
14986
|
+
const columnIndex = path === null || path === void 0 ? void 0 : path[columnsIndex + 1];
|
|
14987
|
+
if (typeof pageIndex !== "number" || typeof columnGroupId !== "string" || typeof columnIndex !== "number") return;
|
|
14988
|
+
return {
|
|
14989
|
+
columnGroupId,
|
|
14990
|
+
columnIndex,
|
|
14991
|
+
pageIndex
|
|
14992
|
+
};
|
|
14993
|
+
}
|
|
14994
|
+
function compareDocumentSkeletonNestedPagePathOrder(pos1, pos2) {
|
|
14995
|
+
const columnGroupOrder1 = getDocumentSkeletonColumnPagePathInfo(pos1);
|
|
14996
|
+
const columnGroupOrder2 = getDocumentSkeletonColumnPagePathInfo(pos2);
|
|
14997
|
+
if (columnGroupOrder1 && columnGroupOrder2 && columnGroupOrder1.pageIndex === columnGroupOrder2.pageIndex && columnGroupOrder1.columnGroupId === columnGroupOrder2.columnGroupId && columnGroupOrder1.columnIndex !== columnGroupOrder2.columnIndex) return columnGroupOrder1.columnIndex < columnGroupOrder2.columnIndex;
|
|
14998
|
+
}
|
|
14999
|
+
function visitPageLines(page, options, cb) {
|
|
15000
|
+
page.sections.forEach((section) => {
|
|
15001
|
+
section.columns.forEach((column) => {
|
|
15002
|
+
column.lines.forEach((line) => {
|
|
15003
|
+
var _options$getBounds, _ref, _bounds$lineWidth, _bounds$visualLeft, _bounds$visualWidth;
|
|
15004
|
+
const bounds = (_options$getBounds = options.getBounds) === null || _options$getBounds === void 0 ? void 0 : _options$getBounds.call(options, page, column, section);
|
|
15005
|
+
cb({
|
|
15006
|
+
clipLeft: options.clipLeft,
|
|
15007
|
+
clipRight: options.clipRight,
|
|
15008
|
+
column,
|
|
15009
|
+
line,
|
|
15010
|
+
lineWidth: (_ref = (_bounds$lineWidth = bounds === null || bounds === void 0 ? void 0 : bounds.lineWidth) !== null && _bounds$lineWidth !== void 0 ? _bounds$lineWidth : bounds === null || bounds === void 0 ? void 0 : bounds.visualWidth) !== null && _ref !== void 0 ? _ref : getFiniteWidth(column.width),
|
|
15011
|
+
page,
|
|
15012
|
+
pageIndex: options.pageIndex,
|
|
15013
|
+
pageLeft: options.pageLeft,
|
|
15014
|
+
section,
|
|
15015
|
+
sectionTop: options.pageTop + section.top,
|
|
15016
|
+
source: options.source,
|
|
15017
|
+
visualLeft: (_bounds$visualLeft = bounds === null || bounds === void 0 ? void 0 : bounds.visualLeft) !== null && _bounds$visualLeft !== void 0 ? _bounds$visualLeft : options.visualLeft,
|
|
15018
|
+
visualWidth: (_bounds$visualWidth = bounds === null || bounds === void 0 ? void 0 : bounds.visualWidth) !== null && _bounds$visualWidth !== void 0 ? _bounds$visualWidth : options.visualWidth
|
|
15019
|
+
});
|
|
15020
|
+
});
|
|
15021
|
+
});
|
|
15022
|
+
});
|
|
15023
|
+
}
|
|
15024
|
+
function getPageLineBounds(page, column, columnCount, pageLeft) {
|
|
15025
|
+
if (columnCount !== 1 || !Number.isFinite(page.pageWidth)) return;
|
|
15026
|
+
const visualLeft = pageLeft + column.left;
|
|
15027
|
+
const visualRight = page.pageWidth - page.marginRight;
|
|
15028
|
+
const visualWidth = Math.max(0, visualRight - visualLeft);
|
|
15029
|
+
const lineWidth = Math.max(0, page.pageWidth - page.marginLeft - page.marginRight);
|
|
15030
|
+
return visualWidth > 0 ? {
|
|
15031
|
+
lineWidth,
|
|
15032
|
+
visualLeft,
|
|
15033
|
+
visualWidth
|
|
15034
|
+
} : void 0;
|
|
15035
|
+
}
|
|
15036
|
+
function collectPageTables(options) {
|
|
15037
|
+
var _page$skeTables2;
|
|
15038
|
+
const { contexts, docsLeft, page, pageIndex, pageLeft, pageTop, resolveViewport, rootPage, source, tableCellInsetX, unitId } = options;
|
|
15039
|
+
(_page$skeTables2 = page.skeTables) === null || _page$skeTables2 === void 0 || _page$skeTables2.forEach((table, tableId) => {
|
|
15040
|
+
var _table$tableId;
|
|
15041
|
+
const effectiveTableId = (_table$tableId = table.tableId) !== null && _table$tableId !== void 0 ? _table$tableId : tableId;
|
|
15042
|
+
const tableLeft = pageLeft + table.left;
|
|
15043
|
+
const tableTop = pageTop + table.top;
|
|
15044
|
+
const sourceTableId = getSourceTableId(effectiveTableId);
|
|
15045
|
+
const viewport = resolveViewport ? getDocsTableRenderViewport(unitId, sourceTableId) : null;
|
|
15046
|
+
const hasHorizontalViewport = hasDocsTableHorizontalViewport(viewport);
|
|
15047
|
+
const tableViewportLeft = getTableViewportLeft(pageLeft, table.left, viewport, docsLeft);
|
|
15048
|
+
const tableViewportRight = tableViewportLeft + (hasHorizontalViewport ? viewport.viewportWidth : table.width);
|
|
15049
|
+
const tableScrollLeft = hasHorizontalViewport ? viewport.scrollLeft : 0;
|
|
15050
|
+
const cells = [];
|
|
15051
|
+
table.rows.forEach((row, rowIndex) => {
|
|
15052
|
+
row.cells.forEach((cell, columnIndex) => {
|
|
15053
|
+
var _cell$marginLeft, _cell$marginRight, _cell$marginTop, _cell$marginBottom, _cell$pageWidth, _cell$pageHeight, _row$top, _cell$left;
|
|
15054
|
+
if (cell.isMergedCellCovered) return;
|
|
15055
|
+
const cellMarginLeft = (_cell$marginLeft = cell.marginLeft) !== null && _cell$marginLeft !== void 0 ? _cell$marginLeft : 0;
|
|
15056
|
+
const cellMarginRight = (_cell$marginRight = cell.marginRight) !== null && _cell$marginRight !== void 0 ? _cell$marginRight : 0;
|
|
15057
|
+
const cellMarginTop = (_cell$marginTop = cell.marginTop) !== null && _cell$marginTop !== void 0 ? _cell$marginTop : 0;
|
|
15058
|
+
const cellMarginBottom = (_cell$marginBottom = cell.marginBottom) !== null && _cell$marginBottom !== void 0 ? _cell$marginBottom : 0;
|
|
15059
|
+
const cellPageWidth = (_cell$pageWidth = cell.pageWidth) !== null && _cell$pageWidth !== void 0 ? _cell$pageWidth : 0;
|
|
15060
|
+
const cellPageHeight = (_cell$pageHeight = cell.pageHeight) !== null && _cell$pageHeight !== void 0 ? _cell$pageHeight : 0;
|
|
15061
|
+
const cellTop = tableTop + ((_row$top = row.top) !== null && _row$top !== void 0 ? _row$top : 0) + cellMarginTop;
|
|
15062
|
+
const cellLeft = tableLeft + ((_cell$left = cell.left) !== null && _cell$left !== void 0 ? _cell$left : 0) - tableScrollLeft + cellMarginLeft;
|
|
15063
|
+
const cellContentRight = cellLeft + cellPageWidth - cellMarginLeft - cellMarginRight;
|
|
15064
|
+
const visualLeft = cellLeft + tableCellInsetX;
|
|
15065
|
+
const visualRight = cellContentRight - tableCellInsetX;
|
|
15066
|
+
const visualWidth = Math.max(0, visualRight - visualLeft);
|
|
15067
|
+
const clipLeft = tableViewportLeft;
|
|
15068
|
+
const clipRight = Math.min(cellContentRight, tableViewportRight);
|
|
15069
|
+
if (visualWidth <= 0 || Math.min(visualRight, clipRight) <= Math.max(visualLeft, clipLeft)) return;
|
|
15070
|
+
cells.push({
|
|
15071
|
+
cell,
|
|
15072
|
+
cellRect: {
|
|
15073
|
+
bottom: cellTop + cellPageHeight - cellMarginBottom - cellMarginTop,
|
|
15074
|
+
left: Math.max(cellLeft, tableViewportLeft),
|
|
15075
|
+
right: Math.min(cellContentRight, tableViewportRight),
|
|
15076
|
+
top: cellTop
|
|
15077
|
+
},
|
|
15078
|
+
clipLeft,
|
|
15079
|
+
clipRight,
|
|
15080
|
+
columnIndex,
|
|
15081
|
+
pageLeft: cellLeft,
|
|
15082
|
+
pageTop: cellTop,
|
|
15083
|
+
row,
|
|
15084
|
+
rowIndex,
|
|
15085
|
+
visualLeft,
|
|
15086
|
+
visualWidth
|
|
15087
|
+
});
|
|
15088
|
+
});
|
|
15089
|
+
});
|
|
15090
|
+
contexts.push({
|
|
15091
|
+
cells,
|
|
15092
|
+
page,
|
|
15093
|
+
pageIndex,
|
|
15094
|
+
pageLeft,
|
|
15095
|
+
pageTop,
|
|
15096
|
+
rootPage,
|
|
15097
|
+
source,
|
|
15098
|
+
table,
|
|
15099
|
+
tableId: effectiveTableId,
|
|
15100
|
+
tableRect: {
|
|
15101
|
+
bottom: tableTop + table.height,
|
|
15102
|
+
left: tableLeft,
|
|
15103
|
+
right: tableLeft + table.width,
|
|
15104
|
+
top: tableTop
|
|
15105
|
+
}
|
|
15106
|
+
});
|
|
15107
|
+
});
|
|
15108
|
+
}
|
|
15109
|
+
function getTableViewportLeft(pageLeft, tableLeft, viewport, docsLeft) {
|
|
15110
|
+
const viewportLeft = viewport === null || viewport === void 0 ? void 0 : viewport.viewportLeft;
|
|
15111
|
+
return viewportLeft != null ? viewportLeft - docsLeft : pageLeft + tableLeft;
|
|
15112
|
+
}
|
|
15113
|
+
function getSourceTableId(tableId) {
|
|
15114
|
+
return tableId.includes("#-#") ? tableId.split("#-#")[0] : tableId;
|
|
15115
|
+
}
|
|
15116
|
+
function getFiniteWidth(width) {
|
|
15117
|
+
return Number.isFinite(width) ? width : 0;
|
|
15118
|
+
}
|
|
14378
15119
|
function columnIterator(pages, iteratorFunction) {
|
|
14379
15120
|
for (const page of pages) {
|
|
14380
15121
|
const { sections } = page;
|
|
@@ -14397,7 +15138,14 @@ function getPositionHorizon(positionH, column, page, objectWidth, isPageBreak =
|
|
|
14397
15138
|
else if (align === AlignTypeH.CENTER) absoluteLeft = left + width / 2 - objectWidth / 2;
|
|
14398
15139
|
return absoluteLeft;
|
|
14399
15140
|
}
|
|
14400
|
-
if (relativeFrom === ObjectRelativeFromH.LEFT_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.MARGIN) {
|
|
15141
|
+
if (relativeFrom === ObjectRelativeFromH.LEFT_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.MARGIN) {
|
|
15142
|
+
const { pageWidth, marginLeft, marginRight } = page;
|
|
15143
|
+
const marginWidth = pageWidth - marginLeft - marginRight;
|
|
15144
|
+
let absoluteLeft = marginLeft;
|
|
15145
|
+
if (align === AlignTypeH.RIGHT) absoluteLeft = marginLeft + marginWidth - objectWidth;
|
|
15146
|
+
else if (align === AlignTypeH.CENTER) absoluteLeft = marginLeft + marginWidth / 2 - objectWidth / 2;
|
|
15147
|
+
return absoluteLeft;
|
|
15148
|
+
} else if (relativeFrom === ObjectRelativeFromH.RIGHT_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.INSIDE_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.OUTSIDE_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.PAGE) {
|
|
14401
15149
|
const { pageWidth } = page;
|
|
14402
15150
|
let absoluteLeft = 0;
|
|
14403
15151
|
if (align === AlignTypeH.RIGHT) absoluteLeft = pageWidth - objectWidth;
|
|
@@ -14405,14 +15153,12 @@ function getPositionHorizon(positionH, column, page, objectWidth, isPageBreak =
|
|
|
14405
15153
|
return absoluteLeft;
|
|
14406
15154
|
}
|
|
14407
15155
|
}
|
|
14408
|
-
else if (posOffset) {
|
|
14409
|
-
const { pageWidth, marginLeft, marginRight } = page;
|
|
14410
|
-
const boundaryRight = pageWidth - marginRight;
|
|
15156
|
+
else if (posOffset != null) {
|
|
14411
15157
|
let absoluteLeft = 0;
|
|
15158
|
+
const { marginLeft } = page;
|
|
14412
15159
|
if (relativeFrom === ObjectRelativeFromH.COLUMN) absoluteLeft = (isPageBreak ? 0 : (column === null || column === void 0 ? void 0 : column.left) || 0) + posOffset;
|
|
14413
15160
|
else if (relativeFrom === ObjectRelativeFromH.LEFT_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.MARGIN) absoluteLeft = posOffset + marginLeft;
|
|
14414
15161
|
else if (relativeFrom === ObjectRelativeFromH.RIGHT_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.INSIDE_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.OUTSIDE_MARGIN) {} else if (relativeFrom === ObjectRelativeFromH.PAGE) absoluteLeft = posOffset;
|
|
14415
|
-
if (absoluteLeft + objectWidth > boundaryRight) absoluteLeft = boundaryRight - objectWidth;
|
|
14416
15162
|
return absoluteLeft;
|
|
14417
15163
|
} else if (percent) {
|
|
14418
15164
|
const { pageWidth, marginLeft, marginRight } = page;
|
|
@@ -14474,9 +15220,9 @@ function getFontConfigFromLastGlyph(glyph, sectionBreakConfig, paragraphStyle) {
|
|
|
14474
15220
|
};
|
|
14475
15221
|
}
|
|
14476
15222
|
function getBulletParagraphTextStyle(bullet, viewModel) {
|
|
14477
|
-
var _lists$listType
|
|
15223
|
+
var _lists$listType;
|
|
14478
15224
|
const { listType } = bullet;
|
|
14479
|
-
return (_lists$listType
|
|
15225
|
+
return (_lists$listType = viewModel.getDataModel().getBulletPresetList()[listType]) === null || _lists$listType === void 0 || (_lists$listType = _lists$listType.nestingLevel) === null || _lists$listType === void 0 || (_lists$listType = _lists$listType[0]) === null || _lists$listType === void 0 || (_lists$listType = _lists$listType.paragraphProperties) === null || _lists$listType === void 0 ? void 0 : _lists$listType.textStyle;
|
|
14480
15226
|
}
|
|
14481
15227
|
const DEFAULT_TEXT_RUN = {
|
|
14482
15228
|
ts: {},
|
|
@@ -14484,6 +15230,7 @@ const DEFAULT_TEXT_RUN = {
|
|
|
14484
15230
|
ed: 0
|
|
14485
15231
|
};
|
|
14486
15232
|
function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph) {
|
|
15233
|
+
var _sectionBreakConfig$d;
|
|
14487
15234
|
const { gridType = GridType.LINES, charSpace = 0, documentTextStyle = {}, pageSize = {
|
|
14488
15235
|
width: Number.POSITIVE_INFINITY,
|
|
14489
15236
|
height: Number.POSITIVE_INFINITY
|
|
@@ -14515,16 +15262,20 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
|
|
|
14515
15262
|
...customRangeStyle,
|
|
14516
15263
|
...bulletTextStyle
|
|
14517
15264
|
};
|
|
15265
|
+
const fontStyle = getFontStyleString(textStyle);
|
|
15266
|
+
const mixTextStyle = {
|
|
15267
|
+
...documentTextStyle,
|
|
15268
|
+
...textStyle
|
|
15269
|
+
};
|
|
15270
|
+
const pageWidth = pageSize.width || Number.POSITIVE_INFINITY - marginLeft - marginRight;
|
|
14518
15271
|
const result = {
|
|
14519
|
-
fontStyle
|
|
14520
|
-
textStyle:
|
|
14521
|
-
...documentTextStyle,
|
|
14522
|
-
...textStyle
|
|
14523
|
-
},
|
|
15272
|
+
fontStyle,
|
|
15273
|
+
textStyle: mixTextStyle,
|
|
14524
15274
|
charSpace,
|
|
14525
15275
|
gridType,
|
|
14526
15276
|
snapToGrid,
|
|
14527
|
-
|
|
15277
|
+
documentCompatibilityPolicy: (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy(),
|
|
15278
|
+
pageWidth
|
|
14528
15279
|
};
|
|
14529
15280
|
if (!hasAddonStyle && originTextRun) fontCreateConfigCache.setValue(st, ed, result);
|
|
14530
15281
|
return result;
|
|
@@ -14659,17 +15410,6 @@ function resetContext(ctx) {
|
|
|
14659
15410
|
ctx.isDirty = false;
|
|
14660
15411
|
(_ctx$skeleton$drawing = ctx.skeleton.drawingAnchor) === null || _ctx$skeleton$drawing === void 0 || _ctx$skeleton$drawing.clear();
|
|
14661
15412
|
}
|
|
14662
|
-
function mergeByV(object, originObject, type) {
|
|
14663
|
-
const mergeIterator = (obj, originObj, key) => {
|
|
14664
|
-
if (key !== "v") if (typeof originObj === "object") return mergeWith(obj, originObj, mergeIterator);
|
|
14665
|
-
else return originObj !== null && originObj !== void 0 ? originObj : obj;
|
|
14666
|
-
if (typeof originObj === "number") {
|
|
14667
|
-
if (typeof obj === "number") return type === "max" ? Math.max(originObj, obj) : Math.min(originObj, obj);
|
|
14668
|
-
}
|
|
14669
|
-
return originObj !== null && originObj !== void 0 ? originObj : obj;
|
|
14670
|
-
};
|
|
14671
|
-
return mergeWith(object, originObject, mergeIterator);
|
|
14672
|
-
}
|
|
14673
15413
|
function getPageFromPath(skeletonData, path) {
|
|
14674
15414
|
const pathCopy = [...path];
|
|
14675
15415
|
let page = null;
|
|
@@ -14686,6 +15426,13 @@ function getPageFromPath(skeletonData, path) {
|
|
|
14686
15426
|
pathCopy.shift();
|
|
14687
15427
|
const cellIndex = pathCopy.shift();
|
|
14688
15428
|
page = (_skeTables = page.skeTables) === null || _skeTables === void 0 || (_skeTables = _skeTables.get(tableId)) === null || _skeTables === void 0 || (_skeTables = _skeTables.rows[rowIndex]) === null || _skeTables === void 0 ? void 0 : _skeTables.cells[cellIndex];
|
|
15429
|
+
} else if (field === "skeColumnGroups") {
|
|
15430
|
+
var _skeColumnGroups;
|
|
15431
|
+
const columnGroupId = pathCopy.shift();
|
|
15432
|
+
pathCopy.shift();
|
|
15433
|
+
const columnIndex = pathCopy.shift();
|
|
15434
|
+
pathCopy.shift();
|
|
15435
|
+
page = (_skeColumnGroups = page.skeColumnGroups) === null || _skeColumnGroups === void 0 || (_skeColumnGroups = _skeColumnGroups.get(columnGroupId)) === null || _skeColumnGroups === void 0 || (_skeColumnGroups = _skeColumnGroups.columns[columnIndex]) === null || _skeColumnGroups === void 0 ? void 0 : _skeColumnGroups.page;
|
|
14689
15436
|
}
|
|
14690
15437
|
}
|
|
14691
15438
|
return page;
|
|
@@ -14735,7 +15482,7 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
14735
15482
|
header = (_skeHeaders$get2 = skeHeaders.get(headerId)) === null || _skeHeaders$get2 === void 0 ? void 0 : _skeHeaders$get2.get(pageWidth);
|
|
14736
15483
|
} else if (headerTreeMap && headerTreeMap.has(headerId)) {
|
|
14737
15484
|
header = _createSkeletonHeaderFooter(ctx, headerTreeMap.get(headerId), sectionBreakConfig, skeletonResourceReference, headerId, true);
|
|
14738
|
-
skeHeaders.set(headerId, new Map([[pageWidth, header]]));
|
|
15485
|
+
skeHeaders.set(headerId, /* @__PURE__ */ new Map([[pageWidth, header]]));
|
|
14739
15486
|
}
|
|
14740
15487
|
page.headerId = headerId;
|
|
14741
15488
|
}
|
|
@@ -14746,7 +15493,7 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
14746
15493
|
footer = (_skeFooters$get2 = skeFooters.get(footerId)) === null || _skeFooters$get2 === void 0 ? void 0 : _skeFooters$get2.get(pageWidth);
|
|
14747
15494
|
} else if (footerTreeMap && footerTreeMap.has(footerId)) {
|
|
14748
15495
|
footer = _createSkeletonHeaderFooter(ctx, footerTreeMap.get(footerId), sectionBreakConfig, skeletonResourceReference, footerId, false);
|
|
14749
|
-
skeFooters.set(footerId, new Map([[pageWidth, footer]]));
|
|
15496
|
+
skeFooters.set(footerId, /* @__PURE__ */ new Map([[pageWidth, footer]]));
|
|
14750
15497
|
}
|
|
14751
15498
|
page.footerId = footerId;
|
|
14752
15499
|
}
|
|
@@ -14792,11 +15539,13 @@ function _getNullPage(type = 0, segmentId = "") {
|
|
|
14792
15539
|
ed: 0,
|
|
14793
15540
|
skeDrawings: /* @__PURE__ */ new Map(),
|
|
14794
15541
|
skeTables: /* @__PURE__ */ new Map(),
|
|
15542
|
+
skeColumnGroups: /* @__PURE__ */ new Map(),
|
|
14795
15543
|
type,
|
|
14796
15544
|
segmentId
|
|
14797
15545
|
};
|
|
14798
15546
|
}
|
|
14799
15547
|
function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader = true, areaPage, count = 0) {
|
|
15548
|
+
var _sectionBreakConfig$d;
|
|
14800
15549
|
const { lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
14801
15550
|
const pageWidth = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || Number.POSITIVE_INFINITY;
|
|
14802
15551
|
const pageHeight = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || Number.POSITIVE_INFINITY;
|
|
@@ -14824,7 +15573,7 @@ function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakC
|
|
|
14824
15573
|
resetContext(ctx);
|
|
14825
15574
|
return _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader, areaPage, count);
|
|
14826
15575
|
}
|
|
14827
|
-
updateBlockIndex([page]);
|
|
15576
|
+
updateBlockIndex([page], -1, (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy());
|
|
14828
15577
|
if (isHeader) Object.assign(page, {
|
|
14829
15578
|
marginTop: marginHeader,
|
|
14830
15579
|
marginBottom: 5
|
|
@@ -14841,9 +15590,22 @@ function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, avai
|
|
|
14841
15590
|
const { skeletonResourceReference } = ctx;
|
|
14842
15591
|
const { cellMargin, tableRows, tableColumns, tableId } = tableConfig;
|
|
14843
15592
|
const cellConfig = tableRows[row].tableCells[col];
|
|
14844
|
-
|
|
15593
|
+
let { start = { v: 10 }, end = { v: 10 }, top = { v: 5 }, bottom = { v: 5 } } = (_ref = (_cellConfig$margin = cellConfig.margin) !== null && _cellConfig$margin !== void 0 ? _cellConfig$margin : cellMargin) !== null && _ref !== void 0 ? _ref : {};
|
|
14845
15594
|
const columnSpan = Math.max(1, (_cellConfig$columnSpa = cellConfig.columnSpan) !== null && _cellConfig$columnSpa !== void 0 ? _cellConfig$columnSpa : 1);
|
|
14846
15595
|
const pageWidth = tableColumns.slice(col, col + columnSpan).reduce((sum, column) => sum + column.size.width.v, 0);
|
|
15596
|
+
if (start.v + end.v >= pageWidth) {
|
|
15597
|
+
const marginWidth = start.v + end.v;
|
|
15598
|
+
const availableMarginWidth = Math.max(0, pageWidth - 1);
|
|
15599
|
+
const startRatio = marginWidth > 0 ? start.v / marginWidth : .5;
|
|
15600
|
+
start = {
|
|
15601
|
+
...start,
|
|
15602
|
+
v: availableMarginWidth * startRatio
|
|
15603
|
+
};
|
|
15604
|
+
end = {
|
|
15605
|
+
...end,
|
|
15606
|
+
v: availableMarginWidth - start.v
|
|
15607
|
+
};
|
|
15608
|
+
}
|
|
14847
15609
|
const pageHeight = maxCellPageHeight;
|
|
14848
15610
|
const cellSectionBreakConfig = {
|
|
14849
15611
|
lists,
|
|
@@ -14872,7 +15634,7 @@ function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, avai
|
|
|
14872
15634
|
};
|
|
14873
15635
|
}
|
|
14874
15636
|
function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY) {
|
|
14875
|
-
var _ctx$dataModel, _ctx$dataModel$getBod;
|
|
15637
|
+
var _sectionBreakConfig$d2, _ctx$dataModel, _ctx$dataModel$getBod;
|
|
14876
15638
|
const sectionNode = cellNode.children[0];
|
|
14877
15639
|
const { page: areaPage, sectionBreakConfig: cellSectionBreakConfig } = createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight, maxCellPageHeight);
|
|
14878
15640
|
const { pages } = dealWithSection(ctx, viewModel, sectionNode, areaPage, cellSectionBreakConfig);
|
|
@@ -14880,8 +15642,8 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
14880
15642
|
p.type = 3;
|
|
14881
15643
|
p.segmentId = tableConfig.tableId;
|
|
14882
15644
|
}
|
|
14883
|
-
updateBlockIndex(pages, cellNode.startIndex);
|
|
14884
|
-
|
|
15645
|
+
updateBlockIndex(pages, cellNode.startIndex, (_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d2 !== void 0 ? _sectionBreakConfig$d2 : getDocumentCompatibilityPolicy());
|
|
15646
|
+
applyTrailingBlockRangeSpaceBelow(pages, (_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), cellNode.endIndex);
|
|
14885
15647
|
updateInlineDrawingCoordsAndBorder(ctx, pages);
|
|
14886
15648
|
expandCellPageHeightForInlineDrawings(pages);
|
|
14887
15649
|
return pages;
|
|
@@ -14897,7 +15659,7 @@ function expandCellPageHeightForInlineDrawings(pages) {
|
|
|
14897
15659
|
});
|
|
14898
15660
|
}
|
|
14899
15661
|
}
|
|
14900
|
-
function
|
|
15662
|
+
function applyTrailingBlockRangeSpaceBelow(pages, body, containerEndIndex) {
|
|
14901
15663
|
const blockRanges = body === null || body === void 0 ? void 0 : body.blockRanges;
|
|
14902
15664
|
const trailingBlockRangeSpace = 28;
|
|
14903
15665
|
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) return;
|
|
@@ -14907,15 +15669,12 @@ function applyTrailingCellBlockRangeSpaceBelow(pages, body, cellEndIndex) {
|
|
|
14907
15669
|
if (!lastLine) continue;
|
|
14908
15670
|
const paragraphIndex = lastLine.paragraphIndex;
|
|
14909
15671
|
if (!blockRanges.some((range) => range.startIndex < paragraphIndex && paragraphIndex < range.endIndex)) continue;
|
|
14910
|
-
if (body === null || body === void 0 || (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.some((paragraph) => paragraph.startIndex > paragraphIndex && paragraph.startIndex <
|
|
15672
|
+
if (body === null || body === void 0 || (_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.some((paragraph) => paragraph.startIndex > paragraphIndex && paragraph.startIndex < containerEndIndex)) continue;
|
|
14911
15673
|
page.height += lastLine.spaceBelowApply || trailingBlockRangeSpace;
|
|
14912
15674
|
}
|
|
14913
15675
|
}
|
|
14914
|
-
function _getVerticalMargin(marginTB,
|
|
14915
|
-
|
|
14916
|
-
const HeaderFooterPageHeight = headerOrFooter.height + headerOrFooter.marginTop + headerOrFooter.marginBottom;
|
|
14917
|
-
const maxMargin = getHeaderFooterMaxHeight(pageHeight);
|
|
14918
|
-
return Math.min(maxMargin, Math.max(marginTB, HeaderFooterPageHeight));
|
|
15676
|
+
function _getVerticalMargin(marginTB, _headerOrFooter, _pageHeight) {
|
|
15677
|
+
return marginTB;
|
|
14919
15678
|
}
|
|
14920
15679
|
|
|
14921
15680
|
//#endregion
|
|
@@ -15022,13 +15781,41 @@ function adjustGlyphsInDivide(divide, justificationRatio, extraJustification) {
|
|
|
15022
15781
|
}
|
|
15023
15782
|
setGlyphGroupLeft(divide.glyphGroup);
|
|
15024
15783
|
}
|
|
15784
|
+
function distributeGlyphsInDivide(divide, remaining) {
|
|
15785
|
+
if (remaining <= 0) return false;
|
|
15786
|
+
const visibleGlyphs = divide.glyphGroup.filter((glyph) => glyph.content !== "" && glyph.width > 0);
|
|
15787
|
+
if (visibleGlyphs.length < 2) return false;
|
|
15788
|
+
const extraGap = remaining / (visibleGlyphs.length - 1);
|
|
15789
|
+
for (let i = 0; i < visibleGlyphs.length - 1; i++) visibleGlyphs[i].width += extraGap;
|
|
15790
|
+
setGlyphGroupLeft(divide.glyphGroup);
|
|
15791
|
+
return true;
|
|
15792
|
+
}
|
|
15025
15793
|
/**
|
|
15026
15794
|
* When aligning text horizontally within a document,
|
|
15027
15795
|
* it may be ineffective if the total line width is not initially calculated.
|
|
15028
15796
|
* Therefore, multiple calculations are performed, which may impact performance.
|
|
15029
15797
|
* Needs optimization for efficiency.
|
|
15030
15798
|
*/
|
|
15031
|
-
function
|
|
15799
|
+
function shouldAllowOverflowHorizontalOffset(sectionBreakConfig) {
|
|
15800
|
+
var _sectionBreakConfig$r;
|
|
15801
|
+
return ((_sectionBreakConfig$r = sectionBreakConfig.renderConfig) === null || _sectionBreakConfig$r === void 0 ? void 0 : _sectionBreakConfig$r.wrapStrategy) === WrapStrategy.OVERFLOW;
|
|
15802
|
+
}
|
|
15803
|
+
function getGlyphGroupInkBounds(divide) {
|
|
15804
|
+
if (divide.glyphGroup.length === 0) return null;
|
|
15805
|
+
let left = Infinity;
|
|
15806
|
+
let right = -Infinity;
|
|
15807
|
+
for (const glyph of divide.glyphGroup) {
|
|
15808
|
+
const glyphLeft = glyph.left + glyph.xOffset;
|
|
15809
|
+
left = Math.min(left, glyphLeft);
|
|
15810
|
+
right = Math.max(right, glyphLeft + glyph.bBox.width);
|
|
15811
|
+
}
|
|
15812
|
+
if (!Number.isFinite(left) || !Number.isFinite(right)) return null;
|
|
15813
|
+
return {
|
|
15814
|
+
left,
|
|
15815
|
+
right
|
|
15816
|
+
};
|
|
15817
|
+
}
|
|
15818
|
+
function horizontalAlignHandler(line, horizontalAlign, allowOverflowHorizontalOffset = false) {
|
|
15032
15819
|
const { divides } = line;
|
|
15033
15820
|
for (let i = 0; i < divides.length; i++) {
|
|
15034
15821
|
const divide = divides[i];
|
|
@@ -15067,9 +15854,18 @@ function horizontalAlignHandler(line, horizontalAlign) {
|
|
|
15067
15854
|
divide.glyphGroupWidth = glyphGroupWidth;
|
|
15068
15855
|
}
|
|
15069
15856
|
}
|
|
15070
|
-
|
|
15857
|
+
const inkBounds = allowOverflowHorizontalOffset ? getGlyphGroupInkBounds(divide) : null;
|
|
15858
|
+
if (horizontalAlign === HorizontalAlign.DISTRIBUTED) {
|
|
15859
|
+
if (distributeGlyphsInDivide(divide, width - glyphGroupWidth)) {
|
|
15860
|
+
glyphGroupWidth = getGlyphGroupWidth(divide);
|
|
15861
|
+
divide.glyphGroupWidth = glyphGroupWidth;
|
|
15862
|
+
}
|
|
15863
|
+
divide.paddingLeft = 0;
|
|
15864
|
+
} else if (horizontalAlign === HorizontalAlign.CENTER && inkBounds) divide.paddingLeft = width / 2 - (inkBounds.left + inkBounds.right) / 2;
|
|
15865
|
+
else if (horizontalAlign === HorizontalAlign.RIGHT && inkBounds) divide.paddingLeft = width - inkBounds.right;
|
|
15866
|
+
else if (horizontalAlign === HorizontalAlign.CENTER) divide.paddingLeft = (width - glyphGroupWidth) / 2;
|
|
15071
15867
|
else if (horizontalAlign === HorizontalAlign.RIGHT) divide.paddingLeft = width - glyphGroupWidth;
|
|
15072
|
-
divide.paddingLeft = Math.max(divide.paddingLeft, 0);
|
|
15868
|
+
if (!allowOverflowHorizontalOffset) divide.paddingLeft = Math.max(divide.paddingLeft, 0);
|
|
15073
15869
|
}
|
|
15074
15870
|
}
|
|
15075
15871
|
function restoreLastCJKGlyphWidth(line) {
|
|
@@ -15114,7 +15910,10 @@ function addHyphenDash(line, viewModel, paragraphNode, sectionBreakConfig, parag
|
|
|
15114
15910
|
}
|
|
15115
15911
|
function lineAdjustment(pages, viewModel, paragraphNode, sectionBreakConfig) {
|
|
15116
15912
|
const { endIndex } = paragraphNode;
|
|
15117
|
-
const paragraph = viewModel.getParagraph(endIndex) || {
|
|
15913
|
+
const paragraph = viewModel.getParagraph(endIndex) || {
|
|
15914
|
+
startIndex: 0,
|
|
15915
|
+
paragraphId: "para_render_fallback"
|
|
15916
|
+
};
|
|
15118
15917
|
lineIterator(pages, (line) => {
|
|
15119
15918
|
if (line.paragraphIndex !== paragraph.startIndex) return;
|
|
15120
15919
|
const { paragraphStyle = {} } = paragraph;
|
|
@@ -15122,7 +15921,7 @@ function lineAdjustment(pages, viewModel, paragraphNode, sectionBreakConfig) {
|
|
|
15122
15921
|
shrinkStartAndEndCJKPunctuation(line);
|
|
15123
15922
|
restoreLastCJKGlyphWidth(line);
|
|
15124
15923
|
addHyphenDash(line, viewModel, paragraphNode, sectionBreakConfig, paragraphStyle);
|
|
15125
|
-
horizontalAlignHandler(line, horizontalAlign);
|
|
15924
|
+
horizontalAlignHandler(line, horizontalAlign, shouldAllowOverflowHorizontalOffset(sectionBreakConfig));
|
|
15126
15925
|
});
|
|
15127
15926
|
}
|
|
15128
15927
|
|
|
@@ -15317,11 +16116,51 @@ function ___getLevelAndSuffix(levelAndSuffixPre) {
|
|
|
15317
16116
|
|
|
15318
16117
|
//#endregion
|
|
15319
16118
|
//#region src/components/docs/layout/block/paragraph/linebreaking.ts
|
|
15320
|
-
const BLOCK_LAYOUT_OUTER_SPACING_MAP = new Map([
|
|
15321
|
-
[
|
|
15322
|
-
[
|
|
15323
|
-
[
|
|
16119
|
+
const BLOCK_LAYOUT_OUTER_SPACING_MAP = /* @__PURE__ */ new Map([
|
|
16120
|
+
[DocumentBlockRangeType.CALLOUT, 34],
|
|
16121
|
+
[DocumentBlockRangeType.CODE, 32],
|
|
16122
|
+
[DocumentBlockRangeType.QUOTE, 24]
|
|
15324
16123
|
]);
|
|
16124
|
+
function _endsWithToken(text, glyphs, token) {
|
|
16125
|
+
var _glyphs, _glyphs2;
|
|
16126
|
+
return text.endsWith(token) || ((_glyphs = glyphs[glyphs.length - 1]) === null || _glyphs === void 0 ? void 0 : _glyphs.raw) === token || ((_glyphs2 = glyphs[glyphs.length - 1]) === null || _glyphs2 === void 0 ? void 0 : _glyphs2.streamType) === token;
|
|
16127
|
+
}
|
|
16128
|
+
function _isMarkedDocxColumnBreak(viewModel, absoluteIndex) {
|
|
16129
|
+
const customRange = viewModel.getCustomRange(absoluteIndex);
|
|
16130
|
+
const properties = customRange === null || customRange === void 0 ? void 0 : customRange.properties;
|
|
16131
|
+
return (properties === null || properties === void 0 ? void 0 : properties.docxBreakType) === "column";
|
|
16132
|
+
}
|
|
16133
|
+
function _glyphCount(glyphs) {
|
|
16134
|
+
return glyphs.reduce((count, glyph) => count + glyph.count, 0);
|
|
16135
|
+
}
|
|
16136
|
+
function _isDocxColumnBreakVisuallyBlankColumn(column) {
|
|
16137
|
+
return column.lines.every((line) => line.divides.every((divide) => divide.glyphGroup.every((glyph) => {
|
|
16138
|
+
const { glyphType, raw, streamType, width } = glyph;
|
|
16139
|
+
const isParagraphMark = raw === DataStreamTreeTokenType.PARAGRAPH || streamType === DataStreamTreeTokenType.PARAGRAPH;
|
|
16140
|
+
const isColumnBreak = width === 0 && (raw === DataStreamTreeTokenType.COLUMN_BREAK || streamType === DataStreamTreeTokenType.COLUMN_BREAK);
|
|
16141
|
+
return glyphType === 4 || glyphType === 2 || isParagraphMark || isColumnBreak;
|
|
16142
|
+
})));
|
|
16143
|
+
}
|
|
16144
|
+
function _hasOnlyCustomBlockGlyphs(glyphs) {
|
|
16145
|
+
return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK);
|
|
16146
|
+
}
|
|
16147
|
+
function _mergeAdjacentCustomBlockShapedTexts(shapedTextList) {
|
|
16148
|
+
const mergedShapedTextList = [];
|
|
16149
|
+
for (const shapedText of shapedTextList) {
|
|
16150
|
+
const lastShapedText = mergedShapedTextList[mergedShapedTextList.length - 1];
|
|
16151
|
+
if (lastShapedText && _hasOnlyCustomBlockGlyphs(lastShapedText.glyphs) && _hasOnlyCustomBlockGlyphs(shapedText.glyphs)) {
|
|
16152
|
+
lastShapedText.text += shapedText.text;
|
|
16153
|
+
lastShapedText.glyphs.push(...shapedText.glyphs);
|
|
16154
|
+
lastShapedText.breakPointType = shapedText.breakPointType;
|
|
16155
|
+
continue;
|
|
16156
|
+
}
|
|
16157
|
+
mergedShapedTextList.push({
|
|
16158
|
+
...shapedText,
|
|
16159
|
+
glyphs: [...shapedText.glyphs]
|
|
16160
|
+
});
|
|
16161
|
+
}
|
|
16162
|
+
return mergedShapedTextList;
|
|
16163
|
+
}
|
|
15325
16164
|
function _getListLevelAncestors(bullet, listLevel) {
|
|
15326
16165
|
if (!bullet || !listLevel) return;
|
|
15327
16166
|
const { listId, nestingLevel } = bullet;
|
|
@@ -15358,7 +16197,9 @@ function _withMinSpacing(style, key, value) {
|
|
|
15358
16197
|
};
|
|
15359
16198
|
}
|
|
15360
16199
|
function _getNextAdjacentBlockRange(blockRanges, blockRange) {
|
|
15361
|
-
|
|
16200
|
+
let nextBlockRange;
|
|
16201
|
+
for (const range of blockRanges !== null && blockRanges !== void 0 ? blockRanges : []) if (range.startIndex > blockRange.endIndex && (!nextBlockRange || range.startIndex < nextBlockRange.startIndex)) nextBlockRange = range;
|
|
16202
|
+
return nextBlockRange;
|
|
15362
16203
|
}
|
|
15363
16204
|
function _hasNextAdjacentLayoutBlockRange(blockRanges, blockRange) {
|
|
15364
16205
|
const nextBlockRange = _getNextAdjacentBlockRange(blockRanges, blockRange);
|
|
@@ -15392,12 +16233,23 @@ function _applyBlockRangeLayoutParagraphStyle(body, paragraph, paragraphStyle, s
|
|
|
15392
16233
|
if ((lastParagraph === null || lastParagraph === void 0 ? void 0 : lastParagraph.startIndex) === paragraph.startIndex && !_hasNextAdjacentLayoutBlockRange(blockRanges, blockRange)) _withMinSpacing(style, "spaceBelow", outerSpacing);
|
|
15393
16234
|
return style;
|
|
15394
16235
|
}
|
|
15395
|
-
function
|
|
15396
|
-
var
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
16236
|
+
function _isOnlyFloatingCustomBlockParagraph(viewModel, paragraphNode, drawings) {
|
|
16237
|
+
var _paragraphNode$blocks, _paragraphNode$conten;
|
|
16238
|
+
if (!((_paragraphNode$blocks = paragraphNode.blocks) === null || _paragraphNode$blocks === void 0 ? void 0 : _paragraphNode$blocks.length)) return false;
|
|
16239
|
+
if (!((_paragraphNode$conten = paragraphNode.content) !== null && _paragraphNode$conten !== void 0 ? _paragraphNode$conten : "").split("").every((char) => char === DataStreamTreeTokenType.CUSTOM_BLOCK || char === DataStreamTreeTokenType.PARAGRAPH || char === DataStreamTreeTokenType.SECTION_BREAK)) return false;
|
|
16240
|
+
return paragraphNode.blocks.every((charIndex) => {
|
|
16241
|
+
const customBlock = viewModel.getCustomBlock(charIndex);
|
|
16242
|
+
const drawing = customBlock == null ? null : drawings[customBlock.blockId];
|
|
16243
|
+
return drawing != null && drawing.layoutType !== PositionedObjectLayoutType.INLINE;
|
|
16244
|
+
});
|
|
16245
|
+
}
|
|
16246
|
+
function _getFollowingIndentedParagraphAnchorLeft(viewModel, paragraph, paragraphNode, drawings, isTraditionalDocument) {
|
|
16247
|
+
var _paragraph$paragraphS, _paragraph$paragraphS2, _viewModel$getBody$pa, _viewModel$getBody, _paragraphs$0$paragra, _paragraphs$, _paragraphs$0$paragra2;
|
|
16248
|
+
if (!isTraditionalDocument) return;
|
|
16249
|
+
if (((_paragraph$paragraphS = (_paragraph$paragraphS2 = paragraph.paragraphStyle) === null || _paragraph$paragraphS2 === void 0 || (_paragraph$paragraphS2 = _paragraph$paragraphS2.indentStart) === null || _paragraph$paragraphS2 === void 0 ? void 0 : _paragraph$paragraphS2.v) !== null && _paragraph$paragraphS !== void 0 ? _paragraph$paragraphS : 0) > 0) return;
|
|
16250
|
+
if (!_isOnlyFloatingCustomBlockParagraph(viewModel, paragraphNode, drawings)) return;
|
|
16251
|
+
const paragraphs = [...(_viewModel$getBody$pa = (_viewModel$getBody = viewModel.getBody) === null || _viewModel$getBody === void 0 || (_viewModel$getBody = _viewModel$getBody.call(viewModel)) === null || _viewModel$getBody === void 0 ? void 0 : _viewModel$getBody.paragraphs) !== null && _viewModel$getBody$pa !== void 0 ? _viewModel$getBody$pa : []].filter((item) => item.startIndex > paragraph.startIndex).sort((left, right) => left.startIndex - right.startIndex);
|
|
16252
|
+
return ((_paragraphs$0$paragra = (_paragraphs$ = paragraphs[0]) === null || _paragraphs$ === void 0 || (_paragraphs$ = _paragraphs$.paragraphStyle) === null || _paragraphs$ === void 0 || (_paragraphs$ = _paragraphs$.indentStart) === null || _paragraphs$ === void 0 ? void 0 : _paragraphs$.v) !== null && _paragraphs$0$paragra !== void 0 ? _paragraphs$0$paragra : 0) > 0 ? (_paragraphs$0$paragra2 = paragraphs[0].paragraphStyle) === null || _paragraphs$0$paragra2 === void 0 ? void 0 : _paragraphs$0$paragra2.indentStart : void 0;
|
|
15401
16253
|
}
|
|
15402
16254
|
function _getDrawingSkeletonFormat(drawingOrigin) {
|
|
15403
16255
|
const { drawingId } = drawingOrigin;
|
|
@@ -15421,16 +16273,24 @@ function _getNextPageNumber(lastPage) {
|
|
|
15421
16273
|
return lastPage.pageNumber + 1;
|
|
15422
16274
|
}
|
|
15423
16275
|
function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, sectionBreakConfig, tableSkeleton) {
|
|
15424
|
-
var _viewModel$
|
|
16276
|
+
var _sectionBreakConfig$d, _viewModel$getSnapsho, _viewModel$getBody2, _viewModel$getBody3;
|
|
15425
16277
|
const { skeletonResourceReference } = ctx;
|
|
15426
16278
|
const { lists, drawings = {}, localeService } = sectionBreakConfig;
|
|
15427
16279
|
const { endIndex, blocks = [], children } = paragraphNode;
|
|
15428
16280
|
const { segmentId } = curPage;
|
|
15429
|
-
const paragraph = viewModel.getParagraph(endIndex) || {
|
|
16281
|
+
const paragraph = viewModel.getParagraph(endIndex) || {
|
|
16282
|
+
startIndex: 0,
|
|
16283
|
+
paragraphId: "para_render_fallback"
|
|
16284
|
+
};
|
|
15430
16285
|
const { paragraphStyle = {}, bullet } = paragraph;
|
|
16286
|
+
const documentCompatibilityPolicy = (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy((_viewModel$getSnapsho = viewModel.getSnapshot) === null || _viewModel$getSnapsho === void 0 || (_viewModel$getSnapsho = _viewModel$getSnapsho.call(viewModel)) === null || _viewModel$getSnapsho === void 0 ? void 0 : _viewModel$getSnapsho.documentStyle.documentFlavor);
|
|
16287
|
+
const shouldApplyDocumentDefaults = documentCompatibilityPolicy.applyDocumentDefaultParagraphStyle;
|
|
16288
|
+
const useWordStyleLineHeight = documentCompatibilityPolicy.useWordStyleLineHeight;
|
|
15431
16289
|
const { skeHeaders, skeFooters, skeListLevel, drawingAnchor } = skeletonResourceReference;
|
|
15432
16290
|
const paragraphNonInlineSkeDrawings = /* @__PURE__ */ new Map();
|
|
15433
16291
|
const paragraphInlineSkeDrawings = /* @__PURE__ */ new Map();
|
|
16292
|
+
const paragraphNonInlineSkeDrawingsByBlockId = /* @__PURE__ */ new Map();
|
|
16293
|
+
const paragraphInlineSkeDrawingsByBlockId = /* @__PURE__ */ new Map();
|
|
15434
16294
|
let segmentDrawingAnchorCache = drawingAnchor === null || drawingAnchor === void 0 ? void 0 : drawingAnchor.get(segmentId);
|
|
15435
16295
|
if (segmentDrawingAnchorCache == null) {
|
|
15436
16296
|
segmentDrawingAnchorCache = /* @__PURE__ */ new Map();
|
|
@@ -15438,7 +16298,10 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
15438
16298
|
}
|
|
15439
16299
|
const paragraphConfig = {
|
|
15440
16300
|
paragraphIndex: endIndex,
|
|
15441
|
-
|
|
16301
|
+
documentCompatibilityPolicy,
|
|
16302
|
+
paragraphStyle: _applyBlockRangeLayoutParagraphStyle((_viewModel$getBody2 = (_viewModel$getBody3 = viewModel.getBody) === null || _viewModel$getBody3 === void 0 ? void 0 : _viewModel$getBody3.call(viewModel)) !== null && _viewModel$getBody2 !== void 0 ? _viewModel$getBody2 : null, paragraph, paragraphStyle, shouldApplyDocumentDefaults),
|
|
16303
|
+
docxFallbackAnchorLeft: _getFollowingIndentedParagraphAnchorLeft(viewModel, paragraph, paragraphNode, drawings, isTraditionalDocumentCompatibility(documentCompatibilityPolicy)),
|
|
16304
|
+
useWordStyleLineHeight,
|
|
15442
16305
|
paragraphNonInlineSkeDrawings,
|
|
15443
16306
|
paragraphInlineSkeDrawings,
|
|
15444
16307
|
skeTablesInParagraph: tableSkeleton ? [{
|
|
@@ -15471,36 +16334,65 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
15471
16334
|
if (customBlock == null) continue;
|
|
15472
16335
|
const { blockId } = customBlock;
|
|
15473
16336
|
const drawingOrigin = drawings[blockId];
|
|
15474
|
-
if (drawingOrigin
|
|
15475
|
-
|
|
16337
|
+
if (drawingOrigin == null) continue;
|
|
16338
|
+
if (drawingOrigin.layoutType === PositionedObjectLayoutType.INLINE) paragraphInlineSkeDrawingsByBlockId.set(blockId, _getDrawingSkeletonFormat(drawingOrigin));
|
|
16339
|
+
else paragraphNonInlineSkeDrawingsByBlockId.set(blockId, _getDrawingSkeletonFormat(drawingOrigin));
|
|
15476
16340
|
}
|
|
15477
16341
|
segmentParagraphCache.set(endIndex, paragraphConfig);
|
|
15478
16342
|
let allPages = [curPage];
|
|
15479
16343
|
let isParagraphFirstShapedText = true;
|
|
15480
|
-
|
|
16344
|
+
let shapedTextOffset = 0;
|
|
16345
|
+
for (const [_index, { text, glyphs, breakPointType }] of _mergeAdjacentCustomBlockShapedTexts(shapedTextList).entries()) {
|
|
16346
|
+
const textStartIndex = paragraphNode.startIndex + shapedTextOffset;
|
|
16347
|
+
const textGlyphCount = _glyphCount(glyphs);
|
|
16348
|
+
const textEndIndex = textStartIndex + textGlyphCount;
|
|
15481
16349
|
const pushPending = () => {
|
|
15482
16350
|
if (glyphs.length === 0) return;
|
|
15483
|
-
|
|
16351
|
+
syncActiveParagraphDrawings(glyphs, paragraphNonInlineSkeDrawings, paragraphInlineSkeDrawings, paragraphNonInlineSkeDrawingsByBlockId, paragraphInlineSkeDrawingsByBlockId);
|
|
16352
|
+
allPages = layoutParagraph(ctx, glyphs, allPages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText || hasOnlyFloatingCustomBlockGlyphs(glyphs, paragraphNonInlineSkeDrawingsByBlockId), breakPointType);
|
|
15484
16353
|
isParagraphFirstShapedText = false;
|
|
15485
16354
|
};
|
|
15486
|
-
if (text
|
|
16355
|
+
if (_endsWithToken(text, glyphs, DataStreamTreeTokenType.PAGE_BREAK)) {
|
|
15487
16356
|
pushPending();
|
|
15488
16357
|
allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(allPages[allPages.length - 1]), 1));
|
|
15489
16358
|
paragraphNonInlineSkeDrawings.clear();
|
|
15490
|
-
|
|
16359
|
+
isParagraphFirstShapedText = true;
|
|
16360
|
+
shapedTextOffset += textGlyphCount;
|
|
15491
16361
|
continue;
|
|
15492
|
-
} else if (text
|
|
16362
|
+
} else if (_endsWithToken(text, glyphs, DataStreamTreeTokenType.COLUMN_BREAK) && (!isTraditionalDocumentCompatibility(documentCompatibilityPolicy) || _isMarkedDocxColumnBreak(viewModel, textEndIndex - 1))) {
|
|
15493
16363
|
pushPending();
|
|
15494
16364
|
const lastPage = allPages[allPages.length - 1];
|
|
15495
16365
|
const columnInfo = getLastNotFullColumnInfo(lastPage);
|
|
15496
16366
|
if (columnInfo && !columnInfo.isLast) setColumnFullState(columnInfo.column, true);
|
|
15497
|
-
else
|
|
16367
|
+
else if (columnInfo && columnInfo.isLast && isTraditionalDocumentCompatibility(documentCompatibilityPolicy) && (isBlankColumn(columnInfo.column) || _isDocxColumnBreakVisuallyBlankColumn(columnInfo.column))) {} else if (isTraditionalDocumentCompatibility(documentCompatibilityPolicy)) {
|
|
16368
|
+
var _getLastSection;
|
|
16369
|
+
const lastColumn = (_getLastSection = getLastSection(lastPage)) === null || _getLastSection === void 0 ? void 0 : _getLastSection.columns.at(-1);
|
|
16370
|
+
if (lastColumn && (isBlankColumn(lastColumn) || _isDocxColumnBreakVisuallyBlankColumn(lastColumn))) setColumnFullState(lastColumn, false);
|
|
16371
|
+
else allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(lastPage), 2));
|
|
16372
|
+
} else allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(lastPage), 2));
|
|
16373
|
+
shapedTextOffset += textGlyphCount;
|
|
15498
16374
|
continue;
|
|
15499
16375
|
}
|
|
15500
16376
|
pushPending();
|
|
16377
|
+
shapedTextOffset += textGlyphCount;
|
|
15501
16378
|
}
|
|
15502
16379
|
return allPages;
|
|
15503
16380
|
}
|
|
16381
|
+
function syncActiveParagraphDrawings(glyphs, paragraphNonInlineSkeDrawings, paragraphInlineSkeDrawings, paragraphNonInlineSkeDrawingsByBlockId, paragraphInlineSkeDrawingsByBlockId) {
|
|
16382
|
+
for (const glyph of glyphs) {
|
|
16383
|
+
if (glyph.streamType !== DataStreamTreeTokenType.CUSTOM_BLOCK || glyph.drawingId == null) continue;
|
|
16384
|
+
const inlineDrawing = paragraphInlineSkeDrawingsByBlockId.get(glyph.drawingId);
|
|
16385
|
+
if (inlineDrawing != null) {
|
|
16386
|
+
paragraphInlineSkeDrawings.set(glyph.drawingId, inlineDrawing);
|
|
16387
|
+
continue;
|
|
16388
|
+
}
|
|
16389
|
+
const nonInlineDrawing = paragraphNonInlineSkeDrawingsByBlockId.get(glyph.drawingId);
|
|
16390
|
+
if (nonInlineDrawing != null) paragraphNonInlineSkeDrawings.set(glyph.drawingId, nonInlineDrawing);
|
|
16391
|
+
}
|
|
16392
|
+
}
|
|
16393
|
+
function hasOnlyFloatingCustomBlockGlyphs(glyphs, paragraphNonInlineSkeDrawingsByBlockId) {
|
|
16394
|
+
return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.drawingId != null && paragraphNonInlineSkeDrawingsByBlockId.has(glyph.drawingId));
|
|
16395
|
+
}
|
|
15504
16396
|
|
|
15505
16397
|
//#endregion
|
|
15506
16398
|
//#region src/components/docs/layout/line-breaker/enhancers/hyphen-enhancer.ts
|
|
@@ -15824,6 +16716,26 @@ function prepareTextChunks(body) {
|
|
|
15824
16716
|
//#region src/components/docs/layout/shaping-engine/text-shaping.ts
|
|
15825
16717
|
const fontCache = /* @__PURE__ */ new Map();
|
|
15826
16718
|
const glyphCache = /* @__PURE__ */ new Map();
|
|
16719
|
+
const fontFamilyCache = /* @__PURE__ */ new Map();
|
|
16720
|
+
function trimOuterQuotes(value) {
|
|
16721
|
+
const firstChar = value.charCodeAt(0);
|
|
16722
|
+
const lastChar = value.charCodeAt(value.length - 1);
|
|
16723
|
+
const hasLeadingQuote = firstChar === 34 || firstChar === 39;
|
|
16724
|
+
const hasTrailingQuote = lastChar === 34 || lastChar === 39;
|
|
16725
|
+
if (hasLeadingQuote && hasTrailingQuote) return value.slice(1, -1);
|
|
16726
|
+
if (hasLeadingQuote) return value.slice(1);
|
|
16727
|
+
if (hasTrailingQuote) return value.slice(0, -1);
|
|
16728
|
+
return value;
|
|
16729
|
+
}
|
|
16730
|
+
function expandFontFamilies(fontFamily) {
|
|
16731
|
+
if (!(fontFamily === null || fontFamily === void 0 ? void 0 : fontFamily.trim())) return [];
|
|
16732
|
+
let families = fontFamilyCache.get(fontFamily);
|
|
16733
|
+
if (families) return families;
|
|
16734
|
+
families = fontFamily.split(",").map((family) => trimOuterQuotes(family.trim())).filter(Boolean);
|
|
16735
|
+
fontFamilyCache.set(fontFamily, families);
|
|
16736
|
+
return families;
|
|
16737
|
+
}
|
|
16738
|
+
const defaultFontFamilies = expandFontFamilies(DEFAULT_FONTFACE_PLANE);
|
|
15827
16739
|
function shapeChunk(content, charPosition, used, families, style) {
|
|
15828
16740
|
var _style$bl, _style$it, _content$match;
|
|
15829
16741
|
let fi = 0;
|
|
@@ -15926,8 +16838,7 @@ function textShape(body) {
|
|
|
15926
16838
|
for (const chunk of chunks) {
|
|
15927
16839
|
var _style$ff;
|
|
15928
16840
|
const { content, style = {} } = chunk;
|
|
15929
|
-
let fontFamilies =
|
|
15930
|
-
fontFamilies.unshift((_style$ff = style.ff) !== null && _style$ff !== void 0 ? _style$ff : "Arial");
|
|
16841
|
+
let fontFamilies = [...expandFontFamilies((_style$ff = style.ff) !== null && _style$ff !== void 0 ? _style$ff : "Arial"), ...defaultFontFamilies];
|
|
15931
16842
|
fontFamilies = fontLibrary.getValidFontFamilies(fontFamilies);
|
|
15932
16843
|
glyphs.push(...shapeChunk(content, charPosition, /* @__PURE__ */ new Set(), fontFamilies, style));
|
|
15933
16844
|
charPosition += content.length;
|
|
@@ -15965,7 +16876,7 @@ function ArabicHandler(index, charArray, viewModel, paragraphNode, sectionBreakC
|
|
|
15965
16876
|
for (let i = 0; i < charArray.length; i++) {
|
|
15966
16877
|
const newChar = charArray[i];
|
|
15967
16878
|
if (hasArabic(newChar)) {
|
|
15968
|
-
glyph.
|
|
16879
|
+
glyph.push(newChar);
|
|
15969
16880
|
step++;
|
|
15970
16881
|
} else break;
|
|
15971
16882
|
}
|
|
@@ -16062,7 +16973,10 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
16062
16973
|
const shapedTextList = [];
|
|
16063
16974
|
let breaker = new LineBreaker(content);
|
|
16064
16975
|
const { endIndex } = paragraphNode;
|
|
16065
|
-
const paragraph = viewModel.getParagraph(endIndex) || {
|
|
16976
|
+
const paragraph = viewModel.getParagraph(endIndex) || {
|
|
16977
|
+
startIndex: 0,
|
|
16978
|
+
paragraphId: "para_render_fallback"
|
|
16979
|
+
};
|
|
16066
16980
|
const { paragraphStyle = {} } = paragraph;
|
|
16067
16981
|
const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
|
|
16068
16982
|
let last = 0;
|
|
@@ -16121,12 +17035,12 @@ function shaping(ctx, content, viewModel, paragraphNode, sectionBreakConfig, use
|
|
|
16121
17035
|
if (customBlock != null) {
|
|
16122
17036
|
const { blockId } = customBlock;
|
|
16123
17037
|
const drawingOrigin = drawings[blockId];
|
|
16124
|
-
if (drawingOrigin.layoutType === PositionedObjectLayoutType.INLINE) {
|
|
17038
|
+
if ((drawingOrigin === null || drawingOrigin === void 0 ? void 0 : drawingOrigin.layoutType) === PositionedObjectLayoutType.INLINE) {
|
|
16125
17039
|
const { angle } = drawingOrigin.docTransform;
|
|
16126
17040
|
const { width = 0, height = 0 } = drawingOrigin.docTransform.size;
|
|
16127
17041
|
const boundingBox = getBoundingBox(angle, 0, width, 0, height);
|
|
16128
17042
|
newGlyph = createSkeletonCustomBlockGlyph(config, boundingBox.width, boundingBox.height, drawingOrigin.drawingId);
|
|
16129
|
-
} else newGlyph = createSkeletonCustomBlockGlyph(config, 0, 0, drawingOrigin.drawingId);
|
|
17043
|
+
} else if (drawingOrigin != null) newGlyph = createSkeletonCustomBlockGlyph(config, 0, 0, drawingOrigin.drawingId);
|
|
16130
17044
|
}
|
|
16131
17045
|
if (newGlyph == null) newGlyph = createSkeletonLetterGlyph(char, config);
|
|
16132
17046
|
shapedGlyphs.push(newGlyph);
|
|
@@ -16209,6 +17123,219 @@ function dealWidthParagraph(ctx, viewModel, paragraphNode, curPage, sectionBreak
|
|
|
16209
17123
|
return allPages;
|
|
16210
17124
|
}
|
|
16211
17125
|
|
|
17126
|
+
//#endregion
|
|
17127
|
+
//#region src/components/docs/layout/block/column.ts
|
|
17128
|
+
const EMPTY_COLUMN_GROUP_MIN_HEIGHT = 72;
|
|
17129
|
+
function createColumnGroupSkeleton(ctx, curPage, viewModel, columnGroupNode, sectionBreakConfig) {
|
|
17130
|
+
var _viewModel$getColumnG, _getLastNotFullColumn;
|
|
17131
|
+
const columnGroupSource = (_viewModel$getColumnG = viewModel.getColumnGroupByStartIndex(columnGroupNode.startIndex)) === null || _viewModel$getColumnG === void 0 ? void 0 : _viewModel$getColumnG.columnGroupSource;
|
|
17132
|
+
if (columnGroupSource == null) {
|
|
17133
|
+
console.warn("Column group not found when creating column group skeleton");
|
|
17134
|
+
return null;
|
|
17135
|
+
}
|
|
17136
|
+
const hostColumn = (_getLastNotFullColumn = getLastNotFullColumnInfo(curPage)) === null || _getLastNotFullColumn === void 0 ? void 0 : _getLastNotFullColumn.column;
|
|
17137
|
+
if (hostColumn == null) return null;
|
|
17138
|
+
const columnPages = columnGroupNode.children.map((columnNode, index) => {
|
|
17139
|
+
const sourceColumn = columnGroupSource.columns[index];
|
|
17140
|
+
return createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig, Math.max(0, getInitialColumnWidth(columnGroupSource, sourceColumn, hostColumn.width)));
|
|
17141
|
+
});
|
|
17142
|
+
const columnHeights = columnPages.map((page) => Math.max(page.height, EMPTY_COLUMN_GROUP_MIN_HEIGHT));
|
|
17143
|
+
const layout = calculateColumnGroupLayout(columnGroupSource, hostColumn.width, columnHeights);
|
|
17144
|
+
const columns = layout.columns.map((layoutColumn, index) => {
|
|
17145
|
+
const page = columnPages[index];
|
|
17146
|
+
page.pageHeight = columnHeights[index];
|
|
17147
|
+
return {
|
|
17148
|
+
columnId: layoutColumn.columnId,
|
|
17149
|
+
left: layoutColumn.left,
|
|
17150
|
+
top: layoutColumn.top,
|
|
17151
|
+
width: layoutColumn.width,
|
|
17152
|
+
height: columnHeights[index],
|
|
17153
|
+
st: columnGroupNode.children[index].startIndex,
|
|
17154
|
+
ed: columnGroupNode.children[index].endIndex,
|
|
17155
|
+
page
|
|
17156
|
+
};
|
|
17157
|
+
});
|
|
17158
|
+
const columnGroupSkeleton = {
|
|
17159
|
+
columns,
|
|
17160
|
+
width: layout.width,
|
|
17161
|
+
height: layout.height,
|
|
17162
|
+
top: getNextBlockTop(hostColumn.lines),
|
|
17163
|
+
left: hostColumn.left,
|
|
17164
|
+
st: columnGroupNode.startIndex,
|
|
17165
|
+
ed: columnGroupNode.endIndex,
|
|
17166
|
+
columnGroupId: columnGroupSource.columnGroupId,
|
|
17167
|
+
columnGroupSource
|
|
17168
|
+
};
|
|
17169
|
+
columns.forEach((column) => {
|
|
17170
|
+
column.parent = columnGroupSkeleton;
|
|
17171
|
+
column.page.parent = column;
|
|
17172
|
+
});
|
|
17173
|
+
return columnGroupSkeleton;
|
|
17174
|
+
}
|
|
17175
|
+
function appendColumnGroupBlockLine(page, columnGroup) {
|
|
17176
|
+
const columnInfo = getLastNotFullColumnInfo(page);
|
|
17177
|
+
if (columnInfo == null) return false;
|
|
17178
|
+
const { column } = columnInfo;
|
|
17179
|
+
const line = createColumnGroupBlockLine(columnGroup, column.lines.length);
|
|
17180
|
+
line.parent = column;
|
|
17181
|
+
column.lines.push(line);
|
|
17182
|
+
page.skeColumnGroups.set(columnGroup.columnGroupId, columnGroup);
|
|
17183
|
+
columnGroup.parent = page;
|
|
17184
|
+
return true;
|
|
17185
|
+
}
|
|
17186
|
+
function createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig, width) {
|
|
17187
|
+
var _sectionBreakConfig$d, _ctx$dataModel, _ctx$dataModel$getBod;
|
|
17188
|
+
const columnSectionBreakConfig = {
|
|
17189
|
+
...sectionBreakConfig,
|
|
17190
|
+
pageSize: {
|
|
17191
|
+
width,
|
|
17192
|
+
height: Number.POSITIVE_INFINITY
|
|
17193
|
+
},
|
|
17194
|
+
marginTop: 0,
|
|
17195
|
+
marginBottom: 0,
|
|
17196
|
+
marginLeft: 0,
|
|
17197
|
+
marginRight: 0,
|
|
17198
|
+
columnProperties: []
|
|
17199
|
+
};
|
|
17200
|
+
const page = createSkeletonPage(ctx, columnSectionBreakConfig, ctx.skeletonResourceReference);
|
|
17201
|
+
page.type = 3;
|
|
17202
|
+
for (const paragraphNode of getColumnParagraphNodes(columnNode)) dealWidthParagraph(ctx, viewModel, paragraphNode, page, columnSectionBreakConfig);
|
|
17203
|
+
updateBlockIndex([page], columnNode.startIndex, (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy());
|
|
17204
|
+
applyTrailingBlockRangeSpaceBelow([page], (_ctx$dataModel = ctx.dataModel) === null || _ctx$dataModel === void 0 || (_ctx$dataModel$getBod = _ctx$dataModel.getBody) === null || _ctx$dataModel$getBod === void 0 ? void 0 : _ctx$dataModel$getBod.call(_ctx$dataModel), columnNode.endIndex);
|
|
17205
|
+
return page;
|
|
17206
|
+
}
|
|
17207
|
+
function getColumnParagraphNodes(columnNode) {
|
|
17208
|
+
const firstChild = columnNode.children[0];
|
|
17209
|
+
if ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeType) === DataStreamTreeNodeType.SECTION_BREAK) return firstChild.children;
|
|
17210
|
+
return columnNode.children;
|
|
17211
|
+
}
|
|
17212
|
+
function createColumnGroupBlockLine(columnGroup, lineIndex) {
|
|
17213
|
+
const top = columnGroup.top;
|
|
17214
|
+
return {
|
|
17215
|
+
paragraphIndex: columnGroup.ed,
|
|
17216
|
+
type: 1,
|
|
17217
|
+
divides: [],
|
|
17218
|
+
divideLen: 0,
|
|
17219
|
+
lineHeight: columnGroup.height,
|
|
17220
|
+
contentHeight: columnGroup.height,
|
|
17221
|
+
top,
|
|
17222
|
+
asc: 0,
|
|
17223
|
+
dsc: 0,
|
|
17224
|
+
paddingTop: 0,
|
|
17225
|
+
paddingBottom: 0,
|
|
17226
|
+
marginTop: 0,
|
|
17227
|
+
marginBottom: 0,
|
|
17228
|
+
spaceBelowApply: 0,
|
|
17229
|
+
st: columnGroup.st,
|
|
17230
|
+
ed: columnGroup.ed,
|
|
17231
|
+
lineIndex,
|
|
17232
|
+
paragraphStart: true,
|
|
17233
|
+
isBehindTable: false,
|
|
17234
|
+
tableId: ""
|
|
17235
|
+
};
|
|
17236
|
+
}
|
|
17237
|
+
function getNextBlockTop(lines) {
|
|
17238
|
+
const lastLine = lines[lines.length - 1];
|
|
17239
|
+
if (lastLine == null) return 0;
|
|
17240
|
+
return lastLine.top + lastLine.lineHeight;
|
|
17241
|
+
}
|
|
17242
|
+
function calculateColumnGroupLayout(source, availableWidth, columnHeights) {
|
|
17243
|
+
var _source$gap$v, _source$gap;
|
|
17244
|
+
const width = Math.max(0, availableWidth);
|
|
17245
|
+
const gap = Math.max(0, (_source$gap$v = (_source$gap = source.gap) === null || _source$gap === void 0 ? void 0 : _source$gap.v) !== null && _source$gap$v !== void 0 ? _source$gap$v : 0);
|
|
17246
|
+
const columns = source.columns;
|
|
17247
|
+
if (columns.length === 0) return {
|
|
17248
|
+
mode: "horizontal",
|
|
17249
|
+
width,
|
|
17250
|
+
height: 0,
|
|
17251
|
+
columns: []
|
|
17252
|
+
};
|
|
17253
|
+
if (shouldStack(columns, width, gap, source.responsive)) {
|
|
17254
|
+
let top = 0;
|
|
17255
|
+
return {
|
|
17256
|
+
mode: "stack",
|
|
17257
|
+
width,
|
|
17258
|
+
height: sumHeights(columnHeights),
|
|
17259
|
+
columns: columns.map((column, index) => {
|
|
17260
|
+
var _columnHeights$index;
|
|
17261
|
+
const layoutColumn = {
|
|
17262
|
+
columnId: column.columnId,
|
|
17263
|
+
left: 0,
|
|
17264
|
+
top,
|
|
17265
|
+
width
|
|
17266
|
+
};
|
|
17267
|
+
top += Math.max(0, (_columnHeights$index = columnHeights[index]) !== null && _columnHeights$index !== void 0 ? _columnHeights$index : 0);
|
|
17268
|
+
return layoutColumn;
|
|
17269
|
+
})
|
|
17270
|
+
};
|
|
17271
|
+
}
|
|
17272
|
+
const widths = allocateHorizontalWidths(columns, Math.max(0, width - gap * (columns.length - 1)));
|
|
17273
|
+
let left = 0;
|
|
17274
|
+
return {
|
|
17275
|
+
mode: "horizontal",
|
|
17276
|
+
width,
|
|
17277
|
+
height: Math.max(0, ...columnHeights),
|
|
17278
|
+
columns: columns.map((column, index) => {
|
|
17279
|
+
const layoutColumn = {
|
|
17280
|
+
columnId: column.columnId,
|
|
17281
|
+
left,
|
|
17282
|
+
top: 0,
|
|
17283
|
+
width: widths[index]
|
|
17284
|
+
};
|
|
17285
|
+
left += widths[index] + gap;
|
|
17286
|
+
return layoutColumn;
|
|
17287
|
+
})
|
|
17288
|
+
};
|
|
17289
|
+
}
|
|
17290
|
+
function shouldStack(columns, availableWidth, gap, responsive) {
|
|
17291
|
+
if (responsive !== ColumnResponsiveType.STACK) return false;
|
|
17292
|
+
return columns.reduce((sum, column) => sum + getMinWidth(column), 0) + gap * Math.max(0, columns.length - 1) > availableWidth;
|
|
17293
|
+
}
|
|
17294
|
+
function getInitialColumnWidth(source, column, availableWidth) {
|
|
17295
|
+
var _source$gap$v2, _source$gap2;
|
|
17296
|
+
if (column == null) return availableWidth;
|
|
17297
|
+
const contentWidth = Math.max(0, availableWidth - Math.max(0, (_source$gap$v2 = (_source$gap2 = source.gap) === null || _source$gap2 === void 0 ? void 0 : _source$gap2.v) !== null && _source$gap$v2 !== void 0 ? _source$gap$v2 : 0) * Math.max(0, source.columns.length - 1));
|
|
17298
|
+
const ratioSum = source.columns.reduce((sum, item) => sum + Math.max(0, item.widthRatio || 0), 0) || source.columns.length;
|
|
17299
|
+
return Math.max(getMinWidth(column), contentWidth * (Math.max(0, column.widthRatio || 0) || 1) / ratioSum);
|
|
17300
|
+
}
|
|
17301
|
+
function allocateHorizontalWidths(columns, contentWidth) {
|
|
17302
|
+
const ratioSum = columns.reduce((sum, column) => sum + Math.max(0, column.widthRatio || 0), 0) || columns.length;
|
|
17303
|
+
const idealWidths = columns.map((column) => contentWidth * (Math.max(0, column.widthRatio || 0) || 1) / ratioSum);
|
|
17304
|
+
const minWidths = columns.map(getMinWidth);
|
|
17305
|
+
const widths = idealWidths.map((width, index) => Math.max(width, minWidths[index]));
|
|
17306
|
+
const overflow = widths.reduce((sum, width) => sum + width, 0) - contentWidth;
|
|
17307
|
+
if (overflow <= 0) return widths;
|
|
17308
|
+
return compressToFit(widths, minWidths, overflow);
|
|
17309
|
+
}
|
|
17310
|
+
function compressToFit(widths, minWidths, overflow) {
|
|
17311
|
+
const nextWidths = [...widths];
|
|
17312
|
+
let remainingOverflow = overflow;
|
|
17313
|
+
let flexibleIndexes = getFlexibleIndexes(nextWidths, minWidths);
|
|
17314
|
+
while (remainingOverflow > 0 && flexibleIndexes.length > 0) {
|
|
17315
|
+
const totalShrink = flexibleIndexes.reduce((sum, item) => sum + item.shrink, 0);
|
|
17316
|
+
for (const item of flexibleIndexes) {
|
|
17317
|
+
const shrink = Math.min(item.shrink, remainingOverflow * item.shrink / totalShrink);
|
|
17318
|
+
nextWidths[item.index] -= shrink;
|
|
17319
|
+
remainingOverflow -= shrink;
|
|
17320
|
+
}
|
|
17321
|
+
flexibleIndexes = getFlexibleIndexes(nextWidths, minWidths);
|
|
17322
|
+
}
|
|
17323
|
+
return nextWidths;
|
|
17324
|
+
}
|
|
17325
|
+
function getFlexibleIndexes(widths, minWidths) {
|
|
17326
|
+
return widths.map((width, index) => ({
|
|
17327
|
+
index,
|
|
17328
|
+
shrink: Math.max(0, width - minWidths[index])
|
|
17329
|
+
})).filter((item) => item.shrink > 0);
|
|
17330
|
+
}
|
|
17331
|
+
function getMinWidth(column) {
|
|
17332
|
+
var _column$minWidth$v, _column$minWidth;
|
|
17333
|
+
return Math.max(0, (_column$minWidth$v = (_column$minWidth = column.minWidth) === null || _column$minWidth === void 0 ? void 0 : _column$minWidth.v) !== null && _column$minWidth$v !== void 0 ? _column$minWidth$v : 0);
|
|
17334
|
+
}
|
|
17335
|
+
function sumHeights(heights) {
|
|
17336
|
+
return heights.reduce((sum, height) => sum + Math.max(0, height), 0);
|
|
17337
|
+
}
|
|
17338
|
+
|
|
16212
17339
|
//#endregion
|
|
16213
17340
|
//#region src/components/docs/layout/block/section.ts
|
|
16214
17341
|
function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfig, layoutAnchor) {
|
|
@@ -16233,6 +17360,10 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
16233
17360
|
if (ctx.paragraphsOpenNewPage.has(paragraphNode.endIndex)) currentPageCache = createSkeletonPage(ctx, sectionBreakConfig, ctx.skeletonResourceReference, currentPageCache.pageNumber + 1);
|
|
16234
17361
|
skeletonPages = dealWidthParagraph(ctx, viewModel, paragraphNode, currentPageCache, sectionBreakConfig);
|
|
16235
17362
|
}
|
|
17363
|
+
if (paragraphNode.nodeType === DataStreamTreeNodeType.COLUMN_GROUP) {
|
|
17364
|
+
const columnGroupSkeleton = createColumnGroupSkeleton(ctx, currentPageCache, viewModel, paragraphNode, sectionBreakConfig);
|
|
17365
|
+
if (columnGroupSkeleton && appendColumnGroupBlockLine(currentPageCache, columnGroupSkeleton)) skeletonPages = [currentPageCache];
|
|
17366
|
+
}
|
|
16236
17367
|
if (skeletonPages.length === 0) skeletonPages = dealWithBlockError();
|
|
16237
17368
|
_pushPage(allCurrentSkeletonPages, skeletonPages);
|
|
16238
17369
|
if (ctx.isDirty) break;
|
|
@@ -16615,11 +17746,49 @@ function removeDupPages(ctx) {
|
|
|
16615
17746
|
return !hasPage;
|
|
16616
17747
|
});
|
|
16617
17748
|
}
|
|
17749
|
+
function mergeContinuousDuplicatePages(pages) {
|
|
17750
|
+
for (let index = 1; index < pages.length;) {
|
|
17751
|
+
var _page$skeDrawings, _page$skeTables;
|
|
17752
|
+
const previousPage = pages[index - 1];
|
|
17753
|
+
const page = pages[index];
|
|
17754
|
+
if (previousPage.pageNumber !== page.pageNumber) {
|
|
17755
|
+
index++;
|
|
17756
|
+
continue;
|
|
17757
|
+
}
|
|
17758
|
+
const topOffset = previousPage.height;
|
|
17759
|
+
for (const section of page.sections) {
|
|
17760
|
+
section.top += topOffset;
|
|
17761
|
+
section.parent = previousPage;
|
|
17762
|
+
previousPage.sections.push(section);
|
|
17763
|
+
}
|
|
17764
|
+
(_page$skeDrawings = page.skeDrawings) === null || _page$skeDrawings === void 0 || _page$skeDrawings.forEach((drawing, drawingId) => {
|
|
17765
|
+
drawing.aTop += topOffset;
|
|
17766
|
+
previousPage.skeDrawings.set(drawingId, drawing);
|
|
17767
|
+
});
|
|
17768
|
+
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table, tableId) => {
|
|
17769
|
+
table.top += topOffset;
|
|
17770
|
+
table.parent = previousPage;
|
|
17771
|
+
previousPage.skeTables.set(tableId, table);
|
|
17772
|
+
});
|
|
17773
|
+
previousPage.height += page.height;
|
|
17774
|
+
previousPage.width = Math.max(previousPage.width, page.width);
|
|
17775
|
+
previousPage.ed = Math.max(previousPage.ed, page.ed);
|
|
17776
|
+
pages.splice(index, 1);
|
|
17777
|
+
}
|
|
17778
|
+
}
|
|
16618
17779
|
function getPagePath(page) {
|
|
16619
17780
|
const path = [];
|
|
16620
17781
|
let skeNode = page;
|
|
16621
17782
|
let parent = skeNode.parent;
|
|
16622
17783
|
while (parent) {
|
|
17784
|
+
var _parent$parent;
|
|
17785
|
+
if (parent.page === skeNode && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.columns)) {
|
|
17786
|
+
const index = parent.parent.columns.indexOf(parent);
|
|
17787
|
+
if (index !== -1) path.unshift("columns", index, "page");
|
|
17788
|
+
skeNode = parent.parent;
|
|
17789
|
+
parent = skeNode === null || skeNode === void 0 ? void 0 : skeNode.parent;
|
|
17790
|
+
continue;
|
|
17791
|
+
}
|
|
16623
17792
|
if (parent.pages) {
|
|
16624
17793
|
const index = parent.pages.indexOf(skeNode);
|
|
16625
17794
|
if (index !== -1) path.unshift("pages", index);
|
|
@@ -16630,11 +17799,53 @@ function getPagePath(page) {
|
|
|
16630
17799
|
const index = parent.rows.indexOf(skeNode);
|
|
16631
17800
|
if (index !== -1) path.unshift("rows", index);
|
|
16632
17801
|
} else if (parent.skeTables && parent.skeTables.has(skeNode.tableId)) path.unshift("skeTables", skeNode.tableId);
|
|
17802
|
+
else if (parent.skeColumnGroups && parent.skeColumnGroups.has(skeNode.columnGroupId)) path.unshift("skeColumnGroups", skeNode.columnGroupId);
|
|
16633
17803
|
skeNode = parent;
|
|
16634
17804
|
parent = parent === null || parent === void 0 ? void 0 : parent.parent;
|
|
16635
17805
|
}
|
|
16636
17806
|
return path;
|
|
16637
17807
|
}
|
|
17808
|
+
function getBoundaryGlyphInPage(page, useLast) {
|
|
17809
|
+
const sections = useLast ? [...page.sections].reverse() : page.sections;
|
|
17810
|
+
for (const section of sections) {
|
|
17811
|
+
const columns = useLast ? [...section.columns].reverse() : section.columns;
|
|
17812
|
+
for (const column of columns) {
|
|
17813
|
+
const lines = useLast ? [...column.lines].reverse() : column.lines;
|
|
17814
|
+
for (const line of lines) {
|
|
17815
|
+
const divides = useLast ? [...line.divides].reverse() : line.divides;
|
|
17816
|
+
for (const divide of divides) {
|
|
17817
|
+
const glyph = (useLast ? [...divide.glyphGroup].reverse() : divide.glyphGroup).find((item) => {
|
|
17818
|
+
var _item$content;
|
|
17819
|
+
return (_item$content = item.content) === null || _item$content === void 0 ? void 0 : _item$content.length;
|
|
17820
|
+
});
|
|
17821
|
+
if (glyph) return {
|
|
17822
|
+
section,
|
|
17823
|
+
column,
|
|
17824
|
+
line,
|
|
17825
|
+
divide,
|
|
17826
|
+
glyph
|
|
17827
|
+
};
|
|
17828
|
+
}
|
|
17829
|
+
}
|
|
17830
|
+
}
|
|
17831
|
+
}
|
|
17832
|
+
}
|
|
17833
|
+
function isHitTestAddressableGlyph(glyph) {
|
|
17834
|
+
var _glyph$content;
|
|
17835
|
+
return Boolean((_glyph$content = glyph.content) === null || _glyph$content === void 0 ? void 0 : _glyph$content.length) || glyph.streamType === DataStreamTreeTokenType.PARAGRAPH && glyph.count > 0;
|
|
17836
|
+
}
|
|
17837
|
+
function resolveMostSpecificPageByCharIndex(page, charIndex) {
|
|
17838
|
+
var _page$skeTables$value, _page$skeTables2, _page$skeColumnGroups, _page$skeColumnGroups2;
|
|
17839
|
+
for (const table of (_page$skeTables$value = (_page$skeTables2 = page.skeTables) === null || _page$skeTables2 === void 0 ? void 0 : _page$skeTables2.values()) !== null && _page$skeTables$value !== void 0 ? _page$skeTables$value : []) for (const row of table.rows) for (const cell of row.cells) {
|
|
17840
|
+
const { st, ed } = cell;
|
|
17841
|
+
if (charIndex >= st && charIndex <= ed) return resolveMostSpecificPageByCharIndex(cell, charIndex);
|
|
17842
|
+
}
|
|
17843
|
+
for (const columnGroup of (_page$skeColumnGroups = (_page$skeColumnGroups2 = page.skeColumnGroups) === null || _page$skeColumnGroups2 === void 0 ? void 0 : _page$skeColumnGroups2.values()) !== null && _page$skeColumnGroups !== void 0 ? _page$skeColumnGroups : []) for (const column of columnGroup.columns) {
|
|
17844
|
+
const { st, ed } = column;
|
|
17845
|
+
if (charIndex >= st && charIndex <= ed) return resolveMostSpecificPageByCharIndex(column.page, charIndex);
|
|
17846
|
+
}
|
|
17847
|
+
return page;
|
|
17848
|
+
}
|
|
16638
17849
|
var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
16639
17850
|
constructor(_docViewModel, localeService) {
|
|
16640
17851
|
super(localeService);
|
|
@@ -16934,7 +18145,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
16934
18145
|
return this._getNearestNode(cache.nearestNodeList, cache.nearestNodeDistanceList);
|
|
16935
18146
|
}
|
|
16936
18147
|
_collectNearestNode(segmentPage, pageType, page, segmentId, pi, cache, x, y, pageLength, nestLevel = 0) {
|
|
16937
|
-
const { sections, skeTables } = segmentPage;
|
|
18148
|
+
const { sections, skeTables, skeColumnGroups = /* @__PURE__ */ new Map() } = segmentPage;
|
|
16938
18149
|
this._findLiquid.translateSave();
|
|
16939
18150
|
const pageLeft = this._findLiquid.x;
|
|
16940
18151
|
const pageRight = pageLeft + page.pageWidth;
|
|
@@ -16995,7 +18206,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
16995
18206
|
this._findLiquid.translateDivide(divide);
|
|
16996
18207
|
const { x: startX } = this._findLiquid;
|
|
16997
18208
|
for (const glyph of glyphGroup) {
|
|
16998
|
-
if (!glyph
|
|
18209
|
+
if (!isHitTestAddressableGlyph(glyph)) continue;
|
|
16999
18210
|
const { width: glyphWidth, left: glyphLeft } = glyph;
|
|
17000
18211
|
const startX_fin = startX + glyphLeft;
|
|
17001
18212
|
const endX_fin = startX + glyphLeft + glyphWidth;
|
|
@@ -17068,9 +18279,9 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17068
18279
|
const viewport = getDocsTableRenderViewport(unitId, sourceTableId);
|
|
17069
18280
|
(_this$_findLiquid = this._findLiquid) === null || _this$_findLiquid === void 0 || _this$_findLiquid.translateSave();
|
|
17070
18281
|
(_this$_findLiquid2 = this._findLiquid) === null || _this$_findLiquid2 === void 0 || _this$_findLiquid2.translate(tableLeft, tableTop);
|
|
17071
|
-
if (viewport
|
|
17072
|
-
var _this$_findLiquid4;
|
|
17073
|
-
const visibleLeft = this._findLiquid.x;
|
|
18282
|
+
if (hasDocsTableHorizontalViewport(viewport)) {
|
|
18283
|
+
var _viewport$leadingInse, _this$_findLiquid4;
|
|
18284
|
+
const visibleLeft = this._findLiquid.x + page.marginLeft - ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0);
|
|
17074
18285
|
const visibleRight = visibleLeft + viewport.viewportWidth;
|
|
17075
18286
|
if (x < visibleLeft || x > visibleRight) {
|
|
17076
18287
|
var _this$_findLiquid3;
|
|
@@ -17098,6 +18309,30 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17098
18309
|
(_this$_findLiquid11 = this._findLiquid) === null || _this$_findLiquid11 === void 0 || _this$_findLiquid11.translateRestore();
|
|
17099
18310
|
}
|
|
17100
18311
|
}
|
|
18312
|
+
if (skeColumnGroups.size > 0) for (const columnGroup of skeColumnGroups.values()) {
|
|
18313
|
+
var _this$_findLiquid12, _this$_findLiquid13, _this$_findLiquid17;
|
|
18314
|
+
const { top: columnGroupTop, left: columnGroupLeft, width: columnGroupWidth, height: columnGroupHeight, columns } = columnGroup;
|
|
18315
|
+
const absoluteColumnGroupLeft = this._findLiquid.x + columnGroupLeft;
|
|
18316
|
+
const absoluteColumnGroupTop = this._findLiquid.y + columnGroupTop;
|
|
18317
|
+
if (x < absoluteColumnGroupLeft || x > absoluteColumnGroupLeft + columnGroupWidth || y < absoluteColumnGroupTop || y > absoluteColumnGroupTop + columnGroupHeight) continue;
|
|
18318
|
+
(_this$_findLiquid12 = this._findLiquid) === null || _this$_findLiquid12 === void 0 || _this$_findLiquid12.translateSave();
|
|
18319
|
+
(_this$_findLiquid13 = this._findLiquid) === null || _this$_findLiquid13 === void 0 || _this$_findLiquid13.translate(columnGroupLeft, columnGroupTop);
|
|
18320
|
+
for (const column of columns) {
|
|
18321
|
+
var _this$_findLiquid14, _this$_findLiquid15, _ref, _exactMatch4, _this$_findLiquid16;
|
|
18322
|
+
const absoluteColumnLeft = absoluteColumnGroupLeft + column.left;
|
|
18323
|
+
const absoluteColumnTop = absoluteColumnGroupTop + column.top;
|
|
18324
|
+
if (x < absoluteColumnLeft || x > absoluteColumnLeft + column.width || y < absoluteColumnTop || y > absoluteColumnTop + column.height) continue;
|
|
18325
|
+
const nestedCache = {
|
|
18326
|
+
nearestNodeList: [],
|
|
18327
|
+
nearestNodeDistanceList: []
|
|
18328
|
+
};
|
|
18329
|
+
(_this$_findLiquid14 = this._findLiquid) === null || _this$_findLiquid14 === void 0 || _this$_findLiquid14.translateSave();
|
|
18330
|
+
(_this$_findLiquid15 = this._findLiquid) === null || _this$_findLiquid15 === void 0 || _this$_findLiquid15.translate(column.left, column.top);
|
|
18331
|
+
exactMatch = (_ref = (_exactMatch4 = exactMatch) !== null && _exactMatch4 !== void 0 ? _exactMatch4 : this._collectNearestNode(column.page, 3, column.page, segmentId, pi, nestedCache, x, y, pageLength, nestLevel + 1)) !== null && _ref !== void 0 ? _ref : this._getNearestNode(nestedCache.nearestNodeList, nestedCache.nearestNodeDistanceList);
|
|
18332
|
+
(_this$_findLiquid16 = this._findLiquid) === null || _this$_findLiquid16 === void 0 || _this$_findLiquid16.translateRestore();
|
|
18333
|
+
}
|
|
18334
|
+
(_this$_findLiquid17 = this._findLiquid) === null || _this$_findLiquid17 === void 0 || _this$_findLiquid17.translateRestore();
|
|
18335
|
+
}
|
|
17101
18336
|
if (exactMatch) {
|
|
17102
18337
|
this._findLiquid.translateRestore();
|
|
17103
18338
|
return exactMatch;
|
|
@@ -17166,6 +18401,7 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17166
18401
|
lists,
|
|
17167
18402
|
drawings,
|
|
17168
18403
|
localeService: this._localeService,
|
|
18404
|
+
documentCompatibilityPolicy: getDocumentCompatibilityPolicy(documentStyle.documentFlavor),
|
|
17169
18405
|
paragraphLineGapDefault,
|
|
17170
18406
|
defaultTabStop,
|
|
17171
18407
|
documentTextStyle: textStyle
|
|
@@ -17240,8 +18476,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17240
18476
|
let curSkeletonPage = getLastPage(allSkeletonPages);
|
|
17241
18477
|
let isContinuous = false;
|
|
17242
18478
|
ctx.sectionBreakConfigCache.set(sectionNode.endIndex, sectionBreakConfig);
|
|
17243
|
-
if (sectionType === SectionType.CONTINUOUS) {
|
|
17244
|
-
updateBlockIndex(allSkeletonPages);
|
|
18479
|
+
if (sectionType === SectionType.CONTINUOUS && curSkeletonPage != null) {
|
|
18480
|
+
updateBlockIndex(allSkeletonPages, -1, ctx.docsConfig.documentCompatibilityPolicy);
|
|
17245
18481
|
this._addNewSectionByContinuous(curSkeletonPage, columnProperties, columnSeparatorType);
|
|
17246
18482
|
isContinuous = true;
|
|
17247
18483
|
} else if (layoutAnchor == null || curSkeletonPage == null) {
|
|
@@ -17250,7 +18486,10 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17250
18486
|
}
|
|
17251
18487
|
const { pages } = dealWithSection(ctx, viewModel, sectionNode, curSkeletonPage, sectionBreakConfig, layoutAnchor);
|
|
17252
18488
|
if (sectionTypeNext === SectionType.CONTINUOUS && columnProperties.length > 0) {}
|
|
17253
|
-
if (isContinuous)
|
|
18489
|
+
if (isContinuous) {
|
|
18490
|
+
const continuousFirstPage = pages.shift();
|
|
18491
|
+
if (continuousFirstPage && allSkeletonPages.length > 0) allSkeletonPages[allSkeletonPages.length - 1] = continuousFirstPage;
|
|
18492
|
+
}
|
|
17254
18493
|
allSkeletonPages.push(...pages);
|
|
17255
18494
|
if (ctx.isDirty) break;
|
|
17256
18495
|
}
|
|
@@ -17261,7 +18500,8 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17261
18500
|
} else {
|
|
17262
18501
|
this._iteratorCount = 0;
|
|
17263
18502
|
removeDupPages(ctx);
|
|
17264
|
-
updateBlockIndex(skeleton.pages);
|
|
18503
|
+
updateBlockIndex(skeleton.pages, -1, ctx.docsConfig.documentCompatibilityPolicy);
|
|
18504
|
+
mergeContinuousDuplicatePages(skeleton.pages);
|
|
17265
18505
|
updateInlineDrawingCoordsAndBorder(ctx, skeleton.pages);
|
|
17266
18506
|
for (const hSkeMap of skeleton.skeHeaders.values()) for (const page of hSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
17267
18507
|
for (const fSkeMap of skeleton.skeFooters.values()) for (const page of fSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
@@ -17285,9 +18525,10 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17285
18525
|
if (skeletonData == null) return;
|
|
17286
18526
|
const { pages, skeFooters, skeHeaders } = skeletonData;
|
|
17287
18527
|
for (const page of pages) {
|
|
18528
|
+
var _segmentPageParent$pa;
|
|
17288
18529
|
const curPageIndex = pages.indexOf(page);
|
|
17289
18530
|
if (segmentId && curPageIndex !== segmentPageIndex) continue;
|
|
17290
|
-
const { pageWidth
|
|
18531
|
+
const { pageWidth } = page;
|
|
17291
18532
|
let segmentPage = page;
|
|
17292
18533
|
if (segmentId) {
|
|
17293
18534
|
var _skeHeaders$get5, _skeFooters$get5;
|
|
@@ -17297,27 +18538,22 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17297
18538
|
else if (maybeFooterSke) segmentPage = maybeFooterSke;
|
|
17298
18539
|
else continue;
|
|
17299
18540
|
}
|
|
17300
|
-
if (segmentId === "")
|
|
17301
|
-
|
|
17302
|
-
|
|
17303
|
-
|
|
17304
|
-
|
|
17305
|
-
|
|
17306
|
-
|
|
17307
|
-
|
|
17308
|
-
|
|
17309
|
-
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17313
|
-
}
|
|
17314
|
-
if (foundCell) break;
|
|
17315
|
-
}
|
|
17316
|
-
if (foundCell) break;
|
|
18541
|
+
if (segmentId === "") segmentPage = resolveMostSpecificPageByCharIndex(page, charIndex);
|
|
18542
|
+
const { sections, st, ed } = segmentPage;
|
|
18543
|
+
const segmentPageParent = segmentPage.parent;
|
|
18544
|
+
const isColumnSegmentPage = segmentId === "" && (segmentPageParent === null || segmentPageParent === void 0 ? void 0 : segmentPageParent.page) === segmentPage && ((_segmentPageParent$pa = segmentPageParent.parent) === null || _segmentPageParent$pa === void 0 ? void 0 : _segmentPageParent$pa.columnGroupId);
|
|
18545
|
+
if (charIndex < st || charIndex > ed) {
|
|
18546
|
+
if (isColumnSegmentPage) {
|
|
18547
|
+
const boundary = getBoundaryGlyphInPage(segmentPage, charIndex >= ed);
|
|
18548
|
+
if (boundary) return {
|
|
18549
|
+
page: segmentPage,
|
|
18550
|
+
pageType: segmentPage.type,
|
|
18551
|
+
segmentPageIndex,
|
|
18552
|
+
...boundary
|
|
18553
|
+
};
|
|
17317
18554
|
}
|
|
18555
|
+
continue;
|
|
17318
18556
|
}
|
|
17319
|
-
const { sections, st, ed } = segmentPage;
|
|
17320
|
-
if (charIndex < st || charIndex > ed) continue;
|
|
17321
18557
|
for (const section of sections) {
|
|
17322
18558
|
const { columns, st, ed } = section;
|
|
17323
18559
|
if (charIndex < st || charIndex > ed) continue;
|
|
@@ -17350,6 +18586,15 @@ var DocumentSkeleton = class DocumentSkeleton extends Skeleton {
|
|
|
17350
18586
|
}
|
|
17351
18587
|
}
|
|
17352
18588
|
}
|
|
18589
|
+
if (isColumnSegmentPage) {
|
|
18590
|
+
const boundary = getBoundaryGlyphInPage(segmentPage, charIndex >= segmentPage.ed);
|
|
18591
|
+
if (boundary) return {
|
|
18592
|
+
page: segmentPage,
|
|
18593
|
+
pageType: segmentPage.type,
|
|
18594
|
+
segmentPageIndex,
|
|
18595
|
+
...boundary
|
|
18596
|
+
};
|
|
18597
|
+
}
|
|
17353
18598
|
}
|
|
17354
18599
|
}
|
|
17355
18600
|
};
|
|
@@ -17372,6 +18617,7 @@ function createDocumentModelWithStyle(content, textStyle, config = {}) {
|
|
|
17372
18617
|
}],
|
|
17373
18618
|
paragraphs: [{
|
|
17374
18619
|
startIndex: contentLength,
|
|
18620
|
+
paragraphId: createParagraphId(/* @__PURE__ */ new Set()),
|
|
17375
18621
|
paragraphStyle: { horizontalAlign }
|
|
17376
18622
|
}],
|
|
17377
18623
|
sectionBreaks: [{ startIndex: contentLength + 1 }]
|
|
@@ -17428,7 +18674,7 @@ function getFontFormat(format) {
|
|
|
17428
18674
|
}
|
|
17429
18675
|
|
|
17430
18676
|
//#endregion
|
|
17431
|
-
//#region \0@oxc-project+runtime@0.
|
|
18677
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorateParam.js
|
|
17432
18678
|
function __decorateParam(paramIndex, decorator) {
|
|
17433
18679
|
return function(target, key) {
|
|
17434
18680
|
decorator(target, key, paramIndex);
|
|
@@ -17436,7 +18682,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
17436
18682
|
}
|
|
17437
18683
|
|
|
17438
18684
|
//#endregion
|
|
17439
|
-
//#region \0@oxc-project+runtime@0.
|
|
18685
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/decorate.js
|
|
17440
18686
|
function __decorate(decorators, target, key, desc) {
|
|
17441
18687
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
17442
18688
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -18249,7 +19495,7 @@ let SpreadsheetSkeleton = class SpreadsheetSkeleton extends SheetSkeleton {
|
|
|
18249
19495
|
this.makeDirty(true);
|
|
18250
19496
|
}
|
|
18251
19497
|
_setBorderStylesCache(row, col, style, options) {
|
|
18252
|
-
if (Tools.isDefine(this._handleBorderMatrix.getValue(row, col))) return;
|
|
19498
|
+
if (Tools.isDefine(this._handleBorderMatrix.getValue(row, col)) && !(options === null || options === void 0 ? void 0 : options.mergeRange)) return;
|
|
18253
19499
|
if (!((options === null || options === void 0 ? void 0 : options.cacheItem) || {
|
|
18254
19500
|
bg: true,
|
|
18255
19501
|
border: true
|
|
@@ -19388,6 +20634,56 @@ var docExtension = class extends ComponentExtension {
|
|
|
19388
20634
|
}
|
|
19389
20635
|
};
|
|
19390
20636
|
|
|
20637
|
+
//#endregion
|
|
20638
|
+
//#region src/components/docs/extensions/background-runs.ts
|
|
20639
|
+
function collectBackgroundGlyphRuns(glyphGroup) {
|
|
20640
|
+
const runs = [];
|
|
20641
|
+
let activeGlyph = null;
|
|
20642
|
+
let activeColor = "";
|
|
20643
|
+
let activeLeft = 0;
|
|
20644
|
+
let activeRight = 0;
|
|
20645
|
+
const flush = () => {
|
|
20646
|
+
if (!activeGlyph) return;
|
|
20647
|
+
runs.push({
|
|
20648
|
+
glyph: {
|
|
20649
|
+
...activeGlyph,
|
|
20650
|
+
width: activeRight - activeLeft
|
|
20651
|
+
},
|
|
20652
|
+
left: activeLeft,
|
|
20653
|
+
width: activeRight - activeLeft
|
|
20654
|
+
});
|
|
20655
|
+
activeGlyph = null;
|
|
20656
|
+
activeColor = "";
|
|
20657
|
+
activeLeft = 0;
|
|
20658
|
+
activeRight = 0;
|
|
20659
|
+
};
|
|
20660
|
+
for (const glyph of glyphGroup) {
|
|
20661
|
+
var _glyph$ts;
|
|
20662
|
+
if (!glyph.content || glyph.content === "\r") {
|
|
20663
|
+
flush();
|
|
20664
|
+
continue;
|
|
20665
|
+
}
|
|
20666
|
+
const backgroundColor = ((_glyph$ts = glyph.ts) === null || _glyph$ts === void 0 ? void 0 : _glyph$ts.bg) ? getColorStyle(glyph.ts.bg) : "";
|
|
20667
|
+
if (!backgroundColor) {
|
|
20668
|
+
flush();
|
|
20669
|
+
continue;
|
|
20670
|
+
}
|
|
20671
|
+
const glyphLeft = glyph.left;
|
|
20672
|
+
const glyphRight = glyph.left + glyph.width;
|
|
20673
|
+
if (activeGlyph && activeColor === backgroundColor) {
|
|
20674
|
+
activeRight = Math.max(activeRight, glyphRight);
|
|
20675
|
+
continue;
|
|
20676
|
+
}
|
|
20677
|
+
flush();
|
|
20678
|
+
activeGlyph = glyph;
|
|
20679
|
+
activeColor = backgroundColor;
|
|
20680
|
+
activeLeft = glyphLeft;
|
|
20681
|
+
activeRight = glyphRight;
|
|
20682
|
+
}
|
|
20683
|
+
flush();
|
|
20684
|
+
return runs;
|
|
20685
|
+
}
|
|
20686
|
+
|
|
19391
20687
|
//#endregion
|
|
19392
20688
|
//#region src/components/docs/extensions/background.ts
|
|
19393
20689
|
const UNIQUE_KEY$3 = "DefaultDocsBackgroundExtension";
|
|
@@ -19803,7 +21099,6 @@ var Image$1 = class extends Shape {
|
|
|
19803
21099
|
this.makeDirty(true);
|
|
19804
21100
|
} else if (config.url) {
|
|
19805
21101
|
this._native = document.createElement("img");
|
|
19806
|
-
this._native.src = config.url;
|
|
19807
21102
|
this._native.crossOrigin = "anonymous";
|
|
19808
21103
|
this._native.onload = () => {
|
|
19809
21104
|
var _config$success, _this$getEngine;
|
|
@@ -19818,6 +21113,7 @@ var Image$1 = class extends Shape {
|
|
|
19818
21113
|
this.makeDirty(true);
|
|
19819
21114
|
}
|
|
19820
21115
|
};
|
|
21116
|
+
this._native.src = config.url;
|
|
19821
21117
|
}
|
|
19822
21118
|
this._init();
|
|
19823
21119
|
}
|
|
@@ -19831,10 +21127,17 @@ var Image$1 = class extends Shape {
|
|
|
19831
21127
|
var _this$_props$opacity;
|
|
19832
21128
|
return (_this$_props$opacity = this._props.opacity) !== null && _this$_props$opacity !== void 0 ? _this$_props$opacity : 1;
|
|
19833
21129
|
}
|
|
21130
|
+
get clipBounds() {
|
|
21131
|
+
return this._props.clipBounds;
|
|
21132
|
+
}
|
|
19834
21133
|
setOpacity(opacity) {
|
|
19835
21134
|
this._props.opacity = opacity;
|
|
19836
21135
|
this.makeDirty(true);
|
|
19837
21136
|
}
|
|
21137
|
+
setClipBounds(clipBounds) {
|
|
21138
|
+
this._props.clipBounds = clipBounds;
|
|
21139
|
+
this.makeDirty(true);
|
|
21140
|
+
}
|
|
19838
21141
|
setClipService(clipService) {
|
|
19839
21142
|
this._clipService = clipService;
|
|
19840
21143
|
}
|
|
@@ -19851,10 +21154,10 @@ var Image$1 = class extends Shape {
|
|
|
19851
21154
|
}
|
|
19852
21155
|
changeSource(url) {
|
|
19853
21156
|
if (this._native == null) this._native = document.createElement("img");
|
|
19854
|
-
this._native.src = url;
|
|
19855
21157
|
this._native.onload = () => {
|
|
19856
21158
|
this.makeDirty(true);
|
|
19857
21159
|
};
|
|
21160
|
+
this._native.src = url;
|
|
19858
21161
|
}
|
|
19859
21162
|
resetSize() {
|
|
19860
21163
|
if (this._native == null) return;
|
|
@@ -19960,6 +21263,12 @@ var Image$1 = class extends Shape {
|
|
|
19960
21263
|
}
|
|
19961
21264
|
const m = this.transform.getMatrix();
|
|
19962
21265
|
mainCtx.save();
|
|
21266
|
+
const { clipBounds } = this;
|
|
21267
|
+
if (clipBounds) {
|
|
21268
|
+
mainCtx.beginPath();
|
|
21269
|
+
mainCtx.rect(clipBounds.left, clipBounds.top, clipBounds.width, clipBounds.height);
|
|
21270
|
+
mainCtx.clip();
|
|
21271
|
+
}
|
|
19963
21272
|
const centerX = realLeft + realWidth / 2;
|
|
19964
21273
|
const centerY = realTop + realHeight / 2;
|
|
19965
21274
|
mainCtx.transform(m[0], m[1], m[2], m[3], centerX, centerY);
|
|
@@ -21600,6 +22909,7 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
21600
22909
|
"actualFontMap",
|
|
21601
22910
|
{}
|
|
21602
22911
|
);
|
|
22912
|
+
_defineProperty(this, "_textFillImageCache", /* @__PURE__ */ new Map());
|
|
21603
22913
|
}
|
|
21604
22914
|
draw(ctx, _parentScale, glyph, _, _more) {
|
|
21605
22915
|
var _glyph$parent;
|
|
@@ -21618,13 +22928,162 @@ var FontAndBaseLine = class extends docExtension {
|
|
|
21618
22928
|
this.actualFontMap[fontStringPxStr] = ctx.font;
|
|
21619
22929
|
}
|
|
21620
22930
|
}
|
|
21621
|
-
const { cl: colorStyle, va: baselineOffset } = textStyle;
|
|
22931
|
+
const { cl: colorStyle, va: baselineOffset, textFill } = textStyle;
|
|
21622
22932
|
const fontColor = getColorStyle(colorStyle) || "rgb(0,0,0)";
|
|
21623
|
-
if (fontColor && this._preFontColor !== fontColor) ctx.fillStyle = fontColor;
|
|
21624
22933
|
if (baselineOffset === BaselineOffset.SUPERSCRIPT) spanPointWithFont.y += -bBox.spo;
|
|
21625
22934
|
else if (baselineOffset === BaselineOffset.SUBSCRIPT) spanPointWithFont.y += bBox.sbo;
|
|
22935
|
+
if (this._fillTextWithTextFill(ctx, glyph, spanPointWithFont, textFill, fontColor)) return;
|
|
22936
|
+
if (fontColor && this._preFontColor !== fontColor) ctx.fillStyle = fontColor;
|
|
21626
22937
|
this._fillText(ctx, glyph, spanPointWithFont);
|
|
21627
22938
|
}
|
|
22939
|
+
_fillTextWithTextFill(ctx, glyph, spanPointWithFont, textFill, fallbackColor) {
|
|
22940
|
+
if (!textFill || textFill.type === "none") return (textFill === null || textFill === void 0 ? void 0 : textFill.type) === "none";
|
|
22941
|
+
const { content, glyphType } = glyph;
|
|
22942
|
+
if (content == null || glyphType === 2) return false;
|
|
22943
|
+
const { renderConfig } = this.extensionOffset;
|
|
22944
|
+
const { vertexAngle, centerAngle } = renderConfig !== null && renderConfig !== void 0 ? renderConfig : {};
|
|
22945
|
+
const VERTICAL_DEG = 90;
|
|
22946
|
+
if (vertexAngle === VERTICAL_DEG && centerAngle === VERTICAL_DEG) return false;
|
|
22947
|
+
const bounds = this._getGlyphPaintBounds(glyph, spanPointWithFont);
|
|
22948
|
+
if (bounds.width <= 0 || bounds.height <= 0) return false;
|
|
22949
|
+
const color = this._colorWithOpacity(textFill.color || fallbackColor, textFill.opacity);
|
|
22950
|
+
if (textFill.type === "solid") {
|
|
22951
|
+
ctx.fillStyle = color;
|
|
22952
|
+
this._fillText(ctx, glyph, spanPointWithFont);
|
|
22953
|
+
return true;
|
|
22954
|
+
}
|
|
22955
|
+
if (textFill.type === "gradient") {
|
|
22956
|
+
const gradient = this._createTextGradient(ctx, bounds, textFill, fallbackColor);
|
|
22957
|
+
if (!gradient) return false;
|
|
22958
|
+
ctx.fillStyle = gradient;
|
|
22959
|
+
this._fillText(ctx, glyph, spanPointWithFont);
|
|
22960
|
+
return true;
|
|
22961
|
+
}
|
|
22962
|
+
if (textFill.type === "picture") {
|
|
22963
|
+
const pattern = this._createTextPicturePattern(ctx, bounds, textFill);
|
|
22964
|
+
if (!pattern) return false;
|
|
22965
|
+
ctx.fillStyle = pattern;
|
|
22966
|
+
this._fillText(ctx, glyph, spanPointWithFont);
|
|
22967
|
+
return true;
|
|
22968
|
+
}
|
|
22969
|
+
return false;
|
|
22970
|
+
}
|
|
22971
|
+
_getGlyphPaintBounds(glyph, spanPointWithFont) {
|
|
22972
|
+
const { width, bBox } = glyph;
|
|
22973
|
+
const textWidth = Math.max(width, bBox.width, 1);
|
|
22974
|
+
const textHeight = Math.max(bBox.aba + bBox.abd, 1);
|
|
22975
|
+
return {
|
|
22976
|
+
left: spanPointWithFont.x,
|
|
22977
|
+
top: spanPointWithFont.y - bBox.aba,
|
|
22978
|
+
width: textWidth,
|
|
22979
|
+
height: textHeight
|
|
22980
|
+
};
|
|
22981
|
+
}
|
|
22982
|
+
_createTextGradient(ctx, bounds, textFill, fallbackColor) {
|
|
22983
|
+
var _gradient$type, _gradient$angle, _context;
|
|
22984
|
+
const gradient = textFill.gradient;
|
|
22985
|
+
const type = (_gradient$type = gradient === null || gradient === void 0 ? void 0 : gradient.type) !== null && _gradient$type !== void 0 ? _gradient$type : "linear";
|
|
22986
|
+
const angle = (_gradient$angle = gradient === null || gradient === void 0 ? void 0 : gradient.angle) !== null && _gradient$angle !== void 0 ? _gradient$angle : 0;
|
|
22987
|
+
const stops = this._normalizeGradientStops(gradient === null || gradient === void 0 ? void 0 : gradient.stops, textFill.color || fallbackColor);
|
|
22988
|
+
const centerX = bounds.left + bounds.width / 2;
|
|
22989
|
+
const centerY = bounds.top + bounds.height / 2;
|
|
22990
|
+
let canvasGradient;
|
|
22991
|
+
if (type === "radial") {
|
|
22992
|
+
const radius = Math.max(bounds.width, bounds.height) / 2;
|
|
22993
|
+
canvasGradient = ctx.createRadialGradient(centerX, centerY, 0, centerX, centerY, radius);
|
|
22994
|
+
} else if (type === "angular" && "createConicGradient" in ((_context = ctx._context) !== null && _context !== void 0 ? _context : ctx)) {
|
|
22995
|
+
var _context2;
|
|
22996
|
+
canvasGradient = ((_context2 = ctx._context) !== null && _context2 !== void 0 ? _context2 : ctx).createConicGradient((angle - 90) * Math.PI / 180, centerX, centerY);
|
|
22997
|
+
} else if (type === "diamond") {
|
|
22998
|
+
const radius = Math.max(bounds.width, bounds.height) / 2;
|
|
22999
|
+
canvasGradient = ctx.createRadialGradient(centerX, centerY, 0, centerX, centerY, radius);
|
|
23000
|
+
} else {
|
|
23001
|
+
const line = this._getLinearGradientLine(bounds, angle);
|
|
23002
|
+
canvasGradient = ctx.createLinearGradient(line.x0, line.y0, line.x1, line.y1);
|
|
23003
|
+
}
|
|
23004
|
+
for (const stop of stops) {
|
|
23005
|
+
var _textFill$opacity, _stop$opacity;
|
|
23006
|
+
const opacity = ((_textFill$opacity = textFill.opacity) !== null && _textFill$opacity !== void 0 ? _textFill$opacity : 1) * ((_stop$opacity = stop.opacity) !== null && _stop$opacity !== void 0 ? _stop$opacity : 1);
|
|
23007
|
+
canvasGradient.addColorStop(stop.offset, this._colorWithOpacity(stop.color, opacity));
|
|
23008
|
+
}
|
|
23009
|
+
return canvasGradient;
|
|
23010
|
+
}
|
|
23011
|
+
_createTextPicturePattern(ctx, bounds, textFill) {
|
|
23012
|
+
var _textFill$picture, _ref, _textFill$picture$opa, _textFill$picture2, _textFill$picture3, _pattern$setTransform;
|
|
23013
|
+
const source = (_textFill$picture = textFill.picture) === null || _textFill$picture === void 0 ? void 0 : _textFill$picture.source;
|
|
23014
|
+
if (!source) return null;
|
|
23015
|
+
const image = this._getTextFillImage(source);
|
|
23016
|
+
if (!image || !image.complete || !(image.naturalWidth || image.width)) return null;
|
|
23017
|
+
const canvas = document.createElement("canvas");
|
|
23018
|
+
canvas.width = Math.max(1, Math.ceil(bounds.width));
|
|
23019
|
+
canvas.height = Math.max(1, Math.ceil(bounds.height));
|
|
23020
|
+
const canvasContext = canvas.getContext("2d");
|
|
23021
|
+
if (!canvasContext) return null;
|
|
23022
|
+
canvasContext.globalAlpha = this._clamp((_ref = (_textFill$picture$opa = (_textFill$picture2 = textFill.picture) === null || _textFill$picture2 === void 0 ? void 0 : _textFill$picture2.opacity) !== null && _textFill$picture$opa !== void 0 ? _textFill$picture$opa : textFill.opacity) !== null && _ref !== void 0 ? _ref : 1, 0, 1);
|
|
23023
|
+
if (((_textFill$picture3 = textFill.picture) === null || _textFill$picture3 === void 0 ? void 0 : _textFill$picture3.mode) === "tile") {
|
|
23024
|
+
var _textFill$picture$sca, _textFill$picture$sca2, _textFill$picture$off, _textFill$picture$off2;
|
|
23025
|
+
const scaleX = (_textFill$picture$sca = textFill.picture.scaleX) !== null && _textFill$picture$sca !== void 0 ? _textFill$picture$sca : 1;
|
|
23026
|
+
const scaleY = (_textFill$picture$sca2 = textFill.picture.scaleY) !== null && _textFill$picture$sca2 !== void 0 ? _textFill$picture$sca2 : 1;
|
|
23027
|
+
const cellWidth = Math.max(1, (image.naturalWidth || image.width) * scaleX);
|
|
23028
|
+
const cellHeight = Math.max(1, (image.naturalHeight || image.height) * scaleY);
|
|
23029
|
+
const offsetX = (_textFill$picture$off = textFill.picture.offsetX) !== null && _textFill$picture$off !== void 0 ? _textFill$picture$off : 0;
|
|
23030
|
+
const offsetY = (_textFill$picture$off2 = textFill.picture.offsetY) !== null && _textFill$picture$off2 !== void 0 ? _textFill$picture$off2 : 0;
|
|
23031
|
+
for (let x = (offsetX % cellWidth + cellWidth) % cellWidth - cellWidth; x < canvas.width; x += cellWidth) for (let y = (offsetY % cellHeight + cellHeight) % cellHeight - cellHeight; y < canvas.height; y += cellHeight) canvasContext.drawImage(image, x, y, cellWidth, cellHeight);
|
|
23032
|
+
} else canvasContext.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
23033
|
+
const pattern = ctx.createPattern(canvas, "no-repeat");
|
|
23034
|
+
pattern === null || pattern === void 0 || (_pattern$setTransform = pattern.setTransform) === null || _pattern$setTransform === void 0 || _pattern$setTransform.call(pattern, new DOMMatrix().translate(bounds.left, bounds.top));
|
|
23035
|
+
return pattern;
|
|
23036
|
+
}
|
|
23037
|
+
_getTextFillImage(source) {
|
|
23038
|
+
const cached = this._textFillImageCache.get(source);
|
|
23039
|
+
if (cached) return cached;
|
|
23040
|
+
const image = new Image();
|
|
23041
|
+
image.crossOrigin = "anonymous";
|
|
23042
|
+
image.src = source;
|
|
23043
|
+
this._textFillImageCache.set(source, image);
|
|
23044
|
+
return image.complete ? image : null;
|
|
23045
|
+
}
|
|
23046
|
+
_normalizeGradientStops(stops, fallbackColor) {
|
|
23047
|
+
return (stops && stops.length >= 2 ? stops : [{
|
|
23048
|
+
offset: 0,
|
|
23049
|
+
color: fallbackColor
|
|
23050
|
+
}, {
|
|
23051
|
+
offset: 100,
|
|
23052
|
+
color: "#ffffff"
|
|
23053
|
+
}]).map((stop) => ({
|
|
23054
|
+
color: stop.color,
|
|
23055
|
+
offset: this._clamp(stop.offset > 1 ? stop.offset / 100 : stop.offset, 0, 1),
|
|
23056
|
+
opacity: stop.opacity
|
|
23057
|
+
}));
|
|
23058
|
+
}
|
|
23059
|
+
_getLinearGradientLine(bounds, angle) {
|
|
23060
|
+
const angleRad = angle * Math.PI / 180;
|
|
23061
|
+
const centerX = bounds.left + bounds.width / 2;
|
|
23062
|
+
const centerY = bounds.top + bounds.height / 2;
|
|
23063
|
+
const cos = Math.cos(angleRad);
|
|
23064
|
+
const sin = Math.sin(angleRad);
|
|
23065
|
+
const halfDiagonal = (Math.abs(bounds.width * cos) + Math.abs(bounds.height * sin)) / 2;
|
|
23066
|
+
return {
|
|
23067
|
+
x0: centerX - cos * halfDiagonal,
|
|
23068
|
+
y0: centerY - sin * halfDiagonal,
|
|
23069
|
+
x1: centerX + cos * halfDiagonal,
|
|
23070
|
+
y1: centerY + sin * halfDiagonal
|
|
23071
|
+
};
|
|
23072
|
+
}
|
|
23073
|
+
_colorWithOpacity(color, opacity) {
|
|
23074
|
+
if (opacity === void 0 || opacity >= 1) return color;
|
|
23075
|
+
const alpha = this._clamp(opacity, 0, 1);
|
|
23076
|
+
const hex = color.trim();
|
|
23077
|
+
if (/^#[0-9a-f]{3}$/i.test(hex)) {
|
|
23078
|
+
const [, r, g, b] = hex;
|
|
23079
|
+
return `rgba(${Number.parseInt(r + r, 16)}, ${Number.parseInt(g + g, 16)}, ${Number.parseInt(b + b, 16)}, ${alpha})`;
|
|
23080
|
+
}
|
|
23081
|
+
if (/^#[0-9a-f]{6}$/i.test(hex)) return `rgba(${Number.parseInt(hex.slice(1, 3), 16)}, ${Number.parseInt(hex.slice(3, 5), 16)}, ${Number.parseInt(hex.slice(5, 7), 16)}, ${alpha})`;
|
|
23082
|
+
return color;
|
|
23083
|
+
}
|
|
23084
|
+
_clamp(value, min, max) {
|
|
23085
|
+
return Math.max(min, Math.min(max, value));
|
|
23086
|
+
}
|
|
21628
23087
|
_fillText(ctx, glyph, spanPointWithFont) {
|
|
21629
23088
|
const { renderConfig, spanStartPoint, centerPoint } = this.extensionOffset;
|
|
21630
23089
|
const { content, width, bBox } = glyph;
|
|
@@ -21908,7 +23367,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
21908
23367
|
for (let i = 0, len = pages.length; i < len; i++) {
|
|
21909
23368
|
var _skeHeaders$get, _headerSkeletonPage$m, _skeFooters$get;
|
|
21910
23369
|
const page = pages[i];
|
|
21911
|
-
const { sections, marginTop: pagePaddingTop = 0, marginBottom: pagePaddingBottom = 0, marginLeft: pagePaddingLeft = 0, marginRight: pagePaddingRight = 0, width: actualWidth, height: actualHeight, pageWidth, headerId, footerId, renderConfig = {}, skeTables } = page;
|
|
23370
|
+
const { sections, marginTop: pagePaddingTop = 0, marginBottom: pagePaddingBottom = 0, marginLeft: pagePaddingLeft = 0, marginRight: pagePaddingRight = 0, width: actualWidth, height: actualHeight, pageWidth, headerId, footerId, renderConfig = {}, skeTables, skeColumnGroups = /* @__PURE__ */ new Map() } = page;
|
|
21912
23371
|
const { verticalAlign = VerticalAlign.TOP, horizontalAlign = HorizontalAlign.LEFT, centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0, wrapStrategy = WrapStrategy.UNSPECIFIED, cellValueType } = renderConfig;
|
|
21913
23372
|
const isVertical = vertexAngleDeg === 90 && centerAngleDeg === 90;
|
|
21914
23373
|
const horizontalOffsetNoAngle = this._horizontalHandler(actualWidth, pagePaddingLeft, pagePaddingRight, horizontalAlign, vertexAngleDeg, centerAngleDeg, cellValueType);
|
|
@@ -21972,24 +23431,14 @@ var Documents = class Documents extends DocComponent {
|
|
|
21972
23431
|
this._drawLiquid.translateSave();
|
|
21973
23432
|
this._drawLiquid.translateLine(line, true, true);
|
|
21974
23433
|
rotateTranslateXListApply && this._drawLiquid.translate(rotateTranslateXListApply[i]);
|
|
23434
|
+
this._drawLineBackground(ctx, page, line);
|
|
21975
23435
|
const divideLength = divides.length;
|
|
21976
23436
|
for (let i = 0; i < divideLength; i++) {
|
|
21977
23437
|
const divide = divides[i];
|
|
21978
23438
|
const { glyphGroup } = divide;
|
|
21979
23439
|
this._drawLiquid.translateSave();
|
|
21980
23440
|
this._drawLiquid.translateDivide(divide, isVertical && wrapStrategy === WrapStrategy.WRAP, verticalAlign, rotatedHeightStore);
|
|
21981
|
-
|
|
21982
|
-
if (!glyph.content || glyph.content.length === 0) continue;
|
|
21983
|
-
const { width: spanWidth, left: spanLeft } = glyph;
|
|
21984
|
-
const { x: translateX, y: translateY } = this._drawLiquid;
|
|
21985
|
-
const originTranslate = Vector2.create(translateX, translateY);
|
|
21986
|
-
const centerPoint = Vector2.create(spanWidth / 2, lineHeight / 2);
|
|
21987
|
-
const extensionOffset = { spanStartPoint: calculateRectRotate(originTranslate.addByPoint(spanLeft, 0), centerPoint, centerAngle, vertexAngle, alignOffset) };
|
|
21988
|
-
if (backgroundExtension) {
|
|
21989
|
-
backgroundExtension.extensionOffset = extensionOffset;
|
|
21990
|
-
backgroundExtension.draw(ctx, parentScale, glyph);
|
|
21991
|
-
}
|
|
21992
|
-
}
|
|
23441
|
+
this._drawGlyphGroupBackgrounds(ctx, parentScale, glyphGroup, lineHeight, alignOffset, centerAngle, vertexAngle, backgroundExtension);
|
|
21993
23442
|
for (const glyph of glyphGroup) {
|
|
21994
23443
|
if (!glyph.content || glyph.content.length === 0) continue;
|
|
21995
23444
|
const { width: spanWidth, left: spanLeft, xOffset } = glyph;
|
|
@@ -22018,6 +23467,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
22018
23467
|
this._drawLiquid.translateRestore();
|
|
22019
23468
|
}
|
|
22020
23469
|
}
|
|
23470
|
+
if (skeColumnGroups.size > 0) this._drawColumnGroups(ctx, page, skeColumnGroups, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
22021
23471
|
this._resetRotation(ctx, finalAngle);
|
|
22022
23472
|
const footerSkeletonPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
22023
23473
|
if (footerSkeletonPage) {
|
|
@@ -22045,15 +23495,18 @@ var Documents = class Documents extends DocComponent {
|
|
|
22045
23495
|
const viewport = this._getTableViewport(page, tableSkeleton, renderUnitId, sourceTableId);
|
|
22046
23496
|
drawLiquid.translateSave();
|
|
22047
23497
|
drawLiquid.translate(tableLeft, tableTop);
|
|
22048
|
-
if (viewport
|
|
23498
|
+
if (hasDocsTableHorizontalViewport(viewport)) {
|
|
23499
|
+
var _viewport$leadingInse;
|
|
22049
23500
|
const { x, y } = drawLiquid;
|
|
23501
|
+
const clipLeft = x + page.marginLeft - ((_viewport$leadingInse = viewport.leadingInsetLeft) !== null && _viewport$leadingInse !== void 0 ? _viewport$leadingInse : 0);
|
|
22050
23502
|
ctx.save();
|
|
22051
23503
|
ctx.beginPath();
|
|
22052
|
-
ctx.rectByPrecision(
|
|
23504
|
+
ctx.rectByPrecision(clipLeft - TABLE_VIEWPORT_BORDER_CLIP_PADDING, y + page.marginTop - TABLE_VIEWPORT_BORDER_CLIP_PADDING, viewport.viewportWidth + TABLE_VIEWPORT_BORDER_CLIP_PADDING * 2, tableSkeleton.height + TABLE_VIEWPORT_BORDER_CLIP_PADDING * 2);
|
|
22053
23505
|
ctx.closePath();
|
|
22054
23506
|
ctx.clip();
|
|
22055
23507
|
drawLiquid.translate(-viewport.scrollLeft, 0);
|
|
22056
23508
|
}
|
|
23509
|
+
this._drawTableCellBackgrounds(ctx, page, tableSkeleton);
|
|
22057
23510
|
for (const row of rows) {
|
|
22058
23511
|
const { top: rowTop, cells } = row;
|
|
22059
23512
|
drawLiquid.translateSave();
|
|
@@ -22068,16 +23521,64 @@ var Documents = class Documents extends DocComponent {
|
|
|
22068
23521
|
}
|
|
22069
23522
|
drawLiquid.translateRestore();
|
|
22070
23523
|
}
|
|
22071
|
-
if (viewport
|
|
23524
|
+
if (hasDocsTableHorizontalViewport(viewport)) ctx.restore();
|
|
22072
23525
|
drawLiquid.translateRestore();
|
|
22073
23526
|
}
|
|
22074
23527
|
}
|
|
23528
|
+
_drawColumnGroups(ctx, page, skeColumnGroups, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale) {
|
|
23529
|
+
const drawLiquid = this._drawLiquid;
|
|
23530
|
+
if (drawLiquid == null) return;
|
|
23531
|
+
for (const columnGroup of skeColumnGroups.values()) {
|
|
23532
|
+
drawLiquid.translateSave();
|
|
23533
|
+
drawLiquid.translate(columnGroup.left, columnGroup.top);
|
|
23534
|
+
for (const column of columnGroup.columns) {
|
|
23535
|
+
drawLiquid.translateSave();
|
|
23536
|
+
drawLiquid.translate(column.left, column.top);
|
|
23537
|
+
this._drawNestedPageContent(ctx, page, column.page, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23538
|
+
drawLiquid.translateRestore();
|
|
23539
|
+
}
|
|
23540
|
+
drawLiquid.translateRestore();
|
|
23541
|
+
}
|
|
23542
|
+
}
|
|
23543
|
+
_drawTableCellBackgrounds(ctx, page, tableSkeleton) {
|
|
23544
|
+
if (this._drawLiquid == null) return;
|
|
23545
|
+
const backgrounds = /* @__PURE__ */ new Map();
|
|
23546
|
+
const tableX = this._drawLiquid.x + page.marginLeft;
|
|
23547
|
+
const tableY = this._drawLiquid.y + page.marginTop;
|
|
23548
|
+
for (const row of tableSkeleton.rows) row.cells.forEach((cell, index) => {
|
|
23549
|
+
var _cellSource$backgroun, _backgrounds$get;
|
|
23550
|
+
if (cell.isMergedCellCovered) return;
|
|
23551
|
+
const cellSource = row.rowSource.tableCells[index];
|
|
23552
|
+
if (!cellSource || cellSource.rowSpan === 0 || cellSource.columnSpan === 0) return;
|
|
23553
|
+
const color = (_cellSource$backgroun = cellSource.backgroundColor) === null || _cellSource$backgroun === void 0 ? void 0 : _cellSource$backgroun.rgb;
|
|
23554
|
+
if (!color) return;
|
|
23555
|
+
const rects = (_backgrounds$get = backgrounds.get(color)) !== null && _backgrounds$get !== void 0 ? _backgrounds$get : [];
|
|
23556
|
+
rects.push({
|
|
23557
|
+
x: tableX + cell.left,
|
|
23558
|
+
y: tableY + row.top,
|
|
23559
|
+
width: cell.pageWidth,
|
|
23560
|
+
height: cell.pageHeight
|
|
23561
|
+
});
|
|
23562
|
+
backgrounds.set(color, rects);
|
|
23563
|
+
});
|
|
23564
|
+
backgrounds.forEach((rects, color) => {
|
|
23565
|
+
ctx.save();
|
|
23566
|
+
ctx.fillStyle = color;
|
|
23567
|
+
ctx.beginPath();
|
|
23568
|
+
rects.forEach(({ x, y, width, height }) => {
|
|
23569
|
+
rectByPrecisionBounds(ctx, x, y, width, height);
|
|
23570
|
+
});
|
|
23571
|
+
ctx.fill();
|
|
23572
|
+
ctx.closePath();
|
|
23573
|
+
ctx.restore();
|
|
23574
|
+
});
|
|
23575
|
+
}
|
|
22075
23576
|
_getTableViewport(page, tableSkeleton, unitId, tableId) {
|
|
22076
23577
|
const viewport = getDocsTableRenderViewport(unitId, tableId);
|
|
22077
23578
|
if (viewport) return viewport;
|
|
22078
23579
|
const { pageWidth, marginLeft = 0, marginRight = 0 } = page;
|
|
22079
23580
|
if (!Number.isFinite(pageWidth)) return null;
|
|
22080
|
-
const viewportWidth = Math.max(0, pageWidth - marginLeft - marginRight - tableSkeleton.left);
|
|
23581
|
+
const viewportWidth = shouldAllowImportedTableMarginOverflow(this._getDocumentCompatibilityPolicy(), tableSkeleton.tableSource) ? Math.max(0, pageWidth - Math.max(0, marginLeft + tableSkeleton.left)) : Math.max(0, pageWidth - marginLeft - marginRight - tableSkeleton.left);
|
|
22081
23582
|
if (viewportWidth <= 0 || tableSkeleton.width <= viewportWidth) return null;
|
|
22082
23583
|
return {
|
|
22083
23584
|
contentWidth: tableSkeleton.width,
|
|
@@ -22092,6 +23593,26 @@ var Documents = class Documents extends DocComponent {
|
|
|
22092
23593
|
const dataModel = viewModel === null || viewModel === void 0 || (_viewModel$getDataMod = viewModel.getDataModel) === null || _viewModel$getDataMod === void 0 ? void 0 : _viewModel$getDataMod.call(viewModel);
|
|
22093
23594
|
return (_dataModel$getUnitId = dataModel === null || dataModel === void 0 || (_dataModel$getUnitId2 = dataModel.getUnitId) === null || _dataModel$getUnitId2 === void 0 ? void 0 : _dataModel$getUnitId2.call(dataModel)) !== null && _dataModel$getUnitId !== void 0 ? _dataModel$getUnitId : this.oKey;
|
|
22094
23595
|
}
|
|
23596
|
+
_getDocumentCompatibilityPolicy() {
|
|
23597
|
+
var _skeleton$getViewMode2, _skeleton$getViewMode3;
|
|
23598
|
+
const skeleton = this.getSkeleton();
|
|
23599
|
+
return getDocumentCompatibilityPolicy(skeleton === null || skeleton === void 0 || (_skeleton$getViewMode2 = skeleton.getViewModel) === null || _skeleton$getViewMode2 === void 0 || (_skeleton$getViewMode2 = _skeleton$getViewMode2.call(skeleton)) === null || _skeleton$getViewMode2 === void 0 || (_skeleton$getViewMode3 = _skeleton$getViewMode2.getSnapshot) === null || _skeleton$getViewMode3 === void 0 || (_skeleton$getViewMode3 = _skeleton$getViewMode3.call(_skeleton$getViewMode2)) === null || _skeleton$getViewMode3 === void 0 || (_skeleton$getViewMode3 = _skeleton$getViewMode3.documentStyle) === null || _skeleton$getViewMode3 === void 0 ? void 0 : _skeleton$getViewMode3.documentFlavor);
|
|
23600
|
+
}
|
|
23601
|
+
_drawLineBackground(ctx, page, line, left = 0, top = 0) {
|
|
23602
|
+
var _line$backgroundColor;
|
|
23603
|
+
const color = (_line$backgroundColor = line.backgroundColor) === null || _line$backgroundColor === void 0 ? void 0 : _line$backgroundColor.rgb;
|
|
23604
|
+
if (!color || this._drawLiquid == null) return;
|
|
23605
|
+
let { x, y } = this._drawLiquid;
|
|
23606
|
+
const { pageWidth, marginLeft, marginRight, marginTop } = page;
|
|
23607
|
+
x += marginLeft + (left !== null && left !== void 0 ? left : 0);
|
|
23608
|
+
y -= line.marginTop;
|
|
23609
|
+
y -= line.paddingTop;
|
|
23610
|
+
y += marginTop + top;
|
|
23611
|
+
ctx.save();
|
|
23612
|
+
ctx.fillStyle = color;
|
|
23613
|
+
fillRectByPrecisionBounds(ctx, x, y, pageWidth - marginLeft - marginRight, line.lineHeight);
|
|
23614
|
+
ctx.restore();
|
|
23615
|
+
}
|
|
22095
23616
|
_drawBorderBottom(ctx, page, line, left = 0, top = 0) {
|
|
22096
23617
|
var _line$borderBottom$pa, _line$borderBottom, _line$borderBottom$co, _line$borderBottom2;
|
|
22097
23618
|
if (this._drawLiquid == null) return;
|
|
@@ -22112,18 +23633,48 @@ var Documents = class Documents extends DocComponent {
|
|
|
22112
23633
|
});
|
|
22113
23634
|
ctx.restore();
|
|
22114
23635
|
}
|
|
23636
|
+
_drawGlyphGroupBackgrounds(ctx, parentScale, glyphGroup, lineHeight, alignOffset, centerAngle, vertexAngle, backgroundExtension) {
|
|
23637
|
+
if (!backgroundExtension || this._drawLiquid == null) return;
|
|
23638
|
+
const backgroundRuns = collectBackgroundGlyphRuns(glyphGroup);
|
|
23639
|
+
for (const backgroundRun of backgroundRuns) {
|
|
23640
|
+
const { glyph, left: spanLeft, width: spanWidth } = backgroundRun;
|
|
23641
|
+
const { x: translateX, y: translateY } = this._drawLiquid;
|
|
23642
|
+
const originTranslate = Vector2.create(translateX, translateY);
|
|
23643
|
+
const centerPoint = Vector2.create(spanWidth / 2, lineHeight / 2);
|
|
23644
|
+
backgroundExtension.extensionOffset = { spanStartPoint: calculateRectRotate(originTranslate.addByPoint(spanLeft, 0), centerPoint, centerAngle, vertexAngle, alignOffset) };
|
|
23645
|
+
backgroundExtension.draw(ctx, parentScale, glyph);
|
|
23646
|
+
}
|
|
23647
|
+
}
|
|
22115
23648
|
_drawTableCell(ctx, page, cell, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale) {
|
|
22116
23649
|
if (this._drawLiquid == null) return;
|
|
22117
|
-
this._drawTableCellBordersAndBg(ctx, page, cell);
|
|
22118
|
-
|
|
22119
|
-
|
|
23650
|
+
this._drawTableCellBordersAndBg(ctx, page, cell, false);
|
|
23651
|
+
this._drawNestedPageContent(ctx, page, cell, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23652
|
+
}
|
|
23653
|
+
_drawNestedPageContent(ctx, parentPage, nestedPage, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale) {
|
|
23654
|
+
if (this._drawLiquid == null) return;
|
|
23655
|
+
const { sections, marginLeft, marginTop, skeTables } = nestedPage;
|
|
23656
|
+
const alignOffset = Vector2.create(alignOffsetNoAngle.x + marginLeft, alignOffsetNoAngle.y + marginTop);
|
|
22120
23657
|
ctx.save();
|
|
22121
23658
|
const { x, y } = this._drawLiquid;
|
|
22122
|
-
const { pageWidth, pageHeight } =
|
|
23659
|
+
const { pageWidth, pageHeight } = nestedPage;
|
|
23660
|
+
const clipOrigin = getNestedPageClipOrigin(parentPage, nestedPage, {
|
|
23661
|
+
x,
|
|
23662
|
+
y
|
|
23663
|
+
}, alignOffset);
|
|
22123
23664
|
ctx.beginPath();
|
|
22124
|
-
ctx.rectByPrecision(x
|
|
23665
|
+
ctx.rectByPrecision(clipOrigin.x, clipOrigin.y, pageWidth, pageHeight);
|
|
22125
23666
|
ctx.closePath();
|
|
22126
23667
|
ctx.clip();
|
|
23668
|
+
if (skeTables.size > 0) if (isColumnGroupNestedPage(nestedPage)) {
|
|
23669
|
+
this._drawLiquid.translateSave();
|
|
23670
|
+
this._drawLiquid.translate(alignOffset.x, alignOffset.y);
|
|
23671
|
+
this._drawTable(ctx, {
|
|
23672
|
+
...nestedPage,
|
|
23673
|
+
marginLeft: 0,
|
|
23674
|
+
marginTop: 0
|
|
23675
|
+
}, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, Vector2.create(0, 0), centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23676
|
+
this._drawLiquid.translateRestore();
|
|
23677
|
+
} else this._drawTable(ctx, nestedPage, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffset, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
22127
23678
|
for (const section of sections) {
|
|
22128
23679
|
const { columns } = section;
|
|
22129
23680
|
this._drawLiquid.translateSave();
|
|
@@ -22133,7 +23684,6 @@ var Documents = class Documents extends DocComponent {
|
|
|
22133
23684
|
this._drawLiquid.translateSave();
|
|
22134
23685
|
this._drawLiquid.translateColumn(column);
|
|
22135
23686
|
const linesCount = lines.length;
|
|
22136
|
-
const alignOffset = alignOffsetNoAngle;
|
|
22137
23687
|
for (let i = 0; i < linesCount; i++) {
|
|
22138
23688
|
const line = lines[i];
|
|
22139
23689
|
const { divides, asc = 0, type, lineHeight = 0 } = line;
|
|
@@ -22151,24 +23701,14 @@ var Documents = class Documents extends DocComponent {
|
|
|
22151
23701
|
} else {
|
|
22152
23702
|
this._drawLiquid.translateSave();
|
|
22153
23703
|
this._drawLiquid.translateLine(line, true, true);
|
|
23704
|
+
this._drawLineBackground(ctx, nestedPage, line);
|
|
22154
23705
|
const divideLength = divides.length;
|
|
22155
23706
|
for (let i = 0; i < divideLength; i++) {
|
|
22156
23707
|
const divide = divides[i];
|
|
22157
23708
|
const { glyphGroup } = divide;
|
|
22158
23709
|
this._drawLiquid.translateSave();
|
|
22159
23710
|
this._drawLiquid.translateDivide(divide);
|
|
22160
|
-
|
|
22161
|
-
if (!glyph.content || glyph.content.length === 0) continue;
|
|
22162
|
-
const { width: spanWidth, left: spanLeft } = glyph;
|
|
22163
|
-
const { x: translateX, y: translateY } = this._drawLiquid;
|
|
22164
|
-
const originTranslate = Vector2.create(translateX, translateY);
|
|
22165
|
-
const centerPoint = Vector2.create(spanWidth / 2, lineHeight / 2);
|
|
22166
|
-
const extensionOffset = { spanStartPoint: calculateRectRotate(originTranslate.addByPoint(spanLeft, 0), centerPoint, centerAngle, vertexAngle, alignOffset) };
|
|
22167
|
-
if (backgroundExtension) {
|
|
22168
|
-
backgroundExtension.extensionOffset = extensionOffset;
|
|
22169
|
-
backgroundExtension.draw(ctx, parentScale, glyph);
|
|
22170
|
-
}
|
|
22171
|
-
}
|
|
23711
|
+
this._drawGlyphGroupBackgrounds(ctx, parentScale, glyphGroup, lineHeight, alignOffset, centerAngle, vertexAngle, backgroundExtension);
|
|
22172
23712
|
for (const glyph of glyphGroup) {
|
|
22173
23713
|
if (!glyph.content || glyph.content.length === 0) continue;
|
|
22174
23714
|
const { width: spanWidth, left: spanLeft, xOffset } = glyph;
|
|
@@ -22190,7 +23730,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
22190
23730
|
}
|
|
22191
23731
|
this._drawLiquid.translateRestore();
|
|
22192
23732
|
}
|
|
22193
|
-
if (line.borderBottom) this._drawBorderBottom(ctx,
|
|
23733
|
+
if (line.borderBottom) this._drawBorderBottom(ctx, nestedPage, line, parentPage.marginLeft, parentPage.marginTop);
|
|
22194
23734
|
this._drawLiquid.translateRestore();
|
|
22195
23735
|
}
|
|
22196
23736
|
}
|
|
@@ -22200,8 +23740,8 @@ var Documents = class Documents extends DocComponent {
|
|
|
22200
23740
|
}
|
|
22201
23741
|
ctx.restore();
|
|
22202
23742
|
}
|
|
22203
|
-
_drawTableCellBordersAndBg(ctx, page, cell) {
|
|
22204
|
-
var _rowSke$index, _cellSource$
|
|
23743
|
+
_drawTableCellBordersAndBg(ctx, page, cell, drawBackground = true) {
|
|
23744
|
+
var _rowSke$index, _cellSource$backgroun2;
|
|
22205
23745
|
const { marginLeft, marginTop } = page;
|
|
22206
23746
|
const { pageWidth, pageHeight } = cell;
|
|
22207
23747
|
const rowSke = cell.parent;
|
|
@@ -22216,10 +23756,10 @@ var Documents = class Documents extends DocComponent {
|
|
|
22216
23756
|
let { x, y } = this._drawLiquid;
|
|
22217
23757
|
x += marginLeft;
|
|
22218
23758
|
y += marginTop;
|
|
22219
|
-
if ((_cellSource$
|
|
23759
|
+
if (drawBackground && ((_cellSource$backgroun2 = cellSource.backgroundColor) === null || _cellSource$backgroun2 === void 0 ? void 0 : _cellSource$backgroun2.rgb)) {
|
|
22220
23760
|
ctx.save();
|
|
22221
23761
|
ctx.fillStyle = cellSource.backgroundColor.rgb;
|
|
22222
|
-
ctx
|
|
23762
|
+
fillRectByPrecisionBounds(ctx, x, y, pageWidth, pageHeight);
|
|
22223
23763
|
ctx.restore();
|
|
22224
23764
|
}
|
|
22225
23765
|
const position = {
|
|
@@ -22267,8 +23807,9 @@ var Documents = class Documents extends DocComponent {
|
|
|
22267
23807
|
}
|
|
22268
23808
|
_drawHeaderFooter(page, ctx, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale, parentPage, isHeader = true) {
|
|
22269
23809
|
if (this._drawLiquid == null) return;
|
|
22270
|
-
const { sections } = page;
|
|
23810
|
+
const { sections, skeTables } = page;
|
|
22271
23811
|
const { y: originY } = this._drawLiquid;
|
|
23812
|
+
if (skeTables.size > 0) this._drawTable(ctx, page, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
22272
23813
|
for (const section of sections) {
|
|
22273
23814
|
const { columns } = section;
|
|
22274
23815
|
this._drawLiquid.translateSave();
|
|
@@ -22297,33 +23838,20 @@ var Documents = class Documents extends DocComponent {
|
|
|
22297
23838
|
this._drawLiquid.translateSave();
|
|
22298
23839
|
this._drawLiquid.translateLine(line, true, true);
|
|
22299
23840
|
const { y } = this._drawLiquid;
|
|
22300
|
-
if (isHeader) {
|
|
22301
|
-
if (y - originY + alignOffset.y
|
|
23841
|
+
if (!isHeader) {
|
|
23842
|
+
if (y - originY + alignOffset.y + lineHeight < (parentPage.pageHeight - 100) / 2 + 100) {
|
|
22302
23843
|
this._drawLiquid.translateRestore();
|
|
22303
23844
|
continue;
|
|
22304
23845
|
}
|
|
22305
|
-
} else if (y - originY + alignOffset.y + lineHeight < (parentPage.pageHeight - 100) / 2 + 100) {
|
|
22306
|
-
this._drawLiquid.translateRestore();
|
|
22307
|
-
continue;
|
|
22308
23846
|
}
|
|
23847
|
+
this._drawLineBackground(ctx, page, line, parentPage.marginLeft);
|
|
22309
23848
|
const divideLength = divides.length;
|
|
22310
23849
|
for (let i = 0; i < divideLength; i++) {
|
|
22311
23850
|
const divide = divides[i];
|
|
22312
23851
|
const { glyphGroup } = divide;
|
|
22313
23852
|
this._drawLiquid.translateSave();
|
|
22314
23853
|
this._drawLiquid.translateDivide(divide);
|
|
22315
|
-
|
|
22316
|
-
if (!glyph.content || glyph.content.length === 0) continue;
|
|
22317
|
-
const { width: spanWidth, left: spanLeft } = glyph;
|
|
22318
|
-
const { x: translateX, y: translateY } = this._drawLiquid;
|
|
22319
|
-
const originTranslate = Vector2.create(translateX, translateY);
|
|
22320
|
-
const centerPoint = Vector2.create(spanWidth / 2, lineHeight / 2);
|
|
22321
|
-
const extensionOffset = { spanStartPoint: calculateRectRotate(originTranslate.addByPoint(spanLeft, 0), centerPoint, centerAngle, vertexAngle, alignOffset) };
|
|
22322
|
-
if (backgroundExtension) {
|
|
22323
|
-
backgroundExtension.extensionOffset = extensionOffset;
|
|
22324
|
-
backgroundExtension.draw(ctx, parentScale, glyph);
|
|
22325
|
-
}
|
|
22326
|
-
}
|
|
23854
|
+
this._drawGlyphGroupBackgrounds(ctx, parentScale, glyphGroup, lineHeight, alignOffset, centerAngle, vertexAngle, backgroundExtension);
|
|
22327
23855
|
for (const glyph of glyphGroup) {
|
|
22328
23856
|
if (!glyph.content || glyph.content.length === 0) continue;
|
|
22329
23857
|
const { width: spanWidth, left: spanLeft, xOffset } = glyph;
|
|
@@ -22359,18 +23887,19 @@ var Documents = class Documents extends DocComponent {
|
|
|
22359
23887
|
* In Excel, if horizontal alignment is not specified,
|
|
22360
23888
|
* rotated text aligns to the right when rotated downwards and aligns to the left when rotated upwards.
|
|
22361
23889
|
*/
|
|
22362
|
-
|
|
23890
|
+
let resolvedHorizontalAlign = horizontalAlign;
|
|
23891
|
+
if (resolvedHorizontalAlign === HorizontalAlign.UNSPECIFIED) if (centerAngleDeg === 90 && vertexAngleDeg === 90) resolvedHorizontalAlign = HorizontalAlign.CENTER;
|
|
22363
23892
|
else if (vertexAngleDeg > 0 && vertexAngleDeg !== 90 || vertexAngleDeg === -90)
|
|
22364
23893
|
/**
|
|
22365
23894
|
* https://github.com/dream-num/univer-pro/issues/334
|
|
22366
23895
|
*/
|
|
22367
|
-
|
|
22368
|
-
else if (cellValueType === CellValueType.NUMBER)
|
|
22369
|
-
else if (cellValueType === CellValueType.BOOLEAN)
|
|
22370
|
-
else
|
|
23896
|
+
resolvedHorizontalAlign = HorizontalAlign.RIGHT;
|
|
23897
|
+
else if (cellValueType === CellValueType.NUMBER) resolvedHorizontalAlign = HorizontalAlign.RIGHT;
|
|
23898
|
+
else if (cellValueType === CellValueType.BOOLEAN) resolvedHorizontalAlign = HorizontalAlign.CENTER;
|
|
23899
|
+
else resolvedHorizontalAlign = HorizontalAlign.LEFT;
|
|
22371
23900
|
let offsetLeft = 0;
|
|
22372
|
-
if (
|
|
22373
|
-
else if (
|
|
23901
|
+
if (resolvedHorizontalAlign === HorizontalAlign.CENTER) offsetLeft = (this.width - pageWidth) / 2;
|
|
23902
|
+
else if (resolvedHorizontalAlign === HorizontalAlign.RIGHT) offsetLeft = this.width - pageWidth - pagePaddingRight;
|
|
22374
23903
|
else offsetLeft = pagePaddingLeft;
|
|
22375
23904
|
return offsetLeft;
|
|
22376
23905
|
}
|
|
@@ -22404,6 +23933,37 @@ function setTableCellBorderDash(ctx, dashStyle) {
|
|
|
22404
23933
|
}
|
|
22405
23934
|
ctx.setLineDash([0]);
|
|
22406
23935
|
}
|
|
23936
|
+
function isColumnGroupNestedPage(page) {
|
|
23937
|
+
var _parent$parent;
|
|
23938
|
+
const parent = page.parent;
|
|
23939
|
+
return (parent === null || parent === void 0 ? void 0 : parent.columnId) != null && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.columnGroupId) != null;
|
|
23940
|
+
}
|
|
23941
|
+
function getNestedPageClipOrigin(parentPage, nestedPage, drawOrigin, alignOffset) {
|
|
23942
|
+
if (isColumnGroupNestedPage(nestedPage)) return {
|
|
23943
|
+
x: drawOrigin.x + alignOffset.x,
|
|
23944
|
+
y: drawOrigin.y + alignOffset.y
|
|
23945
|
+
};
|
|
23946
|
+
return {
|
|
23947
|
+
x: drawOrigin.x + parentPage.marginLeft,
|
|
23948
|
+
y: drawOrigin.y + parentPage.marginTop
|
|
23949
|
+
};
|
|
23950
|
+
}
|
|
23951
|
+
function fillRectByPrecisionBounds(ctx, x, y, width, height) {
|
|
23952
|
+
const { scaleX, scaleY } = ctx.getScale();
|
|
23953
|
+
const startX = fixLineWidthByScale(x, scaleX);
|
|
23954
|
+
const startY = fixLineWidthByScale(y, scaleY);
|
|
23955
|
+
const endX = fixLineWidthByScale(x + width, scaleX);
|
|
23956
|
+
const endY = fixLineWidthByScale(y + height, scaleY);
|
|
23957
|
+
ctx.fillRect(startX, startY, endX - startX, endY - startY);
|
|
23958
|
+
}
|
|
23959
|
+
function rectByPrecisionBounds(ctx, x, y, width, height) {
|
|
23960
|
+
const { scaleX, scaleY } = ctx.getScale();
|
|
23961
|
+
const startX = fixLineWidthByScale(x, scaleX);
|
|
23962
|
+
const startY = fixLineWidthByScale(y, scaleY);
|
|
23963
|
+
const endX = fixLineWidthByScale(x + width, scaleX);
|
|
23964
|
+
const endY = fixLineWidthByScale(y + height, scaleY);
|
|
23965
|
+
ctx.rect(startX, startY, endX - startX, endY - startY);
|
|
23966
|
+
}
|
|
22407
23967
|
|
|
22408
23968
|
//#endregion
|
|
22409
23969
|
//#region src/components/sheets/spreadsheet.ts
|
|
@@ -23616,6 +25176,8 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
23616
25176
|
_defineProperty(this, "_pageFillColor", void 0);
|
|
23617
25177
|
_defineProperty(this, "_pageStrokeColor", void 0);
|
|
23618
25178
|
_defineProperty(this, "_marginStrokeColor", void 0);
|
|
25179
|
+
_defineProperty(this, "_pageBackgroundSource", void 0);
|
|
25180
|
+
_defineProperty(this, "_pageBackgroundImage", void 0);
|
|
23619
25181
|
this._drawLiquid = new Liquid();
|
|
23620
25182
|
this._backgroundFillColor = config === null || config === void 0 ? void 0 : config.backgroundFillColor;
|
|
23621
25183
|
this._pageFillColor = config === null || config === void 0 ? void 0 : config.pageFillColor;
|
|
@@ -23639,7 +25201,7 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
23639
25201
|
const skeletonData = (_this$getSkeleton = this.getSkeleton()) === null || _this$getSkeleton === void 0 ? void 0 : _this$getSkeleton.getSkeletonData();
|
|
23640
25202
|
const docDataModel = (_this$getSkeleton2 = this.getSkeleton()) === null || _this$getSkeleton2 === void 0 ? void 0 : _this$getSkeleton2.getViewModel().getDataModel();
|
|
23641
25203
|
if (skeletonData == null || docDataModel == null) return;
|
|
23642
|
-
const { documentFlavor } = docDataModel.getSnapshot().documentStyle;
|
|
25204
|
+
const { documentFlavor, background } = docDataModel.getSnapshot().documentStyle;
|
|
23643
25205
|
const workspaceFill = (_this$_backgroundFill = this._backgroundFillColor) !== null && _this$_backgroundFill !== void 0 ? _this$_backgroundFill : documentFlavor === DocumentFlavor.MODERN ? PAGE_FILL_COLOR : DOCS_WORKSPACE_FILL_COLOR;
|
|
23644
25206
|
this._drawWorkspaceBackground(ctx, workspaceFill, bounds);
|
|
23645
25207
|
if (documentFlavor === DocumentFlavor.MODERN) return;
|
|
@@ -23668,6 +25230,7 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
23668
25230
|
zIndex: 3
|
|
23669
25231
|
};
|
|
23670
25232
|
Rect.drawWith(ctx, backgroundOptions);
|
|
25233
|
+
this._drawPageBackgroundImage(ctx, background === null || background === void 0 ? void 0 : background.source, pageWidth !== null && pageWidth !== void 0 ? pageWidth : width, pageHeight !== null && pageHeight !== void 0 ? pageHeight : height);
|
|
23671
25234
|
const IDENTIFIER_WIDTH = 15;
|
|
23672
25235
|
const marginIdentification = {
|
|
23673
25236
|
dataArray: [
|
|
@@ -23748,6 +25311,22 @@ var DocBackground = class DocBackground extends DocComponent {
|
|
|
23748
25311
|
});
|
|
23749
25312
|
ctx.restore();
|
|
23750
25313
|
}
|
|
25314
|
+
_drawPageBackgroundImage(ctx, source, width, height) {
|
|
25315
|
+
if (!source || width <= 0 || height <= 0) return;
|
|
25316
|
+
const image = this._getPageBackgroundImage(source);
|
|
25317
|
+
if (!image.complete) return;
|
|
25318
|
+
ctx.drawImage(image, 0, 0, width, height);
|
|
25319
|
+
}
|
|
25320
|
+
_getPageBackgroundImage(source) {
|
|
25321
|
+
if (this._pageBackgroundSource === source && this._pageBackgroundImage != null) return this._pageBackgroundImage;
|
|
25322
|
+
const image = document.createElement("img");
|
|
25323
|
+
image.crossOrigin = "anonymous";
|
|
25324
|
+
image.onload = () => this.makeDirty(true);
|
|
25325
|
+
image.src = source;
|
|
25326
|
+
this._pageBackgroundSource = source;
|
|
25327
|
+
this._pageBackgroundImage = image;
|
|
25328
|
+
return image;
|
|
25329
|
+
}
|
|
23751
25330
|
changeSkeleton(newSkeleton) {
|
|
23752
25331
|
this.setSkeleton(newSkeleton);
|
|
23753
25332
|
return this;
|
|
@@ -24184,6 +25763,42 @@ var DumbCanvasColorService = class {
|
|
|
24184
25763
|
return color;
|
|
24185
25764
|
}
|
|
24186
25765
|
};
|
|
25766
|
+
const DARK_RENDER_COLOR_OVERRIDES = {
|
|
25767
|
+
"#17212b": "#e2e8f0",
|
|
25768
|
+
"#64748b": "#94a3b8",
|
|
25769
|
+
"#d9e0e7": "#253044",
|
|
25770
|
+
"#edf1f5": "#1b2535",
|
|
25771
|
+
"#eef2f6": "#1b2535",
|
|
25772
|
+
"#f2f5f8": "#101827",
|
|
25773
|
+
"#f3f6fa": "#18243a",
|
|
25774
|
+
"#f4f8ff": "#172a46",
|
|
25775
|
+
"#f5f9ff": "#12233a",
|
|
25776
|
+
"#f7f9fb": "#0d1422",
|
|
25777
|
+
"#f7f9fc": "#0d1422",
|
|
25778
|
+
"#f8fafc": "#0f172a",
|
|
25779
|
+
"#fbfcfd": "#07111f",
|
|
25780
|
+
"#fcfdff": "#050914",
|
|
25781
|
+
"#e8f1ff": "#173a69",
|
|
25782
|
+
"#eaf5ff": "#12315a",
|
|
25783
|
+
"#dbeafe": "#1e3a8a",
|
|
25784
|
+
"#bfdbfe": "#60a5fa",
|
|
25785
|
+
"#93c5fd": "#60a5fa",
|
|
25786
|
+
"#8eb6f5": "#60a5fa",
|
|
25787
|
+
"#60a5fa": "#60a5fa",
|
|
25788
|
+
"#2563eb": "#60a5fa",
|
|
25789
|
+
"#1d64d8": "#93c5fd",
|
|
25790
|
+
"#1d5cff": "#60a5fa",
|
|
25791
|
+
"#0f766e": "#2dd4bf",
|
|
25792
|
+
"#d7f4ef": "#134e4a",
|
|
25793
|
+
"rgba(37,99,235,0.05)": "rgba(96,165,250,0.16)",
|
|
25794
|
+
"rgba(37,99,235,0.06)": "rgba(96,165,250,0.18)",
|
|
25795
|
+
"rgba(37,99,235,0.08)": "rgba(96,165,250,0.22)",
|
|
25796
|
+
"rgba(37,99,235,0.12)": "rgba(96,165,250,0.26)",
|
|
25797
|
+
"rgba(37,99,235,0.18)": "rgba(96,165,250,0.30)",
|
|
25798
|
+
"rgba(37,99,235,0.28)": "rgba(96,165,250,0.38)",
|
|
25799
|
+
"rgba(239,246,255,0.88)": "rgba(30,64,175,0.72)",
|
|
25800
|
+
"rgba(148,163,184,0.45)": "rgba(148,163,184,0.52)"
|
|
25801
|
+
};
|
|
24187
25802
|
let CanvasColorService = class CanvasColorService extends Disposable {
|
|
24188
25803
|
constructor(_themeService) {
|
|
24189
25804
|
super();
|
|
@@ -24194,8 +25809,14 @@ let CanvasColorService = class CanvasColorService extends Disposable {
|
|
|
24194
25809
|
getRenderColor(color) {
|
|
24195
25810
|
if (!this._themeService.darkMode) return color;
|
|
24196
25811
|
if (this._cache.has(color)) return this._cache.get(color);
|
|
25812
|
+
if (normalizeRenderColor(color) === "transparent") {
|
|
25813
|
+
this._cache.set(color, "transparent");
|
|
25814
|
+
return "transparent";
|
|
25815
|
+
}
|
|
24197
25816
|
let cachedColor = "";
|
|
24198
|
-
|
|
25817
|
+
const mappedColor = getDarkRenderColorOverride(color);
|
|
25818
|
+
if (mappedColor) cachedColor = mappedColor;
|
|
25819
|
+
else if (color.startsWith("#")) {
|
|
24199
25820
|
cachedColor = rgbToHex(this._invertAlgo(hexToRgb(color)));
|
|
24200
25821
|
if (color.length === 5) {
|
|
24201
25822
|
const alpha = color.charAt(4);
|
|
@@ -24227,6 +25848,15 @@ let CanvasColorService = class CanvasColorService extends Disposable {
|
|
|
24227
25848
|
}
|
|
24228
25849
|
};
|
|
24229
25850
|
CanvasColorService = __decorate([__decorateParam(0, Inject(ThemeService))], CanvasColorService);
|
|
25851
|
+
function getDarkRenderColorOverride(color) {
|
|
25852
|
+
var _DARK_RENDER_COLOR_OV;
|
|
25853
|
+
return (_DARK_RENDER_COLOR_OV = DARK_RENDER_COLOR_OVERRIDES[normalizeRenderColor(color)]) !== null && _DARK_RENDER_COLOR_OV !== void 0 ? _DARK_RENDER_COLOR_OV : null;
|
|
25854
|
+
}
|
|
25855
|
+
function normalizeRenderColor(color) {
|
|
25856
|
+
const trimmed = color.trim().toLowerCase();
|
|
25857
|
+
if (trimmed.startsWith("rgb")) return trimmed.replace(/\s+/g, "");
|
|
25858
|
+
return trimmed;
|
|
25859
|
+
}
|
|
24230
25860
|
function hexToRgb(_hex) {
|
|
24231
25861
|
const hex = _hex.replace(/^#/, "");
|
|
24232
25862
|
let r;
|
|
@@ -24900,7 +26530,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
24900
26530
|
//#endregion
|
|
24901
26531
|
//#region package.json
|
|
24902
26532
|
var name = "@univerjs/engine-render";
|
|
24903
|
-
var version = "0.
|
|
26533
|
+
var version = "1.0.0-alpha.1";
|
|
24904
26534
|
|
|
24905
26535
|
//#endregion
|
|
24906
26536
|
//#region src/config/config.ts
|
|
@@ -25372,7 +27002,47 @@ const DEFAULT_TRANSFORMER_LAYER_INDEX = 2;
|
|
|
25372
27002
|
const MINI_WIDTH_LIMIT = 20;
|
|
25373
27003
|
const MINI_HEIGHT_LIMIT = 20;
|
|
25374
27004
|
const DEFAULT_CONTROL_PLUS_INDEX = 5e3;
|
|
25375
|
-
const SINGLE_ACTIVE_OBJECT_TYPE_MAP = new Set([6]);
|
|
27005
|
+
const SINGLE_ACTIVE_OBJECT_TYPE_MAP = /* @__PURE__ */ new Set([6]);
|
|
27006
|
+
const ROTATE_ICON_SIZE = 14;
|
|
27007
|
+
var TransformerRotateIcon = class extends Rect {
|
|
27008
|
+
_draw(ctx) {
|
|
27009
|
+
const iconWidth = this.width || ROTATE_ICON_SIZE;
|
|
27010
|
+
const iconHeight = this.height || ROTATE_ICON_SIZE;
|
|
27011
|
+
const scaleX = iconWidth / 24;
|
|
27012
|
+
const scaleY = iconHeight / 24;
|
|
27013
|
+
ctx.save();
|
|
27014
|
+
ctx.scale(scaleX, scaleY);
|
|
27015
|
+
ctx.beginPath();
|
|
27016
|
+
ctx.lineWidth = (this.strokeWidth || 2) / Math.max(scaleX, scaleY);
|
|
27017
|
+
ctx.lineCap = "round";
|
|
27018
|
+
ctx.lineJoin = "round";
|
|
27019
|
+
ctx.strokeStyle = this.stroke || "currentColor";
|
|
27020
|
+
ctx.moveTo(21, 12);
|
|
27021
|
+
ctx.arc(12, 12, 9, 0, Math.PI * 1.5, false);
|
|
27022
|
+
ctx.bezierCurveTo(14.52, 3, 16.93, 4, 18.74, 5.74);
|
|
27023
|
+
ctx.lineTo(21, 8);
|
|
27024
|
+
ctx.moveTo(21, 3);
|
|
27025
|
+
ctx.lineTo(21, 8);
|
|
27026
|
+
ctx.lineTo(16, 8);
|
|
27027
|
+
ctx.stroke();
|
|
27028
|
+
ctx.restore();
|
|
27029
|
+
}
|
|
27030
|
+
};
|
|
27031
|
+
var TransformerAnchor = class extends Rect {
|
|
27032
|
+
_draw(ctx) {
|
|
27033
|
+
if (!this.shadowColor || !this.shadowBlur && !this.shadowOffsetX && !this.shadowOffsetY) {
|
|
27034
|
+
Rect.drawWith(ctx, this);
|
|
27035
|
+
return;
|
|
27036
|
+
}
|
|
27037
|
+
ctx.save();
|
|
27038
|
+
ctx.shadowColor = this.shadowColor;
|
|
27039
|
+
ctx.shadowBlur = this.shadowBlur;
|
|
27040
|
+
ctx.shadowOffsetX = this.shadowOffsetX;
|
|
27041
|
+
ctx.shadowOffsetY = this.shadowOffsetY;
|
|
27042
|
+
Rect.drawWith(ctx, this);
|
|
27043
|
+
ctx.restore();
|
|
27044
|
+
}
|
|
27045
|
+
};
|
|
25376
27046
|
/**
|
|
25377
27047
|
* Transformer constructor. Transformer is a special type of group that allow you transform
|
|
25378
27048
|
* primitives and shapes. Transforming tool is not changing `width` and `height` properties of nodes
|
|
@@ -25391,8 +27061,16 @@ var Transformer = class extends Disposable {
|
|
|
25391
27061
|
_defineProperty(this, "rotationSnaps", []);
|
|
25392
27062
|
_defineProperty(this, "rotationSnapTolerance", 5);
|
|
25393
27063
|
_defineProperty(this, "rotateAnchorOffset", 50);
|
|
27064
|
+
_defineProperty(this, "rotateAnchorPosition", "top");
|
|
27065
|
+
_defineProperty(this, "rotateLineEnabled", true);
|
|
25394
27066
|
_defineProperty(this, "rotateSize", 10);
|
|
25395
27067
|
_defineProperty(this, "rotateCornerRadius", 10);
|
|
27068
|
+
_defineProperty(this, "rotateFill", void 0);
|
|
27069
|
+
_defineProperty(this, "rotateStroke", void 0);
|
|
27070
|
+
_defineProperty(this, "rotateStrokeWidth", void 0);
|
|
27071
|
+
_defineProperty(this, "rotateIconEnabled", false);
|
|
27072
|
+
_defineProperty(this, "rotateIconStroke", void 0);
|
|
27073
|
+
_defineProperty(this, "rotateIconStrokeWidth", 1.5);
|
|
25396
27074
|
_defineProperty(this, "borderEnabled", true);
|
|
25397
27075
|
_defineProperty(this, "borderStroke", "rgb(97, 97, 97)");
|
|
25398
27076
|
_defineProperty(this, "borderStrokeWidth", 1);
|
|
@@ -25403,10 +27081,19 @@ var Transformer = class extends Disposable {
|
|
|
25403
27081
|
_defineProperty(this, "anchorStrokeWidth", 1);
|
|
25404
27082
|
_defineProperty(this, "anchorSize", 10);
|
|
25405
27083
|
_defineProperty(this, "anchorCornerRadius", 10);
|
|
27084
|
+
_defineProperty(this, "anchorStyle", "default");
|
|
27085
|
+
_defineProperty(this, "anchorSideLongSize", 16);
|
|
27086
|
+
_defineProperty(this, "anchorSideShortSize", 5);
|
|
27087
|
+
_defineProperty(this, "anchorSideCornerRadius", 2.5);
|
|
27088
|
+
_defineProperty(this, "anchorShadowColor", void 0);
|
|
27089
|
+
_defineProperty(this, "anchorShadowBlur", 0);
|
|
27090
|
+
_defineProperty(this, "anchorShadowOffsetX", 0);
|
|
27091
|
+
_defineProperty(this, "anchorShadowOffsetY", 0);
|
|
25406
27092
|
_defineProperty(this, "keepRatio", true);
|
|
25407
27093
|
_defineProperty(this, "centeredScaling", false);
|
|
25408
27094
|
_defineProperty(this, "zeroLeft", 0);
|
|
25409
27095
|
_defineProperty(this, "zeroTop", 0);
|
|
27096
|
+
_defineProperty(this, "moveBoundaryEnabled", true);
|
|
25410
27097
|
_defineProperty(
|
|
25411
27098
|
this,
|
|
25412
27099
|
/**
|
|
@@ -25520,9 +27207,9 @@ var Transformer = class extends Disposable {
|
|
|
25520
27207
|
}
|
|
25521
27208
|
_getConfig(applyObject) {
|
|
25522
27209
|
const objectTransformerConfig = applyObject.transformerConfig;
|
|
25523
|
-
let { isCropper, hoverEnabled, hoverEnterFunc, hoverLeaveFunc, resizeEnabled, rotateEnabled, rotationSnaps, rotationSnapTolerance, rotateAnchorOffset, rotateSize, rotateCornerRadius, borderEnabled, borderStroke, borderStrokeWidth, borderDash, borderSpacing, anchorFill, anchorStroke, anchorStrokeWidth, anchorSize, anchorCornerRadius, keepRatio, centeredScaling, enabledAnchors, flipEnabled, ignoreStroke, boundBoxFunc, useSingleNodeRotation, shouldOverdrawWholeArea } = this;
|
|
27210
|
+
let { isCropper, hoverEnabled, hoverEnterFunc, hoverLeaveFunc, resizeEnabled, rotateEnabled, rotationSnaps, rotationSnapTolerance, rotateAnchorOffset, rotateAnchorPosition, rotateLineEnabled, rotateSize, rotateCornerRadius, rotateFill, rotateStroke, rotateStrokeWidth, rotateIconEnabled, rotateIconStroke, rotateIconStrokeWidth, borderEnabled, borderStroke, borderStrokeWidth, borderDash, borderSpacing, anchorFill, anchorStroke, anchorStrokeWidth, anchorSize, anchorCornerRadius, anchorStyle, anchorSideLongSize, anchorSideShortSize, anchorSideCornerRadius, anchorShadowColor, anchorShadowBlur, anchorShadowOffsetX, anchorShadowOffsetY, keepRatio, centeredScaling, enabledAnchors, flipEnabled, ignoreStroke, boundBoxFunc, useSingleNodeRotation, shouldOverdrawWholeArea, moveBoundaryEnabled } = this;
|
|
25524
27211
|
if (objectTransformerConfig != null) {
|
|
25525
|
-
var _objectTransformerCon, _objectTransformerCon2, _objectTransformerCon3, _objectTransformerCon4, _objectTransformerCon5, _objectTransformerCon6, _objectTransformerCon7, _objectTransformerCon8, _objectTransformerCon9, _objectTransformerCon10, _objectTransformerCon11, _objectTransformerCon12, _objectTransformerCon13, _objectTransformerCon14, _objectTransformerCon15, _objectTransformerCon16, _objectTransformerCon17, _objectTransformerCon18, _objectTransformerCon19, _objectTransformerCon20, _objectTransformerCon21, _objectTransformerCon22, _objectTransformerCon23, _objectTransformerCon24, _objectTransformerCon25, _objectTransformerCon26, _objectTransformerCon27, _objectTransformerCon28, _objectTransformerCon29;
|
|
27212
|
+
var _objectTransformerCon, _objectTransformerCon2, _objectTransformerCon3, _objectTransformerCon4, _objectTransformerCon5, _objectTransformerCon6, _objectTransformerCon7, _objectTransformerCon8, _objectTransformerCon9, _objectTransformerCon10, _objectTransformerCon11, _objectTransformerCon12, _objectTransformerCon13, _objectTransformerCon14, _objectTransformerCon15, _objectTransformerCon16, _objectTransformerCon17, _objectTransformerCon18, _objectTransformerCon19, _objectTransformerCon20, _objectTransformerCon21, _objectTransformerCon22, _objectTransformerCon23, _objectTransformerCon24, _objectTransformerCon25, _objectTransformerCon26, _objectTransformerCon27, _objectTransformerCon28, _objectTransformerCon29, _objectTransformerCon30, _objectTransformerCon31, _objectTransformerCon32, _objectTransformerCon33, _objectTransformerCon34, _objectTransformerCon35, _objectTransformerCon36, _objectTransformerCon37, _objectTransformerCon38, _objectTransformerCon39, _objectTransformerCon40, _objectTransformerCon41, _objectTransformerCon42, _objectTransformerCon43, _objectTransformerCon44, _objectTransformerCon45, _objectTransformerCon46;
|
|
25526
27213
|
isCropper = (_objectTransformerCon = objectTransformerConfig.isCropper) !== null && _objectTransformerCon !== void 0 ? _objectTransformerCon : isCropper;
|
|
25527
27214
|
hoverEnabled = (_objectTransformerCon2 = objectTransformerConfig.hoverEnabled) !== null && _objectTransformerCon2 !== void 0 ? _objectTransformerCon2 : hoverEnabled;
|
|
25528
27215
|
hoverEnterFunc = (_objectTransformerCon3 = objectTransformerConfig.hoverEnterFunc) !== null && _objectTransformerCon3 !== void 0 ? _objectTransformerCon3 : hoverEnterFunc;
|
|
@@ -25532,26 +27219,43 @@ var Transformer = class extends Disposable {
|
|
|
25532
27219
|
rotationSnaps = (_objectTransformerCon7 = objectTransformerConfig.rotationSnaps) !== null && _objectTransformerCon7 !== void 0 ? _objectTransformerCon7 : rotationSnaps;
|
|
25533
27220
|
rotationSnapTolerance = (_objectTransformerCon8 = objectTransformerConfig.rotationSnapTolerance) !== null && _objectTransformerCon8 !== void 0 ? _objectTransformerCon8 : rotationSnapTolerance;
|
|
25534
27221
|
rotateAnchorOffset = (_objectTransformerCon9 = objectTransformerConfig.rotateAnchorOffset) !== null && _objectTransformerCon9 !== void 0 ? _objectTransformerCon9 : rotateAnchorOffset;
|
|
25535
|
-
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
|
|
25544
|
-
|
|
25545
|
-
|
|
25546
|
-
|
|
25547
|
-
|
|
25548
|
-
|
|
25549
|
-
|
|
25550
|
-
|
|
25551
|
-
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
27222
|
+
rotateAnchorPosition = (_objectTransformerCon10 = objectTransformerConfig.rotateAnchorPosition) !== null && _objectTransformerCon10 !== void 0 ? _objectTransformerCon10 : rotateAnchorPosition;
|
|
27223
|
+
rotateLineEnabled = (_objectTransformerCon11 = objectTransformerConfig.rotateLineEnabled) !== null && _objectTransformerCon11 !== void 0 ? _objectTransformerCon11 : rotateLineEnabled;
|
|
27224
|
+
rotateSize = (_objectTransformerCon12 = objectTransformerConfig.rotateSize) !== null && _objectTransformerCon12 !== void 0 ? _objectTransformerCon12 : rotateSize;
|
|
27225
|
+
rotateCornerRadius = (_objectTransformerCon13 = objectTransformerConfig.rotateCornerRadius) !== null && _objectTransformerCon13 !== void 0 ? _objectTransformerCon13 : rotateCornerRadius;
|
|
27226
|
+
rotateFill = (_objectTransformerCon14 = objectTransformerConfig.rotateFill) !== null && _objectTransformerCon14 !== void 0 ? _objectTransformerCon14 : rotateFill;
|
|
27227
|
+
rotateStroke = (_objectTransformerCon15 = objectTransformerConfig.rotateStroke) !== null && _objectTransformerCon15 !== void 0 ? _objectTransformerCon15 : rotateStroke;
|
|
27228
|
+
rotateStrokeWidth = (_objectTransformerCon16 = objectTransformerConfig.rotateStrokeWidth) !== null && _objectTransformerCon16 !== void 0 ? _objectTransformerCon16 : rotateStrokeWidth;
|
|
27229
|
+
rotateIconEnabled = (_objectTransformerCon17 = objectTransformerConfig.rotateIconEnabled) !== null && _objectTransformerCon17 !== void 0 ? _objectTransformerCon17 : rotateIconEnabled;
|
|
27230
|
+
rotateIconStroke = (_objectTransformerCon18 = objectTransformerConfig.rotateIconStroke) !== null && _objectTransformerCon18 !== void 0 ? _objectTransformerCon18 : rotateIconStroke;
|
|
27231
|
+
rotateIconStrokeWidth = (_objectTransformerCon19 = objectTransformerConfig.rotateIconStrokeWidth) !== null && _objectTransformerCon19 !== void 0 ? _objectTransformerCon19 : rotateIconStrokeWidth;
|
|
27232
|
+
borderEnabled = (_objectTransformerCon20 = objectTransformerConfig.borderEnabled) !== null && _objectTransformerCon20 !== void 0 ? _objectTransformerCon20 : borderEnabled;
|
|
27233
|
+
borderStroke = (_objectTransformerCon21 = objectTransformerConfig.borderStroke) !== null && _objectTransformerCon21 !== void 0 ? _objectTransformerCon21 : borderStroke;
|
|
27234
|
+
borderStrokeWidth = (_objectTransformerCon22 = objectTransformerConfig.borderStrokeWidth) !== null && _objectTransformerCon22 !== void 0 ? _objectTransformerCon22 : borderStrokeWidth;
|
|
27235
|
+
borderDash = (_objectTransformerCon23 = objectTransformerConfig.borderDash) !== null && _objectTransformerCon23 !== void 0 ? _objectTransformerCon23 : borderDash;
|
|
27236
|
+
borderSpacing = (_objectTransformerCon24 = objectTransformerConfig.borderSpacing) !== null && _objectTransformerCon24 !== void 0 ? _objectTransformerCon24 : borderSpacing;
|
|
27237
|
+
anchorFill = (_objectTransformerCon25 = objectTransformerConfig.anchorFill) !== null && _objectTransformerCon25 !== void 0 ? _objectTransformerCon25 : anchorFill;
|
|
27238
|
+
anchorStroke = (_objectTransformerCon26 = objectTransformerConfig.anchorStroke) !== null && _objectTransformerCon26 !== void 0 ? _objectTransformerCon26 : anchorStroke;
|
|
27239
|
+
anchorStrokeWidth = (_objectTransformerCon27 = objectTransformerConfig.anchorStrokeWidth) !== null && _objectTransformerCon27 !== void 0 ? _objectTransformerCon27 : anchorStrokeWidth;
|
|
27240
|
+
anchorSize = (_objectTransformerCon28 = objectTransformerConfig.anchorSize) !== null && _objectTransformerCon28 !== void 0 ? _objectTransformerCon28 : anchorSize;
|
|
27241
|
+
anchorCornerRadius = (_objectTransformerCon29 = objectTransformerConfig.anchorCornerRadius) !== null && _objectTransformerCon29 !== void 0 ? _objectTransformerCon29 : anchorCornerRadius;
|
|
27242
|
+
anchorStyle = (_objectTransformerCon30 = objectTransformerConfig.anchorStyle) !== null && _objectTransformerCon30 !== void 0 ? _objectTransformerCon30 : anchorStyle;
|
|
27243
|
+
anchorSideLongSize = (_objectTransformerCon31 = objectTransformerConfig.anchorSideLongSize) !== null && _objectTransformerCon31 !== void 0 ? _objectTransformerCon31 : anchorSideLongSize;
|
|
27244
|
+
anchorSideShortSize = (_objectTransformerCon32 = objectTransformerConfig.anchorSideShortSize) !== null && _objectTransformerCon32 !== void 0 ? _objectTransformerCon32 : anchorSideShortSize;
|
|
27245
|
+
anchorSideCornerRadius = (_objectTransformerCon33 = objectTransformerConfig.anchorSideCornerRadius) !== null && _objectTransformerCon33 !== void 0 ? _objectTransformerCon33 : anchorSideCornerRadius;
|
|
27246
|
+
anchorShadowColor = (_objectTransformerCon34 = objectTransformerConfig.anchorShadowColor) !== null && _objectTransformerCon34 !== void 0 ? _objectTransformerCon34 : anchorShadowColor;
|
|
27247
|
+
anchorShadowBlur = (_objectTransformerCon35 = objectTransformerConfig.anchorShadowBlur) !== null && _objectTransformerCon35 !== void 0 ? _objectTransformerCon35 : anchorShadowBlur;
|
|
27248
|
+
anchorShadowOffsetX = (_objectTransformerCon36 = objectTransformerConfig.anchorShadowOffsetX) !== null && _objectTransformerCon36 !== void 0 ? _objectTransformerCon36 : anchorShadowOffsetX;
|
|
27249
|
+
anchorShadowOffsetY = (_objectTransformerCon37 = objectTransformerConfig.anchorShadowOffsetY) !== null && _objectTransformerCon37 !== void 0 ? _objectTransformerCon37 : anchorShadowOffsetY;
|
|
27250
|
+
keepRatio = (_objectTransformerCon38 = objectTransformerConfig.keepRatio) !== null && _objectTransformerCon38 !== void 0 ? _objectTransformerCon38 : keepRatio;
|
|
27251
|
+
centeredScaling = (_objectTransformerCon39 = objectTransformerConfig.centeredScaling) !== null && _objectTransformerCon39 !== void 0 ? _objectTransformerCon39 : centeredScaling;
|
|
27252
|
+
enabledAnchors = (_objectTransformerCon40 = objectTransformerConfig.enabledAnchors) !== null && _objectTransformerCon40 !== void 0 ? _objectTransformerCon40 : enabledAnchors;
|
|
27253
|
+
flipEnabled = (_objectTransformerCon41 = objectTransformerConfig.flipEnabled) !== null && _objectTransformerCon41 !== void 0 ? _objectTransformerCon41 : flipEnabled;
|
|
27254
|
+
ignoreStroke = (_objectTransformerCon42 = objectTransformerConfig.ignoreStroke) !== null && _objectTransformerCon42 !== void 0 ? _objectTransformerCon42 : ignoreStroke;
|
|
27255
|
+
boundBoxFunc = (_objectTransformerCon43 = objectTransformerConfig.boundBoxFunc) !== null && _objectTransformerCon43 !== void 0 ? _objectTransformerCon43 : boundBoxFunc;
|
|
27256
|
+
useSingleNodeRotation = (_objectTransformerCon44 = objectTransformerConfig.useSingleNodeRotation) !== null && _objectTransformerCon44 !== void 0 ? _objectTransformerCon44 : useSingleNodeRotation;
|
|
27257
|
+
shouldOverdrawWholeArea = (_objectTransformerCon45 = objectTransformerConfig.shouldOverdrawWholeArea) !== null && _objectTransformerCon45 !== void 0 ? _objectTransformerCon45 : shouldOverdrawWholeArea;
|
|
27258
|
+
moveBoundaryEnabled = (_objectTransformerCon46 = objectTransformerConfig.moveBoundaryEnabled) !== null && _objectTransformerCon46 !== void 0 ? _objectTransformerCon46 : moveBoundaryEnabled;
|
|
25555
27259
|
}
|
|
25556
27260
|
return {
|
|
25557
27261
|
isCropper,
|
|
@@ -25563,8 +27267,16 @@ var Transformer = class extends Disposable {
|
|
|
25563
27267
|
rotationSnaps,
|
|
25564
27268
|
rotationSnapTolerance,
|
|
25565
27269
|
rotateAnchorOffset,
|
|
27270
|
+
rotateAnchorPosition,
|
|
27271
|
+
rotateLineEnabled,
|
|
25566
27272
|
rotateSize,
|
|
25567
27273
|
rotateCornerRadius,
|
|
27274
|
+
rotateFill,
|
|
27275
|
+
rotateStroke,
|
|
27276
|
+
rotateStrokeWidth,
|
|
27277
|
+
rotateIconEnabled,
|
|
27278
|
+
rotateIconStroke,
|
|
27279
|
+
rotateIconStrokeWidth,
|
|
25568
27280
|
borderEnabled,
|
|
25569
27281
|
borderStroke,
|
|
25570
27282
|
borderStrokeWidth,
|
|
@@ -25575,6 +27287,14 @@ var Transformer = class extends Disposable {
|
|
|
25575
27287
|
anchorStrokeWidth,
|
|
25576
27288
|
anchorSize,
|
|
25577
27289
|
anchorCornerRadius,
|
|
27290
|
+
anchorStyle,
|
|
27291
|
+
anchorSideLongSize,
|
|
27292
|
+
anchorSideShortSize,
|
|
27293
|
+
anchorSideCornerRadius,
|
|
27294
|
+
anchorShadowColor,
|
|
27295
|
+
anchorShadowBlur,
|
|
27296
|
+
anchorShadowOffsetX,
|
|
27297
|
+
anchorShadowOffsetY,
|
|
25578
27298
|
keepRatio,
|
|
25579
27299
|
centeredScaling,
|
|
25580
27300
|
enabledAnchors,
|
|
@@ -25582,7 +27302,8 @@ var Transformer = class extends Disposable {
|
|
|
25582
27302
|
ignoreStroke,
|
|
25583
27303
|
boundBoxFunc,
|
|
25584
27304
|
useSingleNodeRotation,
|
|
25585
|
-
shouldOverdrawWholeArea
|
|
27305
|
+
shouldOverdrawWholeArea,
|
|
27306
|
+
moveBoundaryEnabled
|
|
25586
27307
|
};
|
|
25587
27308
|
}
|
|
25588
27309
|
attachTo(applyObject) {
|
|
@@ -25616,7 +27337,7 @@ var Transformer = class extends Disposable {
|
|
|
25616
27337
|
this._copperSelectedObject = applyObject;
|
|
25617
27338
|
this._changeStart$.next({
|
|
25618
27339
|
target: applyObject,
|
|
25619
|
-
objects: new Map([[applyObject.oKey, applyObject]]),
|
|
27340
|
+
objects: /* @__PURE__ */ new Map([[applyObject.oKey, applyObject]]),
|
|
25620
27341
|
type: 0
|
|
25621
27342
|
});
|
|
25622
27343
|
}
|
|
@@ -25644,7 +27365,7 @@ var Transformer = class extends Disposable {
|
|
|
25644
27365
|
event
|
|
25645
27366
|
});
|
|
25646
27367
|
else this._changeEnd$.next({
|
|
25647
|
-
objects: new Map([[applyObject.oKey, applyObject]]),
|
|
27368
|
+
objects: /* @__PURE__ */ new Map([[applyObject.oKey, applyObject]]),
|
|
25648
27369
|
type: 2,
|
|
25649
27370
|
offsetX,
|
|
25650
27371
|
offsetY,
|
|
@@ -25691,6 +27412,10 @@ var Transformer = class extends Disposable {
|
|
|
25691
27412
|
});
|
|
25692
27413
|
}
|
|
25693
27414
|
_checkMoveBoundary(moveObject, moveLeft, moveTop, ancestorLeft, ancestorTop, topSceneWidth, topSceneHeight) {
|
|
27415
|
+
if (this._getConfig(moveObject).moveBoundaryEnabled === false) return {
|
|
27416
|
+
moveLeft,
|
|
27417
|
+
moveTop
|
|
27418
|
+
};
|
|
25694
27419
|
const { left, top, width, height } = moveObject;
|
|
25695
27420
|
let resultMoveLeft = moveLeft;
|
|
25696
27421
|
let resultMoveTop = moveTop;
|
|
@@ -25740,7 +27465,7 @@ var Transformer = class extends Disposable {
|
|
|
25740
27465
|
moveTop = boundary.moveTop;
|
|
25741
27466
|
cropper.translate(moveLeft + cropper.left, moveTop + cropper.top);
|
|
25742
27467
|
this._changing$.next({
|
|
25743
|
-
objects: new Map([[cropper.oKey, cropper]]),
|
|
27468
|
+
objects: /* @__PURE__ */ new Map([[cropper.oKey, cropper]]),
|
|
25744
27469
|
moveX: moveLeft,
|
|
25745
27470
|
moveY: moveTop,
|
|
25746
27471
|
type: 1,
|
|
@@ -25775,7 +27500,7 @@ var Transformer = class extends Disposable {
|
|
|
25775
27500
|
} else {
|
|
25776
27501
|
this._moveFunc(applyObject, type, x, y, keepRatio, isCropper, isGroup);
|
|
25777
27502
|
this._changing$.next({
|
|
25778
|
-
objects: new Map([[applyObject.oKey, applyObject]]),
|
|
27503
|
+
objects: /* @__PURE__ */ new Map([[applyObject.oKey, applyObject]]),
|
|
25779
27504
|
type: 1,
|
|
25780
27505
|
offsetX: moveOffsetX,
|
|
25781
27506
|
offsetY: moveOffsetY
|
|
@@ -26022,7 +27747,7 @@ var Transformer = class extends Disposable {
|
|
|
26022
27747
|
});
|
|
26023
27748
|
} else {
|
|
26024
27749
|
this._changeStart$.next({
|
|
26025
|
-
objects: new Map([[applyObject.oKey, applyObject]]),
|
|
27750
|
+
objects: /* @__PURE__ */ new Map([[applyObject.oKey, applyObject]]),
|
|
26026
27751
|
type: 0
|
|
26027
27752
|
});
|
|
26028
27753
|
const { width, height, left, top } = applyObject.getState();
|
|
@@ -26063,7 +27788,7 @@ var Transformer = class extends Disposable {
|
|
|
26063
27788
|
} else {
|
|
26064
27789
|
this._recoverySizeBoundary([applyObject], ancestorLeft, ancestorTop, topSceneWidth, topSceneHeight);
|
|
26065
27790
|
this._changeEnd$.next({
|
|
26066
|
-
objects: new Map([[applyObject.oKey, applyObject]]),
|
|
27791
|
+
objects: /* @__PURE__ */ new Map([[applyObject.oKey, applyObject]]),
|
|
26067
27792
|
type: 2,
|
|
26068
27793
|
offsetX,
|
|
26069
27794
|
offsetY,
|
|
@@ -26138,7 +27863,11 @@ var Transformer = class extends Disposable {
|
|
|
26138
27863
|
_rotateMoving(moveOffsetX, moveOffsetY, centerX, centerY, agentOrigin) {
|
|
26139
27864
|
const { ancestorScaleX, ancestorScaleY } = this._scene;
|
|
26140
27865
|
if (this._moveBufferBlocker(moveOffsetX, moveOffsetY)) return;
|
|
26141
|
-
|
|
27866
|
+
const moveSceneX = moveOffsetX / ancestorScaleX + this._viewportScrollX;
|
|
27867
|
+
const moveSceneY = moveOffsetY / ancestorScaleY + this._viewportScrollY;
|
|
27868
|
+
const startSceneX = this._startOffsetX / ancestorScaleX + this._viewportScrollX;
|
|
27869
|
+
const startSceneY = this._startOffsetY / ancestorScaleY + this._viewportScrollY;
|
|
27870
|
+
let angle = agentOrigin + radToDeg(Math.atan2(moveSceneY - centerY, moveSceneX - centerX) - Math.atan2(startSceneY - centerY, startSceneX - centerX));
|
|
26142
27871
|
if (angle < 0) angle = 360 + angle;
|
|
26143
27872
|
angle %= 360;
|
|
26144
27873
|
angle = this._smoothAccuracy(angle);
|
|
@@ -26195,6 +27924,23 @@ var Transformer = class extends Disposable {
|
|
|
26195
27924
|
}
|
|
26196
27925
|
return cursor;
|
|
26197
27926
|
}
|
|
27927
|
+
_createRotateIcon(applyObject, zIndex, left, top) {
|
|
27928
|
+
const { rotateSize, rotateIconStroke, rotateIconStrokeWidth, borderStroke } = this._getConfig(applyObject);
|
|
27929
|
+
const iconOffset = (rotateSize - ROTATE_ICON_SIZE) / 2;
|
|
27930
|
+
return new TransformerRotateIcon(`__SpreadsheetTransformerRotate___ICON_${zIndex}`, {
|
|
27931
|
+
zIndex,
|
|
27932
|
+
evented: false,
|
|
27933
|
+
left: left + iconOffset,
|
|
27934
|
+
top: top + iconOffset,
|
|
27935
|
+
width: ROTATE_ICON_SIZE,
|
|
27936
|
+
height: ROTATE_ICON_SIZE,
|
|
27937
|
+
fill: null,
|
|
27938
|
+
stroke: rotateIconStroke !== null && rotateIconStroke !== void 0 ? rotateIconStroke : borderStroke,
|
|
27939
|
+
strokeWidth: rotateIconStrokeWidth,
|
|
27940
|
+
strokeLineCap: "round",
|
|
27941
|
+
strokeLineJoin: "round"
|
|
27942
|
+
});
|
|
27943
|
+
}
|
|
26198
27944
|
_getCopperAnchorPosition(type, height, width, applyObject) {
|
|
26199
27945
|
const { borderStrokeWidth, borderSpacing, anchorSize } = this._getConfig(applyObject);
|
|
26200
27946
|
let left = 0;
|
|
@@ -26241,17 +27987,18 @@ var Transformer = class extends Disposable {
|
|
|
26241
27987
|
};
|
|
26242
27988
|
}
|
|
26243
27989
|
_getRotateAnchorPosition(type, height, width, applyObject) {
|
|
26244
|
-
const { rotateAnchorOffset, rotateSize, borderStrokeWidth, borderSpacing, anchorSize } = this._getConfig(applyObject);
|
|
27990
|
+
const { rotateAnchorOffset, rotateAnchorPosition, rotateSize, borderStrokeWidth, borderSpacing, anchorSize } = this._getConfig(applyObject);
|
|
27991
|
+
const isBottomRotateAnchor = rotateAnchorPosition === "bottom";
|
|
26245
27992
|
let left = -anchorSize / 2;
|
|
26246
27993
|
let top = -anchorSize / 2;
|
|
26247
27994
|
switch (type) {
|
|
26248
27995
|
case "__SpreadsheetTransformerRotate__":
|
|
26249
27996
|
left = width / 2 - rotateSize / 2;
|
|
26250
|
-
top = -rotateAnchorOffset - borderSpacing - borderStrokeWidth * 2 - rotateSize;
|
|
27997
|
+
top = isBottomRotateAnchor ? height + rotateAnchorOffset + borderSpacing + borderStrokeWidth * 2 : -rotateAnchorOffset - borderSpacing - borderStrokeWidth * 2 - rotateSize;
|
|
26251
27998
|
break;
|
|
26252
27999
|
case "__SpreadsheetTransformerRotateLine__":
|
|
26253
28000
|
left = width / 2;
|
|
26254
|
-
top = -rotateAnchorOffset - borderSpacing - borderStrokeWidth;
|
|
28001
|
+
top = isBottomRotateAnchor ? height + borderSpacing + borderStrokeWidth : -rotateAnchorOffset - borderSpacing - borderStrokeWidth;
|
|
26255
28002
|
break;
|
|
26256
28003
|
case "__SpreadsheetTransformerResizeLT__":
|
|
26257
28004
|
left += -borderSpacing - borderStrokeWidth;
|
|
@@ -26291,21 +28038,43 @@ var Transformer = class extends Disposable {
|
|
|
26291
28038
|
top
|
|
26292
28039
|
};
|
|
26293
28040
|
}
|
|
28041
|
+
_isMiddleAnchor(type) {
|
|
28042
|
+
return type === "__SpreadsheetTransformerResizeCT__" || type === "__SpreadsheetTransformerResizeLM__" || type === "__SpreadsheetTransformerResizeRM__" || type === "__SpreadsheetTransformerResizeCB__";
|
|
28043
|
+
}
|
|
28044
|
+
_getResizeAnchorProps(type, applyObject) {
|
|
28045
|
+
const { anchorSize, anchorCornerRadius, anchorStyle, anchorSideLongSize, anchorSideShortSize, anchorSideCornerRadius } = this._getConfig(applyObject);
|
|
28046
|
+
if (anchorStyle !== "canva" || !this._isMiddleAnchor(type)) return {
|
|
28047
|
+
width: anchorSize,
|
|
28048
|
+
height: anchorSize,
|
|
28049
|
+
radius: anchorStyle === "canva" ? anchorSize / 2 : anchorCornerRadius
|
|
28050
|
+
};
|
|
28051
|
+
const isHorizontal = type === "__SpreadsheetTransformerResizeCT__" || type === "__SpreadsheetTransformerResizeCB__";
|
|
28052
|
+
return {
|
|
28053
|
+
width: isHorizontal ? anchorSideLongSize : anchorSideShortSize,
|
|
28054
|
+
height: isHorizontal ? anchorSideShortSize : anchorSideLongSize,
|
|
28055
|
+
radius: anchorSideCornerRadius
|
|
28056
|
+
};
|
|
28057
|
+
}
|
|
26294
28058
|
_createResizeAnchor(type, applyObject, zIndex) {
|
|
26295
28059
|
const { height = 0, width = 0, scaleX = 1, scaleY = 1 } = applyObject.getState();
|
|
26296
|
-
const { anchorFill, anchorStroke, anchorStrokeWidth,
|
|
28060
|
+
const { anchorFill, anchorStroke, anchorStrokeWidth, anchorSize, anchorShadowColor, anchorShadowBlur, anchorShadowOffsetX, anchorShadowOffsetY } = this._getConfig(applyObject);
|
|
26297
28061
|
const { left, top } = this._getRotateAnchorPosition(type, height, width, applyObject);
|
|
28062
|
+
const anchorProps = this._getResizeAnchorProps(type, applyObject);
|
|
26298
28063
|
const cursor = this._getRotateAnchorCursor(type);
|
|
26299
|
-
const anchor = new
|
|
28064
|
+
const anchor = new TransformerAnchor(`${type}_${zIndex}`, {
|
|
26300
28065
|
zIndex: zIndex - 1,
|
|
26301
28066
|
fill: anchorFill,
|
|
26302
28067
|
stroke: anchorStroke,
|
|
26303
28068
|
strokeWidth: anchorStrokeWidth,
|
|
26304
|
-
width:
|
|
26305
|
-
height:
|
|
26306
|
-
radius:
|
|
26307
|
-
left,
|
|
26308
|
-
top
|
|
28069
|
+
width: anchorProps.width,
|
|
28070
|
+
height: anchorProps.height,
|
|
28071
|
+
radius: anchorProps.radius,
|
|
28072
|
+
left: left + (anchorSize - anchorProps.width) / 2,
|
|
28073
|
+
top: top + (anchorSize - anchorProps.height) / 2,
|
|
28074
|
+
shadowColor: anchorShadowColor,
|
|
28075
|
+
shadowBlur: anchorShadowBlur,
|
|
28076
|
+
shadowOffsetX: anchorShadowOffsetX,
|
|
28077
|
+
shadowOffsetY: anchorShadowOffsetY
|
|
26309
28078
|
});
|
|
26310
28079
|
this._attachHover(anchor, cursor, "default");
|
|
26311
28080
|
return anchor;
|
|
@@ -26553,7 +28322,7 @@ var Transformer = class extends Disposable {
|
|
|
26553
28322
|
_createControl(applyObject, isSkipOnCropper = true) {
|
|
26554
28323
|
const { left = 0, top = 0, height = 0, width = 0 } = applyObject.getState();
|
|
26555
28324
|
const angle = applyObject.angle;
|
|
26556
|
-
const { isCropper, resizeEnabled, rotateEnabled, rotateAnchorOffset, rotateSize, rotateCornerRadius, borderEnabled, borderStroke, borderStrokeWidth, borderSpacing, enabledAnchors } = this._getConfig(applyObject);
|
|
28325
|
+
const { isCropper, resizeEnabled, rotateEnabled, rotateAnchorOffset, rotateLineEnabled, rotateSize, rotateCornerRadius, rotateFill, rotateStroke, rotateStrokeWidth, rotateIconEnabled, anchorShadowColor, anchorShadowBlur, anchorShadowOffsetX, anchorShadowOffsetY, borderEnabled, borderStroke, borderStrokeWidth, borderSpacing, enabledAnchors } = this._getConfig(applyObject);
|
|
26557
28326
|
if (isSkipOnCropper && isCropper) return;
|
|
26558
28327
|
const oKey = applyObject.oKey;
|
|
26559
28328
|
const zIndex = this._selectedObjectMap.size + applyObject.maxZIndex + DEFAULT_CONTROL_PLUS_INDEX;
|
|
@@ -26584,19 +28353,26 @@ var Transformer = class extends Disposable {
|
|
|
26584
28353
|
});
|
|
26585
28354
|
const { left: rotateLeft, top: rotateTop } = this._getRotateAnchorPosition("__SpreadsheetTransformerRotate__", height, width, applyObject);
|
|
26586
28355
|
const cursor = this._getRotateAnchorCursor("__SpreadsheetTransformerRotate__");
|
|
26587
|
-
const rotate = new
|
|
28356
|
+
const rotate = new TransformerAnchor(`__SpreadsheetTransformerRotate___${zIndex}`, {
|
|
26588
28357
|
zIndex: zIndex - 1,
|
|
26589
28358
|
left: rotateLeft,
|
|
26590
28359
|
top: rotateTop,
|
|
26591
28360
|
height: rotateSize,
|
|
26592
28361
|
width: rotateSize,
|
|
26593
28362
|
radius: rotateCornerRadius,
|
|
26594
|
-
|
|
26595
|
-
|
|
28363
|
+
fill: rotateFill,
|
|
28364
|
+
strokeWidth: rotateStrokeWidth !== null && rotateStrokeWidth !== void 0 ? rotateStrokeWidth : borderStrokeWidth * 2,
|
|
28365
|
+
stroke: rotateStroke !== null && rotateStroke !== void 0 ? rotateStroke : borderStroke,
|
|
28366
|
+
shadowColor: anchorShadowColor,
|
|
28367
|
+
shadowBlur: anchorShadowBlur,
|
|
28368
|
+
shadowOffsetX: anchorShadowOffsetX,
|
|
28369
|
+
shadowOffsetY: anchorShadowOffsetY
|
|
26596
28370
|
});
|
|
26597
28371
|
this._attachEventToRotate(rotate, applyObject);
|
|
26598
28372
|
this._attachHover(rotate, cursor, "default");
|
|
26599
|
-
groupElements.push(rotateLine
|
|
28373
|
+
if (rotateLineEnabled) groupElements.push(rotateLine);
|
|
28374
|
+
groupElements.push(rotate);
|
|
28375
|
+
if (rotateIconEnabled) groupElements.push(this._createRotateIcon(applyObject, zIndex, rotateLeft, rotateTop));
|
|
26600
28376
|
}
|
|
26601
28377
|
}
|
|
26602
28378
|
if (resizeEnabled) for (let i = 0, len = enabledAnchors.length; i < len; i++) {
|
|
@@ -29032,4 +30808,4 @@ var Viewport = class {
|
|
|
29032
30808
|
};
|
|
29033
30809
|
|
|
29034
30810
|
//#endregion
|
|
29035
|
-
export { BASE_OBJECT_ARRAY, BG_Z_INDEX, BORDER_TYPE, BORDER_Z_INDEX, Background, BaseObject, Border, BreakType, CHECK_OBJECT_ARRAY, CIRCLE_OBJECT_ARRAY, COLOR_BLACK_RGB, CURSOR_TYPE, Canvas, CanvasColorService, CanvasRenderMode, CheckboxShape, Circle, ColumnHeaderLayout, ComponentExtension, Control, Custom, CustomObject, DEFAULT_DOCUMENT_FONTSIZE, DEFAULT_FONTFACE_PLANE, DEFAULT_FRAME_LIST_SIZE, DEFAULT_FRAME_SAMPLE_SIZE, DEFAULT_MEASURE_TEXT, DEFAULT_OFFSET_SPACING, DEFAULT_PADDING_DATA, DEFAULT_SKELETON_FOOTER, DEFAULT_SKELETON_HEADER, DOCUMENT_CONTEXT_CLIP_TYPE, DRAWING_OBJECT_LAYER_INDEX, DRAWING_OBJECT_LOWER_LAYER_INDEX, DRAWING_OBJECT_UPPER_LAYER_INDEX, DashedRect, DataStreamTreeNode, DeviceInputEventType, DeviceType, DocBackground, DocSimpleSkeleton, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, DocumentsSpanAndLineExtensionRegistry, Drawing, DrawingGroupObject, DumbCanvasColorService, EXPAND_SIZE_FOR_RENDER_OVERFLOW, Engine, EventConstants, FIX_ONE_PIXEL_BLUR_OFFSET, FONT_EXTENSION_Z_INDEX, Font, FontCache, GlyphType, Group, HitCanvas, ICanvasColorService, INITIAL_MATRIX, INITIAL_Path2, IRenderManagerService, IRenderingEngine, IWatermarkTypeEnum, Image$1 as Image, IsSafari, LINK_VIEW_PORT_TYPE, Layer, LineType, Liquid, MAIN_VIEW_PORT_KEY, MAXIMUM_COL_WIDTH, MAXIMUM_ROW_HEIGHT, MEASURE_EXTENT, MEASURE_EXTENT_FOR_PARAGRAPH, MIDDLE_CELL_POS_MAGIC_NUMBER, MIN_COL_WIDTH, Marker, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ORIENTATION_TYPE, ObjectType, PATH_OBJECT_ARRAY, PRINTING_BG_Z_INDEX, PageLayoutType, Path, Path2, PerformanceMonitor, PointerInput, RECT_OBJECT_ARRAY, REGULAR_POLYGON_OBJECT_ARRAY, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, RICHTEXT_OBJECT_ARRAY, Rect, RegularPolygon, RenderComponent, RenderManagerService, RenderUnit, RichText, RollingAverage, RowHeaderLayout, SHAPE_OBJECT_ARRAY, SHAPE_TYPE, SHEET_EXTENSION_PREFIX, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SLIDE_NAVIGATION_KEY, Scene, SceneCanvas, SceneViewer, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetColumnHeaderExtensionRegistry, SheetComponent, SheetExtension, SheetRowHeaderExtensionRegistry, ShowGridlinesState, SkeletonType, Slide, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetExtensionRegistry, SpreadsheetHeader, SpreadsheetRowHeader, SpreadsheetSkeleton, TEXT_OBJECT_ARRAY, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Text, Transform, UNIVER_WATERMARK_LAYER_INDEX, UNIVER_WATERMARK_STORAGE_KEY, UniverPrintingContext, UniverRenderEnginePlugin, UniverRenderingContext, UniverRenderingContext2D, VERTICAL_ROTATE_ANGLE, Vector2, Viewport, WatermarkLayer, calculateRectRotate, cancelRequestFrame, checkStyle, clampRange, clearLineByBorderType, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, createCanvasElement, createImageElement, degToRad, drawDiagonalLineByBorderType, drawLineByBorderType, expandRangeIfIntersects, fixLineWidthByScale, generateRandomKey, getCellByIndexWithMergeInfo, getCellPositionByIndex, getCharSpaceApply, getColor, getCurrentScrollXY, getCurrentTypeOfRenderer, getDPI, getDevicePixelRatio, getDocsSkeletonPageSize, getDocsTableRenderViewport, getDrawingGroupState, getFirstGrapheme, getFontStyleString, getGroupState, getLastColumn, getLastLine, getLineOffset, getLineWidth, getLineWith, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getPointerPrefix, getRenderTransformBaseOnParentBound, getRotateOffsetAndFarthestHypotenuse, getRotateOrientation, getRotatedBoundInGroup, getScale, getSizeForDom, getSystemHighlightColor, getTableIdAndSliceIndex, getTranslateInSpreadContextWithPixelRatio, getValueType, glyphIterator, hasAllLatin, hasArabic, hasBasicLatin, hasCJK, hasCJKPunctuation, hasCJKText, hasLatinExtendedA, hasLatinExtendedB, hasLatinOneSupplement, hasListGlyph, hasSpace, hasThai, hasTibetan, hasUnMergedCellInRow, inViewRanges, injectStyle, isArray, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, isDate, isEmojiGrapheme, isFirstGlyph, isFunction, isIndentByGlyph, isLastGlyph, isNumber, isObject, isPlaceholderOrSpace, isRectIntersect, isRegExp, isSameLine, isString, lineIterator, mergeInfoOffset, parseDataStreamToTree, pixelToPt, precisionTo, ptToMM, ptToPixel, ptToPx, pxToInch, pxToNum, pxToPt, radToDeg, renderImageWatermark, renderTextWatermark, renderUserInfoWatermark, renderWatermark, requestNewFrame, setDocsTableRenderViewportProvider, setLineType, sheetContentViewportKeys, sheetHeaderViewportKeys, startWithEmoji, toPx, transformObjectOutOfGroup, withCurrentTypeOfRenderer };
|
|
30811
|
+
export { BASE_OBJECT_ARRAY, BG_Z_INDEX, BORDER_TYPE, BORDER_Z_INDEX, Background, BaseObject, Border, BreakType, CHECK_OBJECT_ARRAY, CIRCLE_OBJECT_ARRAY, COLOR_BLACK_RGB, CURSOR_TYPE, Canvas, CanvasColorService, CanvasRenderMode, CheckboxShape, Circle, ColumnHeaderLayout, ComponentExtension, Control, Custom, CustomObject, DEFAULT_DOCUMENT_FONTSIZE, DEFAULT_FONTFACE_PLANE, DEFAULT_FRAME_LIST_SIZE, DEFAULT_FRAME_SAMPLE_SIZE, DEFAULT_MEASURE_TEXT, DEFAULT_OFFSET_SPACING, DEFAULT_PADDING_DATA, DEFAULT_SKELETON_FOOTER, DEFAULT_SKELETON_HEADER, DOCUMENT_CONTEXT_CLIP_TYPE, DRAWING_OBJECT_LAYER_INDEX, DRAWING_OBJECT_LOWER_LAYER_INDEX, DRAWING_OBJECT_UPPER_LAYER_INDEX, DashedRect, DataStreamTreeNode, DeviceInputEventType, DeviceType, DocBackground, DocSimpleSkeleton, DocumentEditArea, DocumentSkeleton, DocumentSkeletonPageType, DocumentViewModel, Documents, DocumentsSpanAndLineExtensionRegistry, Drawing, DrawingGroupObject, DumbCanvasColorService, EXPAND_SIZE_FOR_RENDER_OVERFLOW, Engine, EventConstants, FIX_ONE_PIXEL_BLUR_OFFSET, FONT_EXTENSION_Z_INDEX, Font, FontCache, GlyphType, Group, HitCanvas, ICanvasColorService, INITIAL_MATRIX, INITIAL_Path2, IRenderManagerService, IRenderingEngine, IWatermarkTypeEnum, Image$1 as Image, IsSafari, LINK_VIEW_PORT_TYPE, Layer, LineType, Liquid, MAIN_VIEW_PORT_KEY, MAXIMUM_COL_WIDTH, MAXIMUM_ROW_HEIGHT, MEASURE_EXTENT, MEASURE_EXTENT_FOR_PARAGRAPH, MIDDLE_CELL_POS_MAGIC_NUMBER, MIN_COL_WIDTH, Marker, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, ORIENTATION_TYPE, ObjectType, PATH_OBJECT_ARRAY, PRINTING_BG_Z_INDEX, PageLayoutType, Path, Path2, PerformanceMonitor, PointerInput, RECT_OBJECT_ARRAY, REGULAR_POLYGON_OBJECT_ARRAY, RENDER_CLASS_TYPE, RENDER_RAW_FORMULA_KEY, RICHTEXT_OBJECT_ARRAY, Rect, RegularPolygon, RenderComponent, RenderManagerService, RenderUnit, RichText, RollingAverage, RowHeaderLayout, SHAPE_OBJECT_ARRAY, SHAPE_TYPE, SHEET_EXTENSION_PREFIX, SHEET_EXTENSION_TYPE, SHEET_VIEWPORT_KEY, SLIDE_NAVIGATION_KEY, Scene, SceneCanvas, SceneViewer, ScrollBar, ScrollTimer, ScrollTimerType, Shape, SheetColumnHeaderExtensionRegistry, SheetComponent, SheetExtension, SheetRowHeaderExtensionRegistry, ShowGridlinesState, SkeletonType, Slide, Spreadsheet, SpreadsheetColumnHeader, SpreadsheetExtensionRegistry, SpreadsheetHeader, SpreadsheetRowHeader, SpreadsheetSkeleton, TEXT_OBJECT_ARRAY, TRANSFORM_CHANGE_OBSERVABLE_TYPE, Text, Transform, UNIVER_WATERMARK_LAYER_INDEX, UNIVER_WATERMARK_STORAGE_KEY, UniverPrintingContext, UniverRenderEnginePlugin, UniverRenderingContext, UniverRenderingContext2D, VERTICAL_ROTATE_ANGLE, Vector2, Viewport, WatermarkLayer, calculateRectRotate, cancelRequestFrame, checkStyle, clampRange, clearLineByBorderType, compareDocumentSkeletonNestedPagePathOrder, convertTextRotation, convertTransformToOffsetX, convertTransformToOffsetY, createCanvasElement, createImageElement, degToRad, documentSkeletonLineIterator, documentSkeletonTableIterator, drawDiagonalLineByBorderType, drawLineByBorderType, expandRangeIfIntersects, fixLineWidthByScale, generateRandomKey, getCellByIndexWithMergeInfo, getCellPositionByIndex, getCharSpaceApply, getColor, getCurrentScrollXY, getCurrentTypeOfRenderer, getDPI, getDevicePixelRatio, getDocsSkeletonPageSize, getDocsTableRenderViewport, getDocumentSkeletonColumnPagePathInfo, getDocumentSkeletonNestedPageOffset, getDrawingGroupState, getFirstGrapheme, getFontStyleString, getGroupState, getLastColumn, getLastLine, getLineOffset, getLineWidth, getLineWith, getNextWheelZoomRatio, getNumberUnitValue, getOffsetRectForDom, getPageFromPath, getParagraphByGlyph, getPointerPrefix, getRenderTransformBaseOnParentBound, getRotateOffsetAndFarthestHypotenuse, getRotateOrientation, getRotatedBoundInGroup, getScale, getSizeForDom, getSystemHighlightColor, getTableIdAndSliceIndex, getTranslateInSpreadContextWithPixelRatio, getValueType, glyphIterator, hasAllLatin, hasArabic, hasBasicLatin, hasCJK, hasCJKPunctuation, hasCJKText, hasLatinExtendedA, hasLatinExtendedB, hasLatinOneSupplement, hasListGlyph, hasSpace, hasThai, hasTibetan, hasUnMergedCellInRow, inViewRanges, injectStyle, isArray, isCjkCenterAlignedPunctuation, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation, isDate, isEmojiGrapheme, isFirstGlyph, isFunction, isIndentByGlyph, isLastGlyph, isNumber, isObject, isPlaceholderOrSpace, isRectIntersect, isRegExp, isSameLine, isString, lineIterator, mergeInfoOffset, parseDataStreamToTree, pixelToPt, precisionTo, ptToMM, ptToPixel, ptToPx, pxToInch, pxToNum, pxToPt, radToDeg, renderImageWatermark, renderTextWatermark, renderUserInfoWatermark, renderWatermark, requestNewFrame, setDocsTableRenderViewportProvider, setLineType, sheetContentViewportKeys, sheetHeaderViewportKeys, startWithEmoji, toPx, transformObjectOutOfGroup, withCurrentTypeOfRenderer };
|