@agile-team/mach-report 2.19.1 → 2.20.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.
Files changed (54) hide show
  1. package/README.md +18 -3
  2. package/dist/ExcelBindingWizard-B7aeRg46.cjs +1 -0
  3. package/dist/{ExcelBindingWizard-xJIYmnZ_.js → ExcelBindingWizard-Chn6ZC2-.js} +350 -350
  4. package/dist/ParamEditor-BdFMa1CX.cjs +1 -0
  5. package/dist/{ParamEditor-D1wWemaf.js → ParamEditor-o-7E7WZZ.js} +10 -10
  6. package/dist/{ReportBatchPanel-B88R-fME.js → ReportBatchPanel-CNJ4Useq.js} +2 -2
  7. package/dist/{ReportBatchPanel-BkJFqeEW.cjs → ReportBatchPanel-DVpmB7tG.cjs} +1 -1
  8. package/dist/ReportLabelStudio-Drsm9sAS.cjs +1 -0
  9. package/dist/ReportLabelStudio-r8VFnhGQ.js +589 -0
  10. package/dist/ReportParamPanel-CVpK8mFc.cjs +1 -0
  11. package/dist/{ReportParamPanel-mQkeN70Q.js → ReportParamPanel-peB-KEmm.js} +10 -2
  12. package/dist/{ReportPreview-DBbctg6C.js → ReportPreview-CGcxwkAn.js} +2093 -1978
  13. package/dist/ReportPreview-hlwvZ1wf.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-BOh2MgjQ.cjs → ReportTemplateLibrary-DjjyZnZB.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-BGELmgd3.js → ReportTemplateLibrary-DyIJhJjX.js} +1 -1
  16. package/dist/RuleEditor-BVuRn_OQ.cjs +1 -0
  17. package/dist/{RuleEditor-CoLqgehG.js → RuleEditor-BeknHHOD.js} +176 -172
  18. package/dist/{TemplateOutlinePanel-DU95loB-.js → TemplateOutlinePanel-Bv8CxbXS.js} +1 -1
  19. package/dist/{TemplateOutlinePanel-DiG8tRRe.cjs → TemplateOutlinePanel-D6TXg1aV.cjs} +1 -1
  20. package/dist/{TemplateReusePanel-DE1KSD6c.js → TemplateReusePanel-CfousvPY.js} +1 -1
  21. package/dist/{TemplateReusePanel-G-Y299wc.cjs → TemplateReusePanel-wrSbd_mr.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-KQx9ts0D.cjs → TemplateReviewPanel-BKFcSbTh.cjs} +1 -1
  23. package/dist/{TemplateReviewPanel-vqFJ_Y9o.js → TemplateReviewPanel-F2tqWNLO.js} +1 -1
  24. package/dist/artifact-integrity.json +36 -36
  25. package/dist/designer-B52ddmHO.js +6676 -0
  26. package/dist/designer-Dtsw_rh7.cjs +2 -0
  27. package/dist/designer.cjs +1 -1
  28. package/dist/designer.d.cts +142 -5
  29. package/dist/designer.d.ts +142 -5
  30. package/dist/designer.js +1 -1
  31. package/dist/{plugin-CPyHs4UC.cjs → plugin-BMsIIJDh.cjs} +1 -1
  32. package/dist/{plugin-DsXJRR6Q.js → plugin-Co1oKD7T.js} +1 -1
  33. package/dist/sbom.cdx.json +1 -1
  34. package/dist/server.cjs +1 -1
  35. package/dist/server.js +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/vue/async.d.cts +8 -0
  38. package/dist/vue/async.d.ts +8 -0
  39. package/dist/vue/index.d.cts +10 -2
  40. package/dist/vue/index.d.ts +10 -2
  41. package/dist/vue-async.cjs +1 -1
  42. package/dist/vue-async.js +3 -3
  43. package/dist/vue.cjs +1 -1
  44. package/dist/vue.js +5 -5
  45. package/package.json +1 -1
  46. package/dist/ExcelBindingWizard-UHSApSG9.cjs +0 -1
  47. package/dist/ParamEditor-BZb-okUd.cjs +0 -1
  48. package/dist/ReportLabelStudio-B4WZ2XNN.js +0 -239
  49. package/dist/ReportLabelStudio-BN-fYNCr.cjs +0 -1
  50. package/dist/ReportParamPanel-sOANVRz-.cjs +0 -1
  51. package/dist/ReportPreview-CuoHl15N.cjs +0 -6
  52. package/dist/RuleEditor-XaLcCdTb.cjs +0 -1
  53. package/dist/designer-CyKXBhQg.cjs +0 -2
  54. package/dist/designer-fVvpYg8H.js +0 -5824
@@ -0,0 +1,589 @@
1
+ import { computed as p, shallowRef as Ue, onMounted as Ie, ref as k, onScopeDispose as qe, watch as ve, defineComponent as je, nextTick as He, openBlock as b, createElementBlock as y, unref as e, normalizeClass as Me, createElementVNode as i, createVNode as Q, toDisplayString as o, createTextVNode as w, Fragment as ae, renderList as pe, createCommentVNode as V, withDirectives as O, isRef as Z, vModelText as re, vModelSelect as Je, withKeys as Ge, withModifiers as Qe, createBlock as Ze, withCtx as We, vModelCheckbox as Xe, vShow as Ye } from "vue";
2
+ import { provideMachReportConfig as et, ReportPreview as tt } from "@agile-team/mach-report/vue";
3
+ import { L as lt, c as at, d as nt } from "./designer-B52ddmHO.js";
4
+ import { a as ne } from "./_plugin-vue_export-helper-8SL1F89S.js";
5
+ import { defineReportTemplate as it, createLabelTemplate as st, parseReportTemplate as x, serializeReportTemplate as Ce, createReportSource as ot, defineLabelReport as rt, imposeLabelSheets as dt } from "@agile-team/mach-report";
6
+ import { createCodeAssetRenderers as ut } from "@agile-team/mach-report/codes";
7
+ const de = [
8
+ { id: "material", widthMm: 80, heightMm: 55, faces: 1 },
9
+ { id: "paired", widthMm: 80, heightMm: 55, faces: 2 },
10
+ { id: "warehouse", widthMm: 100, heightMm: 60, faces: 1 }
11
+ ];
12
+ function Le(t, d) {
13
+ return d ?? t.fields.find((s) => s.semanticRole === "identifier" && s.field !== t.rowKey)?.field ?? t.rowKey ?? t.fields[0]?.field;
14
+ }
15
+ function ue(t, d, s) {
16
+ const u = t.fields.filter((a) => a.field !== d && a.field !== t.rowKey);
17
+ if (s === void 0)
18
+ return u.map((a, f) => ({ field: a, index: f, priority: ct(a) })).sort((a, f) => a.priority - f.priority || a.index - f.index).slice(0, 5).map((a) => a.field);
19
+ const m = new Map(u.map((a) => [a.field, a])), l = [...new Set(s)];
20
+ if (l.length > 5) throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");
21
+ return l.map((a) => {
22
+ const f = m.get(a);
23
+ if (!f) throw new Error(`标签显示字段未在业务契约中声明:${a}`);
24
+ return f;
25
+ });
26
+ }
27
+ function ct(t) {
28
+ return /^(?:name|title|label|category)$/i.test(t.field) || /名称|品名|品类|类别/.test(t.label ?? "") ? 0 : t.semanticRole === "dimension" ? 1 : t.semanticRole === "measure" && t.unit ? 2 : t.semanticRole === "identifier" ? 3 : t.semanticRole === "date" ? 4 : 5;
29
+ }
30
+ function ft(t = "paired") {
31
+ return de.find((d) => d.id === t) ?? de[1];
32
+ }
33
+ const ge = "#173450", ce = "#586c82";
34
+ function $(t, d, s, u, m = 4, l = 7) {
35
+ return {
36
+ kind: "text",
37
+ text: t,
38
+ leftMm: d,
39
+ topMm: s,
40
+ widthMm: u,
41
+ heightMm: m,
42
+ style: { fontSize: l, lineHeight: 1.1, color: ge, verticalAlign: "middle" }
43
+ };
44
+ }
45
+ function be(t, d) {
46
+ return {
47
+ kind: "line",
48
+ leftMm: 4,
49
+ topMm: t,
50
+ widthMm: d - 8,
51
+ heightMm: 0.2,
52
+ style: { lineColor: "#c9d7e5", lineWidthPt: 0.55 }
53
+ };
54
+ }
55
+ function De(t, d, s) {
56
+ const u = [];
57
+ let m = 4;
58
+ if (s?.logoData) {
59
+ if (!/^data:image\/(?:png|jpeg);base64,/i.test(s.logoData))
60
+ throw new Error("标签Logo须使用PNG或JPEG图片数据");
61
+ u.push({ kind: "image", leftMm: 4, topMm: 3, widthMm: 12, heightMm: 7, imageData: s.logoData, meta: { labelBrandLogo: !0 } }), m = 19;
62
+ }
63
+ return u.push({ ...$(s?.name?.trim() || t, m, 3, d - m - 4, 5, 9), style: { fontSize: 9, color: "#205582" } }), s?.tagline?.trim() && u.push({ ...$(s.tagline.trim(), m, 8, d - m - 4, 3, 5.5), style: { fontSize: 5.5, color: ce } }), u.push(be(12, d)), u;
64
+ }
65
+ function Fe(t, d, s, u, m = 4.7) {
66
+ return t.flatMap((l, a) => {
67
+ const f = d + a * m;
68
+ return [
69
+ { ...$(l.label ?? l.field, 4, f, s, 4, 6), style: { fontSize: 6, color: ce } },
70
+ { ...$("", 4 + s, f, u, 4, 7), binding: { field: l.field, ...l.format ? { format: l.format } : {} } }
71
+ ];
72
+ });
73
+ }
74
+ function mt(t, d) {
75
+ return t ? [{ ...$("", 4, 14, d, 7, 14), binding: { field: t }, style: { fontSize: 14, color: ge } }] : [];
76
+ }
77
+ function pt(t, d, s, u) {
78
+ const m = ue(t, s, u.fields), l = [
79
+ ...De(d, 80, u.brand),
80
+ ...mt(s, 71),
81
+ ...Fe(m, 23, 21, 27)
82
+ ];
83
+ s && l.push({ kind: "qrcode", leftMm: 55, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: s }, code: { quietZoneModules: 4, errorCorrection: "M" } }), l.push(be(48, 80));
84
+ const a = t.fields.find((f) => f.field === s)?.label ?? d;
85
+ return l.push({ ...$(a, 4, 49, 71, 3, 5.8), style: { fontSize: 5.8, color: ce } }), l;
86
+ }
87
+ function _e(t, d, s, u, m = 80) {
88
+ const l = De(d, m, u.brand);
89
+ s && (l.push({ ...$("", 4, 14, m - 8, 8, 16), binding: { field: s }, style: { fontSize: 16, align: "center", color: ge } }), l.push({ kind: "qrcode", leftMm: (m - 20) / 2, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: s }, code: { quietZoneModules: 4, errorCorrection: "M" } })), l.push(be(44, m));
90
+ const a = ue(t, s, u.fields);
91
+ return m === 100 ? a.forEach((f, M) => {
92
+ const C = M % 2 === 0 ? 4 : 52, h = 46 + Math.floor(M / 2) * 4.3;
93
+ l.push({ ...$(f.label ?? f.field, C, h, 19, 3.7, 5.8), style: { fontSize: 5.8, color: ce } }), l.push({ ...$("", C + 19, h, 25, 3.7, 6.5), binding: { field: f.field, ...f.format ? { format: f.format } : {} } });
94
+ }) : l.push(...Fe(a.slice(0, 1), 46, 24, m - 32, 5)), l;
95
+ }
96
+ function ke(t, d, s, u = {}) {
97
+ const m = Le(t, s), l = ft(u.preset), a = Object.fromEntries(["name", "tagline"].flatMap((h) => {
98
+ const L = u.brand?.[h];
99
+ return typeof L == "string" ? [[h, L]] : [];
100
+ })), f = { preset: l.id, brand: a, fields: ue(t, m, u.fields).map((h) => h.field) }, M = l.id === "warehouse" ? _e(t, d, m, u, l.widthMm) : pt(t, d, m, u), C = [{ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${d} · 1`, labelStudio: f }, components: M }];
101
+ return l.faces === 2 && C.push({ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${d} · 2`, labelStudio: f }, components: _e(t, d, m, u) }), it({ id: "record-label", name: d, template: st({ dataset: "records", rowKey: t.rowKey, pages: C }) });
102
+ }
103
+ function K(t) {
104
+ const d = t.template.pages[0]?.meta?.labelStudio;
105
+ if (!d || typeof d != "object") return;
106
+ const s = d, u = de.find((f) => f.id === s.preset);
107
+ if (!u) return;
108
+ const m = Array.isArray(s.fields) ? s.fields.filter((f) => typeof f == "string") : void 0;
109
+ if (m && m.length > 5) return;
110
+ const l = s.brand && typeof s.brand == "object" ? s.brand : {}, a = {};
111
+ for (const f of ["name", "tagline", "logoData"])
112
+ typeof l[f] == "string" && (a[f] = l[f]);
113
+ return { preset: u.id, fields: m, brand: a };
114
+ }
115
+ function Se(t, d, s) {
116
+ const u = new Set(t.fields.filter((l) => l.field !== d && l.field !== t.rowKey).map((l) => l.field)), m = s?.filter((l) => u.has(l));
117
+ return ue(t, d, m).map((l) => l.field);
118
+ }
119
+ function vt(t, d) {
120
+ const s = p(() => ({ ...lt, ...t.messages })), u = p(() => t.title ?? s.value.title), m = { preset: t.preset, brand: t.brand, fields: t.fields }, l = Ue(t.modelValue ? x(t.modelValue) : ke(t.schema, u.value, t.identityField, m));
121
+ let a = x(l.value);
122
+ Ie(() => {
123
+ t.modelValue || d(x(l.value));
124
+ });
125
+ const f = k("preview"), M = k("all"), C = k(1), h = k(!1), L = k(!1), g = k(), E = at(() => t.beforeDiscard), D = p(() => L.value || E.pending.value || g.value?.saving === !0 || g.value?.blocked === !0), F = k(""), W = p(() => Le(t.schema, t.identityField)), P = k(K(l.value)?.preset ?? (t.modelValue ? void 0 : t.preset ?? "paired")), U = k(K(l.value)?.brand?.name ?? t.brand?.name ?? ""), I = k(K(l.value)?.brand?.tagline ?? t.brand?.tagline ?? ""), _ = k(Se(t.schema, W.value, K(l.value)?.fields ?? t.fields)), X = k(""), ie = p(() => t.schema.fields.filter((n) => n.field !== W.value && n.field !== t.schema.rowKey)), q = p(() => _.value.map((n) => ({ field: n, label: t.schema.fields.find((v) => v.field === n)?.label ?? n }))), fe = p(() => {
126
+ const n = X.value.trim().toLocaleLowerCase();
127
+ return ie.value.filter((v) => `${v.label ?? ""} ${v.field}`.toLocaleLowerCase().includes(n)).slice(0, 30);
128
+ }), j = p(() => {
129
+ const n = l.value.template.pages[0]?.components.find((v) => v.kind === "image" && v.meta?.labelBrandLogo);
130
+ return n?.kind === "image" ? n.imageData : t.brand?.logoData;
131
+ }), Y = p(() => ({
132
+ preset: P.value,
133
+ fields: _.value,
134
+ brand: { ...t.brand, ...j.value ? { logoData: j.value } : {}, name: U.value, tagline: I.value }
135
+ }));
136
+ let N = JSON.stringify(K(l.value));
137
+ const ee = p(() => !K(l.value)), A = () => JSON.stringify({ preset: P.value, fields: _.value, name: U.value, tagline: I.value }), H = k(A()), J = p(() => A() !== H.value), te = p(() => J.value || g.value?.pendingLocalChanges === !0);
138
+ function le() {
139
+ const n = K(l.value);
140
+ P.value = n?.preset, _.value = Se(t.schema, W.value, n?.fields ?? t.fields), U.value = n?.brand?.name ?? t.brand?.name ?? "", I.value = n?.brand?.tagline ?? t.brand?.tagline ?? "", N = JSON.stringify(n), H.value = A();
141
+ }
142
+ function se(n) {
143
+ const v = K(n), S = JSON.stringify(v);
144
+ S !== N && (N = S, le());
145
+ }
146
+ let R = !1;
147
+ qe(() => {
148
+ R = !0;
149
+ });
150
+ const oe = { assetRenderers: ut() };
151
+ et({ get defaults() {
152
+ return { assets: oe, ...t.preview };
153
+ } }), ve(() => t.modelValue, (n) => {
154
+ n && Ce(n) !== Ce(l.value) && (l.value = x(n), a = x(n), se(n));
155
+ }), ve(() => t.rows, () => {
156
+ M.value = "all", C.value = 1;
157
+ });
158
+ function T(n) {
159
+ F.value = "", l.value = n, se(n), d(n);
160
+ }
161
+ function G(n, v) {
162
+ v && _.value.length < 5 && !_.value.includes(n) ? _.value = [..._.value, n] : v || (_.value = _.value.filter((S) => S !== n));
163
+ }
164
+ function c() {
165
+ if (D.value || R) return !1;
166
+ if (!P.value)
167
+ return F.value = s.value.choosePreset, !1;
168
+ if (g.value?.canApply === !1)
169
+ return F.value = g.value.saveReason || s.value.applyFirst, !1;
170
+ try {
171
+ const n = ke(t.schema, u.value, t.identityField, Y.value), v = l.value.template.repeat;
172
+ if (v?.copies !== void 0 && n.template.repeat && (n.template.repeat.copies = v.copies), g.value?.applyTemplate) {
173
+ if (!g.value.applyTemplate(n.template))
174
+ return F.value = s.value.saveFailed, !1;
175
+ } else
176
+ T({ ...l.value, template: n.template });
177
+ return H.value = A(), !0;
178
+ } catch (n) {
179
+ return F.value = n instanceof Error ? n.message : s.value.saveFailed, !1;
180
+ }
181
+ }
182
+ const r = p(() => M.value === "all" ? t.rows : Number.isSafeInteger(C.value) && t.rows[C.value - 1] ? [t.rows[C.value - 1]] : []), z = p(() => l.value.template.repeat?.dataset ?? "records"), xe = p(() => ({ [z.value]: r.value })), Ee = p(() => ({ [z.value]: r.value.slice(0, 3) })), Re = p(() => ({ [z.value]: t.schema })), Te = p(() => [{ id: z.value, label: u.value, rowKey: t.schema.rowKey, fields: t.schema.fields }]), Ve = p(() => l.value.template.pages[0]), he = p(() => l.value.template.pages.length), $e = p(() => {
183
+ const n = l.value.template.repeat?.copies ?? 1;
184
+ return typeof n == "number" ? n : void 0;
185
+ }), Ne = p(() => {
186
+ const n = l.value.template.repeat?.copies;
187
+ return typeof n == "object" ? n.field : void 0;
188
+ }), ye = p(() => {
189
+ const n = Ne.value;
190
+ if (!n) return;
191
+ let v = 0;
192
+ for (const S of r.value) {
193
+ const B = Object.getOwnPropertyDescriptor(S, n)?.value;
194
+ if (typeof B != "number" || !Number.isSafeInteger(B) || B < 1 || B > 1e3) return;
195
+ v += B;
196
+ }
197
+ return v;
198
+ }), ze = p(() => {
199
+ const n = $e.value;
200
+ return n !== void 0 ? Number.isSafeInteger(n) && n >= 1 && n <= 1e3 ? r.value.length * n * he.value : void 0 : ye.value === void 0 ? void 0 : ye.value * he.value;
201
+ }), Be = p(() => {
202
+ const n = ot({ labels: rt({ template: l.value.template, rows: r.value, dataSchema: t.schema }) }), v = h.value;
203
+ return async (S) => {
204
+ const B = await n(S);
205
+ return v ? dt(B, { paper: "a4", columns: 2, rows: 4, marginMm: 12, gapMm: 4, signal: S.signal }) : B;
206
+ };
207
+ }), Ke = async (n, v) => {
208
+ const S = t.save ? await t.save(n, v) : x(n);
209
+ if (R || v.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
210
+ return a = x(S), T(S), S;
211
+ };
212
+ async function we() {
213
+ if (!(D.value || R) && !(J.value && !c())) {
214
+ L.value = !0;
215
+ try {
216
+ if (g.value) {
217
+ if (g.value.canApply === !1) {
218
+ F.value = g.value.saveReason || s.value.applyFirst;
219
+ return;
220
+ }
221
+ if (g.value.pendingLocalChanges && await g.value.save(), g.value.pendingLocalChanges) {
222
+ F.value = s.value.saveFailed;
223
+ return;
224
+ }
225
+ }
226
+ if (!R)
227
+ return F.value = "", x(l.value);
228
+ } finally {
229
+ L.value = !1;
230
+ }
231
+ }
232
+ }
233
+ async function Pe(n) {
234
+ n !== f.value && await we() && (f.value = n);
235
+ }
236
+ let me = !1;
237
+ const Ae = (n) => me || E.request(n);
238
+ async function Oe() {
239
+ if (D.value) return !1;
240
+ const n = g.value?.pendingLocalChanges === !0;
241
+ if (!n && !J.value) return !0;
242
+ if (!(n && g.value ? await g.value.guardChanges() : await E.request({ reason: "replace", document: x(l.value), pendingLocalChanges: !0 })) || R) return !1;
243
+ if (n && g.value) {
244
+ me = !0;
245
+ try {
246
+ await g.value.reset();
247
+ } finally {
248
+ me = !1;
249
+ }
250
+ T(x(a));
251
+ }
252
+ return le(), !0;
253
+ }
254
+ return { m: s, notice: F, title: u, document: l, mode: f, record: M, recordIndex: C, sheet: h, busy: D, editor: g, rows: r, datasets: xe, designDatasets: Ee, schemas: Re, bindings: Te, paper: Ve, labelCount: ze, fetcher: Be, update: T, save: Ke, navigate: Pe, prepare: we, guardChanges: Oe, preset: P, presets: de, brandName: U, brandTagline: I, fields: _, fieldQuery: X, selectedFields: q, availableFields: fe, fieldCount: p(() => ie.value.length), configurationDirty: J, pendingLocalChanges: te, custom: ee, toggleField: G, applyConfiguration: c, restoreConfiguration: le, beforeDiscard: Ae, confirmation: E.confirmation, decideDiscard: E.decide };
255
+ }
256
+ const gt = ["aria-label"], bt = { class: "mr-label-context" }, ht = { class: "mr-label-identity" }, yt = { class: "mr-label-spec" }, wt = ["disabled"], Mt = ["aria-label"], Ct = ["aria-pressed", "onClick"], _t = { class: "mr-label-fields" }, kt = {
257
+ key: 0,
258
+ class: "mr-label-selected-fields"
259
+ }, St = ["aria-label", "onClick"], Lt = { class: "mr-label-field-search" }, Dt = ["aria-label", "placeholder"], Ft = { class: "mr-label-field-options" }, xt = ["checked", "disabled", "onChange"], Et = { key: 0 }, Rt = { key: 1 }, Tt = { class: "mr-label-brand" }, Vt = ["placeholder"], $t = ["disabled"], Nt = {
260
+ key: 1,
261
+ class: "mr-label-reflow-hint"
262
+ }, zt = { class: "mr-label-reflow-hint" }, Bt = { class: "mr-label-record" }, Kt = ["disabled"], Pt = { value: "all" }, At = { value: "single" }, Ot = {
263
+ key: 0,
264
+ class: "mr-label-record-index"
265
+ }, Ut = ["max", "aria-label", "disabled"], It = { class: "mr-label-count" }, qt = { class: "mr-label-help" }, jt = { class: "mr-label-main" }, Ht = { class: "mr-label-bar" }, Jt = ["aria-label"], Gt = ["aria-pressed", "disabled"], Qt = ["aria-pressed", "disabled"], Zt = {
266
+ key: 0,
267
+ class: "mr-label-notice",
268
+ role: "status"
269
+ }, Wt = ["aria-label"], Xt = { class: "mr-label-imposition" }, Yt = { class: "mr-label-editor" }, sl = /* @__PURE__ */ je({
270
+ __name: "ReportLabelStudio",
271
+ props: {
272
+ showSave: { type: Boolean, default: !0 },
273
+ rows: {},
274
+ schema: {},
275
+ title: {},
276
+ identityField: {},
277
+ modelValue: {},
278
+ preview: {},
279
+ save: {},
280
+ beforeDiscard: {},
281
+ messages: {},
282
+ preset: {},
283
+ brand: {},
284
+ fields: {}
285
+ },
286
+ emits: ["update:modelValue"],
287
+ setup(t, { expose: d, emit: s }) {
288
+ const u = t, m = s, l = vt(u, (G) => m("update:modelValue", G)), { m: a, notice: f, title: M, document: C, mode: h, record: L, recordIndex: g, sheet: E, busy: D, editor: F, rows: W, designDatasets: P, schemas: U, bindings: I, paper: _, labelCount: X, fetcher: ie, preset: q, presets: fe, brandName: j, brandTagline: Y, fields: N, fieldQuery: ee, selectedFields: A, availableFields: H, fieldCount: J, configurationDirty: te, pendingLocalChanges: le, custom: se, confirmation: R } = l, oe = k();
289
+ let T = null;
290
+ return ve(R, async (G) => {
291
+ G ? (T = window.document.activeElement, await He(), oe.value?.focus()) : T?.isConnected && (T.focus(), T = null);
292
+ }), d({ guardChanges: l.guardChanges, prepare: l.prepare, get busy() {
293
+ return D.value;
294
+ }, get pendingLocalChanges() {
295
+ return le.value;
296
+ } }), (G, c) => (b(), y("section", {
297
+ class: Me(["mr-label-studio", { "is-design": e(h) === "design" }]),
298
+ "aria-label": e(M)
299
+ }, [
300
+ i("aside", bt, [
301
+ i("div", ht, [
302
+ Q(ne, {
303
+ name: "file",
304
+ size: 18
305
+ }),
306
+ i("strong", null, o(e(M)), 1),
307
+ i("small", null, o(e(se) ? e(a).customTemplate : e(a).readyTemplate), 1)
308
+ ]),
309
+ i("div", yt, [
310
+ i("strong", null, [
311
+ w(o(e(_)?.widthMm) + " ", 1),
312
+ c[13] || (c[13] = i("i", null, "×", -1)),
313
+ w(" " + o(e(_)?.heightMm), 1)
314
+ ]),
315
+ i("span", null, "mm · " + o(e(C).template.pages.length) + " " + o(e(a).faces), 1)
316
+ ]),
317
+ i("fieldset", {
318
+ class: "mr-label-quick",
319
+ disabled: e(D)
320
+ }, [
321
+ i("legend", null, o(e(a).layout), 1),
322
+ i("div", {
323
+ class: "mr-label-presets",
324
+ "aria-label": e(a).layout
325
+ }, [
326
+ (b(!0), y(ae, null, pe(e(fe), (r) => (b(), y("button", {
327
+ key: r.id,
328
+ type: "button",
329
+ "aria-pressed": e(q) === r.id,
330
+ onClick: (z) => q.value = r.id
331
+ }, [
332
+ i("span", {
333
+ class: Me(["mr-label-preset-art", `is-${r.id}`]),
334
+ "aria-hidden": "true"
335
+ }, [...c[14] || (c[14] = [
336
+ i("i", null, null, -1),
337
+ i("i", null, null, -1),
338
+ i("i", null, null, -1)
339
+ ])], 2),
340
+ i("span", null, [
341
+ i("strong", null, o(e(a)[`${r.id}Preset`]), 1),
342
+ i("small", null, o(r.widthMm) + " × " + o(r.heightMm) + " · " + o(r.faces) + " " + o(e(a).faces), 1)
343
+ ])
344
+ ], 8, Ct))), 128))
345
+ ], 8, Mt),
346
+ i("details", _t, [
347
+ i("summary", null, [
348
+ w(o(e(a).fields) + " ", 1),
349
+ i("span", null, o(e(N).length) + " / 5", 1)
350
+ ]),
351
+ e(A).length ? (b(), y("div", kt, [
352
+ (b(!0), y(ae, null, pe(e(A), (r) => (b(), y("button", {
353
+ key: r.field,
354
+ type: "button",
355
+ "aria-label": `${e(a).removeField} ${r.label}`,
356
+ onClick: (z) => e(l).toggleField(r.field, !1)
357
+ }, [
358
+ w(o(r.label) + " ", 1),
359
+ c[15] || (c[15] = i("span", { "aria-hidden": "true" }, "×", -1))
360
+ ], 8, St))), 128))
361
+ ])) : V("", !0),
362
+ i("label", Lt, [
363
+ Q(ne, {
364
+ name: "search",
365
+ size: 13
366
+ }),
367
+ O(i("input", {
368
+ "onUpdate:modelValue": c[0] || (c[0] = (r) => Z(ee) ? ee.value = r : null),
369
+ type: "search",
370
+ "aria-label": e(a).findField,
371
+ placeholder: e(a).findField
372
+ }, null, 8, Dt), [
373
+ [re, e(ee)]
374
+ ])
375
+ ]),
376
+ i("div", Ft, [
377
+ (b(!0), y(ae, null, pe(e(H), (r) => (b(), y("label", {
378
+ key: r.field
379
+ }, [
380
+ i("input", {
381
+ type: "checkbox",
382
+ checked: e(N).includes(r.field),
383
+ disabled: !e(N).includes(r.field) && e(N).length >= 5,
384
+ onChange: (z) => e(l).toggleField(r.field, z.target.checked)
385
+ }, null, 40, xt),
386
+ i("span", null, o(r.label ?? r.field), 1)
387
+ ]))), 128)),
388
+ e(H).length ? V("", !0) : (b(), y("p", Et, o(e(a).noFields), 1))
389
+ ]),
390
+ i("small", null, o(e(a).fieldLimit), 1),
391
+ e(J) > 30 ? (b(), y("small", Rt, o(e(a).fieldSearchHint), 1)) : V("", !0)
392
+ ]),
393
+ i("details", Tt, [
394
+ i("summary", null, o(e(a).brand), 1),
395
+ i("label", null, [
396
+ w(o(e(a).brandName), 1),
397
+ O(i("input", {
398
+ "onUpdate:modelValue": c[1] || (c[1] = (r) => Z(j) ? j.value = r : null),
399
+ maxlength: "80",
400
+ placeholder: e(M)
401
+ }, null, 8, Vt), [
402
+ [re, e(j)]
403
+ ])
404
+ ]),
405
+ i("label", null, [
406
+ w(o(e(a).brandTagline), 1),
407
+ O(i("input", {
408
+ "onUpdate:modelValue": c[2] || (c[2] = (r) => Z(Y) ? Y.value = r : null),
409
+ maxlength: "120"
410
+ }, null, 512), [
411
+ [re, e(Y)]
412
+ ])
413
+ ])
414
+ ]),
415
+ i("button", {
416
+ class: "mr-label-apply",
417
+ type: "button",
418
+ disabled: !e(te) || !e(q),
419
+ onClick: c[3] || (c[3] = //@ts-ignore
420
+ (...r) => e(l).applyConfiguration && e(l).applyConfiguration(...r))
421
+ }, [
422
+ Q(ne, {
423
+ name: "arrow-right",
424
+ size: 13
425
+ }),
426
+ w(o(e(a).applyLayout), 1)
427
+ ], 8, $t),
428
+ e(te) ? (b(), y("button", {
429
+ key: 0,
430
+ class: "mr-label-reset-configuration",
431
+ type: "button",
432
+ onClick: c[4] || (c[4] = //@ts-ignore
433
+ (...r) => e(l).restoreConfiguration && e(l).restoreConfiguration(...r))
434
+ }, o(e(a).restoreConfiguration), 1)) : V("", !0),
435
+ e(te) && !e(q) ? (b(), y("p", Nt, o(e(a).choosePreset), 1)) : V("", !0),
436
+ i("p", zt, o(e(a).reflowHint), 1)
437
+ ], 8, wt),
438
+ i("label", Bt, [
439
+ w(o(e(a).records), 1),
440
+ O(i("select", {
441
+ "onUpdate:modelValue": c[5] || (c[5] = (r) => Z(L) ? L.value = r : null),
442
+ disabled: e(D) || !u.rows.length
443
+ }, [
444
+ i("option", Pt, o(e(a).all) + " · " + o(u.rows.length), 1),
445
+ i("option", At, o(e(a).single), 1)
446
+ ], 8, Kt), [
447
+ [Je, e(L)]
448
+ ])
449
+ ]),
450
+ e(L) === "single" ? (b(), y("label", Ot, [
451
+ w(o(e(a).record), 1),
452
+ O(i("input", {
453
+ "onUpdate:modelValue": c[6] || (c[6] = (r) => Z(g) ? g.value = r : null),
454
+ type: "number",
455
+ min: "1",
456
+ max: u.rows.length,
457
+ "aria-label": e(a).record,
458
+ disabled: e(D)
459
+ }, null, 8, Ut), [
460
+ [
461
+ re,
462
+ e(g),
463
+ void 0,
464
+ { number: !0 }
465
+ ]
466
+ ]),
467
+ w(" / " + o(u.rows.length), 1)
468
+ ])) : V("", !0),
469
+ i("p", It, [
470
+ i("strong", null, o(e(W).length), 1),
471
+ w(" " + o(e(a).count) + " ", 1),
472
+ c[16] || (c[16] = i("span", null, "→", -1)),
473
+ c[17] || (c[17] = w()),
474
+ e(X) !== void 0 ? (b(), y(ae, { key: 0 }, [
475
+ i("strong", null, o(e(X)), 1),
476
+ w(" " + o(e(a).labels), 1)
477
+ ], 64)) : (b(), y(ae, { key: 1 }, [
478
+ w(o(e(a).invalidCopies), 1)
479
+ ], 64))
480
+ ]),
481
+ i("details", qt, [
482
+ i("summary", null, o(e(a).guide), 1),
483
+ i("p", null, o(e(a).help), 1),
484
+ i("p", null, o(e(a).printHint), 1)
485
+ ])
486
+ ]),
487
+ i("div", jt, [
488
+ i("header", Ht, [
489
+ i("nav", { "aria-label": e(M) }, [
490
+ i("button", {
491
+ type: "button",
492
+ "aria-pressed": e(h) === "preview",
493
+ disabled: e(D),
494
+ onClick: c[7] || (c[7] = (r) => e(l).navigate("preview"))
495
+ }, [
496
+ Q(ne, {
497
+ name: "file",
498
+ size: 14
499
+ }),
500
+ w(o(e(a).preview), 1)
501
+ ], 8, Gt),
502
+ i("button", {
503
+ type: "button",
504
+ "aria-pressed": e(h) === "design",
505
+ disabled: e(D),
506
+ onClick: c[8] || (c[8] = (r) => e(l).navigate("design"))
507
+ }, [
508
+ Q(ne, {
509
+ name: "settings",
510
+ size: 14
511
+ }),
512
+ w(o(e(a).design), 1)
513
+ ], 8, Qt)
514
+ ], 8, Jt),
515
+ i("span", null, o(e(h) === "design" ? e(a).designHint : e(a).flow), 1)
516
+ ]),
517
+ e(f) ? (b(), y("p", Zt, o(e(f)), 1)) : V("", !0),
518
+ e(R) ? (b(), y("div", {
519
+ key: 1,
520
+ class: "mr-label-confirm",
521
+ role: "alertdialog",
522
+ "aria-label": e(a).discardTitle,
523
+ onKeydown: c[11] || (c[11] = Ge(Qe((r) => e(l).decideDiscard(!1), ["prevent", "stop"]), ["esc"]))
524
+ }, [
525
+ i("div", null, [
526
+ i("strong", null, o(e(a).discardTitle), 1),
527
+ i("p", null, o(e(a).discardDescription), 1)
528
+ ]),
529
+ i("button", {
530
+ ref_key: "keepEditingButton",
531
+ ref: oe,
532
+ type: "button",
533
+ onClick: c[9] || (c[9] = (r) => e(l).decideDiscard(!1))
534
+ }, o(e(a).keepEditing), 513),
535
+ i("button", {
536
+ type: "button",
537
+ onClick: c[10] || (c[10] = (r) => e(l).decideDiscard(!0))
538
+ }, o(e(a).discard), 1)
539
+ ], 40, Wt)) : V("", !0),
540
+ e(h) === "preview" ? (b(), Ze(e(tt), {
541
+ key: 2,
542
+ "report-id": "labels",
543
+ fetcher: e(ie),
544
+ "show-params": !1,
545
+ height: "100%",
546
+ toolbar: { exportFormats: ["pdf", "png", "html"], editing: !1, excelImport: !1 },
547
+ messages: { title: e(M), empty: e(a).empty }
548
+ }, {
549
+ settings: We(() => [
550
+ i("label", Xt, [
551
+ O(i("input", {
552
+ "onUpdate:modelValue": c[12] || (c[12] = (r) => Z(E) ? E.value = r : null),
553
+ type: "checkbox"
554
+ }, null, 512), [
555
+ [Xe, e(E)]
556
+ ]),
557
+ w(o(e(a).sheet), 1),
558
+ i("small", null, o(e(a).sheetHint), 1)
559
+ ])
560
+ ]),
561
+ _: 1
562
+ }, 8, ["fetcher", "messages"])) : V("", !0),
563
+ O(i("div", Yt, [
564
+ Q(nt, {
565
+ ref_key: "editor",
566
+ ref: F,
567
+ "model-value": e(C),
568
+ mode: "design",
569
+ "show-mode-switch": !1,
570
+ "show-save": t.showSave,
571
+ capabilities: { params: !1 },
572
+ datasets: e(P),
573
+ "data-schemas": e(U),
574
+ "binding-datasets": e(I),
575
+ save: e(l).save,
576
+ "before-discard": e(l).beforeDiscard,
577
+ preview: t.preview,
578
+ "onUpdate:modelValue": e(l).update
579
+ }, null, 8, ["model-value", "show-save", "datasets", "data-schemas", "binding-datasets", "save", "before-discard", "preview", "onUpdate:modelValue"])
580
+ ], 512), [
581
+ [Ye, e(h) === "design"]
582
+ ])
583
+ ])
584
+ ], 10, gt));
585
+ }
586
+ });
587
+ export {
588
+ sl as default
589
+ };