@guodun/antdv 1.7.12 → 1.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +373 -295
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +219 -202
- package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +18 -18
- package/dist/es/components/contract-signing-location/src/template-source.mjs +62 -49
- package/dist/es/components/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +37 -42
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +69 -55
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +278 -270
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +344 -343
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1025 -964
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +120 -74
- package/dist/es/components/pro-contract-template-designer/src/SigningLayoutCustomModal.vue.mjs +72 -59
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +133 -132
- package/dist/es/components/pro-contract-template-designer/src/utils/contract-layout-check.mjs +239 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +95 -71
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +67 -76
- package/dist/es/components/pro-contract-template-designer/src/utils/signing-layout-presets.mjs +77 -61
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -83
- package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +23 -15
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/contract-print-css/index.mjs +134 -30
- package/dist/es/contract-print.mjs +2 -0
- package/dist/es/index.mjs +21 -20
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
- package/dist/lib/components/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/SigningLayoutCustomModal.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
- package/dist/lib/components/pro-contract-template-designer/src/utils/contract-layout-check.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +50 -28
- package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/signing-layout-presets.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +5 -5
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-variable-render.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/contract-print-css/index.cjs +74 -23
- package/dist/lib/contract-print.cjs +1 -0
- package/dist/lib/index.cjs +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +9 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.d.ts +7 -0
- package/dist/types/components/contract-signing-location/src/template-source.d.ts +6 -0
- package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.d.ts +2 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +5 -1
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +7 -2
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +2 -2
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +36 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/contract-layout-check.d.ts +104 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts +4 -1
- package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts +2 -8
- package/dist/types/components/pro-contract-template-designer/src/utils/signing-layout-presets.d.ts +9 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +6 -1
- package/dist/types/contract-print-css/index.d.ts +70 -0
- package/dist/types/contract-print.d.ts +2 -0
- package/package.json +14 -2
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
top: 54,
|
|
7
|
-
right: 64,
|
|
8
|
-
bottom: 54,
|
|
9
|
-
left: 64
|
|
10
|
-
}, a = {
|
|
1
|
+
import { isContractPageDecorationVisible as e, resolveContractDecorationSafePadding as t } from "../../../../contract-print-css/index.mjs";
|
|
2
|
+
import { DEFAULT_CONTRACT_FONT_FAMILY as n } from "../constants.mjs";
|
|
3
|
+
import { escapeHtmlAttribute as r, escapeHtmlText as i } from "./html.mjs";
|
|
4
|
+
import { resolveTemplateVariablePresentation as a } from "./template-variable-render.mjs";
|
|
5
|
+
var o = {
|
|
11
6
|
sparse: {
|
|
12
7
|
columns: 2,
|
|
13
8
|
rows: 3
|
|
@@ -20,7 +15,7 @@ var i = {
|
|
|
20
15
|
columns: 4,
|
|
21
16
|
rows: 6
|
|
22
17
|
}
|
|
23
|
-
},
|
|
18
|
+
}, s = {
|
|
24
19
|
header: {
|
|
25
20
|
enabled: !1,
|
|
26
21
|
text: "",
|
|
@@ -31,7 +26,7 @@ var i = {
|
|
|
31
26
|
right: ""
|
|
32
27
|
},
|
|
33
28
|
showOnFirstPage: !0,
|
|
34
|
-
fontFamily:
|
|
29
|
+
fontFamily: n,
|
|
35
30
|
fontSize: 12,
|
|
36
31
|
fontWeight: 400,
|
|
37
32
|
color: "#565b66",
|
|
@@ -51,7 +46,7 @@ var i = {
|
|
|
51
46
|
right: ""
|
|
52
47
|
},
|
|
53
48
|
showOnFirstPage: !0,
|
|
54
|
-
fontFamily:
|
|
49
|
+
fontFamily: n,
|
|
55
50
|
fontSize: 12,
|
|
56
51
|
fontWeight: 400,
|
|
57
52
|
color: "#565b66",
|
|
@@ -73,17 +68,17 @@ var i = {
|
|
|
73
68
|
density: "normal"
|
|
74
69
|
},
|
|
75
70
|
pageNumbering: { countFirstPage: !0 }
|
|
76
|
-
},
|
|
77
|
-
function
|
|
71
|
+
}, c = /^#[\da-f]{6}$/i, l = /^[A-Za-z][A-Za-z0-9_]{1,63}$/, u = /\$\{\{[\s\S]*?\}\}|\$\{\{|\$\{[^{}]*\}|\{[A-Za-z][A-Za-z0-9]*\}/g;
|
|
72
|
+
function d(e) {
|
|
78
73
|
return {
|
|
79
|
-
header: D(e?.header,
|
|
80
|
-
footer: D(e?.footer,
|
|
74
|
+
header: D(e?.header, s.header),
|
|
75
|
+
footer: D(e?.footer, s.footer),
|
|
81
76
|
watermark: O(e?.watermark),
|
|
82
77
|
pageNumbering: { countFirstPage: e?.pageNumbering?.countFirstPage !== !1 }
|
|
83
78
|
};
|
|
84
79
|
}
|
|
85
|
-
function
|
|
86
|
-
let t =
|
|
80
|
+
function f(e) {
|
|
81
|
+
let t = d();
|
|
87
82
|
return e === "none" ? t : (t.footer = D({
|
|
88
83
|
...t.footer,
|
|
89
84
|
enabled: !0,
|
|
@@ -92,7 +87,7 @@ function d(e) {
|
|
|
92
87
|
center: "第 {pageNumber} / {totalPages} 页",
|
|
93
88
|
right: ""
|
|
94
89
|
}
|
|
95
|
-
},
|
|
90
|
+
}, s.footer), (e === "internal-review" || e === "draft") && (t.watermark = O({
|
|
96
91
|
...t.watermark,
|
|
97
92
|
enabled: !0,
|
|
98
93
|
text: e === "internal-review" ? "内部审阅" : "草稿",
|
|
@@ -100,38 +95,38 @@ function d(e) {
|
|
|
100
95
|
density: "normal"
|
|
101
96
|
})), t);
|
|
102
97
|
}
|
|
103
|
-
function
|
|
104
|
-
let t = JSON.stringify(
|
|
98
|
+
function p(e) {
|
|
99
|
+
let t = JSON.stringify(d(e));
|
|
105
100
|
return [
|
|
106
101
|
"none",
|
|
107
102
|
"page-number",
|
|
108
103
|
"internal-review",
|
|
109
104
|
"draft"
|
|
110
|
-
].find((e) => JSON.stringify(
|
|
111
|
-
}
|
|
112
|
-
function p(e, t = 1) {
|
|
113
|
-
let n = u(e).header;
|
|
114
|
-
return I(n, t);
|
|
105
|
+
].find((e) => JSON.stringify(f(e)) === t) ?? "custom";
|
|
115
106
|
}
|
|
116
107
|
function m(e, t = 1) {
|
|
117
|
-
let n =
|
|
108
|
+
let n = d(e).header;
|
|
118
109
|
return I(n, t);
|
|
119
110
|
}
|
|
120
111
|
function h(e, t = 1) {
|
|
121
|
-
let n =
|
|
112
|
+
let n = d(e).footer;
|
|
113
|
+
return I(n, t);
|
|
114
|
+
}
|
|
115
|
+
function g(e, t = 1) {
|
|
116
|
+
let n = d(e).watermark;
|
|
122
117
|
return n.enabled && !!n.text.trim() && (t !== 1 || n.showOnFirstPage);
|
|
123
118
|
}
|
|
124
|
-
function
|
|
119
|
+
function _(e, t, n = !0) {
|
|
125
120
|
let r = Math.max(1, Math.floor(e || 1)), i = Math.max(0, Math.floor(t || 0));
|
|
126
121
|
return {
|
|
127
122
|
pageNumber: n ? String(r) : r === 1 ? "" : String(r - 1),
|
|
128
123
|
totalPages: String(n ? i : Math.max(0, i - 1))
|
|
129
124
|
};
|
|
130
125
|
}
|
|
131
|
-
function
|
|
126
|
+
function v(e, t = [], n = !1) {
|
|
132
127
|
let r = [], i = [], a = new Map(t.map((e) => [e.key, e])), o = 0;
|
|
133
|
-
|
|
134
|
-
let s =
|
|
128
|
+
u.lastIndex = 0;
|
|
129
|
+
let s = u.exec(e);
|
|
135
130
|
for (; s;) {
|
|
136
131
|
s.index > o && r.push({
|
|
137
132
|
type: "text",
|
|
@@ -142,7 +137,7 @@ function _(e, t = [], n = !1) {
|
|
|
142
137
|
else if (t === "{totalPages}") r.push({ type: "totalPages" });
|
|
143
138
|
else if (t.startsWith("${{") && t.endsWith("}}")) {
|
|
144
139
|
let e = t.slice(3, -2), o = e.trim();
|
|
145
|
-
if (e !== o || !
|
|
140
|
+
if (e !== o || !l.test(o)) i.push({
|
|
146
141
|
code: "DECORATION_TOKEN_MALFORMED",
|
|
147
142
|
message: `页面装饰变量令牌 ${t} 格式错误`,
|
|
148
143
|
token: t,
|
|
@@ -178,7 +173,7 @@ function _(e, t = [], n = !1) {
|
|
|
178
173
|
type: "text",
|
|
179
174
|
value: t
|
|
180
175
|
});
|
|
181
|
-
o = s.index + t.length, s =
|
|
176
|
+
o = s.index + t.length, s = u.exec(e);
|
|
182
177
|
}
|
|
183
178
|
return o < e.length && r.push({
|
|
184
179
|
type: "text",
|
|
@@ -188,18 +183,18 @@ function _(e, t = [], n = !1) {
|
|
|
188
183
|
issues: i
|
|
189
184
|
};
|
|
190
185
|
}
|
|
191
|
-
function
|
|
192
|
-
let t =
|
|
186
|
+
function y(e) {
|
|
187
|
+
let t = d(e), n = /* @__PURE__ */ new Set();
|
|
193
188
|
return P(t, (e) => {
|
|
194
|
-
|
|
189
|
+
v(e).tokens.forEach((e) => {
|
|
195
190
|
e.type === "variable" && n.add(e.key);
|
|
196
191
|
}), R(e).forEach((e) => n.add(e.key));
|
|
197
192
|
}), n;
|
|
198
193
|
}
|
|
199
|
-
function
|
|
200
|
-
let n =
|
|
194
|
+
function b(e, t) {
|
|
195
|
+
let n = d(e), r = [];
|
|
201
196
|
return P(n, (e, n) => {
|
|
202
|
-
|
|
197
|
+
v(e, t, !0).issues.forEach((e, t) => {
|
|
203
198
|
r.push({
|
|
204
199
|
type: "variable",
|
|
205
200
|
id: `${n}-${e.offset}-${t}`,
|
|
@@ -210,40 +205,36 @@ function y(e, t) {
|
|
|
210
205
|
});
|
|
211
206
|
}), r;
|
|
212
207
|
}
|
|
213
|
-
function
|
|
208
|
+
function x(e) {
|
|
214
209
|
if (!e.code?.startsWith("DECORATION_")) return;
|
|
215
210
|
let t = e.id.replace(/-\d+-\d+$/, "");
|
|
216
211
|
if (/^(?:header|footer)\.slots\.(?:left|center|right)$/.test(t) || t === "watermark.text") return t;
|
|
217
212
|
}
|
|
218
|
-
function
|
|
219
|
-
let r =
|
|
220
|
-
return r.header.slots = L(r.header.slots, i), r.footer.slots = L(r.footer.slots, i), r.watermark.text = i(r.watermark.text), r.header = D(r.header,
|
|
213
|
+
function S(e, t, n) {
|
|
214
|
+
let r = d(e), i = (e) => z(e, t, n);
|
|
215
|
+
return r.header.slots = L(r.header.slots, i), r.footer.slots = L(r.footer.slots, i), r.watermark.text = i(r.watermark.text), r.header = D(r.header, s.header), r.footer = D(r.footer, s.footer), r;
|
|
221
216
|
}
|
|
222
|
-
function
|
|
217
|
+
function C(e, t, n, r, i, a) {
|
|
223
218
|
if (e.type === "text") return e.value;
|
|
224
|
-
let o =
|
|
219
|
+
let o = _(r, i, a);
|
|
225
220
|
if (e.type === "pageNumber") return o.pageNumber;
|
|
226
221
|
if (e.type === "totalPages") return o.totalPages;
|
|
227
222
|
let s = t.find((t) => t.key === e.key);
|
|
228
223
|
return !s || s.type === "image" ? e.raw : N(s, n?.[e.key]);
|
|
229
224
|
}
|
|
230
|
-
function C(e) {
|
|
231
|
-
return a[e] ?? a.normal;
|
|
232
|
-
}
|
|
233
225
|
function w(e) {
|
|
234
|
-
|
|
235
|
-
return Math.max(80, t.offset + Math.ceil(t.fontSize * 1.5) + 20);
|
|
226
|
+
return o[e] ?? o.normal;
|
|
236
227
|
}
|
|
237
228
|
function T(e, t = 1) {
|
|
238
229
|
return [
|
|
239
230
|
"gd-contract-template-page",
|
|
240
|
-
|
|
241
|
-
|
|
231
|
+
m(e, t) ? "has-contract-header" : "",
|
|
232
|
+
h(e, t) ? "has-contract-footer" : ""
|
|
242
233
|
].filter(Boolean).join(" ");
|
|
243
234
|
}
|
|
244
235
|
function E(e, t, n, r = [], i) {
|
|
245
|
-
let a =
|
|
246
|
-
return
|
|
236
|
+
let a = d(e), o = [];
|
|
237
|
+
return g(a, t) && o.push(j(a.watermark, r, i, t, n, a.pageNumbering.countFirstPage)), m(a, t) && o.push(A("header", a.header, r, i, t, n, a.pageNumbering.countFirstPage)), h(a, t) && o.push(A("footer", a.footer, r, i, t, n, a.pageNumbering.countFirstPage)), o.join("");
|
|
247
238
|
}
|
|
248
239
|
function D(e, t) {
|
|
249
240
|
let n = B(e?.textAlign, t.textAlign), r = k(e, t, n), i = r[n].trim() ? n : r.center.trim() ? "center" : r.left.trim() ? "left" : r.right.trim() ? "right" : n;
|
|
@@ -265,7 +256,7 @@ function D(e, t) {
|
|
|
265
256
|
};
|
|
266
257
|
}
|
|
267
258
|
function O(e) {
|
|
268
|
-
let t =
|
|
259
|
+
let t = s.watermark;
|
|
269
260
|
return {
|
|
270
261
|
enabled: !!e?.enabled,
|
|
271
262
|
text: V(e?.text, t.text),
|
|
@@ -291,31 +282,31 @@ function k(e, t, n) {
|
|
|
291
282
|
};
|
|
292
283
|
return r[n] = V(e?.text, t.text), r;
|
|
293
284
|
}
|
|
294
|
-
function A(e, n,
|
|
295
|
-
let
|
|
285
|
+
function A(e, n, i, a, o, s, c) {
|
|
286
|
+
let l = t(n), u = n.divider.enabled ? `;border-${e === "header" ? "bottom" : "top"}:1px solid ${r(n.divider.color)}` : "", d = `color:${r(n.color)};font-family:${r(n.fontFamily)};font-size:${n.fontSize}px;font-weight:${n.fontWeight};${e === "header" ? "top" : "bottom"}:${n.offset}px${u}`, f = [
|
|
296
287
|
"left",
|
|
297
288
|
"center",
|
|
298
289
|
"right"
|
|
299
|
-
].map((e) => `<div class="gd-contract-template-page__decoration-slot is-${e}">${M(n.slots[e],
|
|
300
|
-
return `<div class="gd-contract-template-page__${e}" data-decoration-offset="${n.offset}" data-decoration-font-size="${n.fontSize}" data-decoration-safe-padding="${
|
|
290
|
+
].map((e) => `<div class="gd-contract-template-page__decoration-slot is-${e}">${M(n.slots[e], i, a, o, s, c)}</div>`).join("");
|
|
291
|
+
return `<div class="gd-contract-template-page__${e}" data-decoration-offset="${n.offset}" data-decoration-font-size="${n.fontSize}" data-decoration-safe-padding="${l}" style="${d}">${f}</div>`;
|
|
301
292
|
}
|
|
302
|
-
function j(e,
|
|
303
|
-
let s =
|
|
293
|
+
function j(e, t, n, i, a, o) {
|
|
294
|
+
let s = w(e.density), c = e.layout === "tiled" ? s.columns * s.rows : 1, l = M(e.text, t, n, i, a, o), u = Array.from({ length: c }, () => `<div class="gd-contract-template-page__watermark-item" style="color:${r(e.color)};font-size:${e.fontSize}px;opacity:${e.opacity};transform:rotate(${e.rotation}deg)">${l}</div>`).join(""), d = e.layout === "tiled" ? `--gd-watermark-columns:${s.columns};--gd-watermark-rows:${s.rows}` : "";
|
|
304
295
|
return `<div class="gd-contract-template-page__watermark is-${e.layout} density-${e.density}" data-watermark-layout="${e.layout}" data-watermark-density="${e.density}" aria-hidden="true" style="${d}">${u}</div>`;
|
|
305
296
|
}
|
|
306
|
-
function M(e,
|
|
307
|
-
let c =
|
|
308
|
-
return
|
|
309
|
-
if (e.type === "text") return
|
|
310
|
-
if (e.type === "pageNumber") return
|
|
311
|
-
if (e.type === "totalPages") return
|
|
312
|
-
let
|
|
313
|
-
return
|
|
297
|
+
function M(e, t, n, a, o, s) {
|
|
298
|
+
let c = _(a, o, s), l = new Map(t.map((e) => [e.key, e]));
|
|
299
|
+
return v(e).tokens.map((e) => {
|
|
300
|
+
if (e.type === "text") return i(e.value);
|
|
301
|
+
if (e.type === "pageNumber") return i(c.pageNumber);
|
|
302
|
+
if (e.type === "totalPages") return i(c.totalPages);
|
|
303
|
+
let t = l.get(e.key);
|
|
304
|
+
return n !== void 0 && t && t.type !== "image" ? i(N(t, n[e.key])) : `<span class="gd-contract-template-page__variable" data-template-variable="true" data-key="${r(e.key)}" data-label="${r(t?.label ?? e.key)}" data-variable-type="${r(t?.type ?? "text")}">\${{${i(e.key)}}}</span>`;
|
|
314
305
|
}).join("");
|
|
315
306
|
}
|
|
316
307
|
function N(e, t) {
|
|
317
308
|
let n = t == null ? e.defaultValue ?? "" : String(t);
|
|
318
|
-
return
|
|
309
|
+
return a({
|
|
319
310
|
type: e.type,
|
|
320
311
|
defaultValue: n,
|
|
321
312
|
placeholder: e.placeholder,
|
|
@@ -347,8 +338,8 @@ function F(e) {
|
|
|
347
338
|
"watermark.text": "水印内容"
|
|
348
339
|
}[e] ?? "页面装饰";
|
|
349
340
|
}
|
|
350
|
-
function I(
|
|
351
|
-
return e
|
|
341
|
+
function I(t, n) {
|
|
342
|
+
return e(t, n);
|
|
352
343
|
}
|
|
353
344
|
function L(e, t) {
|
|
354
345
|
return {
|
|
@@ -385,7 +376,7 @@ function V(e, t) {
|
|
|
385
376
|
return (typeof e == "string" ? e : t).slice(0, 240);
|
|
386
377
|
}
|
|
387
378
|
function H(e, t) {
|
|
388
|
-
return typeof e == "string" &&
|
|
379
|
+
return typeof e == "string" && c.test(e) ? e : t;
|
|
389
380
|
}
|
|
390
381
|
function U(e, t) {
|
|
391
382
|
return typeof e == "string" && e.replace(/[;{}<>]/g, "").trim().slice(0, 120) || t;
|
|
@@ -395,4 +386,4 @@ function W(e, t, n, r) {
|
|
|
395
386
|
return Number.isFinite(i) ? Math.min(n, Math.max(t, i)) : r;
|
|
396
387
|
}
|
|
397
388
|
//#endregion
|
|
398
|
-
export {
|
|
389
|
+
export { T as buildPageDecorationClassNames, E as buildPageDecorationsHtml, y as collectPageDecorationVariableKeys, f as createPageDecorationPreset, w as getWatermarkDensityGrid, h as hasEnabledPageFooter, m as hasEnabledPageHeader, g as hasEnabledPageWatermark, d as normalizePageDecorations, v as parsePageDecorationText, p as resolvePageDecorationPreset, C as resolvePageDecorationTokenText, x as resolvePageDecorationValidationPath, S as rewritePageDecorationVariableTokens, b as validatePageDecorations };
|
package/dist/es/components/pro-contract-template-designer/src/utils/signing-layout-presets.mjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CONTRACT_PAGE_BASE_PADDING as e } from "../../../../contract-print-css/index.mjs";
|
|
2
|
+
import { buildSigningMarkAttrs as t, getSigningMarkDefaultSize as n } from "./signing-mark.mjs";
|
|
2
3
|
//#region src/components/pro-contract-template-designer/src/utils/signing-layout-presets.ts
|
|
3
|
-
var
|
|
4
|
+
var r = "dual-party", i = 794, a = 24, o = 4, s = i - e.left - e.right, c = 3, l = "custom", u = 1, d = 6, f = [
|
|
4
5
|
"side-by-side",
|
|
5
6
|
"stacked",
|
|
6
7
|
"table-cell",
|
|
7
8
|
"final-page"
|
|
8
|
-
],
|
|
9
|
+
], p = {
|
|
9
10
|
"side-by-side": "并排分栏",
|
|
10
11
|
stacked: "逐行列出",
|
|
11
12
|
"table-cell": "表格单元格",
|
|
12
13
|
"final-page": "末页集中"
|
|
13
|
-
},
|
|
14
|
+
}, m = [
|
|
14
15
|
"seal",
|
|
15
16
|
"signature",
|
|
16
17
|
"date",
|
|
17
18
|
"title"
|
|
18
|
-
],
|
|
19
|
+
], h = {
|
|
19
20
|
seal: "盖章框",
|
|
20
21
|
signature: "签字线",
|
|
21
22
|
date: "日期",
|
|
22
23
|
title: "职务"
|
|
23
|
-
},
|
|
24
|
+
}, g = [
|
|
24
25
|
"甲",
|
|
25
26
|
"乙",
|
|
26
27
|
"丙",
|
|
@@ -31,12 +32,12 @@ var t = "dual-party", n = "custom", r = 1, i = 6, a = [
|
|
|
31
32
|
"辛",
|
|
32
33
|
"壬",
|
|
33
34
|
"癸"
|
|
34
|
-
],
|
|
35
|
-
function
|
|
36
|
-
let t =
|
|
35
|
+
], _ = "年 月 日", v = " ", y = "签署页";
|
|
36
|
+
function b(e) {
|
|
37
|
+
let t = g[e];
|
|
37
38
|
return t ? `${t}方` : `${e + 1}方`;
|
|
38
39
|
}
|
|
39
|
-
var
|
|
40
|
+
var x = {
|
|
40
41
|
"dual-party": {
|
|
41
42
|
key: "dual-party",
|
|
42
43
|
label: "双方并排",
|
|
@@ -97,22 +98,22 @@ var m = {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
|
-
},
|
|
101
|
+
}, S = [
|
|
101
102
|
"dual-party",
|
|
102
103
|
"party-list",
|
|
103
104
|
"table-cell",
|
|
104
105
|
"final-page"
|
|
105
|
-
],
|
|
106
|
-
function
|
|
107
|
-
return typeof e == "string" && Object.prototype.hasOwnProperty.call(
|
|
106
|
+
], C = [...S, l];
|
|
107
|
+
function w(e) {
|
|
108
|
+
return typeof e == "string" && Object.prototype.hasOwnProperty.call(x, e);
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
-
return typeof e == "string" &&
|
|
110
|
+
function T(e) {
|
|
111
|
+
return typeof e == "string" && C.includes(e);
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
113
|
+
function E(e) {
|
|
114
|
+
return f.includes(e);
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function D(e) {
|
|
116
117
|
let t = Number(e?.partyCount), n = e?.fields, r = {
|
|
117
118
|
seal: n?.seal !== !1,
|
|
118
119
|
signature: n?.signature !== !1,
|
|
@@ -120,38 +121,48 @@ function b(e) {
|
|
|
120
121
|
title: n?.title === !0
|
|
121
122
|
};
|
|
122
123
|
!r.seal && !r.signature && !r.date && !r.title && (r.seal = !0);
|
|
123
|
-
let i = Array.isArray(e?.partyNames) ? e.partyNames.map((e) => String(e ?? "").trim()) : void 0;
|
|
124
|
+
let i = Array.isArray(e?.partyNames) ? e.partyNames.map((e) => String(e ?? "").trim()) : void 0, a = Number.isFinite(t) ? Math.min(6, Math.max(1, Math.round(t))) : x["dual-party"].options.partyCount, o = E(e?.arrangement) ? e.arrangement : "side-by-side";
|
|
124
125
|
return {
|
|
125
|
-
partyCount:
|
|
126
|
-
arrangement:
|
|
126
|
+
partyCount: a,
|
|
127
|
+
arrangement: M(o) && a > 3 ? "stacked" : o,
|
|
127
128
|
fields: r,
|
|
128
129
|
...i?.length ? { partyNames: i } : {}
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
-
return Array.from({ length: e.partyCount }, (t, n) => e.partyNames?.[n] ||
|
|
132
|
+
function O(e) {
|
|
133
|
+
return Array.from({ length: e.partyCount }, (t, n) => e.partyNames?.[n] || b(n));
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function k(e = [], t) {
|
|
135
136
|
return {
|
|
136
137
|
type: "paragraph",
|
|
137
138
|
...t ? { attrs: { textAlign: t } } : {},
|
|
138
139
|
content: e
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
-
return
|
|
142
|
+
function A(e, t) {
|
|
143
|
+
return k([{
|
|
143
144
|
type: "text",
|
|
144
145
|
text: e
|
|
145
146
|
}], t);
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
148
|
+
function j(e, n = "", r) {
|
|
149
|
+
return k([{
|
|
149
150
|
type: "signingMark",
|
|
150
|
-
attrs: e
|
|
151
|
+
attrs: t(e, {
|
|
152
|
+
label: n,
|
|
153
|
+
width: r
|
|
154
|
+
})
|
|
151
155
|
}]);
|
|
152
156
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
157
|
+
function M(e) {
|
|
158
|
+
return e !== "stacked";
|
|
159
|
+
}
|
|
160
|
+
function N(e) {
|
|
161
|
+
let t = Math.floor(s / Math.max(1, e)) - a * 2 - o;
|
|
162
|
+
return Math.min(n("line").width, t);
|
|
163
|
+
}
|
|
164
|
+
function P(e, t) {
|
|
165
|
+
return k([{
|
|
155
166
|
type: "text",
|
|
156
167
|
text: e
|
|
157
168
|
}, {
|
|
@@ -160,13 +171,13 @@ function T(e, t) {
|
|
|
160
171
|
marks: [{ type: "underline" }]
|
|
161
172
|
}]);
|
|
162
173
|
}
|
|
163
|
-
function
|
|
164
|
-
return
|
|
174
|
+
function F() {
|
|
175
|
+
return P("日期:", _);
|
|
165
176
|
}
|
|
166
|
-
function
|
|
167
|
-
return
|
|
177
|
+
function I() {
|
|
178
|
+
return P("职务:", v);
|
|
168
179
|
}
|
|
169
|
-
function
|
|
180
|
+
function L(e, t = "tableCell") {
|
|
170
181
|
return {
|
|
171
182
|
type: t,
|
|
172
183
|
attrs: {
|
|
@@ -178,45 +189,50 @@ function O(e, t = "tableCell") {
|
|
|
178
189
|
content: e
|
|
179
190
|
};
|
|
180
191
|
}
|
|
181
|
-
function
|
|
182
|
-
let
|
|
183
|
-
return t.seal &&
|
|
192
|
+
function R(e, t, n) {
|
|
193
|
+
let r = [A(t.seal ? `${e}(盖章):` : `${e}:`)];
|
|
194
|
+
return t.seal && r.push(j("seal")), t.signature && (r.push(A("授权代表(签字):")), r.push(j("line", "", n))), t.title && r.push(I()), t.date && r.push(F()), L(r);
|
|
184
195
|
}
|
|
185
|
-
function
|
|
196
|
+
function z(e, t) {
|
|
186
197
|
return {
|
|
187
198
|
type: "table",
|
|
188
199
|
attrs: { signingLayout: t },
|
|
189
200
|
content: e
|
|
190
201
|
};
|
|
191
202
|
}
|
|
192
|
-
function
|
|
193
|
-
let
|
|
194
|
-
|
|
195
|
-
type: "tableRow",
|
|
196
|
-
content: [k(e, r.fields)]
|
|
197
|
-
})), a)) : o.push(A([{
|
|
203
|
+
function B(e, t = l) {
|
|
204
|
+
let n = D(e), r = O(n), i = T(t) ? t : l, a = [];
|
|
205
|
+
if (n.arrangement === "final-page" && a.push(A(y, "center")), n.arrangement === "stacked") a.push(z(r.map((e) => ({
|
|
198
206
|
type: "tableRow",
|
|
199
|
-
content:
|
|
200
|
-
}
|
|
207
|
+
content: [R(e, n.fields)]
|
|
208
|
+
})), i));
|
|
209
|
+
else {
|
|
210
|
+
let e = N(n.partyCount);
|
|
211
|
+
a.push(z([{
|
|
212
|
+
type: "tableRow",
|
|
213
|
+
content: r.map((t) => R(t, n.fields, e))
|
|
214
|
+
}], i));
|
|
215
|
+
}
|
|
216
|
+
return a.push(k()), a;
|
|
201
217
|
}
|
|
202
|
-
function
|
|
203
|
-
return
|
|
218
|
+
function V(e) {
|
|
219
|
+
return B(x[e].options, e);
|
|
204
220
|
}
|
|
205
|
-
function
|
|
206
|
-
return
|
|
221
|
+
function H() {
|
|
222
|
+
return V("dual-party");
|
|
207
223
|
}
|
|
208
|
-
function
|
|
209
|
-
let t =
|
|
210
|
-
return `${t.partyCount} 个签署方 · ${
|
|
224
|
+
function U(e) {
|
|
225
|
+
let t = D(e), n = m.filter((e) => t.fields[e]).map((e) => h[e]);
|
|
226
|
+
return `${t.partyCount} 个签署方 · ${p[t.arrangement]} · ${n.join("、")}`;
|
|
211
227
|
}
|
|
212
|
-
var
|
|
228
|
+
var W = {
|
|
213
229
|
seal: "seal",
|
|
214
230
|
signature: "line",
|
|
215
231
|
date: "date",
|
|
216
232
|
title: "text"
|
|
217
233
|
};
|
|
218
|
-
function
|
|
219
|
-
let t =
|
|
234
|
+
function G(e) {
|
|
235
|
+
let t = D(e), n = O(t), r = m.filter((e) => t.fields[e]).map((e) => W[e]), i = n.map((e) => ({
|
|
220
236
|
partyLabel: e,
|
|
221
237
|
items: r
|
|
222
238
|
}));
|
|
@@ -227,9 +243,9 @@ function I(e) {
|
|
|
227
243
|
} : {
|
|
228
244
|
arrangement: t.arrangement,
|
|
229
245
|
columns: t.partyCount,
|
|
230
|
-
...t.arrangement === "final-page" ? { title:
|
|
246
|
+
...t.arrangement === "final-page" ? { title: y } : {},
|
|
231
247
|
cells: i
|
|
232
248
|
};
|
|
233
249
|
}
|
|
234
250
|
//#endregion
|
|
235
|
-
export {
|
|
251
|
+
export { l as CUSTOM_SIGNING_LAYOUT, r as DUAL_PARTY_SIGNING_LAYOUT, c as MAX_SIDE_BY_SIDE_SIGNING_LAYOUT_PARTY_COUNT, d as MAX_SIGNING_LAYOUT_PARTY_COUNT, u as MIN_SIGNING_LAYOUT_PARTY_COUNT, f as SIGNING_LAYOUT_ARRANGEMENTS, p as SIGNING_LAYOUT_ARRANGEMENT_LABELS, C as SIGNING_LAYOUT_ATTRIBUTE_VALUES, m as SIGNING_LAYOUT_FIELD_KEYS, h as SIGNING_LAYOUT_FIELD_LABELS, x as SIGNING_LAYOUT_PRESETS, S as SIGNING_LAYOUT_PRESET_KEYS, H as buildDualPartySigningLayoutPreset, B as buildSigningLayoutContent, V as buildSigningLayoutPresetContent, G as buildSigningLayoutPreviewModel, U as describeSigningLayoutOptions, T as isSigningLayoutAttributeValue, w as isSigningLayoutPresetKey, M as isSingleRowSigningLayoutArrangement, D as normalizeSigningLayoutOptions, b as resolvePartyName, N as resolveSingleRowSignatureLineWidth };
|