@hufe921/canvas-editor 0.9.88 → 0.9.89
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 +22 -0
- package/dist/canvas-editor.es.js +127 -46
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +14 -14
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +5 -5
- package/dist/src/editor/core/draw/frame/LineNumber.d.ts +7 -0
- package/dist/src/editor/dataset/constant/LineNumber.d.ts +2 -0
- package/dist/src/editor/dataset/enum/LineNumber.d.ts +4 -0
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/Control.d.ts +10 -5
- package/dist/src/editor/interface/Editor.d.ts +2 -0
- package/dist/src/editor/interface/Element.d.ts +1 -1
- package/dist/src/editor/interface/LineNumber.d.ts +9 -0
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [0.9.89](https://github.com/Hufe921/canvas-editor/compare/v0.9.88...v0.9.89) (2024-08-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* three click selection paragraph boundary error #742 ([9dd192f](https://github.com/Hufe921/canvas-editor/commit/9dd192ffd26f9f271efa06c81b6bd5e32557d872)), closes [#742](https://github.com/Hufe921/canvas-editor/issues/742)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Documentation
|
|
10
|
+
|
|
11
|
+
* update plugin markdown ([c2d3e94](https://github.com/Hufe921/canvas-editor/commit/c2d3e941b19a6bc766b0bfa8dac7911578170b6c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* add id property to contextMenu context #737 ([997ecc0](https://github.com/Hufe921/canvas-editor/commit/997ecc03e89afeaaf6b903f9f253c5c5090b3f78)), closes [#737](https://github.com/Hufe921/canvas-editor/issues/737)
|
|
17
|
+
* add line number option #734 ([d89218a](https://github.com/Hufe921/canvas-editor/commit/d89218a916fce5a7b7b6bf27fa4663ecc4d15cf6)), closes [#734](https://github.com/Hufe921/canvas-editor/issues/734)
|
|
18
|
+
* control related apis support the control id property ([dd1b53e](https://github.com/Hufe921/canvas-editor/commit/dd1b53ee6297bc72b0064c09522b597118919c50))
|
|
19
|
+
* set range using the shift shortcut key #728 ([8878fd7](https://github.com/Hufe921/canvas-editor/commit/8878fd7734ae0a566f16ca2db14e64ded5a05f38)), closes [#728](https://github.com/Hufe921/canvas-editor/issues/728)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
## [0.9.88](https://github.com/Hufe921/canvas-editor/compare/v0.9.87...v0.9.88) (2024-08-02)
|
|
2
24
|
|
|
3
25
|
|
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.89";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -5550,7 +5550,7 @@ class CheckboxControl {
|
|
|
5550
5550
|
return -1;
|
|
5551
5551
|
}
|
|
5552
5552
|
setSelect(codes, context = {}, options = {}) {
|
|
5553
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
5553
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
5554
5554
|
return;
|
|
5555
5555
|
}
|
|
5556
5556
|
const { control } = this.element;
|
|
@@ -5602,7 +5602,7 @@ class CheckboxControl {
|
|
|
5602
5602
|
}
|
|
5603
5603
|
class RadioControl extends CheckboxControl {
|
|
5604
5604
|
setSelect(codes, context = {}, options = {}) {
|
|
5605
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
5605
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
5606
5606
|
return;
|
|
5607
5607
|
}
|
|
5608
5608
|
const { control } = this.element;
|
|
@@ -5670,6 +5670,7 @@ function mousedown(evt, host) {
|
|
|
5670
5670
|
draw.setPageNo(Number(pageIndex));
|
|
5671
5671
|
}
|
|
5672
5672
|
host.isAllowSelection = true;
|
|
5673
|
+
const oldPositionContext = deepClone(position.getPositionContext());
|
|
5673
5674
|
const positionResult = position.adjustPositionContext({
|
|
5674
5675
|
x: evt.offsetX,
|
|
5675
5676
|
y: evt.offsetY
|
|
@@ -5690,7 +5691,22 @@ function mousedown(evt, host) {
|
|
|
5690
5691
|
const isDirectHitCheckbox = !!(isDirectHit && isCheckbox);
|
|
5691
5692
|
const isDirectHitRadio = !!(isDirectHit && isRadio);
|
|
5692
5693
|
if (~index2) {
|
|
5693
|
-
|
|
5694
|
+
let startIndex = curIndex;
|
|
5695
|
+
let endIndex = curIndex;
|
|
5696
|
+
if (evt.shiftKey) {
|
|
5697
|
+
const { startIndex: oldStartIndex } = rangeManager.getRange();
|
|
5698
|
+
if (~oldStartIndex) {
|
|
5699
|
+
const newPositionContext = position.getPositionContext();
|
|
5700
|
+
if (newPositionContext.tdId === oldPositionContext.tdId) {
|
|
5701
|
+
if (curIndex > oldStartIndex) {
|
|
5702
|
+
startIndex = oldStartIndex;
|
|
5703
|
+
} else {
|
|
5704
|
+
endIndex = oldStartIndex;
|
|
5705
|
+
}
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
rangeManager.setRange(startIndex, endIndex);
|
|
5694
5710
|
position.setCursorPosition(positionList[curIndex]);
|
|
5695
5711
|
const isSetCheckbox = isDirectHitCheckbox && !isReadonly;
|
|
5696
5712
|
const isSetRadio = isDirectHitRadio && !isReadonly;
|
|
@@ -7261,7 +7277,7 @@ function threeClick(host) {
|
|
|
7261
7277
|
if (newStartIndex < 0)
|
|
7262
7278
|
return;
|
|
7263
7279
|
let newEndIndex = index2 + downCount + 1;
|
|
7264
|
-
if (((_b = elementList[newEndIndex]) == null ? void 0 : _b.value) === ZERO) {
|
|
7280
|
+
if (((_b = elementList[newEndIndex]) == null ? void 0 : _b.value) === ZERO || newEndIndex > elementList.length - 1) {
|
|
7265
7281
|
newEndIndex -= 1;
|
|
7266
7282
|
}
|
|
7267
7283
|
rangeManager.setRange(newStartIndex, newEndIndex);
|
|
@@ -10519,7 +10535,6 @@ class ControlSearch {
|
|
|
10519
10535
|
computeHighlightList() {
|
|
10520
10536
|
const search = this.draw.getSearch();
|
|
10521
10537
|
const computeHighlight = (elementList, restArgs) => {
|
|
10522
|
-
var _a;
|
|
10523
10538
|
let i = 0;
|
|
10524
10539
|
while (i < elementList.length) {
|
|
10525
10540
|
const element = elementList[i];
|
|
@@ -10541,10 +10556,10 @@ class ControlSearch {
|
|
|
10541
10556
|
}
|
|
10542
10557
|
}
|
|
10543
10558
|
}
|
|
10544
|
-
const
|
|
10545
|
-
if (!
|
|
10559
|
+
const currentControl = element == null ? void 0 : element.control;
|
|
10560
|
+
if (!currentControl)
|
|
10546
10561
|
continue;
|
|
10547
|
-
const highlightIndex = this.highlightList.findIndex((highlight2) => highlight2.conceptId ===
|
|
10562
|
+
const highlightIndex = this.highlightList.findIndex((highlight2) => highlight2.id === element.controlId || currentControl.conceptId && currentControl.conceptId === highlight2.conceptId);
|
|
10548
10563
|
if (!~highlightIndex)
|
|
10549
10564
|
continue;
|
|
10550
10565
|
const startIndex = i;
|
|
@@ -10748,7 +10763,7 @@ class SelectControl {
|
|
|
10748
10763
|
}
|
|
10749
10764
|
clearSelect(context = {}, options = {}) {
|
|
10750
10765
|
const { isIgnoreDisabledRule = false, isAddPlaceholder = true } = options;
|
|
10751
|
-
if (!isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
10766
|
+
if (!isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
10752
10767
|
return -1;
|
|
10753
10768
|
}
|
|
10754
10769
|
const elementList = context.elementList || this.control.getElementList();
|
|
@@ -10785,7 +10800,7 @@ class SelectControl {
|
|
|
10785
10800
|
return preIndex;
|
|
10786
10801
|
}
|
|
10787
10802
|
setSelect(code, context = {}, options = {}) {
|
|
10788
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
10803
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
10789
10804
|
return;
|
|
10790
10805
|
}
|
|
10791
10806
|
const elementList = context.elementList || this.control.getElementList();
|
|
@@ -10936,7 +10951,7 @@ class TextControl {
|
|
|
10936
10951
|
return data2;
|
|
10937
10952
|
}
|
|
10938
10953
|
setValue(data2, context = {}, options = {}) {
|
|
10939
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
10954
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
10940
10955
|
return -1;
|
|
10941
10956
|
}
|
|
10942
10957
|
const elementList = context.elementList || this.control.getElementList();
|
|
@@ -10966,7 +10981,7 @@ class TextControl {
|
|
|
10966
10981
|
return start + data2.length - 1;
|
|
10967
10982
|
}
|
|
10968
10983
|
clearValue(context = {}, options = {}) {
|
|
10969
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
10984
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
10970
10985
|
return -1;
|
|
10971
10986
|
}
|
|
10972
10987
|
const elementList = context.elementList || this.control.getElementList();
|
|
@@ -11574,7 +11589,7 @@ class DateControl {
|
|
|
11574
11589
|
return data2;
|
|
11575
11590
|
}
|
|
11576
11591
|
setValue(data2, context = {}, options = {}) {
|
|
11577
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
11592
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
11578
11593
|
return -1;
|
|
11579
11594
|
}
|
|
11580
11595
|
const elementList = context.elementList || this.control.getElementList();
|
|
@@ -11605,7 +11620,7 @@ class DateControl {
|
|
|
11605
11620
|
}
|
|
11606
11621
|
clearSelect(context = {}, options = {}) {
|
|
11607
11622
|
const { isIgnoreDisabledRule = false, isAddPlaceholder = true } = options;
|
|
11608
|
-
if (!isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
11623
|
+
if (!isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
11609
11624
|
return -1;
|
|
11610
11625
|
}
|
|
11611
11626
|
const range = this.getValueRange(context);
|
|
@@ -11623,7 +11638,7 @@ class DateControl {
|
|
|
11623
11638
|
return leftIndex;
|
|
11624
11639
|
}
|
|
11625
11640
|
setSelect(date, context = {}, options = {}) {
|
|
11626
|
-
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl()) {
|
|
11641
|
+
if (!options.isIgnoreDisabledRule && this.control.getIsDisabledControl(context)) {
|
|
11627
11642
|
return;
|
|
11628
11643
|
}
|
|
11629
11644
|
const elementList = context.elementList || this.control.getElementList();
|
|
@@ -11887,13 +11902,13 @@ class Control {
|
|
|
11887
11902
|
return false;
|
|
11888
11903
|
return prefixCount === postfixCount;
|
|
11889
11904
|
}
|
|
11890
|
-
getIsDisabledControl() {
|
|
11905
|
+
getIsDisabledControl(context = {}) {
|
|
11891
11906
|
var _a, _b;
|
|
11892
11907
|
if (!this.activeControl)
|
|
11893
11908
|
return false;
|
|
11894
|
-
const { startIndex, endIndex } = this.range.getRange();
|
|
11895
|
-
if (startIndex === endIndex) {
|
|
11896
|
-
const elementList = this.getElementList();
|
|
11909
|
+
const { startIndex, endIndex } = context.range || this.range.getRange();
|
|
11910
|
+
if (startIndex === endIndex && ~startIndex && ~endIndex) {
|
|
11911
|
+
const elementList = context.elementList || this.getElementList();
|
|
11897
11912
|
const startElement = elementList[startIndex];
|
|
11898
11913
|
if (startElement.controlComponent === ControlComponent.POSTFIX) {
|
|
11899
11914
|
return false;
|
|
@@ -12192,11 +12207,12 @@ class Control {
|
|
|
12192
12207
|
}
|
|
12193
12208
|
return this.activeControl.cut();
|
|
12194
12209
|
}
|
|
12195
|
-
|
|
12196
|
-
const { conceptId } = payload;
|
|
12210
|
+
getValueById(payload) {
|
|
12211
|
+
const { id, conceptId } = payload;
|
|
12197
12212
|
const result = [];
|
|
12213
|
+
if (!id && !conceptId)
|
|
12214
|
+
return result;
|
|
12198
12215
|
const getValue = (elementList, zone2) => {
|
|
12199
|
-
var _a;
|
|
12200
12216
|
let i = 0;
|
|
12201
12217
|
while (i < elementList.length) {
|
|
12202
12218
|
const element = elementList[i];
|
|
@@ -12211,8 +12227,9 @@ class Control {
|
|
|
12211
12227
|
}
|
|
12212
12228
|
}
|
|
12213
12229
|
}
|
|
12214
|
-
if (
|
|
12230
|
+
if (!element.control || id && element.controlId !== id || conceptId && element.control.conceptId !== conceptId) {
|
|
12215
12231
|
continue;
|
|
12232
|
+
}
|
|
12216
12233
|
const { type, code, valueSets } = element.control;
|
|
12217
12234
|
let j = i;
|
|
12218
12235
|
let textControlValue = "";
|
|
@@ -12233,8 +12250,8 @@ class Control {
|
|
|
12233
12250
|
}));
|
|
12234
12251
|
} else if (type === ControlType.SELECT || type === ControlType.CHECKBOX || type === ControlType.RADIO) {
|
|
12235
12252
|
const innerText = code == null ? void 0 : code.split(",").map((selectCode) => {
|
|
12236
|
-
var
|
|
12237
|
-
return (
|
|
12253
|
+
var _a;
|
|
12254
|
+
return (_a = valueSets == null ? void 0 : valueSets.find((valueSet) => valueSet.code === selectCode)) == null ? void 0 : _a.value;
|
|
12238
12255
|
}).filter(Boolean).join("");
|
|
12239
12256
|
result.push(__spreadProps(__spreadValues({}, element.control), {
|
|
12240
12257
|
zone: zone2,
|
|
@@ -12264,11 +12281,12 @@ class Control {
|
|
|
12264
12281
|
}
|
|
12265
12282
|
return result;
|
|
12266
12283
|
}
|
|
12267
|
-
|
|
12284
|
+
setValueById(payload) {
|
|
12268
12285
|
let isExistSet = false;
|
|
12269
|
-
const { conceptId, value } = payload;
|
|
12286
|
+
const { id, conceptId, value } = payload;
|
|
12287
|
+
if (!id && !conceptId)
|
|
12288
|
+
return;
|
|
12270
12289
|
const setValue = (elementList) => {
|
|
12271
|
-
var _a;
|
|
12272
12290
|
let i = 0;
|
|
12273
12291
|
while (i < elementList.length) {
|
|
12274
12292
|
const element = elementList[i];
|
|
@@ -12283,8 +12301,9 @@ class Control {
|
|
|
12283
12301
|
}
|
|
12284
12302
|
}
|
|
12285
12303
|
}
|
|
12286
|
-
if (
|
|
12304
|
+
if (!element.control || id && element.controlId !== id || conceptId && element.control.conceptId !== conceptId) {
|
|
12287
12305
|
continue;
|
|
12306
|
+
}
|
|
12288
12307
|
isExistSet = true;
|
|
12289
12308
|
const { type } = element.control;
|
|
12290
12309
|
let currentEndIndex = i;
|
|
@@ -12371,10 +12390,11 @@ class Control {
|
|
|
12371
12390
|
});
|
|
12372
12391
|
}
|
|
12373
12392
|
}
|
|
12374
|
-
|
|
12375
|
-
const { conceptId, extension } = payload;
|
|
12393
|
+
setExtensionById(payload) {
|
|
12394
|
+
const { id, conceptId, extension } = payload;
|
|
12395
|
+
if (!id && !conceptId)
|
|
12396
|
+
return;
|
|
12376
12397
|
const setExtension = (elementList) => {
|
|
12377
|
-
var _a;
|
|
12378
12398
|
let i = 0;
|
|
12379
12399
|
while (i < elementList.length) {
|
|
12380
12400
|
const element = elementList[i];
|
|
@@ -12389,8 +12409,9 @@ class Control {
|
|
|
12389
12409
|
}
|
|
12390
12410
|
}
|
|
12391
12411
|
}
|
|
12392
|
-
if (
|
|
12412
|
+
if (!element.control || id && element.controlId !== id || conceptId && element.control.conceptId !== conceptId) {
|
|
12393
12413
|
continue;
|
|
12414
|
+
}
|
|
12394
12415
|
element.control.extension = extension;
|
|
12395
12416
|
let newEndIndex = i;
|
|
12396
12417
|
while (newEndIndex < elementList.length) {
|
|
@@ -12411,11 +12432,12 @@ class Control {
|
|
|
12411
12432
|
setExtension(elementList);
|
|
12412
12433
|
}
|
|
12413
12434
|
}
|
|
12414
|
-
|
|
12415
|
-
const { conceptId, properties } = payload;
|
|
12435
|
+
setPropertiesById(payload) {
|
|
12436
|
+
const { id, conceptId, properties } = payload;
|
|
12437
|
+
if (!id && !conceptId)
|
|
12438
|
+
return;
|
|
12416
12439
|
let isExistUpdate = false;
|
|
12417
12440
|
function setProperties(elementList) {
|
|
12418
|
-
var _a;
|
|
12419
12441
|
let i = 0;
|
|
12420
12442
|
while (i < elementList.length) {
|
|
12421
12443
|
const element = elementList[i];
|
|
@@ -12430,8 +12452,9 @@ class Control {
|
|
|
12430
12452
|
}
|
|
12431
12453
|
}
|
|
12432
12454
|
}
|
|
12433
|
-
if (
|
|
12455
|
+
if (!element.control || id && element.controlId !== id || conceptId && element.control.conceptId !== conceptId) {
|
|
12434
12456
|
continue;
|
|
12457
|
+
}
|
|
12435
12458
|
isExistUpdate = true;
|
|
12436
12459
|
element.control = __spreadProps(__spreadValues(__spreadValues({}, element.control), properties), {
|
|
12437
12460
|
value: element.control.value
|
|
@@ -14581,6 +14604,42 @@ class MouseObserver {
|
|
|
14581
14604
|
this.eventBus.emit("mouseleave", evt);
|
|
14582
14605
|
}
|
|
14583
14606
|
}
|
|
14607
|
+
var LineNumberType;
|
|
14608
|
+
(function(LineNumberType2) {
|
|
14609
|
+
LineNumberType2["PAGE"] = "page";
|
|
14610
|
+
LineNumberType2["CONTINUITY"] = "continuity";
|
|
14611
|
+
})(LineNumberType || (LineNumberType = {}));
|
|
14612
|
+
class LineNumber {
|
|
14613
|
+
constructor(draw) {
|
|
14614
|
+
__publicField(this, "draw");
|
|
14615
|
+
__publicField(this, "options");
|
|
14616
|
+
this.draw = draw;
|
|
14617
|
+
this.options = draw.getOptions();
|
|
14618
|
+
}
|
|
14619
|
+
render(ctx, pageNo) {
|
|
14620
|
+
const { scale, lineNumber: { color, size, font, right: right2, type } } = this.options;
|
|
14621
|
+
const textParticle = this.draw.getTextParticle();
|
|
14622
|
+
const margins = this.draw.getMargins();
|
|
14623
|
+
const positionList = this.draw.getPosition().getOriginalMainPositionList();
|
|
14624
|
+
const pageRowList = this.draw.getPageRowList();
|
|
14625
|
+
const rowList = pageRowList[pageNo];
|
|
14626
|
+
ctx.save();
|
|
14627
|
+
ctx.fillStyle = color;
|
|
14628
|
+
ctx.font = `${size * scale}px ${font}`;
|
|
14629
|
+
for (let i = 0; i < rowList.length; i++) {
|
|
14630
|
+
const row = rowList[i];
|
|
14631
|
+
const { coordinate: { leftBottom } } = positionList[row.startIndex];
|
|
14632
|
+
const seq = type === LineNumberType.PAGE ? i + 1 : row.rowIndex + 1;
|
|
14633
|
+
const textMetrics = textParticle.measureText(ctx, {
|
|
14634
|
+
value: `${seq}`
|
|
14635
|
+
});
|
|
14636
|
+
const x = margins[3] - (textMetrics.width + right2) * scale;
|
|
14637
|
+
const y = leftBottom[1] - textMetrics.actualBoundingBoxAscent * scale;
|
|
14638
|
+
ctx.fillText(`${seq}`, x, y);
|
|
14639
|
+
}
|
|
14640
|
+
ctx.restore();
|
|
14641
|
+
}
|
|
14642
|
+
}
|
|
14584
14643
|
class Draw {
|
|
14585
14644
|
constructor(rootContainer, options, data2, listener, eventBus, override) {
|
|
14586
14645
|
__publicField(this, "container");
|
|
@@ -14617,6 +14676,7 @@ class Draw {
|
|
|
14617
14676
|
__publicField(this, "tableParticle");
|
|
14618
14677
|
__publicField(this, "tableTool");
|
|
14619
14678
|
__publicField(this, "pageNumber");
|
|
14679
|
+
__publicField(this, "lineNumber");
|
|
14620
14680
|
__publicField(this, "waterMark");
|
|
14621
14681
|
__publicField(this, "placeholder");
|
|
14622
14682
|
__publicField(this, "header");
|
|
@@ -14680,6 +14740,7 @@ class Draw {
|
|
|
14680
14740
|
this.tableParticle = new TableParticle(this);
|
|
14681
14741
|
this.tableTool = new TableTool(this);
|
|
14682
14742
|
this.pageNumber = new PageNumber(this);
|
|
14743
|
+
this.lineNumber = new LineNumber(this);
|
|
14683
14744
|
this.waterMark = new Watermark(this);
|
|
14684
14745
|
this.placeholder = new Placeholder(this);
|
|
14685
14746
|
this.header = new Header(this, data2.header);
|
|
@@ -14946,6 +15007,9 @@ class Draw {
|
|
|
14946
15007
|
getLineBreakParticle() {
|
|
14947
15008
|
return this.lineBreakParticle;
|
|
14948
15009
|
}
|
|
15010
|
+
getTextParticle() {
|
|
15011
|
+
return this.textParticle;
|
|
15012
|
+
}
|
|
14949
15013
|
getHeaderElementList() {
|
|
14950
15014
|
return this.header.getElementList();
|
|
14951
15015
|
}
|
|
@@ -15465,6 +15529,7 @@ class Draw {
|
|
|
15465
15529
|
ascent: 0,
|
|
15466
15530
|
elementList: [],
|
|
15467
15531
|
startIndex: 0,
|
|
15532
|
+
rowIndex: 0,
|
|
15468
15533
|
rowFlex: ((_a = elementList == null ? void 0 : elementList[0]) == null ? void 0 : _a.rowFlex) || ((_b = elementList == null ? void 0 : elementList[1]) == null ? void 0 : _b.rowFlex)
|
|
15469
15534
|
});
|
|
15470
15535
|
}
|
|
@@ -15799,6 +15864,7 @@ class Draw {
|
|
|
15799
15864
|
startIndex: i,
|
|
15800
15865
|
elementList: [rowElement],
|
|
15801
15866
|
ascent,
|
|
15867
|
+
rowIndex: curRow.rowIndex + 1,
|
|
15802
15868
|
rowFlex: ((_g = elementList[i]) == null ? void 0 : _g.rowFlex) || ((_h = elementList[i + 1]) == null ? void 0 : _h.rowFlex),
|
|
15803
15869
|
isPageBreak: element.type === ElementType.PAGE_BREAK
|
|
15804
15870
|
};
|
|
@@ -16129,7 +16195,7 @@ class Draw {
|
|
|
16129
16195
|
_drawPage(payload) {
|
|
16130
16196
|
var _a, _b;
|
|
16131
16197
|
const { elementList, positionList, rowList, pageNo } = payload;
|
|
16132
|
-
const { inactiveAlpha, pageMode, header, footer, pageNumber } = this.options;
|
|
16198
|
+
const { inactiveAlpha, pageMode, header, footer, pageNumber, lineNumber } = this.options;
|
|
16133
16199
|
const innerWidth = this.getInnerWidth();
|
|
16134
16200
|
const ctx = this.ctxList[pageNo];
|
|
16135
16201
|
ctx.globalAlpha = !this.zone.isMainActive() ? inactiveAlpha : 1;
|
|
@@ -16177,6 +16243,9 @@ class Draw {
|
|
|
16177
16243
|
if (this.elementList.length <= 1 && !((_b = this.elementList[0]) == null ? void 0 : _b.listId)) {
|
|
16178
16244
|
this.placeholder.render(ctx);
|
|
16179
16245
|
}
|
|
16246
|
+
if (!lineNumber.disabled) {
|
|
16247
|
+
this.lineNumber.render(ctx, pageNo);
|
|
16248
|
+
}
|
|
16180
16249
|
}
|
|
16181
16250
|
_disconnectLazyRender() {
|
|
16182
16251
|
var _a;
|
|
@@ -16687,6 +16756,14 @@ const defaultTableOption = {
|
|
|
16687
16756
|
const defaultZoneOption = {
|
|
16688
16757
|
tipDisabled: true
|
|
16689
16758
|
};
|
|
16759
|
+
const defaultLineNumberOption = {
|
|
16760
|
+
size: 12,
|
|
16761
|
+
font: "Microsoft YaHei",
|
|
16762
|
+
color: "#000000",
|
|
16763
|
+
disabled: true,
|
|
16764
|
+
right: 20,
|
|
16765
|
+
type: LineNumberType.CONTINUITY
|
|
16766
|
+
};
|
|
16690
16767
|
function mergeOption(options = {}) {
|
|
16691
16768
|
const tableOptions = __spreadValues(__spreadValues({}, defaultTableOption), options.table);
|
|
16692
16769
|
const headerOptions = __spreadValues(__spreadValues({}, defaultHeaderOption), options.header);
|
|
@@ -16705,6 +16782,7 @@ function mergeOption(options = {}) {
|
|
|
16705
16782
|
const backgroundOptions = __spreadValues(__spreadValues({}, defaultBackground), options.background);
|
|
16706
16783
|
const lineBreakOptions = __spreadValues(__spreadValues({}, defaultLineBreak), options.lineBreak);
|
|
16707
16784
|
const separatorOptions = __spreadValues(__spreadValues({}, defaultSeparatorOption), options.separator);
|
|
16785
|
+
const lineNumberOptions = __spreadValues(__spreadValues({}, defaultLineNumberOption), options.lineNumber);
|
|
16708
16786
|
return __spreadProps(__spreadValues({
|
|
16709
16787
|
mode: EditorMode.EDIT,
|
|
16710
16788
|
defaultType: "TEXT",
|
|
@@ -16763,7 +16841,8 @@ function mergeOption(options = {}) {
|
|
|
16763
16841
|
zone: zoneOptions,
|
|
16764
16842
|
background: backgroundOptions,
|
|
16765
16843
|
lineBreak: lineBreakOptions,
|
|
16766
|
-
separator: separatorOptions
|
|
16844
|
+
separator: separatorOptions,
|
|
16845
|
+
lineNumber: lineNumberOptions
|
|
16767
16846
|
});
|
|
16768
16847
|
}
|
|
16769
16848
|
function printImageBase64(base64List, options) {
|
|
@@ -18909,16 +18988,16 @@ class CommandAdapt {
|
|
|
18909
18988
|
this.draw.getZone().setZone(zone2);
|
|
18910
18989
|
}
|
|
18911
18990
|
getControlValue(payload) {
|
|
18912
|
-
return this.draw.getControl().
|
|
18991
|
+
return this.draw.getControl().getValueById(payload);
|
|
18913
18992
|
}
|
|
18914
18993
|
setControlValue(payload) {
|
|
18915
|
-
this.draw.getControl().
|
|
18994
|
+
this.draw.getControl().setValueById(payload);
|
|
18916
18995
|
}
|
|
18917
18996
|
setControlExtension(payload) {
|
|
18918
|
-
this.draw.getControl().
|
|
18997
|
+
this.draw.getControl().setExtensionById(payload);
|
|
18919
18998
|
}
|
|
18920
18999
|
setControlProperties(payload) {
|
|
18921
|
-
this.draw.getControl().
|
|
19000
|
+
this.draw.getControl().setPropertiesById(payload);
|
|
18922
19001
|
}
|
|
18923
19002
|
setControlHighlight(payload) {
|
|
18924
19003
|
this.draw.getControl().setHighlightList(payload);
|
|
@@ -19788,7 +19867,9 @@ class ContextMenu {
|
|
|
19788
19867
|
const originalElementList = this.draw.getOriginalElementList();
|
|
19789
19868
|
const originTableElement = originalElementList[index2] || null;
|
|
19790
19869
|
if (originTableElement) {
|
|
19791
|
-
tableElement = zipElementList([originTableElement]
|
|
19870
|
+
tableElement = zipElementList([originTableElement], {
|
|
19871
|
+
extraPickAttrs: ["id"]
|
|
19872
|
+
})[0];
|
|
19792
19873
|
}
|
|
19793
19874
|
}
|
|
19794
19875
|
const isCrossRowCol = isTable && !!crossRowCol;
|
|
@@ -20287,5 +20368,5 @@ class Editor {
|
|
|
20287
20368
|
this.use = plugin.use.bind(plugin);
|
|
20288
20369
|
}
|
|
20289
20370
|
}
|
|
20290
|
-
export { BackgroundRepeat, BackgroundSize, BlockType, Command, ControlIndentation, ControlType, EDITOR_COMPONENT, Editor, EditorComponent, EditorMode, EditorZone, ElementType, INTERNAL_CONTEXT_MENU_KEY, ImageDisplay, KeyMap, LETTER_CLASS, ListStyle, ListType, MaxHeightRatio, NumberType, PageMode, PaperDirection, RenderMode, RowFlex, TableBorder, TdBorder, TdSlash, TextDecorationStyle, TitleLevel, VerticalAlign, WordBreak, Editor as default, splitText };
|
|
20371
|
+
export { BackgroundRepeat, BackgroundSize, BlockType, Command, ControlIndentation, ControlType, EDITOR_COMPONENT, Editor, EditorComponent, EditorMode, EditorZone, ElementType, INTERNAL_CONTEXT_MENU_KEY, ImageDisplay, KeyMap, LETTER_CLASS, LineNumberType, ListStyle, ListType, MaxHeightRatio, NumberType, PageMode, PaperDirection, RenderMode, RowFlex, TableBorder, TdBorder, TdSlash, TextDecorationStyle, TitleLevel, VerticalAlign, WordBreak, Editor as default, splitText };
|
|
20291
20372
|
//# sourceMappingURL=canvas-editor.es.js.map
|