@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.
- package/dist/chunks/designer-ui.js +1383 -1302
- package/dist/chunks/renderer-core.js +1104 -1046
- package/dist/components/designer/FormDesigner.vue.d.ts.map +1 -1
- package/dist/components/designer/HelpPanel.vue.d.ts.map +1 -1
- package/dist/components/designer/InspectorPanel.vue.d.ts.map +1 -1
- package/dist/components/designer/PaletteSidebar.vue.d.ts.map +1 -1
- package/dist/components/designer/composables/useSchemaEdits.d.ts +5 -2
- package/dist/components/designer/composables/useSchemaEdits.d.ts.map +1 -1
- package/dist/components/designer/inspectors/FieldPInspector.vue.d.ts +9 -1
- package/dist/components/designer/inspectors/FieldPInspector.vue.d.ts.map +1 -1
- package/dist/components/designer/inspectors/ParamsFields.vue.d.ts +9 -0
- package/dist/components/designer/inspectors/ParamsFields.vue.d.ts.map +1 -0
- package/dist/components/designer/inspectors/TableInspector.vue.d.ts.map +1 -1
- package/dist/components/renderer-v2/FormRenderer.vue.d.ts +3 -3
- package/dist/components/renderer-v2/FormRenderer.vue.d.ts.map +1 -1
- package/dist/components/renderer-v2/GridFormRenderer.vue.d.ts +3 -3
- package/dist/components/renderer-v2/GridFormRenderer.vue.d.ts.map +1 -1
- package/dist/components/renderer-v2/GridSchemaNode.vue.d.ts +3 -3
- package/dist/components/renderer-v2/GridSchemaNode.vue.d.ts.map +1 -1
- package/dist/designer-ui.css +2 -2
- package/dist/index.js +24 -24
- package/dist/renderer-core.css +1 -1
- package/dist/renderer.js +25 -25
- package/dist/ticket-designer.css +2 -2
- package/dist/types/schema-v2-serialization.d.ts.map +1 -1
- package/dist/types/schema-v2.d.ts +36 -15
- package/dist/types/schema-v2.d.ts.map +1 -1
- package/dist/utils/date-format.d.ts +11 -5
- package/dist/utils/date-format.d.ts.map +1 -1
- package/dist/utils/node-params.d.ts +35 -0
- package/dist/utils/node-params.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as Te, ref as
|
|
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
|
|
7
|
-
import
|
|
8
|
-
import { VuePrintNext as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
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
|
|
13
|
+
const Ct = {
|
|
14
14
|
A4: { short: 210, long: 297 },
|
|
15
15
|
A3: { short: 297, long: 420 }
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const t = (e == null ? void 0 : e.size) === "A3" ? "A3" : "A4", n =
|
|
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
|
|
22
|
-
return
|
|
21
|
+
function it(e, t) {
|
|
22
|
+
return ie(e).get(t);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function vn(e, t) {
|
|
25
25
|
var n;
|
|
26
|
-
return (n =
|
|
26
|
+
return (n = it(e, t)) == null ? void 0 : n.node;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function En(e, t) {
|
|
29
29
|
var n;
|
|
30
|
-
return (n =
|
|
30
|
+
return (n = it(e, t)) == null ? void 0 : n.ownerCell;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const n =
|
|
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
|
|
50
|
-
Ee(e, t, n, r, i), t.type === "grid" ? t.rows.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,
|
|
53
|
+
(c, u) => We(e, c, o, [...l, "children", u], o)
|
|
54
54
|
);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
function
|
|
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) =>
|
|
61
|
+
(l, c) => We(e, l, i, [...a, "children", c], i)
|
|
62
62
|
);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
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) =>
|
|
70
|
+
(o, a) => We(t, o, n, [...i, "children", a])
|
|
71
71
|
);
|
|
72
72
|
}), t;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
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
|
|
77
|
+
function ne(e) {
|
|
78
78
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return e === "auto" ? !0 : typeof e == "number" ?
|
|
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
|
|
84
|
-
function
|
|
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
|
|
87
|
+
function lt(e, t) {
|
|
88
88
|
let n = 0;
|
|
89
|
-
for (const r of e) n +=
|
|
90
|
-
return n * t *
|
|
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
|
|
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) ??
|
|
98
|
+
const i = ((c = e.style) == null ? void 0 : c.fontSize) ?? at;
|
|
99
99
|
let o;
|
|
100
|
-
if ((e.prefix || e.suffix) && (o =
|
|
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 &&
|
|
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
|
|
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
|
|
115
|
-
const { heightMm: n } =
|
|
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
|
|
118
|
+
function Ot(e, t, n, r) {
|
|
119
119
|
const i = t.children.reduce(
|
|
120
|
-
(a, l) => a +
|
|
120
|
+
(a, l) => a + Vt(l, e.baseRowHeight),
|
|
121
121
|
0
|
|
122
|
-
), o =
|
|
123
|
-
i > o &&
|
|
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
|
|
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" &&
|
|
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
|
|
144
|
+
function Bt(e, t, n) {
|
|
145
145
|
if (!Array.isArray(e.rows) || e.rows.length === 0) {
|
|
146
|
-
|
|
146
|
+
I(n, "error", "INVALID_GRID_ROWS", e, t, "格子至少需要一行");
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
e.rows.forEach((r, i) =>
|
|
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
|
|
152
|
-
if (
|
|
153
|
-
|
|
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
|
-
|
|
158
|
+
Wt(o, [...n, "cells", a], r);
|
|
159
159
|
const l = o.colspan ?? 1;
|
|
160
|
-
(!Number.isInteger(l) || l < 1) &&
|
|
161
|
-
}), t.rows.some((o) => o.cells.length > 0) && i < 1 &&
|
|
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
|
|
164
|
-
e.width !== void 0 && !
|
|
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
|
|
166
|
+
function Ut(e, t, n) {
|
|
167
167
|
if (!Array.isArray(e.columns) || e.columns.length === 0) {
|
|
168
|
-
|
|
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)) &&
|
|
175
|
-
}), (!Number.isInteger(e.minRows) || e.minRows < 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)) &&
|
|
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) ||
|
|
182
|
+
i.has(o) || I(n, "warning", "MISSING_TABLE_TEMPLATE", e, t, `列「${o}」缺少行模板`);
|
|
183
183
|
}
|
|
184
|
-
function
|
|
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
|
-
|
|
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
|
|
200
|
-
|
|
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(
|
|
206
|
+
`文本估算宽度约 ${be(m)}mm,超过格子可用宽度 ${be(g)}mm,可能显示不全`
|
|
207
207
|
);
|
|
208
208
|
}
|
|
209
|
-
e.text.trim() ||
|
|
210
|
-
} else e.type === "p" ? (
|
|
211
|
-
let
|
|
212
|
-
|
|
213
|
-
const M =
|
|
214
|
-
|
|
215
|
-
(
|
|
216
|
-
),
|
|
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" ? (
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
(
|
|
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 &&
|
|
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
|
|
225
|
+
function Ue(e) {
|
|
226
226
|
const t = [];
|
|
227
|
-
e.version !== 2 &&
|
|
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) &&
|
|
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 ||
|
|
234
|
-
(c,
|
|
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
|
-
|
|
238
|
+
ie(e);
|
|
239
239
|
} catch (o) {
|
|
240
|
-
|
|
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
|
|
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) =>
|
|
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
|
|
283
|
+
function jt(e) {
|
|
284
284
|
return me(e);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
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) =>
|
|
290
|
+
rows: r.rows.map((i) => Kt(i, t, n))
|
|
291
291
|
} : r.type === "table" ? {
|
|
292
292
|
...r,
|
|
293
|
-
rowTemplate: r.rowTemplate.map((i) =>
|
|
293
|
+
rowTemplate: r.rowTemplate.map((i) => Yt(i, t, n))
|
|
294
294
|
} : r;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
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) =>
|
|
300
|
+
cells: r.cells.map((i) => qt(i, t, n))
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
function
|
|
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) =>
|
|
307
|
+
children: r.children.map((i) => je(i, t, n))
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
|
-
function
|
|
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) =>
|
|
314
|
+
children: r.children.map((i) => je(i, t, n))
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
function
|
|
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) =>
|
|
321
|
+
children: r.children.map((i) => je(i, t, n))
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function L(e, t, n) {
|
|
325
325
|
return {
|
|
326
326
|
...e,
|
|
327
|
-
pages: e.pages.map((r) =>
|
|
327
|
+
pages: e.pages.map((r) => Jt(r, t, n))
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
function
|
|
331
|
-
return
|
|
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
|
|
338
|
-
return
|
|
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
|
|
341
|
-
return
|
|
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
|
|
348
|
-
return
|
|
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
|
|
355
|
-
return
|
|
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
|
|
362
|
-
return
|
|
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
|
|
368
|
+
function Nn(e, t, n) {
|
|
369
369
|
const r = Number.isFinite(n) && n > 0 ? n : 0;
|
|
370
|
-
return
|
|
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
|
|
377
|
-
return
|
|
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
|
|
384
|
-
return
|
|
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
|
|
391
|
-
return
|
|
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
|
|
397
|
+
function Cn(e, t, n) {
|
|
398
398
|
const r = typeof n == "number" && Number.isFinite(n) && n > 0 ? n : void 0;
|
|
399
|
-
return
|
|
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
|
|
410
|
-
return
|
|
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
|
|
417
|
-
return
|
|
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((
|
|
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:
|
|
429
|
+
id: V(`${r.id}-${a}`),
|
|
430
430
|
type: "table-cell-template",
|
|
431
431
|
columnKey: a,
|
|
432
432
|
children: [
|
|
433
433
|
{
|
|
434
|
-
id:
|
|
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
|
|
452
|
-
return
|
|
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
|
|
458
|
+
function Hn(e, t, n, r) {
|
|
459
459
|
const i = r.trim();
|
|
460
|
-
return !i || i === n ? e :
|
|
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
|
|
471
|
-
return
|
|
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
|
|
478
|
+
function Vn(e, t) {
|
|
479
479
|
return { ...e, baseRowHeight: Math.max(1, Math.min(99, Math.floor(t))) };
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function _n(e, t) {
|
|
482
482
|
return { ...e, paper: t };
|
|
483
483
|
}
|
|
484
|
-
function
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
515
|
-
return
|
|
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
|
|
521
|
+
function Gn(e, t, n) {
|
|
522
522
|
var l, c;
|
|
523
|
-
const r =
|
|
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
|
|
527
|
-
if (
|
|
528
|
-
const
|
|
529
|
-
if (
|
|
530
|
-
const
|
|
531
|
-
...
|
|
532
|
-
colspan: (
|
|
533
|
-
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
|
-
...
|
|
537
|
-
cells:
|
|
538
|
-
(
|
|
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
|
|
544
|
-
const r =
|
|
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 :
|
|
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((
|
|
551
|
+
const l = a.cells.findIndex((v) => v.id === t);
|
|
552
552
|
if (l < 0) return a;
|
|
553
|
-
const c = a.cells[l], { colspan:
|
|
554
|
-
id:
|
|
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
|
-
|
|
563
|
-
...
|
|
562
|
+
m,
|
|
563
|
+
...g,
|
|
564
564
|
...a.cells.slice(l + 1)
|
|
565
565
|
]
|
|
566
566
|
};
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
return
|
|
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 =
|
|
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
|
|
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
|
|
603
|
-
var
|
|
604
|
-
const r =
|
|
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" || ((
|
|
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 = ((
|
|
609
|
+
a = ((m = r.get(a.id)) == null ? void 0 : m.parent) ?? null;
|
|
610
610
|
}
|
|
611
|
-
const { schema: l, node: c } =
|
|
612
|
-
return c ?
|
|
611
|
+
const { schema: l, node: c } = st(e, t);
|
|
612
|
+
return c ? Zt(l, n, c) : e;
|
|
613
613
|
}
|
|
614
|
-
const
|
|
615
|
-
function
|
|
616
|
-
var
|
|
617
|
-
const i =
|
|
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 = ((
|
|
622
|
+
l = ((b = i.get(l.id)) == null ? void 0 : b.parent) ?? null;
|
|
623
623
|
}
|
|
624
|
-
const c = o.parent,
|
|
625
|
-
if (
|
|
626
|
-
const { schema:
|
|
627
|
-
if (!
|
|
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
|
|
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
|
|
632
|
-
return { ...f, children: [...f.children.slice(0,
|
|
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
|
|
635
|
+
function Kn(e, t, n) {
|
|
636
636
|
var c;
|
|
637
|
-
const i = (c =
|
|
637
|
+
const i = (c = ie(e).get(t)) == null ? void 0 : c.parent;
|
|
638
638
|
if (!i) return e;
|
|
639
|
-
const o = (
|
|
640
|
-
const
|
|
641
|
-
if (
|
|
642
|
-
const
|
|
643
|
-
if (
|
|
644
|
-
const
|
|
645
|
-
if (!
|
|
646
|
-
const M = [...
|
|
647
|
-
return 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 =
|
|
651
|
-
const
|
|
652
|
-
if (!
|
|
653
|
-
const
|
|
654
|
-
return
|
|
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
|
|
659
|
-
var c,
|
|
660
|
-
const n =
|
|
661
|
-
var
|
|
662
|
-
let
|
|
663
|
-
for (;
|
|
664
|
-
if (
|
|
665
|
-
|
|
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 = (
|
|
669
|
-
|
|
670
|
-
if (
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
M.cells.forEach((f,
|
|
674
|
-
const
|
|
675
|
-
o(f.id) && a.push({ id: f.id, label:
|
|
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
|
|
679
|
-
if (!o(
|
|
680
|
-
const M =
|
|
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:
|
|
683
|
-
label: `${
|
|
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((
|
|
688
|
+
return e.pages.forEach((m) => l(m.children, "")), a;
|
|
689
689
|
}
|
|
690
|
-
function
|
|
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
|
|
699
|
-
return
|
|
698
|
+
function Jn(e, t, n) {
|
|
699
|
+
return Xt(e, t, n);
|
|
700
700
|
}
|
|
701
|
-
function
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
801
|
+
function ti(e, t, n) {
|
|
802
802
|
const r = Math.max(1, Math.floor(n));
|
|
803
|
-
return
|
|
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:
|
|
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
|
|
814
|
+
function Qt(e = "1fr") {
|
|
815
815
|
return {
|
|
816
|
-
id:
|
|
816
|
+
id: V("cell"),
|
|
817
817
|
type: "grid-cell",
|
|
818
818
|
width: e,
|
|
819
819
|
children: []
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function ct(e, t) {
|
|
823
823
|
const n = e.cells.slice(0, t);
|
|
824
|
-
for (; n.length < t; ) n.push(
|
|
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
|
|
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
|
|
837
|
-
var
|
|
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((
|
|
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
|
|
844
|
-
|
|
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, ...
|
|
846
|
+
children: [...M.children, ...v]
|
|
847
847
|
};
|
|
848
848
|
}
|
|
849
|
-
const
|
|
850
|
-
return { ...a, rows: l, columns:
|
|
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
|
|
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
|
|
863
|
-
return
|
|
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 ??
|
|
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,
|
|
872
|
+
(c, u) => u === n ? { ...c, width: r } : c
|
|
873
873
|
)
|
|
874
874
|
}))
|
|
875
875
|
};
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
|
-
function
|
|
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
|
|
881
|
-
var
|
|
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 && ((
|
|
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
|
|
886
|
-
for (;
|
|
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
|
|
889
|
-
M.cells[M.cells.length - 1] = { ...
|
|
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:
|
|
893
|
+
children: [{ ...l, rows: g }]
|
|
894
894
|
};
|
|
895
895
|
}
|
|
896
|
-
const c =
|
|
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
|
|
901
|
-
return
|
|
900
|
+
function ii(e, t, n) {
|
|
901
|
+
return tr(e, t, n, 1);
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function oi(e = ke(), t = "all") {
|
|
904
904
|
return "type" in e ? {
|
|
905
|
-
id:
|
|
905
|
+
id: V("grid"),
|
|
906
906
|
type: "grid",
|
|
907
907
|
border: t,
|
|
908
908
|
rows: [e]
|
|
909
|
-
} :
|
|
909
|
+
} : Ke(e);
|
|
910
910
|
}
|
|
911
|
-
function
|
|
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:
|
|
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
|
|
928
|
-
return { id:
|
|
927
|
+
function ai(e = "固定文本") {
|
|
928
|
+
return { id: V("text"), type: "text", text: e };
|
|
929
929
|
}
|
|
930
|
-
function
|
|
931
|
-
return { id:
|
|
930
|
+
function li(e = "字段") {
|
|
931
|
+
return { id: V("p-field"), type: "p", mode: "field", field: e, underline: !0 };
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
const e =
|
|
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:
|
|
944
|
+
id: V(`${e}-${n.key}`),
|
|
945
945
|
type: "table-cell-template",
|
|
946
946
|
columnKey: n.key,
|
|
947
947
|
children: [{
|
|
948
|
-
id:
|
|
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
|
|
960
|
+
function ci(e = "") {
|
|
961
961
|
return {
|
|
962
|
-
id:
|
|
962
|
+
id: V("html"),
|
|
963
963
|
type: "html",
|
|
964
964
|
html: e
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function ui() {
|
|
968
968
|
return {
|
|
969
|
-
id:
|
|
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
|
-
|
|
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
|
-
|
|
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) =>
|
|
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) =>
|
|
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
|
|
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) =>
|
|
1039
|
+
cells: Array.isArray(t.cells) ? t.cells.map((n) => ar(n)) : []
|
|
1021
1040
|
};
|
|
1022
1041
|
}
|
|
1023
|
-
function
|
|
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(
|
|
1046
|
+
children: Array.isArray(t.children) ? t.children.map(qe) : []
|
|
1028
1047
|
};
|
|
1029
1048
|
}
|
|
1030
|
-
function
|
|
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(
|
|
1053
|
+
children: Array.isArray(t.children) ? t.children.map(qe) : []
|
|
1035
1054
|
};
|
|
1036
1055
|
}
|
|
1037
|
-
function
|
|
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(
|
|
1090
|
+
children: Array.isArray(a.children) ? a.children.map(qe) : []
|
|
1072
1091
|
};
|
|
1073
1092
|
})
|
|
1074
1093
|
};
|
|
1075
1094
|
}
|
|
1076
|
-
function
|
|
1077
|
-
const r =
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
1146
|
+
const r = Ue(n);
|
|
1128
1147
|
return { schema: n, issues: r, ok: !0 };
|
|
1129
1148
|
}
|
|
1130
|
-
function
|
|
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
|
-
|
|
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
|
-
|
|
1158
|
+
Ze(r, t);
|
|
1140
1159
|
return t;
|
|
1141
1160
|
}
|
|
1142
|
-
const
|
|
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(
|
|
1172
|
+
function o(b) {
|
|
1154
1173
|
var f;
|
|
1155
|
-
return ((f = n.fieldPermissions) == null ? void 0 : f[
|
|
1174
|
+
return ((f = n.fieldPermissions) == null ? void 0 : f[b]) ?? "EDIT";
|
|
1156
1175
|
}
|
|
1157
|
-
const a =
|
|
1158
|
-
function l(
|
|
1159
|
-
return
|
|
1176
|
+
const a = J(null);
|
|
1177
|
+
function l(b) {
|
|
1178
|
+
return b ? b.replace(/@import[^;]+;?/gi, "").replace(/<\/style>/gi, "") : "";
|
|
1160
1179
|
}
|
|
1161
|
-
function c(
|
|
1162
|
-
return
|
|
1180
|
+
function c(b) {
|
|
1181
|
+
return b.replace(
|
|
1163
1182
|
/\{\{\s*([\p{L}\p{N}_.$-]+)\s*\}\}/gu,
|
|
1164
|
-
(f,
|
|
1165
|
-
const
|
|
1166
|
-
return
|
|
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
|
|
1171
|
-
const
|
|
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>${
|
|
1178
|
-
}
|
|
1179
|
-
function
|
|
1180
|
-
|
|
1181
|
-
const
|
|
1182
|
-
if (!
|
|
1183
|
-
const
|
|
1184
|
-
if (
|
|
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
|
|
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",
|
|
1211
|
+
f.setAttribute("contenteditable", y ? "true" : "false");
|
|
1193
1212
|
});
|
|
1194
1213
|
}
|
|
1195
|
-
function
|
|
1214
|
+
function g() {
|
|
1196
1215
|
var f;
|
|
1197
|
-
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1216
|
+
w();
|
|
1217
|
+
const b = (f = a.value) == null ? void 0 : f.shadowRoot;
|
|
1218
|
+
b && m(b);
|
|
1200
1219
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const
|
|
1203
|
-
|
|
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
|
|
1224
|
+
function w() {
|
|
1206
1225
|
var f;
|
|
1207
|
-
const
|
|
1208
|
-
!
|
|
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
|
|
1211
|
-
if (!
|
|
1212
|
-
const
|
|
1213
|
-
|
|
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
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
const
|
|
1222
|
-
|
|
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
|
-
}),
|
|
1225
|
-
|
|
1226
|
-
const
|
|
1227
|
-
|
|
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(
|
|
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,
|
|
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
|
-
},
|
|
1244
|
-
|
|
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
|
|
1253
|
-
function
|
|
1300
|
+
const hr = 0, gr = "center", pr = "middle";
|
|
1301
|
+
function yr(e, t) {
|
|
1254
1302
|
return {
|
|
1255
|
-
padding: e.padding ?? t.cellPadding ??
|
|
1256
|
-
align: e.align ?? t.cellAlign ??
|
|
1257
|
-
verticalAlign: e.verticalAlign ?? t.cellVerticalAlign ??
|
|
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
|
|
1308
|
+
function mt(e, t) {
|
|
1261
1309
|
return `${e}_${t}`;
|
|
1262
1310
|
}
|
|
1263
|
-
function
|
|
1264
|
-
const r =
|
|
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) =>
|
|
1319
|
+
children: a.children.map((l) => ht(l, t, n))
|
|
1272
1320
|
}))
|
|
1273
1321
|
}))
|
|
1274
1322
|
} : i;
|
|
1275
1323
|
}
|
|
1276
|
-
function
|
|
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 =
|
|
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
|
|
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:
|
|
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((
|
|
1357
|
+
const c = i.rowTemplate.find((u) => u.columnKey === l.key);
|
|
1310
1358
|
if (c)
|
|
1311
|
-
for (let
|
|
1312
|
-
for (const
|
|
1313
|
-
r(
|
|
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
|
|
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
|
|
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
|
-
},
|
|
1384
|
+
}, xr = ["contenteditable", "data-field"], Rr = {
|
|
1337
1385
|
key: 3,
|
|
1338
1386
|
class: "layout-p__value"
|
|
1339
|
-
},
|
|
1387
|
+
}, Nr = {
|
|
1340
1388
|
key: 4,
|
|
1341
1389
|
class: "layout-p__label"
|
|
1342
|
-
},
|
|
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", "
|
|
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,
|
|
1361
|
-
const N = s[
|
|
1408
|
+
function o(s, S) {
|
|
1409
|
+
const N = s[S];
|
|
1362
1410
|
if (!i(N)) return;
|
|
1363
|
-
const B = s[
|
|
1411
|
+
const B = s[S - 1];
|
|
1364
1412
|
return { left: !!B && i(B) };
|
|
1365
1413
|
}
|
|
1366
|
-
const a =
|
|
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
|
-
),
|
|
1369
|
-
function
|
|
1370
|
-
const
|
|
1371
|
-
return
|
|
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
|
|
1374
|
-
const N = s.rows[
|
|
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(
|
|
1424
|
+
gridTemplateColumns: B.map(u).join(" "),
|
|
1377
1425
|
minHeight: `${N.height * r.baseRowHeight}mm`,
|
|
1378
1426
|
// 列间距:gap 同时作用于行列。
|
|
1379
|
-
columnGap:
|
|
1427
|
+
columnGap: re > 0 ? `${re}mm` : void 0
|
|
1380
1428
|
};
|
|
1381
1429
|
}
|
|
1382
|
-
function
|
|
1383
|
-
const N =
|
|
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:
|
|
1437
|
+
justifyContent: re
|
|
1390
1438
|
};
|
|
1391
|
-
return s.flex ? { ...
|
|
1439
|
+
return s.flex ? { ...de, flexWrap: "wrap" } : de;
|
|
1392
1440
|
}
|
|
1393
|
-
function
|
|
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
|
-
...
|
|
1457
|
+
...w(s.style),
|
|
1410
1458
|
whiteSpace: "pre-wrap",
|
|
1411
|
-
width:
|
|
1459
|
+
width: C(s) ? void 0 : s.width
|
|
1412
1460
|
};
|
|
1413
1461
|
}
|
|
1414
|
-
function
|
|
1415
|
-
return !
|
|
1462
|
+
function b(s) {
|
|
1463
|
+
return !C(s) || !s.width ? {} : { width: s.width, flexGrow: 0 };
|
|
1416
1464
|
}
|
|
1417
1465
|
function f(s) {
|
|
1418
|
-
return
|
|
1466
|
+
return w(s.style);
|
|
1419
1467
|
}
|
|
1420
|
-
function
|
|
1468
|
+
function h(s) {
|
|
1421
1469
|
return {
|
|
1422
|
-
gridTemplateColumns: s.map((
|
|
1470
|
+
gridTemplateColumns: s.map((S) => u(S.width)).join(" ")
|
|
1423
1471
|
};
|
|
1424
1472
|
}
|
|
1425
|
-
function
|
|
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
|
|
1431
|
-
const N = (
|
|
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:
|
|
1435
|
-
fontWeight: (
|
|
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
|
|
1439
|
-
return s.rowTemplate.find((N) => N.columnKey ===
|
|
1486
|
+
function p(s, S) {
|
|
1487
|
+
return s.rowTemplate.find((N) => N.columnKey === S);
|
|
1440
1488
|
}
|
|
1441
|
-
function E(s,
|
|
1442
|
-
const N = we(s,
|
|
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
|
|
1446
|
-
return
|
|
1493
|
+
function F(s, S, N) {
|
|
1494
|
+
return ht(s, S, N);
|
|
1447
1495
|
}
|
|
1448
|
-
function
|
|
1496
|
+
function C(s) {
|
|
1449
1497
|
return s.mode === "field" && !!(s.prefix || s.suffix);
|
|
1450
1498
|
}
|
|
1451
|
-
const
|
|
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
|
|
1456
|
-
|
|
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
|
-
|
|
1460
|
-
actionParams: s.actionParams
|
|
1510
|
+
params: s.params
|
|
1461
1511
|
}));
|
|
1462
1512
|
}
|
|
1463
|
-
const
|
|
1464
|
-
function
|
|
1465
|
-
return
|
|
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
|
|
1471
|
-
return
|
|
1517
|
+
function k(s) {
|
|
1518
|
+
return A.value ? [Qe] : z(s);
|
|
1472
1519
|
}
|
|
1473
1520
|
function te(s) {
|
|
1474
|
-
|
|
1475
|
-
|
|
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
|
|
1478
|
-
!c.value || !s || n("field-change", s,
|
|
1527
|
+
function oe(s, S) {
|
|
1528
|
+
!c.value || !s || n("field-change", s, X(S.target));
|
|
1479
1529
|
}
|
|
1480
|
-
const
|
|
1530
|
+
const ae = J(null);
|
|
1481
1531
|
function pe() {
|
|
1482
|
-
var
|
|
1532
|
+
var S;
|
|
1483
1533
|
if (r.node.type !== "p") return;
|
|
1484
|
-
const s =
|
|
1485
|
-
if (!(!s || !c.value) && s !== (((
|
|
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
|
|
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" ?
|
|
1544
|
+
() => r.node.type === "p" ? $(r.node) : "",
|
|
1495
1545
|
pe
|
|
1496
1546
|
), Fe(pe);
|
|
1497
|
-
function
|
|
1498
|
-
const
|
|
1499
|
-
if (
|
|
1500
|
-
const N =
|
|
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
|
|
1504
|
-
return
|
|
1553
|
+
function z(s) {
|
|
1554
|
+
return $(s).split(`
|
|
1505
1555
|
`);
|
|
1506
1556
|
}
|
|
1507
|
-
const
|
|
1508
|
-
() => r.node.type === "image" ?
|
|
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
|
-
),
|
|
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
|
-
|
|
1570
|
+
Z.value = !1;
|
|
1521
1571
|
},
|
|
1522
1572
|
{ deep: !0 }
|
|
1523
1573
|
);
|
|
1524
|
-
function
|
|
1525
|
-
|
|
1574
|
+
function Ce() {
|
|
1575
|
+
Z.value = !0;
|
|
1526
1576
|
}
|
|
1527
|
-
return (s,
|
|
1528
|
-
var B,
|
|
1529
|
-
const N =
|
|
1530
|
-
return e.node.type === "grid" ? (
|
|
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:
|
|
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": (
|
|
1537
|
-
"layout-grid--no-bottom": (
|
|
1538
|
-
"layout-grid--no-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:
|
|
1590
|
+
]],
|
|
1591
|
+
style: m(e.node),
|
|
1542
1592
|
"data-node-id": e.node.id
|
|
1543
|
-
}, [
|
|
1544
|
-
(
|
|
1545
|
-
key:
|
|
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:
|
|
1548
|
-
"data-layout-id":
|
|
1597
|
+
style: ce(g(e.node, W)),
|
|
1598
|
+
"data-layout-id": H.id
|
|
1549
1599
|
}, [
|
|
1550
|
-
(
|
|
1551
|
-
key:
|
|
1552
|
-
class:
|
|
1553
|
-
style:
|
|
1554
|
-
"data-layout-id":
|
|
1555
|
-
"data-node-id":
|
|
1556
|
-
}, [
|
|
1557
|
-
(
|
|
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(
|
|
1566
|
-
onFieldChange:
|
|
1567
|
-
|
|
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
|
-
],
|
|
1570
|
-
], 12,
|
|
1571
|
-
],
|
|
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:
|
|
1574
|
-
style:
|
|
1623
|
+
class: ["layout-text", {}],
|
|
1624
|
+
style: f(e.node),
|
|
1575
1625
|
"data-node-id": e.node.id
|
|
1576
|
-
}, G(e.node.text),
|
|
1626
|
+
}, D(e.node)), G(e.node.text), 17, Sr)) : e.node.type === "p" ? (x(), R("div", se({
|
|
1577
1627
|
key: 2,
|
|
1578
|
-
class:
|
|
1628
|
+
class: ["layout-p", {
|
|
1579
1629
|
"layout-p--field": !0,
|
|
1580
|
-
"layout-p--composite":
|
|
1581
|
-
"layout-p--underline": e.node.underline && !
|
|
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":
|
|
1584
|
-
}]
|
|
1585
|
-
style:
|
|
1586
|
-
contenteditable:
|
|
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
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
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:
|
|
1596
|
-
style:
|
|
1597
|
-
contenteditable:
|
|
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:
|
|
1650
|
+
onBlur: S[2] || (S[2] = (H) => oe(e.node.field, H))
|
|
1600
1651
|
}, [
|
|
1601
|
-
e.node.innerBorder ? (
|
|
1602
|
-
key:
|
|
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(
|
|
1605
|
-
|
|
1655
|
+
}, G(H), 1))), 128)) : (x(), R(j, { key: 1 }, [
|
|
1656
|
+
Tt(G(_(e.node)), 1)
|
|
1606
1657
|
], 64))
|
|
1607
|
-
], 46,
|
|
1658
|
+
], 46, xr)) : e.node.innerBorder ? (x(), R("span", {
|
|
1608
1659
|
key: 2,
|
|
1609
1660
|
ref_key: "innerLinesEl",
|
|
1610
|
-
ref:
|
|
1661
|
+
ref: ae,
|
|
1611
1662
|
class: "layout-p__lines"
|
|
1612
1663
|
}, [
|
|
1613
|
-
(
|
|
1614
|
-
key:
|
|
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(
|
|
1617
|
-
], 512)) : (
|
|
1618
|
-
e.node.suffix ? (
|
|
1619
|
-
],
|
|
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:
|
|
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:
|
|
1628
|
-
|
|
1678
|
+
style: ce([
|
|
1679
|
+
h(e.node.columns),
|
|
1629
1680
|
{ minHeight: `${e.baseRowHeight}mm` }
|
|
1630
1681
|
])
|
|
1631
1682
|
}, [
|
|
1632
|
-
(
|
|
1633
|
-
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:
|
|
1636
|
-
}, G(
|
|
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
|
-
(
|
|
1641
|
-
key:
|
|
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:
|
|
1644
|
-
|
|
1694
|
+
style: ce([
|
|
1695
|
+
h(e.node.columns),
|
|
1645
1696
|
{ minHeight: `${e.baseRowHeight}mm` }
|
|
1646
1697
|
])
|
|
1647
1698
|
}, [
|
|
1648
|
-
(
|
|
1649
|
-
var
|
|
1650
|
-
return
|
|
1651
|
-
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:
|
|
1654
|
-
"data-layout-id": (
|
|
1704
|
+
style: ce(d(W)),
|
|
1705
|
+
"data-layout-id": (q = p(e.node, W.key)) == null ? void 0 : q.id
|
|
1655
1706
|
}, [
|
|
1656
|
-
(
|
|
1657
|
-
key: `${
|
|
1658
|
-
node:
|
|
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
|
-
|
|
1666
|
-
}, null, 8, ["node", "base-row-height", "mode", "data", "readonly", "field-permissions", "onFieldChange", "
|
|
1667
|
-
], 12,
|
|
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
|
-
],
|
|
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
|
-
|
|
1678
|
-
|
|
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:
|
|
1732
|
+
class: ["layout-image", { "layout-image--blank": Q.value }],
|
|
1681
1733
|
"data-node-id": e.node.id,
|
|
1682
|
-
"data-field": e.node.field
|
|
1683
|
-
|
|
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:
|
|
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:
|
|
1691
|
-
}, null,
|
|
1742
|
+
},
|
|
1743
|
+
onError: Ce
|
|
1744
|
+
}), null, 16, Ir));
|
|
1692
1745
|
};
|
|
1693
1746
|
}
|
|
1694
|
-
}),
|
|
1695
|
-
let
|
|
1696
|
-
const
|
|
1697
|
-
function
|
|
1698
|
-
return typeof document > "u" ? null : (
|
|
1699
|
-
}
|
|
1700
|
-
function
|
|
1701
|
-
const n =
|
|
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
|
|
1757
|
+
function Pr() {
|
|
1705
1758
|
const e = {};
|
|
1706
|
-
return
|
|
1707
|
-
|
|
1759
|
+
return $e.add(e), () => {
|
|
1760
|
+
$e.delete(e), $e.size === 0 && K && (K.remove(), K = null);
|
|
1708
1761
|
};
|
|
1709
1762
|
}
|
|
1710
|
-
function
|
|
1711
|
-
return (
|
|
1763
|
+
function gi() {
|
|
1764
|
+
return (K == null ? void 0 : K.textContent) ?? "";
|
|
1712
1765
|
}
|
|
1713
|
-
const
|
|
1714
|
-
function
|
|
1715
|
-
return e.offsetHeight /
|
|
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
|
|
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
|
|
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,
|
|
1736
|
-
|
|
1737
|
-
}),
|
|
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
|
|
1740
|
-
var c,
|
|
1741
|
-
const n = ((c = e.style) == null ? void 0 : c.fontSize) ?? 13, r = ((
|
|
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
|
|
1796
|
+
for (const m of e.text.split(`
|
|
1744
1797
|
`))
|
|
1745
|
-
l += Math.max(1, Math.ceil(
|
|
1798
|
+
l += Math.max(1, Math.ceil(m.length / a));
|
|
1746
1799
|
return l * i;
|
|
1747
1800
|
}
|
|
1748
|
-
function
|
|
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
|
|
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
|
|
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
|
|
1816
|
+
return _e(t.baseRowHeight, e, e.rows, !1, !1, t.measureRow);
|
|
1764
1817
|
case "image":
|
|
1765
|
-
return
|
|
1818
|
+
return ft(e, { data: t.data }) === null ? 0 : Gr(e, t.baseRowHeight);
|
|
1766
1819
|
case "text":
|
|
1767
|
-
return
|
|
1820
|
+
return Or(e, t.contentWidthMm);
|
|
1768
1821
|
case "table":
|
|
1769
|
-
return
|
|
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
|
|
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,
|
|
1792
|
-
o.push(f), a +=
|
|
1793
|
-
},
|
|
1794
|
-
const
|
|
1795
|
-
c(
|
|
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})高度约 ${
|
|
1798
|
-
})),
|
|
1799
|
-
},
|
|
1800
|
-
const
|
|
1801
|
-
let
|
|
1802
|
-
for (const
|
|
1803
|
-
for (const
|
|
1804
|
-
for (const E of
|
|
1805
|
-
if (E.type === "table" &&
|
|
1806
|
-
|
|
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 (
|
|
1862
|
+
if (d) break;
|
|
1810
1863
|
}
|
|
1811
|
-
if (
|
|
1864
|
+
if (d) break;
|
|
1812
1865
|
}
|
|
1813
|
-
if (c(
|
|
1814
|
-
|
|
1866
|
+
if (c(h) && !d) {
|
|
1867
|
+
u({ node: f });
|
|
1815
1868
|
return;
|
|
1816
1869
|
}
|
|
1817
|
-
|
|
1818
|
-
},
|
|
1819
|
-
const
|
|
1820
|
-
if (c(
|
|
1821
|
-
|
|
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
|
|
1825
|
-
for (;
|
|
1826
|
-
const
|
|
1827
|
-
let
|
|
1828
|
-
if (
|
|
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
|
-
|
|
1833
|
-
const te =
|
|
1885
|
+
k = Math.min(k, C);
|
|
1886
|
+
const te = P + k >= h, X = {
|
|
1834
1887
|
...f,
|
|
1835
|
-
_paginateMaxRows:
|
|
1888
|
+
_paginateMaxRows: k
|
|
1836
1889
|
};
|
|
1837
|
-
|
|
1838
|
-
node:
|
|
1890
|
+
u({
|
|
1891
|
+
node: X,
|
|
1839
1892
|
suppressBorders: {
|
|
1840
|
-
top: !
|
|
1893
|
+
top: !D,
|
|
1841
1894
|
// 后续片段抑制上外框(连续外观)
|
|
1842
1895
|
bottom: !te
|
|
1843
1896
|
// 非末片段抑制下外框
|
|
1844
1897
|
}
|
|
1845
|
-
}),
|
|
1898
|
+
}), C -= k, P += k, D = !1, C > 0 && l();
|
|
1846
1899
|
}
|
|
1847
1900
|
};
|
|
1848
|
-
function
|
|
1849
|
-
const
|
|
1850
|
-
for (const
|
|
1851
|
-
for (const
|
|
1852
|
-
|
|
1853
|
-
return
|
|
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,
|
|
1856
|
-
return f.map((
|
|
1857
|
-
if (
|
|
1908
|
+
function M(f, h) {
|
|
1909
|
+
return f.map((d) => {
|
|
1910
|
+
if (d.type === "grid")
|
|
1858
1911
|
return {
|
|
1859
|
-
...
|
|
1860
|
-
rows:
|
|
1861
|
-
...
|
|
1862
|
-
cells:
|
|
1863
|
-
...
|
|
1864
|
-
children: M(
|
|
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 (
|
|
1869
|
-
const
|
|
1870
|
-
if (typeof
|
|
1871
|
-
return { ...
|
|
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
|
|
1926
|
+
return d;
|
|
1874
1927
|
});
|
|
1875
1928
|
}
|
|
1876
|
-
const
|
|
1877
|
-
const
|
|
1878
|
-
let E = 0,
|
|
1879
|
-
for (; E <
|
|
1880
|
-
const
|
|
1881
|
-
let
|
|
1882
|
-
const
|
|
1883
|
-
let
|
|
1884
|
-
for (const
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
if (
|
|
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
|
|
1890
|
-
for (const
|
|
1891
|
-
|
|
1892
|
-
let
|
|
1893
|
-
for (;
|
|
1894
|
-
const
|
|
1895
|
-
let
|
|
1896
|
-
|
|
1897
|
-
const
|
|
1898
|
-
...
|
|
1899
|
-
children: M(
|
|
1900
|
-
const
|
|
1901
|
-
return Math.round(
|
|
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
|
-
|
|
1905
|
-
node: { ...f, rows: [{ ...
|
|
1906
|
-
suppressBorders: { top: !
|
|
1907
|
-
}),
|
|
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
|
-
|
|
1962
|
+
F = !1, E = E + 1, E < h.length && l();
|
|
1910
1963
|
continue;
|
|
1911
1964
|
}
|
|
1912
|
-
let
|
|
1913
|
-
for (;
|
|
1914
|
-
const
|
|
1915
|
-
if (te +
|
|
1916
|
-
te +=
|
|
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 (
|
|
1973
|
+
if (X === 0) {
|
|
1921
1974
|
o.length > 0 && l();
|
|
1922
|
-
const
|
|
1923
|
-
|
|
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} 行高度约 ${
|
|
1926
|
-
}),
|
|
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
|
|
1930
|
-
|
|
1931
|
-
node: { ...f, rows:
|
|
1932
|
-
suppressBorders: { top:
|
|
1933
|
-
}),
|
|
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" ?
|
|
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
|
|
1948
|
-
const n =
|
|
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 =
|
|
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
|
|
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", "
|
|
2027
|
+
emits: ["field-change", "field-activate"],
|
|
1975
2028
|
setup(e, { emit: t }) {
|
|
1976
|
-
const n = t, r = e, i =
|
|
2029
|
+
const n = t, r = e, i = U(() => ze(r.schema.paper));
|
|
1977
2030
|
ge(
|
|
1978
2031
|
i,
|
|
1979
|
-
(
|
|
2032
|
+
(d) => Hr(d.widthMm, d.heightMm),
|
|
1980
2033
|
{ immediate: !0 }
|
|
1981
|
-
),
|
|
1982
|
-
function o(
|
|
1983
|
-
const
|
|
2034
|
+
), St(Pr());
|
|
2035
|
+
function o(d) {
|
|
2036
|
+
const y = i.value, p = r.paginate;
|
|
1984
2037
|
return {
|
|
1985
2038
|
position: "relative",
|
|
1986
|
-
width: `${
|
|
1987
|
-
...
|
|
1988
|
-
padding: `${
|
|
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 =
|
|
1992
|
-
const
|
|
2044
|
+
const a = U(() => {
|
|
2045
|
+
const d = i.value;
|
|
1993
2046
|
if (!r.paginate)
|
|
1994
|
-
return r.schema.pages.map((
|
|
1995
|
-
id:
|
|
1996
|
-
sourcePageId:
|
|
1997
|
-
sourceIndex:
|
|
1998
|
-
index:
|
|
1999
|
-
margin:
|
|
2000
|
-
children:
|
|
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
|
|
2003
|
-
for (const
|
|
2004
|
-
const
|
|
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:
|
|
2007
|
-
contentWidthMm:
|
|
2059
|
+
bodyHeightMm: E,
|
|
2060
|
+
contentWidthMm: F,
|
|
2008
2061
|
data: r.data ?? null
|
|
2009
2062
|
});
|
|
2010
|
-
|
|
2063
|
+
y.push(...C.pages);
|
|
2011
2064
|
}
|
|
2012
|
-
return
|
|
2013
|
-
}), l =
|
|
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
|
|
2017
|
-
return document.querySelectorAll(".grid-form-paper .layout-grid__row").forEach((
|
|
2018
|
-
const
|
|
2019
|
-
if (!
|
|
2020
|
-
const
|
|
2021
|
-
Number.isFinite(
|
|
2022
|
-
}),
|
|
2023
|
-
}
|
|
2024
|
-
function
|
|
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
|
|
2030
|
-
if (!
|
|
2031
|
-
const
|
|
2082
|
+
const d = c();
|
|
2083
|
+
if (!d) return;
|
|
2084
|
+
const y = Br(r.schema, {
|
|
2032
2085
|
data: r.data ?? null,
|
|
2033
|
-
measureRow: (
|
|
2034
|
-
const
|
|
2035
|
-
if (
|
|
2036
|
-
return Math.max(
|
|
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 =
|
|
2092
|
+
l.value = y.pages;
|
|
2040
2093
|
}
|
|
2041
|
-
ge(a, () =>
|
|
2042
|
-
const
|
|
2043
|
-
function
|
|
2044
|
-
return (
|
|
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
|
|
2047
|
-
const
|
|
2048
|
-
return typeof
|
|
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
|
|
2051
|
-
return
|
|
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(
|
|
2054
|
-
var
|
|
2055
|
-
const
|
|
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: `${
|
|
2058
|
-
right: `${
|
|
2059
|
-
height: `${
|
|
2060
|
-
...
|
|
2061
|
-
fontSize: (
|
|
2062
|
-
fontWeight: ((
|
|
2063
|
-
color: ((
|
|
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
|
|
2067
|
-
return { ...f(
|
|
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
|
|
2070
|
-
const
|
|
2071
|
-
|
|
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 (
|
|
2076
|
-
class:
|
|
2132
|
+
return (d, y) => (x(), R("div", {
|
|
2133
|
+
class: Be(["grid-form-canvas", { "grid-form-canvas--bare": e.bare }])
|
|
2077
2134
|
}, [
|
|
2078
|
-
(
|
|
2079
|
-
var
|
|
2080
|
-
return
|
|
2081
|
-
key:
|
|
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:
|
|
2084
|
-
"data-node-id":
|
|
2085
|
-
}, [
|
|
2086
|
-
|
|
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:
|
|
2146
|
+
style: ce(M(e.schema.paper.header, p.margin, "top"))
|
|
2090
2147
|
}, [
|
|
2091
|
-
O("span",
|
|
2092
|
-
O("span",
|
|
2093
|
-
O("span",
|
|
2094
|
-
], 4)) :
|
|
2095
|
-
(
|
|
2096
|
-
key:
|
|
2097
|
-
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":
|
|
2104
|
-
onFieldChange:
|
|
2105
|
-
|
|
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
|
-
|
|
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:
|
|
2167
|
+
style: ce(M(e.schema.paper.footer, p.margin, "bottom"))
|
|
2111
2168
|
}, [
|
|
2112
|
-
O("span",
|
|
2113
|
-
O("span",
|
|
2114
|
-
O("span",
|
|
2115
|
-
], 4)) :
|
|
2116
|
-
],
|
|
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
|
-
}),
|
|
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
|
-
},
|
|
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 =
|
|
2135
|
-
let c = null,
|
|
2136
|
-
const
|
|
2137
|
-
function
|
|
2138
|
-
const
|
|
2139
|
-
|
|
2140
|
-
|
|
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
|
|
2144
|
-
function
|
|
2145
|
-
const
|
|
2146
|
-
return !!(
|
|
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
|
|
2150
|
-
|
|
2206
|
+
var T;
|
|
2207
|
+
v.value || (v.value = !0, (T = o.value) == null || T.classList.add("is-space-pan"));
|
|
2151
2208
|
}
|
|
2152
|
-
function
|
|
2153
|
-
var
|
|
2154
|
-
|
|
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(
|
|
2157
|
-
|
|
2213
|
+
function f(T) {
|
|
2214
|
+
T.code !== "Space" && T.key !== " " || w(T.target) || (T.preventDefault(), M());
|
|
2158
2215
|
}
|
|
2159
|
-
function
|
|
2160
|
-
|
|
2216
|
+
function h(T) {
|
|
2217
|
+
T.code !== "Space" && T.key !== " " || b();
|
|
2161
2218
|
}
|
|
2162
|
-
function
|
|
2163
|
-
const
|
|
2164
|
-
typeof (
|
|
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
|
|
2223
|
+
function y(T) {
|
|
2167
2224
|
if (!c) return;
|
|
2168
|
-
const
|
|
2169
|
-
|
|
2225
|
+
const A = T.target;
|
|
2226
|
+
A && A.closest("input, textarea, select, [contenteditable]") || c.zoomWithWheel(T);
|
|
2170
2227
|
}
|
|
2171
|
-
function
|
|
2172
|
-
return Math.min(r.maxScale, Math.max(r.minScale,
|
|
2228
|
+
function p(T) {
|
|
2229
|
+
return Math.min(r.maxScale, Math.max(r.minScale, T));
|
|
2173
2230
|
}
|
|
2174
2231
|
function E() {
|
|
2175
|
-
const
|
|
2176
|
-
c == null || c.zoom(
|
|
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
|
|
2180
|
-
c == null || c.zoom(
|
|
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
|
|
2239
|
+
function C() {
|
|
2183
2240
|
c == null || c.reset({ animate: !1 });
|
|
2184
2241
|
}
|
|
2185
|
-
function
|
|
2186
|
-
const
|
|
2187
|
-
if (!
|
|
2188
|
-
const
|
|
2189
|
-
if (
|
|
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(
|
|
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:
|
|
2199
|
-
const
|
|
2200
|
-
if (!
|
|
2201
|
-
const
|
|
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 =
|
|
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
|
-
}),
|
|
2215
|
-
}),
|
|
2216
|
-
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
}), (
|
|
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:
|
|
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
|
-
|
|
2286
|
+
At(T.$slots, "default", {}, void 0, !0)
|
|
2230
2287
|
], 512),
|
|
2231
|
-
O("div",
|
|
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",
|
|
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:
|
|
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:
|
|
2312
|
+
onClick: C
|
|
2256
2313
|
}, " 重置 ")
|
|
2257
2314
|
])
|
|
2258
2315
|
], 2));
|
|
2259
2316
|
}
|
|
2260
|
-
}),
|
|
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
|
-
},
|
|
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
|
-
},
|
|
2315
|
-
"zh-CN":
|
|
2316
|
-
en:
|
|
2317
|
-
},
|
|
2318
|
-
function
|
|
2319
|
-
|
|
2320
|
-
}
|
|
2321
|
-
function
|
|
2322
|
-
let i = (
|
|
2323
|
-
return i == null && (i =
|
|
2324
|
-
}
|
|
2325
|
-
function
|
|
2326
|
-
return
|
|
2327
|
-
}
|
|
2328
|
-
const
|
|
2329
|
-
let
|
|
2330
|
-
function
|
|
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(
|
|
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"),
|
|
2343
|
-
a.push({ el: l, attr:
|
|
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:
|
|
2350
|
-
|
|
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
|
|
2414
|
+
function dn(e) {
|
|
2358
2415
|
const t = [];
|
|
2359
|
-
return e.querySelectorAll(
|
|
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
|
|
2425
|
+
function fn(e = {}) {
|
|
2369
2426
|
if (typeof document > "u") return !1;
|
|
2370
|
-
const t = e.root !== void 0 ? e.root : document.querySelector(
|
|
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(
|
|
2429
|
+
const n = Array.from(t.querySelectorAll(ln));
|
|
2373
2430
|
if (!n.length) return !1;
|
|
2374
|
-
const r = String(
|
|
2375
|
-
n.forEach((a) => a.setAttribute(
|
|
2376
|
-
const i =
|
|
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
|
|
2379
|
-
el: `[${
|
|
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(
|
|
2445
|
+
o(), n.forEach((a) => a.removeAttribute(He));
|
|
2389
2446
|
}
|
|
2390
2447
|
return !0;
|
|
2391
2448
|
}
|
|
2392
|
-
function
|
|
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
|
|
2399
|
-
if (!
|
|
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[
|
|
2459
|
+
i[u] = "***";
|
|
2403
2460
|
else {
|
|
2404
|
-
const
|
|
2405
|
-
|
|
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[
|
|
2467
|
+
i[u] = c.getAttribute("src") ?? "";
|
|
2411
2468
|
continue;
|
|
2412
2469
|
}
|
|
2413
|
-
const
|
|
2414
|
-
i[
|
|
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
|
|
2422
|
-
|
|
2423
|
-
const
|
|
2424
|
-
if (
|
|
2425
|
-
if (
|
|
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[
|
|
2484
|
+
i[g] = "***";
|
|
2428
2485
|
else {
|
|
2429
|
-
const
|
|
2430
|
-
|
|
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 (
|
|
2435
|
-
i[
|
|
2491
|
+
if (m instanceof HTMLInputElement) {
|
|
2492
|
+
i[g] = m.value;
|
|
2436
2493
|
return;
|
|
2437
2494
|
}
|
|
2438
2495
|
}
|
|
2439
|
-
}),
|
|
2440
|
-
const
|
|
2441
|
-
if (!
|
|
2442
|
-
if (
|
|
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[
|
|
2501
|
+
i[g] = "***";
|
|
2445
2502
|
else {
|
|
2446
|
-
const
|
|
2447
|
-
|
|
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
|
|
2452
|
-
i[
|
|
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
|
|
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", "
|
|
2521
|
+
emits: ["field-change", "update:data", "field-activate"],
|
|
2465
2522
|
setup(e, { expose: t, emit: n }) {
|
|
2466
|
-
const r = e, i = n, o =
|
|
2523
|
+
const r = e, i = n, o = J({ ...r.data ?? {} });
|
|
2467
2524
|
ge(
|
|
2468
2525
|
() => r.data,
|
|
2469
|
-
(
|
|
2470
|
-
o.value = { ...
|
|
2526
|
+
(w) => {
|
|
2527
|
+
o.value = { ...w ?? {} };
|
|
2471
2528
|
}
|
|
2472
2529
|
);
|
|
2473
|
-
const a =
|
|
2474
|
-
var
|
|
2475
|
-
return ((
|
|
2530
|
+
const a = U(() => {
|
|
2531
|
+
var w;
|
|
2532
|
+
return ((w = r.options) == null ? void 0 : w.readonly) ?? !0;
|
|
2476
2533
|
});
|
|
2477
|
-
function l(
|
|
2478
|
-
o.value = { ...o.value, [
|
|
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(
|
|
2481
|
-
i("
|
|
2537
|
+
function c(w) {
|
|
2538
|
+
i("field-activate", w);
|
|
2482
2539
|
}
|
|
2483
|
-
const
|
|
2484
|
-
function
|
|
2540
|
+
const u = J(null);
|
|
2541
|
+
function m() {
|
|
2485
2542
|
var M;
|
|
2486
|
-
const
|
|
2487
|
-
return
|
|
2543
|
+
const w = (M = u.value) == null ? void 0 : M.$el;
|
|
2544
|
+
return fn({ root: w instanceof HTMLElement ? w : null });
|
|
2488
2545
|
}
|
|
2489
|
-
function
|
|
2546
|
+
function g() {
|
|
2490
2547
|
return { ...o.value };
|
|
2491
2548
|
}
|
|
2492
|
-
function
|
|
2493
|
-
var
|
|
2494
|
-
return
|
|
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:
|
|
2497
|
-
var
|
|
2498
|
-
return (
|
|
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:
|
|
2503
|
-
var
|
|
2559
|
+
default: xt(() => {
|
|
2560
|
+
var y;
|
|
2504
2561
|
return [
|
|
2505
|
-
|
|
2562
|
+
Rt(rt, {
|
|
2506
2563
|
ref_key: "rendererRef",
|
|
2507
|
-
ref:
|
|
2564
|
+
ref: u,
|
|
2508
2565
|
schema: e.schema,
|
|
2509
|
-
mode:
|
|
2566
|
+
mode: nt,
|
|
2510
2567
|
data: o.value,
|
|
2511
2568
|
readonly: a.value,
|
|
2512
|
-
"field-permissions": (
|
|
2569
|
+
"field-permissions": (y = e.options) == null ? void 0 : y.fieldPermissions,
|
|
2513
2570
|
bare: !0,
|
|
2514
2571
|
onFieldChange: l,
|
|
2515
|
-
|
|
2572
|
+
onFieldActivate: c
|
|
2516
2573
|
}, null, 8, ["schema", "data", "readonly", "field-permissions"])
|
|
2517
2574
|
];
|
|
2518
2575
|
}),
|
|
2519
2576
|
_: 1
|
|
2520
|
-
}, 8, ["fit-on-mount"])) : (
|
|
2577
|
+
}, 8, ["fit-on-mount"])) : (x(), ye(rt, {
|
|
2521
2578
|
key: 1,
|
|
2522
2579
|
ref_key: "rendererRef",
|
|
2523
|
-
ref:
|
|
2580
|
+
ref: u,
|
|
2524
2581
|
schema: e.schema,
|
|
2525
|
-
mode:
|
|
2582
|
+
mode: nt,
|
|
2526
2583
|
data: o.value,
|
|
2527
2584
|
readonly: a.value,
|
|
2528
|
-
"field-permissions": (
|
|
2529
|
-
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
|
-
|
|
2588
|
+
onFieldActivate: c
|
|
2532
2589
|
}, null, 8, ["schema", "data", "readonly", "field-permissions", "bare"]));
|
|
2533
2590
|
};
|
|
2534
2591
|
}
|
|
2535
2592
|
});
|
|
2536
2593
|
export {
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
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
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
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
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
ct as
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
On as
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
di as
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
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
|
};
|