@guodun/antdv 1.4.0 → 1.4.2
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 +8 -1
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationInspector.vue.mjs +3 -2
- package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.mjs +4 -1
- package/dist/es/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.mjs +67 -66
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +208 -180
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.mjs +2 -1
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.mjs +690 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +215 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.mjs +87 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.mjs +98 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.mjs +550 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.mjs +117 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.mjs +96 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +51 -26
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +56 -33
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.mjs +29 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.mjs +390 -0
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +313 -267
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1278 -2293
- package/dist/es/components/pro-contract-template-designer/src/composables/use-auto-pagination.mjs +71 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-designer-files.mjs +11 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-draft-cache-session.mjs +111 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.mjs +79 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +189 -160
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-files.mjs +35 -22
- package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +71 -0
- package/dist/es/components/pro-contract-template-designer/src/constants.mjs +71 -10
- package/dist/es/components/pro-contract-template-designer/src/extensions/editor-extensions.mjs +1 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/block-style.mjs +43 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/context-menu-viewport.mjs +13 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/editor-state.mjs +7 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +398 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/serialize-fingerprint.mjs +6 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +88 -72
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +20 -20
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.cjs +1 -0
- 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/ContractTemplateSubmitDataModal.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.cjs +1 -0
- 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/composables/use-auto-pagination.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-designer-files.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-draft-cache-session.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.cjs +1 -0
- 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/composables/use-template-files.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/extensions/editor-extensions.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/block-style.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/context-menu-viewport.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/editor-state.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/serialize-fingerprint.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- 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 +1 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningLocationInspector.vue.d.ts +1 -0
- package/dist/types/components/contract-signing-location/src/types.d.ts +2 -0
- package/dist/types/components/pro-contract-signing-flow/src/types.d.ts +2 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerToolbar.vue.d.ts +104 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +50 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateImageContextMenu.vue.d.ts +27 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorations.vue.d.ts +13 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsInspector.vue.d.ts +28 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePageDecorationsStudio.vue.d.ts +77 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewModal.vue.d.ts +36 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.d.ts +5 -1
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererHeader.vue.d.ts +4 -4
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererToolbar.vue.d.ts +4 -4
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSubmitDataModal.vue.d.ts +12 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextContextMenu.vue.d.ts +77 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +8 -32
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +366 -12
- package/dist/types/components/pro-contract-template-designer/src/composables/use-auto-pagination.d.ts +43 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-designer-files.d.ts +22 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-draft-cache-session.d.ts +41 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-signing-placement-editor.d.ts +49 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +15 -1
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-files.d.ts +13 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.d.ts +19 -0
- package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +7 -1
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +89 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/block-style.d.ts +4 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/context-menu-viewport.d.ts +22 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/editor-state.d.ts +8 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts +90 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/serialize-fingerprint.d.ts +8 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +4 -1
- package/package.json +3 -3
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { escapeHtmlAttribute as e, escapeHtmlText as t } from "./html.mjs";
|
|
2
|
+
import { DEFAULT_CONTRACT_FONT_FAMILY as n } from "../constants.mjs";
|
|
3
|
+
import { resolveTemplateVariablePresentation as r } from "./template-variable-render.mjs";
|
|
4
|
+
//#region src/components/pro-contract-template-designer/src/utils/page-decorations.ts
|
|
5
|
+
var i = {
|
|
6
|
+
top: 54,
|
|
7
|
+
right: 64,
|
|
8
|
+
bottom: 54,
|
|
9
|
+
left: 64
|
|
10
|
+
}, a = {
|
|
11
|
+
sparse: {
|
|
12
|
+
columns: 2,
|
|
13
|
+
rows: 3
|
|
14
|
+
},
|
|
15
|
+
normal: {
|
|
16
|
+
columns: 3,
|
|
17
|
+
rows: 4
|
|
18
|
+
},
|
|
19
|
+
dense: {
|
|
20
|
+
columns: 4,
|
|
21
|
+
rows: 6
|
|
22
|
+
}
|
|
23
|
+
}, o = {
|
|
24
|
+
header: {
|
|
25
|
+
enabled: !1,
|
|
26
|
+
text: "",
|
|
27
|
+
textAlign: "center",
|
|
28
|
+
slots: {
|
|
29
|
+
left: "",
|
|
30
|
+
center: "",
|
|
31
|
+
right: ""
|
|
32
|
+
},
|
|
33
|
+
showOnFirstPage: !0,
|
|
34
|
+
fontFamily: n,
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
fontWeight: 400,
|
|
37
|
+
color: "#565b66",
|
|
38
|
+
offset: 24,
|
|
39
|
+
divider: {
|
|
40
|
+
enabled: !1,
|
|
41
|
+
color: "#d8dadd"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
footer: {
|
|
45
|
+
enabled: !1,
|
|
46
|
+
text: "第 {pageNumber} / {totalPages} 页",
|
|
47
|
+
textAlign: "center",
|
|
48
|
+
slots: {
|
|
49
|
+
left: "",
|
|
50
|
+
center: "第 {pageNumber} / {totalPages} 页",
|
|
51
|
+
right: ""
|
|
52
|
+
},
|
|
53
|
+
showOnFirstPage: !0,
|
|
54
|
+
fontFamily: n,
|
|
55
|
+
fontSize: 12,
|
|
56
|
+
fontWeight: 400,
|
|
57
|
+
color: "#565b66",
|
|
58
|
+
offset: 24,
|
|
59
|
+
divider: {
|
|
60
|
+
enabled: !1,
|
|
61
|
+
color: "#d8dadd"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
watermark: {
|
|
65
|
+
enabled: !1,
|
|
66
|
+
text: "",
|
|
67
|
+
fontSize: 36,
|
|
68
|
+
color: "#7a818b",
|
|
69
|
+
opacity: .14,
|
|
70
|
+
rotation: -30,
|
|
71
|
+
showOnFirstPage: !0,
|
|
72
|
+
layout: "single",
|
|
73
|
+
density: "normal"
|
|
74
|
+
},
|
|
75
|
+
pageNumbering: { countFirstPage: !0 }
|
|
76
|
+
}, s = /^#[\da-f]{6}$/i, c = /^[A-Za-z][A-Za-z0-9_]{1,63}$/, l = /\$\{\{[\s\S]*?\}\}|\$\{\{|\$\{[^{}]*\}|\{[A-Za-z][A-Za-z0-9]*\}/g;
|
|
77
|
+
function u(e) {
|
|
78
|
+
return {
|
|
79
|
+
header: D(e?.header, o.header),
|
|
80
|
+
footer: D(e?.footer, o.footer),
|
|
81
|
+
watermark: O(e?.watermark),
|
|
82
|
+
pageNumbering: { countFirstPage: e?.pageNumbering?.countFirstPage !== !1 }
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function d(e) {
|
|
86
|
+
let t = u();
|
|
87
|
+
return e === "none" ? t : (t.footer = D({
|
|
88
|
+
...t.footer,
|
|
89
|
+
enabled: !0,
|
|
90
|
+
slots: {
|
|
91
|
+
left: "",
|
|
92
|
+
center: "第 {pageNumber} / {totalPages} 页",
|
|
93
|
+
right: ""
|
|
94
|
+
}
|
|
95
|
+
}, o.footer), (e === "internal-review" || e === "draft") && (t.watermark = O({
|
|
96
|
+
...t.watermark,
|
|
97
|
+
enabled: !0,
|
|
98
|
+
text: e === "internal-review" ? "内部审阅" : "草稿",
|
|
99
|
+
layout: "tiled",
|
|
100
|
+
density: "normal"
|
|
101
|
+
})), t);
|
|
102
|
+
}
|
|
103
|
+
function f(e) {
|
|
104
|
+
let t = JSON.stringify(u(e));
|
|
105
|
+
return [
|
|
106
|
+
"none",
|
|
107
|
+
"page-number",
|
|
108
|
+
"internal-review",
|
|
109
|
+
"draft"
|
|
110
|
+
].find((e) => JSON.stringify(d(e)) === t) ?? "custom";
|
|
111
|
+
}
|
|
112
|
+
function p(e, t = 1) {
|
|
113
|
+
let n = u(e).header;
|
|
114
|
+
return I(n, t);
|
|
115
|
+
}
|
|
116
|
+
function m(e, t = 1) {
|
|
117
|
+
let n = u(e).footer;
|
|
118
|
+
return I(n, t);
|
|
119
|
+
}
|
|
120
|
+
function h(e, t = 1) {
|
|
121
|
+
let n = u(e).watermark;
|
|
122
|
+
return n.enabled && !!n.text.trim() && (t !== 1 || n.showOnFirstPage);
|
|
123
|
+
}
|
|
124
|
+
function g(e, t, n = !0) {
|
|
125
|
+
let r = Math.max(1, Math.floor(e || 1)), i = Math.max(0, Math.floor(t || 0));
|
|
126
|
+
return {
|
|
127
|
+
pageNumber: n ? String(r) : r === 1 ? "" : String(r - 1),
|
|
128
|
+
totalPages: String(n ? i : Math.max(0, i - 1))
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function _(e, t = [], n = !1) {
|
|
132
|
+
let r = [], i = [], a = new Map(t.map((e) => [e.key, e])), o = 0;
|
|
133
|
+
l.lastIndex = 0;
|
|
134
|
+
let s = l.exec(e);
|
|
135
|
+
for (; s;) {
|
|
136
|
+
s.index > o && r.push({
|
|
137
|
+
type: "text",
|
|
138
|
+
value: e.slice(o, s.index)
|
|
139
|
+
});
|
|
140
|
+
let t = s[0];
|
|
141
|
+
if (t === "{pageNumber}") r.push({ type: "pageNumber" });
|
|
142
|
+
else if (t === "{totalPages}") r.push({ type: "totalPages" });
|
|
143
|
+
else if (t.startsWith("${{") && t.endsWith("}}")) {
|
|
144
|
+
let e = t.slice(3, -2), o = e.trim();
|
|
145
|
+
if (e !== o || !c.test(o)) i.push({
|
|
146
|
+
code: "DECORATION_TOKEN_MALFORMED",
|
|
147
|
+
message: `页面装饰变量令牌 ${t} 格式错误`,
|
|
148
|
+
token: t,
|
|
149
|
+
offset: s.index
|
|
150
|
+
}), r.push({
|
|
151
|
+
type: "text",
|
|
152
|
+
value: t
|
|
153
|
+
});
|
|
154
|
+
else {
|
|
155
|
+
let e = a.get(o);
|
|
156
|
+
n && !e ? i.push({
|
|
157
|
+
code: "DECORATION_VARIABLE_UNKNOWN",
|
|
158
|
+
message: `页面装饰引用了未知变量 ${o}`,
|
|
159
|
+
token: t,
|
|
160
|
+
offset: s.index
|
|
161
|
+
}) : e?.type === "image" && i.push({
|
|
162
|
+
code: "DECORATION_VARIABLE_IMAGE_UNSUPPORTED",
|
|
163
|
+
message: `图片变量 ${o} 不能用于页面装饰`,
|
|
164
|
+
token: t,
|
|
165
|
+
offset: s.index
|
|
166
|
+
}), r.push({
|
|
167
|
+
type: "variable",
|
|
168
|
+
key: o,
|
|
169
|
+
raw: t
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
} else i.push({
|
|
173
|
+
code: "DECORATION_TOKEN_MALFORMED",
|
|
174
|
+
message: `页面装饰令牌 ${t} 格式错误`,
|
|
175
|
+
token: t,
|
|
176
|
+
offset: s.index
|
|
177
|
+
}), r.push({
|
|
178
|
+
type: "text",
|
|
179
|
+
value: t
|
|
180
|
+
});
|
|
181
|
+
o = s.index + t.length, s = l.exec(e);
|
|
182
|
+
}
|
|
183
|
+
return o < e.length && r.push({
|
|
184
|
+
type: "text",
|
|
185
|
+
value: e.slice(o)
|
|
186
|
+
}), {
|
|
187
|
+
tokens: r,
|
|
188
|
+
issues: i
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function v(e) {
|
|
192
|
+
let t = u(e), n = /* @__PURE__ */ new Set();
|
|
193
|
+
return P(t, (e) => {
|
|
194
|
+
_(e).tokens.forEach((e) => {
|
|
195
|
+
e.type === "variable" && n.add(e.key);
|
|
196
|
+
}), R(e).forEach((e) => n.add(e.key));
|
|
197
|
+
}), n;
|
|
198
|
+
}
|
|
199
|
+
function y(e, t) {
|
|
200
|
+
let n = u(e), r = [];
|
|
201
|
+
return P(n, (e, n) => {
|
|
202
|
+
_(e, t, !0).issues.forEach((e, t) => {
|
|
203
|
+
r.push({
|
|
204
|
+
type: "variable",
|
|
205
|
+
id: `${n}-${e.offset}-${t}`,
|
|
206
|
+
variableKey: e.code === "DECORATION_VARIABLE_UNKNOWN" ? e.token.slice(3, -2).trim() : void 0,
|
|
207
|
+
code: e.code,
|
|
208
|
+
message: `${F(n)}:${e.message}`
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
}), r;
|
|
212
|
+
}
|
|
213
|
+
function b(e) {
|
|
214
|
+
if (!e.code?.startsWith("DECORATION_")) return;
|
|
215
|
+
let t = e.id.replace(/-\d+-\d+$/, "");
|
|
216
|
+
if (/^(?:header|footer)\.slots\.(?:left|center|right)$/.test(t) || t === "watermark.text") return t;
|
|
217
|
+
}
|
|
218
|
+
function x(e, t, n) {
|
|
219
|
+
let r = u(e), i = (e) => z(e, t, n);
|
|
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, o.header), r.footer = D(r.footer, o.footer), r;
|
|
221
|
+
}
|
|
222
|
+
function S(e, t, n, r, i, a) {
|
|
223
|
+
if (e.type === "text") return e.value;
|
|
224
|
+
let o = g(r, i, a);
|
|
225
|
+
if (e.type === "pageNumber") return o.pageNumber;
|
|
226
|
+
if (e.type === "totalPages") return o.totalPages;
|
|
227
|
+
let s = t.find((t) => t.key === e.key);
|
|
228
|
+
return !s || s.type === "image" ? e.raw : N(s, n?.[e.key]);
|
|
229
|
+
}
|
|
230
|
+
function C(e) {
|
|
231
|
+
return a[e] ?? a.normal;
|
|
232
|
+
}
|
|
233
|
+
function w(e) {
|
|
234
|
+
let t = D(e, o.header);
|
|
235
|
+
return Math.max(80, t.offset + Math.ceil(t.fontSize * 1.5) + 20);
|
|
236
|
+
}
|
|
237
|
+
function T(e, t = 1) {
|
|
238
|
+
return [
|
|
239
|
+
"gd-contract-template-page",
|
|
240
|
+
p(e, t) ? "has-contract-header" : "",
|
|
241
|
+
m(e, t) ? "has-contract-footer" : ""
|
|
242
|
+
].filter(Boolean).join(" ");
|
|
243
|
+
}
|
|
244
|
+
function E(e, t, n, r = [], i) {
|
|
245
|
+
let a = u(e), o = [];
|
|
246
|
+
return h(a, t) && o.push(j(a.watermark, r, i, t, n, a.pageNumbering.countFirstPage)), p(a, t) && o.push(A("header", a.header, r, i, t, n, a.pageNumbering.countFirstPage)), m(a, t) && o.push(A("footer", a.footer, r, i, t, n, a.pageNumbering.countFirstPage)), o.join("");
|
|
247
|
+
}
|
|
248
|
+
function D(e, t) {
|
|
249
|
+
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;
|
|
250
|
+
return {
|
|
251
|
+
enabled: !!e?.enabled,
|
|
252
|
+
text: r[i],
|
|
253
|
+
textAlign: i,
|
|
254
|
+
slots: r,
|
|
255
|
+
showOnFirstPage: e?.showOnFirstPage !== !1,
|
|
256
|
+
fontFamily: U(e?.fontFamily, t.fontFamily),
|
|
257
|
+
fontSize: W(e?.fontSize, 10, 24, t.fontSize),
|
|
258
|
+
fontWeight: e?.fontWeight === 600 ? 600 : 400,
|
|
259
|
+
color: H(e?.color, t.color),
|
|
260
|
+
offset: W(e?.offset, 12, 48, t.offset),
|
|
261
|
+
divider: {
|
|
262
|
+
enabled: !!e?.divider?.enabled,
|
|
263
|
+
color: H(e?.divider?.color, t.divider.color)
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function O(e) {
|
|
268
|
+
let t = o.watermark;
|
|
269
|
+
return {
|
|
270
|
+
enabled: !!e?.enabled,
|
|
271
|
+
text: V(e?.text, t.text),
|
|
272
|
+
fontSize: W(e?.fontSize, 12, 72, t.fontSize),
|
|
273
|
+
color: H(e?.color, t.color),
|
|
274
|
+
opacity: W(e?.opacity, .04, .5, t.opacity),
|
|
275
|
+
rotation: W(e?.rotation, -90, 90, t.rotation),
|
|
276
|
+
showOnFirstPage: e?.showOnFirstPage !== !1,
|
|
277
|
+
layout: e?.layout === "tiled" ? "tiled" : "single",
|
|
278
|
+
density: e?.density === "sparse" || e?.density === "dense" ? e.density : "normal"
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function k(e, t, n) {
|
|
282
|
+
if (e?.slots && typeof e.slots == "object") return {
|
|
283
|
+
left: V(e.slots.left, ""),
|
|
284
|
+
center: V(e.slots.center, ""),
|
|
285
|
+
right: V(e.slots.right, "")
|
|
286
|
+
};
|
|
287
|
+
let r = {
|
|
288
|
+
left: "",
|
|
289
|
+
center: "",
|
|
290
|
+
right: ""
|
|
291
|
+
};
|
|
292
|
+
return r[n] = V(e?.text, t.text), r;
|
|
293
|
+
}
|
|
294
|
+
function A(t, n, r, i, a, o, s) {
|
|
295
|
+
let c = w(n), l = n.divider.enabled ? `;border-${t === "header" ? "bottom" : "top"}:1px solid ${e(n.divider.color)}` : "", u = `color:${e(n.color)};font-family:${e(n.fontFamily)};font-size:${n.fontSize}px;font-weight:${n.fontWeight};${t === "header" ? "top" : "bottom"}:${n.offset}px${l}`, d = [
|
|
296
|
+
"left",
|
|
297
|
+
"center",
|
|
298
|
+
"right"
|
|
299
|
+
].map((e) => `<div class="gd-contract-template-page__decoration-slot is-${e}">${M(n.slots[e], r, i, a, o, s)}</div>`).join("");
|
|
300
|
+
return `<div class="gd-contract-template-page__${t}" data-decoration-offset="${n.offset}" data-decoration-font-size="${n.fontSize}" data-decoration-safe-padding="${c}" style="${u}">${d}</div>`;
|
|
301
|
+
}
|
|
302
|
+
function j(t, n, r, i, a, o) {
|
|
303
|
+
let s = C(t.density), c = t.layout === "tiled" ? s.columns * s.rows : 1, l = M(t.text, n, r, i, a, o), u = Array.from({ length: c }, () => `<div class="gd-contract-template-page__watermark-item" style="color:${e(t.color)};font-size:${t.fontSize}px;opacity:${t.opacity};transform:rotate(${t.rotation}deg)">${l}</div>`).join(""), d = t.layout === "tiled" ? `--gd-watermark-columns:${s.columns};--gd-watermark-rows:${s.rows}` : "";
|
|
304
|
+
return `<div class="gd-contract-template-page__watermark is-${t.layout} density-${t.density}" data-watermark-layout="${t.layout}" data-watermark-density="${t.density}" aria-hidden="true" style="${d}">${u}</div>`;
|
|
305
|
+
}
|
|
306
|
+
function M(n, r, i, a, o, s) {
|
|
307
|
+
let c = g(a, o, s), l = new Map(r.map((e) => [e.key, e]));
|
|
308
|
+
return _(n).tokens.map((n) => {
|
|
309
|
+
if (n.type === "text") return t(n.value);
|
|
310
|
+
if (n.type === "pageNumber") return t(c.pageNumber);
|
|
311
|
+
if (n.type === "totalPages") return t(c.totalPages);
|
|
312
|
+
let r = l.get(n.key);
|
|
313
|
+
return i !== void 0 && r && r.type !== "image" ? t(N(r, i[n.key])) : `<span class="gd-contract-template-page__variable" data-template-variable="true" data-key="${e(n.key)}" data-label="${e(r?.label ?? n.key)}" data-variable-type="${e(r?.type ?? "text")}">\${{${t(n.key)}}}</span>`;
|
|
314
|
+
}).join("");
|
|
315
|
+
}
|
|
316
|
+
function N(e, t) {
|
|
317
|
+
let n = t == null ? e.defaultValue ?? "" : String(t);
|
|
318
|
+
return r({
|
|
319
|
+
type: e.type,
|
|
320
|
+
defaultValue: n,
|
|
321
|
+
placeholder: e.placeholder,
|
|
322
|
+
format: e.format,
|
|
323
|
+
precision: e.precision,
|
|
324
|
+
useGrouping: e.useGrouping,
|
|
325
|
+
checkedText: e.checkedText,
|
|
326
|
+
uncheckedText: e.uncheckedText,
|
|
327
|
+
style: e.style
|
|
328
|
+
}).displayText || e.placeholder || e.label || e.key;
|
|
329
|
+
}
|
|
330
|
+
function P(e, t) {
|
|
331
|
+
[
|
|
332
|
+
"left",
|
|
333
|
+
"center",
|
|
334
|
+
"right"
|
|
335
|
+
].forEach((n) => {
|
|
336
|
+
t(e.header.slots[n], `header.slots.${n}`), t(e.footer.slots[n], `footer.slots.${n}`);
|
|
337
|
+
}), t(e.watermark.text, "watermark.text");
|
|
338
|
+
}
|
|
339
|
+
function F(e) {
|
|
340
|
+
return {
|
|
341
|
+
"header.slots.left": "页眉左栏",
|
|
342
|
+
"header.slots.center": "页眉中栏",
|
|
343
|
+
"header.slots.right": "页眉右栏",
|
|
344
|
+
"footer.slots.left": "页脚左栏",
|
|
345
|
+
"footer.slots.center": "页脚中栏",
|
|
346
|
+
"footer.slots.right": "页脚右栏",
|
|
347
|
+
"watermark.text": "水印内容"
|
|
348
|
+
}[e] ?? "页面装饰";
|
|
349
|
+
}
|
|
350
|
+
function I(e, t) {
|
|
351
|
+
return e.enabled && Object.values(e.slots).some((e) => e.trim()) && (t !== 1 || e.showOnFirstPage);
|
|
352
|
+
}
|
|
353
|
+
function L(e, t) {
|
|
354
|
+
return {
|
|
355
|
+
left: t(e.left),
|
|
356
|
+
center: t(e.center),
|
|
357
|
+
right: t(e.right)
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function R(e) {
|
|
361
|
+
let t = [], n = /\$\{\{([\s\S]*?)\}\}|\$\{\{\s*([A-Za-z][A-Za-z0-9_]{1,63})(?![A-Za-z0-9_])/g, r = n.exec(e);
|
|
362
|
+
for (; r;) {
|
|
363
|
+
let i = (r[1] ?? r[2] ?? "").trim();
|
|
364
|
+
i && t.push({
|
|
365
|
+
key: i,
|
|
366
|
+
raw: r[0],
|
|
367
|
+
start: r.index,
|
|
368
|
+
end: r.index + r[0].length
|
|
369
|
+
}), r = n.exec(e);
|
|
370
|
+
}
|
|
371
|
+
return t;
|
|
372
|
+
}
|
|
373
|
+
function z(e, t, n) {
|
|
374
|
+
let r = R(e);
|
|
375
|
+
if (!r.length) return e;
|
|
376
|
+
let i = "", a = 0;
|
|
377
|
+
return r.forEach((r) => {
|
|
378
|
+
i += e.slice(a, r.start), i += r.key === t ? n ? `\${{${n}}}` : "" : r.raw, a = r.end;
|
|
379
|
+
}), i + e.slice(a);
|
|
380
|
+
}
|
|
381
|
+
function B(e, t) {
|
|
382
|
+
return e === "left" || e === "right" || e === "center" ? e : t;
|
|
383
|
+
}
|
|
384
|
+
function V(e, t) {
|
|
385
|
+
return (typeof e == "string" ? e : t).slice(0, 240);
|
|
386
|
+
}
|
|
387
|
+
function H(e, t) {
|
|
388
|
+
return typeof e == "string" && s.test(e) ? e : t;
|
|
389
|
+
}
|
|
390
|
+
function U(e, t) {
|
|
391
|
+
return typeof e == "string" && e.replace(/[";{}<>]/g, "").trim().slice(0, 120) || t;
|
|
392
|
+
}
|
|
393
|
+
function W(e, t, n, r) {
|
|
394
|
+
let i = Number(e);
|
|
395
|
+
return Number.isFinite(i) ? Math.min(n, Math.max(t, i)) : r;
|
|
396
|
+
}
|
|
397
|
+
//#endregion
|
|
398
|
+
export { i as CONTRACT_PAGE_BASE_PADDING, T as buildPageDecorationClassNames, E as buildPageDecorationsHtml, v as collectPageDecorationVariableKeys, d as createPageDecorationPreset, w as getPageDecorationSafePadding, C as getWatermarkDensityGrid, m as hasEnabledPageFooter, p as hasEnabledPageHeader, h as hasEnabledPageWatermark, u as normalizePageDecorations, _ as parsePageDecorationText, f as resolvePageDecorationPreset, S as resolvePageDecorationTokenText, b as resolvePageDecorationValidationPath, x as rewritePageDecorationVariableTokens, y as validatePageDecorations };
|