@cluadwong/form-designer 0.2.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 (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/dist/chunks/designer-ui.js +3092 -0
  4. package/dist/chunks/renderer-core.js +2635 -0
  5. package/dist/components/designer/CanvasSurface.vue.d.ts +64 -0
  6. package/dist/components/designer/CanvasSurface.vue.d.ts.map +1 -0
  7. package/dist/components/designer/DesignerToolbar.vue.d.ts +49 -0
  8. package/dist/components/designer/DesignerToolbar.vue.d.ts.map +1 -0
  9. package/dist/components/designer/FormDesigner.vue.d.ts +25 -0
  10. package/dist/components/designer/FormDesigner.vue.d.ts.map +1 -0
  11. package/dist/components/designer/HelpPanel.vue.d.ts +10 -0
  12. package/dist/components/designer/HelpPanel.vue.d.ts.map +1 -0
  13. package/dist/components/designer/InspectorPanel.vue.d.ts +48 -0
  14. package/dist/components/designer/InspectorPanel.vue.d.ts.map +1 -0
  15. package/dist/components/designer/NodeTreeItem.vue.d.ts +18 -0
  16. package/dist/components/designer/NodeTreeItem.vue.d.ts.map +1 -0
  17. package/dist/components/designer/PaletteSidebar.vue.d.ts +29 -0
  18. package/dist/components/designer/PaletteSidebar.vue.d.ts.map +1 -0
  19. package/dist/components/designer/StatusBar.vue.d.ts +25 -0
  20. package/dist/components/designer/StatusBar.vue.d.ts.map +1 -0
  21. package/dist/components/designer/composables/treeControl.d.ts +65 -0
  22. package/dist/components/designer/composables/treeControl.d.ts.map +1 -0
  23. package/dist/components/designer/composables/useFillData.d.ts +34 -0
  24. package/dist/components/designer/composables/useFillData.d.ts.map +1 -0
  25. package/dist/components/designer/composables/useNodeSelection.d.ts +56 -0
  26. package/dist/components/designer/composables/useNodeSelection.d.ts.map +1 -0
  27. package/dist/components/designer/composables/useSchemaDocument.d.ts +44 -0
  28. package/dist/components/designer/composables/useSchemaDocument.d.ts.map +1 -0
  29. package/dist/components/designer/composables/useSchemaEdits.d.ts +111 -0
  30. package/dist/components/designer/composables/useSchemaEdits.d.ts.map +1 -0
  31. package/dist/components/designer/config.d.ts +40 -0
  32. package/dist/components/designer/config.d.ts.map +1 -0
  33. package/dist/components/designer/export-api.d.ts +81 -0
  34. package/dist/components/designer/export-api.d.ts.map +1 -0
  35. package/dist/components/designer/inspectors/CellInspector.vue.d.ts +20 -0
  36. package/dist/components/designer/inspectors/CellInspector.vue.d.ts.map +1 -0
  37. package/dist/components/designer/inspectors/FieldPInspector.vue.d.ts +10 -0
  38. package/dist/components/designer/inspectors/FieldPInspector.vue.d.ts.map +1 -0
  39. package/dist/components/designer/inspectors/GridInspector.vue.d.ts +10 -0
  40. package/dist/components/designer/inspectors/GridInspector.vue.d.ts.map +1 -0
  41. package/dist/components/designer/inspectors/HeaderFooterFields.vue.d.ts +14 -0
  42. package/dist/components/designer/inspectors/HeaderFooterFields.vue.d.ts.map +1 -0
  43. package/dist/components/designer/inspectors/HtmlInspector.vue.d.ts +10 -0
  44. package/dist/components/designer/inspectors/HtmlInspector.vue.d.ts.map +1 -0
  45. package/dist/components/designer/inspectors/ImageInspector.vue.d.ts +10 -0
  46. package/dist/components/designer/inspectors/ImageInspector.vue.d.ts.map +1 -0
  47. package/dist/components/designer/inspectors/IssuesPanel.vue.d.ts +11 -0
  48. package/dist/components/designer/inspectors/IssuesPanel.vue.d.ts.map +1 -0
  49. package/dist/components/designer/inspectors/PageInspector.vue.d.ts +27 -0
  50. package/dist/components/designer/inspectors/PageInspector.vue.d.ts.map +1 -0
  51. package/dist/components/designer/inspectors/TableInspector.vue.d.ts +10 -0
  52. package/dist/components/designer/inspectors/TableInspector.vue.d.ts.map +1 -0
  53. package/dist/components/designer/inspectors/TextInspector.vue.d.ts +10 -0
  54. package/dist/components/designer/inspectors/TextInspector.vue.d.ts.map +1 -0
  55. package/dist/components/designer/inspectors/TextStyleFields.vue.d.ts +10 -0
  56. package/dist/components/designer/inspectors/TextStyleFields.vue.d.ts.map +1 -0
  57. package/dist/components/renderer-v2/FormRenderer.vue.d.ts +106 -0
  58. package/dist/components/renderer-v2/FormRenderer.vue.d.ts.map +1 -0
  59. package/dist/components/renderer-v2/GridFormRenderer.vue.d.ts +49 -0
  60. package/dist/components/renderer-v2/GridFormRenderer.vue.d.ts.map +1 -0
  61. package/dist/components/renderer-v2/GridSchemaNode.vue.d.ts +46 -0
  62. package/dist/components/renderer-v2/GridSchemaNode.vue.d.ts.map +1 -0
  63. package/dist/components/renderer-v2/HtmlBlock.vue.d.ts +16 -0
  64. package/dist/components/renderer-v2/HtmlBlock.vue.d.ts.map +1 -0
  65. package/dist/components/renderer-v2/PaperViewport.vue.d.ts +63 -0
  66. package/dist/components/renderer-v2/PaperViewport.vue.d.ts.map +1 -0
  67. package/dist/components/renderer-v2/collectFieldValues.d.ts +29 -0
  68. package/dist/components/renderer-v2/collectFieldValues.d.ts.map +1 -0
  69. package/dist/components/renderer-v2/index.d.ts +13 -0
  70. package/dist/components/renderer-v2/index.d.ts.map +1 -0
  71. package/dist/components/renderer-v2/measure-rows.d.ts +12 -0
  72. package/dist/components/renderer-v2/measure-rows.d.ts.map +1 -0
  73. package/dist/components/renderer-v2/page-size-style.d.ts +28 -0
  74. package/dist/components/renderer-v2/page-size-style.d.ts.map +1 -0
  75. package/dist/components/renderer-v2/print-form.d.ts +20 -0
  76. package/dist/components/renderer-v2/print-form.d.ts.map +1 -0
  77. package/dist/designer-ui.css +5 -0
  78. package/dist/designer.d.ts +16 -0
  79. package/dist/designer.d.ts.map +1 -0
  80. package/dist/designer.js +16 -0
  81. package/dist/engine-v2/derivation.d.ts +81 -0
  82. package/dist/engine-v2/derivation.d.ts.map +1 -0
  83. package/dist/engine-v2/index.d.ts +3 -0
  84. package/dist/engine-v2/index.d.ts.map +1 -0
  85. package/dist/engine-v2/node-address.d.ts +25 -0
  86. package/dist/engine-v2/node-address.d.ts.map +1 -0
  87. package/dist/engine-v2/pagination.d.ts +120 -0
  88. package/dist/engine-v2/pagination.d.ts.map +1 -0
  89. package/dist/i18n/en.d.ts +7 -0
  90. package/dist/i18n/en.d.ts.map +1 -0
  91. package/dist/i18n/index.d.ts +14 -0
  92. package/dist/i18n/index.d.ts.map +1 -0
  93. package/dist/i18n/types.d.ts +5 -0
  94. package/dist/i18n/types.d.ts.map +1 -0
  95. package/dist/i18n/zh-CN.d.ts +7 -0
  96. package/dist/i18n/zh-CN.d.ts.map +1 -0
  97. package/dist/index.d.ts +9 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +107 -0
  100. package/dist/renderer-core.css +1 -0
  101. package/dist/renderer.d.ts +22 -0
  102. package/dist/renderer.d.ts.map +1 -0
  103. package/dist/renderer.js +93 -0
  104. package/dist/samples/types.d.ts +18 -0
  105. package/dist/samples/types.d.ts.map +1 -0
  106. package/dist/ticket-designer.css +5 -0
  107. package/dist/types/index.d.ts +8 -0
  108. package/dist/types/index.d.ts.map +1 -0
  109. package/dist/types/schema-v2-index.d.ts +15 -0
  110. package/dist/types/schema-v2-index.d.ts.map +1 -0
  111. package/dist/types/schema-v2-operations.d.ts +124 -0
  112. package/dist/types/schema-v2-operations.d.ts.map +1 -0
  113. package/dist/types/schema-v2-serialization.d.ts +30 -0
  114. package/dist/types/schema-v2-serialization.d.ts.map +1 -0
  115. package/dist/types/schema-v2-table-rows.d.ts +17 -0
  116. package/dist/types/schema-v2-table-rows.d.ts.map +1 -0
  117. package/dist/types/schema-v2-validation.d.ts +10 -0
  118. package/dist/types/schema-v2-validation.d.ts.map +1 -0
  119. package/dist/types/schema-v2.d.ts +283 -0
  120. package/dist/types/schema-v2.d.ts.map +1 -0
  121. package/dist/utils/date-format.d.ts +34 -0
  122. package/dist/utils/date-format.d.ts.map +1 -0
  123. package/package.json +96 -0
@@ -0,0 +1,3092 @@
1
+ import { defineComponent as X, ref as G, watch as ve, onMounted as Zt, onUnmounted as tt, computed as P, openBlock as $, createElementBlock as I, normalizeClass as me, createVNode as le, normalizeStyle as Pe, createCommentVNode as K, nextTick as Ke, createElementVNode as l, createTextVNode as ge, toDisplayString as D, Fragment as _, renderList as ye, inject as Sl, resolveComponent as $l, withModifiers as Qt, createBlock as oe, unref as x, useModel as _t, withDirectives as Cl, vModelCheckbox as wl, mergeModels as qe, createStaticVNode as Il, reactive as xl, provide as Tl, withCtx as kl } from "vue";
2
+ import { L as he, N as $e, G as Fl, b as Xe, a as Ye, P as Ze, _ as ie, c as Dl, p as Qe, s as el, t as Nl, r as Pl, i as ke, D as El, d as Al, e as _e, f as tl, u as Hl, g as Rl, h as Ll, j as Ml, k as Bl, l as Wt, m as Vl, n as Gl, o as zl, q as Ol, v as Wl, w as Ul, x as jl, y as Yl, z as be, A as Ut, B as Jl, C as Kl, E as Fe, F as ql, H as Xl, I as Zl, J as Ql, K as _l, M as ea, O as ta, Q as la, R as aa, S as na, T as oa, U as ia } from "./renderer-core.js";
3
+ const da = /* @__PURE__ */ X({
4
+ __name: "CanvasSurface",
5
+ props: {
6
+ schema: {},
7
+ mode: {},
8
+ data: {},
9
+ readonly: { type: Boolean },
10
+ selectedNodeId: {},
11
+ bare: { type: Boolean },
12
+ paginate: { type: Boolean, default: !0 }
13
+ },
14
+ emits: ["node-drag-start", "field-change", "drop-node", "drop-palette", "drag-end"],
15
+ setup(e, { emit: u }) {
16
+ const t = e, a = u, n = G(null);
17
+ let r = null;
18
+ function b() {
19
+ const c = n.value;
20
+ if (!c) return;
21
+ const h = t.selectedNodeId ? c.querySelector(`[${$e}="${t.selectedNodeId}"]`) : null;
22
+ c.querySelectorAll(".is-design-selected").forEach((m) => {
23
+ m !== h && m.classList.remove("is-design-selected");
24
+ }), h && h.classList.add("is-design-selected");
25
+ }
26
+ function s() {
27
+ const c = n.value;
28
+ if (!c) return;
29
+ const h = U.value;
30
+ c.querySelectorAll("[data-node-id]:not(.layout-grid__cell)").forEach((m) => {
31
+ h ? m.setAttribute("draggable", "true") : m.removeAttribute("draggable");
32
+ });
33
+ }
34
+ function f() {
35
+ r == null || r.disconnect(), Ke(() => {
36
+ b(), s(), n.value && (r == null || r.observe(n.value, { childList: !0, subtree: !0 }));
37
+ });
38
+ }
39
+ ve(
40
+ () => [
41
+ t.selectedNodeId,
42
+ t.schema,
43
+ t.data,
44
+ t.mode,
45
+ t.readonly
46
+ ],
47
+ f,
48
+ { deep: !0, immediate: !0 }
49
+ ), Zt(() => {
50
+ r = new MutationObserver(f), f();
51
+ }), tt(() => r == null ? void 0 : r.disconnect());
52
+ const v = P(() => ({
53
+ "v2-canvas-surface--preview": t.mode !== "design"
54
+ })), p = G(null), g = G(-1), L = P(() => {
55
+ const c = p.value, h = g.value, m = n.value;
56
+ if (!c || h < 0 || !m) return null;
57
+ const S = m.querySelector(`[${he}="${c}"]`);
58
+ if (!S) return null;
59
+ const F = m.getBoundingClientRect(), E = Array.from(S.children).filter(
60
+ (O) => O instanceof HTMLElement && O.hasAttribute($e)
61
+ );
62
+ if (h < E.length) {
63
+ const O = E[h].getBoundingClientRect();
64
+ return {
65
+ position: "absolute",
66
+ top: `${O.top - F.top}px`,
67
+ left: `${O.left - F.left}px`,
68
+ width: `${O.width}px`
69
+ };
70
+ }
71
+ const N = E[E.length - 1];
72
+ if (N) {
73
+ const O = N.getBoundingClientRect();
74
+ return {
75
+ position: "absolute",
76
+ top: `${O.bottom - F.top}px`,
77
+ left: `${O.left - F.left}px`,
78
+ width: `${O.width}px`
79
+ };
80
+ }
81
+ const z = S.getBoundingClientRect();
82
+ return {
83
+ position: "absolute",
84
+ top: `${z.top - F.top}px`,
85
+ left: `${z.left - F.left}px`,
86
+ width: `${z.width}px`
87
+ };
88
+ }), A = G(/* @__PURE__ */ new Set());
89
+ let H = null;
90
+ const U = P(
91
+ () => t.mode === "design"
92
+ );
93
+ function q(c) {
94
+ H && H !== c && H.classList.remove("v2-drop-target"), c && c !== H && c.classList.add("v2-drop-target"), H = c;
95
+ }
96
+ function j() {
97
+ H && (H.classList.remove("v2-drop-target"), H = null);
98
+ }
99
+ function te(c, h) {
100
+ const m = Array.from(c.children).filter(
101
+ (S) => S instanceof HTMLElement && S.hasAttribute($e)
102
+ );
103
+ for (let S = 0; S < m.length; S += 1) {
104
+ const F = m[S].getBoundingClientRect();
105
+ if (h < F.top + F.height / 2) return S;
106
+ }
107
+ return m.length;
108
+ }
109
+ function ee(c) {
110
+ const h = Xe(t.schema), m = [], S = (F) => {
111
+ var N, z;
112
+ let E = F;
113
+ for (; E; ) {
114
+ if (E === c) return !0;
115
+ E = (z = (N = h.get(E)) == null ? void 0 : N.parent) == null ? void 0 : z.id;
116
+ }
117
+ return !1;
118
+ };
119
+ t.schema.pages.forEach((F) => {
120
+ const E = (N) => {
121
+ N.forEach((z) => {
122
+ z.type === "grid" ? z.rows.forEach(
123
+ (O) => O.cells.forEach((ce) => {
124
+ S(ce.id) || m.push(ce.id), E(ce.children);
125
+ })
126
+ ) : z.type === "table" && z.rowTemplate.forEach((O) => {
127
+ S(O.id) || m.push(O.id);
128
+ });
129
+ });
130
+ };
131
+ E(F.children);
132
+ }), A.value = new Set(m), a("node-drag-start", c);
133
+ }
134
+ function k(c) {
135
+ var O;
136
+ if (!U.value) return;
137
+ const h = c.target, m = (h == null ? void 0 : h.closest("[data-node-id]")) ?? null;
138
+ if (!m) return;
139
+ const S = m.closest(".layout-table");
140
+ if (S && S !== m) {
141
+ c.preventDefault();
142
+ return;
143
+ }
144
+ const F = m.getAttribute("data-node-id") ?? "";
145
+ if (!F) return;
146
+ const E = (O = Xe(t.schema).get(F)) == null ? void 0 : O.node, N = E || void 0;
147
+ if (N && N.type === "p" && t.mode === "design" && N.mode === "field" && !N.prefix && !N.suffix && !c.altKey) {
148
+ c.preventDefault();
149
+ return;
150
+ }
151
+ const z = c.dataTransfer;
152
+ z && (z.setData(Ye, F), z.setData("text/plain", F), z.effectAllowed = "move", ee(F));
153
+ }
154
+ function Y(c) {
155
+ if (!U.value) return;
156
+ const h = c.dataTransfer;
157
+ if (!h) return;
158
+ const m = Array.from(h.types).includes(Ze), S = Array.from(h.types).includes(Ye);
159
+ if (!m && !S) return;
160
+ if (m) {
161
+ c.preventDefault();
162
+ const N = c.target.closest(
163
+ `[${he}]`
164
+ );
165
+ q(N ?? null), p.value = null, g.value = -1;
166
+ return;
167
+ }
168
+ q(null);
169
+ const F = c.target.closest(
170
+ `[${he}]`
171
+ ), E = (F == null ? void 0 : F.dataset.layoutId) ?? null;
172
+ F && E && A.value.has(E) ? (c.preventDefault(), p.value = E, g.value = te(F, c.clientY)) : (p.value = null, g.value = -1);
173
+ }
174
+ function J(c) {
175
+ const h = c.relatedTarget;
176
+ (!h || !h.closest(`[${he}]`)) && (j(), p.value = null, g.value = -1);
177
+ }
178
+ function Z() {
179
+ p.value = null, g.value = -1, A.value = /* @__PURE__ */ new Set(), j();
180
+ }
181
+ function w(c) {
182
+ if (!U.value) return;
183
+ const h = c.dataTransfer;
184
+ if (!h) return;
185
+ j(), c.preventDefault();
186
+ const m = h.getData(Ze) ?? "";
187
+ if (m) {
188
+ const N = c.target.closest(
189
+ `[${he}]`
190
+ ), z = (N == null ? void 0 : N.dataset.layoutId) ?? null;
191
+ if (Z(), !z) return;
192
+ a("drop-palette", { kind: m, cellId: z });
193
+ return;
194
+ }
195
+ const S = h.getData(Ye) ?? "", F = p.value, E = g.value;
196
+ Z(), !(!S || !F || E < 0) && a("drop-node", { moveId: S, cellId: F, index: E });
197
+ }
198
+ function y() {
199
+ Z(), a("drag-end");
200
+ }
201
+ return (c, h) => ($(), I("div", {
202
+ ref_key: "root",
203
+ ref: n,
204
+ class: me(["v2-canvas-surface", v.value]),
205
+ onDragover: Y,
206
+ onDragleave: J,
207
+ onDrop: w,
208
+ onDragend: y,
209
+ onDragstart: k
210
+ }, [
211
+ le(Fl, {
212
+ schema: e.schema,
213
+ mode: e.mode,
214
+ data: e.data,
215
+ readonly: e.readonly,
216
+ bare: e.bare,
217
+ paginate: e.paginate,
218
+ onFieldChange: h[0] || (h[0] = (m, S) => a("field-change", m, S))
219
+ }, null, 8, ["schema", "mode", "data", "readonly", "bare", "paginate"]),
220
+ L.value ? ($(), I("div", {
221
+ key: 0,
222
+ class: "v2-insertion-line",
223
+ style: Pe(L.value)
224
+ }, null, 4)) : K("", !0)
225
+ ], 34));
226
+ }
227
+ }), ua = /* @__PURE__ */ ie(da, [["__scopeId", "data-v-deb3136c"]]), ra = 2, sa = "ticket-schema-v2", va = "ticket-fill-data";
228
+ function et(e, u = {}) {
229
+ return e ? Dl(e, u) : {};
230
+ }
231
+ function ca(e, u = !0) {
232
+ return el(e, u);
233
+ }
234
+ function jt(e, u = !0) {
235
+ return u ? JSON.stringify(e, null, ra) : JSON.stringify(e);
236
+ }
237
+ function ll(e, u = Date.now()) {
238
+ return `${e}-${u}.json`;
239
+ }
240
+ function al(e, u) {
241
+ if (typeof document > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function")
242
+ return;
243
+ const t = new Blob([u], { type: "application/json" }), a = URL.createObjectURL(t), n = document.createElement("a");
244
+ n.href = a, n.download = e, n.click(), URL.revokeObjectURL(a);
245
+ }
246
+ function pa(e) {
247
+ return typeof e == "string" ? Qe(e) : JSON.parse(JSON.stringify(e));
248
+ }
249
+ const fa = { class: "status-bar" }, ga = { class: "status-group" }, ma = { class: "status-item" }, ba = {
250
+ key: 0,
251
+ class: "status-item",
252
+ "data-physical-page-count": "true"
253
+ }, ha = {
254
+ key: 1,
255
+ class: "status-item warning-count has-warning",
256
+ "data-paginate-warning-count": "true"
257
+ }, ya = /* @__PURE__ */ X({
258
+ __name: "StatusBar",
259
+ props: {
260
+ pageCount: {},
261
+ warningCount: {},
262
+ physicalPageCount: {},
263
+ paginateWarningCount: {}
264
+ },
265
+ setup(e) {
266
+ return (u, t) => ($(), I("div", fa, [
267
+ l("div", ga, [
268
+ l("span", ma, [
269
+ t[0] || (t[0] = ge(" 页数:", -1)),
270
+ l("strong", null, D(e.pageCount), 1)
271
+ ]),
272
+ e.physicalPageCount != null && e.physicalPageCount !== e.pageCount ? ($(), I("span", ba, [
273
+ t[1] || (t[1] = ge(" 打印:", -1)),
274
+ l("strong", null, D(e.physicalPageCount), 1),
275
+ t[2] || (t[2] = ge(" 张 ", -1))
276
+ ])) : K("", !0),
277
+ l("span", {
278
+ class: me(["status-item", "warning-count", { "has-warning": e.warningCount > 0 }])
279
+ }, [
280
+ t[3] || (t[3] = ge(" 待处理问题:", -1)),
281
+ l("strong", null, D(e.warningCount), 1)
282
+ ], 2),
283
+ e.paginateWarningCount ? ($(), I("span", ha, [
284
+ t[4] || (t[4] = ge(" 内容超高:", -1)),
285
+ l("strong", null, D(e.paginateWarningCount), 1)
286
+ ])) : K("", !0)
287
+ ]),
288
+ t[5] || (t[5] = l("div", { class: "status-group status-right" }, [
289
+ l("span", { class: "status-item muted" }, "缩放:100%(阶段 5 完善)")
290
+ ], -1))
291
+ ]));
292
+ }
293
+ }), Sa = /* @__PURE__ */ ie(ya, [["__scopeId", "data-v-e5a749ea"]]), $a = {
294
+ showNewBlank: !0,
295
+ showSamples: !0,
296
+ showUndoRedo: !0,
297
+ showTemplateModule: !0,
298
+ showFillDataModule: !0,
299
+ showPreviewPrint: !0,
300
+ showHelp: !0,
301
+ locale: "zh-CN"
302
+ };
303
+ function Ca(e) {
304
+ return { ...$a, ...e ?? {} };
305
+ }
306
+ const wa = { class: "v2-toolbar" }, Ia = {
307
+ key: 0,
308
+ class: "v2-toolbar__group"
309
+ }, xa = ["onClick"], Ta = {
310
+ key: 1,
311
+ class: "v2-toolbar__group"
312
+ }, ka = ["disabled"], Fa = ["disabled"], Da = {
313
+ key: 2,
314
+ class: "v2-toolbar__group"
315
+ }, Na = { class: "v2-toolbar__label" }, Pa = {
316
+ key: 3,
317
+ class: "v2-toolbar__group"
318
+ }, Ea = { class: "v2-toolbar__label" }, Aa = ["title"], Ha = ["title"], Ra = ["title"], La = ["title"], Ma = {
319
+ key: 4,
320
+ class: "v2-toolbar__group"
321
+ }, Ba = ["title"], Va = ["title"], Ga = /* @__PURE__ */ X({
322
+ __name: "DesignerToolbar",
323
+ props: {
324
+ samples: {},
325
+ dirty: { type: Boolean },
326
+ canUndo: { type: Boolean },
327
+ canRedo: { type: Boolean },
328
+ previewMode: { type: Boolean },
329
+ uiConfig: {}
330
+ },
331
+ emits: ["reset-blank", "load-sample", "undo", "redo", "save-template", "load-template", "export-template", "import-template", "import-fill-data", "export-fill-data", "load-fill-data", "save-fill-data", "toggle-preview", "print", "help"],
332
+ setup(e, { emit: u }) {
333
+ const t = e, a = P(() => Ca(t.uiConfig));
334
+ function n(b) {
335
+ return Nl(b, void 0, a.value.locale);
336
+ }
337
+ const r = u;
338
+ return (b, s) => ($(), I("header", wa, [
339
+ l("span", {
340
+ class: me(["v2-toolbar__dirty", { "v2-toolbar__dirty--on": e.dirty }])
341
+ }, D(e.dirty ? n("toolbar.dirty") : n("toolbar.saved")), 3),
342
+ a.value.showNewBlank || a.value.showSamples ? ($(), I("div", Ia, [
343
+ a.value.showNewBlank ? ($(), I("button", {
344
+ key: 0,
345
+ class: "v2-toolbar__button",
346
+ type: "button",
347
+ onClick: s[0] || (s[0] = (f) => r("reset-blank"))
348
+ }, D(n("toolbar.newBlank")), 1)) : K("", !0),
349
+ a.value.showSamples ? ($(!0), I(_, { key: 1 }, ye(e.samples, (f) => ($(), I("button", {
350
+ key: f.id,
351
+ class: "v2-toolbar__button",
352
+ type: "button",
353
+ onClick: (v) => r("load-sample", f)
354
+ }, D(n("toolbar.loadSamplePrefix")) + D(f.label), 9, xa))), 128)) : K("", !0)
355
+ ])) : K("", !0),
356
+ a.value.showUndoRedo ? ($(), I("div", Ta, [
357
+ l("button", {
358
+ class: "v2-toolbar__button",
359
+ type: "button",
360
+ disabled: !e.canUndo,
361
+ onClick: s[1] || (s[1] = (f) => r("undo"))
362
+ }, D(n("toolbar.undo")), 9, ka),
363
+ l("button", {
364
+ class: "v2-toolbar__button",
365
+ type: "button",
366
+ disabled: !e.canRedo,
367
+ onClick: s[2] || (s[2] = (f) => r("redo"))
368
+ }, D(n("toolbar.redo")), 9, Fa)
369
+ ])) : K("", !0),
370
+ a.value.showTemplateModule ? ($(), I("div", Da, [
371
+ l("span", Na, D(n("toolbar.module.template")), 1),
372
+ l("button", {
373
+ class: "v2-toolbar__button",
374
+ type: "button",
375
+ onClick: s[3] || (s[3] = (f) => r("save-template"))
376
+ }, D(n("toolbar.saveTemplate")), 1),
377
+ l("button", {
378
+ class: "v2-toolbar__button",
379
+ type: "button",
380
+ onClick: s[4] || (s[4] = (f) => r("load-template"))
381
+ }, D(n("toolbar.loadTemplate")), 1),
382
+ l("button", {
383
+ class: "v2-toolbar__button",
384
+ type: "button",
385
+ onClick: s[5] || (s[5] = (f) => r("export-template"))
386
+ }, D(n("toolbar.exportTemplate")), 1),
387
+ l("button", {
388
+ class: "v2-toolbar__button",
389
+ type: "button",
390
+ onClick: s[6] || (s[6] = (f) => r("import-template"))
391
+ }, D(n("toolbar.importTemplate")), 1)
392
+ ])) : K("", !0),
393
+ a.value.showFillDataModule ? ($(), I("div", Pa, [
394
+ l("span", Ea, D(n("toolbar.module.fillData")), 1),
395
+ l("button", {
396
+ class: "v2-toolbar__button",
397
+ type: "button",
398
+ title: n("toolbar.saveFillDataTip"),
399
+ onClick: s[7] || (s[7] = (f) => r("save-fill-data"))
400
+ }, D(n("toolbar.saveFillData")), 9, Aa),
401
+ l("button", {
402
+ class: "v2-toolbar__button",
403
+ type: "button",
404
+ title: n("toolbar.loadFillDataTip"),
405
+ onClick: s[8] || (s[8] = (f) => r("load-fill-data"))
406
+ }, D(n("toolbar.loadFillData")), 9, Ha),
407
+ l("button", {
408
+ class: "v2-toolbar__button",
409
+ type: "button",
410
+ "data-export-fill-data": "",
411
+ title: n("toolbar.exportFillDataTip"),
412
+ onClick: s[9] || (s[9] = (f) => r("export-fill-data"))
413
+ }, D(n("toolbar.exportFillData")), 9, Ra),
414
+ l("button", {
415
+ class: "v2-toolbar__button",
416
+ type: "button",
417
+ title: n("toolbar.importFillDataTip"),
418
+ onClick: s[10] || (s[10] = (f) => r("import-fill-data"))
419
+ }, D(n("toolbar.importFillData")), 9, La)
420
+ ])) : K("", !0),
421
+ a.value.showPreviewPrint || a.value.showHelp ? ($(), I("div", Ma, [
422
+ a.value.showPreviewPrint ? ($(), I("button", {
423
+ key: 0,
424
+ class: me(["v2-toolbar__button", { "v2-toolbar__button--active": e.previewMode }]),
425
+ type: "button",
426
+ "data-view-mode": "preview",
427
+ title: n("toolbar.previewTip"),
428
+ onClick: s[11] || (s[11] = (f) => r("toggle-preview"))
429
+ }, D(e.previewMode ? n("toolbar.exitPreview") : n("toolbar.preview")), 11, Ba)) : K("", !0),
430
+ a.value.showPreviewPrint ? ($(), I("button", {
431
+ key: 1,
432
+ class: "v2-toolbar__button",
433
+ type: "button",
434
+ onClick: s[12] || (s[12] = (f) => r("print"))
435
+ }, D(n("toolbar.print")), 1)) : K("", !0),
436
+ a.value.showHelp ? ($(), I("button", {
437
+ key: 2,
438
+ class: "v2-toolbar__button",
439
+ type: "button",
440
+ "data-help-toggle": "",
441
+ title: n("toolbar.helpTip"),
442
+ onClick: s[13] || (s[13] = (f) => r("help"))
443
+ }, D(n("toolbar.help")), 9, Va)) : K("", !0)
444
+ ])) : K("", !0)
445
+ ]));
446
+ }
447
+ }), za = /* @__PURE__ */ ie(Ga, [["__scopeId", "data-v-71ae7003"]]), nl = Symbol(
448
+ "TicketDesigner.TreeControl"
449
+ );
450
+ function ol(e, u) {
451
+ return u ? e.id === u ? !0 : e.children.some((t) => ol(t, u)) : !1;
452
+ }
453
+ function Oa(e, u, t = 4) {
454
+ const a = e.getBoundingClientRect(), n = u.getBoundingClientRect(), r = e.scrollTop, b = a.top + t - n.top;
455
+ if (b > 0) return Math.max(0, r - b);
456
+ const s = n.bottom + t - a.bottom;
457
+ return s > 0 ? r + s : r;
458
+ }
459
+ function Yt(e, u, t = 4) {
460
+ const a = Oa(e, u, t);
461
+ return a === e.scrollTop ? !1 : (e.scrollTop = a, !0);
462
+ }
463
+ const Wa = { class: "v2-tree-node" }, Ua = ["data-tree-node-id"], ja = {
464
+ key: 1,
465
+ class: "v2-tree-dot"
466
+ }, Ya = { class: "v2-tree-label" }, Ja = { class: "v2-tree-type" }, Ka = {
467
+ key: 0,
468
+ class: "v2-tree-children"
469
+ }, qa = /* @__PURE__ */ X({
470
+ name: "NodeTreeItem",
471
+ __name: "NodeTreeItem",
472
+ props: {
473
+ node: {},
474
+ selectedId: {},
475
+ depth: {}
476
+ },
477
+ emits: ["select"],
478
+ setup(e, { emit: u }) {
479
+ const t = e, a = u, n = Sl(nl, null), r = G(n ? n.target.value : !0);
480
+ n && (ve(n.token, () => {
481
+ r.value = n.target.value;
482
+ }), ve(
483
+ n.focusToken,
484
+ () => {
485
+ ol(t.node, n.focusId.value) && (r.value = !0);
486
+ },
487
+ { immediate: !0 }
488
+ ));
489
+ function b() {
490
+ a("select", t.node.id);
491
+ }
492
+ function s() {
493
+ r.value = !r.value;
494
+ }
495
+ return (f, v) => {
496
+ const p = $l("NodeTreeItem", !0);
497
+ return $(), I("div", Wa, [
498
+ l("div", {
499
+ class: me(["v2-tree-row", { "v2-tree-row--selected": e.node.id === e.selectedId }]),
500
+ style: Pe({ paddingLeft: `${e.depth * 14 + 6}px` }),
501
+ "data-tree-node-id": e.node.id,
502
+ onClick: b
503
+ }, [
504
+ e.node.children.length ? ($(), I("button", {
505
+ key: 0,
506
+ class: "v2-tree-toggle",
507
+ type: "button",
508
+ onClick: Qt(s, ["stop"])
509
+ }, D(r.value ? "▾" : "▸"), 1)) : ($(), I("span", ja, "·")),
510
+ l("span", Ya, D(e.node.label), 1),
511
+ l("span", Ja, D(e.node.type), 1)
512
+ ], 14, Ua),
513
+ r.value && e.node.children.length ? ($(), I("div", Ka, [
514
+ ($(!0), I(_, null, ye(e.node.children, (g) => ($(), oe(p, {
515
+ key: g.id,
516
+ node: g,
517
+ "selected-id": e.selectedId,
518
+ depth: e.depth + 1,
519
+ onSelect: v[0] || (v[0] = (L) => a("select", L))
520
+ }, null, 8, ["node", "selected-id", "depth"]))), 128))
521
+ ])) : K("", !0)
522
+ ]);
523
+ };
524
+ }
525
+ }), Xa = /* @__PURE__ */ ie(qa, [["__scopeId", "data-v-10a2a207"]]), Za = ["disabled"], Qa = ["disabled"], _a = ["disabled"], en = ["disabled"], tn = ["disabled"], ln = ["disabled"], an = { class: "v2-sidebar__heading v2-sidebar__heading--tree v2-tree-head" }, nn = ["disabled", "title"], on = { class: "v2-tree__buttons" }, dn = /* @__PURE__ */ X({
526
+ __name: "PaletteSidebar",
527
+ props: {
528
+ editable: { type: Boolean },
529
+ canRemove: { type: Boolean },
530
+ nodeTree: {},
531
+ selectedNodeId: {}
532
+ },
533
+ emits: ["add-node", "add-grid", "palette-drag", "select", "remove-selected", "collapse-all", "expand-all"],
534
+ setup(e, { emit: u }) {
535
+ const t = e, a = G(null), n = G(null);
536
+ function r(f) {
537
+ const v = a.value;
538
+ if (!v) return null;
539
+ const p = v.querySelectorAll("[data-tree-node-id]");
540
+ for (const g of Array.from(p))
541
+ if (g.dataset.treeNodeId === f) return g;
542
+ return null;
543
+ }
544
+ function b(f) {
545
+ if (!f) return;
546
+ const v = r(f);
547
+ v && (a.value && Yt(a.value, v), n.value && a.value && Yt(n.value, a.value));
548
+ }
549
+ ve(
550
+ () => t.selectedNodeId,
551
+ async (f) => {
552
+ f && (await Ke(), r(f) || await Ke(), b(f));
553
+ }
554
+ );
555
+ const s = u;
556
+ return (f, v) => ($(), I("aside", {
557
+ ref_key: "sidebarRef",
558
+ ref: n,
559
+ class: "v2-sidebar v2-sidebar--left"
560
+ }, [
561
+ v[17] || (v[17] = l("div", { class: "v2-sidebar__group-title" }, "基础组件", -1)),
562
+ l("button", {
563
+ class: "v2-palette-item v2-palette-item--button",
564
+ type: "button",
565
+ draggable: "true",
566
+ "data-palette": "text",
567
+ disabled: !e.editable,
568
+ onDragstart: v[0] || (v[0] = (p) => s("palette-drag", "text", p)),
569
+ onClick: v[1] || (v[1] = (p) => s("add-node", "text"))
570
+ }, " 文本 ", 40, Za),
571
+ l("button", {
572
+ class: "v2-palette-item v2-palette-item--button",
573
+ type: "button",
574
+ draggable: "true",
575
+ "data-palette": "field",
576
+ disabled: !e.editable,
577
+ onDragstart: v[2] || (v[2] = (p) => s("palette-drag", "field", p)),
578
+ onClick: v[3] || (v[3] = (p) => s("add-node", "field"))
579
+ }, " 输入框 ", 40, Qa),
580
+ l("button", {
581
+ class: "v2-palette-item v2-palette-item--button",
582
+ type: "button",
583
+ draggable: "true",
584
+ "data-palette": "image",
585
+ disabled: !e.editable,
586
+ onDragstart: v[4] || (v[4] = (p) => s("palette-drag", "image", p)),
587
+ onClick: v[5] || (v[5] = (p) => s("add-node", "image"))
588
+ }, " 图片 ", 40, _a),
589
+ l("button", {
590
+ class: "v2-palette-item v2-palette-item--button",
591
+ type: "button",
592
+ draggable: "true",
593
+ "data-palette": "html",
594
+ disabled: !e.editable,
595
+ onDragstart: v[6] || (v[6] = (p) => s("palette-drag", "html", p)),
596
+ onClick: v[7] || (v[7] = (p) => s("add-node", "html"))
597
+ }, " HTML 模块 ", 40, en),
598
+ v[18] || (v[18] = l("div", { class: "v2-sidebar__group-title" }, "布局组件", -1)),
599
+ l("button", {
600
+ class: "v2-palette-item v2-palette-item--button",
601
+ type: "button",
602
+ draggable: "true",
603
+ "data-palette": "grid",
604
+ disabled: !e.editable,
605
+ onDragstart: v[8] || (v[8] = (p) => s("palette-drag", "grid", p)),
606
+ onClick: v[9] || (v[9] = (p) => s("add-grid"))
607
+ }, " 网格 ", 40, tn),
608
+ l("button", {
609
+ class: "v2-palette-item v2-palette-item--button",
610
+ type: "button",
611
+ draggable: "true",
612
+ "data-palette": "table",
613
+ disabled: !e.editable,
614
+ onDragstart: v[10] || (v[10] = (p) => s("palette-drag", "table", p)),
615
+ onClick: v[11] || (v[11] = (p) => s("add-node", "table"))
616
+ }, " 表格 ", 40, ln),
617
+ l("div", an, [
618
+ v[16] || (v[16] = l("span", null, "结构", -1)),
619
+ l("button", {
620
+ class: "v2-tree__delete",
621
+ type: "button",
622
+ disabled: !e.canRemove,
623
+ title: e.editable ? "删除选中的组件" : "预览状态下不可编辑结构",
624
+ onClick: v[12] || (v[12] = (p) => s("remove-selected"))
625
+ }, " 删除 ", 8, nn)
626
+ ]),
627
+ l("div", {
628
+ ref_key: "treeRef",
629
+ ref: a,
630
+ class: "v2-tree"
631
+ }, [
632
+ ($(!0), I(_, null, ye(e.nodeTree, (p) => ($(), oe(Xa, {
633
+ key: p.id,
634
+ node: p,
635
+ "selected-id": e.selectedNodeId,
636
+ depth: 0,
637
+ onSelect: v[13] || (v[13] = (g) => s("select", g))
638
+ }, null, 8, ["node", "selected-id"]))), 128))
639
+ ], 512),
640
+ l("div", on, [
641
+ l("button", {
642
+ type: "button",
643
+ class: "v2-tree__btn",
644
+ onClick: v[14] || (v[14] = (p) => s("collapse-all"))
645
+ }, " 折叠全部 "),
646
+ l("button", {
647
+ type: "button",
648
+ class: "v2-tree__btn",
649
+ onClick: v[15] || (v[15] = (p) => s("expand-all"))
650
+ }, " 展开全部 ")
651
+ ])
652
+ ], 512));
653
+ }
654
+ }), un = /* @__PURE__ */ ie(dn, [["__scopeId", "data-v-91a9dac6"]]), rn = {
655
+ page: "页面",
656
+ grid: "网格",
657
+ "grid-cell": "格子",
658
+ text: "文本",
659
+ p: "字段",
660
+ table: "表格",
661
+ image: "图片",
662
+ html: "HTML 模块"
663
+ };
664
+ function De(e) {
665
+ return rn[e] ?? e;
666
+ }
667
+ function Ne(e) {
668
+ switch (e.type) {
669
+ case "page":
670
+ return "页面";
671
+ case "grid":
672
+ return "网格";
673
+ case "text":
674
+ return e.text ? `“${e.text}”` : "(空文本)";
675
+ case "p":
676
+ return `字段:${e.field}`;
677
+ case "table":
678
+ return e.field ? `表格:${e.field}` : "表格";
679
+ case "image":
680
+ return "图片";
681
+ case "html":
682
+ return "HTML 模块";
683
+ default:
684
+ return De(e.type);
685
+ }
686
+ }
687
+ function lt(e) {
688
+ return e.type === "grid" ? sn(e) : e.type === "page" ? {
689
+ id: e.id,
690
+ type: De(e.type),
691
+ label: Ne(e),
692
+ children: e.children.map(lt)
693
+ } : { id: e.id, type: De(e.type), label: Ne(e), children: [] };
694
+ }
695
+ function sn(e) {
696
+ const u = [];
697
+ return e.rows.forEach((t, a) => {
698
+ t.cells.forEach((n, r) => {
699
+ u.push(vn(n, a, r, t.cells.length, e.rows.length));
700
+ });
701
+ }), { id: e.id, type: "网格", label: Ne(e), children: u };
702
+ }
703
+ function vn(e, u, t, a, n) {
704
+ const r = n > 1 ? `格子 ${u + 1}-${t + 1}` : a > 1 ? `格子 ${t + 1}` : "格子";
705
+ return {
706
+ id: e.id,
707
+ type: "格子",
708
+ label: r,
709
+ children: e.children.map(lt)
710
+ };
711
+ }
712
+ function cn(e, u) {
713
+ const t = G(null), a = G(null), n = G([]), r = G(0);
714
+ let b = null, s = 0;
715
+ const f = P(() => Xe(e.value));
716
+ function v(w) {
717
+ var c, h;
718
+ let y = ((c = f.value.get(w)) == null ? void 0 : c.parent) ?? null;
719
+ for (; y; ) {
720
+ if (y.type === "table") return !0;
721
+ y = ((h = f.value.get(y.id)) == null ? void 0 : h.parent) ?? null;
722
+ }
723
+ return !1;
724
+ }
725
+ function p(w) {
726
+ var c;
727
+ const y = (c = f.value.get(w)) == null ? void 0 : c.node;
728
+ return !y || v(w) ? !1 : ke(y) || y.type === "grid-cell";
729
+ }
730
+ const g = P(() => {
731
+ var y;
732
+ const w = t.value;
733
+ return w && p(w) ? ((y = f.value.get(w)) == null ? void 0 : y.node) ?? null : null;
734
+ }), L = P(
735
+ () => g.value ? De(g.value.type) : "未选择"
736
+ ), A = P(
737
+ () => {
738
+ var w;
739
+ return t.value ? ((w = f.value.get(t.value)) == null ? void 0 : w.ownerCell) ?? null : null;
740
+ }
741
+ ), H = P(
742
+ () => {
743
+ var w;
744
+ return ((w = g.value) == null ? void 0 : w.type) === "grid-cell" ? g.value : null;
745
+ }
746
+ ), U = P(() => {
747
+ var c, h;
748
+ const w = t.value;
749
+ if (!w) return null;
750
+ let y = ((c = f.value.get(w)) == null ? void 0 : c.parent) ?? null;
751
+ for (; y && y.type !== "grid"; )
752
+ y = ((h = f.value.get(y.id)) == null ? void 0 : h.parent) ?? null;
753
+ return (y == null ? void 0 : y.type) === "grid" ? y : null;
754
+ }), q = P(() => {
755
+ const w = H.value, y = U.value;
756
+ return !w || !y ? null : Pl(w, y);
757
+ }), j = P(() => {
758
+ var S, F, E;
759
+ const w = t.value;
760
+ if (!w) return null;
761
+ const y = f.value.get(w);
762
+ if ((y == null ? void 0 : y.node.type) !== "grid-cell" || ((S = y.parent) == null ? void 0 : S.type) !== "grid-row") return null;
763
+ const c = y.parent, h = (F = f.value.get(c.id)) != null && F.node ? (((E = U.value) == null ? void 0 : E.rows) ?? []).findIndex((N) => N.id === c.id) : -1, m = c.cells.findIndex((N) => N.id === w);
764
+ return m < 0 ? null : {
765
+ rowIndex: h,
766
+ columnIndex: m,
767
+ hasNextSibling: m < c.cells.length - 1,
768
+ canSplit: (y.node.colspan ?? 1) > 1
769
+ };
770
+ }), te = P(() => {
771
+ var h, m;
772
+ const w = a.value, y = w ? (h = f.value.get(w)) == null ? void 0 : h.node : void 0;
773
+ if ((y == null ? void 0 : y.type) === "grid-cell" || (y == null ? void 0 : y.type) === "table-cell-template") return y;
774
+ const c = t.value ? (m = f.value.get(t.value)) == null ? void 0 : m.node : void 0;
775
+ return (c == null ? void 0 : c.type) === "grid-cell" || (c == null ? void 0 : c.type) === "table-cell-template" ? c : A.value;
776
+ }), ee = P(() => e.value.pages.map((w) => lt(w)));
777
+ function k() {
778
+ t.value = null, a.value = null, n.value = [], r.value = 0, b = null, s = 0;
779
+ }
780
+ function Y(w) {
781
+ var F, E;
782
+ if (!u.editable()) return;
783
+ const y = w.target;
784
+ a.value = ((F = y.closest(`[${he}]`)) == null ? void 0 : F.dataset.layoutId) ?? null;
785
+ const c = [];
786
+ let h = y.closest(`[${$e}]`);
787
+ for (; h; ) {
788
+ const N = h.dataset.nodeId;
789
+ N && c.push(N), h = ((E = h.parentElement) == null ? void 0 : E.closest(`[${$e}]`)) ?? null;
790
+ }
791
+ const m = c.filter((N) => p(N)), S = m[0] ?? null;
792
+ if (!S) {
793
+ t.value = null, a.value = null, n.value = [], r.value = 0, b = null, s = 0;
794
+ return;
795
+ }
796
+ S === b && n.value.join("/") === m.join("/") ? s = (s + 1) % m.length : (b = S, s = 0, n.value = m), r.value = s, t.value = m[s] ?? S;
797
+ }
798
+ function J(w) {
799
+ var m, S, F;
800
+ const y = f.value, c = [];
801
+ let h = w.nodeId ? (m = y.get(w.nodeId)) == null ? void 0 : m.node : void 0;
802
+ for (; h; )
803
+ ke(h) && c.push(h.id), h = ((S = y.get(h.id)) == null ? void 0 : S.parent) ?? void 0;
804
+ if (c.length === 0) {
805
+ const E = (F = e.value.pages[0]) == null ? void 0 : F.id;
806
+ if (!E) return;
807
+ c.push(E);
808
+ }
809
+ t.value = c[0], a.value = null, n.value = c, r.value = 0, s = 0, b = c[0];
810
+ }
811
+ function Z(w) {
812
+ var m;
813
+ if (!u.editable()) return;
814
+ const y = f.value.get(w);
815
+ if (!y || !ke(y.node) && y.node.type !== "grid-cell") return;
816
+ t.value = w, a.value = null;
817
+ const c = [];
818
+ let h = y.parent;
819
+ for (; h; )
820
+ ke(h) && c.unshift(h.id), h = ((m = f.value.get(h.id)) == null ? void 0 : m.parent) ?? null;
821
+ n.value = [...c, w], r.value = n.value.length - 1, s = n.value.length - 1, b = w;
822
+ }
823
+ return {
824
+ selectedNodeId: t,
825
+ selectedInsertionSlotId: a,
826
+ selectionPathIds: n,
827
+ selectionPathIndex: r,
828
+ nodeIndex: f,
829
+ selectedNode: g,
830
+ selectedNodeType: L,
831
+ selectedOwnerCell: A,
832
+ selectedCell: H,
833
+ selectedOwnerGridOfCell: U,
834
+ selectedCellBox: q,
835
+ selectedCellContext: j,
836
+ insertionSlot: te,
837
+ nodeTree: ee,
838
+ isInsideTable: v,
839
+ isStyleEditableNodeId: p,
840
+ clearSelection: k,
841
+ selectNode: Y,
842
+ selectNodeById: Z,
843
+ selectIssue: J
844
+ };
845
+ }
846
+ const pn = { class: "v2-sidebar__subheading" }, fn = { class: "v2-control v2-control--toggle" }, gn = ["checked"], mn = { class: "v2-control v2-control--inline" }, bn = ["value"], hn = { class: "v2-control v2-control--inline" }, yn = ["value"], Sn = { class: "v2-control v2-control--inline" }, $n = ["value"], Cn = { class: "v2-grid-dimensions" }, wn = { class: "v2-control v2-control--inline" }, In = ["value"], xn = { class: "v2-control v2-control--inline" }, Tn = ["value"], kn = {
847
+ key: 0,
848
+ class: "v2-hint",
849
+ style: { color: "#b45309" }
850
+ }, Fn = { class: "v2-grid-dimensions" }, Dn = { class: "v2-control v2-control--inline" }, Nn = ["value"], Pn = { class: "v2-control v2-control--inline" }, En = ["value"], An = { class: "v2-control v2-control--toggle" }, Hn = ["checked"], Jt = /* @__PURE__ */ X({
851
+ __name: "HeaderFooterFields",
852
+ props: {
853
+ label: {},
854
+ band: {},
855
+ kind: {},
856
+ api: {},
857
+ margin: {}
858
+ },
859
+ setup(e) {
860
+ const u = e, t = P(
861
+ () => u.kind === "header" ? u.api.updatePaperHeaderEnabled : u.api.updatePaperFooterEnabled
862
+ ), a = P(
863
+ () => u.kind === "header" ? u.api.updatePaperHeaderContent : u.api.updatePaperFooterContent
864
+ ), n = P(
865
+ () => u.kind === "header" ? u.api.updatePaperHeaderHeight : u.api.updatePaperFooterHeight
866
+ ), r = P(
867
+ () => u.kind === "header" ? u.api.updatePaperHeaderSeparator : u.api.updatePaperFooterSeparator
868
+ ), b = P(
869
+ () => u.kind === "header" ? u.api.updatePaperHeaderFontSize : u.api.updatePaperFooterFontSize
870
+ ), s = P(
871
+ () => u.kind === "header" ? u.api.updatePaperHeaderFontWeight : u.api.updatePaperFooterFontWeight
872
+ ), f = P(
873
+ () => u.kind === "header" ? u.api.updatePaperHeaderColor : u.api.updatePaperFooterColor
874
+ ), v = P(() => {
875
+ var p;
876
+ return ((p = u.band) == null ? void 0 : p.enabled) === !0;
877
+ });
878
+ return (p, g) => {
879
+ var L, A, H, U, q, j, te, ee, k, Y, J, Z, w, y, c, h;
880
+ return $(), I(_, null, [
881
+ l("div", pn, D(e.label), 1),
882
+ l("label", fn, [
883
+ l("input", {
884
+ type: "checkbox",
885
+ checked: ((L = e.band) == null ? void 0 : L.enabled) === !0,
886
+ onChange: g[0] || (g[0] = //@ts-ignore
887
+ (...m) => t.value && t.value(...m))
888
+ }, null, 40, gn),
889
+ l("span", null, "启用" + D(e.label), 1)
890
+ ]),
891
+ v.value ? ($(), I(_, { key: 0 }, [
892
+ l("label", mn, [
893
+ g[9] || (g[9] = l("span", null, "左", -1)),
894
+ l("input", {
895
+ type: "text",
896
+ value: ((H = (A = e.band) == null ? void 0 : A.content) == null ? void 0 : H.left) ?? "",
897
+ placeholder: "变量: {page} {total}",
898
+ onChange: g[1] || (g[1] = (m) => a.value("left", m))
899
+ }, null, 40, bn)
900
+ ]),
901
+ l("label", hn, [
902
+ g[10] || (g[10] = l("span", null, "中", -1)),
903
+ l("input", {
904
+ type: "text",
905
+ value: ((q = (U = e.band) == null ? void 0 : U.content) == null ? void 0 : q.center) ?? "",
906
+ placeholder: "变量: {page} {total}",
907
+ onChange: g[2] || (g[2] = (m) => a.value("center", m))
908
+ }, null, 40, yn)
909
+ ]),
910
+ l("label", Sn, [
911
+ g[11] || (g[11] = l("span", null, "右", -1)),
912
+ l("input", {
913
+ type: "text",
914
+ value: ((te = (j = e.band) == null ? void 0 : j.content) == null ? void 0 : te.right) ?? "",
915
+ placeholder: "变量: {page} {total}",
916
+ onChange: g[3] || (g[3] = (m) => a.value("right", m))
917
+ }, null, 40, $n)
918
+ ]),
919
+ l("div", Cn, [
920
+ l("label", wn, [
921
+ g[12] || (g[12] = l("span", null, "高度(mm)", -1)),
922
+ l("input", {
923
+ type: "number",
924
+ min: "1",
925
+ step: "1",
926
+ value: ((ee = e.band) == null ? void 0 : ee.height) ?? x(El),
927
+ onChange: g[4] || (g[4] = //@ts-ignore
928
+ (...m) => n.value && n.value(...m))
929
+ }, null, 40, In)
930
+ ]),
931
+ l("label", xn, [
932
+ g[13] || (g[13] = l("span", null, "字号(px)", -1)),
933
+ l("input", {
934
+ type: "number",
935
+ min: "1",
936
+ step: "1",
937
+ value: ((Y = (k = e.band) == null ? void 0 : k.style) == null ? void 0 : Y.fontSize) ?? 12,
938
+ onChange: g[5] || (g[5] = //@ts-ignore
939
+ (...m) => b.value && b.value(...m))
940
+ }, null, 40, Tn)
941
+ ])
942
+ ]),
943
+ ((J = e.band) == null ? void 0 : J.height) != null && e.margin != null && e.band.height > e.margin ? ($(), I("p", kn, " 高度 " + D(e.band.height) + "mm 超过纸张边距 " + D(e.margin) + "mm:显示时已按边距 收敛(页眉/页脚画在边距内,超出会压到正文、打印被裁切)。 ", 1)) : K("", !0),
944
+ l("div", Fn, [
945
+ l("label", Dn, [
946
+ g[15] || (g[15] = l("span", null, "粗细", -1)),
947
+ l("select", {
948
+ value: ((w = (Z = e.band) == null ? void 0 : Z.style) == null ? void 0 : w.fontWeight) ?? "normal",
949
+ onChange: g[6] || (g[6] = //@ts-ignore
950
+ (...m) => s.value && s.value(...m))
951
+ }, [...g[14] || (g[14] = [
952
+ l("option", { value: "normal" }, "常规", -1),
953
+ l("option", { value: "bold" }, "加粗", -1)
954
+ ])], 40, Nn)
955
+ ]),
956
+ l("label", Pn, [
957
+ g[16] || (g[16] = l("span", null, "颜色", -1)),
958
+ l("input", {
959
+ type: "color",
960
+ value: ((c = (y = e.band) == null ? void 0 : y.style) == null ? void 0 : c.color) ?? "#111827",
961
+ onChange: g[7] || (g[7] = //@ts-ignore
962
+ (...m) => f.value && f.value(...m))
963
+ }, null, 40, En)
964
+ ])
965
+ ]),
966
+ l("label", An, [
967
+ l("input", {
968
+ type: "checkbox",
969
+ checked: ((h = e.band) == null ? void 0 : h.separator) !== !1,
970
+ onChange: g[8] || (g[8] = //@ts-ignore
971
+ (...m) => r.value && r.value(...m))
972
+ }, null, 40, Hn),
973
+ g[17] || (g[17] = l("span", null, "分隔线", -1))
974
+ ])
975
+ ], 64)) : K("", !0)
976
+ ], 64);
977
+ };
978
+ }
979
+ }), Rn = { class: "v2-control v2-control--inline" }, Ln = ["value"], Mn = { class: "v2-grid-dimensions" }, Bn = { class: "v2-control v2-control--inline" }, Vn = ["value"], Gn = { class: "v2-control v2-control--inline" }, zn = ["value"], On = { class: "v2-control v2-control--inline" }, Wn = ["value"], Un = { class: "v2-control v2-control--inline" }, jn = ["value"], Yn = { class: "v2-control v2-control--inline" }, Jn = ["value"], Kn = { class: "v2-control v2-control--toggle" }, qn = /* @__PURE__ */ X({
980
+ __name: "PageInspector",
981
+ props: /* @__PURE__ */ qe({
982
+ paperSize: {},
983
+ baseRowHeight: {},
984
+ paperMarginTop: {},
985
+ paperMarginRight: {},
986
+ paperMarginBottom: {},
987
+ paperMarginLeft: {},
988
+ header: {},
989
+ footer: {},
990
+ api: {}
991
+ }, {
992
+ paginate: { type: Boolean, required: !0 },
993
+ paginateModifiers: {}
994
+ }),
995
+ emits: ["update:paginate"],
996
+ setup(e) {
997
+ const u = _t(e, "paginate");
998
+ return (t, a) => ($(), I(_, null, [
999
+ a[15] || (a[15] = l("div", { class: "v2-sidebar__subheading" }, "页面设置", -1)),
1000
+ l("label", Rn, [
1001
+ a[8] || (a[8] = l("span", null, "纸张类型", -1)),
1002
+ l("select", {
1003
+ value: e.paperSize,
1004
+ onChange: a[0] || (a[0] = //@ts-ignore
1005
+ (...n) => e.api.updatePaperSize && e.api.updatePaperSize(...n))
1006
+ }, [...a[7] || (a[7] = [
1007
+ l("option", { value: "A4" }, "A4(纵向)", -1),
1008
+ l("option", { value: "A3" }, "A3(横向)", -1)
1009
+ ])], 40, Ln)
1010
+ ]),
1011
+ l("div", Mn, [
1012
+ l("label", Bn, [
1013
+ a[9] || (a[9] = l("span", null, "上边距(mm)", -1)),
1014
+ l("input", {
1015
+ type: "number",
1016
+ min: "0",
1017
+ max: "99",
1018
+ step: "1",
1019
+ value: e.paperMarginTop,
1020
+ onChange: a[1] || (a[1] = (n) => e.api.updatePaperMarginSide("top", n))
1021
+ }, null, 40, Vn)
1022
+ ]),
1023
+ l("label", Gn, [
1024
+ a[10] || (a[10] = l("span", null, "右边距(mm)", -1)),
1025
+ l("input", {
1026
+ type: "number",
1027
+ min: "0",
1028
+ max: "99",
1029
+ step: "1",
1030
+ value: e.paperMarginRight,
1031
+ onChange: a[2] || (a[2] = (n) => e.api.updatePaperMarginSide("right", n))
1032
+ }, null, 40, zn)
1033
+ ]),
1034
+ l("label", On, [
1035
+ a[11] || (a[11] = l("span", null, "下边距(mm)", -1)),
1036
+ l("input", {
1037
+ type: "number",
1038
+ min: "0",
1039
+ max: "99",
1040
+ step: "1",
1041
+ value: e.paperMarginBottom,
1042
+ onChange: a[3] || (a[3] = (n) => e.api.updatePaperMarginSide("bottom", n))
1043
+ }, null, 40, Wn)
1044
+ ]),
1045
+ l("label", Un, [
1046
+ a[12] || (a[12] = l("span", null, "左边距(mm)", -1)),
1047
+ l("input", {
1048
+ type: "number",
1049
+ min: "0",
1050
+ max: "99",
1051
+ step: "1",
1052
+ value: e.paperMarginLeft,
1053
+ onChange: a[4] || (a[4] = (n) => e.api.updatePaperMarginSide("left", n))
1054
+ }, null, 40, jn)
1055
+ ])
1056
+ ]),
1057
+ l("label", Yn, [
1058
+ a[13] || (a[13] = l("span", null, "行高(mm)", -1)),
1059
+ l("input", {
1060
+ type: "number",
1061
+ min: "1",
1062
+ max: "99",
1063
+ step: "1",
1064
+ value: e.baseRowHeight,
1065
+ onChange: a[5] || (a[5] = //@ts-ignore
1066
+ (...n) => e.api.updateBaseRowHeight && e.api.updateBaseRowHeight(...n))
1067
+ }, null, 40, Jn)
1068
+ ]),
1069
+ l("label", Kn, [
1070
+ Cl(l("input", {
1071
+ "onUpdate:modelValue": a[6] || (a[6] = (n) => u.value = n),
1072
+ type: "checkbox",
1073
+ "data-paginate": "true"
1074
+ }, null, 512), [
1075
+ [wl, u.value]
1076
+ ]),
1077
+ a[14] || (a[14] = l("span", null, "分页显示(仅影响编辑画面,打印始终分页)", -1))
1078
+ ]),
1079
+ le(Jt, {
1080
+ label: "页眉",
1081
+ kind: "header",
1082
+ band: e.header,
1083
+ margin: e.paperMarginTop,
1084
+ api: e.api
1085
+ }, null, 8, ["band", "margin", "api"]),
1086
+ le(Jt, {
1087
+ label: "页脚",
1088
+ kind: "footer",
1089
+ band: e.footer,
1090
+ margin: e.paperMarginBottom,
1091
+ api: e.api
1092
+ }, null, 8, ["band", "margin", "api"])
1093
+ ], 64));
1094
+ }
1095
+ }), Xn = { class: "v2-grid-dimensions" }, Zn = { class: "v2-control" }, Qn = ["value"], _n = { class: "v2-control" }, eo = ["value"], to = { class: "v2-grid-dimensions" }, lo = ["value", "onChange"], ao = { class: "v2-control" }, no = ["value"], oo = { class: "v2-grid-dimensions" }, io = { class: "v2-control v2-control--inline" }, uo = ["value"], ro = { class: "v2-control v2-control--inline" }, so = ["value"], vo = { class: "v2-control v2-control--inline" }, co = ["value"], po = { class: "v2-control v2-control--inline" }, fo = ["value"], go = /* @__PURE__ */ X({
1096
+ __name: "GridInspector",
1097
+ props: {
1098
+ node: {},
1099
+ api: {}
1100
+ },
1101
+ setup(e) {
1102
+ return (u, t) => {
1103
+ var a;
1104
+ return $(), I(_, null, [
1105
+ l("div", Xn, [
1106
+ l("label", Zn, [
1107
+ t[7] || (t[7] = l("span", null, "行数", -1)),
1108
+ l("input", {
1109
+ type: "number",
1110
+ min: "1",
1111
+ step: "1",
1112
+ value: e.node.rows.length,
1113
+ "data-dimension": "rows",
1114
+ onChange: t[0] || (t[0] = //@ts-ignore
1115
+ (...n) => e.api.updateGridDimensions && e.api.updateGridDimensions(...n))
1116
+ }, null, 40, Qn)
1117
+ ]),
1118
+ l("label", _n, [
1119
+ t[8] || (t[8] = l("span", null, "列数", -1)),
1120
+ l("input", {
1121
+ type: "number",
1122
+ min: "1",
1123
+ step: "1",
1124
+ value: ((a = e.node.rows[0]) == null ? void 0 : a.cells.length) ?? 1,
1125
+ "data-dimension": "columns",
1126
+ onChange: t[1] || (t[1] = //@ts-ignore
1127
+ (...n) => e.api.updateGridDimensions && e.api.updateGridDimensions(...n))
1128
+ }, null, 40, eo)
1129
+ ])
1130
+ ]),
1131
+ t[17] || (t[17] = l("div", { class: "v2-sidebar__subheading" }, "列宽(mm / 比例 / 自动)", -1)),
1132
+ l("div", to, [
1133
+ ($(!0), I(_, null, ye(e.node.rows[0].cells, (n, r) => {
1134
+ var b;
1135
+ return $(), I("label", {
1136
+ key: r,
1137
+ class: "v2-control v2-control--inline"
1138
+ }, [
1139
+ l("span", null, "第 " + D(r + 1) + " 列", 1),
1140
+ l("input", {
1141
+ value: ((b = e.node.columns) == null ? void 0 : b[r]) ?? n.width ?? "1fr",
1142
+ placeholder: "如 30、1fr、auto",
1143
+ onChange: (s) => e.api.updateGridColumnWidth(r, s)
1144
+ }, null, 40, lo)
1145
+ ]);
1146
+ }), 128))
1147
+ ]),
1148
+ l("label", ao, [
1149
+ t[10] || (t[10] = l("span", null, "边框", -1)),
1150
+ l("select", {
1151
+ value: e.node.border,
1152
+ onChange: t[2] || (t[2] = //@ts-ignore
1153
+ (...n) => e.api.updateGridBorder && e.api.updateGridBorder(...n))
1154
+ }, [...t[9] || (t[9] = [
1155
+ l("option", { value: "all" }, "外框 + 内部", -1),
1156
+ l("option", { value: "outer" }, "仅外框", -1),
1157
+ l("option", { value: "inner" }, "仅内部", -1),
1158
+ l("option", { value: "none" }, "无边框", -1)
1159
+ ])], 40, no)
1160
+ ]),
1161
+ t[18] || (t[18] = l("div", { class: "v2-sidebar__subheading" }, "格子默认样式(内边距 / 对齐)", -1)),
1162
+ l("div", oo, [
1163
+ l("label", io, [
1164
+ t[11] || (t[11] = l("span", null, "格子间距(mm)", -1)),
1165
+ l("input", {
1166
+ type: "number",
1167
+ min: "0",
1168
+ step: "1",
1169
+ "data-grid": "gap",
1170
+ value: e.node.gap ?? "",
1171
+ onChange: t[3] || (t[3] = //@ts-ignore
1172
+ (...n) => e.api.updateGridGap && e.api.updateGridGap(...n))
1173
+ }, null, 40, uo)
1174
+ ]),
1175
+ l("label", ro, [
1176
+ t[12] || (t[12] = l("span", null, "默认内边距(mm)", -1)),
1177
+ l("input", {
1178
+ type: "number",
1179
+ min: "0",
1180
+ step: "1",
1181
+ "data-cell-default": "padding",
1182
+ value: e.node.cellPadding ?? "",
1183
+ onChange: t[4] || (t[4] = (n) => e.api.updateGridCellDefault("cellPadding", n))
1184
+ }, null, 40, so)
1185
+ ]),
1186
+ l("label", vo, [
1187
+ t[14] || (t[14] = l("span", null, "默认水平对齐", -1)),
1188
+ l("select", {
1189
+ "data-cell-default": "align",
1190
+ value: e.node.cellAlign ?? "",
1191
+ onChange: t[5] || (t[5] = (n) => e.api.updateGridCellDefault("cellAlign", n))
1192
+ }, [...t[13] || (t[13] = [
1193
+ l("option", { value: "" }, "居中(默认)", -1),
1194
+ l("option", { value: "left" }, "左", -1),
1195
+ l("option", { value: "center" }, "居中", -1),
1196
+ l("option", { value: "right" }, "右", -1)
1197
+ ])], 40, co)
1198
+ ]),
1199
+ l("label", po, [
1200
+ t[16] || (t[16] = l("span", null, "默认垂直对齐", -1)),
1201
+ l("select", {
1202
+ "data-cell-default": "valign",
1203
+ value: e.node.cellVerticalAlign ?? "",
1204
+ onChange: t[6] || (t[6] = (n) => e.api.updateGridCellDefault("cellVerticalAlign", n))
1205
+ }, [...t[15] || (t[15] = [
1206
+ l("option", { value: "" }, "居中(默认)", -1),
1207
+ l("option", { value: "top" }, "顶部", -1),
1208
+ l("option", { value: "middle" }, "居中", -1),
1209
+ l("option", { value: "bottom" }, "底部", -1)
1210
+ ])], 40, fo)
1211
+ ])
1212
+ ])
1213
+ ], 64);
1214
+ };
1215
+ }
1216
+ }), mo = { class: "v2-control v2-control--inline" }, bo = ["checked"], ho = { class: "v2-toolbar v2-toolbar--row" }, yo = ["disabled"], So = ["disabled"], $o = { class: "v2-grid-dimensions" }, Co = { class: "v2-control" }, wo = ["value"], Io = { class: "v2-control" }, xo = ["value"], To = { class: "v2-control" }, ko = ["value"], Fo = { class: "v2-control" }, Do = ["value"], No = /* @__PURE__ */ X({
1217
+ __name: "CellInspector",
1218
+ props: {
1219
+ node: {},
1220
+ cellContext: {},
1221
+ cellBox: {},
1222
+ api: {}
1223
+ },
1224
+ setup(e) {
1225
+ return (u, t) => {
1226
+ var a, n;
1227
+ return $(), I(_, null, [
1228
+ l("label", mo, [
1229
+ t[7] || (t[7] = l("span", null, "内容撑满格子", -1)),
1230
+ l("input", {
1231
+ type: "checkbox",
1232
+ "data-flex": "true",
1233
+ checked: !!e.node.flex,
1234
+ onChange: t[0] || (t[0] = //@ts-ignore
1235
+ (...r) => e.api.updateSelectedCellFlex && e.api.updateSelectedCellFlex(...r))
1236
+ }, null, 40, bo)
1237
+ ]),
1238
+ t[14] || (t[14] = l("div", { class: "v2-sidebar__subheading" }, "合并 / 拆分", -1)),
1239
+ l("div", ho, [
1240
+ l("button", {
1241
+ class: "v2-toolbar__button",
1242
+ type: "button",
1243
+ "data-cell-merge": "true",
1244
+ disabled: !((a = e.cellContext) != null && a.hasNextSibling),
1245
+ onClick: t[1] || (t[1] = //@ts-ignore
1246
+ (...r) => e.api.mergeSelectedCellRight && e.api.mergeSelectedCellRight(...r))
1247
+ }, " 合并右侧相邻格 ", 8, yo),
1248
+ l("button", {
1249
+ class: "v2-toolbar__button",
1250
+ type: "button",
1251
+ "data-cell-split": "true",
1252
+ disabled: !((n = e.cellContext) != null && n.canSplit),
1253
+ onClick: t[2] || (t[2] = //@ts-ignore
1254
+ (...r) => e.api.splitSelectedCell && e.api.splitSelectedCell(...r))
1255
+ }, " 拆分此格 ", 8, So)
1256
+ ]),
1257
+ l("div", $o, [
1258
+ l("label", Co, [
1259
+ t[8] || (t[8] = l("span", null, "内边距(mm)", -1)),
1260
+ l("input", {
1261
+ type: "number",
1262
+ min: "0",
1263
+ step: "1",
1264
+ "data-cell-padding": "true",
1265
+ value: e.node.padding ?? "",
1266
+ onChange: t[3] || (t[3] = //@ts-ignore
1267
+ (...r) => e.api.updateSelectedCellPadding && e.api.updateSelectedCellPadding(...r))
1268
+ }, null, 40, wo)
1269
+ ]),
1270
+ l("label", Io, [
1271
+ t[9] || (t[9] = l("span", null, "行高倍数", -1)),
1272
+ l("input", {
1273
+ type: "number",
1274
+ min: "0",
1275
+ step: "1",
1276
+ value: e.node.rowHeight ?? "",
1277
+ onChange: t[4] || (t[4] = //@ts-ignore
1278
+ (...r) => e.api.updateSelectedCellRowHeight && e.api.updateSelectedCellRowHeight(...r))
1279
+ }, null, 40, xo)
1280
+ ]),
1281
+ l("label", To, [
1282
+ t[11] || (t[11] = l("span", null, "水平对齐", -1)),
1283
+ l("select", {
1284
+ value: e.node.align ?? "",
1285
+ onChange: t[5] || (t[5] = //@ts-ignore
1286
+ (...r) => e.api.updateSelectedCellAlign && e.api.updateSelectedCellAlign(...r))
1287
+ }, [...t[10] || (t[10] = [
1288
+ l("option", { value: "" }, "默认(居中)", -1),
1289
+ l("option", { value: "left" }, "左", -1),
1290
+ l("option", { value: "center" }, "居中", -1),
1291
+ l("option", { value: "right" }, "右", -1)
1292
+ ])], 40, ko)
1293
+ ]),
1294
+ l("label", Fo, [
1295
+ t[13] || (t[13] = l("span", null, "垂直对齐", -1)),
1296
+ l("select", {
1297
+ value: e.node.verticalAlign ?? "",
1298
+ onChange: t[6] || (t[6] = //@ts-ignore
1299
+ (...r) => e.api.updateSelectedCellVerticalAlign && e.api.updateSelectedCellVerticalAlign(...r))
1300
+ }, [...t[12] || (t[12] = [
1301
+ l("option", { value: "" }, "默认(跟随格子设置)", -1),
1302
+ l("option", { value: "top" }, "顶部", -1),
1303
+ l("option", { value: "middle" }, "居中", -1),
1304
+ l("option", { value: "bottom" }, "底部", -1)
1305
+ ])], 40, Do)
1306
+ ])
1307
+ ])
1308
+ ], 64);
1309
+ };
1310
+ }
1311
+ }), Po = { class: "v2-style-grid" }, Eo = { class: "v2-control v2-control--inline" }, Ao = ["value"], Ho = { class: "v2-control v2-control--inline" }, Ro = ["value"], Lo = { class: "v2-control v2-control--inline" }, Mo = ["value"], Bo = { class: "v2-control v2-control--inline" }, Vo = ["value"], Go = { class: "v2-grid-dimensions" }, zo = { class: "v2-control" }, Oo = ["value"], Wo = { class: "v2-control" }, Uo = ["value"], jo = { class: "v2-control v2-control--full" }, Yo = ["value"], il = /* @__PURE__ */ X({
1312
+ __name: "TextStyleFields",
1313
+ props: {
1314
+ style: {},
1315
+ api: {}
1316
+ },
1317
+ setup(e) {
1318
+ return (u, t) => {
1319
+ var a, n, r, b, s, f, v;
1320
+ return $(), I(_, null, [
1321
+ t[17] || (t[17] = l("div", { class: "v2-sidebar__subheading" }, "文本样式", -1)),
1322
+ l("div", Po, [
1323
+ l("label", Eo, [
1324
+ t[7] || (t[7] = l("span", null, "字号(px)", -1)),
1325
+ l("input", {
1326
+ type: "number",
1327
+ min: "1",
1328
+ step: "1",
1329
+ value: ((a = e.style) == null ? void 0 : a.fontSize) ?? "",
1330
+ onChange: t[0] || (t[0] = //@ts-ignore
1331
+ (...p) => e.api.updateSelectedFontSize && e.api.updateSelectedFontSize(...p))
1332
+ }, null, 40, Ao)
1333
+ ]),
1334
+ l("label", Ho, [
1335
+ t[8] || (t[8] = l("span", null, "行高", -1)),
1336
+ l("input", {
1337
+ type: "number",
1338
+ min: "0",
1339
+ step: "0.1",
1340
+ value: ((n = e.style) == null ? void 0 : n.lineHeight) ?? "",
1341
+ onChange: t[1] || (t[1] = //@ts-ignore
1342
+ (...p) => e.api.updateSelectedLineHeight && e.api.updateSelectedLineHeight(...p))
1343
+ }, null, 40, Ro)
1344
+ ]),
1345
+ l("label", Lo, [
1346
+ t[10] || (t[10] = l("span", null, "粗细", -1)),
1347
+ l("select", {
1348
+ value: ((r = e.style) == null ? void 0 : r.fontWeight) ?? "normal",
1349
+ onChange: t[2] || (t[2] = //@ts-ignore
1350
+ (...p) => e.api.updateSelectedFontWeight && e.api.updateSelectedFontWeight(...p))
1351
+ }, [...t[9] || (t[9] = [
1352
+ l("option", { value: "normal" }, "常规", -1),
1353
+ l("option", { value: "bold" }, "加粗", -1)
1354
+ ])], 40, Mo)
1355
+ ]),
1356
+ l("label", Bo, [
1357
+ t[11] || (t[11] = l("span", null, "颜色", -1)),
1358
+ l("input", {
1359
+ type: "color",
1360
+ value: ((b = e.style) == null ? void 0 : b.color) ?? "#111827",
1361
+ onInput: t[3] || (t[3] = //@ts-ignore
1362
+ (...p) => e.api.updateSelectedColor && e.api.updateSelectedColor(...p))
1363
+ }, null, 40, Vo)
1364
+ ])
1365
+ ]),
1366
+ l("div", Go, [
1367
+ l("label", zo, [
1368
+ t[13] || (t[13] = l("span", null, "水平对齐", -1)),
1369
+ l("select", {
1370
+ value: ((s = e.style) == null ? void 0 : s.align) ?? "left",
1371
+ onChange: t[4] || (t[4] = //@ts-ignore
1372
+ (...p) => e.api.updateSelectedAlign && e.api.updateSelectedAlign(...p))
1373
+ }, [...t[12] || (t[12] = [
1374
+ l("option", { value: "left" }, "左", -1),
1375
+ l("option", { value: "center" }, "居中", -1),
1376
+ l("option", { value: "right" }, "右", -1)
1377
+ ])], 40, Oo)
1378
+ ]),
1379
+ l("label", Wo, [
1380
+ t[15] || (t[15] = l("span", null, "垂直对齐", -1)),
1381
+ l("select", {
1382
+ value: ((f = e.style) == null ? void 0 : f.verticalAlign) ?? "middle",
1383
+ onChange: t[5] || (t[5] = //@ts-ignore
1384
+ (...p) => e.api.updateSelectedVerticalAlign && e.api.updateSelectedVerticalAlign(...p))
1385
+ }, [...t[14] || (t[14] = [
1386
+ l("option", { value: "top" }, "顶部", -1),
1387
+ l("option", { value: "middle" }, "居中", -1),
1388
+ l("option", { value: "bottom" }, "底部", -1)
1389
+ ])], 40, Uo)
1390
+ ]),
1391
+ l("label", jo, [
1392
+ t[16] || (t[16] = l("span", null, "字体", -1)),
1393
+ l("input", {
1394
+ value: ((v = e.style) == null ? void 0 : v.fontFamily) ?? "",
1395
+ onInput: t[6] || (t[6] = //@ts-ignore
1396
+ (...p) => e.api.updateSelectedFontFamily && e.api.updateSelectedFontFamily(...p))
1397
+ }, null, 40, Yo)
1398
+ ])
1399
+ ])
1400
+ ], 64);
1401
+ };
1402
+ }
1403
+ }), Jo = { class: "v2-control v2-control--full" }, Ko = ["value"], qo = /* @__PURE__ */ X({
1404
+ __name: "TextInspector",
1405
+ props: {
1406
+ node: {},
1407
+ api: {}
1408
+ },
1409
+ setup(e) {
1410
+ return (u, t) => ($(), I(_, null, [
1411
+ l("label", Jo, [
1412
+ t[1] || (t[1] = l("span", null, "文本内容", -1)),
1413
+ l("textarea", {
1414
+ class: "v2-textarea",
1415
+ rows: "3",
1416
+ value: e.node.text,
1417
+ onInput: t[0] || (t[0] = //@ts-ignore
1418
+ (...a) => e.api.updateSelectedText && e.api.updateSelectedText(...a))
1419
+ }, null, 40, Ko)
1420
+ ]),
1421
+ le(il, {
1422
+ style: Pe(e.node.style),
1423
+ api: e.api
1424
+ }, null, 8, ["style", "api"])
1425
+ ], 64));
1426
+ }
1427
+ }), Xo = { class: "v2-control" }, Zo = ["value"], Qo = { class: "v2-grid-dimensions" }, _o = { class: "v2-control" }, ei = ["value"], ti = { class: "v2-control" }, li = ["value"], ai = { class: "v2-control" }, ni = ["value"], oi = {
1428
+ key: 0,
1429
+ class: "v2-control v2-control--full"
1430
+ }, ii = ["value"], di = {
1431
+ key: 1,
1432
+ class: "v2-hint"
1433
+ }, ui = { class: "v2-control v2-control--full" }, ri = ["value"], si = { class: "v2-grid-dimensions" }, vi = { class: "v2-control v2-control--full" }, ci = ["value"], pi = { class: "v2-control" }, fi = ["checked"], gi = /* @__PURE__ */ X({
1434
+ __name: "FieldPInspector",
1435
+ props: {
1436
+ node: {},
1437
+ api: {}
1438
+ },
1439
+ setup(e) {
1440
+ return (u, t) => {
1441
+ var a;
1442
+ return $(), I(_, null, [
1443
+ l("label", Xo, [
1444
+ t[8] || (t[8] = l("span", null, "字段名", -1)),
1445
+ l("input", {
1446
+ value: e.node.field,
1447
+ onInput: t[0] || (t[0] = //@ts-ignore
1448
+ (...n) => e.api.updateSelectedField && e.api.updateSelectedField(...n))
1449
+ }, null, 40, Zo)
1450
+ ]),
1451
+ l("div", Qo, [
1452
+ l("label", _o, [
1453
+ t[9] || (t[9] = l("span", null, "前标签(可选)", -1)),
1454
+ l("input", {
1455
+ value: e.node.prefix ?? "",
1456
+ onInput: t[1] || (t[1] = //@ts-ignore
1457
+ (...n) => e.api.updateSelectedPrefix && e.api.updateSelectedPrefix(...n))
1458
+ }, null, 40, ei)
1459
+ ]),
1460
+ l("label", ti, [
1461
+ t[10] || (t[10] = l("span", null, "后标签(可选)", -1)),
1462
+ l("input", {
1463
+ value: e.node.suffix ?? "",
1464
+ onInput: t[2] || (t[2] = //@ts-ignore
1465
+ (...n) => e.api.updateSelectedSuffix && e.api.updateSelectedSuffix(...n))
1466
+ }, null, 40, li)
1467
+ ])
1468
+ ]),
1469
+ l("label", ai, [
1470
+ t[12] || (t[12] = l("span", null, "输入方式", -1)),
1471
+ l("select", {
1472
+ value: e.node.action ?? "text",
1473
+ onChange: t[3] || (t[3] = //@ts-ignore
1474
+ (...n) => e.api.updateSelectedAction && e.api.updateSelectedAction(...n))
1475
+ }, [...t[11] || (t[11] = [
1476
+ l("option", { value: "text" }, "无(纯文本输入)", -1),
1477
+ l("option", { value: "date" }, "日期选择器", -1),
1478
+ l("option", { value: "signature" }, "签名板", -1),
1479
+ l("option", { value: "upload" }, "文件上传", -1)
1480
+ ])], 40, ni)
1481
+ ]),
1482
+ e.node.action === "date" ? ($(), I("label", oi, [
1483
+ t[13] || (t[13] = l("span", null, "日期格式", -1)),
1484
+ l("input", {
1485
+ type: "text",
1486
+ placeholder: "如 {YYYY}年{MM}月{DD} {hh}时{mm}分{ss}秒",
1487
+ value: ((a = e.node.actionParams) == null ? void 0 : a.format) ?? "",
1488
+ onChange: t[4] || (t[4] = //@ts-ignore
1489
+ (...n) => e.api.updateSelectedDateFormat && e.api.updateSelectedDateFormat(...n))
1490
+ }, null, 40, ii)
1491
+ ])) : K("", !0),
1492
+ e.node.action === "date" ? ($(), I("p", di, " 留空则存原生日期(YYYY-MM-DD);配置后填写值按格式显示,如 " + D("{") + "YYYY" + D("}") + "年" + D("{") + "MM" + D("}") + "月" + D("{") + "DD" + D("}") + "。 ")) : K("", !0),
1493
+ le(il, {
1494
+ style: Pe(e.node.style),
1495
+ api: e.api
1496
+ }, null, 8, ["style", "api"]),
1497
+ l("label", ui, [
1498
+ t[14] || (t[14] = l("span", null, "默认内容", -1)),
1499
+ l("textarea", {
1500
+ class: "v2-textarea",
1501
+ rows: "3",
1502
+ "data-field-default": "true",
1503
+ value: e.node.default ?? "",
1504
+ onInput: t[5] || (t[5] = //@ts-ignore
1505
+ (...n) => e.api.updateSelectedDefault && e.api.updateSelectedDefault(...n))
1506
+ }, null, 40, ri)
1507
+ ]),
1508
+ l("div", si, [
1509
+ l("label", vi, [
1510
+ t[15] || (t[15] = l("span", null, "输入区宽度", -1)),
1511
+ l("input", {
1512
+ "data-field-width": "true",
1513
+ placeholder: "如 30mm、50%,留空不限",
1514
+ value: e.node.width ?? "",
1515
+ onInput: t[6] || (t[6] = //@ts-ignore
1516
+ (...n) => e.api.updateSelectedWidth && e.api.updateSelectedWidth(...n))
1517
+ }, null, 40, ci)
1518
+ ]),
1519
+ l("label", pi, [
1520
+ t[16] || (t[16] = l("span", null, "内部边框", -1)),
1521
+ l("input", {
1522
+ type: "checkbox",
1523
+ "data-field-inner-border": "true",
1524
+ checked: e.node.innerBorder ?? !1,
1525
+ onChange: t[7] || (t[7] = //@ts-ignore
1526
+ (...n) => e.api.updateSelectedInnerBorder && e.api.updateSelectedInnerBorder(...n))
1527
+ }, null, 40, fi)
1528
+ ])
1529
+ ])
1530
+ ], 64);
1531
+ };
1532
+ }
1533
+ }), mi = { class: "v2-control v2-control--full" }, bi = ["value"], hi = { class: "v2-control v2-control--full" }, yi = ["value"], Si = /* @__PURE__ */ X({
1534
+ __name: "HtmlInspector",
1535
+ props: {
1536
+ node: {},
1537
+ api: {}
1538
+ },
1539
+ setup(e) {
1540
+ return (u, t) => ($(), I(_, null, [
1541
+ l("label", mi, [
1542
+ t[2] || (t[2] = l("span", null, "HTML 片段(不含脚本)", -1)),
1543
+ l("textarea", {
1544
+ class: "v2-textarea",
1545
+ rows: "6",
1546
+ value: e.node.html,
1547
+ onInput: t[0] || (t[0] = //@ts-ignore
1548
+ (...a) => e.api.updateSelectedHtml && e.api.updateSelectedHtml(...a))
1549
+ }, null, 40, bi)
1550
+ ]),
1551
+ l("label", hi, [
1552
+ t[3] || (t[3] = l("span", null, "样式代码(仅模块内生效)", -1)),
1553
+ l("textarea", {
1554
+ class: "v2-textarea",
1555
+ rows: "4",
1556
+ value: e.node.css ?? "",
1557
+ onInput: t[1] || (t[1] = //@ts-ignore
1558
+ (...a) => e.api.updateSelectedCss && e.api.updateSelectedCss(...a))
1559
+ }, null, 40, yi)
1560
+ ]),
1561
+ t[4] || (t[4] = l("p", { class: "v2-sidebar__hint" }, " 支持 {{ 字段 }} 占位符,展示时自动替换为填写内容;样式仅在模块内部生效,不影响整张表单。 ", -1))
1562
+ ], 64));
1563
+ }
1564
+ }), $i = { class: "v2-grid-dimensions" }, Ci = { class: "v2-control v2-control--full" }, wi = ["value"], Ii = { class: "v2-control v2-control--full" }, xi = ["value"], Ti = { class: "v2-grid-dimensions" }, ki = { class: "v2-control" }, Fi = ["value"], Di = { class: "v2-control" }, Ni = ["value"], Pi = { class: "v2-control" }, Ei = ["value"], Ai = {
1565
+ key: 0,
1566
+ class: "v2-sidebar__hint"
1567
+ }, Hi = /* @__PURE__ */ X({
1568
+ __name: "ImageInspector",
1569
+ props: {
1570
+ node: {},
1571
+ api: {}
1572
+ },
1573
+ setup(e) {
1574
+ return (u, t) => ($(), I(_, null, [
1575
+ l("div", $i, [
1576
+ l("label", Ci, [
1577
+ t[5] || (t[5] = l("span", null, "字段名", -1)),
1578
+ l("input", {
1579
+ value: e.node.field ?? "",
1580
+ onInput: t[0] || (t[0] = //@ts-ignore
1581
+ (...a) => e.api.updateSelectedImageField && e.api.updateSelectedImageField(...a))
1582
+ }, null, 40, wi)
1583
+ ]),
1584
+ l("label", Ii, [
1585
+ t[6] || (t[6] = l("span", null, "图片地址", -1)),
1586
+ l("input", {
1587
+ value: e.node.src ?? "",
1588
+ placeholder: "https:// 链接或 Base64",
1589
+ onInput: t[1] || (t[1] = //@ts-ignore
1590
+ (...a) => e.api.updateSelectedImageSrc && e.api.updateSelectedImageSrc(...a))
1591
+ }, null, 40, xi)
1592
+ ])
1593
+ ]),
1594
+ l("div", Ti, [
1595
+ l("label", ki, [
1596
+ t[7] || (t[7] = l("span", null, "宽(mm)", -1)),
1597
+ l("input", {
1598
+ type: "number",
1599
+ min: "0",
1600
+ value: e.node.width ?? "",
1601
+ onChange: t[2] || (t[2] = (a) => e.api.updateSelectedImageSize("width", a))
1602
+ }, null, 40, Fi)
1603
+ ]),
1604
+ l("label", Di, [
1605
+ t[8] || (t[8] = l("span", null, "高(mm)", -1)),
1606
+ l("input", {
1607
+ type: "number",
1608
+ min: "0",
1609
+ value: e.node.height ?? "",
1610
+ onChange: t[3] || (t[3] = (a) => e.api.updateSelectedImageSize("height", a))
1611
+ }, null, 40, Ni)
1612
+ ])
1613
+ ]),
1614
+ l("label", Pi, [
1615
+ t[10] || (t[10] = l("span", null, "填充方式", -1)),
1616
+ l("select", {
1617
+ value: e.node.objectFit ?? "contain",
1618
+ onChange: t[4] || (t[4] = //@ts-ignore
1619
+ (...a) => e.api.updateSelectedImageFit && e.api.updateSelectedImageFit(...a))
1620
+ }, [...t[9] || (t[9] = [
1621
+ l("option", { value: "contain" }, "等比完整显示", -1),
1622
+ l("option", { value: "cover" }, "裁剪填满", -1),
1623
+ l("option", { value: "fill" }, "拉伸填满", -1)
1624
+ ])], 40, Ei)
1625
+ ]),
1626
+ !e.node.src && !e.node.field ? ($(), I("p", Ai, [...t[11] || (t[11] = [
1627
+ ge(" 还没配置图片地址:画布上会显示占位框方便编辑,", -1),
1628
+ l("strong", null, "打印时不占位置", -1),
1629
+ ge("。 ", -1)
1630
+ ])])) : K("", !0)
1631
+ ], 64));
1632
+ }
1633
+ }), Ri = { class: "v2-grid-dimensions" }, Li = { class: "v2-control" }, Mi = ["value"], Bi = { class: "v2-control" }, Vi = ["value"], Gi = { class: "v2-style-grid" }, zi = { class: "v2-control v2-control--inline" }, Oi = ["value"], Wi = { class: "v2-control v2-control--inline" }, Ui = ["value"], ji = { class: "v2-grid-dimensions" }, Yi = { class: "v2-control" }, Ji = ["value"], Ki = { class: "v2-col-table" }, qi = ["value", "onInput"], Xi = ["value", "onInput"], Zi = ["disabled", "title", "onClick"], Qi = /* @__PURE__ */ X({
1634
+ __name: "TableInspector",
1635
+ props: {
1636
+ node: {},
1637
+ api: {}
1638
+ },
1639
+ setup(e) {
1640
+ return (u, t) => {
1641
+ var a, n, r;
1642
+ return $(), I(_, null, [
1643
+ l("div", Ri, [
1644
+ l("label", Li, [
1645
+ t[6] || (t[6] = l("span", null, "最小行数", -1)),
1646
+ l("input", {
1647
+ type: "number",
1648
+ min: "0",
1649
+ step: "1",
1650
+ value: e.node.minRows,
1651
+ onChange: t[0] || (t[0] = //@ts-ignore
1652
+ (...b) => e.api.updateTableRows && e.api.updateTableRows(...b))
1653
+ }, null, 40, Mi)
1654
+ ]),
1655
+ l("label", Bi, [
1656
+ t[8] || (t[8] = l("span", null, "边框", -1)),
1657
+ l("select", {
1658
+ value: e.node.border ?? "all",
1659
+ onChange: t[1] || (t[1] = //@ts-ignore
1660
+ (...b) => e.api.updateTableBorder && e.api.updateTableBorder(...b))
1661
+ }, [...t[7] || (t[7] = [
1662
+ l("option", { value: "all" }, "外框 + 内部", -1),
1663
+ l("option", { value: "outer" }, "仅外框", -1),
1664
+ l("option", { value: "inner" }, "仅内部", -1),
1665
+ l("option", { value: "none" }, "无边框", -1)
1666
+ ])], 40, Vi)
1667
+ ])
1668
+ ]),
1669
+ t[15] || (t[15] = l("div", { class: "v2-sidebar__subheading" }, "表头样式", -1)),
1670
+ l("div", Gi, [
1671
+ l("label", zi, [
1672
+ t[9] || (t[9] = l("span", null, "字号(px)", -1)),
1673
+ l("input", {
1674
+ type: "number",
1675
+ min: "1",
1676
+ step: "1",
1677
+ value: ((a = e.node.headerStyle) == null ? void 0 : a.fontSize) ?? 16,
1678
+ onChange: t[2] || (t[2] = //@ts-ignore
1679
+ (...b) => e.api.updateTableHeaderFontSize && e.api.updateTableHeaderFontSize(...b))
1680
+ }, null, 40, Oi)
1681
+ ]),
1682
+ l("label", Wi, [
1683
+ t[11] || (t[11] = l("span", null, "粗细", -1)),
1684
+ l("select", {
1685
+ value: ((n = e.node.headerStyle) == null ? void 0 : n.fontWeight) ?? "normal",
1686
+ onChange: t[3] || (t[3] = //@ts-ignore
1687
+ (...b) => e.api.updateTableHeaderFontWeight && e.api.updateTableHeaderFontWeight(...b))
1688
+ }, [...t[10] || (t[10] = [
1689
+ l("option", { value: "normal" }, "常规", -1),
1690
+ l("option", { value: "bold" }, "加粗", -1)
1691
+ ])], 40, Ui)
1692
+ ])
1693
+ ]),
1694
+ l("div", ji, [
1695
+ l("label", Yi, [
1696
+ t[13] || (t[13] = l("span", null, "水平对齐", -1)),
1697
+ l("select", {
1698
+ value: ((r = e.node.headerStyle) == null ? void 0 : r.align) ?? "left",
1699
+ onChange: t[4] || (t[4] = //@ts-ignore
1700
+ (...b) => e.api.updateTableHeaderAlign && e.api.updateTableHeaderAlign(...b))
1701
+ }, [...t[12] || (t[12] = [
1702
+ l("option", { value: "left" }, "左", -1),
1703
+ l("option", { value: "center" }, "居中", -1),
1704
+ l("option", { value: "right" }, "右", -1)
1705
+ ])], 40, Ji)
1706
+ ])
1707
+ ]),
1708
+ t[16] || (t[16] = l("div", { class: "v2-sidebar__subheading" }, "列配置", -1)),
1709
+ l("div", Ki, [
1710
+ t[14] || (t[14] = l("div", { class: "v2-col-table__row v2-col-table__head" }, [
1711
+ l("span", { class: "v2-col-table__th" }, "标题"),
1712
+ l("span", { class: "v2-col-table__th" }, "字段"),
1713
+ l("span", { class: "v2-col-table__th v2-col-table__th--action" })
1714
+ ], -1)),
1715
+ ($(!0), I(_, null, ye(e.node.columns, (b) => ($(), I("div", {
1716
+ key: b.key,
1717
+ class: "v2-col-table__row"
1718
+ }, [
1719
+ l("input", {
1720
+ class: "v2-col-table__input",
1721
+ value: b.title,
1722
+ placeholder: "列标题",
1723
+ onInput: (s) => e.api.updateTableColumn(b.key, "title", s)
1724
+ }, null, 40, qi),
1725
+ l("input", {
1726
+ class: "v2-col-table__input v2-col-table__input--mono",
1727
+ value: b.key,
1728
+ placeholder: "字段名",
1729
+ onInput: (s) => e.api.renameTableColumnKey(b.key, s)
1730
+ }, null, 40, Xi),
1731
+ l("button", {
1732
+ class: "v2-inspector__delete v2-inspector__delete--small",
1733
+ type: "button",
1734
+ disabled: e.node.columns.length <= 1,
1735
+ title: `删除列 ${b.key}`,
1736
+ onClick: (s) => e.api.removeTableColumn(b.key)
1737
+ }, " ✕ ", 8, Zi)
1738
+ ]))), 128))
1739
+ ]),
1740
+ l("button", {
1741
+ class: "v2-toolbar__button v2-add-col",
1742
+ type: "button",
1743
+ onClick: t[5] || (t[5] = //@ts-ignore
1744
+ (...b) => e.api.addTableColumn && e.api.addTableColumn(...b))
1745
+ }, " + 添加列 ")
1746
+ ], 64);
1747
+ };
1748
+ }
1749
+ }), _i = /* @__PURE__ */ ie(Qi, [["__scopeId", "data-v-6aacc8cd"]]), ed = ["onClick"], td = /* @__PURE__ */ X({
1750
+ __name: "IssuesPanel",
1751
+ props: {
1752
+ issues: {}
1753
+ },
1754
+ emits: ["select"],
1755
+ setup(e, { emit: u }) {
1756
+ const t = u;
1757
+ return (a, n) => ($(), I("div", {
1758
+ class: me(["v2-issues", { "v2-issues--ok": e.issues.length === 0 }])
1759
+ }, [
1760
+ l("strong", null, D(e.issues.length === 0 ? "检查通过" : "发现 " + e.issues.length + " 个问题"), 1),
1761
+ ($(!0), I(_, null, ye(e.issues, (r) => ($(), I("div", {
1762
+ key: r.code + "-" + (r.nodeId || "schema"),
1763
+ class: "v2-issue v2-issue--selectable",
1764
+ onClick: (b) => t("select", r)
1765
+ }, D(r.message), 9, ed))), 128))
1766
+ ], 2));
1767
+ }
1768
+ }), ld = /* @__PURE__ */ ie(td, [["__scopeId", "data-v-1f696812"]]), ad = { class: "v2-sidebar v2-sidebar--right" }, nd = { class: "v2-inspector-row" }, od = { class: "v2-inspector-row v2-inspector-row--head" }, id = /* @__PURE__ */ X({
1769
+ __name: "InspectorPanel",
1770
+ props: /* @__PURE__ */ qe({
1771
+ node: { default: null },
1772
+ nodeId: { default: null },
1773
+ nodeType: {},
1774
+ cellContext: {},
1775
+ cellBox: {},
1776
+ issues: {},
1777
+ api: {},
1778
+ paperSize: {},
1779
+ baseRowHeight: {},
1780
+ paperMarginTop: {},
1781
+ paperMarginRight: {},
1782
+ paperMarginBottom: {},
1783
+ paperMarginLeft: {},
1784
+ header: {},
1785
+ footer: {}
1786
+ }, {
1787
+ paginate: { type: Boolean, required: !0 },
1788
+ paginateModifiers: {}
1789
+ }),
1790
+ emits: /* @__PURE__ */ qe(["selectIssue"], ["update:paginate"]),
1791
+ setup(e, { emit: u }) {
1792
+ const t = e, a = P(() => {
1793
+ const s = t.node;
1794
+ return s && s.type === "page" ? {
1795
+ top: s.margin.top ?? 12,
1796
+ right: s.margin.right ?? 12,
1797
+ bottom: s.margin.bottom ?? 12,
1798
+ left: s.margin.left ?? 12
1799
+ } : { top: 12, right: 12, bottom: 12, left: 12 };
1800
+ }), n = _t(e, "paginate"), r = u, b = P(() => {
1801
+ const s = t.node;
1802
+ if (!s) return "未选择";
1803
+ if (s.type === "grid-cell" && t.cellContext) {
1804
+ const { rowIndex: f, columnIndex: v } = t.cellContext;
1805
+ if (f >= 0) return `格子 ${f + 1}-${v + 1}`;
1806
+ }
1807
+ return Ne(s);
1808
+ });
1809
+ return (s, f) => {
1810
+ var v, p, g, L, A, H, U, q;
1811
+ return $(), I("aside", ad, [
1812
+ l("div", nd, [
1813
+ f[2] || (f[2] = l("span", null, "组件类型", -1)),
1814
+ l("strong", null, D(e.nodeType), 1)
1815
+ ]),
1816
+ l("div", od, [
1817
+ f[3] || (f[3] = l("span", null, "当前选中", -1)),
1818
+ l("code", null, D(b.value), 1)
1819
+ ]),
1820
+ ((v = e.node) == null ? void 0 : v.type) === "page" ? ($(), oe(qn, {
1821
+ key: 0,
1822
+ paginate: n.value,
1823
+ "onUpdate:paginate": f[0] || (f[0] = (j) => n.value = j),
1824
+ "paper-size": e.paperSize,
1825
+ "base-row-height": e.baseRowHeight,
1826
+ "paper-margin-top": a.value.top,
1827
+ "paper-margin-right": a.value.right,
1828
+ "paper-margin-bottom": a.value.bottom,
1829
+ "paper-margin-left": a.value.left,
1830
+ header: e.header,
1831
+ footer: e.footer,
1832
+ api: e.api
1833
+ }, null, 8, ["paginate", "paper-size", "base-row-height", "paper-margin-top", "paper-margin-right", "paper-margin-bottom", "paper-margin-left", "header", "footer", "api"])) : ((p = e.node) == null ? void 0 : p.type) === "grid" ? ($(), oe(go, {
1834
+ key: 1,
1835
+ node: e.node,
1836
+ api: e.api
1837
+ }, null, 8, ["node", "api"])) : ((g = e.node) == null ? void 0 : g.type) === "text" ? ($(), oe(qo, {
1838
+ key: 2,
1839
+ node: e.node,
1840
+ api: e.api
1841
+ }, null, 8, ["node", "api"])) : ((L = e.node) == null ? void 0 : L.type) === "p" ? ($(), oe(gi, {
1842
+ key: 3,
1843
+ node: e.node,
1844
+ api: e.api
1845
+ }, null, 8, ["node", "api"])) : ((A = e.node) == null ? void 0 : A.type) === "grid-cell" ? ($(), oe(No, {
1846
+ key: 4,
1847
+ node: e.node,
1848
+ "cell-context": e.cellContext,
1849
+ "cell-box": e.cellBox,
1850
+ api: e.api
1851
+ }, null, 8, ["node", "cell-context", "cell-box", "api"])) : ((H = e.node) == null ? void 0 : H.type) === "html" ? ($(), oe(Si, {
1852
+ key: 5,
1853
+ node: e.node,
1854
+ api: e.api
1855
+ }, null, 8, ["node", "api"])) : ((U = e.node) == null ? void 0 : U.type) === "image" ? ($(), oe(Hi, {
1856
+ key: 6,
1857
+ node: e.node,
1858
+ api: e.api
1859
+ }, null, 8, ["node", "api"])) : ((q = e.node) == null ? void 0 : q.type) === "table" ? ($(), oe(_i, {
1860
+ key: 7,
1861
+ node: e.node,
1862
+ api: e.api
1863
+ }, null, 8, ["node", "api"])) : K("", !0),
1864
+ le(ld, {
1865
+ issues: e.issues,
1866
+ onSelect: f[1] || (f[1] = (j) => r("selectIssue", j))
1867
+ }, null, 8, ["issues"])
1868
+ ]);
1869
+ };
1870
+ }
1871
+ }), dd = /* @__PURE__ */ ie(id, [["__scopeId", "data-v-b0930d9c"]]), ud = {
1872
+ class: "v2-help__panel",
1873
+ role: "dialog",
1874
+ "aria-label": "操作指南"
1875
+ }, rd = { class: "v2-help__head" }, sd = /* @__PURE__ */ X({
1876
+ __name: "HelpPanel",
1877
+ props: {
1878
+ open: { type: Boolean }
1879
+ },
1880
+ emits: ["close"],
1881
+ setup(e, { emit: u }) {
1882
+ const t = e, a = u;
1883
+ function n(r) {
1884
+ r.key === "Escape" && a("close");
1885
+ }
1886
+ return ve(
1887
+ () => t.open,
1888
+ (r) => {
1889
+ r ? window.addEventListener("keydown", n) : window.removeEventListener("keydown", n);
1890
+ },
1891
+ // immediate:兼容「初始即 open」的消费方,否则首挂载时 Esc 监听永远挂不上。
1892
+ { immediate: !0 }
1893
+ ), tt(() => window.removeEventListener("keydown", n)), (r, b) => e.open ? ($(), I("div", {
1894
+ key: 0,
1895
+ class: "v2-help",
1896
+ onClick: b[1] || (b[1] = Qt((s) => a("close"), ["self"]))
1897
+ }, [
1898
+ l("div", ud, [
1899
+ l("header", rd, [
1900
+ b[2] || (b[2] = l("h2", null, "操作指南", -1)),
1901
+ l("button", {
1902
+ type: "button",
1903
+ class: "v2-help__close",
1904
+ title: "关闭帮助",
1905
+ onClick: b[0] || (b[0] = (s) => a("close"))
1906
+ }, " ✕ ")
1907
+ ]),
1908
+ b[3] || (b[3] = Il('<div class="v2-help__body" data-v-3f47c5df><h3 data-v-3f47c5df>这个工具是做什么的</h3><p data-v-3f47c5df> 用来<b data-v-3f47c5df>设计固定版式的工作票表单</b>:设计好一次「模板」,以后每次作业直接填写、打印不同的票。 </p><ul data-v-3f47c5df><li data-v-3f47c5df><b data-v-3f47c5df>模板</b>=空的表单版式(有哪些格子、哪些输入框、标题写什么)。 </li><li data-v-3f47c5df><b data-v-3f47c5df>填写数据</b>=某次作业填进输入框的具体内容(如「工作负责人:张三」)。 </li></ul><h3 data-v-3f47c5df>界面五大区域</h3><table data-v-3f47c5df><tbody data-v-3f47c5df><tr data-v-3f47c5df><th data-v-3f47c5df>顶部工具栏</th><td data-v-3f47c5df>新建、保存、预览、打印、导入导出</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>左侧栏</th><td data-v-3f47c5df>组件「零件库」+ 整张表的结构树</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>中间画布</th><td data-v-3f47c5df> 纸张,在这里摆组件、看效果. <strong data-v-3f47c5df>按住空格键,拖拽可平移纸张</strong></td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>右侧属性面板</th><td data-v-3f47c5df>选中某个东西后,在这里改它的设置</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>底部状态栏</th><td data-v-3f47c5df>共几页、有没有问题、会打印几张</td></tr></tbody></table><h3 data-v-3f47c5df>两个模式:设计 / 预览</h3><ul data-v-3f47c5df><li data-v-3f47c5df><b data-v-3f47c5df>设计态</b>(默认):搭模板、改结构、调属性,可随意增删组件、拖动位置。 </li><li data-v-3f47c5df><b data-v-3f47c5df>预览态</b>:点「预览」进入(再点变「退出预览」),输入框<b data-v-3f47c5df>直接打字填写</b>,检查版式。刚进入时输入框是<b data-v-3f47c5df>空的</b>,内容靠填写或「导入数据 / 读取数据」载入。 </li></ul><p class="v2-help__tip" data-v-3f47c5df> 记不住就记住一句:<b data-v-3f47c5df>设计时搭架子,预览时填内容。</b></p><h3 data-v-3f47c5df>模板 与 填写数据(一定要分清)</h3><ul data-v-3f47c5df><li data-v-3f47c5df> 模板 → 工具栏「模板」组的 <b data-v-3f47c5df>保存模板 / 读取模板 / 导出文件 / 导入文件</b>。 </li><li data-v-3f47c5df> 填写数据 → 工具栏「填充数据」组的 <b data-v-3f47c5df>保存数据 / 读取数据 / 导入数据 / 导出数据</b>(这组不限预览态,随时都能点)。 </li></ul><p class="v2-help__tip" data-v-3f47c5df><b data-v-3f47c5df>导出数据 / 保存数据</b>随时可点:它们扫一遍画布上的输入框,把「字段 → 值」 采集出来(没配输入框时就是空对象)。导出<b data-v-3f47c5df>文件</b>与导出<b data-v-3f47c5df>数据</b>还会把同一份 JSON 打印到浏览器控制台,方便对接系统时直接复制。 </p><h3 data-v-3f47c5df>从零设计一张票(标准流程)</h3><ol data-v-3f47c5df><li data-v-3f47c5df><b data-v-3f47c5df>新建空白</b>:得到一张空纸。</li><li data-v-3f47c5df><b data-v-3f47c5df>搭大框</b>:从左侧「布局组件」拖一个<b data-v-3f47c5df>网格</b>到画布(按行列分成若干<b data-v-3f47c5df>格子</b>)。 </li><li data-v-3f47c5df><b data-v-3f47c5df>放内容</b>:把 文本 / 输入框 / 图片 / HTML 模块 拖进某个格子(或点组件按钮放进当前选中的格子)。 </li><li data-v-3f47c5df><b data-v-3f47c5df>改属性</b>:点画布上的组件,右侧面板修改设置。</li><li data-v-3f47c5df><b data-v-3f47c5df>保存 / 导出</b>:本机接着改用「保存模板 / 读取模板」;备份或发人用「导出文件 / 导入文件」(.json)。 </li></ol><p data-v-3f47c5df>左上角「● 未保存 / 已保存」:改了没保存会提示,关页面前记得保存。</p><h3 data-v-3f47c5df>组件说明(左侧零件库)</h3><table data-v-3f47c5df><tbody data-v-3f47c5df><tr data-v-3f47c5df><th data-v-3f47c5df>文本</th><td data-v-3f47c5df>固定不变的文字,不能填。用于标题、栏目标题、说明文字。</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>输入框</th><td data-v-3f47c5df>可填写的字段。凡作业时要手写的地方。</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>图片</th><td data-v-3f47c5df>图片占位框。用于盖章区、示意图、签名扫描件。</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>HTML 模块</th><td data-v-3f47c5df>自由排版的自定义块。不懂 HTML 不用管它。</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>网格</th><td data-v-3f47c5df>按行列划分的布局区,把票分成若干区块。</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>表格</th><td data-v-3f47c5df>多行多列的表。用于设备清单、措施列表等。</td></tr></tbody></table><p data-v-3f47c5df><b data-v-3f47c5df>右侧属性面板</b>(选中后显示):页面=纸张/边距/页眉页脚/分页;网格=列数/边框/间距/行数;格子=撑满/内边距/对齐;文本=文字/字号/加粗/对齐;输入框=字段名/输入方式/宽度/默认值/内边框;图片=地址/填充方式/尺寸;表格=行列数/边框。顶部会显示当前选中(如「格子 1-2」)。 </p><h3 data-v-3f47c5df>结构树(左侧下半部分)</h3><ul data-v-3f47c5df><li data-v-3f47c5df>把整张表从大到小列出:页面 → 网格 → 格子 → 组件。</li><li data-v-3f47c5df> 点树里的项=选中它(比在画布上找小字方便);反向也成立:点画布上的组件,树里会同步高亮并滚动到 它,折叠着的层级会自动展开。 </li><li data-v-3f47c5df> 「删除」删掉选中的组件(页面和格子不能删);「折叠全部 / 展开全部」收起或展开整棵树。 </li></ul><h3 data-v-3f47c5df>填写与打印</h3><ul data-v-3f47c5df><li data-v-3f47c5df>点「预览」→ 在输入框直接打字 → 「保存数据 / 导出数据」留存。</li><li data-v-3f47c5df> 「打印」在预览态或设计态都能点,<b data-v-3f47c5df>自动按纸张分页</b>,方向由纸张尺寸决定(A4 竖打、A3 横打)。 </li><li data-v-3f47c5df> 打出来的<b data-v-3f47c5df>只有票面本身</b>:系统菜单、工具栏、页面其他区域都不会跟着打出来。 </li></ul><p data-v-3f47c5df> 没配置地址的图片:屏幕显示占位灰框方便选中编辑,<b data-v-3f47c5df>打印时不占位置</b>。 </p><p data-v-3f47c5df> 输入框默认的下划线(表示「这里可填写」)<b data-v-3f47c5df>打印时不显示</b>;只有勾选了「显示内部边框」的字段,逐行实线边框才会打印出来。 </p><h3 data-v-3f47c5df>快捷键(设计时可用)</h3><p data-v-3f47c5df>在输入框里打字时,快捷键让位给输入,不会触发下面的操作。</p><table data-v-3f47c5df><tbody data-v-3f47c5df><tr data-v-3f47c5df><th data-v-3f47c5df>Space 空格键</th><td data-v-3f47c5df>按住,拖拽可平移纸张</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>Ctrl/Cmd + Z</th><td data-v-3f47c5df>撤销</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>Ctrl/Cmd + Shift + Z 或 Ctrl/Cmd + Y</th><td data-v-3f47c5df>重做</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>Ctrl/Cmd + S</th><td data-v-3f47c5df>保存模板(本机)</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>Ctrl/Cmd + C / X / V</th><td data-v-3f47c5df>复制 / 剪切 / 粘贴选中的组件</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>Ctrl/Cmd + D</th><td data-v-3f47c5df>原地复制一份选中的组件</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>Delete / Backspace</th><td data-v-3f47c5df>删除选中的组件(仅设计态)</td></tr></tbody></table><h3 data-v-3f47c5df>常见问题</h3><p data-v-3f47c5df><b data-v-3f47c5df>拖了组件但放不进去?</b>先点一下网格里的空位选中某个格子,再拖或点组件按钮。组件必须落在格子里。 </p><p data-v-3f47c5df><b data-v-3f47c5df>预览里能改结构吗?</b>不能。点「退出预览」回设计态再改。</p><p data-v-3f47c5df><b data-v-3f47c5df>导出的文件是什么?</b>模板和填写数据都是 .json 文本备份,可导入还原、发给同事。 </p><p data-v-3f47c5df><b data-v-3f47c5df>怎么知道有没有排版问题?</b>看底部状态栏「待处理问题」数量,点右侧面板里的提示可跳到对应位置。 </p><h3 data-v-3f47c5df>术语速查</h3><table data-v-3f47c5df><tbody data-v-3f47c5df><tr data-v-3f47c5df><th data-v-3f47c5df>模板</th><td data-v-3f47c5df>空表单版式(设计一次,反复用)</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>填写数据</th><td data-v-3f47c5df>某次作业填进表里的具体内容</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>网格</th><td data-v-3f47c5df>按行列划分的布局容器</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>格子</th><td data-v-3f47c5df>网格里的小格,组件就放在里面</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>输入框 / 文本</th><td data-v-3f47c5df>可填写的字段 / 固定不可填的文字</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>设计态 / 预览态</th><td data-v-3f47c5df>搭模板改结构 / 像最终用户一样填写检查</td></tr><tr data-v-3f47c5df><th data-v-3f47c5df>分页</th><td data-v-3f47c5df>一页放不下时自动分到下一页</td></tr></tbody></table></div>', 1))
1909
+ ])
1910
+ ])) : K("", !0);
1911
+ }
1912
+ }), vd = /* @__PURE__ */ ie(sd, [["__scopeId", "data-v-3f47c5df"]]), cd = "[ticket-designer] schema 配置 JSON", Kt = "ticket-designer-schema-v2", pd = 100, fd = 800;
1913
+ function dl() {
1914
+ const e = Al(), u = _e();
1915
+ return tl(e, u);
1916
+ }
1917
+ function gd(e, u = {}) {
1918
+ const t = G(
1919
+ e ? JSON.parse(JSON.stringify(e)) : dl()
1920
+ ), a = G(!1), n = G([]), r = G([]), b = G(null);
1921
+ let s = "", f = 0;
1922
+ ve(
1923
+ t,
1924
+ () => {
1925
+ a.value = !0;
1926
+ },
1927
+ { flush: "sync" }
1928
+ );
1929
+ function v(k, Y) {
1930
+ const J = Date.now();
1931
+ Y && Y === s && J - f < fd ? t.value = k : (n.value.push(t.value), n.value.length > pd && n.value.shift(), r.value = [], t.value = k, s = Y ?? ""), f = J;
1932
+ }
1933
+ function p(k) {
1934
+ n.value = [], r.value = [], s = "", t.value = k, a.value = !1;
1935
+ }
1936
+ function g() {
1937
+ const k = n.value.pop();
1938
+ k && (r.value.push(t.value), t.value = k, s = "", a.value = !0);
1939
+ }
1940
+ function L() {
1941
+ const k = r.value.pop();
1942
+ k && (n.value.push(t.value), t.value = k, s = "", a.value = !0);
1943
+ }
1944
+ const A = P(() => n.value.length > 0), H = P(() => r.value.length > 0);
1945
+ function U() {
1946
+ try {
1947
+ localStorage.setItem(
1948
+ Kt,
1949
+ el(t.value, !0)
1950
+ ), a.value = !1;
1951
+ } catch (k) {
1952
+ alert(
1953
+ `保存失败:${k instanceof Error ? k.message : String(k)}`
1954
+ );
1955
+ }
1956
+ }
1957
+ function q() {
1958
+ var Y;
1959
+ const k = localStorage.getItem(Kt);
1960
+ if (!k) {
1961
+ alert("本地没有已保存的模板");
1962
+ return;
1963
+ }
1964
+ try {
1965
+ p(Qe(k)), (Y = u.onReset) == null || Y.call(u);
1966
+ } catch (J) {
1967
+ alert(
1968
+ `读取失败:${J instanceof Error ? J.message : String(J)}`
1969
+ );
1970
+ }
1971
+ }
1972
+ function j() {
1973
+ try {
1974
+ const k = ca(t.value);
1975
+ console.log(cd, k), al(ll(sa), k);
1976
+ } catch (k) {
1977
+ alert(
1978
+ `导出失败:${k instanceof Error ? k.message : String(k)}`
1979
+ );
1980
+ }
1981
+ }
1982
+ function te(k) {
1983
+ var w;
1984
+ const Y = k.target, J = (w = Y.files) == null ? void 0 : w[0];
1985
+ if (!J) return;
1986
+ const Z = new FileReader();
1987
+ Z.onload = () => {
1988
+ var y;
1989
+ try {
1990
+ p(Qe(String(Z.result))), (y = u.onReset) == null || y.call(u);
1991
+ } catch (c) {
1992
+ alert(
1993
+ `导入失败:${c instanceof Error ? c.message : String(c)}`
1994
+ );
1995
+ } finally {
1996
+ Y.value = "";
1997
+ }
1998
+ }, Z.onerror = () => {
1999
+ alert("文件读取失败"), Y.value = "";
2000
+ }, Z.readAsText(J);
2001
+ }
2002
+ function ee() {
2003
+ var k;
2004
+ (k = b.value) == null || k.click();
2005
+ }
2006
+ return {
2007
+ schema: t,
2008
+ dirty: a,
2009
+ canUndo: A,
2010
+ canRedo: H,
2011
+ fileInput: b,
2012
+ commit: v,
2013
+ resetHistory: p,
2014
+ undo: g,
2015
+ redo: L,
2016
+ saveToLocal: U,
2017
+ loadFromLocal: q,
2018
+ exportFile: j,
2019
+ importFile: te,
2020
+ triggerImport: ee
2021
+ };
2022
+ }
2023
+ function Je(e) {
2024
+ const u = e.trim();
2025
+ if (u === "") return;
2026
+ const t = Number(u);
2027
+ return Number.isFinite(t) ? Math.max(0, t) : void 0;
2028
+ }
2029
+ function md(e) {
2030
+ const { schema: u, commit: t } = e.document, {
2031
+ selectedNodeId: a,
2032
+ selectedNode: n,
2033
+ selectionPathIds: r,
2034
+ selectionPathIndex: b,
2035
+ nodeIndex: s,
2036
+ selectedCellContext: f,
2037
+ selectedOwnerCell: v,
2038
+ insertionSlot: p
2039
+ } = e.selection;
2040
+ function g(o) {
2041
+ return o === "text" ? Xl() : o === "field" ? Zl() : o === "table" ? Ql() : o === "html" ? _l() : o === "grid" ? _e() : ea();
2042
+ }
2043
+ function L() {
2044
+ if (!e.editable()) return;
2045
+ const o = _e();
2046
+ t(tl(u.value, o)), a.value = o.id, r.value = [u.value.pages[0].id, o.id], b.value = 1;
2047
+ }
2048
+ function A() {
2049
+ e.editable() && (p.value ? H("grid") : L());
2050
+ }
2051
+ function H(o) {
2052
+ if (!e.editable()) return;
2053
+ const i = p.value;
2054
+ if (!i) return;
2055
+ const d = g(o);
2056
+ t(be(u.value, i.id, d)), a.value = d.id;
2057
+ }
2058
+ function U() {
2059
+ var o, i;
2060
+ !a.value || ((o = n.value) == null ? void 0 : o.type) === "page" || ((i = n.value) == null ? void 0 : i.type) === "grid-cell" || (t(ql(u.value, a.value)), e.clearSelection());
2061
+ }
2062
+ let q = null, j = null;
2063
+ function te() {
2064
+ const o = n.value;
2065
+ return o && o.type !== "page" && o.type !== "grid-cell" ? o : null;
2066
+ }
2067
+ function ee(o) {
2068
+ var B;
2069
+ const i = n.value;
2070
+ if ((i == null ? void 0 : i.type) === "grid-cell") {
2071
+ t(be(u.value, i.id, o)), a.value = o.id;
2072
+ return;
2073
+ }
2074
+ const d = v.value;
2075
+ if (i && d) {
2076
+ const Q = d.children.findIndex((se) => se.id === a.value), ne = Q >= 0 ? Q + 1 : d.children.length, pe = be(u.value, d.id, o);
2077
+ t(Ut(pe, o.id, d.id, ne)), a.value = o.id;
2078
+ return;
2079
+ }
2080
+ const C = p.value;
2081
+ if (C && (C.type === "grid-cell" || C.type === "table-cell-template")) {
2082
+ t(be(u.value, C.id, o)), a.value = o.id;
2083
+ return;
2084
+ }
2085
+ if (j) {
2086
+ const Q = (B = s.value.get(j)) == null ? void 0 : B.node;
2087
+ if (Q && Q.type === "grid-cell") {
2088
+ t(be(u.value, Q.id, o)), a.value = o.id;
2089
+ return;
2090
+ }
2091
+ }
2092
+ }
2093
+ function k() {
2094
+ var i;
2095
+ if (!e.editable()) return;
2096
+ const o = te();
2097
+ o && (q = Fe(o), j = ((i = v.value) == null ? void 0 : i.id) ?? null);
2098
+ }
2099
+ function Y() {
2100
+ var i;
2101
+ if (!e.editable()) return;
2102
+ const o = te();
2103
+ o && (q = Fe(o), j = ((i = v.value) == null ? void 0 : i.id) ?? null, U());
2104
+ }
2105
+ function J() {
2106
+ e.editable() && q && ee(Fe(q));
2107
+ }
2108
+ function Z() {
2109
+ if (!e.editable()) return;
2110
+ const o = te();
2111
+ o && ee(Fe(o));
2112
+ }
2113
+ function w() {
2114
+ var B;
2115
+ const o = a.value, i = f.value;
2116
+ if (!o || !i || !i.hasNextSibling) return;
2117
+ const d = (B = s.value.get(o)) == null ? void 0 : B.parent;
2118
+ if (!d) return;
2119
+ const C = d.cells[i.columnIndex + 1].id;
2120
+ t(Kl(u.value, o, C), `merge:${o}`), a.value = o;
2121
+ }
2122
+ function y() {
2123
+ const o = a.value, i = f.value;
2124
+ !o || !i || !i.canSplit || (t(Jl(u.value, o), `split:${o}`), a.value = o);
2125
+ }
2126
+ function c(o) {
2127
+ a.value = o;
2128
+ }
2129
+ function h(o) {
2130
+ const i = Ut(u.value, o.moveId, o.cellId, o.index);
2131
+ i !== u.value && (t(i, "move:" + o.moveId), a.value = o.moveId);
2132
+ }
2133
+ function m(o) {
2134
+ var C;
2135
+ const i = (C = s.value.get(o.cellId)) == null ? void 0 : C.node;
2136
+ if (!i || i.type !== "grid-cell" && i.type !== "table-cell-template") return;
2137
+ const d = g(o.kind);
2138
+ t(be(u.value, o.cellId, d)), a.value = d.id;
2139
+ }
2140
+ function S(o, i) {
2141
+ a.value && t(Yl(u.value, a.value, o), i);
2142
+ }
2143
+ function F(o) {
2144
+ const i = o.target.value;
2145
+ S(
2146
+ (d) => d.type === "text" ? { ...d, text: i } : d,
2147
+ a.value ? `edit:${a.value}` : void 0
2148
+ );
2149
+ }
2150
+ function E(o) {
2151
+ const i = o.target.value;
2152
+ S(
2153
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, field: i } : d,
2154
+ a.value ? `edit:${a.value}` : void 0
2155
+ );
2156
+ }
2157
+ function N(o) {
2158
+ const i = o.target.value;
2159
+ S(
2160
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, prefix: i || void 0 } : d,
2161
+ a.value ? `edit:${a.value}` : void 0
2162
+ );
2163
+ }
2164
+ function z(o) {
2165
+ const i = o.target.value;
2166
+ S(
2167
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, suffix: i || void 0 } : d,
2168
+ a.value ? `edit:${a.value}` : void 0
2169
+ );
2170
+ }
2171
+ function O(o) {
2172
+ const i = o.target.value;
2173
+ S(
2174
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, width: i.trim() || void 0 } : d,
2175
+ a.value ? `edit:${a.value}` : void 0
2176
+ );
2177
+ }
2178
+ function ce(o) {
2179
+ const i = o.target.value;
2180
+ S(
2181
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, default: i || void 0 } : d,
2182
+ a.value ? `edit:${a.value}` : void 0
2183
+ );
2184
+ }
2185
+ function Ee(o) {
2186
+ const i = o.target.checked;
2187
+ S(
2188
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, innerBorder: i || void 0 } : d,
2189
+ a.value ? `edit:${a.value}` : void 0
2190
+ );
2191
+ }
2192
+ function ae(o) {
2193
+ const i = o.target.value;
2194
+ S(
2195
+ (d) => d.type === "p" && d.mode === "field" ? { ...d, action: i || void 0 } : d,
2196
+ a.value ? `action:${a.value}` : void 0
2197
+ );
2198
+ }
2199
+ function Ae(o) {
2200
+ const i = o.target.value.trim();
2201
+ S(
2202
+ (d) => {
2203
+ if (d.type !== "p" || d.mode !== "field") return d;
2204
+ const C = { ...d.actionParams ?? {} };
2205
+ return i ? C.format = i : delete C.format, {
2206
+ ...d,
2207
+ actionParams: Object.keys(C).length ? C : void 0
2208
+ };
2209
+ },
2210
+ a.value ? `actionParams:${a.value}` : void 0
2211
+ );
2212
+ }
2213
+ function He(o) {
2214
+ var i;
2215
+ ((i = n.value) == null ? void 0 : i.type) === "grid" && t(
2216
+ jl(
2217
+ u.value,
2218
+ n.value.id,
2219
+ o.target.value
2220
+ )
2221
+ );
2222
+ }
2223
+ function Ce(o) {
2224
+ var i;
2225
+ ((i = n.value) == null ? void 0 : i.type) === "table" && t(
2226
+ Ul(
2227
+ u.value,
2228
+ n.value.id,
2229
+ o.target.value
2230
+ )
2231
+ );
2232
+ }
2233
+ function at(o) {
2234
+ var ne, pe;
2235
+ if (((ne = n.value) == null ? void 0 : ne.type) !== "grid") return;
2236
+ const i = o.target, d = Math.floor(Number(i.value));
2237
+ if (!Number.isInteger(d) || d < 1) return;
2238
+ const C = d, B = i.dataset.dimension === "rows" ? C : n.value.rows.length, Q = i.dataset.dimension === "columns" ? C : ((pe = n.value.rows[0]) == null ? void 0 : pe.cells.length) ?? 1;
2239
+ t(Wl(u.value, n.value.id, B, Q));
2240
+ }
2241
+ function Re(o) {
2242
+ var i;
2243
+ ((i = n.value) == null ? void 0 : i.type) === "table" && t(
2244
+ Ol(
2245
+ u.value,
2246
+ n.value.id,
2247
+ Number(o.target.value)
2248
+ )
2249
+ );
2250
+ }
2251
+ function Le() {
2252
+ var o;
2253
+ ((o = n.value) == null ? void 0 : o.type) === "table" && t(zl(u.value, n.value.id));
2254
+ }
2255
+ function we(o) {
2256
+ var i;
2257
+ ((i = n.value) == null ? void 0 : i.type) === "table" && t(Gl(u.value, n.value.id, o));
2258
+ }
2259
+ function Me(o, i) {
2260
+ var C;
2261
+ if (((C = n.value) == null ? void 0 : C.type) !== "table") return;
2262
+ const d = i.target.value.trim();
2263
+ !d || d === o || t(Vl(u.value, n.value.id, o, d));
2264
+ }
2265
+ function Be(o, i, d) {
2266
+ var Q;
2267
+ if (((Q = n.value) == null ? void 0 : Q.type) !== "table") return;
2268
+ const C = d.target;
2269
+ if (i === "width") {
2270
+ const ne = Ie(C.value);
2271
+ if (ne === "INVALID") return;
2272
+ t(
2273
+ Wt(u.value, n.value.id, o, { width: ne }),
2274
+ `tblcol:${o}:width`
2275
+ );
2276
+ return;
2277
+ }
2278
+ const B = { [i]: C.value || void 0 };
2279
+ t(
2280
+ Wt(u.value, n.value.id, o, B),
2281
+ `tblcol:${o}:${i}`
2282
+ );
2283
+ }
2284
+ function Se(o) {
2285
+ var i;
2286
+ ((i = n.value) == null ? void 0 : i.type) === "table" && S(
2287
+ (d) => d.type === "table" ? { ...d, headerStyle: { ...d.headerStyle, ...o } } : d,
2288
+ a.value ? `tablehdr:${a.value}` : void 0
2289
+ );
2290
+ }
2291
+ function Ve(o) {
2292
+ const i = o.target.value, d = Number(i);
2293
+ Se({ fontSize: Number.isFinite(d) && d > 0 ? d : void 0 });
2294
+ }
2295
+ function nt(o) {
2296
+ const i = o.target.value;
2297
+ Se({
2298
+ fontWeight: i || void 0
2299
+ });
2300
+ }
2301
+ function ot(o) {
2302
+ const i = o.target.value;
2303
+ Se({
2304
+ align: i || void 0
2305
+ });
2306
+ }
2307
+ function Ie(o) {
2308
+ const i = o.trim().toLowerCase();
2309
+ if (i === "") return "1fr";
2310
+ if (i === "auto") return "auto";
2311
+ if (/^\d+(\.\d+)?fr$/.test(i)) return i;
2312
+ const d = i.match(/^(\d+(?:\.\d+)?)\s*mm$/);
2313
+ if (d) {
2314
+ const B = Number(d[1]);
2315
+ return Number.isFinite(B) && B > 0 ? B : "INVALID";
2316
+ }
2317
+ const C = Number(i);
2318
+ return Number.isFinite(C) && C > 0 ? C : "INVALID";
2319
+ }
2320
+ function Ge(o, i) {
2321
+ var C;
2322
+ if (((C = n.value) == null ? void 0 : C.type) !== "grid") return;
2323
+ const d = Ie(i.target.value);
2324
+ d !== "INVALID" && t(
2325
+ Bl(u.value, n.value.id, o, d),
2326
+ `col:${n.value.id}:${o}`
2327
+ );
2328
+ }
2329
+ function ze(o, i) {
2330
+ var Q;
2331
+ if (((Q = n.value) == null ? void 0 : Q.type) !== "grid") return;
2332
+ const C = i.target.value, B = o === "cellPadding" ? { cellPadding: Je(C) } : { [o]: C === "" ? void 0 : C };
2333
+ t(Ml(u.value, n.value.id, B), `gridcell:${o}`);
2334
+ }
2335
+ function it(o) {
2336
+ var C;
2337
+ if (((C = n.value) == null ? void 0 : C.type) !== "grid") return;
2338
+ const i = o.target.value, d = Je(i);
2339
+ t(Ll(u.value, n.value.id, d), "gridgap");
2340
+ }
2341
+ function dt(o) {
2342
+ const i = o.target.value, d = Je(i);
2343
+ S(
2344
+ (C) => C.type === "grid-cell" ? { ...C, padding: d } : C,
2345
+ a.value ? `cellpad:${a.value}` : void 0
2346
+ );
2347
+ }
2348
+ function ut(o) {
2349
+ const i = o.target.value;
2350
+ S(
2351
+ (d) => d.type === "grid-cell" ? { ...d, align: i || void 0 } : d,
2352
+ a.value ? `cellalign:${a.value}` : void 0
2353
+ );
2354
+ }
2355
+ function rt(o) {
2356
+ const i = o.target.value;
2357
+ S(
2358
+ (d) => d.type === "grid-cell" ? {
2359
+ ...d,
2360
+ verticalAlign: i || void 0
2361
+ } : d,
2362
+ a.value ? `cellvalign:${a.value}` : void 0
2363
+ );
2364
+ }
2365
+ function st(o) {
2366
+ const i = o.target.checked;
2367
+ S(
2368
+ (d) => d.type === "grid-cell" ? { ...d, flex: i || void 0 } : d,
2369
+ a.value ? `cellflex:${a.value}` : void 0
2370
+ );
2371
+ }
2372
+ function vt(o) {
2373
+ const i = o.target.value, d = Number(i), C = Number.isFinite(d) && d > 0 ? Math.floor(d) : void 0;
2374
+ S(
2375
+ (B) => B.type === "grid-cell" ? { ...B, rowHeight: C } : B,
2376
+ a.value ? `cellrowh:${a.value}` : void 0
2377
+ );
2378
+ }
2379
+ function de(o) {
2380
+ S(
2381
+ (i) => i.type === "p" || i.type === "text" ? { ...i, style: { ...i.style, ...o } } : i,
2382
+ a.value ? `style:${a.value}` : void 0
2383
+ );
2384
+ }
2385
+ function ct(o) {
2386
+ const i = o.target.value, d = Number(i);
2387
+ de({
2388
+ fontSize: Number.isFinite(d) && d > 0 ? Math.floor(d) : void 0
2389
+ });
2390
+ }
2391
+ function pt(o) {
2392
+ const i = Number(o.target.value);
2393
+ de({
2394
+ lineHeight: Number.isFinite(i) && i > 0 ? i : void 0
2395
+ });
2396
+ }
2397
+ function ft(o) {
2398
+ const i = o.target.value;
2399
+ de({
2400
+ fontWeight: i || void 0
2401
+ });
2402
+ }
2403
+ function gt(o) {
2404
+ const i = o.target.value;
2405
+ de({ color: i || void 0 });
2406
+ }
2407
+ function mt(o) {
2408
+ const i = o.target.value;
2409
+ de({ fontFamily: i || void 0 });
2410
+ }
2411
+ function bt(o) {
2412
+ const i = o.target.value;
2413
+ de({
2414
+ align: i || void 0
2415
+ });
2416
+ }
2417
+ function ht(o) {
2418
+ const i = o.target.value;
2419
+ de({
2420
+ verticalAlign: i || void 0
2421
+ });
2422
+ }
2423
+ function yt(o) {
2424
+ const i = o.target.value;
2425
+ S(
2426
+ (d) => d.type === "html" ? { ...d, html: i } : d,
2427
+ a.value ? `html:${a.value}` : void 0
2428
+ );
2429
+ }
2430
+ function St(o) {
2431
+ const i = o.target.value;
2432
+ S(
2433
+ (d) => d.type === "html" ? { ...d, css: i || void 0 } : d,
2434
+ a.value ? `css:${a.value}` : void 0
2435
+ );
2436
+ }
2437
+ function $t(o) {
2438
+ const i = o.target.value;
2439
+ S(
2440
+ (d) => d.type === "image" ? { ...d, src: i || void 0 } : d,
2441
+ a.value ? `imgsrc:${a.value}` : void 0
2442
+ );
2443
+ }
2444
+ function Ct(o) {
2445
+ const i = o.target.value;
2446
+ S(
2447
+ (d) => d.type === "image" ? { ...d, field: i || void 0 } : d,
2448
+ a.value ? `imgfield:${a.value}` : void 0
2449
+ );
2450
+ }
2451
+ function wt(o, i) {
2452
+ const d = Number(i.target.value);
2453
+ S(
2454
+ (C) => C.type === "image" ? { ...C, [o]: Number.isFinite(d) && d > 0 ? d : void 0 } : C,
2455
+ a.value ? `imgsize:${a.value}` : void 0
2456
+ );
2457
+ }
2458
+ function It(o) {
2459
+ const i = o.target.value;
2460
+ S(
2461
+ (d) => d.type === "image" ? { ...d, objectFit: i } : d,
2462
+ a.value ? `imgfit:${a.value}` : void 0
2463
+ );
2464
+ }
2465
+ function xt(o) {
2466
+ const i = Number(o.target.value);
2467
+ !Number.isFinite(i) || i < 1 || t(Rl(u.value, Math.floor(i)));
2468
+ }
2469
+ function Tt(o) {
2470
+ const i = o.target.value;
2471
+ t(Hl(u.value, { size: i }));
2472
+ }
2473
+ const kt = P(
2474
+ () => {
2475
+ var o;
2476
+ return ((o = u.value.pages[0]) == null ? void 0 : o.margin.top) ?? 12;
2477
+ }
2478
+ ), Ft = P(
2479
+ () => {
2480
+ var o;
2481
+ return ((o = u.value.pages[0]) == null ? void 0 : o.margin.right) ?? 12;
2482
+ }
2483
+ ), Dt = P(
2484
+ () => {
2485
+ var o;
2486
+ return ((o = u.value.pages[0]) == null ? void 0 : o.margin.bottom) ?? 12;
2487
+ }
2488
+ ), Nt = P(
2489
+ () => {
2490
+ var o;
2491
+ return ((o = u.value.pages[0]) == null ? void 0 : o.margin.left) ?? 12;
2492
+ }
2493
+ );
2494
+ function Pt(o, i) {
2495
+ const d = Number(i.target.value);
2496
+ if (!Number.isFinite(d)) return;
2497
+ const C = Math.max(0, Math.floor(d));
2498
+ t({
2499
+ ...u.value,
2500
+ pages: u.value.pages.map((B) => ({
2501
+ ...B,
2502
+ margin: { ...B.margin, [o]: C }
2503
+ }))
2504
+ });
2505
+ }
2506
+ function Oe(o) {
2507
+ function i() {
2508
+ const R = u.value.paper;
2509
+ return o === "header" ? R == null ? void 0 : R.header : R == null ? void 0 : R.footer;
2510
+ }
2511
+ function d(R) {
2512
+ const W = u.value.paper;
2513
+ t({
2514
+ ...u.value,
2515
+ paper: o === "header" ? { ...W, header: R } : { ...W, footer: R }
2516
+ });
2517
+ }
2518
+ function C(R) {
2519
+ d({ ...i() ?? {}, ...R });
2520
+ }
2521
+ function B(R, W) {
2522
+ var Te;
2523
+ const fe = W.target.value, xe = ((Te = i()) == null ? void 0 : Te.content) ?? {};
2524
+ C({ content: { ...xe, [R]: fe || void 0 } });
2525
+ }
2526
+ function Q(R) {
2527
+ C({ enabled: R.target.checked });
2528
+ }
2529
+ function ne(R) {
2530
+ const W = Number(R.target.value);
2531
+ C({ height: Number.isFinite(W) && W > 0 ? W : void 0 });
2532
+ }
2533
+ function pe(R) {
2534
+ C({ separator: R.target.checked });
2535
+ }
2536
+ function se(R) {
2537
+ var fe;
2538
+ const W = ((fe = i()) == null ? void 0 : fe.style) ?? {};
2539
+ C({ style: { ...W, ...R } });
2540
+ }
2541
+ function We(R) {
2542
+ const W = Number(R.target.value);
2543
+ se({ fontSize: Number.isFinite(W) && W > 0 ? W : void 0 });
2544
+ }
2545
+ function Ue(R) {
2546
+ const W = R.target.value;
2547
+ se({ fontWeight: W === "bold" || W === "normal" ? W : void 0 });
2548
+ }
2549
+ function je(R) {
2550
+ const W = R.target.value;
2551
+ se({ color: W || void 0 });
2552
+ }
2553
+ return { patch: C, content: B, enabled: Q, height: ne, separator: pe, style: se, fontSize: We, fontWeight: Ue, color: je };
2554
+ }
2555
+ const ue = Oe("header"), re = Oe("footer");
2556
+ return {
2557
+ addRootGrid: L,
2558
+ addGrid: A,
2559
+ addNodeToSelectedCell: H,
2560
+ removeSelectedNode: U,
2561
+ copySelected: k,
2562
+ cutSelected: Y,
2563
+ pasteClipboard: J,
2564
+ duplicateSelected: Z,
2565
+ mergeSelectedCellRight: w,
2566
+ splitSelectedCell: y,
2567
+ onCanvasNodeDragStart: c,
2568
+ onDropNode: h,
2569
+ onDropPalette: m,
2570
+ updateSelectedNode: S,
2571
+ updateSelectedText: F,
2572
+ updateSelectedField: E,
2573
+ updateSelectedPrefix: N,
2574
+ updateSelectedSuffix: z,
2575
+ updateSelectedWidth: O,
2576
+ updateSelectedDefault: ce,
2577
+ updateSelectedInnerBorder: Ee,
2578
+ updateSelectedAction: ae,
2579
+ updateSelectedDateFormat: Ae,
2580
+ updateGridBorder: He,
2581
+ updateTableBorder: Ce,
2582
+ updateGridDimensions: at,
2583
+ updateTableRows: Re,
2584
+ addTableColumn: Le,
2585
+ removeTableColumn: we,
2586
+ renameTableColumnKey: Me,
2587
+ updateTableColumn: Be,
2588
+ updateTableHeaderFontSize: Ve,
2589
+ updateTableHeaderFontWeight: nt,
2590
+ updateTableHeaderAlign: ot,
2591
+ updateGridColumnWidth: Ge,
2592
+ updateGridCellDefault: ze,
2593
+ updateGridGap: it,
2594
+ updateSelectedCellPadding: dt,
2595
+ updateSelectedCellAlign: ut,
2596
+ updateSelectedCellVerticalAlign: rt,
2597
+ updateSelectedCellFlex: st,
2598
+ updateSelectedCellRowHeight: vt,
2599
+ updateSelectedTextStyle: de,
2600
+ updateSelectedFontSize: ct,
2601
+ updateSelectedLineHeight: pt,
2602
+ updateSelectedFontWeight: ft,
2603
+ updateSelectedColor: gt,
2604
+ updateSelectedFontFamily: mt,
2605
+ updateSelectedAlign: bt,
2606
+ updateSelectedVerticalAlign: ht,
2607
+ updateSelectedHtml: yt,
2608
+ updateSelectedCss: St,
2609
+ updateSelectedImageSrc: $t,
2610
+ updateSelectedImageField: Ct,
2611
+ updateSelectedImageSize: wt,
2612
+ updateSelectedImageFit: It,
2613
+ updateBaseRowHeight: xt,
2614
+ updatePaperSize: Tt,
2615
+ paperMarginTop: kt,
2616
+ paperMarginRight: Ft,
2617
+ paperMarginBottom: Dt,
2618
+ paperMarginLeft: Nt,
2619
+ updatePaperMarginSide: Pt,
2620
+ updatePaperHeader: ue.patch,
2621
+ updatePaperHeaderContent: ue.content,
2622
+ updatePaperHeaderEnabled: ue.enabled,
2623
+ updatePaperHeaderHeight: ue.height,
2624
+ updatePaperHeaderSeparator: ue.separator,
2625
+ updatePaperHeaderFontSize: ue.fontSize,
2626
+ updatePaperHeaderFontWeight: ue.fontWeight,
2627
+ updatePaperHeaderColor: ue.color,
2628
+ updatePaperFooter: re.patch,
2629
+ updatePaperFooterContent: re.content,
2630
+ updatePaperFooterEnabled: re.enabled,
2631
+ updatePaperFooterHeight: re.height,
2632
+ updatePaperFooterSeparator: re.separator,
2633
+ updatePaperFooterFontSize: re.fontSize,
2634
+ updatePaperFooterFontWeight: re.fontWeight,
2635
+ updatePaperFooterColor: re.color
2636
+ };
2637
+ }
2638
+ const qt = "ticket-designer-fill-data-v2", bd = "[ticket-designer] 表单数据 JSON";
2639
+ function hd(e) {
2640
+ const u = xl({
2641
+ value: null
2642
+ }), t = P(() => u.value), a = G(null);
2643
+ function n(v) {
2644
+ var A;
2645
+ const p = v.target, g = (A = p.files) == null ? void 0 : A[0];
2646
+ if (!g) return;
2647
+ const L = new FileReader();
2648
+ L.onload = () => {
2649
+ try {
2650
+ const H = JSON.parse(String(L.result));
2651
+ e.enterPreview(H);
2652
+ } catch (H) {
2653
+ alert(
2654
+ `导入数据失败:${H instanceof Error ? H.message : String(H)}`
2655
+ );
2656
+ } finally {
2657
+ p.value = "";
2658
+ }
2659
+ }, L.onerror = () => {
2660
+ alert("数据文件读取失败"), p.value = "";
2661
+ }, L.readAsText(g);
2662
+ }
2663
+ function r() {
2664
+ var v;
2665
+ (v = a.value) == null || v.click();
2666
+ }
2667
+ function b() {
2668
+ try {
2669
+ const v = et(e.canvasEl.value, {
2670
+ maskHidden: !0
2671
+ }), p = jt(v);
2672
+ console.log(bd, p), al(ll(va), p);
2673
+ } catch (v) {
2674
+ alert(
2675
+ `导出数据失败:${v instanceof Error ? v.message : String(v)}`
2676
+ );
2677
+ }
2678
+ }
2679
+ function s() {
2680
+ try {
2681
+ localStorage.setItem(
2682
+ qt,
2683
+ // 本机「保存数据」:脱敏字段(HIDDEN)从 previewFormData 回源真实值,保存→读取不丢数据
2684
+ jt(
2685
+ et(e.canvasEl.value, {
2686
+ baseData: u.value
2687
+ })
2688
+ )
2689
+ );
2690
+ } catch (v) {
2691
+ alert(
2692
+ `保存数据失败:${v instanceof Error ? v.message : String(v)}`
2693
+ );
2694
+ }
2695
+ }
2696
+ function f() {
2697
+ const v = localStorage.getItem(qt);
2698
+ if (!v) {
2699
+ alert("本地没有已保存的填写数据");
2700
+ return;
2701
+ }
2702
+ try {
2703
+ e.enterPreview(JSON.parse(v));
2704
+ } catch (p) {
2705
+ alert(
2706
+ `读取数据失败:${p instanceof Error ? p.message : String(p)}`
2707
+ );
2708
+ }
2709
+ }
2710
+ return {
2711
+ previewFormData: u,
2712
+ previewData: t,
2713
+ fillDataFileInput: a,
2714
+ importFillDataFile: n,
2715
+ triggerImportFillData: r,
2716
+ exportFillDataFile: b,
2717
+ saveFillDataToLocal: s,
2718
+ loadFillDataFromLocal: f
2719
+ };
2720
+ }
2721
+ const yd = { class: "v2-designer" }, Sd = { class: "v2-designer__body" }, Xt = "ticket-designer-help-seen-v1", $d = /* @__PURE__ */ X({
2722
+ __name: "FormDesigner",
2723
+ props: {
2724
+ initialSchema: {},
2725
+ samples: {},
2726
+ uiConfig: {}
2727
+ },
2728
+ setup(e, { expose: u }) {
2729
+ const t = e;
2730
+ ve(
2731
+ () => {
2732
+ var T;
2733
+ return (T = t.uiConfig) == null ? void 0 : T.locale;
2734
+ },
2735
+ (T) => ta(T ?? ia),
2736
+ { immediate: !0 }
2737
+ );
2738
+ const a = G("design"), n = P(() => a.value !== "design"), r = P(() => !n.value), b = G(!0);
2739
+ function s() {
2740
+ try {
2741
+ return localStorage.getItem(Xt) !== null;
2742
+ } catch {
2743
+ return !1;
2744
+ }
2745
+ }
2746
+ function f() {
2747
+ v.value = !1;
2748
+ try {
2749
+ localStorage.setItem(Xt, "1");
2750
+ } catch {
2751
+ }
2752
+ }
2753
+ const v = G(!s()), p = G(null);
2754
+ let g = () => {
2755
+ };
2756
+ const L = gd(t.initialSchema, {
2757
+ onReset: () => g()
2758
+ }), {
2759
+ schema: A,
2760
+ dirty: H,
2761
+ canUndo: U,
2762
+ canRedo: q,
2763
+ fileInput: j,
2764
+ commit: te,
2765
+ resetHistory: ee,
2766
+ saveToLocal: k,
2767
+ loadFromLocal: Y,
2768
+ exportFile: J,
2769
+ importFile: Z,
2770
+ triggerImport: w
2771
+ } = L, y = cn(A, { editable: () => r.value }), {
2772
+ selectedNodeId: c,
2773
+ selectedNode: h,
2774
+ selectedNodeType: m,
2775
+ selectedCellContext: S,
2776
+ selectedCellBox: F,
2777
+ nodeTree: E,
2778
+ clearSelection: N,
2779
+ selectNode: z,
2780
+ selectNodeById: O,
2781
+ selectIssue: ce
2782
+ } = y;
2783
+ g = N;
2784
+ const Ee = P(
2785
+ () => {
2786
+ var T, V;
2787
+ return r.value && c.value !== null && ((T = h.value) == null ? void 0 : T.type) !== "page" && ((V = h.value) == null ? void 0 : V.type) !== "grid-cell";
2788
+ }
2789
+ ), ae = {
2790
+ token: G(0),
2791
+ target: G(!0),
2792
+ focusId: G(null),
2793
+ focusToken: G(0)
2794
+ };
2795
+ Tl(nl, ae);
2796
+ function Ae() {
2797
+ ae.target.value = !1, ae.focusId.value = null, ae.token.value++;
2798
+ }
2799
+ function He() {
2800
+ ae.target.value = !0, ae.focusId.value = null, ae.token.value++;
2801
+ }
2802
+ ve(
2803
+ c,
2804
+ (T) => {
2805
+ ae.focusId.value = T, T && ae.focusToken.value++;
2806
+ },
2807
+ { flush: "sync" }
2808
+ );
2809
+ const Ce = md({
2810
+ document: L,
2811
+ selection: y,
2812
+ editable: () => r.value,
2813
+ clearSelection: N
2814
+ }), {
2815
+ addRootGrid: at,
2816
+ addGrid: Re,
2817
+ addNodeToSelectedCell: Le,
2818
+ removeSelectedNode: we,
2819
+ copySelected: Me,
2820
+ cutSelected: Be,
2821
+ pasteClipboard: Se,
2822
+ duplicateSelected: Ve,
2823
+ mergeSelectedCellRight: nt,
2824
+ splitSelectedCell: ot,
2825
+ onCanvasNodeDragStart: Ie,
2826
+ onDropNode: Ge,
2827
+ onDropPalette: ze,
2828
+ updateSelectedText: it,
2829
+ updateSelectedField: dt,
2830
+ updateSelectedPrefix: ut,
2831
+ updateSelectedSuffix: rt,
2832
+ updateSelectedWidth: st,
2833
+ updateSelectedDefault: vt,
2834
+ updateSelectedInnerBorder: de,
2835
+ updateSelectedAction: ct,
2836
+ updateGridBorder: pt,
2837
+ updateTableBorder: ft,
2838
+ updateGridDimensions: gt,
2839
+ updateTableRows: mt,
2840
+ addTableColumn: bt,
2841
+ removeTableColumn: ht,
2842
+ renameTableColumnKey: yt,
2843
+ updateTableColumn: St,
2844
+ updateGridColumnWidth: $t,
2845
+ updateGridCellDefault: Ct,
2846
+ updateGridGap: wt,
2847
+ updateSelectedCellPadding: It,
2848
+ updateSelectedCellAlign: xt,
2849
+ updateSelectedCellVerticalAlign: Tt,
2850
+ updateSelectedCellRowHeight: kt,
2851
+ updateSelectedFontSize: Ft,
2852
+ updateSelectedLineHeight: Dt,
2853
+ updateSelectedFontWeight: Nt,
2854
+ updateSelectedColor: Pt,
2855
+ updateSelectedFontFamily: Oe,
2856
+ updateSelectedAlign: ue,
2857
+ updateSelectedVerticalAlign: re,
2858
+ updateSelectedHtml: o,
2859
+ updateSelectedCss: i,
2860
+ updateSelectedImageSrc: d,
2861
+ updateSelectedImageField: C,
2862
+ updateSelectedImageSize: B,
2863
+ updateSelectedImageFit: Q,
2864
+ updateBaseRowHeight: ne,
2865
+ updatePaperSize: pe,
2866
+ paperMarginTop: se,
2867
+ paperMarginRight: We,
2868
+ paperMarginBottom: Ue,
2869
+ paperMarginLeft: je,
2870
+ updatePaperMarginSide: R
2871
+ } = Ce, W = hd({
2872
+ canvasEl: p,
2873
+ enterPreview: (T) => Ht(T)
2874
+ }), {
2875
+ previewFormData: fe,
2876
+ previewData: xe,
2877
+ fillDataFileInput: Te,
2878
+ importFillDataFile: Et,
2879
+ triggerImportFillData: ul,
2880
+ exportFillDataFile: At,
2881
+ saveFillDataToLocal: rl,
2882
+ loadFillDataFromLocal: sl
2883
+ } = W;
2884
+ function Ht(T) {
2885
+ fe.value = T, a.value = "preview", N();
2886
+ }
2887
+ function vl(T) {
2888
+ if (a.value === T) {
2889
+ a.value = "design", fe.value = null;
2890
+ return;
2891
+ }
2892
+ Ht({});
2893
+ }
2894
+ function Rt() {
2895
+ L.undo(), N();
2896
+ }
2897
+ function Lt() {
2898
+ L.redo(), N();
2899
+ }
2900
+ function Mt() {
2901
+ oa({ root: p.value });
2902
+ }
2903
+ function cl(T) {
2904
+ ee(T.loadSchema()), N();
2905
+ }
2906
+ function Bt() {
2907
+ ee(dl()), N();
2908
+ }
2909
+ function pl(T, V) {
2910
+ var M;
2911
+ r.value && ((M = V.dataTransfer) == null || M.setData(Ze, T), V.dataTransfer && (V.dataTransfer.effectAllowed = "copy"));
2912
+ }
2913
+ const Vt = P(() => la(A.value)), fl = P(() => Vt.value.length), Gt = P(
2914
+ () => aa(A.value, { data: xe.value })
2915
+ );
2916
+ function gl(T) {
2917
+ const V = T.target;
2918
+ if (!V) return !1;
2919
+ const M = V.tagName;
2920
+ return M === "INPUT" || M === "TEXTAREA" || M === "SELECT" || V.isContentEditable;
2921
+ }
2922
+ function zt(T) {
2923
+ if (gl(T)) return;
2924
+ const V = T.ctrlKey || T.metaKey, M = T.key.toLowerCase();
2925
+ if (V) {
2926
+ M === "z" && !T.shiftKey ? (T.preventDefault(), Rt()) : M === "z" && T.shiftKey || M === "y" ? (T.preventDefault(), Lt()) : M === "s" ? (T.preventDefault(), k()) : M === "c" ? (T.preventDefault(), Me()) : M === "x" ? (T.preventDefault(), Be()) : M === "v" ? (T.preventDefault(), Se()) : M === "d" && (T.preventDefault(), Ve());
2927
+ return;
2928
+ }
2929
+ (M === "delete" || M === "backspace") && r.value && (T.preventDefault(), we());
2930
+ }
2931
+ function Ot(T) {
2932
+ H.value && (T.preventDefault(), T.returnValue = "");
2933
+ }
2934
+ Zt(() => {
2935
+ A.value.pages.length > 0 && O(A.value.pages[0].id), window.addEventListener("keydown", zt), window.addEventListener("beforeunload", Ot);
2936
+ }), tt(() => {
2937
+ window.removeEventListener("keydown", zt), window.removeEventListener("beforeunload", Ot);
2938
+ });
2939
+ function ml() {
2940
+ return JSON.parse(JSON.stringify(A.value));
2941
+ }
2942
+ function bl(T) {
2943
+ return et(p.value, {
2944
+ maskHidden: !0,
2945
+ ...T
2946
+ });
2947
+ }
2948
+ function hl(T) {
2949
+ ee(pa(T)), N();
2950
+ }
2951
+ function yl() {
2952
+ J();
2953
+ }
2954
+ return u({
2955
+ getSchema: ml,
2956
+ getFormData: bl,
2957
+ setSchema: hl,
2958
+ exportSchemaFile: yl,
2959
+ // 「导出数据」与工具栏同一实现(`useFillData.exportFillDataFile`,含 console 打印)
2960
+ exportFillDataFile: At,
2961
+ print: Mt,
2962
+ resetBlank: Bt
2963
+ }), (T, V) => ($(), I("div", yd, [
2964
+ le(za, {
2965
+ samples: e.samples,
2966
+ dirty: x(H),
2967
+ "can-undo": x(U),
2968
+ "can-redo": x(q),
2969
+ "preview-mode": n.value,
2970
+ "ui-config": e.uiConfig,
2971
+ onResetBlank: Bt,
2972
+ onLoadSample: cl,
2973
+ onUndo: Rt,
2974
+ onRedo: Lt,
2975
+ onSaveTemplate: x(k),
2976
+ onLoadTemplate: x(Y),
2977
+ onExportTemplate: x(J),
2978
+ onImportTemplate: x(w),
2979
+ onImportFillData: x(ul),
2980
+ onExportFillData: x(At),
2981
+ onLoadFillData: x(sl),
2982
+ onSaveFillData: x(rl),
2983
+ onTogglePreview: V[0] || (V[0] = (M) => vl("preview")),
2984
+ onPrint: Mt,
2985
+ onHelp: V[1] || (V[1] = (M) => v.value = !0)
2986
+ }, null, 8, ["samples", "dirty", "can-undo", "can-redo", "preview-mode", "ui-config", "onSaveTemplate", "onLoadTemplate", "onExportTemplate", "onImportTemplate", "onImportFillData", "onExportFillData", "onLoadFillData", "onSaveFillData"]),
2987
+ l("div", Sd, [
2988
+ le(un, {
2989
+ editable: r.value,
2990
+ "can-remove": Ee.value,
2991
+ "node-tree": x(E),
2992
+ "selected-node-id": x(c),
2993
+ onAddNode: x(Le),
2994
+ onAddGrid: x(Re),
2995
+ onPaletteDrag: pl,
2996
+ onSelect: x(O),
2997
+ onRemoveSelected: x(we),
2998
+ onCollapseAll: Ae,
2999
+ onExpandAll: He
3000
+ }, null, 8, ["editable", "can-remove", "node-tree", "selected-node-id", "onAddNode", "onAddGrid", "onSelect", "onRemoveSelected"]),
3001
+ l("main", {
3002
+ ref_key: "canvasEl",
3003
+ ref: p,
3004
+ class: me(["v2-canvas", { "v2-canvas--preview": n.value }]),
3005
+ onClick: V[2] || (V[2] = //@ts-ignore
3006
+ (...M) => x(z) && x(z)(...M))
3007
+ }, [
3008
+ le(na, { "fit-on-mount": !1 }, {
3009
+ default: kl(() => [
3010
+ le(ua, {
3011
+ schema: x(A),
3012
+ mode: n.value ? "preview" : "design",
3013
+ "selected-node-id": n.value ? null : x(c),
3014
+ data: x(xe),
3015
+ readonly: !1,
3016
+ bare: !0,
3017
+ paginate: n.value || b.value,
3018
+ onNodeDragStart: x(Ie),
3019
+ onDropNode: x(Ge),
3020
+ onDropPalette: x(ze)
3021
+ }, null, 8, ["schema", "mode", "selected-node-id", "data", "paginate", "onNodeDragStart", "onDropNode", "onDropPalette"])
3022
+ ]),
3023
+ _: 1
3024
+ })
3025
+ ], 2),
3026
+ le(dd, {
3027
+ paginate: b.value,
3028
+ "onUpdate:paginate": V[3] || (V[3] = (M) => b.value = M),
3029
+ node: x(h),
3030
+ "node-id": x(c),
3031
+ "node-type": x(m),
3032
+ "cell-context": x(S),
3033
+ "cell-box": x(F),
3034
+ issues: Vt.value,
3035
+ api: x(Ce),
3036
+ "paper-size": x(A).paper.size,
3037
+ "base-row-height": x(A).baseRowHeight,
3038
+ "paper-margin-top": x(se),
3039
+ "paper-margin-right": x(We),
3040
+ "paper-margin-bottom": x(Ue),
3041
+ "paper-margin-left": x(je),
3042
+ header: x(A).paper.header,
3043
+ footer: x(A).paper.footer,
3044
+ onSelectIssue: x(ce)
3045
+ }, null, 8, ["paginate", "node", "node-id", "node-type", "cell-context", "cell-box", "issues", "api", "paper-size", "base-row-height", "paper-margin-top", "paper-margin-right", "paper-margin-bottom", "paper-margin-left", "header", "footer", "onSelectIssue"])
3046
+ ]),
3047
+ le(Sa, {
3048
+ "page-count": x(A).pages.length,
3049
+ "warning-count": fl.value,
3050
+ "physical-page-count": Gt.value.pages.length,
3051
+ "paginate-warning-count": Gt.value.warnings.length
3052
+ }, null, 8, ["page-count", "warning-count", "physical-page-count", "paginate-warning-count"]),
3053
+ l("input", {
3054
+ ref_key: "fileInput",
3055
+ ref: j,
3056
+ type: "file",
3057
+ accept: ".json,application/json",
3058
+ class: "v2-toolbar__file",
3059
+ onChange: V[4] || (V[4] = //@ts-ignore
3060
+ (...M) => x(Z) && x(Z)(...M))
3061
+ }, null, 544),
3062
+ l("input", {
3063
+ ref_key: "fillDataFileInput",
3064
+ ref: Te,
3065
+ type: "file",
3066
+ accept: ".json,application/json",
3067
+ class: "v2-toolbar__file",
3068
+ onChange: V[5] || (V[5] = //@ts-ignore
3069
+ (...M) => x(Et) && x(Et)(...M))
3070
+ }, null, 544),
3071
+ le(vd, {
3072
+ open: v.value,
3073
+ onClose: f
3074
+ }, null, 8, ["open"])
3075
+ ]));
3076
+ }
3077
+ }), Id = /* @__PURE__ */ ie($d, [["__scopeId", "data-v-c31c7c34"]]);
3078
+ export {
3079
+ va as F,
3080
+ ra as J,
3081
+ sa as S,
3082
+ Id as a,
3083
+ dl as b,
3084
+ et as c,
3085
+ $a as d,
3086
+ al as e,
3087
+ ll as f,
3088
+ ca as g,
3089
+ pa as n,
3090
+ Ca as r,
3091
+ jt as s
3092
+ };