@guodun/antdv 1.7.10 → 1.7.12
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/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +213 -216
- package/dist/es/components/pro-contract-template-designer/src/constants.mjs +7 -7
- package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +23 -23
- package/dist/es/contract-print-css/index.mjs +376 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/constants.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +4 -4
- package/dist/lib/contract-print-css/index.cjs +369 -0
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/types/contract-print-css/index.d.ts +29 -0
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CONTRACT_PRINT_FONT_FAMILY as e, CONTRACT_PRINT_SANS_FONT_FAMILY as t } from "../../../contract-print-css/index.mjs";
|
|
2
|
+
import { SIGNING_MARK_TYPE_LABELS as n } from "./utils/signing-mark.mjs";
|
|
3
3
|
//#region src/components/pro-contract-template-designer/src/constants.ts
|
|
4
|
-
var r =
|
|
4
|
+
var r = e, i = [{
|
|
5
5
|
label: "合同宋体",
|
|
6
6
|
value: r
|
|
7
7
|
}, {
|
|
8
8
|
label: "文档黑体",
|
|
9
|
-
value:
|
|
9
|
+
value: t
|
|
10
10
|
}], a = [
|
|
11
11
|
12,
|
|
12
12
|
14,
|
|
@@ -181,9 +181,9 @@ var g = [
|
|
|
181
181
|
"date",
|
|
182
182
|
"area",
|
|
183
183
|
"line"
|
|
184
|
-
].map((
|
|
185
|
-
markType:
|
|
186
|
-
label: e
|
|
184
|
+
].map((e) => ({
|
|
185
|
+
markType: e,
|
|
186
|
+
label: n[e]
|
|
187
187
|
}));
|
|
188
188
|
//#endregion
|
|
189
189
|
export { s as CONTRACT_BLOCK_STYLES, l as CONTRACT_TEXT_STYLE_PRESETS, d as CONTRACT_TEXT_STYLE_PRESET_COMMANDS, r as DEFAULT_CONTRACT_FONT_FAMILY, i as DEFAULT_FONT_FAMILY_OPTIONS, a as DEFAULT_FONT_SIZE_PRESETS, o as DEFAULT_TEXT_ALIGN_OPTIONS, g as SIGNING_MARK_TOOL_ITEMS, c as getContractBlockStyle, f as getContractTextStylePreset, m as normalizeFontFamilyValue, p as resolveContractTextStylePresetCommands, h as resolveFontFamilyOptions };
|
package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CONTRACT_PRINT_FONT_FAMILY as e, CONTRACT_PRINT_FONT_TIMEOUT_MS as t, CONTRACT_PRINT_METRIC_NORMALIZE_CSS as n, CONTRACT_PRINT_SANS_FONT_FAMILY as r, buildContractPrintCss as i } from "../../../../contract-print-css/index.mjs";
|
|
2
|
+
import { shallowRef as a } from "vue";
|
|
3
3
|
//#region src/components/pro-contract-template-designer/src/utils/contract-print-document.ts
|
|
4
|
-
var o = "gd-contract-print", s = .5, c = "合同签署位置:甲方(Company A)编号 2026-08-31。", l =
|
|
4
|
+
var o = "gd-contract-print", s = .5, c = "合同签署位置:甲方(Company A)编号 2026-08-31。", l = t + 1e3, u = /* @__PURE__ */ new Set();
|
|
5
5
|
function d(e) {
|
|
6
6
|
u.forEach((t) => t(e));
|
|
7
7
|
}
|
|
@@ -15,7 +15,7 @@ var m = "合同签署位置甲乙双方", h = ":,()。;", g = "2026083
|
|
|
15
15
|
textWidth: 379.546875,
|
|
16
16
|
sansTextWidth: 393,
|
|
17
17
|
variableRowHeight: 28
|
|
18
|
-
}, v = "合同排版度量校验失败,禁止生成签署坐标", y =
|
|
18
|
+
}, v = "合同排版度量校验失败,禁止生成签署坐标", y = a("");
|
|
19
19
|
function b(e) {
|
|
20
20
|
y.value = (e?.baseUrl?.trim() ?? "").replace(/\/+$/, "");
|
|
21
21
|
}
|
|
@@ -27,27 +27,27 @@ function S(e, t = typeof window > "u" ? "" : window.location.origin) {
|
|
|
27
27
|
let n = e.trim().replace(/\/+$/, "");
|
|
28
28
|
return n ? /^https?:\/\//i.test(n) ? n : t ? new URL(n.startsWith("/") ? n : `/${n}`, `${t.replace(/\/+$/, "")}/`).href.replace(/\/+$/, "") : n.startsWith("/") ? n : `/${n}` : "";
|
|
29
29
|
}
|
|
30
|
-
function C(
|
|
31
|
-
let l = `gd-contract-print-${
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
30
|
+
function C(a) {
|
|
31
|
+
let l = `gd-contract-print-${a.messageId}`, u = i({
|
|
32
|
+
width: a.width,
|
|
33
|
+
height: a.height,
|
|
34
34
|
pages: [{
|
|
35
|
-
id:
|
|
35
|
+
id: a.pageId,
|
|
36
36
|
pageSize: {
|
|
37
|
-
width:
|
|
38
|
-
height:
|
|
37
|
+
width: a.width,
|
|
38
|
+
height: a.height
|
|
39
39
|
}
|
|
40
40
|
}]
|
|
41
41
|
}), d = JSON.stringify({
|
|
42
|
-
messageId:
|
|
43
|
-
parentOrigin:
|
|
44
|
-
pageId:
|
|
45
|
-
pageHeight:
|
|
46
|
-
timeoutMs:
|
|
47
|
-
fontFamily:
|
|
48
|
-
sansFontFamily:
|
|
42
|
+
messageId: a.messageId,
|
|
43
|
+
parentOrigin: a.parentOrigin,
|
|
44
|
+
pageId: a.pageId,
|
|
45
|
+
pageHeight: a.height,
|
|
46
|
+
timeoutMs: t,
|
|
47
|
+
fontFamily: e,
|
|
48
|
+
sansFontFamily: r,
|
|
49
49
|
latinFontFamily: "\"GD Contract Latin\", serif",
|
|
50
|
-
metricNormalizeCss:
|
|
50
|
+
metricNormalizeCss: n.replace(/\s+/g, " ").trim(),
|
|
51
51
|
sample: c,
|
|
52
52
|
hanziSample: m,
|
|
53
53
|
punctSample: h,
|
|
@@ -57,7 +57,7 @@ function C(e) {
|
|
|
57
57
|
digitAdvance: 8,
|
|
58
58
|
baseline: _,
|
|
59
59
|
tolerance: s
|
|
60
|
-
}).replace(/</g, "\\u003c"), f = `width:${
|
|
60
|
+
}).replace(/</g, "\\u003c"), f = `width:${a.width}px;min-height:${a.height}px;padding-top:${a.paddingTop}px;padding-bottom:${a.paddingBottom}px`;
|
|
61
61
|
return `<!doctype html>
|
|
62
62
|
<html lang="zh-CN">
|
|
63
63
|
<head>
|
|
@@ -69,9 +69,9 @@ ${w(u)}
|
|
|
69
69
|
</style>
|
|
70
70
|
</head>
|
|
71
71
|
<body>
|
|
72
|
-
<section class="${T(
|
|
73
|
-
${
|
|
74
|
-
<div class="gd-contract-template-page__content">${
|
|
72
|
+
<section class="${T(a.classNames)}" data-page-id="${T(a.pageId)}" data-page-format="${T(a.pageFormat ?? "Custom")}" data-page-width="${a.width}" data-page-height="${a.height}" style="${f}">
|
|
73
|
+
${a.decorationsHtml}
|
|
74
|
+
<div class="gd-contract-template-page__content">${a.contentHtml}</div>
|
|
75
75
|
</section>
|
|
76
76
|
<script nonce="${T(l)}">
|
|
77
77
|
(() => {
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
//#region src/contract-print-css/index.ts
|
|
2
|
+
var e = "\"GD Contract Latin\", \"Songti SC\", SimSun, \"Noto Serif CJK SC\", \"Source Han Serif SC\", serif", t = "\"GD Contract Latin Sans\", \"PingFang SC\", \"Microsoft YaHei\", \"Noto Sans CJK SC\", sans-serif", n = 8e3, r = "text-spacing-trim: space-all;\n font-kerning: none;\n font-variant-ligatures: none;\n font-variant-east-asian: normal;\n font-synthesis: none;\n font-feature-settings: \"palt\" 0, \"halt\" 0;\n font-optical-sizing: none;";
|
|
3
|
+
function i(n) {
|
|
4
|
+
let i = c(n.width, "width"), l = c(n.height, "height"), u = n.pages.map((e) => {
|
|
5
|
+
let t = s(e.pageSize?.width) ? e.pageSize.width : i, n = s(e.pageSize?.height) ? e.pageSize.height : l;
|
|
6
|
+
return `.gd-contract-template-page[data-page-id="${o(e.id)}"] { width: ${t}px; min-height: ${n}px; }`;
|
|
7
|
+
}).join("\n");
|
|
8
|
+
return `${a()}
|
|
9
|
+
@page { size: ${i}px ${l}px; margin: 0; }
|
|
10
|
+
* { box-sizing: border-box; }
|
|
11
|
+
html, body { margin: 0; padding: 0; background: #fff; }
|
|
12
|
+
body {
|
|
13
|
+
color: #262a33;
|
|
14
|
+
font-size: 16px;
|
|
15
|
+
font-family: ${e};
|
|
16
|
+
line-height: 1.75;
|
|
17
|
+
-webkit-print-color-adjust: exact;
|
|
18
|
+
print-color-adjust: exact;
|
|
19
|
+
}
|
|
20
|
+
.gd-contract-template-page {
|
|
21
|
+
position: relative;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
width: ${i}px;
|
|
24
|
+
min-height: ${l}px;
|
|
25
|
+
padding: 54px 64px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
color: #262a33;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
font-family: ${e};
|
|
30
|
+
line-height: 1.75;
|
|
31
|
+
${r}
|
|
32
|
+
break-after: page;
|
|
33
|
+
page-break-after: always;
|
|
34
|
+
}
|
|
35
|
+
.gd-contract-template-page *,
|
|
36
|
+
.gd-contract-template-page *::before,
|
|
37
|
+
.gd-contract-template-page *::after { box-sizing: border-box; }
|
|
38
|
+
.gd-contract-template-page.has-contract-header {
|
|
39
|
+
padding-top: var(--gd-contract-header-safe-padding, 80px);
|
|
40
|
+
}
|
|
41
|
+
.gd-contract-template-page.has-contract-footer {
|
|
42
|
+
padding-bottom: var(--gd-contract-footer-safe-padding, 80px);
|
|
43
|
+
}
|
|
44
|
+
.gd-contract-template-page__content { position: relative; z-index: 1; }
|
|
45
|
+
.gd-contract-template-page__header,
|
|
46
|
+
.gd-contract-template-page__footer {
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
51
|
+
align-items: center;
|
|
52
|
+
right: 64px;
|
|
53
|
+
left: 64px;
|
|
54
|
+
gap: 8px;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
padding-block: 4px;
|
|
57
|
+
line-height: 1.5;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
}
|
|
60
|
+
.gd-contract-template-page__header { top: 24px; }
|
|
61
|
+
.gd-contract-template-page__footer { bottom: 24px; }
|
|
62
|
+
.gd-contract-template-page__decoration-slot {
|
|
63
|
+
min-width: 0;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
text-overflow: ellipsis;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
}
|
|
68
|
+
.gd-contract-template-page__decoration-slot.is-left { text-align: left; }
|
|
69
|
+
.gd-contract-template-page__decoration-slot.is-center { text-align: center; }
|
|
70
|
+
.gd-contract-template-page__decoration-slot.is-right { text-align: right; }
|
|
71
|
+
.gd-contract-template-page__watermark {
|
|
72
|
+
position: absolute;
|
|
73
|
+
z-index: 0;
|
|
74
|
+
display: grid;
|
|
75
|
+
inset: 0;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
letter-spacing: 0;
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
user-select: none;
|
|
80
|
+
}
|
|
81
|
+
.gd-contract-template-page__watermark.is-single { place-items: center; }
|
|
82
|
+
.gd-contract-template-page__watermark.is-tiled {
|
|
83
|
+
grid-template-columns: repeat(var(--gd-watermark-columns), minmax(0, 1fr));
|
|
84
|
+
grid-template-rows: repeat(var(--gd-watermark-rows), minmax(0, 1fr));
|
|
85
|
+
padding: 72px 40px;
|
|
86
|
+
}
|
|
87
|
+
.gd-contract-template-page__watermark-item {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
min-width: 0;
|
|
92
|
+
max-width: 100%;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
line-height: 1.5;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
white-space: nowrap;
|
|
98
|
+
transform-origin: center;
|
|
99
|
+
}
|
|
100
|
+
${u}
|
|
101
|
+
.gd-contract-template-page:last-child { break-after: auto; page-break-after: auto; }
|
|
102
|
+
.gd-contract-template-page p { margin: 0 0 10px; }
|
|
103
|
+
.gd-contract-template-page table { width: 100%; border-collapse: collapse; }
|
|
104
|
+
.gd-contract-template-page th,
|
|
105
|
+
.gd-contract-template-page td { min-width: 80px; padding: 6px 8px; border: 1px solid #d9dce0; }
|
|
106
|
+
.gd-contract-template-page table[data-signing-layout="dual-party"] {
|
|
107
|
+
margin: 16px 0;
|
|
108
|
+
border: 0;
|
|
109
|
+
}
|
|
110
|
+
.gd-contract-template-page table[data-signing-layout="dual-party"] td {
|
|
111
|
+
width: 50%;
|
|
112
|
+
padding: 8px 20px;
|
|
113
|
+
border: 0;
|
|
114
|
+
vertical-align: top;
|
|
115
|
+
}
|
|
116
|
+
.gd-contract-template-page table[data-signing-layout="dual-party"] td + td { padding-left: 28px; }
|
|
117
|
+
.gd-contract-template-page img {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
max-width: 100%;
|
|
120
|
+
object-fit: contain;
|
|
121
|
+
vertical-align: middle;
|
|
122
|
+
}
|
|
123
|
+
.gd-contract-template-page img[width],
|
|
124
|
+
.gd-contract-template-page img[height] { max-width: none; }
|
|
125
|
+
.gd-contract-template-page img:not([height]) { height: auto; }
|
|
126
|
+
.gd-contract-template-page h1,
|
|
127
|
+
.gd-contract-template-page h2,
|
|
128
|
+
.gd-contract-template-page h3,
|
|
129
|
+
.gd-contract-template-page h4,
|
|
130
|
+
.gd-contract-template-page h5,
|
|
131
|
+
.gd-contract-template-page h6 { display: block; font-weight: bold; }
|
|
132
|
+
.gd-contract-template-page h1 { margin: 0.67em 0; font-size: 2em; }
|
|
133
|
+
.gd-contract-template-page h2 { margin: 0.83em 0; font-size: 1.5em; }
|
|
134
|
+
.gd-contract-template-page h3 { margin: 1em 0; font-size: 1.17em; }
|
|
135
|
+
.gd-contract-template-page h4 { margin: 1.33em 0; font-size: 1em; }
|
|
136
|
+
.gd-contract-template-page h5 { margin: 1.67em 0; font-size: 0.83em; }
|
|
137
|
+
.gd-contract-template-page h6 { margin: 2.33em 0; font-size: 0.67em; }
|
|
138
|
+
.gd-contract-template-page ul,
|
|
139
|
+
.gd-contract-template-page ol {
|
|
140
|
+
display: block;
|
|
141
|
+
margin: 1em 0;
|
|
142
|
+
padding-inline-start: 40px;
|
|
143
|
+
list-style-position: outside;
|
|
144
|
+
}
|
|
145
|
+
.gd-contract-template-page ul ul,
|
|
146
|
+
.gd-contract-template-page ul ol,
|
|
147
|
+
.gd-contract-template-page ol ul,
|
|
148
|
+
.gd-contract-template-page ol ol { margin-block: 0; }
|
|
149
|
+
.gd-contract-template-page ul { list-style-type: disc; }
|
|
150
|
+
.gd-contract-template-page ul ul,
|
|
151
|
+
.gd-contract-template-page ol ul { list-style-type: circle; }
|
|
152
|
+
.gd-contract-template-page ul ul ul,
|
|
153
|
+
.gd-contract-template-page ul ol ul,
|
|
154
|
+
.gd-contract-template-page ol ul ul,
|
|
155
|
+
.gd-contract-template-page ol ol ul { list-style-type: square; }
|
|
156
|
+
.gd-contract-template-page ol { list-style-type: decimal; }
|
|
157
|
+
.gd-contract-template-page li { display: list-item; text-align: match-parent; }
|
|
158
|
+
.gd-contract-template-page blockquote { display: block; margin: 1em 40px; }
|
|
159
|
+
.gd-contract-template-page pre {
|
|
160
|
+
display: block;
|
|
161
|
+
margin: 1em 0;
|
|
162
|
+
font-family: monospace;
|
|
163
|
+
white-space: pre;
|
|
164
|
+
}
|
|
165
|
+
.gd-contract-template-page code,
|
|
166
|
+
.gd-contract-template-page kbd,
|
|
167
|
+
.gd-contract-template-page samp { font-family: ${t}; }
|
|
168
|
+
.gd-contract-template-page hr {
|
|
169
|
+
display: block;
|
|
170
|
+
margin: 0.5em auto;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
border-width: 1px;
|
|
173
|
+
border-style: inset;
|
|
174
|
+
}
|
|
175
|
+
.gd-contract-template-page b,
|
|
176
|
+
.gd-contract-template-page strong { font-weight: bolder; }
|
|
177
|
+
.gd-contract-template-page i,
|
|
178
|
+
.gd-contract-template-page em,
|
|
179
|
+
.gd-contract-template-page cite,
|
|
180
|
+
.gd-contract-template-page var,
|
|
181
|
+
.gd-contract-template-page dfn,
|
|
182
|
+
.gd-contract-template-page address { font-style: italic; }
|
|
183
|
+
.gd-contract-template-page s,
|
|
184
|
+
.gd-contract-template-page strike,
|
|
185
|
+
.gd-contract-template-page del { text-decoration: line-through; }
|
|
186
|
+
.gd-contract-template-page u,
|
|
187
|
+
.gd-contract-template-page ins { text-decoration: underline; }
|
|
188
|
+
.gd-contract-template-page sup {
|
|
189
|
+
font-size: smaller;
|
|
190
|
+
line-height: normal;
|
|
191
|
+
vertical-align: super;
|
|
192
|
+
}
|
|
193
|
+
.gd-contract-template-page sub {
|
|
194
|
+
font-size: smaller;
|
|
195
|
+
line-height: normal;
|
|
196
|
+
vertical-align: sub;
|
|
197
|
+
}
|
|
198
|
+
.gd-contract-template-page small { font-size: smaller; }
|
|
199
|
+
.gd-contract-template-page .gd-contract-template-variable,
|
|
200
|
+
.gd-contract-template-page [data-template-variable="true"]:not(.gd-contract-template-page__variable) {
|
|
201
|
+
position: relative;
|
|
202
|
+
box-sizing: border-box;
|
|
203
|
+
display: inline-flex;
|
|
204
|
+
align-items: center;
|
|
205
|
+
justify-content: var(--gd-contract-variable-justify-content, flex-start);
|
|
206
|
+
width: var(--gd-contract-variable-width, 160px);
|
|
207
|
+
min-width: 0;
|
|
208
|
+
min-height: var(--gd-contract-variable-height, 32px);
|
|
209
|
+
margin: 0 2px;
|
|
210
|
+
padding: 0 6px;
|
|
211
|
+
border: 1px solid transparent;
|
|
212
|
+
border-radius: 2px;
|
|
213
|
+
background: var(--gd-contract-variable-background, transparent);
|
|
214
|
+
color: var(--gd-contract-variable-color, #1f2937);
|
|
215
|
+
font-size: var(--gd-contract-variable-font-size, 14px);
|
|
216
|
+
font-family: var(--gd-contract-variable-font-family, inherit);
|
|
217
|
+
line-height: 1.5;
|
|
218
|
+
text-align: var(--gd-contract-variable-text-align, left);
|
|
219
|
+
vertical-align: middle;
|
|
220
|
+
white-space: nowrap;
|
|
221
|
+
}
|
|
222
|
+
.gd-contract-template-page .gd-contract-template-variable.has-border,
|
|
223
|
+
.gd-contract-template-page [data-template-variable="true"][data-border="true"]:not(.gd-contract-template-page__variable) {
|
|
224
|
+
border-color: var(--gd-contract-variable-line-color, #565b66);
|
|
225
|
+
border-style: var(--gd-contract-variable-border-style, solid);
|
|
226
|
+
}
|
|
227
|
+
.gd-contract-template-page .gd-contract-template-variable.has-underline,
|
|
228
|
+
.gd-contract-template-page [data-template-variable="true"][data-underline="true"]:not(.gd-contract-template-page__variable) {
|
|
229
|
+
border-color: transparent;
|
|
230
|
+
border-bottom-color: var(--gd-contract-variable-line-color, #565b66);
|
|
231
|
+
border-bottom-style: var(--gd-contract-variable-border-style, solid);
|
|
232
|
+
border-radius: 0;
|
|
233
|
+
}
|
|
234
|
+
.gd-contract-template-page .gd-contract-template-variable.is-multiline,
|
|
235
|
+
.gd-contract-template-page [data-template-variable="true"][data-multiline="true"]:not(.gd-contract-template-page__variable) {
|
|
236
|
+
display: inline-block;
|
|
237
|
+
width: var(--gd-contract-variable-width, 160px);
|
|
238
|
+
height: var(--gd-contract-variable-multiline-height, 84px);
|
|
239
|
+
min-height: var(--gd-contract-variable-multiline-height, 84px);
|
|
240
|
+
overflow: hidden;
|
|
241
|
+
line-height: var(--gd-contract-variable-line-height, 28px);
|
|
242
|
+
vertical-align: top;
|
|
243
|
+
white-space: pre-wrap;
|
|
244
|
+
overflow-wrap: anywhere;
|
|
245
|
+
}
|
|
246
|
+
.gd-contract-template-page textarea.gd-contract-template-variable.is-multiline {
|
|
247
|
+
resize: none;
|
|
248
|
+
}
|
|
249
|
+
.gd-contract-template-page .gd-contract-template-variable.is-multiline.has-underline,
|
|
250
|
+
.gd-contract-template-page [data-template-variable="true"][data-multiline="true"][data-underline="true"]:not(.gd-contract-template-page__variable) {
|
|
251
|
+
border-bottom-color: transparent;
|
|
252
|
+
background-image: linear-gradient(
|
|
253
|
+
to bottom,
|
|
254
|
+
transparent calc(100% - 1px),
|
|
255
|
+
var(--gd-contract-variable-line-color, #565b66) calc(100% - 1px)
|
|
256
|
+
);
|
|
257
|
+
/* 以边框盒固定横线周期;PDF 会对 repeat-y 图块边界插值,padding-box 排除顶部透明边框区的浅线。 */
|
|
258
|
+
background-origin: border-box;
|
|
259
|
+
background-position: 0 0;
|
|
260
|
+
background-clip: padding-box;
|
|
261
|
+
/* 底部 1px 边框等量移为 padding,避免末行线被 clip;总高度、内容高度和文字顶部位置均不变。 */
|
|
262
|
+
border-bottom-width: 0;
|
|
263
|
+
padding-bottom: 1px;
|
|
264
|
+
background-repeat: repeat-y;
|
|
265
|
+
background-size: 100% var(--gd-contract-variable-line-height, 28px);
|
|
266
|
+
}
|
|
267
|
+
.gd-contract-template-page .gd-contract-template-variable.is-image,
|
|
268
|
+
.gd-contract-template-page [data-template-variable="true"][data-variable-type="image"]:not(.gd-contract-template-page__variable) {
|
|
269
|
+
justify-content: var(--gd-contract-variable-justify-content, flex-start);
|
|
270
|
+
min-height: var(--gd-contract-variable-height, 32px);
|
|
271
|
+
border-color: transparent;
|
|
272
|
+
border-style: solid;
|
|
273
|
+
background-image: var(--gd-contract-variable-image, none);
|
|
274
|
+
background-repeat: no-repeat;
|
|
275
|
+
background-position: center;
|
|
276
|
+
background-size: var(--gd-contract-variable-object-fit, contain);
|
|
277
|
+
white-space: nowrap;
|
|
278
|
+
}
|
|
279
|
+
.gd-contract-template-page .gd-contract-template-variable.is-image.has-value,
|
|
280
|
+
.gd-contract-template-page [data-template-variable="true"][data-variable-type="image"]:not(.gd-contract-template-page__variable) {
|
|
281
|
+
color: transparent;
|
|
282
|
+
}
|
|
283
|
+
.gd-contract-template-page .gd-contract-template-variable.is-image.has-value::before { content: none; }
|
|
284
|
+
.gd-contract-template-page .gd-contract-template-variable.is-checkbox {
|
|
285
|
+
gap: 6px;
|
|
286
|
+
width: var(--gd-contract-variable-width, 160px);
|
|
287
|
+
min-width: 0;
|
|
288
|
+
padding: 0 6px;
|
|
289
|
+
}
|
|
290
|
+
.gd-contract-template-page .gd-contract-template-signing-mark,
|
|
291
|
+
.gd-contract-template-page [data-signing-mark="true"] {
|
|
292
|
+
display: inline-flex;
|
|
293
|
+
align-items: center;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
box-sizing: border-box;
|
|
296
|
+
width: var(--gd-contract-sign-mark-width, 142px);
|
|
297
|
+
height: var(--gd-contract-sign-mark-height, 57px);
|
|
298
|
+
margin: 0 2px;
|
|
299
|
+
border: 1px dashed var(--gd-contract-sign-mark-line-color, #565b66);
|
|
300
|
+
border-radius: 2px;
|
|
301
|
+
background: var(--gd-contract-sign-mark-fill, transparent);
|
|
302
|
+
color: var(--gd-contract-sign-mark-color, #565b66);
|
|
303
|
+
font-size: 14px;
|
|
304
|
+
line-height: 1.4;
|
|
305
|
+
vertical-align: middle;
|
|
306
|
+
white-space: pre-wrap;
|
|
307
|
+
text-align: center;
|
|
308
|
+
}
|
|
309
|
+
.gd-contract-template-page .gd-contract-template-signing-mark--seal,
|
|
310
|
+
.gd-contract-template-page [data-signing-mark="true"][data-mark-type="seal"] {
|
|
311
|
+
border-color: color-mix(in srgb, #ee3939 72%, #565b66);
|
|
312
|
+
}
|
|
313
|
+
.gd-contract-template-page .gd-contract-template-signing-mark--line,
|
|
314
|
+
.gd-contract-template-page [data-signing-mark="true"][data-mark-type="line"] {
|
|
315
|
+
border-style: solid;
|
|
316
|
+
border-width: 0 0 1px;
|
|
317
|
+
border-radius: 0;
|
|
318
|
+
background: transparent;
|
|
319
|
+
justify-content: flex-start;
|
|
320
|
+
}
|
|
321
|
+
.gd-contract-template-page .gd-contract-template-signing-mark--area,
|
|
322
|
+
.gd-contract-template-page [data-signing-mark="true"][data-mark-type="area"] {
|
|
323
|
+
border-style: dashed;
|
|
324
|
+
}
|
|
325
|
+
.gd-contract-template-page .gd-contract-template-signing-mark--signature,
|
|
326
|
+
.gd-contract-template-page [data-signing-mark="true"][data-mark-type="signature"],
|
|
327
|
+
.gd-contract-template-page .gd-contract-template-signing-mark--date,
|
|
328
|
+
.gd-contract-template-page [data-signing-mark="true"][data-mark-type="date"] {
|
|
329
|
+
border-style: dashed;
|
|
330
|
+
}
|
|
331
|
+
/* 签署标记仅保留正式签署线或留白尺寸,不向预览、PDF 和签署底图泄漏辅助文案。 */
|
|
332
|
+
.gd-contract-template-page .gd-contract-template-signing-mark:not(.gd-contract-template-signing-mark--line),
|
|
333
|
+
.gd-contract-template-page [data-signing-mark="true"]:not([data-mark-type="line"]) {
|
|
334
|
+
border: 0;
|
|
335
|
+
background: transparent;
|
|
336
|
+
}
|
|
337
|
+
.gd-contract-template-page .gd-contract-template-signing-mark__label,
|
|
338
|
+
.gd-contract-template-page [data-signing-mark="true"] .gd-contract-template-signing-mark__label {
|
|
339
|
+
display: none !important;
|
|
340
|
+
}
|
|
341
|
+
/* 历史模板可能写入仅某个操作系统存在的字体;保留原数据,打印时收敛到合同标准栈。 */
|
|
342
|
+
.gd-contract-template-page [style*="font-family" i],
|
|
343
|
+
.gd-contract-template-page [data-font-family],
|
|
344
|
+
.gd-contract-template-page [face] {
|
|
345
|
+
font-family: ${e} !important;
|
|
346
|
+
}
|
|
347
|
+
.gd-contract-template-page [style*="GD Contract Latin Sans" i],
|
|
348
|
+
.gd-contract-template-page [style*="PingFang SC" i],
|
|
349
|
+
.gd-contract-template-page [style*="Microsoft YaHei" i],
|
|
350
|
+
.gd-contract-template-page [style*="Noto Sans CJK SC" i],
|
|
351
|
+
.gd-contract-template-page [data-font-family*="GD Contract Latin Sans" i],
|
|
352
|
+
.gd-contract-template-page [data-font-family*="PingFang SC" i],
|
|
353
|
+
.gd-contract-template-page [data-font-family*="Microsoft YaHei" i],
|
|
354
|
+
.gd-contract-template-page [data-font-family*="Noto Sans CJK SC" i],
|
|
355
|
+
.gd-contract-template-page [face*="GD Contract Latin Sans" i],
|
|
356
|
+
.gd-contract-template-page [face*="PingFang SC" i],
|
|
357
|
+
.gd-contract-template-page [face*="Microsoft YaHei" i],
|
|
358
|
+
.gd-contract-template-page [face*="Noto Sans CJK SC" i] {
|
|
359
|
+
font-family: ${t} !important;
|
|
360
|
+
}`;
|
|
361
|
+
}
|
|
362
|
+
function a() {
|
|
363
|
+
return "@font-face {\n font-family: \"GD Contract Latin\";\n src: local(\"Times New Roman\"), local(\"Liberation Serif\"), local(\"Tinos\");\n unicode-range: U+0000-024F, U+2000-206F, U+2190-21FF, U+2200-22FF;\n}\n@font-face {\n font-family: \"GD Contract Latin Sans\";\n src: local(\"Arial\"), local(\"Helvetica Neue\"), local(\"Liberation Sans\");\n unicode-range: U+0000-024F, U+2000-206F, U+2190-21FF, U+2200-22FF;\n}";
|
|
364
|
+
}
|
|
365
|
+
function o(e) {
|
|
366
|
+
return String(e).replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/[\r\n\f]/g, " ");
|
|
367
|
+
}
|
|
368
|
+
function s(e) {
|
|
369
|
+
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
370
|
+
}
|
|
371
|
+
function c(e, t) {
|
|
372
|
+
if (!s(e)) throw TypeError(`${t} 必须是有限正数`);
|
|
373
|
+
return e;
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
export { e as CONTRACT_PRINT_FONT_FAMILY, n as CONTRACT_PRINT_FONT_TIMEOUT_MS, r as CONTRACT_PRINT_METRIC_NORMALIZE_CSS, t as CONTRACT_PRINT_SANS_FONT_FAMILY, i as buildContractPrintCss };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`./types.cjs`),t=require(`./utils/advanced-controls.cjs`),n=require(`./utils/template-renderer.cjs`),r=require(`./ContractTemplateRendererField.cjs`),i=require(`./ContractTemplateRendererHeader.cjs`),a=require(`./ContractTemplateRendererPage.cjs`),o=require(`./ContractTemplateRendererValidation.cjs`);let s=require(`vue`),c=require(`ant-design-vue`),l=require(`@vueuse/core`),u=require(`@ant-design/icons-vue`);var ee={key:2,class:`gd-contract-template-renderer__empty`},te=[`data-highlighted-variable-key`],ne={class:`gd-contract-template-renderer__pages`},re=[`aria-label`,`aria-expanded`],ie={class:`gd-contract-template-renderer__panel-clip`},ae={class:`gd-contract-template-renderer__panel`},oe={class:`gd-contract-template-renderer__panel-head`},se={class:`gd-contract-template-renderer__panel-head-row`},ce={class:`gd-contract-template-renderer__panel-head-actions`},le={class:`gd-contract-template-renderer__field-group-head`},ue={class:`gd-contract-template-renderer__field-group-items`},de=[`data-field-key`],fe=.5,pe=1.5,d=.1,me=3e3,f=(0,s.defineComponent)({name:`ContractTemplateSingleRenderer`,__name:`ContractTemplateSingleRenderer`,props:{files:{},activeFileId:{},valuesByFile:{},template:{default:void 0},values:{default:void 0},interactionMode:{default:`panel`},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},title:{default:`合同填写`},showSubmitButton:{type:Boolean,default:!0},validateOnSubmit:{type:Boolean,default:!0},showValidateButton:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},showPageMeta:{type:Boolean,default:!0},collapsiblePanel:{type:Boolean,default:!0},zoom:{default:1},controlRegistry:{default:()=>({})},optionResolver:{type:Function,default:void 0},requester:{type:Function,default:void 0},allowedRemoteOrigins:{default:()=>[]},remoteRequestTimeoutMs:{default:1e4},remoteOptionsCacheTtlMs:{default:3e4},selectorHttp:{default:void 0},selectorUrlPrefix:{default:``},contractFontBaseUrl:{default:void 0}},emits:[`update:activeFileId`,`update:valuesByFile`,`update:values`,`change`,`validate`,`submit`,`update:zoom`,`control-warning`],setup(f,{expose:he,emit:ge}){let p=f,m=ge,_e=[{label:`全部`,value:`all`},{label:`未填写`,value:`unfilled`},{label:`有错误`,value:`error`}],ve=(0,s.ref)(),h=(0,s.ref)(),g=(0,s.ref)(),_=(0,s.ref)(n.normalizeRenderValues(p.template,p.values)),v=(0,s.ref)({..._.value}),y=(0,s.ref)(!1),b=(0,s.ref)([]),x=(0,s.ref)([]),S=(0,s.ref)(!1),C=(0,s.ref)(!1),w=(0,s.ref)(``),T=(0,s.ref)(``),E=(0,s.ref)(``),ye=(0,s.ref)(0),D=(0,s.ref)(ht(p.zoom)),O=(0,s.ref)(``),k=(0,s.ref)(`all`),A=(0,s.ref)(!1),be=(0,s.ref)(new Map),j=new Map,xe=new Map,M=new Map,Se=new Set,{width:Ce}=(0,l.useElementSize)(h),we=(0,s.computed)(()=>p.readonly||p.disabled),N=(0,s.computed)(()=>n.validateTemplateRenderStructure(p.template)),P=(0,s.computed)(()=>y.value?b.value:[...N.value,...x.value]),F=(0,s.computed)(()=>(Array.isArray(p.template?.variables)?p.template.variables:[]).filter(t=>!!t?.key&&e.isContractTemplateFieldType(t.type??`text`))),Te=(0,s.computed)(()=>{let e={..._.value};return F.value.forEach(n=>{let r=Ye(n);if(r?.toDisplayText)try{e[n.key]=r.toDisplayText(e[n.key],{variable:n,config:t.normalizeContractTemplateJsonObject(n.componentConfig)})}catch{}}),e}),Ee=(0,s.computed)(()=>F.value.filter(e=>n.isEmptyRenderValue(_.value[e.key])).length),De=(0,s.computed)(()=>{let e=new Map;return P.value.forEach(t=>{t.variableKey&&e.set(t.variableKey,[...e.get(t.variableKey)??[],t])}),e}),I=(0,s.computed)(()=>{let e=p.interactionMode===`panel`;return n.buildTemplateRenderPages(p.template,e?Te.value:v.value,{readonly:p.readonly,disabled:p.disabled,mode:e?`display`:`control`})}),Oe=(0,s.computed)(()=>{let e=new Map,t=new Set(F.value.map(e=>e.key));return I.value.forEach(n=>{lt(n.contentHtml).forEach(r=>{t.has(r)&&!e.has(r)&&e.set(r,n.id)})}),e}),L=(0,s.computed)(()=>F.value.filter(it)),ke=(0,s.computed)(()=>{let e=I.value.map((e,t)=>({id:`page:${e.id}`,pageId:e.id,title:`第 ${t+1} 页${e.title?` · ${e.title}`:``}`,allVariables:[],variables:[]})),t=new Map(e.map(e=>[e.pageId,e])),n={id:`unlocated`,title:`未定位字段`,allVariables:[],variables:[]};return F.value.forEach(e=>{let r=t.get(Oe.value.get(e.key)??``)??n;r.allVariables.push(e),it(e)&&r.variables.push(e)}),[...e,n].filter(e=>e.variables.length>0).map(e=>({id:e.id,title:e.title,totalCount:e.allVariables.length,variables:e.variables}))}),R=(0,s.computed)(()=>I.value.length>0),z=(0,s.computed)(()=>F.value.filter(e=>!n.isEmptyRenderValue(_.value[e.key])).length),B=(0,s.computed)(()=>F.value.filter(e=>e.required&&n.isEmptyRenderValue(_.value[e.key])).length),Ae=(0,s.computed)(()=>F.value.length?Math.round(z.value/F.value.length*100):0),je=(0,s.computed)(()=>y.value&&b.value.length===0),Me=(0,s.computed)(()=>y.value?je.value?`校验通过,模板与填写值均符合规则`:`发现 ${b.value.length} 个模板或填写问题`:x.value.length?`发现 ${P.value.length} 个模板或填写问题`:N.value.length?`模板存在 ${N.value.length} 个问题,已安全降级展示`:``),Ne=(0,s.computed)(()=>y.value?P.value.length>0||C.value:P.value.length>0);(0,s.watch)(()=>p.template,e=>{V(n.normalizeRenderValues(e,p.values),!1),G();let t=Array.isArray(e?.pages)?e.pages.map(e=>e?.id):[];t.includes(E.value)||(E.value=t.find(Boolean)??``),T.value&&!F.value.some(e=>e.key===T.value)&&Ge()},{deep:!0}),(0,s.watch)(()=>[p.template?.variables,p.optionResolver,p.requester,p.allowedRemoteOrigins,p.remoteRequestTimeoutMs,p.remoteOptionsCacheTtlMs],()=>{Ze()},{deep:!0,immediate:!0}),(0,s.watch)(()=>p.values,e=>{let t=n.normalizeRenderValues(p.template,e);gt(t,_.value)||(V(t,!1,{refreshInlineHtml:p.interactionMode!==`inline`}),G())},{deep:!0}),(0,s.watch)(()=>p.interactionMode,e=>{e===`inline`&&(v.value={..._.value})}),(0,s.watch)(()=>p.collapsiblePanel,e=>{e||(A.value=!1)}),(0,s.watch)(()=>p.zoom,e=>D.value=ht(e)),(0,s.watch)(I,e=>{!E.value&&e.length&&(E.value=e[0].id)},{immediate:!0});function V(e,t=!0,n={}){_.value={...e},n.refreshInlineHtml!==!1&&(v.value={...e}),t&&(m(`update:values`,{..._.value}),m(`change`,{..._.value}))}function H(e,t){if(!e||we.value)return;if(V({..._.value,[e]:t},!0,{refreshInlineHtml:p.interactionMode!==`inline`}),y.value){W();return}let r=F.value.find(t=>t.key===e);r&&(r.type??`text`)===`text`&&(x.value=[...x.value.filter(t=>t.variableKey!==e),...n.validateTemplateTextOverflow(r,t)],m(`validate`,P.value))}function Pe(e){if(p.interactionMode!==`inline`)return;let t=e.target;if(!(t instanceof HTMLInputElement)&&!(t instanceof HTMLTextAreaElement))return;let n=t.dataset.key||``;n&&(t instanceof HTMLInputElement&&t.type===`checkbox`?H(n,t.checked):t instanceof HTMLInputElement&&t.type===`number`?H(n,t.value===``?void 0:t.valueAsNumber):H(n,t.value))}function Fe(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-render-page-id]`);n?.dataset.renderPageId&&(E.value=n.dataset.renderPageId);let r=t.closest(`[data-contract-render-wrapper], [data-contract-render-control]`)?.dataset.key||``;r&&Y(r)}function Ie(e){let t=I.value.find(t=>t.id===e.pageId),n=F.value.some(t=>t.key===e.key);if(!(!t||!n||!lt(t.contentHtml).has(e.key))&&!(e.kind===`input`&&p.interactionMode!==`inline`)){if(E.value=e.pageId,e.kind===`input`){H(e.key,e.value);return}Y(e.key)}}function Le(e){if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLElement)||!t.dataset.key||(e.preventDefault(),Y(t.dataset.key))}function U(){return{..._.value}}function Re(e){V(n.normalizeRenderValues(p.template,e))}function W(){let e=n.validateTemplateRenderValues(p.template,_.value);return He(e),m(`validate`,e),e}function ze(){let e=n.resolveTemplateRenderSubmitErrors(p.template,_.value,p.validateOnSubmit);if((p.validateOnSubmit||e.length)&&(He(e),m(`validate`,e)),e.length)return qe(e[0]),!1;let t=U();return m(`submit`,t),t}function Be(){return V(n.buildInitialRenderValues(p.template)),G(),U()}function Ve(){we.value||c.Modal.confirm({title:`重置填写内容?`,content:`将恢复模板中的默认值,当前未提交的填写内容会被覆盖。`,okText:`确认重置`,cancelText:`取消`,onOk:()=>Be()})}function G(){x.value=[],y.value=!1,b.value=[],S.value=!1,C.value=!1,q()}function He(e){if(x.value=[],b.value=e,y.value=!0,S.value=!1,e.length){C.value=!1,q();return}Ue()}let K;function q(){K&&=(clearTimeout(K),void 0)}function Ue(){q(),C.value=!0,K=setTimeout(()=>{C.value=!1,K=void 0},me)}function J(e){Y(e,!0)}function We(e){p.interactionMode===`panel`&&(A.value&&=!1,F.value.some(t=>t.key===e)&&!L.value.some(t=>t.key===e)&&at())}function Y(e,t=!1){if(!e)return;We(e),T.value=e,w.value=e;let n=Oe.value.get(e);n&&(E.value=n),t&&(ye.value+=1),(0,s.nextTick)(()=>{Ke(e);let r=n?h.value?.querySelector(`[data-render-page-id="${$(n)}"]`):void 0;t&&r?.scrollIntoView({behavior:`smooth`,block:`center`,inline:`center`}),p.interactionMode===`panel`&&g.value?.querySelector(`[data-field-key="${$(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`})})}function Ge(){T.value=``,w.value=``,Ke(``)}function Ke(e){h.value?.querySelectorAll(`[data-contract-render-wrapper], [data-contract-render-control]`).forEach(t=>t.classList.toggle(`is-active`,!!e&&t.dataset.key===e))}function qe(e){e.variableKey?(J(e.variableKey),p.interactionMode===`panel`&&(0,s.nextTick)(()=>st(e.variableKey))):e.pageId&&mt(e.pageId)}function Je(e){return De.value.get(e)??[]}function X(e){return be.value.get(e.key)??{options:e.options??[],loading:!1}}function Ye(e){let t=e.componentKey||e.type||``;return t?p.controlRegistry?.[t]:void 0}function Z(e,t){let n=new Map(be.value);n.set(e,t),be.value=n}function Xe(e){m(`control-warning`,e)}async function Ze(){j.forEach(e=>e.abort()),j.clear(),xe.clear(),Se.clear();let e=Array.isArray(p.template?.variables)?p.template.variables:[];await Promise.all(e.map(async e=>{if(!e?.key)return;let t=Array.isArray(e.options)?e.options.map(e=>({...e})):[];if(e.dataSource?await Qe(e,t):Z(e.key,{options:t,loading:!1}),e.type===`custom`&&!Ye(e)){let t=e.componentKey||``,n=`${e.key}:${t}`;Se.has(n)||(Se.add(n),Xe({code:`CONTROL_COMPONENT_MISSING`,variableKey:e.key,componentKey:t,message:`${e.label||e.key} 未注册自定义控件 ${t||`(空)`}`}))}}))}async function Qe(e,n){let r=e.dataSource;if(!r)return;let i=new AbortController;j.set(e.key,i),Z(e.key,{options:n,loading:!0});let a=$e(e),o=Date.now(),s=xe.get(a);if(s&&s.expiresAt>o){Z(e.key,{options:s.options,loading:!1}),j.delete(e.key);return}let c=`CONTROL_OPTIONS_LOAD_FAILED`;try{r.kind===`url`&&!t.isAllowedContractTemplateRemoteUrl(r.url,p.allowedRemoteOrigins)&&(c=`CONTROL_REMOTE_URL_BLOCKED`);let o=M.get(a);o||(o=et(e,r,c,i),M.set(a,o),o.finally(()=>{M.get(a)===o&&M.delete(a)}).catch(()=>void 0));let s=await o;if(i.signal.aborted)return;let l=Math.max(0,Number(p.remoteOptionsCacheTtlMs)||0);l>0&&xe.set(a,{options:s,expiresAt:Date.now()+l}),Z(e.key,{options:s.length?s:n,loading:!1})}catch(t){let r=t instanceof Error&&t.message.startsWith(`高级控件请求超时`);if(i.signal.aborted&&!r)return;let a=t instanceof Error?t.message:`高级控件选项加载失败`;Z(e.key,{options:n,loading:!1,error:a}),Xe({code:c,variableKey:e.key,message:`${e.label||e.key}:${a}`,cause:t})}finally{j.get(e.key)===i&&j.delete(e.key)}}function $e(e){try{return JSON.stringify([e.type,e.dataSource])}catch{return`${e.key}:${e.type}`}}async function et(e,n,r,i){let a;if(n.kind===`resolver`){if(!p.optionResolver)throw Error(`缺少 resolver ${n.resolverKey} 的宿主实现`);a=await p.optionResolver({resolverKey:n.resolverKey,params:n.params,variable:e,signal:i.signal})}else{if(!t.isAllowedContractTemplateRemoteUrl(n.url,p.allowedRemoteOrigins))throw Error(`远程地址未在 allowlist 中:${n.url}`);if(!p.requester)throw Error(`缺少宿主 requester,组件库不会直接发起网络请求`);let r=t.normalizeContractTemplateRequestTimeout(n.timeoutMs,p.remoteRequestTimeoutMs);a=await tt(p.requester({url:n.url,method:n.method||`GET`,params:n.params,headers:n.headers,timeoutMs:r,signal:i.signal,variable:e}),i,r)}return t.normalizeContractTemplateControlOptions(a,n.kind===`url`?n:void 0,e.type||`select`)}function tt(e,t,n){return new Promise((r,i)=>{let a=()=>{clearTimeout(c),t.signal.removeEventListener(`abort`,s)},o=e=>{a(),e()},s=()=>o(()=>i(Error(`高级控件请求已取消`))),c=setTimeout(()=>{o(()=>i(Error(`高级控件请求超时(${n}ms)`))),t.abort()},n);t.signal.addEventListener(`abort`,s,{once:!0}),e.then(e=>o(()=>r(e)),e=>o(()=>i(e)))})}function nt(e){let t=X(e);return{variable:e,value:_.value[e.key],errors:Je(e.key),active:T.value===e.key,readonly:p.readonly,disabled:p.disabled,options:t.options,loading:t.loading,loadError:t.error,updateValue:t=>H(e.key,t),focusVariable:()=>J(e.key)}}function rt(){let e=F.value;if(!e.length)return;let t=e.findIndex(e=>e.key===T.value),r=t<0?0:t+1;for(let t=0;t<e.length;t+=1){let i=e[(r+t)%e.length];if(n.isEmptyRenderValue(_.value[i.key])){J(i.key);return}}}function it(e){let t=O.value.trim().toLocaleLowerCase();return!t||e.key.toLocaleLowerCase().includes(t)||(e.label??``).toLocaleLowerCase().includes(t)?k.value===`unfilled`?n.isEmptyRenderValue(_.value[e.key]):k.value===`error`?Je(e.key).length>0:!0:!1}function at(){O.value=``,k.value=`all`}function ot(e,t){let n=L.value;if(!n.length)return;let r=n.findIndex(t=>t.key===e),i=n[r<0?0:(r+t+n.length)%n.length]?.key;i&&(J(i),(0,s.nextTick)(()=>st(i)))}function st(e){(g.value?.querySelector(`[data-field-key="${$(e)}"]`))?.querySelector(`input:not([disabled]), textarea:not([disabled]), button:not([disabled])`)?.focus()}function ct(e){if(e.key!==`Enter`||e.target instanceof HTMLTextAreaElement)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-field-key]`)?.dataset.fieldKey;n&&(e.preventDefault(),ot(n,e.shiftKey?-1:1))}function lt(e){let t=new Set;if(typeof DOMParser<`u`)return new DOMParser().parseFromString(e,`text/html`).querySelectorAll(`[data-key]`).forEach(e=>{let n=e.getAttribute(`data-key`)?.trim();n&&t.add(n)}),t;let n=/\bdata-key\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+))/gi,r;for(;r=n.exec(e);){let e=(r[1]??r[2]??r[3]??``).trim();e&&t.add(e)}return t}function ut(){!p.collapsiblePanel||p.interactionMode!==`panel`||(A.value=!A.value)}function Q(e){let t=ht(e);return D.value=t,m(`update:zoom`,t),t}function dt(){return Q(1)}function ft(){return D.value}function pt(){let e=Math.max(...I.value.map(e=>e.width),1);return Q(Math.max(0,Ce.value-48)/e)}function mt(e){e&&(E.value=e,(0,s.nextTick)(()=>{h.value?.querySelector(`[data-render-page-id="${$(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`start`,inline:`center`})}))}function ht(e){let t=Number(e);return Number.isFinite(t)?Math.min(pe,Math.max(fe,Math.round(t*100)/100)):1}function $(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function gt(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);return Array.from(n).every(n=>e[n]===t[n])}function _t(e){!(e.ctrlKey||e.metaKey)||!R.value||(e.preventDefault(),Q(e.deltaY>0?D.value-d:D.value+d))}let vt;function yt(){vt?.removeEventListener(`wheel`,_t),vt=void 0}function bt(e){yt(),e&&(e.addEventListener(`wheel`,_t,{passive:!1}),vt=e)}return(0,s.watch)(h,e=>{bt(e)},{immediate:!0}),(0,s.onBeforeUnmount)(()=>{yt(),q(),j.forEach(e=>e.abort()),j.clear()}),he({showValidation:He,focusError:e=>{qe(e),e.variableKey&&(0,s.nextTick)(()=>st(e.variableKey))},getValues:U,setValues:Re,validate:W,submit:ze,resetValues:Be,scrollToVariable:J,setZoom:Q,resetZoom:dt,getZoom:ft,fitWidth:pt,scrollToPage:mt}),(e,t)=>((0,s.openBlock)(),(0,s.createElementBlock)(`section`,{ref_key:`rendererElement`,ref:ve,class:(0,s.normalizeClass)([`gd-contract-template-renderer`,{"is-disabled":f.disabled,"is-readonly":f.readonly,"is-panel":f.interactionMode===`panel`,"is-inline":f.interactionMode===`inline`}]),onClick:Fe,onKeydown:Le,onInput:Pe,onChange:Pe},[(0,s.renderSlot)(e.$slots,`fileBar`),R.value?((0,s.openBlock)(),(0,s.createBlock)(i.default,{key:0,title:f.title,"filled-count":z.value,"total-count":F.value.length,"progress-percent":Ae.value,"required-missing-count":B.value,zoom:D.value,pages:I.value,"active-page-id":E.value,"min-zoom":fe,"max-zoom":pe,"show-toolbar":f.showToolbar,"show-validate-button":f.showValidateButton,"show-reset-button":f.showResetButton,"show-submit-button":f.showSubmitButton,"show-panel-toggle":f.interactionMode===`panel`&&f.collapsiblePanel,"panel-collapsed":A.value,readonly:f.readonly,disabled:f.disabled,onZoomIn:t[0]||=e=>Q(D.value+d),onZoomOut:t[1]||=e=>Q(D.value-d),onResetZoom:dt,onFitWidth:pt,onSelectPage:mt,onValidate:W,onReset:Ve,onSubmit:ze,onTogglePanel:ut},{extra:(0,s.withCtx)(()=>[(0,s.renderSlot)(e.$slots,`headerExtra`)]),_:3},8,[`title`,`filled-count`,`total-count`,`progress-percent`,`required-missing-count`,`zoom`,`pages`,`active-page-id`,`show-toolbar`,`show-validate-button`,`show-reset-button`,`show-submit-button`,`show-panel-toggle`,`panel-collapsed`,`readonly`,`disabled`])):(0,s.createCommentVNode)(``,!0),Ne.value?((0,s.openBlock)(),(0,s.createBlock)(o.default,{key:1,passed:je.value,summary:Me.value,errors:P.value,expanded:S.value,onToggle:t[2]||=e=>S.value=!S.value,onFocusError:qe},null,8,[`passed`,`summary`,`errors`,`expanded`])):(0,s.createCommentVNode)(``,!0),R.value?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:3,class:(0,s.normalizeClass)([`gd-contract-template-renderer__workspace`,{"is-inline":f.interactionMode===`inline`}])},[(0,s.createElementVNode)(`div`,{ref_key:`pagesViewportElement`,ref:h,class:`gd-contract-template-renderer__pages-viewport`,"data-highlighted-variable-key":w.value},[(0,s.createElementVNode)(`div`,ne,[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(I.value,(e,t)=>((0,s.openBlock)(),(0,s.createBlock)(a.default,{key:e.id,page:e,index:t,total:I.value.length,zoom:D.value,"show-meta":f.showPageMeta,"font-base-url":f.contractFontBaseUrl,"active-key":w.value,"scroll-request":ye.value,onInteraction:Ie},null,8,[`page`,`index`,`total`,`zoom`,`show-meta`,`font-base-url`,`active-key`,`scroll-request`]))),128))])],8,te),f.interactionMode===`panel`?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:0,class:(0,s.normalizeClass)([`gd-contract-template-renderer__panel-wrap`,{"is-collapsed":A.value&&f.collapsiblePanel}])},[f.collapsiblePanel?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.Tooltip),{key:0,title:A.value?`展开填写面板`:`收起填写面板`},{default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`button`,{type:`button`,class:`gd-contract-template-renderer__panel-handle`,"aria-label":A.value?`展开填写面板`:`收起填写面板`,"aria-expanded":!A.value,onClick:t[3]||=e=>A.value=!A.value},[A.value?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(u.LeftOutlined),{key:0,"aria-hidden":`true`})):((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(u.RightOutlined),{key:1,"aria-hidden":`true`}))],8,re)]),_:1},8,[`title`])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,ie,[(0,s.createElementVNode)(`aside`,ae,[(0,s.createElementVNode)(`div`,oe,[(0,s.createElementVNode)(`div`,se,[(0,s.createElementVNode)(`div`,null,[t[6]||=(0,s.createElementVNode)(`strong`,null,`填写项`,-1),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(z.value)+` / `+(0,s.toDisplayString)(F.value.length)+` 已填写`,1)]),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(B.value?`${B.value} 项必填未完成`:`必填项已完成`),1)]),(0,s.createVNode)((0,s.unref)(c.Input),{value:O.value,"onUpdate:value":t[4]||=e=>O.value=e,"allow-clear":``,size:`small`,class:`gd-contract-template-renderer__field-search`,placeholder:`搜索字段名称或标识`},{prefix:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(u.SearchOutlined),{"aria-hidden":`true`})]),_:1},8,[`value`]),(0,s.createElementVNode)(`div`,ce,[(0,s.createVNode)((0,s.unref)(c.Segmented),{value:k.value,"onUpdate:value":t[5]||=e=>k.value=e,size:`small`,class:`gd-contract-template-renderer__field-filter`,options:_e},null,8,[`value`]),(0,s.createVNode)((0,s.unref)(c.Button),{size:`small`,disabled:!Ee.value,onClick:rt},{default:(0,s.withCtx)(()=>[...t[7]||=[(0,s.createTextVNode)(` 下一个未填项 `,-1)]]),_:1},8,[`disabled`])]),(0,s.createVNode)((0,s.unref)(c.Progress),{percent:Ae.value,size:`small`,"show-info":!1},null,8,[`percent`])]),L.value.length?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:1,ref_key:`fieldListElement`,ref:g,class:`gd-contract-template-renderer__field-list`,onKeydownCapture:ct},[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(ke.value,t=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:t.id,class:`gd-contract-template-renderer__field-group`},[(0,s.createElementVNode)(`div`,le,[(0,s.createElementVNode)(`strong`,null,(0,s.toDisplayString)(t.title),1),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(t.variables.length)+` / `+(0,s.toDisplayString)(t.totalCount)+` 项`,1)]),(0,s.createElementVNode)(`div`,ue,[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(t.variables,t=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:t.id||t.key,"data-field-key":t.key},[(0,s.renderSlot)(e.$slots,`field`,(0,s.mergeProps)({ref_for:!0},nt(t)),()=>[(0,s.createVNode)(r.default,{variable:t,value:_.value[t.key],errors:Je(t.key),active:T.value===t.key,readonly:f.readonly,disabled:f.disabled,options:X(t).options,loading:X(t).loading,"load-error":X(t).error,registration:Ye(t),"selector-http":f.selectorHttp,"selector-url-prefix":f.selectorUrlPrefix,onUpdateValue:e=>H(t.key,e),onFocusVariable:e=>J(t.key)},null,8,[`variable`,`value`,`errors`,`active`,`readonly`,`disabled`,`options`,`loading`,`load-error`,`registration`,`selector-http`,`selector-url-prefix`,`onUpdateValue`,`onFocusVariable`])])],8,de))),128))])]))),128))],544)):((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.Empty),{key:0,class:`gd-contract-template-renderer__field-empty`,description:F.value.length?`没有符合条件的填写项`:`暂无填写项`,image:(0,s.unref)(c.Empty).PRESENTED_IMAGE_SIMPLE},(0,s.createSlots)({default:(0,s.withCtx)(()=>[O.value||k.value!==`all`?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.Button),{key:0,type:`link`,size:`small`,onClick:at},{default:(0,s.withCtx)(()=>[...t[9]||=[(0,s.createTextVNode)(`清除筛选`,-1)]]),_:1})):(0,s.createCommentVNode)(``,!0)]),_:2},[O.value||k.value!==`all`?{name:`description`,fn:(0,s.withCtx)(()=>[t[8]||=(0,s.createElementVNode)(`span`,null,`没有符合条件的填写项`,-1)]),key:`0`}:void 0]),1032,[`description`,`image`]))])])],2)):(0,s.createCommentVNode)(``,!0)],2)):((0,s.openBlock)(),(0,s.createElementBlock)(`div`,ee,[(0,s.createVNode)((0,s.unref)(c.Empty),{description:`暂无可渲染的合同页面`,image:(0,s.unref)(c.Empty).PRESENTED_IMAGE_SIMPLE},null,8,[`image`])]))],34))}});exports.default=f;
|
|
1
|
+
require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`./types.cjs`),t=require(`./utils/advanced-controls.cjs`),n=require(`./utils/template-renderer.cjs`),r=require(`./ContractTemplateRendererField.cjs`),i=require(`./ContractTemplateRendererHeader.cjs`),a=require(`./ContractTemplateRendererPage.cjs`),o=require(`./ContractTemplateRendererValidation.cjs`);let s=require(`vue`),c=require(`ant-design-vue`),l=require(`@vueuse/core`),ee=require(`@ant-design/icons-vue`);var te={key:2,class:`gd-contract-template-renderer__empty`},ne=[`data-highlighted-variable-key`],re={class:`gd-contract-template-renderer__pages`},ie=[`aria-label`,`aria-expanded`],ae={class:`gd-contract-template-renderer__panel-clip`},oe={class:`gd-contract-template-renderer__panel`},se={class:`gd-contract-template-renderer__panel-head`},ce={class:`gd-contract-template-renderer__panel-head-row`},le={class:`gd-contract-template-renderer__panel-head-actions`},ue={class:`gd-contract-template-renderer__field-group-head`},de={class:`gd-contract-template-renderer__field-group-items`},fe=[`data-field-key`],pe=.5,me=1.5,u=.1,he=3e3,d=(0,s.defineComponent)({name:`ContractTemplateSingleRenderer`,__name:`ContractTemplateSingleRenderer`,props:{files:{},activeFileId:{},valuesByFile:{},template:{default:void 0},values:{default:void 0},interactionMode:{default:`panel`},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},title:{default:`合同填写`},showSubmitButton:{type:Boolean,default:!0},validateOnSubmit:{type:Boolean,default:!0},showValidateButton:{type:Boolean,default:!0},showResetButton:{type:Boolean,default:!0},showToolbar:{type:Boolean,default:!0},showPageMeta:{type:Boolean,default:!0},collapsiblePanel:{type:Boolean,default:!0},zoom:{default:1},controlRegistry:{default:()=>({})},optionResolver:{type:Function,default:void 0},requester:{type:Function,default:void 0},allowedRemoteOrigins:{default:()=>[]},remoteRequestTimeoutMs:{default:1e4},remoteOptionsCacheTtlMs:{default:3e4},selectorHttp:{default:void 0},selectorUrlPrefix:{default:``},contractFontBaseUrl:{default:void 0}},emits:[`update:activeFileId`,`update:valuesByFile`,`update:values`,`change`,`validate`,`submit`,`update:zoom`,`control-warning`],setup(d,{expose:ge,emit:_e}){let f=d,p=_e,ve=[{label:`全部`,value:`all`},{label:`未填写`,value:`unfilled`},{label:`有错误`,value:`error`}],ye=(0,s.ref)(),m=(0,s.ref)(),h=(0,s.ref)(),g=(0,s.ref)(n.normalizeRenderValues(f.template,f.values)),be=(0,s.ref)({...g.value}),_=(0,s.ref)(!1),v=(0,s.ref)([]),y=(0,s.ref)([]),b=(0,s.ref)(!1),x=(0,s.ref)(!1),S=(0,s.ref)(``),C=(0,s.ref)(``),w=(0,s.ref)(``),xe=(0,s.ref)(0),T=(0,s.ref)(gt(f.zoom)),E=(0,s.ref)(``),D=(0,s.ref)(`all`),O=(0,s.ref)(!1),Se=(0,s.ref)(new Map),k=new Map,A=new Map,j=new Map,M=new Set,{width:Ce}=(0,l.useElementSize)(m),N=(0,s.computed)(()=>f.readonly||f.disabled),we=(0,s.computed)(()=>f.interactionMode===`inline`&&!N.value),Te=(0,s.computed)(()=>n.validateTemplateRenderStructure(f.template)),P=(0,s.computed)(()=>_.value?v.value:[...Te.value,...y.value]),F=(0,s.computed)(()=>(Array.isArray(f.template?.variables)?f.template.variables:[]).filter(t=>!!t?.key&&e.isContractTemplateFieldType(t.type??`text`))),Ee=(0,s.computed)(()=>{let e={...g.value};return F.value.forEach(n=>{let r=Ze(n);if(r?.toDisplayText)try{e[n.key]=r.toDisplayText(e[n.key],{variable:n,config:t.normalizeContractTemplateJsonObject(n.componentConfig)})}catch{}}),e}),De=(0,s.computed)(()=>F.value.filter(e=>n.isEmptyRenderValue(g.value[e.key])).length),Oe=(0,s.computed)(()=>{let e=new Map;return P.value.forEach(t=>{t.variableKey&&e.set(t.variableKey,[...e.get(t.variableKey)??[],t])}),e}),I=(0,s.computed)(()=>n.buildTemplateRenderPages(f.template,we.value?be.value:Ee.value,{readonly:f.readonly,disabled:f.disabled,mode:we.value?`control`:`display`})),ke=(0,s.computed)(()=>{let e=new Map,t=new Set(F.value.map(e=>e.key));return I.value.forEach(n=>{dt(n.contentHtml).forEach(r=>{t.has(r)&&!e.has(r)&&e.set(r,n.id)})}),e}),Ae=(0,s.computed)(()=>F.value.filter(ot)),je=(0,s.computed)(()=>{let e=I.value.map((e,t)=>({id:`page:${e.id}`,pageId:e.id,title:`第 ${t+1} 页${e.title?` · ${e.title}`:``}`,allVariables:[],variables:[]})),t=new Map(e.map(e=>[e.pageId,e])),n={id:`unlocated`,title:`未定位字段`,allVariables:[],variables:[]};return F.value.forEach(e=>{let r=t.get(ke.value.get(e.key)??``)??n;r.allVariables.push(e),ot(e)&&r.variables.push(e)}),[...e,n].filter(e=>e.variables.length>0).map(e=>({id:e.id,title:e.title,totalCount:e.allVariables.length,variables:e.variables}))}),Me=(0,s.computed)(()=>I.value.length>0),L=(0,s.computed)(()=>F.value.filter(e=>!n.isEmptyRenderValue(g.value[e.key])).length),R=(0,s.computed)(()=>F.value.filter(e=>e.required&&n.isEmptyRenderValue(g.value[e.key])).length),Ne=(0,s.computed)(()=>F.value.length?Math.round(L.value/F.value.length*100):0),Pe=(0,s.computed)(()=>_.value&&v.value.length===0),Fe=(0,s.computed)(()=>_.value?Pe.value?`校验通过,模板与填写值均符合规则`:`发现 ${v.value.length} 个模板或填写问题`:y.value.length?`发现 ${P.value.length} 个模板或填写问题`:Te.value.length?`模板存在 ${Te.value.length} 个问题,已安全降级展示`:``),Ie=(0,s.computed)(()=>_.value?P.value.length>0||x.value:P.value.length>0);(0,s.watch)(()=>f.template,e=>{z(n.normalizeRenderValues(e,f.values),!1),U();let t=Array.isArray(e?.pages)?e.pages.map(e=>e?.id):[];t.includes(w.value)||(w.value=t.find(Boolean)??``),C.value&&!F.value.some(e=>e.key===C.value)&&qe()},{deep:!0}),(0,s.watch)(()=>[f.template?.variables,f.optionResolver,f.requester,f.allowedRemoteOrigins,f.remoteRequestTimeoutMs,f.remoteOptionsCacheTtlMs],()=>{$e()},{deep:!0,immediate:!0}),(0,s.watch)(()=>f.values,e=>{let t=n.normalizeRenderValues(f.template,e);_t(t,g.value)||(z(t,!1,{refreshInlineHtml:f.interactionMode!==`inline`}),U())},{deep:!0}),(0,s.watch)(we,e=>{e&&(be.value={...g.value})}),(0,s.watch)(()=>f.collapsiblePanel,e=>{e||(O.value=!1)}),(0,s.watch)(()=>f.zoom,e=>T.value=gt(e)),(0,s.watch)(I,e=>{!w.value&&e.length&&(w.value=e[0].id)},{immediate:!0});function z(e,t=!0,n={}){g.value={...e},n.refreshInlineHtml!==!1&&(be.value={...e}),t&&(p(`update:values`,{...g.value}),p(`change`,{...g.value}))}function B(e,t){if(!e||N.value)return;if(z({...g.value,[e]:t},!0,{refreshInlineHtml:f.interactionMode!==`inline`}),_.value){H();return}let r=F.value.find(t=>t.key===e);r&&(r.type??`text`)===`text`&&(y.value=[...y.value.filter(t=>t.variableKey!==e),...n.validateTemplateTextOverflow(r,t)],p(`validate`,P.value))}function Le(e){if(f.interactionMode!==`inline`)return;let t=e.target;if(!(t instanceof HTMLInputElement)&&!(t instanceof HTMLTextAreaElement))return;let n=t.dataset.key||``;n&&(t instanceof HTMLInputElement&&t.type===`checkbox`?B(n,t.checked):t instanceof HTMLInputElement&&t.type===`number`?B(n,t.value===``?void 0:t.valueAsNumber):B(n,t.value))}function Re(e){let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-render-page-id]`);n?.dataset.renderPageId&&(w.value=n.dataset.renderPageId);let r=t.closest(`[data-contract-render-wrapper], [data-contract-render-control]`)?.dataset.key||``;r&&J(r)}function ze(e){let t=I.value.find(t=>t.id===e.pageId),n=F.value.some(t=>t.key===e.key);if(!(!t||!n||!dt(t.contentHtml).has(e.key))&&!(e.kind===`input`&&f.interactionMode!==`inline`)){if(w.value=e.pageId,e.kind===`input`){B(e.key,e.value);return}J(e.key)}}function Be(e){if(e.key!==`Enter`&&e.key!==` `)return;let t=e.target;!(t instanceof HTMLElement)||!t.dataset.key||(e.preventDefault(),J(t.dataset.key))}function V(){return{...g.value}}function Ve(e){z(n.normalizeRenderValues(f.template,e))}function H(){let e=n.validateTemplateRenderValues(f.template,g.value);return W(e),p(`validate`,e),e}function He(){let e=n.resolveTemplateRenderSubmitErrors(f.template,g.value,f.validateOnSubmit);if((f.validateOnSubmit||e.length)&&(W(e),p(`validate`,e)),e.length)return Ye(e[0]),!1;let t=V();return p(`submit`,t),t}function Ue(){return z(n.buildInitialRenderValues(f.template)),U(),V()}function We(){N.value||c.Modal.confirm({title:`重置填写内容?`,content:`将恢复模板中的默认值,当前未提交的填写内容会被覆盖。`,okText:`确认重置`,cancelText:`取消`,onOk:()=>Ue()})}function U(){y.value=[],_.value=!1,v.value=[],b.value=!1,x.value=!1,K()}function W(e){if(y.value=[],v.value=e,_.value=!0,b.value=!1,e.length){x.value=!1,K();return}Ge()}let G;function K(){G&&=(clearTimeout(G),void 0)}function Ge(){K(),x.value=!0,G=setTimeout(()=>{x.value=!1,G=void 0},he)}function q(e){J(e,!0)}function Ke(e){f.interactionMode===`panel`&&(O.value&&=!1,F.value.some(t=>t.key===e)&&!Ae.value.some(t=>t.key===e)&&st())}function J(e,t=!1){if(!e)return;Ke(e),C.value=e,S.value=e;let n=ke.value.get(e);n&&(w.value=n),t&&(xe.value+=1),(0,s.nextTick)(()=>{Je(e);let r=n?m.value?.querySelector(`[data-render-page-id="${$(n)}"]`):void 0;t&&r?.scrollIntoView({behavior:`smooth`,block:`center`,inline:`center`}),f.interactionMode===`panel`&&h.value?.querySelector(`[data-field-key="${$(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`nearest`})})}function qe(){C.value=``,S.value=``,Je(``)}function Je(e){m.value?.querySelectorAll(`[data-contract-render-wrapper], [data-contract-render-control]`).forEach(t=>t.classList.toggle(`is-active`,!!e&&t.dataset.key===e))}function Ye(e){e.variableKey?(q(e.variableKey),f.interactionMode===`panel`&&(0,s.nextTick)(()=>lt(e.variableKey))):e.pageId&&Q(e.pageId)}function Xe(e){return Oe.value.get(e)??[]}function Y(e){return Se.value.get(e.key)??{options:e.options??[],loading:!1}}function Ze(e){let t=e.componentKey||e.type||``;return t?f.controlRegistry?.[t]:void 0}function X(e,t){let n=new Map(Se.value);n.set(e,t),Se.value=n}function Qe(e){p(`control-warning`,e)}async function $e(){k.forEach(e=>e.abort()),k.clear(),A.clear(),M.clear();let e=Array.isArray(f.template?.variables)?f.template.variables:[];await Promise.all(e.map(async e=>{if(!e?.key)return;let t=Array.isArray(e.options)?e.options.map(e=>({...e})):[];if(e.dataSource?await et(e,t):X(e.key,{options:t,loading:!1}),e.type===`custom`&&!Ze(e)){let t=e.componentKey||``,n=`${e.key}:${t}`;M.has(n)||(M.add(n),Qe({code:`CONTROL_COMPONENT_MISSING`,variableKey:e.key,componentKey:t,message:`${e.label||e.key} 未注册自定义控件 ${t||`(空)`}`}))}}))}async function et(e,n){let r=e.dataSource;if(!r)return;let i=new AbortController;k.set(e.key,i),X(e.key,{options:n,loading:!0});let a=tt(e),o=Date.now(),s=A.get(a);if(s&&s.expiresAt>o){X(e.key,{options:s.options,loading:!1}),k.delete(e.key);return}let c=`CONTROL_OPTIONS_LOAD_FAILED`;try{r.kind===`url`&&!t.isAllowedContractTemplateRemoteUrl(r.url,f.allowedRemoteOrigins)&&(c=`CONTROL_REMOTE_URL_BLOCKED`);let o=j.get(a);o||(o=nt(e,r,c,i),j.set(a,o),o.finally(()=>{j.get(a)===o&&j.delete(a)}).catch(()=>void 0));let s=await o;if(i.signal.aborted)return;let l=Math.max(0,Number(f.remoteOptionsCacheTtlMs)||0);l>0&&A.set(a,{options:s,expiresAt:Date.now()+l}),X(e.key,{options:s.length?s:n,loading:!1})}catch(t){let r=t instanceof Error&&t.message.startsWith(`高级控件请求超时`);if(i.signal.aborted&&!r)return;let a=t instanceof Error?t.message:`高级控件选项加载失败`;X(e.key,{options:n,loading:!1,error:a}),Qe({code:c,variableKey:e.key,message:`${e.label||e.key}:${a}`,cause:t})}finally{k.get(e.key)===i&&k.delete(e.key)}}function tt(e){try{return JSON.stringify([e.type,e.dataSource])}catch{return`${e.key}:${e.type}`}}async function nt(e,n,r,i){let a;if(n.kind===`resolver`){if(!f.optionResolver)throw Error(`缺少 resolver ${n.resolverKey} 的宿主实现`);a=await f.optionResolver({resolverKey:n.resolverKey,params:n.params,variable:e,signal:i.signal})}else{if(!t.isAllowedContractTemplateRemoteUrl(n.url,f.allowedRemoteOrigins))throw Error(`远程地址未在 allowlist 中:${n.url}`);if(!f.requester)throw Error(`缺少宿主 requester,组件库不会直接发起网络请求`);let r=t.normalizeContractTemplateRequestTimeout(n.timeoutMs,f.remoteRequestTimeoutMs);a=await rt(f.requester({url:n.url,method:n.method||`GET`,params:n.params,headers:n.headers,timeoutMs:r,signal:i.signal,variable:e}),i,r)}return t.normalizeContractTemplateControlOptions(a,n.kind===`url`?n:void 0,e.type||`select`)}function rt(e,t,n){return new Promise((r,i)=>{let a=()=>{clearTimeout(c),t.signal.removeEventListener(`abort`,s)},o=e=>{a(),e()},s=()=>o(()=>i(Error(`高级控件请求已取消`))),c=setTimeout(()=>{o(()=>i(Error(`高级控件请求超时(${n}ms)`))),t.abort()},n);t.signal.addEventListener(`abort`,s,{once:!0}),e.then(e=>o(()=>r(e)),e=>o(()=>i(e)))})}function it(e){let t=Y(e);return{variable:e,value:g.value[e.key],errors:Xe(e.key),active:C.value===e.key,readonly:f.readonly,disabled:f.disabled,options:t.options,loading:t.loading,loadError:t.error,updateValue:t=>B(e.key,t),focusVariable:()=>q(e.key)}}function at(){let e=F.value;if(!e.length)return;let t=e.findIndex(e=>e.key===C.value),r=t<0?0:t+1;for(let t=0;t<e.length;t+=1){let i=e[(r+t)%e.length];if(n.isEmptyRenderValue(g.value[i.key])){q(i.key);return}}}function ot(e){let t=E.value.trim().toLocaleLowerCase();return!t||e.key.toLocaleLowerCase().includes(t)||(e.label??``).toLocaleLowerCase().includes(t)?D.value===`unfilled`?n.isEmptyRenderValue(g.value[e.key]):D.value===`error`?Xe(e.key).length>0:!0:!1}function st(){E.value=``,D.value=`all`}function ct(e,t){let n=Ae.value;if(!n.length)return;let r=n.findIndex(t=>t.key===e),i=n[r<0?0:(r+t+n.length)%n.length]?.key;i&&(q(i),(0,s.nextTick)(()=>lt(i)))}function lt(e){(h.value?.querySelector(`[data-field-key="${$(e)}"]`))?.querySelector(`input:not([disabled]), textarea:not([disabled]), button:not([disabled])`)?.focus()}function ut(e){if(e.key!==`Enter`||e.target instanceof HTMLTextAreaElement)return;let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`[data-field-key]`)?.dataset.fieldKey;n&&(e.preventDefault(),ct(n,e.shiftKey?-1:1))}function dt(e){let t=new Set;if(typeof DOMParser<`u`)return new DOMParser().parseFromString(e,`text/html`).querySelectorAll(`[data-key]`).forEach(e=>{let n=e.getAttribute(`data-key`)?.trim();n&&t.add(n)}),t;let n=/\bdata-key\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+))/gi,r;for(;r=n.exec(e);){let e=(r[1]??r[2]??r[3]??``).trim();e&&t.add(e)}return t}function ft(){!f.collapsiblePanel||f.interactionMode!==`panel`||(O.value=!O.value)}function Z(e){let t=gt(e);return T.value=t,p(`update:zoom`,t),t}function pt(){return Z(1)}function mt(){return T.value}function ht(){let e=Math.max(...I.value.map(e=>e.width),1);return Z(Math.max(0,Ce.value-48)/e)}function Q(e){e&&(w.value=e,(0,s.nextTick)(()=>{m.value?.querySelector(`[data-render-page-id="${$(e)}"]`)?.scrollIntoView({behavior:`smooth`,block:`start`,inline:`center`})}))}function gt(e){let t=Number(e);return Number.isFinite(t)?Math.min(me,Math.max(pe,Math.round(t*100)/100)):1}function $(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)}function _t(e,t){let n=new Set([...Object.keys(e),...Object.keys(t)]);return Array.from(n).every(n=>e[n]===t[n])}function vt(e){!(e.ctrlKey||e.metaKey)||!Me.value||(e.preventDefault(),Z(e.deltaY>0?T.value-u:T.value+u))}let yt;function bt(){yt?.removeEventListener(`wheel`,vt),yt=void 0}function xt(e){bt(),e&&(e.addEventListener(`wheel`,vt,{passive:!1}),yt=e)}return(0,s.watch)(m,e=>{xt(e)},{immediate:!0}),(0,s.onBeforeUnmount)(()=>{bt(),K(),k.forEach(e=>e.abort()),k.clear()}),ge({showValidation:W,focusError:e=>{Ye(e),e.variableKey&&(0,s.nextTick)(()=>lt(e.variableKey))},getValues:V,setValues:Ve,validate:H,submit:He,resetValues:Ue,scrollToVariable:q,setZoom:Z,resetZoom:pt,getZoom:mt,fitWidth:ht,scrollToPage:Q}),(e,t)=>((0,s.openBlock)(),(0,s.createElementBlock)(`section`,{ref_key:`rendererElement`,ref:ye,class:(0,s.normalizeClass)([`gd-contract-template-renderer`,{"is-disabled":d.disabled,"is-readonly":d.readonly,"is-panel":d.interactionMode===`panel`,"is-inline":d.interactionMode===`inline`}]),onClick:Re,onKeydown:Be,onInput:Le,onChange:Le},[(0,s.renderSlot)(e.$slots,`fileBar`),Me.value?((0,s.openBlock)(),(0,s.createBlock)(i.default,{key:0,title:d.title,"filled-count":L.value,"total-count":F.value.length,"progress-percent":Ne.value,"required-missing-count":R.value,zoom:T.value,pages:I.value,"active-page-id":w.value,"min-zoom":pe,"max-zoom":me,"show-toolbar":d.showToolbar,"show-validate-button":d.showValidateButton,"show-reset-button":d.showResetButton,"show-submit-button":d.showSubmitButton,"show-panel-toggle":d.interactionMode===`panel`&&d.collapsiblePanel,"panel-collapsed":O.value,readonly:d.readonly,disabled:d.disabled,onZoomIn:t[0]||=e=>Z(T.value+u),onZoomOut:t[1]||=e=>Z(T.value-u),onResetZoom:pt,onFitWidth:ht,onSelectPage:Q,onValidate:H,onReset:We,onSubmit:He,onTogglePanel:ft},{extra:(0,s.withCtx)(()=>[(0,s.renderSlot)(e.$slots,`headerExtra`)]),_:3},8,[`title`,`filled-count`,`total-count`,`progress-percent`,`required-missing-count`,`zoom`,`pages`,`active-page-id`,`show-toolbar`,`show-validate-button`,`show-reset-button`,`show-submit-button`,`show-panel-toggle`,`panel-collapsed`,`readonly`,`disabled`])):(0,s.createCommentVNode)(``,!0),Ie.value?((0,s.openBlock)(),(0,s.createBlock)(o.default,{key:1,passed:Pe.value,summary:Fe.value,errors:P.value,expanded:b.value,onToggle:t[2]||=e=>b.value=!b.value,onFocusError:Ye},null,8,[`passed`,`summary`,`errors`,`expanded`])):(0,s.createCommentVNode)(``,!0),Me.value?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:3,class:(0,s.normalizeClass)([`gd-contract-template-renderer__workspace`,{"is-inline":d.interactionMode===`inline`}])},[(0,s.createElementVNode)(`div`,{ref_key:`pagesViewportElement`,ref:m,class:`gd-contract-template-renderer__pages-viewport`,"data-highlighted-variable-key":S.value},[(0,s.createElementVNode)(`div`,re,[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(I.value,(e,t)=>((0,s.openBlock)(),(0,s.createBlock)(a.default,{key:e.id,page:e,index:t,total:I.value.length,zoom:T.value,"show-meta":d.showPageMeta,"font-base-url":d.contractFontBaseUrl,"active-key":S.value,"scroll-request":xe.value,onInteraction:ze},null,8,[`page`,`index`,`total`,`zoom`,`show-meta`,`font-base-url`,`active-key`,`scroll-request`]))),128))])],8,ne),d.interactionMode===`panel`?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:0,class:(0,s.normalizeClass)([`gd-contract-template-renderer__panel-wrap`,{"is-collapsed":O.value&&d.collapsiblePanel}])},[d.collapsiblePanel?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.Tooltip),{key:0,title:O.value?`展开填写面板`:`收起填写面板`},{default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`button`,{type:`button`,class:`gd-contract-template-renderer__panel-handle`,"aria-label":O.value?`展开填写面板`:`收起填写面板`,"aria-expanded":!O.value,onClick:t[3]||=e=>O.value=!O.value},[O.value?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(ee.LeftOutlined),{key:0,"aria-hidden":`true`})):((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(ee.RightOutlined),{key:1,"aria-hidden":`true`}))],8,ie)]),_:1},8,[`title`])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,ae,[(0,s.createElementVNode)(`aside`,oe,[(0,s.createElementVNode)(`div`,se,[(0,s.createElementVNode)(`div`,ce,[(0,s.createElementVNode)(`div`,null,[t[6]||=(0,s.createElementVNode)(`strong`,null,`填写项`,-1),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(L.value)+` / `+(0,s.toDisplayString)(F.value.length)+` 已填写`,1)]),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(R.value?`${R.value} 项必填未完成`:`必填项已完成`),1)]),(0,s.createVNode)((0,s.unref)(c.Input),{value:E.value,"onUpdate:value":t[4]||=e=>E.value=e,"allow-clear":``,size:`small`,class:`gd-contract-template-renderer__field-search`,placeholder:`搜索字段名称或标识`},{prefix:(0,s.withCtx)(()=>[(0,s.createVNode)((0,s.unref)(ee.SearchOutlined),{"aria-hidden":`true`})]),_:1},8,[`value`]),(0,s.createElementVNode)(`div`,le,[(0,s.createVNode)((0,s.unref)(c.Segmented),{value:D.value,"onUpdate:value":t[5]||=e=>D.value=e,size:`small`,class:`gd-contract-template-renderer__field-filter`,options:ve},null,8,[`value`]),(0,s.createVNode)((0,s.unref)(c.Button),{size:`small`,disabled:!De.value,onClick:at},{default:(0,s.withCtx)(()=>[...t[7]||=[(0,s.createTextVNode)(` 下一个未填项 `,-1)]]),_:1},8,[`disabled`])]),(0,s.createVNode)((0,s.unref)(c.Progress),{percent:Ne.value,size:`small`,"show-info":!1},null,8,[`percent`])]),Ae.value.length?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:1,ref_key:`fieldListElement`,ref:h,class:`gd-contract-template-renderer__field-list`,onKeydownCapture:ut},[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(je.value,t=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:t.id,class:`gd-contract-template-renderer__field-group`},[(0,s.createElementVNode)(`div`,ue,[(0,s.createElementVNode)(`strong`,null,(0,s.toDisplayString)(t.title),1),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(t.variables.length)+` / `+(0,s.toDisplayString)(t.totalCount)+` 项`,1)]),(0,s.createElementVNode)(`div`,de,[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(t.variables,t=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:t.id||t.key,"data-field-key":t.key},[(0,s.renderSlot)(e.$slots,`field`,(0,s.mergeProps)({ref_for:!0},it(t)),()=>[(0,s.createVNode)(r.default,{variable:t,value:g.value[t.key],errors:Xe(t.key),active:C.value===t.key,readonly:d.readonly,disabled:d.disabled,options:Y(t).options,loading:Y(t).loading,"load-error":Y(t).error,registration:Ze(t),"selector-http":d.selectorHttp,"selector-url-prefix":d.selectorUrlPrefix,onUpdateValue:e=>B(t.key,e),onFocusVariable:e=>q(t.key)},null,8,[`variable`,`value`,`errors`,`active`,`readonly`,`disabled`,`options`,`loading`,`load-error`,`registration`,`selector-http`,`selector-url-prefix`,`onUpdateValue`,`onFocusVariable`])])],8,fe))),128))])]))),128))],544)):((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.Empty),{key:0,class:`gd-contract-template-renderer__field-empty`,description:F.value.length?`没有符合条件的填写项`:`暂无填写项`,image:(0,s.unref)(c.Empty).PRESENTED_IMAGE_SIMPLE},(0,s.createSlots)({default:(0,s.withCtx)(()=>[E.value||D.value!==`all`?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.Button),{key:0,type:`link`,size:`small`,onClick:st},{default:(0,s.withCtx)(()=>[...t[9]||=[(0,s.createTextVNode)(`清除筛选`,-1)]]),_:1})):(0,s.createCommentVNode)(``,!0)]),_:2},[E.value||D.value!==`all`?{name:`description`,fn:(0,s.withCtx)(()=>[t[8]||=(0,s.createElementVNode)(`span`,null,`没有符合条件的填写项`,-1)]),key:`0`}:void 0]),1032,[`description`,`image`]))])])],2)):(0,s.createCommentVNode)(``,!0)],2)):((0,s.openBlock)(),(0,s.createElementBlock)(`div`,te,[(0,s.createVNode)((0,s.unref)(c.Empty),{description:`暂无可渲染的合同页面`,image:(0,s.unref)(c.Empty).PRESENTED_IMAGE_SIMPLE},null,8,[`image`])]))],34))}});exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../
|
|
1
|
+
const e=require(`../../../contract-print-css/index.cjs`),t=require(`./utils/signing-mark.cjs`);var n=e.CONTRACT_PRINT_FONT_FAMILY,r=[{label:`合同宋体`,value:n},{label:`文档黑体`,value:e.CONTRACT_PRINT_SANS_FONT_FAMILY}],i=[12,14,16,18,20,24,28,32],a=[{label:`左对齐`,value:`left`},{label:`居中对齐`,value:`center`},{label:`右对齐`,value:`right`}],o=[{format:`paragraph`,label:`正文`,fontSize:14,bold:!1,marginTop:0,marginBottom:10},{format:1,label:`标题 1`,fontSize:28,bold:!0,marginTop:20,marginBottom:12},{format:2,label:`标题 2`,fontSize:24,bold:!0,marginTop:16,marginBottom:10},{format:3,label:`标题 3`,fontSize:20,bold:!0,marginTop:14,marginBottom:8},{format:4,label:`标题 4`,fontSize:18,bold:!0,marginTop:12,marginBottom:8},{format:5,label:`标题 5`,fontSize:16,bold:!0,marginTop:10,marginBottom:6},{format:6,label:`标题 6`,fontSize:14,bold:!0,marginTop:8,marginBottom:6}];function s(e){return o.find(t=>t.format===e)}var c=[{key:`contractTitle`,label:`合同标题`,headingLevel:1,fontSize:26,fontFamily:n,textAlign:`center`,bold:!0,italic:!1,underline:!1},{key:`clauseTitle`,label:`条款标题`,headingLevel:2,fontSize:18,fontFamily:n,textAlign:`left`,bold:!0,italic:!1,underline:!1},{key:`bodyClause`,label:`正文条款`,paragraph:!0,fontSize:14,fontFamily:n,textAlign:`left`,bold:!1,italic:!1,underline:!1},{key:`appendixTitle`,label:`附件标题`,headingLevel:2,fontSize:20,fontFamily:n,textAlign:`center`,bold:!0,italic:!1,underline:!1}];function l(e){return[e.paragraph?{type:`set-paragraph`}:{type:`set-heading`,level:e.headingLevel??2},{type:`set-text-align`,value:e.textAlign},{type:`set-font-family`,value:e.fontFamily},{type:`set-font-size`,value:e.fontSize},e.bold?{type:`set-bold`}:{type:`unset-bold`},e.italic?{type:`set-italic`}:{type:`unset-italic`},e.underline?{type:`set-underline`}:{type:`unset-underline`}]}var u=Object.fromEntries(c.map(e=>[e.key,l(e)]));function d(e){return c.find(t=>t.key===e)}function f(e){return(u[e]??[]).map(e=>({...e}))}function p(e){return String(e||``).replace(/["']/g,``).replace(/\s*,\s*/g,`,`).trim().toLowerCase()}function m(e,t=`append`){let n=t===`replace`?e??r:[...r,...e??[]],i=new Map;return n.forEach(e=>{e?.value&&i.set(p(e.value),e)}),Array.from(i.values())}var h=[`seal`,`signature`,`date`,`area`,`line`].map(e=>({markType:e,label:t.SIGNING_MARK_TYPE_LABELS[e]}));exports.CONTRACT_BLOCK_STYLES=o,exports.CONTRACT_TEXT_STYLE_PRESETS=c,exports.CONTRACT_TEXT_STYLE_PRESET_COMMANDS=u,exports.DEFAULT_CONTRACT_FONT_FAMILY=n,exports.DEFAULT_FONT_FAMILY_OPTIONS=r,exports.DEFAULT_FONT_SIZE_PRESETS=i,exports.DEFAULT_TEXT_ALIGN_OPTIONS=a,exports.SIGNING_MARK_TOOL_ITEMS=h,exports.getContractBlockStyle=s,exports.getContractTextStylePreset=d,exports.normalizeFontFamilyValue=p,exports.resolveContractTextStylePresetCommands=f,exports.resolveFontFamilyOptions=m;
|
package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require(`../../../../_virtual/_rolldown/runtime.cjs`);
|
|
1
|
+
require(`../../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../../contract-print-css/index.cjs`);let t=require(`vue`);var n=`gd-contract-print`,r=.5,i=`合同签署位置:甲方(Company A)编号 2026-08-31。`,a=e.CONTRACT_PRINT_FONT_TIMEOUT_MS+1e3,o=new Set;function s(e){o.forEach(t=>t(e))}function c(e){o.size||window.addEventListener(`message`,s),o.add(e)}function l(e){o.delete(e),o.size||window.removeEventListener(`message`,s)}var u=`合同签署位置甲乙双方`,d=`:,()。;`,f=`20260831`,p={textWidth:379.546875,sansTextWidth:393,variableRowHeight:28},m=`合同排版度量校验失败,禁止生成签署坐标`,h=(0,t.shallowRef)(``);function g(e){h.value=(e?.baseUrl?.trim()??``).replace(/\/+$/,``)}function _(e){let t=e?.trim();return t?t.replace(/\/+$/,``):h.value.trim().replace(/\/+$/,``)}function v(e,t=typeof window>`u`?``:window.location.origin){let n=e.trim().replace(/\/+$/,``);return n?/^https?:\/\//i.test(n)?n:t?new URL(n.startsWith(`/`)?n:`/${n}`,`${t.replace(/\/+$/,``)}/`).href.replace(/\/+$/,``):n.startsWith(`/`)?n:`/${n}`:``}function y(t){let a=`gd-contract-print-${t.messageId}`,o=e.buildContractPrintCss({width:t.width,height:t.height,pages:[{id:t.pageId,pageSize:{width:t.width,height:t.height}}]}),s=JSON.stringify({messageId:t.messageId,parentOrigin:t.parentOrigin,pageId:t.pageId,pageHeight:t.height,timeoutMs:e.CONTRACT_PRINT_FONT_TIMEOUT_MS,fontFamily:e.CONTRACT_PRINT_FONT_FAMILY,sansFontFamily:e.CONTRACT_PRINT_SANS_FONT_FAMILY,latinFontFamily:`"GD Contract Latin", serif`,metricNormalizeCss:e.CONTRACT_PRINT_METRIC_NORMALIZE_CSS.replace(/\s+/g,` `).trim(),sample:i,hanziSample:u,punctSample:d,digitSample:f,hanziAdvance:16,punctAdvance:16,digitAdvance:8,baseline:p,tolerance:r}).replace(/</g,`\\u003c`),c=`width:${t.width}px;min-height:${t.height}px;padding-top:${t.paddingTop}px;padding-bottom:${t.paddingBottom}px`;return`<!doctype html>
|
|
2
2
|
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
@@ -9,9 +9,9 @@ ${b(o)}
|
|
|
9
9
|
</style>
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
|
-
<section class="${x(
|
|
13
|
-
${
|
|
14
|
-
<div class="gd-contract-template-page__content">${
|
|
12
|
+
<section class="${x(t.classNames)}" data-page-id="${x(t.pageId)}" data-page-format="${x(t.pageFormat??`Custom`)}" data-page-width="${t.width}" data-page-height="${t.height}" style="${c}">
|
|
13
|
+
${t.decorationsHtml}
|
|
14
|
+
<div class="gd-contract-template-page__content">${t.contentHtml}</div>
|
|
15
15
|
</section>
|
|
16
16
|
<script nonce="${x(a)}">
|
|
17
17
|
(() => {
|