label-designer-vue 0.1.1 → 0.1.2

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,52 +1,52 @@
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
- return String(s ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1
+ import { ref as M, computed as F, onMounted as We, onBeforeUnmount as Oe, watch as $e, openBlock as u, createElementBlock as c, createElementVNode as s, Fragment as k, renderList as H, toDisplayString as L, normalizeClass as I, createVNode as a, unref as d, withModifiers as N, withCtx as D, createTextVNode as K, createCommentVNode as z, normalizeStyle as G, pushScopeId as Pe, popScopeId as Xe } from "vue";
2
+ import { ElButton as J, ElSelect as ce, ElOption as Q, ElSwitch as Z, ElInput as S, ElInputNumber as $, ElColorPicker as ne } from "element-plus";
3
+ import Ce from "jsbarcode";
4
+ import je from "qrcode";
5
+ const Ke = 25.4 / 72;
6
+ function B(n) {
7
+ return String(n ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
8
8
  }
9
- function Me(s, u = {}) {
10
- const c = s.fieldName ? u == null ? void 0 : u[s.fieldName] : void 0;
11
- return c != null && String(c) !== "" ? String(c) : String(s.testData ?? "");
9
+ function Se(n, m = {}) {
10
+ const h = n.fieldName ? m == null ? void 0 : m[n.fieldName] : void 0;
11
+ return h != null && String(h) !== "" ? String(h) : String(n.testData ?? "");
12
12
  }
13
- function te(s, u = {}) {
14
- const c = s.fieldName ? u == null ? void 0 : u[s.fieldName] : void 0;
15
- return c != null && String(c) !== "" ? String(c) : String(s.content ?? "");
13
+ function W(n, m = {}) {
14
+ const h = n.fieldName ? m == null ? void 0 : m[n.fieldName] : void 0;
15
+ return h != null && String(h) !== "" ? String(h) : String(n.content ?? "");
16
16
  }
17
- function ze(s, u, c, h = !0) {
18
- const V = String(s ?? "").trim();
19
- if (!V || !(u > 0) || !(c > 0)) return "";
17
+ function Ue(n, m, h, g = !0) {
18
+ const f = String(n ?? "").trim();
19
+ if (!f || !(m > 0) || !(h > 0)) return "";
20
20
  try {
21
- const g = document.createElement("canvas");
22
- if (Ve(g, V, {
21
+ const p = document.createElement("canvas");
22
+ if (Ce(p, f, {
23
23
  format: "CODE128",
24
24
  width: 1,
25
25
  height: 60,
26
- displayValue: h !== !1,
26
+ displayValue: g !== !1,
27
27
  fontSize: 12,
28
28
  textMargin: 1,
29
29
  margin: 0
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, {
30
+ }), !p.width || !p.height) return "";
31
+ const O = Math.max(1, p.width), oe = Math.max(0.1, m / h * p.height / O), v = document.createElement("canvas");
32
+ return Ce(v, f, {
33
33
  format: "CODE128",
34
- width: m,
34
+ width: oe,
35
35
  height: 60,
36
- displayValue: h !== !1,
36
+ displayValue: g !== !1,
37
37
  fontSize: 12,
38
38
  textMargin: 1,
39
39
  margin: 0
40
- }), w.toDataURL("image/png");
40
+ }), v.toDataURL("image/png");
41
41
  } catch {
42
42
  return "";
43
43
  }
44
44
  }
45
- async function Se(s) {
46
- const u = String(s ?? "").trim();
47
- if (!u) return "";
45
+ async function Ee(n) {
46
+ const m = String(n ?? "").trim();
47
+ if (!m) return "";
48
48
  try {
49
- return await Xe.toDataURL(u, {
49
+ return await je.toDataURL(m, {
50
50
  width: 240,
51
51
  margin: 1,
52
52
  errorCorrectionLevel: "M",
@@ -56,66 +56,83 @@ async function Se(s) {
56
56
  return "";
57
57
  }
58
58
  }
59
- function He(s) {
59
+ function Ge(n) {
60
60
  return [
61
- `left:${s.x}mm`,
62
- `top:${s.y}mm`,
63
- `width:${s.width}mm`,
64
- `height:${s.height}mm`,
65
- s.rotation ? `transform:rotate(${s.rotation}deg)` : ""
61
+ `left:${n.x}mm`,
62
+ `top:${n.y}mm`,
63
+ `width:${n.width}mm`,
64
+ `height:${n.height}mm`,
65
+ n.rotation ? `transform:rotate(${n.rotation}deg)` : ""
66
66
  ].filter(Boolean).join(";");
67
67
  }
68
- function ke(s) {
68
+ function Je(n) {
69
+ const m = String(n || "Microsoft YaHei").replace(/'/g, "");
70
+ return m.includes(" ") ? `'${m}'` : m;
71
+ }
72
+ function Me(n) {
69
73
  return [
70
- `font-size:${s.fontSize || 9}pt`,
71
- `font-weight:${s.bold ? "700" : "400"}`,
72
- `text-align:${s.align || "left"}`,
73
- `color:${s.color || "#000000"}`,
74
+ `font-family:${Je(n.fontFamily)},sans-serif`,
75
+ `font-size:${n.fontSize || 9}pt`,
76
+ `font-weight:${n.bold ? "700" : "400"}`,
77
+ `text-align:${n.align || "left"}`,
78
+ `color:${n.color || "#000000"}`,
74
79
  "line-height:1.15",
75
80
  "white-space:pre-wrap",
76
81
  "word-break:break-all",
77
82
  "overflow:hidden"
78
83
  ].join(";");
79
84
  }
80
- function Fe(s, u, c) {
81
- const h = He(s);
82
- if (s.type === "text")
83
- return `<div class="ld-print-item ld-print-text" style="${h};${ke(
84
- s
85
- )}">${ue(s.text)}</div>`;
86
- if (s.type === "value")
87
- return `<div class="ld-print-item ld-print-text" style="${h};${ke(
88
- s
89
- )}">${ue(Me(s, c))}</div>`;
90
- if (s.type === "barcode" || s.type === "qrcode") {
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>`;
85
+ function Qe(n, m, h) {
86
+ const g = Ge(n);
87
+ if (n.type === "text")
88
+ return `<div class="ld-print-item ld-print-text" style="${g};${Me(
89
+ n
90
+ )}">${B(n.text)}</div>`;
91
+ if (n.type === "value")
92
+ return `<div class="ld-print-item ld-print-text" style="${g};${Me(
93
+ n
94
+ )}">${B(Se(n, h))}</div>`;
95
+ if (n.type === "image") {
96
+ const f = B(W(n, h));
97
+ return f ? `<div class="ld-print-item" style="${g}"><img class="ld-print-img is-fill" src="${f}" alt="" /></div>` : `<div class="ld-print-item" style="${g}"></div>`;
98
+ }
99
+ if (n.type === "line") {
100
+ const f = `${n.lineWidth || 1}px`, p = B(n.lineColor || "#000000"), O = n.width >= n.height ? `position:absolute;top:calc(50% - ${f}/2);left:0;right:0;height:${f};background:${p}` : `position:absolute;left:calc(50% - ${f}/2);top:0;bottom:0;width:${f};background:${p}`;
101
+ return `<div class="ld-print-item" style="${g}"><div style="${O}"></div></div>`;
102
+ }
103
+ if (n.type === "rect" || n.type === "ellipse") {
104
+ const f = n.type === "ellipse" ? "50%" : `${n.radius || 0}px`, p = `width:100%;height:100%;box-sizing:border-box;border:${n.borderWidth || 0}px solid ${B(n.borderColor || "#000000")};background:${B(n.fillColor || "#ffffff")};border-radius:${f}`;
105
+ return `<div class="ld-print-item" style="${g}"><div style="${p}"></div></div>`;
106
+ }
107
+ if (n.type === "barcode" || n.type === "qrcode") {
108
+ const f = m[n.id] || "", p = n.type === "barcode" ? "fill" : "contain";
109
+ return f ? `<div class="ld-print-item" style="${g}"><img class="ld-print-img is-${p}" src="${f}" alt="" /></div>` : `<div class="ld-print-item" style="${g}"></div>`;
93
110
  }
94
111
  return "";
95
112
  }
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("");
113
+ async function Ze(n, m = {}) {
114
+ const h = n.items || [], g = {};
115
+ for (const p of h)
116
+ p.type === "barcode" ? g[p.id] = Ue(
117
+ W(p, m),
118
+ p.width,
119
+ p.height,
120
+ p.showValue !== !1
121
+ ) : p.type === "qrcode" && (g[p.id] = await Ee(W(p, m)));
122
+ const f = h.map((p) => Qe(p, g, m)).join("");
106
123
  return `<!DOCTYPE html>
107
124
  <html>
108
125
  <head>
109
126
  <meta charset="utf-8" />
110
- <title>${ue(s.name || "标签打印")}</title>
127
+ <title>${B(n.name || "标签打印")}</title>
111
128
  <style>
112
- @page { size: ${s.width}mm ${s.height}mm; margin: 0; }
129
+ @page { size: ${n.width}mm ${n.height}mm; margin: 0; }
113
130
  * { margin: 0; padding: 0; box-sizing: border-box; }
114
131
  body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; }
115
132
  .ld-print-canvas {
116
133
  position: relative;
117
- width: ${s.width}mm;
118
- height: ${s.height}mm;
134
+ width: ${n.width}mm;
135
+ height: ${n.height}mm;
119
136
  overflow: hidden;
120
137
  background: #fff;
121
138
  }
@@ -127,49 +144,61 @@ async function Ke(s, u = {}) {
127
144
  </style>
128
145
  </head>
129
146
  <body>
130
- <div class="ld-print-canvas">${V}</div>
147
+ <div class="ld-print-canvas">${f}</div>
131
148
  </body>
132
149
  </html>`;
133
150
  }
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();
151
+ async function os(n, m = {}) {
152
+ const h = await Ze(n, m), g = window.open("", "_blank");
153
+ return g ? (g.document.write(h), g.document.close(), g.addEventListener("load", () => {
154
+ g.focus(), g.print();
138
155
  }), !0) : !1;
139
156
  }
140
- const We = (s, u) => {
141
- const c = s.__vccOpts || s;
142
- for (const [h, V] of u)
143
- c[h] = V;
144
- return c;
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 = {
157
+ const el = (n, m) => {
158
+ const h = n.__vccOpts || n;
159
+ for (const [g, f] of m)
160
+ h[g] = f;
161
+ return h;
162
+ }, r = (n) => (Pe("data-v-8646f5dc"), n = n(), Xe(), n), ll = { class: "ldesign" }, tl = { class: "ldesign-pane ldesign-left" }, sl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("div", { class: "ldesign-pane-title" }, "素材库", -1)), nl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("div", { class: "ldesign-pane-tip" }, "拖到画布上,或点击添加", -1)), ol = { class: "ldesign-palette" }, il = ["onDragstart", "onClick"], al = ["innerHTML"], dl = { class: "ldesign-palette-name" }, rl = { class: "ldesign-palette-desc" }, ul = /* @__PURE__ */ r(() => /* @__PURE__ */ s("div", { class: "ldesign-pane-title" }, "元素图层", -1)), cl = { class: "ldesign-layers" }, ml = ["onClick"], hl = { class: "ldesign-layer-name" }, pl = { class: "ldesign-layer-ops" }, vl = {
146
163
  key: 0,
147
164
  class: "ldesign-empty"
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
- key: 3,
165
+ }, gl = { class: "ldesign-center" }, fl = { class: "ldesign-canvas-bar" }, yl = { class: "ldesign-canvas-bar-left" }, wl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("span", { class: "ldesign-bar-label" }, "缩放", -1)), xl = { class: "ldesign-bar-switch" }, _l = /* @__PURE__ */ r(() => /* @__PURE__ */ s("span", null, "网格", -1)), bl = { class: "ldesign-bar-switch" }, Vl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("span", null, "对齐网格", -1)), kl = { class: "ldesign-bar-switch" }, $l = /* @__PURE__ */ r(() => /* @__PURE__ */ s("span", null, "预览模拟数据", -1)), Cl = { class: "ldesign-canvas-bar-right" }, Ml = { class: "ldesign-bar-size" }, zl = { class: "ldesign-stage" }, Sl = ["onMousedown"], Ul = ["src"], El = {
166
+ key: 2,
150
167
  class: "ldesign-item-placeholder"
151
- }, St = {
152
- key: 4,
168
+ }, Ll = ["src"], Nl = ["src"], Dl = {
169
+ key: 7,
153
170
  class: "ldesign-item-placeholder"
154
- }, Ct = {
155
- key: 5,
171
+ }, Tl = {
172
+ key: 8,
173
+ class: "ldesign-item-placeholder"
174
+ }, Il = {
175
+ key: 9,
156
176
  class: "ldesign-item-badge"
157
- }, Et = ["onMousedown"], Ut = {
177
+ }, Bl = ["onMousedown"], Yl = {
158
178
  key: 0,
159
179
  class: "ldesign-guide is-v"
160
- }, Lt = {
180
+ }, Rl = {
161
181
  key: 1,
162
182
  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 = {
183
+ }, ql = { class: "ldesign-pane ldesign-right" }, Al = { class: "ldesign-pane-title" }, Fl = { class: "ldesign-props" }, Hl = { class: "ldesign-prop-row" }, Wl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "名称", -1)), Ol = {
164
184
  key: 0,
165
185
  class: "ldesign-prop-row"
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 = {
186
+ }, Pl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "文本内容", -1)), Xl = { class: "ldesign-prop-row" }, jl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "字段名", -1)), Kl = { class: "ldesign-prop-row" }, Gl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "测试数据", -1)), Jl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("div", { class: "ldesign-prop-hint" }, " 画布默认显示测试数据;开启「预览模拟数据」或打印时,优先取模拟数据里该字段的值 ", -1)), Ql = { class: "ldesign-prop-row" }, Zl = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "图片地址", -1)), et = { class: "ldesign-prop-row" }, lt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "字段名(可选)", -1)), tt = { class: "ldesign-prop-row" }, st = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "码内容", -1)), nt = { class: "ldesign-prop-row" }, ot = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "字段名(可选)", -1)), it = {
167
187
  key: 0,
168
188
  class: "ldesign-prop-row"
169
- }, Jt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "显示条码值", -1)), Qt = {
170
- key: 3,
189
+ }, at = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "显示条码值", -1)), dt = {
190
+ key: 4,
191
+ class: "ldesign-grid2"
192
+ }, rt = { class: "ldesign-prop-cell" }, ut = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "线宽(px)", -1)), ct = { class: "ldesign-prop-cell" }, mt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "线条颜色", -1)), ht = {
193
+ key: 5,
171
194
  class: "ldesign-grid2"
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 = {
195
+ }, pt = { class: "ldesign-prop-cell" }, vt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "边框宽度(px)", -1)), gt = { class: "ldesign-prop-cell" }, ft = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "边框颜色", -1)), yt = { class: "ldesign-prop-cell" }, wt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "填充颜色", -1)), xt = {
196
+ key: 0,
197
+ class: "ldesign-prop-cell"
198
+ }, _t = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "圆角(px)", -1)), bt = {
199
+ key: 6,
200
+ class: "ldesign-grid2"
201
+ }, Vt = { class: "ldesign-prop-cell" }, kt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "字体", -1)), $t = { class: "ldesign-prop-cell" }, Ct = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "字号(pt)", -1)), Mt = { class: "ldesign-prop-cell" }, zt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "加粗", -1)), St = { class: "ldesign-prop-cell" }, Ut = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "对齐", -1)), Et = { class: "ldesign-prop-cell" }, Lt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "文字颜色", -1)), Nt = { class: "ldesign-grid2" }, Dt = { class: "ldesign-prop-cell" }, Tt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "位置 X(mm)", -1)), It = { class: "ldesign-prop-cell" }, Bt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "位置 Y(mm)", -1)), Yt = { class: "ldesign-prop-cell" }, Rt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "宽(mm)", -1)), qt = { class: "ldesign-prop-cell" }, At = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "高(mm)", -1)), Ft = { class: "ldesign-prop-cell" }, Ht = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "旋转(度)", -1)), Wt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("div", { class: "ldesign-pane-title" }, "画布设置", -1)), Ot = { class: "ldesign-props" }, Pt = { class: "ldesign-prop-row" }, Xt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "画布名称", -1)), jt = { class: "ldesign-grid2" }, Kt = { class: "ldesign-prop-cell" }, Gt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "宽(mm)", -1)), Jt = { class: "ldesign-prop-cell" }, Qt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("label", null, "高(mm)", -1)), Zt = /* @__PURE__ */ r(() => /* @__PURE__ */ s("div", { class: "ldesign-prop-hint" }, " 画布尺寸即实际标签纸大小(毫米),打印时按此尺寸出纸;点击画布空白处或「画布设置」返回本面板 ", -1)), ze = 0.6, es = {
173
202
  __name: "label-designer",
174
203
  props: {
175
204
  /** 当前编辑的画布对象(页面持有的设计数据,直接在其上编辑) */
@@ -177,23 +206,45 @@ const We = (s, u) => {
177
206
  /** 模拟数据(按字段名取值) */
178
207
  mockData: { type: Object, default: () => ({}) }
179
208
  },
180
- setup(s) {
181
- const u = {
209
+ setup(n) {
210
+ const m = {
182
211
  text: "文字",
183
212
  value: "动态数据",
184
213
  barcode: "条形码",
185
- qrcode: "二维码"
186
- }, c = {
214
+ qrcode: "二维码",
215
+ image: "图片",
216
+ line: "线条",
217
+ rect: "矩形框",
218
+ ellipse: "圆形"
219
+ }, h = {
187
220
  text: { w: 4, h: 2 },
188
221
  value: { w: 4, h: 2 },
189
222
  barcode: { w: 10, h: 5 },
190
- qrcode: { w: 5, h: 5 }
191
- }, h = {
223
+ qrcode: { w: 5, h: 5 },
224
+ image: { w: 8, h: 6 },
225
+ line: { w: 4, h: 1 },
226
+ rect: { w: 5, h: 5 },
227
+ ellipse: { w: 5, h: 5 }
228
+ }, g = [
229
+ "Microsoft YaHei",
230
+ "SimSun",
231
+ "SimHei",
232
+ "KaiTi",
233
+ "FangSong",
234
+ "Arial",
235
+ "Times New Roman",
236
+ "Verdana",
237
+ "Tahoma",
238
+ "Consolas",
239
+ "Courier New",
240
+ "Impact"
241
+ ], f = {
192
242
  text: {
193
243
  width: 20,
194
244
  height: 5,
195
245
  text: "文字内容",
196
246
  fontSize: 9,
247
+ fontFamily: "Microsoft YaHei",
197
248
  bold: !1,
198
249
  align: "left",
199
250
  color: "#000000"
@@ -204,6 +255,7 @@ const We = (s, u) => {
204
255
  fieldName: "",
205
256
  testData: "测试数据",
206
257
  fontSize: 9,
258
+ fontFamily: "Microsoft YaHei",
207
259
  bold: !1,
208
260
  align: "left",
209
261
  color: "#000000"
@@ -220,8 +272,35 @@ const We = (s, u) => {
220
272
  height: 10,
221
273
  content: "https://example.com",
222
274
  fieldName: ""
275
+ },
276
+ image: {
277
+ width: 16,
278
+ height: 12,
279
+ content: "",
280
+ fieldName: ""
281
+ },
282
+ line: {
283
+ width: 20,
284
+ height: 1,
285
+ lineWidth: 1,
286
+ lineColor: "#000000"
287
+ },
288
+ rect: {
289
+ width: 16,
290
+ height: 10,
291
+ borderWidth: 1,
292
+ borderColor: "#000000",
293
+ fillColor: "#ffffff",
294
+ radius: 0
295
+ },
296
+ ellipse: {
297
+ width: 10,
298
+ height: 10,
299
+ borderWidth: 1,
300
+ borderColor: "#000000",
301
+ fillColor: "#ffffff"
223
302
  }
224
- }, V = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], g = [50, 60, 80, 100, 120, 150], le = [
303
+ }, p = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], O = [50, 60, 80, 100, 120, 150], oe = [
225
304
  {
226
305
  type: "text",
227
306
  label: "文字",
@@ -245,94 +324,118 @@ const We = (s, u) => {
245
324
  label: "二维码",
246
325
  desc: "内容 / 字段",
247
326
  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>'
327
+ },
328
+ {
329
+ type: "image",
330
+ label: "图片",
331
+ desc: "Logo / 图片",
332
+ thumb: '<svg viewBox="0 0 32 20" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="3" y="3" width="26" height="14" rx="2"/><circle cx="10" cy="8" r="2"/><path d="M5 16l7-6 5 4 4-3 6 5"/></svg>'
333
+ },
334
+ {
335
+ type: "line",
336
+ label: "线条",
337
+ desc: "分隔线",
338
+ thumb: '<svg viewBox="0 0 32 20"><path d="M3 10h26" stroke="currentColor" stroke-width="2"/></svg>'
339
+ },
340
+ {
341
+ type: "rect",
342
+ label: "矩形框",
343
+ desc: "边框 / 底色",
344
+ thumb: '<svg viewBox="0 0 32 20" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="3" width="24" height="14" rx="2"/></svg>'
345
+ },
346
+ {
347
+ type: "ellipse",
348
+ label: "圆形",
349
+ desc: "圆框 / 底色",
350
+ thumb: '<svg viewBox="0 0 32 20" fill="none" stroke="currentColor" stroke-width="2"><ellipse cx="16" cy="10" rx="10" ry="7"/></svg>'
248
351
  }
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 = {};
352
+ ], v = n, _ = M(""), ie = M(100), ae = M(!0), de = M(!0), T = M(!1), me = M(null), U = M({ v: !1, h: !1 }), re = M({}), ue = M({}), he = {}, pe = {};
250
353
  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(
254
- () => x.value && c[x.value.type] || {
354
+ const Y = F(() => v.canvas), i = F(() => x.value), b = F(() => ie.value / 10), x = F(
355
+ () => v.canvas.items.find((t) => t.id === _.value) || null
356
+ ), ge = F(
357
+ () => x.value && h[x.value.type] || {
255
358
  w: 2,
256
359
  h: 2
257
360
  }
258
- ), Ce = Y(() => ({
259
- width: `${m.canvas.width * _.value}px`,
260
- height: `${m.canvas.height * _.value}px`,
261
- "--ld-mm": `${_.value}px`
361
+ ), Le = F(() => ({
362
+ width: `${v.canvas.width * b.value}px`,
363
+ height: `${v.canvas.height * b.value}px`,
364
+ "--ld-mm": `${b.value}px`
262
365
  }));
263
- function ge() {
366
+ function fe() {
264
367
  return ve += 1, `it_${Date.now().toString(36)}${ve}${Math.random().toString(36).slice(2, 6)}`;
265
368
  }
266
- function fe(t) {
267
- return u[t] || t;
369
+ function ye(t) {
370
+ return m[t] || t;
268
371
  }
269
- function b(t) {
270
- return oe.value ? Math.round(t * 2) / 2 : Math.round(t * 100) / 100;
372
+ function V(t) {
373
+ return de.value ? Math.round(t * 2) / 2 : Math.round(t * 100) / 100;
271
374
  }
272
- function W(t, l) {
273
- const e = Math.max(0, m.canvas.width - l.width);
375
+ function ee(t, l) {
376
+ const e = Math.max(0, v.canvas.width - l.width);
274
377
  return Math.min(Math.max(t, 0), e);
275
378
  }
276
- function G(t, l) {
277
- const e = Math.max(0, m.canvas.height - l.height);
379
+ function le(t, l) {
380
+ const e = Math.max(0, v.canvas.height - l.height);
278
381
  return Math.min(Math.max(t, 0), e);
279
382
  }
280
- function ye(t, l = null) {
281
- const e = h[t];
383
+ function we(t, l = null) {
384
+ const e = f[t];
282
385
  if (!e) return;
283
- const o = m.canvas.items, f = o.length + 1, y = {
284
- id: ge(),
386
+ const o = v.canvas.items, y = o.length + 1, w = {
387
+ id: fe(),
285
388
  type: t,
286
- name: `${u[t]}${f}`,
389
+ name: `${m[t]}${y}`,
287
390
  x: 0,
288
391
  y: 0,
289
392
  rotation: 0,
290
393
  ...e
291
394
  };
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;
395
+ t === "value" && !w.fieldName && (w.fieldName = `field${y}`), l ? (w.x = l.x, w.y = l.y) : (w.x = 2 + (y - 1) * 1.5 % Math.max(1, v.canvas.width - e.width), w.y = 2 + (y - 1) * 1.5 % Math.max(1, v.canvas.height - e.height)), w.x = ee(V(w.x), w), w.y = le(V(w.y), w), o.push(w), _.value = w.id;
293
396
  }
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 = "");
397
+ function xe(t) {
398
+ const l = v.canvas.items, e = l.indexOf(t);
399
+ e >= 0 && l.splice(e, 1), _.value === t.id && (_.value = "");
297
400
  }
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;
401
+ function Ne(t = x.value) {
402
+ const l = t;
403
+ if (!l) return;
404
+ const e = { ...l, id: fe(), name: `${l.name}-副本` };
405
+ e.x = ee(V(l.x + 1.5), e), e.y = le(V(l.y + 1.5), e), v.canvas.items.push(e), _.value = e.id;
303
406
  }
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));
407
+ function _e(t, l) {
408
+ const e = v.canvas.items, o = e.indexOf(t), y = o + l;
409
+ o < 0 || y < 0 || y >= e.length || (e.splice(o, 1), e.splice(y, 0, t));
307
410
  }
308
- function Ue(t, l) {
411
+ function De(t, l) {
309
412
  l.dataTransfer.effectAllowed = "copy", l.dataTransfer.setData("text/plain", t);
310
413
  }
311
- function Le(t) {
312
- var f;
414
+ function Te(t) {
415
+ var y;
313
416
  const l = t.dataTransfer.getData("text/plain");
314
- if (!h[l]) return;
315
- const e = (f = ce.value) == null ? void 0 : f.getBoundingClientRect();
417
+ if (!f[l]) return;
418
+ const e = (y = me.value) == null ? void 0 : y.getBoundingClientRect();
316
419
  if (!e) return;
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
420
+ const o = f[l];
421
+ we(l, {
422
+ x: (t.clientX - e.left) / b.value - o.width / 2,
423
+ y: (t.clientY - e.top) / b.value - o.height / 2
321
424
  });
322
425
  }
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;
426
+ function Ie(t, l) {
427
+ _.value = t.id;
428
+ const e = l.clientX, o = l.clientY, y = t.x, w = t.y, R = (X) => {
429
+ const te = (X.clientX - e) / b.value, E = (X.clientY - o) / b.value;
430
+ let C = V(y + te), q = V(w + E);
431
+ const A = v.canvas.width / 2, j = v.canvas.height / 2, se = Math.abs(C + t.width / 2 - A) <= ze, ke = Math.abs(q + t.height / 2 - j) <= ze;
432
+ se && (C = A - t.width / 2), ke && (q = j - t.height / 2), t.x = ee(C, t), t.y = le(q, t), U.value.v = se && Math.abs(t.x + t.width / 2 - A) < 0.01, U.value.h = ke && Math.abs(t.y + t.height / 2 - j) < 0.01;
330
433
  }, P = () => {
331
- S.value.v = !1, S.value.h = !1, document.removeEventListener("mousemove", B), document.removeEventListener("mouseup", P);
434
+ U.value.v = !1, U.value.h = !1, document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", P);
332
435
  };
333
- document.addEventListener("mousemove", B), document.addEventListener("mouseup", P);
436
+ document.addEventListener("mousemove", R), document.addEventListener("mouseup", P);
334
437
  }
335
- function Ne(t, l, e) {
438
+ function Be(t, l, e) {
336
439
  const o = {
337
440
  mx: e.clientX,
338
441
  my: e.clientY,
@@ -340,168 +443,196 @@ const We = (s, u) => {
340
443
  y: t.y,
341
444
  w: t.width,
342
445
  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);
446
+ }, y = h[t.type] || { w: 2, h: 2 }, w = (P) => {
447
+ const X = (P.clientX - o.mx) / b.value, te = (P.clientY - o.my) / b.value;
448
+ let E = o.w, C = o.h, q = o.x, A = o.y;
449
+ l.includes("e") && (E = o.w + X), l.includes("s") && (C = o.h + te), l.includes("w") && (E = o.w - X), l.includes("n") && (C = o.h - te);
450
+ const j = l.includes("w") ? o.x + o.w : v.canvas.width - o.x, se = l.includes("n") ? o.y + o.h : v.canvas.height - o.y;
451
+ E = Math.max(y.w, Math.min(V(E), j)), C = Math.max(y.h, Math.min(V(C), se)), l.includes("w") && (q = Math.max(0, o.x + o.w - E)), l.includes("n") && (A = Math.max(0, o.y + o.h - C)), t.x = V(q), t.y = V(A), t.width = V(E), t.height = V(C);
452
+ }, R = () => {
453
+ document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", R);
351
454
  };
352
- document.addEventListener("mousemove", y), document.addEventListener("mouseup", B);
455
+ document.addEventListener("mousemove", w), document.addEventListener("mouseup", R);
353
456
  }
354
- function we(t) {
457
+ function be(t) {
355
458
  const l = document.activeElement;
356
459
  if (l && (l.tagName === "INPUT" || l.tagName === "TEXTAREA" || l.tagName === "SELECT" || l.isContentEditable))
357
460
  return;
358
461
  const e = x.value;
359
462
  if (!e) return;
360
- const o = t.shiftKey ? 2 : 0.5, f = {
463
+ const o = t.shiftKey ? 2 : 0.5, y = {
361
464
  ArrowLeft: [-o, 0],
362
465
  ArrowRight: [o, 0],
363
466
  ArrowUp: [0, -o],
364
467
  ArrowDown: [0, o]
365
468
  };
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 = "");
469
+ y[t.key] ? (t.preventDefault(), e.x = ee(V(e.x + y[t.key][0]), e), e.y = le(V(e.y + y[t.key][1]), e)) : t.key === "Delete" || t.key === "Backspace" ? (t.preventDefault(), xe(e)) : t.key === "Escape" && (_.value = "");
367
470
  }
368
- Be(() => {
369
- document.addEventListener("keydown", we);
370
- }), Re(() => {
371
- document.removeEventListener("keydown", we);
372
- }), _e(
373
- () => m.canvas,
471
+ We(() => {
472
+ document.addEventListener("keydown", be);
473
+ }), Oe(() => {
474
+ document.removeEventListener("keydown", be);
475
+ }), $e(
476
+ () => v.canvas,
374
477
  () => {
375
- w.value = "", S.value.v = !1, S.value.h = !1;
478
+ _.value = "", U.value.v = !1, U.value.h = !1;
376
479
  }
377
480
  );
378
- function Ie() {
379
- for (const t of m.canvas.items)
481
+ function Ye() {
482
+ for (const t of v.canvas.items)
380
483
  if (t.type === "barcode") {
381
- const l = q.value ? te(t, m.mockData) : t.content, e = [
484
+ const l = T.value ? W(t, v.mockData) : t.content, e = [
382
485
  t.id,
383
486
  l,
384
487
  t.width,
385
488
  t.height,
386
489
  t.showValue ? 1 : 0
387
490
  ].join("|");
388
- me[t.id] !== e && (me[t.id] = e, ie.value[t.id] = ze(
491
+ he[t.id] !== e && (he[t.id] = e, re.value[t.id] = Ue(
389
492
  l,
390
493
  t.width,
391
494
  t.height,
392
495
  t.showValue !== !1
393
496
  ));
394
497
  } 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;
498
+ const l = T.value ? W(t, v.mockData) : t.content, e = `${t.id}|${l}`;
499
+ pe[t.id] !== e && (pe[t.id] = e, Ee(l).then((o) => {
500
+ ue.value[t.id] = o;
398
501
  }));
399
502
  }
400
503
  }
401
- _e(
402
- [() => m.canvas.items, q, () => m.mockData],
403
- Ie,
504
+ $e(
505
+ [() => v.canvas.items, T, () => v.mockData],
506
+ Ye,
404
507
  { deep: !0, immediate: !0 }
405
508
  );
406
- function Te(t) {
509
+ function Re(t) {
407
510
  return {
408
- left: `${t.x * _.value}px`,
409
- top: `${t.y * _.value}px`,
410
- width: `${t.width * _.value}px`,
411
- height: `${t.height * _.value}px`,
511
+ left: `${t.x * b.value}px`,
512
+ top: `${t.y * b.value}px`,
513
+ width: `${t.width * b.value}px`,
514
+ height: `${t.height * b.value}px`,
412
515
  transform: t.rotation ? `rotate(${t.rotation}deg)` : void 0
413
516
  };
414
517
  }
415
518
  function qe(t) {
416
519
  return {
417
- fontSize: `${((t.fontSize || 9) * je * _.value).toFixed(2)}px`,
520
+ fontSize: `${((t.fontSize || 9) * Ke * b.value).toFixed(2)}px`,
521
+ fontFamily: t.fontFamily || "Microsoft YaHei",
418
522
  fontWeight: t.bold ? "700" : "400",
419
523
  textAlign: t.align || "left",
420
524
  color: t.color || "#000000"
421
525
  };
422
526
  }
423
527
  function Ae(t) {
424
- return t.type === "value" ? q.value ? Me(t, m.mockData) : String(t.testData ?? "") : String(t.text ?? "");
528
+ return t.type === "value" ? T.value ? Se(t, v.mockData) : String(t.testData ?? "") : String(t.text ?? "");
529
+ }
530
+ function Ve(t) {
531
+ return T.value && t.fieldName ? W(t, v.mockData) : String(t.content ?? "");
532
+ }
533
+ function Fe(t) {
534
+ return {
535
+ "--ld-line-w": `${t.lineWidth || 1}px`,
536
+ "--ld-line-c": t.lineColor || "#000000"
537
+ };
425
538
  }
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", {
539
+ function He(t) {
540
+ return {
541
+ border: `${t.borderWidth || 0}px solid ${t.borderColor || "#000000"}`,
542
+ background: t.fillColor || "#ffffff",
543
+ borderRadius: t.type === "ellipse" ? "50%" : `${t.radius || 0}px`
544
+ };
545
+ }
546
+ return (t, l) => (u(), c("div", ll, [
547
+ s("aside", tl, [
548
+ sl,
549
+ nl,
550
+ s("div", ol, [
551
+ (u(), c(k, null, H(oe, (e) => s("div", {
432
552
  key: e.type,
433
553
  class: "ldesign-palette-item",
434
554
  draggable: "true",
435
- onDragstart: (o) => Ue(e.type, o),
436
- onClick: (o) => ye(e.type)
555
+ onDragstart: (o) => De(e.type, o),
556
+ onClick: (o) => we(e.type)
437
557
  }, [
438
- n("span", {
558
+ s("span", {
439
559
  class: "ldesign-palette-thumb",
440
560
  innerHTML: e.thumb
441
- }, null, 8, lt),
442
- n("span", nt, E(e.label), 1),
443
- n("span", st, E(e.desc), 1)
444
- ], 40, tt)), 64))
561
+ }, null, 8, al),
562
+ s("span", dl, L(e.label), 1),
563
+ s("span", rl, L(e.desc), 1)
564
+ ], 40, il)), 64))
445
565
  ]),
446
- ot,
447
- n("div", it, [
448
- (v(!0), p(z, null, H(s.canvas.items, (e) => (v(), p("div", {
566
+ ul,
567
+ s("div", cl, [
568
+ (u(!0), c(k, null, H(n.canvas.items, (e) => (u(), c("div", {
449
569
  key: e.id,
450
- class: F(["ldesign-layer", { "is-active": e.id === w.value }]),
451
- onClick: (o) => w.value = e.id
570
+ class: I(["ldesign-layer", { "is-active": e.id === _.value }]),
571
+ onClick: (o) => _.value = e.id
452
572
  }, [
453
- n("span", {
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), {
573
+ s("span", {
574
+ class: I(["ldesign-layer-tag", `is-${e.type}`])
575
+ }, L(ye(e.type)), 3),
576
+ s("span", hl, L(e.name), 1),
577
+ s("span", pl, [
578
+ a(d(J), {
579
+ size: "small",
580
+ circle: "",
581
+ title: "复制元素",
582
+ onClick: N((o) => Ne(e), ["stop"])
583
+ }, {
584
+ default: D(() => [
585
+ K("复")
586
+ ]),
587
+ _: 2
588
+ }, 1032, ["onClick"]),
589
+ a(d(J), {
459
590
  size: "small",
460
591
  circle: "",
461
- onClick: I((o) => J(e, -1), ["stop"])
592
+ onClick: N((o) => _e(e, -1), ["stop"])
462
593
  }, {
463
- default: $(() => [
464
- U("↑")
594
+ default: D(() => [
595
+ K("↑")
465
596
  ]),
466
597
  _: 2
467
598
  }, 1032, ["onClick"]),
468
- i(a(D), {
599
+ a(d(J), {
469
600
  size: "small",
470
601
  circle: "",
471
- onClick: I((o) => J(e, 1), ["stop"])
602
+ onClick: N((o) => _e(e, 1), ["stop"])
472
603
  }, {
473
- default: $(() => [
474
- U("↓")
604
+ default: D(() => [
605
+ K("↓")
475
606
  ]),
476
607
  _: 2
477
608
  }, 1032, ["onClick"]),
478
- i(a(D), {
609
+ a(d(J), {
479
610
  size: "small",
480
611
  circle: "",
481
- onClick: I((o) => de(e), ["stop"])
612
+ onClick: N((o) => xe(e), ["stop"])
482
613
  }, {
483
- default: $(() => [
484
- U("×")
614
+ default: D(() => [
615
+ K("×")
485
616
  ]),
486
617
  _: 2
487
618
  }, 1032, ["onClick"])
488
619
  ])
489
- ], 10, at))), 128)),
490
- s.canvas.items.length ? L("", !0) : (v(), p("div", ut, "暂无元素"))
620
+ ], 10, ml))), 128)),
621
+ n.canvas.items.length ? z("", !0) : (u(), c("div", vl, "暂无元素"))
491
622
  ])
492
623
  ]),
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),
624
+ s("section", gl, [
625
+ s("div", fl, [
626
+ s("div", yl, [
627
+ wl,
628
+ a(d(ce), {
629
+ modelValue: ie.value,
630
+ "onUpdate:modelValue": l[0] || (l[0] = (e) => ie.value = e),
500
631
  size: "small",
501
632
  class: "ldesign-zoom-select"
502
633
  }, {
503
- default: $(() => [
504
- (v(), p(z, null, H(g, (e) => i(a(ee), {
634
+ default: D(() => [
635
+ (u(), c(k, null, H(O, (e) => a(d(Q), {
505
636
  key: e,
506
637
  label: `${e}%`,
507
638
  value: e
@@ -509,164 +640,275 @@ const We = (s, u) => {
509
640
  ]),
510
641
  _: 1
511
642
  }, 8, ["modelValue"]),
512
- n("span", pt, [
513
- i(a(K), {
514
- modelValue: se.value,
515
- "onUpdate:modelValue": l[1] || (l[1] = (e) => se.value = e),
643
+ s("span", xl, [
644
+ a(d(Z), {
645
+ modelValue: ae.value,
646
+ "onUpdate:modelValue": l[1] || (l[1] = (e) => ae.value = e),
516
647
  size: "small"
517
648
  }, null, 8, ["modelValue"]),
518
- gt
649
+ _l
519
650
  ]),
520
- n("span", ft, [
521
- i(a(K), {
522
- modelValue: oe.value,
523
- "onUpdate:modelValue": l[2] || (l[2] = (e) => oe.value = e),
651
+ s("span", bl, [
652
+ a(d(Z), {
653
+ modelValue: de.value,
654
+ "onUpdate:modelValue": l[2] || (l[2] = (e) => de.value = e),
524
655
  size: "small"
525
656
  }, null, 8, ["modelValue"]),
526
- yt
657
+ Vl
527
658
  ]),
528
- n("span", wt, [
529
- i(a(K), {
530
- modelValue: q.value,
531
- "onUpdate:modelValue": l[3] || (l[3] = (e) => q.value = e),
659
+ s("span", kl, [
660
+ a(d(Z), {
661
+ modelValue: T.value,
662
+ "onUpdate:modelValue": l[3] || (l[3] = (e) => T.value = e),
532
663
  size: "small"
533
664
  }, null, 8, ["modelValue"]),
534
- xt
665
+ $l
535
666
  ])
536
667
  ]),
537
- n("div", _t, [
538
- n("span", bt, E(s.canvas.width) + " × " + E(s.canvas.height) + " mm", 1),
539
- i(a(D), {
668
+ s("div", Cl, [
669
+ s("span", Ml, L(n.canvas.width) + " × " + L(n.canvas.height) + " mm", 1),
670
+ a(d(J), {
540
671
  size: "small",
541
- onClick: l[4] || (l[4] = (e) => w.value = "")
672
+ onClick: l[4] || (l[4] = (e) => _.value = "")
542
673
  }, {
543
- default: $(() => [
544
- U("画布设置")
674
+ default: D(() => [
675
+ K("画布设置")
545
676
  ]),
546
677
  _: 1
547
678
  })
548
679
  ])
549
680
  ]),
550
- n("div", Vt, [
551
- n("div", {
681
+ s("div", zl, [
682
+ s("div", {
552
683
  ref_key: "paperRef",
553
- ref: ce,
554
- class: F(["ldesign-paper", { "is-grid": se.value }]),
555
- style: re(Ce.value),
556
- onDragover: l[5] || (l[5] = I(() => {
684
+ ref: me,
685
+ class: I(["ldesign-paper", { "is-grid": ae.value }]),
686
+ style: G(Le.value),
687
+ onDragover: l[5] || (l[5] = N(() => {
557
688
  }, ["prevent"])),
558
- onDrop: Le,
559
- onMousedown: l[6] || (l[6] = I((e) => w.value = "", ["self"]))
689
+ onDrop: Te,
690
+ onMousedown: l[6] || (l[6] = N((e) => _.value = "", ["self"]))
560
691
  }, [
561
- (v(!0), p(z, null, H(s.canvas.items, (e) => (v(), p("div", {
692
+ (u(!0), c(k, null, H(n.canvas.items, (e) => (u(), c("div", {
562
693
  key: e.id,
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"])
694
+ class: I(["ldesign-item", [`is-${e.type}`, { "is-selected": e.id === _.value }]]),
695
+ style: G(Re(e)),
696
+ onMousedown: N((o) => Ie(e, o), ["stop", "prevent"])
566
697
  }, [
567
- e.type === "text" || e.type === "value" ? (v(), p("div", {
698
+ e.type === "text" || e.type === "value" ? (u(), c("div", {
568
699
  key: 0,
569
700
  class: "ldesign-item-text",
570
- style: re(qe(e))
571
- }, E(Ae(e)), 5)) : e.type === "barcode" && ie.value[e.id] ? (v(), p("img", {
701
+ style: G(qe(e))
702
+ }, L(Ae(e)), 5)) : e.type === "image" && Ve(e) ? (u(), c("img", {
572
703
  key: 1,
573
704
  class: "ldesign-item-img is-fill",
574
- src: ie.value[e.id],
705
+ src: Ve(e),
706
+ alt: "图片",
707
+ draggable: "false"
708
+ }, null, 8, Ul)) : e.type === "image" ? (u(), c("div", El, " 图片 ")) : e.type === "line" ? (u(), c("div", {
709
+ key: 3,
710
+ class: I(["ldesign-item-line", { "is-v": e.width < e.height }]),
711
+ style: G(Fe(e))
712
+ }, null, 6)) : e.type === "rect" || e.type === "ellipse" ? (u(), c("div", {
713
+ key: 4,
714
+ class: I(["ldesign-item-rect", { "is-ellipse": e.type === "ellipse" }]),
715
+ style: G(He(e))
716
+ }, null, 6)) : e.type === "barcode" && re.value[e.id] ? (u(), c("img", {
717
+ key: 5,
718
+ class: "ldesign-item-img is-fill",
719
+ src: re.value[e.id],
575
720
  alt: "条形码",
576
721
  draggable: "false"
577
- }, null, 8, $t)) : e.type === "qrcode" && ae.value[e.id] ? (v(), p("img", {
578
- key: 2,
722
+ }, null, 8, Ll)) : e.type === "qrcode" && ue.value[e.id] ? (u(), c("img", {
723
+ key: 6,
579
724
  class: "ldesign-item-img is-contain",
580
- src: ae.value[e.id],
725
+ src: ue.value[e.id],
581
726
  alt: "二维码",
582
727
  draggable: "false"
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", {
728
+ }, null, 8, Nl)) : e.type === "barcode" ? (u(), c("div", Dl, " 条形码内容无效 ")) : e.type === "qrcode" ? (u(), c("div", Tl, " 二维码内容无效 ")) : z("", !0),
729
+ e.type === "value" ? (u(), c("span", Il, "动态")) : z("", !0),
730
+ e.id === _.value ? (u(), c(k, { key: 10 }, H(p, (o) => s("span", {
586
731
  key: o,
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)
732
+ class: I(["ldesign-handle", `is-${o}`]),
733
+ onMousedown: N((y) => Be(e, o, y), ["stop", "prevent"])
734
+ }, null, 42, Bl)), 64)) : z("", !0)
735
+ ], 46, Sl))), 128)),
736
+ U.value.v ? (u(), c("div", Yl)) : z("", !0),
737
+ U.value.h ? (u(), c("div", Rl)) : z("", !0)
593
738
  ], 38)
594
- ]),
595
- Dt
739
+ ])
596
740
  ]),
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), {
604
- modelValue: d.value.name,
605
- "onUpdate:modelValue": l[7] || (l[7] = (e) => d.value.name = e),
741
+ s("aside", ql, [
742
+ x.value ? (u(), c(k, { key: 0 }, [
743
+ s("div", Al, " 元素设置 · " + L(ye(x.value.type)), 1),
744
+ s("div", Fl, [
745
+ s("div", Hl, [
746
+ Wl,
747
+ a(d(S), {
748
+ modelValue: i.value.name,
749
+ "onUpdate:modelValue": l[7] || (l[7] = (e) => i.value.name = e),
606
750
  size: "small"
607
751
  }, null, 8, ["modelValue"])
608
752
  ]),
609
- x.value.type === "text" ? (v(), p("div", Bt, [
610
- Rt,
611
- i(a(T), {
612
- modelValue: d.value.text,
613
- "onUpdate:modelValue": l[8] || (l[8] = (e) => d.value.text = e),
753
+ x.value.type === "text" ? (u(), c("div", Ol, [
754
+ Pl,
755
+ a(d(S), {
756
+ modelValue: i.value.text,
757
+ "onUpdate:modelValue": l[8] || (l[8] = (e) => i.value.text = e),
614
758
  type: "textarea",
615
759
  rows: 2,
616
760
  size: "small"
617
761
  }, null, 8, ["modelValue"])
618
- ])) : x.value.type === "value" ? (v(), p(z, { key: 1 }, [
619
- n("div", Ot, [
620
- Yt,
621
- i(a(T), {
622
- modelValue: d.value.fieldName,
623
- "onUpdate:modelValue": l[9] || (l[9] = (e) => d.value.fieldName = e),
762
+ ])) : x.value.type === "value" ? (u(), c(k, { key: 1 }, [
763
+ s("div", Xl, [
764
+ jl,
765
+ a(d(S), {
766
+ modelValue: i.value.fieldName,
767
+ "onUpdate:modelValue": l[9] || (l[9] = (e) => i.value.fieldName = e),
624
768
  size: "small",
625
769
  placeholder: "数据里的字段标识,如 subjectName"
626
770
  }, null, 8, ["modelValue"])
627
771
  ]),
628
- n("div", Pt, [
629
- Xt,
630
- i(a(T), {
631
- modelValue: d.value.testData,
632
- "onUpdate:modelValue": l[10] || (l[10] = (e) => d.value.testData = e),
772
+ s("div", Kl, [
773
+ Gl,
774
+ a(d(S), {
775
+ modelValue: i.value.testData,
776
+ "onUpdate:modelValue": l[10] || (l[10] = (e) => i.value.testData = e),
633
777
  size: "small",
634
778
  placeholder: "画布上直接显示的文字"
635
779
  }, null, 8, ["modelValue"])
636
780
  ]),
637
- jt
638
- ], 64)) : (v(), p(z, { key: 2 }, [
639
- n("div", Ht, [
640
- Ft,
641
- i(a(T), {
642
- modelValue: d.value.content,
643
- "onUpdate:modelValue": l[11] || (l[11] = (e) => d.value.content = e),
781
+ Jl
782
+ ], 64)) : x.value.type === "image" ? (u(), c(k, { key: 2 }, [
783
+ s("div", Ql, [
784
+ Zl,
785
+ a(d(S), {
786
+ modelValue: i.value.content,
787
+ "onUpdate:modelValue": l[11] || (l[11] = (e) => i.value.content = e),
788
+ size: "small",
789
+ placeholder: "图片链接或 dataURL"
790
+ }, null, 8, ["modelValue"])
791
+ ]),
792
+ s("div", et, [
793
+ lt,
794
+ a(d(S), {
795
+ modelValue: i.value.fieldName,
796
+ "onUpdate:modelValue": l[12] || (l[12] = (e) => i.value.fieldName = e),
797
+ size: "small",
798
+ placeholder: "填了字段名,打印时优先取模拟数据"
799
+ }, null, 8, ["modelValue"])
800
+ ])
801
+ ], 64)) : x.value.type === "barcode" || x.value.type === "qrcode" ? (u(), c(k, { key: 3 }, [
802
+ s("div", tt, [
803
+ st,
804
+ a(d(S), {
805
+ modelValue: i.value.content,
806
+ "onUpdate:modelValue": l[13] || (l[13] = (e) => i.value.content = e),
644
807
  size: "small"
645
808
  }, null, 8, ["modelValue"])
646
809
  ]),
647
- n("div", Kt, [
648
- Wt,
649
- i(a(T), {
650
- modelValue: d.value.fieldName,
651
- "onUpdate:modelValue": l[12] || (l[12] = (e) => d.value.fieldName = e),
810
+ s("div", nt, [
811
+ ot,
812
+ a(d(S), {
813
+ modelValue: i.value.fieldName,
814
+ "onUpdate:modelValue": l[14] || (l[14] = (e) => i.value.fieldName = e),
652
815
  size: "small",
653
816
  placeholder: "填了字段名,打印时优先取模拟数据"
654
817
  }, null, 8, ["modelValue"])
655
818
  ]),
656
- x.value.type === "barcode" ? (v(), p("div", Gt, [
657
- Jt,
658
- i(a(K), {
659
- modelValue: d.value.showValue,
660
- "onUpdate:modelValue": l[13] || (l[13] = (e) => d.value.showValue = e)
819
+ x.value.type === "barcode" ? (u(), c("div", it, [
820
+ at,
821
+ a(d(Z), {
822
+ modelValue: i.value.showValue,
823
+ "onUpdate:modelValue": l[15] || (l[15] = (e) => i.value.showValue = e)
824
+ }, null, 8, ["modelValue"])
825
+ ])) : z("", !0)
826
+ ], 64)) : x.value.type === "line" ? (u(), c("div", dt, [
827
+ s("div", rt, [
828
+ ut,
829
+ a(d($), {
830
+ modelValue: i.value.lineWidth,
831
+ "onUpdate:modelValue": l[16] || (l[16] = (e) => i.value.lineWidth = e),
832
+ min: 0.5,
833
+ max: 10,
834
+ step: 0.5,
835
+ size: "small",
836
+ style: { width: "100%" }
837
+ }, null, 8, ["modelValue"])
838
+ ]),
839
+ s("div", ct, [
840
+ mt,
841
+ a(d(ne), {
842
+ modelValue: i.value.lineColor,
843
+ "onUpdate:modelValue": l[17] || (l[17] = (e) => i.value.lineColor = e),
844
+ size: "small"
661
845
  }, null, 8, ["modelValue"])
662
- ])) : L("", !0)
663
- ], 64)),
664
- x.value.type === "text" || x.value.type === "value" ? (v(), p("div", Qt, [
665
- n("div", Zt, [
666
- el,
667
- i(a(N), {
668
- modelValue: d.value.fontSize,
669
- "onUpdate:modelValue": l[14] || (l[14] = (e) => d.value.fontSize = e),
846
+ ])
847
+ ])) : (u(), c("div", ht, [
848
+ s("div", pt, [
849
+ vt,
850
+ a(d($), {
851
+ modelValue: i.value.borderWidth,
852
+ "onUpdate:modelValue": l[18] || (l[18] = (e) => i.value.borderWidth = e),
853
+ min: 0,
854
+ max: 10,
855
+ step: 0.5,
856
+ size: "small",
857
+ style: { width: "100%" }
858
+ }, null, 8, ["modelValue"])
859
+ ]),
860
+ s("div", gt, [
861
+ ft,
862
+ a(d(ne), {
863
+ modelValue: i.value.borderColor,
864
+ "onUpdate:modelValue": l[19] || (l[19] = (e) => i.value.borderColor = e),
865
+ size: "small"
866
+ }, null, 8, ["modelValue"])
867
+ ]),
868
+ s("div", yt, [
869
+ wt,
870
+ a(d(ne), {
871
+ modelValue: i.value.fillColor,
872
+ "onUpdate:modelValue": l[20] || (l[20] = (e) => i.value.fillColor = e),
873
+ size: "small"
874
+ }, null, 8, ["modelValue"])
875
+ ]),
876
+ x.value.type === "rect" ? (u(), c("div", xt, [
877
+ _t,
878
+ a(d($), {
879
+ modelValue: i.value.radius,
880
+ "onUpdate:modelValue": l[21] || (l[21] = (e) => i.value.radius = e),
881
+ min: 0,
882
+ max: 30,
883
+ step: 1,
884
+ size: "small",
885
+ style: { width: "100%" }
886
+ }, null, 8, ["modelValue"])
887
+ ])) : z("", !0)
888
+ ])),
889
+ x.value.type === "text" || x.value.type === "value" ? (u(), c("div", bt, [
890
+ s("div", Vt, [
891
+ kt,
892
+ a(d(ce), {
893
+ modelValue: i.value.fontFamily,
894
+ "onUpdate:modelValue": l[22] || (l[22] = (e) => i.value.fontFamily = e),
895
+ size: "small"
896
+ }, {
897
+ default: D(() => [
898
+ (u(), c(k, null, H(g, (e) => a(d(Q), {
899
+ key: e,
900
+ label: e,
901
+ value: e
902
+ }, null, 8, ["label", "value"])), 64))
903
+ ]),
904
+ _: 1
905
+ }, 8, ["modelValue"])
906
+ ]),
907
+ s("div", $t, [
908
+ Ct,
909
+ a(d($), {
910
+ modelValue: i.value.fontSize,
911
+ "onUpdate:modelValue": l[23] || (l[23] = (e) => i.value.fontSize = e),
670
912
  min: 4,
671
913
  max: 72,
672
914
  step: 0.5,
@@ -674,30 +916,30 @@ const We = (s, u) => {
674
916
  style: { width: "100%" }
675
917
  }, null, 8, ["modelValue"])
676
918
  ]),
677
- n("div", tl, [
678
- ll,
679
- i(a(K), {
680
- modelValue: d.value.bold,
681
- "onUpdate:modelValue": l[15] || (l[15] = (e) => d.value.bold = e)
919
+ s("div", Mt, [
920
+ zt,
921
+ a(d(Z), {
922
+ modelValue: i.value.bold,
923
+ "onUpdate:modelValue": l[24] || (l[24] = (e) => i.value.bold = e)
682
924
  }, null, 8, ["modelValue"])
683
925
  ]),
684
- n("div", nl, [
685
- sl,
686
- i(a(be), {
687
- modelValue: d.value.align,
688
- "onUpdate:modelValue": l[16] || (l[16] = (e) => d.value.align = e),
926
+ s("div", St, [
927
+ Ut,
928
+ a(d(ce), {
929
+ modelValue: i.value.align,
930
+ "onUpdate:modelValue": l[25] || (l[25] = (e) => i.value.align = e),
689
931
  size: "small"
690
932
  }, {
691
- default: $(() => [
692
- i(a(ee), {
933
+ default: D(() => [
934
+ a(d(Q), {
693
935
  label: "左对齐",
694
936
  value: "left"
695
937
  }),
696
- i(a(ee), {
938
+ a(d(Q), {
697
939
  label: "居中",
698
940
  value: "center"
699
941
  }),
700
- i(a(ee), {
942
+ a(d(Q), {
701
943
  label: "右对齐",
702
944
  value: "right"
703
945
  })
@@ -705,65 +947,65 @@ const We = (s, u) => {
705
947
  _: 1
706
948
  }, 8, ["modelValue"])
707
949
  ]),
708
- n("div", ol, [
709
- il,
710
- i(a(Pe), {
711
- modelValue: d.value.color,
712
- "onUpdate:modelValue": l[17] || (l[17] = (e) => d.value.color = e),
950
+ s("div", Et, [
951
+ Lt,
952
+ a(d(ne), {
953
+ modelValue: i.value.color,
954
+ "onUpdate:modelValue": l[26] || (l[26] = (e) => i.value.color = e),
713
955
  size: "small"
714
956
  }, null, 8, ["modelValue"])
715
957
  ])
716
- ])) : L("", !0),
717
- n("div", al, [
718
- n("div", dl, [
719
- rl,
720
- i(a(N), {
721
- modelValue: d.value.x,
722
- "onUpdate:modelValue": l[18] || (l[18] = (e) => d.value.x = e),
958
+ ])) : z("", !0),
959
+ s("div", Nt, [
960
+ s("div", Dt, [
961
+ Tt,
962
+ a(d($), {
963
+ modelValue: i.value.x,
964
+ "onUpdate:modelValue": l[27] || (l[27] = (e) => i.value.x = e),
723
965
  min: 0,
724
966
  step: 0.5,
725
967
  size: "small",
726
968
  style: { width: "100%" }
727
969
  }, null, 8, ["modelValue"])
728
970
  ]),
729
- n("div", ul, [
730
- cl,
731
- i(a(N), {
732
- modelValue: d.value.y,
733
- "onUpdate:modelValue": l[19] || (l[19] = (e) => d.value.y = e),
971
+ s("div", It, [
972
+ Bt,
973
+ a(d($), {
974
+ modelValue: i.value.y,
975
+ "onUpdate:modelValue": l[28] || (l[28] = (e) => i.value.y = e),
734
976
  min: 0,
735
977
  step: 0.5,
736
978
  size: "small",
737
979
  style: { width: "100%" }
738
980
  }, null, 8, ["modelValue"])
739
981
  ]),
740
- n("div", ml, [
741
- hl,
742
- i(a(N), {
743
- modelValue: d.value.width,
744
- "onUpdate:modelValue": l[20] || (l[20] = (e) => d.value.width = e),
745
- min: pe.value.w,
982
+ s("div", Yt, [
983
+ Rt,
984
+ a(d($), {
985
+ modelValue: i.value.width,
986
+ "onUpdate:modelValue": l[29] || (l[29] = (e) => i.value.width = e),
987
+ min: ge.value.w,
746
988
  step: 0.5,
747
989
  size: "small",
748
990
  style: { width: "100%" }
749
991
  }, null, 8, ["modelValue", "min"])
750
992
  ]),
751
- n("div", vl, [
752
- pl,
753
- i(a(N), {
754
- modelValue: d.value.height,
755
- "onUpdate:modelValue": l[21] || (l[21] = (e) => d.value.height = e),
756
- min: pe.value.h,
993
+ s("div", qt, [
994
+ At,
995
+ a(d($), {
996
+ modelValue: i.value.height,
997
+ "onUpdate:modelValue": l[30] || (l[30] = (e) => i.value.height = e),
998
+ min: ge.value.h,
757
999
  step: 0.5,
758
1000
  size: "small",
759
1001
  style: { width: "100%" }
760
1002
  }, null, 8, ["modelValue", "min"])
761
1003
  ]),
762
- n("div", gl, [
763
- fl,
764
- i(a(N), {
765
- modelValue: d.value.rotation,
766
- "onUpdate:modelValue": l[22] || (l[22] = (e) => d.value.rotation = e),
1004
+ s("div", Ft, [
1005
+ Ht,
1006
+ a(d($), {
1007
+ modelValue: i.value.rotation,
1008
+ "onUpdate:modelValue": l[31] || (l[31] = (e) => i.value.rotation = e),
767
1009
  min: 0,
768
1010
  max: 359,
769
1011
  step: 15,
@@ -771,76 +1013,36 @@ const We = (s, u) => {
771
1013
  style: { width: "100%" }
772
1014
  }, null, 8, ["modelValue"])
773
1015
  ])
774
- ]),
775
- n("div", yl, [
776
- i(a(D), {
777
- size: "small",
778
- onClick: Ee
779
- }, {
780
- default: $(() => [
781
- U("复制")
782
- ]),
783
- _: 1
784
- }),
785
- i(a(D), {
786
- size: "small",
787
- onClick: l[23] || (l[23] = (e) => J(x.value, -1))
788
- }, {
789
- default: $(() => [
790
- U("上移图层")
791
- ]),
792
- _: 1
793
- }),
794
- i(a(D), {
795
- size: "small",
796
- onClick: l[24] || (l[24] = (e) => J(x.value, 1))
797
- }, {
798
- default: $(() => [
799
- U("下移图层")
800
- ]),
801
- _: 1
802
- }),
803
- i(a(D), {
804
- size: "small",
805
- type: "danger",
806
- plain: "",
807
- onClick: l[25] || (l[25] = (e) => de(x.value))
808
- }, {
809
- default: $(() => [
810
- U("删除")
811
- ]),
812
- _: 1
813
- })
814
1016
  ])
815
1017
  ])
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),
1018
+ ], 64)) : (u(), c(k, { key: 1 }, [
1019
+ Wt,
1020
+ s("div", Ot, [
1021
+ s("div", Pt, [
1022
+ Xt,
1023
+ a(d(S), {
1024
+ modelValue: Y.value.name,
1025
+ "onUpdate:modelValue": l[32] || (l[32] = (e) => Y.value.name = e),
824
1026
  size: "small"
825
1027
  }, null, 8, ["modelValue"])
826
1028
  ]),
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),
1029
+ s("div", jt, [
1030
+ s("div", Kt, [
1031
+ Gt,
1032
+ a(d($), {
1033
+ modelValue: Y.value.width,
1034
+ "onUpdate:modelValue": l[33] || (l[33] = (e) => Y.value.width = e),
833
1035
  min: 5,
834
1036
  max: 500,
835
1037
  size: "small",
836
1038
  style: { width: "100%" }
837
1039
  }, null, 8, ["modelValue"])
838
1040
  ]),
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),
1041
+ s("div", Jt, [
1042
+ Qt,
1043
+ a(d($), {
1044
+ modelValue: Y.value.height,
1045
+ "onUpdate:modelValue": l[34] || (l[34] = (e) => Y.value.height = e),
844
1046
  min: 5,
845
1047
  max: 500,
846
1048
  size: "small",
@@ -848,20 +1050,20 @@ const We = (s, u) => {
848
1050
  }, null, 8, ["modelValue"])
849
1051
  ])
850
1052
  ]),
851
- Sl
1053
+ Zt
852
1054
  ])
853
1055
  ], 64))
854
1056
  ])
855
1057
  ]));
856
1058
  }
857
- }, Il = /* @__PURE__ */ We(Cl, [["__scopeId", "data-v-488f17e7"]]);
1059
+ }, is = /* @__PURE__ */ el(es, [["__scopeId", "data-v-8646f5dc"]]);
858
1060
  export {
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
1061
+ is as LabelDesigner,
1062
+ Ke as PT2MM,
1063
+ Ue as barcodeDataURL,
1064
+ Ze as buildPrintHTML,
1065
+ os as printCanvas,
1066
+ Ee as qrDataURL,
1067
+ W as resolveContent,
1068
+ Se as resolveValue
867
1069
  };