bp-aicc-editor 1.0.0

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.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.EN.md +129 -0
  3. package/README.md +133 -0
  4. package/lib/accounting-BdNhlOvc.js +150 -0
  5. package/lib/arrow-right-ZYLcC6uE.js +24 -0
  6. package/lib/atlas-Dqnvg58g.js +27 -0
  7. package/lib/blueprint-7yYCtfFC.js +28 -0
  8. package/lib/border-box-BoVwKoLu.js +226 -0
  9. package/lib/browser_upgrade/chrome.png +0 -0
  10. package/lib/browser_upgrade/edge.png +0 -0
  11. package/lib/browser_upgrade/index.css +49 -0
  12. package/lib/btn-group-aVjYHP70.js +125 -0
  13. package/lib/btn-return-KOGYYoba.js +37 -0
  14. package/lib/button-base-CUvUtpPb.js +42 -0
  15. package/lib/cache-Cs2VtqJi.js +43 -0
  16. package/lib/capitalize-CJ7zhOsJ.js +46 -0
  17. package/lib/carousel-table-hn7W3uoD.js +163 -0
  18. package/lib/children-manager-CdxNQ6Oe.js +457 -0
  19. package/lib/circle-DdqdosvQ.js +10 -0
  20. package/lib/config-6kqKwjzS.js +783 -0
  21. package/lib/config-B1XQHD5S.js +110 -0
  22. package/lib/config-BqncRAOx.js +167 -0
  23. package/lib/config-CSUhHF5L.js +10 -0
  24. package/lib/config-CXGTRw74.js +743 -0
  25. package/lib/config-CjMfBTu9.js +75 -0
  26. package/lib/config-Cm22p_rY.js +40 -0
  27. package/lib/config-D3z2R85K.js +373 -0
  28. package/lib/config-D846M2Gv.js +813 -0
  29. package/lib/config-DHGpQmWe.js +695 -0
  30. package/lib/config-DJJlRxrQ.js +510 -0
  31. package/lib/config-DOtfpO43.js +64 -0
  32. package/lib/config-DS3NxQuJ.js +427 -0
  33. package/lib/config-DSw2PMKb.js +528 -0
  34. package/lib/config-DwVaqCyN.js +369 -0
  35. package/lib/config-Ec_zeOmT.js +10 -0
  36. package/lib/config-V6sABZH7.js +152 -0
  37. package/lib/config-XBAZDWTe.js +739 -0
  38. package/lib/config-ZZyCB-UG.js +210 -0
  39. package/lib/config-efyvf2nq.js +799 -0
  40. package/lib/context-Bl7hm9BN.js +5 -0
  41. package/lib/context-DXwgwPsi.js +5 -0
  42. package/lib/dashedLine-CJojzUDO.js +23 -0
  43. package/lib/data-CnP9NKXT.js +7 -0
  44. package/lib/data-field-DL4ZWkqD.js +17 -0
  45. package/lib/data-source-9Lgf-grI.js +78 -0
  46. package/lib/datav-BNctF3aF.js +89 -0
  47. package/lib/dater-BmOxJMnU.js +34 -0
  48. package/lib/db-rnJHM_q3.js +22 -0
  49. package/lib/decoration-ByPSHV8P.js +408 -0
  50. package/lib/delete-074QJWYN.js +112 -0
  51. package/lib/dialogBox-D3bwyGqh.js +21 -0
  52. package/lib/dialogSquare-C4KW-cRk.js +43 -0
  53. package/lib/dottedLine-CUbyTDpF.js +23 -0
  54. package/lib/doubleHeadedArrow-ph10_VNV.js +31 -0
  55. package/lib/ds-api-editor-uAArtQJI.js +115 -0
  56. package/lib/ds-global-editor-Cp80r2NN.js +121 -0
  57. package/lib/ds-sql-editor-ijeSFlXA.js +338 -0
  58. package/lib/ds-static-editor-CyEO_12Q.js +21592 -0
  59. package/lib/eightPointedStar-iyNwBma5.js +12 -0
  60. package/lib/empty-panel-C6Y6WgQ5.js +49 -0
  61. package/lib/event-DDj_G-ix.js +130 -0
  62. package/lib/favicon.svg +14 -0
  63. package/lib/filter-panel-BXIsc124.js +573 -0
  64. package/lib/fivePointedStar-CG-mQPKI.js +12 -0
  65. package/lib/fourPointedStar-Cjt9WMZi.js +12 -0
  66. package/lib/full-screen-By33Ud_D.js +34 -0
  67. package/lib/group-Bw2QYoqv.js +24 -0
  68. package/lib/heart-BS_j9yRq.js +4 -0
  69. package/lib/hexagon-BfE9vpeG.js +12 -0
  70. package/lib/hexagonalStar-CDF1zFRy.js +12 -0
  71. package/lib/icon/add.png +0 -0
  72. package/lib/icon/align-center.png +0 -0
  73. package/lib/icon/amplify.png +0 -0
  74. package/lib/icon/audio.png +0 -0
  75. package/lib/icon/bottomUp.png +0 -0
  76. package/lib/icon/carouselList.png +0 -0
  77. package/lib/icon/characters.png +0 -0
  78. package/lib/icon/delete.png +0 -0
  79. package/lib/icon/delete1.png +0 -0
  80. package/lib/icon/edit.png +0 -0
  81. package/lib/icon/file.png +0 -0
  82. package/lib/icon/graphic.png +0 -0
  83. package/lib/icon/icon/357/274/217/346/267/273/345/212/240 /347/231/275/350/211/262 1@2x.png +0 -0
  84. package/lib/icon/icon/357/274/217/346/267/273/345/212/240@2x.png +0 -0
  85. package/lib/icon/img.png +0 -0
  86. package/lib/icon/lock.png +0 -0
  87. package/lib/icon/multiline.png +0 -0
  88. package/lib/icon/navigate.png +0 -0
  89. package/lib/icon/next.png +0 -0
  90. package/lib/icon/pictureScrolling.png +0 -0
  91. package/lib/icon/previous.png +0 -0
  92. package/lib/icon/reduce.png +0 -0
  93. package/lib/icon/return.png +0 -0
  94. package/lib/icon/save.png +0 -0
  95. package/lib/icon/scBg.png +0 -0
  96. package/lib/icon/scrollText.png +0 -0
  97. package/lib/icon/search.png +0 -0
  98. package/lib/icon/share.png +0 -0
  99. package/lib/icon/topUp.png +0 -0
  100. package/lib/icon/upload.png +0 -0
  101. package/lib/icon/video.png +0 -0
  102. package/lib/icon/view.png +0 -0
  103. package/lib/icon//345/244/215/351/200/211/357/274/217/346/234/252/351/200/211@2x.png +0 -0
  104. package/lib/icon//345/244/215/351/200/211/357/274/217/351/200/211/344/270/255@2x(1).png +0 -0
  105. package/lib/icon//345/244/215/351/200/211/357/274/217/351/200/211/344/270/255@2x.png +0 -0
  106. package/lib/iking-utils.es-Ba74AedH.js +13822 -0
  107. package/lib/index-B76XXskt.js +225 -0
  108. package/lib/index-B9lRx-kg.js +85 -0
  109. package/lib/index-B9nm6Rgv.js +142 -0
  110. package/lib/index-BAN9B0Xt.js +176 -0
  111. package/lib/index-BH6iU67J.js +209 -0
  112. package/lib/index-BSeD4M2U.js +988 -0
  113. package/lib/index-BbUCT3bG.js +66 -0
  114. package/lib/index-Bjs1bW2W.js +6291 -0
  115. package/lib/index-Bzc3Ri47.js +472 -0
  116. package/lib/index-C2ezj_lw.js +19 -0
  117. package/lib/index-C8Ni1uMd.js +435 -0
  118. package/lib/index-CCCckUnm.js +19 -0
  119. package/lib/index-CGni9huM.js +339 -0
  120. package/lib/index-CI6xXcR0.js +47 -0
  121. package/lib/index-CTo4-44e.js +2013 -0
  122. package/lib/index-CX6tHoIu.js +208 -0
  123. package/lib/index-Cb06BDgi.js +48 -0
  124. package/lib/index-CuapA_N-.js +586 -0
  125. package/lib/index-D0Kh7c2E.js +142 -0
  126. package/lib/index-D8pryMlS.js +228 -0
  127. package/lib/index-DGErpAp1.js +245 -0
  128. package/lib/index-DHe-NWes.js +415 -0
  129. package/lib/index-DL5IJLR7.js +156 -0
  130. package/lib/index-DN_9YBN_.js +957 -0
  131. package/lib/index-DOYvASbD.js +121 -0
  132. package/lib/index-D_ojDCWy.js +52 -0
  133. package/lib/index-DcmokBSP.js +109 -0
  134. package/lib/index-Dm1le54W.js +226 -0
  135. package/lib/index-Dpg5we85.js +127 -0
  136. package/lib/index-IeVkGUKs.js +146 -0
  137. package/lib/index-VSfx-dDV.js +87 -0
  138. package/lib/index-_Ya8vNUb.js +79 -0
  139. package/lib/index.es.js +5 -0
  140. package/lib/index.umd.js +99 -0
  141. package/lib/kebabCase-CO6lu_Gu.js +250 -0
  142. package/lib/keyMap-wL6Ma83z.js +91 -0
  143. package/lib/layer-setting-panel-C86c3fN0.js +486 -0
  144. package/lib/main-graph-BjOO_j7Y.js +43 -0
  145. package/lib/marquee-B6qUH-Kc.js +49 -0
  146. package/lib/message-carousel-ToN1yK7K.js +34 -0
  147. package/lib/multi-layout-config-DWBvxtbQ.js +312 -0
  148. package/lib/number-title-flop-DUzpC1bo.js +112 -0
  149. package/lib/orderBy--EIhNVJu.js +388 -0
  150. package/lib/page-config-DT1C_kDM.js +5598 -0
  151. package/lib/page-table-U2Zv9dzo.js +169 -0
  152. package/lib/paragraph-D7CutH53.js +51 -0
  153. package/lib/pentagon-6sVh023X.js +12 -0
  154. package/lib/plus-DjE6l8qH.js +24 -0
  155. package/lib/rank-board-Cgj8rzLd.js +121 -0
  156. package/lib/rectangle-BQXP06pk.js +10 -0
  157. package/lib/roundedRectangle-DnEbzLph.js +10 -0
  158. package/lib/scroll-article-BC3pQhTm.js +130 -0
  159. package/lib/scroll-rank-BsbvGjIy.js +191 -0
  160. package/lib/scroll-rank-bar-BfceYhB-.js +189 -0
  161. package/lib/scroll-table-BTbnMVFS.js +303 -0
  162. package/lib/search-DkzwOoCx.js +24 -0
  163. package/lib/select-options-BTOkre7F.js +338 -0
  164. package/lib/setting-panel-CMKniQhs.js +397 -0
  165. package/lib/source-panel-ClGOmTVn.js +557 -0
  166. package/lib/straightLine-DPMRNFNz.js +23 -0
  167. package/lib/style.css +1 -0
  168. package/lib/table-bar-ciEVdDFG.js +117 -0
  169. package/lib/transform-layer.vue_vue_type_style_index_0_scoped_04cdae36_lang-6ixEI9oF.js +593 -0
  170. package/lib/triangle-NkNGdZCH.js +15 -0
  171. package/lib/use-border-BUij5e0F.js +29 -0
  172. package/lib/use-data-center-Cj9FGyCg.js +31 -0
  173. package/lib/use-series-Cmnkexlu.js +18 -0
  174. package/lib/use-swiper-B17v1vT0.js +12 -0
  175. package/lib/vue-util-oCdnLsQn.js +6 -0
  176. package/lib/warning-DYO0amRd.js +25 -0
  177. package/package.json +154 -0
@@ -0,0 +1,586 @@
1
+ import { storeToRefs as fe } from "pinia";
2
+ import { defineComponent as N, computed as P, createElementBlock as R, createCommentVNode as q, openBlock as y, createElementVNode as f, normalizeStyle as b, h as O, resolveComponent as H, ref as m, watchEffect as pe, onMounted as se, onUnmounted as me, createBlock as Y, withCtx as U, createVNode as Z, watch as K, TransitionGroup as ge, Fragment as we, renderList as ye } from "vue";
3
+ import { b as j, _ as I, C as ne, u as Le, a as $e, w as be, d as Ce } from "./index-Bjs1bW2W.js";
4
+ import { c as Se, l as Me } from "./datav-BNctF3aF.js";
5
+ import { b as A, o as M, a as T, u as Te } from "./index-D0Kh7c2E.js";
6
+ import { _ as ke } from "./transform-layer.vue_vue_type_style_index_0_scoped_04cdae36_lang-6ixEI9oF.js";
7
+ import { NIcon as xe } from "naive-ui";
8
+ const We = N({
9
+ name: "AlignLine",
10
+ setup() {
11
+ const t = j();
12
+ return {
13
+ alignLine: P(() => t.alignLine),
14
+ canvas: P(() => t.canvas)
15
+ };
16
+ }
17
+ }), Ee = {
18
+ key: 0,
19
+ class: "ident-line-wp"
20
+ };
21
+ function Re(t, e, n, o, s, i) {
22
+ return t.alignLine.enable && t.alignLine.show ? (y(), R("div", Ee, [
23
+ f("div", {
24
+ class: "ident-line x-line",
25
+ style: b({ width: `${t.canvas.width}px`, top: `${t.alignLine.top}px` })
26
+ }, null, 4),
27
+ f("div", {
28
+ class: "ident-line x-line",
29
+ style: b({ width: `${t.canvas.width}px`, top: `${t.alignLine.horizontal}px` })
30
+ }, null, 4),
31
+ f("div", {
32
+ class: "ident-line x-line",
33
+ style: b({ width: `${t.canvas.width}px`, top: `${t.alignLine.bottom}px` })
34
+ }, null, 4),
35
+ f("div", {
36
+ class: "ident-line y-line",
37
+ style: b({ height: `${t.canvas.height}px`, left: `${t.alignLine.left}px` })
38
+ }, null, 4),
39
+ f("div", {
40
+ class: "ident-line y-line",
41
+ style: b({ height: `${t.canvas.height}px`, left: `${t.alignLine.vertical}px` })
42
+ }, null, 4),
43
+ f("div", {
44
+ class: "ident-line y-line",
45
+ style: b({ height: `${t.canvas.height}px`, left: `${t.alignLine.right}px` })
46
+ }, null, 4)
47
+ ])) : q("", !0);
48
+ }
49
+ const Ie = /* @__PURE__ */ I(We, [["render", Re], ["__scopeId", "data-v-78e75dcb"]]), Be = { class: "canvas-selection" }, Xe = ["d"], ze = /* @__PURE__ */ N({
50
+ __name: "canvas-area",
51
+ props: {
52
+ startX: {
53
+ type: Number,
54
+ default: 0
55
+ },
56
+ startY: {
57
+ type: Number,
58
+ default: 0
59
+ },
60
+ width: {
61
+ type: Number,
62
+ default: 0
63
+ },
64
+ height: {
65
+ type: Number,
66
+ default: 0
67
+ }
68
+ },
69
+ setup(t) {
70
+ return (e, n) => (y(), R("svg", Be, [
71
+ f("path", {
72
+ fill: "none",
73
+ stroke: "rgba(255,255,255,0.5)",
74
+ d: `M ${t.startX},${t.startY} L ${t.startX},${t.startY + t.height} L ${t.startX + t.width},${t.startY + t.height} L ${t.startX + t.width},${t.startY} Z`,
75
+ style: { "stroke-width": "1", "stroke-dasharray": "3, 3" }
76
+ }, null, 8, Xe)
77
+ ]));
78
+ }
79
+ }), He = /* @__PURE__ */ I(ze, [["__scopeId", "data-v-5262200c"]]), Q = /* @__PURE__ */ I(ke, [["__scopeId", "data-v-04cdae36"]]), De = N({
80
+ name: "DatavTransform",
81
+ props: {
82
+ com: {
83
+ type: Object,
84
+ required: !0
85
+ },
86
+ editable: {
87
+ type: Boolean,
88
+ default: !0
89
+ }
90
+ },
91
+ setup() {
92
+ const t = (e, n, o) => e.type === ne.com ? O(
93
+ Q,
94
+ {
95
+ com: e,
96
+ parentCom: n,
97
+ editable: o
98
+ },
99
+ {
100
+ default: () => O(H(e.name), {
101
+ com: e,
102
+ style: {
103
+ transform: "translateZ(0)",
104
+ opacity: e.attr.opacity
105
+ }
106
+ })
107
+ }
108
+ ) : O(
109
+ Q,
110
+ {
111
+ com: e,
112
+ parentCom: n,
113
+ editable: o
114
+ },
115
+ {
116
+ default: ({ data: s, editable: i }) => t(s, e, i)
117
+ }
118
+ );
119
+ return {
120
+ create: t
121
+ };
122
+ },
123
+ render() {
124
+ return this.create(this.$props.com, void 0, this.$props.editable);
125
+ }
126
+ }), Ge = {}, Pe = {
127
+ t: "1639130833808",
128
+ class: "icon",
129
+ viewBox: "0 0 1024 1024",
130
+ version: "1.1",
131
+ xmlns: "http://www.w3.org/2000/svg",
132
+ "p-id": "3985",
133
+ width: "64",
134
+ height: "64"
135
+ };
136
+ function Ye(t, e) {
137
+ return y(), R("svg", Pe, [...e[0] || (e[0] = [
138
+ f("path", {
139
+ d: "M341.33333333 579.33333333C426.66933333 463.33333333 511.99733333 405.33333333 597.33333333 405.33333333c85.336 0 170.664 58 256 174C767.99733333 676.66933333 682.66933333 725.33333333 597.33333333 725.33333333c-85.336 0-170.664-48.664-256-146z m96-5.6C490.66933333 632.13333333 543.99733333 661.33333333 597.33333333 661.33333333s106.664-29.2 160-87.6C703.99733333 504.13333333 650.66933333 469.33333333 597.33333333 469.33333333s-106.664 34.8-160 104.4zM597.33333333 629.33333333a64 64 0 1 1 0-128 64 64 0 0 1 0 128zM213.33333333 213.33333333V85.33333333h64v128h640v64H277.33333333v640h-64V277.33333333H85.33333333v-64h128z",
140
+ "p-id": "3986"
141
+ }, null, -1)
142
+ ])]);
143
+ }
144
+ const Ae = /* @__PURE__ */ I(Ge, [["render", Ye]]), Ve = {}, Ne = {
145
+ t: "1639130872871",
146
+ class: "icon",
147
+ viewBox: "0 0 1024 1024",
148
+ version: "1.1",
149
+ xmlns: "http://www.w3.org/2000/svg",
150
+ "p-id": "4135",
151
+ width: "64",
152
+ height: "64"
153
+ };
154
+ function Fe(t, e) {
155
+ return y(), R("svg", Ne, [...e[0] || (e[0] = [
156
+ f("path", {
157
+ d: "M651.14133333 413.01333333l-56.344 56.344C542.30933333 470.45333333 489.82133333 505.23733333 437.33333333 573.73333333a416 416 0 0 0 26.48 26.6l-49.976 49.984c-24.168-19.76-48.336-43.416-72.504-70.984C426.66933333 463.33333333 511.99733333 405.33333333 597.33333333 405.33333333c17.936 0 35.872 2.56 53.808 7.68z m113.968 67.056c29.408 26.2 58.816 59.28 88.224 99.264C767.99733333 676.66933333 682.66933333 725.33333333 597.33333333 725.33333333c-22.456 0-44.92-3.368-67.376-10.112l54.456-54.456c4.304 0.376 8.616 0.568 12.92 0.568 53.336 0 106.664-29.2 160-87.6-13.368-17.44-26.736-32.704-40.112-45.784l47.888-47.88zM213.33333333 213.33333333V85.33333333h64v128h640v64H277.33333333v640h-64V277.33333333H85.33333333v-64h128z",
158
+ "p-id": "4136"
159
+ }, null, -1),
160
+ f("path", {
161
+ d: "M770.34933333 339.06133333l45.256 45.256-407.288 407.288-45.256-45.256z",
162
+ "p-id": "4137"
163
+ }, null, -1)
164
+ ])]);
165
+ }
166
+ const Oe = /* @__PURE__ */ I(Ve, [["render", Fe]]), V = (t) => `${t}px`, ee = (t, e, n, o) => {
167
+ const s = t ?? document.createElement("canvas");
168
+ s.width = e * o, s.height = n * o, s.style.width = V(e), s.style.height = V(n);
169
+ const i = s.getContext("2d");
170
+ return i && i.setTransform(o, 0, 0, o, 0, 0), s;
171
+ }, oe = (t, e, n, o) => {
172
+ const s = parseFloat(t.style.transform.match(new RegExp("(?<=X\\()(.+)", "ig"))[0]), { height: i, scale: a, offset: h } = e;
173
+ let c = 0;
174
+ return e.direction == "TB" ? c = n - (t.parentElement?.offsetLeft || 0) - s : c = o - (t.parentElement?.offsetTop || 0) - s, c = c - i + e.indicatorLineWidth, {
175
+ coor: Math.floor((c - h) / a),
176
+ dist: c
177
+ };
178
+ }, qe = (t, e) => {
179
+ const { scale: n, offset: o } = e;
180
+ return {
181
+ coor: t,
182
+ dist: parseFloat((t * n + o).toFixed(3))
183
+ };
184
+ };
185
+ class D {
186
+ constructor(e, n, o, s = 0) {
187
+ this.el = e, this.options = n, this.constructGuide(o, s);
188
+ }
189
+ static isMoveing = !1;
190
+ guideLine;
191
+ coor = -1;
192
+ // 创建参考线
193
+ constructGuide(e, n) {
194
+ const { el: o } = this, s = document.createElement("div");
195
+ s.title = "双击删除参考线", A(s, "ruler-line"), this.guideLine = s;
196
+ const { coor: i } = this;
197
+ this.setLine(e, n), e && this.coorChange("add", this.coor, i);
198
+ let a = o.querySelector(".lines-wrapper");
199
+ a || (a = document.createElement("div"), A(a, "lines-wrapper"), o.appendChild(a)), a.appendChild(s), M(s, "mousedown", this.moving.bind(this)), M(s, "dblclick", this.dblclick.bind(this));
200
+ }
201
+ moving(e) {
202
+ D.isMoveing = !0;
203
+ const { options: n } = this;
204
+ e.preventDefault(), e.stopPropagation();
205
+ const { coor: o } = this, s = (a) => {
206
+ n.direction === "TB" ? document.body.style.cursor = "ew-resize" : document.body.style.cursor = "ns-resize", this.setLine(a);
207
+ }, i = () => {
208
+ D.isMoveing = !1, document.body.style.cursor = "", T(document, "mousemove", s), T(document, "mouseup", i);
209
+ const { coor: a } = this;
210
+ a < 0 ? this.coorChange("delete", o, o) : this.coorChange("update", a, o);
211
+ };
212
+ M(document, "mousemove", s), M(document, "mouseup", i);
213
+ }
214
+ setLine(e, n = 0) {
215
+ const { el: o, options: s, guideLine: i } = this, a = e ? oe(o, s, e.clientX, e.clientY) : qe(n, s);
216
+ s.direction === "TB" ? i.style.left = V(a.dist) : i.style.top = V(a.dist), i.innerHTML = `
217
+ <div class="line-action">
218
+ <span class="line-value">${a.coor}</span>
219
+ </div>`, this.coor = a.coor;
220
+ }
221
+ dblclick(e) {
222
+ e.preventDefault(), e.stopPropagation(), this.destroy();
223
+ }
224
+ coorChange(e, n, o) {
225
+ const { options: s } = this;
226
+ s.coorChange && s.coorChange(e, n, o);
227
+ }
228
+ show() {
229
+ this.guideLine.style.display = "block";
230
+ }
231
+ hide() {
232
+ this.guideLine.style.display = "none";
233
+ }
234
+ destroy() {
235
+ const { guideLine: e, coor: n } = this;
236
+ this.coorChange("delete", n, n), T(e, "mousedown", this.moving.bind(this)), T(e, "dblclick", this.dblclick.bind(this)), e.remove();
237
+ }
238
+ }
239
+ class te {
240
+ el;
241
+ canvas;
242
+ ctx;
243
+ ruler = {
244
+ width: 0,
245
+ height: 0
246
+ };
247
+ indicator;
248
+ indicatorValue;
249
+ guideLines = [];
250
+ options = {
251
+ direction: "TB",
252
+ width: 1e3,
253
+ height: 20,
254
+ bgColor: "#0e1013",
255
+ fontFamily: "sans-serif",
256
+ fontSize: "10px",
257
+ fontColor: "#90a0ae",
258
+ strokeStyle: "rgba(161, 174, 179, 0.8)",
259
+ lineWidth: 0.5,
260
+ indicatorLineWidth: 1,
261
+ scale: 1,
262
+ offset: 40,
263
+ ratio: 2
264
+ };
265
+ constructor(e, n) {
266
+ this.el = e, this.options = { ...this.options, ...n }, this.constructRuler();
267
+ }
268
+ // 创建标尺
269
+ constructRuler() {
270
+ const { el: e, options: n } = this, { direction: o, width: s, height: i, ratio: a } = n, h = Math.max(o === "TB" ? e.offsetWidth : e.offsetHeight, s), c = i;
271
+ this.ruler.width = h, this.ruler.height = c;
272
+ const r = ee(null, h, c, a);
273
+ A(r, "canvas-ruler"), e.appendChild(r), this.canvas = r, this.ctx = r.getContext("2d"), this.drawRuler(), M(r, "mouseenter", this.constructIndicator.bind(this)), M(r, "mousedown", this.createGuideLine.bind(this));
274
+ }
275
+ // 画标尺
276
+ drawRuler() {
277
+ const { ctx: e, options: n, ruler: o } = this, { width: s, height: i } = o;
278
+ e.beginPath(), e.fillStyle = n.bgColor, e.fillRect(0, 0, s, i), e.closePath(), e.beginPath(), e.font = `${n.fontSize} ${n.fontFamily}`, e.textAlign = "left", e.fillStyle = n.fontColor, e.strokeStyle = n.strokeStyle, e.lineWidth = n.lineWidth, this.drawPoints(), e.stroke();
279
+ }
280
+ // 画刻度
281
+ drawPoints() {
282
+ const { ctx: e, options: n, ruler: o } = this, { width: s, height: i } = o, { offset: a, scale: h } = n, c = 0, r = i / 1.5, p = i / 1.2;
283
+ for (let u = 0; u <= s; u += 1) {
284
+ const d = u - a;
285
+ if (d < 0) continue;
286
+ let L = -1, v = -1;
287
+ d % 50 === 0 ? (L = Math.floor(d / h), v = c) : d % 25 === 0 ? v = r : d % 5 === 0 && (v = p), v >= 0 && (e.moveTo(u + 0.5, i + 0.5), e.lineTo(u + 0.5, v), L > -1 && e.fillText(`${L}`, u + 2.5, i / 1.5));
288
+ }
289
+ }
290
+ // 画指示线
291
+ constructIndicator(e) {
292
+ if (D.isMoveing)
293
+ return;
294
+ const { el: n, options: o, canvas: s } = this, i = document.createElement("div"), a = document.createElement("span");
295
+ A(i, "ruler-indicator"), A(a, "indicator-value"), i.appendChild(a), this.indicator = i, this.indicatorValue = a, n.appendChild(i);
296
+ const h = (p) => {
297
+ const u = oe(n, o, p.clientX, p.clientY);
298
+ i.style.left = V(u.dist), a.textContent = `${u.coor}`;
299
+ };
300
+ h(e);
301
+ const c = (p) => {
302
+ h(p);
303
+ }, r = () => {
304
+ T(s, "mousemove", c), T(s, "mouseout", r), i.remove();
305
+ };
306
+ M(s, "mousemove", c), M(s, "mouseout", r);
307
+ }
308
+ // 创建参考线
309
+ createGuideLine(e) {
310
+ e.preventDefault(), e.stopPropagation();
311
+ const { el: n, options: o } = this;
312
+ this.guideLines.push(new D(n, o, e));
313
+ }
314
+ // 设置指定参考线
315
+ setGuideLines(e) {
316
+ const { el: n, options: o } = this;
317
+ e.forEach((s) => {
318
+ this.guideLines.push(new D(n, o, null, s));
319
+ });
320
+ }
321
+ // 设置画布尺寸和比例
322
+ setSize(e, n, o) {
323
+ const { el: s, options: i } = this;
324
+ i.width = e, i.height = n, i.scale = o;
325
+ const { direction: a, width: h, height: c, ratio: r } = i, p = Math.max(a === "TB" ? s.offsetWidth : s.offsetHeight, h), u = c;
326
+ this.ruler.width = p, this.ruler.height = u, ee(this.canvas, p, u, r), this.drawRuler(), this.guideLines.forEach((d) => d.setLine(null, d.coor));
327
+ }
328
+ // 设置画布比例
329
+ setScale(e) {
330
+ this.options.scale = e, this.drawRuler(), this.guideLines.forEach((n) => n.setLine(null, n.coor));
331
+ }
332
+ // 切换参考线
333
+ toggleGuide(e) {
334
+ const n = e ? "show" : "hide";
335
+ this.guideLines.forEach((o) => o[n]());
336
+ }
337
+ // 清空所有参考线
338
+ clearGuides() {
339
+ this.guideLines.forEach((e) => e.destroy()), this.guideLines = [];
340
+ }
341
+ destroy() {
342
+ const { el: e, canvas: n } = this;
343
+ this.clearGuides(), T(n, "mouseenter", this.constructIndicator.bind(this)), T(n, "mousedown", this.createGuideLine.bind(this)), e.remove();
344
+ }
345
+ }
346
+ const Ue = N({
347
+ name: "Ruler",
348
+ components: {
349
+ IconLineShow: Ae,
350
+ IconLineHide: Oe
351
+ },
352
+ setup() {
353
+ const t = j(), e = m(null), n = m(null), o = m(null), s = m(null), i = m(!0), a = m(0), h = m(0), c = document.documentElement.clientWidth;
354
+ pe(() => {
355
+ if (e.value && n.value) {
356
+ const { canvas: u, guideLine: d } = t, L = Math.max(u.width, c);
357
+ o.value ? o.value.setSize(L, 20, u.scale) : (o.value = new te(e.value, {
358
+ direction: "TB",
359
+ width: L,
360
+ scale: u.scale,
361
+ coorChange: (v, $, W) => {
362
+ v === "add" ? d.h.push($) : v === "update" && $ !== W ? (d.h = d.h.filter((k) => k !== W), d.h.push($)) : v === "delete" && (d.h = d.h.filter((k) => k !== $));
363
+ }
364
+ }), o.value.setGuideLines(d.h)), s.value ? s.value.setSize(u.height, 20, u.scale) : (s.value = new te(n.value, {
365
+ direction: "LR",
366
+ width: u.height,
367
+ scale: u.scale,
368
+ coorChange: (v, $, W) => {
369
+ v === "add" ? d.v.push($) : v === "update" && $ !== W ? (d.v = d.v.filter((k) => k !== W), d.v.push($)) : v === "delete" && (d.v = d.v.filter((k) => k !== $));
370
+ }
371
+ }), s.value.setGuideLines(d.v));
372
+ }
373
+ });
374
+ const r = () => {
375
+ o.value && s.value && (i.value = !i.value, o.value.toggleGuide(i.value), s.value.toggleGuide(i.value));
376
+ }, p = (u) => {
377
+ const d = u.target;
378
+ a.value = d.scrollLeft, h.value = d.scrollTop;
379
+ };
380
+ return se(() => {
381
+ document.getElementById("canvas-wp")?.addEventListener("scroll", p);
382
+ }), me(() => {
383
+ document.getElementById("canvas-wp")?.removeEventListener("scroll", p);
384
+ }), {
385
+ visible: i,
386
+ hRulerWpRef: e,
387
+ vRulerWpRef: n,
388
+ toggleGuides: r,
389
+ vScroll: h,
390
+ hScroll: a
391
+ };
392
+ }
393
+ }), Ze = { class: "canvas-ruler-wp" };
394
+ function je(t, e, n, o, s, i) {
395
+ const a = H("IconLineShow"), h = xe, c = H("IconLineHide");
396
+ return y(), R("div", Ze, [
397
+ f("div", {
398
+ ref: "hRulerWpRef",
399
+ class: "ruler-wrapper h-container",
400
+ style: b(`transform: translateX(-${t.hScroll}px);`)
401
+ }, null, 4),
402
+ f("div", {
403
+ ref: "vRulerWpRef",
404
+ class: "ruler-wrapper v-container",
405
+ style: b(`transform: rotate(90deg) translateX(-${t.vScroll}px);`)
406
+ }, null, 4),
407
+ f("div", {
408
+ title: "切换参考线",
409
+ class: "ruler-corner",
410
+ onClick: e[0] || (e[0] = (...r) => t.toggleGuides && t.toggleGuides(...r))
411
+ }, [
412
+ t.visible ? (y(), Y(h, { key: 0 }, {
413
+ default: U(() => [
414
+ Z(a)
415
+ ]),
416
+ _: 1
417
+ })) : (y(), Y(h, { key: 1 }, {
418
+ default: U(() => [
419
+ Z(c)
420
+ ]),
421
+ _: 1
422
+ }))
423
+ ])
424
+ ]);
425
+ }
426
+ const _e = /* @__PURE__ */ I(Ue, [["render", je]]), Je = N({
427
+ name: "CanvasMain",
428
+ components: {
429
+ AlignLine: Ie,
430
+ Ruler: _e,
431
+ CanvasArea: He,
432
+ DatavTransform: De
433
+ },
434
+ setup() {
435
+ const t = Le(), e = $e(), n = j(), { hideMenu: o } = Te(), { pageConfig: s, canvas: i, editMode: a } = fe(n), h = P(() => e.coms.filter((g) => n.selectedPage?.children.includes(g.id))), c = m(!1), r = m(0), p = m(0), u = m(0), d = m(0), L = m(0), v = m(0), $ = 60, W = 60, k = P(() => ({
436
+ width: `${i.value.width}px`,
437
+ height: `${i.value.height}px`,
438
+ position: "absolute"
439
+ }));
440
+ K(
441
+ () => s.value.resourceList[s.value.bgimage],
442
+ () => {
443
+ _();
444
+ },
445
+ {
446
+ deep: !0
447
+ }
448
+ );
449
+ const G = m(""), _ = async () => {
450
+ let l = s.value.resourceList[s.value.bgimage];
451
+ l ? (l.startsWith("http"), G.value = l) : G.value = "";
452
+ }, ie = P(() => {
453
+ const l = {};
454
+ return s.value.bgimage && (l.backgroundImage = `url(${G.value})`), s.value?.bgcolor?.includes("gradient") ? l.backgroundImage = s.value.bgcolor : l.backgroundColor = s.value.bgcolor, {
455
+ width: `${s.value.width}px`,
456
+ height: `${s.value.height}px`,
457
+ transform: `scale(${i.value.scale}) translate(0px, 0px)`,
458
+ ...l
459
+ };
460
+ });
461
+ se(() => {
462
+ _();
463
+ });
464
+ const ae = async (l) => {
465
+ if (l.preventDefault(), !!a.value)
466
+ try {
467
+ const g = l.dataTransfer.getData("text");
468
+ if (g) {
469
+ t.addLoading();
470
+ let w = await Se(g);
471
+ const { scale: E } = i.value, { left: B, top: C } = t.getPanelOffset, x = document.getElementById("canvas-wp"), X = x?.scrollLeft || 0, z = x?.scrollTop || 0, S = (X + l.clientX - B) / E, F = (z + l.clientY - C) / E;
472
+ w.attr.x = Math.round(S - w.attr.w / 2), w.attr.y = Math.round(F - w.attr.h / 2), await Me(w), e.select(w.id), t.removeLoading();
473
+ }
474
+ } catch (g) {
475
+ be("dropToAddCom", g.message);
476
+ }
477
+ }, le = (l) => {
478
+ l.preventDefault(), l.stopPropagation(), l.dataTransfer.dropEffect = "copy";
479
+ }, re = (l) => {
480
+ const g = l.target;
481
+ ["canvas-panel", "screen-shot", "canvas-panel-wrap"].includes(g.className) ? c.value = !0 : c.value = !1;
482
+ }, ce = () => {
483
+ c.value && (c.value = !1, e.select(""));
484
+ }, J = () => {
485
+ L.value = 0, v.value = 0;
486
+ }, de = () => h?.value?.filter((l) => l.locked || l.hided || !l.hovered ? (l.selected = !1, !1) : (l.selected = !0, !0)), ue = () => {
487
+ const { scale: l } = i.value, g = (u.value - $) / l, w = (d.value - W) / l, E = L.value / l, B = v.value / l;
488
+ h?.value?.forEach((C) => {
489
+ if (C.locked || C.hided)
490
+ return;
491
+ const { x, y: X, w: z, h: S } = C.attr, F = { x: g, y: w, w: E, h: B }, ve = { x, y: X, w: z, h: S };
492
+ C.hovered = Ce(F, ve);
493
+ });
494
+ }, he = (l) => {
495
+ if (!a.value) return;
496
+ if (c.value = !0, n.contextMenu.show)
497
+ return c.value = !1, o(), !1;
498
+ const g = document.getElementById("screen-wp");
499
+ r.value = g.clientWidth, p.value = g.clientHeight;
500
+ const w = g.getBoundingClientRect(), E = w.x, B = w.y, C = l.clientX, x = l.clientY;
501
+ u.value = C - E, d.value = x - B;
502
+ const X = (S) => {
503
+ S.clientX < C && (u.value = S.clientX - E), S.clientY < x && (d.value = S.clientY - B), L.value = Math.abs(S.clientX - C), v.value = Math.abs(S.clientY - x), ue(), c.value = !1;
504
+ }, z = () => {
505
+ T(document, "mousemove", X), T(document, "mouseup", z), J(), de(), c.value && re(l);
506
+ };
507
+ M(document, "mousemove", X), M(document, "mouseup", z);
508
+ };
509
+ return K(
510
+ () => n.canvas.scale,
511
+ () => {
512
+ J(), o();
513
+ }
514
+ ), {
515
+ imgUrl: G,
516
+ ComType: ne,
517
+ coms: h,
518
+ canvasPanelStyle: ie,
519
+ screenShotStyle: k,
520
+ selectionW: r,
521
+ selectionH: p,
522
+ areaStartX: u,
523
+ areaStartY: d,
524
+ areaWidth: L,
525
+ areaHeight: v,
526
+ dragOver: le,
527
+ dropToAddCom: ae,
528
+ handleMouseDown: he,
529
+ cancelSelected: ce,
530
+ editMode: a
531
+ };
532
+ }
533
+ }), Ke = { class: "canvas-main" };
534
+ function Qe(t, e, n, o, s, i) {
535
+ const a = H("DatavTransform"), h = H("AlignLine"), c = H("CanvasArea");
536
+ return y(), R("div", Ke, [
537
+ f("div", {
538
+ id: "canvas-wp",
539
+ class: "canvas-panel-wrap",
540
+ onClick: e[3] || (e[3] = (...r) => t.cancelSelected && t.cancelSelected(...r))
541
+ }, [
542
+ f("div", {
543
+ id: "screen-wp",
544
+ class: "screen-shot",
545
+ style: b(t.screenShotStyle),
546
+ onMousedown: e[2] || (e[2] = (...r) => t.handleMouseDown && t.handleMouseDown(...r))
547
+ }, [
548
+ f("div", {
549
+ id: "canvas-coms",
550
+ class: "canvas-panel",
551
+ style: b(t.canvasPanelStyle),
552
+ onDragover: e[0] || (e[0] = (...r) => t.dragOver && t.dragOver(...r)),
553
+ onDrop: e[1] || (e[1] = (...r) => t.dropToAddCom && t.dropToAddCom(...r))
554
+ }, [
555
+ Z(ge, { name: "list" }, {
556
+ default: U(() => [
557
+ (y(!0), R(we, null, ye(t.coms, (r) => (y(), Y(a, {
558
+ key: r.id,
559
+ com: r,
560
+ editable: t.editMode
561
+ }, null, 8, ["com", "editable"]))), 128))
562
+ ]),
563
+ _: 1
564
+ })
565
+ ], 36),
566
+ t.editMode ? (y(), Y(h, { key: 0 })) : q("", !0)
567
+ ], 36),
568
+ t.editMode && (t.areaWidth > 0 || t.areaHeight > 0) ? (y(), Y(c, {
569
+ key: 0,
570
+ "start-x": t.areaStartX,
571
+ "start-y": t.areaStartY,
572
+ width: t.areaWidth,
573
+ height: t.areaHeight,
574
+ style: b({
575
+ width: `${t.selectionW}px`,
576
+ height: `${t.selectionH}px`
577
+ })
578
+ }, null, 8, ["start-x", "start-y", "width", "height", "style"])) : q("", !0)
579
+ ]),
580
+ e[4] || (e[4] = f("div", { class: "thumbnail" }, null, -1))
581
+ ]);
582
+ }
583
+ const lt = /* @__PURE__ */ I(Je, [["render", Qe], ["__scopeId", "data-v-472fb032"]]);
584
+ export {
585
+ lt as default
586
+ };