@hufe921/canvas-editor 0.9.90 → 0.9.91
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/CHANGELOG.md +17 -0
- package/dist/canvas-editor.es.js +125 -60
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +34 -33
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/draw/Draw.d.ts +1 -0
- package/dist/src/editor/core/draw/frame/PageBorder.d.ts +9 -0
- package/dist/src/editor/core/event/handlers/mousedown.d.ts +4 -0
- package/dist/src/editor/dataset/constant/PageBorder.d.ts +2 -0
- package/dist/src/editor/interface/Editor.d.ts +2 -0
- package/dist/src/editor/interface/PageBorder.d.ts +7 -0
- package/dist/src/editor/utils/element.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [0.9.91](https://github.com/Hufe921/canvas-editor/compare/v0.9.90...v0.9.91) (2024-08-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* format different types of line breaks #769 ([f65ff87](https://github.com/Hufe921/canvas-editor/commit/f65ff87e44728322417d235d2347ceca25cc6667)), closes [#769](https://github.com/Hufe921/canvas-editor/issues/769)
|
|
7
|
+
* format initial data boundary error #771 #784 ([f62a315](https://github.com/Hufe921/canvas-editor/commit/f62a315a7bd04e49e9e17bc7737ccd1f0e751d69)), closes [#771](https://github.com/Hufe921/canvas-editor/issues/771) [#784](https://github.com/Hufe921/canvas-editor/issues/784)
|
|
8
|
+
* set row margin boundary error ([5285170](https://github.com/Hufe921/canvas-editor/commit/528517094373b5fa9ca2145bb259889db865a588))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add page border ([3f6bdf6](https://github.com/Hufe921/canvas-editor/commit/3f6bdf6fcb583ab370cb5abe3eafebf6100f415e))
|
|
14
|
+
* hit checkbox/radio control when click on label #651 ([31b76b6](https://github.com/Hufe921/canvas-editor/commit/31b76b6fb6640ea75383569cb16ad1b5a2ccf25f)), closes [#651](https://github.com/Hufe921/canvas-editor/issues/651)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
1
18
|
## [0.9.90](https://github.com/Hufe921/canvas-editor/compare/v0.9.89...v0.9.90) (2024-08-18)
|
|
2
19
|
|
|
3
20
|
|
package/dist/canvas-editor.es.js
CHANGED
|
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
25
|
var index = "";
|
|
26
|
-
const version = "0.9.
|
|
26
|
+
const version = "0.9.91";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -3768,11 +3768,9 @@ function unzipElementList(elementList) {
|
|
|
3768
3768
|
return result;
|
|
3769
3769
|
}
|
|
3770
3770
|
function formatElementList(elementList, options) {
|
|
3771
|
-
const { isHandleFirstElement, editorOptions } =
|
|
3772
|
-
isHandleFirstElement: true
|
|
3773
|
-
}, options);
|
|
3771
|
+
const { isHandleFirstElement = true, isForceCompensation = false, editorOptions } = options;
|
|
3774
3772
|
const startElement = elementList[0];
|
|
3775
|
-
if (isHandleFirstElement && (startElement == null ? void 0 : startElement.type) !== ElementType.LIST && ((startElement == null ? void 0 : startElement.type) && startElement.type !== ElementType.TEXT || !START_LINE_BREAK_REG.test(startElement == null ? void 0 : startElement.value))) {
|
|
3773
|
+
if (isForceCompensation || isHandleFirstElement && (startElement == null ? void 0 : startElement.type) !== ElementType.LIST && ((startElement == null ? void 0 : startElement.type) && startElement.type !== ElementType.TEXT || !START_LINE_BREAK_REG.test(startElement == null ? void 0 : startElement.value))) {
|
|
3776
3774
|
elementList.unshift({
|
|
3777
3775
|
value: ZERO
|
|
3778
3776
|
});
|
|
@@ -3784,7 +3782,8 @@ function formatElementList(elementList, options) {
|
|
|
3784
3782
|
elementList.splice(i, 1);
|
|
3785
3783
|
const valueList = el.valueList || [];
|
|
3786
3784
|
formatElementList(valueList, __spreadProps(__spreadValues({}, options), {
|
|
3787
|
-
isHandleFirstElement: false
|
|
3785
|
+
isHandleFirstElement: false,
|
|
3786
|
+
isForceCompensation: false
|
|
3788
3787
|
}));
|
|
3789
3788
|
if (valueList.length) {
|
|
3790
3789
|
const titleId = getUUID();
|
|
@@ -3813,7 +3812,8 @@ function formatElementList(elementList, options) {
|
|
|
3813
3812
|
elementList.splice(i, 1);
|
|
3814
3813
|
const valueList = el.valueList || [];
|
|
3815
3814
|
formatElementList(valueList, __spreadProps(__spreadValues({}, options), {
|
|
3816
|
-
isHandleFirstElement: true
|
|
3815
|
+
isHandleFirstElement: true,
|
|
3816
|
+
isForceCompensation: false
|
|
3817
3817
|
}));
|
|
3818
3818
|
if (valueList.length) {
|
|
3819
3819
|
const listId = getUUID();
|
|
@@ -3847,7 +3847,8 @@ function formatElementList(elementList, options) {
|
|
|
3847
3847
|
const tdId = getUUID();
|
|
3848
3848
|
td.id = tdId;
|
|
3849
3849
|
formatElementList(td.value, __spreadProps(__spreadValues({}, options), {
|
|
3850
|
-
isHandleFirstElement: true
|
|
3850
|
+
isHandleFirstElement: true,
|
|
3851
|
+
isForceCompensation: true
|
|
3851
3852
|
}));
|
|
3852
3853
|
for (let v = 0; v < td.value.length; v++) {
|
|
3853
3854
|
const value = td.value[v];
|
|
@@ -4002,7 +4003,8 @@ function formatElementList(elementList, options) {
|
|
|
4002
4003
|
}
|
|
4003
4004
|
}
|
|
4004
4005
|
formatElementList(valueList, __spreadProps(__spreadValues({}, options), {
|
|
4005
|
-
isHandleFirstElement: false
|
|
4006
|
+
isHandleFirstElement: false,
|
|
4007
|
+
isForceCompensation: false
|
|
4006
4008
|
}));
|
|
4007
4009
|
for (let v = 0; v < valueList.length; v++) {
|
|
4008
4010
|
const element = valueList[v];
|
|
@@ -4055,7 +4057,7 @@ function formatElementList(elementList, options) {
|
|
|
4055
4057
|
}
|
|
4056
4058
|
el = elementList[i];
|
|
4057
4059
|
}
|
|
4058
|
-
if (el.value === "\n") {
|
|
4060
|
+
if (el.value === "\n" || el.value == "\r\n") {
|
|
4059
4061
|
el.value = ZERO;
|
|
4060
4062
|
}
|
|
4061
4063
|
if (el.type === ElementType.IMAGE || el.type === ElementType.BLOCK) {
|
|
@@ -5658,7 +5660,40 @@ function setRangeCache(host) {
|
|
|
5658
5660
|
host.cachePositionList = position.getPositionList();
|
|
5659
5661
|
host.cachePositionContext = position.getPositionContext();
|
|
5660
5662
|
}
|
|
5663
|
+
function hitCheckbox(element, draw) {
|
|
5664
|
+
const { checkbox, control } = element;
|
|
5665
|
+
if (!control) {
|
|
5666
|
+
draw.getCheckboxParticle().setSelect(element);
|
|
5667
|
+
} else {
|
|
5668
|
+
const codes = (control == null ? void 0 : control.code) ? control.code.split(",") : [];
|
|
5669
|
+
if (checkbox == null ? void 0 : checkbox.value) {
|
|
5670
|
+
const codeIndex = codes.findIndex((c) => c === checkbox.code);
|
|
5671
|
+
codes.splice(codeIndex, 1);
|
|
5672
|
+
} else {
|
|
5673
|
+
if (checkbox == null ? void 0 : checkbox.code) {
|
|
5674
|
+
codes.push(checkbox.code);
|
|
5675
|
+
}
|
|
5676
|
+
}
|
|
5677
|
+
const activeControl = draw.getControl().getActiveControl();
|
|
5678
|
+
if (activeControl instanceof CheckboxControl) {
|
|
5679
|
+
activeControl.setSelect(codes);
|
|
5680
|
+
}
|
|
5681
|
+
}
|
|
5682
|
+
}
|
|
5683
|
+
function hitRadio(element, draw) {
|
|
5684
|
+
const { radio, control } = element;
|
|
5685
|
+
if (!control) {
|
|
5686
|
+
draw.getRadioParticle().setSelect(element);
|
|
5687
|
+
} else {
|
|
5688
|
+
const codes = (radio == null ? void 0 : radio.code) ? [radio.code] : [];
|
|
5689
|
+
const activeControl = draw.getControl().getActiveControl();
|
|
5690
|
+
if (activeControl instanceof RadioControl) {
|
|
5691
|
+
activeControl.setSelect(codes);
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5661
5695
|
function mousedown(evt, host) {
|
|
5696
|
+
var _a, _b;
|
|
5662
5697
|
if (evt.button === MouseEventButton.RIGHT)
|
|
5663
5698
|
return;
|
|
5664
5699
|
const draw = host.getDraw();
|
|
@@ -5719,37 +5754,22 @@ function mousedown(evt, host) {
|
|
|
5719
5754
|
}
|
|
5720
5755
|
rangeManager.setRange(startIndex, endIndex);
|
|
5721
5756
|
position.setCursorPosition(positionList[curIndex]);
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
if (
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
const
|
|
5730
|
-
if (
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
} else {
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
}
|
|
5737
|
-
}
|
|
5738
|
-
const activeControl = draw.getControl().getActiveControl();
|
|
5739
|
-
if (activeControl instanceof CheckboxControl) {
|
|
5740
|
-
activeControl.setSelect(codes);
|
|
5741
|
-
}
|
|
5742
|
-
}
|
|
5743
|
-
} else if (isSetRadio) {
|
|
5744
|
-
const { control, radio } = curElement;
|
|
5745
|
-
if (!control) {
|
|
5746
|
-
draw.getRadioParticle().setSelect(curElement);
|
|
5747
|
-
} else {
|
|
5748
|
-
const codes = (radio == null ? void 0 : radio.code) ? [radio.code] : [];
|
|
5749
|
-
const activeControl = draw.getControl().getActiveControl();
|
|
5750
|
-
if (activeControl instanceof RadioControl) {
|
|
5751
|
-
activeControl.setSelect(codes);
|
|
5757
|
+
if (isDirectHitCheckbox && !isReadonly) {
|
|
5758
|
+
hitCheckbox(curElement, draw);
|
|
5759
|
+
} else if (isDirectHitRadio && !isReadonly) {
|
|
5760
|
+
hitRadio(curElement, draw);
|
|
5761
|
+
} else if (curElement.controlComponent === ControlComponent.VALUE && (((_a = curElement.control) == null ? void 0 : _a.type) === ControlType.CHECKBOX || ((_b = curElement.control) == null ? void 0 : _b.type) === ControlType.RADIO)) {
|
|
5762
|
+
let preIndex = curIndex;
|
|
5763
|
+
while (preIndex > 0) {
|
|
5764
|
+
const preElement = elementList[preIndex];
|
|
5765
|
+
if (preElement.controlComponent === ControlComponent.CHECKBOX) {
|
|
5766
|
+
hitCheckbox(preElement, draw);
|
|
5767
|
+
break;
|
|
5768
|
+
} else if (preElement.controlComponent === ControlComponent.RADIO) {
|
|
5769
|
+
hitRadio(preElement, draw);
|
|
5770
|
+
break;
|
|
5752
5771
|
}
|
|
5772
|
+
preIndex--;
|
|
5753
5773
|
}
|
|
5754
5774
|
} else {
|
|
5755
5775
|
draw.render({
|
|
@@ -8526,7 +8546,7 @@ class RangeManager {
|
|
|
8526
8546
|
this.setRange(range.startIndex, range.endIndex, range.tableId, range.startTdIndex, range.endTdIndex, range.startTrIndex, range.endTrIndex);
|
|
8527
8547
|
}
|
|
8528
8548
|
setRangeStyle() {
|
|
8529
|
-
var _a;
|
|
8549
|
+
var _a, _b;
|
|
8530
8550
|
const rangeStyleChangeListener = this.listener.rangeStyleChange;
|
|
8531
8551
|
const isSubscribeRangeStyleChange = this.eventBus.isSubscribe("rangeStyleChange");
|
|
8532
8552
|
if (!rangeStyleChangeListener && !isSubscribeRangeStyleChange)
|
|
@@ -8560,7 +8580,7 @@ class RangeManager {
|
|
|
8560
8580
|
const color = curElement.color || null;
|
|
8561
8581
|
const highlight = curElement.highlight || null;
|
|
8562
8582
|
const rowFlex = curElement.rowFlex || null;
|
|
8563
|
-
const rowMargin = curElement.rowMargin
|
|
8583
|
+
const rowMargin = (_a = curElement.rowMargin) != null ? _a : this.options.defaultRowMargin;
|
|
8564
8584
|
const dashArray = curElement.dashArray || [];
|
|
8565
8585
|
const level = curElement.level || null;
|
|
8566
8586
|
const listType = curElement.listType || null;
|
|
@@ -8570,7 +8590,7 @@ class RangeManager {
|
|
|
8570
8590
|
const undo = this.historyManager.isCanUndo();
|
|
8571
8591
|
const redo = this.historyManager.isCanRedo();
|
|
8572
8592
|
const groupIds = curElement.groupIds || null;
|
|
8573
|
-
const extension = (
|
|
8593
|
+
const extension = (_b = curElement.extension) != null ? _b : null;
|
|
8574
8594
|
const rangeStyle = {
|
|
8575
8595
|
type,
|
|
8576
8596
|
undo,
|
|
@@ -12506,7 +12526,8 @@ class Control {
|
|
|
12506
12526
|
const elementList = zipElementList(pageComponentData[pageComponentKey]);
|
|
12507
12527
|
pageComponentData[pageComponentKey] = elementList;
|
|
12508
12528
|
formatElementList(elementList, {
|
|
12509
|
-
editorOptions: this.options
|
|
12529
|
+
editorOptions: this.options,
|
|
12530
|
+
isForceCompensation: true
|
|
12510
12531
|
});
|
|
12511
12532
|
}
|
|
12512
12533
|
this.draw.setEditorData(pageComponentData);
|
|
@@ -14472,7 +14493,8 @@ class Placeholder {
|
|
|
14472
14493
|
}
|
|
14473
14494
|
];
|
|
14474
14495
|
formatElementList(this.elementList, {
|
|
14475
|
-
editorOptions: this.options
|
|
14496
|
+
editorOptions: this.options,
|
|
14497
|
+
isForceCompensation: true
|
|
14476
14498
|
});
|
|
14477
14499
|
this._compute();
|
|
14478
14500
|
const innerWidth = this.draw.getInnerWidth();
|
|
@@ -14715,6 +14737,33 @@ class LineNumber {
|
|
|
14715
14737
|
ctx.restore();
|
|
14716
14738
|
}
|
|
14717
14739
|
}
|
|
14740
|
+
class PageBorder {
|
|
14741
|
+
constructor(draw) {
|
|
14742
|
+
__publicField(this, "draw");
|
|
14743
|
+
__publicField(this, "header");
|
|
14744
|
+
__publicField(this, "footer");
|
|
14745
|
+
__publicField(this, "options");
|
|
14746
|
+
this.draw = draw;
|
|
14747
|
+
this.header = draw.getHeader();
|
|
14748
|
+
this.footer = draw.getFooter();
|
|
14749
|
+
this.options = draw.getOptions();
|
|
14750
|
+
}
|
|
14751
|
+
render(ctx) {
|
|
14752
|
+
const { scale, pageBorder: { color, lineWidth, padding } } = this.options;
|
|
14753
|
+
ctx.save();
|
|
14754
|
+
ctx.translate(0.5, 0.5);
|
|
14755
|
+
ctx.strokeStyle = color;
|
|
14756
|
+
ctx.lineWidth = lineWidth * scale;
|
|
14757
|
+
const margins = this.draw.getMargins();
|
|
14758
|
+
const x = margins[3] - padding[3] * scale;
|
|
14759
|
+
const y = margins[0] + this.header.getExtraHeight() - padding[0] * scale;
|
|
14760
|
+
const width = this.draw.getInnerWidth() + (padding[1] + padding[3]) * scale;
|
|
14761
|
+
const height = this.draw.getHeight() - y - this.footer.getExtraHeight() - margins[2] + padding[2] * scale;
|
|
14762
|
+
ctx.rect(x, y, width, height);
|
|
14763
|
+
ctx.stroke();
|
|
14764
|
+
ctx.restore();
|
|
14765
|
+
}
|
|
14766
|
+
}
|
|
14718
14767
|
class Draw {
|
|
14719
14768
|
constructor(rootContainer, options, data2, listener, eventBus, override) {
|
|
14720
14769
|
__publicField(this, "container");
|
|
@@ -14768,6 +14817,7 @@ class Draw {
|
|
|
14768
14817
|
__publicField(this, "listParticle");
|
|
14769
14818
|
__publicField(this, "lineBreakParticle");
|
|
14770
14819
|
__publicField(this, "control");
|
|
14820
|
+
__publicField(this, "pageBorder");
|
|
14771
14821
|
__publicField(this, "workerManager");
|
|
14772
14822
|
__publicField(this, "scrollObserver");
|
|
14773
14823
|
__publicField(this, "selectionObserver");
|
|
@@ -14832,6 +14882,7 @@ class Draw {
|
|
|
14832
14882
|
this.listParticle = new ListParticle(this);
|
|
14833
14883
|
this.lineBreakParticle = new LineBreakParticle(this);
|
|
14834
14884
|
this.control = new Control(this);
|
|
14885
|
+
this.pageBorder = new PageBorder(this);
|
|
14835
14886
|
this.scrollObserver = new ScrollObserver(this);
|
|
14836
14887
|
this.selectionObserver = new SelectionObserver(this);
|
|
14837
14888
|
this.imageObserver = new ImageObserver();
|
|
@@ -15513,7 +15564,8 @@ class Draw {
|
|
|
15513
15564
|
if (!data2)
|
|
15514
15565
|
return;
|
|
15515
15566
|
formatElementList(data2, {
|
|
15516
|
-
editorOptions: this.options
|
|
15567
|
+
editorOptions: this.options,
|
|
15568
|
+
isForceCompensation: true
|
|
15517
15569
|
});
|
|
15518
15570
|
});
|
|
15519
15571
|
this.setEditorData({
|
|
@@ -15597,11 +15649,12 @@ class Draw {
|
|
|
15597
15649
|
return el.actualSize || el.size || this.options.defaultSize;
|
|
15598
15650
|
}
|
|
15599
15651
|
getElementRowMargin(el) {
|
|
15652
|
+
var _a;
|
|
15600
15653
|
const { defaultBasicRowMarginHeight, defaultRowMargin, scale } = this.options;
|
|
15601
|
-
return defaultBasicRowMarginHeight * (el.rowMargin
|
|
15654
|
+
return defaultBasicRowMarginHeight * ((_a = el.rowMargin) != null ? _a : defaultRowMargin) * scale;
|
|
15602
15655
|
}
|
|
15603
15656
|
computeRowList(payload) {
|
|
15604
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
15657
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
15605
15658
|
const { innerWidth, elementList, isPagingMode = false } = payload;
|
|
15606
15659
|
const { defaultSize, defaultRowMargin, scale, table: { tdPadding }, defaultTabWidth } = this.options;
|
|
15607
15660
|
const defaultBasicRowMarginHeight = this.getDefaultBasicRowMarginHeight();
|
|
@@ -15626,7 +15679,7 @@ class Draw {
|
|
|
15626
15679
|
for (let i = 0; i < elementList.length; i++) {
|
|
15627
15680
|
const curRow = rowList[rowList.length - 1];
|
|
15628
15681
|
const element = elementList[i];
|
|
15629
|
-
const rowMargin = defaultBasicRowMarginHeight * (element.rowMargin
|
|
15682
|
+
const rowMargin = defaultBasicRowMarginHeight * ((_c = element.rowMargin) != null ? _c : defaultRowMargin);
|
|
15630
15683
|
const metrics = {
|
|
15631
15684
|
width: 0,
|
|
15632
15685
|
height: 0,
|
|
@@ -15679,7 +15732,7 @@ class Draw {
|
|
|
15679
15732
|
elementList.splice(i + 1, combineCount);
|
|
15680
15733
|
}
|
|
15681
15734
|
}
|
|
15682
|
-
element.pagingIndex = (
|
|
15735
|
+
element.pagingIndex = (_d = element.pagingIndex) != null ? _d : 0;
|
|
15683
15736
|
this.tableParticle.computeRowColInfo(element);
|
|
15684
15737
|
const trList = element.trList;
|
|
15685
15738
|
for (let t = 0; t < trList.length; t++) {
|
|
@@ -15755,7 +15808,7 @@ class Draw {
|
|
|
15755
15808
|
let curPagePreHeight = marginHeight;
|
|
15756
15809
|
for (let r = 0; r < rowList.length; r++) {
|
|
15757
15810
|
const row = rowList[r];
|
|
15758
|
-
if (row.height + curPagePreHeight > height2 || ((
|
|
15811
|
+
if (row.height + curPagePreHeight > height2 || ((_e = rowList[r - 1]) == null ? void 0 : _e.isPageBreak)) {
|
|
15759
15812
|
curPagePreHeight = marginHeight + row.height;
|
|
15760
15813
|
} else {
|
|
15761
15814
|
curPagePreHeight += row.height;
|
|
@@ -15776,7 +15829,7 @@ class Draw {
|
|
|
15776
15829
|
const trHeight = tr.height * scale;
|
|
15777
15830
|
if (curPagePreHeight + rowMarginHeight + preTrHeight + trHeight > height2) {
|
|
15778
15831
|
const rowColCount = tr.tdList.reduce((pre, cur) => pre + cur.colspan, 0);
|
|
15779
|
-
if (((
|
|
15832
|
+
if (((_f = element.colgroup) == null ? void 0 : _f.length) !== rowColCount) {
|
|
15780
15833
|
deleteCount = 0;
|
|
15781
15834
|
}
|
|
15782
15835
|
break;
|
|
@@ -15899,7 +15952,7 @@ class Draw {
|
|
|
15899
15952
|
metrics,
|
|
15900
15953
|
style: this.getElementFont(element, scale)
|
|
15901
15954
|
});
|
|
15902
|
-
if ((
|
|
15955
|
+
if ((_g = rowElement.control) == null ? void 0 : _g.minWidth) {
|
|
15903
15956
|
if (rowElement.controlComponent) {
|
|
15904
15957
|
controlRealWidth += metrics.width;
|
|
15905
15958
|
}
|
|
@@ -15952,10 +16005,10 @@ class Draw {
|
|
|
15952
16005
|
elementList: [rowElement],
|
|
15953
16006
|
ascent,
|
|
15954
16007
|
rowIndex: curRow.rowIndex + 1,
|
|
15955
|
-
rowFlex: ((
|
|
16008
|
+
rowFlex: ((_h = elementList[i]) == null ? void 0 : _h.rowFlex) || ((_i = elementList[i + 1]) == null ? void 0 : _i.rowFlex),
|
|
15956
16009
|
isPageBreak: element.type === ElementType.PAGE_BREAK
|
|
15957
16010
|
};
|
|
15958
|
-
if (rowElement.controlComponent !== ControlComponent.PREFIX && ((
|
|
16011
|
+
if (rowElement.controlComponent !== ControlComponent.PREFIX && ((_j = rowElement.control) == null ? void 0 : _j.indentation) === ControlIndentation.VALUE_START) {
|
|
15959
16012
|
const preStartIndex = curRow.elementList.findIndex((el) => el.controlId === rowElement.controlId && el.controlComponent !== ControlComponent.PREFIX);
|
|
15960
16013
|
if (~preStartIndex) {
|
|
15961
16014
|
const preRowPositionList = this.position.computeRowPosition({
|
|
@@ -15988,7 +16041,7 @@ class Draw {
|
|
|
15988
16041
|
if (isForceBreak || isWidthNotEnough || i === elementList.length - 1) {
|
|
15989
16042
|
curRow.isWidthNotEnough = isWidthNotEnough && !isForceBreak;
|
|
15990
16043
|
if ((preElement == null ? void 0 : preElement.rowFlex) === RowFlex.JUSTIFY || (preElement == null ? void 0 : preElement.rowFlex) === RowFlex.ALIGNMENT && isWidthNotEnough) {
|
|
15991
|
-
const rowElementList = ((
|
|
16044
|
+
const rowElementList = ((_k = curRow.elementList[0]) == null ? void 0 : _k.value) === ZERO ? curRow.elementList.slice(1) : curRow.elementList;
|
|
15992
16045
|
const gap = (availableWidth - curRow.width) / (rowElementList.length - 1);
|
|
15993
16046
|
for (let e = 0; e < rowElementList.length - 1; e++) {
|
|
15994
16047
|
const el = rowElementList[e];
|
|
@@ -16295,7 +16348,7 @@ class Draw {
|
|
|
16295
16348
|
_drawPage(payload) {
|
|
16296
16349
|
var _a, _b;
|
|
16297
16350
|
const { elementList, positionList, rowList, pageNo } = payload;
|
|
16298
|
-
const { inactiveAlpha, pageMode, header, footer, pageNumber, lineNumber } = this.options;
|
|
16351
|
+
const { inactiveAlpha, pageMode, header, footer, pageNumber, lineNumber, pageBorder } = this.options;
|
|
16299
16352
|
const innerWidth = this.getInnerWidth();
|
|
16300
16353
|
const ctx = this.ctxList[pageNo];
|
|
16301
16354
|
ctx.globalAlpha = !this.zone.isMainActive() ? inactiveAlpha : 1;
|
|
@@ -16346,6 +16399,9 @@ class Draw {
|
|
|
16346
16399
|
if (!lineNumber.disabled) {
|
|
16347
16400
|
this.lineNumber.render(ctx, pageNo);
|
|
16348
16401
|
}
|
|
16402
|
+
if (!pageBorder.disabled) {
|
|
16403
|
+
this.pageBorder.render(ctx);
|
|
16404
|
+
}
|
|
16349
16405
|
}
|
|
16350
16406
|
_disconnectLazyRender() {
|
|
16351
16407
|
var _a;
|
|
@@ -16860,6 +16916,12 @@ const defaultLineNumberOption = {
|
|
|
16860
16916
|
right: 20,
|
|
16861
16917
|
type: LineNumberType.CONTINUITY
|
|
16862
16918
|
};
|
|
16919
|
+
const defaultPageBorderOption = {
|
|
16920
|
+
color: "#000000",
|
|
16921
|
+
lineWidth: 1,
|
|
16922
|
+
padding: [0, 5, 0, 5],
|
|
16923
|
+
disabled: true
|
|
16924
|
+
};
|
|
16863
16925
|
function mergeOption(options = {}) {
|
|
16864
16926
|
const tableOptions = __spreadValues(__spreadValues({}, defaultTableOption), options.table);
|
|
16865
16927
|
const headerOptions = __spreadValues(__spreadValues({}, defaultHeaderOption), options.header);
|
|
@@ -16879,6 +16941,7 @@ function mergeOption(options = {}) {
|
|
|
16879
16941
|
const lineBreakOptions = __spreadValues(__spreadValues({}, defaultLineBreak), options.lineBreak);
|
|
16880
16942
|
const separatorOptions = __spreadValues(__spreadValues({}, defaultSeparatorOption), options.separator);
|
|
16881
16943
|
const lineNumberOptions = __spreadValues(__spreadValues({}, defaultLineNumberOption), options.lineNumber);
|
|
16944
|
+
const pageBorderOptions = __spreadValues(__spreadValues({}, defaultPageBorderOption), options.pageBorder);
|
|
16882
16945
|
return __spreadProps(__spreadValues({
|
|
16883
16946
|
mode: EditorMode.EDIT,
|
|
16884
16947
|
defaultType: "TEXT",
|
|
@@ -16938,7 +17001,8 @@ function mergeOption(options = {}) {
|
|
|
16938
17001
|
background: backgroundOptions,
|
|
16939
17002
|
lineBreak: lineBreakOptions,
|
|
16940
17003
|
separator: separatorOptions,
|
|
16941
|
-
lineNumber: lineNumberOptions
|
|
17004
|
+
lineNumber: lineNumberOptions,
|
|
17005
|
+
pageBorder: pageBorderOptions
|
|
16942
17006
|
});
|
|
16943
17007
|
}
|
|
16944
17008
|
function convertPxToPaperSize(width, height) {
|
|
@@ -17653,7 +17717,7 @@ class CommandAdapt {
|
|
|
17653
17717
|
tdList.push({
|
|
17654
17718
|
colspan: 1,
|
|
17655
17719
|
rowspan: 1,
|
|
17656
|
-
value: [
|
|
17720
|
+
value: []
|
|
17657
17721
|
});
|
|
17658
17722
|
}
|
|
17659
17723
|
trList.push(tr);
|
|
@@ -20470,7 +20534,8 @@ class Editor {
|
|
|
20470
20534
|
];
|
|
20471
20535
|
pageComponentData.forEach((elementList) => {
|
|
20472
20536
|
formatElementList(elementList, {
|
|
20473
|
-
editorOptions
|
|
20537
|
+
editorOptions,
|
|
20538
|
+
isForceCompensation: true
|
|
20474
20539
|
});
|
|
20475
20540
|
});
|
|
20476
20541
|
this.listener = new Listener();
|