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