@agile-team/mach-report 2.21.0 → 2.22.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 (110) hide show
  1. package/README.md +16 -2
  2. package/dist/{ExcelBindingWizard-B2xXBOJu.cjs → ExcelBindingWizard-CW79I6Gl.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-CixTPQAL.js → ExcelBindingWizard-CZyppD7I.js} +3 -3
  4. package/dist/{ParamEditor-DhHlNxai.cjs → ParamEditor-CiYCJI0b.cjs} +1 -1
  5. package/dist/{ParamEditor-gKhvEsnr.js → ParamEditor-DQit-Gdf.js} +2 -2
  6. package/dist/{ReportBatchPanel-D-lyWKyf.js → ReportBatchPanel-DKTpV7MU.js} +2 -2
  7. package/dist/{ReportBatchPanel-BUdUfTdm.cjs → ReportBatchPanel-Db6TAfG5.cjs} +1 -1
  8. package/dist/ReportLabelStudio-B0i9ohQj.cjs +1 -0
  9. package/dist/ReportLabelStudio-BYnRqmje.js +780 -0
  10. package/dist/{ReportParamPanel-peB-KEmm.js → ReportParamPanel-BHSKVL8k.js} +231 -224
  11. package/dist/ReportParamPanel-lngONOEz.cjs +1 -0
  12. package/dist/ReportPreview-BDgKssYR.js +5887 -0
  13. package/dist/ReportPreview-Dw-4icG6.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-WZl-AK-2.js → ReportTemplateLibrary-BZuKn0YK.js} +1 -1
  15. package/dist/{ReportTemplateLibrary-Cs9WKneQ.cjs → ReportTemplateLibrary-DEXH07ND.cjs} +1 -1
  16. package/dist/{RuleEditor-DGpmjCko.js → RuleEditor-CIQn547x.js} +3 -3
  17. package/dist/{RuleEditor-Dtcq-7LO.cjs → RuleEditor-zSUmPjKa.cjs} +1 -1
  18. package/dist/{TemplateOutlinePanel-CkCh506f.cjs → TemplateOutlinePanel-B5SfGYVN.cjs} +1 -1
  19. package/dist/{TemplateOutlinePanel-cxp95OT9.js → TemplateOutlinePanel-D0PgOSQE.js} +2 -2
  20. package/dist/{TemplateReusePanel-BZ8VTtrO.js → TemplateReusePanel-BKlAEF8-.js} +2 -2
  21. package/dist/{TemplateReusePanel-CwttuSta.cjs → TemplateReusePanel-DAy_Hwqz.cjs} +1 -1
  22. package/dist/TemplateReviewPanel-CowmHaQQ.cjs +1 -0
  23. package/dist/{TemplateReviewPanel-C9cTvsRs.js → TemplateReviewPanel-div-EH_m.js} +2 -2
  24. package/dist/artifact-integrity.json +76 -76
  25. package/dist/{auto-Tq7ReIC1.cjs → auto-DcUHlKob.cjs} +1 -1
  26. package/dist/{auto-BkdGiNtr.js → auto-moShblh1.js} +4 -4
  27. package/dist/{designer-CIDHt5xz.js → designer-B7jJeAeG.js} +1500 -1455
  28. package/dist/{designer-CDqok4S5.cjs → designer-BWQVpJeN.cjs} +2 -2
  29. package/dist/designer.cjs +1 -1
  30. package/dist/designer.d.cts +149 -2
  31. package/dist/designer.d.ts +149 -2
  32. package/dist/designer.js +13 -12
  33. package/dist/{encoding-BSeUwrN7.js → encoding-DbnhbwI8.js} +2 -2
  34. package/dist/{encoding-B79hW4zq.cjs → encoding-ncQAvyOv.cjs} +1 -1
  35. package/dist/index.cjs +5 -5
  36. package/dist/index.d.cts +38 -0
  37. package/dist/index.d.ts +38 -0
  38. package/dist/index.js +299 -279
  39. package/dist/{json-snapshot-Kgn459Oj.js → json-snapshot-DvQbZlD7.js} +2 -2
  40. package/dist/{json-snapshot-I5VI84Vp.cjs → json-snapshot-nyV63AbB.cjs} +1 -1
  41. package/dist/{plugin-BaRUGORD.cjs → plugin-AcAQ2m9X.cjs} +1 -1
  42. package/dist/{plugin-D4kAxfLG.js → plugin-w5Nyt08U.js} +1 -1
  43. package/dist/{prefill-CJSazcVY.js → prefill-BXBxx5We.js} +1 -1
  44. package/dist/{prefill-Bpyn58AZ.cjs → prefill-DUvejVt1.cjs} +1 -1
  45. package/dist/prepared-YXy-fVLw.cjs +1 -0
  46. package/dist/{prepared-BwjwEzFz.js → prepared-rXCKqdHY.js} +35 -34
  47. package/dist/{protocol-C8VWF9An.cjs → protocol-C9ZaylID.cjs} +1 -1
  48. package/dist/{protocol-Bs9-ohHN.js → protocol-fjaeKkjf.js} +3 -3
  49. package/dist/{region-binding-workflow-JNowHd0A.cjs → region-binding-workflow-BiJQ7NU6.cjs} +1 -1
  50. package/dist/{region-binding-workflow-Cy4GIOUo.js → region-binding-workflow-aA8nxmkZ.js} +1 -1
  51. package/dist/report-encoding-worker.cjs +1 -1
  52. package/dist/report-encoding-worker.js +1 -1
  53. package/dist/{runtime-BDf5x1i1.js → runtime-BTtpjF3D.js} +4 -4
  54. package/dist/{runtime-DsJt1PIf.cjs → runtime-Dq0LUsyS.cjs} +1 -1
  55. package/dist/sbom.cdx.json +1 -1
  56. package/dist/server/node.d.cts +9 -0
  57. package/dist/server/node.d.ts +9 -0
  58. package/dist/server-node.cjs +5 -4
  59. package/dist/server-node.js +1838 -1760
  60. package/dist/server.cjs +1 -1
  61. package/dist/server.d.cts +81 -0
  62. package/dist/server.d.ts +81 -0
  63. package/dist/server.js +6 -6
  64. package/dist/style.css +1 -1
  65. package/dist/template-catalog-CLAM4w7H.cjs +1 -0
  66. package/dist/{template-catalog-DFwIS9aN.js → template-catalog-JSxSqk5y.js} +3 -3
  67. package/dist/template-fragments-Ca25Jt7e.cjs +1 -0
  68. package/dist/{template-fragments-Dng-AlHk.js → template-fragments-D2JFj7Du.js} +18 -18
  69. package/dist/{template-outline-DiADphlq.js → template-outline-CDWXptuj.js} +1 -1
  70. package/dist/template-outline-K4jGhATu.cjs +1 -0
  71. package/dist/template-registry-CWnuGqyP.cjs +1 -0
  72. package/dist/{template-registry-DhBqoD7W.js → template-registry-Do1Uav2Z.js} +333 -261
  73. package/dist/template-serialization-CU4n_Miu.js +307 -0
  74. package/dist/template-serialization-CgqBo6s-.cjs +1 -0
  75. package/dist/vue/async.d.cts +97 -2
  76. package/dist/vue/async.d.ts +97 -2
  77. package/dist/vue/index.d.cts +197 -4
  78. package/dist/vue/index.d.ts +197 -4
  79. package/dist/vue-async.cjs +1 -1
  80. package/dist/vue-async.js +3 -3
  81. package/dist/vue.cjs +1 -1
  82. package/dist/vue.js +75 -70
  83. package/dist/{workbook-session-NYv01LHe.cjs → workbook-session-BvEBRRMz.cjs} +1 -1
  84. package/dist/{workbook-session-oinxX3qo.js → workbook-session-f0wVlzst.js} +1 -1
  85. package/dist/workbook-sheets-CaPAulQ6.cjs +2 -0
  86. package/dist/workbook-sheets-D4M7XXBh.js +44 -0
  87. package/dist/worker.cjs +1 -1
  88. package/dist/worker.d.cts +9 -0
  89. package/dist/worker.d.ts +9 -0
  90. package/dist/worker.js +4 -4
  91. package/dist/xlsx.cjs +4 -4
  92. package/dist/xlsx.d.cts +39 -2
  93. package/dist/xlsx.d.ts +39 -2
  94. package/dist/xlsx.js +290 -270
  95. package/package.json +1 -1
  96. package/dist/ReportLabelStudio-BcjQt73a.cjs +0 -1
  97. package/dist/ReportLabelStudio-N2w6DdaZ.js +0 -764
  98. package/dist/ReportParamPanel-CVpK8mFc.cjs +0 -1
  99. package/dist/ReportPreview-BBJNlu2U.js +0 -5740
  100. package/dist/ReportPreview-nf4Dk1Jc.cjs +0 -6
  101. package/dist/TemplateReviewPanel-C2YjiaEC.cjs +0 -1
  102. package/dist/prepared-BiSz_9vN.cjs +0 -1
  103. package/dist/template-bindings-Cg5oBLFT.cjs +0 -1
  104. package/dist/template-bindings-TKnXM7ll.js +0 -62
  105. package/dist/template-catalog-D_2jdnkL.cjs +0 -1
  106. package/dist/template-fragments-DZVUBhuB.cjs +0 -1
  107. package/dist/template-outline-DWkzZXVC.cjs +0 -1
  108. package/dist/template-registry-DpLUSLwF.cjs +0 -1
  109. package/dist/template-serialization-Cc3h-miv.js +0 -247
  110. package/dist/template-serialization-D1R5oAqh.cjs +0 -1
@@ -1,764 +0,0 @@
1
- import { computed as p, shallowRef as Ce, ref as R, onMounted as st, onScopeDispose as qe, watch as X, defineComponent as ot, markRaw as rt, nextTick as ut, openBlock as S, createElementBlock as M, unref as t, normalizeClass as ze, createElementVNode as r, createVNode as ve, toDisplayString as d, createTextVNode as _, Fragment as be, renderList as Ne, createCommentVNode as N, withDirectives as W, isRef as se, vModelText as Se, vModelSelect as dt, withKeys as ct, withModifiers as ft, createBlock as Ae, withCtx as mt, vModelCheckbox as vt, resolveDynamicComponent as bt, vShow as pt } from "vue";
2
- import { provideMachReportConfig as gt, ReportPreview as ht } from "@agile-team/mach-report/vue";
3
- import { a as pe } from "./_plugin-vue_export-helper-8SL1F89S.js";
4
- import { defineReportTemplate as yt, createLabelTemplate as wt, parseReportTemplate as x, serializeReportTemplate as Me, createReportSource as St, defineLabelReport as Mt, imposeLabelSheets as Ct } from "@agile-team/mach-report";
5
- import { L as kt, c as _t } from "./designer-CIDHt5xz.js";
6
- function Lt() {
7
- let e;
8
- const s = () => e ??= import("@agile-team/mach-report/codes").then((o) => o.createCodeAssetRenderers()).catch((o) => {
9
- throw e = void 0, o;
10
- }), n = (o) => async (u) => {
11
- u.signal.throwIfAborted();
12
- const l = await s();
13
- return u.signal.throwIfAborted(), l[o](u);
14
- };
15
- return { assetRenderers: { barcode: n("barcode"), qrcode: n("qrcode") } };
16
- }
17
- function Rt(e) {
18
- const s = e.pages[0];
19
- if (!s || e.pages.some((u) => u.layout === "wide" || u.widthMm !== s.widthMm || u.heightMm !== s.heightMm)) return;
20
- const n = Math.floor(190 / (s.widthMm + 4)), o = Math.floor(277 / (s.heightMm + 4));
21
- if (!(n < 1 || o < 1 || n * o > 1e3))
22
- return { paper: "a4", columns: n, rows: o, marginMm: 12, gapMm: 4, capacity: n * o };
23
- }
24
- const ke = [
25
- { id: "material", widthMm: 80, heightMm: 55, faces: 1 },
26
- { id: "paired", widthMm: 80, heightMm: 55, faces: 2 },
27
- { id: "warehouse", widthMm: 100, heightMm: 60, faces: 1 }
28
- ];
29
- function Be(e, s) {
30
- return s ?? e.fields.find((n) => n.semanticRole === "identifier" && n.field !== e.rowKey)?.field ?? e.rowKey ?? e.fields[0]?.field;
31
- }
32
- function Le(e, s, n) {
33
- const o = e.fields.filter((a) => a.field !== s && a.field !== e.rowKey);
34
- if (n === void 0)
35
- return o.map((a, f) => ({ field: a, index: f, priority: Dt(a) })).sort((a, f) => a.priority - f.priority || a.index - f.index).slice(0, 5).map((a) => a.field);
36
- const u = new Map(o.map((a) => [a.field, a])), l = [...new Set(n)];
37
- if (l.length > 5) throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");
38
- return l.map((a) => {
39
- const f = u.get(a);
40
- if (!f) throw new Error(`标签显示字段未在业务契约中声明:${a}`);
41
- return f;
42
- });
43
- }
44
- function Dt(e) {
45
- return /^(?:name|title|label|category)$/i.test(e.field) || /名称|品名|品类|类别/.test(e.label ?? "") ? 0 : e.semanticRole === "dimension" ? 1 : e.semanticRole === "measure" && e.unit ? 2 : e.semanticRole === "identifier" ? 3 : e.semanticRole === "date" ? 4 : 5;
46
- }
47
- function Ft(e = "paired") {
48
- return ke.find((s) => s.id === e) ?? ke[1];
49
- }
50
- const xe = "#173450", Re = "#586c82";
51
- function H(e, s, n, o, u = 4, l = 7) {
52
- return {
53
- kind: "text",
54
- text: e,
55
- leftMm: s,
56
- topMm: n,
57
- widthMm: o,
58
- heightMm: u,
59
- style: { fontSize: l, lineHeight: 1.1, color: xe, verticalAlign: "middle" }
60
- };
61
- }
62
- function Te(e, s) {
63
- return {
64
- kind: "line",
65
- leftMm: 4,
66
- topMm: e,
67
- widthMm: s - 8,
68
- heightMm: 0.2,
69
- style: { lineColor: "#c9d7e5", lineWidthPt: 0.55 }
70
- };
71
- }
72
- function He(e, s, n) {
73
- const o = [];
74
- let u = 4;
75
- if (n?.logoData) {
76
- if (!/^data:image\/(?:png|jpeg);base64,/i.test(n.logoData))
77
- throw new Error("标签Logo须使用PNG或JPEG图片数据");
78
- o.push({ kind: "image", leftMm: 4, topMm: 3, widthMm: 12, heightMm: 7, imageData: n.logoData, meta: { labelBrandLogo: !0 } }), u = 19;
79
- }
80
- return o.push({ ...H(n?.name?.trim() || e, u, 3, s - u - 4, 5, 9), style: { fontSize: 9, color: "#205582" }, meta: { labelStudioRole: "brand-name" } }), n?.tagline?.trim() && o.push({ ...H(n.tagline.trim(), u, 8, s - u - 4, 3, 5.5), style: { fontSize: 5.5, color: Re }, meta: { labelStudioRole: "brand-tagline" } }), o.push(Te(12, s)), o;
81
- }
82
- function Ke(e, s, n, o, u = 4.7) {
83
- return e.flatMap((l, a) => {
84
- const f = s + a * u;
85
- return [
86
- { ...H(l.label ?? l.field, 4, f, n, 4, 6), style: { fontSize: 6, color: Re }, meta: { labelStudioRole: "field-label", labelStudioField: l.field } },
87
- { ...H("", 4 + n, f, o, 4, 7), binding: { field: l.field, ...l.format ? { format: l.format } : {} }, meta: { labelStudioRole: "field-value", labelStudioField: l.field } }
88
- ];
89
- });
90
- }
91
- function Nt(e, s) {
92
- return e ? [{ ...H("", 4, 14, s, 7, 14), binding: { field: e }, style: { fontSize: 14, color: xe } }] : [];
93
- }
94
- function Et(e, s, n, o) {
95
- const u = Le(e, n, o.fields), l = [
96
- ...He(s, 80, o.brand),
97
- ...Nt(n, 71),
98
- ...Ke(u, 23, 21, 27)
99
- ];
100
- n && l.push({ kind: "qrcode", leftMm: 55, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: n }, code: { quietZoneModules: 4, errorCorrection: "M" } }), l.push(Te(48, 80));
101
- const a = e.fields.find((f) => f.field === n)?.label ?? s;
102
- return l.push({ ...H(a, 4, 49, 71, 3, 5.8), style: { fontSize: 5.8, color: Re } }), l;
103
- }
104
- function Je(e, s, n, o, u = 80) {
105
- const l = He(s, u, o.brand);
106
- n && (l.push({ ...H("", 4, 14, u - 8, 8, 16), binding: { field: n }, style: { fontSize: 16, align: "center", color: xe } }), l.push({ kind: "qrcode", leftMm: (u - 20) / 2, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: n }, code: { quietZoneModules: 4, errorCorrection: "M" } })), l.push(Te(44, u));
107
- const a = Le(e, n, o.fields);
108
- return u === 100 ? a.forEach((f, y) => {
109
- const g = y % 2 === 0 ? 4 : 52, v = 46 + Math.floor(y / 2) * 4.3;
110
- l.push({ ...H(f.label ?? f.field, g, v, 19, 3.7, 5.8), style: { fontSize: 5.8, color: Re }, meta: { labelStudioRole: "field-label", labelStudioField: f.field } }), l.push({ ...H("", g + 19, v, 25, 3.7, 6.5), binding: { field: f.field, ...f.format ? { format: f.format } : {} }, meta: { labelStudioRole: "field-value", labelStudioField: f.field } });
111
- }) : l.push(...Ke(a.slice(0, 1), 46, 24, u - 32, 5)), l;
112
- }
113
- function ge(e, s, n, o = {}) {
114
- const u = Be(e, n), l = Ft(o.preset), a = Object.fromEntries(["name", "tagline"].flatMap((v) => {
115
- const h = o.brand?.[v];
116
- return typeof h == "string" ? [[v, h]] : [];
117
- })), f = { preset: l.id, brand: a, fields: Le(e, u, o.fields).map((v) => v.field) }, y = l.id === "warehouse" ? Je(e, s, u, o, l.widthMm) : Et(e, s, u, o), g = [{ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${s} · 1`, labelStudio: f }, components: y }];
118
- return l.faces === 2 && g.push({ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${s} · 2`, labelStudio: f }, components: Je(e, s, u, o) }), yt({ id: "record-label", name: s, template: wt({ dataset: "records", rowKey: e.rowKey, pages: g }) });
119
- }
120
- const J = (e) => e.meta?.labelStudioRole, Ee = (e) => typeof J(e) == "string";
121
- function _e(e) {
122
- const s = { ...e, ...e.meta ? { meta: { ...e.meta } } : {} };
123
- return s.meta && (delete s.meta.labelStudioRole, delete s.meta.labelStudioField, Object.keys(s.meta).length || delete s.meta), s;
124
- }
125
- function xt(e, s) {
126
- for (const n of s.components.filter(Ee)) {
127
- if (e.components.some((u) => J(u) === J(n) && u.meta?.labelStudioField === n.meta?.labelStudioField)) continue;
128
- const o = e.components.find((u) => !Ee(u) && JSON.stringify(_e(u)) === JSON.stringify(_e(n)));
129
- o && (o.meta = { ...o.meta, ...n.meta });
130
- }
131
- }
132
- function Tt(e, s) {
133
- const n = e.kind === "list" ? Number.POSITIVE_INFINITY : e.heightMm, o = s.kind === "list" ? Number.POSITIVE_INFINITY : s.heightMm;
134
- return e.leftMm < s.leftMm + s.widthMm && e.leftMm + e.widthMm > s.leftMm && e.topMm < s.topMm + o && e.topMm + n > s.topMm;
135
- }
136
- function Vt(e, s) {
137
- const n = { ...e, meta: { ...e.meta, ...s.meta } };
138
- return n.kind === "text" && s.kind === "text" && (n.text = s.text, s.binding ? n.binding = structuredClone(s.binding) : delete n.binding), n;
139
- }
140
- function It(e, s, n, o) {
141
- const u = o.has("field-value");
142
- xt(e, s);
143
- const l = new Set(e.components.filter((v) => J(v) === "field-label" || J(v) === "field-value")), a = [...l], f = /* @__PURE__ */ new Map(), y = [];
144
- for (const v of n.components.filter(Ee)) {
145
- const h = J(v);
146
- if (!o.has(String(h))) continue;
147
- const D = h === "field-label" || h === "field-value" ? a.find((k) => J(k) === h && !f.has(k)) : e.components.find((k) => J(k) === h);
148
- D ? f.set(D, Vt(D, v)) : y.push(structuredClone(v));
149
- }
150
- const g = e.components.filter((v) => (!u || !l.has(v) || f.has(v)) && (!o.has("brand-tagline") || J(v) !== "brand-tagline" || n.components.some((h) => J(h) === "brand-tagline"))).map((v) => f.get(v) ?? v);
151
- for (const v of y) {
152
- if (g.some((h) => Tt(h, v))) return !1;
153
- g.push(v);
154
- }
155
- return e.components = g, e.meta = { ...e.meta, labelStudio: n.meta?.labelStudio }, !0;
156
- }
157
- function Ot(e, s, n, o, u, l) {
158
- const a = ge(s, n, o, u), f = ge(s, n, o, l), y = x(e), g = /* @__PURE__ */ new Set();
159
- JSON.stringify(u.fields) !== JSON.stringify(l.fields) && (g.add("field-label"), g.add("field-value")), (u.brand?.name ?? "").trim() !== (l.brand?.name ?? "").trim() && g.add("brand-name"), (u.brand?.tagline ?? "").trim() !== (l.brand?.tagline ?? "").trim() && g.add("brand-tagline");
160
- for (const [v, h] of y.template.pages.entries()) {
161
- const D = a.template.pages[v], k = f.template.pages[v];
162
- if (D && k && !It(h, D, k, g)) return;
163
- }
164
- return y;
165
- }
166
- function $t(e, s) {
167
- const n = e.template.pages, o = s.template.pages;
168
- return n.length !== o.length || n.some((u, l) => u.components.length !== o[l].components.length) ? !0 : n.some((u, l) => {
169
- const a = o[l], f = { ...u, meta: void 0, components: void 0 }, y = { ...a, meta: void 0, components: void 0 };
170
- return JSON.stringify(f) !== JSON.stringify(y) || u.components.some((g, v) => JSON.stringify(_e(g)) !== JSON.stringify(_e(a.components[v])));
171
- });
172
- }
173
- function zt(e, s, n, o, u) {
174
- const l = { ...e, template: ge(s, n, o, u).template }, a = e.template.repeat;
175
- return a?.copies !== void 0 && l.template.repeat && (l.template.repeat.copies = a.copies), l;
176
- }
177
- function A(e) {
178
- const s = e.template.pages[0]?.meta?.labelStudio;
179
- if (!s || typeof s != "object") return;
180
- const n = s, o = ke.find((f) => f.id === n.preset);
181
- if (!o) return;
182
- const u = Array.isArray(n.fields) ? n.fields.filter((f) => typeof f == "string") : void 0;
183
- if (u && u.length > 5) return;
184
- const l = n.brand && typeof n.brand == "object" ? n.brand : {}, a = {};
185
- for (const f of ["name", "tagline", "logoData"])
186
- typeof l[f] == "string" && (a[f] = l[f]);
187
- return { preset: o.id, fields: u, brand: a };
188
- }
189
- function Pe(e, s, n) {
190
- const o = new Set(e.fields.filter((l) => l.field !== s && l.field !== e.rowKey).map((l) => l.field)), u = n?.filter((l) => o.has(l));
191
- return Le(e, s, u).map((l) => l.field);
192
- }
193
- function At(e, s) {
194
- const n = p(() => ({ ...kt, ...e.messages })), o = p(() => e.title ?? n.value.title), u = { preset: e.preset, brand: e.brand, fields: e.fields }, l = Ce(e.modelValue ? x(e.modelValue) : ge(e.schema, o.value, e.identityField, u)), a = Ce(x(l.value)), f = R(!1), y = Ce();
195
- let g, v;
196
- st(() => {
197
- e.modelValue || s(x(l.value));
198
- });
199
- const h = R("preview"), D = R("all"), k = R(1), O = R(!1), oe = R(!1), w = R(), K = _t(() => e.beforeDiscard), U = p(() => oe.value || K.pending.value || f.value && !w.value || w.value?.saving === !0 || w.value?.blocked === !0), L = R(""), ee = p(() => Be(e.schema, e.identityField)), $ = R(A(l.value)?.preset ?? (e.modelValue ? void 0 : e.preset ?? "paired")), j = R(A(l.value)?.brand?.name ?? e.brand?.name ?? ""), T = R(A(l.value)?.brand?.tagline ?? e.brand?.tagline ?? ""), F = R(Pe(e.schema, ee.value, A(l.value)?.fields ?? e.fields)), te = R(""), le = p(() => e.schema.fields.filter((i) => i.field !== ee.value && i.field !== e.schema.rowKey)), ae = p(() => F.value.map((i) => ({ field: i, label: e.schema.fields.find((b) => b.field === i)?.label ?? i }))), re = p(() => {
200
- const i = te.value.trim().toLocaleLowerCase();
201
- return le.value.filter((b) => `${b.label ?? ""} ${b.field}`.toLocaleLowerCase().includes(i)).slice(0, 30);
202
- }), G = p(() => {
203
- const i = l.value.template.pages[0]?.components.find((b) => b.kind === "image" && b.meta?.labelBrandLogo);
204
- return i?.kind === "image" ? i.imageData : e.brand?.logoData;
205
- }), ue = p(() => ({
206
- preset: $.value,
207
- fields: F.value,
208
- brand: { ...e.brand, ...G.value ? { logoData: G.value } : {}, name: j.value, tagline: T.value }
209
- }));
210
- let de = JSON.stringify(A(l.value));
211
- const ce = p(() => {
212
- const i = A(l.value);
213
- if (!i) return !0;
214
- try {
215
- const b = ge(e.schema, o.value, e.identityField, { ...i, brand: { ...i.brand, ...G.value ? { logoData: G.value } : {} } });
216
- return $t(l.value, b);
217
- } catch {
218
- return !0;
219
- }
220
- }), P = R(!1), Q = p(() => $.value !== A(l.value)?.preset), Y = () => JSON.stringify({ preset: $.value, fields: F.value, name: j.value, tagline: T.value }), fe = R(Y()), q = p(() => Y() !== fe.value), me = p(() => Me(l.value)), De = p(() => Me(a.value)), ne = p(() => me.value !== De.value), he = p(() => q.value || ne.value || w.value?.pendingLocalChanges === !0);
221
- function B() {
222
- P.value = !1;
223
- const i = A(l.value);
224
- $.value = i?.preset, F.value = Pe(e.schema, ee.value, i?.fields ?? e.fields), j.value = i?.brand?.name ?? e.brand?.name ?? "", T.value = i?.brand?.tagline ?? e.brand?.tagline ?? "", de = JSON.stringify(i), fe.value = Y();
225
- }
226
- function ie(i) {
227
- const b = A(i), C = JSON.stringify(b);
228
- C !== de && (de = C, B());
229
- }
230
- let V = !1;
231
- qe(() => {
232
- V = !0, v?.abort();
233
- });
234
- const Z = Lt();
235
- gt({ get defaults() {
236
- return { ...e.preview, assets: { ...Z, ...e.preview?.assets, assetRenderers: { ...Z.assetRenderers, ...e.preview?.assets?.assetRenderers } } };
237
- } }), X(w, (i) => {
238
- const b = y.value;
239
- if (!i || !b) return;
240
- const C = l.value;
241
- Me(b) !== me.value && i.applyTemplate?.(C.template), y.value = void 0, g = void 0;
242
- }, { flush: "post" }), X([$, F, j, T], () => {
243
- P.value = !1;
244
- }), X(() => e.modelValue, (i) => {
245
- i && Me(i) !== me.value && (l.value = x(i), a.value = x(i), g = void 0, ie(i));
246
- }), X(() => e.rows, () => {
247
- D.value = "all", k.value = 1;
248
- });
249
- function I(i) {
250
- L.value = "", l.value = i, ie(i), s(i);
251
- }
252
- function m(i, b) {
253
- b && F.value.length < 5 && !F.value.includes(i) ? F.value = [...F.value, i] : b || (F.value = F.value.filter((C) => C !== i));
254
- }
255
- function c(i = !1) {
256
- if (U.value || V) return !1;
257
- if (!$.value)
258
- return L.value = n.value.choosePreset, !1;
259
- if (w.value?.canApply === !1)
260
- return L.value = w.value.saveReason || n.value.applyFirst, !1;
261
- if (Q.value && !i)
262
- return P.value = !0, !1;
263
- try {
264
- const b = A(l.value);
265
- let C;
266
- if (i ? C = zt(l.value, e.schema, o.value, e.identityField, ue.value) : b && (C = Ot(l.value, e.schema, o.value, e.identityField, b, ue.value)), !C)
267
- return L.value = n.value.contentNeedsDesign, !1;
268
- if (w.value?.applyTemplate) {
269
- if (!w.value.applyTemplate(C.template))
270
- return L.value = n.value.saveFailed, !1;
271
- } else
272
- g = x(l.value), I(C);
273
- return P.value = !1, fe.value = Y(), !0;
274
- } catch (b) {
275
- return L.value = b instanceof Error ? b.message : n.value.saveFailed, !1;
276
- }
277
- }
278
- const z = p(() => D.value === "all" ? e.rows : Number.isSafeInteger(k.value) && e.rows[k.value - 1] ? [e.rows[k.value - 1]] : []), ye = p(() => l.value.template.repeat?.dataset ?? "records"), Ue = p(() => ({ [ye.value]: z.value })), je = p(() => ({ [ye.value]: z.value.slice(0, 3) })), Ge = p(() => ({ [ye.value]: e.schema })), Qe = p(() => [{ id: ye.value, label: o.value, rowKey: e.schema.rowKey, fields: e.schema.fields }]), Ye = p(() => l.value.template.pages[0]), Ve = p(() => l.value.template.pages.length), Ze = p(() => {
279
- const i = l.value.template.repeat?.copies ?? 1;
280
- return typeof i == "number" ? i : void 0;
281
- }), We = p(() => {
282
- const i = l.value.template.repeat?.copies;
283
- return typeof i == "object" ? i.field : void 0;
284
- }), Ie = p(() => {
285
- const i = We.value;
286
- if (!i) return;
287
- let b = 0;
288
- for (const C of z.value) {
289
- const E = Object.getOwnPropertyDescriptor(C, i)?.value;
290
- if (typeof E != "number" || !Number.isSafeInteger(E) || E < 1 || E > 1e3) return;
291
- b += E;
292
- }
293
- return b;
294
- }), Xe = p(() => {
295
- const i = Ze.value;
296
- return i !== void 0 ? Number.isSafeInteger(i) && i >= 1 && i <= 1e3 ? z.value.length * i * Ve.value : void 0 : Ie.value === void 0 ? void 0 : Ie.value * Ve.value;
297
- }), we = p(() => Rt(l.value.template)), et = p(() => {
298
- const i = we.value;
299
- return i ? n.value.sheetHint.replace("{columns}", String(i.columns)).replace("{rows}", String(i.rows)).replace("{capacity}", String(i.capacity)) : n.value.sheetUnavailable;
300
- });
301
- X(we, (i) => {
302
- i || (O.value = !1);
303
- });
304
- const tt = p(() => {
305
- const i = St({ labels: Mt({ template: l.value.template, rows: z.value, dataSchema: e.schema }) }), b = O.value ? we.value : void 0;
306
- return async (C) => {
307
- const E = await i(C);
308
- return b ? Ct(E, { ...b, signal: C.signal }) : E;
309
- };
310
- }), Oe = async (i, b) => {
311
- if (V || b.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
312
- const C = x(i), E = x(e.save ? await e.save(C, b) : C);
313
- if (E.id !== i.id) throw new Error(n.value.invalidSavedTemplate);
314
- if (V || b.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
315
- return a.value = x(E), I(E), E;
316
- };
317
- async function $e() {
318
- if (!(U.value || V)) {
319
- if (q.value && Q.value) {
320
- L.value = n.value.applyLayoutFirst;
321
- return;
322
- }
323
- if (!(q.value && !c())) {
324
- oe.value = !0;
325
- try {
326
- if (w.value) {
327
- if (w.value.canApply === !1) {
328
- L.value = w.value.saveReason || n.value.applyFirst;
329
- return;
330
- }
331
- if (w.value.pendingLocalChanges && await w.value.save(), w.value.pendingLocalChanges) {
332
- L.value = n.value.saveFailed;
333
- return;
334
- }
335
- } else ne.value && (v = new AbortController(), await Oe(l.value, { expectedRevision: l.value.revision, signal: v.signal }), g = void 0);
336
- if (!V)
337
- return L.value = "", x(l.value);
338
- } catch (i) {
339
- V || (L.value = i instanceof Error ? i.message : n.value.saveFailed);
340
- } finally {
341
- oe.value = !1, v = void 0;
342
- }
343
- }
344
- }
345
- }
346
- async function lt(i) {
347
- if (!(U.value || i === h.value))
348
- if (i === "design" && !f.value) {
349
- if (q.value && Q.value) {
350
- L.value = n.value.applyLayoutFirst;
351
- return;
352
- }
353
- if (q.value && !c()) return;
354
- y.value = g, f.value = !0, h.value = i;
355
- } else await $e() && (h.value = i);
356
- }
357
- function at(i) {
358
- f.value = !1, h.value = "preview", L.value = `${n.value.designLoadFailed} ${i instanceof Error ? i.message : String(i)}`;
359
- }
360
- let Fe = !1;
361
- const nt = (i) => Fe || K.request(i);
362
- async function it() {
363
- if (U.value) return !1;
364
- const i = w.value?.pendingLocalChanges === !0;
365
- if (!i && !ne.value && !q.value) return !0;
366
- if (!(i && w.value ? await w.value.guardChanges() : await K.request({ reason: "replace", document: x(l.value), pendingLocalChanges: !0 })) || V) return !1;
367
- if (i && w.value) {
368
- Fe = !0;
369
- try {
370
- await w.value.reset();
371
- } finally {
372
- Fe = !1;
373
- }
374
- }
375
- return I(x(a.value)), g = void 0, B(), !0;
376
- }
377
- return { m: n, notice: L, title: o, document: l, mode: h, editorVisited: f, editorInitialDocument: y, failDesignLoad: at, sheetLayout: we, sheetHint: et, rebuilding: P, layoutChanged: Q, record: D, recordIndex: k, sheet: O, busy: U, editor: w, rows: z, datasets: Ue, designDatasets: je, schemas: Ge, bindings: Qe, paper: Ye, labelCount: Xe, fetcher: tt, update: I, save: Oe, navigate: lt, prepare: $e, guardChanges: it, preset: $, presets: ke, brandName: j, brandTagline: T, fields: F, fieldQuery: te, selectedFields: ae, availableFields: re, fieldCount: p(() => le.value.length), configurationDirty: q, pendingLocalChanges: he, custom: ce, toggleField: m, applyConfiguration: c, requestRebuild: () => {
378
- P.value = !0;
379
- }, cancelRebuild: () => {
380
- P.value = !1;
381
- }, restoreConfiguration: B, beforeDiscard: nt, confirmation: K.confirmation, decideDiscard: K.decide };
382
- }
383
- const Jt = ["aria-label"], Pt = { class: "mr-label-context" }, qt = { class: "mr-label-identity" }, Bt = { class: "mr-label-spec" }, Ht = ["disabled"], Kt = ["aria-label"], Ut = ["aria-pressed", "onClick"], jt = { class: "mr-label-fields" }, Gt = {
384
- key: 0,
385
- class: "mr-label-selected-fields"
386
- }, Qt = ["aria-label", "onClick"], Yt = { class: "mr-label-field-search" }, Zt = ["aria-label", "placeholder"], Wt = { class: "mr-label-field-options" }, Xt = ["checked", "disabled", "onChange"], el = { key: 0 }, tl = { key: 1 }, ll = { class: "mr-label-brand" }, al = ["placeholder"], nl = ["disabled"], il = {
387
- key: 1,
388
- class: "mr-label-rebuild",
389
- role: "alert"
390
- }, sl = {
391
- key: 3,
392
- class: "mr-label-reflow-hint"
393
- }, ol = { class: "mr-label-reflow-hint" }, rl = { class: "mr-label-record" }, ul = ["disabled"], dl = { value: "all" }, cl = { value: "single" }, fl = {
394
- key: 0,
395
- class: "mr-label-record-index"
396
- }, ml = ["max", "aria-label", "disabled"], vl = { class: "mr-label-count" }, bl = { class: "mr-label-help" }, pl = { class: "mr-label-main" }, gl = { class: "mr-label-bar" }, hl = ["aria-label"], yl = ["aria-pressed", "disabled"], wl = ["aria-pressed", "disabled"], Sl = {
397
- key: 0,
398
- class: "mr-label-notice",
399
- role: "status"
400
- }, Ml = ["aria-label"], Cl = { class: "mr-label-imposition" }, kl = ["disabled"], _l = {
401
- key: 3,
402
- class: "mr-label-editor"
403
- }, Ll = {
404
- key: 0,
405
- class: "mr-label-editor-loading",
406
- role: "status"
407
- }, xl = /* @__PURE__ */ ot({
408
- __name: "ReportLabelStudio",
409
- props: {
410
- showSave: { type: Boolean, default: !0 },
411
- rows: {},
412
- schema: {},
413
- title: {},
414
- identityField: {},
415
- modelValue: {},
416
- preview: {},
417
- save: {},
418
- beforeDiscard: {},
419
- messages: {},
420
- preset: {},
421
- brand: {},
422
- fields: {}
423
- },
424
- emits: ["update:modelValue"],
425
- setup(e, { expose: s, emit: n }) {
426
- const o = e, u = n, l = At(o, (I) => u("update:modelValue", I)), { m: a, notice: f, title: y, document: g, mode: v, record: h, recordIndex: D, sheet: k, busy: O, editor: oe, rows: w, designDatasets: K, schemas: U, bindings: L, paper: ee, labelCount: $, fetcher: j, preset: T, presets: F, brandName: te, brandTagline: le, fields: ae, fieldQuery: re, selectedFields: G, availableFields: ue, fieldCount: de, configurationDirty: ce, pendingLocalChanges: P, custom: Q, confirmation: Y, editorVisited: fe, editorInitialDocument: q, sheetLayout: me, sheetHint: De, rebuilding: ne, layoutChanged: he } = l, B = Ce();
427
- let ie = !1;
428
- qe(() => {
429
- ie = !0;
430
- }), X(l.editorVisited, async (I) => {
431
- if (!(!I || B.value))
432
- try {
433
- const m = await import("./designer-CIDHt5xz.js").then((c) => c.t);
434
- ie || (B.value = rt(m.default));
435
- } catch (m) {
436
- ie || l.failDesignLoad(m);
437
- }
438
- });
439
- const V = R();
440
- let Z = null;
441
- return X(Y, async (I) => {
442
- I ? (Z = window.document.activeElement, await ut(), V.value?.focus()) : Z?.isConnected && (Z.focus(), Z = null);
443
- }), s({ guardChanges: l.guardChanges, prepare: l.prepare, get busy() {
444
- return O.value;
445
- }, get pendingLocalChanges() {
446
- return P.value;
447
- } }), (I, m) => (S(), M("section", {
448
- class: ze(["mr-label-studio", { "is-design": t(v) === "design" }]),
449
- "aria-label": t(y)
450
- }, [
451
- r("aside", Pt, [
452
- r("div", qt, [
453
- ve(pe, {
454
- name: "file",
455
- size: 18
456
- }),
457
- r("strong", null, d(t(y)), 1),
458
- r("small", null, d(t(Q) ? t(a).customTemplate : t(a).readyTemplate), 1)
459
- ]),
460
- r("div", Bt, [
461
- r("strong", null, [
462
- _(d(t(ee)?.widthMm) + " ", 1),
463
- m[16] || (m[16] = r("i", null, "×", -1)),
464
- _(" " + d(t(ee)?.heightMm), 1)
465
- ]),
466
- r("span", null, "mm · " + d(t(g).template.pages.length) + " " + d(t(a).faces), 1)
467
- ]),
468
- r("fieldset", {
469
- class: "mr-label-quick",
470
- disabled: t(O)
471
- }, [
472
- r("legend", null, d(t(a).layout), 1),
473
- r("div", {
474
- class: "mr-label-presets",
475
- "aria-label": t(a).layout
476
- }, [
477
- (S(!0), M(be, null, Ne(t(F), (c) => (S(), M("button", {
478
- key: c.id,
479
- type: "button",
480
- "aria-pressed": t(T) === c.id,
481
- onClick: (z) => T.value = c.id
482
- }, [
483
- r("span", {
484
- class: ze(["mr-label-preset-art", `is-${c.id}`]),
485
- "aria-hidden": "true"
486
- }, [...m[17] || (m[17] = [
487
- r("i", null, null, -1),
488
- r("i", null, null, -1),
489
- r("i", null, null, -1)
490
- ])], 2),
491
- r("span", null, [
492
- r("strong", null, d(t(a)[`${c.id}Preset`]), 1),
493
- r("small", null, d(c.widthMm) + " × " + d(c.heightMm) + " · " + d(c.faces) + " " + d(t(a).faces), 1)
494
- ])
495
- ], 8, Ut))), 128))
496
- ], 8, Kt),
497
- r("details", jt, [
498
- r("summary", null, [
499
- _(d(t(a).fields) + " ", 1),
500
- r("span", null, d(t(ae).length) + " / 5", 1)
501
- ]),
502
- t(G).length ? (S(), M("div", Gt, [
503
- (S(!0), M(be, null, Ne(t(G), (c) => (S(), M("button", {
504
- key: c.field,
505
- type: "button",
506
- "aria-label": `${t(a).removeField} ${c.label}`,
507
- onClick: (z) => t(l).toggleField(c.field, !1)
508
- }, [
509
- _(d(c.label) + " ", 1),
510
- m[18] || (m[18] = r("span", { "aria-hidden": "true" }, "×", -1))
511
- ], 8, Qt))), 128))
512
- ])) : N("", !0),
513
- r("label", Yt, [
514
- ve(pe, {
515
- name: "search",
516
- size: 13
517
- }),
518
- W(r("input", {
519
- "onUpdate:modelValue": m[0] || (m[0] = (c) => se(re) ? re.value = c : null),
520
- type: "search",
521
- "aria-label": t(a).findField,
522
- placeholder: t(a).findField
523
- }, null, 8, Zt), [
524
- [Se, t(re)]
525
- ])
526
- ]),
527
- r("div", Wt, [
528
- (S(!0), M(be, null, Ne(t(ue), (c) => (S(), M("label", {
529
- key: c.field
530
- }, [
531
- r("input", {
532
- type: "checkbox",
533
- checked: t(ae).includes(c.field),
534
- disabled: !t(ae).includes(c.field) && t(ae).length >= 5,
535
- onChange: (z) => t(l).toggleField(c.field, z.target.checked)
536
- }, null, 40, Xt),
537
- r("span", null, d(c.label ?? c.field), 1)
538
- ]))), 128)),
539
- t(ue).length ? N("", !0) : (S(), M("p", el, d(t(a).noFields), 1))
540
- ]),
541
- r("small", null, d(t(a).fieldLimit), 1),
542
- t(de) > 30 ? (S(), M("small", tl, d(t(a).fieldSearchHint), 1)) : N("", !0)
543
- ]),
544
- r("details", ll, [
545
- r("summary", null, d(t(a).brand), 1),
546
- r("label", null, [
547
- _(d(t(a).brandName), 1),
548
- W(r("input", {
549
- "onUpdate:modelValue": m[1] || (m[1] = (c) => se(te) ? te.value = c : null),
550
- maxlength: "80",
551
- placeholder: t(y)
552
- }, null, 8, al), [
553
- [Se, t(te)]
554
- ])
555
- ]),
556
- r("label", null, [
557
- _(d(t(a).brandTagline), 1),
558
- W(r("input", {
559
- "onUpdate:modelValue": m[2] || (m[2] = (c) => se(le) ? le.value = c : null),
560
- maxlength: "120"
561
- }, null, 512), [
562
- [Se, t(le)]
563
- ])
564
- ])
565
- ]),
566
- r("button", {
567
- class: "mr-label-apply",
568
- type: "button",
569
- disabled: !t(ce) || !t(T),
570
- onClick: m[3] || (m[3] = (c) => t(l).applyConfiguration())
571
- }, [
572
- ve(pe, {
573
- name: "arrow-right",
574
- size: 13
575
- }),
576
- _(d(t(he) ? t(a).applyLayout : t(a).applyContent), 1)
577
- ], 8, nl),
578
- t(Q) && t(T) && !t(ne) ? (S(), M("button", {
579
- key: 0,
580
- class: "mr-label-reset-configuration mr-label-rebuild-current",
581
- type: "button",
582
- onClick: m[4] || (m[4] = //@ts-ignore
583
- (...c) => t(l).requestRebuild && t(l).requestRebuild(...c))
584
- }, d(t(a).rebuildCurrent), 1)) : N("", !0),
585
- t(ne) ? (S(), M("div", il, [
586
- r("strong", null, d(t(a).rebuildTitle), 1),
587
- r("p", null, d(t(a).rebuildDescription), 1),
588
- r("div", null, [
589
- r("button", {
590
- type: "button",
591
- onClick: m[5] || (m[5] = //@ts-ignore
592
- (...c) => t(l).cancelRebuild && t(l).cancelRebuild(...c))
593
- }, d(t(a).cancelRebuild), 1),
594
- r("button", {
595
- type: "button",
596
- onClick: m[6] || (m[6] = (c) => t(l).applyConfiguration(!0))
597
- }, d(t(a).confirmRebuild), 1)
598
- ])
599
- ])) : N("", !0),
600
- t(ce) ? (S(), M("button", {
601
- key: 2,
602
- class: "mr-label-reset-configuration",
603
- type: "button",
604
- onClick: m[7] || (m[7] = //@ts-ignore
605
- (...c) => t(l).restoreConfiguration && t(l).restoreConfiguration(...c))
606
- }, d(t(a).restoreConfiguration), 1)) : N("", !0),
607
- t(ce) && !t(T) ? (S(), M("p", sl, d(t(a).choosePreset), 1)) : N("", !0),
608
- r("p", ol, d(t(he) ? t(a).reflowHint : t(a).contentHint), 1)
609
- ], 8, Ht),
610
- r("label", rl, [
611
- _(d(t(a).records), 1),
612
- W(r("select", {
613
- "onUpdate:modelValue": m[8] || (m[8] = (c) => se(h) ? h.value = c : null),
614
- disabled: t(O) || !o.rows.length
615
- }, [
616
- r("option", dl, d(t(a).all) + " · " + d(o.rows.length), 1),
617
- r("option", cl, d(t(a).single), 1)
618
- ], 8, ul), [
619
- [dt, t(h)]
620
- ])
621
- ]),
622
- t(h) === "single" ? (S(), M("label", fl, [
623
- _(d(t(a).record), 1),
624
- W(r("input", {
625
- "onUpdate:modelValue": m[9] || (m[9] = (c) => se(D) ? D.value = c : null),
626
- type: "number",
627
- min: "1",
628
- max: o.rows.length,
629
- "aria-label": t(a).record,
630
- disabled: t(O)
631
- }, null, 8, ml), [
632
- [
633
- Se,
634
- t(D),
635
- void 0,
636
- { number: !0 }
637
- ]
638
- ]),
639
- _(" / " + d(o.rows.length), 1)
640
- ])) : N("", !0),
641
- r("p", vl, [
642
- r("strong", null, d(t(w).length), 1),
643
- _(" " + d(t(a).count) + " ", 1),
644
- m[19] || (m[19] = r("span", null, "→", -1)),
645
- m[20] || (m[20] = _()),
646
- t($) !== void 0 ? (S(), M(be, { key: 0 }, [
647
- r("strong", null, d(t($)), 1),
648
- _(" " + d(t(a).labels), 1)
649
- ], 64)) : (S(), M(be, { key: 1 }, [
650
- _(d(t(a).invalidCopies), 1)
651
- ], 64))
652
- ]),
653
- r("details", bl, [
654
- r("summary", null, d(t(a).guide), 1),
655
- r("p", null, d(t(a).help), 1),
656
- r("p", null, d(t(a).printHint), 1)
657
- ])
658
- ]),
659
- r("div", pl, [
660
- r("header", gl, [
661
- r("nav", { "aria-label": t(y) }, [
662
- r("button", {
663
- type: "button",
664
- "aria-pressed": t(v) === "preview",
665
- disabled: t(O),
666
- onClick: m[10] || (m[10] = (c) => t(l).navigate("preview"))
667
- }, [
668
- ve(pe, {
669
- name: "file",
670
- size: 14
671
- }),
672
- _(d(t(a).preview), 1)
673
- ], 8, yl),
674
- r("button", {
675
- type: "button",
676
- "aria-pressed": t(v) === "design",
677
- disabled: t(O),
678
- onClick: m[11] || (m[11] = (c) => t(l).navigate("design"))
679
- }, [
680
- ve(pe, {
681
- name: "settings",
682
- size: 14
683
- }),
684
- _(d(t(a).design), 1)
685
- ], 8, wl)
686
- ], 8, hl),
687
- r("span", null, d(t(v) === "design" ? t(a).designHint : t(a).flow), 1)
688
- ]),
689
- t(f) ? (S(), M("p", Sl, d(t(f)), 1)) : N("", !0),
690
- t(Y) ? (S(), M("div", {
691
- key: 1,
692
- class: "mr-label-confirm",
693
- role: "alertdialog",
694
- "aria-label": t(a).discardTitle,
695
- onKeydown: m[14] || (m[14] = ct(ft((c) => t(l).decideDiscard(!1), ["prevent", "stop"]), ["esc"]))
696
- }, [
697
- r("div", null, [
698
- r("strong", null, d(t(a).discardTitle), 1),
699
- r("p", null, d(t(a).discardDescription), 1)
700
- ]),
701
- r("button", {
702
- ref_key: "keepEditingButton",
703
- ref: V,
704
- type: "button",
705
- onClick: m[12] || (m[12] = (c) => t(l).decideDiscard(!1))
706
- }, d(t(a).keepEditing), 513),
707
- r("button", {
708
- type: "button",
709
- onClick: m[13] || (m[13] = (c) => t(l).decideDiscard(!0))
710
- }, d(t(a).discard), 1)
711
- ], 40, Ml)) : N("", !0),
712
- t(v) === "preview" ? (S(), Ae(t(ht), {
713
- key: 2,
714
- "report-id": "labels",
715
- fetcher: t(j),
716
- "show-params": !1,
717
- height: "100%",
718
- toolbar: { exportFormats: ["pdf", "png", "html"], editing: !1, excelImport: !1 },
719
- messages: { title: t(y), empty: t(a).empty }
720
- }, {
721
- settings: mt(() => [
722
- r("label", Cl, [
723
- W(r("input", {
724
- "onUpdate:modelValue": m[15] || (m[15] = (c) => se(k) ? k.value = c : null),
725
- type: "checkbox",
726
- disabled: !t(me)
727
- }, null, 8, kl), [
728
- [vt, t(k)]
729
- ]),
730
- _(d(t(a).sheet), 1),
731
- r("small", null, d(t(De)), 1)
732
- ])
733
- ]),
734
- _: 1
735
- }, 8, ["fetcher", "messages"])) : N("", !0),
736
- t(fe) ? W((S(), M("div", _l, [
737
- B.value ? N("", !0) : (S(), M("p", Ll, d(t(a).designLoading), 1)),
738
- B.value ? (S(), Ae(bt(B.value), {
739
- key: 1,
740
- ref_key: "editor",
741
- ref: oe,
742
- "model-value": t(q) ?? t(g),
743
- mode: "design",
744
- "show-mode-switch": !1,
745
- "show-save": e.showSave,
746
- capabilities: { params: !1 },
747
- datasets: t(K),
748
- "data-schemas": t(U),
749
- "binding-datasets": t(L),
750
- save: t(l).save,
751
- "before-discard": t(l).beforeDiscard,
752
- preview: e.preview,
753
- "onUpdate:modelValue": t(l).update
754
- }, null, 8, ["model-value", "show-save", "datasets", "data-schemas", "binding-datasets", "save", "before-discard", "preview", "onUpdate:modelValue"])) : N("", !0)
755
- ], 512)), [
756
- [pt, t(v) === "design"]
757
- ]) : N("", !0)
758
- ])
759
- ], 10, Jt));
760
- }
761
- });
762
- export {
763
- xl as default
764
- };