label-designer-vue 0.1.0 → 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 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) {
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 _e(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 G(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 be(s, u, c, m = !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 v = document.createElement("canvas");
22
- if (we(v, 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: m !== !1,
26
+ displayValue: g !== !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
+ }), !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: h,
34
+ width: oe,
35
35
  height: 60,
36
- displayValue: m !== !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 Ve(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 Oe.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 Ve(s) {
56
56
  return "";
57
57
  }
58
58
  }
59
- function Pe(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 xe(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 je(s, u, c) {
81
- const m = Pe(s);
82
- if (s.type === "text")
83
- return `<div class="ld-print-item ld-print-text" style="${m};${xe(
84
- s
85
- )}">${oe(s.text)}</div>`;
86
- if (s.type === "value")
87
- return `<div class="ld-print-item ld-print-text" style="${m};${xe(
88
- s
89
- )}">${oe(_e(s, c))}</div>`;
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>`;
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 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("");
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>${oe(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,43 +144,61 @@ async function Xe(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 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();
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 He = (s, u) => {
141
- const c = s.__vccOpts || s;
142
- for (const [m, V] of u)
143
- c[m] = V;
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 = {
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
- }, 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 = {
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
- }, $t = {
152
- key: 4,
168
+ }, Ll = ["src"], Nl = ["src"], Dl = {
169
+ key: 7,
153
170
  class: "ldesign-item-placeholder"
154
- }, zt = {
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
- }, 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 = {
177
+ }, Bl = ["onMousedown"], Yl = {
178
+ key: 0,
179
+ class: "ldesign-guide is-v"
180
+ }, Rl = {
181
+ key: 1,
182
+ class: "ldesign-guide is-h"
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 = {
158
184
  key: 0,
159
185
  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 = {
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 = {
161
187
  key: 0,
162
188
  class: "ldesign-prop-row"
163
- }, Ht = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "显示条码值", -1)), Ft = {
164
- 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,
194
+ class: "ldesign-grid2"
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,
165
200
  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 = {
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 = {
167
202
  __name: "label-designer",
168
203
  props: {
169
204
  /** 当前编辑的画布对象(页面持有的设计数据,直接在其上编辑) */
@@ -171,23 +206,45 @@ const He = (s, u) => {
171
206
  /** 模拟数据(按字段名取值) */
172
207
  mockData: { type: Object, default: () => ({}) }
173
208
  },
174
- setup(s) {
175
- const u = {
209
+ setup(n) {
210
+ const m = {
176
211
  text: "文字",
177
212
  value: "动态数据",
178
213
  barcode: "条形码",
179
- qrcode: "二维码"
180
- }, c = {
214
+ qrcode: "二维码",
215
+ image: "图片",
216
+ line: "线条",
217
+ rect: "矩形框",
218
+ ellipse: "圆形"
219
+ }, h = {
181
220
  text: { w: 4, h: 2 },
182
221
  value: { w: 4, h: 2 },
183
222
  barcode: { w: 10, h: 5 },
184
- qrcode: { w: 5, h: 5 }
185
- }, m = {
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 = {
186
242
  text: {
187
243
  width: 20,
188
244
  height: 5,
189
245
  text: "文字内容",
190
246
  fontSize: 9,
247
+ fontFamily: "Microsoft YaHei",
191
248
  bold: !1,
192
249
  align: "left",
193
250
  color: "#000000"
@@ -198,6 +255,7 @@ const He = (s, u) => {
198
255
  fieldName: "",
199
256
  testData: "测试数据",
200
257
  fontSize: 9,
258
+ fontFamily: "Microsoft YaHei",
201
259
  bold: !1,
202
260
  align: "left",
203
261
  color: "#000000"
@@ -214,8 +272,35 @@ const He = (s, u) => {
214
272
  height: 10,
215
273
  content: "https://example.com",
216
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"
217
302
  }
218
- }, V = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], v = [50, 60, 80, 100, 120, 150], J = [
303
+ }, p = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], O = [50, 60, 80, 100, 120, 150], oe = [
219
304
  {
220
305
  type: "text",
221
306
  label: "文字",
@@ -239,261 +324,315 @@ const He = (s, u) => {
239
324
  label: "二维码",
240
325
  desc: "内容 / 字段",
241
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>'
242
351
  }
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(
248
- () => x.value && c[x.value.type] || {
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 = {};
353
+ let ve = 0;
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] || {
249
358
  w: 2,
250
359
  h: 2
251
360
  }
252
- ), ke = B(() => ({
253
- width: `${h.canvas.width * _.value}px`,
254
- height: `${h.canvas.height * _.value}px`,
255
- "--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`
256
365
  }));
257
- function ce() {
258
- return re += 1, `it_${Date.now().toString(36)}${re}${Math.random().toString(36).slice(2, 6)}`;
366
+ function fe() {
367
+ return ve += 1, `it_${Date.now().toString(36)}${ve}${Math.random().toString(36).slice(2, 6)}`;
259
368
  }
260
- function me(l) {
261
- return u[l] || l;
369
+ function ye(t) {
370
+ return m[t] || t;
262
371
  }
263
- function b(l) {
264
- return ee.value ? Math.round(l * 2) / 2 : Math.round(l * 100) / 100;
372
+ function V(t) {
373
+ return de.value ? Math.round(t * 2) / 2 : Math.round(t * 100) / 100;
265
374
  }
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);
375
+ function ee(t, l) {
376
+ const e = Math.max(0, v.canvas.width - l.width);
377
+ return Math.min(Math.max(t, 0), e);
269
378
  }
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);
379
+ function le(t, l) {
380
+ const e = Math.max(0, v.canvas.height - l.height);
381
+ return Math.min(Math.max(t, 0), e);
273
382
  }
274
- function he(l, t = null) {
275
- const e = m[l];
383
+ function we(t, l = null) {
384
+ const e = f[t];
276
385
  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}`,
386
+ const o = v.canvas.items, y = o.length + 1, w = {
387
+ id: fe(),
388
+ type: t,
389
+ name: `${m[t]}${y}`,
281
390
  x: 0,
282
391
  y: 0,
283
392
  rotation: 0,
284
393
  ...e
285
394
  };
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;
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;
287
396
  }
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 = "");
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 = "");
291
400
  }
292
- function $e() {
293
- const l = x.value;
401
+ function Ne(t = x.value) {
402
+ const l = t;
294
403
  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;
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;
297
406
  }
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));
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));
301
410
  }
302
- function ze(l, t) {
303
- t.dataTransfer.effectAllowed = "copy", t.dataTransfer.setData("text/plain", l);
411
+ function De(t, l) {
412
+ l.dataTransfer.effectAllowed = "copy", l.dataTransfer.setData("text/plain", t);
304
413
  }
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();
414
+ function Te(t) {
415
+ var y;
416
+ const l = t.dataTransfer.getData("text/plain");
417
+ if (!f[l]) return;
418
+ const e = (y = me.value) == null ? void 0 : y.getBoundingClientRect();
310
419
  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
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
315
424
  });
316
425
  }
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);
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;
433
+ }, P = () => {
434
+ U.value.v = !1, U.value.h = !1, document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", P);
324
435
  };
325
- document.addEventListener("mousemove", T), document.addEventListener("mouseup", R);
436
+ document.addEventListener("mousemove", R), document.addEventListener("mouseup", P);
326
437
  }
327
- function Ce(l, t, e) {
438
+ function Be(t, l, e) {
328
439
  const o = {
329
440
  mx: e.clientX,
330
441
  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);
442
+ x: t.x,
443
+ y: t.y,
444
+ w: t.width,
445
+ h: t.height
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);
343
454
  };
344
- document.addEventListener("mousemove", y), document.addEventListener("mouseup", T);
455
+ document.addEventListener("mousemove", w), document.addEventListener("mouseup", R);
345
456
  }
346
- function ve(l) {
347
- const t = document.activeElement;
348
- if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable))
457
+ function be(t) {
458
+ const l = document.activeElement;
459
+ if (l && (l.tagName === "INPUT" || l.tagName === "TEXTAREA" || l.tagName === "SELECT" || l.isContentEditable))
349
460
  return;
350
461
  const e = x.value;
351
462
  if (!e) return;
352
- const o = l.shiftKey ? 2 : 0.5, p = {
463
+ const o = t.shiftKey ? 2 : 0.5, y = {
353
464
  ArrowLeft: [-o, 0],
354
465
  ArrowRight: [o, 0],
355
466
  ArrowUp: [0, -o],
356
467
  ArrowDown: [0, o]
357
468
  };
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 = "");
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 = "");
359
470
  }
360
- Te(() => {
361
- document.addEventListener("keydown", ve);
362
- }), qe(() => {
363
- document.removeEventListener("keydown", ve);
364
- }), fe(
365
- () => h.canvas,
471
+ We(() => {
472
+ document.addEventListener("keydown", be);
473
+ }), Oe(() => {
474
+ document.removeEventListener("keydown", be);
475
+ }), $e(
476
+ () => v.canvas,
366
477
  () => {
367
- w.value = "";
478
+ _.value = "", U.value.v = !1, U.value.h = !1;
368
479
  }
369
480
  );
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
481
+ function Ye() {
482
+ for (const t of v.canvas.items)
483
+ if (t.type === "barcode") {
484
+ const l = T.value ? W(t, v.mockData) : t.content, e = [
485
+ t.id,
486
+ l,
487
+ t.width,
488
+ t.height,
489
+ t.showValue ? 1 : 0
379
490
  ].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
491
+ he[t.id] !== e && (he[t.id] = e, re.value[t.id] = Ue(
492
+ l,
493
+ t.width,
494
+ t.height,
495
+ t.showValue !== !1
385
496
  ));
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;
497
+ } else if (t.type === "qrcode") {
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;
390
501
  }));
391
502
  }
392
503
  }
393
- fe(
394
- [() => h.canvas.items, N, () => h.mockData],
395
- Ee,
504
+ $e(
505
+ [() => v.canvas.items, T, () => v.mockData],
506
+ Ye,
396
507
  { deep: !0, immediate: !0 }
397
508
  );
398
- function Ue(l) {
509
+ function Re(t) {
399
510
  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
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`,
515
+ transform: t.rotation ? `rotate(${t.rotation}deg)` : void 0
405
516
  };
406
517
  }
407
- function Le(l) {
518
+ function qe(t) {
408
519
  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"
520
+ fontSize: `${((t.fontSize || 9) * Ke * b.value).toFixed(2)}px`,
521
+ fontFamily: t.fontFamily || "Microsoft YaHei",
522
+ fontWeight: t.bold ? "700" : "400",
523
+ textAlign: t.align || "left",
524
+ color: t.color || "#000000"
413
525
  };
414
526
  }
415
- function De(l) {
416
- return l.type === "value" ? N.value ? _e(l, h.mockData) : String(l.testData ?? "") : String(l.text ?? "");
527
+ function Ae(t) {
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
+ };
538
+ }
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
+ };
417
545
  }
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", {
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", {
424
552
  key: e.type,
425
553
  class: "ldesign-palette-item",
426
554
  draggable: "true",
427
- onDragstart: (o) => ze(e.type, o),
428
- onClick: (o) => he(e.type)
555
+ onDragstart: (o) => De(e.type, o),
556
+ onClick: (o) => we(e.type)
429
557
  }, [
430
- n("span", {
558
+ s("span", {
431
559
  class: "ldesign-palette-thumb",
432
560
  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))
561
+ }, null, 8, al),
562
+ s("span", dl, L(e.label), 1),
563
+ s("span", rl, L(e.desc), 1)
564
+ ], 40, il)), 64))
437
565
  ]),
438
- lt,
439
- n("div", nt, [
440
- (g(!0), f($, null, Y(s.canvas.items, (e) => (g(), f("div", {
566
+ ul,
567
+ s("div", cl, [
568
+ (u(!0), c(k, null, H(n.canvas.items, (e) => (u(), c("div", {
441
569
  key: e.id,
442
- class: P(["ldesign-layer", { "is-active": e.id === w.value }]),
443
- onClick: (o) => w.value = e.id
570
+ class: I(["ldesign-layer", { "is-active": e.id === _.value }]),
571
+ onClick: (o) => _.value = e.id
444
572
  }, [
445
- 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), {
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), {
451
579
  size: "small",
452
580
  circle: "",
453
- onClick: L((o) => F(e, -1), ["stop"])
581
+ title: "复制元素",
582
+ onClick: N((o) => Ne(e), ["stop"])
454
583
  }, {
455
- default: k(() => [
456
- C("↑")
584
+ default: D(() => [
585
+ K("复")
457
586
  ]),
458
587
  _: 2
459
588
  }, 1032, ["onClick"]),
460
- i(a(E), {
589
+ a(d(J), {
461
590
  size: "small",
462
591
  circle: "",
463
- onClick: L((o) => F(e, 1), ["stop"])
592
+ onClick: N((o) => _e(e, -1), ["stop"])
464
593
  }, {
465
- default: k(() => [
466
- C("↓")
594
+ default: D(() => [
595
+ K("↑")
467
596
  ]),
468
597
  _: 2
469
598
  }, 1032, ["onClick"]),
470
- i(a(E), {
599
+ a(d(J), {
471
600
  size: "small",
472
601
  circle: "",
473
- onClick: L((o) => ne(e), ["stop"])
602
+ onClick: N((o) => _e(e, 1), ["stop"])
474
603
  }, {
475
- default: k(() => [
476
- C("×")
604
+ default: D(() => [
605
+ K("↓")
606
+ ]),
607
+ _: 2
608
+ }, 1032, ["onClick"]),
609
+ a(d(J), {
610
+ size: "small",
611
+ circle: "",
612
+ onClick: N((o) => xe(e), ["stop"])
613
+ }, {
614
+ default: D(() => [
615
+ K("×")
477
616
  ]),
478
617
  _: 2
479
618
  }, 1032, ["onClick"])
480
619
  ])
481
- ], 10, st))), 128)),
482
- s.canvas.items.length ? A("", !0) : (g(), f("div", at, "暂无元素"))
620
+ ], 10, ml))), 128)),
621
+ n.canvas.items.length ? z("", !0) : (u(), c("div", vl, "暂无元素"))
483
622
  ])
484
623
  ]),
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),
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),
492
631
  size: "small",
493
632
  class: "ldesign-zoom-select"
494
633
  }, {
495
- default: k(() => [
496
- (g(), f($, null, Y(v, (e) => i(a(W), {
634
+ default: D(() => [
635
+ (u(), c(k, null, H(O, (e) => a(d(Q), {
497
636
  key: e,
498
637
  label: `${e}%`,
499
638
  value: e
@@ -501,162 +640,275 @@ const He = (s, u) => {
501
640
  ]),
502
641
  _: 1
503
642
  }, 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),
643
+ s("span", xl, [
644
+ a(d(Z), {
645
+ modelValue: ae.value,
646
+ "onUpdate:modelValue": l[1] || (l[1] = (e) => ae.value = e),
508
647
  size: "small"
509
648
  }, null, 8, ["modelValue"]),
510
- ht
649
+ _l
511
650
  ]),
512
- n("span", vt, [
513
- i(a(j), {
514
- modelValue: ee.value,
515
- "onUpdate:modelValue": t[2] || (t[2] = (e) => ee.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),
516
655
  size: "small"
517
656
  }, null, 8, ["modelValue"]),
518
- pt
657
+ Vl
519
658
  ]),
520
- n("span", gt, [
521
- i(a(j), {
522
- modelValue: N.value,
523
- "onUpdate:modelValue": t[3] || (t[3] = (e) => N.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),
524
663
  size: "small"
525
664
  }, null, 8, ["modelValue"]),
526
- ft
665
+ $l
527
666
  ])
528
667
  ]),
529
- n("div", yt, [
530
- n("span", wt, S(s.canvas.width) + " × " + S(s.canvas.height) + " mm", 1),
531
- i(a(E), {
668
+ s("div", Cl, [
669
+ s("span", Ml, L(n.canvas.width) + " × " + L(n.canvas.height) + " mm", 1),
670
+ a(d(J), {
532
671
  size: "small",
533
- onClick: t[4] || (t[4] = (e) => w.value = "")
672
+ onClick: l[4] || (l[4] = (e) => _.value = "")
534
673
  }, {
535
- default: k(() => [
536
- C("画布设置")
674
+ default: D(() => [
675
+ K("画布设置")
537
676
  ]),
538
677
  _: 1
539
678
  })
540
679
  ])
541
680
  ]),
542
- n("div", xt, [
543
- n("div", {
681
+ s("div", zl, [
682
+ s("div", {
544
683
  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(() => {
684
+ ref: me,
685
+ class: I(["ldesign-paper", { "is-grid": ae.value }]),
686
+ style: G(Le.value),
687
+ onDragover: l[5] || (l[5] = N(() => {
549
688
  }, ["prevent"])),
550
- onDrop: Me,
551
- onMousedown: t[6] || (t[6] = L((e) => w.value = "", ["self"]))
689
+ onDrop: Te,
690
+ onMousedown: l[6] || (l[6] = N((e) => _.value = "", ["self"]))
552
691
  }, [
553
- (g(!0), f($, null, Y(s.canvas.items, (e) => (g(), f("div", {
692
+ (u(!0), c(k, null, H(n.canvas.items, (e) => (u(), c("div", {
554
693
  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"])
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"])
558
697
  }, [
559
- e.type === "text" || e.type === "value" ? (g(), f("div", {
698
+ e.type === "text" || e.type === "value" ? (u(), c("div", {
560
699
  key: 0,
561
700
  class: "ldesign-item-text",
562
- style: se(Le(e))
563
- }, S(De(e)), 5)) : e.type === "barcode" && te.value[e.id] ? (g(), f("img", {
701
+ style: G(qe(e))
702
+ }, L(Ae(e)), 5)) : e.type === "image" && Ve(e) ? (u(), c("img", {
564
703
  key: 1,
565
704
  class: "ldesign-item-img is-fill",
566
- src: te.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],
567
720
  alt: "条形码",
568
721
  draggable: "false"
569
- }, null, 8, bt)) : e.type === "qrcode" && le.value[e.id] ? (g(), f("img", {
570
- key: 2,
722
+ }, null, 8, Ll)) : e.type === "qrcode" && ue.value[e.id] ? (u(), c("img", {
723
+ key: 6,
571
724
  class: "ldesign-item-img is-contain",
572
- src: le.value[e.id],
725
+ src: ue.value[e.id],
573
726
  alt: "二维码",
574
727
  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", {
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", {
578
731
  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))
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)
583
738
  ], 38)
584
- ]),
585
- St
739
+ ])
586
740
  ]),
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), {
594
- modelValue: d.value.name,
595
- "onUpdate:modelValue": t[7] || (t[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),
596
750
  size: "small"
597
751
  }, null, 8, ["modelValue"])
598
752
  ]),
599
- x.value.type === "text" ? (g(), f("div", Nt, [
600
- It,
601
- i(a(D), {
602
- modelValue: d.value.text,
603
- "onUpdate:modelValue": t[8] || (t[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),
604
758
  type: "textarea",
605
759
  rows: 2,
606
760
  size: "small"
607
761
  }, null, 8, ["modelValue"])
608
- ])) : x.value.type === "value" ? (g(), f($, { key: 1 }, [
609
- n("div", Tt, [
610
- qt,
611
- i(a(D), {
612
- modelValue: d.value.fieldName,
613
- "onUpdate:modelValue": t[9] || (t[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),
614
768
  size: "small",
615
769
  placeholder: "数据里的字段标识,如 subjectName"
616
770
  }, null, 8, ["modelValue"])
617
771
  ]),
618
- n("div", Bt, [
619
- At,
620
- i(a(D), {
621
- modelValue: d.value.testData,
622
- "onUpdate:modelValue": t[10] || (t[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),
623
777
  size: "small",
624
778
  placeholder: "画布上直接显示的文字"
625
779
  }, null, 8, ["modelValue"])
626
780
  ]),
627
- Rt
628
- ], 64)) : (g(), f($, { key: 2 }, [
629
- n("div", Ot, [
630
- Yt,
631
- i(a(D), {
632
- modelValue: d.value.content,
633
- "onUpdate:modelValue": t[11] || (t[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),
634
807
  size: "small"
635
808
  }, null, 8, ["modelValue"])
636
809
  ]),
637
- n("div", Pt, [
638
- jt,
639
- i(a(D), {
640
- modelValue: d.value.fieldName,
641
- "onUpdate:modelValue": t[12] || (t[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),
642
815
  size: "small",
643
816
  placeholder: "填了字段名,打印时优先取模拟数据"
644
817
  }, null, 8, ["modelValue"])
645
818
  ]),
646
- x.value.type === "barcode" ? (g(), f("div", Xt, [
647
- Ht,
648
- i(a(j), {
649
- modelValue: d.value.showValue,
650
- "onUpdate:modelValue": t[13] || (t[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"
651
845
  }, null, 8, ["modelValue"])
652
- ])) : A("", !0)
653
- ], 64)),
654
- x.value.type === "text" || x.value.type === "value" ? (g(), f("div", Ft, [
655
- n("div", Kt, [
656
- Wt,
657
- i(a(U), {
658
- modelValue: d.value.fontSize,
659
- "onUpdate:modelValue": t[14] || (t[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),
660
912
  min: 4,
661
913
  max: 72,
662
914
  step: 0.5,
@@ -664,30 +916,30 @@ const He = (s, u) => {
664
916
  style: { width: "100%" }
665
917
  }, null, 8, ["modelValue"])
666
918
  ]),
667
- n("div", Gt, [
668
- Jt,
669
- i(a(j), {
670
- modelValue: d.value.bold,
671
- "onUpdate:modelValue": t[15] || (t[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)
672
924
  }, null, 8, ["modelValue"])
673
925
  ]),
674
- n("div", Qt, [
675
- Zt,
676
- i(a(ye), {
677
- modelValue: d.value.align,
678
- "onUpdate:modelValue": t[16] || (t[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),
679
931
  size: "small"
680
932
  }, {
681
- default: k(() => [
682
- i(a(W), {
933
+ default: D(() => [
934
+ a(d(Q), {
683
935
  label: "左对齐",
684
936
  value: "left"
685
937
  }),
686
- i(a(W), {
938
+ a(d(Q), {
687
939
  label: "居中",
688
940
  value: "center"
689
941
  }),
690
- i(a(W), {
942
+ a(d(Q), {
691
943
  label: "右对齐",
692
944
  value: "right"
693
945
  })
@@ -695,65 +947,65 @@ const He = (s, u) => {
695
947
  _: 1
696
948
  }, 8, ["modelValue"])
697
949
  ]),
698
- n("div", el, [
699
- tl,
700
- i(a(Re), {
701
- modelValue: d.value.color,
702
- "onUpdate:modelValue": t[17] || (t[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),
703
955
  size: "small"
704
956
  }, null, 8, ["modelValue"])
705
957
  ])
706
- ])) : A("", !0),
707
- n("div", ll, [
708
- n("div", nl, [
709
- sl,
710
- i(a(U), {
711
- modelValue: d.value.x,
712
- "onUpdate:modelValue": t[18] || (t[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),
713
965
  min: 0,
714
966
  step: 0.5,
715
967
  size: "small",
716
968
  style: { width: "100%" }
717
969
  }, null, 8, ["modelValue"])
718
970
  ]),
719
- n("div", ol, [
720
- il,
721
- i(a(U), {
722
- modelValue: d.value.y,
723
- "onUpdate:modelValue": t[19] || (t[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),
724
976
  min: 0,
725
977
  step: 0.5,
726
978
  size: "small",
727
979
  style: { width: "100%" }
728
980
  }, null, 8, ["modelValue"])
729
981
  ]),
730
- n("div", al, [
731
- dl,
732
- i(a(U), {
733
- modelValue: d.value.width,
734
- "onUpdate:modelValue": t[20] || (t[20] = (e) => d.value.width = e),
735
- min: ue.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,
736
988
  step: 0.5,
737
989
  size: "small",
738
990
  style: { width: "100%" }
739
991
  }, null, 8, ["modelValue", "min"])
740
992
  ]),
741
- n("div", rl, [
742
- ul,
743
- i(a(U), {
744
- modelValue: d.value.height,
745
- "onUpdate:modelValue": t[21] || (t[21] = (e) => d.value.height = e),
746
- min: ue.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,
747
999
  step: 0.5,
748
1000
  size: "small",
749
1001
  style: { width: "100%" }
750
1002
  }, null, 8, ["modelValue", "min"])
751
1003
  ]),
752
- n("div", cl, [
753
- ml,
754
- i(a(U), {
755
- modelValue: d.value.rotation,
756
- "onUpdate:modelValue": t[22] || (t[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),
757
1009
  min: 0,
758
1010
  max: 359,
759
1011
  step: 15,
@@ -761,76 +1013,36 @@ const He = (s, u) => {
761
1013
  style: { width: "100%" }
762
1014
  }, null, 8, ["modelValue"])
763
1015
  ])
764
- ]),
765
- n("div", hl, [
766
- i(a(E), {
767
- size: "small",
768
- onClick: $e
769
- }, {
770
- default: k(() => [
771
- C("复制")
772
- ]),
773
- _: 1
774
- }),
775
- i(a(E), {
776
- size: "small",
777
- onClick: t[23] || (t[23] = (e) => F(x.value, -1))
778
- }, {
779
- default: k(() => [
780
- C("上移图层")
781
- ]),
782
- _: 1
783
- }),
784
- i(a(E), {
785
- size: "small",
786
- onClick: t[24] || (t[24] = (e) => F(x.value, 1))
787
- }, {
788
- default: k(() => [
789
- C("下移图层")
790
- ]),
791
- _: 1
792
- }),
793
- i(a(E), {
794
- size: "small",
795
- type: "danger",
796
- plain: "",
797
- onClick: t[25] || (t[25] = (e) => ne(x.value))
798
- }, {
799
- default: k(() => [
800
- C("删除")
801
- ]),
802
- _: 1
803
- })
804
1016
  ])
805
1017
  ])
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),
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),
814
1026
  size: "small"
815
1027
  }, null, 8, ["modelValue"])
816
1028
  ]),
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),
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),
823
1035
  min: 5,
824
1036
  max: 500,
825
1037
  size: "small",
826
1038
  style: { width: "100%" }
827
1039
  }, null, 8, ["modelValue"])
828
1040
  ]),
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),
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),
834
1046
  min: 5,
835
1047
  max: 500,
836
1048
  size: "small",
@@ -838,20 +1050,20 @@ const He = (s, u) => {
838
1050
  }, null, 8, ["modelValue"])
839
1051
  ])
840
1052
  ]),
841
- Vl
1053
+ Zt
842
1054
  ])
843
1055
  ], 64))
844
1056
  ])
845
1057
  ]));
846
1058
  }
847
- }, El = /* @__PURE__ */ He(kl, [["__scopeId", "data-v-80df9fa9"]]);
1059
+ }, is = /* @__PURE__ */ el(es, [["__scopeId", "data-v-8646f5dc"]]);
848
1060
  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
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
857
1069
  };