@cluadwong/form-designer 0.2.0 → 0.3.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 (32) hide show
  1. package/dist/chunks/designer-ui.js +1383 -1302
  2. package/dist/chunks/renderer-core.js +1104 -1046
  3. package/dist/components/designer/FormDesigner.vue.d.ts.map +1 -1
  4. package/dist/components/designer/HelpPanel.vue.d.ts.map +1 -1
  5. package/dist/components/designer/InspectorPanel.vue.d.ts.map +1 -1
  6. package/dist/components/designer/PaletteSidebar.vue.d.ts.map +1 -1
  7. package/dist/components/designer/composables/useSchemaEdits.d.ts +5 -2
  8. package/dist/components/designer/composables/useSchemaEdits.d.ts.map +1 -1
  9. package/dist/components/designer/inspectors/FieldPInspector.vue.d.ts +9 -1
  10. package/dist/components/designer/inspectors/FieldPInspector.vue.d.ts.map +1 -1
  11. package/dist/components/designer/inspectors/ParamsFields.vue.d.ts +9 -0
  12. package/dist/components/designer/inspectors/ParamsFields.vue.d.ts.map +1 -0
  13. package/dist/components/designer/inspectors/TableInspector.vue.d.ts.map +1 -1
  14. package/dist/components/renderer-v2/FormRenderer.vue.d.ts +3 -3
  15. package/dist/components/renderer-v2/FormRenderer.vue.d.ts.map +1 -1
  16. package/dist/components/renderer-v2/GridFormRenderer.vue.d.ts +3 -3
  17. package/dist/components/renderer-v2/GridFormRenderer.vue.d.ts.map +1 -1
  18. package/dist/components/renderer-v2/GridSchemaNode.vue.d.ts +3 -3
  19. package/dist/components/renderer-v2/GridSchemaNode.vue.d.ts.map +1 -1
  20. package/dist/designer-ui.css +2 -2
  21. package/dist/index.js +24 -24
  22. package/dist/renderer-core.css +1 -1
  23. package/dist/renderer.js +25 -25
  24. package/dist/ticket-designer.css +2 -2
  25. package/dist/types/schema-v2-serialization.d.ts.map +1 -1
  26. package/dist/types/schema-v2.d.ts +36 -15
  27. package/dist/types/schema-v2.d.ts.map +1 -1
  28. package/dist/utils/date-format.d.ts +11 -5
  29. package/dist/utils/date-format.d.ts.map +1 -1
  30. package/dist/utils/node-params.d.ts +35 -0
  31. package/dist/utils/node-params.d.ts.map +1 -0
  32. package/package.json +1 -1
@@ -1,36 +1,36 @@
1
- var pt = Object.defineProperty;
2
- var yt = (e, t, n) => t in e ? pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var je = (e, t, n) => yt(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { defineComponent as Te, ref as X, onMounted as Fe, watch as ge, openBlock as A, createElementBlock as R, computed as K, resolveComponent as wt, normalizeStyle as z, normalizeClass as ae, Fragment as q, renderList as Y, createBlock as ye, toDisplayString as G, createCommentVNode as Ae, createTextVNode as bt, createElementVNode as O, onUnmounted as vt, nextTick as Je, onBeforeUnmount as Et, renderSlot as Tt, withCtx as St, createVNode as Mt } from "vue";
1
+ var bt = Object.defineProperty;
2
+ var vt = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Je = (e, t, n) => vt(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { defineComponent as Te, ref as J, onMounted as Fe, watch as ge, openBlock as x, createElementBlock as R, computed as U, resolveComponent as Et, mergeProps as se, Fragment as j, renderList as Y, normalizeStyle as ce, createBlock as ye, toDisplayString as G, createCommentVNode as xe, normalizeClass as Be, createTextVNode as Tt, createElementVNode as O, onUnmounted as St, nextTick as Xe, onBeforeUnmount as Mt, renderSlot as At, withCtx as xt, createVNode as Rt } from "vue";
5
5
  import "./designer-ui.js";
6
- import xt from "dompurify";
7
- import At from "@panzoom/panzoom";
8
- import { VuePrintNext as Rt } from "vue-print-next";
9
- const Nt = 10;
10
- function un(e) {
6
+ import Nt from "dompurify";
7
+ import Ft from "@panzoom/panzoom";
8
+ import { VuePrintNext as kt } from "vue-print-next";
9
+ const It = 10;
10
+ function bn(e) {
11
11
  return !!(e && e.type !== "grid-row" && e.type !== "grid-cell" && e.type !== "table-cell-template");
12
12
  }
13
- const Ft = {
13
+ const Ct = {
14
14
  A4: { short: 210, long: 297 },
15
15
  A3: { short: 297, long: 420 }
16
16
  };
17
- function Be(e) {
18
- const t = (e == null ? void 0 : e.size) === "A3" ? "A3" : "A4", n = Ft[t], r = t === "A3" ? "landscape" : "portrait";
17
+ function ze(e) {
18
+ const t = (e == null ? void 0 : e.size) === "A3" ? "A3" : "A4", n = Ct[t], r = t === "A3" ? "landscape" : "portrait";
19
19
  return r === "portrait" ? { size: t, orientation: r, widthMm: n.short, heightMm: n.long } : { size: t, orientation: r, widthMm: n.long, heightMm: n.short };
20
20
  }
21
- function rt(e, t) {
22
- return se(e).get(t);
21
+ function it(e, t) {
22
+ return ie(e).get(t);
23
23
  }
24
- function dn(e, t) {
24
+ function vn(e, t) {
25
25
  var n;
26
- return (n = rt(e, t)) == null ? void 0 : n.node;
26
+ return (n = it(e, t)) == null ? void 0 : n.node;
27
27
  }
28
- function fn(e, t) {
28
+ function En(e, t) {
29
29
  var n;
30
- return (n = rt(e, t)) == null ? void 0 : n.ownerCell;
30
+ return (n = it(e, t)) == null ? void 0 : n.ownerCell;
31
31
  }
32
- function mn(e, t) {
33
- const n = se(e), r = n.get(t);
32
+ function Tn(e, t) {
33
+ const n = ie(e), r = n.get(t);
34
34
  if (!r) return [];
35
35
  const i = [];
36
36
  let o = r.parent;
@@ -46,60 +46,60 @@ function Ee(e, t, n, r, i) {
46
46
  throw new Error(`Duplicate Schema V2 node id: ${t.id}`);
47
47
  e.set(t.id, { node: t, parent: n, path: r, ownerCell: i });
48
48
  }
49
- function Ge(e, t, n, r, i) {
50
- Ee(e, t, n, r, i), t.type === "grid" ? t.rows.forEach((o, a) => kt(e, o, t, [...r, "rows", a])) : t.type === "table" && t.rowTemplate.forEach((o, a) => {
49
+ function We(e, t, n, r, i) {
50
+ Ee(e, t, n, r, i), t.type === "grid" ? t.rows.forEach((o, a) => Lt(e, o, t, [...r, "rows", a])) : t.type === "table" && t.rowTemplate.forEach((o, a) => {
51
51
  const l = [...r, "rowTemplate", a];
52
52
  Ee(e, o, t, l), o.children.forEach(
53
- (c, d) => Ge(e, c, o, [...l, "children", d], o)
53
+ (c, u) => We(e, c, o, [...l, "children", u], o)
54
54
  );
55
55
  });
56
56
  }
57
- function kt(e, t, n, r) {
57
+ function Lt(e, t, n, r) {
58
58
  Ee(e, t, n, r), t.cells.forEach((i, o) => {
59
59
  const a = [...r, "cells", o];
60
60
  Ee(e, i, t, a), i.children.forEach(
61
- (l, c) => Ge(e, l, i, [...a, "children", c], i)
61
+ (l, c) => We(e, l, i, [...a, "children", c], i)
62
62
  );
63
63
  });
64
64
  }
65
- function se(e) {
65
+ function ie(e) {
66
66
  const t = /* @__PURE__ */ new Map();
67
67
  return e.pages.forEach((n, r) => {
68
68
  const i = ["pages", r];
69
69
  Ee(t, n, null, i), n.children.forEach(
70
- (o, a) => Ge(t, o, n, [...i, "children", a])
70
+ (o, a) => We(t, o, n, [...i, "children", a])
71
71
  );
72
72
  }), t;
73
73
  }
74
- function F(e, t, n, r, i, o) {
74
+ function I(e, t, n, r, i, o) {
75
75
  e.push({ level: t, code: n, nodeId: r == null ? void 0 : r.id, path: i, message: o });
76
76
  }
77
- function le(e) {
77
+ function ne(e) {
78
78
  return typeof e == "number" && Number.isFinite(e) && e > 0;
79
79
  }
80
- function nt(e) {
81
- return e === "auto" ? !0 : typeof e == "number" ? le(e) : typeof e == "string" && /^\d+(?:\.\d+)?fr$/.test(e);
80
+ function ot(e) {
81
+ return e === "auto" ? !0 : typeof e == "number" ? ne(e) : typeof e == "string" && /^\d+(?:\.\d+)?fr$/.test(e);
82
82
  }
83
- const It = 25.4 / 96, it = 13, Lt = 12;
84
- function Ct(e) {
83
+ const $t = 25.4 / 96, at = 13, Dt = 12;
84
+ function Ht(e) {
85
85
  return /[\u3000-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/.test(e);
86
86
  }
87
- function ot(e, t) {
87
+ function lt(e, t) {
88
88
  let n = 0;
89
- for (const r of e) n += Ct(r) ? 1 : 0.5;
90
- return n * t * It;
89
+ for (const r of e) n += Ht(r) ? 1 : 0.5;
90
+ return n * t * $t;
91
91
  }
92
92
  function be(e) {
93
93
  return `${Math.round(e * 10) / 10}`;
94
94
  }
95
- function $t(e, t, n, r) {
95
+ function Pt(e, t, n, r) {
96
96
  var l, c;
97
97
  if (!t || ((l = e.style) == null ? void 0 : l.writingMode) === "vertical-rl") return;
98
- const i = ((c = e.style) == null ? void 0 : c.fontSize) ?? it;
98
+ const i = ((c = e.style) == null ? void 0 : c.fontSize) ?? at;
99
99
  let o;
100
- if ((e.prefix || e.suffix) && (o = ot(`${e.prefix ?? ""}${e.suffix ?? ""}`, i) + Lt), o === void 0) return;
100
+ if ((e.prefix || e.suffix) && (o = lt(`${e.prefix ?? ""}${e.suffix ?? ""}`, i) + Dt), o === void 0) return;
101
101
  const a = t.widthMm - 2 * t.paddingMm;
102
- o > a && F(
102
+ o > a && I(
103
103
  r,
104
104
  "warning",
105
105
  "CONTENT_OVERFLOW",
@@ -108,19 +108,19 @@ function $t(e, t, n, r) {
108
108
  `字段内容估算宽度约 ${be(o)}mm,超过可用宽度 ${be(a)}mm,可能显示不全`
109
109
  );
110
110
  }
111
- function Dt(e, t) {
111
+ function Vt(e, t) {
112
112
  return e.type === "grid" ? e.rows.reduce((n, r) => n + Math.max(0, r.height), 0) * t : e.type === "p" ? t : e.type === "table" ? Math.max(0, 1 + e.minRows) * t : e.type === "image" ? !e.src && !e.field ? 0 : Math.max(0, e.height ?? 0) : 0;
113
113
  }
114
- function Ht(e, t) {
115
- const { heightMm: n } = Be(e.paper);
114
+ function _t(e, t) {
115
+ const { heightMm: n } = ze(e.paper);
116
116
  return n - t.margin.top - t.margin.bottom;
117
117
  }
118
- function Vt(e, t, n, r) {
118
+ function Ot(e, t, n, r) {
119
119
  const i = t.children.reduce(
120
- (a, l) => a + Dt(l, e.baseRowHeight),
120
+ (a, l) => a + Vt(l, e.baseRowHeight),
121
121
  0
122
- ), o = Ht(e, t);
123
- i > o && F(
122
+ ), o = _t(e, t);
123
+ i > o && I(
124
124
  r,
125
125
  "warning",
126
126
  "PAPER_OVERFLOW",
@@ -129,62 +129,62 @@ function Vt(e, t, n, r) {
129
129
  `页面内容最低高度约 ${be(i)}mm,超过一页可用高度 ${be(o)}mm,打印时会自动分成多页`
130
130
  );
131
131
  }
132
- function Pt(e, t, n) {
132
+ function Gt(e, t, n) {
133
133
  if (!e) return;
134
134
  let r = 0;
135
135
  for (let i = t; i < t + n; i += 1) {
136
136
  const o = e[i];
137
- if (typeof o == "number" && le(o))
137
+ if (typeof o == "number" && ne(o))
138
138
  r = (r ?? 0) + o;
139
139
  else
140
140
  return;
141
141
  }
142
142
  return r;
143
143
  }
144
- function _t(e, t, n) {
144
+ function Bt(e, t, n) {
145
145
  if (!Array.isArray(e.rows) || e.rows.length === 0) {
146
- F(n, "error", "INVALID_GRID_ROWS", e, t, "格子至少需要一行");
146
+ I(n, "error", "INVALID_GRID_ROWS", e, t, "格子至少需要一行");
147
147
  return;
148
148
  }
149
- e.rows.forEach((r, i) => Ot(r, e, [...t, "rows", i], n)), e.gap !== void 0 && !le(e.gap) && F(n, "warning", "INVALID_GRID_GAP", e, t, "格子间距必须是正数(mm)");
149
+ e.rows.forEach((r, i) => zt(r, e, [...t, "rows", i], n)), e.gap !== void 0 && !ne(e.gap) && I(n, "warning", "INVALID_GRID_GAP", e, t, "格子间距必须是正数(mm)");
150
150
  }
151
- function Ot(e, t, n, r) {
152
- if (le(e.height) || F(r, "error", "INVALID_ROW_HEIGHT", e, n, "行高必须是正数"), !Array.isArray(e.cells) || e.cells.length === 0) {
153
- F(r, "error", "INVALID_GRID_CELLS", e, n, "该行至少需要一个格子");
151
+ function zt(e, t, n, r) {
152
+ if (ne(e.height) || I(r, "error", "INVALID_ROW_HEIGHT", e, n, "行高必须是正数"), !Array.isArray(e.cells) || e.cells.length === 0) {
153
+ I(r, "error", "INVALID_GRID_CELLS", e, n, "该行至少需要一个格子");
154
154
  return;
155
155
  }
156
156
  let i = 0;
157
157
  e.cells.forEach((o, a) => {
158
- Bt(o, [...n, "cells", a], r);
158
+ Wt(o, [...n, "cells", a], r);
159
159
  const l = o.colspan ?? 1;
160
- (!Number.isInteger(l) || l < 1) && F(r, "error", "INVALID_COLSPAN", o, [...n, "cells", a], "合并格数必须是正整数"), i += Number.isInteger(l) && l > 0 ? l : 0;
161
- }), t.rows.some((o) => o.cells.length > 0) && i < 1 && F(r, "error", "INVALID_GRID_COLUMNS", t, n, "该行没有可用的格子");
160
+ (!Number.isInteger(l) || l < 1) && I(r, "error", "INVALID_COLSPAN", o, [...n, "cells", a], "合并格数必须是正整数"), i += Number.isInteger(l) && l > 0 ? l : 0;
161
+ }), t.rows.some((o) => o.cells.length > 0) && i < 1 && I(r, "error", "INVALID_GRID_COLUMNS", t, n, "该行没有可用的格子");
162
162
  }
163
- function Bt(e, t, n) {
164
- e.width !== void 0 && !nt(e.width) && F(n, "error", "INVALID_CELL_WIDTH", e, t, "格子宽度必须是正数(mm)、比例(如 1fr)或 auto"), e.padding !== void 0 && (!Number.isFinite(e.padding) || e.padding < 0) && F(n, "error", "INVALID_CELL_PADDING", e, t, "内边距不能是负数");
163
+ function Wt(e, t, n) {
164
+ e.width !== void 0 && !ot(e.width) && I(n, "error", "INVALID_CELL_WIDTH", e, t, "格子宽度必须是正数(mm)、比例(如 1fr)或 auto"), e.padding !== void 0 && (!Number.isFinite(e.padding) || e.padding < 0) && I(n, "error", "INVALID_CELL_PADDING", e, t, "内边距不能是负数");
165
165
  }
166
- function Gt(e, t, n) {
166
+ function Ut(e, t, n) {
167
167
  if (!Array.isArray(e.columns) || e.columns.length === 0) {
168
- F(n, "error", "INVALID_TABLE_COLUMNS", e, t, "表格至少需要一列");
168
+ I(n, "error", "INVALID_TABLE_COLUMNS", e, t, "表格至少需要一列");
169
169
  return;
170
170
  }
171
171
  const r = /* @__PURE__ */ new Set();
172
172
  e.columns.forEach((o, a) => {
173
173
  const l = [...t, "columns", a];
174
- (!o.key.trim() || r.has(o.key)) && F(n, "error", "DUPLICATE_TABLE_COLUMN", e, l, `列字段重复或为空:${o.key}`), r.add(o.key), o.width !== void 0 && !nt(o.width) && F(n, "error", "INVALID_TABLE_COLUMN_WIDTH", e, l, `列「${o.key}」的宽度不合法`);
175
- }), (!Number.isInteger(e.minRows) || e.minRows < 0) && F(n, "error", "INVALID_TABLE_MIN_ROWS", e, t, "表格最小行数必须是不小于 0 的整数");
174
+ (!o.key.trim() || r.has(o.key)) && I(n, "error", "DUPLICATE_TABLE_COLUMN", e, l, `列字段重复或为空:${o.key}`), r.add(o.key), o.width !== void 0 && !ot(o.width) && I(n, "error", "INVALID_TABLE_COLUMN_WIDTH", e, l, `列「${o.key}」的宽度不合法`);
175
+ }), (!Number.isInteger(e.minRows) || e.minRows < 0) && I(n, "error", "INVALID_TABLE_MIN_ROWS", e, t, "表格最小行数必须是不小于 0 的整数");
176
176
  const i = /* @__PURE__ */ new Set();
177
177
  e.rowTemplate.forEach((o, a) => {
178
178
  const l = [...t, "rowTemplate", a];
179
- (!r.has(o.columnKey) || i.has(o.columnKey)) && F(n, "error", "INVALID_TABLE_TEMPLATE", o, l, `行模板引用了不存在的列:${o.columnKey}`), i.add(o.columnKey);
179
+ (!r.has(o.columnKey) || i.has(o.columnKey)) && I(n, "error", "INVALID_TABLE_TEMPLATE", o, l, `行模板引用了不存在的列:${o.columnKey}`), i.add(o.columnKey);
180
180
  });
181
181
  for (const o of r)
182
- i.has(o) || F(n, "warning", "MISSING_TABLE_TEMPLATE", e, t, `列「${o}」缺少行模板`);
182
+ i.has(o) || I(n, "warning", "MISSING_TABLE_TEMPLATE", e, t, `列「${o}」缺少行模板`);
183
183
  }
184
- function He(e, t, n, r, i, o = !1) {
184
+ function Pe(e, t, n, r, i, o = !1) {
185
185
  var l, c;
186
186
  if (!(/* @__PURE__ */ new Set(["text", "p", "grid", "table", "image", "html"])).has(e.type)) {
187
- F(
187
+ I(
188
188
  n,
189
189
  "error",
190
190
  "UNKNOWN_NODE_TYPE",
@@ -196,56 +196,56 @@ function He(e, t, n, r, i, o = !1) {
196
196
  }
197
197
  if (e.type === "text") {
198
198
  if (i && ((l = e.style) == null ? void 0 : l.writingMode) !== "vertical-rl") {
199
- const d = ((c = e.style) == null ? void 0 : c.fontSize) ?? it, h = ot(e.text, d), p = i.widthMm - 2 * i.paddingMm;
200
- h > p && F(
199
+ const u = ((c = e.style) == null ? void 0 : c.fontSize) ?? at, m = lt(e.text, u), g = i.widthMm - 2 * i.paddingMm;
200
+ m > g && I(
201
201
  n,
202
202
  "warning",
203
203
  "CONTENT_OVERFLOW",
204
204
  e,
205
205
  t,
206
- `文本估算宽度约 ${be(h)}mm,超过格子可用宽度 ${be(p)}mm,可能显示不全`
206
+ `文本估算宽度约 ${be(m)}mm,超过格子可用宽度 ${be(g)}mm,可能显示不全`
207
207
  );
208
208
  }
209
- e.text.trim() || F(n, "warning", "EMPTY_STATIC_TEXT", e, t, "文本内容为空");
210
- } else e.type === "p" ? ($t(e, i, t, n), e.mode === "field" && !o && (e.field.trim() ? r.has(e.field) ? F(n, "warning", "DUPLICATE_FIELD", e, t, `字段名已被其他字段使用:${e.field}`) : r.set(e.field, e.id) : F(n, "warning", "EMPTY_FIELD", e, t, "字段名为空"))) : e.type === "grid" ? (_t(e, t, n), e.rows.forEach((d, h) => {
211
- let p = 0;
212
- d.cells.forEach((b, y) => {
213
- const M = b.colspan ?? 1, w = M === 1 ? Pt(e.columns, p, 1) ?? (typeof b.width == "number" && le(b.width) ? b.width : void 0) : void 0, f = w !== void 0 ? { widthMm: w, paddingMm: b.padding ?? e.cellPadding ?? 0 } : void 0;
214
- b.children.forEach(
215
- (u, m) => He(u, [...t, "rows", h, "cells", y, "children", m], n, r, f, o)
216
- ), p += M;
209
+ e.text.trim() || I(n, "warning", "EMPTY_STATIC_TEXT", e, t, "文本内容为空");
210
+ } else e.type === "p" ? (Pt(e, i, t, n), e.mode === "field" && !o && (e.field.trim() ? r.has(e.field) ? I(n, "warning", "DUPLICATE_FIELD", e, t, `字段名已被其他字段使用:${e.field}`) : r.set(e.field, e.id) : I(n, "warning", "EMPTY_FIELD", e, t, "字段名为空"))) : e.type === "grid" ? (Bt(e, t, n), e.rows.forEach((u, m) => {
211
+ let g = 0;
212
+ u.cells.forEach((v, w) => {
213
+ const M = v.colspan ?? 1, b = M === 1 ? Gt(e.columns, g, 1) ?? (typeof v.width == "number" && ne(v.width) ? v.width : void 0) : void 0, f = b !== void 0 ? { widthMm: b, paddingMm: v.padding ?? e.cellPadding ?? 0 } : void 0;
214
+ v.children.forEach(
215
+ (h, d) => Pe(h, [...t, "rows", m, "cells", w, "children", d], n, r, f, o)
216
+ ), g += M;
217
217
  });
218
- })) : e.type === "table" ? (Gt(e, t, n), e.rowTemplate.forEach((d, h) => {
219
- const p = e.columns.find((y) => y.key === d.columnKey), b = p && typeof p.width == "number" && le(p.width) ? { widthMm: p.width, paddingMm: 0 } : void 0;
220
- d.children.forEach(
221
- (y, M) => He(y, [...t, "rowTemplate", h, "children", M], n, r, b, !0)
218
+ })) : e.type === "table" ? (Ut(e, t, n), e.rowTemplate.forEach((u, m) => {
219
+ const g = e.columns.find((w) => w.key === u.columnKey), v = g && typeof g.width == "number" && ne(g.width) ? { widthMm: g.width, paddingMm: 0 } : void 0;
220
+ u.children.forEach(
221
+ (w, M) => Pe(w, [...t, "rowTemplate", m, "children", M], n, r, v, !0)
222
222
  );
223
- })) : e.type === "image" && (!e.src && !e.field && F(n, "warning", "IMAGE_WITHOUT_SOURCE", e, t, "图片未设置地址或数据字段"), (e.width !== void 0 && !le(e.width) || e.height !== void 0 && !le(e.height)) && F(n, "error", "INVALID_IMAGE_DIMENSION", e, t, "图片宽高必须是正数"));
223
+ })) : e.type === "image" && (!e.src && !e.field && I(n, "warning", "IMAGE_WITHOUT_SOURCE", e, t, "图片未设置地址或数据字段"), (e.width !== void 0 && !ne(e.width) || e.height !== void 0 && !ne(e.height)) && I(n, "error", "INVALID_IMAGE_DIMENSION", e, t, "图片宽高必须是正数"));
224
224
  }
225
- function ze(e) {
225
+ function Ue(e) {
226
226
  const t = [];
227
- e.version !== 2 && F(t, "error", "INVALID_VERSION", void 0, void 0, "不是有效的表单模板文件(Schema V2)"), le(e.baseRowHeight) || F(t, "error", "INVALID_BASE_ROW_HEIGHT", void 0, ["baseRowHeight"], "基础行高必须是正数");
227
+ e.version !== 2 && I(t, "error", "INVALID_VERSION", void 0, void 0, "不是有效的表单模板文件(Schema V2)"), ne(e.baseRowHeight) || I(t, "error", "INVALID_BASE_ROW_HEIGHT", void 0, ["baseRowHeight"], "基础行高必须是正数");
228
228
  const n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map(), i = (o, a) => {
229
- n.has(o.id) && F(t, "error", "DUPLICATE_ID", o, a, `存在重复的节点 ID:${o.id}`), n.add(o.id);
229
+ n.has(o.id) && I(t, "error", "DUPLICATE_ID", o, a, `存在重复的节点 ID:${o.id}`), n.add(o.id);
230
230
  };
231
231
  e.pages.forEach((o, a) => {
232
232
  const l = ["pages", a];
233
- i(o, l), o.children.length || F(t, "warning", "EMPTY_PAGE", o, l, "页面没有内容"), Vt(e, o, l, t), o.children.forEach(
234
- (c, d) => He(c, [...l, "children", d], t, r, void 0)
233
+ i(o, l), o.children.length || I(t, "warning", "EMPTY_PAGE", o, l, "页面没有内容"), Ot(e, o, l, t), o.children.forEach(
234
+ (c, u) => Pe(c, [...l, "children", u], t, r, void 0)
235
235
  );
236
236
  });
237
237
  try {
238
- se(e);
238
+ ie(e);
239
239
  } catch (o) {
240
- F(t, "error", "INDEX_BUILD_FAILED", void 0, void 0, o instanceof Error ? o.message : String(o));
240
+ I(t, "error", "INDEX_BUILD_FAILED", void 0, void 0, o instanceof Error ? o.message : String(o));
241
241
  }
242
242
  return t;
243
243
  }
244
- function P(e) {
244
+ function V(e) {
245
245
  return `${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 7)}`;
246
246
  }
247
247
  function me(e) {
248
- const t = (n) => P(n);
248
+ const t = (n) => V(n);
249
249
  return e.type === "grid-row" ? {
250
250
  ...e,
251
251
  id: t("row"),
@@ -280,123 +280,123 @@ function me(e) {
280
280
  }))
281
281
  } : { ...e, id: t(e.type) };
282
282
  }
283
- function zt(e) {
283
+ function jt(e) {
284
284
  return me(e);
285
285
  }
286
- function We(e, t, n) {
286
+ function je(e, t, n) {
287
287
  const r = e.id === t ? n(e) : e;
288
288
  return r.type === "grid" ? {
289
289
  ...r,
290
- rows: r.rows.map((i) => Wt(i, t, n))
290
+ rows: r.rows.map((i) => Kt(i, t, n))
291
291
  } : r.type === "table" ? {
292
292
  ...r,
293
- rowTemplate: r.rowTemplate.map((i) => Kt(i, t, n))
293
+ rowTemplate: r.rowTemplate.map((i) => Yt(i, t, n))
294
294
  } : r;
295
295
  }
296
- function Wt(e, t, n) {
296
+ function Kt(e, t, n) {
297
297
  const r = e.id === t ? n(e) : e;
298
298
  return {
299
299
  ...r,
300
- cells: r.cells.map((i) => Ut(i, t, n))
300
+ cells: r.cells.map((i) => qt(i, t, n))
301
301
  };
302
302
  }
303
- function Ut(e, t, n) {
303
+ function qt(e, t, n) {
304
304
  const r = e.id === t ? n(e) : e;
305
305
  return {
306
306
  ...r,
307
- children: r.children.map((i) => We(i, t, n))
307
+ children: r.children.map((i) => je(i, t, n))
308
308
  };
309
309
  }
310
- function Kt(e, t, n) {
310
+ function Yt(e, t, n) {
311
311
  const r = e.id === t ? n(e) : e;
312
312
  return {
313
313
  ...r,
314
- children: r.children.map((i) => We(i, t, n))
314
+ children: r.children.map((i) => je(i, t, n))
315
315
  };
316
316
  }
317
- function qt(e, t, n) {
317
+ function Jt(e, t, n) {
318
318
  const r = e.id === t ? n(e) : e;
319
319
  return {
320
320
  ...r,
321
- children: r.children.map((i) => We(i, t, n))
321
+ children: r.children.map((i) => je(i, t, n))
322
322
  };
323
323
  }
324
- function k(e, t, n) {
324
+ function L(e, t, n) {
325
325
  return {
326
326
  ...e,
327
- pages: e.pages.map((r) => qt(r, t, n))
327
+ pages: e.pages.map((r) => Jt(r, t, n))
328
328
  };
329
329
  }
330
- function jt(e, t, n, r) {
331
- return k(e, t, (i) => {
330
+ function Xt(e, t, n, r) {
331
+ return L(e, t, (i) => {
332
332
  if (i.type !== "grid") return i;
333
333
  const o = Math.max(0, Math.min(r ?? i.rows.length, i.rows.length)), a = [...i.rows];
334
334
  return a.splice(o, 0, n), { ...i, rows: a };
335
335
  });
336
336
  }
337
- function hn(e, t, n = 1) {
338
- return k(e, t, (r) => r.type !== "table" ? r : { ...r, minRows: Math.max(0, r.minRows + n) });
337
+ function Sn(e, t, n = 1) {
338
+ return L(e, t, (r) => r.type !== "table" ? r : { ...r, minRows: Math.max(0, r.minRows + n) });
339
339
  }
340
- function gn(e, t, n) {
341
- return k(
340
+ function Mn(e, t, n) {
341
+ return L(
342
342
  e,
343
343
  t,
344
344
  (r) => r.type === "grid" ? { ...r, border: n } : r
345
345
  );
346
346
  }
347
- function pn(e, t, n) {
348
- return k(
347
+ function An(e, t, n) {
348
+ return L(
349
349
  e,
350
350
  t,
351
351
  (r) => r.type === "table" ? { ...r, border: n } : r
352
352
  );
353
353
  }
354
- function yn(e, t, n) {
355
- return k(
354
+ function xn(e, t, n) {
355
+ return L(
356
356
  e,
357
357
  t,
358
358
  (r) => r.type === "grid-row" ? { ...r, height: n } : r
359
359
  );
360
360
  }
361
- function wn(e, t, n) {
362
- return k(
361
+ function Rn(e, t, n) {
362
+ return L(
363
363
  e,
364
364
  t,
365
365
  (r) => r.type === "grid-cell" ? { ...r, width: n } : r
366
366
  );
367
367
  }
368
- function bn(e, t, n) {
368
+ function Nn(e, t, n) {
369
369
  const r = Number.isFinite(n) && n > 0 ? n : 0;
370
- return k(
370
+ return L(
371
371
  e,
372
372
  t,
373
373
  (i) => i.type === "grid-cell" ? { ...i, padding: r } : i
374
374
  );
375
375
  }
376
- function vn(e, t, n) {
377
- return k(
376
+ function Fn(e, t, n) {
377
+ return L(
378
378
  e,
379
379
  t,
380
380
  (r) => r.type === "grid-cell" ? { ...r, align: n } : r
381
381
  );
382
382
  }
383
- function En(e, t, n) {
384
- return k(
383
+ function kn(e, t, n) {
384
+ return L(
385
385
  e,
386
386
  t,
387
387
  (r) => r.type === "grid-cell" ? { ...r, verticalAlign: n } : r
388
388
  );
389
389
  }
390
- function Tn(e, t, n) {
391
- return k(
390
+ function In(e, t, n) {
391
+ return L(
392
392
  e,
393
393
  t,
394
394
  (r) => r.type === "grid" ? { ...r, ...n } : r
395
395
  );
396
396
  }
397
- function Sn(e, t, n) {
397
+ function Cn(e, t, n) {
398
398
  const r = typeof n == "number" && Number.isFinite(n) && n > 0 ? n : void 0;
399
- return k(
399
+ return L(
400
400
  e,
401
401
  t,
402
402
  (i) => i.type === "grid" ? { ...i, gap: r } : i
@@ -406,17 +406,17 @@ function Re(e) {
406
406
  const t = e.gap;
407
407
  return typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 0;
408
408
  }
409
- function Mn(e, t, n) {
410
- return k(
409
+ function Ln(e, t, n) {
410
+ return L(
411
411
  e,
412
412
  t,
413
413
  (r) => r.type === "table" ? { ...r, minRows: Math.max(0, Math.floor(n)) } : r
414
414
  );
415
415
  }
416
- function xn(e, t, n) {
417
- return k(e, t, (r) => {
416
+ function $n(e, t, n) {
417
+ return L(e, t, (r) => {
418
418
  if (r.type !== "table") return r;
419
- const i = new Set(r.columns.map((d) => d.key));
419
+ const i = new Set(r.columns.map((u) => u.key));
420
420
  let o = r.columns.length + 1, a = `col${o}`;
421
421
  for (; i.has(a); )
422
422
  o += 1, a = `col${o}`;
@@ -426,12 +426,12 @@ function xn(e, t, n) {
426
426
  width: (n == null ? void 0 : n.width) ?? "1fr",
427
427
  align: n == null ? void 0 : n.align
428
428
  }, c = {
429
- id: P(`${r.id}-${a}`),
429
+ id: V(`${r.id}-${a}`),
430
430
  type: "table-cell-template",
431
431
  columnKey: a,
432
432
  children: [
433
433
  {
434
- id: P(`${r.id}-${a}-p`),
434
+ id: V(`${r.id}-${a}-p`),
435
435
  type: "p",
436
436
  mode: "field",
437
437
  // 字段名由渲染期按「列key_行号」自动派生(见 schema-v2-table-rows.ts),
@@ -448,16 +448,16 @@ function xn(e, t, n) {
448
448
  };
449
449
  });
450
450
  }
451
- function An(e, t, n) {
452
- return k(e, t, (r) => r.type !== "table" || r.columns.length <= 1 ? r : {
451
+ function Dn(e, t, n) {
452
+ return L(e, t, (r) => r.type !== "table" || r.columns.length <= 1 ? r : {
453
453
  ...r,
454
454
  columns: r.columns.filter((i) => i.key !== n),
455
455
  rowTemplate: r.rowTemplate.filter((i) => i.columnKey !== n)
456
456
  });
457
457
  }
458
- function Rn(e, t, n, r) {
458
+ function Hn(e, t, n, r) {
459
459
  const i = r.trim();
460
- return !i || i === n ? e : k(e, t, (o) => o.type !== "table" || o.columns.some((a) => a.key === i) ? o : {
460
+ return !i || i === n ? e : L(e, t, (o) => o.type !== "table" || o.columns.some((a) => a.key === i) ? o : {
461
461
  ...o,
462
462
  columns: o.columns.map(
463
463
  (a) => a.key === n ? { ...a, key: i } : a
@@ -467,28 +467,28 @@ function Rn(e, t, n, r) {
467
467
  )
468
468
  });
469
469
  }
470
- function Nn(e, t, n, r) {
471
- return k(e, t, (i) => i.type !== "table" ? i : {
470
+ function Pn(e, t, n, r) {
471
+ return L(e, t, (i) => i.type !== "table" ? i : {
472
472
  ...i,
473
473
  columns: i.columns.map(
474
474
  (o) => o.key === n ? { ...o, ...r } : o
475
475
  )
476
476
  });
477
477
  }
478
- function Fn(e, t) {
478
+ function Vn(e, t) {
479
479
  return { ...e, baseRowHeight: Math.max(1, Math.min(99, Math.floor(t))) };
480
480
  }
481
- function kn(e, t) {
481
+ function _n(e, t) {
482
482
  return { ...e, paper: t };
483
483
  }
484
- function In() {
484
+ function On() {
485
485
  return {
486
486
  version: 2,
487
487
  paper: { size: "A4" },
488
488
  baseRowHeight: 8,
489
489
  pages: [
490
490
  {
491
- id: P("page"),
491
+ id: V("page"),
492
492
  type: "page",
493
493
  mode: "fixed",
494
494
  margin: { top: 12, right: 12, bottom: 12, left: 12 },
@@ -500,58 +500,58 @@ function In() {
500
500
  function ke(e = 1, t = 1) {
501
501
  const n = Math.max(1, Math.floor(e));
502
502
  return {
503
- id: P("row"),
503
+ id: V("row"),
504
504
  type: "grid-row",
505
505
  height: Math.max(1, Math.floor(t)),
506
506
  cells: Array.from({ length: n }, (r, i) => ({
507
- id: P(`cell-${i + 1}`),
507
+ id: V(`cell-${i + 1}`),
508
508
  type: "grid-cell",
509
509
  width: "1fr",
510
510
  children: []
511
511
  }))
512
512
  };
513
513
  }
514
- function Jt(e, t, n) {
515
- return k(
514
+ function Zt(e, t, n) {
515
+ return L(
516
516
  e,
517
517
  t,
518
518
  (r) => r.type === "grid-cell" || r.type === "table-cell-template" ? { ...r, children: [...r.children, n] } : r
519
519
  );
520
520
  }
521
- function Ln(e, t, n) {
521
+ function Gn(e, t, n) {
522
522
  var l, c;
523
- const r = se(e), i = r.get(t), o = r.get(n);
523
+ const r = ie(e), i = r.get(t), o = r.get(n);
524
524
  if ((i == null ? void 0 : i.node.type) !== "grid-cell" || (o == null ? void 0 : o.node.type) !== "grid-cell" || ((l = i.parent) == null ? void 0 : l.type) !== "grid-row" || i.parent.id !== ((c = o.parent) == null ? void 0 : c.id)) return e;
525
525
  const a = i.parent.id;
526
- return k(e, a, (d) => {
527
- if (d.type !== "grid-row") return d;
528
- const h = d.cells.findIndex((w) => w.id === t), p = d.cells.findIndex((w) => w.id === n);
529
- if (h < 0 || p < 0 || h === p) return d;
530
- const b = d.cells[h], y = d.cells[p], M = {
531
- ...b,
532
- colspan: (b.colspan ?? 1) + (y.colspan ?? 1),
533
- children: [...b.children, ...y.children]
526
+ return L(e, a, (u) => {
527
+ if (u.type !== "grid-row") return u;
528
+ const m = u.cells.findIndex((b) => b.id === t), g = u.cells.findIndex((b) => b.id === n);
529
+ if (m < 0 || g < 0 || m === g) return u;
530
+ const v = u.cells[m], w = u.cells[g], M = {
531
+ ...v,
532
+ colspan: (v.colspan ?? 1) + (w.colspan ?? 1),
533
+ children: [...v.children, ...w.children]
534
534
  };
535
535
  return {
536
- ...d,
537
- cells: d.cells.filter((w) => w.id !== n).map(
538
- (w) => w.id === t ? M : w
536
+ ...u,
537
+ cells: u.cells.filter((b) => b.id !== n).map(
538
+ (b) => b.id === t ? M : b
539
539
  )
540
540
  };
541
541
  });
542
542
  }
543
- function Cn(e, t) {
544
- const r = se(e).get(t);
543
+ function Bn(e, t) {
544
+ const r = ie(e).get(t);
545
545
  if ((r == null ? void 0 : r.node.type) !== "grid-cell") return e;
546
546
  const i = r.node.colspan ?? 1;
547
547
  if (i <= 1) return e;
548
548
  const o = r.parent;
549
- return !o || o.type !== "grid-row" ? e : k(e, o.id, (a) => {
549
+ return !o || o.type !== "grid-row" ? e : L(e, o.id, (a) => {
550
550
  if (a.type !== "grid-row") return a;
551
- const l = a.cells.findIndex((b) => b.id === t);
551
+ const l = a.cells.findIndex((v) => v.id === t);
552
552
  if (l < 0) return a;
553
- const c = a.cells[l], { colspan: d, ...h } = c, p = Array.from({ length: i - 1 }, () => ({
554
- id: P("cell"),
553
+ const c = a.cells[l], { colspan: u, ...m } = c, g = Array.from({ length: i - 1 }, () => ({
554
+ id: V("cell"),
555
555
  type: "grid-cell",
556
556
  children: []
557
557
  }));
@@ -559,21 +559,21 @@ function Cn(e, t) {
559
559
  ...a,
560
560
  cells: [
561
561
  ...a.cells.slice(0, l),
562
- h,
563
- ...p,
562
+ m,
563
+ ...g,
564
564
  ...a.cells.slice(l + 1)
565
565
  ]
566
566
  };
567
567
  });
568
568
  }
569
- function $n(e, t) {
570
- return k(e, t, (n) => {
569
+ function zn(e, t) {
570
+ return L(e, t, (n) => {
571
571
  if (n.type !== "grid-cell" || n.children.length === 0) return n;
572
- const r = Ue({ rows: 1, columns: 1, border: "none" });
572
+ const r = Ke({ rows: 1, columns: 1, border: "none" });
573
573
  return r.rows[0].cells[0].children = n.children, { ...n, children: [r] };
574
574
  });
575
575
  }
576
- function at(e, t) {
576
+ function st(e, t) {
577
577
  let n;
578
578
  const r = (o) => o.type === "grid" ? {
579
579
  ...o,
@@ -599,95 +599,95 @@ function at(e, t) {
599
599
  }))
600
600
  }, node: n };
601
601
  }
602
- function Dn(e, t, n) {
603
- var d, h;
604
- const r = se(e), i = r.get(t), o = r.get(n);
605
- if (!i || !o || o.node.type !== "grid-cell" && o.node.type !== "table-cell-template" || i.node.type === "page" || i.node.type === "grid-row" || i.node.type === "grid-cell" || i.node.type === "table-cell-template" || ((d = i.parent) == null ? void 0 : d.id) === n) return e;
602
+ function Wn(e, t, n) {
603
+ var u, m;
604
+ const r = ie(e), i = r.get(t), o = r.get(n);
605
+ if (!i || !o || o.node.type !== "grid-cell" && o.node.type !== "table-cell-template" || i.node.type === "page" || i.node.type === "grid-row" || i.node.type === "grid-cell" || i.node.type === "table-cell-template" || ((u = i.parent) == null ? void 0 : u.id) === n) return e;
606
606
  let a = o.parent;
607
607
  for (; a; ) {
608
608
  if (a.id === t) return e;
609
- a = ((h = r.get(a.id)) == null ? void 0 : h.parent) ?? null;
609
+ a = ((m = r.get(a.id)) == null ? void 0 : m.parent) ?? null;
610
610
  }
611
- const { schema: l, node: c } = at(e, t);
612
- return c ? Jt(l, n, c) : e;
611
+ const { schema: l, node: c } = st(e, t);
612
+ return c ? Zt(l, n, c) : e;
613
613
  }
614
- const Hn = "application/x-ticket-node-move";
615
- function Vn(e, t, n, r) {
616
- var w;
617
- const i = se(e), o = i.get(t), a = i.get(n);
614
+ const Un = "application/x-ticket-node-move";
615
+ function jn(e, t, n, r) {
616
+ var b;
617
+ const i = ie(e), o = i.get(t), a = i.get(n);
618
618
  if (!o || !a || a.node.type !== "grid-cell" && a.node.type !== "table-cell-template" || o.node.type === "page" || o.node.type === "grid-row" || o.node.type === "grid-cell" || o.node.type === "table-cell-template") return e;
619
619
  let l = a.parent;
620
620
  for (; l; ) {
621
621
  if (l.id === t) return e;
622
- l = ((w = i.get(l.id)) == null ? void 0 : w.parent) ?? null;
622
+ l = ((b = i.get(l.id)) == null ? void 0 : b.parent) ?? null;
623
623
  }
624
- const c = o.parent, d = c && (c.type === "grid-cell" || c.type === "table-cell-template") ? c.children : null, h = d ? d.findIndex((f) => f.id === t) : -1, p = (c == null ? void 0 : c.id) === n;
625
- if (p && h >= 0 && r === h) return e;
626
- const { schema: b, node: y } = at(e, t);
627
- if (!y) return e;
624
+ const c = o.parent, u = c && (c.type === "grid-cell" || c.type === "table-cell-template") ? c.children : null, m = u ? u.findIndex((f) => f.id === t) : -1, g = (c == null ? void 0 : c.id) === n;
625
+ if (g && m >= 0 && r === m) return e;
626
+ const { schema: v, node: w } = st(e, t);
627
+ if (!w) return e;
628
628
  let M = Number.isFinite(r) ? Math.trunc(r) : 0;
629
- return p && h >= 0 && M > h && (M -= 1), k(b, n, (f) => {
629
+ return g && m >= 0 && M > m && (M -= 1), L(v, n, (f) => {
630
630
  if (f.type !== "grid-cell" && f.type !== "table-cell-template") return f;
631
- const u = Math.max(0, Math.min(M, f.children.length));
632
- return { ...f, children: [...f.children.slice(0, u), y, ...f.children.slice(u)] };
631
+ const h = Math.max(0, Math.min(M, f.children.length));
632
+ return { ...f, children: [...f.children.slice(0, h), w, ...f.children.slice(h)] };
633
633
  });
634
634
  }
635
- function Pn(e, t, n) {
635
+ function Kn(e, t, n) {
636
636
  var c;
637
- const i = (c = se(e).get(t)) == null ? void 0 : c.parent;
637
+ const i = (c = ie(e).get(t)) == null ? void 0 : c.parent;
638
638
  if (!i) return e;
639
- const o = (d) => {
640
- const h = d.findIndex((w) => w.id === t);
641
- if (h < 0) return null;
642
- const p = n === "up" ? h - 1 : h + 1;
643
- if (p < 0 || p >= d.length) return null;
644
- const b = d[h], y = d[p];
645
- if (!b || !y) return null;
646
- const M = [...d];
647
- return M[h] = y, M[p] = b, M;
639
+ const o = (u) => {
640
+ const m = u.findIndex((b) => b.id === t);
641
+ if (m < 0) return null;
642
+ const g = n === "up" ? m - 1 : m + 1;
643
+ if (g < 0 || g >= u.length) return null;
644
+ const v = u[m], w = u[g];
645
+ if (!v || !w) return null;
646
+ const M = [...u];
647
+ return M[m] = w, M[g] = v, M;
648
648
  };
649
649
  let a = null;
650
- const l = k(e, i.id, (d) => {
651
- const h = d.type === "grid-cell" || d.type === "table-cell-template" || d.type === "page" ? d.children : null;
652
- if (!h) return d;
653
- const p = o(h);
654
- return p ? (a = p, { ...d, children: p }) : d;
650
+ const l = L(e, i.id, (u) => {
651
+ const m = u.type === "grid-cell" || u.type === "table-cell-template" || u.type === "page" ? u.children : null;
652
+ if (!m) return u;
653
+ const g = o(m);
654
+ return g ? (a = g, { ...u, children: g }) : u;
655
655
  });
656
656
  return a ? l : e;
657
657
  }
658
- function _n(e, t) {
659
- var c, d;
660
- const n = se(e), r = t ? (d = (c = n.get(t)) == null ? void 0 : c.parent) == null ? void 0 : d.id : void 0, i = (h) => {
661
- var b, y;
662
- let p = h;
663
- for (; p; ) {
664
- if (p === t) return !0;
665
- p = (y = (b = n.get(p)) == null ? void 0 : b.parent) == null ? void 0 : y.id;
658
+ function qn(e, t) {
659
+ var c, u;
660
+ const n = ie(e), r = t ? (u = (c = n.get(t)) == null ? void 0 : c.parent) == null ? void 0 : u.id : void 0, i = (m) => {
661
+ var v, w;
662
+ let g = m;
663
+ for (; g; ) {
664
+ if (g === t) return !0;
665
+ g = (w = (v = n.get(g)) == null ? void 0 : v.parent) == null ? void 0 : w.id;
666
666
  }
667
667
  return !1;
668
- }, o = (h) => h !== r && !(t !== void 0 && i(h)), a = [], l = (h, p) => {
669
- h.forEach((b) => {
670
- if (b.type === "grid") {
671
- const y = `${p}${b.id}`;
672
- b.rows.forEach((M, w) => {
673
- M.cells.forEach((f, u) => {
674
- const m = `${y} · 第${w + 1}行第${u + 1}格`;
675
- o(f.id) && a.push({ id: f.id, label: m }), l(f.children, `${m} › `);
668
+ }, o = (m) => m !== r && !(t !== void 0 && i(m)), a = [], l = (m, g) => {
669
+ m.forEach((v) => {
670
+ if (v.type === "grid") {
671
+ const w = `${g}${v.id}`;
672
+ v.rows.forEach((M, b) => {
673
+ M.cells.forEach((f, h) => {
674
+ const d = `${w} · 第${b + 1}行第${h + 1}格`;
675
+ o(f.id) && a.push({ id: f.id, label: d }), l(f.children, `${d} › `);
676
676
  });
677
677
  });
678
- } else b.type === "table" && b.rowTemplate.forEach((y) => {
679
- if (!o(y.id)) return;
680
- const M = b.columns.find((w) => w.key === y.columnKey);
678
+ } else v.type === "table" && v.rowTemplate.forEach((w) => {
679
+ if (!o(w.id)) return;
680
+ const M = v.columns.find((b) => b.key === w.columnKey);
681
681
  a.push({
682
- id: y.id,
683
- label: `${p}${b.id} · ${(M == null ? void 0 : M.title) ?? y.columnKey}列`
682
+ id: w.id,
683
+ label: `${g}${v.id} · ${(M == null ? void 0 : M.title) ?? w.columnKey}列`
684
684
  });
685
685
  });
686
686
  });
687
687
  };
688
- return e.pages.forEach((h) => l(h.children, "")), a;
688
+ return e.pages.forEach((m) => l(m.children, "")), a;
689
689
  }
690
- function On(e, t) {
690
+ function Yn(e, t) {
691
691
  return e.pages[0] ? {
692
692
  ...e,
693
693
  pages: e.pages.map(
@@ -695,15 +695,15 @@ function On(e, t) {
695
695
  )
696
696
  } : e;
697
697
  }
698
- function Bn(e, t, n) {
699
- return jt(e, t, n);
698
+ function Jn(e, t, n) {
699
+ return Xt(e, t, n);
700
700
  }
701
- function Gn(e, t, n) {
701
+ function Xn(e, t, n) {
702
702
  const r = (i) => {
703
703
  if (i.type === "grid") {
704
704
  const o = i.rows.findIndex((a) => a.id === t);
705
705
  if (o >= 0) {
706
- const a = [...i.rows], l = zt(i.rows[o]), c = Math.max(0, Math.min(n ?? o + 1, a.length));
706
+ const a = [...i.rows], l = jt(i.rows[o]), c = Math.max(0, Math.min(n ?? o + 1, a.length));
707
707
  return a.splice(c, 0, l), { ...i, rows: a };
708
708
  }
709
709
  return {
@@ -727,7 +727,7 @@ function Gn(e, t, n) {
727
727
  pages: e.pages.map((i) => ({ ...i, children: i.children.map(r) }))
728
728
  };
729
729
  }
730
- function zn(e, t) {
730
+ function Zn(e, t) {
731
731
  const n = (r) => r.type === "grid" ? {
732
732
  ...r,
733
733
  rows: r.rows.filter((i) => i.id !== t).map((i) => ({
@@ -772,7 +772,7 @@ function Ve(e, t) {
772
772
  }))
773
773
  } : e;
774
774
  }
775
- function Wn(e, t) {
775
+ function Qn(e, t) {
776
776
  return {
777
777
  ...e,
778
778
  pages: e.pages.filter((n) => n.id !== t).map((n) => ({
@@ -781,7 +781,7 @@ function Wn(e, t) {
781
781
  }))
782
782
  };
783
783
  }
784
- function Un(e, t, n) {
784
+ function ei(e, t, n) {
785
785
  return {
786
786
  ...e,
787
787
  pages: e.pages.map((r) => ({
@@ -798,12 +798,12 @@ function Un(e, t, n) {
798
798
  }))
799
799
  };
800
800
  }
801
- function Kn(e, t, n) {
801
+ function ti(e, t, n) {
802
802
  const r = Math.max(1, Math.floor(n));
803
- return k(e, t, (i) => {
803
+ return L(e, t, (i) => {
804
804
  if (i.type !== "grid-row") return i;
805
805
  const o = i.cells, a = Array.from({ length: r }, (l, c) => o[c] ?? {
806
- id: P(`cell-${c + 1}`),
806
+ id: V(`cell-${c + 1}`),
807
807
  type: "grid-cell",
808
808
  width: "1fr",
809
809
  children: []
@@ -811,17 +811,17 @@ function Kn(e, t, n) {
811
811
  return { ...i, cells: a };
812
812
  });
813
813
  }
814
- function Yt(e = "1fr") {
814
+ function Qt(e = "1fr") {
815
815
  return {
816
- id: P("cell"),
816
+ id: V("cell"),
817
817
  type: "grid-cell",
818
818
  width: e,
819
819
  children: []
820
820
  };
821
821
  }
822
- function lt(e, t) {
822
+ function ct(e, t) {
823
823
  const n = e.cells.slice(0, t);
824
- for (; n.length < t; ) n.push(Yt());
824
+ for (; n.length < t; ) n.push(Qt());
825
825
  if (e.cells.length > t && n.length > 0) {
826
826
  const r = e.cells.slice(t).flatMap((i) => i.children);
827
827
  n[n.length - 1] = {
@@ -831,26 +831,26 @@ function lt(e, t) {
831
831
  }
832
832
  return { ...e, cells: n };
833
833
  }
834
- function qn(e, t, n, r) {
834
+ function ri(e, t, n, r) {
835
835
  const i = Math.max(1, Math.floor(n)), o = Math.max(1, Math.floor(r));
836
- return k(e, t, (a) => {
837
- var h, p;
836
+ return L(e, t, (a) => {
837
+ var m, g;
838
838
  if (a.type !== "grid") return a;
839
- const l = a.rows.slice(0, i).map((b) => lt(b, o)), c = ((h = a.rows[0]) == null ? void 0 : h.height) ?? 1;
839
+ const l = a.rows.slice(0, i).map((v) => ct(v, o)), c = ((m = a.rows[0]) == null ? void 0 : m.height) ?? 1;
840
840
  for (; l.length < i; )
841
841
  l.push(ke(o, c));
842
842
  if (a.rows.length > i && l.length > 0) {
843
- const b = a.rows.slice(i).flatMap((w) => w.cells.flatMap((f) => f.children)), y = l[l.length - 1], M = y.cells[y.cells.length - 1];
844
- y.cells[y.cells.length - 1] = {
843
+ const v = a.rows.slice(i).flatMap((b) => b.cells.flatMap((f) => f.children)), w = l[l.length - 1], M = w.cells[w.cells.length - 1];
844
+ w.cells[w.cells.length - 1] = {
845
845
  ...M,
846
- children: [...M.children, ...b]
846
+ children: [...M.children, ...v]
847
847
  };
848
848
  }
849
- const d = (((p = l[0]) == null ? void 0 : p.cells) ?? []).map((b) => b.width ?? "1fr");
850
- return { ...a, rows: l, columns: d };
849
+ const u = (((g = l[0]) == null ? void 0 : g.cells) ?? []).map((v) => v.width ?? "1fr");
850
+ return { ...a, rows: l, columns: u };
851
851
  });
852
852
  }
853
- function Xt(e) {
853
+ function er(e) {
854
854
  const t = e.rows.find((r) => r.cells.length > 0) ?? e.rows[0], n = [];
855
855
  if (!t) return n;
856
856
  for (const r of t.cells) {
@@ -859,59 +859,59 @@ function Xt(e) {
859
859
  }
860
860
  return n;
861
861
  }
862
- function jn(e, t, n, r) {
863
- return k(e, t, (i) => {
862
+ function ni(e, t, n, r) {
863
+ return L(e, t, (i) => {
864
864
  if (i.type !== "grid") return i;
865
- const a = (i.columns ?? Xt(i)).slice();
865
+ const a = (i.columns ?? er(i)).slice();
866
866
  return n >= 0 && n < a.length && (a[n] = r), {
867
867
  ...i,
868
868
  columns: a,
869
869
  rows: i.rows.map((l) => ({
870
870
  ...l,
871
871
  cells: l.cells.map(
872
- (c, d) => d === n ? { ...c, width: r } : c
872
+ (c, u) => u === n ? { ...c, width: r } : c
873
873
  )
874
874
  }))
875
875
  };
876
876
  });
877
877
  }
878
- function Zt(e, t, n, r) {
878
+ function tr(e, t, n, r) {
879
879
  const i = Math.max(1, Math.floor(n)), o = Math.max(1, Math.floor(r));
880
- return k(e, t, (a) => {
881
- var d, h;
880
+ return L(e, t, (a) => {
881
+ var u, m;
882
882
  if (a.type !== "grid-cell") return a;
883
- const l = a.children.length === 1 && ((d = a.children[0]) == null ? void 0 : d.type) === "grid" ? a.children[0] : void 0;
883
+ const l = a.children.length === 1 && ((u = a.children[0]) == null ? void 0 : u.type) === "grid" ? a.children[0] : void 0;
884
884
  if (l) {
885
- const p = l.rows.slice(0, i).map((y) => lt(y, o)), b = ((h = l.rows[0]) == null ? void 0 : h.height) ?? 1;
886
- for (; p.length < i; ) p.push(ke(o, b));
885
+ const g = l.rows.slice(0, i).map((w) => ct(w, o)), v = ((m = l.rows[0]) == null ? void 0 : m.height) ?? 1;
886
+ for (; g.length < i; ) g.push(ke(o, v));
887
887
  if (l.rows.length > i) {
888
- const y = l.rows.slice(i).flatMap((f) => f.cells.flatMap((u) => u.children)), M = p[p.length - 1], w = M.cells[M.cells.length - 1];
889
- M.cells[M.cells.length - 1] = { ...w, children: [...w.children, ...y] };
888
+ const w = l.rows.slice(i).flatMap((f) => f.cells.flatMap((h) => h.children)), M = g[g.length - 1], b = M.cells[M.cells.length - 1];
889
+ M.cells[M.cells.length - 1] = { ...b, children: [...b.children, ...w] };
890
890
  }
891
891
  return {
892
892
  ...a,
893
- children: [{ ...l, rows: p }]
893
+ children: [{ ...l, rows: g }]
894
894
  };
895
895
  }
896
- const c = Ue({ rows: i, columns: o, border: "none" });
896
+ const c = Ke({ rows: i, columns: o, border: "none" });
897
897
  return c.rows[0].cells[0].children = a.children, { ...a, children: [c] };
898
898
  });
899
899
  }
900
- function Jn(e, t, n) {
901
- return Zt(e, t, n, 1);
900
+ function ii(e, t, n) {
901
+ return tr(e, t, n, 1);
902
902
  }
903
- function Yn(e = ke(), t = "all") {
903
+ function oi(e = ke(), t = "all") {
904
904
  return "type" in e ? {
905
- id: P("grid"),
905
+ id: V("grid"),
906
906
  type: "grid",
907
907
  border: t,
908
908
  rows: [e]
909
- } : Ue(e);
909
+ } : Ke(e);
910
910
  }
911
- function Ue(e = {}) {
911
+ function Ke(e = {}) {
912
912
  const t = Math.max(1, Math.floor(e.rows ?? 1)), n = Math.max(1, Math.floor(e.columns ?? 1)), r = Math.max(1, Math.floor(e.rowHeight ?? 1)), i = e.cellWidth ?? "1fr";
913
913
  return {
914
- id: P("grid"),
914
+ id: V("grid"),
915
915
  type: "grid",
916
916
  border: e.border ?? "all",
917
917
  columns: Array.from({ length: n }, () => i),
@@ -924,14 +924,14 @@ function Ue(e = {}) {
924
924
  })
925
925
  };
926
926
  }
927
- function Xn(e = "固定文本") {
928
- return { id: P("text"), type: "text", text: e };
927
+ function ai(e = "固定文本") {
928
+ return { id: V("text"), type: "text", text: e };
929
929
  }
930
- function Zn(e = "字段") {
931
- return { id: P("p-field"), type: "p", mode: "field", field: e, underline: !0 };
930
+ function li(e = "字段") {
931
+ return { id: V("p-field"), type: "p", mode: "field", field: e, underline: !0 };
932
932
  }
933
- function Qn() {
934
- const e = P("table"), t = [
933
+ function si() {
934
+ const e = V("table"), t = [
935
935
  { key: "col1", title: "列 1", width: "1fr" },
936
936
  { key: "col2", title: "列 2", width: "1fr" }
937
937
  ];
@@ -941,11 +941,11 @@ function Qn() {
941
941
  columns: t,
942
942
  minRows: 4,
943
943
  rowTemplate: t.map((n) => ({
944
- id: P(`${e}-${n.key}`),
944
+ id: V(`${e}-${n.key}`),
945
945
  type: "table-cell-template",
946
946
  columnKey: n.key,
947
947
  children: [{
948
- id: P(`${e}-${n.key}-p`),
948
+ id: V(`${e}-${n.key}-p`),
949
949
  type: "p",
950
950
  mode: "field",
951
951
  // 字段名由渲染期按「列key_行号」自动派生(见 schema-v2-table-rows.ts),
@@ -957,16 +957,16 @@ function Qn() {
957
957
  border: "all"
958
958
  };
959
959
  }
960
- function ei(e = "") {
960
+ function ci(e = "") {
961
961
  return {
962
- id: P("html"),
962
+ id: V("html"),
963
963
  type: "html",
964
964
  html: e
965
965
  };
966
966
  }
967
- function ti() {
967
+ function ui() {
968
968
  return {
969
- id: P("image"),
969
+ id: V("image"),
970
970
  type: "image",
971
971
  objectFit: "contain"
972
972
  };
@@ -974,7 +974,7 @@ function ti() {
974
974
  class ee extends Error {
975
975
  constructor(n, r = []) {
976
976
  super(n);
977
- je(this, "issues");
977
+ Je(this, "issues");
978
978
  this.name = "SchemaV2SerializationError", this.issues = r;
979
979
  }
980
980
  }
@@ -988,7 +988,26 @@ function Se(e, t) {
988
988
  throw new ee(`${t} must be a non-empty string`);
989
989
  return e;
990
990
  }
991
- function Ke(e) {
991
+ const rr = {
992
+ date: "datePicker",
993
+ upload: "uploadImg",
994
+ signature: "uploadImg"
995
+ }, nr = {
996
+ format: "date-format"
997
+ };
998
+ function ir(e) {
999
+ const { action: t, actionParams: n, ...r } = e, i = {}, o = typeof t == "string" ? t : void 0, a = !!o && o !== "text";
1000
+ if (a && o && (i.action = rr[o] ?? o), n && typeof n == "object" && !Array.isArray(n))
1001
+ for (const [u, m] of Object.entries(n))
1002
+ typeof m == "string" && (i[nr[u] ?? u] = m);
1003
+ const l = r.params;
1004
+ if (l && typeof l == "object" && !Array.isArray(l))
1005
+ for (const [u, m] of Object.entries(l))
1006
+ typeof m == "string" && (i[u] = m);
1007
+ const c = { ...r };
1008
+ return a && (c.interactive = !0), Object.keys(i).length ? c.params = i : delete c.params, c;
1009
+ }
1010
+ function qe(e) {
992
1011
  const t = ue(e, "Schema node");
993
1012
  if (Se(t.id, "Schema node id"), typeof t.type != "string")
994
1013
  throw new ee(`Schema node ${t.id} is missing type`);
@@ -998,7 +1017,7 @@ function Ke(e) {
998
1017
  ...t,
999
1018
  border: t.border ?? "none",
1000
1019
  gap: r,
1001
- rows: Array.isArray(t.rows) ? t.rows.map((i) => Qt(i)) : []
1020
+ rows: Array.isArray(t.rows) ? t.rows.map((i) => or(i)) : []
1002
1021
  };
1003
1022
  }
1004
1023
  if (t.type === "table") {
@@ -1007,34 +1026,34 @@ function Ke(e) {
1007
1026
  ...t,
1008
1027
  columns: n,
1009
1028
  minRows: t.minRows ?? 0,
1010
- rowTemplate: Array.isArray(t.rowTemplate) ? t.rowTemplate.map((r) => tr(r)) : []
1029
+ rowTemplate: Array.isArray(t.rowTemplate) ? t.rowTemplate.map((r) => lr(r)) : []
1011
1030
  };
1012
1031
  }
1013
- return t.type === "text" ? { ...t, text: t.text ?? "" } : t.type === "p" ? t.mode === "field" ? { ...t, field: t.field ?? "" } : { ...t, type: "text", text: t.text ?? "" } : t.type === "html" ? { ...t, html: t.html ?? "" } : t.type === "image" ? { ...t, objectFit: t.objectFit ?? "contain" } : { ...t };
1032
+ return t.type === "text" ? { ...t, text: t.text ?? "" } : t.type === "p" ? t.mode === "field" ? { ...ir(t), field: t.field ?? "" } : { ...t, type: "text", text: t.text ?? "" } : t.type === "html" ? { ...t, html: t.html ?? "" } : t.type === "image" ? { ...t, objectFit: t.objectFit ?? "contain" } : { ...t };
1014
1033
  }
1015
- function Qt(e) {
1034
+ function or(e) {
1016
1035
  const t = ue(e, "Grid row");
1017
1036
  return Se(t.id, "Grid row id"), {
1018
1037
  ...t,
1019
1038
  height: t.height ?? 1,
1020
- cells: Array.isArray(t.cells) ? t.cells.map((n) => er(n)) : []
1039
+ cells: Array.isArray(t.cells) ? t.cells.map((n) => ar(n)) : []
1021
1040
  };
1022
1041
  }
1023
- function er(e) {
1042
+ function ar(e) {
1024
1043
  const t = ue(e, "Grid cell");
1025
1044
  return Se(t.id, "Grid cell id"), {
1026
1045
  ...t,
1027
- children: Array.isArray(t.children) ? t.children.map(Ke) : []
1046
+ children: Array.isArray(t.children) ? t.children.map(qe) : []
1028
1047
  };
1029
1048
  }
1030
- function tr(e) {
1049
+ function lr(e) {
1031
1050
  const t = ue(e, "Table cell template");
1032
1051
  return Se(t.id, "Table cell template id"), {
1033
1052
  ...t,
1034
- children: Array.isArray(t.children) ? t.children.map(Ke) : []
1053
+ children: Array.isArray(t.children) ? t.children.map(qe) : []
1035
1054
  };
1036
1055
  }
1037
- function st(e) {
1056
+ function ut(e) {
1038
1057
  const t = ue(e, "Schema");
1039
1058
  if (t.version !== 2)
1040
1059
  throw new ee("Expected Schema V2");
@@ -1068,17 +1087,17 @@ function st(e) {
1068
1087
  bottom: l.bottom ?? 10,
1069
1088
  left: l.left ?? 10
1070
1089
  },
1071
- children: Array.isArray(a.children) ? a.children.map(Ke) : []
1090
+ children: Array.isArray(a.children) ? a.children.map(qe) : []
1072
1091
  };
1073
1092
  })
1074
1093
  };
1075
1094
  }
1076
- function ri(e, t = !1) {
1077
- const r = ze(e).filter((i) => i.level === "error");
1095
+ function di(e, t = !1) {
1096
+ const r = Ue(e).filter((i) => i.level === "error");
1078
1097
  if (r.length) throw new ee("Cannot serialize invalid Schema V2", r);
1079
1098
  return JSON.stringify(e, null, t ? 2 : 0);
1080
1099
  }
1081
- function ni(e) {
1100
+ function fi(e) {
1082
1101
  let t = e;
1083
1102
  if (typeof e == "string")
1084
1103
  try {
@@ -1086,11 +1105,11 @@ function ni(e) {
1086
1105
  } catch (o) {
1087
1106
  throw new ee(`Invalid Schema JSON: ${o instanceof Error ? o.message : String(o)}`);
1088
1107
  }
1089
- const n = st(t), i = ze(n).filter((o) => o.level === "error");
1108
+ const n = ut(t), i = Ue(n).filter((o) => o.level === "error");
1090
1109
  if (i.length) throw new ee("Schema V2 validation failed", i);
1091
1110
  return n;
1092
1111
  }
1093
- function ii(e) {
1112
+ function mi(e) {
1094
1113
  let t = e;
1095
1114
  if (typeof e == "string")
1096
1115
  try {
@@ -1110,7 +1129,7 @@ function ii(e) {
1110
1129
  }
1111
1130
  let n;
1112
1131
  try {
1113
- n = st(t);
1132
+ n = ut(t);
1114
1133
  } catch (i) {
1115
1134
  return i instanceof ee ? { schema: null, issues: i.issues, ok: !1 } : {
1116
1135
  schema: null,
@@ -1124,22 +1143,22 @@ function ii(e) {
1124
1143
  ok: !1
1125
1144
  };
1126
1145
  }
1127
- const r = ze(n);
1146
+ const r = Ue(n);
1128
1147
  return { schema: n, issues: r, ok: !0 };
1129
1148
  }
1130
- function Ye(e, t = []) {
1149
+ function Ze(e, t = []) {
1131
1150
  if ("field" in e && typeof e.field == "string" && e.field.length > 0 && t.push(e.field), e.type === "grid")
1132
1151
  for (const n of e.rows)
1133
1152
  for (const r of n.cells)
1134
1153
  for (const i of r.children)
1135
- Ye(i, t);
1154
+ Ze(i, t);
1136
1155
  else if (e.type === "table")
1137
1156
  for (const n of e.rowTemplate)
1138
1157
  for (const r of n.children)
1139
- Ye(r, t);
1158
+ Ze(r, t);
1140
1159
  return t;
1141
1160
  }
1142
- const rr = ["data-node-id"], nr = /* @__PURE__ */ Te({
1161
+ const sr = ["data-node-id"], cr = /* @__PURE__ */ Te({
1143
1162
  __name: "HtmlBlock",
1144
1163
  props: {
1145
1164
  node: {},
@@ -1150,98 +1169,127 @@ const rr = ["data-node-id"], nr = /* @__PURE__ */ Te({
1150
1169
  emits: ["field-change"],
1151
1170
  setup(e, { emit: t }) {
1152
1171
  const n = e, r = t, i = () => n.data != null && !n.readonly;
1153
- function o(w) {
1172
+ function o(b) {
1154
1173
  var f;
1155
- return ((f = n.fieldPermissions) == null ? void 0 : f[w]) ?? "EDIT";
1174
+ return ((f = n.fieldPermissions) == null ? void 0 : f[b]) ?? "EDIT";
1156
1175
  }
1157
- const a = X(null);
1158
- function l(w) {
1159
- return w ? w.replace(/@import[^;]+;?/gi, "").replace(/<\/style>/gi, "") : "";
1176
+ const a = J(null);
1177
+ function l(b) {
1178
+ return b ? b.replace(/@import[^;]+;?/gi, "").replace(/<\/style>/gi, "") : "";
1160
1179
  }
1161
- function c(w) {
1162
- return w.replace(
1180
+ function c(b) {
1181
+ return b.replace(
1163
1182
  /\{\{\s*([\p{L}\p{N}_.$-]+)\s*\}\}/gu,
1164
- (f, u) => {
1165
- const m = o(u);
1166
- return m === "HIDDEN" ? `<span data-bind="${u}" data-masked>***</span>` : i() ? `<input data-bind="${u}"${m === "READ" ? " readonly" : ""} />` : `<span data-bind="${u}"></span>`;
1183
+ (f, h) => {
1184
+ const d = o(h);
1185
+ return d === "HIDDEN" ? `<span data-bind="${h}" data-masked>***</span>` : i() ? `<input data-bind="${h}"${d === "READ" ? " readonly" : ""} />` : `<span data-bind="${h}"></span>`;
1167
1186
  }
1168
1187
  );
1169
1188
  }
1170
- function d() {
1171
- const w = xt.sanitize(c(n.node.html ?? ""), {
1189
+ function u() {
1190
+ const b = Nt.sanitize(c(n.node.html ?? ""), {
1172
1191
  USE_PROFILES: { html: !0 },
1173
1192
  ADD_TAGS: ["input"],
1174
1193
  ADD_ATTR: ["target", "data-bind", "readonly", "contenteditable"],
1175
1194
  FORBID_TAGS: ["style", "script"]
1176
1195
  });
1177
- return `<style>${l(n.node.css)}</style>${w}`;
1178
- }
1179
- function h(w) {
1180
- w.querySelectorAll("[data-field]").forEach((f) => {
1181
- const u = f.getAttribute("data-field");
1182
- if (!u) return;
1183
- const m = o(u), g = i() && m === "EDIT";
1184
- if (m === "HIDDEN") {
1196
+ return `<style>${l(n.node.css)}</style>${b}`;
1197
+ }
1198
+ function m(b) {
1199
+ b.querySelectorAll("[data-field]").forEach((f) => {
1200
+ const h = f.getAttribute("data-field");
1201
+ if (!h) return;
1202
+ const d = o(h), y = i() && d === "EDIT";
1203
+ if (d === "HIDDEN") {
1185
1204
  f.textContent = "***", f.setAttribute("data-masked", ""), f.setAttribute("contenteditable", "false");
1186
1205
  return;
1187
1206
  }
1188
1207
  if (i() && n.data) {
1189
- const S = n.data[u], E = S == null ? "" : String(S);
1208
+ const p = n.data[h], E = p == null ? "" : String(p);
1190
1209
  f.textContent !== E && (f.textContent = E);
1191
1210
  }
1192
- f.setAttribute("contenteditable", g ? "true" : "false");
1211
+ f.setAttribute("contenteditable", y ? "true" : "false");
1193
1212
  });
1194
1213
  }
1195
- function p() {
1214
+ function g() {
1196
1215
  var f;
1197
- y();
1198
- const w = (f = a.value) == null ? void 0 : f.shadowRoot;
1199
- w && h(w);
1216
+ w();
1217
+ const b = (f = a.value) == null ? void 0 : f.shadowRoot;
1218
+ b && m(b);
1200
1219
  }
1201
- function b() {
1202
- const w = a.value;
1203
- w && (w.shadowRoot || w.attachShadow({ mode: "open" }), w.shadowRoot.innerHTML = d(), p(), M());
1220
+ function v() {
1221
+ const b = a.value;
1222
+ b && (b.shadowRoot || b.attachShadow({ mode: "open" }), b.shadowRoot.innerHTML = u(), g(), M());
1204
1223
  }
1205
- function y() {
1224
+ function w() {
1206
1225
  var f;
1207
- const w = (f = a.value) == null ? void 0 : f.shadowRoot;
1208
- !w || !n.data || w.querySelectorAll("[data-bind]").forEach((u) => {
1226
+ const b = (f = a.value) == null ? void 0 : f.shadowRoot;
1227
+ !b || !n.data || b.querySelectorAll("[data-bind]").forEach((h) => {
1209
1228
  var E;
1210
- const m = u.dataset.bind;
1211
- if (!m) return;
1212
- const g = (E = n.data) == null ? void 0 : E[m], S = g == null ? "" : String(g);
1213
- u instanceof HTMLInputElement ? u.value !== S && (u.value = S) : u.hasAttribute("data-masked") || u.textContent !== S && (u.textContent = S);
1229
+ const d = h.dataset.bind;
1230
+ if (!d) return;
1231
+ const y = (E = n.data) == null ? void 0 : E[d], p = y == null ? "" : String(y);
1232
+ h instanceof HTMLInputElement ? h.value !== p && (h.value = p) : h.hasAttribute("data-masked") || h.textContent !== p && (h.textContent = p);
1214
1233
  });
1215
1234
  }
1216
1235
  function M() {
1217
1236
  var f;
1218
- const w = (f = a.value) == null ? void 0 : f.shadowRoot;
1219
- w && (w.querySelectorAll("input[data-bind]:not([readonly])").forEach((u) => {
1220
- u.addEventListener("input", () => {
1221
- const m = u.dataset.bind;
1222
- m && r("field-change", m, u.value);
1237
+ const b = (f = a.value) == null ? void 0 : f.shadowRoot;
1238
+ b && (b.querySelectorAll("input[data-bind]:not([readonly])").forEach((h) => {
1239
+ h.addEventListener("input", () => {
1240
+ const d = h.dataset.bind;
1241
+ d && r("field-change", d, h.value);
1223
1242
  });
1224
- }), w.querySelectorAll("[data-field][contenteditable='true']").forEach((u) => {
1225
- u.addEventListener("input", () => {
1226
- const m = u.getAttribute("data-field");
1227
- m && r("field-change", m, u.textContent ?? "");
1243
+ }), b.querySelectorAll("[data-field][contenteditable='true']").forEach((h) => {
1244
+ h.addEventListener("input", () => {
1245
+ const d = h.getAttribute("data-field");
1246
+ d && r("field-change", d, h.textContent ?? "");
1228
1247
  });
1229
1248
  }));
1230
1249
  }
1231
- return Fe(b), ge(() => [n.node.html, n.node.css, n.fieldPermissions], b), ge(() => n.data, p, { deep: !0 }), (w, f) => (A(), R("div", {
1250
+ return Fe(v), ge(() => [n.node.html, n.node.css, n.fieldPermissions], v), ge(() => n.data, g, { deep: !0 }), (b, f) => (x(), R("div", {
1232
1251
  ref_key: "host",
1233
1252
  ref: a,
1234
1253
  class: "layout-html",
1235
1254
  "data-node-id": e.node.id
1236
- }, null, 8, rr));
1255
+ }, null, 8, sr));
1237
1256
  }
1238
1257
  }), Ie = (e, t) => {
1239
1258
  const n = e.__vccOpts || e;
1240
1259
  for (const [r, i] of t)
1241
1260
  n[r] = i;
1242
1261
  return n;
1243
- }, ir = /* @__PURE__ */ Ie(nr, [["__scopeId", "data-v-2c9190b4"]]);
1244
- function ct(e, t = {}) {
1262
+ }, ur = /* @__PURE__ */ Ie(cr, [["__scopeId", "data-v-2c9190b4"]]), dr = /* @__PURE__ */ new Set([
1263
+ "id",
1264
+ "class",
1265
+ "style",
1266
+ "slot",
1267
+ "key",
1268
+ "ref",
1269
+ "is",
1270
+ // 字段寻址与字段采集
1271
+ "field",
1272
+ // image 标签自带属性
1273
+ "src",
1274
+ "alt",
1275
+ "width",
1276
+ "height",
1277
+ // 可编辑性 / 拖拽 / 可见性均由内核闸门控制
1278
+ "contenteditable",
1279
+ "draggable",
1280
+ "hidden"
1281
+ ]), fr = /^[a-z][a-z0-9_-]*$/;
1282
+ function mr(e) {
1283
+ return typeof e != "string" || !fr.test(e) || e.startsWith("on") || e.startsWith("data-") ? !1 : !dr.has(e);
1284
+ }
1285
+ function dt(e) {
1286
+ const t = {};
1287
+ if (!e) return t;
1288
+ for (const [n, r] of Object.entries(e))
1289
+ typeof r != "string" || r === "" || mr(n) && (t[n] = r);
1290
+ return t;
1291
+ }
1292
+ function ft(e, t = {}) {
1245
1293
  var n;
1246
1294
  if (!t.isDesign && e.field) {
1247
1295
  const r = (n = t.data) == null ? void 0 : n[e.field];
@@ -1249,31 +1297,31 @@ function ct(e, t = {}) {
1249
1297
  }
1250
1298
  return e.src && e.src !== "" ? e.src : null;
1251
1299
  }
1252
- const or = 0, ar = "center", lr = "middle";
1253
- function sr(e, t) {
1300
+ const hr = 0, gr = "center", pr = "middle";
1301
+ function yr(e, t) {
1254
1302
  return {
1255
- padding: e.padding ?? t.cellPadding ?? or,
1256
- align: e.align ?? t.cellAlign ?? ar,
1257
- verticalAlign: e.verticalAlign ?? t.cellVerticalAlign ?? lr
1303
+ padding: e.padding ?? t.cellPadding ?? hr,
1304
+ align: e.align ?? t.cellAlign ?? gr,
1305
+ verticalAlign: e.verticalAlign ?? t.cellVerticalAlign ?? pr
1258
1306
  };
1259
1307
  }
1260
- function ut(e, t) {
1308
+ function mt(e, t) {
1261
1309
  return `${e}_${t}`;
1262
1310
  }
1263
- function dt(e, t, n) {
1264
- const r = ut(t, n), i = e.type === "p" && e.mode === "field" ? { ...e, field: r } : e;
1311
+ function ht(e, t, n) {
1312
+ const r = mt(t, n), i = e.type === "p" && e.mode === "field" ? { ...e, field: r } : e;
1265
1313
  return i.type === "grid" ? {
1266
1314
  ...i,
1267
1315
  rows: i.rows.map((o) => ({
1268
1316
  ...o,
1269
1317
  cells: o.cells.map((a) => ({
1270
1318
  ...a,
1271
- children: a.children.map((l) => dt(l, t, n))
1319
+ children: a.children.map((l) => ht(l, t, n))
1272
1320
  }))
1273
1321
  }))
1274
1322
  } : i;
1275
1323
  }
1276
- function cr(e, t) {
1324
+ function wr(e, t) {
1277
1325
  const n = `${t}_`;
1278
1326
  if (!e.startsWith(n)) return null;
1279
1327
  const r = e.slice(n.length);
@@ -1287,16 +1335,16 @@ function we(e, t) {
1287
1335
  let r = 0;
1288
1336
  for (const i of e.columns)
1289
1337
  for (const o of Object.keys(t)) {
1290
- const a = cr(o, i.key);
1338
+ const a = wr(o, i.key);
1291
1339
  a != null && a > r && (r = a);
1292
1340
  }
1293
1341
  return Math.max(n, r);
1294
1342
  }
1295
- function oi(e, t) {
1343
+ function hi(e, t) {
1296
1344
  const n = [], r = (i, o) => {
1297
1345
  if (i.type === "p" && i.mode === "field") {
1298
1346
  o ? n.push({
1299
- key: ut(o.columnKey, o.rowIndex),
1347
+ key: mt(o.columnKey, o.rowIndex),
1300
1348
  kind: "table-field",
1301
1349
  tableField: o.columnKey,
1302
1350
  row: o.rowIndex
@@ -1306,11 +1354,11 @@ function oi(e, t) {
1306
1354
  if (i.type === "table") {
1307
1355
  const a = we(i, t ?? null);
1308
1356
  for (const l of i.columns) {
1309
- const c = i.rowTemplate.find((d) => d.columnKey === l.key);
1357
+ const c = i.rowTemplate.find((u) => u.columnKey === l.key);
1310
1358
  if (c)
1311
- for (let d = 1; d <= a; d += 1)
1312
- for (const h of c.children)
1313
- r(h, { columnKey: l.key, rowIndex: d });
1359
+ for (let u = 1; u <= a; u += 1)
1360
+ for (const m of c.children)
1361
+ r(m, { columnKey: l.key, rowIndex: u });
1314
1362
  }
1315
1363
  return;
1316
1364
  }
@@ -1325,21 +1373,21 @@ function oi(e, t) {
1325
1373
  r(o);
1326
1374
  return n;
1327
1375
  }
1328
- function ur(e, t) {
1376
+ function br(e, t) {
1329
1377
  if (!e) return [];
1330
1378
  const n = (r) => typeof r != "string" || r.trim() === "";
1331
1379
  return Object.entries(e).filter(([, r]) => (r == null ? void 0 : r.required) === !0).map(([r]) => r).filter((r) => n(t == null ? void 0 : t[r]));
1332
1380
  }
1333
- const dr = ["data-node-id"], fr = ["data-layout-id"], mr = ["data-layout-id", "data-node-id"], hr = ["data-node-id"], gr = ["contenteditable", "data-field", "data-node-id", "onClick", "onBlur"], pr = {
1381
+ const vr = ["data-node-id"], Er = ["data-layout-id"], Tr = ["data-layout-id", "data-node-id"], Sr = ["data-node-id"], Mr = ["contenteditable", "data-field", "data-node-id", "onClick", "onBlur"], Ar = {
1334
1382
  key: 0,
1335
1383
  class: "layout-p__label"
1336
- }, yr = ["contenteditable", "data-field"], wr = {
1384
+ }, xr = ["contenteditable", "data-field"], Rr = {
1337
1385
  key: 3,
1338
1386
  class: "layout-p__value"
1339
- }, br = {
1387
+ }, Nr = {
1340
1388
  key: 4,
1341
1389
  class: "layout-p__label"
1342
- }, vr = ["data-node-id"], Er = ["data-layout-id"], Tr = ["data-node-id", "data-field", "src", "alt"], Xe = "***", Ze = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='60'%3E%3Crect width='100%25' height='100%25' fill='%23f1f5f9' stroke='%23cbd5e1'/%3E%3Ctext x='50%25' y='50%25' font-size='10' fill='%2394a3b8' text-anchor='middle' dominant-baseline='middle'%3E图片%3C/text%3E%3C/svg%3E", Sr = /* @__PURE__ */ Te({
1390
+ }, Fr = ["data-node-id"], kr = ["data-layout-id"], Ir = ["data-node-id", "data-field", "src", "alt"], Qe = "***", et = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='60'%3E%3Crect width='100%25' height='100%25' fill='%23f1f5f9' stroke='%23cbd5e1'/%3E%3Ctext x='50%25' y='50%25' font-size='10' fill='%2394a3b8' text-anchor='middle' dominant-baseline='middle'%3E图片%3C/text%3E%3C/svg%3E", Cr = /* @__PURE__ */ Te({
1343
1391
  name: "GridSchemaNodeV2",
1344
1392
  __name: "GridSchemaNode",
1345
1393
  props: {
@@ -1351,46 +1399,46 @@ const dr = ["data-node-id"], fr = ["data-layout-id"], mr = ["data-layout-id", "d
1351
1399
  suppressBorders: {},
1352
1400
  fieldPermissions: {}
1353
1401
  },
1354
- emits: ["field-change", "action-trigger"],
1402
+ emits: ["field-change", "field-activate"],
1355
1403
  setup(e, { emit: t }) {
1356
1404
  const n = t, r = e;
1357
1405
  function i(s) {
1358
1406
  return s.type === "grid" && (s.border === "all" || s.border === "outer");
1359
1407
  }
1360
- function o(s, T) {
1361
- const N = s[T];
1408
+ function o(s, S) {
1409
+ const N = s[S];
1362
1410
  if (!i(N)) return;
1363
- const B = s[T - 1];
1411
+ const B = s[S - 1];
1364
1412
  return { left: !!B && i(B) };
1365
1413
  }
1366
- const a = K(() => r.mode ? r.mode : r.data != null ? "preview" : "design"), l = K(() => a.value === "design"), c = K(
1414
+ const a = U(() => r.mode ? r.mode : r.data != null ? "preview" : "design"), l = U(() => a.value === "design"), c = U(
1367
1415
  () => a.value !== "design" && !r.readonly
1368
- ), d = (s) => s === void 0 || s === "auto" ? "auto" : typeof s == "number" ? `${s}mm` : s;
1369
- function h(s) {
1370
- const T = Re(s);
1371
- return T > 0 ? { rowGap: `${T}mm` } : {};
1416
+ ), u = (s) => s === void 0 || s === "auto" ? "auto" : typeof s == "number" ? `${s}mm` : s;
1417
+ function m(s) {
1418
+ const S = Re(s);
1419
+ return S > 0 ? { rowGap: `${S}mm` } : {};
1372
1420
  }
1373
- function p(s, T) {
1374
- const N = s.rows[T], B = s.columns && s.columns.length > 0 ? s.columns : N.cells.map((oe) => oe.width), ce = Re(s);
1421
+ function g(s, S) {
1422
+ const N = s.rows[S], B = s.columns && s.columns.length > 0 ? s.columns : N.cells.map((de) => de.width), re = Re(s);
1375
1423
  return {
1376
- gridTemplateColumns: B.map(d).join(" "),
1424
+ gridTemplateColumns: B.map(u).join(" "),
1377
1425
  minHeight: `${N.height * r.baseRowHeight}mm`,
1378
1426
  // 列间距:gap 同时作用于行列。
1379
- columnGap: ce > 0 ? `${ce}mm` : void 0
1427
+ columnGap: re > 0 ? `${re}mm` : void 0
1380
1428
  };
1381
1429
  }
1382
- function b(s, T) {
1383
- const N = sr(s, T), B = N.verticalAlign === "top" ? "flex-start" : N.verticalAlign === "bottom" ? "flex-end" : "center", ce = N.align === "center" ? "center" : N.align === "right" ? "flex-end" : "flex-start", oe = {
1430
+ function v(s, S) {
1431
+ const N = yr(s, S), B = N.verticalAlign === "top" ? "flex-start" : N.verticalAlign === "bottom" ? "flex-end" : "center", re = N.align === "center" ? "center" : N.align === "right" ? "flex-end" : "flex-start", de = {
1384
1432
  gridColumn: s.colspan ? `span ${s.colspan}` : void 0,
1385
1433
  // 单元格行高倍数:设置时覆盖所在 Grid 行高(行容器按最高单元格撑开)。
1386
1434
  minHeight: s.rowHeight ? `${s.rowHeight * r.baseRowHeight}mm` : void 0,
1387
1435
  padding: `${N.padding}mm`,
1388
1436
  alignItems: B,
1389
- justifyContent: ce
1437
+ justifyContent: re
1390
1438
  };
1391
- return s.flex ? { ...oe, flexWrap: "wrap" } : oe;
1439
+ return s.flex ? { ...de, flexWrap: "wrap" } : de;
1392
1440
  }
1393
- function y(s) {
1441
+ function w(s) {
1394
1442
  return {
1395
1443
  justifyContent: (s == null ? void 0 : s.align) === "center" ? "center" : (s == null ? void 0 : s.align) === "right" ? "flex-end" : "flex-start",
1396
1444
  alignItems: (s == null ? void 0 : s.verticalAlign) === "top" ? "flex-start" : (s == null ? void 0 : s.verticalAlign) === "bottom" ? "flex-end" : "center",
@@ -1406,110 +1454,112 @@ const dr = ["data-node-id"], fr = ["data-layout-id"], mr = ["data-layout-id", "d
1406
1454
  }
1407
1455
  function M(s) {
1408
1456
  return {
1409
- ...y(s.style),
1457
+ ...w(s.style),
1410
1458
  whiteSpace: "pre-wrap",
1411
- width: I(s) ? void 0 : s.width
1459
+ width: C(s) ? void 0 : s.width
1412
1460
  };
1413
1461
  }
1414
- function w(s) {
1415
- return !I(s) || !s.width ? {} : { width: s.width, flexGrow: 0 };
1462
+ function b(s) {
1463
+ return !C(s) || !s.width ? {} : { width: s.width, flexGrow: 0 };
1416
1464
  }
1417
1465
  function f(s) {
1418
- return y(s.style);
1466
+ return w(s.style);
1419
1467
  }
1420
- function u(s) {
1468
+ function h(s) {
1421
1469
  return {
1422
- gridTemplateColumns: s.map((T) => d(T.width)).join(" ")
1470
+ gridTemplateColumns: s.map((S) => u(S.width)).join(" ")
1423
1471
  };
1424
1472
  }
1425
- function m(s) {
1473
+ function d(s) {
1426
1474
  return {
1427
1475
  justifyContent: s.align === "center" ? "center" : s.align === "right" ? "flex-end" : "flex-start"
1428
1476
  };
1429
1477
  }
1430
- function g(s, T) {
1431
- const N = (T == null ? void 0 : T.align) ?? s.align;
1478
+ function y(s, S) {
1479
+ const N = (S == null ? void 0 : S.align) ?? s.align;
1432
1480
  return {
1433
1481
  justifyContent: N === "center" ? "center" : N === "right" ? "flex-end" : "flex-start",
1434
- fontSize: T != null && T.fontSize ? `${T.fontSize}px` : void 0,
1435
- fontWeight: (T == null ? void 0 : T.fontWeight) ?? void 0
1482
+ fontSize: S != null && S.fontSize ? `${S.fontSize}px` : void 0,
1483
+ fontWeight: (S == null ? void 0 : S.fontWeight) ?? void 0
1436
1484
  };
1437
1485
  }
1438
- function S(s, T) {
1439
- return s.rowTemplate.find((N) => N.columnKey === T);
1486
+ function p(s, S) {
1487
+ return s.rowTemplate.find((N) => N.columnKey === S);
1440
1488
  }
1441
- function E(s, T) {
1442
- const N = we(s, T);
1489
+ function E(s, S) {
1490
+ const N = we(s, S);
1443
1491
  return typeof s._paginateMaxRows == "number" && s._paginateMaxRows > 0 ? Math.min(N, s._paginateMaxRows) : N;
1444
1492
  }
1445
- function $(s, T, N) {
1446
- return dt(s, T, N);
1493
+ function F(s, S, N) {
1494
+ return ht(s, S, N);
1447
1495
  }
1448
- function I(s) {
1496
+ function C(s) {
1449
1497
  return s.mode === "field" && !!(s.prefix || s.suffix);
1450
1498
  }
1451
- const D = K(() => {
1499
+ const P = U(() => {
1452
1500
  var s;
1453
1501
  return r.node.type !== "p" || r.node.mode !== "field" ? "EDIT" : ((s = r.fieldPermissions) == null ? void 0 : s[r.node.field]) ?? "EDIT";
1454
1502
  });
1455
- function _(s, T) {
1456
- c.value && (s.mode !== "field" || !s.action || s.action === "text" || n("action-trigger", {
1503
+ function D(s) {
1504
+ return dt(s.params);
1505
+ }
1506
+ function T(s, S) {
1507
+ c.value && (s.mode !== "field" || !s.interactive || n("field-activate", {
1457
1508
  nodeId: s.id,
1458
1509
  field: s.field,
1459
- action: s.action,
1460
- actionParams: s.actionParams
1510
+ params: s.params
1461
1511
  }));
1462
1512
  }
1463
- const v = K(() => D.value === "HIDDEN");
1464
- function x(s) {
1465
- return v.value ? Xe : ne(s);
1466
- }
1467
- function V(s) {
1468
- return v.value ? [Xe] : H(s);
1513
+ const A = U(() => P.value === "HIDDEN");
1514
+ function _(s) {
1515
+ return A.value ? Qe : $(s);
1469
1516
  }
1470
- function L(s) {
1471
- return l.value && s.mode === "field" && !I(s) ? "true" : void 0;
1517
+ function k(s) {
1518
+ return A.value ? [Qe] : z(s);
1472
1519
  }
1473
1520
  function te(s) {
1474
- const T = s.innerText;
1475
- return typeof T == "string" ? T : s.textContent ?? "";
1521
+ return l.value && s.mode === "field" && !C(s) ? "true" : void 0;
1522
+ }
1523
+ function X(s) {
1524
+ const S = s.innerText;
1525
+ return typeof S == "string" ? S : s.textContent ?? "";
1476
1526
  }
1477
- function J(s, T) {
1478
- !c.value || !s || n("field-change", s, te(T.target));
1527
+ function oe(s, S) {
1528
+ !c.value || !s || n("field-change", s, X(S.target));
1479
1529
  }
1480
- const re = X(null);
1530
+ const ae = J(null);
1481
1531
  function pe() {
1482
- var T;
1532
+ var S;
1483
1533
  if (r.node.type !== "p") return;
1484
- const s = re.value;
1485
- if (!(!s || !c.value) && s !== (((T = s.ownerDocument) == null ? void 0 : T.activeElement) ?? null)) {
1534
+ const s = ae.value;
1535
+ if (!(!s || !c.value) && s !== (((S = s.ownerDocument) == null ? void 0 : S.activeElement) ?? null)) {
1486
1536
  for (; s.firstChild; ) s.removeChild(s.firstChild);
1487
- for (const N of V(r.node)) {
1537
+ for (const N of k(r.node)) {
1488
1538
  const B = document.createElement("div");
1489
1539
  B.className = "layout-p__line", B.textContent = N, s.appendChild(B);
1490
1540
  }
1491
1541
  }
1492
1542
  }
1493
1543
  ge(
1494
- () => r.node.type === "p" ? ne(r.node) : "",
1544
+ () => r.node.type === "p" ? $(r.node) : "",
1495
1545
  pe
1496
1546
  ), Fe(pe);
1497
- function ne(s) {
1498
- const T = r.data;
1499
- if (T == null || !(s.field in T)) return s.default ?? "";
1500
- const N = T[s.field];
1547
+ function $(s) {
1548
+ const S = r.data;
1549
+ if (S == null || !(s.field in S)) return s.default ?? "";
1550
+ const N = S[s.field];
1501
1551
  return N == null ? s.default ?? "" : String(N);
1502
1552
  }
1503
- function H(s) {
1504
- return ne(s).split(`
1553
+ function z(s) {
1554
+ return $(s).split(`
1505
1555
  `);
1506
1556
  }
1507
- const W = X(!1), ie = K(
1508
- () => r.node.type === "image" ? ct(r.node, {
1557
+ const Z = J(!1), le = U(
1558
+ () => r.node.type === "image" ? ft(r.node, {
1509
1559
  data: r.data,
1510
1560
  isDesign: a.value === "design"
1511
1561
  }) : null
1512
- ), de = K(() => W.value ? Ze : ie.value ?? Ze), Me = K(() => r.node.type === "image" && ie.value === null);
1562
+ ), Me = U(() => Z.value ? et : le.value ?? et), Q = U(() => r.node.type === "image" && le.value === null);
1513
1563
  ge(
1514
1564
  () => [
1515
1565
  r.node.type === "image" ? r.node.src : null,
@@ -1517,44 +1567,44 @@ const dr = ["data-node-id"], fr = ["data-layout-id"], mr = ["data-layout-id", "d
1517
1567
  r.data
1518
1568
  ],
1519
1569
  () => {
1520
- W.value = !1;
1570
+ Z.value = !1;
1521
1571
  },
1522
1572
  { deep: !0 }
1523
1573
  );
1524
- function Z() {
1525
- W.value = !0;
1574
+ function Ce() {
1575
+ Z.value = !0;
1526
1576
  }
1527
- return (s, T) => {
1528
- var B, ce, oe, qe;
1529
- const N = wt("GridSchemaNode", !0);
1530
- return e.node.type === "grid" ? (A(), R("div", {
1577
+ return (s, S) => {
1578
+ var B, re, de, Ye;
1579
+ const N = Et("GridSchemaNode", !0);
1580
+ return e.node.type === "grid" ? (x(), R("div", se({
1531
1581
  key: 0,
1532
- class: ae(["layout-grid", [
1582
+ class: ["layout-grid", [
1533
1583
  `layout-grid--${e.node.border}`,
1534
1584
  {
1535
1585
  "layout-grid--no-top": (B = e.suppressBorders) == null ? void 0 : B.top,
1536
- "layout-grid--no-right": (ce = e.suppressBorders) == null ? void 0 : ce.right,
1537
- "layout-grid--no-bottom": (oe = e.suppressBorders) == null ? void 0 : oe.bottom,
1538
- "layout-grid--no-left": (qe = e.suppressBorders) == null ? void 0 : qe.left
1586
+ "layout-grid--no-right": (re = e.suppressBorders) == null ? void 0 : re.right,
1587
+ "layout-grid--no-bottom": (de = e.suppressBorders) == null ? void 0 : de.bottom,
1588
+ "layout-grid--no-left": (Ye = e.suppressBorders) == null ? void 0 : Ye.left
1539
1589
  }
1540
- ]]),
1541
- style: z(h(e.node)),
1590
+ ]],
1591
+ style: m(e.node),
1542
1592
  "data-node-id": e.node.id
1543
- }, [
1544
- (A(!0), R(q, null, Y(e.node.rows, (C, U) => (A(), R("div", {
1545
- key: C.id,
1593
+ }, D(e.node)), [
1594
+ (x(!0), R(j, null, Y(e.node.rows, (H, W) => (x(), R("div", {
1595
+ key: H.id,
1546
1596
  class: "layout-grid__row",
1547
- style: z(p(e.node, U)),
1548
- "data-layout-id": C.id
1597
+ style: ce(g(e.node, W)),
1598
+ "data-layout-id": H.id
1549
1599
  }, [
1550
- (A(!0), R(q, null, Y(C.cells, (Q) => (A(), R("div", {
1551
- key: Q.id,
1552
- class: ae(["layout-grid__cell", Q.flex ? "layout-grid__cell--flex" : {}]),
1553
- style: z(b(Q, e.node)),
1554
- "data-layout-id": Q.id,
1555
- "data-node-id": Q.id
1556
- }, [
1557
- (A(!0), R(q, null, Y(Q.children, (ve, xe) => (A(), ye(N, {
1600
+ (x(!0), R(j, null, Y(H.cells, (q) => (x(), R("div", se({
1601
+ key: q.id,
1602
+ class: ["layout-grid__cell", q.flex ? "layout-grid__cell--flex" : {}],
1603
+ style: v(q, e.node),
1604
+ "data-layout-id": q.id,
1605
+ "data-node-id": q.id
1606
+ }, { ref_for: !0 }, D(q)), [
1607
+ (x(!0), R(j, null, Y(q.children, (ve, Ae) => (x(), ye(N, {
1558
1608
  key: ve.id,
1559
1609
  node: ve,
1560
1610
  "base-row-height": e.baseRowHeight,
@@ -1562,160 +1612,163 @@ const dr = ["data-node-id"], fr = ["data-layout-id"], mr = ["data-layout-id", "d
1562
1612
  data: e.data,
1563
1613
  readonly: r.readonly,
1564
1614
  "field-permissions": r.fieldPermissions,
1565
- "suppress-borders": o(Q.children, xe),
1566
- onFieldChange: T[0] || (T[0] = (fe, Le) => n("field-change", fe, Le)),
1567
- onActionTrigger: T[1] || (T[1] = (fe) => n("action-trigger", fe))
1615
+ "suppress-borders": o(q.children, Ae),
1616
+ onFieldChange: S[0] || (S[0] = (fe, Le) => n("field-change", fe, Le)),
1617
+ onFieldActivate: S[1] || (S[1] = (fe) => n("field-activate", fe))
1568
1618
  }, null, 8, ["node", "base-row-height", "mode", "data", "readonly", "field-permissions", "suppress-borders"]))), 128))
1569
- ], 14, mr))), 128))
1570
- ], 12, fr))), 128))
1571
- ], 14, dr)) : e.node.type === "text" ? (A(), R("div", {
1619
+ ], 16, Tr))), 128))
1620
+ ], 12, Er))), 128))
1621
+ ], 16, vr)) : e.node.type === "text" ? (x(), R("div", se({
1572
1622
  key: 1,
1573
- class: ae(["layout-text", {}]),
1574
- style: z(f(e.node)),
1623
+ class: ["layout-text", {}],
1624
+ style: f(e.node),
1575
1625
  "data-node-id": e.node.id
1576
- }, G(e.node.text), 13, hr)) : e.node.type === "p" ? (A(), R("div", {
1626
+ }, D(e.node)), G(e.node.text), 17, Sr)) : e.node.type === "p" ? (x(), R("div", se({
1577
1627
  key: 2,
1578
- class: ae(["layout-p", {
1628
+ class: ["layout-p", {
1579
1629
  "layout-p--field": !0,
1580
- "layout-p--composite": I(e.node),
1581
- "layout-p--underline": e.node.underline && !I(e.node),
1630
+ "layout-p--composite": C(e.node),
1631
+ "layout-p--underline": e.node.underline && !C(e.node),
1582
1632
  "layout-p--inner-border": e.node.innerBorder,
1583
- "layout-p--hidden": D.value === "HIDDEN"
1584
- }]),
1585
- style: z(M(e.node)),
1586
- contenteditable: I(e.node) ? void 0 : D.value === "EDIT" ? c.value ? "true" : L(e.node) : void 0,
1633
+ "layout-p--hidden": P.value === "HIDDEN"
1634
+ }],
1635
+ style: M(e.node),
1636
+ contenteditable: C(e.node) ? void 0 : P.value === "EDIT" ? c.value ? "true" : te(e.node) : void 0,
1587
1637
  "data-field": e.node.field,
1588
- "data-node-id": e.node.id,
1589
- onClick: (C) => _(e.node),
1590
- onBlur: (C) => J(e.node.field, C)
1591
- }, [
1592
- e.node.prefix ? (A(), R("span", pr, G(e.node.prefix), 1)) : Ae("", !0),
1593
- I(e.node) ? (A(), R("span", {
1638
+ "data-node-id": e.node.id
1639
+ }, D(e.node), {
1640
+ onClick: (H) => T(e.node),
1641
+ onBlur: (H) => oe(e.node.field, H)
1642
+ }), [
1643
+ e.node.prefix ? (x(), R("span", Ar, G(e.node.prefix), 1)) : xe("", !0),
1644
+ C(e.node) ? (x(), R("span", {
1594
1645
  key: 1,
1595
- class: ae(["layout-p__input", { "layout-p--underline": e.node.underline }]),
1596
- style: z(w(e.node)),
1597
- contenteditable: D.value === "EDIT" ? c.value ? "true" : r.readonly ? void 0 : "true" : void 0,
1646
+ class: Be(["layout-p__input", { "layout-p--underline": e.node.underline }]),
1647
+ style: ce(b(e.node)),
1648
+ contenteditable: P.value === "EDIT" ? c.value ? "true" : r.readonly ? void 0 : "true" : void 0,
1598
1649
  "data-field": e.node.field,
1599
- onBlur: T[2] || (T[2] = (C) => J(e.node.field, C))
1650
+ onBlur: S[2] || (S[2] = (H) => oe(e.node.field, H))
1600
1651
  }, [
1601
- e.node.innerBorder ? (A(!0), R(q, { key: 0 }, Y(V(e.node), (C, U) => (A(), R("div", {
1602
- key: U,
1652
+ e.node.innerBorder ? (x(!0), R(j, { key: 0 }, Y(k(e.node), (H, W) => (x(), R("div", {
1653
+ key: W,
1603
1654
  class: "layout-p__line"
1604
- }, G(C), 1))), 128)) : (A(), R(q, { key: 1 }, [
1605
- bt(G(x(e.node)), 1)
1655
+ }, G(H), 1))), 128)) : (x(), R(j, { key: 1 }, [
1656
+ Tt(G(_(e.node)), 1)
1606
1657
  ], 64))
1607
- ], 46, yr)) : e.node.innerBorder ? (A(), R("span", {
1658
+ ], 46, xr)) : e.node.innerBorder ? (x(), R("span", {
1608
1659
  key: 2,
1609
1660
  ref_key: "innerLinesEl",
1610
- ref: re,
1661
+ ref: ae,
1611
1662
  class: "layout-p__lines"
1612
1663
  }, [
1613
- (A(!0), R(q, null, Y(V(e.node), (C, U) => (A(), R("div", {
1614
- key: U,
1664
+ (x(!0), R(j, null, Y(k(e.node), (H, W) => (x(), R("div", {
1665
+ key: W,
1615
1666
  class: "layout-p__line"
1616
- }, G(C), 1))), 128))
1617
- ], 512)) : (A(), R("span", wr, G(x(e.node)), 1)),
1618
- e.node.suffix ? (A(), R("span", br, G(e.node.suffix), 1)) : Ae("", !0)
1619
- ], 46, gr)) : e.node.type === "table" ? (A(), R("table", {
1667
+ }, G(H), 1))), 128))
1668
+ ], 512)) : (x(), R("span", Rr, G(_(e.node)), 1)),
1669
+ e.node.suffix ? (x(), R("span", Nr, G(e.node.suffix), 1)) : xe("", !0)
1670
+ ], 16, Mr)) : e.node.type === "table" ? (x(), R("table", se({
1620
1671
  key: 3,
1621
- class: ae(["layout-table", [`layout-table--${e.node.border ?? "all"}`]]),
1672
+ class: ["layout-table", [`layout-table--${e.node.border ?? "all"}`]],
1622
1673
  "data-node-id": e.node.id
1623
- }, [
1674
+ }, D(e.node)), [
1624
1675
  O("thead", null, [
1625
1676
  O("tr", {
1626
1677
  class: "layout-table__row layout-table__header",
1627
- style: z([
1628
- u(e.node.columns),
1678
+ style: ce([
1679
+ h(e.node.columns),
1629
1680
  { minHeight: `${e.baseRowHeight}mm` }
1630
1681
  ])
1631
1682
  }, [
1632
- (A(!0), R(q, null, Y(e.node.columns, (C) => (A(), R("th", {
1633
- key: C.key,
1683
+ (x(!0), R(j, null, Y(e.node.columns, (H) => (x(), R("th", {
1684
+ key: H.key,
1634
1685
  class: "layout-table__cell",
1635
- style: z(g(C, e.node.headerStyle))
1636
- }, G(C.title), 5))), 128))
1686
+ style: ce(y(H, e.node.headerStyle))
1687
+ }, G(H.title), 5))), 128))
1637
1688
  ], 4)
1638
1689
  ]),
1639
1690
  O("tbody", null, [
1640
- (A(!0), R(q, null, Y(E(e.node, e.data), (C) => (A(), R("tr", {
1641
- key: C,
1691
+ (x(!0), R(j, null, Y(E(e.node, e.data), (H) => (x(), R("tr", {
1692
+ key: H,
1642
1693
  class: "layout-table__row",
1643
- style: z([
1644
- u(e.node.columns),
1694
+ style: ce([
1695
+ h(e.node.columns),
1645
1696
  { minHeight: `${e.baseRowHeight}mm` }
1646
1697
  ])
1647
1698
  }, [
1648
- (A(!0), R(q, null, Y(e.node.columns, (U) => {
1649
- var Q, ve;
1650
- return A(), R("td", {
1651
- key: U.key,
1699
+ (x(!0), R(j, null, Y(e.node.columns, (W) => {
1700
+ var q, ve;
1701
+ return x(), R("td", {
1702
+ key: W.key,
1652
1703
  class: "layout-table__cell",
1653
- style: z(m(U)),
1654
- "data-layout-id": (Q = S(e.node, U.key)) == null ? void 0 : Q.id
1704
+ style: ce(d(W)),
1705
+ "data-layout-id": (q = p(e.node, W.key)) == null ? void 0 : q.id
1655
1706
  }, [
1656
- (A(!0), R(q, null, Y(((ve = S(e.node, U.key)) == null ? void 0 : ve.children) ?? [], (xe) => (A(), ye(N, {
1657
- key: `${xe.id}-${C}`,
1658
- node: $(xe, U.key, C),
1707
+ (x(!0), R(j, null, Y(((ve = p(e.node, W.key)) == null ? void 0 : ve.children) ?? [], (Ae) => (x(), ye(N, {
1708
+ key: `${Ae.id}-${H}`,
1709
+ node: F(Ae, W.key, H),
1659
1710
  "base-row-height": e.baseRowHeight,
1660
1711
  mode: a.value,
1661
1712
  data: e.data,
1662
1713
  readonly: r.readonly,
1663
1714
  "field-permissions": r.fieldPermissions,
1664
1715
  onFieldChange: (fe, Le) => n("field-change", fe, Le),
1665
- onActionTrigger: (fe) => n("action-trigger", fe)
1666
- }, null, 8, ["node", "base-row-height", "mode", "data", "readonly", "field-permissions", "onFieldChange", "onActionTrigger"]))), 128))
1667
- ], 12, Er);
1716
+ onFieldActivate: (fe) => n("field-activate", fe)
1717
+ }, null, 8, ["node", "base-row-height", "mode", "data", "readonly", "field-permissions", "onFieldChange", "onFieldActivate"]))), 128))
1718
+ ], 12, kr);
1668
1719
  }), 128))
1669
1720
  ], 4))), 128))
1670
1721
  ])
1671
- ], 10, vr)) : e.node.type === "html" ? (A(), ye(ir, {
1722
+ ], 16, Fr)) : e.node.type === "html" ? (x(), ye(ur, se({
1672
1723
  key: 4,
1673
1724
  node: e.node,
1674
1725
  data: e.data,
1675
1726
  readonly: r.readonly,
1676
- "field-permissions": r.fieldPermissions,
1677
- onFieldChange: (C, U) => n("field-change", C, U)
1678
- }, null, 8, ["node", "data", "readonly", "field-permissions", "onFieldChange"])) : (A(), R("img", {
1727
+ "field-permissions": r.fieldPermissions
1728
+ }, D(e.node), {
1729
+ onFieldChange: (H, W) => n("field-change", H, W)
1730
+ }), null, 16, ["node", "data", "readonly", "field-permissions", "onFieldChange"])) : (x(), R("img", se({
1679
1731
  key: 5,
1680
- class: ae(["layout-image", { "layout-image--blank": Me.value }]),
1732
+ class: ["layout-image", { "layout-image--blank": Q.value }],
1681
1733
  "data-node-id": e.node.id,
1682
- "data-field": e.node.field,
1683
- src: de.value,
1734
+ "data-field": e.node.field
1735
+ }, D(e.node), {
1736
+ src: Me.value,
1684
1737
  alt: e.node.field ?? e.node.src ?? "",
1685
- style: z({
1738
+ style: {
1686
1739
  width: e.node.width ? `${e.node.width}mm` : void 0,
1687
1740
  height: e.node.height ? `${e.node.height}mm` : void 0,
1688
1741
  objectFit: e.node.objectFit
1689
- }),
1690
- onError: Z
1691
- }, null, 46, Tr));
1742
+ },
1743
+ onError: Ce
1744
+ }), null, 16, Ir));
1692
1745
  };
1693
1746
  }
1694
- }), Mr = /* @__PURE__ */ Ie(Sr, [["__scopeId", "data-v-3f4d7b64"]]), xr = "grid-form-page-size";
1695
- let j = null;
1696
- const Ce = /* @__PURE__ */ new Set();
1697
- function Ar() {
1698
- return typeof document > "u" ? null : (j || (j = document.createElement("style"), j.id = xr, j.setAttribute("data-generated-by", "GridFormRenderer"), document.head.appendChild(j)), j);
1699
- }
1700
- function Rr(e, t) {
1701
- const n = Ar();
1747
+ }), Lr = /* @__PURE__ */ Ie(Cr, [["__scopeId", "data-v-57df9cd1"]]), $r = "grid-form-page-size";
1748
+ let K = null;
1749
+ const $e = /* @__PURE__ */ new Set();
1750
+ function Dr() {
1751
+ return typeof document > "u" ? null : (K || (K = document.createElement("style"), K.id = $r, K.setAttribute("data-generated-by", "GridFormRenderer"), document.head.appendChild(K)), K);
1752
+ }
1753
+ function Hr(e, t) {
1754
+ const n = Dr();
1702
1755
  n && (n.textContent = `@page { size: ${e}mm ${t}mm; margin: 0; }`);
1703
1756
  }
1704
- function Nr() {
1757
+ function Pr() {
1705
1758
  const e = {};
1706
- return Ce.add(e), () => {
1707
- Ce.delete(e), Ce.size === 0 && j && (j.remove(), j = null);
1759
+ return $e.add(e), () => {
1760
+ $e.delete(e), $e.size === 0 && K && (K.remove(), K = null);
1708
1761
  };
1709
1762
  }
1710
- function ai() {
1711
- return (j == null ? void 0 : j.textContent) ?? "";
1763
+ function gi() {
1764
+ return (K == null ? void 0 : K.textContent) ?? "";
1712
1765
  }
1713
- const Fr = 96 / 25.4;
1714
- function kr(e) {
1715
- return e.offsetHeight / Fr;
1766
+ const Vr = 96 / 25.4;
1767
+ function _r(e) {
1768
+ return e.offsetHeight / Vr;
1716
1769
  }
1717
1770
  const he = 1 / (96 / 25.4);
1718
- function ft(e) {
1771
+ function gt(e) {
1719
1772
  return e.border === "all" || e.border === "outer";
1720
1773
  }
1721
1774
  function Ne(e, t, n) {
@@ -1729,51 +1782,51 @@ function Ne(e, t, n) {
1729
1782
  typeof i.rowHeight == "number" && Number.isFinite(i.rowHeight) && i.rowHeight > r && (r = i.rowHeight);
1730
1783
  return r * e;
1731
1784
  }
1732
- function Pe(e, t, n, r, i, o) {
1785
+ function _e(e, t, n, r, i, o) {
1733
1786
  const a = Re(t);
1734
1787
  let l = 0;
1735
- return n.forEach((c, d) => {
1736
- d > 0 && (l += a), l += Ne(e, c, o);
1737
- }), ft(t) && (r || (l += he), i || (l += he)), l;
1788
+ return n.forEach((c, u) => {
1789
+ u > 0 && (l += a), l += Ne(e, c, o);
1790
+ }), gt(t) && (r || (l += he), i || (l += he)), l;
1738
1791
  }
1739
- function Ir(e, t) {
1740
- var c, d;
1741
- const n = ((c = e.style) == null ? void 0 : c.fontSize) ?? 13, r = ((d = e.style) == null ? void 0 : d.lineHeight) ?? 1.35, i = n * r / (96 / 25.4), o = Math.max(0.1, n * 0.6 / (96 / 25.4)), a = Math.max(1, Math.floor(t / o));
1792
+ function Or(e, t) {
1793
+ var c, u;
1794
+ const n = ((c = e.style) == null ? void 0 : c.fontSize) ?? 13, r = ((u = e.style) == null ? void 0 : u.lineHeight) ?? 1.35, i = n * r / (96 / 25.4), o = Math.max(0.1, n * 0.6 / (96 / 25.4)), a = Math.max(1, Math.floor(t / o));
1742
1795
  let l = 0;
1743
- for (const h of e.text.split(`
1796
+ for (const m of e.text.split(`
1744
1797
  `))
1745
- l += Math.max(1, Math.ceil(h.length / a));
1798
+ l += Math.max(1, Math.ceil(m.length / a));
1746
1799
  return l * i;
1747
1800
  }
1748
- function Lr(e, t) {
1801
+ function Gr(e, t) {
1749
1802
  return typeof e.height == "number" && Number.isFinite(e.height) && e.height > 0 ? e.height : typeof e.width == "number" && Number.isFinite(e.width) && e.width > 0 ? e.width : t;
1750
1803
  }
1751
- function _e(e, t, n) {
1804
+ function Oe(e, t, n) {
1752
1805
  const r = we(e, n);
1753
1806
  let o = (1 + (typeof e._paginateMaxRows == "number" && e._paginateMaxRows > 0 ? Math.min(r, e._paginateMaxRows) : r)) * t;
1754
1807
  return (e.border === "all" || e.border === "outer") && (o += 2 * he), o;
1755
1808
  }
1756
- function Qe(e, t) {
1809
+ function tt(e, t) {
1757
1810
  if (t.measureNode) {
1758
1811
  const n = t.measureNode(e);
1759
1812
  if (typeof n == "number" && Number.isFinite(n)) return n;
1760
1813
  }
1761
1814
  switch (e.type) {
1762
1815
  case "grid":
1763
- return Pe(t.baseRowHeight, e, e.rows, !1, !1, t.measureRow);
1816
+ return _e(t.baseRowHeight, e, e.rows, !1, !1, t.measureRow);
1764
1817
  case "image":
1765
- return ct(e, { data: t.data }) === null ? 0 : Lr(e, t.baseRowHeight);
1818
+ return ft(e, { data: t.data }) === null ? 0 : Gr(e, t.baseRowHeight);
1766
1819
  case "text":
1767
- return Ir(e, t.contentWidthMm);
1820
+ return Or(e, t.contentWidthMm);
1768
1821
  case "table":
1769
- return _e(e, t.baseRowHeight, t.data);
1822
+ return Oe(e, t.baseRowHeight, t.data);
1770
1823
  case "html":
1771
1824
  return t.baseRowHeight;
1772
1825
  case "p":
1773
1826
  return t.baseRowHeight;
1774
1827
  }
1775
1828
  }
1776
- function mt(e, t) {
1829
+ function pt(e, t) {
1777
1830
  const n = [], r = Math.max(1, t.bodyHeightMm), i = [];
1778
1831
  let o = [], a = 0;
1779
1832
  const l = () => {
@@ -1788,153 +1841,153 @@ function mt(e, t) {
1788
1841
  children: o
1789
1842
  }), o = [], a = 0;
1790
1843
  }
1791
- }, c = (f) => a + f <= r + 1e-6, d = (f) => {
1792
- o.push(f), a += Qe(f.node, t);
1793
- }, h = (f) => {
1794
- const u = Qe(f, t);
1795
- c(u) || (l(), c(u) || n.push({
1844
+ }, c = (f) => a + f <= r + 1e-6, u = (f) => {
1845
+ o.push(f), a += tt(f.node, t);
1846
+ }, m = (f) => {
1847
+ const h = tt(f, t);
1848
+ c(h) || (l(), c(h) || n.push({
1796
1849
  nodeId: f.id,
1797
- message: `节点(${f.type})高度约 ${u.toFixed(1)}mm 超过单页可用高 ${r.toFixed(1)}mm,已溢出裁剪`
1798
- })), d({ node: f });
1799
- }, p = (f) => {
1800
- const u = Pe(t.baseRowHeight, f, f.rows, !1, !1, t.measureRow);
1801
- let m = !1;
1802
- for (const g of f.rows) {
1803
- for (const S of g.cells) {
1804
- for (const E of S.children)
1805
- if (E.type === "table" && _e(E, t.baseRowHeight, t.data) > t.bodyHeightMm * 0.8) {
1806
- m = !0;
1850
+ message: `节点(${f.type})高度约 ${h.toFixed(1)}mm 超过单页可用高 ${r.toFixed(1)}mm,已溢出裁剪`
1851
+ })), u({ node: f });
1852
+ }, g = (f) => {
1853
+ const h = _e(t.baseRowHeight, f, f.rows, !1, !1, t.measureRow);
1854
+ let d = !1;
1855
+ for (const y of f.rows) {
1856
+ for (const p of y.cells) {
1857
+ for (const E of p.children)
1858
+ if (E.type === "table" && Oe(E, t.baseRowHeight, t.data) > t.bodyHeightMm * 0.8) {
1859
+ d = !0;
1807
1860
  break;
1808
1861
  }
1809
- if (m) break;
1862
+ if (d) break;
1810
1863
  }
1811
- if (m) break;
1864
+ if (d) break;
1812
1865
  }
1813
- if (c(u) && !m) {
1814
- d({ node: f });
1866
+ if (c(h) && !d) {
1867
+ u({ node: f });
1815
1868
  return;
1816
1869
  }
1817
- w(f);
1818
- }, b = (f) => {
1819
- const u = we(f, t.data), m = t.baseRowHeight, g = t.baseRowHeight, S = f.border === "all" || f.border === "outer", E = S ? he : 0, $ = g + u * m + (S ? 2 * E : 0);
1820
- if (c($)) {
1821
- d({ node: f });
1870
+ b(f);
1871
+ }, v = (f) => {
1872
+ const h = we(f, t.data), d = t.baseRowHeight, y = t.baseRowHeight, p = f.border === "all" || f.border === "outer", E = p ? he : 0, F = y + h * d + (p ? 2 * E : 0);
1873
+ if (c(F)) {
1874
+ u({ node: f });
1822
1875
  return;
1823
1876
  }
1824
- let I = u, D = 0, _ = !0;
1825
- for (; I > 0; ) {
1826
- const v = r - a, x = _ ? g + E : E, V = Math.max(0, v - x);
1827
- let L = V > 0 ? Math.floor(V / m) : 0;
1828
- if (L === 0 && I > 0 && (L = 1, o.length > 0 && x + m > v + 1e-6)) {
1877
+ let C = h, P = 0, D = !0;
1878
+ for (; C > 0; ) {
1879
+ const T = r - a, A = D ? y + E : E, _ = Math.max(0, T - A);
1880
+ let k = _ > 0 ? Math.floor(_ / d) : 0;
1881
+ if (k === 0 && C > 0 && (k = 1, o.length > 0 && A + d > T + 1e-6)) {
1829
1882
  l();
1830
1883
  continue;
1831
1884
  }
1832
- L = Math.min(L, I);
1833
- const te = D + L >= u, J = {
1885
+ k = Math.min(k, C);
1886
+ const te = P + k >= h, X = {
1834
1887
  ...f,
1835
- _paginateMaxRows: L
1888
+ _paginateMaxRows: k
1836
1889
  };
1837
- d({
1838
- node: J,
1890
+ u({
1891
+ node: X,
1839
1892
  suppressBorders: {
1840
- top: !_,
1893
+ top: !D,
1841
1894
  // 后续片段抑制上外框(连续外观)
1842
1895
  bottom: !te
1843
1896
  // 非末片段抑制下外框
1844
1897
  }
1845
- }), I -= L, D += L, _ = !1, I > 0 && l();
1898
+ }), C -= k, P += k, D = !1, C > 0 && l();
1846
1899
  }
1847
1900
  };
1848
- function y(f) {
1849
- const u = [];
1850
- for (const m of f.cells)
1851
- for (const g of m.children)
1852
- g.type === "table" && u.push(g);
1853
- return u;
1901
+ function w(f) {
1902
+ const h = [];
1903
+ for (const d of f.cells)
1904
+ for (const y of d.children)
1905
+ y.type === "table" && h.push(y);
1906
+ return h;
1854
1907
  }
1855
- function M(f, u) {
1856
- return f.map((m) => {
1857
- if (m.type === "grid")
1908
+ function M(f, h) {
1909
+ return f.map((d) => {
1910
+ if (d.type === "grid")
1858
1911
  return {
1859
- ...m,
1860
- rows: m.rows.map((g) => ({
1861
- ...g,
1862
- cells: g.cells.map((S) => ({
1863
- ...S,
1864
- children: M(S.children, u)
1912
+ ...d,
1913
+ rows: d.rows.map((y) => ({
1914
+ ...y,
1915
+ cells: y.cells.map((p) => ({
1916
+ ...p,
1917
+ children: M(p.children, h)
1865
1918
  }))
1866
1919
  }))
1867
1920
  };
1868
- if (m.type === "table") {
1869
- const g = u(m);
1870
- if (typeof g == "number" && g > 0)
1871
- return { ...m, _paginateMaxRows: g };
1921
+ if (d.type === "table") {
1922
+ const y = h(d);
1923
+ if (typeof y == "number" && y > 0)
1924
+ return { ...d, _paginateMaxRows: y };
1872
1925
  }
1873
- return m;
1926
+ return d;
1874
1927
  });
1875
1928
  }
1876
- const w = (f) => {
1877
- const u = f.rows, m = Re(f), g = ft(f), S = t.measureRow;
1878
- let E = 0, $ = !0;
1879
- for (; E < u.length; ) {
1880
- const I = !$;
1881
- let D = r - a;
1882
- const _ = y(u[E]);
1883
- let v = 0;
1884
- for (const H of _)
1885
- v += _e(H, t.baseRowHeight, t.data);
1886
- const x = Ne(t.baseRowHeight, u[E], S), V = (g ? he : 0) + x;
1887
- if (_.length > 0 && v > D - V && u.length - E === 1) {
1929
+ const b = (f) => {
1930
+ const h = f.rows, d = Re(f), y = gt(f), p = t.measureRow;
1931
+ let E = 0, F = !0;
1932
+ for (; E < h.length; ) {
1933
+ const C = !F;
1934
+ let P = r - a;
1935
+ const D = w(h[E]);
1936
+ let T = 0;
1937
+ for (const $ of D)
1938
+ T += Oe($, t.baseRowHeight, t.data);
1939
+ const A = Ne(t.baseRowHeight, h[E], p), _ = (y ? he : 0) + A;
1940
+ if (D.length > 0 && T > P - _ && h.length - E === 1) {
1888
1941
  o.length > 0 && l();
1889
- let H = 0;
1890
- for (const de of _)
1891
- H += we(de, t.data);
1892
- let W = 0, ie = !0;
1893
- for (; H > 0; ) {
1894
- const de = r - a, Me = Math.max(0, de - V);
1895
- let Z = Me > 0 ? Math.floor(Me / t.baseRowHeight) : 0;
1896
- Z === 0 && H > 0 && (Z = 1), Z = Math.min(Z, H);
1897
- const s = W + Z >= H, T = u[E].cells.map((N) => ({
1898
- ...N,
1899
- children: M(N.children, (B) => {
1900
- const oe = we(B, t.data) / Math.max(1, H + W);
1901
- return Math.round(Z * oe);
1942
+ let $ = 0;
1943
+ for (const le of D)
1944
+ $ += we(le, t.data);
1945
+ let z = 0, Z = !0;
1946
+ for (; $ > 0; ) {
1947
+ const le = r - a, Me = Math.max(0, le - _);
1948
+ let Q = Me > 0 ? Math.floor(Me / t.baseRowHeight) : 0;
1949
+ Q === 0 && $ > 0 && (Q = 1), Q = Math.min(Q, $);
1950
+ const Ce = z + Q >= $, s = h[E].cells.map((S) => ({
1951
+ ...S,
1952
+ children: M(S.children, (N) => {
1953
+ const re = we(N, t.data) / Math.max(1, $ + z);
1954
+ return Math.round(Q * re);
1902
1955
  })
1903
1956
  }));
1904
- d({
1905
- node: { ...f, rows: [{ ...u[E], cells: T }] },
1906
- suppressBorders: { top: !ie, bottom: !s }
1907
- }), H -= Z, W += Z, ie = !1, H > 0 && l();
1957
+ u({
1958
+ node: { ...f, rows: [{ ...h[E], cells: s }] },
1959
+ suppressBorders: { top: !Z, bottom: !Ce }
1960
+ }), $ -= Q, z += Q, Z = !1, $ > 0 && l();
1908
1961
  }
1909
- $ = !1, E = E + 1, E < u.length && l();
1962
+ F = !1, E = E + 1, E < h.length && l();
1910
1963
  continue;
1911
1964
  }
1912
- let L = E, te = I || !g ? 0 : he, J = 0;
1913
- for (; L < u.length; ) {
1914
- const H = Ne(t.baseRowHeight, u[L], S), W = (J > 0 ? m : 0) + H, de = L + 1 >= u.length && g ? he : 0;
1915
- if (te + W + de <= D + 1e-6)
1916
- te += W, J++, L++;
1965
+ let k = E, te = C || !y ? 0 : he, X = 0;
1966
+ for (; k < h.length; ) {
1967
+ const $ = Ne(t.baseRowHeight, h[k], p), z = (X > 0 ? d : 0) + $, le = k + 1 >= h.length && y ? he : 0;
1968
+ if (te + z + le <= P + 1e-6)
1969
+ te += z, X++, k++;
1917
1970
  else
1918
1971
  break;
1919
1972
  }
1920
- if (J === 0) {
1973
+ if (X === 0) {
1921
1974
  o.length > 0 && l();
1922
- const H = !$, W = E + 1 < u.length, ie = Pe(t.baseRowHeight, f, u.slice(E, E + 1), H, W, S);
1923
- ie > r + 1e-6 && n.push({
1975
+ const $ = !F, z = E + 1 < h.length, Z = _e(t.baseRowHeight, f, h.slice(E, E + 1), $, z, p);
1976
+ Z > r + 1e-6 && n.push({
1924
1977
  nodeId: f.id,
1925
- message: `Grid 第 ${E + 1} 行高度约 ${ie.toFixed(1)}mm 超过单页可用高,已溢出裁剪`
1926
- }), d({ node: { ...f, rows: u.slice(E, E + 1) }, suppressBorders: { top: H, bottom: W } }), $ = !1, E = E + 1, E < u.length && l();
1978
+ message: `Grid 第 ${E + 1} 行高度约 ${Z.toFixed(1)}mm 超过单页可用高,已溢出裁剪`
1979
+ }), u({ node: { ...f, rows: h.slice(E, E + 1) }, suppressBorders: { top: $, bottom: z } }), F = !1, E = E + 1, E < h.length && l();
1927
1980
  continue;
1928
1981
  }
1929
- const re = L < u.length, pe = I, ne = re;
1930
- d({
1931
- node: { ...f, rows: u.slice(E, L), id: f.id },
1932
- suppressBorders: { top: pe, bottom: ne }
1933
- }), $ = !1, E = L, re && l();
1982
+ const oe = k < h.length, ae = C, pe = oe;
1983
+ u({
1984
+ node: { ...f, rows: h.slice(E, k), id: f.id },
1985
+ suppressBorders: { top: ae, bottom: pe }
1986
+ }), F = !1, E = k, oe && l();
1934
1987
  }
1935
1988
  };
1936
1989
  for (const f of e.children)
1937
- f.type === "grid" ? p(f) : f.type === "table" ? b(f) : h(f);
1990
+ f.type === "grid" ? g(f) : f.type === "table" ? v(f) : m(f);
1938
1991
  return l(), i.length === 0 && i.push({
1939
1992
  id: e.id,
1940
1993
  sourcePageId: e.id,
@@ -1944,10 +1997,10 @@ function mt(e, t) {
1944
1997
  children: []
1945
1998
  }), { pages: i, warnings: n };
1946
1999
  }
1947
- function Cr(e, t) {
1948
- const n = Be(e.paper), r = [], i = [];
2000
+ function Br(e, t) {
2001
+ const n = ze(e.paper), r = [], i = [];
1949
2002
  for (const o of e.pages) {
1950
- const a = n.heightMm - o.margin.top - o.margin.bottom, l = n.widthMm - o.margin.left - o.margin.right, c = mt(o, {
2003
+ const a = n.heightMm - o.margin.top - o.margin.bottom, l = n.widthMm - o.margin.left - o.margin.right, c = pt(o, {
1951
2004
  baseRowHeight: e.baseRowHeight,
1952
2005
  bodyHeightMm: a,
1953
2006
  contentWidthMm: l,
@@ -1959,7 +2012,7 @@ function Cr(e, t) {
1959
2012
  }
1960
2013
  return r.forEach((o, a) => o.index = a + 1), { pages: r, warnings: i };
1961
2014
  }
1962
- const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { class: "grid-form-band__zone grid-form-band__zone--center" }, Vr = { class: "grid-form-band__zone grid-form-band__zone--right" }, Pr = { class: "grid-form-band__zone" }, _r = { class: "grid-form-band__zone grid-form-band__zone--center" }, Or = { class: "grid-form-band__zone grid-form-band__zone--right" }, Br = /* @__PURE__ */ Te({
2015
+ const zr = ["data-node-id"], Wr = { class: "grid-form-band__zone" }, Ur = { class: "grid-form-band__zone grid-form-band__zone--center" }, jr = { class: "grid-form-band__zone grid-form-band__zone--right" }, Kr = { class: "grid-form-band__zone" }, qr = { class: "grid-form-band__zone grid-form-band__zone--center" }, Yr = { class: "grid-form-band__zone grid-form-band__zone--right" }, Jr = /* @__PURE__ */ Te({
1963
2016
  name: "GridFormRenderer",
1964
2017
  __name: "GridFormRenderer",
1965
2018
  props: {
@@ -1971,157 +2024,161 @@ const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { clas
1971
2024
  paginate: { type: Boolean, default: !0 },
1972
2025
  fieldPermissions: {}
1973
2026
  },
1974
- emits: ["field-change", "action-trigger"],
2027
+ emits: ["field-change", "field-activate"],
1975
2028
  setup(e, { emit: t }) {
1976
- const n = t, r = e, i = K(() => Be(r.schema.paper));
2029
+ const n = t, r = e, i = U(() => ze(r.schema.paper));
1977
2030
  ge(
1978
2031
  i,
1979
- (u) => Rr(u.widthMm, u.heightMm),
2032
+ (d) => Hr(d.widthMm, d.heightMm),
1980
2033
  { immediate: !0 }
1981
- ), vt(Nr());
1982
- function o(u) {
1983
- const m = i.value, g = r.paginate;
2034
+ ), St(Pr());
2035
+ function o(d) {
2036
+ const y = i.value, p = r.paginate;
1984
2037
  return {
1985
2038
  position: "relative",
1986
- width: `${m.widthMm}mm`,
1987
- ...g ? { height: `${m.heightMm}mm` } : { minHeight: `${m.heightMm}mm` },
1988
- padding: `${u.top}mm ${u.right}mm ${u.bottom}mm ${u.left}mm`
2039
+ width: `${y.widthMm}mm`,
2040
+ ...p ? { height: `${y.heightMm}mm` } : { minHeight: `${y.heightMm}mm` },
2041
+ padding: `${d.top}mm ${d.right}mm ${d.bottom}mm ${d.left}mm`
1989
2042
  };
1990
2043
  }
1991
- const a = K(() => {
1992
- const u = i.value;
2044
+ const a = U(() => {
2045
+ const d = i.value;
1993
2046
  if (!r.paginate)
1994
- return r.schema.pages.map((g, S) => ({
1995
- id: g.id,
1996
- sourcePageId: g.id,
1997
- sourceIndex: S,
1998
- index: S + 1,
1999
- margin: g.margin,
2000
- children: g.children.map((E) => ({ node: E }))
2047
+ return r.schema.pages.map((p, E) => ({
2048
+ id: p.id,
2049
+ sourcePageId: p.id,
2050
+ sourceIndex: E,
2051
+ index: E + 1,
2052
+ margin: p.margin,
2053
+ children: p.children.map((F) => ({ node: F }))
2001
2054
  }));
2002
- const m = [];
2003
- for (const g of r.schema.pages) {
2004
- const S = u.heightMm - g.margin.top - g.margin.bottom, E = u.widthMm - g.margin.left - g.margin.right, $ = mt(g, {
2055
+ const y = [];
2056
+ for (const p of r.schema.pages) {
2057
+ const E = d.heightMm - p.margin.top - p.margin.bottom, F = d.widthMm - p.margin.left - p.margin.right, C = pt(p, {
2005
2058
  baseRowHeight: r.schema.baseRowHeight,
2006
- bodyHeightMm: S,
2007
- contentWidthMm: E,
2059
+ bodyHeightMm: E,
2060
+ contentWidthMm: F,
2008
2061
  data: r.data ?? null
2009
2062
  });
2010
- m.push(...$.pages);
2063
+ y.push(...C.pages);
2011
2064
  }
2012
- return m.forEach((g, S) => g.index = S + 1), m;
2013
- }), l = X(null);
2065
+ return y.forEach((p, E) => p.index = E + 1), y;
2066
+ }), l = J(null);
2014
2067
  function c() {
2015
2068
  if (typeof document > "u") return null;
2016
- const u = /* @__PURE__ */ new Map();
2017
- return document.querySelectorAll(".grid-form-paper .layout-grid__row").forEach((m) => {
2018
- const g = m.dataset.layoutId;
2019
- if (!g) return;
2020
- const S = kr(m);
2021
- Number.isFinite(S) && S > 0 && u.set(g, S);
2022
- }), u.size ? u : null;
2023
- }
2024
- function d() {
2069
+ const d = /* @__PURE__ */ new Map();
2070
+ return document.querySelectorAll(".grid-form-paper .layout-grid__row").forEach((y) => {
2071
+ const p = y.dataset.layoutId;
2072
+ if (!p) return;
2073
+ const E = _r(y);
2074
+ Number.isFinite(E) && E > 0 && d.set(p, E);
2075
+ }), d.size ? d : null;
2076
+ }
2077
+ function u() {
2025
2078
  if (!r.paginate || typeof document > "u") {
2026
2079
  l.value = null;
2027
2080
  return;
2028
2081
  }
2029
- const u = c();
2030
- if (!u) return;
2031
- const m = Cr(r.schema, {
2082
+ const d = c();
2083
+ if (!d) return;
2084
+ const y = Br(r.schema, {
2032
2085
  data: r.data ?? null,
2033
- measureRow: (g) => {
2034
- const S = u.get(g.id);
2035
- if (S !== void 0)
2036
- return Math.max(S, Ne(r.schema.baseRowHeight, g));
2086
+ measureRow: (p) => {
2087
+ const E = d.get(p.id);
2088
+ if (E !== void 0)
2089
+ return Math.max(E, Ne(r.schema.baseRowHeight, p));
2037
2090
  }
2038
2091
  });
2039
- l.value = m.pages;
2092
+ l.value = y.pages;
2040
2093
  }
2041
- ge(a, () => Je(d), { flush: "post" }), Fe(() => Je(d));
2042
- const h = K(() => l.value ?? a.value);
2043
- function p(u) {
2044
- return (u == null ? void 0 : u.enabled) === !0;
2094
+ ge(a, () => Xe(u), { flush: "post" }), Fe(() => Xe(u));
2095
+ const m = U(() => l.value ?? a.value);
2096
+ function g(d) {
2097
+ return (d == null ? void 0 : d.enabled) === !0;
2045
2098
  }
2046
- function b(u) {
2047
- const m = u == null ? void 0 : u.height;
2048
- return typeof m == "number" && Number.isFinite(m) && m > 0 ? m : Nt;
2099
+ function v(d) {
2100
+ const y = d == null ? void 0 : d.height;
2101
+ return typeof y == "number" && Number.isFinite(y) && y > 0 ? y : It;
2049
2102
  }
2050
- function y(u, m, g) {
2051
- return u ? u.replace(/\{page\}/g, String(m.index)).replace(/\{total\}/g, String(g)) : "";
2103
+ function w(d, y, p) {
2104
+ return d ? d.replace(/\{page\}/g, String(y.index)).replace(/\{total\}/g, String(p)) : "";
2052
2105
  }
2053
- function M(u, m, g) {
2054
- var v, x, V;
2055
- const S = (u == null ? void 0 : u.separator) !== !1, E = (u == null ? void 0 : u.separatorColor) ?? "#111827", I = `${(u == null ? void 0 : u.separatorWidth) ?? 1}px solid ${E}`, D = g === "top" ? m.top : m.bottom, _ = Math.min(b(u), D);
2106
+ function M(d, y, p) {
2107
+ var A, _, k;
2108
+ const E = (d == null ? void 0 : d.separator) !== !1, F = (d == null ? void 0 : d.separatorColor) ?? "#111827", P = `${(d == null ? void 0 : d.separatorWidth) ?? 1}px solid ${F}`, D = p === "top" ? y.top : y.bottom, T = Math.min(v(d), D);
2056
2109
  return {
2057
- left: `${m.left}mm`,
2058
- right: `${m.right}mm`,
2059
- height: `${_}mm`,
2060
- ...g === "top" ? { top: 0, ...S ? { borderBottom: I } : {} } : { bottom: 0, ...S ? { borderTop: I } : {} },
2061
- fontSize: (v = u == null ? void 0 : u.style) != null && v.fontSize ? `${u.style.fontSize}px` : void 0,
2062
- fontWeight: ((x = u == null ? void 0 : u.style) == null ? void 0 : x.fontWeight) ?? void 0,
2063
- color: ((V = u == null ? void 0 : u.style) == null ? void 0 : V.color) ?? void 0
2110
+ left: `${y.left}mm`,
2111
+ right: `${y.right}mm`,
2112
+ height: `${T}mm`,
2113
+ ...p === "top" ? { top: 0, ...E ? { borderBottom: P } : {} } : { bottom: 0, ...E ? { borderTop: P } : {} },
2114
+ fontSize: (A = d == null ? void 0 : d.style) != null && A.fontSize ? `${d.style.fontSize}px` : void 0,
2115
+ fontWeight: ((_ = d == null ? void 0 : d.style) == null ? void 0 : _.fontWeight) ?? void 0,
2116
+ color: ((k = d == null ? void 0 : d.style) == null ? void 0 : k.color) ?? void 0
2064
2117
  };
2065
2118
  }
2066
- function w(u, m, g) {
2067
- return { ...f(u.children.map((E) => E.node), m), ...g ?? {} };
2119
+ function b(d, y, p) {
2120
+ return { ...f(d.children.map((F) => F.node), y), ...p ?? {} };
2121
+ }
2122
+ function f(d, y) {
2123
+ const p = d[y];
2124
+ if (!(p.type === "grid" && (p.border === "all" || p.border === "outer"))) return;
2125
+ const F = d[y - 1];
2126
+ return { top: !!F && F.type === "grid" && (F.border === "all" || F.border === "outer") };
2068
2127
  }
2069
- function f(u, m) {
2070
- const g = u[m];
2071
- if (!(g.type === "grid" && (g.border === "all" || g.border === "outer"))) return;
2072
- const E = u[m - 1];
2073
- return { top: !!E && E.type === "grid" && (E.border === "all" || E.border === "outer") };
2128
+ function h(d) {
2129
+ const y = r.schema.pages.find((p) => p.id === d);
2130
+ return dt(y == null ? void 0 : y.params);
2074
2131
  }
2075
- return (u, m) => (A(), R("div", {
2076
- class: ae(["grid-form-canvas", { "grid-form-canvas--bare": e.bare }])
2132
+ return (d, y) => (x(), R("div", {
2133
+ class: Be(["grid-form-canvas", { "grid-form-canvas--bare": e.bare }])
2077
2134
  }, [
2078
- (A(!0), R(q, null, Y(h.value, (g) => {
2079
- var S, E, $, I, D, _, v, x, V, L, te, J;
2080
- return A(), R("main", {
2081
- key: g.id,
2135
+ (x(!0), R(j, null, Y(m.value, (p) => {
2136
+ var E, F, C, P, D, T, A, _, k, te, X, oe;
2137
+ return x(), R("main", se({
2138
+ key: p.id,
2082
2139
  class: "grid-form-paper",
2083
- style: z(o(g.margin)),
2084
- "data-node-id": g.id
2085
- }, [
2086
- p(e.schema.paper.header) ? (A(), R("div", {
2140
+ style: o(p.margin),
2141
+ "data-node-id": p.id
2142
+ }, { ref_for: !0 }, h(p.sourcePageId)), [
2143
+ g(e.schema.paper.header) ? (x(), R("div", {
2087
2144
  key: 0,
2088
2145
  class: "grid-form-band grid-form-band--header",
2089
- style: z(M(e.schema.paper.header, g.margin, "top"))
2146
+ style: ce(M(e.schema.paper.header, p.margin, "top"))
2090
2147
  }, [
2091
- O("span", Dr, G(y((E = (S = e.schema.paper.header) == null ? void 0 : S.content) == null ? void 0 : E.left, g, h.value.length)), 1),
2092
- O("span", Hr, G(y((I = ($ = e.schema.paper.header) == null ? void 0 : $.content) == null ? void 0 : I.center, g, h.value.length)), 1),
2093
- O("span", Vr, G(y((_ = (D = e.schema.paper.header) == null ? void 0 : D.content) == null ? void 0 : _.right, g, h.value.length)), 1)
2094
- ], 4)) : Ae("", !0),
2095
- (A(!0), R(q, null, Y(g.children, (re, pe) => (A(), ye(Mr, {
2096
- key: re.node.id,
2097
- node: re.node,
2148
+ O("span", Wr, G(w((F = (E = e.schema.paper.header) == null ? void 0 : E.content) == null ? void 0 : F.left, p, m.value.length)), 1),
2149
+ O("span", Ur, G(w((P = (C = e.schema.paper.header) == null ? void 0 : C.content) == null ? void 0 : P.center, p, m.value.length)), 1),
2150
+ O("span", jr, G(w((T = (D = e.schema.paper.header) == null ? void 0 : D.content) == null ? void 0 : T.right, p, m.value.length)), 1)
2151
+ ], 4)) : xe("", !0),
2152
+ (x(!0), R(j, null, Y(p.children, (ae, pe) => (x(), ye(Lr, {
2153
+ key: ae.node.id,
2154
+ node: ae.node,
2098
2155
  "base-row-height": e.schema.baseRowHeight,
2099
2156
  mode: r.mode,
2100
2157
  data: e.data,
2101
2158
  readonly: r.readonly,
2102
2159
  "field-permissions": r.fieldPermissions,
2103
- "suppress-borders": w(g, pe, re.suppressBorders),
2104
- onFieldChange: m[0] || (m[0] = (ne, H) => n("field-change", ne, H)),
2105
- onActionTrigger: m[1] || (m[1] = (ne) => n("action-trigger", ne))
2160
+ "suppress-borders": b(p, pe, ae.suppressBorders),
2161
+ onFieldChange: y[0] || (y[0] = ($, z) => n("field-change", $, z)),
2162
+ onFieldActivate: y[1] || (y[1] = ($) => n("field-activate", $))
2106
2163
  }, null, 8, ["node", "base-row-height", "mode", "data", "readonly", "field-permissions", "suppress-borders"]))), 128)),
2107
- p(e.schema.paper.footer) ? (A(), R("div", {
2164
+ g(e.schema.paper.footer) ? (x(), R("div", {
2108
2165
  key: 1,
2109
2166
  class: "grid-form-band grid-form-band--footer",
2110
- style: z(M(e.schema.paper.footer, g.margin, "bottom"))
2167
+ style: ce(M(e.schema.paper.footer, p.margin, "bottom"))
2111
2168
  }, [
2112
- O("span", Pr, G(y((x = (v = e.schema.paper.footer) == null ? void 0 : v.content) == null ? void 0 : x.left, g, h.value.length)), 1),
2113
- O("span", _r, G(y((L = (V = e.schema.paper.footer) == null ? void 0 : V.content) == null ? void 0 : L.center, g, h.value.length)), 1),
2114
- O("span", Or, G(y((J = (te = e.schema.paper.footer) == null ? void 0 : te.content) == null ? void 0 : J.right, g, h.value.length)), 1)
2115
- ], 4)) : Ae("", !0)
2116
- ], 12, $r);
2169
+ O("span", Kr, G(w((_ = (A = e.schema.paper.footer) == null ? void 0 : A.content) == null ? void 0 : _.left, p, m.value.length)), 1),
2170
+ O("span", qr, G(w((te = (k = e.schema.paper.footer) == null ? void 0 : k.content) == null ? void 0 : te.center, p, m.value.length)), 1),
2171
+ O("span", Yr, G(w((oe = (X = e.schema.paper.footer) == null ? void 0 : X.content) == null ? void 0 : oe.right, p, m.value.length)), 1)
2172
+ ], 4)) : xe("", !0)
2173
+ ], 16, zr);
2117
2174
  }), 128))
2118
2175
  ], 2));
2119
2176
  }
2120
- }), et = /* @__PURE__ */ Ie(Br, [["__scopeId", "data-v-f3e7b908"]]), li = "data-node-id", si = "data-layout-id", ci = "application/x-ticket-node-kind", Gr = {
2177
+ }), rt = /* @__PURE__ */ Ie(Jr, [["__scopeId", "data-v-f826627e"]]), pi = "data-node-id", yi = "data-layout-id", wi = "application/x-ticket-node-kind", Xr = {
2121
2178
  class: "paper-viewport__bar",
2122
2179
  role: "toolbar",
2123
2180
  "aria-label": "缩放控制"
2124
- }, zr = { class: "paper-viewport__scale" }, Wr = "input, textarea, select, [contenteditable], [draggable='true']", Ur = /* @__PURE__ */ Te({
2181
+ }, Zr = { class: "paper-viewport__scale" }, Qr = "input, textarea, select, [contenteditable], [draggable='true']", en = /* @__PURE__ */ Te({
2125
2182
  __name: "PaperViewport",
2126
2183
  props: {
2127
2184
  initialScale: { default: 1 },
@@ -2131,74 +2188,74 @@ const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { clas
2131
2188
  },
2132
2189
  emits: ["scale-change"],
2133
2190
  setup(e, { expose: t, emit: n }) {
2134
- const r = e, i = n, o = X(null), a = X(null), l = X(r.initialScale);
2135
- let c = null, d = null;
2136
- const h = K(() => `${Math.round(l.value * 100)}%`);
2137
- function p() {
2138
- const v = a.value;
2139
- v && (v.querySelectorAll(".panzoom-exclude").forEach((x) => x.classList.remove("panzoom-exclude")), v.querySelectorAll(Wr).forEach((x) => {
2140
- x.classList.add("panzoom-exclude"), x.matches("input, textarea, select, [contenteditable]") && (x.style.userSelect = "text");
2191
+ const r = e, i = n, o = J(null), a = J(null), l = J(r.initialScale);
2192
+ let c = null, u = null;
2193
+ const m = U(() => `${Math.round(l.value * 100)}%`);
2194
+ function g() {
2195
+ const T = a.value;
2196
+ T && (T.querySelectorAll(".panzoom-exclude").forEach((A) => A.classList.remove("panzoom-exclude")), T.querySelectorAll(Qr).forEach((A) => {
2197
+ A.classList.add("panzoom-exclude"), A.matches("input, textarea, select, [contenteditable]") && (A.style.userSelect = "text");
2141
2198
  }));
2142
2199
  }
2143
- const b = X(!1);
2144
- function y(v) {
2145
- const x = v;
2146
- return !!(x && typeof x.closest == "function" && x.closest("input, textarea, select, [contenteditable]"));
2200
+ const v = J(!1);
2201
+ function w(T) {
2202
+ const A = T;
2203
+ return !!(A && typeof A.closest == "function" && A.closest("input, textarea, select, [contenteditable]"));
2147
2204
  }
2148
2205
  function M() {
2149
- var v;
2150
- b.value || (b.value = !0, (v = o.value) == null || v.classList.add("is-space-pan"));
2206
+ var T;
2207
+ v.value || (v.value = !0, (T = o.value) == null || T.classList.add("is-space-pan"));
2151
2208
  }
2152
- function w() {
2153
- var v;
2154
- b.value && (b.value = !1, (v = o.value) == null || v.classList.remove("is-space-pan"));
2209
+ function b() {
2210
+ var T;
2211
+ v.value && (v.value = !1, (T = o.value) == null || T.classList.remove("is-space-pan"));
2155
2212
  }
2156
- function f(v) {
2157
- v.code !== "Space" && v.key !== " " || y(v.target) || (v.preventDefault(), M());
2213
+ function f(T) {
2214
+ T.code !== "Space" && T.key !== " " || w(T.target) || (T.preventDefault(), M());
2158
2215
  }
2159
- function u(v) {
2160
- v.code !== "Space" && v.key !== " " || w();
2216
+ function h(T) {
2217
+ T.code !== "Space" && T.key !== " " || b();
2161
2218
  }
2162
- function m(v) {
2163
- const x = v.detail;
2164
- typeof (x == null ? void 0 : x.scale) == "number" && x.scale !== l.value && (l.value = x.scale, i("scale-change", x.scale));
2219
+ function d(T) {
2220
+ const A = T.detail;
2221
+ typeof (A == null ? void 0 : A.scale) == "number" && A.scale !== l.value && (l.value = A.scale, i("scale-change", A.scale));
2165
2222
  }
2166
- function g(v) {
2223
+ function y(T) {
2167
2224
  if (!c) return;
2168
- const x = v.target;
2169
- x && x.closest("input, textarea, select, [contenteditable]") || c.zoomWithWheel(v);
2225
+ const A = T.target;
2226
+ A && A.closest("input, textarea, select, [contenteditable]") || c.zoomWithWheel(T);
2170
2227
  }
2171
- function S(v) {
2172
- return Math.min(r.maxScale, Math.max(r.minScale, v));
2228
+ function p(T) {
2229
+ return Math.min(r.maxScale, Math.max(r.minScale, T));
2173
2230
  }
2174
2231
  function E() {
2175
- const v = (c == null ? void 0 : c.getScale()) ?? l.value;
2176
- c == null || c.zoom(S(v * 1.2));
2232
+ const T = (c == null ? void 0 : c.getScale()) ?? l.value;
2233
+ c == null || c.zoom(p(T * 1.2));
2177
2234
  }
2178
- function $() {
2179
- const v = (c == null ? void 0 : c.getScale()) ?? l.value;
2180
- c == null || c.zoom(S(v / 1.2));
2235
+ function F() {
2236
+ const T = (c == null ? void 0 : c.getScale()) ?? l.value;
2237
+ c == null || c.zoom(p(T / 1.2));
2181
2238
  }
2182
- function I() {
2239
+ function C() {
2183
2240
  c == null || c.reset({ animate: !1 });
2184
2241
  }
2185
- function D() {
2186
- const v = o.value, x = a.value;
2187
- if (!v || !x || !c) return;
2188
- const L = (x.firstElementChild ?? x).scrollWidth || 0;
2189
- if (L <= 0 || v.clientWidth <= 0) {
2242
+ function P() {
2243
+ const T = o.value, A = a.value;
2244
+ if (!T || !A || !c) return;
2245
+ const k = (A.firstElementChild ?? A).scrollWidth || 0;
2246
+ if (k <= 0 || T.clientWidth <= 0) {
2190
2247
  c.zoom(r.initialScale);
2191
2248
  return;
2192
2249
  }
2193
- c.zoom(S(v.clientWidth / L));
2250
+ c.zoom(p(T.clientWidth / k));
2194
2251
  }
2195
- function _() {
2252
+ function D() {
2196
2253
  return (c == null ? void 0 : c.getScale()) ?? l.value;
2197
2254
  }
2198
- return t({ zoomIn: E, zoomOut: $, reset: I, fitWidth: D, getScale: _ }), Fe(() => {
2199
- const v = a.value, x = o.value;
2200
- if (!v || !x) return;
2201
- const V = {
2255
+ return t({ zoomIn: E, zoomOut: F, reset: C, fitWidth: P, getScale: D }), Fe(() => {
2256
+ const T = a.value, A = o.value;
2257
+ if (!T || !A) return;
2258
+ const _ = {
2202
2259
  minScale: r.minScale,
2203
2260
  maxScale: r.maxScale,
2204
2261
  startScale: r.initialScale,
@@ -2206,36 +2263,36 @@ const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { clas
2206
2263
  cursor: "grab",
2207
2264
  touchAction: "none"
2208
2265
  };
2209
- c = At(v, V), v.style.userSelect = "", x.style.userSelect = "", p(), d = new MutationObserver(p), d.observe(v, {
2266
+ c = Ft(T, _), T.style.userSelect = "", A.style.userSelect = "", g(), u = new MutationObserver(g), u.observe(T, {
2210
2267
  childList: !0,
2211
2268
  subtree: !0,
2212
2269
  attributes: !0,
2213
2270
  attributeFilter: ["draggable", "contenteditable"]
2214
- }), v.addEventListener("panzoomchange", m), x.addEventListener("wheel", g, { passive: !1 }), window.addEventListener("keydown", f), window.addEventListener("keyup", u), r.fitOnMount && D();
2215
- }), Et(() => {
2216
- d == null || d.disconnect(), d = null;
2217
- const v = a.value, x = o.value;
2218
- v == null || v.removeEventListener("panzoomchange", m), x == null || x.removeEventListener("wheel", g), window.removeEventListener("keydown", f), window.removeEventListener("keyup", u), c == null || c.resetStyle(), c == null || c.destroy(), c = null;
2219
- }), (v, x) => (A(), R("div", {
2271
+ }), T.addEventListener("panzoomchange", d), A.addEventListener("wheel", y, { passive: !1 }), window.addEventListener("keydown", f), window.addEventListener("keyup", h), r.fitOnMount && P();
2272
+ }), Mt(() => {
2273
+ u == null || u.disconnect(), u = null;
2274
+ const T = a.value, A = o.value;
2275
+ T == null || T.removeEventListener("panzoomchange", d), A == null || A.removeEventListener("wheel", y), window.removeEventListener("keydown", f), window.removeEventListener("keyup", h), c == null || c.resetStyle(), c == null || c.destroy(), c = null;
2276
+ }), (T, A) => (x(), R("div", {
2220
2277
  ref_key: "viewport",
2221
2278
  ref: o,
2222
- class: ae(["paper-viewport", { "is-space-pan": b.value }])
2279
+ class: Be(["paper-viewport", { "is-space-pan": v.value }])
2223
2280
  }, [
2224
2281
  O("div", {
2225
2282
  ref_key: "scaler",
2226
2283
  ref: a,
2227
2284
  class: "paper-viewport__scaler"
2228
2285
  }, [
2229
- Tt(v.$slots, "default", {}, void 0, !0)
2286
+ At(T.$slots, "default", {}, void 0, !0)
2230
2287
  ], 512),
2231
- O("div", Gr, [
2288
+ O("div", Xr, [
2232
2289
  O("button", {
2233
2290
  type: "button",
2234
2291
  class: "paper-viewport__btn",
2235
2292
  title: "缩小",
2236
- onClick: $
2293
+ onClick: F
2237
2294
  }, " − "),
2238
- O("span", zr, G(h.value), 1),
2295
+ O("span", Zr, G(m.value), 1),
2239
2296
  O("button", {
2240
2297
  type: "button",
2241
2298
  class: "paper-viewport__btn",
@@ -2246,18 +2303,18 @@ const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { clas
2246
2303
  type: "button",
2247
2304
  class: "paper-viewport__btn paper-viewport__btn--text",
2248
2305
  title: "适应宽度",
2249
- onClick: D
2306
+ onClick: P
2250
2307
  }, " 适应 "),
2251
2308
  O("button", {
2252
2309
  type: "button",
2253
2310
  class: "paper-viewport__btn paper-viewport__btn--text",
2254
2311
  title: "重置为 100%",
2255
- onClick: I
2312
+ onClick: C
2256
2313
  }, " 重置 ")
2257
2314
  ])
2258
2315
  ], 2));
2259
2316
  }
2260
- }), Kr = /* @__PURE__ */ Ie(Ur, [["__scopeId", "data-v-2b6e9ef6"]]), qr = {
2317
+ }), tn = /* @__PURE__ */ Ie(en, [["__scopeId", "data-v-2b6e9ef6"]]), rn = {
2261
2318
  "toolbar.dirty": "● 未保存",
2262
2319
  "toolbar.saved": "已保存",
2263
2320
  "toolbar.newBlank": "新建空白",
@@ -2284,7 +2341,7 @@ const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { clas
2284
2341
  "toolbar.saveFillDataTip": "保存表单当前的字段与值到本机(设计态 / 预览态均可,无字段则为空对象)",
2285
2342
  "toolbar.previewTip": "查看表单的实际填写效果;预览中可直接输入内容,并可导出为填写数据",
2286
2343
  "toolbar.helpTip": "查看使用说明"
2287
- }, jr = {
2344
+ }, nn = {
2288
2345
  "toolbar.dirty": "● Unsaved",
2289
2346
  "toolbar.saved": "Saved",
2290
2347
  "toolbar.newBlank": "New Blank",
@@ -2311,25 +2368,25 @@ const $r = ["data-node-id"], Dr = { class: "grid-form-band__zone" }, Hr = { clas
2311
2368
  "toolbar.saveFillDataTip": "Save the form's field-value JSON to this browser (design or preview; empty object when no fields)",
2312
2369
  "toolbar.previewTip": "See the actual filled form; you can input in preview and export as fill data",
2313
2370
  "toolbar.helpTip": "View usage instructions"
2314
- }, Jr = ["zh-CN", "en"], Oe = "zh-CN", $e = {
2315
- "zh-CN": qr,
2316
- en: jr
2317
- }, ht = X(Oe);
2318
- function ui(e) {
2319
- Jr.includes(e) && (ht.value = e);
2320
- }
2321
- function Yr(e, t, n) {
2322
- let i = ($e[e] ?? $e[Oe])[t];
2323
- return i == null && (i = $e[Oe][t] ?? t), i;
2324
- }
2325
- function di(e, t, n) {
2326
- return Yr(n ?? ht.value, e);
2327
- }
2328
- const Xr = ".grid-form-paper", Zr = ".grid-form-canvas", gt = ".layout-html", De = "data-v2-print-scope";
2329
- let Qr = 0;
2330
- function en(e) {
2371
+ }, on = ["zh-CN", "en"], Ge = "zh-CN", De = {
2372
+ "zh-CN": rn,
2373
+ en: nn
2374
+ }, yt = J(Ge);
2375
+ function bi(e) {
2376
+ on.includes(e) && (yt.value = e);
2377
+ }
2378
+ function an(e, t, n) {
2379
+ let i = (De[e] ?? De[Ge])[t];
2380
+ return i == null && (i = De[Ge][t] ?? t), i;
2381
+ }
2382
+ function vi(e, t, n) {
2383
+ return an(n ?? yt.value, e);
2384
+ }
2385
+ const ln = ".grid-form-paper", sn = ".grid-form-canvas", wt = ".layout-html", He = "data-v2-print-scope";
2386
+ let cn = 0;
2387
+ function un(e) {
2331
2388
  const t = [];
2332
- e.querySelectorAll(gt).forEach((r) => {
2389
+ e.querySelectorAll(wt).forEach((r) => {
2333
2390
  const i = r.shadowRoot;
2334
2391
  if (!i) return;
2335
2392
  const o = [];
@@ -2339,24 +2396,24 @@ function en(e) {
2339
2396
  o.forEach((l) => r.appendChild(l));
2340
2397
  const a = [];
2341
2398
  r.querySelectorAll("input, textarea").forEach((l) => {
2342
- const c = l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), d = c ? "checked" : "value";
2343
- a.push({ el: l, attr: d, prev: l.getAttribute(d) }), c ? l.checked ? l.setAttribute("checked", "") : l.removeAttribute("checked") : l.setAttribute("value", l.value);
2399
+ const c = l instanceof HTMLInputElement && (l.type === "checkbox" || l.type === "radio"), u = c ? "checked" : "value";
2400
+ a.push({ el: l, attr: u, prev: l.getAttribute(u) }), c ? l.checked ? l.setAttribute("checked", "") : l.removeAttribute("checked") : l.setAttribute("value", l.value);
2344
2401
  }), t.push({ host: r, nodes: o, controls: a });
2345
2402
  });
2346
2403
  let n = !1;
2347
2404
  return () => {
2348
2405
  n || (n = !0, t.forEach(({ host: r, nodes: i, controls: o }) => {
2349
- o.forEach(({ el: l, attr: c, prev: d }) => {
2350
- d === null ? l.removeAttribute(c) : l.setAttribute(c, d);
2406
+ o.forEach(({ el: l, attr: c, prev: u }) => {
2407
+ u === null ? l.removeAttribute(c) : l.setAttribute(c, u);
2351
2408
  });
2352
2409
  const a = r.shadowRoot;
2353
2410
  a && i.forEach((l) => a.appendChild(l));
2354
2411
  }));
2355
2412
  };
2356
2413
  }
2357
- function tn(e) {
2414
+ function dn(e) {
2358
2415
  const t = [];
2359
- return e.querySelectorAll(gt).forEach((n) => {
2416
+ return e.querySelectorAll(wt).forEach((n) => {
2360
2417
  var r;
2361
2418
  (r = n.shadowRoot) == null || r.querySelectorAll("style").forEach((i) => {
2362
2419
  const o = i.textContent ?? "";
@@ -2365,18 +2422,18 @@ function tn(e) {
2365
2422
  }), t.length ? `<style>${t.join(`
2366
2423
  `)}</style>` : "";
2367
2424
  }
2368
- function rn(e = {}) {
2425
+ function fn(e = {}) {
2369
2426
  if (typeof document > "u") return !1;
2370
- const t = e.root !== void 0 ? e.root : document.querySelector(Zr);
2427
+ const t = e.root !== void 0 ? e.root : document.querySelector(sn);
2371
2428
  if (!t) return !1;
2372
- const n = Array.from(t.querySelectorAll(Xr));
2429
+ const n = Array.from(t.querySelectorAll(ln));
2373
2430
  if (!n.length) return !1;
2374
- const r = String(Qr++);
2375
- n.forEach((a) => a.setAttribute(De, r));
2376
- const i = tn(t), o = en(t);
2431
+ const r = String(cn++);
2432
+ n.forEach((a) => a.setAttribute(He, r));
2433
+ const i = dn(t), o = un(t);
2377
2434
  try {
2378
- new Rt({
2379
- el: `[${De}="${r}"]`,
2435
+ new kt({
2436
+ el: `[${He}="${r}"]`,
2380
2437
  popTitle: e.title ?? document.title,
2381
2438
  extraHead: i,
2382
2439
  // 刻意不传 paperSize / orientation / customSize —— 契约 2。
@@ -2385,251 +2442,252 @@ function rn(e = {}) {
2385
2442
  } catch {
2386
2443
  return !1;
2387
2444
  } finally {
2388
- o(), n.forEach((a) => a.removeAttribute(De));
2445
+ o(), n.forEach((a) => a.removeAttribute(He));
2389
2446
  }
2390
2447
  return !0;
2391
2448
  }
2392
- function fi(e, t = {}) {
2449
+ function Ei(e, t = {}) {
2393
2450
  const { baseData: n, maskHidden: r } = t, i = {}, a = [
2394
2451
  ...e instanceof Element && e.matches("[data-field]") ? [e] : [],
2395
2452
  ...e.querySelectorAll("[data-field]")
2396
2453
  ];
2397
2454
  for (const c of Array.from(a)) {
2398
- const d = c.getAttribute("data-field");
2399
- if (!d) continue;
2455
+ const u = c.getAttribute("data-field");
2456
+ if (!u) continue;
2400
2457
  if (c.closest(".layout-p--hidden")) {
2401
2458
  if (r)
2402
- i[d] = "***";
2459
+ i[u] = "***";
2403
2460
  else {
2404
- const p = n == null ? void 0 : n[d];
2405
- p != null && (i[d] = String(p));
2461
+ const g = n == null ? void 0 : n[u];
2462
+ g != null && (i[u] = String(g));
2406
2463
  }
2407
2464
  continue;
2408
2465
  }
2409
2466
  if (c instanceof HTMLImageElement) {
2410
- i[d] = c.getAttribute("src") ?? "";
2467
+ i[u] = c.getAttribute("src") ?? "";
2411
2468
  continue;
2412
2469
  }
2413
- const h = c.innerText;
2414
- i[d] = typeof h == "string" ? h : c.textContent ?? "";
2470
+ const m = c.innerText;
2471
+ i[u] = typeof m == "string" ? m : c.textContent ?? "";
2415
2472
  }
2416
2473
  const l = [
2417
2474
  ...e instanceof HTMLElement && e.matches(".layout-html") ? [e] : [],
2418
2475
  ...e.querySelectorAll(".layout-html")
2419
2476
  ];
2420
2477
  for (const c of Array.from(l)) {
2421
- const d = c.shadowRoot;
2422
- d && (d.querySelectorAll("[data-bind]").forEach((h) => {
2423
- const p = h.getAttribute("data-bind");
2424
- if (p) {
2425
- if (h.hasAttribute("data-masked")) {
2478
+ const u = c.shadowRoot;
2479
+ u && (u.querySelectorAll("[data-bind]").forEach((m) => {
2480
+ const g = m.getAttribute("data-bind");
2481
+ if (g) {
2482
+ if (m.hasAttribute("data-masked")) {
2426
2483
  if (r)
2427
- i[p] = "***";
2484
+ i[g] = "***";
2428
2485
  else {
2429
- const b = n == null ? void 0 : n[p];
2430
- b != null && (i[p] = String(b));
2486
+ const v = n == null ? void 0 : n[g];
2487
+ v != null && (i[g] = String(v));
2431
2488
  }
2432
2489
  return;
2433
2490
  }
2434
- if (h instanceof HTMLInputElement) {
2435
- i[p] = h.value;
2491
+ if (m instanceof HTMLInputElement) {
2492
+ i[g] = m.value;
2436
2493
  return;
2437
2494
  }
2438
2495
  }
2439
- }), d.querySelectorAll("[data-field]").forEach((h) => {
2440
- const p = h.getAttribute("data-field");
2441
- if (!p) return;
2442
- if (h.hasAttribute("data-masked")) {
2496
+ }), u.querySelectorAll("[data-field]").forEach((m) => {
2497
+ const g = m.getAttribute("data-field");
2498
+ if (!g) return;
2499
+ if (m.hasAttribute("data-masked")) {
2443
2500
  if (r)
2444
- i[p] = "***";
2501
+ i[g] = "***";
2445
2502
  else {
2446
- const y = n == null ? void 0 : n[p];
2447
- y != null && (i[p] = String(y));
2503
+ const w = n == null ? void 0 : n[g];
2504
+ w != null && (i[g] = String(w));
2448
2505
  }
2449
2506
  return;
2450
2507
  }
2451
- const b = h.innerText;
2452
- i[p] = typeof b == "string" ? b : h.textContent ?? "";
2508
+ const v = m.innerText;
2509
+ i[g] = typeof v == "string" ? v : m.textContent ?? "";
2453
2510
  }));
2454
2511
  }
2455
2512
  return i;
2456
2513
  }
2457
- const tt = "preview", mi = /* @__PURE__ */ Te({
2514
+ const nt = "preview", Ti = /* @__PURE__ */ Te({
2458
2515
  __name: "FormRenderer",
2459
2516
  props: {
2460
2517
  schema: {},
2461
2518
  data: {},
2462
2519
  options: { default: () => ({}) }
2463
2520
  },
2464
- emits: ["field-change", "update:data", "action"],
2521
+ emits: ["field-change", "update:data", "field-activate"],
2465
2522
  setup(e, { expose: t, emit: n }) {
2466
- const r = e, i = n, o = X({ ...r.data ?? {} });
2523
+ const r = e, i = n, o = J({ ...r.data ?? {} });
2467
2524
  ge(
2468
2525
  () => r.data,
2469
- (y) => {
2470
- o.value = { ...y ?? {} };
2526
+ (w) => {
2527
+ o.value = { ...w ?? {} };
2471
2528
  }
2472
2529
  );
2473
- const a = K(() => {
2474
- var y;
2475
- return ((y = r.options) == null ? void 0 : y.readonly) ?? !0;
2530
+ const a = U(() => {
2531
+ var w;
2532
+ return ((w = r.options) == null ? void 0 : w.readonly) ?? !0;
2476
2533
  });
2477
- function l(y, M) {
2478
- o.value = { ...o.value, [y]: M }, i("update:data", o.value), i("field-change", y, M);
2534
+ function l(w, M) {
2535
+ o.value = { ...o.value, [w]: M }, i("update:data", o.value), i("field-change", w, M);
2479
2536
  }
2480
- function c(y) {
2481
- i("action", y);
2537
+ function c(w) {
2538
+ i("field-activate", w);
2482
2539
  }
2483
- const d = X(null);
2484
- function h() {
2540
+ const u = J(null);
2541
+ function m() {
2485
2542
  var M;
2486
- const y = (M = d.value) == null ? void 0 : M.$el;
2487
- return rn({ root: y instanceof HTMLElement ? y : null });
2543
+ const w = (M = u.value) == null ? void 0 : M.$el;
2544
+ return fn({ root: w instanceof HTMLElement ? w : null });
2488
2545
  }
2489
- function p() {
2546
+ function g() {
2490
2547
  return { ...o.value };
2491
2548
  }
2492
- function b() {
2493
- var y;
2494
- return ur((y = r.options) == null ? void 0 : y.rules, o.value);
2549
+ function v() {
2550
+ var w;
2551
+ return br((w = r.options) == null ? void 0 : w.rules, o.value);
2495
2552
  }
2496
- return t({ print: h, getFormData: p, validate: b }), (y, M) => {
2497
- var w, f, u, m;
2498
- return (w = e.options) != null && w.zoom ? (A(), ye(Kr, {
2553
+ return t({ print: m, getFormData: g, validate: v }), (w, M) => {
2554
+ var b, f, h, d;
2555
+ return (b = e.options) != null && b.zoom ? (x(), ye(tn, {
2499
2556
  key: 0,
2500
2557
  "fit-on-mount": ((f = e.options) == null ? void 0 : f.fitOnMount) ?? !1
2501
2558
  }, {
2502
- default: St(() => {
2503
- var g;
2559
+ default: xt(() => {
2560
+ var y;
2504
2561
  return [
2505
- Mt(et, {
2562
+ Rt(rt, {
2506
2563
  ref_key: "rendererRef",
2507
- ref: d,
2564
+ ref: u,
2508
2565
  schema: e.schema,
2509
- mode: tt,
2566
+ mode: nt,
2510
2567
  data: o.value,
2511
2568
  readonly: a.value,
2512
- "field-permissions": (g = e.options) == null ? void 0 : g.fieldPermissions,
2569
+ "field-permissions": (y = e.options) == null ? void 0 : y.fieldPermissions,
2513
2570
  bare: !0,
2514
2571
  onFieldChange: l,
2515
- onActionTrigger: c
2572
+ onFieldActivate: c
2516
2573
  }, null, 8, ["schema", "data", "readonly", "field-permissions"])
2517
2574
  ];
2518
2575
  }),
2519
2576
  _: 1
2520
- }, 8, ["fit-on-mount"])) : (A(), ye(et, {
2577
+ }, 8, ["fit-on-mount"])) : (x(), ye(rt, {
2521
2578
  key: 1,
2522
2579
  ref_key: "rendererRef",
2523
- ref: d,
2580
+ ref: u,
2524
2581
  schema: e.schema,
2525
- mode: tt,
2582
+ mode: nt,
2526
2583
  data: o.value,
2527
2584
  readonly: a.value,
2528
- "field-permissions": (u = e.options) == null ? void 0 : u.fieldPermissions,
2529
- bare: (m = e.options) == null ? void 0 : m.bare,
2585
+ "field-permissions": (h = e.options) == null ? void 0 : h.fieldPermissions,
2586
+ bare: (d = e.options) == null ? void 0 : d.bare,
2530
2587
  onFieldChange: l,
2531
- onActionTrigger: c
2588
+ onFieldActivate: c
2532
2589
  }, null, 8, ["schema", "data", "readonly", "field-permissions", "bare"]));
2533
2590
  };
2534
2591
  }
2535
2592
  });
2536
2593
  export {
2537
- ee as $,
2538
- Vn as A,
2539
- Cn as B,
2540
- Ln as C,
2541
- Nt as D,
2542
- zt as E,
2543
- Wn as F,
2544
- et as G,
2545
- Xn as H,
2546
- Zn as I,
2547
- Qn as J,
2548
- ei as K,
2549
- si as L,
2550
- ti as M,
2551
- li as N,
2594
+ sn as $,
2595
+ Zt as A,
2596
+ jn as B,
2597
+ Bn as C,
2598
+ It as D,
2599
+ Gn as E,
2600
+ jt as F,
2601
+ rt as G,
2602
+ Qn as H,
2603
+ ai as I,
2604
+ li as J,
2605
+ si as K,
2606
+ yi as L,
2607
+ ci as M,
2608
+ pi as N,
2552
2609
  ui as O,
2553
- ci as P,
2554
- ze as Q,
2555
- Cr as R,
2556
- Kr as S,
2557
- rn as T,
2558
- Oe as U,
2559
- mi as V,
2560
- Mr as W,
2561
- Ft as X,
2562
- Xr as Y,
2563
- Zr as Z,
2610
+ wi as P,
2611
+ bi as Q,
2612
+ Ue as R,
2613
+ Br as S,
2614
+ tn as T,
2615
+ fn as U,
2616
+ Ge as V,
2617
+ Ti as W,
2618
+ Lr as X,
2619
+ Ct as Y,
2620
+ ln as Z,
2564
2621
  Ie as _,
2565
- Hn as a,
2566
- Bn as a0,
2567
- hn as a1,
2568
- dt as a2,
2569
- ut as a3,
2570
- Ye as a4,
2571
- oi as a5,
2572
- Gn as a6,
2573
- Ue as a7,
2574
- ke as a8,
2575
- P as a9,
2576
- Kn as aA,
2577
- _e as aB,
2578
- vn as aC,
2579
- bn as aD,
2580
- En as aE,
2581
- wn as aF,
2582
- yn as aG,
2583
- $n as aH,
2584
- ai as aa,
2585
- ur as ab,
2586
- mn as ac,
2587
- dn as ad,
2588
- rt as ae,
2589
- fn as af,
2590
- Pe as ag,
2591
- Ne as ah,
2592
- jt as ai,
2593
- _n as aj,
2594
- Un as ak,
2595
- Dn as al,
2596
- Pn as am,
2597
- st as an,
2598
- mt as ao,
2599
- ii as ap,
2600
- Nr as aq,
2601
- zn as ar,
2602
- Zt as as,
2603
- lt as at,
2604
- Re as au,
2605
- ct as av,
2606
- Be as aw,
2607
- we as ax,
2608
- Rr as ay,
2609
- Jn as az,
2610
- se as b,
2611
- fi as c,
2612
- In as d,
2613
- Yn as e,
2614
- On as f,
2615
- Fn as g,
2616
- Sn as h,
2617
- un as i,
2618
- Tn as j,
2619
- jn as k,
2620
- Nn as l,
2621
- Rn as m,
2622
- An as n,
2623
- xn as o,
2624
- ni as p,
2625
- Mn as q,
2626
- sr as r,
2627
- ri as s,
2628
- di as t,
2629
- kn as u,
2630
- qn as v,
2631
- pn as w,
2632
- gn as x,
2633
- k as y,
2634
- Jt as z
2622
+ Un as a,
2623
+ ee as a0,
2624
+ Jn as a1,
2625
+ Sn as a2,
2626
+ ht as a3,
2627
+ mt as a4,
2628
+ Ze as a5,
2629
+ hi as a6,
2630
+ Xn as a7,
2631
+ Ke as a8,
2632
+ ke as a9,
2633
+ ii as aA,
2634
+ ti as aB,
2635
+ Oe as aC,
2636
+ Fn as aD,
2637
+ Nn as aE,
2638
+ kn as aF,
2639
+ Rn as aG,
2640
+ xn as aH,
2641
+ zn as aI,
2642
+ V as aa,
2643
+ gi as ab,
2644
+ br as ac,
2645
+ Tn as ad,
2646
+ vn as ae,
2647
+ it as af,
2648
+ En as ag,
2649
+ _e as ah,
2650
+ Ne as ai,
2651
+ Xt as aj,
2652
+ qn as ak,
2653
+ ei as al,
2654
+ Wn as am,
2655
+ Kn as an,
2656
+ ut as ao,
2657
+ pt as ap,
2658
+ mi as aq,
2659
+ Pr as ar,
2660
+ Zn as as,
2661
+ tr as at,
2662
+ ct as au,
2663
+ Re as av,
2664
+ ft as aw,
2665
+ ze as ax,
2666
+ we as ay,
2667
+ Hr as az,
2668
+ ie as b,
2669
+ Ei as c,
2670
+ mr as d,
2671
+ On as e,
2672
+ oi as f,
2673
+ Yn as g,
2674
+ Vn as h,
2675
+ bn as i,
2676
+ Cn as j,
2677
+ In as k,
2678
+ ni as l,
2679
+ Pn as m,
2680
+ Hn as n,
2681
+ Dn as o,
2682
+ fi as p,
2683
+ $n as q,
2684
+ yr as r,
2685
+ di as s,
2686
+ vi as t,
2687
+ _n as u,
2688
+ Ln as v,
2689
+ ri as w,
2690
+ An as x,
2691
+ Mn as y,
2692
+ L as z
2635
2693
  };