@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
package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CONTRACT_PRINT_STYLE_VERSION as e } from "../../../../contract-print-css/index.mjs";
|
|
2
|
+
import { DEFAULT_CONTRACT_FONT_FAMILY as t } from "../constants.mjs";
|
|
3
|
+
import { canUseDomHtml as n, createElementAttributeReader as r, createTagAttributeReader as i, escapeHtmlAttribute as a, escapeHtmlText as o, forEachHtmlTag as s, readNumberAttribute as c, readOptionalBoolean as l, readOptionalNumber as u, replaceTemplateVariableSpans as d } from "../utils/html.mjs";
|
|
3
4
|
import { resolveTemplateVariablePresentation as ee } from "../utils/template-variable-render.mjs";
|
|
4
|
-
import { buildPageDecorationClassNames as
|
|
5
|
-
import { isContractTemplateFieldType as
|
|
6
|
-
import { buildRadioOptionsHtml as
|
|
7
|
-
import { toRaw as
|
|
5
|
+
import { buildPageDecorationClassNames as te, buildPageDecorationsHtml as f, collectPageDecorationVariableKeys as ne, normalizePageDecorations as p, validatePageDecorations as m } from "../utils/page-decorations.mjs";
|
|
6
|
+
import { isContractTemplateFieldType as re } from "../types.mjs";
|
|
7
|
+
import { buildRadioOptionsHtml as ie, decodeContractTemplateJsonAttribute as h } from "../utils/advanced-controls.mjs";
|
|
8
|
+
import { toRaw as ae } from "vue";
|
|
8
9
|
//#region src/components/pro-contract-template-designer/src/composables/use-template-designer.ts
|
|
9
10
|
var g = [
|
|
10
11
|
{
|
|
@@ -59,22 +60,22 @@ var g = [
|
|
|
59
60
|
color: "#1f2937",
|
|
60
61
|
background: "transparent",
|
|
61
62
|
fontSize: 14,
|
|
62
|
-
fontFamily:
|
|
63
|
+
fontFamily: t,
|
|
63
64
|
placeholderColor: "#7a818b",
|
|
64
65
|
lineColor: "#565b66",
|
|
65
66
|
textAlign: "left",
|
|
66
67
|
borderStyle: "solid",
|
|
67
68
|
objectFit: "contain"
|
|
68
|
-
},
|
|
69
|
+
}, oe = 3, se = 28, ce = "contract-template-renderer-1.0.0", le = e, ue = /^[A-Za-z][A-Za-z0-9_]{1,63}$/, y = new Set([
|
|
69
70
|
"pageNumber",
|
|
70
71
|
"totalPages",
|
|
71
72
|
"rendererVersion"
|
|
72
73
|
]);
|
|
73
74
|
function b(e, t, n) {
|
|
74
75
|
let r = typeof e == "string" ? e.trim() : "";
|
|
75
|
-
return r ?
|
|
76
|
+
return r ? ue.test(r) ? y.has(r) ? `${r} 是系统保留标识` : t.some((e) => e.id !== n && e.key.trim() === r) ? `变量标识 ${r} 已存在` : "" : "变量标识需以字母开头,仅包含字母、数字和下划线,长度为 2~64 位" : "请输入变量标识";
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function de(e) {
|
|
78
79
|
let t = Number(e);
|
|
79
80
|
return Number.isFinite(t) && t >= 1 ? Math.max(1, Math.floor(t)) : 20;
|
|
80
81
|
}
|
|
@@ -226,7 +227,7 @@ function I(e, t) {
|
|
|
226
227
|
let n = P(e);
|
|
227
228
|
return t.find((e) => P(e) === n);
|
|
228
229
|
}
|
|
229
|
-
function
|
|
230
|
+
function fe(e, t) {
|
|
230
231
|
let n = F(t), r = n[0], i = N(e.pageSize, r), a = I(i, n) ?? r, o = /* @__PURE__ */ new Map(), s = e.pages.map((e) => {
|
|
231
232
|
let t = N(e.pageSize, i), a = I(t, n) ?? r;
|
|
232
233
|
return P(t) !== P(a) && o.set(e.id, {
|
|
@@ -272,7 +273,7 @@ function B(e = _) {
|
|
|
272
273
|
pageSize: t
|
|
273
274
|
};
|
|
274
275
|
}
|
|
275
|
-
function
|
|
276
|
+
function pe(e = _) {
|
|
276
277
|
let t = N(e);
|
|
277
278
|
return {
|
|
278
279
|
pages: [z(1, t, "<p></p>")],
|
|
@@ -280,11 +281,11 @@ function fe(e = _) {
|
|
|
280
281
|
pageSize: t
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
+
function V(e, t = C) {
|
|
284
285
|
return t.find((t) => t.type === e) ?? D.find((t) => t.type === e) ?? C[0];
|
|
285
286
|
}
|
|
286
|
-
function
|
|
287
|
-
let r = e.type === void 0 ? "text" : e.type, i =
|
|
287
|
+
function H(e, t = C, n = {}) {
|
|
288
|
+
let r = e.type === void 0 ? "text" : e.type, i = V(r, t), a = me(r);
|
|
288
289
|
return {
|
|
289
290
|
id: e.id ?? k("variable"),
|
|
290
291
|
key: e.key,
|
|
@@ -381,8 +382,8 @@ function me(e) {
|
|
|
381
382
|
underline: !0
|
|
382
383
|
} };
|
|
383
384
|
}
|
|
384
|
-
function
|
|
385
|
-
return e !== void 0 && !
|
|
385
|
+
function U(e) {
|
|
386
|
+
return e !== void 0 && !re(e);
|
|
386
387
|
}
|
|
387
388
|
function he(e, t = _) {
|
|
388
389
|
if (!e) return B(t);
|
|
@@ -394,23 +395,23 @@ function he(e, t = _) {
|
|
|
394
395
|
contentJson: e.contentJson
|
|
395
396
|
})), i = [], a = /* @__PURE__ */ new Map();
|
|
396
397
|
return Object.fromEntries(r.map((e) => [e.id, N(e.pageSize, n)])), (e.variables ?? []).forEach((e) => {
|
|
397
|
-
let t =
|
|
398
|
+
let t = H({
|
|
398
399
|
...e,
|
|
399
400
|
id: e.id || k("variable"),
|
|
400
401
|
options: Array.isArray(e.options) ? e.options : []
|
|
401
402
|
});
|
|
402
403
|
i.push(t), t.key && a.set(t.key, t);
|
|
403
404
|
}), r.forEach((e) => {
|
|
404
|
-
|
|
405
|
+
Oe(e).forEach((e) => {
|
|
405
406
|
if (!e.key) return;
|
|
406
407
|
let t = a.get(e.key);
|
|
407
408
|
if (!t) {
|
|
408
|
-
let t =
|
|
409
|
+
let t = H(e);
|
|
409
410
|
i.push(t), a.set(e.key, t);
|
|
410
411
|
return;
|
|
411
412
|
}
|
|
412
|
-
if (
|
|
413
|
-
let n =
|
|
413
|
+
if (U(e.type)) {
|
|
414
|
+
let n = H({
|
|
414
415
|
...t,
|
|
415
416
|
type: e.type
|
|
416
417
|
});
|
|
@@ -427,41 +428,41 @@ function he(e, t = _) {
|
|
|
427
428
|
};
|
|
428
429
|
}
|
|
429
430
|
function ge(e) {
|
|
430
|
-
return e.pages.map((t, n) =>
|
|
431
|
+
return e.pages.map((t, n) => Te(e, t, n, t.contentHtml, {})).join("\n");
|
|
431
432
|
}
|
|
432
|
-
function
|
|
433
|
-
return e.pages.map((t, n) =>
|
|
433
|
+
function W(e) {
|
|
434
|
+
return e.pages.map((t, n) => Te(e, t, n, Ve(t.contentHtml))).join("\n");
|
|
434
435
|
}
|
|
435
436
|
function _e(e) {
|
|
436
|
-
return
|
|
437
|
+
return G(e).map(({ page: t, contentHtml: n }, r) => {
|
|
437
438
|
let i = N(t.pageSize, e.pageSize), a = f(e.pageDecorations, r + 1, e.pages.length, e.variables, {});
|
|
438
|
-
return `<section ${
|
|
439
|
+
return `<section ${Ee(t, e.pageSize, e.pageDecorations, r + 1)} style="width:${i.width}px;min-height:${i.height}px">${a}<div class="gd-contract-template-page__content">${n}</div></section>`;
|
|
439
440
|
}).join("\n");
|
|
440
441
|
}
|
|
441
|
-
function
|
|
442
|
+
function G(e) {
|
|
442
443
|
let t = new Map(e.variables.map((e) => [e.key, e]));
|
|
443
444
|
return e.pages.map((e) => ({
|
|
444
445
|
page: {
|
|
445
446
|
...e,
|
|
446
447
|
...e.pageSize ? { pageSize: { ...e.pageSize } } : {}
|
|
447
448
|
},
|
|
448
|
-
contentHtml:
|
|
449
|
+
contentHtml: je(e.contentHtml, t)
|
|
449
450
|
}));
|
|
450
451
|
}
|
|
451
|
-
var
|
|
452
|
+
var K = class extends Error {
|
|
452
453
|
constructor(e) {
|
|
453
454
|
super(e[0]?.message || "页面装饰配置无效"), this.errors = e, this.name = "ContractTemplatePageDecorationValidationError";
|
|
454
455
|
}
|
|
455
456
|
};
|
|
456
457
|
function ve(e) {
|
|
457
458
|
let t = m(e.pageDecorations, e.variables);
|
|
458
|
-
if (t.length) throw new
|
|
459
|
+
if (t.length) throw new K(t);
|
|
459
460
|
let n = A(e);
|
|
460
461
|
return n.pageDecorations &&= p(n.pageDecorations), {
|
|
461
462
|
...n,
|
|
462
|
-
rendererVersion:
|
|
463
|
-
styleVersion:
|
|
464
|
-
html:
|
|
463
|
+
rendererVersion: ce,
|
|
464
|
+
styleVersion: le,
|
|
465
|
+
html: W(n)
|
|
465
466
|
};
|
|
466
467
|
}
|
|
467
468
|
function ye(e, t = {}) {
|
|
@@ -486,7 +487,7 @@ function ye(e, t = {}) {
|
|
|
486
487
|
variableKey: t.key,
|
|
487
488
|
message: `变量标识 ${t.key} 重复`,
|
|
488
489
|
code: "VARIABLE_KEY_DUPLICATED"
|
|
489
|
-
}), r.add(t.key)),
|
|
490
|
+
}), r.add(t.key)), U(t.type) && n.push({
|
|
490
491
|
type: "variable",
|
|
491
492
|
id: t.id,
|
|
492
493
|
variableKey: t.key,
|
|
@@ -494,9 +495,9 @@ function ye(e, t = {}) {
|
|
|
494
495
|
code: "VARIABLE_TYPE_UNSUPPORTED"
|
|
495
496
|
});
|
|
496
497
|
});
|
|
497
|
-
let i = new Set(e.variables.map((e) => e.key).filter(Boolean)), a = /* @__PURE__ */ new Set(), o =
|
|
498
|
+
let i = new Set(e.variables.map((e) => e.key).filter(Boolean)), a = /* @__PURE__ */ new Set(), o = ne(e.pageDecorations);
|
|
498
499
|
return e.pages.forEach((e) => {
|
|
499
|
-
|
|
500
|
+
q(e).forEach((t) => {
|
|
500
501
|
a.add(t), i.has(t) || n.push({
|
|
501
502
|
type: "variable",
|
|
502
503
|
id: e.id,
|
|
@@ -511,7 +512,7 @@ function ye(e, t = {}) {
|
|
|
511
512
|
});
|
|
512
513
|
}), n.push(...m(e.pageDecorations, e.variables)), n;
|
|
513
514
|
}
|
|
514
|
-
function
|
|
515
|
+
function q(e) {
|
|
515
516
|
let t = /* @__PURE__ */ new Set();
|
|
516
517
|
function n(e) {
|
|
517
518
|
if (!e || typeof e != "object") return;
|
|
@@ -529,14 +530,14 @@ function K(e) {
|
|
|
529
530
|
function be(e) {
|
|
530
531
|
return e === "templateVariable" || e === "templateField";
|
|
531
532
|
}
|
|
532
|
-
function
|
|
533
|
+
function J(e) {
|
|
533
534
|
let t = /* @__PURE__ */ new Set();
|
|
534
535
|
return e.pages.forEach((e) => {
|
|
535
|
-
|
|
536
|
+
q(e).forEach((e) => t.add(e));
|
|
536
537
|
}), t;
|
|
537
538
|
}
|
|
538
|
-
function
|
|
539
|
-
let n =
|
|
539
|
+
function Y(e, t = J(e)) {
|
|
540
|
+
let n = ne(e.pageDecorations), r = /* @__PURE__ */ new Map();
|
|
540
541
|
for (let t of e.variables) r.set(t.key, (r.get(t.key) ?? 0) + 1);
|
|
541
542
|
return {
|
|
542
543
|
...e,
|
|
@@ -546,11 +547,11 @@ function J(e, t = q(e)) {
|
|
|
546
547
|
function xe() {
|
|
547
548
|
let e = /* @__PURE__ */ new Map();
|
|
548
549
|
function t(t) {
|
|
549
|
-
let n = t.contentJson &&
|
|
550
|
+
let n = t.contentJson && ae(t.contentJson), r = e.get(t.id);
|
|
550
551
|
return (!r || r.html !== t.contentHtml || r.json !== n) && (r = {
|
|
551
552
|
html: t.contentHtml,
|
|
552
553
|
json: n,
|
|
553
|
-
keys:
|
|
554
|
+
keys: q(t)
|
|
554
555
|
}, e.set(t.id, r)), r;
|
|
555
556
|
}
|
|
556
557
|
function n(n) {
|
|
@@ -564,14 +565,14 @@ function xe() {
|
|
|
564
565
|
let r = n(e), i = e.variables.slice(), a = new Map(i.filter((e) => e.key).map((e) => [e.key, e]));
|
|
565
566
|
for (let n of e.pages) {
|
|
566
567
|
let e = t(n);
|
|
567
|
-
e.variables ??=
|
|
568
|
+
e.variables ??= Oe(n);
|
|
568
569
|
for (let t of e.variables) {
|
|
569
570
|
let e = a.get(t.key);
|
|
570
571
|
if (!e) {
|
|
571
|
-
let e =
|
|
572
|
+
let e = H(t);
|
|
572
573
|
i.push(e), a.set(e.key, e);
|
|
573
|
-
} else if (
|
|
574
|
-
let n =
|
|
574
|
+
} else if (U(t.type) && e.type !== t.type) {
|
|
575
|
+
let n = H({
|
|
575
576
|
...e,
|
|
576
577
|
type: t.type
|
|
577
578
|
}), r = i.findIndex((t) => t.id === e.id);
|
|
@@ -579,7 +580,7 @@ function xe() {
|
|
|
579
580
|
}
|
|
580
581
|
}
|
|
581
582
|
}
|
|
582
|
-
let o =
|
|
583
|
+
let o = Y({
|
|
583
584
|
...e,
|
|
584
585
|
variables: i
|
|
585
586
|
}, r);
|
|
@@ -646,51 +647,51 @@ function we(e, t, n) {
|
|
|
646
647
|
overflowContent: r.slice(a)
|
|
647
648
|
};
|
|
648
649
|
}
|
|
649
|
-
function
|
|
650
|
+
function Te(e, t, n, r, i) {
|
|
650
651
|
let a = f(e.pageDecorations, n + 1, e.pages.length, e.variables, i);
|
|
651
|
-
return `<section ${
|
|
652
|
+
return `<section ${Ee(t, e.pageSize, e.pageDecorations, n + 1)}>${a}<div class="gd-contract-template-page__content">${r}</div></section>`;
|
|
652
653
|
}
|
|
653
|
-
function
|
|
654
|
-
let
|
|
654
|
+
function Ee(e, t, n, r = 1) {
|
|
655
|
+
let i = N(e.pageSize, t);
|
|
655
656
|
return [
|
|
656
|
-
`class="${
|
|
657
|
-
`data-page-id="${
|
|
658
|
-
`data-page-format="${i
|
|
659
|
-
`data-page-label="${i
|
|
660
|
-
`data-page-width="${
|
|
661
|
-
`data-page-height="${
|
|
657
|
+
`class="${te(n, r)}"`,
|
|
658
|
+
`data-page-id="${a(e.id)}"`,
|
|
659
|
+
`data-page-format="${a(i.format ?? "Custom")}"`,
|
|
660
|
+
`data-page-label="${a(i.label ?? i.format ?? "自定义")}"`,
|
|
661
|
+
`data-page-width="${i.width}"`,
|
|
662
|
+
`data-page-height="${i.height}"`
|
|
662
663
|
].join(" ");
|
|
663
664
|
}
|
|
664
|
-
var
|
|
665
|
-
function
|
|
666
|
-
let
|
|
665
|
+
var De = /<span\b[^>]*data-template-variable=["']true["'][^>]*>/g;
|
|
666
|
+
function Oe(e) {
|
|
667
|
+
let t = /* @__PURE__ */ new Map();
|
|
667
668
|
function a(e) {
|
|
668
669
|
if (!e.key) return;
|
|
669
|
-
let
|
|
670
|
-
(!
|
|
670
|
+
let n = t.get(e.key);
|
|
671
|
+
(!n || U(e.type) && !U(n.type)) && t.set(e.key, e);
|
|
671
672
|
}
|
|
672
|
-
function
|
|
673
|
+
function o(e) {
|
|
673
674
|
if (!e || typeof e != "object") return;
|
|
674
675
|
let t = e;
|
|
675
|
-
t.type === "templateVariable" && typeof t.attrs?.key == "string" && a(
|
|
676
|
+
t.type === "templateVariable" && typeof t.attrs?.key == "string" && a(Ae(t.attrs, t.attrs.key)), t.content?.forEach(o);
|
|
676
677
|
}
|
|
677
|
-
|
|
678
|
+
o(e.contentJson);
|
|
678
679
|
let c = e.contentHtml || "";
|
|
679
|
-
return
|
|
680
|
-
a(
|
|
681
|
-
}) :
|
|
682
|
-
a(
|
|
683
|
-
}), Array.from(
|
|
680
|
+
return n() ? new DOMParser().parseFromString(c, "text/html").querySelectorAll("[data-template-variable]").forEach((e) => {
|
|
681
|
+
a(ke(r(e)));
|
|
682
|
+
}) : s(c, De, (e) => {
|
|
683
|
+
a(ke(i(e)));
|
|
684
|
+
}), Array.from(t.values());
|
|
684
685
|
}
|
|
685
|
-
function
|
|
686
|
+
function ke(e) {
|
|
686
687
|
let t = e("data-key") ?? "", n = e("data-variable-type"), r = e("data-precision"), i = e("data-use-grouping");
|
|
687
688
|
return {
|
|
688
689
|
key: t,
|
|
689
690
|
label: e("data-label") ?? t,
|
|
690
691
|
type: n ?? "text",
|
|
691
692
|
placeholder: e("data-placeholder") ?? "",
|
|
692
|
-
width:
|
|
693
|
-
height:
|
|
693
|
+
width: c(e("data-width"), 160),
|
|
694
|
+
height: c(e("data-height"), 32),
|
|
694
695
|
required: e("data-required") === "true",
|
|
695
696
|
defaultValue: e("data-default-value") ?? "",
|
|
696
697
|
format: e("data-format") ?? "",
|
|
@@ -704,14 +705,14 @@ function Oe(e) {
|
|
|
704
705
|
componentKey: e("data-component-key") ?? "",
|
|
705
706
|
componentConfig: h(e("data-component-config")) ?? {},
|
|
706
707
|
multiline: e("data-multiline") === "true",
|
|
707
|
-
rows:
|
|
708
|
-
lineHeight:
|
|
708
|
+
rows: c(e("data-rows"), 3),
|
|
709
|
+
lineHeight: c(e("data-line-height"), 28),
|
|
709
710
|
style: {
|
|
710
|
-
border:
|
|
711
|
-
underline:
|
|
711
|
+
border: l(e("data-border")),
|
|
712
|
+
underline: l(e("data-underline")),
|
|
712
713
|
color: e("data-color"),
|
|
713
714
|
background: e("data-background"),
|
|
714
|
-
fontSize:
|
|
715
|
+
fontSize: c(e("data-font-size"), 14),
|
|
715
716
|
fontFamily: e("data-font-family"),
|
|
716
717
|
placeholderColor: e("data-placeholder-color"),
|
|
717
718
|
lineColor: e("data-line-color"),
|
|
@@ -721,15 +722,15 @@ function Oe(e) {
|
|
|
721
722
|
}
|
|
722
723
|
};
|
|
723
724
|
}
|
|
724
|
-
function
|
|
725
|
+
function Ae(e, t) {
|
|
725
726
|
let n = (t) => typeof e[t] == "string" ? e[t] : void 0;
|
|
726
727
|
return {
|
|
727
728
|
key: t,
|
|
728
729
|
label: n("label") ?? t,
|
|
729
730
|
type: e.type === void 0 ? "text" : e.type,
|
|
730
731
|
placeholder: n("placeholder") ?? "",
|
|
731
|
-
width:
|
|
732
|
-
height:
|
|
732
|
+
width: c(e.width, 160),
|
|
733
|
+
height: c(e.height, 32),
|
|
733
734
|
required: e.required === !0,
|
|
734
735
|
defaultValue: n("defaultValue") ?? "",
|
|
735
736
|
format: n("format") ?? "",
|
|
@@ -743,14 +744,14 @@ function ke(e, t) {
|
|
|
743
744
|
componentKey: n("componentKey") ?? "",
|
|
744
745
|
componentConfig: e.componentConfig,
|
|
745
746
|
multiline: e.multiline === !0,
|
|
746
|
-
rows:
|
|
747
|
-
lineHeight:
|
|
747
|
+
rows: c(e.rows, 3),
|
|
748
|
+
lineHeight: c(e.lineHeight, 28),
|
|
748
749
|
style: {
|
|
749
750
|
border: typeof e.border == "boolean" ? e.border : void 0,
|
|
750
751
|
underline: typeof e.underline == "boolean" ? e.underline : void 0,
|
|
751
752
|
color: n("color"),
|
|
752
753
|
background: n("background"),
|
|
753
|
-
fontSize:
|
|
754
|
+
fontSize: c(e.fontSize, 14),
|
|
754
755
|
fontFamily: n("fontFamily"),
|
|
755
756
|
placeholderColor: n("placeholderColor"),
|
|
756
757
|
lineColor: n("lineColor"),
|
|
@@ -760,20 +761,20 @@ function ke(e, t) {
|
|
|
760
761
|
}
|
|
761
762
|
};
|
|
762
763
|
}
|
|
763
|
-
function
|
|
764
|
+
function je(e, t) {
|
|
764
765
|
if (!e) return e;
|
|
765
|
-
if (
|
|
766
|
-
let
|
|
767
|
-
return
|
|
768
|
-
|
|
769
|
-
}),
|
|
766
|
+
if (n()) {
|
|
767
|
+
let n = new DOMParser().parseFromString(e, "text/html");
|
|
768
|
+
return Me(n), n.querySelectorAll("[data-template-variable]").forEach((e) => {
|
|
769
|
+
Fe(e, t);
|
|
770
|
+
}), n.body.innerHTML;
|
|
770
771
|
}
|
|
771
|
-
return
|
|
772
|
-
let
|
|
773
|
-
return
|
|
772
|
+
return d(Le(e), (e, n) => {
|
|
773
|
+
let r = i(n);
|
|
774
|
+
return r("data-key") ? Ie(r, t) : e;
|
|
774
775
|
});
|
|
775
776
|
}
|
|
776
|
-
function
|
|
777
|
+
function Me(e) {
|
|
777
778
|
e.querySelectorAll("script,style,meta,link").forEach((e) => e.remove()), e.querySelectorAll("*").forEach((e) => {
|
|
778
779
|
Array.from(e.attributes).forEach((t) => {
|
|
779
780
|
let n = t.name.toLowerCase(), r = t.value;
|
|
@@ -785,60 +786,60 @@ function je(e) {
|
|
|
785
786
|
e.removeAttribute(t.name);
|
|
786
787
|
return;
|
|
787
788
|
}
|
|
788
|
-
n === "style" &&
|
|
789
|
+
n === "style" && Be(r) && e.removeAttribute(t.name);
|
|
789
790
|
});
|
|
790
791
|
});
|
|
791
792
|
}
|
|
792
|
-
function
|
|
793
|
-
let n = e("data-key") ?? "", r = t.get(n), i = r?.type ?? e("data-variable-type") ?? "text", a =
|
|
793
|
+
function Ne(e, t) {
|
|
794
|
+
let n = e("data-key") ?? "", r = t.get(n), i = r?.type ?? e("data-variable-type") ?? "text", a = ze(i, r?.defaultValue ?? e("data-default-value") ?? ""), o = Pe(r, e), s = r ? !!r.multiple : e("data-multiple") === "true", c = ee({
|
|
794
795
|
type: i,
|
|
795
796
|
width: r?.width ?? e("data-width"),
|
|
796
797
|
height: r?.height ?? e("data-height"),
|
|
797
798
|
defaultValue: a,
|
|
798
799
|
placeholder: r?.placeholder ?? e("data-placeholder") ?? "",
|
|
799
800
|
format: r?.format ?? e("data-format") ?? "",
|
|
800
|
-
precision: r?.precision ??
|
|
801
|
-
useGrouping: r?.useGrouping ??
|
|
801
|
+
precision: r?.precision ?? u(e("data-precision")),
|
|
802
|
+
useGrouping: r?.useGrouping ?? l(e("data-use-grouping")),
|
|
802
803
|
checkedText: r?.checkedText ?? e("data-checked-text") ?? "",
|
|
803
804
|
uncheckedText: r?.uncheckedText ?? e("data-unchecked-text") ?? "",
|
|
804
|
-
multiline: r?.multiline ??
|
|
805
|
+
multiline: r?.multiline ?? l(e("data-multiline")) ?? !1,
|
|
805
806
|
rows: r?.rows ?? e("data-rows"),
|
|
806
807
|
lineHeight: r?.lineHeight ?? e("data-line-height"),
|
|
807
808
|
options: o,
|
|
808
809
|
multiple: s,
|
|
809
|
-
style:
|
|
810
|
-
}), d =
|
|
810
|
+
style: Re(r, e)
|
|
811
|
+
}), d = c.type === "radio" && o.length ? ie(o, a) : "";
|
|
811
812
|
return {
|
|
812
813
|
key: n,
|
|
813
814
|
label: r?.label ?? e("data-label") ?? n,
|
|
814
|
-
presentation:
|
|
815
|
+
presentation: c,
|
|
815
816
|
radioHtml: d,
|
|
816
|
-
text:
|
|
817
|
+
text: c.type === "image" && c.hasDefaultValue ? " " : c.type === "radio" && !d ? r?.placeholder || e("data-placeholder") || " " : c.displayText || " "
|
|
817
818
|
};
|
|
818
819
|
}
|
|
819
|
-
function
|
|
820
|
+
function Pe(e, t) {
|
|
820
821
|
if (e) return Array.isArray(e.options) ? e.options : [];
|
|
821
822
|
let n = h(t("data-control-options"));
|
|
822
823
|
return Array.isArray(n) ? n : [];
|
|
823
824
|
}
|
|
824
|
-
function Pe(e, t) {
|
|
825
|
-
let { key: r, label: i, presentation: a, radioHtml: o, text: s } = Me(n(e), t);
|
|
826
|
-
e.setAttribute("data-template-variable", "true"), e.setAttribute("data-key", r), e.setAttribute("data-label", i), e.setAttribute("data-variable-type", a.type), e.setAttribute("data-width", String(a.width)), e.setAttribute("data-height", String(a.height)), e.setAttribute("data-border", String(a.border)), e.setAttribute("data-underline", String(a.underline)), e.setAttribute("data-color", a.color), e.setAttribute("data-background", a.background), e.setAttribute("data-font-size", String(a.fontSize)), e.setAttribute("data-font-family", a.fontFamily), e.setAttribute("data-placeholder-color", a.placeholderColor), e.setAttribute("data-line-color", a.lineColor), e.setAttribute("data-text-align", a.textAlign), e.setAttribute("data-border-style", a.borderStyle), e.setAttribute("data-object-fit", a.objectFit), e.className = a.classes.join(" "), e.setAttribute("style", a.styleText), o ? e.innerHTML = o : e.textContent = s;
|
|
827
|
-
}
|
|
828
825
|
function Fe(e, t) {
|
|
829
|
-
let { key: n, label:
|
|
830
|
-
|
|
826
|
+
let { key: n, label: i, presentation: a, radioHtml: o, text: s } = Ne(r(e), t);
|
|
827
|
+
e.setAttribute("data-template-variable", "true"), e.setAttribute("data-key", n), e.setAttribute("data-label", i), e.setAttribute("data-variable-type", a.type), e.setAttribute("data-width", String(a.width)), e.setAttribute("data-height", String(a.height)), e.setAttribute("data-border", String(a.border)), e.setAttribute("data-underline", String(a.underline)), e.setAttribute("data-color", a.color), e.setAttribute("data-background", a.background), e.setAttribute("data-font-size", String(a.fontSize)), e.setAttribute("data-font-family", a.fontFamily), e.setAttribute("data-placeholder-color", a.placeholderColor), e.setAttribute("data-line-color", a.lineColor), e.setAttribute("data-text-align", a.textAlign), e.setAttribute("data-border-style", a.borderStyle), e.setAttribute("data-object-fit", a.objectFit), e.className = a.classes.join(" "), e.setAttribute("style", a.styleText), o ? e.innerHTML = o : e.textContent = s;
|
|
831
828
|
}
|
|
832
|
-
function Ie(e) {
|
|
833
|
-
|
|
829
|
+
function Ie(e, t) {
|
|
830
|
+
let { key: n, label: r, presentation: i, radioHtml: s, text: c } = Ne(e, t);
|
|
831
|
+
return `<span data-template-variable="true" data-key="${a(n)}" data-label="${a(r)}" data-variable-type="${a(i.type)}" data-width="${i.width}" data-height="${i.height}" data-border="${i.border}" data-underline="${i.underline}" data-font-family="${a(i.fontFamily)}" class="${a(i.classes.join(" "))}" style="${a(i.styleText)}">${s || o(c)}</span>`;
|
|
834
832
|
}
|
|
835
|
-
function Le(e
|
|
833
|
+
function Le(e) {
|
|
834
|
+
return e.replace(/<\s*(script|style|meta|link)\b[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/<\s*(meta|link)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+srcdoc\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(href|src)\s*=\s*(["'])(.*?)\2/gi, (e, t, n, r) => X(r) ? "" : ` ${t}=${n}${r}${n}`).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => Be(n) ? "" : ` style=${t}${n}${t}`);
|
|
835
|
+
}
|
|
836
|
+
function Re(e, t) {
|
|
836
837
|
return {
|
|
837
|
-
border: e?.style?.border ??
|
|
838
|
-
underline: e?.style?.underline ??
|
|
838
|
+
border: e?.style?.border ?? l(t("data-border")),
|
|
839
|
+
underline: e?.style?.underline ?? l(t("data-underline")),
|
|
839
840
|
color: e?.style?.color ?? t("data-color"),
|
|
840
841
|
background: e?.style?.background ?? t("data-background"),
|
|
841
|
-
fontSize: e?.style?.fontSize ??
|
|
842
|
+
fontSize: e?.style?.fontSize ?? u(t("data-font-size")),
|
|
842
843
|
fontFamily: e?.style?.fontFamily ?? t("data-font-family"),
|
|
843
844
|
placeholderColor: e?.style?.placeholderColor ?? t("data-placeholder-color"),
|
|
844
845
|
lineColor: e?.style?.lineColor ?? t("data-line-color"),
|
|
@@ -847,47 +848,47 @@ function Le(e, t) {
|
|
|
847
848
|
objectFit: e?.style?.objectFit ?? $(t("data-object-fit"))
|
|
848
849
|
};
|
|
849
850
|
}
|
|
850
|
-
function
|
|
851
|
+
function ze(e, t) {
|
|
851
852
|
return e === "image" && X(t) ? "" : t;
|
|
852
853
|
}
|
|
853
854
|
function X(e) {
|
|
854
855
|
let t = e.trim().replace(/[\u0000-\u001F\s]+/g, "").toLowerCase();
|
|
855
856
|
return t.startsWith("javascript:") || t.startsWith("vbscript:") || t.startsWith("data:") && !t.startsWith("data:image/");
|
|
856
857
|
}
|
|
857
|
-
function
|
|
858
|
+
function Be(e) {
|
|
858
859
|
return /expression\s*\(|javascript:|vbscript:/i.test(e);
|
|
859
860
|
}
|
|
860
|
-
function
|
|
861
|
+
function Ve(e) {
|
|
861
862
|
if (!e) return e;
|
|
862
|
-
if (
|
|
863
|
+
if (n()) {
|
|
863
864
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
864
865
|
return t.querySelectorAll("[data-template-variable]").forEach((e) => {
|
|
865
866
|
let t = e.dataset.key || "";
|
|
866
867
|
t && (e.textContent = `\${{${t}}}`);
|
|
867
868
|
}), t.body.innerHTML;
|
|
868
869
|
}
|
|
869
|
-
return
|
|
870
|
-
let n =
|
|
870
|
+
return d(e, (e, t) => {
|
|
871
|
+
let n = i(t)("data-key");
|
|
871
872
|
return n ? `<span${t}>\${{${n}}}</span>` : e;
|
|
872
873
|
});
|
|
873
874
|
}
|
|
874
|
-
function
|
|
875
|
+
function He(e) {
|
|
875
876
|
return e === "left" || e === "center" || e === "right";
|
|
876
877
|
}
|
|
877
|
-
function
|
|
878
|
+
function Ue(e) {
|
|
878
879
|
return e === "solid" || e === "dashed";
|
|
879
880
|
}
|
|
880
|
-
function
|
|
881
|
+
function We(e) {
|
|
881
882
|
return e === "contain" || e === "cover" || e === "fill";
|
|
882
883
|
}
|
|
883
884
|
function Z(e) {
|
|
884
|
-
return
|
|
885
|
+
return He(e) ? e : void 0;
|
|
885
886
|
}
|
|
886
887
|
function Q(e) {
|
|
887
|
-
return
|
|
888
|
+
return Ue(e) ? e : void 0;
|
|
888
889
|
}
|
|
889
890
|
function $(e) {
|
|
890
|
-
return
|
|
891
|
+
return We(e) ? e : void 0;
|
|
891
892
|
}
|
|
892
893
|
//#endregion
|
|
893
|
-
export { D as ALL_DEFAULT_FIELD_TYPES,
|
|
894
|
+
export { D as ALL_DEFAULT_FIELD_TYPES, ce as CONTRACT_TEMPLATE_RENDERER_VERSION, y as CONTRACT_TEMPLATE_RESERVED_VARIABLE_KEYS, le as CONTRACT_TEMPLATE_STYLE_VERSION, ue as CONTRACT_TEMPLATE_VARIABLE_KEY_PATTERN, K as ContractTemplatePageDecorationValidationError, w as DEFAULT_ADVANCED_CHOICE_FIELD_TYPES, T as DEFAULT_BUILTIN_SELECTOR_FIELD_TYPES, S as DEFAULT_CHECKBOX_FIELD_TYPE, E as DEFAULT_CUSTOM_FIELD_TYPES, v as DEFAULT_FIELD_STYLE, C as DEFAULT_FIELD_TYPES, x as DEFAULT_IMAGE_FIELD_TYPE, se as DEFAULT_MULTILINE_LINE_HEIGHT, oe as DEFAULT_MULTILINE_ROWS, _ as DEFAULT_PAGE_SIZE, g as PAGE_SIZE_OPTIONS, W as buildTemplateExpressionHtml, ge as buildTemplateHtml, _e as buildTemplatePreviewHtml, G as buildTemplatePreviewPages, A as cloneTemplateValue, J as collectTemplateValueVariableKeys, q as collectTemplateVariableKeys, fe as constrainTemplatePageSizes, z as createBlankPage, pe as createBlankTemplate, R as createDefaultPage, B as createDefaultTemplate, k as createDesignerId, xe as createTemplateBodySync, H as createTemplateVariable, ve as exportTemplateValue, I as findPageSizeOption, V as getFieldOption, P as getPageSizeKey, j as getPageSizeOption, M as inferPageFormat, de as normalizeContractTemplateMaxPages, F as normalizePageSizeOptions, he as normalizeTemplateValue, N as resolvePageSize, we as splitPageContentByMeasurements, Y as syncTemplateVariablesWithPages, b as validateContractTemplateVariableKey, ye as validateTemplateValue };
|