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