label-designer-vue 0.1.0 → 0.1.1

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.
@@ -1,39 +1,39 @@
1
- import { ref as M, computed as B, onMounted as Te, onBeforeUnmount as qe, watch as fe, openBlock as g, createElementBlock as f, createElementVNode as n, Fragment as $, renderList as Y, toDisplayString as S, normalizeClass as P, createVNode as i, unref as a, withModifiers as L, withCtx as k, createTextVNode as C, createCommentVNode as A, normalizeStyle as se, pushScopeId as Be, popScopeId as Ae } from "vue";
2
- import { ElButton as E, ElSelect as ye, ElOption as W, ElSwitch as j, ElInput as D, ElInputNumber as U, ElColorPicker as Re } from "element-plus";
3
- import we from "jsbarcode";
4
- import Oe from "qrcode";
5
- const Ye = 25.4 / 72;
6
- function oe(s) {
1
+ import { ref as M, computed as Y, onMounted as Be, onBeforeUnmount as Re, watch as _e, openBlock as v, createElementBlock as p, createElementVNode as n, Fragment as z, renderList as H, toDisplayString as E, normalizeClass as F, createVNode as i, unref as a, withModifiers as I, withCtx as $, createTextVNode as U, createCommentVNode as L, normalizeStyle as re, pushScopeId as Oe, popScopeId as Ye } from "vue";
2
+ import { ElButton as D, ElSelect as be, ElOption as ee, ElSwitch as K, ElInput as T, ElInputNumber as N, ElColorPicker as Pe } from "element-plus";
3
+ import Ve from "jsbarcode";
4
+ import Xe from "qrcode";
5
+ const je = 25.4 / 72;
6
+ function ue(s) {
7
7
  return String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
8
8
  }
9
- function _e(s, u = {}) {
9
+ function Me(s, u = {}) {
10
10
  const c = s.fieldName ? u == null ? void 0 : u[s.fieldName] : void 0;
11
11
  return c != null && String(c) !== "" ? String(c) : String(s.testData ?? "");
12
12
  }
13
- function G(s, u = {}) {
13
+ function te(s, u = {}) {
14
14
  const c = s.fieldName ? u == null ? void 0 : u[s.fieldName] : void 0;
15
15
  return c != null && String(c) !== "" ? String(c) : String(s.content ?? "");
16
16
  }
17
- function be(s, u, c, m = !0) {
17
+ function ze(s, u, c, h = !0) {
18
18
  const V = String(s ?? "").trim();
19
19
  if (!V || !(u > 0) || !(c > 0)) return "";
20
20
  try {
21
- const v = document.createElement("canvas");
22
- if (we(v, V, {
21
+ const g = document.createElement("canvas");
22
+ if (Ve(g, V, {
23
23
  format: "CODE128",
24
24
  width: 1,
25
25
  height: 60,
26
- displayValue: m !== !1,
26
+ displayValue: h !== !1,
27
27
  fontSize: 12,
28
28
  textMargin: 1,
29
29
  margin: 0
30
- }), !v.width || !v.height) return "";
31
- const J = Math.max(1, v.width), h = Math.max(0.1, u / c * v.height / J), w = document.createElement("canvas");
32
- return we(w, V, {
30
+ }), !g.width || !g.height) return "";
31
+ const le = Math.max(1, g.width), m = Math.max(0.1, u / c * g.height / le), w = document.createElement("canvas");
32
+ return Ve(w, V, {
33
33
  format: "CODE128",
34
- width: h,
34
+ width: m,
35
35
  height: 60,
36
- displayValue: m !== !1,
36
+ displayValue: h !== !1,
37
37
  fontSize: 12,
38
38
  textMargin: 1,
39
39
  margin: 0
@@ -42,11 +42,11 @@ function be(s, u, c, m = !0) {
42
42
  return "";
43
43
  }
44
44
  }
45
- async function Ve(s) {
45
+ async function Se(s) {
46
46
  const u = String(s ?? "").trim();
47
47
  if (!u) return "";
48
48
  try {
49
- return await Oe.toDataURL(u, {
49
+ return await Xe.toDataURL(u, {
50
50
  width: 240,
51
51
  margin: 1,
52
52
  errorCorrectionLevel: "M",
@@ -56,7 +56,7 @@ async function Ve(s) {
56
56
  return "";
57
57
  }
58
58
  }
59
- function Pe(s) {
59
+ function He(s) {
60
60
  return [
61
61
  `left:${s.x}mm`,
62
62
  `top:${s.y}mm`,
@@ -65,7 +65,7 @@ function Pe(s) {
65
65
  s.rotation ? `transform:rotate(${s.rotation}deg)` : ""
66
66
  ].filter(Boolean).join(";");
67
67
  }
68
- function xe(s) {
68
+ function ke(s) {
69
69
  return [
70
70
  `font-size:${s.fontSize || 9}pt`,
71
71
  `font-weight:${s.bold ? "700" : "400"}`,
@@ -77,37 +77,37 @@ function xe(s) {
77
77
  "overflow:hidden"
78
78
  ].join(";");
79
79
  }
80
- function je(s, u, c) {
81
- const m = Pe(s);
80
+ function Fe(s, u, c) {
81
+ const h = He(s);
82
82
  if (s.type === "text")
83
- return `<div class="ld-print-item ld-print-text" style="${m};${xe(
83
+ return `<div class="ld-print-item ld-print-text" style="${h};${ke(
84
84
  s
85
- )}">${oe(s.text)}</div>`;
85
+ )}">${ue(s.text)}</div>`;
86
86
  if (s.type === "value")
87
- return `<div class="ld-print-item ld-print-text" style="${m};${xe(
87
+ return `<div class="ld-print-item ld-print-text" style="${h};${ke(
88
88
  s
89
- )}">${oe(_e(s, c))}</div>`;
89
+ )}">${ue(Me(s, c))}</div>`;
90
90
  if (s.type === "barcode" || s.type === "qrcode") {
91
- const V = u[s.id] || "", v = s.type === "barcode" ? "fill" : "contain";
92
- return V ? `<div class="ld-print-item" style="${m}"><img class="ld-print-img is-${v}" src="${V}" alt="" /></div>` : `<div class="ld-print-item" style="${m}"></div>`;
91
+ const V = u[s.id] || "", g = s.type === "barcode" ? "fill" : "contain";
92
+ return V ? `<div class="ld-print-item" style="${h}"><img class="ld-print-img is-${g}" src="${V}" alt="" /></div>` : `<div class="ld-print-item" style="${h}"></div>`;
93
93
  }
94
94
  return "";
95
95
  }
96
- async function Xe(s, u = {}) {
97
- const c = s.items || [], m = {};
98
- for (const v of c)
99
- v.type === "barcode" ? m[v.id] = be(
100
- G(v, u),
101
- v.width,
102
- v.height,
103
- v.showValue !== !1
104
- ) : v.type === "qrcode" && (m[v.id] = await Ve(G(v, u)));
105
- const V = c.map((v) => je(v, m, u)).join("");
96
+ async function Ke(s, u = {}) {
97
+ const c = s.items || [], h = {};
98
+ for (const g of c)
99
+ g.type === "barcode" ? h[g.id] = ze(
100
+ te(g, u),
101
+ g.width,
102
+ g.height,
103
+ g.showValue !== !1
104
+ ) : g.type === "qrcode" && (h[g.id] = await Se(te(g, u)));
105
+ const V = c.map((g) => Fe(g, h, u)).join("");
106
106
  return `<!DOCTYPE html>
107
107
  <html>
108
108
  <head>
109
109
  <meta charset="utf-8" />
110
- <title>${oe(s.name || "标签打印")}</title>
110
+ <title>${ue(s.name || "标签打印")}</title>
111
111
  <style>
112
112
  @page { size: ${s.width}mm ${s.height}mm; margin: 0; }
113
113
  * { margin: 0; padding: 0; box-sizing: border-box; }
@@ -131,39 +131,45 @@ async function Xe(s, u = {}) {
131
131
  </body>
132
132
  </html>`;
133
133
  }
134
- async function Cl(s, u = {}) {
135
- const c = await Xe(s, u), m = window.open("", "_blank");
136
- return m ? (m.document.write(c), m.document.close(), m.addEventListener("load", () => {
137
- m.focus(), m.print();
134
+ async function Nl(s, u = {}) {
135
+ const c = await Ke(s, u), h = window.open("", "_blank");
136
+ return h ? (h.document.write(c), h.document.close(), h.addEventListener("load", () => {
137
+ h.focus(), h.print();
138
138
  }), !0) : !1;
139
139
  }
140
- const He = (s, u) => {
140
+ const We = (s, u) => {
141
141
  const c = s.__vccOpts || s;
142
- for (const [m, V] of u)
143
- c[m] = V;
142
+ for (const [h, V] of u)
143
+ c[h] = V;
144
144
  return c;
145
- }, r = (s) => (Be("data-v-80df9fa9"), s = s(), Ae(), s), Fe = { class: "ldesign" }, Ke = { class: "ldesign-pane ldesign-left" }, We = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-title" }, "素材库", -1)), Ge = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-tip" }, "拖到画布上,或点击添加", -1)), Je = { class: "ldesign-palette" }, Qe = ["onDragstart", "onClick"], Ze = ["innerHTML"], et = { class: "ldesign-palette-name" }, tt = { class: "ldesign-palette-desc" }, lt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-title" }, "元素图层", -1)), nt = { class: "ldesign-layers" }, st = ["onClick"], ot = { class: "ldesign-layer-name" }, it = { class: "ldesign-layer-ops" }, at = {
145
+ }, r = (s) => (Oe("data-v-488f17e7"), s = s(), Ye(), s), Ge = { class: "ldesign" }, Je = { class: "ldesign-pane ldesign-left" }, Qe = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-title" }, "素材库", -1)), Ze = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-tip" }, "拖到画布上,或点击添加", -1)), et = { class: "ldesign-palette" }, tt = ["onDragstart", "onClick"], lt = ["innerHTML"], nt = { class: "ldesign-palette-name" }, st = { class: "ldesign-palette-desc" }, ot = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-title" }, "元素图层", -1)), it = { class: "ldesign-layers" }, at = ["onClick"], dt = { class: "ldesign-layer-name" }, rt = { class: "ldesign-layer-ops" }, ut = {
146
146
  key: 0,
147
147
  class: "ldesign-empty"
148
- }, dt = { class: "ldesign-center" }, rt = { class: "ldesign-canvas-bar" }, ut = { class: "ldesign-canvas-bar-left" }, ct = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", { class: "ldesign-bar-label" }, "缩放", -1)), mt = { class: "ldesign-bar-switch" }, ht = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "网格", -1)), vt = { class: "ldesign-bar-switch" }, pt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "对齐网格", -1)), gt = { class: "ldesign-bar-switch" }, ft = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "预览模拟数据", -1)), yt = { class: "ldesign-canvas-bar-right" }, wt = { class: "ldesign-bar-size" }, xt = { class: "ldesign-stage" }, _t = ["onMousedown"], bt = ["src"], Vt = ["src"], kt = {
148
+ }, ct = { class: "ldesign-center" }, mt = { class: "ldesign-canvas-bar" }, ht = { class: "ldesign-canvas-bar-left" }, vt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", { class: "ldesign-bar-label" }, "缩放", -1)), pt = { class: "ldesign-bar-switch" }, gt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "网格", -1)), ft = { class: "ldesign-bar-switch" }, yt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "对齐网格", -1)), wt = { class: "ldesign-bar-switch" }, xt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "预览模拟数据", -1)), _t = { class: "ldesign-canvas-bar-right" }, bt = { class: "ldesign-bar-size" }, Vt = { class: "ldesign-stage" }, kt = ["onMousedown"], $t = ["src"], Mt = ["src"], zt = {
149
149
  key: 3,
150
150
  class: "ldesign-item-placeholder"
151
- }, $t = {
151
+ }, St = {
152
152
  key: 4,
153
153
  class: "ldesign-item-placeholder"
154
- }, zt = {
154
+ }, Ct = {
155
155
  key: 5,
156
156
  class: "ldesign-item-badge"
157
- }, Mt = ["onMousedown"], St = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-foot-tip" }, " 拖动左侧素材到画布;选中后可拖动移动、拖手柄改尺寸、方向键微调(Shift 加速)、Delete 删除 ", -1)), Ct = { class: "ldesign-pane ldesign-right" }, Et = { class: "ldesign-pane-title" }, Ut = { class: "ldesign-props" }, Lt = { class: "ldesign-prop-row" }, Dt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "名称", -1)), Nt = {
157
+ }, Et = ["onMousedown"], Ut = {
158
+ key: 0,
159
+ class: "ldesign-guide is-v"
160
+ }, Lt = {
161
+ key: 1,
162
+ class: "ldesign-guide is-h"
163
+ }, Dt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-foot-tip" }, " 拖动左侧素材到画布;选中后可拖动移动、拖手柄改尺寸、方向键微调(Shift 加速)、Delete 删除 ", -1)), Nt = { class: "ldesign-pane ldesign-right" }, It = { class: "ldesign-pane-title" }, Tt = { class: "ldesign-props" }, qt = { class: "ldesign-prop-row" }, At = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "名称", -1)), Bt = {
158
164
  key: 0,
159
165
  class: "ldesign-prop-row"
160
- }, It = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "文本内容", -1)), Tt = { class: "ldesign-prop-row" }, qt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "字段名", -1)), Bt = { class: "ldesign-prop-row" }, At = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "测试数据", -1)), Rt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-prop-hint" }, " 画布默认显示测试数据;开启「预览模拟数据」或打印时,优先取模拟数据里该字段的值 ", -1)), Ot = { class: "ldesign-prop-row" }, Yt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "码内容", -1)), Pt = { class: "ldesign-prop-row" }, jt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "字段名(可选)", -1)), Xt = {
166
+ }, Rt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "文本内容", -1)), Ot = { class: "ldesign-prop-row" }, Yt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "字段名", -1)), Pt = { class: "ldesign-prop-row" }, Xt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "测试数据", -1)), jt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-prop-hint" }, " 画布默认显示测试数据;开启「预览模拟数据」或打印时,优先取模拟数据里该字段的值 ", -1)), Ht = { class: "ldesign-prop-row" }, Ft = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "码内容", -1)), Kt = { class: "ldesign-prop-row" }, Wt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "字段名(可选)", -1)), Gt = {
161
167
  key: 0,
162
168
  class: "ldesign-prop-row"
163
- }, Ht = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "显示条码值", -1)), Ft = {
169
+ }, Jt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "显示条码值", -1)), Qt = {
164
170
  key: 3,
165
171
  class: "ldesign-grid2"
166
- }, Kt = { class: "ldesign-prop-cell" }, Wt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "字号(pt)", -1)), Gt = { class: "ldesign-prop-cell" }, Jt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "加粗", -1)), Qt = { class: "ldesign-prop-cell" }, Zt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "对齐", -1)), el = { class: "ldesign-prop-cell" }, tl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "文字颜色", -1)), ll = { class: "ldesign-grid2" }, nl = { class: "ldesign-prop-cell" }, sl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "位置 X(mm)", -1)), ol = { class: "ldesign-prop-cell" }, il = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "位置 Y(mm)", -1)), al = { class: "ldesign-prop-cell" }, dl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "宽(mm)", -1)), rl = { class: "ldesign-prop-cell" }, ul = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "高(mm)", -1)), cl = { class: "ldesign-prop-cell" }, ml = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "旋转(度)", -1)), hl = { class: "ldesign-prop-actions" }, vl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-title" }, "画布设置", -1)), pl = { class: "ldesign-props" }, gl = { class: "ldesign-prop-row" }, fl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "画布名称", -1)), yl = { class: "ldesign-grid2" }, wl = { class: "ldesign-prop-cell" }, xl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "宽(mm)", -1)), _l = { class: "ldesign-prop-cell" }, bl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "高(mm)", -1)), Vl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-prop-hint" }, " 画布尺寸即实际标签纸大小(毫米),打印时按此尺寸出纸;点击画布空白处或「画布设置」返回本面板 ", -1)), kl = {
172
+ }, Zt = { class: "ldesign-prop-cell" }, el = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "字号(pt)", -1)), tl = { class: "ldesign-prop-cell" }, ll = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "加粗", -1)), nl = { class: "ldesign-prop-cell" }, sl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "对齐", -1)), ol = { class: "ldesign-prop-cell" }, il = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "文字颜色", -1)), al = { class: "ldesign-grid2" }, dl = { class: "ldesign-prop-cell" }, rl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "位置 X(mm)", -1)), ul = { class: "ldesign-prop-cell" }, cl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "位置 Y(mm)", -1)), ml = { class: "ldesign-prop-cell" }, hl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "宽(mm)", -1)), vl = { class: "ldesign-prop-cell" }, pl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "高(mm)", -1)), gl = { class: "ldesign-prop-cell" }, fl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "旋转(度)", -1)), yl = { class: "ldesign-prop-actions" }, wl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-pane-title" }, "画布设置", -1)), xl = { class: "ldesign-props" }, _l = { class: "ldesign-prop-row" }, bl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "画布名称", -1)), Vl = { class: "ldesign-grid2" }, kl = { class: "ldesign-prop-cell" }, $l = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "宽(mm)", -1)), Ml = { class: "ldesign-prop-cell" }, zl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "高(mm)", -1)), Sl = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-prop-hint" }, " 画布尺寸即实际标签纸大小(毫米),打印时按此尺寸出纸;点击画布空白处或「画布设置」返回本面板 ", -1)), $e = 0.6, Cl = {
167
173
  __name: "label-designer",
168
174
  props: {
169
175
  /** 当前编辑的画布对象(页面持有的设计数据,直接在其上编辑) */
@@ -182,7 +188,7 @@ const He = (s, u) => {
182
188
  value: { w: 4, h: 2 },
183
189
  barcode: { w: 10, h: 5 },
184
190
  qrcode: { w: 5, h: 5 }
185
- }, m = {
191
+ }, h = {
186
192
  text: {
187
193
  width: 20,
188
194
  height: 5,
@@ -215,7 +221,7 @@ const He = (s, u) => {
215
221
  content: "https://example.com",
216
222
  fieldName: ""
217
223
  }
218
- }, V = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], v = [50, 60, 80, 100, 120, 150], J = [
224
+ }, V = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], g = [50, 60, 80, 100, 120, 150], le = [
219
225
  {
220
226
  type: "text",
221
227
  label: "文字",
@@ -240,260 +246,262 @@ const He = (s, u) => {
240
246
  desc: "内容 / 字段",
241
247
  thumb: '<svg viewBox="0 0 20 20" fill="currentColor"><rect x="2" y="2" width="6" height="6" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="4" y="4" width="2" height="2"/><rect x="12" y="2" width="6" height="6" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="14" y="4" width="2" height="2"/><rect x="2" y="12" width="6" height="6" fill="none" stroke="currentColor" stroke-width="1.6"/><rect x="4" y="14" width="2" height="2"/><rect x="12" y="12" width="2" height="2"/><rect x="16" y="12" width="2" height="2"/><rect x="14" y="14" width="2" height="2"/><rect x="12" y="16" width="2" height="2"/><rect x="16" y="16" width="2" height="2"/></svg>'
242
248
  }
243
- ], h = s, w = M(""), Q = M(100), Z = M(!0), ee = M(!0), N = M(!1), ie = M(null), te = M({}), le = M({}), ae = {}, de = {};
244
- let re = 0;
245
- const I = B(() => h.canvas), d = B(() => x.value), _ = B(() => Q.value / 10), x = B(
246
- () => h.canvas.items.find((l) => l.id === w.value) || null
247
- ), ue = B(
249
+ ], m = s, w = M(""), ne = M(100), se = M(!0), oe = M(!0), q = M(!1), ce = M(null), S = M({ v: !1, h: !1 }), ie = M({}), ae = M({}), me = {}, he = {};
250
+ let ve = 0;
251
+ const A = Y(() => m.canvas), d = Y(() => x.value), _ = Y(() => ne.value / 10), x = Y(
252
+ () => m.canvas.items.find((t) => t.id === w.value) || null
253
+ ), pe = Y(
248
254
  () => x.value && c[x.value.type] || {
249
255
  w: 2,
250
256
  h: 2
251
257
  }
252
- ), ke = B(() => ({
253
- width: `${h.canvas.width * _.value}px`,
254
- height: `${h.canvas.height * _.value}px`,
258
+ ), Ce = Y(() => ({
259
+ width: `${m.canvas.width * _.value}px`,
260
+ height: `${m.canvas.height * _.value}px`,
255
261
  "--ld-mm": `${_.value}px`
256
262
  }));
257
- function ce() {
258
- return re += 1, `it_${Date.now().toString(36)}${re}${Math.random().toString(36).slice(2, 6)}`;
263
+ function ge() {
264
+ return ve += 1, `it_${Date.now().toString(36)}${ve}${Math.random().toString(36).slice(2, 6)}`;
259
265
  }
260
- function me(l) {
261
- return u[l] || l;
266
+ function fe(t) {
267
+ return u[t] || t;
262
268
  }
263
- function b(l) {
264
- return ee.value ? Math.round(l * 2) / 2 : Math.round(l * 100) / 100;
269
+ function b(t) {
270
+ return oe.value ? Math.round(t * 2) / 2 : Math.round(t * 100) / 100;
265
271
  }
266
- function X(l, t) {
267
- const e = Math.max(0, h.canvas.width - t.width);
268
- return Math.min(Math.max(l, 0), e);
272
+ function W(t, l) {
273
+ const e = Math.max(0, m.canvas.width - l.width);
274
+ return Math.min(Math.max(t, 0), e);
269
275
  }
270
- function H(l, t) {
271
- const e = Math.max(0, h.canvas.height - t.height);
272
- return Math.min(Math.max(l, 0), e);
276
+ function G(t, l) {
277
+ const e = Math.max(0, m.canvas.height - l.height);
278
+ return Math.min(Math.max(t, 0), e);
273
279
  }
274
- function he(l, t = null) {
275
- const e = m[l];
280
+ function ye(t, l = null) {
281
+ const e = h[t];
276
282
  if (!e) return;
277
- const o = h.canvas.items, p = o.length + 1, y = {
278
- id: ce(),
279
- type: l,
280
- name: `${u[l]}${p}`,
283
+ const o = m.canvas.items, f = o.length + 1, y = {
284
+ id: ge(),
285
+ type: t,
286
+ name: `${u[t]}${f}`,
281
287
  x: 0,
282
288
  y: 0,
283
289
  rotation: 0,
284
290
  ...e
285
291
  };
286
- l === "value" && !y.fieldName && (y.fieldName = `field${p}`), t ? (y.x = t.x, y.y = t.y) : (y.x = 2 + (p - 1) * 1.5 % Math.max(1, h.canvas.width - e.width), y.y = 2 + (p - 1) * 1.5 % Math.max(1, h.canvas.height - e.height)), y.x = X(b(y.x), y), y.y = H(b(y.y), y), o.push(y), w.value = y.id;
292
+ t === "value" && !y.fieldName && (y.fieldName = `field${f}`), l ? (y.x = l.x, y.y = l.y) : (y.x = 2 + (f - 1) * 1.5 % Math.max(1, m.canvas.width - e.width), y.y = 2 + (f - 1) * 1.5 % Math.max(1, m.canvas.height - e.height)), y.x = W(b(y.x), y), y.y = G(b(y.y), y), o.push(y), w.value = y.id;
287
293
  }
288
- function ne(l) {
289
- const t = h.canvas.items, e = t.indexOf(l);
290
- e >= 0 && t.splice(e, 1), w.value === l.id && (w.value = "");
294
+ function de(t) {
295
+ const l = m.canvas.items, e = l.indexOf(t);
296
+ e >= 0 && l.splice(e, 1), w.value === t.id && (w.value = "");
291
297
  }
292
- function $e() {
293
- const l = x.value;
294
- if (!l) return;
295
- const t = { ...l, id: ce(), name: `${l.name}-副本` };
296
- t.x = X(b(l.x + 1.5), t), t.y = H(b(l.y + 1.5), t), h.canvas.items.push(t), w.value = t.id;
298
+ function Ee() {
299
+ const t = x.value;
300
+ if (!t) return;
301
+ const l = { ...t, id: ge(), name: `${t.name}-副本` };
302
+ l.x = W(b(t.x + 1.5), l), l.y = G(b(t.y + 1.5), l), m.canvas.items.push(l), w.value = l.id;
297
303
  }
298
- function F(l, t) {
299
- const e = h.canvas.items, o = e.indexOf(l), p = o + t;
300
- o < 0 || p < 0 || p >= e.length || (e.splice(o, 1), e.splice(p, 0, l));
304
+ function J(t, l) {
305
+ const e = m.canvas.items, o = e.indexOf(t), f = o + l;
306
+ o < 0 || f < 0 || f >= e.length || (e.splice(o, 1), e.splice(f, 0, t));
301
307
  }
302
- function ze(l, t) {
303
- t.dataTransfer.effectAllowed = "copy", t.dataTransfer.setData("text/plain", l);
308
+ function Ue(t, l) {
309
+ l.dataTransfer.effectAllowed = "copy", l.dataTransfer.setData("text/plain", t);
304
310
  }
305
- function Me(l) {
306
- var p;
307
- const t = l.dataTransfer.getData("text/plain");
308
- if (!m[t]) return;
309
- const e = (p = ie.value) == null ? void 0 : p.getBoundingClientRect();
311
+ function Le(t) {
312
+ var f;
313
+ const l = t.dataTransfer.getData("text/plain");
314
+ if (!h[l]) return;
315
+ const e = (f = ce.value) == null ? void 0 : f.getBoundingClientRect();
310
316
  if (!e) return;
311
- const o = m[t];
312
- he(t, {
313
- x: (l.clientX - e.left) / _.value - o.width / 2,
314
- y: (l.clientY - e.top) / _.value - o.height / 2
317
+ const o = h[l];
318
+ ye(l, {
319
+ x: (t.clientX - e.left) / _.value - o.width / 2,
320
+ y: (t.clientY - e.top) / _.value - o.height / 2
315
321
  });
316
322
  }
317
- function Se(l, t) {
318
- w.value = l.id;
319
- const e = t.clientX, o = t.clientY, p = l.x, y = l.y, T = (O) => {
320
- const K = (O.clientX - e) / _.value, z = (O.clientY - o) / _.value;
321
- l.x = X(b(p + K), l), l.y = H(b(y + z), l);
322
- }, R = () => {
323
- document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", R);
323
+ function De(t, l) {
324
+ w.value = t.id;
325
+ const e = l.clientX, o = l.clientY, f = t.x, y = t.y, B = (X) => {
326
+ const Q = (X.clientX - e) / _.value, C = (X.clientY - o) / _.value;
327
+ let k = b(f + Q), R = b(y + C);
328
+ const O = m.canvas.width / 2, j = m.canvas.height / 2, Z = Math.abs(k + t.width / 2 - O) <= $e, xe = Math.abs(R + t.height / 2 - j) <= $e;
329
+ Z && (k = O - t.width / 2), xe && (R = j - t.height / 2), t.x = W(k, t), t.y = G(R, t), S.value.v = Z && Math.abs(t.x + t.width / 2 - O) < 0.01, S.value.h = xe && Math.abs(t.y + t.height / 2 - j) < 0.01;
330
+ }, P = () => {
331
+ S.value.v = !1, S.value.h = !1, document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", P);
324
332
  };
325
- document.addEventListener("mousemove", T), document.addEventListener("mouseup", R);
333
+ document.addEventListener("mousemove", B), document.addEventListener("mouseup", P);
326
334
  }
327
- function Ce(l, t, e) {
335
+ function Ne(t, l, e) {
328
336
  const o = {
329
337
  mx: e.clientX,
330
338
  my: e.clientY,
331
- x: l.x,
332
- y: l.y,
333
- w: l.width,
334
- h: l.height
335
- }, p = c[l.type] || { w: 2, h: 2 }, y = (R) => {
336
- const O = (R.clientX - o.mx) / _.value, K = (R.clientY - o.my) / _.value;
337
- let z = o.w, q = o.h, pe = o.x, ge = o.y;
338
- t.includes("e") && (z = o.w + O), t.includes("s") && (q = o.h + K), t.includes("w") && (z = o.w - O), t.includes("n") && (q = o.h - K);
339
- const Ne = t.includes("w") ? o.x + o.w : h.canvas.width - o.x, Ie = t.includes("n") ? o.y + o.h : h.canvas.height - o.y;
340
- z = Math.max(p.w, Math.min(b(z), Ne)), q = Math.max(p.h, Math.min(b(q), Ie)), t.includes("w") && (pe = Math.max(0, o.x + o.w - z)), t.includes("n") && (ge = Math.max(0, o.y + o.h - q)), l.x = b(pe), l.y = b(ge), l.width = b(z), l.height = b(q);
341
- }, T = () => {
342
- document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", T);
339
+ x: t.x,
340
+ y: t.y,
341
+ w: t.width,
342
+ h: t.height
343
+ }, f = c[t.type] || { w: 2, h: 2 }, y = (P) => {
344
+ const X = (P.clientX - o.mx) / _.value, Q = (P.clientY - o.my) / _.value;
345
+ let C = o.w, k = o.h, R = o.x, O = o.y;
346
+ l.includes("e") && (C = o.w + X), l.includes("s") && (k = o.h + Q), l.includes("w") && (C = o.w - X), l.includes("n") && (k = o.h - Q);
347
+ const j = l.includes("w") ? o.x + o.w : m.canvas.width - o.x, Z = l.includes("n") ? o.y + o.h : m.canvas.height - o.y;
348
+ C = Math.max(f.w, Math.min(b(C), j)), k = Math.max(f.h, Math.min(b(k), Z)), l.includes("w") && (R = Math.max(0, o.x + o.w - C)), l.includes("n") && (O = Math.max(0, o.y + o.h - k)), t.x = b(R), t.y = b(O), t.width = b(C), t.height = b(k);
349
+ }, B = () => {
350
+ document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", B);
343
351
  };
344
- document.addEventListener("mousemove", y), document.addEventListener("mouseup", T);
352
+ document.addEventListener("mousemove", y), document.addEventListener("mouseup", B);
345
353
  }
346
- function ve(l) {
347
- const t = document.activeElement;
348
- if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable))
354
+ function we(t) {
355
+ const l = document.activeElement;
356
+ if (l && (l.tagName === "INPUT" || l.tagName === "TEXTAREA" || l.tagName === "SELECT" || l.isContentEditable))
349
357
  return;
350
358
  const e = x.value;
351
359
  if (!e) return;
352
- const o = l.shiftKey ? 2 : 0.5, p = {
360
+ const o = t.shiftKey ? 2 : 0.5, f = {
353
361
  ArrowLeft: [-o, 0],
354
362
  ArrowRight: [o, 0],
355
363
  ArrowUp: [0, -o],
356
364
  ArrowDown: [0, o]
357
365
  };
358
- p[l.key] ? (l.preventDefault(), e.x = X(b(e.x + p[l.key][0]), e), e.y = H(b(e.y + p[l.key][1]), e)) : l.key === "Delete" || l.key === "Backspace" ? (l.preventDefault(), ne(e)) : l.key === "Escape" && (w.value = "");
366
+ f[t.key] ? (t.preventDefault(), e.x = W(b(e.x + f[t.key][0]), e), e.y = G(b(e.y + f[t.key][1]), e)) : t.key === "Delete" || t.key === "Backspace" ? (t.preventDefault(), de(e)) : t.key === "Escape" && (w.value = "");
359
367
  }
360
- Te(() => {
361
- document.addEventListener("keydown", ve);
362
- }), qe(() => {
363
- document.removeEventListener("keydown", ve);
364
- }), fe(
365
- () => h.canvas,
368
+ Be(() => {
369
+ document.addEventListener("keydown", we);
370
+ }), Re(() => {
371
+ document.removeEventListener("keydown", we);
372
+ }), _e(
373
+ () => m.canvas,
366
374
  () => {
367
- w.value = "";
375
+ w.value = "", S.value.v = !1, S.value.h = !1;
368
376
  }
369
377
  );
370
- function Ee() {
371
- for (const l of h.canvas.items)
372
- if (l.type === "barcode") {
373
- const t = N.value ? G(l, h.mockData) : l.content, e = [
374
- l.id,
375
- t,
376
- l.width,
377
- l.height,
378
- l.showValue ? 1 : 0
378
+ function Ie() {
379
+ for (const t of m.canvas.items)
380
+ if (t.type === "barcode") {
381
+ const l = q.value ? te(t, m.mockData) : t.content, e = [
382
+ t.id,
383
+ l,
384
+ t.width,
385
+ t.height,
386
+ t.showValue ? 1 : 0
379
387
  ].join("|");
380
- ae[l.id] !== e && (ae[l.id] = e, te.value[l.id] = be(
381
- t,
382
- l.width,
383
- l.height,
384
- l.showValue !== !1
388
+ me[t.id] !== e && (me[t.id] = e, ie.value[t.id] = ze(
389
+ l,
390
+ t.width,
391
+ t.height,
392
+ t.showValue !== !1
385
393
  ));
386
- } else if (l.type === "qrcode") {
387
- const t = N.value ? G(l, h.mockData) : l.content, e = `${l.id}|${t}`;
388
- de[l.id] !== e && (de[l.id] = e, Ve(t).then((o) => {
389
- le.value[l.id] = o;
394
+ } else if (t.type === "qrcode") {
395
+ const l = q.value ? te(t, m.mockData) : t.content, e = `${t.id}|${l}`;
396
+ he[t.id] !== e && (he[t.id] = e, Se(l).then((o) => {
397
+ ae.value[t.id] = o;
390
398
  }));
391
399
  }
392
400
  }
393
- fe(
394
- [() => h.canvas.items, N, () => h.mockData],
395
- Ee,
401
+ _e(
402
+ [() => m.canvas.items, q, () => m.mockData],
403
+ Ie,
396
404
  { deep: !0, immediate: !0 }
397
405
  );
398
- function Ue(l) {
406
+ function Te(t) {
399
407
  return {
400
- left: `${l.x * _.value}px`,
401
- top: `${l.y * _.value}px`,
402
- width: `${l.width * _.value}px`,
403
- height: `${l.height * _.value}px`,
404
- transform: l.rotation ? `rotate(${l.rotation}deg)` : void 0
408
+ left: `${t.x * _.value}px`,
409
+ top: `${t.y * _.value}px`,
410
+ width: `${t.width * _.value}px`,
411
+ height: `${t.height * _.value}px`,
412
+ transform: t.rotation ? `rotate(${t.rotation}deg)` : void 0
405
413
  };
406
414
  }
407
- function Le(l) {
415
+ function qe(t) {
408
416
  return {
409
- fontSize: `${((l.fontSize || 9) * Ye * _.value).toFixed(2)}px`,
410
- fontWeight: l.bold ? "700" : "400",
411
- textAlign: l.align || "left",
412
- color: l.color || "#000000"
417
+ fontSize: `${((t.fontSize || 9) * je * _.value).toFixed(2)}px`,
418
+ fontWeight: t.bold ? "700" : "400",
419
+ textAlign: t.align || "left",
420
+ color: t.color || "#000000"
413
421
  };
414
422
  }
415
- function De(l) {
416
- return l.type === "value" ? N.value ? _e(l, h.mockData) : String(l.testData ?? "") : String(l.text ?? "");
423
+ function Ae(t) {
424
+ return t.type === "value" ? q.value ? Me(t, m.mockData) : String(t.testData ?? "") : String(t.text ?? "");
417
425
  }
418
- return (l, t) => (g(), f("div", Fe, [
419
- n("aside", Ke, [
420
- We,
421
- Ge,
422
- n("div", Je, [
423
- (g(), f($, null, Y(J, (e) => n("div", {
426
+ return (t, l) => (v(), p("div", Ge, [
427
+ n("aside", Je, [
428
+ Qe,
429
+ Ze,
430
+ n("div", et, [
431
+ (v(), p(z, null, H(le, (e) => n("div", {
424
432
  key: e.type,
425
433
  class: "ldesign-palette-item",
426
434
  draggable: "true",
427
- onDragstart: (o) => ze(e.type, o),
428
- onClick: (o) => he(e.type)
435
+ onDragstart: (o) => Ue(e.type, o),
436
+ onClick: (o) => ye(e.type)
429
437
  }, [
430
438
  n("span", {
431
439
  class: "ldesign-palette-thumb",
432
440
  innerHTML: e.thumb
433
- }, null, 8, Ze),
434
- n("span", et, S(e.label), 1),
435
- n("span", tt, S(e.desc), 1)
436
- ], 40, Qe)), 64))
441
+ }, null, 8, lt),
442
+ n("span", nt, E(e.label), 1),
443
+ n("span", st, E(e.desc), 1)
444
+ ], 40, tt)), 64))
437
445
  ]),
438
- lt,
439
- n("div", nt, [
440
- (g(!0), f($, null, Y(s.canvas.items, (e) => (g(), f("div", {
446
+ ot,
447
+ n("div", it, [
448
+ (v(!0), p(z, null, H(s.canvas.items, (e) => (v(), p("div", {
441
449
  key: e.id,
442
- class: P(["ldesign-layer", { "is-active": e.id === w.value }]),
450
+ class: F(["ldesign-layer", { "is-active": e.id === w.value }]),
443
451
  onClick: (o) => w.value = e.id
444
452
  }, [
445
453
  n("span", {
446
- class: P(["ldesign-layer-tag", `is-${e.type}`])
447
- }, S(me(e.type)), 3),
448
- n("span", ot, S(e.name), 1),
449
- n("span", it, [
450
- i(a(E), {
454
+ class: F(["ldesign-layer-tag", `is-${e.type}`])
455
+ }, E(fe(e.type)), 3),
456
+ n("span", dt, E(e.name), 1),
457
+ n("span", rt, [
458
+ i(a(D), {
451
459
  size: "small",
452
460
  circle: "",
453
- onClick: L((o) => F(e, -1), ["stop"])
461
+ onClick: I((o) => J(e, -1), ["stop"])
454
462
  }, {
455
- default: k(() => [
456
- C("↑")
463
+ default: $(() => [
464
+ U("↑")
457
465
  ]),
458
466
  _: 2
459
467
  }, 1032, ["onClick"]),
460
- i(a(E), {
468
+ i(a(D), {
461
469
  size: "small",
462
470
  circle: "",
463
- onClick: L((o) => F(e, 1), ["stop"])
471
+ onClick: I((o) => J(e, 1), ["stop"])
464
472
  }, {
465
- default: k(() => [
466
- C("↓")
473
+ default: $(() => [
474
+ U("↓")
467
475
  ]),
468
476
  _: 2
469
477
  }, 1032, ["onClick"]),
470
- i(a(E), {
478
+ i(a(D), {
471
479
  size: "small",
472
480
  circle: "",
473
- onClick: L((o) => ne(e), ["stop"])
481
+ onClick: I((o) => de(e), ["stop"])
474
482
  }, {
475
- default: k(() => [
476
- C("×")
483
+ default: $(() => [
484
+ U("×")
477
485
  ]),
478
486
  _: 2
479
487
  }, 1032, ["onClick"])
480
488
  ])
481
- ], 10, st))), 128)),
482
- s.canvas.items.length ? A("", !0) : (g(), f("div", at, "暂无元素"))
489
+ ], 10, at))), 128)),
490
+ s.canvas.items.length ? L("", !0) : (v(), p("div", ut, "暂无元素"))
483
491
  ])
484
492
  ]),
485
- n("section", dt, [
486
- n("div", rt, [
487
- n("div", ut, [
488
- ct,
489
- i(a(ye), {
490
- modelValue: Q.value,
491
- "onUpdate:modelValue": t[0] || (t[0] = (e) => Q.value = e),
493
+ n("section", ct, [
494
+ n("div", mt, [
495
+ n("div", ht, [
496
+ vt,
497
+ i(a(be), {
498
+ modelValue: ne.value,
499
+ "onUpdate:modelValue": l[0] || (l[0] = (e) => ne.value = e),
492
500
  size: "small",
493
501
  class: "ldesign-zoom-select"
494
502
  }, {
495
- default: k(() => [
496
- (g(), f($, null, Y(v, (e) => i(a(W), {
503
+ default: $(() => [
504
+ (v(), p(z, null, H(g, (e) => i(a(ee), {
497
505
  key: e,
498
506
  label: `${e}%`,
499
507
  value: e
@@ -501,162 +509,164 @@ const He = (s, u) => {
501
509
  ]),
502
510
  _: 1
503
511
  }, 8, ["modelValue"]),
504
- n("span", mt, [
505
- i(a(j), {
506
- modelValue: Z.value,
507
- "onUpdate:modelValue": t[1] || (t[1] = (e) => Z.value = e),
512
+ n("span", pt, [
513
+ i(a(K), {
514
+ modelValue: se.value,
515
+ "onUpdate:modelValue": l[1] || (l[1] = (e) => se.value = e),
508
516
  size: "small"
509
517
  }, null, 8, ["modelValue"]),
510
- ht
518
+ gt
511
519
  ]),
512
- n("span", vt, [
513
- i(a(j), {
514
- modelValue: ee.value,
515
- "onUpdate:modelValue": t[2] || (t[2] = (e) => ee.value = e),
520
+ n("span", ft, [
521
+ i(a(K), {
522
+ modelValue: oe.value,
523
+ "onUpdate:modelValue": l[2] || (l[2] = (e) => oe.value = e),
516
524
  size: "small"
517
525
  }, null, 8, ["modelValue"]),
518
- pt
526
+ yt
519
527
  ]),
520
- n("span", gt, [
521
- i(a(j), {
522
- modelValue: N.value,
523
- "onUpdate:modelValue": t[3] || (t[3] = (e) => N.value = e),
528
+ n("span", wt, [
529
+ i(a(K), {
530
+ modelValue: q.value,
531
+ "onUpdate:modelValue": l[3] || (l[3] = (e) => q.value = e),
524
532
  size: "small"
525
533
  }, null, 8, ["modelValue"]),
526
- ft
534
+ xt
527
535
  ])
528
536
  ]),
529
- n("div", yt, [
530
- n("span", wt, S(s.canvas.width) + " × " + S(s.canvas.height) + " mm", 1),
531
- i(a(E), {
537
+ n("div", _t, [
538
+ n("span", bt, E(s.canvas.width) + " × " + E(s.canvas.height) + " mm", 1),
539
+ i(a(D), {
532
540
  size: "small",
533
- onClick: t[4] || (t[4] = (e) => w.value = "")
541
+ onClick: l[4] || (l[4] = (e) => w.value = "")
534
542
  }, {
535
- default: k(() => [
536
- C("画布设置")
543
+ default: $(() => [
544
+ U("画布设置")
537
545
  ]),
538
546
  _: 1
539
547
  })
540
548
  ])
541
549
  ]),
542
- n("div", xt, [
550
+ n("div", Vt, [
543
551
  n("div", {
544
552
  ref_key: "paperRef",
545
- ref: ie,
546
- class: P(["ldesign-paper", { "is-grid": Z.value }]),
547
- style: se(ke.value),
548
- onDragover: t[5] || (t[5] = L(() => {
553
+ ref: ce,
554
+ class: F(["ldesign-paper", { "is-grid": se.value }]),
555
+ style: re(Ce.value),
556
+ onDragover: l[5] || (l[5] = I(() => {
549
557
  }, ["prevent"])),
550
- onDrop: Me,
551
- onMousedown: t[6] || (t[6] = L((e) => w.value = "", ["self"]))
558
+ onDrop: Le,
559
+ onMousedown: l[6] || (l[6] = I((e) => w.value = "", ["self"]))
552
560
  }, [
553
- (g(!0), f($, null, Y(s.canvas.items, (e) => (g(), f("div", {
561
+ (v(!0), p(z, null, H(s.canvas.items, (e) => (v(), p("div", {
554
562
  key: e.id,
555
- class: P(["ldesign-item", [`is-${e.type}`, { "is-selected": e.id === w.value }]]),
556
- style: se(Ue(e)),
557
- onMousedown: L((o) => Se(e, o), ["stop", "prevent"])
563
+ class: F(["ldesign-item", [`is-${e.type}`, { "is-selected": e.id === w.value }]]),
564
+ style: re(Te(e)),
565
+ onMousedown: I((o) => De(e, o), ["stop", "prevent"])
558
566
  }, [
559
- e.type === "text" || e.type === "value" ? (g(), f("div", {
567
+ e.type === "text" || e.type === "value" ? (v(), p("div", {
560
568
  key: 0,
561
569
  class: "ldesign-item-text",
562
- style: se(Le(e))
563
- }, S(De(e)), 5)) : e.type === "barcode" && te.value[e.id] ? (g(), f("img", {
570
+ style: re(qe(e))
571
+ }, E(Ae(e)), 5)) : e.type === "barcode" && ie.value[e.id] ? (v(), p("img", {
564
572
  key: 1,
565
573
  class: "ldesign-item-img is-fill",
566
- src: te.value[e.id],
574
+ src: ie.value[e.id],
567
575
  alt: "条形码",
568
576
  draggable: "false"
569
- }, null, 8, bt)) : e.type === "qrcode" && le.value[e.id] ? (g(), f("img", {
577
+ }, null, 8, $t)) : e.type === "qrcode" && ae.value[e.id] ? (v(), p("img", {
570
578
  key: 2,
571
579
  class: "ldesign-item-img is-contain",
572
- src: le.value[e.id],
580
+ src: ae.value[e.id],
573
581
  alt: "二维码",
574
582
  draggable: "false"
575
- }, null, 8, Vt)) : e.type === "barcode" ? (g(), f("div", kt, " 条形码内容无效 ")) : e.type === "qrcode" ? (g(), f("div", $t, " 二维码内容无效 ")) : A("", !0),
576
- e.type === "value" ? (g(), f("span", zt, "动态")) : A("", !0),
577
- e.id === w.value ? (g(), f($, { key: 6 }, Y(V, (o) => n("span", {
583
+ }, null, 8, Mt)) : e.type === "barcode" ? (v(), p("div", zt, " 条形码内容无效 ")) : e.type === "qrcode" ? (v(), p("div", St, " 二维码内容无效 ")) : L("", !0),
584
+ e.type === "value" ? (v(), p("span", Ct, "动态")) : L("", !0),
585
+ e.id === w.value ? (v(), p(z, { key: 6 }, H(V, (o) => n("span", {
578
586
  key: o,
579
- class: P(["ldesign-handle", `is-${o}`]),
580
- onMousedown: L((p) => Ce(e, o, p), ["stop", "prevent"])
581
- }, null, 42, Mt)), 64)) : A("", !0)
582
- ], 46, _t))), 128))
587
+ class: F(["ldesign-handle", `is-${o}`]),
588
+ onMousedown: I((f) => Ne(e, o, f), ["stop", "prevent"])
589
+ }, null, 42, Et)), 64)) : L("", !0)
590
+ ], 46, kt))), 128)),
591
+ S.value.v ? (v(), p("div", Ut)) : L("", !0),
592
+ S.value.h ? (v(), p("div", Lt)) : L("", !0)
583
593
  ], 38)
584
594
  ]),
585
- St
595
+ Dt
586
596
  ]),
587
- n("aside", Ct, [
588
- x.value ? (g(), f($, { key: 0 }, [
589
- n("div", Et, " 元素设置 · " + S(me(x.value.type)), 1),
590
- n("div", Ut, [
591
- n("div", Lt, [
592
- Dt,
593
- i(a(D), {
597
+ n("aside", Nt, [
598
+ x.value ? (v(), p(z, { key: 0 }, [
599
+ n("div", It, " 元素设置 · " + E(fe(x.value.type)), 1),
600
+ n("div", Tt, [
601
+ n("div", qt, [
602
+ At,
603
+ i(a(T), {
594
604
  modelValue: d.value.name,
595
- "onUpdate:modelValue": t[7] || (t[7] = (e) => d.value.name = e),
605
+ "onUpdate:modelValue": l[7] || (l[7] = (e) => d.value.name = e),
596
606
  size: "small"
597
607
  }, null, 8, ["modelValue"])
598
608
  ]),
599
- x.value.type === "text" ? (g(), f("div", Nt, [
600
- It,
601
- i(a(D), {
609
+ x.value.type === "text" ? (v(), p("div", Bt, [
610
+ Rt,
611
+ i(a(T), {
602
612
  modelValue: d.value.text,
603
- "onUpdate:modelValue": t[8] || (t[8] = (e) => d.value.text = e),
613
+ "onUpdate:modelValue": l[8] || (l[8] = (e) => d.value.text = e),
604
614
  type: "textarea",
605
615
  rows: 2,
606
616
  size: "small"
607
617
  }, null, 8, ["modelValue"])
608
- ])) : x.value.type === "value" ? (g(), f($, { key: 1 }, [
609
- n("div", Tt, [
610
- qt,
611
- i(a(D), {
618
+ ])) : x.value.type === "value" ? (v(), p(z, { key: 1 }, [
619
+ n("div", Ot, [
620
+ Yt,
621
+ i(a(T), {
612
622
  modelValue: d.value.fieldName,
613
- "onUpdate:modelValue": t[9] || (t[9] = (e) => d.value.fieldName = e),
623
+ "onUpdate:modelValue": l[9] || (l[9] = (e) => d.value.fieldName = e),
614
624
  size: "small",
615
625
  placeholder: "数据里的字段标识,如 subjectName"
616
626
  }, null, 8, ["modelValue"])
617
627
  ]),
618
- n("div", Bt, [
619
- At,
620
- i(a(D), {
628
+ n("div", Pt, [
629
+ Xt,
630
+ i(a(T), {
621
631
  modelValue: d.value.testData,
622
- "onUpdate:modelValue": t[10] || (t[10] = (e) => d.value.testData = e),
632
+ "onUpdate:modelValue": l[10] || (l[10] = (e) => d.value.testData = e),
623
633
  size: "small",
624
634
  placeholder: "画布上直接显示的文字"
625
635
  }, null, 8, ["modelValue"])
626
636
  ]),
627
- Rt
628
- ], 64)) : (g(), f($, { key: 2 }, [
629
- n("div", Ot, [
630
- Yt,
631
- i(a(D), {
637
+ jt
638
+ ], 64)) : (v(), p(z, { key: 2 }, [
639
+ n("div", Ht, [
640
+ Ft,
641
+ i(a(T), {
632
642
  modelValue: d.value.content,
633
- "onUpdate:modelValue": t[11] || (t[11] = (e) => d.value.content = e),
643
+ "onUpdate:modelValue": l[11] || (l[11] = (e) => d.value.content = e),
634
644
  size: "small"
635
645
  }, null, 8, ["modelValue"])
636
646
  ]),
637
- n("div", Pt, [
638
- jt,
639
- i(a(D), {
647
+ n("div", Kt, [
648
+ Wt,
649
+ i(a(T), {
640
650
  modelValue: d.value.fieldName,
641
- "onUpdate:modelValue": t[12] || (t[12] = (e) => d.value.fieldName = e),
651
+ "onUpdate:modelValue": l[12] || (l[12] = (e) => d.value.fieldName = e),
642
652
  size: "small",
643
653
  placeholder: "填了字段名,打印时优先取模拟数据"
644
654
  }, null, 8, ["modelValue"])
645
655
  ]),
646
- x.value.type === "barcode" ? (g(), f("div", Xt, [
647
- Ht,
648
- i(a(j), {
656
+ x.value.type === "barcode" ? (v(), p("div", Gt, [
657
+ Jt,
658
+ i(a(K), {
649
659
  modelValue: d.value.showValue,
650
- "onUpdate:modelValue": t[13] || (t[13] = (e) => d.value.showValue = e)
660
+ "onUpdate:modelValue": l[13] || (l[13] = (e) => d.value.showValue = e)
651
661
  }, null, 8, ["modelValue"])
652
- ])) : A("", !0)
662
+ ])) : L("", !0)
653
663
  ], 64)),
654
- x.value.type === "text" || x.value.type === "value" ? (g(), f("div", Ft, [
655
- n("div", Kt, [
656
- Wt,
657
- i(a(U), {
664
+ x.value.type === "text" || x.value.type === "value" ? (v(), p("div", Qt, [
665
+ n("div", Zt, [
666
+ el,
667
+ i(a(N), {
658
668
  modelValue: d.value.fontSize,
659
- "onUpdate:modelValue": t[14] || (t[14] = (e) => d.value.fontSize = e),
669
+ "onUpdate:modelValue": l[14] || (l[14] = (e) => d.value.fontSize = e),
660
670
  min: 4,
661
671
  max: 72,
662
672
  step: 0.5,
@@ -664,30 +674,30 @@ const He = (s, u) => {
664
674
  style: { width: "100%" }
665
675
  }, null, 8, ["modelValue"])
666
676
  ]),
667
- n("div", Gt, [
668
- Jt,
669
- i(a(j), {
677
+ n("div", tl, [
678
+ ll,
679
+ i(a(K), {
670
680
  modelValue: d.value.bold,
671
- "onUpdate:modelValue": t[15] || (t[15] = (e) => d.value.bold = e)
681
+ "onUpdate:modelValue": l[15] || (l[15] = (e) => d.value.bold = e)
672
682
  }, null, 8, ["modelValue"])
673
683
  ]),
674
- n("div", Qt, [
675
- Zt,
676
- i(a(ye), {
684
+ n("div", nl, [
685
+ sl,
686
+ i(a(be), {
677
687
  modelValue: d.value.align,
678
- "onUpdate:modelValue": t[16] || (t[16] = (e) => d.value.align = e),
688
+ "onUpdate:modelValue": l[16] || (l[16] = (e) => d.value.align = e),
679
689
  size: "small"
680
690
  }, {
681
- default: k(() => [
682
- i(a(W), {
691
+ default: $(() => [
692
+ i(a(ee), {
683
693
  label: "左对齐",
684
694
  value: "left"
685
695
  }),
686
- i(a(W), {
696
+ i(a(ee), {
687
697
  label: "居中",
688
698
  value: "center"
689
699
  }),
690
- i(a(W), {
700
+ i(a(ee), {
691
701
  label: "右对齐",
692
702
  value: "right"
693
703
  })
@@ -695,65 +705,65 @@ const He = (s, u) => {
695
705
  _: 1
696
706
  }, 8, ["modelValue"])
697
707
  ]),
698
- n("div", el, [
699
- tl,
700
- i(a(Re), {
708
+ n("div", ol, [
709
+ il,
710
+ i(a(Pe), {
701
711
  modelValue: d.value.color,
702
- "onUpdate:modelValue": t[17] || (t[17] = (e) => d.value.color = e),
712
+ "onUpdate:modelValue": l[17] || (l[17] = (e) => d.value.color = e),
703
713
  size: "small"
704
714
  }, null, 8, ["modelValue"])
705
715
  ])
706
- ])) : A("", !0),
707
- n("div", ll, [
708
- n("div", nl, [
709
- sl,
710
- i(a(U), {
716
+ ])) : L("", !0),
717
+ n("div", al, [
718
+ n("div", dl, [
719
+ rl,
720
+ i(a(N), {
711
721
  modelValue: d.value.x,
712
- "onUpdate:modelValue": t[18] || (t[18] = (e) => d.value.x = e),
722
+ "onUpdate:modelValue": l[18] || (l[18] = (e) => d.value.x = e),
713
723
  min: 0,
714
724
  step: 0.5,
715
725
  size: "small",
716
726
  style: { width: "100%" }
717
727
  }, null, 8, ["modelValue"])
718
728
  ]),
719
- n("div", ol, [
720
- il,
721
- i(a(U), {
729
+ n("div", ul, [
730
+ cl,
731
+ i(a(N), {
722
732
  modelValue: d.value.y,
723
- "onUpdate:modelValue": t[19] || (t[19] = (e) => d.value.y = e),
733
+ "onUpdate:modelValue": l[19] || (l[19] = (e) => d.value.y = e),
724
734
  min: 0,
725
735
  step: 0.5,
726
736
  size: "small",
727
737
  style: { width: "100%" }
728
738
  }, null, 8, ["modelValue"])
729
739
  ]),
730
- n("div", al, [
731
- dl,
732
- i(a(U), {
740
+ n("div", ml, [
741
+ hl,
742
+ i(a(N), {
733
743
  modelValue: d.value.width,
734
- "onUpdate:modelValue": t[20] || (t[20] = (e) => d.value.width = e),
735
- min: ue.value.w,
744
+ "onUpdate:modelValue": l[20] || (l[20] = (e) => d.value.width = e),
745
+ min: pe.value.w,
736
746
  step: 0.5,
737
747
  size: "small",
738
748
  style: { width: "100%" }
739
749
  }, null, 8, ["modelValue", "min"])
740
750
  ]),
741
- n("div", rl, [
742
- ul,
743
- i(a(U), {
751
+ n("div", vl, [
752
+ pl,
753
+ i(a(N), {
744
754
  modelValue: d.value.height,
745
- "onUpdate:modelValue": t[21] || (t[21] = (e) => d.value.height = e),
746
- min: ue.value.h,
755
+ "onUpdate:modelValue": l[21] || (l[21] = (e) => d.value.height = e),
756
+ min: pe.value.h,
747
757
  step: 0.5,
748
758
  size: "small",
749
759
  style: { width: "100%" }
750
760
  }, null, 8, ["modelValue", "min"])
751
761
  ]),
752
- n("div", cl, [
753
- ml,
754
- i(a(U), {
762
+ n("div", gl, [
763
+ fl,
764
+ i(a(N), {
755
765
  modelValue: d.value.rotation,
756
- "onUpdate:modelValue": t[22] || (t[22] = (e) => d.value.rotation = e),
766
+ "onUpdate:modelValue": l[22] || (l[22] = (e) => d.value.rotation = e),
757
767
  min: 0,
758
768
  max: 359,
759
769
  step: 15,
@@ -762,75 +772,75 @@ const He = (s, u) => {
762
772
  }, null, 8, ["modelValue"])
763
773
  ])
764
774
  ]),
765
- n("div", hl, [
766
- i(a(E), {
775
+ n("div", yl, [
776
+ i(a(D), {
767
777
  size: "small",
768
- onClick: $e
778
+ onClick: Ee
769
779
  }, {
770
- default: k(() => [
771
- C("复制")
780
+ default: $(() => [
781
+ U("复制")
772
782
  ]),
773
783
  _: 1
774
784
  }),
775
- i(a(E), {
785
+ i(a(D), {
776
786
  size: "small",
777
- onClick: t[23] || (t[23] = (e) => F(x.value, -1))
787
+ onClick: l[23] || (l[23] = (e) => J(x.value, -1))
778
788
  }, {
779
- default: k(() => [
780
- C("上移图层")
789
+ default: $(() => [
790
+ U("上移图层")
781
791
  ]),
782
792
  _: 1
783
793
  }),
784
- i(a(E), {
794
+ i(a(D), {
785
795
  size: "small",
786
- onClick: t[24] || (t[24] = (e) => F(x.value, 1))
796
+ onClick: l[24] || (l[24] = (e) => J(x.value, 1))
787
797
  }, {
788
- default: k(() => [
789
- C("下移图层")
798
+ default: $(() => [
799
+ U("下移图层")
790
800
  ]),
791
801
  _: 1
792
802
  }),
793
- i(a(E), {
803
+ i(a(D), {
794
804
  size: "small",
795
805
  type: "danger",
796
806
  plain: "",
797
- onClick: t[25] || (t[25] = (e) => ne(x.value))
807
+ onClick: l[25] || (l[25] = (e) => de(x.value))
798
808
  }, {
799
- default: k(() => [
800
- C("删除")
809
+ default: $(() => [
810
+ U("删除")
801
811
  ]),
802
812
  _: 1
803
813
  })
804
814
  ])
805
815
  ])
806
- ], 64)) : (g(), f($, { key: 1 }, [
807
- vl,
808
- n("div", pl, [
809
- n("div", gl, [
810
- fl,
811
- i(a(D), {
812
- modelValue: I.value.name,
813
- "onUpdate:modelValue": t[26] || (t[26] = (e) => I.value.name = e),
816
+ ], 64)) : (v(), p(z, { key: 1 }, [
817
+ wl,
818
+ n("div", xl, [
819
+ n("div", _l, [
820
+ bl,
821
+ i(a(T), {
822
+ modelValue: A.value.name,
823
+ "onUpdate:modelValue": l[26] || (l[26] = (e) => A.value.name = e),
814
824
  size: "small"
815
825
  }, null, 8, ["modelValue"])
816
826
  ]),
817
- n("div", yl, [
818
- n("div", wl, [
819
- xl,
820
- i(a(U), {
821
- modelValue: I.value.width,
822
- "onUpdate:modelValue": t[27] || (t[27] = (e) => I.value.width = e),
827
+ n("div", Vl, [
828
+ n("div", kl, [
829
+ $l,
830
+ i(a(N), {
831
+ modelValue: A.value.width,
832
+ "onUpdate:modelValue": l[27] || (l[27] = (e) => A.value.width = e),
823
833
  min: 5,
824
834
  max: 500,
825
835
  size: "small",
826
836
  style: { width: "100%" }
827
837
  }, null, 8, ["modelValue"])
828
838
  ]),
829
- n("div", _l, [
830
- bl,
831
- i(a(U), {
832
- modelValue: I.value.height,
833
- "onUpdate:modelValue": t[28] || (t[28] = (e) => I.value.height = e),
839
+ n("div", Ml, [
840
+ zl,
841
+ i(a(N), {
842
+ modelValue: A.value.height,
843
+ "onUpdate:modelValue": l[28] || (l[28] = (e) => A.value.height = e),
834
844
  min: 5,
835
845
  max: 500,
836
846
  size: "small",
@@ -838,20 +848,20 @@ const He = (s, u) => {
838
848
  }, null, 8, ["modelValue"])
839
849
  ])
840
850
  ]),
841
- Vl
851
+ Sl
842
852
  ])
843
853
  ], 64))
844
854
  ])
845
855
  ]));
846
856
  }
847
- }, El = /* @__PURE__ */ He(kl, [["__scopeId", "data-v-80df9fa9"]]);
857
+ }, Il = /* @__PURE__ */ We(Cl, [["__scopeId", "data-v-488f17e7"]]);
848
858
  export {
849
- El as LabelDesigner,
850
- Ye as PT2MM,
851
- be as barcodeDataURL,
852
- Xe as buildPrintHTML,
853
- Cl as printCanvas,
854
- Ve as qrDataURL,
855
- G as resolveContent,
856
- _e as resolveValue
859
+ Il as LabelDesigner,
860
+ je as PT2MM,
861
+ ze as barcodeDataURL,
862
+ Ke as buildPrintHTML,
863
+ Nl as printCanvas,
864
+ Se as qrDataURL,
865
+ te as resolveContent,
866
+ Me as resolveValue
857
867
  };