label-designer-vue 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/label-designer.es.js +857 -0
- package/dist/label-designer.umd.js +27 -0
- package/dist/style.css +1 -0
- package/package.json +50 -4
- package/README.md +0 -3
|
@@ -0,0 +1,857 @@
|
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
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 ?? "");
|
|
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 ?? "");
|
|
16
|
+
}
|
|
17
|
+
function be(s, u, c, m = !0) {
|
|
18
|
+
const V = String(s ?? "").trim();
|
|
19
|
+
if (!V || !(u > 0) || !(c > 0)) return "";
|
|
20
|
+
try {
|
|
21
|
+
const v = document.createElement("canvas");
|
|
22
|
+
if (we(v, V, {
|
|
23
|
+
format: "CODE128",
|
|
24
|
+
width: 1,
|
|
25
|
+
height: 60,
|
|
26
|
+
displayValue: m !== !1,
|
|
27
|
+
fontSize: 12,
|
|
28
|
+
textMargin: 1,
|
|
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, {
|
|
33
|
+
format: "CODE128",
|
|
34
|
+
width: h,
|
|
35
|
+
height: 60,
|
|
36
|
+
displayValue: m !== !1,
|
|
37
|
+
fontSize: 12,
|
|
38
|
+
textMargin: 1,
|
|
39
|
+
margin: 0
|
|
40
|
+
}), w.toDataURL("image/png");
|
|
41
|
+
} catch {
|
|
42
|
+
return "";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function Ve(s) {
|
|
46
|
+
const u = String(s ?? "").trim();
|
|
47
|
+
if (!u) return "";
|
|
48
|
+
try {
|
|
49
|
+
return await Oe.toDataURL(u, {
|
|
50
|
+
width: 240,
|
|
51
|
+
margin: 1,
|
|
52
|
+
errorCorrectionLevel: "M",
|
|
53
|
+
color: { dark: "#000000", light: "#ffffff" }
|
|
54
|
+
});
|
|
55
|
+
} catch {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function Pe(s) {
|
|
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)` : ""
|
|
66
|
+
].filter(Boolean).join(";");
|
|
67
|
+
}
|
|
68
|
+
function xe(s) {
|
|
69
|
+
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
|
+
"line-height:1.15",
|
|
75
|
+
"white-space:pre-wrap",
|
|
76
|
+
"word-break:break-all",
|
|
77
|
+
"overflow:hidden"
|
|
78
|
+
].join(";");
|
|
79
|
+
}
|
|
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>`;
|
|
93
|
+
}
|
|
94
|
+
return "";
|
|
95
|
+
}
|
|
96
|
+
async function Xe(s, u = {}) {
|
|
97
|
+
const c = s.items || [], m = {};
|
|
98
|
+
for (const v of c)
|
|
99
|
+
v.type === "barcode" ? m[v.id] = be(
|
|
100
|
+
G(v, u),
|
|
101
|
+
v.width,
|
|
102
|
+
v.height,
|
|
103
|
+
v.showValue !== !1
|
|
104
|
+
) : v.type === "qrcode" && (m[v.id] = await Ve(G(v, u)));
|
|
105
|
+
const V = c.map((v) => je(v, m, u)).join("");
|
|
106
|
+
return `<!DOCTYPE html>
|
|
107
|
+
<html>
|
|
108
|
+
<head>
|
|
109
|
+
<meta charset="utf-8" />
|
|
110
|
+
<title>${oe(s.name || "标签打印")}</title>
|
|
111
|
+
<style>
|
|
112
|
+
@page { size: ${s.width}mm ${s.height}mm; margin: 0; }
|
|
113
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
114
|
+
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; }
|
|
115
|
+
.ld-print-canvas {
|
|
116
|
+
position: relative;
|
|
117
|
+
width: ${s.width}mm;
|
|
118
|
+
height: ${s.height}mm;
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
background: #fff;
|
|
121
|
+
}
|
|
122
|
+
.ld-print-item { position: absolute; }
|
|
123
|
+
.ld-print-text { line-height: 1.15; white-space: pre-wrap; word-break: break-all; overflow: hidden; }
|
|
124
|
+
.ld-print-img { width: 100%; height: 100%; display: block; }
|
|
125
|
+
.ld-print-img.is-fill { object-fit: fill; }
|
|
126
|
+
.ld-print-img.is-contain { object-fit: contain; }
|
|
127
|
+
</style>
|
|
128
|
+
</head>
|
|
129
|
+
<body>
|
|
130
|
+
<div class="ld-print-canvas">${V}</div>
|
|
131
|
+
</body>
|
|
132
|
+
</html>`;
|
|
133
|
+
}
|
|
134
|
+
async function Cl(s, u = {}) {
|
|
135
|
+
const c = await Xe(s, u), m = window.open("", "_blank");
|
|
136
|
+
return m ? (m.document.write(c), m.document.close(), m.addEventListener("load", () => {
|
|
137
|
+
m.focus(), m.print();
|
|
138
|
+
}), !0) : !1;
|
|
139
|
+
}
|
|
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 = {
|
|
146
|
+
key: 0,
|
|
147
|
+
class: "ldesign-empty"
|
|
148
|
+
}, dt = { class: "ldesign-center" }, rt = { class: "ldesign-canvas-bar" }, ut = { class: "ldesign-canvas-bar-left" }, ct = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", { class: "ldesign-bar-label" }, "缩放", -1)), mt = { class: "ldesign-bar-switch" }, ht = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "网格", -1)), vt = { class: "ldesign-bar-switch" }, pt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "对齐网格", -1)), gt = { class: "ldesign-bar-switch" }, ft = /* @__PURE__ */ r(() => /* @__PURE__ */ n("span", null, "预览模拟数据", -1)), yt = { class: "ldesign-canvas-bar-right" }, wt = { class: "ldesign-bar-size" }, xt = { class: "ldesign-stage" }, _t = ["onMousedown"], bt = ["src"], Vt = ["src"], kt = {
|
|
149
|
+
key: 3,
|
|
150
|
+
class: "ldesign-item-placeholder"
|
|
151
|
+
}, $t = {
|
|
152
|
+
key: 4,
|
|
153
|
+
class: "ldesign-item-placeholder"
|
|
154
|
+
}, zt = {
|
|
155
|
+
key: 5,
|
|
156
|
+
class: "ldesign-item-badge"
|
|
157
|
+
}, Mt = ["onMousedown"], St = /* @__PURE__ */ r(() => /* @__PURE__ */ n("div", { class: "ldesign-foot-tip" }, " 拖动左侧素材到画布;选中后可拖动移动、拖手柄改尺寸、方向键微调(Shift 加速)、Delete 删除 ", -1)), Ct = { class: "ldesign-pane ldesign-right" }, Et = { class: "ldesign-pane-title" }, Ut = { class: "ldesign-props" }, Lt = { class: "ldesign-prop-row" }, Dt = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "名称", -1)), Nt = {
|
|
158
|
+
key: 0,
|
|
159
|
+
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 = {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: "ldesign-prop-row"
|
|
163
|
+
}, Ht = /* @__PURE__ */ r(() => /* @__PURE__ */ n("label", null, "显示条码值", -1)), Ft = {
|
|
164
|
+
key: 3,
|
|
165
|
+
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 = {
|
|
167
|
+
__name: "label-designer",
|
|
168
|
+
props: {
|
|
169
|
+
/** 当前编辑的画布对象(页面持有的设计数据,直接在其上编辑) */
|
|
170
|
+
canvas: { type: Object, required: !0 },
|
|
171
|
+
/** 模拟数据(按字段名取值) */
|
|
172
|
+
mockData: { type: Object, default: () => ({}) }
|
|
173
|
+
},
|
|
174
|
+
setup(s) {
|
|
175
|
+
const u = {
|
|
176
|
+
text: "文字",
|
|
177
|
+
value: "动态数据",
|
|
178
|
+
barcode: "条形码",
|
|
179
|
+
qrcode: "二维码"
|
|
180
|
+
}, c = {
|
|
181
|
+
text: { w: 4, h: 2 },
|
|
182
|
+
value: { w: 4, h: 2 },
|
|
183
|
+
barcode: { w: 10, h: 5 },
|
|
184
|
+
qrcode: { w: 5, h: 5 }
|
|
185
|
+
}, m = {
|
|
186
|
+
text: {
|
|
187
|
+
width: 20,
|
|
188
|
+
height: 5,
|
|
189
|
+
text: "文字内容",
|
|
190
|
+
fontSize: 9,
|
|
191
|
+
bold: !1,
|
|
192
|
+
align: "left",
|
|
193
|
+
color: "#000000"
|
|
194
|
+
},
|
|
195
|
+
value: {
|
|
196
|
+
width: 20,
|
|
197
|
+
height: 5,
|
|
198
|
+
fieldName: "",
|
|
199
|
+
testData: "测试数据",
|
|
200
|
+
fontSize: 9,
|
|
201
|
+
bold: !1,
|
|
202
|
+
align: "left",
|
|
203
|
+
color: "#000000"
|
|
204
|
+
},
|
|
205
|
+
barcode: {
|
|
206
|
+
width: 24,
|
|
207
|
+
height: 9,
|
|
208
|
+
content: "20261201001",
|
|
209
|
+
showValue: !0,
|
|
210
|
+
fieldName: ""
|
|
211
|
+
},
|
|
212
|
+
qrcode: {
|
|
213
|
+
width: 10,
|
|
214
|
+
height: 10,
|
|
215
|
+
content: "https://example.com",
|
|
216
|
+
fieldName: ""
|
|
217
|
+
}
|
|
218
|
+
}, V = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], v = [50, 60, 80, 100, 120, 150], J = [
|
|
219
|
+
{
|
|
220
|
+
type: "text",
|
|
221
|
+
label: "文字",
|
|
222
|
+
desc: "静态文本",
|
|
223
|
+
thumb: '<svg viewBox="0 0 32 20"><text x="16" y="15" text-anchor="middle" font-size="14" font-weight="bold" fill="currentColor">A</text></svg>'
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: "value",
|
|
227
|
+
label: "动态数据",
|
|
228
|
+
desc: "字段名 + 测试数据",
|
|
229
|
+
thumb: '<svg viewBox="0 0 32 20"><text x="16" y="14" text-anchor="middle" font-size="11" font-weight="bold" fill="currentColor">{x}</text></svg>'
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
type: "barcode",
|
|
233
|
+
label: "条形码",
|
|
234
|
+
desc: "CODE128",
|
|
235
|
+
thumb: '<svg viewBox="0 0 32 20" fill="currentColor"><rect x="2" y="3" width="2" height="14"/><rect x="5" y="3" width="1" height="14"/><rect x="8" y="3" width="3" height="14"/><rect x="12" y="3" width="1" height="14"/><rect x="15" y="3" width="2" height="14"/><rect x="18" y="3" width="4" height="14"/><rect x="23" y="3" width="1" height="14"/><rect x="25" y="3" width="2" height="14"/><rect x="28" y="3" width="2" height="14"/></svg>'
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
type: "qrcode",
|
|
239
|
+
label: "二维码",
|
|
240
|
+
desc: "内容 / 字段",
|
|
241
|
+
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
|
+
}
|
|
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] || {
|
|
249
|
+
w: 2,
|
|
250
|
+
h: 2
|
|
251
|
+
}
|
|
252
|
+
), ke = B(() => ({
|
|
253
|
+
width: `${h.canvas.width * _.value}px`,
|
|
254
|
+
height: `${h.canvas.height * _.value}px`,
|
|
255
|
+
"--ld-mm": `${_.value}px`
|
|
256
|
+
}));
|
|
257
|
+
function ce() {
|
|
258
|
+
return re += 1, `it_${Date.now().toString(36)}${re}${Math.random().toString(36).slice(2, 6)}`;
|
|
259
|
+
}
|
|
260
|
+
function me(l) {
|
|
261
|
+
return u[l] || l;
|
|
262
|
+
}
|
|
263
|
+
function b(l) {
|
|
264
|
+
return ee.value ? Math.round(l * 2) / 2 : Math.round(l * 100) / 100;
|
|
265
|
+
}
|
|
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);
|
|
269
|
+
}
|
|
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);
|
|
273
|
+
}
|
|
274
|
+
function he(l, t = null) {
|
|
275
|
+
const e = m[l];
|
|
276
|
+
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}`,
|
|
281
|
+
x: 0,
|
|
282
|
+
y: 0,
|
|
283
|
+
rotation: 0,
|
|
284
|
+
...e
|
|
285
|
+
};
|
|
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;
|
|
287
|
+
}
|
|
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 = "");
|
|
291
|
+
}
|
|
292
|
+
function $e() {
|
|
293
|
+
const l = x.value;
|
|
294
|
+
if (!l) return;
|
|
295
|
+
const t = { ...l, id: ce(), name: `${l.name}-副本` };
|
|
296
|
+
t.x = X(b(l.x + 1.5), t), t.y = H(b(l.y + 1.5), t), h.canvas.items.push(t), w.value = t.id;
|
|
297
|
+
}
|
|
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));
|
|
301
|
+
}
|
|
302
|
+
function ze(l, t) {
|
|
303
|
+
t.dataTransfer.effectAllowed = "copy", t.dataTransfer.setData("text/plain", l);
|
|
304
|
+
}
|
|
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();
|
|
310
|
+
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
|
|
315
|
+
});
|
|
316
|
+
}
|
|
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);
|
|
324
|
+
};
|
|
325
|
+
document.addEventListener("mousemove", T), document.addEventListener("mouseup", R);
|
|
326
|
+
}
|
|
327
|
+
function Ce(l, t, e) {
|
|
328
|
+
const o = {
|
|
329
|
+
mx: e.clientX,
|
|
330
|
+
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);
|
|
343
|
+
};
|
|
344
|
+
document.addEventListener("mousemove", y), document.addEventListener("mouseup", T);
|
|
345
|
+
}
|
|
346
|
+
function ve(l) {
|
|
347
|
+
const t = document.activeElement;
|
|
348
|
+
if (t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.tagName === "SELECT" || t.isContentEditable))
|
|
349
|
+
return;
|
|
350
|
+
const e = x.value;
|
|
351
|
+
if (!e) return;
|
|
352
|
+
const o = l.shiftKey ? 2 : 0.5, p = {
|
|
353
|
+
ArrowLeft: [-o, 0],
|
|
354
|
+
ArrowRight: [o, 0],
|
|
355
|
+
ArrowUp: [0, -o],
|
|
356
|
+
ArrowDown: [0, o]
|
|
357
|
+
};
|
|
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 = "");
|
|
359
|
+
}
|
|
360
|
+
Te(() => {
|
|
361
|
+
document.addEventListener("keydown", ve);
|
|
362
|
+
}), qe(() => {
|
|
363
|
+
document.removeEventListener("keydown", ve);
|
|
364
|
+
}), fe(
|
|
365
|
+
() => h.canvas,
|
|
366
|
+
() => {
|
|
367
|
+
w.value = "";
|
|
368
|
+
}
|
|
369
|
+
);
|
|
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
|
|
379
|
+
].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
|
|
385
|
+
));
|
|
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;
|
|
390
|
+
}));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
fe(
|
|
394
|
+
[() => h.canvas.items, N, () => h.mockData],
|
|
395
|
+
Ee,
|
|
396
|
+
{ deep: !0, immediate: !0 }
|
|
397
|
+
);
|
|
398
|
+
function Ue(l) {
|
|
399
|
+
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
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function Le(l) {
|
|
408
|
+
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"
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
function De(l) {
|
|
416
|
+
return l.type === "value" ? N.value ? _e(l, h.mockData) : String(l.testData ?? "") : String(l.text ?? "");
|
|
417
|
+
}
|
|
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", {
|
|
424
|
+
key: e.type,
|
|
425
|
+
class: "ldesign-palette-item",
|
|
426
|
+
draggable: "true",
|
|
427
|
+
onDragstart: (o) => ze(e.type, o),
|
|
428
|
+
onClick: (o) => he(e.type)
|
|
429
|
+
}, [
|
|
430
|
+
n("span", {
|
|
431
|
+
class: "ldesign-palette-thumb",
|
|
432
|
+
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))
|
|
437
|
+
]),
|
|
438
|
+
lt,
|
|
439
|
+
n("div", nt, [
|
|
440
|
+
(g(!0), f($, null, Y(s.canvas.items, (e) => (g(), f("div", {
|
|
441
|
+
key: e.id,
|
|
442
|
+
class: P(["ldesign-layer", { "is-active": e.id === w.value }]),
|
|
443
|
+
onClick: (o) => w.value = e.id
|
|
444
|
+
}, [
|
|
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), {
|
|
451
|
+
size: "small",
|
|
452
|
+
circle: "",
|
|
453
|
+
onClick: L((o) => F(e, -1), ["stop"])
|
|
454
|
+
}, {
|
|
455
|
+
default: k(() => [
|
|
456
|
+
C("↑")
|
|
457
|
+
]),
|
|
458
|
+
_: 2
|
|
459
|
+
}, 1032, ["onClick"]),
|
|
460
|
+
i(a(E), {
|
|
461
|
+
size: "small",
|
|
462
|
+
circle: "",
|
|
463
|
+
onClick: L((o) => F(e, 1), ["stop"])
|
|
464
|
+
}, {
|
|
465
|
+
default: k(() => [
|
|
466
|
+
C("↓")
|
|
467
|
+
]),
|
|
468
|
+
_: 2
|
|
469
|
+
}, 1032, ["onClick"]),
|
|
470
|
+
i(a(E), {
|
|
471
|
+
size: "small",
|
|
472
|
+
circle: "",
|
|
473
|
+
onClick: L((o) => ne(e), ["stop"])
|
|
474
|
+
}, {
|
|
475
|
+
default: k(() => [
|
|
476
|
+
C("×")
|
|
477
|
+
]),
|
|
478
|
+
_: 2
|
|
479
|
+
}, 1032, ["onClick"])
|
|
480
|
+
])
|
|
481
|
+
], 10, st))), 128)),
|
|
482
|
+
s.canvas.items.length ? A("", !0) : (g(), f("div", at, "暂无元素"))
|
|
483
|
+
])
|
|
484
|
+
]),
|
|
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),
|
|
492
|
+
size: "small",
|
|
493
|
+
class: "ldesign-zoom-select"
|
|
494
|
+
}, {
|
|
495
|
+
default: k(() => [
|
|
496
|
+
(g(), f($, null, Y(v, (e) => i(a(W), {
|
|
497
|
+
key: e,
|
|
498
|
+
label: `${e}%`,
|
|
499
|
+
value: e
|
|
500
|
+
}, null, 8, ["label", "value"])), 64))
|
|
501
|
+
]),
|
|
502
|
+
_: 1
|
|
503
|
+
}, 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),
|
|
508
|
+
size: "small"
|
|
509
|
+
}, null, 8, ["modelValue"]),
|
|
510
|
+
ht
|
|
511
|
+
]),
|
|
512
|
+
n("span", vt, [
|
|
513
|
+
i(a(j), {
|
|
514
|
+
modelValue: ee.value,
|
|
515
|
+
"onUpdate:modelValue": t[2] || (t[2] = (e) => ee.value = e),
|
|
516
|
+
size: "small"
|
|
517
|
+
}, null, 8, ["modelValue"]),
|
|
518
|
+
pt
|
|
519
|
+
]),
|
|
520
|
+
n("span", gt, [
|
|
521
|
+
i(a(j), {
|
|
522
|
+
modelValue: N.value,
|
|
523
|
+
"onUpdate:modelValue": t[3] || (t[3] = (e) => N.value = e),
|
|
524
|
+
size: "small"
|
|
525
|
+
}, null, 8, ["modelValue"]),
|
|
526
|
+
ft
|
|
527
|
+
])
|
|
528
|
+
]),
|
|
529
|
+
n("div", yt, [
|
|
530
|
+
n("span", wt, S(s.canvas.width) + " × " + S(s.canvas.height) + " mm", 1),
|
|
531
|
+
i(a(E), {
|
|
532
|
+
size: "small",
|
|
533
|
+
onClick: t[4] || (t[4] = (e) => w.value = "")
|
|
534
|
+
}, {
|
|
535
|
+
default: k(() => [
|
|
536
|
+
C("画布设置")
|
|
537
|
+
]),
|
|
538
|
+
_: 1
|
|
539
|
+
})
|
|
540
|
+
])
|
|
541
|
+
]),
|
|
542
|
+
n("div", xt, [
|
|
543
|
+
n("div", {
|
|
544
|
+
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(() => {
|
|
549
|
+
}, ["prevent"])),
|
|
550
|
+
onDrop: Me,
|
|
551
|
+
onMousedown: t[6] || (t[6] = L((e) => w.value = "", ["self"]))
|
|
552
|
+
}, [
|
|
553
|
+
(g(!0), f($, null, Y(s.canvas.items, (e) => (g(), f("div", {
|
|
554
|
+
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"])
|
|
558
|
+
}, [
|
|
559
|
+
e.type === "text" || e.type === "value" ? (g(), f("div", {
|
|
560
|
+
key: 0,
|
|
561
|
+
class: "ldesign-item-text",
|
|
562
|
+
style: se(Le(e))
|
|
563
|
+
}, S(De(e)), 5)) : e.type === "barcode" && te.value[e.id] ? (g(), f("img", {
|
|
564
|
+
key: 1,
|
|
565
|
+
class: "ldesign-item-img is-fill",
|
|
566
|
+
src: te.value[e.id],
|
|
567
|
+
alt: "条形码",
|
|
568
|
+
draggable: "false"
|
|
569
|
+
}, null, 8, bt)) : e.type === "qrcode" && le.value[e.id] ? (g(), f("img", {
|
|
570
|
+
key: 2,
|
|
571
|
+
class: "ldesign-item-img is-contain",
|
|
572
|
+
src: le.value[e.id],
|
|
573
|
+
alt: "二维码",
|
|
574
|
+
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", {
|
|
578
|
+
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))
|
|
583
|
+
], 38)
|
|
584
|
+
]),
|
|
585
|
+
St
|
|
586
|
+
]),
|
|
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),
|
|
596
|
+
size: "small"
|
|
597
|
+
}, null, 8, ["modelValue"])
|
|
598
|
+
]),
|
|
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),
|
|
604
|
+
type: "textarea",
|
|
605
|
+
rows: 2,
|
|
606
|
+
size: "small"
|
|
607
|
+
}, 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),
|
|
614
|
+
size: "small",
|
|
615
|
+
placeholder: "数据里的字段标识,如 subjectName"
|
|
616
|
+
}, null, 8, ["modelValue"])
|
|
617
|
+
]),
|
|
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),
|
|
623
|
+
size: "small",
|
|
624
|
+
placeholder: "画布上直接显示的文字"
|
|
625
|
+
}, null, 8, ["modelValue"])
|
|
626
|
+
]),
|
|
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),
|
|
634
|
+
size: "small"
|
|
635
|
+
}, null, 8, ["modelValue"])
|
|
636
|
+
]),
|
|
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),
|
|
642
|
+
size: "small",
|
|
643
|
+
placeholder: "填了字段名,打印时优先取模拟数据"
|
|
644
|
+
}, null, 8, ["modelValue"])
|
|
645
|
+
]),
|
|
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)
|
|
651
|
+
}, 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),
|
|
660
|
+
min: 4,
|
|
661
|
+
max: 72,
|
|
662
|
+
step: 0.5,
|
|
663
|
+
size: "small",
|
|
664
|
+
style: { width: "100%" }
|
|
665
|
+
}, null, 8, ["modelValue"])
|
|
666
|
+
]),
|
|
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)
|
|
672
|
+
}, null, 8, ["modelValue"])
|
|
673
|
+
]),
|
|
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),
|
|
679
|
+
size: "small"
|
|
680
|
+
}, {
|
|
681
|
+
default: k(() => [
|
|
682
|
+
i(a(W), {
|
|
683
|
+
label: "左对齐",
|
|
684
|
+
value: "left"
|
|
685
|
+
}),
|
|
686
|
+
i(a(W), {
|
|
687
|
+
label: "居中",
|
|
688
|
+
value: "center"
|
|
689
|
+
}),
|
|
690
|
+
i(a(W), {
|
|
691
|
+
label: "右对齐",
|
|
692
|
+
value: "right"
|
|
693
|
+
})
|
|
694
|
+
]),
|
|
695
|
+
_: 1
|
|
696
|
+
}, 8, ["modelValue"])
|
|
697
|
+
]),
|
|
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),
|
|
703
|
+
size: "small"
|
|
704
|
+
}, null, 8, ["modelValue"])
|
|
705
|
+
])
|
|
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),
|
|
713
|
+
min: 0,
|
|
714
|
+
step: 0.5,
|
|
715
|
+
size: "small",
|
|
716
|
+
style: { width: "100%" }
|
|
717
|
+
}, null, 8, ["modelValue"])
|
|
718
|
+
]),
|
|
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),
|
|
724
|
+
min: 0,
|
|
725
|
+
step: 0.5,
|
|
726
|
+
size: "small",
|
|
727
|
+
style: { width: "100%" }
|
|
728
|
+
}, null, 8, ["modelValue"])
|
|
729
|
+
]),
|
|
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,
|
|
736
|
+
step: 0.5,
|
|
737
|
+
size: "small",
|
|
738
|
+
style: { width: "100%" }
|
|
739
|
+
}, null, 8, ["modelValue", "min"])
|
|
740
|
+
]),
|
|
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,
|
|
747
|
+
step: 0.5,
|
|
748
|
+
size: "small",
|
|
749
|
+
style: { width: "100%" }
|
|
750
|
+
}, null, 8, ["modelValue", "min"])
|
|
751
|
+
]),
|
|
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),
|
|
757
|
+
min: 0,
|
|
758
|
+
max: 359,
|
|
759
|
+
step: 15,
|
|
760
|
+
size: "small",
|
|
761
|
+
style: { width: "100%" }
|
|
762
|
+
}, null, 8, ["modelValue"])
|
|
763
|
+
])
|
|
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
|
+
])
|
|
805
|
+
])
|
|
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),
|
|
814
|
+
size: "small"
|
|
815
|
+
}, null, 8, ["modelValue"])
|
|
816
|
+
]),
|
|
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),
|
|
823
|
+
min: 5,
|
|
824
|
+
max: 500,
|
|
825
|
+
size: "small",
|
|
826
|
+
style: { width: "100%" }
|
|
827
|
+
}, null, 8, ["modelValue"])
|
|
828
|
+
]),
|
|
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),
|
|
834
|
+
min: 5,
|
|
835
|
+
max: 500,
|
|
836
|
+
size: "small",
|
|
837
|
+
style: { width: "100%" }
|
|
838
|
+
}, null, 8, ["modelValue"])
|
|
839
|
+
])
|
|
840
|
+
]),
|
|
841
|
+
Vl
|
|
842
|
+
])
|
|
843
|
+
], 64))
|
|
844
|
+
])
|
|
845
|
+
]));
|
|
846
|
+
}
|
|
847
|
+
}, El = /* @__PURE__ */ He(kl, [["__scopeId", "data-v-80df9fa9"]]);
|
|
848
|
+
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
|
|
857
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
(function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus"),require("jsbarcode"),require("qrcode")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus","jsbarcode","qrcode"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.LabelDesigner={},u.Vue,u.ElementPlus,u.JsBarcode,u.QRCode))})(this,function(u,e,s,X,se){"use strict";const H=.35277777777777775;function U(o){return String(o??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function I(o,r={}){const c=o.fieldName?r==null?void 0:r[o.fieldName]:void 0;return c!=null&&String(c)!==""?String(c):String(o.testData??"")}function C(o,r={}){const c=o.fieldName?r==null?void 0:r[o.fieldName]:void 0;return c!=null&&String(c)!==""?String(c):String(o.content??"")}function T(o,r,c,m=!0){const N=String(o??"").trim();if(!N||!(r>0)||!(c>0))return"";try{const p=document.createElement("canvas");if(X(p,N,{format:"CODE128",width:1,height:60,displayValue:m!==!1,fontSize:12,textMargin:1,margin:0}),!p.width||!p.height)return"";const O=Math.max(1,p.width),h=Math.max(.1,r/c*p.height/O),V=document.createElement("canvas");return X(V,N,{format:"CODE128",width:h,height:60,displayValue:m!==!1,fontSize:12,textMargin:1,margin:0}),V.toDataURL("image/png")}catch{return""}}async function q(o){const r=String(o??"").trim();if(!r)return"";try{return await se.toDataURL(r,{width:240,margin:1,errorCorrectionLevel:"M",color:{dark:"#000000",light:"#ffffff"}})}catch{return""}}function ie(o){return[`left:${o.x}mm`,`top:${o.y}mm`,`width:${o.width}mm`,`height:${o.height}mm`,o.rotation?`transform:rotate(${o.rotation}deg)`:""].filter(Boolean).join(";")}function K(o){return[`font-size:${o.fontSize||9}pt`,`font-weight:${o.bold?"700":"400"}`,`text-align:${o.align||"left"}`,`color:${o.color||"#000000"}`,"line-height:1.15","white-space:pre-wrap","word-break:break-all","overflow:hidden"].join(";")}function de(o,r,c){const m=ie(o);if(o.type==="text")return`<div class="ld-print-item ld-print-text" style="${m};${K(o)}">${U(o.text)}</div>`;if(o.type==="value")return`<div class="ld-print-item ld-print-text" style="${m};${K(o)}">${U(I(o,c))}</div>`;if(o.type==="barcode"||o.type==="qrcode"){const N=r[o.id]||"",p=o.type==="barcode"?"fill":"contain";return N?`<div class="ld-print-item" style="${m}"><img class="ld-print-img is-${p}" src="${N}" alt="" /></div>`:`<div class="ld-print-item" style="${m}"></div>`}return""}async function W(o,r={}){const c=o.items||[],m={};for(const p of c)p.type==="barcode"?m[p.id]=T(C(p,r),p.width,p.height,p.showValue!==!1):p.type==="qrcode"&&(m[p.id]=await q(C(p,r)));const N=c.map(p=>de(p,m,r)).join("");return`<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>${U(o.name||"标签打印")}</title>
|
|
6
|
+
<style>
|
|
7
|
+
@page { size: ${o.width}mm ${o.height}mm; margin: 0; }
|
|
8
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
9
|
+
body { font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif; }
|
|
10
|
+
.ld-print-canvas {
|
|
11
|
+
position: relative;
|
|
12
|
+
width: ${o.width}mm;
|
|
13
|
+
height: ${o.height}mm;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
background: #fff;
|
|
16
|
+
}
|
|
17
|
+
.ld-print-item { position: absolute; }
|
|
18
|
+
.ld-print-text { line-height: 1.15; white-space: pre-wrap; word-break: break-all; overflow: hidden; }
|
|
19
|
+
.ld-print-img { width: 100%; height: 100%; display: block; }
|
|
20
|
+
.ld-print-img.is-fill { object-fit: fill; }
|
|
21
|
+
.ld-print-img.is-contain { object-fit: contain; }
|
|
22
|
+
</style>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div class="ld-print-canvas">${N}</div>
|
|
26
|
+
</body>
|
|
27
|
+
</html>`}async function re(o,r={}){const c=await W(o,r),m=window.open("","_blank");return m?(m.document.write(c),m.document.close(),m.addEventListener("load",()=>{m.focus(),m.print()}),!0):!1}const ce=(o,r)=>{const c=o.__vccOpts||o;for(const[m,N]of r)c[m]=N;return c},d=o=>(e.pushScopeId("data-v-80df9fa9"),o=o(),e.popScopeId(),o),me={class:"ldesign"},he={class:"ldesign-pane ldesign-left"},pe=d(()=>e.createElementVNode("div",{class:"ldesign-pane-title"},"素材库",-1)),fe=d(()=>e.createElementVNode("div",{class:"ldesign-pane-tip"},"拖到画布上,或点击添加",-1)),ge={class:"ldesign-palette"},ue=["onDragstart","onClick"],Ve=["innerHTML"],ye={class:"ldesign-palette-name"},we={class:"ldesign-palette-desc"},Ee=d(()=>e.createElementVNode("div",{class:"ldesign-pane-title"},"元素图层",-1)),Ne={class:"ldesign-layers"},xe=["onClick"],_e={class:"ldesign-layer-name"},be={class:"ldesign-layer-ops"},ke={key:0,class:"ldesign-empty"},Be={class:"ldesign-center"},Ce={class:"ldesign-canvas-bar"},Se={class:"ldesign-canvas-bar-left"},Me=d(()=>e.createElementVNode("span",{class:"ldesign-bar-label"},"缩放",-1)),$e={class:"ldesign-bar-switch"},ze=d(()=>e.createElementVNode("span",null,"网格",-1)),Le={class:"ldesign-bar-switch"},De=d(()=>e.createElementVNode("span",null,"对齐网格",-1)),Ue={class:"ldesign-bar-switch"},Ie=d(()=>e.createElementVNode("span",null,"预览模拟数据",-1)),Te={class:"ldesign-canvas-bar-right"},qe={class:"ldesign-bar-size"},Oe={class:"ldesign-stage"},Re=["onMousedown"],je=["src"],ve=["src"],Ae={key:3,class:"ldesign-item-placeholder"},Fe={key:4,class:"ldesign-item-placeholder"},Ye={key:5,class:"ldesign-item-badge"},Xe=["onMousedown"],He=d(()=>e.createElementVNode("div",{class:"ldesign-foot-tip"}," 拖动左侧素材到画布;选中后可拖动移动、拖手柄改尺寸、方向键微调(Shift 加速)、Delete 删除 ",-1)),Ke={class:"ldesign-pane ldesign-right"},We={class:"ldesign-pane-title"},Ge={class:"ldesign-props"},Qe={class:"ldesign-prop-row"},Ze=d(()=>e.createElementVNode("label",null,"名称",-1)),Je={key:0,class:"ldesign-prop-row"},Pe=d(()=>e.createElementVNode("label",null,"文本内容",-1)),et={class:"ldesign-prop-row"},tt=d(()=>e.createElementVNode("label",null,"字段名",-1)),lt={class:"ldesign-prop-row"},nt=d(()=>e.createElementVNode("label",null,"测试数据",-1)),ot=d(()=>e.createElementVNode("div",{class:"ldesign-prop-hint"}," 画布默认显示测试数据;开启「预览模拟数据」或打印时,优先取模拟数据里该字段的值 ",-1)),at={class:"ldesign-prop-row"},st=d(()=>e.createElementVNode("label",null,"码内容",-1)),it={class:"ldesign-prop-row"},dt=d(()=>e.createElementVNode("label",null,"字段名(可选)",-1)),rt={key:0,class:"ldesign-prop-row"},ct=d(()=>e.createElementVNode("label",null,"显示条码值",-1)),mt={key:3,class:"ldesign-grid2"},ht={class:"ldesign-prop-cell"},pt=d(()=>e.createElementVNode("label",null,"字号(pt)",-1)),ft={class:"ldesign-prop-cell"},gt=d(()=>e.createElementVNode("label",null,"加粗",-1)),ut={class:"ldesign-prop-cell"},Vt=d(()=>e.createElementVNode("label",null,"对齐",-1)),yt={class:"ldesign-prop-cell"},wt=d(()=>e.createElementVNode("label",null,"文字颜色",-1)),Et={class:"ldesign-grid2"},Nt={class:"ldesign-prop-cell"},xt=d(()=>e.createElementVNode("label",null,"位置 X(mm)",-1)),_t={class:"ldesign-prop-cell"},bt=d(()=>e.createElementVNode("label",null,"位置 Y(mm)",-1)),kt={class:"ldesign-prop-cell"},Bt=d(()=>e.createElementVNode("label",null,"宽(mm)",-1)),Ct={class:"ldesign-prop-cell"},St=d(()=>e.createElementVNode("label",null,"高(mm)",-1)),Mt={class:"ldesign-prop-cell"},$t=d(()=>e.createElementVNode("label",null,"旋转(度)",-1)),zt={class:"ldesign-prop-actions"},Lt=d(()=>e.createElementVNode("div",{class:"ldesign-pane-title"},"画布设置",-1)),Dt={class:"ldesign-props"},Ut={class:"ldesign-prop-row"},It=d(()=>e.createElementVNode("label",null,"画布名称",-1)),Tt={class:"ldesign-grid2"},qt={class:"ldesign-prop-cell"},Ot=d(()=>e.createElementVNode("label",null,"宽(mm)",-1)),Rt={class:"ldesign-prop-cell"},jt=d(()=>e.createElementVNode("label",null,"高(mm)",-1)),vt=d(()=>e.createElementVNode("div",{class:"ldesign-prop-hint"}," 画布尺寸即实际标签纸大小(毫米),打印时按此尺寸出纸;点击画布空白处或「画布设置」返回本面板 ",-1)),At=ce({__name:"label-designer",props:{canvas:{type:Object,required:!0},mockData:{type:Object,default:()=>({})}},setup(o){const r={text:"文字",value:"动态数据",barcode:"条形码",qrcode:"二维码"},c={text:{w:4,h:2},value:{w:4,h:2},barcode:{w:10,h:5},qrcode:{w:5,h:5}},m={text:{width:20,height:5,text:"文字内容",fontSize:9,bold:!1,align:"left",color:"#000000"},value:{width:20,height:5,fieldName:"",testData:"测试数据",fontSize:9,bold:!1,align:"left",color:"#000000"},barcode:{width:24,height:9,content:"20261201001",showValue:!0,fieldName:""},qrcode:{width:10,height:10,content:"https://example.com",fieldName:""}},N=["n","s","e","w","ne","nw","se","sw"],p=[50,60,80,100,120,150],O=[{type:"text",label:"文字",desc:"静态文本",thumb:'<svg viewBox="0 0 32 20"><text x="16" y="15" text-anchor="middle" font-size="14" font-weight="bold" fill="currentColor">A</text></svg>'},{type:"value",label:"动态数据",desc:"字段名 + 测试数据",thumb:'<svg viewBox="0 0 32 20"><text x="16" y="14" text-anchor="middle" font-size="11" font-weight="bold" fill="currentColor">{x}</text></svg>'},{type:"barcode",label:"条形码",desc:"CODE128",thumb:'<svg viewBox="0 0 32 20" fill="currentColor"><rect x="2" y="3" width="2" height="14"/><rect x="5" y="3" width="1" height="14"/><rect x="8" y="3" width="3" height="14"/><rect x="12" y="3" width="1" height="14"/><rect x="15" y="3" width="2" height="14"/><rect x="18" y="3" width="4" height="14"/><rect x="23" y="3" width="1" height="14"/><rect x="25" y="3" width="2" height="14"/><rect x="28" y="3" width="2" height="14"/></svg>'},{type:"qrcode",label:"二维码",desc:"内容 / 字段",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>'}],h=o,V=e.ref(""),R=e.ref(100),j=e.ref(!0),v=e.ref(!0),_=e.ref(!1),G=e.ref(null),A=e.ref({}),F=e.ref({}),Q={},Z={};let J=0;const b=e.computed(()=>h.canvas),i=e.computed(()=>y.value),w=e.computed(()=>R.value/10),y=e.computed(()=>h.canvas.items.find(n=>n.id===V.value)||null),P=e.computed(()=>y.value&&c[y.value.type]||{w:2,h:2}),Ft=e.computed(()=>({width:`${h.canvas.width*w.value}px`,height:`${h.canvas.height*w.value}px`,"--ld-mm":`${w.value}px`}));function ee(){return J+=1,`it_${Date.now().toString(36)}${J}${Math.random().toString(36).slice(2,6)}`}function te(n){return r[n]||n}function E(n){return v.value?Math.round(n*2)/2:Math.round(n*100)/100}function $(n,l){const t=Math.max(0,h.canvas.width-l.width);return Math.min(Math.max(n,0),t)}function z(n,l){const t=Math.max(0,h.canvas.height-l.height);return Math.min(Math.max(n,0),t)}function le(n,l=null){const t=m[n];if(!t)return;const a=h.canvas.items,f=a.length+1,g={id:ee(),type:n,name:`${r[n]}${f}`,x:0,y:0,rotation:0,...t};n==="value"&&!g.fieldName&&(g.fieldName=`field${f}`),l?(g.x=l.x,g.y=l.y):(g.x=2+(f-1)*1.5%Math.max(1,h.canvas.width-t.width),g.y=2+(f-1)*1.5%Math.max(1,h.canvas.height-t.height)),g.x=$(E(g.x),g),g.y=z(E(g.y),g),a.push(g),V.value=g.id}function Y(n){const l=h.canvas.items,t=l.indexOf(n);t>=0&&l.splice(t,1),V.value===n.id&&(V.value="")}function Yt(){const n=y.value;if(!n)return;const l={...n,id:ee(),name:`${n.name}-副本`};l.x=$(E(n.x+1.5),l),l.y=z(E(n.y+1.5),l),h.canvas.items.push(l),V.value=l.id}function L(n,l){const t=h.canvas.items,a=t.indexOf(n),f=a+l;a<0||f<0||f>=t.length||(t.splice(a,1),t.splice(f,0,n))}function Xt(n,l){l.dataTransfer.effectAllowed="copy",l.dataTransfer.setData("text/plain",n)}function Ht(n){var f;const l=n.dataTransfer.getData("text/plain");if(!m[l])return;const t=(f=G.value)==null?void 0:f.getBoundingClientRect();if(!t)return;const a=m[l];le(l,{x:(n.clientX-t.left)/w.value-a.width/2,y:(n.clientY-t.top)/w.value-a.height/2})}function Kt(n,l){V.value=n.id;const t=l.clientX,a=l.clientY,f=n.x,g=n.y,k=M=>{const D=(M.clientX-t)/w.value,x=(M.clientY-a)/w.value;n.x=$(E(f+D),n),n.y=z(E(g+x),n)},S=()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",S)};document.addEventListener("mousemove",k),document.addEventListener("mouseup",S)}function Wt(n,l,t){const a={mx:t.clientX,my:t.clientY,x:n.x,y:n.y,w:n.width,h:n.height},f=c[n.type]||{w:2,h:2},g=S=>{const M=(S.clientX-a.mx)/w.value,D=(S.clientY-a.my)/w.value;let x=a.w,B=a.h,oe=a.x,ae=a.y;l.includes("e")&&(x=a.w+M),l.includes("s")&&(B=a.h+D),l.includes("w")&&(x=a.w-M),l.includes("n")&&(B=a.h-D);const Pt=l.includes("w")?a.x+a.w:h.canvas.width-a.x,el=l.includes("n")?a.y+a.h:h.canvas.height-a.y;x=Math.max(f.w,Math.min(E(x),Pt)),B=Math.max(f.h,Math.min(E(B),el)),l.includes("w")&&(oe=Math.max(0,a.x+a.w-x)),l.includes("n")&&(ae=Math.max(0,a.y+a.h-B)),n.x=E(oe),n.y=E(ae),n.width=E(x),n.height=E(B)},k=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",k)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",k)}function ne(n){const l=document.activeElement;if(l&&(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.tagName==="SELECT"||l.isContentEditable))return;const t=y.value;if(!t)return;const a=n.shiftKey?2:.5,f={ArrowLeft:[-a,0],ArrowRight:[a,0],ArrowUp:[0,-a],ArrowDown:[0,a]};f[n.key]?(n.preventDefault(),t.x=$(E(t.x+f[n.key][0]),t),t.y=z(E(t.y+f[n.key][1]),t)):n.key==="Delete"||n.key==="Backspace"?(n.preventDefault(),Y(t)):n.key==="Escape"&&(V.value="")}e.onMounted(()=>{document.addEventListener("keydown",ne)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",ne)}),e.watch(()=>h.canvas,()=>{V.value=""});function Gt(){for(const n of h.canvas.items)if(n.type==="barcode"){const l=_.value?C(n,h.mockData):n.content,t=[n.id,l,n.width,n.height,n.showValue?1:0].join("|");Q[n.id]!==t&&(Q[n.id]=t,A.value[n.id]=T(l,n.width,n.height,n.showValue!==!1))}else if(n.type==="qrcode"){const l=_.value?C(n,h.mockData):n.content,t=`${n.id}|${l}`;Z[n.id]!==t&&(Z[n.id]=t,q(l).then(a=>{F.value[n.id]=a}))}}e.watch([()=>h.canvas.items,_,()=>h.mockData],Gt,{deep:!0,immediate:!0});function Qt(n){return{left:`${n.x*w.value}px`,top:`${n.y*w.value}px`,width:`${n.width*w.value}px`,height:`${n.height*w.value}px`,transform:n.rotation?`rotate(${n.rotation}deg)`:void 0}}function Zt(n){return{fontSize:`${((n.fontSize||9)*H*w.value).toFixed(2)}px`,fontWeight:n.bold?"700":"400",textAlign:n.align||"left",color:n.color||"#000000"}}function Jt(n){return n.type==="value"?_.value?I(n,h.mockData):String(n.testData??""):String(n.text??"")}return(n,l)=>(e.openBlock(),e.createElementBlock("div",me,[e.createElementVNode("aside",he,[pe,fe,e.createElementVNode("div",ge,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,t=>e.createElementVNode("div",{key:t.type,class:"ldesign-palette-item",draggable:"true",onDragstart:a=>Xt(t.type,a),onClick:a=>le(t.type)},[e.createElementVNode("span",{class:"ldesign-palette-thumb",innerHTML:t.thumb},null,8,Ve),e.createElementVNode("span",ye,e.toDisplayString(t.label),1),e.createElementVNode("span",we,e.toDisplayString(t.desc),1)],40,ue)),64))]),Ee,e.createElementVNode("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.canvas.items,t=>(e.openBlock(),e.createElementBlock("div",{key:t.id,class:e.normalizeClass(["ldesign-layer",{"is-active":t.id===V.value}]),onClick:a=>V.value=t.id},[e.createElementVNode("span",{class:e.normalizeClass(["ldesign-layer-tag",`is-${t.type}`])},e.toDisplayString(te(t.type)),3),e.createElementVNode("span",_e,e.toDisplayString(t.name),1),e.createElementVNode("span",be,[e.createVNode(e.unref(s.ElButton),{size:"small",circle:"",onClick:e.withModifiers(a=>L(t,-1),["stop"])},{default:e.withCtx(()=>[e.createTextVNode("↑")]),_:2},1032,["onClick"]),e.createVNode(e.unref(s.ElButton),{size:"small",circle:"",onClick:e.withModifiers(a=>L(t,1),["stop"])},{default:e.withCtx(()=>[e.createTextVNode("↓")]),_:2},1032,["onClick"]),e.createVNode(e.unref(s.ElButton),{size:"small",circle:"",onClick:e.withModifiers(a=>Y(t),["stop"])},{default:e.withCtx(()=>[e.createTextVNode("×")]),_:2},1032,["onClick"])])],10,xe))),128)),o.canvas.items.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ke,"暂无元素"))])]),e.createElementVNode("section",Be,[e.createElementVNode("div",Ce,[e.createElementVNode("div",Se,[Me,e.createVNode(e.unref(s.ElSelect),{modelValue:R.value,"onUpdate:modelValue":l[0]||(l[0]=t=>R.value=t),size:"small",class:"ldesign-zoom-select"},{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(p,t=>e.createVNode(e.unref(s.ElOption),{key:t,label:`${t}%`,value:t},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),e.createElementVNode("span",$e,[e.createVNode(e.unref(s.ElSwitch),{modelValue:j.value,"onUpdate:modelValue":l[1]||(l[1]=t=>j.value=t),size:"small"},null,8,["modelValue"]),ze]),e.createElementVNode("span",Le,[e.createVNode(e.unref(s.ElSwitch),{modelValue:v.value,"onUpdate:modelValue":l[2]||(l[2]=t=>v.value=t),size:"small"},null,8,["modelValue"]),De]),e.createElementVNode("span",Ue,[e.createVNode(e.unref(s.ElSwitch),{modelValue:_.value,"onUpdate:modelValue":l[3]||(l[3]=t=>_.value=t),size:"small"},null,8,["modelValue"]),Ie])]),e.createElementVNode("div",Te,[e.createElementVNode("span",qe,e.toDisplayString(o.canvas.width)+" × "+e.toDisplayString(o.canvas.height)+" mm",1),e.createVNode(e.unref(s.ElButton),{size:"small",onClick:l[4]||(l[4]=t=>V.value="")},{default:e.withCtx(()=>[e.createTextVNode("画布设置")]),_:1})])]),e.createElementVNode("div",Oe,[e.createElementVNode("div",{ref_key:"paperRef",ref:G,class:e.normalizeClass(["ldesign-paper",{"is-grid":j.value}]),style:e.normalizeStyle(Ft.value),onDragover:l[5]||(l[5]=e.withModifiers(()=>{},["prevent"])),onDrop:Ht,onMousedown:l[6]||(l[6]=e.withModifiers(t=>V.value="",["self"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.canvas.items,t=>(e.openBlock(),e.createElementBlock("div",{key:t.id,class:e.normalizeClass(["ldesign-item",[`is-${t.type}`,{"is-selected":t.id===V.value}]]),style:e.normalizeStyle(Qt(t)),onMousedown:e.withModifiers(a=>Kt(t,a),["stop","prevent"])},[t.type==="text"||t.type==="value"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"ldesign-item-text",style:e.normalizeStyle(Zt(t))},e.toDisplayString(Jt(t)),5)):t.type==="barcode"&&A.value[t.id]?(e.openBlock(),e.createElementBlock("img",{key:1,class:"ldesign-item-img is-fill",src:A.value[t.id],alt:"条形码",draggable:"false"},null,8,je)):t.type==="qrcode"&&F.value[t.id]?(e.openBlock(),e.createElementBlock("img",{key:2,class:"ldesign-item-img is-contain",src:F.value[t.id],alt:"二维码",draggable:"false"},null,8,ve)):t.type==="barcode"?(e.openBlock(),e.createElementBlock("div",Ae," 条形码内容无效 ")):t.type==="qrcode"?(e.openBlock(),e.createElementBlock("div",Fe," 二维码内容无效 ")):e.createCommentVNode("",!0),t.type==="value"?(e.openBlock(),e.createElementBlock("span",Ye,"动态")):e.createCommentVNode("",!0),t.id===V.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:6},e.renderList(N,a=>e.createElementVNode("span",{key:a,class:e.normalizeClass(["ldesign-handle",`is-${a}`]),onMousedown:e.withModifiers(f=>Wt(t,a,f),["stop","prevent"])},null,42,Xe)),64)):e.createCommentVNode("",!0)],46,Re))),128))],38)]),He]),e.createElementVNode("aside",Ke,[y.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",We," 元素设置 · "+e.toDisplayString(te(y.value.type)),1),e.createElementVNode("div",Ge,[e.createElementVNode("div",Qe,[Ze,e.createVNode(e.unref(s.ElInput),{modelValue:i.value.name,"onUpdate:modelValue":l[7]||(l[7]=t=>i.value.name=t),size:"small"},null,8,["modelValue"])]),y.value.type==="text"?(e.openBlock(),e.createElementBlock("div",Je,[Pe,e.createVNode(e.unref(s.ElInput),{modelValue:i.value.text,"onUpdate:modelValue":l[8]||(l[8]=t=>i.value.text=t),type:"textarea",rows:2,size:"small"},null,8,["modelValue"])])):y.value.type==="value"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",et,[tt,e.createVNode(e.unref(s.ElInput),{modelValue:i.value.fieldName,"onUpdate:modelValue":l[9]||(l[9]=t=>i.value.fieldName=t),size:"small",placeholder:"数据里的字段标识,如 subjectName"},null,8,["modelValue"])]),e.createElementVNode("div",lt,[nt,e.createVNode(e.unref(s.ElInput),{modelValue:i.value.testData,"onUpdate:modelValue":l[10]||(l[10]=t=>i.value.testData=t),size:"small",placeholder:"画布上直接显示的文字"},null,8,["modelValue"])]),ot],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",at,[st,e.createVNode(e.unref(s.ElInput),{modelValue:i.value.content,"onUpdate:modelValue":l[11]||(l[11]=t=>i.value.content=t),size:"small"},null,8,["modelValue"])]),e.createElementVNode("div",it,[dt,e.createVNode(e.unref(s.ElInput),{modelValue:i.value.fieldName,"onUpdate:modelValue":l[12]||(l[12]=t=>i.value.fieldName=t),size:"small",placeholder:"填了字段名,打印时优先取模拟数据"},null,8,["modelValue"])]),y.value.type==="barcode"?(e.openBlock(),e.createElementBlock("div",rt,[ct,e.createVNode(e.unref(s.ElSwitch),{modelValue:i.value.showValue,"onUpdate:modelValue":l[13]||(l[13]=t=>i.value.showValue=t)},null,8,["modelValue"])])):e.createCommentVNode("",!0)],64)),y.value.type==="text"||y.value.type==="value"?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ht,[pt,e.createVNode(e.unref(s.ElInputNumber),{modelValue:i.value.fontSize,"onUpdate:modelValue":l[14]||(l[14]=t=>i.value.fontSize=t),min:4,max:72,step:.5,size:"small",style:{width:"100%"}},null,8,["modelValue"])]),e.createElementVNode("div",ft,[gt,e.createVNode(e.unref(s.ElSwitch),{modelValue:i.value.bold,"onUpdate:modelValue":l[15]||(l[15]=t=>i.value.bold=t)},null,8,["modelValue"])]),e.createElementVNode("div",ut,[Vt,e.createVNode(e.unref(s.ElSelect),{modelValue:i.value.align,"onUpdate:modelValue":l[16]||(l[16]=t=>i.value.align=t),size:"small"},{default:e.withCtx(()=>[e.createVNode(e.unref(s.ElOption),{label:"左对齐",value:"left"}),e.createVNode(e.unref(s.ElOption),{label:"居中",value:"center"}),e.createVNode(e.unref(s.ElOption),{label:"右对齐",value:"right"})]),_:1},8,["modelValue"])]),e.createElementVNode("div",yt,[wt,e.createVNode(e.unref(s.ElColorPicker),{modelValue:i.value.color,"onUpdate:modelValue":l[17]||(l[17]=t=>i.value.color=t),size:"small"},null,8,["modelValue"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",Et,[e.createElementVNode("div",Nt,[xt,e.createVNode(e.unref(s.ElInputNumber),{modelValue:i.value.x,"onUpdate:modelValue":l[18]||(l[18]=t=>i.value.x=t),min:0,step:.5,size:"small",style:{width:"100%"}},null,8,["modelValue"])]),e.createElementVNode("div",_t,[bt,e.createVNode(e.unref(s.ElInputNumber),{modelValue:i.value.y,"onUpdate:modelValue":l[19]||(l[19]=t=>i.value.y=t),min:0,step:.5,size:"small",style:{width:"100%"}},null,8,["modelValue"])]),e.createElementVNode("div",kt,[Bt,e.createVNode(e.unref(s.ElInputNumber),{modelValue:i.value.width,"onUpdate:modelValue":l[20]||(l[20]=t=>i.value.width=t),min:P.value.w,step:.5,size:"small",style:{width:"100%"}},null,8,["modelValue","min"])]),e.createElementVNode("div",Ct,[St,e.createVNode(e.unref(s.ElInputNumber),{modelValue:i.value.height,"onUpdate:modelValue":l[21]||(l[21]=t=>i.value.height=t),min:P.value.h,step:.5,size:"small",style:{width:"100%"}},null,8,["modelValue","min"])]),e.createElementVNode("div",Mt,[$t,e.createVNode(e.unref(s.ElInputNumber),{modelValue:i.value.rotation,"onUpdate:modelValue":l[22]||(l[22]=t=>i.value.rotation=t),min:0,max:359,step:15,size:"small",style:{width:"100%"}},null,8,["modelValue"])])]),e.createElementVNode("div",zt,[e.createVNode(e.unref(s.ElButton),{size:"small",onClick:Yt},{default:e.withCtx(()=>[e.createTextVNode("复制")]),_:1}),e.createVNode(e.unref(s.ElButton),{size:"small",onClick:l[23]||(l[23]=t=>L(y.value,-1))},{default:e.withCtx(()=>[e.createTextVNode("上移图层")]),_:1}),e.createVNode(e.unref(s.ElButton),{size:"small",onClick:l[24]||(l[24]=t=>L(y.value,1))},{default:e.withCtx(()=>[e.createTextVNode("下移图层")]),_:1}),e.createVNode(e.unref(s.ElButton),{size:"small",type:"danger",plain:"",onClick:l[25]||(l[25]=t=>Y(y.value))},{default:e.withCtx(()=>[e.createTextVNode("删除")]),_:1})])])],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Lt,e.createElementVNode("div",Dt,[e.createElementVNode("div",Ut,[It,e.createVNode(e.unref(s.ElInput),{modelValue:b.value.name,"onUpdate:modelValue":l[26]||(l[26]=t=>b.value.name=t),size:"small"},null,8,["modelValue"])]),e.createElementVNode("div",Tt,[e.createElementVNode("div",qt,[Ot,e.createVNode(e.unref(s.ElInputNumber),{modelValue:b.value.width,"onUpdate:modelValue":l[27]||(l[27]=t=>b.value.width=t),min:5,max:500,size:"small",style:{width:"100%"}},null,8,["modelValue"])]),e.createElementVNode("div",Rt,[jt,e.createVNode(e.unref(s.ElInputNumber),{modelValue:b.value.height,"onUpdate:modelValue":l[28]||(l[28]=t=>b.value.height=t),min:5,max:500,size:"small",style:{width:"100%"}},null,8,["modelValue"])])]),vt])],64))])]))}},[["__scopeId","data-v-80df9fa9"]]);u.LabelDesigner=At,u.PT2MM=H,u.barcodeDataURL=T,u.buildPrintHTML=W,u.printCanvas=re,u.qrDataURL=q,u.resolveContent=C,u.resolveValue=I,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";.ldesign[data-v-80df9fa9]{display:flex;height:calc(100vh - 212px);min-height:520px;overflow:hidden;border:1px solid var(--el-border-color-lighter);border-radius:8px;background:var(--el-bg-color)}.ldesign-pane[data-v-80df9fa9]{flex:none;overflow-y:auto;background:var(--el-bg-color)}.ldesign-left[data-v-80df9fa9]{width:220px;border-right:1px solid var(--el-border-color-lighter)}.ldesign-right[data-v-80df9fa9]{width:264px;border-left:1px solid var(--el-border-color-lighter)}.ldesign-pane-title[data-v-80df9fa9]{padding:12px 12px 4px;font-size:13px;font-weight:600;color:var(--el-text-color-primary)}.ldesign-pane-tip[data-v-80df9fa9]{padding:0 12px 8px;font-size:12px;color:var(--el-text-color-secondary)}.ldesign-palette[data-v-80df9fa9]{padding:0 10px 10px}.ldesign-palette-item[data-v-80df9fa9]{display:flex;flex-direction:column;align-items:center;padding:8px 4px;margin-bottom:8px;cursor:grab;text-align:center;border:1px solid var(--el-border-color-lighter);border-radius:6px;transition:border-color .15s,box-shadow .15s}.ldesign-palette-item[data-v-80df9fa9]:hover{border-color:var(--el-color-primary);box-shadow:0 2px 8px #00000014}.ldesign-palette-item[data-v-80df9fa9]:active{cursor:grabbing}.ldesign-palette-thumb[data-v-80df9fa9]{display:flex;align-items:center;justify-content:center;width:44px;height:26px;margin-bottom:4px;color:var(--el-color-primary);background:var(--el-color-primary-light-9);border-radius:4px}.ldesign-palette-thumb svg[data-v-80df9fa9]{width:32px;height:20px}.ldesign-palette-name[data-v-80df9fa9]{font-size:13px;color:var(--el-text-color-primary)}.ldesign-palette-desc[data-v-80df9fa9]{font-size:11px;color:var(--el-text-color-secondary)}.ldesign-layers[data-v-80df9fa9]{max-height:240px;overflow-y:auto;padding-bottom:8px}.ldesign-layer[data-v-80df9fa9]{display:flex;align-items:center;gap:6px;padding:4px 10px;cursor:pointer;border-left:2px solid transparent}.ldesign-layer[data-v-80df9fa9]:hover{background:var(--el-fill-color-light)}.ldesign-layer.is-active[data-v-80df9fa9]{background:var(--el-color-primary-light-9);border-left-color:var(--el-color-primary)}.ldesign-layer-tag[data-v-80df9fa9]{flex:none;padding:0 4px;font-size:11px;line-height:16px;border-radius:3px;color:var(--el-color-info);background:var(--el-color-info-light-9)}.ldesign-layer-tag.is-value[data-v-80df9fa9]{color:var(--el-color-warning);background:var(--el-color-warning-light-9)}.ldesign-layer-tag.is-barcode[data-v-80df9fa9]{color:var(--el-color-primary);background:var(--el-color-primary-light-9)}.ldesign-layer-tag.is-qrcode[data-v-80df9fa9]{color:var(--el-color-success);background:var(--el-color-success-light-9)}.ldesign-layer-name[data-v-80df9fa9]{flex:1;min-width:0;font-size:12px;color:var(--el-text-color-primary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ldesign-layer-ops[data-v-80df9fa9]{flex:none}.ldesign-layer-ops .el-button+.el-button[data-v-80df9fa9]{margin-left:4px}.ldesign-empty[data-v-80df9fa9]{padding:12px;font-size:12px;color:var(--el-text-color-secondary);text-align:center}.ldesign-center[data-v-80df9fa9]{display:flex;flex:1;min-width:0;flex-direction:column;background:var(--el-fill-color-light)}.ldesign-canvas-bar[data-v-80df9fa9]{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 12px;background:var(--el-bg-color);border-bottom:1px solid var(--el-border-color-lighter)}.ldesign-canvas-bar-left[data-v-80df9fa9],.ldesign-canvas-bar-right[data-v-80df9fa9]{display:flex;align-items:center;gap:12px}.ldesign-bar-label[data-v-80df9fa9]{font-size:12px;color:var(--el-text-color-secondary)}.ldesign-zoom-select[data-v-80df9fa9]{width:84px}.ldesign-bar-switch[data-v-80df9fa9]{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--el-text-color-regular)}.ldesign-bar-size[data-v-80df9fa9]{font-size:12px;color:var(--el-text-color-secondary)}.ldesign-stage[data-v-80df9fa9]{display:flex;flex:1;overflow:auto;padding:24px}.ldesign-paper[data-v-80df9fa9]{position:relative;flex:none;margin:auto;font-family:Microsoft YaHei,PingFang SC,sans-serif;background:#fff;outline:1px solid var(--el-border-color);box-shadow:0 2px 12px #0000001f}.ldesign-paper.is-grid[data-v-80df9fa9]{background-image:linear-gradient(to right,rgba(0,0,0,.05) 1px,transparent 1px),linear-gradient(to bottom,rgba(0,0,0,.05) 1px,transparent 1px),linear-gradient(to right,rgba(0,0,0,.11) 1px,transparent 1px),linear-gradient(to bottom,rgba(0,0,0,.11) 1px,transparent 1px);background-size:var(--ld-mm) var(--ld-mm),var(--ld-mm) var(--ld-mm),calc(var(--ld-mm) * 5) calc(var(--ld-mm) * 5),calc(var(--ld-mm) * 5) calc(var(--ld-mm) * 5)}.ldesign-item[data-v-80df9fa9]{position:absolute;box-sizing:border-box;cursor:move;outline:1px dashed rgba(0,0,0,.18)}.ldesign-item.is-selected[data-v-80df9fa9]{outline:1px solid var(--el-color-primary);box-shadow:0 0 0 1px #fff9}.ldesign-item-text[data-v-80df9fa9]{width:100%;height:100%;overflow:hidden;line-height:1.15;white-space:pre-wrap;word-break:break-all;pointer-events:none}.ldesign-item-img[data-v-80df9fa9]{width:100%;height:100%;pointer-events:none}.ldesign-item-img.is-fill[data-v-80df9fa9]{object-fit:fill}.ldesign-item-img.is-contain[data-v-80df9fa9]{object-fit:contain}.ldesign-item-placeholder[data-v-80df9fa9]{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:12px;color:var(--el-text-color-placeholder);pointer-events:none}.ldesign-item-badge[data-v-80df9fa9]{position:absolute;top:0;right:0;padding:0 3px;font-size:10px;line-height:14px;color:#fff;background:var(--el-color-warning);border-bottom-left-radius:3px;pointer-events:none}.ldesign-handle[data-v-80df9fa9]{position:absolute;z-index:3;width:9px;height:9px;background:var(--el-color-primary);border:1px solid #fff;border-radius:2px}.ldesign-handle.is-n[data-v-80df9fa9]{top:-5px;left:calc(50% - 4.5px);cursor:n-resize}.ldesign-handle.is-s[data-v-80df9fa9]{bottom:-5px;left:calc(50% - 4.5px);cursor:s-resize}.ldesign-handle.is-e[data-v-80df9fa9]{top:calc(50% - 4.5px);right:-5px;cursor:e-resize}.ldesign-handle.is-w[data-v-80df9fa9]{top:calc(50% - 4.5px);left:-5px;cursor:w-resize}.ldesign-handle.is-ne[data-v-80df9fa9]{top:-5px;right:-5px;cursor:ne-resize}.ldesign-handle.is-nw[data-v-80df9fa9]{top:-5px;left:-5px;cursor:nw-resize}.ldesign-handle.is-se[data-v-80df9fa9]{right:-5px;bottom:-5px;cursor:se-resize}.ldesign-handle.is-sw[data-v-80df9fa9]{bottom:-5px;left:-5px;cursor:sw-resize}.ldesign-foot-tip[data-v-80df9fa9]{padding:6px 12px;font-size:12px;color:var(--el-text-color-secondary);background:var(--el-bg-color);border-top:1px solid var(--el-border-color-lighter)}.ldesign-props[data-v-80df9fa9]{padding:8px 12px 12px}.ldesign-prop-row[data-v-80df9fa9]{margin-bottom:10px}.ldesign-prop-row label[data-v-80df9fa9]{display:block;margin-bottom:4px;font-size:12px;color:var(--el-text-color-secondary)}.ldesign-grid2[data-v-80df9fa9]{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:10px}.ldesign-prop-cell label[data-v-80df9fa9]{display:block;margin-bottom:4px;font-size:12px;color:var(--el-text-color-secondary)}.ldesign-prop-hint[data-v-80df9fa9]{padding:8px;margin-bottom:10px;font-size:12px;line-height:1.5;color:var(--el-text-color-secondary);background:var(--el-fill-color-light);border-radius:4px}.ldesign-prop-actions[data-v-80df9fa9]{display:flex;flex-wrap:wrap;gap:8px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "label-designer-vue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vue3 标签设计画布组件:文字 / 动态数据 / 条形码 / 二维码拖拽排版,JSON 契约输出,支持打印",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"vue3",
|
|
8
|
+
"vue-component",
|
|
9
|
+
"element-plus",
|
|
10
|
+
"label",
|
|
11
|
+
"designer",
|
|
12
|
+
"canvas",
|
|
13
|
+
"barcode",
|
|
14
|
+
"qrcode",
|
|
15
|
+
"print"
|
|
16
|
+
],
|
|
17
|
+
"main": "dist/label-designer.umd.js",
|
|
18
|
+
"module": "dist/label-designer.es.js",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": "./dist/label-designer.es.js",
|
|
22
|
+
"require": "./dist/label-designer.umd.js"
|
|
23
|
+
},
|
|
24
|
+
"./style.css": "./dist/style.css"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"*.css"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "vite",
|
|
34
|
+
"build": "vite build",
|
|
35
|
+
"preview": "vite preview"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"vue": "^3.2.0",
|
|
39
|
+
"element-plus": "^2.4.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"jsbarcode": "~3.11.6",
|
|
43
|
+
"qrcode": "^1.5.4"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
47
|
+
"element-plus": "2.9.11",
|
|
48
|
+
"sass": "~1.80.6",
|
|
49
|
+
"vite": "~5.4.2",
|
|
50
|
+
"vue": "~3.4.38"
|
|
51
|
+
}
|
|
52
|
+
}
|
package/README.md
DELETED