@hufe921/canvas-editor 0.9.47 → 0.9.49
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 +37 -0
- package/dist/canvas-editor.es.js +268 -37
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +31 -31
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/command/Command.d.ts +2 -0
- package/dist/src/editor/core/command/CommandAdapt.d.ts +3 -0
- package/dist/src/editor/core/draw/Draw.d.ts +3 -0
- package/dist/src/editor/core/draw/control/Control.d.ts +3 -1
- package/dist/src/editor/core/draw/control/checkbox/CheckboxControl.d.ts +2 -2
- package/dist/src/editor/core/draw/control/select/SelectControl.d.ts +3 -3
- package/dist/src/editor/core/draw/control/text/TextControl.d.ts +3 -2
- package/dist/src/editor/core/draw/particle/TextParticle.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Common.d.ts +12 -0
- package/dist/src/editor/dataset/constant/Regular.d.ts +0 -2
- package/dist/src/editor/index.d.ts +2 -1
- package/dist/src/editor/interface/Control.d.ts +18 -0
- package/dist/src/editor/interface/Editor.d.ts +1 -0
- package/dist/src/editor/interface/Element.d.ts +1 -0
- package/dist/src/editor/interface/Row.d.ts +1 -0
- package/dist/src/editor/utils/index.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## [0.9.49](https://github.com/Hufe921/canvas-editor/compare/v0.9.48...v0.9.49) (2023-09-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* control minimum width when scaling ([05ddc2d](https://github.com/Hufe921/canvas-editor/commit/05ddc2db290e58a4ec0fb1b00ad5d64ce7f4cf3a))
|
|
7
|
+
* draw text element letter space error #282 ([c35f8ab](https://github.com/Hufe921/canvas-editor/commit/c35f8ab82c57849269a09fbad9d54d5085065d22)), closes [#282](https://github.com/Hufe921/canvas-editor/issues/282)
|
|
8
|
+
* omitObject function missing reference ([c45317e](https://github.com/Hufe921/canvas-editor/commit/c45317eced93e3d79129aea24776a8629d058050))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add set and get control value api #278 ([f754741](https://github.com/Hufe921/canvas-editor/commit/f754741f32de6c5d5c27d15dfc9fc31e284d29dc)), closes [#278](https://github.com/Hufe921/canvas-editor/issues/278)
|
|
14
|
+
* text element width #277 ([bb64626](https://github.com/Hufe921/canvas-editor/commit/bb646266b10897c3097ada5932f9b7cef317aebe)), closes [#277](https://github.com/Hufe921/canvas-editor/issues/277)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Performance Improvements
|
|
18
|
+
|
|
19
|
+
* adjusted the tab draw in the list style #283 ([fc0fdb2](https://github.com/Hufe921/canvas-editor/commit/fc0fdb2fe36966e3b8a51107d9929ca137e5681c)), closes [#283](https://github.com/Hufe921/canvas-editor/issues/283)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [0.9.48](https://github.com/Hufe921/canvas-editor/compare/v0.9.47...v0.9.48) (2023-09-09)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* control minimum width boundary ([05caccc](https://github.com/Hufe921/canvas-editor/commit/05caccc74c7d723f4ac357d161acf45364368f4b))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* add control minimum width option ([4b2bbfb](https://github.com/Hufe921/canvas-editor/commit/4b2bbfbe9a9bfe0fcad276dc16eb01b7015e6205))
|
|
34
|
+
* custom letter class #279 ([de76977](https://github.com/Hufe921/canvas-editor/commit/de769778c04266ed08c5721a01670cdbf0992d2b)), closes [#279](https://github.com/Hufe921/canvas-editor/issues/279)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
1
38
|
## [0.9.47](https://github.com/Hufe921/canvas-editor/compare/v0.9.46...v0.9.47) (2023-09-02)
|
|
2
39
|
|
|
3
40
|
|
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.49";
|
|
27
27
|
var MaxHeightRatio;
|
|
28
28
|
(function(MaxHeightRatio2) {
|
|
29
29
|
MaxHeightRatio2["HALF"] = "half";
|
|
@@ -60,6 +60,18 @@ const maxHeightRadioMapping = {
|
|
|
60
60
|
[MaxHeightRatio.ONE_THIRD]: 1 / 3,
|
|
61
61
|
[MaxHeightRatio.QUARTER]: 1 / 4
|
|
62
62
|
};
|
|
63
|
+
const LETTER_CLASS = {
|
|
64
|
+
ENGLISH: "A-Za-z",
|
|
65
|
+
SPANISH: "A-Za-z\xC1\xC9\xCD\xD3\xDA\xE1\xE9\xED\xF3\xFA\xD1\xF1\xDC\xFC",
|
|
66
|
+
FRENCH: "A-Za-z\xC0\xC2\xC7\xE0\xE2\xE7\xC9\xE9\xC8\xE8\xCA\xEA\xCB\xEB\xCE\xEE\xCF\xEF\xD4\xF4\xD9\xF9\xDB\xFB\u0178\xFF",
|
|
67
|
+
GERMAN: "A-Za-z\xC4\xE4\xD6\xF6\xDC\xFC\xDF",
|
|
68
|
+
RUSSIAN: "\u0410-\u042F\u0430-\u044F\u0401\u0451",
|
|
69
|
+
PORTUGUESE: "A-Za-z\xC1\xC9\xCD\xD3\xDA\xE1\xE9\xED\xF3\xFA\xC3\xD5\xE3\xF5\xC7\xE7",
|
|
70
|
+
ITALIAN: "A-Za-z\xC0\xE0\xC8\xE8\xC9\xE9\xCC\xEC\xCD\xED\xCE\xEE\xD3\xF3\xD2\xF2\xD9\xF9",
|
|
71
|
+
DUTCH: "A-Za-z\xC0\xE0\xC1\xE1\xC2\xE2\xC4\xE4\xC8\xE8\xC9\xE9\xCA\xEA\xCB\xEB\xCC\xEC\xCD\xED\xCE\xEE\xCF\xEF\xD3\xF3\xD2\xF2\xD4\xF4\xD6\xF6\xD9\xF9\xDB\xFB\xDC\xFC",
|
|
72
|
+
SWEDISH: "A-Za-z\xC5\xE5\xC4\xE4\xD6\xF6",
|
|
73
|
+
GREEK: "\u0391\u03B1\u0392\u03B2\u0393\u03B3\u0394\u03B4\u0395\u03B5\u0396\u03B6\u0397\u03B7\u0398\u03B8\u0399\u03B9\u039A\u03BA\u039B\u03BB\u039C\u03BC\u039D\u03BD\u039E\u03BE\u039F\u03BF\u03A0\u03C0\u03A1\u03C1\u03A3\u03C3\u03C2\u03A4\u03C4\u03A5\u03C5\u03A6\u03C6\u03A7\u03C7\u03A8\u03C8\u03A9\u03C9"
|
|
74
|
+
};
|
|
63
75
|
var RowFlex;
|
|
64
76
|
(function(RowFlex2) {
|
|
65
77
|
RowFlex2["LEFT"] = "left";
|
|
@@ -67,9 +79,7 @@ var RowFlex;
|
|
|
67
79
|
RowFlex2["RIGHT"] = "right";
|
|
68
80
|
RowFlex2["ALIGNMENT"] = "alignment";
|
|
69
81
|
})(RowFlex || (RowFlex = {}));
|
|
70
|
-
const LETTER_REG = /[a-zA-Z]/;
|
|
71
82
|
const NUMBER_LIKE_REG = /[0-9.]/;
|
|
72
|
-
const WORD_LIKE_REG = /[^a-zA-Z][a-zA-Z]/;
|
|
73
83
|
const SURROGATE_PAIR_REG = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;
|
|
74
84
|
const EMOJI_REG = /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
75
85
|
const UNICODE_SYMBOL_REG = new RegExp(`${EMOJI_REG.source}|${SURROGATE_PAIR_REG.source}`, "g");
|
|
@@ -247,14 +257,14 @@ function cloneProperty(properties, sourceElement, targetElement) {
|
|
|
247
257
|
}
|
|
248
258
|
}
|
|
249
259
|
}
|
|
250
|
-
function omitObject(object,
|
|
251
|
-
const
|
|
260
|
+
function omitObject(object, omitKeys) {
|
|
261
|
+
const newObject = {};
|
|
252
262
|
for (const key in object) {
|
|
253
|
-
if (
|
|
254
|
-
|
|
263
|
+
if (!omitKeys.includes(key)) {
|
|
264
|
+
newObject[key] = object[key];
|
|
255
265
|
}
|
|
256
266
|
}
|
|
257
|
-
return
|
|
267
|
+
return newObject;
|
|
258
268
|
}
|
|
259
269
|
function convertStringToBase64(input2) {
|
|
260
270
|
const encoder = new TextEncoder();
|
|
@@ -4909,10 +4919,10 @@ class CheckboxControl {
|
|
|
4909
4919
|
setValue() {
|
|
4910
4920
|
return -1;
|
|
4911
4921
|
}
|
|
4912
|
-
setSelect() {
|
|
4922
|
+
setSelect(context = {}) {
|
|
4913
4923
|
const { control } = this.element;
|
|
4914
|
-
const elementList = this.control.getElementList();
|
|
4915
|
-
const { startIndex } = this.control.getRange();
|
|
4924
|
+
const elementList = context.elementList || this.control.getElementList();
|
|
4925
|
+
const { startIndex } = context.range || this.control.getRange();
|
|
4916
4926
|
const startElement = elementList[startIndex];
|
|
4917
4927
|
const data2 = [];
|
|
4918
4928
|
let preIndex = startIndex;
|
|
@@ -5750,6 +5760,7 @@ function drop(evt, host) {
|
|
|
5750
5760
|
}
|
|
5751
5761
|
function dblclick(host, evt) {
|
|
5752
5762
|
const draw = host.getDraw();
|
|
5763
|
+
const LETTER_REG = draw.getLetterReg();
|
|
5753
5764
|
const position = draw.getPosition();
|
|
5754
5765
|
if (draw.getIsPagingMode()) {
|
|
5755
5766
|
const positionContext = position.getPositionByXY({
|
|
@@ -6317,6 +6328,9 @@ class Position {
|
|
|
6317
6328
|
const element = curRow.elementList[j];
|
|
6318
6329
|
const metrics = element.metrics;
|
|
6319
6330
|
const offsetY = element.imgDisplay !== ImageDisplay.INLINE && element.type === ElementType.IMAGE || element.type === ElementType.LATEX ? curRow.ascent - metrics.height : curRow.ascent;
|
|
6331
|
+
if (element.left) {
|
|
6332
|
+
x += element.left;
|
|
6333
|
+
}
|
|
6320
6334
|
const positionItem = {
|
|
6321
6335
|
pageNo,
|
|
6322
6336
|
index: index2,
|
|
@@ -6324,6 +6338,7 @@ class Position {
|
|
|
6324
6338
|
rowIndex: startRowIndex + i,
|
|
6325
6339
|
rowNo: i,
|
|
6326
6340
|
metrics,
|
|
6341
|
+
left: element.left || 0,
|
|
6327
6342
|
ascent: offsetY,
|
|
6328
6343
|
lineHeight: curRow.height,
|
|
6329
6344
|
isFirstLetter: j === 0,
|
|
@@ -6437,10 +6452,10 @@ class Position {
|
|
|
6437
6452
|
const isMainActive = zoneManager.isMainActive();
|
|
6438
6453
|
const positionNo = isMainActive ? curPageNo : 0;
|
|
6439
6454
|
for (let j = 0; j < positionList.length; j++) {
|
|
6440
|
-
const { index: index2, pageNo, isFirstLetter, coordinate: { leftTop, rightTop, leftBottom } } = positionList[j];
|
|
6455
|
+
const { index: index2, pageNo, left, isFirstLetter, coordinate: { leftTop, rightTop, leftBottom } } = positionList[j];
|
|
6441
6456
|
if (positionNo !== pageNo)
|
|
6442
6457
|
continue;
|
|
6443
|
-
if (leftTop[0] <= x && rightTop[0] >= x && leftTop[1] <= y && leftBottom[1] >= y) {
|
|
6458
|
+
if (leftTop[0] - left <= x && rightTop[0] >= x && leftTop[1] <= y && leftBottom[1] >= y) {
|
|
6444
6459
|
let curPositionIndex2 = j;
|
|
6445
6460
|
const element = elementList[j];
|
|
6446
6461
|
if (element.type === ElementType.TABLE) {
|
|
@@ -6880,7 +6895,10 @@ class RangeManager {
|
|
|
6880
6895
|
const size = curElement.size || this.options.defaultSize;
|
|
6881
6896
|
const bold = !~curElementList.findIndex((el) => !el.bold);
|
|
6882
6897
|
const italic = !~curElementList.findIndex((el) => !el.italic);
|
|
6883
|
-
const underline = !~curElementList.findIndex((el) =>
|
|
6898
|
+
const underline = !~curElementList.findIndex((el) => {
|
|
6899
|
+
var _a;
|
|
6900
|
+
return !el.underline && !((_a = el.control) == null ? void 0 : _a.underline);
|
|
6901
|
+
});
|
|
6884
6902
|
const strikeout = !~curElementList.findIndex((el) => !el.strikeout);
|
|
6885
6903
|
const color = curElement.color || null;
|
|
6886
6904
|
const highlight = curElement.highlight || null;
|
|
@@ -7074,6 +7092,7 @@ class AbstractRichText {
|
|
|
7074
7092
|
if (!isFirstRecord && this.fillColor && this.fillColor !== color) {
|
|
7075
7093
|
this.render(ctx);
|
|
7076
7094
|
this.clearFillInfo();
|
|
7095
|
+
this.recordFillInfo(ctx, x, y, width, height, color);
|
|
7077
7096
|
return;
|
|
7078
7097
|
}
|
|
7079
7098
|
if (isFirstRecord) {
|
|
@@ -7437,6 +7456,7 @@ class Underline extends AbstractRichText {
|
|
|
7437
7456
|
}
|
|
7438
7457
|
class TextParticle {
|
|
7439
7458
|
constructor(draw) {
|
|
7459
|
+
__publicField(this, "draw");
|
|
7440
7460
|
__publicField(this, "ctx");
|
|
7441
7461
|
__publicField(this, "curX");
|
|
7442
7462
|
__publicField(this, "curY");
|
|
@@ -7444,6 +7464,7 @@ class TextParticle {
|
|
|
7444
7464
|
__publicField(this, "curStyle");
|
|
7445
7465
|
__publicField(this, "curColor");
|
|
7446
7466
|
__publicField(this, "cacheMeasureText");
|
|
7467
|
+
this.draw = draw;
|
|
7447
7468
|
this.ctx = draw.getCtx();
|
|
7448
7469
|
this.curX = -1;
|
|
7449
7470
|
this.curY = -1;
|
|
@@ -7452,6 +7473,7 @@ class TextParticle {
|
|
|
7452
7473
|
this.cacheMeasureText = new Map();
|
|
7453
7474
|
}
|
|
7454
7475
|
measureWord(ctx, elementList, curIndex) {
|
|
7476
|
+
const LETTER_REG = this.draw.getLetterReg();
|
|
7455
7477
|
let width = 0;
|
|
7456
7478
|
let endElement = elementList[curIndex];
|
|
7457
7479
|
let i = curIndex;
|
|
@@ -7475,6 +7497,18 @@ class TextParticle {
|
|
|
7475
7497
|
return this.measureText(ctx, element).width;
|
|
7476
7498
|
}
|
|
7477
7499
|
measureText(ctx, element) {
|
|
7500
|
+
if (element.width) {
|
|
7501
|
+
const textMetrics2 = ctx.measureText(element.value);
|
|
7502
|
+
return {
|
|
7503
|
+
width: element.width,
|
|
7504
|
+
actualBoundingBoxAscent: textMetrics2.actualBoundingBoxAscent,
|
|
7505
|
+
actualBoundingBoxDescent: textMetrics2.actualBoundingBoxDescent,
|
|
7506
|
+
actualBoundingBoxLeft: textMetrics2.actualBoundingBoxLeft,
|
|
7507
|
+
actualBoundingBoxRight: textMetrics2.actualBoundingBoxRight,
|
|
7508
|
+
fontBoundingBoxAscent: textMetrics2.fontBoundingBoxAscent,
|
|
7509
|
+
fontBoundingBoxDescent: textMetrics2.fontBoundingBoxDescent
|
|
7510
|
+
};
|
|
7511
|
+
}
|
|
7478
7512
|
const id = `${element.value}${ctx.font}`;
|
|
7479
7513
|
const cacheTextMetrics = this.cacheMeasureText.get(id);
|
|
7480
7514
|
if (cacheTextMetrics) {
|
|
@@ -8640,9 +8674,9 @@ class SelectControl {
|
|
|
8640
8674
|
}
|
|
8641
8675
|
return this.clearSelect();
|
|
8642
8676
|
}
|
|
8643
|
-
clearSelect() {
|
|
8644
|
-
const elementList = this.control.getElementList();
|
|
8645
|
-
const { startIndex } = this.control.getRange();
|
|
8677
|
+
clearSelect(context = {}) {
|
|
8678
|
+
const elementList = context.elementList || this.control.getElementList();
|
|
8679
|
+
const { startIndex } = context.range || this.control.getRange();
|
|
8646
8680
|
const startElement = elementList[startIndex];
|
|
8647
8681
|
let leftIndex = -1;
|
|
8648
8682
|
let rightIndex = -1;
|
|
@@ -8672,7 +8706,7 @@ class SelectControl {
|
|
|
8672
8706
|
this.element.control.code = null;
|
|
8673
8707
|
return preIndex;
|
|
8674
8708
|
}
|
|
8675
|
-
setSelect(code) {
|
|
8709
|
+
setSelect(code, context = {}) {
|
|
8676
8710
|
const control = this.element.control;
|
|
8677
8711
|
const valueSets = control.valueSets;
|
|
8678
8712
|
if (!Array.isArray(valueSets) || !valueSets.length)
|
|
@@ -8680,9 +8714,9 @@ class SelectControl {
|
|
|
8680
8714
|
const valueSet = valueSets.find((v) => v.code === code);
|
|
8681
8715
|
if (!valueSet)
|
|
8682
8716
|
return;
|
|
8683
|
-
const startIndex = this.clearSelect();
|
|
8717
|
+
const startIndex = this.clearSelect(context);
|
|
8684
8718
|
this.control.removePlaceholder(startIndex);
|
|
8685
|
-
const elementList = this.control.getElementList();
|
|
8719
|
+
const elementList = context.elementList || this.control.getElementList();
|
|
8686
8720
|
const startElement = elementList[startIndex];
|
|
8687
8721
|
const anchorElement = startElement.controlComponent === ControlComponent.PREFIX ? omitObject(startElement, EDITOR_ELEMENT_STYLE_ATTR) : startElement;
|
|
8688
8722
|
const start = startIndex + 1;
|
|
@@ -8696,10 +8730,12 @@ class SelectControl {
|
|
|
8696
8730
|
formatElementContext(elementList, [newElement], startIndex);
|
|
8697
8731
|
draw.spliceElementList(elementList, start + i, 0, newElement);
|
|
8698
8732
|
}
|
|
8699
|
-
const newIndex = start + data2.length - 1;
|
|
8700
|
-
this.control.repaintControl(newIndex);
|
|
8701
8733
|
this.element.control.code = code;
|
|
8702
|
-
|
|
8734
|
+
if (!context.range) {
|
|
8735
|
+
const newIndex = start + data2.length - 1;
|
|
8736
|
+
this.control.repaintControl(newIndex);
|
|
8737
|
+
this.destroy();
|
|
8738
|
+
}
|
|
8703
8739
|
}
|
|
8704
8740
|
_createSelectPopupDom() {
|
|
8705
8741
|
const control = this.element.control;
|
|
@@ -8794,9 +8830,9 @@ class TextControl {
|
|
|
8794
8830
|
}
|
|
8795
8831
|
return data2;
|
|
8796
8832
|
}
|
|
8797
|
-
setValue(data2) {
|
|
8798
|
-
const elementList = this.control.getElementList();
|
|
8799
|
-
const range = this.control.getRange();
|
|
8833
|
+
setValue(data2, context = {}) {
|
|
8834
|
+
const elementList = context.elementList || this.control.getElementList();
|
|
8835
|
+
const range = context.range || this.control.getRange();
|
|
8800
8836
|
this.control.shrinkBoundary();
|
|
8801
8837
|
const { startIndex, endIndex } = range;
|
|
8802
8838
|
const draw = this.control.getDraw();
|
|
@@ -8817,6 +8853,17 @@ class TextControl {
|
|
|
8817
8853
|
}
|
|
8818
8854
|
return start + data2.length - 1;
|
|
8819
8855
|
}
|
|
8856
|
+
clearValue(context = {}) {
|
|
8857
|
+
const elementList = context.elementList || this.control.getElementList();
|
|
8858
|
+
const range = context.range || this.control.getRange();
|
|
8859
|
+
const { startIndex, endIndex } = range;
|
|
8860
|
+
this.control.getDraw().spliceElementList(elementList, startIndex + 1, endIndex - startIndex);
|
|
8861
|
+
const value = this.getValue();
|
|
8862
|
+
if (!value.length) {
|
|
8863
|
+
this.control.addPlaceholder(startIndex);
|
|
8864
|
+
}
|
|
8865
|
+
return startIndex;
|
|
8866
|
+
}
|
|
8820
8867
|
keydown(evt) {
|
|
8821
8868
|
const elementList = this.control.getElementList();
|
|
8822
8869
|
const range = this.control.getRange();
|
|
@@ -8907,8 +8954,10 @@ class Control {
|
|
|
8907
8954
|
const editorDataKeys = ["header", "main", "footer"];
|
|
8908
8955
|
editorDataKeys.forEach((key) => {
|
|
8909
8956
|
payload[key] = payload[key].filter((element) => {
|
|
8910
|
-
|
|
8957
|
+
var _a;
|
|
8958
|
+
if (element.type !== ElementType.CONTROL || ((_a = element.control) == null ? void 0 : _a.minWidth)) {
|
|
8911
8959
|
return true;
|
|
8960
|
+
}
|
|
8912
8961
|
return element.controlComponent !== ControlComponent.PREFIX && element.controlComponent !== ControlComponent.POSTFIX && element.controlComponent !== ControlComponent.PLACEHOLDER;
|
|
8913
8962
|
});
|
|
8914
8963
|
});
|
|
@@ -9193,6 +9242,135 @@ class Control {
|
|
|
9193
9242
|
}
|
|
9194
9243
|
return this.activeControl.cut();
|
|
9195
9244
|
}
|
|
9245
|
+
getValueByConceptId(payload) {
|
|
9246
|
+
var _a;
|
|
9247
|
+
const { conceptId } = payload;
|
|
9248
|
+
const elementList = [
|
|
9249
|
+
...this.draw.getHeaderElementList(),
|
|
9250
|
+
...this.draw.getOriginalMainElementList(),
|
|
9251
|
+
...this.draw.getFooterElementList()
|
|
9252
|
+
];
|
|
9253
|
+
const result = [];
|
|
9254
|
+
let i = 0;
|
|
9255
|
+
while (i < elementList.length) {
|
|
9256
|
+
const element = elementList[i];
|
|
9257
|
+
i++;
|
|
9258
|
+
if (((_a = element == null ? void 0 : element.control) == null ? void 0 : _a.conceptId) !== conceptId)
|
|
9259
|
+
continue;
|
|
9260
|
+
const { type, code, valueSets } = element.control;
|
|
9261
|
+
let j = i;
|
|
9262
|
+
let textControlValue = "";
|
|
9263
|
+
while (j < elementList.length) {
|
|
9264
|
+
const nextElement = elementList[j];
|
|
9265
|
+
if (nextElement.controlId !== element.controlId)
|
|
9266
|
+
break;
|
|
9267
|
+
if (type === ControlType.TEXT && nextElement.controlComponent === ControlComponent.VALUE) {
|
|
9268
|
+
textControlValue += nextElement.value;
|
|
9269
|
+
}
|
|
9270
|
+
j++;
|
|
9271
|
+
}
|
|
9272
|
+
if (type === ControlType.TEXT) {
|
|
9273
|
+
result.push({
|
|
9274
|
+
value: textControlValue || null,
|
|
9275
|
+
innerText: textControlValue || null
|
|
9276
|
+
});
|
|
9277
|
+
} else if (type === ControlType.SELECT || type === ControlType.CHECKBOX) {
|
|
9278
|
+
const innerText = code == null ? void 0 : code.split(",").map((selectCode) => {
|
|
9279
|
+
var _a2;
|
|
9280
|
+
return (_a2 = valueSets == null ? void 0 : valueSets.find((valueSet) => valueSet.code === selectCode)) == null ? void 0 : _a2.value;
|
|
9281
|
+
}).filter(Boolean).join("");
|
|
9282
|
+
result.push({
|
|
9283
|
+
value: code || null,
|
|
9284
|
+
innerText: innerText || null
|
|
9285
|
+
});
|
|
9286
|
+
}
|
|
9287
|
+
i = j;
|
|
9288
|
+
}
|
|
9289
|
+
return result;
|
|
9290
|
+
}
|
|
9291
|
+
setValueByConceptId(payload) {
|
|
9292
|
+
var _a;
|
|
9293
|
+
const isReadonly = this.draw.isReadonly();
|
|
9294
|
+
if (isReadonly)
|
|
9295
|
+
return;
|
|
9296
|
+
let isExistSet = false;
|
|
9297
|
+
const { conceptId, value } = payload;
|
|
9298
|
+
const data2 = [
|
|
9299
|
+
this.draw.getHeaderElementList(),
|
|
9300
|
+
this.draw.getOriginalMainElementList(),
|
|
9301
|
+
this.draw.getFooterElementList()
|
|
9302
|
+
];
|
|
9303
|
+
for (const elementList of data2) {
|
|
9304
|
+
let i = 0;
|
|
9305
|
+
while (i < elementList.length) {
|
|
9306
|
+
const element = elementList[i];
|
|
9307
|
+
i++;
|
|
9308
|
+
if (((_a = element == null ? void 0 : element.control) == null ? void 0 : _a.conceptId) !== conceptId)
|
|
9309
|
+
continue;
|
|
9310
|
+
isExistSet = true;
|
|
9311
|
+
const { type } = element.control;
|
|
9312
|
+
let currentEndIndex = i;
|
|
9313
|
+
while (currentEndIndex < elementList.length) {
|
|
9314
|
+
const nextElement = elementList[currentEndIndex];
|
|
9315
|
+
if (nextElement.controlId !== element.controlId)
|
|
9316
|
+
break;
|
|
9317
|
+
currentEndIndex++;
|
|
9318
|
+
}
|
|
9319
|
+
const fakeRange = {
|
|
9320
|
+
startIndex: i - 1,
|
|
9321
|
+
endIndex: currentEndIndex - 2
|
|
9322
|
+
};
|
|
9323
|
+
const controlContext = {
|
|
9324
|
+
range: fakeRange,
|
|
9325
|
+
elementList
|
|
9326
|
+
};
|
|
9327
|
+
if (type === ControlType.TEXT) {
|
|
9328
|
+
const formatValue = [{ value }];
|
|
9329
|
+
formatElementList(formatValue, {
|
|
9330
|
+
isHandleFirstElement: false,
|
|
9331
|
+
editorOptions: this.draw.getOptions()
|
|
9332
|
+
});
|
|
9333
|
+
const text = new TextControl(element, this);
|
|
9334
|
+
if (value) {
|
|
9335
|
+
text.setValue(formatValue, controlContext);
|
|
9336
|
+
} else {
|
|
9337
|
+
text.clearValue(controlContext);
|
|
9338
|
+
}
|
|
9339
|
+
} else if (type === ControlType.SELECT) {
|
|
9340
|
+
const select = new SelectControl(element, this);
|
|
9341
|
+
if (value) {
|
|
9342
|
+
select.setSelect(value, controlContext);
|
|
9343
|
+
} else {
|
|
9344
|
+
select.clearSelect(controlContext);
|
|
9345
|
+
}
|
|
9346
|
+
} else if (type === ControlType.CHECKBOX) {
|
|
9347
|
+
const checkbox = new CheckboxControl(element, this);
|
|
9348
|
+
const checkboxElementList = elementList.slice(fakeRange.startIndex + 1, fakeRange.endIndex + 1);
|
|
9349
|
+
const codes = (value == null ? void 0 : value.split(",")) || [];
|
|
9350
|
+
for (const checkElement of checkboxElementList) {
|
|
9351
|
+
if (checkElement.controlComponent === ControlComponent.CHECKBOX) {
|
|
9352
|
+
const checkboxItem = checkElement.checkbox;
|
|
9353
|
+
checkboxItem.value = codes.includes(checkboxItem.code);
|
|
9354
|
+
}
|
|
9355
|
+
}
|
|
9356
|
+
checkbox.setSelect(controlContext);
|
|
9357
|
+
}
|
|
9358
|
+
let newEndIndex = i;
|
|
9359
|
+
while (newEndIndex < elementList.length) {
|
|
9360
|
+
const nextElement = elementList[newEndIndex];
|
|
9361
|
+
if (nextElement.controlId !== element.controlId)
|
|
9362
|
+
break;
|
|
9363
|
+
newEndIndex++;
|
|
9364
|
+
}
|
|
9365
|
+
i = newEndIndex;
|
|
9366
|
+
}
|
|
9367
|
+
}
|
|
9368
|
+
if (isExistSet) {
|
|
9369
|
+
this.draw.render({
|
|
9370
|
+
isSetCursor: false
|
|
9371
|
+
});
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9196
9374
|
}
|
|
9197
9375
|
class CheckboxParticle {
|
|
9198
9376
|
constructor(draw) {
|
|
@@ -10816,6 +10994,14 @@ class ListParticle {
|
|
|
10816
10994
|
const startElement = elementList[0];
|
|
10817
10995
|
if (startElement.value !== ZERO || startElement.listWrap)
|
|
10818
10996
|
return;
|
|
10997
|
+
let tabWidth = 0;
|
|
10998
|
+
const { defaultTabWidth, scale, defaultFont, defaultSize } = this.options;
|
|
10999
|
+
for (let i = 1; i < elementList.length; i++) {
|
|
11000
|
+
const element = elementList[i];
|
|
11001
|
+
if ((element == null ? void 0 : element.type) !== ElementType.TAB)
|
|
11002
|
+
break;
|
|
11003
|
+
tabWidth += defaultTabWidth * scale;
|
|
11004
|
+
}
|
|
10819
11005
|
let text = "";
|
|
10820
11006
|
if (startElement.listType === ListType.UL) {
|
|
10821
11007
|
text = ulStyleMapping[startElement.listStyle] || ulStyleMapping[UlStyle.DISC];
|
|
@@ -10825,9 +11011,8 @@ class ListParticle {
|
|
|
10825
11011
|
if (!text)
|
|
10826
11012
|
return;
|
|
10827
11013
|
const { coordinate: { leftTop: [startX, startY] } } = position;
|
|
10828
|
-
const x = startX - offsetX;
|
|
11014
|
+
const x = startX - offsetX + tabWidth;
|
|
10829
11015
|
const y = startY + ascent;
|
|
10830
|
-
const { defaultFont, defaultSize, scale } = this.options;
|
|
10831
11016
|
ctx.save();
|
|
10832
11017
|
ctx.font = `${defaultSize * scale}px ${defaultFont}`;
|
|
10833
11018
|
ctx.fillText(text, x, y);
|
|
@@ -11125,6 +11310,8 @@ class Draw {
|
|
|
11125
11310
|
__publicField(this, "scrollObserver");
|
|
11126
11311
|
__publicField(this, "selectionObserver");
|
|
11127
11312
|
__publicField(this, "imageObserver");
|
|
11313
|
+
__publicField(this, "LETTER_REG");
|
|
11314
|
+
__publicField(this, "WORD_LIKE_REG");
|
|
11128
11315
|
__publicField(this, "rowList");
|
|
11129
11316
|
__publicField(this, "pageRowList");
|
|
11130
11317
|
__publicField(this, "painterStyle");
|
|
@@ -11189,6 +11376,9 @@ class Draw {
|
|
|
11189
11376
|
this.globalEvent = new GlobalEvent(this, this.canvasEvent);
|
|
11190
11377
|
this.globalEvent.register();
|
|
11191
11378
|
this.workerManager = new WorkerManager(this);
|
|
11379
|
+
const { letterClass } = options;
|
|
11380
|
+
this.LETTER_REG = new RegExp(`[${letterClass.join("")}]`);
|
|
11381
|
+
this.WORD_LIKE_REG = new RegExp(`${letterClass.map((letter) => `[^${letter}][${letter}]`).join("|")}`);
|
|
11192
11382
|
this.rowList = [];
|
|
11193
11383
|
this.pageRowList = [];
|
|
11194
11384
|
this.painterStyle = null;
|
|
@@ -11202,6 +11392,9 @@ class Draw {
|
|
|
11202
11392
|
isSetCursor: false
|
|
11203
11393
|
});
|
|
11204
11394
|
}
|
|
11395
|
+
getLetterReg() {
|
|
11396
|
+
return this.LETTER_REG;
|
|
11397
|
+
}
|
|
11205
11398
|
getMode() {
|
|
11206
11399
|
return this.mode;
|
|
11207
11400
|
}
|
|
@@ -11837,7 +12030,7 @@ class Draw {
|
|
|
11837
12030
|
return `${el.italic ? "italic " : ""}${el.bold ? "bold " : ""}${size * scale}px ${font}`;
|
|
11838
12031
|
}
|
|
11839
12032
|
computeRowList(innerWidth, elementList) {
|
|
11840
|
-
var _a, _b, _c, _d;
|
|
12033
|
+
var _a, _b, _c, _d, _e;
|
|
11841
12034
|
const { defaultSize, defaultRowMargin, scale, tdPadding, defaultTabWidth } = this.options;
|
|
11842
12035
|
const defaultBasicRowMarginHeight = this.getDefaultBasicRowMarginHeight();
|
|
11843
12036
|
const canvas = document.createElement("canvas");
|
|
@@ -11856,6 +12049,7 @@ class Draw {
|
|
|
11856
12049
|
}
|
|
11857
12050
|
let listId;
|
|
11858
12051
|
let listIndex = 0;
|
|
12052
|
+
let controlRealWidth = 0;
|
|
11859
12053
|
for (let i = 0; i < elementList.length; i++) {
|
|
11860
12054
|
const curRow = rowList[rowList.length - 1];
|
|
11861
12055
|
const element = elementList[i];
|
|
@@ -12062,13 +12256,30 @@ class Draw {
|
|
|
12062
12256
|
metrics,
|
|
12063
12257
|
style: this._getFont(element, scale)
|
|
12064
12258
|
});
|
|
12259
|
+
if ((_d = rowElement.control) == null ? void 0 : _d.minWidth) {
|
|
12260
|
+
if (rowElement.controlComponent) {
|
|
12261
|
+
controlRealWidth += metrics.width;
|
|
12262
|
+
}
|
|
12263
|
+
if (rowElement.controlComponent === ControlComponent.POSTFIX) {
|
|
12264
|
+
const extraWidth = rowElement.control.minWidth - controlRealWidth;
|
|
12265
|
+
if (extraWidth > 0) {
|
|
12266
|
+
const rowRemainingWidth = availableWidth - curRow.width - metrics.width;
|
|
12267
|
+
const left = Math.min(rowRemainingWidth, extraWidth) * scale;
|
|
12268
|
+
rowElement.left = left;
|
|
12269
|
+
curRow.width += left;
|
|
12270
|
+
} else {
|
|
12271
|
+
rowElement.left = 0;
|
|
12272
|
+
}
|
|
12273
|
+
controlRealWidth = 0;
|
|
12274
|
+
}
|
|
12275
|
+
}
|
|
12065
12276
|
const preElement = elementList[i - 1];
|
|
12066
12277
|
let nextElement = elementList[i + 1];
|
|
12067
12278
|
let curRowWidth = curRow.width + metrics.width;
|
|
12068
12279
|
if (this.options.wordBreak === WordBreak.BREAK_WORD) {
|
|
12069
12280
|
if ((!(preElement == null ? void 0 : preElement.type) || (preElement == null ? void 0 : preElement.type) === ElementType.TEXT) && (!element.type || element.type === ElementType.TEXT)) {
|
|
12070
12281
|
const word = `${(preElement == null ? void 0 : preElement.value) || ""}${element.value}`;
|
|
12071
|
-
if (WORD_LIKE_REG.test(word)) {
|
|
12282
|
+
if (this.WORD_LIKE_REG.test(word)) {
|
|
12072
12283
|
const { width, endElement } = this.textParticle.measureWord(ctx, elementList, i);
|
|
12073
12284
|
curRowWidth += width;
|
|
12074
12285
|
nextElement = endElement;
|
|
@@ -12102,7 +12313,7 @@ class Draw {
|
|
|
12102
12313
|
startIndex: i,
|
|
12103
12314
|
elementList: [rowElement],
|
|
12104
12315
|
ascent,
|
|
12105
|
-
rowFlex: (
|
|
12316
|
+
rowFlex: (_e = elementList[i + 1]) == null ? void 0 : _e.rowFlex,
|
|
12106
12317
|
isPageBreak: element.type === ElementType.PAGE_BREAK
|
|
12107
12318
|
};
|
|
12108
12319
|
if (element.listId) {
|
|
@@ -12167,6 +12378,7 @@ class Draw {
|
|
|
12167
12378
|
this.textParticle.complete();
|
|
12168
12379
|
}
|
|
12169
12380
|
drawRow(ctx, payload) {
|
|
12381
|
+
var _a, _b;
|
|
12170
12382
|
const { rowList, pageNo, elementList, positionList, startIndex, zone } = payload;
|
|
12171
12383
|
const isPrintMode = this.mode === EditorMode.PRINT;
|
|
12172
12384
|
const { scale, tdPadding, defaultBasicRowMarginHeight, defaultRowMargin, group: group2 } = this.options;
|
|
@@ -12238,11 +12450,16 @@ class Draw {
|
|
|
12238
12450
|
this.blockParticle.render(pageNo, element, x, y);
|
|
12239
12451
|
} else {
|
|
12240
12452
|
this.textParticle.record(ctx, element, x, y + offsetY);
|
|
12453
|
+
if (element.width || element.letterSpacing) {
|
|
12454
|
+
this.textParticle.complete();
|
|
12455
|
+
}
|
|
12241
12456
|
}
|
|
12242
|
-
if (element.underline) {
|
|
12457
|
+
if (element.underline || ((_a = element.control) == null ? void 0 : _a.underline)) {
|
|
12243
12458
|
const rowMargin = defaultBasicRowMarginHeight * (element.rowMargin || defaultRowMargin) * scale;
|
|
12244
|
-
|
|
12245
|
-
|
|
12459
|
+
const left = element.left || 0;
|
|
12460
|
+
const color = element.controlComponent === ControlComponent.PLACEHOLDER ? void 0 : element.color;
|
|
12461
|
+
this.underline.recordFillInfo(ctx, x - left, y + curRow.height - rowMargin, metrics.width + left, 0, color);
|
|
12462
|
+
} else if ((preElement == null ? void 0 : preElement.underline) || ((_b = preElement == null ? void 0 : preElement.control) == null ? void 0 : _b.underline)) {
|
|
12246
12463
|
this.underline.render(ctx);
|
|
12247
12464
|
}
|
|
12248
12465
|
if (element.strikeout) {
|
|
@@ -12594,6 +12811,7 @@ class Command {
|
|
|
12594
12811
|
__publicField(this, "executeSetGroup");
|
|
12595
12812
|
__publicField(this, "executeDeleteGroup");
|
|
12596
12813
|
__publicField(this, "executeLocationGroup");
|
|
12814
|
+
__publicField(this, "executeSetControlValue");
|
|
12597
12815
|
__publicField(this, "getCatalog");
|
|
12598
12816
|
__publicField(this, "getImage");
|
|
12599
12817
|
__publicField(this, "getOptions");
|
|
@@ -12609,6 +12827,7 @@ class Command {
|
|
|
12609
12827
|
__publicField(this, "getSearchNavigateInfo");
|
|
12610
12828
|
__publicField(this, "getLocale");
|
|
12611
12829
|
__publicField(this, "getGroupIds");
|
|
12830
|
+
__publicField(this, "getControlValue");
|
|
12612
12831
|
this.executeMode = adapt.mode.bind(adapt);
|
|
12613
12832
|
this.executeCut = adapt.cut.bind(adapt);
|
|
12614
12833
|
this.executeCopy = adapt.copy.bind(adapt);
|
|
@@ -12703,6 +12922,8 @@ class Command {
|
|
|
12703
12922
|
this.getSearchNavigateInfo = adapt.getSearchNavigateInfo.bind(adapt);
|
|
12704
12923
|
this.getLocale = adapt.getLocale.bind(adapt);
|
|
12705
12924
|
this.getGroupIds = adapt.getGroupIds.bind(adapt);
|
|
12925
|
+
this.executeSetControlValue = adapt.setControlValue.bind(adapt);
|
|
12926
|
+
this.getControlValue = adapt.getControlValue.bind(adapt);
|
|
12706
12927
|
}
|
|
12707
12928
|
}
|
|
12708
12929
|
const defaultWatermarkOption = {
|
|
@@ -14537,6 +14758,15 @@ class CommandAdapt {
|
|
|
14537
14758
|
isSubmitHistory: false
|
|
14538
14759
|
});
|
|
14539
14760
|
}
|
|
14761
|
+
getControlValue(payload) {
|
|
14762
|
+
return this.draw.getControl().getValueByConceptId(payload);
|
|
14763
|
+
}
|
|
14764
|
+
setControlValue(payload) {
|
|
14765
|
+
const isReadonly = this.draw.isReadonly();
|
|
14766
|
+
if (isReadonly)
|
|
14767
|
+
return;
|
|
14768
|
+
this.draw.getControl().setValueByConceptId(payload);
|
|
14769
|
+
}
|
|
14540
14770
|
}
|
|
14541
14771
|
class Listener {
|
|
14542
14772
|
constructor() {
|
|
@@ -15515,7 +15745,8 @@ class Editor {
|
|
|
15515
15745
|
historyMaxRecordCount: 100,
|
|
15516
15746
|
wordBreak: WordBreak.BREAK_WORD,
|
|
15517
15747
|
printPixelRatio: 3,
|
|
15518
|
-
maskMargin: [0, 0, 0, 0]
|
|
15748
|
+
maskMargin: [0, 0, 0, 0],
|
|
15749
|
+
letterClass: [LETTER_CLASS.ENGLISH]
|
|
15519
15750
|
}, options), {
|
|
15520
15751
|
header: headerOptions,
|
|
15521
15752
|
footer: footerOptions,
|
|
@@ -15574,5 +15805,5 @@ class Editor {
|
|
|
15574
15805
|
this.use = plugin.use.bind(plugin);
|
|
15575
15806
|
}
|
|
15576
15807
|
}
|
|
15577
|
-
export { BlockType, Command, ControlType, EDITOR_COMPONENT, Editor, EditorComponent, EditorMode, EditorZone, ElementType, ImageDisplay, KeyMap, ListStyle, ListType, MaxHeightRatio, NumberType, PageMode, PaperDirection, RowFlex, TableBorder, TdBorder, TitleLevel, VerticalAlign, WordBreak, Editor as default };
|
|
15808
|
+
export { BlockType, Command, ControlType, EDITOR_COMPONENT, Editor, EditorComponent, EditorMode, EditorZone, ElementType, ImageDisplay, KeyMap, LETTER_CLASS, ListStyle, ListType, MaxHeightRatio, NumberType, PageMode, PaperDirection, RowFlex, TableBorder, TdBorder, TitleLevel, VerticalAlign, WordBreak, Editor as default };
|
|
15578
15809
|
//# sourceMappingURL=canvas-editor.es.js.map
|