@univerjs/engine-render 1.0.0-alpha.0 → 1.0.0-alpha.2
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 +1062 -141
- package/lib/es/index.js +1059 -143
- package/lib/types/basics/const.d.ts +4 -0
- package/lib/types/basics/i-document-skeleton-cached.d.ts +25 -1
- package/lib/types/components/docs/document.d.ts +2 -0
- package/lib/types/components/docs/layout/block/column.d.ts +23 -0
- package/lib/types/components/docs/layout/model/page.d.ts +2 -1
- package/lib/types/components/docs/layout/tools.d.ts +82 -2
- package/lib/types/components/docs/view-model/document-view-model.d.ts +10 -2
- package/lib/types/index.d.ts +2 -1
- package/lib/umd/index.js +2 -2
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -114,6 +114,10 @@ let CURSOR_TYPE = /* @__PURE__ */ function(CURSOR_TYPE) {
|
|
|
114
114
|
CURSOR_TYPE["SOUTH_WEST_RESIZE"] = "sw-resize";
|
|
115
115
|
CURSOR_TYPE["SOUTH_RESIZE"] = "s-resize";
|
|
116
116
|
CURSOR_TYPE["WEST_RESIZE"] = "w-resize";
|
|
117
|
+
CURSOR_TYPE["EAST_WEST_RESIZE"] = "ew-resize";
|
|
118
|
+
CURSOR_TYPE["NORTH_SOUTH_RESIZE"] = "ns-resize";
|
|
119
|
+
CURSOR_TYPE["NORTH_EAST_SOUTH_WEST_RESIZE"] = "nesw-resize";
|
|
120
|
+
CURSOR_TYPE["NORTH_WEST_SOUTH_EAST_RESIZE"] = "nwse-resize";
|
|
117
121
|
CURSOR_TYPE["TEXT"] = "text";
|
|
118
122
|
CURSOR_TYPE["WAIT"] = "wait";
|
|
119
123
|
CURSOR_TYPE["HELP"] = "help";
|
|
@@ -228,6 +232,7 @@ const cancelRequestFrame = (requestID, requester) => {
|
|
|
228
232
|
};
|
|
229
233
|
const createCanvasElement = () => {
|
|
230
234
|
const canvas = document.createElement("canvas");
|
|
235
|
+
canvas.dir = "ltr";
|
|
231
236
|
try {
|
|
232
237
|
canvas.style = canvas.style || {};
|
|
233
238
|
} catch (e) {
|
|
@@ -3460,11 +3465,12 @@ var BaseObject = class extends _univerjs_core.Disposable {
|
|
|
3460
3465
|
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();
|
|
3461
3466
|
if (baseBound) {
|
|
3462
3467
|
const parentState = this.getParent();
|
|
3468
|
+
const parentRealBound = typeof parentState.getRealBound === "function" ? parentState.getRealBound() : parentState;
|
|
3463
3469
|
const parentBound = {
|
|
3464
|
-
top:
|
|
3465
|
-
left:
|
|
3466
|
-
width:
|
|
3467
|
-
height:
|
|
3470
|
+
top: parentRealBound.top || 0,
|
|
3471
|
+
left: parentRealBound.left,
|
|
3472
|
+
width: parentRealBound.width || 0,
|
|
3473
|
+
height: parentRealBound.height || 0
|
|
3468
3474
|
};
|
|
3469
3475
|
const realBound = getRenderTransformBaseOnParentBound(baseBound, parentBound, {
|
|
3470
3476
|
width: realWidth,
|
|
@@ -11994,6 +12000,68 @@ var Text = class Text extends Shape {
|
|
|
11994
12000
|
}
|
|
11995
12001
|
};
|
|
11996
12002
|
|
|
12003
|
+
//#endregion
|
|
12004
|
+
//#region src/components/docs/document-compatibility.ts
|
|
12005
|
+
const MODERN_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12006
|
+
mode: "modern",
|
|
12007
|
+
applyDocumentDefaultParagraphStyle: true,
|
|
12008
|
+
useWordStyleLineHeight: true,
|
|
12009
|
+
font: { metricScaleRules: [] },
|
|
12010
|
+
table: {
|
|
12011
|
+
currentPageOverflowTolerance: 0,
|
|
12012
|
+
rowOverflowTolerance: 0,
|
|
12013
|
+
allowImportedTableMarginOverflow: false
|
|
12014
|
+
}
|
|
12015
|
+
};
|
|
12016
|
+
const TRADITIONAL_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12017
|
+
mode: "traditional",
|
|
12018
|
+
applyDocumentDefaultParagraphStyle: false,
|
|
12019
|
+
useWordStyleLineHeight: true,
|
|
12020
|
+
font: { metricScaleRules: [{
|
|
12021
|
+
fontFamily: /^calibri$/i,
|
|
12022
|
+
minFontSize: 20,
|
|
12023
|
+
fontString: /\bbold\b/i,
|
|
12024
|
+
content: /^[\d/]+$/u,
|
|
12025
|
+
widthScale: .92
|
|
12026
|
+
}] },
|
|
12027
|
+
table: {
|
|
12028
|
+
currentPageOverflowTolerance: 12,
|
|
12029
|
+
rowOverflowTolerance: 4,
|
|
12030
|
+
allowImportedTableMarginOverflow: true
|
|
12031
|
+
}
|
|
12032
|
+
};
|
|
12033
|
+
const UNSPECIFIED_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12034
|
+
mode: "unspecified",
|
|
12035
|
+
applyDocumentDefaultParagraphStyle: false,
|
|
12036
|
+
useWordStyleLineHeight: false,
|
|
12037
|
+
font: { metricScaleRules: [] },
|
|
12038
|
+
table: {
|
|
12039
|
+
currentPageOverflowTolerance: 0,
|
|
12040
|
+
rowOverflowTolerance: 0,
|
|
12041
|
+
allowImportedTableMarginOverflow: false
|
|
12042
|
+
}
|
|
12043
|
+
};
|
|
12044
|
+
function getDocumentCompatibilityPolicy(documentFlavor) {
|
|
12045
|
+
if (documentFlavor === _univerjs_core.DocumentFlavor.MODERN) return MODERN_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12046
|
+
if (documentFlavor === _univerjs_core.DocumentFlavor.TRADITIONAL) return TRADITIONAL_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12047
|
+
return UNSPECIFIED_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12048
|
+
}
|
|
12049
|
+
function applyFontMetricCompatibility(content, fontStyle, bBox, policy) {
|
|
12050
|
+
const fontFamilies = fontStyle.fontFamily.split(",").map((item) => item.trim().replace(/^['"]|['"]$/g, ""));
|
|
12051
|
+
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)));
|
|
12052
|
+
if ((rule === null || rule === void 0 ? void 0 : rule.widthScale) == null) return bBox;
|
|
12053
|
+
return {
|
|
12054
|
+
...bBox,
|
|
12055
|
+
width: bBox.width * rule.widthScale
|
|
12056
|
+
};
|
|
12057
|
+
}
|
|
12058
|
+
function isTraditionalDocumentCompatibility(policy) {
|
|
12059
|
+
return policy.mode === "traditional";
|
|
12060
|
+
}
|
|
12061
|
+
function shouldAllowImportedTableMarginOverflow(policy, tableSource) {
|
|
12062
|
+
return policy.table.allowImportedTableMarginOverflow && tableSource != null && typeof tableSource === "object" && "docxWidth" in tableSource;
|
|
12063
|
+
}
|
|
12064
|
+
|
|
11997
12065
|
//#endregion
|
|
11998
12066
|
//#region src/components/docs/liquid.ts
|
|
11999
12067
|
var Liquid = class {
|
|
@@ -12286,8 +12354,16 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12286
12354
|
const tableList = [];
|
|
12287
12355
|
const tableRowList = [];
|
|
12288
12356
|
const tableCellList = [];
|
|
12357
|
+
const columnGroupList = [];
|
|
12358
|
+
const columnList = [];
|
|
12359
|
+
const columnParagraphList = [];
|
|
12360
|
+
const columnSectionList = [];
|
|
12289
12361
|
const currentBlocks = [];
|
|
12290
|
-
const getParagraphList = () =>
|
|
12362
|
+
const getParagraphList = () => {
|
|
12363
|
+
if (tableCellList.length > 0) return cellParagraphList;
|
|
12364
|
+
if (columnGroupList.length > 0) return columnParagraphList;
|
|
12365
|
+
return paragraphList;
|
|
12366
|
+
};
|
|
12291
12367
|
const appendToPreviousParagraph = (char) => {
|
|
12292
12368
|
const tempParagraphList = getParagraphList();
|
|
12293
12369
|
const lastParagraph = tempParagraphList[tempParagraphList.length - 1];
|
|
@@ -12317,10 +12393,11 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12317
12393
|
currentBlocks.length = 0;
|
|
12318
12394
|
content = "";
|
|
12319
12395
|
if (tableCellList.length > 0) cellParagraphList.push(paragraphNode);
|
|
12396
|
+
else if (columnGroupList.length > 0) columnParagraphList.push(paragraphNode);
|
|
12320
12397
|
else paragraphList.push(paragraphNode);
|
|
12321
12398
|
} else if (char === _univerjs_core.DataStreamTreeTokenType.SECTION_BREAK) {
|
|
12322
12399
|
const sectionNode = DataStreamTreeNode.create(_univerjs_core.DataStreamTreeNodeType.SECTION_BREAK);
|
|
12323
|
-
const tempParagraphList = tableCellList.length > 0 ? cellParagraphList : paragraphList;
|
|
12400
|
+
const tempParagraphList = tableCellList.length > 0 ? cellParagraphList : columnGroupList.length > 0 ? columnParagraphList : paragraphList;
|
|
12324
12401
|
if (tempParagraphList.length === 0) {
|
|
12325
12402
|
const emptyParagraph = DataStreamTreeNode.create(_univerjs_core.DataStreamTreeNodeType.PARAGRAPH, "");
|
|
12326
12403
|
emptyParagraph.setIndexRange(i, i - 1);
|
|
@@ -12332,7 +12409,8 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12332
12409
|
if (tableCellList.length > 0) {
|
|
12333
12410
|
const lastCell = tableCellList[tableCellList.length - 1];
|
|
12334
12411
|
batchParent(lastCell, [sectionNode], _univerjs_core.DataStreamTreeNodeType.TABLE_CELL);
|
|
12335
|
-
} else
|
|
12412
|
+
} else if (columnGroupList.length > 0) columnSectionList.push(sectionNode);
|
|
12413
|
+
else sectionList.push(sectionNode);
|
|
12336
12414
|
tempParagraphList.length = 0;
|
|
12337
12415
|
} else if (char === _univerjs_core.DataStreamTreeTokenType.TABLE_START) {
|
|
12338
12416
|
const tableNode = DataStreamTreeNode.create(_univerjs_core.DataStreamTreeNodeType.TABLE);
|
|
@@ -12358,6 +12436,32 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12358
12436
|
const cellNode = tableCellList.pop();
|
|
12359
12437
|
const lastRow = tableRowList[tableRowList.length - 1];
|
|
12360
12438
|
batchParent(lastRow, [cellNode], _univerjs_core.DataStreamTreeNodeType.TABLE_ROW);
|
|
12439
|
+
} else if (char === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_START) {
|
|
12440
|
+
const columnGroupNode = DataStreamTreeNode.create(_univerjs_core.DataStreamTreeNodeType.COLUMN_GROUP);
|
|
12441
|
+
columnGroupNode.setIndexRange(i, i);
|
|
12442
|
+
columnGroupList.push(columnGroupNode);
|
|
12443
|
+
} else if (char === _univerjs_core.DataStreamTreeTokenType.COLUMN_START) {
|
|
12444
|
+
const columnNode = DataStreamTreeNode.create(_univerjs_core.DataStreamTreeNodeType.COLUMN);
|
|
12445
|
+
columnNode.setIndexRange(i, i);
|
|
12446
|
+
columnList.push(columnNode);
|
|
12447
|
+
} else if (char === _univerjs_core.DataStreamTreeTokenType.COLUMN_END) {
|
|
12448
|
+
const columnNode = columnList[columnList.length - 1];
|
|
12449
|
+
const columnChildren = columnSectionList.length > 0 ? columnSectionList : columnParagraphList;
|
|
12450
|
+
const columnStartIndex = columnNode.startIndex;
|
|
12451
|
+
batchParent(columnNode, columnChildren, _univerjs_core.DataStreamTreeNodeType.COLUMN);
|
|
12452
|
+
columnNode.setIndexRange(columnStartIndex, i);
|
|
12453
|
+
columnParagraphList.length = 0;
|
|
12454
|
+
columnSectionList.length = 0;
|
|
12455
|
+
} else if (char === _univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_END) {
|
|
12456
|
+
const columnGroupNode = columnGroupList.pop();
|
|
12457
|
+
const columnGroupStartIndex = columnGroupNode.startIndex;
|
|
12458
|
+
batchParent(columnGroupNode, columnList, _univerjs_core.DataStreamTreeNodeType.COLUMN_GROUP);
|
|
12459
|
+
columnGroupNode.setIndexRange(columnGroupStartIndex, i);
|
|
12460
|
+
paragraphList.push(columnGroupNode);
|
|
12461
|
+
columnList.length = 0;
|
|
12462
|
+
columnParagraphList.length = 0;
|
|
12463
|
+
columnSectionList.length = 0;
|
|
12464
|
+
content = "";
|
|
12361
12465
|
} else if (char === _univerjs_core.DataStreamTreeTokenType.BLOCK_START) content += char;
|
|
12362
12466
|
else if (char === _univerjs_core.DataStreamTreeTokenType.BLOCK_END) {
|
|
12363
12467
|
if (content.length > 0 || !appendToPreviousParagraph(char)) content += char;
|
|
@@ -12372,8 +12476,9 @@ function parseDataStreamToTree(dataStream, tables) {
|
|
|
12372
12476
|
};
|
|
12373
12477
|
}
|
|
12374
12478
|
var DocumentViewModel = class DocumentViewModel {
|
|
12375
|
-
constructor(_documentDataModel) {
|
|
12479
|
+
constructor(_documentDataModel, _tableSource) {
|
|
12376
12480
|
this._documentDataModel = _documentDataModel;
|
|
12481
|
+
this._tableSource = _tableSource;
|
|
12377
12482
|
_defineProperty(this, "_interceptor", null);
|
|
12378
12483
|
_defineProperty(this, "_cacheSize", 1e3);
|
|
12379
12484
|
_defineProperty(this, "_textRunsCache", /* @__PURE__ */ new Map());
|
|
@@ -12381,6 +12486,7 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12381
12486
|
_defineProperty(this, "_sectionBreakCache", /* @__PURE__ */ new Map());
|
|
12382
12487
|
_defineProperty(this, "_customBlockCache", /* @__PURE__ */ new Map());
|
|
12383
12488
|
_defineProperty(this, "_tableCache", /* @__PURE__ */ new Map());
|
|
12489
|
+
_defineProperty(this, "_columnGroupCache", /* @__PURE__ */ new Map());
|
|
12384
12490
|
_defineProperty(this, "_tableNodeCache", /* @__PURE__ */ new Map());
|
|
12385
12491
|
_defineProperty(this, "_children", []);
|
|
12386
12492
|
_defineProperty(this, "_editArea", "BODY");
|
|
@@ -12411,6 +12517,7 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12411
12517
|
this._sectionBreakCache.clear();
|
|
12412
12518
|
this._customBlockCache.clear();
|
|
12413
12519
|
this._tableCache.clear();
|
|
12520
|
+
this._columnGroupCache.clear();
|
|
12414
12521
|
this._tableNodeCache.clear();
|
|
12415
12522
|
this._segmentViewModels$.complete();
|
|
12416
12523
|
this._editAreaChange$.complete();
|
|
@@ -12482,6 +12589,9 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12482
12589
|
getTableByStartIndex(index) {
|
|
12483
12590
|
return this._tableCache.get(index);
|
|
12484
12591
|
}
|
|
12592
|
+
getColumnGroupByStartIndex(index) {
|
|
12593
|
+
return this._columnGroupCache.get(index);
|
|
12594
|
+
}
|
|
12485
12595
|
findTableNodeById(id) {
|
|
12486
12596
|
var _this$_tableNodeCache;
|
|
12487
12597
|
return (_this$_tableNodeCache = this._tableNodeCache.get(id)) === null || _this$_tableNodeCache === void 0 ? void 0 : _this$_tableNodeCache.table;
|
|
@@ -12516,6 +12626,7 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12516
12626
|
this._buildSectionBreakCache();
|
|
12517
12627
|
this._buildCustomBlockCache();
|
|
12518
12628
|
this._buildTableCache();
|
|
12629
|
+
this._buildColumnGroupCache();
|
|
12519
12630
|
}
|
|
12520
12631
|
_buildParagraphCache() {
|
|
12521
12632
|
var _this$getBody$paragra, _this$getBody;
|
|
@@ -12545,10 +12656,10 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12545
12656
|
}
|
|
12546
12657
|
}
|
|
12547
12658
|
_buildTableCache() {
|
|
12548
|
-
var _this$getBody4;
|
|
12659
|
+
var _this$getBody4, _this$_tableSource;
|
|
12549
12660
|
this._tableCache.clear();
|
|
12550
12661
|
const tables = (_this$getBody4 = this.getBody()) === null || _this$getBody4 === void 0 ? void 0 : _this$getBody4.tables;
|
|
12551
|
-
const tableConfig = this.getSnapshot().tableSource;
|
|
12662
|
+
const tableConfig = (_this$_tableSource = this._tableSource) !== null && _this$_tableSource !== void 0 ? _this$_tableSource : this.getSnapshot().tableSource;
|
|
12552
12663
|
if (tables == null || tableConfig == null) return;
|
|
12553
12664
|
for (const table of tables) {
|
|
12554
12665
|
const { startIndex, tableId } = table;
|
|
@@ -12560,9 +12671,23 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12560
12671
|
});
|
|
12561
12672
|
}
|
|
12562
12673
|
}
|
|
12674
|
+
_buildColumnGroupCache() {
|
|
12675
|
+
var _this$getBody5;
|
|
12676
|
+
this._columnGroupCache.clear();
|
|
12677
|
+
const columnGroups = (_this$getBody5 = this.getBody()) === null || _this$getBody5 === void 0 ? void 0 : _this$getBody5.columnGroups;
|
|
12678
|
+
if (columnGroups == null) return;
|
|
12679
|
+
for (const columnGroup of columnGroups) {
|
|
12680
|
+
const { startIndex } = columnGroup;
|
|
12681
|
+
if (!columnGroup.columns) continue;
|
|
12682
|
+
this._columnGroupCache.set(startIndex, {
|
|
12683
|
+
columnGroup,
|
|
12684
|
+
columnGroupSource: columnGroup
|
|
12685
|
+
});
|
|
12686
|
+
}
|
|
12687
|
+
}
|
|
12563
12688
|
_buildTextRunsCache() {
|
|
12564
|
-
var _this$getBody$textRun, _this$
|
|
12565
|
-
const textRuns = (_this$getBody$textRun = (_this$
|
|
12689
|
+
var _this$getBody$textRun, _this$getBody6;
|
|
12690
|
+
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 : [];
|
|
12566
12691
|
this._textRunsCache.clear();
|
|
12567
12692
|
for (const textRun of textRuns) {
|
|
12568
12693
|
const { st, ed } = textRun;
|
|
@@ -12576,80 +12701,19 @@ var DocumentViewModel = class DocumentViewModel {
|
|
|
12576
12701
|
_buildHeaderFooterViewModel() {
|
|
12577
12702
|
const { headerModelMap, footerModelMap } = this._documentDataModel;
|
|
12578
12703
|
const viewModels = [];
|
|
12704
|
+
const tableSource = this.getSnapshot().tableSource;
|
|
12579
12705
|
for (const [headerId, headerModel] of headerModelMap) {
|
|
12580
|
-
this._headerTreeMap.set(headerId, new DocumentViewModel(headerModel));
|
|
12706
|
+
this._headerTreeMap.set(headerId, new DocumentViewModel(headerModel, tableSource));
|
|
12581
12707
|
viewModels.push(this._headerTreeMap.get(headerId));
|
|
12582
12708
|
}
|
|
12583
12709
|
for (const [footerId, footerModel] of footerModelMap) {
|
|
12584
|
-
this._footerTreeMap.set(footerId, new DocumentViewModel(footerModel));
|
|
12710
|
+
this._footerTreeMap.set(footerId, new DocumentViewModel(footerModel, tableSource));
|
|
12585
12711
|
viewModels.push(this._footerTreeMap.get(footerId));
|
|
12586
12712
|
}
|
|
12587
12713
|
this._segmentViewModels$.next(viewModels);
|
|
12588
12714
|
}
|
|
12589
12715
|
};
|
|
12590
12716
|
|
|
12591
|
-
//#endregion
|
|
12592
|
-
//#region src/components/docs/document-compatibility.ts
|
|
12593
|
-
const MODERN_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12594
|
-
mode: "modern",
|
|
12595
|
-
applyDocumentDefaultParagraphStyle: true,
|
|
12596
|
-
useWordStyleLineHeight: true,
|
|
12597
|
-
font: { metricScaleRules: [] },
|
|
12598
|
-
table: {
|
|
12599
|
-
currentPageOverflowTolerance: 0,
|
|
12600
|
-
rowOverflowTolerance: 0,
|
|
12601
|
-
allowImportedTableMarginOverflow: false
|
|
12602
|
-
}
|
|
12603
|
-
};
|
|
12604
|
-
const TRADITIONAL_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12605
|
-
mode: "traditional",
|
|
12606
|
-
applyDocumentDefaultParagraphStyle: false,
|
|
12607
|
-
useWordStyleLineHeight: true,
|
|
12608
|
-
font: { metricScaleRules: [{
|
|
12609
|
-
fontFamily: /^calibri$/i,
|
|
12610
|
-
minFontSize: 20,
|
|
12611
|
-
fontString: /\bbold\b/i,
|
|
12612
|
-
content: /^[\d/]+$/u,
|
|
12613
|
-
widthScale: .92
|
|
12614
|
-
}] },
|
|
12615
|
-
table: {
|
|
12616
|
-
currentPageOverflowTolerance: 12,
|
|
12617
|
-
rowOverflowTolerance: 4,
|
|
12618
|
-
allowImportedTableMarginOverflow: true
|
|
12619
|
-
}
|
|
12620
|
-
};
|
|
12621
|
-
const UNSPECIFIED_DOCUMENT_COMPATIBILITY_POLICY = {
|
|
12622
|
-
mode: "unspecified",
|
|
12623
|
-
applyDocumentDefaultParagraphStyle: false,
|
|
12624
|
-
useWordStyleLineHeight: false,
|
|
12625
|
-
font: { metricScaleRules: [] },
|
|
12626
|
-
table: {
|
|
12627
|
-
currentPageOverflowTolerance: 0,
|
|
12628
|
-
rowOverflowTolerance: 0,
|
|
12629
|
-
allowImportedTableMarginOverflow: false
|
|
12630
|
-
}
|
|
12631
|
-
};
|
|
12632
|
-
function getDocumentCompatibilityPolicy(documentFlavor) {
|
|
12633
|
-
if (documentFlavor === _univerjs_core.DocumentFlavor.MODERN) return MODERN_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12634
|
-
if (documentFlavor === _univerjs_core.DocumentFlavor.TRADITIONAL) return TRADITIONAL_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12635
|
-
return UNSPECIFIED_DOCUMENT_COMPATIBILITY_POLICY;
|
|
12636
|
-
}
|
|
12637
|
-
function applyFontMetricCompatibility(content, fontStyle, bBox, policy) {
|
|
12638
|
-
const fontFamilies = fontStyle.fontFamily.split(",").map((item) => item.trim().replace(/^['"]|['"]$/g, ""));
|
|
12639
|
-
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)));
|
|
12640
|
-
if ((rule === null || rule === void 0 ? void 0 : rule.widthScale) == null) return bBox;
|
|
12641
|
-
return {
|
|
12642
|
-
...bBox,
|
|
12643
|
-
width: bBox.width * rule.widthScale
|
|
12644
|
-
};
|
|
12645
|
-
}
|
|
12646
|
-
function isTraditionalDocumentCompatibility(policy) {
|
|
12647
|
-
return policy.mode === "traditional";
|
|
12648
|
-
}
|
|
12649
|
-
function shouldAllowImportedTableMarginOverflow(policy, tableSource) {
|
|
12650
|
-
return policy.table.allowImportedTableMarginOverflow && tableSource != null && typeof tableSource === "object" && "docxWidth" in tableSource;
|
|
12651
|
-
}
|
|
12652
|
-
|
|
12653
12717
|
//#endregion
|
|
12654
12718
|
//#region src/components/docs/layout/model/glyph.ts
|
|
12655
12719
|
function isSpace(char) {
|
|
@@ -12740,6 +12804,10 @@ function _createSkeletonWordOrLetter(glyphType, content, config, glyphWidth, gly
|
|
|
12740
12804
|
_univerjs_core.DataStreamTreeTokenType.TABLE_ROW_END,
|
|
12741
12805
|
_univerjs_core.DataStreamTreeTokenType.TABLE_CELL_START,
|
|
12742
12806
|
_univerjs_core.DataStreamTreeTokenType.TABLE_CELL_END,
|
|
12807
|
+
_univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_START,
|
|
12808
|
+
_univerjs_core.DataStreamTreeTokenType.COLUMN_START,
|
|
12809
|
+
_univerjs_core.DataStreamTreeTokenType.COLUMN_END,
|
|
12810
|
+
_univerjs_core.DataStreamTreeTokenType.COLUMN_GROUP_END,
|
|
12743
12811
|
_univerjs_core.DataStreamTreeTokenType.BLOCK_START,
|
|
12744
12812
|
_univerjs_core.DataStreamTreeTokenType.BLOCK_END,
|
|
12745
12813
|
_univerjs_core.DataStreamTreeTokenType.CUSTOM_RANGE_START,
|
|
@@ -12902,7 +12970,9 @@ function createSkeletonLine(paragraphIndex, lineType, lineBoundingBox, columnWid
|
|
|
12902
12970
|
lineSke.isBehindTable = true;
|
|
12903
12971
|
lineSke.tableId = tableId;
|
|
12904
12972
|
}
|
|
12905
|
-
|
|
12973
|
+
const affectSkeDrawings = new Map(Array.from(pageSkeDrawings).filter(([_, drawing]) => drawing.drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.INLINE && drawing.drawingOrigin.layoutType !== _univerjs_core.PositionedObjectLayoutType.WRAP_NONE));
|
|
12974
|
+
const wrapTypeTables = new Map(Array.from(pageSkeTables).filter(([_, table]) => table.tableSource.textWrap === _univerjs_core.TableTextWrapType.WRAP));
|
|
12975
|
+
lineSke.divides = lineHeight <= .01 ? [__getDivideSKe(0, columnWidth)] : _calculateDividesByDrawings(lineHeight, lineTop, columnWidth, paddingLeft, paddingRight, page, headerPage, footerPage, affectSkeDrawings, headersDrawings, footersDrawings, wrapTypeTables);
|
|
12906
12976
|
for (const divide of lineSke.divides) divide.parent = lineSke;
|
|
12907
12977
|
return lineSke;
|
|
12908
12978
|
}
|
|
@@ -13141,6 +13211,8 @@ function ___getWrapTextRuler(wrapText, resultLeft, resultWidth, columnWidth) {
|
|
|
13141
13211
|
return ruler;
|
|
13142
13212
|
}
|
|
13143
13213
|
function _calculateDivideByDrawings(columnWidth, drawingSplit) {
|
|
13214
|
+
if (!Number.isFinite(columnWidth) || columnWidth <= 0) return [__getDivideSKe(0, Math.max(1, columnWidth || 1))];
|
|
13215
|
+
drawingSplit = drawingSplit.filter(({ left, width }) => Number.isFinite(left) && Number.isFinite(width) && width > 0 && left < columnWidth && left + width > 0);
|
|
13144
13216
|
drawingSplit.sort((pre, next) => {
|
|
13145
13217
|
if (pre.left > next.left) return 1;
|
|
13146
13218
|
return -1;
|
|
@@ -13670,6 +13742,13 @@ function getTableIdAndSliceIndex(tableSliceId) {
|
|
|
13670
13742
|
//#region src/components/docs/layout/block/paragraph/layout-ruler.ts
|
|
13671
13743
|
const LINE_LAYOUT_OVERFLOW_TOLERANCE = 2;
|
|
13672
13744
|
const FLOAT_OBJECT_RELAYOUT_LIMIT = 5;
|
|
13745
|
+
const MIN_LINE_WIDTH_TOLERANCE = 1;
|
|
13746
|
+
const MAX_LINE_WIDTH_TOLERANCE = 3;
|
|
13747
|
+
const RELATIVE_LINE_WIDTH_TOLERANCE = .01;
|
|
13748
|
+
function isBeyondDivideWidth(width, divideWidth) {
|
|
13749
|
+
const tolerance = Math.min(MAX_LINE_WIDTH_TOLERANCE, Math.max(MIN_LINE_WIDTH_TOLERANCE, divideWidth * RELATIVE_LINE_WIDTH_TOLERANCE));
|
|
13750
|
+
return width - divideWidth > tolerance;
|
|
13751
|
+
}
|
|
13673
13752
|
function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal") {
|
|
13674
13753
|
if (isParagraphFirstShapedText) if (paragraphConfig.bulletSkeleton) {
|
|
13675
13754
|
var _paragraphProperties$;
|
|
@@ -13751,7 +13830,12 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13751
13830
|
const lastGlyph = divide === null || divide === void 0 || (_divide$glyphGroup = divide.glyphGroup) === null || _divide$glyphGroup === void 0 ? void 0 : _divide$glyphGroup[divide.glyphGroup.length - 1];
|
|
13752
13831
|
const preOffsetLeft = ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.width) || 0) + ((lastGlyph === null || lastGlyph === void 0 ? void 0 : lastGlyph.left) || 0);
|
|
13753
13832
|
const { hyphenationZone } = sectionBreakConfig;
|
|
13754
|
-
if (preOffsetLeft + width
|
|
13833
|
+
if (isBeyondDivideWidth(preOffsetLeft + width, divide.width)) {
|
|
13834
|
+
if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length > 0 && glyphGroup[0].streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) {
|
|
13835
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13836
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13837
|
+
return;
|
|
13838
|
+
}
|
|
13755
13839
|
if (shouldKeepOverflowingTextOnLine(sectionBreakConfig)) {
|
|
13756
13840
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13757
13841
|
updateDivideInfo(divide, { breakType: breakPointType });
|
|
@@ -13763,13 +13847,13 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13763
13847
|
if (divideInfo.isLast && glyphGroup.length === 1 && (glyphGroup[0].content === _univerjs_core.DataStreamTreeTokenType.SPACE || glyphGroup[0].content === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH)) addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13764
13848
|
else if (divideInfo.isLast && !isGlyphGroupBeyondContentBox(glyphGroup, preOffsetLeft, divide.width) && isGlyphGroupEndWithWhiteSpaces(glyphGroup)) addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13765
13849
|
else if (!isLast && (divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0 && glyphGroup.length === 1 && glyphGroup[0].streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyphGroup[0].width > divide.width) {
|
|
13766
|
-
|
|
13767
|
-
|
|
13850
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13851
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13768
13852
|
} else if ((divide === null || divide === void 0 ? void 0 : divide.glyphGroup.length) === 0) {
|
|
13769
13853
|
const sliceGlyphGroup = [];
|
|
13770
13854
|
while (glyphGroup.length) {
|
|
13771
13855
|
sliceGlyphGroup.push(glyphGroup.shift());
|
|
13772
|
-
if (__getGlyphGroupWidth(sliceGlyphGroup)
|
|
13856
|
+
if (isBeyondDivideWidth(__getGlyphGroupWidth(sliceGlyphGroup), divide.width)) {
|
|
13773
13857
|
if (sliceGlyphGroup.length > 1) glyphGroup.unshift(sliceGlyphGroup.pop());
|
|
13774
13858
|
break;
|
|
13775
13859
|
}
|
|
@@ -13822,6 +13906,10 @@ function _divideOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
|
|
|
13822
13906
|
const paragraphAnchorLeft = __getParagraphAnchorLeft(sectionBreakConfig, paragraphConfig, (_paragraphConfig$para = paragraphConfig.paragraphStyle) === null || _paragraphConfig$para === void 0 ? void 0 : _paragraphConfig$para.indentStart);
|
|
13823
13907
|
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);
|
|
13824
13908
|
__updateDrawingPosition(currentLine.parent, drawings);
|
|
13909
|
+
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
13910
|
+
updateDivideInfo(divide, { breakType: breakPointType });
|
|
13911
|
+
glyphGroup.length = 0;
|
|
13912
|
+
return;
|
|
13825
13913
|
}
|
|
13826
13914
|
}
|
|
13827
13915
|
addGlyphToDivide(divide, glyphGroup, preOffsetLeft);
|
|
@@ -13833,6 +13921,19 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13833
13921
|
var _originParagraphStyle, _originParagraphStyle2, _skeHeaders$get, _skeFooters$get;
|
|
13834
13922
|
let lastPage = getLastPage(pages);
|
|
13835
13923
|
let columnInfo = getLastNotFullColumnInfo(lastPage);
|
|
13924
|
+
if (!columnInfo || !columnInfo.column) {
|
|
13925
|
+
const lastSection = getLastSection(lastPage);
|
|
13926
|
+
const lastColumnIndex = lastSection.columns.length - 1;
|
|
13927
|
+
const lastColumn = lastSection.columns[lastColumnIndex];
|
|
13928
|
+
if (lastColumn && isBlankColumn(lastColumn)) {
|
|
13929
|
+
setColumnFullState(lastColumn, false);
|
|
13930
|
+
columnInfo = {
|
|
13931
|
+
column: lastColumn,
|
|
13932
|
+
index: lastColumnIndex,
|
|
13933
|
+
isLast: true
|
|
13934
|
+
};
|
|
13935
|
+
}
|
|
13936
|
+
}
|
|
13836
13937
|
if (!columnInfo || !columnInfo.column) {
|
|
13837
13938
|
_pageOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, true, breakPointType);
|
|
13838
13939
|
lastPage = getLastPage(pages);
|
|
@@ -13859,9 +13960,21 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13859
13960
|
};
|
|
13860
13961
|
const { paragraphLineGapDefault, linePitch, lineSpacing, spacingRule, snapToGrid, gridType } = getLineHeightConfig(sectionBreakConfig, paragraphConfig);
|
|
13861
13962
|
const hasInlineCustomBlock = glyphGroup.some((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.width !== 0);
|
|
13963
|
+
const positionedCustomBlockOnly = glyphGroup.length > 0 && paragraphNonInlineSkeDrawings != null && paragraphNonInlineSkeDrawings.size > 0 && glyphGroup.every((glyph) => {
|
|
13964
|
+
if (!glyph) return false;
|
|
13965
|
+
if (glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK) return [...paragraphNonInlineSkeDrawings.values()].some((drawing) => drawing.drawingId === glyph.drawingId);
|
|
13966
|
+
return glyph.streamType === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH || glyph.raw === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH;
|
|
13967
|
+
});
|
|
13862
13968
|
const glyphGroupCustomBlockIds = new Set(glyphGroup.filter((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK && glyph.drawingId != null).map((glyph) => glyph.drawingId));
|
|
13863
13969
|
let { paddingTop, paddingBottom, contentHeight, lineSpacingApply } = getLineHeightMetrics(glyphLineHeight, paragraphLineGapDefault, linePitch, gridType, lineSpacing, spacingRule, snapToGrid, paragraphConfig.useWordStyleLineHeight, !hasInlineCustomBlock);
|
|
13970
|
+
if (positionedCustomBlockOnly) {
|
|
13971
|
+
paddingTop = 0;
|
|
13972
|
+
paddingBottom = 0;
|
|
13973
|
+
contentHeight = .01;
|
|
13974
|
+
lineSpacingApply = .01;
|
|
13975
|
+
}
|
|
13864
13976
|
let { marginTop, spaceBelowApply } = __getParagraphSpace(ctx, lineSpacingApply, spaceAbove, spaceBelow, isParagraphFirstShapedText, preLine);
|
|
13977
|
+
if (positionedCustomBlockOnly) spaceBelowApply = 0;
|
|
13865
13978
|
if (isZeroWidthNonFlowFloatingAnchorLine) {
|
|
13866
13979
|
paddingTop = 0;
|
|
13867
13980
|
paddingBottom = 0;
|
|
@@ -13904,7 +14017,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
|
|
|
13904
14017
|
var _pDrawingAnchor$get2;
|
|
13905
14018
|
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);
|
|
13906
14019
|
}
|
|
13907
|
-
const newLineTop = calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
14020
|
+
const newLineTop = positionedCustomBlockOnly ? lineTop : calculateLineTopByDrawings(lineHeight, lineTop, lastPage, headerPage, footerPage);
|
|
13908
14021
|
if (lineHeight + newLineTop - section.height > LINE_LAYOUT_OVERFLOW_TOLERANCE && column.lines.length > 0 && lastPage.sections.length > 0 || needOpenNewPageByTableLayout) {
|
|
13909
14022
|
setColumnFullState(column, true);
|
|
13910
14023
|
_columnOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType, defaultGlyphLineHeight);
|
|
@@ -14530,6 +14643,25 @@ function isColumnFull(page) {
|
|
|
14530
14643
|
for (let i = 0; i < columnsLen; i++) if (!section.columns[i].isFull) return false;
|
|
14531
14644
|
return true;
|
|
14532
14645
|
}
|
|
14646
|
+
function isBlankColumn(column) {
|
|
14647
|
+
const lines = column.lines;
|
|
14648
|
+
if (lines.length > 1) return false;
|
|
14649
|
+
const line = lines[lines.length - 1];
|
|
14650
|
+
return isLineBlank(line);
|
|
14651
|
+
}
|
|
14652
|
+
function isLineBlank(line) {
|
|
14653
|
+
if (!line) return true;
|
|
14654
|
+
for (let i = 0; i < line.divides.length; i++) {
|
|
14655
|
+
const spanCount = line.divides[i].glyphGroup.length;
|
|
14656
|
+
if (spanCount > 1) return false;
|
|
14657
|
+
if (spanCount === 1) {
|
|
14658
|
+
const { glyphType, raw, streamType, width } = line.divides[i].glyphGroup[0];
|
|
14659
|
+
const isZeroWidthColumnBreak = width === 0 && (raw === _univerjs_core.DataStreamTreeTokenType.COLUMN_BREAK || streamType === _univerjs_core.DataStreamTreeTokenType.COLUMN_BREAK);
|
|
14660
|
+
if (glyphType !== 4 && glyphType !== 2 && !isZeroWidthColumnBreak) return false;
|
|
14661
|
+
}
|
|
14662
|
+
}
|
|
14663
|
+
return true;
|
|
14664
|
+
}
|
|
14533
14665
|
function getNumberUnitValue(unitValue, benchMark) {
|
|
14534
14666
|
if (!unitValue) return 0;
|
|
14535
14667
|
const { v: value, u: unit } = unitValue;
|
|
@@ -14579,15 +14711,17 @@ function getCharSpaceConfig(sectionBreakConfig, paragraphConfig) {
|
|
|
14579
14711
|
snapToGrid
|
|
14580
14712
|
};
|
|
14581
14713
|
}
|
|
14582
|
-
function updateBlockIndex(pages, start = -1) {
|
|
14714
|
+
function updateBlockIndex(pages, start = -1, documentCompatibilityPolicy) {
|
|
14583
14715
|
let prePageStartIndex = start;
|
|
14716
|
+
const shouldUseLayoutColumnWidth = (documentCompatibilityPolicy === null || documentCompatibilityPolicy === void 0 ? void 0 : documentCompatibilityPolicy.mode) !== "unspecified";
|
|
14584
14717
|
for (const page of pages) {
|
|
14585
|
-
const { sections, skeTables } = page;
|
|
14718
|
+
const { sections, skeTables, skeColumnGroups = /* @__PURE__ */ new Map() } = page;
|
|
14586
14719
|
const pageStartIndex = prePageStartIndex;
|
|
14587
14720
|
let preSectionStartIndex = pageStartIndex;
|
|
14588
14721
|
let maxContentWidth = Number.NEGATIVE_INFINITY;
|
|
14589
14722
|
let contentHeight = 0;
|
|
14590
14723
|
for (const section of sections) {
|
|
14724
|
+
collapseRedundantColumnBreakOverflow(section);
|
|
14591
14725
|
const { columns } = section;
|
|
14592
14726
|
const sectionStartIndex = preSectionStartIndex;
|
|
14593
14727
|
let preColumnStartIndex = sectionStartIndex;
|
|
@@ -14606,6 +14740,16 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14606
14740
|
const table = skeTables.get(tableId);
|
|
14607
14741
|
if (table) lineStartIndex = table.ed;
|
|
14608
14742
|
}
|
|
14743
|
+
if (line.type === 1 && divides.length === 0) {
|
|
14744
|
+
line.st = Math.max(line.st, lineStartIndex + 1);
|
|
14745
|
+
line.ed = Math.max(line.ed, line.st);
|
|
14746
|
+
line.width = 0;
|
|
14747
|
+
line.asc = 0;
|
|
14748
|
+
line.dsc = 0;
|
|
14749
|
+
columnHeight = top + lineHeight;
|
|
14750
|
+
preLineStartIndex = Math.max(preLineStartIndex, line.ed);
|
|
14751
|
+
continue;
|
|
14752
|
+
}
|
|
14609
14753
|
let preDivideStartIndex = lineStartIndex;
|
|
14610
14754
|
let actualWidth = 0;
|
|
14611
14755
|
let maxLineAsc = 0;
|
|
@@ -14645,8 +14789,9 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14645
14789
|
column.st = columStartIndex + 1;
|
|
14646
14790
|
column.ed = preLineStartIndex >= column.st ? preLineStartIndex : column.st;
|
|
14647
14791
|
column.height = columnHeight;
|
|
14648
|
-
column.width
|
|
14649
|
-
|
|
14792
|
+
const measuredColumnWidth = shouldUseLayoutColumnWidth && Number.isFinite(column.width) && column.width > 0 ? column.width : maxColumnWidth;
|
|
14793
|
+
column.width = measuredColumnWidth;
|
|
14794
|
+
sectionWidth += measuredColumnWidth;
|
|
14650
14795
|
maxSectionHeight = Math.max(maxSectionHeight, column.height);
|
|
14651
14796
|
preColumnStartIndex = column.ed;
|
|
14652
14797
|
}
|
|
@@ -14661,6 +14806,10 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14661
14806
|
const { ed } = table;
|
|
14662
14807
|
preSectionStartIndex = Math.max(preSectionStartIndex, ed);
|
|
14663
14808
|
}
|
|
14809
|
+
for (const columnGroup of skeColumnGroups.values()) {
|
|
14810
|
+
const { ed } = columnGroup;
|
|
14811
|
+
preSectionStartIndex = Math.max(preSectionStartIndex, ed);
|
|
14812
|
+
}
|
|
14664
14813
|
page.st = pageStartIndex + 1;
|
|
14665
14814
|
page.ed = preSectionStartIndex >= page.st ? preSectionStartIndex : page.st;
|
|
14666
14815
|
page.height = contentHeight;
|
|
@@ -14668,6 +14817,28 @@ function updateBlockIndex(pages, start = -1) {
|
|
|
14668
14817
|
prePageStartIndex = page.ed;
|
|
14669
14818
|
}
|
|
14670
14819
|
}
|
|
14820
|
+
function collapseRedundantColumnBreakOverflow(section) {
|
|
14821
|
+
var _targetColumn$height;
|
|
14822
|
+
const expectedColumnCount = section.colCount || section.columns.length;
|
|
14823
|
+
if (expectedColumnCount <= 0 || section.columns.length <= expectedColumnCount) return;
|
|
14824
|
+
const targetColumn = section.columns[expectedColumnCount - 1];
|
|
14825
|
+
if (!targetColumn) return;
|
|
14826
|
+
const overflowColumns = section.columns.slice(expectedColumnCount);
|
|
14827
|
+
if (!overflowColumns.some((column) => column.lines.length > 0)) return;
|
|
14828
|
+
const targetHeight = (_targetColumn$height = targetColumn.height) !== null && _targetColumn$height !== void 0 ? _targetColumn$height : 0;
|
|
14829
|
+
const overflowLines = overflowColumns.flatMap((column) => column.lines);
|
|
14830
|
+
overflowLines.forEach((line) => {
|
|
14831
|
+
line.top += targetHeight;
|
|
14832
|
+
line.parent = targetColumn;
|
|
14833
|
+
});
|
|
14834
|
+
targetColumn.lines.push(...overflowLines);
|
|
14835
|
+
targetColumn.height = Math.max(...overflowColumns.map((column) => {
|
|
14836
|
+
var _column$height;
|
|
14837
|
+
return targetHeight + ((_column$height = column.height) !== null && _column$height !== void 0 ? _column$height : 0);
|
|
14838
|
+
}), targetHeight);
|
|
14839
|
+
targetColumn.isFull = overflowColumns.some((column) => column.isFull);
|
|
14840
|
+
section.columns.splice(expectedColumnCount);
|
|
14841
|
+
}
|
|
14671
14842
|
function updateInlineDrawingCoordsAndBorder(ctx, pages) {
|
|
14672
14843
|
lineIterator(pages, (line, _, __, page) => {
|
|
14673
14844
|
var _ctx$paragraphConfigC, _ctx$skeletonResource, _paragraphStyle$shadi;
|
|
@@ -14719,6 +14890,294 @@ function lineIterator(pagesOrCells, cb) {
|
|
|
14719
14890
|
}
|
|
14720
14891
|
}
|
|
14721
14892
|
}
|
|
14893
|
+
function documentSkeletonTableIterator(pages, options = {}) {
|
|
14894
|
+
const { docsLeft = 0, docsTop = 0, pageMarginTop = 0, resolveViewport = true, skeFooters, skeHeaders, tableCellInsetX = 0, unitId = "" } = options;
|
|
14895
|
+
const contexts = [];
|
|
14896
|
+
pages.forEach((rootPage, pageIndex) => {
|
|
14897
|
+
var _skeHeaders$get, _skeFooters$get, _rootPage$skeColumnGr;
|
|
14898
|
+
const rootPageTop = ((rootPage.pageHeight === Infinity ? 0 : rootPage.pageHeight) + pageMarginTop) * pageIndex + rootPage.marginTop + docsTop;
|
|
14899
|
+
const rootPageLeft = rootPage.marginLeft + docsLeft;
|
|
14900
|
+
collectPageTables({
|
|
14901
|
+
contexts,
|
|
14902
|
+
docsLeft,
|
|
14903
|
+
page: rootPage,
|
|
14904
|
+
pageIndex,
|
|
14905
|
+
pageLeft: rootPageLeft,
|
|
14906
|
+
pageTop: rootPageTop,
|
|
14907
|
+
rootPage,
|
|
14908
|
+
source: "page",
|
|
14909
|
+
resolveViewport,
|
|
14910
|
+
tableCellInsetX,
|
|
14911
|
+
unitId
|
|
14912
|
+
});
|
|
14913
|
+
const rootPageDocumentTop = rootPageTop - rootPage.marginTop;
|
|
14914
|
+
const rootPageDocumentLeft = docsLeft + rootPage.marginLeft;
|
|
14915
|
+
const headerPage = rootPage.headerId == null ? void 0 : skeHeaders === null || skeHeaders === void 0 || (_skeHeaders$get = skeHeaders.get(rootPage.headerId)) === null || _skeHeaders$get === void 0 ? void 0 : _skeHeaders$get.get(rootPage.pageWidth);
|
|
14916
|
+
if (headerPage != null) collectPageTables({
|
|
14917
|
+
contexts,
|
|
14918
|
+
docsLeft,
|
|
14919
|
+
page: headerPage,
|
|
14920
|
+
pageIndex,
|
|
14921
|
+
pageLeft: rootPageDocumentLeft,
|
|
14922
|
+
pageTop: rootPageDocumentTop + headerPage.marginTop,
|
|
14923
|
+
rootPage,
|
|
14924
|
+
source: "header",
|
|
14925
|
+
resolveViewport,
|
|
14926
|
+
tableCellInsetX,
|
|
14927
|
+
unitId
|
|
14928
|
+
});
|
|
14929
|
+
const footerPage = rootPage.footerId == null ? void 0 : skeFooters === null || skeFooters === void 0 || (_skeFooters$get = skeFooters.get(rootPage.footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(rootPage.pageWidth);
|
|
14930
|
+
if (footerPage != null) collectPageTables({
|
|
14931
|
+
contexts,
|
|
14932
|
+
docsLeft,
|
|
14933
|
+
page: footerPage,
|
|
14934
|
+
pageIndex,
|
|
14935
|
+
pageLeft: rootPageDocumentLeft,
|
|
14936
|
+
pageTop: rootPageDocumentTop + rootPage.pageHeight - footerPage.height - footerPage.marginBottom,
|
|
14937
|
+
rootPage,
|
|
14938
|
+
source: "footer",
|
|
14939
|
+
resolveViewport,
|
|
14940
|
+
tableCellInsetX,
|
|
14941
|
+
unitId
|
|
14942
|
+
});
|
|
14943
|
+
(_rootPage$skeColumnGr = rootPage.skeColumnGroups) === null || _rootPage$skeColumnGr === void 0 || _rootPage$skeColumnGr.forEach((columnGroup) => {
|
|
14944
|
+
columnGroup.columns.forEach((columnGroupColumn) => {
|
|
14945
|
+
const nestedPage = columnGroupColumn.page;
|
|
14946
|
+
collectPageTables({
|
|
14947
|
+
contexts,
|
|
14948
|
+
docsLeft,
|
|
14949
|
+
page: nestedPage,
|
|
14950
|
+
pageIndex,
|
|
14951
|
+
pageLeft: rootPageLeft + columnGroup.left + columnGroupColumn.left + nestedPage.marginLeft,
|
|
14952
|
+
pageTop: rootPageTop + columnGroup.top + columnGroupColumn.top + nestedPage.marginTop,
|
|
14953
|
+
rootPage,
|
|
14954
|
+
source: "column",
|
|
14955
|
+
resolveViewport,
|
|
14956
|
+
tableCellInsetX,
|
|
14957
|
+
unitId
|
|
14958
|
+
});
|
|
14959
|
+
});
|
|
14960
|
+
});
|
|
14961
|
+
});
|
|
14962
|
+
return contexts;
|
|
14963
|
+
}
|
|
14964
|
+
function documentSkeletonLineIterator(pages, options, cb) {
|
|
14965
|
+
const { docsLeft = 0, pageMarginTop = 0, tableCellInsetX = 0, unitId = "" } = options;
|
|
14966
|
+
pages.forEach((page, pageIndex) => {
|
|
14967
|
+
var _page$skeTables, _page$skeColumnGroups;
|
|
14968
|
+
const pageTop = ((page.pageHeight === Infinity ? 0 : page.pageHeight) + pageMarginTop) * pageIndex + page.marginTop;
|
|
14969
|
+
const pageLeft = page.marginLeft;
|
|
14970
|
+
visitPageLines(page, {
|
|
14971
|
+
pageIndex,
|
|
14972
|
+
pageLeft,
|
|
14973
|
+
pageTop,
|
|
14974
|
+
source: "page",
|
|
14975
|
+
getBounds: (linePage, column, section) => getPageLineBounds(linePage, column, section.columns.length, pageLeft)
|
|
14976
|
+
}, cb);
|
|
14977
|
+
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table) => {
|
|
14978
|
+
const viewport = getDocsTableRenderViewport(unitId, getSourceTableId(table.tableId));
|
|
14979
|
+
const hasHorizontalViewport = hasDocsTableHorizontalViewport(viewport);
|
|
14980
|
+
const tableViewportLeft = getTableViewportLeft(pageLeft, table.left, viewport, docsLeft);
|
|
14981
|
+
const tableViewportRight = tableViewportLeft + (hasHorizontalViewport ? viewport.viewportWidth : table.width);
|
|
14982
|
+
const tableScrollLeft = hasHorizontalViewport ? viewport.scrollLeft : 0;
|
|
14983
|
+
table.rows.forEach((row) => {
|
|
14984
|
+
row.cells.forEach((cell) => {
|
|
14985
|
+
const cellTop = pageTop + table.top + row.top + cell.marginTop;
|
|
14986
|
+
const cellLeft = pageLeft + table.left + cell.left - tableScrollLeft + cell.marginLeft;
|
|
14987
|
+
const cellContentRight = cellLeft + cell.pageWidth - cell.marginLeft - cell.marginRight;
|
|
14988
|
+
const visualLeft = cellLeft + tableCellInsetX;
|
|
14989
|
+
const visualRight = cellContentRight - tableCellInsetX;
|
|
14990
|
+
const visualWidth = Math.max(0, visualRight - visualLeft);
|
|
14991
|
+
const clipLeft = tableViewportLeft;
|
|
14992
|
+
const clipRight = Math.min(cellContentRight, tableViewportRight);
|
|
14993
|
+
if (visualWidth <= 0 || Math.min(visualRight, clipRight) <= Math.max(visualLeft, clipLeft)) return;
|
|
14994
|
+
visitPageLines(cell, {
|
|
14995
|
+
clipLeft,
|
|
14996
|
+
clipRight,
|
|
14997
|
+
pageIndex,
|
|
14998
|
+
pageLeft: cellLeft,
|
|
14999
|
+
pageTop: cellTop,
|
|
15000
|
+
source: "table-cell",
|
|
15001
|
+
visualLeft,
|
|
15002
|
+
visualWidth
|
|
15003
|
+
}, cb);
|
|
15004
|
+
});
|
|
15005
|
+
});
|
|
15006
|
+
});
|
|
15007
|
+
(_page$skeColumnGroups = page.skeColumnGroups) === null || _page$skeColumnGroups === void 0 || _page$skeColumnGroups.forEach((columnGroup) => {
|
|
15008
|
+
columnGroup.columns.forEach((columnGroupColumn) => {
|
|
15009
|
+
const nestedPage = columnGroupColumn.page;
|
|
15010
|
+
const nestedPageLeft = pageLeft + columnGroup.left + columnGroupColumn.left + nestedPage.marginLeft;
|
|
15011
|
+
const nestedPageTop = pageTop + columnGroup.top + columnGroupColumn.top + nestedPage.marginTop;
|
|
15012
|
+
const visualWidth = Math.max(0, columnGroupColumn.width - nestedPage.marginLeft - nestedPage.marginRight);
|
|
15013
|
+
visitPageLines(nestedPage, {
|
|
15014
|
+
pageIndex,
|
|
15015
|
+
pageLeft: nestedPageLeft,
|
|
15016
|
+
pageTop: nestedPageTop,
|
|
15017
|
+
source: "column",
|
|
15018
|
+
getBounds: (_linePage, column) => ({
|
|
15019
|
+
lineWidth: Math.max(getFiniteWidth(column.width), visualWidth - column.left),
|
|
15020
|
+
visualLeft: nestedPageLeft + column.left,
|
|
15021
|
+
visualWidth: Math.max(getFiniteWidth(column.width), visualWidth - column.left)
|
|
15022
|
+
})
|
|
15023
|
+
}, cb);
|
|
15024
|
+
});
|
|
15025
|
+
});
|
|
15026
|
+
});
|
|
15027
|
+
}
|
|
15028
|
+
function getDocumentSkeletonNestedPageOffset(page) {
|
|
15029
|
+
var _parent$parent, _parent$parent$column;
|
|
15030
|
+
const parent = page.parent;
|
|
15031
|
+
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))) {
|
|
15032
|
+
var _parent$parent$left, _parent$left, _parent$parent$top, _parent$top;
|
|
15033
|
+
return {
|
|
15034
|
+
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),
|
|
15035
|
+
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)
|
|
15036
|
+
};
|
|
15037
|
+
}
|
|
15038
|
+
}
|
|
15039
|
+
function getDocumentSkeletonColumnPagePathInfo(position) {
|
|
15040
|
+
var _path$indexOf, _path$indexOf2, _path$indexOf3;
|
|
15041
|
+
const { path } = position;
|
|
15042
|
+
const pagesIndex = (_path$indexOf = path === null || path === void 0 ? void 0 : path.indexOf("pages")) !== null && _path$indexOf !== void 0 ? _path$indexOf : -1;
|
|
15043
|
+
const columnGroupIndex = (_path$indexOf2 = path === null || path === void 0 ? void 0 : path.indexOf("skeColumnGroups")) !== null && _path$indexOf2 !== void 0 ? _path$indexOf2 : -1;
|
|
15044
|
+
const columnsIndex = (_path$indexOf3 = path === null || path === void 0 ? void 0 : path.indexOf("columns")) !== null && _path$indexOf3 !== void 0 ? _path$indexOf3 : -1;
|
|
15045
|
+
if (pagesIndex === -1 || columnGroupIndex === -1 || columnsIndex === -1 || (path === null || path === void 0 ? void 0 : path[columnsIndex + 2]) !== "page") return;
|
|
15046
|
+
const pageIndex = path === null || path === void 0 ? void 0 : path[pagesIndex + 1];
|
|
15047
|
+
const columnGroupId = path === null || path === void 0 ? void 0 : path[columnGroupIndex + 1];
|
|
15048
|
+
const columnIndex = path === null || path === void 0 ? void 0 : path[columnsIndex + 1];
|
|
15049
|
+
if (typeof pageIndex !== "number" || typeof columnGroupId !== "string" || typeof columnIndex !== "number") return;
|
|
15050
|
+
return {
|
|
15051
|
+
columnGroupId,
|
|
15052
|
+
columnIndex,
|
|
15053
|
+
pageIndex
|
|
15054
|
+
};
|
|
15055
|
+
}
|
|
15056
|
+
function compareDocumentSkeletonNestedPagePathOrder(pos1, pos2) {
|
|
15057
|
+
const columnGroupOrder1 = getDocumentSkeletonColumnPagePathInfo(pos1);
|
|
15058
|
+
const columnGroupOrder2 = getDocumentSkeletonColumnPagePathInfo(pos2);
|
|
15059
|
+
if (columnGroupOrder1 && columnGroupOrder2 && columnGroupOrder1.pageIndex === columnGroupOrder2.pageIndex && columnGroupOrder1.columnGroupId === columnGroupOrder2.columnGroupId && columnGroupOrder1.columnIndex !== columnGroupOrder2.columnIndex) return columnGroupOrder1.columnIndex < columnGroupOrder2.columnIndex;
|
|
15060
|
+
}
|
|
15061
|
+
function visitPageLines(page, options, cb) {
|
|
15062
|
+
page.sections.forEach((section) => {
|
|
15063
|
+
section.columns.forEach((column) => {
|
|
15064
|
+
column.lines.forEach((line) => {
|
|
15065
|
+
var _options$getBounds, _ref, _bounds$lineWidth, _bounds$visualLeft, _bounds$visualWidth;
|
|
15066
|
+
const bounds = (_options$getBounds = options.getBounds) === null || _options$getBounds === void 0 ? void 0 : _options$getBounds.call(options, page, column, section);
|
|
15067
|
+
cb({
|
|
15068
|
+
clipLeft: options.clipLeft,
|
|
15069
|
+
clipRight: options.clipRight,
|
|
15070
|
+
column,
|
|
15071
|
+
line,
|
|
15072
|
+
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),
|
|
15073
|
+
page,
|
|
15074
|
+
pageIndex: options.pageIndex,
|
|
15075
|
+
pageLeft: options.pageLeft,
|
|
15076
|
+
section,
|
|
15077
|
+
sectionTop: options.pageTop + section.top,
|
|
15078
|
+
source: options.source,
|
|
15079
|
+
visualLeft: (_bounds$visualLeft = bounds === null || bounds === void 0 ? void 0 : bounds.visualLeft) !== null && _bounds$visualLeft !== void 0 ? _bounds$visualLeft : options.visualLeft,
|
|
15080
|
+
visualWidth: (_bounds$visualWidth = bounds === null || bounds === void 0 ? void 0 : bounds.visualWidth) !== null && _bounds$visualWidth !== void 0 ? _bounds$visualWidth : options.visualWidth
|
|
15081
|
+
});
|
|
15082
|
+
});
|
|
15083
|
+
});
|
|
15084
|
+
});
|
|
15085
|
+
}
|
|
15086
|
+
function getPageLineBounds(page, column, columnCount, pageLeft) {
|
|
15087
|
+
if (columnCount !== 1 || !Number.isFinite(page.pageWidth)) return;
|
|
15088
|
+
const visualLeft = pageLeft + column.left;
|
|
15089
|
+
const visualRight = page.pageWidth - page.marginRight;
|
|
15090
|
+
const visualWidth = Math.max(0, visualRight - visualLeft);
|
|
15091
|
+
const lineWidth = Math.max(0, page.pageWidth - page.marginLeft - page.marginRight);
|
|
15092
|
+
return visualWidth > 0 ? {
|
|
15093
|
+
lineWidth,
|
|
15094
|
+
visualLeft,
|
|
15095
|
+
visualWidth
|
|
15096
|
+
} : void 0;
|
|
15097
|
+
}
|
|
15098
|
+
function collectPageTables(options) {
|
|
15099
|
+
var _page$skeTables2;
|
|
15100
|
+
const { contexts, docsLeft, page, pageIndex, pageLeft, pageTop, resolveViewport, rootPage, source, tableCellInsetX, unitId } = options;
|
|
15101
|
+
(_page$skeTables2 = page.skeTables) === null || _page$skeTables2 === void 0 || _page$skeTables2.forEach((table, tableId) => {
|
|
15102
|
+
var _table$tableId;
|
|
15103
|
+
const effectiveTableId = (_table$tableId = table.tableId) !== null && _table$tableId !== void 0 ? _table$tableId : tableId;
|
|
15104
|
+
const tableLeft = pageLeft + table.left;
|
|
15105
|
+
const tableTop = pageTop + table.top;
|
|
15106
|
+
const sourceTableId = getSourceTableId(effectiveTableId);
|
|
15107
|
+
const viewport = resolveViewport ? getDocsTableRenderViewport(unitId, sourceTableId) : null;
|
|
15108
|
+
const hasHorizontalViewport = hasDocsTableHorizontalViewport(viewport);
|
|
15109
|
+
const tableViewportLeft = getTableViewportLeft(pageLeft, table.left, viewport, docsLeft);
|
|
15110
|
+
const tableViewportRight = tableViewportLeft + (hasHorizontalViewport ? viewport.viewportWidth : table.width);
|
|
15111
|
+
const tableScrollLeft = hasHorizontalViewport ? viewport.scrollLeft : 0;
|
|
15112
|
+
const cells = [];
|
|
15113
|
+
table.rows.forEach((row, rowIndex) => {
|
|
15114
|
+
row.cells.forEach((cell, columnIndex) => {
|
|
15115
|
+
var _cell$marginLeft, _cell$marginRight, _cell$marginTop, _cell$marginBottom, _cell$pageWidth, _cell$pageHeight, _row$top, _cell$left;
|
|
15116
|
+
if (cell.isMergedCellCovered) return;
|
|
15117
|
+
const cellMarginLeft = (_cell$marginLeft = cell.marginLeft) !== null && _cell$marginLeft !== void 0 ? _cell$marginLeft : 0;
|
|
15118
|
+
const cellMarginRight = (_cell$marginRight = cell.marginRight) !== null && _cell$marginRight !== void 0 ? _cell$marginRight : 0;
|
|
15119
|
+
const cellMarginTop = (_cell$marginTop = cell.marginTop) !== null && _cell$marginTop !== void 0 ? _cell$marginTop : 0;
|
|
15120
|
+
const cellMarginBottom = (_cell$marginBottom = cell.marginBottom) !== null && _cell$marginBottom !== void 0 ? _cell$marginBottom : 0;
|
|
15121
|
+
const cellPageWidth = (_cell$pageWidth = cell.pageWidth) !== null && _cell$pageWidth !== void 0 ? _cell$pageWidth : 0;
|
|
15122
|
+
const cellPageHeight = (_cell$pageHeight = cell.pageHeight) !== null && _cell$pageHeight !== void 0 ? _cell$pageHeight : 0;
|
|
15123
|
+
const cellTop = tableTop + ((_row$top = row.top) !== null && _row$top !== void 0 ? _row$top : 0) + cellMarginTop;
|
|
15124
|
+
const cellLeft = tableLeft + ((_cell$left = cell.left) !== null && _cell$left !== void 0 ? _cell$left : 0) - tableScrollLeft + cellMarginLeft;
|
|
15125
|
+
const cellContentRight = cellLeft + cellPageWidth - cellMarginLeft - cellMarginRight;
|
|
15126
|
+
const visualLeft = cellLeft + tableCellInsetX;
|
|
15127
|
+
const visualRight = cellContentRight - tableCellInsetX;
|
|
15128
|
+
const visualWidth = Math.max(0, visualRight - visualLeft);
|
|
15129
|
+
const clipLeft = tableViewportLeft;
|
|
15130
|
+
const clipRight = Math.min(cellContentRight, tableViewportRight);
|
|
15131
|
+
if (visualWidth <= 0 || Math.min(visualRight, clipRight) <= Math.max(visualLeft, clipLeft)) return;
|
|
15132
|
+
cells.push({
|
|
15133
|
+
cell,
|
|
15134
|
+
cellRect: {
|
|
15135
|
+
bottom: cellTop + cellPageHeight - cellMarginBottom - cellMarginTop,
|
|
15136
|
+
left: Math.max(cellLeft, tableViewportLeft),
|
|
15137
|
+
right: Math.min(cellContentRight, tableViewportRight),
|
|
15138
|
+
top: cellTop
|
|
15139
|
+
},
|
|
15140
|
+
clipLeft,
|
|
15141
|
+
clipRight,
|
|
15142
|
+
columnIndex,
|
|
15143
|
+
pageLeft: cellLeft,
|
|
15144
|
+
pageTop: cellTop,
|
|
15145
|
+
row,
|
|
15146
|
+
rowIndex,
|
|
15147
|
+
visualLeft,
|
|
15148
|
+
visualWidth
|
|
15149
|
+
});
|
|
15150
|
+
});
|
|
15151
|
+
});
|
|
15152
|
+
contexts.push({
|
|
15153
|
+
cells,
|
|
15154
|
+
page,
|
|
15155
|
+
pageIndex,
|
|
15156
|
+
pageLeft,
|
|
15157
|
+
pageTop,
|
|
15158
|
+
rootPage,
|
|
15159
|
+
source,
|
|
15160
|
+
table,
|
|
15161
|
+
tableId: effectiveTableId,
|
|
15162
|
+
tableRect: {
|
|
15163
|
+
bottom: tableTop + table.height,
|
|
15164
|
+
left: tableLeft,
|
|
15165
|
+
right: tableLeft + table.width,
|
|
15166
|
+
top: tableTop
|
|
15167
|
+
}
|
|
15168
|
+
});
|
|
15169
|
+
});
|
|
15170
|
+
}
|
|
15171
|
+
function getTableViewportLeft(pageLeft, tableLeft, viewport, docsLeft) {
|
|
15172
|
+
const viewportLeft = viewport === null || viewport === void 0 ? void 0 : viewport.viewportLeft;
|
|
15173
|
+
return viewportLeft != null ? viewportLeft - docsLeft : pageLeft + tableLeft;
|
|
15174
|
+
}
|
|
15175
|
+
function getSourceTableId(tableId) {
|
|
15176
|
+
return tableId.includes("#-#") ? tableId.split("#-#")[0] : tableId;
|
|
15177
|
+
}
|
|
15178
|
+
function getFiniteWidth(width) {
|
|
15179
|
+
return Number.isFinite(width) ? width : 0;
|
|
15180
|
+
}
|
|
14722
15181
|
function columnIterator(pages, iteratorFunction) {
|
|
14723
15182
|
for (const page of pages) {
|
|
14724
15183
|
const { sections } = page;
|
|
@@ -14741,7 +15200,14 @@ function getPositionHorizon(positionH, column, page, objectWidth, isPageBreak =
|
|
|
14741
15200
|
else if (align === _univerjs_core.AlignTypeH.CENTER) absoluteLeft = left + width / 2 - objectWidth / 2;
|
|
14742
15201
|
return absoluteLeft;
|
|
14743
15202
|
}
|
|
14744
|
-
if (relativeFrom === _univerjs_core.ObjectRelativeFromH.LEFT_MARGIN) {} else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.MARGIN) {
|
|
15203
|
+
if (relativeFrom === _univerjs_core.ObjectRelativeFromH.LEFT_MARGIN) {} else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.MARGIN) {
|
|
15204
|
+
const { pageWidth, marginLeft, marginRight } = page;
|
|
15205
|
+
const marginWidth = pageWidth - marginLeft - marginRight;
|
|
15206
|
+
let absoluteLeft = marginLeft;
|
|
15207
|
+
if (align === _univerjs_core.AlignTypeH.RIGHT) absoluteLeft = marginLeft + marginWidth - objectWidth;
|
|
15208
|
+
else if (align === _univerjs_core.AlignTypeH.CENTER) absoluteLeft = marginLeft + marginWidth / 2 - objectWidth / 2;
|
|
15209
|
+
return absoluteLeft;
|
|
15210
|
+
} else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.RIGHT_MARGIN) {} else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.INSIDE_MARGIN) {} else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.OUTSIDE_MARGIN) {} else if (relativeFrom === _univerjs_core.ObjectRelativeFromH.PAGE) {
|
|
14745
15211
|
const { pageWidth } = page;
|
|
14746
15212
|
let absoluteLeft = 0;
|
|
14747
15213
|
if (align === _univerjs_core.AlignTypeH.RIGHT) absoluteLeft = pageWidth - objectWidth;
|
|
@@ -15015,13 +15481,22 @@ function getPageFromPath(skeletonData, path) {
|
|
|
15015
15481
|
const pageIndex = pathCopy.shift();
|
|
15016
15482
|
page = skeletonData.pages[pageIndex];
|
|
15017
15483
|
} else if (field === "skeTables") {
|
|
15018
|
-
var
|
|
15484
|
+
var _page$skeTables3;
|
|
15485
|
+
if (page == null) return null;
|
|
15019
15486
|
const tableId = pathCopy.shift();
|
|
15020
15487
|
pathCopy.shift();
|
|
15021
15488
|
const rowIndex = pathCopy.shift();
|
|
15022
15489
|
pathCopy.shift();
|
|
15023
15490
|
const cellIndex = pathCopy.shift();
|
|
15024
|
-
page = (
|
|
15491
|
+
page = (_page$skeTables3 = page.skeTables) === null || _page$skeTables3 === void 0 || (_page$skeTables3 = _page$skeTables3.get(tableId)) === null || _page$skeTables3 === void 0 || (_page$skeTables3 = _page$skeTables3.rows[rowIndex]) === null || _page$skeTables3 === void 0 ? void 0 : _page$skeTables3.cells[cellIndex];
|
|
15492
|
+
} else if (field === "skeColumnGroups") {
|
|
15493
|
+
var _page$skeColumnGroups2;
|
|
15494
|
+
if (page == null) return null;
|
|
15495
|
+
const columnGroupId = pathCopy.shift();
|
|
15496
|
+
pathCopy.shift();
|
|
15497
|
+
const columnIndex = pathCopy.shift();
|
|
15498
|
+
pathCopy.shift();
|
|
15499
|
+
page = (_page$skeColumnGroups2 = page.skeColumnGroups) === null || _page$skeColumnGroups2 === void 0 || (_page$skeColumnGroups2 = _page$skeColumnGroups2.get(columnGroupId)) === null || _page$skeColumnGroups2 === void 0 || (_page$skeColumnGroups2 = _page$skeColumnGroups2.columns[columnIndex]) === null || _page$skeColumnGroups2 === void 0 ? void 0 : _page$skeColumnGroups2.page;
|
|
15025
15500
|
}
|
|
15026
15501
|
}
|
|
15027
15502
|
return page;
|
|
@@ -15088,8 +15563,8 @@ function createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference,
|
|
|
15088
15563
|
}
|
|
15089
15564
|
page.originMarginTop = marginTop;
|
|
15090
15565
|
page.originMarginBottom = marginBottom;
|
|
15091
|
-
page.marginTop = _getVerticalMargin(marginTop, header
|
|
15092
|
-
page.marginBottom = _getVerticalMargin(marginBottom, footer
|
|
15566
|
+
page.marginTop = _getVerticalMargin(marginTop, header);
|
|
15567
|
+
page.marginBottom = _getVerticalMargin(marginBottom, footer);
|
|
15093
15568
|
const sections = page.sections;
|
|
15094
15569
|
const lastSection = sections[sections.length - 1];
|
|
15095
15570
|
const { marginTop: curPageMT, marginBottom: curPageMB, marginLeft: curPageML, marginRight: curPageMR } = page;
|
|
@@ -15128,11 +15603,13 @@ function _getNullPage(type = 0, segmentId = "") {
|
|
|
15128
15603
|
ed: 0,
|
|
15129
15604
|
skeDrawings: /* @__PURE__ */ new Map(),
|
|
15130
15605
|
skeTables: /* @__PURE__ */ new Map(),
|
|
15606
|
+
skeColumnGroups: /* @__PURE__ */ new Map(),
|
|
15131
15607
|
type,
|
|
15132
15608
|
segmentId
|
|
15133
15609
|
};
|
|
15134
15610
|
}
|
|
15135
15611
|
function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader = true, areaPage, count = 0) {
|
|
15612
|
+
var _sectionBreakConfig$d;
|
|
15136
15613
|
const { lists, footerTreeMap, headerTreeMap, localeService, pageSize, drawings, marginLeft = 0, marginRight = 0, marginHeader = 0, marginFooter = 0 } = sectionBreakConfig;
|
|
15137
15614
|
const pageWidth = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) || Number.POSITIVE_INFINITY;
|
|
15138
15615
|
const pageHeight = (pageSize === null || pageSize === void 0 ? void 0 : pageSize.height) || Number.POSITIVE_INFINITY;
|
|
@@ -15160,7 +15637,7 @@ function _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakC
|
|
|
15160
15637
|
resetContext(ctx);
|
|
15161
15638
|
return _createSkeletonHeaderFooter(ctx, headerOrFooterViewModel, sectionBreakConfig, skeletonResourceReference, segmentId, isHeader, areaPage, count);
|
|
15162
15639
|
}
|
|
15163
|
-
updateBlockIndex([page]);
|
|
15640
|
+
updateBlockIndex([page], -1, (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy());
|
|
15164
15641
|
if (isHeader) Object.assign(page, {
|
|
15165
15642
|
marginTop: marginHeader,
|
|
15166
15643
|
marginBottom: 5
|
|
@@ -15221,7 +15698,7 @@ function createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, avai
|
|
|
15221
15698
|
};
|
|
15222
15699
|
}
|
|
15223
15700
|
function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, tableConfig, row, col, availableHeight = Number.POSITIVE_INFINITY, maxCellPageHeight = Number.POSITIVE_INFINITY) {
|
|
15224
|
-
var _ctx$dataModel, _ctx$dataModel$getBod;
|
|
15701
|
+
var _sectionBreakConfig$d2, _ctx$dataModel, _ctx$dataModel$getBod;
|
|
15225
15702
|
const sectionNode = cellNode.children[0];
|
|
15226
15703
|
const { page: areaPage, sectionBreakConfig: cellSectionBreakConfig } = createNullCellPage(ctx, sectionBreakConfig, tableConfig, row, col, availableHeight, maxCellPageHeight);
|
|
15227
15704
|
const { pages } = dealWithSection(ctx, viewModel, sectionNode, areaPage, cellSectionBreakConfig);
|
|
@@ -15229,8 +15706,8 @@ function createSkeletonCellPages(ctx, viewModel, cellNode, sectionBreakConfig, t
|
|
|
15229
15706
|
p.type = 3;
|
|
15230
15707
|
p.segmentId = tableConfig.tableId;
|
|
15231
15708
|
}
|
|
15232
|
-
updateBlockIndex(pages, cellNode.startIndex);
|
|
15233
|
-
|
|
15709
|
+
updateBlockIndex(pages, cellNode.startIndex, (_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d2 !== void 0 ? _sectionBreakConfig$d2 : getDocumentCompatibilityPolicy());
|
|
15710
|
+
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);
|
|
15234
15711
|
updateInlineDrawingCoordsAndBorder(ctx, pages);
|
|
15235
15712
|
expandCellPageHeightForInlineDrawings(pages);
|
|
15236
15713
|
return pages;
|
|
@@ -15246,7 +15723,7 @@ function expandCellPageHeightForInlineDrawings(pages) {
|
|
|
15246
15723
|
});
|
|
15247
15724
|
}
|
|
15248
15725
|
}
|
|
15249
|
-
function
|
|
15726
|
+
function applyTrailingBlockRangeSpaceBelow(pages, body, containerEndIndex) {
|
|
15250
15727
|
const blockRanges = body === null || body === void 0 ? void 0 : body.blockRanges;
|
|
15251
15728
|
const trailingBlockRangeSpace = 28;
|
|
15252
15729
|
if (!(blockRanges === null || blockRanges === void 0 ? void 0 : blockRanges.length)) return;
|
|
@@ -15256,12 +15733,14 @@ function applyTrailingCellBlockRangeSpaceBelow(pages, body, cellEndIndex) {
|
|
|
15256
15733
|
if (!lastLine) continue;
|
|
15257
15734
|
const paragraphIndex = lastLine.paragraphIndex;
|
|
15258
15735
|
if (!blockRanges.some((range) => range.startIndex < paragraphIndex && paragraphIndex < range.endIndex)) continue;
|
|
15259
|
-
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 <
|
|
15736
|
+
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;
|
|
15260
15737
|
page.height += lastLine.spaceBelowApply || trailingBlockRangeSpace;
|
|
15261
15738
|
}
|
|
15262
15739
|
}
|
|
15263
|
-
function _getVerticalMargin(marginTB,
|
|
15264
|
-
return marginTB;
|
|
15740
|
+
function _getVerticalMargin(marginTB, headerOrFooter) {
|
|
15741
|
+
if (headerOrFooter == null) return marginTB;
|
|
15742
|
+
const { marginTop = 0, height = 0, marginBottom = 0 } = headerOrFooter;
|
|
15743
|
+
return Math.max(marginTB, marginTop + height + marginBottom);
|
|
15265
15744
|
}
|
|
15266
15745
|
|
|
15267
15746
|
//#endregion
|
|
@@ -15368,6 +15847,15 @@ function adjustGlyphsInDivide(divide, justificationRatio, extraJustification) {
|
|
|
15368
15847
|
}
|
|
15369
15848
|
setGlyphGroupLeft(divide.glyphGroup);
|
|
15370
15849
|
}
|
|
15850
|
+
function distributeGlyphsInDivide(divide, remaining) {
|
|
15851
|
+
if (remaining <= 0) return false;
|
|
15852
|
+
const visibleGlyphs = divide.glyphGroup.filter((glyph) => glyph.content !== "" && glyph.width > 0);
|
|
15853
|
+
if (visibleGlyphs.length < 2) return false;
|
|
15854
|
+
const extraGap = remaining / (visibleGlyphs.length - 1);
|
|
15855
|
+
for (let i = 0; i < visibleGlyphs.length - 1; i++) visibleGlyphs[i].width += extraGap;
|
|
15856
|
+
setGlyphGroupLeft(divide.glyphGroup);
|
|
15857
|
+
return true;
|
|
15858
|
+
}
|
|
15371
15859
|
/**
|
|
15372
15860
|
* When aligning text horizontally within a document,
|
|
15373
15861
|
* it may be ineffective if the total line width is not initially calculated.
|
|
@@ -15433,7 +15921,13 @@ function horizontalAlignHandler(line, horizontalAlign, allowOverflowHorizontalOf
|
|
|
15433
15921
|
}
|
|
15434
15922
|
}
|
|
15435
15923
|
const inkBounds = allowOverflowHorizontalOffset ? getGlyphGroupInkBounds(divide) : null;
|
|
15436
|
-
if (horizontalAlign === _univerjs_core.HorizontalAlign.
|
|
15924
|
+
if (horizontalAlign === _univerjs_core.HorizontalAlign.DISTRIBUTED) {
|
|
15925
|
+
if (distributeGlyphsInDivide(divide, width - glyphGroupWidth)) {
|
|
15926
|
+
glyphGroupWidth = getGlyphGroupWidth(divide);
|
|
15927
|
+
divide.glyphGroupWidth = glyphGroupWidth;
|
|
15928
|
+
}
|
|
15929
|
+
divide.paddingLeft = 0;
|
|
15930
|
+
} else if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER && inkBounds) divide.paddingLeft = width / 2 - (inkBounds.left + inkBounds.right) / 2;
|
|
15437
15931
|
else if (horizontalAlign === _univerjs_core.HorizontalAlign.RIGHT && inkBounds) divide.paddingLeft = width - inkBounds.right;
|
|
15438
15932
|
else if (horizontalAlign === _univerjs_core.HorizontalAlign.CENTER) divide.paddingLeft = (width - glyphGroupWidth) / 2;
|
|
15439
15933
|
else if (horizontalAlign === _univerjs_core.HorizontalAlign.RIGHT) divide.paddingLeft = width - glyphGroupWidth;
|
|
@@ -15705,6 +16199,14 @@ function _isMarkedDocxColumnBreak(viewModel, absoluteIndex) {
|
|
|
15705
16199
|
function _glyphCount(glyphs) {
|
|
15706
16200
|
return glyphs.reduce((count, glyph) => count + glyph.count, 0);
|
|
15707
16201
|
}
|
|
16202
|
+
function _isDocxColumnBreakVisuallyBlankColumn(column) {
|
|
16203
|
+
return column.lines.every((line) => line.divides.every((divide) => divide.glyphGroup.every((glyph) => {
|
|
16204
|
+
const { glyphType, raw, streamType, width } = glyph;
|
|
16205
|
+
const isParagraphMark = raw === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH || streamType === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH;
|
|
16206
|
+
const isColumnBreak = width === 0 && (raw === _univerjs_core.DataStreamTreeTokenType.COLUMN_BREAK || streamType === _univerjs_core.DataStreamTreeTokenType.COLUMN_BREAK);
|
|
16207
|
+
return glyphType === 4 || glyphType === 2 || isParagraphMark || isColumnBreak;
|
|
16208
|
+
})));
|
|
16209
|
+
}
|
|
15708
16210
|
function _hasOnlyCustomBlockGlyphs(glyphs) {
|
|
15709
16211
|
return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK);
|
|
15710
16212
|
}
|
|
@@ -15761,7 +16263,9 @@ function _withMinSpacing(style, key, value) {
|
|
|
15761
16263
|
};
|
|
15762
16264
|
}
|
|
15763
16265
|
function _getNextAdjacentBlockRange(blockRanges, blockRange) {
|
|
15764
|
-
|
|
16266
|
+
let nextBlockRange;
|
|
16267
|
+
for (const range of blockRanges !== null && blockRanges !== void 0 ? blockRanges : []) if (range.startIndex > blockRange.endIndex && (!nextBlockRange || range.startIndex < nextBlockRange.startIndex)) nextBlockRange = range;
|
|
16268
|
+
return nextBlockRange;
|
|
15765
16269
|
}
|
|
15766
16270
|
function _hasNextAdjacentLayoutBlockRange(blockRanges, blockRange) {
|
|
15767
16271
|
const nextBlockRange = _getNextAdjacentBlockRange(blockRanges, blockRange);
|
|
@@ -15926,7 +16430,12 @@ function lineBreaking(ctx, viewModel, shapedTextList, curPage, paragraphNode, se
|
|
|
15926
16430
|
const lastPage = allPages[allPages.length - 1];
|
|
15927
16431
|
const columnInfo = getLastNotFullColumnInfo(lastPage);
|
|
15928
16432
|
if (columnInfo && !columnInfo.isLast) setColumnFullState(columnInfo.column, true);
|
|
15929
|
-
else
|
|
16433
|
+
else if (columnInfo && columnInfo.isLast && isTraditionalDocumentCompatibility(documentCompatibilityPolicy) && (isBlankColumn(columnInfo.column) || _isDocxColumnBreakVisuallyBlankColumn(columnInfo.column))) {} else if (isTraditionalDocumentCompatibility(documentCompatibilityPolicy)) {
|
|
16434
|
+
var _getLastSection;
|
|
16435
|
+
const lastColumn = (_getLastSection = getLastSection(lastPage)) === null || _getLastSection === void 0 ? void 0 : _getLastSection.columns.at(-1);
|
|
16436
|
+
if (lastColumn && (isBlankColumn(lastColumn) || _isDocxColumnBreakVisuallyBlankColumn(lastColumn))) setColumnFullState(lastColumn, false);
|
|
16437
|
+
else allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(lastPage), 2));
|
|
16438
|
+
} else allPages.push(createSkeletonPage(ctx, sectionBreakConfig, skeletonResourceReference, _getNextPageNumber(lastPage), 2));
|
|
15930
16439
|
shapedTextOffset += textGlyphCount;
|
|
15931
16440
|
continue;
|
|
15932
16441
|
}
|
|
@@ -16680,6 +17189,219 @@ function dealWidthParagraph(ctx, viewModel, paragraphNode, curPage, sectionBreak
|
|
|
16680
17189
|
return allPages;
|
|
16681
17190
|
}
|
|
16682
17191
|
|
|
17192
|
+
//#endregion
|
|
17193
|
+
//#region src/components/docs/layout/block/column.ts
|
|
17194
|
+
const EMPTY_COLUMN_GROUP_MIN_HEIGHT = 72;
|
|
17195
|
+
function createColumnGroupSkeleton(ctx, curPage, viewModel, columnGroupNode, sectionBreakConfig) {
|
|
17196
|
+
var _viewModel$getColumnG, _getLastNotFullColumn;
|
|
17197
|
+
const columnGroupSource = (_viewModel$getColumnG = viewModel.getColumnGroupByStartIndex(columnGroupNode.startIndex)) === null || _viewModel$getColumnG === void 0 ? void 0 : _viewModel$getColumnG.columnGroupSource;
|
|
17198
|
+
if (columnGroupSource == null) {
|
|
17199
|
+
console.warn("Column group not found when creating column group skeleton");
|
|
17200
|
+
return null;
|
|
17201
|
+
}
|
|
17202
|
+
const hostColumn = (_getLastNotFullColumn = getLastNotFullColumnInfo(curPage)) === null || _getLastNotFullColumn === void 0 ? void 0 : _getLastNotFullColumn.column;
|
|
17203
|
+
if (hostColumn == null) return null;
|
|
17204
|
+
const columnPages = columnGroupNode.children.map((columnNode, index) => {
|
|
17205
|
+
const sourceColumn = columnGroupSource.columns[index];
|
|
17206
|
+
return createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig, Math.max(0, getInitialColumnWidth(columnGroupSource, sourceColumn, hostColumn.width)));
|
|
17207
|
+
});
|
|
17208
|
+
const columnHeights = columnPages.map((page) => Math.max(page.height, EMPTY_COLUMN_GROUP_MIN_HEIGHT));
|
|
17209
|
+
const layout = calculateColumnGroupLayout(columnGroupSource, hostColumn.width, columnHeights);
|
|
17210
|
+
const columns = layout.columns.map((layoutColumn, index) => {
|
|
17211
|
+
const page = columnPages[index];
|
|
17212
|
+
page.pageHeight = columnHeights[index];
|
|
17213
|
+
return {
|
|
17214
|
+
columnId: layoutColumn.columnId,
|
|
17215
|
+
left: layoutColumn.left,
|
|
17216
|
+
top: layoutColumn.top,
|
|
17217
|
+
width: layoutColumn.width,
|
|
17218
|
+
height: columnHeights[index],
|
|
17219
|
+
st: columnGroupNode.children[index].startIndex,
|
|
17220
|
+
ed: columnGroupNode.children[index].endIndex,
|
|
17221
|
+
page
|
|
17222
|
+
};
|
|
17223
|
+
});
|
|
17224
|
+
const columnGroupSkeleton = {
|
|
17225
|
+
columns,
|
|
17226
|
+
width: layout.width,
|
|
17227
|
+
height: layout.height,
|
|
17228
|
+
top: getNextBlockTop(hostColumn.lines),
|
|
17229
|
+
left: hostColumn.left,
|
|
17230
|
+
st: columnGroupNode.startIndex,
|
|
17231
|
+
ed: columnGroupNode.endIndex,
|
|
17232
|
+
columnGroupId: columnGroupSource.columnGroupId,
|
|
17233
|
+
columnGroupSource
|
|
17234
|
+
};
|
|
17235
|
+
columns.forEach((column) => {
|
|
17236
|
+
column.parent = columnGroupSkeleton;
|
|
17237
|
+
column.page.parent = column;
|
|
17238
|
+
});
|
|
17239
|
+
return columnGroupSkeleton;
|
|
17240
|
+
}
|
|
17241
|
+
function appendColumnGroupBlockLine(page, columnGroup) {
|
|
17242
|
+
const columnInfo = getLastNotFullColumnInfo(page);
|
|
17243
|
+
if (columnInfo == null) return false;
|
|
17244
|
+
const { column } = columnInfo;
|
|
17245
|
+
const line = createColumnGroupBlockLine(columnGroup, column.lines.length);
|
|
17246
|
+
line.parent = column;
|
|
17247
|
+
column.lines.push(line);
|
|
17248
|
+
page.skeColumnGroups.set(columnGroup.columnGroupId, columnGroup);
|
|
17249
|
+
columnGroup.parent = page;
|
|
17250
|
+
return true;
|
|
17251
|
+
}
|
|
17252
|
+
function createColumnContentPage(ctx, viewModel, columnNode, sectionBreakConfig, width) {
|
|
17253
|
+
var _sectionBreakConfig$d, _ctx$dataModel, _ctx$dataModel$getBod;
|
|
17254
|
+
const columnSectionBreakConfig = {
|
|
17255
|
+
...sectionBreakConfig,
|
|
17256
|
+
pageSize: {
|
|
17257
|
+
width,
|
|
17258
|
+
height: Number.POSITIVE_INFINITY
|
|
17259
|
+
},
|
|
17260
|
+
marginTop: 0,
|
|
17261
|
+
marginBottom: 0,
|
|
17262
|
+
marginLeft: 0,
|
|
17263
|
+
marginRight: 0,
|
|
17264
|
+
columnProperties: []
|
|
17265
|
+
};
|
|
17266
|
+
const page = createSkeletonPage(ctx, columnSectionBreakConfig, ctx.skeletonResourceReference);
|
|
17267
|
+
page.type = 3;
|
|
17268
|
+
for (const paragraphNode of getColumnParagraphNodes(columnNode)) dealWidthParagraph(ctx, viewModel, paragraphNode, page, columnSectionBreakConfig);
|
|
17269
|
+
updateBlockIndex([page], columnNode.startIndex, (_sectionBreakConfig$d = sectionBreakConfig.documentCompatibilityPolicy) !== null && _sectionBreakConfig$d !== void 0 ? _sectionBreakConfig$d : getDocumentCompatibilityPolicy());
|
|
17270
|
+
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);
|
|
17271
|
+
return page;
|
|
17272
|
+
}
|
|
17273
|
+
function getColumnParagraphNodes(columnNode) {
|
|
17274
|
+
const firstChild = columnNode.children[0];
|
|
17275
|
+
if ((firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeType) === _univerjs_core.DataStreamTreeNodeType.SECTION_BREAK) return firstChild.children;
|
|
17276
|
+
return columnNode.children;
|
|
17277
|
+
}
|
|
17278
|
+
function createColumnGroupBlockLine(columnGroup, lineIndex) {
|
|
17279
|
+
const top = columnGroup.top;
|
|
17280
|
+
return {
|
|
17281
|
+
paragraphIndex: columnGroup.ed,
|
|
17282
|
+
type: 1,
|
|
17283
|
+
divides: [],
|
|
17284
|
+
divideLen: 0,
|
|
17285
|
+
lineHeight: columnGroup.height,
|
|
17286
|
+
contentHeight: columnGroup.height,
|
|
17287
|
+
top,
|
|
17288
|
+
asc: 0,
|
|
17289
|
+
dsc: 0,
|
|
17290
|
+
paddingTop: 0,
|
|
17291
|
+
paddingBottom: 0,
|
|
17292
|
+
marginTop: 0,
|
|
17293
|
+
marginBottom: 0,
|
|
17294
|
+
spaceBelowApply: 0,
|
|
17295
|
+
st: columnGroup.st,
|
|
17296
|
+
ed: columnGroup.ed,
|
|
17297
|
+
lineIndex,
|
|
17298
|
+
paragraphStart: true,
|
|
17299
|
+
isBehindTable: false,
|
|
17300
|
+
tableId: ""
|
|
17301
|
+
};
|
|
17302
|
+
}
|
|
17303
|
+
function getNextBlockTop(lines) {
|
|
17304
|
+
const lastLine = lines[lines.length - 1];
|
|
17305
|
+
if (lastLine == null) return 0;
|
|
17306
|
+
return lastLine.top + lastLine.lineHeight;
|
|
17307
|
+
}
|
|
17308
|
+
function calculateColumnGroupLayout(source, availableWidth, columnHeights) {
|
|
17309
|
+
var _source$gap$v, _source$gap;
|
|
17310
|
+
const width = Math.max(0, availableWidth);
|
|
17311
|
+
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);
|
|
17312
|
+
const columns = source.columns;
|
|
17313
|
+
if (columns.length === 0) return {
|
|
17314
|
+
mode: "horizontal",
|
|
17315
|
+
width,
|
|
17316
|
+
height: 0,
|
|
17317
|
+
columns: []
|
|
17318
|
+
};
|
|
17319
|
+
if (shouldStack(columns, width, gap, source.responsive)) {
|
|
17320
|
+
let top = 0;
|
|
17321
|
+
return {
|
|
17322
|
+
mode: "stack",
|
|
17323
|
+
width,
|
|
17324
|
+
height: sumHeights(columnHeights),
|
|
17325
|
+
columns: columns.map((column, index) => {
|
|
17326
|
+
var _columnHeights$index;
|
|
17327
|
+
const layoutColumn = {
|
|
17328
|
+
columnId: column.columnId,
|
|
17329
|
+
left: 0,
|
|
17330
|
+
top,
|
|
17331
|
+
width
|
|
17332
|
+
};
|
|
17333
|
+
top += Math.max(0, (_columnHeights$index = columnHeights[index]) !== null && _columnHeights$index !== void 0 ? _columnHeights$index : 0);
|
|
17334
|
+
return layoutColumn;
|
|
17335
|
+
})
|
|
17336
|
+
};
|
|
17337
|
+
}
|
|
17338
|
+
const widths = allocateHorizontalWidths(columns, Math.max(0, width - gap * (columns.length - 1)));
|
|
17339
|
+
let left = 0;
|
|
17340
|
+
return {
|
|
17341
|
+
mode: "horizontal",
|
|
17342
|
+
width,
|
|
17343
|
+
height: Math.max(0, ...columnHeights),
|
|
17344
|
+
columns: columns.map((column, index) => {
|
|
17345
|
+
const layoutColumn = {
|
|
17346
|
+
columnId: column.columnId,
|
|
17347
|
+
left,
|
|
17348
|
+
top: 0,
|
|
17349
|
+
width: widths[index]
|
|
17350
|
+
};
|
|
17351
|
+
left += widths[index] + gap;
|
|
17352
|
+
return layoutColumn;
|
|
17353
|
+
})
|
|
17354
|
+
};
|
|
17355
|
+
}
|
|
17356
|
+
function shouldStack(columns, availableWidth, gap, responsive) {
|
|
17357
|
+
if (responsive !== _univerjs_core.ColumnResponsiveType.STACK) return false;
|
|
17358
|
+
return columns.reduce((sum, column) => sum + getMinWidth(column), 0) + gap * Math.max(0, columns.length - 1) > availableWidth;
|
|
17359
|
+
}
|
|
17360
|
+
function getInitialColumnWidth(source, column, availableWidth) {
|
|
17361
|
+
var _source$gap$v2, _source$gap2;
|
|
17362
|
+
if (column == null) return availableWidth;
|
|
17363
|
+
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));
|
|
17364
|
+
const ratioSum = source.columns.reduce((sum, item) => sum + Math.max(0, item.widthRatio || 0), 0) || source.columns.length;
|
|
17365
|
+
return Math.max(getMinWidth(column), contentWidth * (Math.max(0, column.widthRatio || 0) || 1) / ratioSum);
|
|
17366
|
+
}
|
|
17367
|
+
function allocateHorizontalWidths(columns, contentWidth) {
|
|
17368
|
+
const ratioSum = columns.reduce((sum, column) => sum + Math.max(0, column.widthRatio || 0), 0) || columns.length;
|
|
17369
|
+
const idealWidths = columns.map((column) => contentWidth * (Math.max(0, column.widthRatio || 0) || 1) / ratioSum);
|
|
17370
|
+
const minWidths = columns.map(getMinWidth);
|
|
17371
|
+
const widths = idealWidths.map((width, index) => Math.max(width, minWidths[index]));
|
|
17372
|
+
const overflow = widths.reduce((sum, width) => sum + width, 0) - contentWidth;
|
|
17373
|
+
if (overflow <= 0) return widths;
|
|
17374
|
+
return compressToFit(widths, minWidths, overflow);
|
|
17375
|
+
}
|
|
17376
|
+
function compressToFit(widths, minWidths, overflow) {
|
|
17377
|
+
const nextWidths = [...widths];
|
|
17378
|
+
let remainingOverflow = overflow;
|
|
17379
|
+
let flexibleIndexes = getFlexibleIndexes(nextWidths, minWidths);
|
|
17380
|
+
while (remainingOverflow > 0 && flexibleIndexes.length > 0) {
|
|
17381
|
+
const totalShrink = flexibleIndexes.reduce((sum, item) => sum + item.shrink, 0);
|
|
17382
|
+
for (const item of flexibleIndexes) {
|
|
17383
|
+
const shrink = Math.min(item.shrink, remainingOverflow * item.shrink / totalShrink);
|
|
17384
|
+
nextWidths[item.index] -= shrink;
|
|
17385
|
+
remainingOverflow -= shrink;
|
|
17386
|
+
}
|
|
17387
|
+
flexibleIndexes = getFlexibleIndexes(nextWidths, minWidths);
|
|
17388
|
+
}
|
|
17389
|
+
return nextWidths;
|
|
17390
|
+
}
|
|
17391
|
+
function getFlexibleIndexes(widths, minWidths) {
|
|
17392
|
+
return widths.map((width, index) => ({
|
|
17393
|
+
index,
|
|
17394
|
+
shrink: Math.max(0, width - minWidths[index])
|
|
17395
|
+
})).filter((item) => item.shrink > 0);
|
|
17396
|
+
}
|
|
17397
|
+
function getMinWidth(column) {
|
|
17398
|
+
var _column$minWidth$v, _column$minWidth;
|
|
17399
|
+
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);
|
|
17400
|
+
}
|
|
17401
|
+
function sumHeights(heights) {
|
|
17402
|
+
return heights.reduce((sum, height) => sum + Math.max(0, height), 0);
|
|
17403
|
+
}
|
|
17404
|
+
|
|
16683
17405
|
//#endregion
|
|
16684
17406
|
//#region src/components/docs/layout/block/section.ts
|
|
16685
17407
|
function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfig, layoutAnchor) {
|
|
@@ -16704,6 +17426,10 @@ function dealWithSection(ctx, viewModel, sectionNode, curPage, sectionBreakConfi
|
|
|
16704
17426
|
if (ctx.paragraphsOpenNewPage.has(paragraphNode.endIndex)) currentPageCache = createSkeletonPage(ctx, sectionBreakConfig, ctx.skeletonResourceReference, currentPageCache.pageNumber + 1);
|
|
16705
17427
|
skeletonPages = dealWidthParagraph(ctx, viewModel, paragraphNode, currentPageCache, sectionBreakConfig);
|
|
16706
17428
|
}
|
|
17429
|
+
if (paragraphNode.nodeType === _univerjs_core.DataStreamTreeNodeType.COLUMN_GROUP) {
|
|
17430
|
+
const columnGroupSkeleton = createColumnGroupSkeleton(ctx, currentPageCache, viewModel, paragraphNode, sectionBreakConfig);
|
|
17431
|
+
if (columnGroupSkeleton && appendColumnGroupBlockLine(currentPageCache, columnGroupSkeleton)) skeletonPages = [currentPageCache];
|
|
17432
|
+
}
|
|
16707
17433
|
if (skeletonPages.length === 0) skeletonPages = dealWithBlockError();
|
|
16708
17434
|
_pushPage(allCurrentSkeletonPages, skeletonPages);
|
|
16709
17435
|
if (ctx.isDirty) break;
|
|
@@ -17086,11 +17812,49 @@ function removeDupPages(ctx) {
|
|
|
17086
17812
|
return !hasPage;
|
|
17087
17813
|
});
|
|
17088
17814
|
}
|
|
17815
|
+
function mergeContinuousDuplicatePages(pages) {
|
|
17816
|
+
for (let index = 1; index < pages.length;) {
|
|
17817
|
+
var _page$skeDrawings, _page$skeTables;
|
|
17818
|
+
const previousPage = pages[index - 1];
|
|
17819
|
+
const page = pages[index];
|
|
17820
|
+
if (previousPage.pageNumber !== page.pageNumber) {
|
|
17821
|
+
index++;
|
|
17822
|
+
continue;
|
|
17823
|
+
}
|
|
17824
|
+
const topOffset = previousPage.height;
|
|
17825
|
+
for (const section of page.sections) {
|
|
17826
|
+
section.top += topOffset;
|
|
17827
|
+
section.parent = previousPage;
|
|
17828
|
+
previousPage.sections.push(section);
|
|
17829
|
+
}
|
|
17830
|
+
(_page$skeDrawings = page.skeDrawings) === null || _page$skeDrawings === void 0 || _page$skeDrawings.forEach((drawing, drawingId) => {
|
|
17831
|
+
drawing.aTop += topOffset;
|
|
17832
|
+
previousPage.skeDrawings.set(drawingId, drawing);
|
|
17833
|
+
});
|
|
17834
|
+
(_page$skeTables = page.skeTables) === null || _page$skeTables === void 0 || _page$skeTables.forEach((table, tableId) => {
|
|
17835
|
+
table.top += topOffset;
|
|
17836
|
+
table.parent = previousPage;
|
|
17837
|
+
previousPage.skeTables.set(tableId, table);
|
|
17838
|
+
});
|
|
17839
|
+
previousPage.height += page.height;
|
|
17840
|
+
previousPage.width = Math.max(previousPage.width, page.width);
|
|
17841
|
+
previousPage.ed = Math.max(previousPage.ed, page.ed);
|
|
17842
|
+
pages.splice(index, 1);
|
|
17843
|
+
}
|
|
17844
|
+
}
|
|
17089
17845
|
function getPagePath(page) {
|
|
17090
17846
|
const path = [];
|
|
17091
17847
|
let skeNode = page;
|
|
17092
17848
|
let parent = skeNode.parent;
|
|
17093
17849
|
while (parent) {
|
|
17850
|
+
var _parent$parent;
|
|
17851
|
+
if (parent.page === skeNode && ((_parent$parent = parent.parent) === null || _parent$parent === void 0 ? void 0 : _parent$parent.columns)) {
|
|
17852
|
+
const index = parent.parent.columns.indexOf(parent);
|
|
17853
|
+
if (index !== -1) path.unshift("columns", index, "page");
|
|
17854
|
+
skeNode = parent.parent;
|
|
17855
|
+
parent = skeNode === null || skeNode === void 0 ? void 0 : skeNode.parent;
|
|
17856
|
+
continue;
|
|
17857
|
+
}
|
|
17094
17858
|
if (parent.pages) {
|
|
17095
17859
|
const index = parent.pages.indexOf(skeNode);
|
|
17096
17860
|
if (index !== -1) path.unshift("pages", index);
|
|
@@ -17101,11 +17865,73 @@ function getPagePath(page) {
|
|
|
17101
17865
|
const index = parent.rows.indexOf(skeNode);
|
|
17102
17866
|
if (index !== -1) path.unshift("rows", index);
|
|
17103
17867
|
} else if (parent.skeTables && parent.skeTables.has(skeNode.tableId)) path.unshift("skeTables", skeNode.tableId);
|
|
17868
|
+
else if (parent.skeColumnGroups && parent.skeColumnGroups.has(skeNode.columnGroupId)) path.unshift("skeColumnGroups", skeNode.columnGroupId);
|
|
17104
17869
|
skeNode = parent;
|
|
17105
17870
|
parent = parent === null || parent === void 0 ? void 0 : parent.parent;
|
|
17106
17871
|
}
|
|
17107
17872
|
return path;
|
|
17108
17873
|
}
|
|
17874
|
+
function getBoundaryGlyphInPage(page, useLast) {
|
|
17875
|
+
const sections = useLast ? [...page.sections].reverse() : page.sections;
|
|
17876
|
+
for (const section of sections) {
|
|
17877
|
+
const columns = useLast ? [...section.columns].reverse() : section.columns;
|
|
17878
|
+
for (const column of columns) {
|
|
17879
|
+
const lines = useLast ? [...column.lines].reverse() : column.lines;
|
|
17880
|
+
for (const line of lines) {
|
|
17881
|
+
const divides = useLast ? [...line.divides].reverse() : line.divides;
|
|
17882
|
+
for (const divide of divides) {
|
|
17883
|
+
const glyph = (useLast ? [...divide.glyphGroup].reverse() : divide.glyphGroup).find((item) => {
|
|
17884
|
+
var _item$content;
|
|
17885
|
+
return (_item$content = item.content) === null || _item$content === void 0 ? void 0 : _item$content.length;
|
|
17886
|
+
});
|
|
17887
|
+
if (glyph) return {
|
|
17888
|
+
section,
|
|
17889
|
+
column,
|
|
17890
|
+
line,
|
|
17891
|
+
divide,
|
|
17892
|
+
glyph
|
|
17893
|
+
};
|
|
17894
|
+
}
|
|
17895
|
+
}
|
|
17896
|
+
}
|
|
17897
|
+
}
|
|
17898
|
+
}
|
|
17899
|
+
function isHitTestAddressableGlyph(glyph) {
|
|
17900
|
+
var _glyph$content;
|
|
17901
|
+
return Boolean((_glyph$content = glyph.content) === null || _glyph$content === void 0 ? void 0 : _glyph$content.length) || glyph.streamType === _univerjs_core.DataStreamTreeTokenType.PARAGRAPH && glyph.count > 0;
|
|
17902
|
+
}
|
|
17903
|
+
function resolveMostSpecificPageByCharIndex(page, charIndex) {
|
|
17904
|
+
var _page$skeTables$value, _page$skeTables2, _page$skeColumnGroups, _page$skeColumnGroups2;
|
|
17905
|
+
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) {
|
|
17906
|
+
const { st, ed } = cell;
|
|
17907
|
+
if (charIndex >= st && charIndex <= ed) return resolveMostSpecificPageByCharIndex(cell, charIndex);
|
|
17908
|
+
}
|
|
17909
|
+
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) {
|
|
17910
|
+
const { st, ed } = column;
|
|
17911
|
+
if (charIndex >= st && charIndex <= ed) return resolveMostSpecificPageByCharIndex(column.page, charIndex);
|
|
17912
|
+
}
|
|
17913
|
+
return page;
|
|
17914
|
+
}
|
|
17915
|
+
function getSegmentPageFromRelativePath(skeletonData, segmentPageIndex, path) {
|
|
17916
|
+
var _skeletonData$skeHead, _skeletonData$skeFoot;
|
|
17917
|
+
const rootPage = skeletonData.pages[segmentPageIndex];
|
|
17918
|
+
if (rootPage == null) return null;
|
|
17919
|
+
const { headerId, footerId, pageWidth } = rootPage;
|
|
17920
|
+
const segmentPages = [headerId == null ? null : (_skeletonData$skeHead = skeletonData.skeHeaders.get(headerId)) === null || _skeletonData$skeHead === void 0 ? void 0 : _skeletonData$skeHead.get(pageWidth), footerId == null ? null : (_skeletonData$skeFoot = skeletonData.skeFooters.get(footerId)) === null || _skeletonData$skeFoot === void 0 ? void 0 : _skeletonData$skeFoot.get(pageWidth)];
|
|
17921
|
+
for (const segmentPage of segmentPages) {
|
|
17922
|
+
if (segmentPage == null) continue;
|
|
17923
|
+
const page = getPageFromPath({
|
|
17924
|
+
...skeletonData,
|
|
17925
|
+
pages: [segmentPage]
|
|
17926
|
+
}, [
|
|
17927
|
+
"pages",
|
|
17928
|
+
0,
|
|
17929
|
+
...path
|
|
17930
|
+
]);
|
|
17931
|
+
if (page != null) return page;
|
|
17932
|
+
}
|
|
17933
|
+
return null;
|
|
17934
|
+
}
|
|
17109
17935
|
var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
17110
17936
|
constructor(_docViewModel, localeService) {
|
|
17111
17937
|
super(localeService);
|
|
@@ -17200,7 +18026,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17200
18026
|
pageIndex = skeletonData.pages.indexOf(page);
|
|
17201
18027
|
break;
|
|
17202
18028
|
case 3:
|
|
17203
|
-
pageIndex = path[1];
|
|
18029
|
+
pageIndex = typeof path[1] === "number" ? path[1] : segmentPage;
|
|
17204
18030
|
break;
|
|
17205
18031
|
default: throw new Error("Invalid page type");
|
|
17206
18032
|
}
|
|
@@ -17246,7 +18072,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17246
18072
|
pageIndex = pages.indexOf(page);
|
|
17247
18073
|
break;
|
|
17248
18074
|
case 3:
|
|
17249
|
-
pageIndex = path[1];
|
|
18075
|
+
pageIndex = typeof path[1] === "number" ? path[1] : segmentPageIndex;
|
|
17250
18076
|
break;
|
|
17251
18077
|
default: throw new Error("Invalid page type");
|
|
17252
18078
|
}
|
|
@@ -17289,7 +18115,8 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17289
18115
|
if (skeFooter == null) return;
|
|
17290
18116
|
else skePage = skeFooter;
|
|
17291
18117
|
}
|
|
17292
|
-
} else skePage =
|
|
18118
|
+
} else if (pageType === 3 && path[0] !== "pages") skePage = getSegmentPageFromRelativePath(skeletonData, segmentPage, path);
|
|
18119
|
+
else skePage = getPageFromPath(skeletonData, path);
|
|
17293
18120
|
if (skePage == null) return;
|
|
17294
18121
|
const glyphGroup = skePage.sections[section].columns[column].lines[line].divides[divide].glyphGroup;
|
|
17295
18122
|
glyph = Math.min(glyph, glyphGroup.length - 1);
|
|
@@ -17405,7 +18232,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17405
18232
|
return this._getNearestNode(cache.nearestNodeList, cache.nearestNodeDistanceList);
|
|
17406
18233
|
}
|
|
17407
18234
|
_collectNearestNode(segmentPage, pageType, page, segmentId, pi, cache, x, y, pageLength, nestLevel = 0) {
|
|
17408
|
-
const { sections, skeTables } = segmentPage;
|
|
18235
|
+
const { sections, skeTables, skeColumnGroups = /* @__PURE__ */ new Map() } = segmentPage;
|
|
17409
18236
|
this._findLiquid.translateSave();
|
|
17410
18237
|
const pageLeft = this._findLiquid.x;
|
|
17411
18238
|
const pageRight = pageLeft + page.pageWidth;
|
|
@@ -17466,7 +18293,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17466
18293
|
this._findLiquid.translateDivide(divide);
|
|
17467
18294
|
const { x: startX } = this._findLiquid;
|
|
17468
18295
|
for (const glyph of glyphGroup) {
|
|
17469
|
-
if (!glyph
|
|
18296
|
+
if (!isHitTestAddressableGlyph(glyph)) continue;
|
|
17470
18297
|
const { width: glyphWidth, left: glyphLeft } = glyph;
|
|
17471
18298
|
const startX_fin = startX + glyphLeft;
|
|
17472
18299
|
const endX_fin = startX + glyphLeft + glyphWidth;
|
|
@@ -17569,6 +18396,30 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17569
18396
|
(_this$_findLiquid11 = this._findLiquid) === null || _this$_findLiquid11 === void 0 || _this$_findLiquid11.translateRestore();
|
|
17570
18397
|
}
|
|
17571
18398
|
}
|
|
18399
|
+
if (skeColumnGroups.size > 0) for (const columnGroup of skeColumnGroups.values()) {
|
|
18400
|
+
var _this$_findLiquid12, _this$_findLiquid13, _this$_findLiquid17;
|
|
18401
|
+
const { top: columnGroupTop, left: columnGroupLeft, width: columnGroupWidth, height: columnGroupHeight, columns } = columnGroup;
|
|
18402
|
+
const absoluteColumnGroupLeft = this._findLiquid.x + columnGroupLeft;
|
|
18403
|
+
const absoluteColumnGroupTop = this._findLiquid.y + columnGroupTop;
|
|
18404
|
+
if (x < absoluteColumnGroupLeft || x > absoluteColumnGroupLeft + columnGroupWidth || y < absoluteColumnGroupTop || y > absoluteColumnGroupTop + columnGroupHeight) continue;
|
|
18405
|
+
(_this$_findLiquid12 = this._findLiquid) === null || _this$_findLiquid12 === void 0 || _this$_findLiquid12.translateSave();
|
|
18406
|
+
(_this$_findLiquid13 = this._findLiquid) === null || _this$_findLiquid13 === void 0 || _this$_findLiquid13.translate(columnGroupLeft, columnGroupTop);
|
|
18407
|
+
for (const column of columns) {
|
|
18408
|
+
var _this$_findLiquid14, _this$_findLiquid15, _ref, _exactMatch4, _this$_findLiquid16;
|
|
18409
|
+
const absoluteColumnLeft = absoluteColumnGroupLeft + column.left;
|
|
18410
|
+
const absoluteColumnTop = absoluteColumnGroupTop + column.top;
|
|
18411
|
+
if (x < absoluteColumnLeft || x > absoluteColumnLeft + column.width || y < absoluteColumnTop || y > absoluteColumnTop + column.height) continue;
|
|
18412
|
+
const nestedCache = {
|
|
18413
|
+
nearestNodeList: [],
|
|
18414
|
+
nearestNodeDistanceList: []
|
|
18415
|
+
};
|
|
18416
|
+
(_this$_findLiquid14 = this._findLiquid) === null || _this$_findLiquid14 === void 0 || _this$_findLiquid14.translateSave();
|
|
18417
|
+
(_this$_findLiquid15 = this._findLiquid) === null || _this$_findLiquid15 === void 0 || _this$_findLiquid15.translate(column.left, column.top);
|
|
18418
|
+
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);
|
|
18419
|
+
(_this$_findLiquid16 = this._findLiquid) === null || _this$_findLiquid16 === void 0 || _this$_findLiquid16.translateRestore();
|
|
18420
|
+
}
|
|
18421
|
+
(_this$_findLiquid17 = this._findLiquid) === null || _this$_findLiquid17 === void 0 || _this$_findLiquid17.translateRestore();
|
|
18422
|
+
}
|
|
17572
18423
|
if (exactMatch) {
|
|
17573
18424
|
this._findLiquid.translateRestore();
|
|
17574
18425
|
return exactMatch;
|
|
@@ -17713,7 +18564,7 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17713
18564
|
let isContinuous = false;
|
|
17714
18565
|
ctx.sectionBreakConfigCache.set(sectionNode.endIndex, sectionBreakConfig);
|
|
17715
18566
|
if (sectionType === _univerjs_core.SectionType.CONTINUOUS && curSkeletonPage != null) {
|
|
17716
|
-
updateBlockIndex(allSkeletonPages);
|
|
18567
|
+
updateBlockIndex(allSkeletonPages, -1, ctx.docsConfig.documentCompatibilityPolicy);
|
|
17717
18568
|
this._addNewSectionByContinuous(curSkeletonPage, columnProperties, columnSeparatorType);
|
|
17718
18569
|
isContinuous = true;
|
|
17719
18570
|
} else if (layoutAnchor == null || curSkeletonPage == null) {
|
|
@@ -17722,7 +18573,10 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17722
18573
|
}
|
|
17723
18574
|
const { pages } = dealWithSection(ctx, viewModel, sectionNode, curSkeletonPage, sectionBreakConfig, layoutAnchor);
|
|
17724
18575
|
if (sectionTypeNext === _univerjs_core.SectionType.CONTINUOUS && columnProperties.length > 0) {}
|
|
17725
|
-
if (isContinuous)
|
|
18576
|
+
if (isContinuous) {
|
|
18577
|
+
const continuousFirstPage = pages.shift();
|
|
18578
|
+
if (continuousFirstPage && allSkeletonPages.length > 0) allSkeletonPages[allSkeletonPages.length - 1] = continuousFirstPage;
|
|
18579
|
+
}
|
|
17726
18580
|
allSkeletonPages.push(...pages);
|
|
17727
18581
|
if (ctx.isDirty) break;
|
|
17728
18582
|
}
|
|
@@ -17733,7 +18587,8 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17733
18587
|
} else {
|
|
17734
18588
|
this._iteratorCount = 0;
|
|
17735
18589
|
removeDupPages(ctx);
|
|
17736
|
-
updateBlockIndex(skeleton.pages);
|
|
18590
|
+
updateBlockIndex(skeleton.pages, -1, ctx.docsConfig.documentCompatibilityPolicy);
|
|
18591
|
+
mergeContinuousDuplicatePages(skeleton.pages);
|
|
17737
18592
|
updateInlineDrawingCoordsAndBorder(ctx, skeleton.pages);
|
|
17738
18593
|
for (const hSkeMap of skeleton.skeHeaders.values()) for (const page of hSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
17739
18594
|
for (const fSkeMap of skeleton.skeFooters.values()) for (const page of fSkeMap.values()) updateInlineDrawingCoordsAndBorder(ctx, [page]);
|
|
@@ -17757,9 +18612,10 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17757
18612
|
if (skeletonData == null) return;
|
|
17758
18613
|
const { pages, skeFooters, skeHeaders } = skeletonData;
|
|
17759
18614
|
for (const page of pages) {
|
|
18615
|
+
var _segmentPageParent$pa;
|
|
17760
18616
|
const curPageIndex = pages.indexOf(page);
|
|
17761
18617
|
if (segmentId && curPageIndex !== segmentPageIndex) continue;
|
|
17762
|
-
const { pageWidth
|
|
18618
|
+
const { pageWidth } = page;
|
|
17763
18619
|
let segmentPage = page;
|
|
17764
18620
|
if (segmentId) {
|
|
17765
18621
|
var _skeHeaders$get5, _skeFooters$get5;
|
|
@@ -17768,28 +18624,23 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17768
18624
|
if (maybeHeaderSke) segmentPage = maybeHeaderSke;
|
|
17769
18625
|
else if (maybeFooterSke) segmentPage = maybeFooterSke;
|
|
17770
18626
|
else continue;
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
}
|
|
17786
|
-
if (foundCell) break;
|
|
17787
|
-
}
|
|
17788
|
-
if (foundCell) break;
|
|
18627
|
+
segmentPage = resolveMostSpecificPageByCharIndex(segmentPage, charIndex);
|
|
18628
|
+
} else segmentPage = resolveMostSpecificPageByCharIndex(page, charIndex);
|
|
18629
|
+
const { sections, st, ed } = segmentPage;
|
|
18630
|
+
const segmentPageParent = segmentPage.parent;
|
|
18631
|
+
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);
|
|
18632
|
+
if (charIndex < st || charIndex > ed) {
|
|
18633
|
+
if (isColumnSegmentPage) {
|
|
18634
|
+
const boundary = getBoundaryGlyphInPage(segmentPage, charIndex >= ed);
|
|
18635
|
+
if (boundary) return {
|
|
18636
|
+
page: segmentPage,
|
|
18637
|
+
pageType: segmentPage.type,
|
|
18638
|
+
segmentPageIndex,
|
|
18639
|
+
...boundary
|
|
18640
|
+
};
|
|
17789
18641
|
}
|
|
18642
|
+
continue;
|
|
17790
18643
|
}
|
|
17791
|
-
const { sections, st, ed } = segmentPage;
|
|
17792
|
-
if (charIndex < st || charIndex > ed) continue;
|
|
17793
18644
|
for (const section of sections) {
|
|
17794
18645
|
const { columns, st, ed } = section;
|
|
17795
18646
|
if (charIndex < st || charIndex > ed) continue;
|
|
@@ -17822,6 +18673,15 @@ var DocumentSkeleton = class DocumentSkeleton extends _univerjs_core.Skeleton {
|
|
|
17822
18673
|
}
|
|
17823
18674
|
}
|
|
17824
18675
|
}
|
|
18676
|
+
if (isColumnSegmentPage) {
|
|
18677
|
+
const boundary = getBoundaryGlyphInPage(segmentPage, charIndex >= segmentPage.ed);
|
|
18678
|
+
if (boundary) return {
|
|
18679
|
+
page: segmentPage,
|
|
18680
|
+
pageType: segmentPage.type,
|
|
18681
|
+
segmentPageIndex,
|
|
18682
|
+
...boundary
|
|
18683
|
+
};
|
|
18684
|
+
}
|
|
17825
18685
|
}
|
|
17826
18686
|
}
|
|
17827
18687
|
};
|
|
@@ -22594,7 +23454,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
22594
23454
|
for (let i = 0, len = pages.length; i < len; i++) {
|
|
22595
23455
|
var _skeHeaders$get, _headerSkeletonPage$m, _skeFooters$get;
|
|
22596
23456
|
const page = pages[i];
|
|
22597
|
-
const { sections, marginTop: pagePaddingTop = 0, marginBottom: pagePaddingBottom = 0, marginLeft: pagePaddingLeft = 0, marginRight: pagePaddingRight = 0, width: actualWidth, height: actualHeight, pageWidth, headerId, footerId, renderConfig = {}, skeTables } = page;
|
|
23457
|
+
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;
|
|
22598
23458
|
const { verticalAlign = _univerjs_core.VerticalAlign.TOP, horizontalAlign = _univerjs_core.HorizontalAlign.LEFT, centerAngle: centerAngleDeg = 0, vertexAngle: vertexAngleDeg = 0, wrapStrategy = _univerjs_core.WrapStrategy.UNSPECIFIED, cellValueType } = renderConfig;
|
|
22599
23459
|
const isVertical = vertexAngleDeg === 90 && centerAngleDeg === 90;
|
|
22600
23460
|
const horizontalOffsetNoAngle = this._horizontalHandler(actualWidth, pagePaddingLeft, pagePaddingRight, horizontalAlign, vertexAngleDeg, centerAngleDeg, cellValueType);
|
|
@@ -22694,6 +23554,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
22694
23554
|
this._drawLiquid.translateRestore();
|
|
22695
23555
|
}
|
|
22696
23556
|
}
|
|
23557
|
+
if (skeColumnGroups.size > 0) this._drawColumnGroups(ctx, page, skeColumnGroups, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
22697
23558
|
this._resetRotation(ctx, finalAngle);
|
|
22698
23559
|
const footerSkeletonPage = (_skeFooters$get = skeFooters.get(footerId)) === null || _skeFooters$get === void 0 ? void 0 : _skeFooters$get.get(pageWidth);
|
|
22699
23560
|
if (footerSkeletonPage) {
|
|
@@ -22751,6 +23612,21 @@ var Documents = class Documents extends DocComponent {
|
|
|
22751
23612
|
drawLiquid.translateRestore();
|
|
22752
23613
|
}
|
|
22753
23614
|
}
|
|
23615
|
+
_drawColumnGroups(ctx, page, skeColumnGroups, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale) {
|
|
23616
|
+
const drawLiquid = this._drawLiquid;
|
|
23617
|
+
if (drawLiquid == null) return;
|
|
23618
|
+
for (const columnGroup of skeColumnGroups.values()) {
|
|
23619
|
+
drawLiquid.translateSave();
|
|
23620
|
+
drawLiquid.translate(columnGroup.left, columnGroup.top);
|
|
23621
|
+
for (const column of columnGroup.columns) {
|
|
23622
|
+
drawLiquid.translateSave();
|
|
23623
|
+
drawLiquid.translate(column.left, column.top);
|
|
23624
|
+
this._drawNestedPageContent(ctx, page, column.page, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23625
|
+
drawLiquid.translateRestore();
|
|
23626
|
+
}
|
|
23627
|
+
drawLiquid.translateRestore();
|
|
23628
|
+
}
|
|
23629
|
+
}
|
|
22754
23630
|
_drawTableCellBackgrounds(ctx, page, tableSkeleton) {
|
|
22755
23631
|
if (this._drawLiquid == null) return;
|
|
22756
23632
|
const backgrounds = /* @__PURE__ */ new Map();
|
|
@@ -22859,15 +23735,33 @@ var Documents = class Documents extends DocComponent {
|
|
|
22859
23735
|
_drawTableCell(ctx, page, cell, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale) {
|
|
22860
23736
|
if (this._drawLiquid == null) return;
|
|
22861
23737
|
this._drawTableCellBordersAndBg(ctx, page, cell, false);
|
|
22862
|
-
|
|
22863
|
-
|
|
23738
|
+
this._drawNestedPageContent(ctx, page, cell, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23739
|
+
}
|
|
23740
|
+
_drawNestedPageContent(ctx, parentPage, nestedPage, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale) {
|
|
23741
|
+
if (this._drawLiquid == null) return;
|
|
23742
|
+
const { sections, marginLeft, marginTop, skeTables } = nestedPage;
|
|
23743
|
+
const alignOffset = Vector2.create(alignOffsetNoAngle.x + marginLeft, alignOffsetNoAngle.y + marginTop);
|
|
22864
23744
|
ctx.save();
|
|
22865
23745
|
const { x, y } = this._drawLiquid;
|
|
22866
|
-
const { pageWidth, pageHeight } =
|
|
23746
|
+
const { pageWidth, pageHeight } = nestedPage;
|
|
23747
|
+
const clipOrigin = getNestedPageClipOrigin(parentPage, nestedPage, {
|
|
23748
|
+
x,
|
|
23749
|
+
y
|
|
23750
|
+
}, alignOffset);
|
|
22867
23751
|
ctx.beginPath();
|
|
22868
|
-
ctx.rectByPrecision(x
|
|
23752
|
+
ctx.rectByPrecision(clipOrigin.x, clipOrigin.y, pageWidth, pageHeight);
|
|
22869
23753
|
ctx.closePath();
|
|
22870
23754
|
ctx.clip();
|
|
23755
|
+
if (skeTables.size > 0) if (isColumnGroupNestedPage(nestedPage)) {
|
|
23756
|
+
this._drawLiquid.translateSave();
|
|
23757
|
+
this._drawLiquid.translate(alignOffset.x, alignOffset.y);
|
|
23758
|
+
this._drawTable(ctx, {
|
|
23759
|
+
...nestedPage,
|
|
23760
|
+
marginLeft: 0,
|
|
23761
|
+
marginTop: 0
|
|
23762
|
+
}, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, Vector2.create(0, 0), centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23763
|
+
this._drawLiquid.translateRestore();
|
|
23764
|
+
} else this._drawTable(ctx, nestedPage, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffset, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
22871
23765
|
for (const section of sections) {
|
|
22872
23766
|
const { columns } = section;
|
|
22873
23767
|
this._drawLiquid.translateSave();
|
|
@@ -22877,7 +23771,6 @@ var Documents = class Documents extends DocComponent {
|
|
|
22877
23771
|
this._drawLiquid.translateSave();
|
|
22878
23772
|
this._drawLiquid.translateColumn(column);
|
|
22879
23773
|
const linesCount = lines.length;
|
|
22880
|
-
const alignOffset = alignOffsetNoAngle;
|
|
22881
23774
|
for (let i = 0; i < linesCount; i++) {
|
|
22882
23775
|
const line = lines[i];
|
|
22883
23776
|
const { divides, asc = 0, type, lineHeight = 0 } = line;
|
|
@@ -22895,7 +23788,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
22895
23788
|
} else {
|
|
22896
23789
|
this._drawLiquid.translateSave();
|
|
22897
23790
|
this._drawLiquid.translateLine(line, true, true);
|
|
22898
|
-
this._drawLineBackground(ctx,
|
|
23791
|
+
this._drawLineBackground(ctx, nestedPage, line);
|
|
22899
23792
|
const divideLength = divides.length;
|
|
22900
23793
|
for (let i = 0; i < divideLength; i++) {
|
|
22901
23794
|
const divide = divides[i];
|
|
@@ -22924,7 +23817,7 @@ var Documents = class Documents extends DocComponent {
|
|
|
22924
23817
|
}
|
|
22925
23818
|
this._drawLiquid.translateRestore();
|
|
22926
23819
|
}
|
|
22927
|
-
if (line.borderBottom) this._drawBorderBottom(ctx,
|
|
23820
|
+
if (line.borderBottom) this._drawBorderBottom(ctx, nestedPage, line, parentPage.marginLeft, parentPage.marginTop);
|
|
22928
23821
|
this._drawLiquid.translateRestore();
|
|
22929
23822
|
}
|
|
22930
23823
|
}
|
|
@@ -23003,7 +23896,15 @@ var Documents = class Documents extends DocComponent {
|
|
|
23003
23896
|
if (this._drawLiquid == null) return;
|
|
23004
23897
|
const { sections, skeTables } = page;
|
|
23005
23898
|
const { y: originY } = this._drawLiquid;
|
|
23006
|
-
if (skeTables.size > 0)
|
|
23899
|
+
if (skeTables.size > 0) {
|
|
23900
|
+
const tablePage = {
|
|
23901
|
+
...page,
|
|
23902
|
+
marginLeft: parentPage.marginLeft,
|
|
23903
|
+
marginRight: parentPage.marginRight,
|
|
23904
|
+
marginTop: isHeader ? page.marginTop : page.marginTop + alignOffsetNoAngle.y
|
|
23905
|
+
};
|
|
23906
|
+
this._drawTable(ctx, tablePage, skeTables, extensions, backgroundExtension, glyphExtensionsExcludeBackground, alignOffsetNoAngle, centerAngle, vertexAngle, renderConfig, parentScale);
|
|
23907
|
+
}
|
|
23007
23908
|
for (const section of sections) {
|
|
23008
23909
|
const { columns } = section;
|
|
23009
23910
|
this._drawLiquid.translateSave();
|
|
@@ -23127,6 +24028,21 @@ function setTableCellBorderDash(ctx, dashStyle) {
|
|
|
23127
24028
|
}
|
|
23128
24029
|
ctx.setLineDash([0]);
|
|
23129
24030
|
}
|
|
24031
|
+
function isColumnGroupNestedPage(page) {
|
|
24032
|
+
var _parent$parent;
|
|
24033
|
+
const parent = page.parent;
|
|
24034
|
+
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;
|
|
24035
|
+
}
|
|
24036
|
+
function getNestedPageClipOrigin(parentPage, nestedPage, drawOrigin, alignOffset) {
|
|
24037
|
+
if (isColumnGroupNestedPage(nestedPage)) return {
|
|
24038
|
+
x: drawOrigin.x + alignOffset.x,
|
|
24039
|
+
y: drawOrigin.y + alignOffset.y
|
|
24040
|
+
};
|
|
24041
|
+
return {
|
|
24042
|
+
x: drawOrigin.x + parentPage.marginLeft,
|
|
24043
|
+
y: drawOrigin.y + parentPage.marginTop
|
|
24044
|
+
};
|
|
24045
|
+
}
|
|
23130
24046
|
function fillRectByPrecisionBounds(ctx, x, y, width, height) {
|
|
23131
24047
|
const { scaleX, scaleY } = ctx.getScale();
|
|
23132
24048
|
const startX = fixLineWidthByScale(x, scaleX);
|
|
@@ -25709,7 +26625,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
|
|
|
25709
26625
|
//#endregion
|
|
25710
26626
|
//#region package.json
|
|
25711
26627
|
var name = "@univerjs/engine-render";
|
|
25712
|
-
var version = "1.0.0-alpha.
|
|
26628
|
+
var version = "1.0.0-alpha.2";
|
|
25713
26629
|
|
|
25714
26630
|
//#endregion
|
|
25715
26631
|
//#region src/config/config.ts
|
|
@@ -30165,12 +31081,15 @@ exports.cancelRequestFrame = cancelRequestFrame;
|
|
|
30165
31081
|
exports.checkStyle = checkStyle;
|
|
30166
31082
|
exports.clampRange = clampRange;
|
|
30167
31083
|
exports.clearLineByBorderType = clearLineByBorderType;
|
|
31084
|
+
exports.compareDocumentSkeletonNestedPagePathOrder = compareDocumentSkeletonNestedPagePathOrder;
|
|
30168
31085
|
exports.convertTextRotation = convertTextRotation;
|
|
30169
31086
|
exports.convertTransformToOffsetX = convertTransformToOffsetX;
|
|
30170
31087
|
exports.convertTransformToOffsetY = convertTransformToOffsetY;
|
|
30171
31088
|
exports.createCanvasElement = createCanvasElement;
|
|
30172
31089
|
exports.createImageElement = createImageElement;
|
|
30173
31090
|
exports.degToRad = degToRad;
|
|
31091
|
+
exports.documentSkeletonLineIterator = documentSkeletonLineIterator;
|
|
31092
|
+
exports.documentSkeletonTableIterator = documentSkeletonTableIterator;
|
|
30174
31093
|
exports.drawDiagonalLineByBorderType = drawDiagonalLineByBorderType;
|
|
30175
31094
|
exports.drawLineByBorderType = drawLineByBorderType;
|
|
30176
31095
|
exports.expandRangeIfIntersects = expandRangeIfIntersects;
|
|
@@ -30186,6 +31105,8 @@ exports.getDPI = getDPI;
|
|
|
30186
31105
|
exports.getDevicePixelRatio = getDevicePixelRatio;
|
|
30187
31106
|
exports.getDocsSkeletonPageSize = getDocsSkeletonPageSize;
|
|
30188
31107
|
exports.getDocsTableRenderViewport = getDocsTableRenderViewport;
|
|
31108
|
+
exports.getDocumentSkeletonColumnPagePathInfo = getDocumentSkeletonColumnPagePathInfo;
|
|
31109
|
+
exports.getDocumentSkeletonNestedPageOffset = getDocumentSkeletonNestedPageOffset;
|
|
30189
31110
|
exports.getDrawingGroupState = getDrawingGroupState;
|
|
30190
31111
|
exports.getFirstGrapheme = getFirstGrapheme;
|
|
30191
31112
|
exports.getFontStyleString = getFontStyleString;
|