@guodun/antdv 1.7.10 → 1.7.11
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/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/package.json +5 -4
package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs
CHANGED
|
@@ -6,14 +6,14 @@ import ae from "./ContractTemplateRendererHeader.mjs";
|
|
|
6
6
|
import oe from "./ContractTemplateRendererPage.mjs";
|
|
7
7
|
import se from "./ContractTemplateRendererValidation.mjs";
|
|
8
8
|
import { Fragment as ce, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as le, createTextVNode as ue, createVNode as m, defineComponent as h, mergeProps as de, nextTick as g, normalizeClass as fe, onBeforeUnmount as pe, openBlock as _, ref as v, renderList as me, renderSlot as he, toDisplayString as y, unref as b, watch as x, withCtx as S } from "vue";
|
|
9
|
-
import { Button as ge, Empty as
|
|
10
|
-
import { useElementSize as
|
|
11
|
-
import { LeftOutlined as
|
|
9
|
+
import { Button as ge, Empty as C, Input as _e, Modal as ve, Progress as ye, Segmented as be, Tooltip as xe } from "ant-design-vue";
|
|
10
|
+
import { useElementSize as Se } from "@vueuse/core";
|
|
11
|
+
import { LeftOutlined as Ce, RightOutlined as we, SearchOutlined as Te } from "@ant-design/icons-vue";
|
|
12
12
|
//#region src/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue?vue&type=script&setup=true&lang.ts
|
|
13
|
-
var
|
|
13
|
+
var Ee = {
|
|
14
14
|
key: 2,
|
|
15
15
|
class: "gd-contract-template-renderer__empty"
|
|
16
|
-
},
|
|
16
|
+
}, De = ["data-highlighted-variable-key"], Oe = { class: "gd-contract-template-renderer__pages" }, ke = ["aria-label", "aria-expanded"], Ae = { class: "gd-contract-template-renderer__panel-clip" }, je = { class: "gd-contract-template-renderer__panel" }, Me = { class: "gd-contract-template-renderer__panel-head" }, Ne = { class: "gd-contract-template-renderer__panel-head-row" }, Pe = { class: "gd-contract-template-renderer__panel-head-actions" }, Fe = { class: "gd-contract-template-renderer__field-group-head" }, Ie = { class: "gd-contract-template-renderer__field-group-items" }, Le = ["data-field-key"], Re = .5, ze = 1.5, w = .1, Be = 3e3, Ve = /* @__PURE__ */ h({
|
|
17
17
|
name: "ContractTemplateSingleRenderer",
|
|
18
18
|
__name: "ContractTemplateSingleRenderer",
|
|
19
19
|
props: {
|
|
@@ -87,8 +87,8 @@ var De = {
|
|
|
87
87
|
"update:zoom",
|
|
88
88
|
"control-warning"
|
|
89
89
|
],
|
|
90
|
-
setup(h, { expose:
|
|
91
|
-
let
|
|
90
|
+
setup(h, { expose: Ve, emit: He }) {
|
|
91
|
+
let T = h, E = He, Ue = [
|
|
92
92
|
{
|
|
93
93
|
label: "全部",
|
|
94
94
|
value: "all"
|
|
@@ -101,9 +101,9 @@ var De = {
|
|
|
101
101
|
label: "有错误",
|
|
102
102
|
value: "error"
|
|
103
103
|
}
|
|
104
|
-
],
|
|
105
|
-
let e = { ...
|
|
106
|
-
return
|
|
104
|
+
], We = v(), D = v(), Ge = v(), O = v(c(T.template, T.values)), Ke = v({ ...O.value }), k = v(!1), A = v([]), j = v([]), M = v(!1), N = v(!1), P = v(""), F = v(""), I = v(""), qe = v(0), L = v($t(T.zoom)), R = v(""), z = v("all"), B = v(!1), Je = v(/* @__PURE__ */ new Map()), V = /* @__PURE__ */ new Map(), Ye = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Map(), Xe = /* @__PURE__ */ new Set(), { width: Ze } = Se(D), Qe = l(() => T.readonly || T.disabled), $e = l(() => T.interactionMode === "inline" && !Qe.value), et = l(() => te(T.template)), U = l(() => k.value ? A.value : [...et.value, ...j.value]), W = l(() => (Array.isArray(T.template?.variables) ? T.template.variables : []).filter((t) => !!t?.key && e(t.type ?? "text"))), tt = l(() => {
|
|
105
|
+
let e = { ...O.value };
|
|
106
|
+
return W.value.forEach((t) => {
|
|
107
107
|
let n = Nt(t);
|
|
108
108
|
if (n?.toDisplayText) try {
|
|
109
109
|
e[t.key] = n.toDisplayText(e[t.key], {
|
|
@@ -112,27 +112,24 @@ var De = {
|
|
|
112
112
|
});
|
|
113
113
|
} catch {}
|
|
114
114
|
}), e;
|
|
115
|
-
}), nt = l(() =>
|
|
115
|
+
}), nt = l(() => W.value.filter((e) => s(O.value[e.key])).length), rt = l(() => {
|
|
116
116
|
let e = /* @__PURE__ */ new Map();
|
|
117
|
-
return
|
|
117
|
+
return U.value.forEach((t) => {
|
|
118
118
|
t.variableKey && e.set(t.variableKey, [...e.get(t.variableKey) ?? [], t]);
|
|
119
119
|
}), e;
|
|
120
|
-
}),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}), it = l(() => {
|
|
128
|
-
let e = /* @__PURE__ */ new Map(), t = new Set(U.value.map((e) => e.key));
|
|
129
|
-
return W.value.forEach((n) => {
|
|
120
|
+
}), G = l(() => o(T.template, $e.value ? Ke.value : tt.value, {
|
|
121
|
+
readonly: T.readonly,
|
|
122
|
+
disabled: T.disabled,
|
|
123
|
+
mode: $e.value ? "control" : "display"
|
|
124
|
+
})), it = l(() => {
|
|
125
|
+
let e = /* @__PURE__ */ new Map(), t = new Set(W.value.map((e) => e.key));
|
|
126
|
+
return G.value.forEach((n) => {
|
|
130
127
|
qt(n.contentHtml).forEach((r) => {
|
|
131
128
|
t.has(r) && !e.has(r) && e.set(r, n.id);
|
|
132
129
|
});
|
|
133
130
|
}), e;
|
|
134
|
-
}), at = l(() =>
|
|
135
|
-
let e =
|
|
131
|
+
}), at = l(() => W.value.filter(Ht)), ot = l(() => {
|
|
132
|
+
let e = G.value.map((e, t) => ({
|
|
136
133
|
id: `page:${e.id}`,
|
|
137
134
|
pageId: e.id,
|
|
138
135
|
title: `第 ${t + 1} 页${e.title ? ` · ${e.title}` : ""}`,
|
|
@@ -144,7 +141,7 @@ var De = {
|
|
|
144
141
|
allVariables: [],
|
|
145
142
|
variables: []
|
|
146
143
|
};
|
|
147
|
-
return
|
|
144
|
+
return W.value.forEach((e) => {
|
|
148
145
|
let r = t.get(it.value.get(e.key) ?? "") ?? n;
|
|
149
146
|
r.allVariables.push(e), Ht(e) && r.variables.push(e);
|
|
150
147
|
}), [...e, n].filter((e) => e.variables.length > 0).map((e) => ({
|
|
@@ -153,99 +150,99 @@ var De = {
|
|
|
153
150
|
totalCount: e.allVariables.length,
|
|
154
151
|
variables: e.variables
|
|
155
152
|
}));
|
|
156
|
-
}), st = l(() =>
|
|
157
|
-
x(() =>
|
|
158
|
-
|
|
153
|
+
}), st = l(() => G.value.length > 0), ct = l(() => W.value.filter((e) => !s(O.value[e.key])).length), lt = l(() => W.value.filter((e) => e.required && s(O.value[e.key])).length), ut = l(() => W.value.length ? Math.round(ct.value / W.value.length * 100) : 0), dt = l(() => k.value && A.value.length === 0), ft = l(() => k.value ? dt.value ? "校验通过,模板与填写值均符合规则" : `发现 ${A.value.length} 个模板或填写问题` : j.value.length ? `发现 ${U.value.length} 个模板或填写问题` : et.value.length ? `模板存在 ${et.value.length} 个问题,已安全降级展示` : ""), pt = l(() => k.value ? U.value.length > 0 || N.value : U.value.length > 0);
|
|
154
|
+
x(() => T.template, (e) => {
|
|
155
|
+
K(c(e, T.values), !1), wt();
|
|
159
156
|
let t = Array.isArray(e?.pages) ? e.pages.map((e) => e?.id) : [];
|
|
160
|
-
t.includes(
|
|
157
|
+
t.includes(I.value) || (I.value = t.find(Boolean) ?? ""), F.value && !W.value.some((e) => e.key === F.value) && Ot();
|
|
161
158
|
}, { deep: !0 }), x(() => [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
T.template?.variables,
|
|
160
|
+
T.optionResolver,
|
|
161
|
+
T.requester,
|
|
162
|
+
T.allowedRemoteOrigins,
|
|
163
|
+
T.remoteRequestTimeoutMs,
|
|
164
|
+
T.remoteOptionsCacheTtlMs
|
|
168
165
|
], () => {
|
|
169
166
|
Ft();
|
|
170
167
|
}, {
|
|
171
168
|
deep: !0,
|
|
172
169
|
immediate: !0
|
|
173
|
-
}), x(() =>
|
|
174
|
-
let t = c(
|
|
175
|
-
|
|
176
|
-
}, { deep: !0 }), x(
|
|
177
|
-
e
|
|
178
|
-
}), x(() =>
|
|
179
|
-
e || (
|
|
180
|
-
}), x(() =>
|
|
181
|
-
!
|
|
170
|
+
}), x(() => T.values, (e) => {
|
|
171
|
+
let t = c(T.template, e);
|
|
172
|
+
tn(t, O.value) || (K(t, !1, { refreshInlineHtml: T.interactionMode !== "inline" }), wt());
|
|
173
|
+
}, { deep: !0 }), x($e, (e) => {
|
|
174
|
+
e && (Ke.value = { ...O.value });
|
|
175
|
+
}), x(() => T.collapsiblePanel, (e) => {
|
|
176
|
+
e || (B.value = !1);
|
|
177
|
+
}), x(() => T.zoom, (e) => L.value = $t(e)), x(G, (e) => {
|
|
178
|
+
!I.value && e.length && (I.value = e[0].id);
|
|
182
179
|
}, { immediate: !0 });
|
|
183
|
-
function
|
|
184
|
-
|
|
180
|
+
function K(e, t = !0, n = {}) {
|
|
181
|
+
O.value = { ...e }, n.refreshInlineHtml !== !1 && (Ke.value = { ...e }), t && (E("update:values", { ...O.value }), E("change", { ...O.value }));
|
|
185
182
|
}
|
|
186
|
-
function
|
|
187
|
-
if (!e ||
|
|
188
|
-
if (
|
|
189
|
-
...
|
|
183
|
+
function q(e, t) {
|
|
184
|
+
if (!e || Qe.value) return;
|
|
185
|
+
if (K({
|
|
186
|
+
...O.value,
|
|
190
187
|
[e]: t
|
|
191
|
-
}, !0, { refreshInlineHtml:
|
|
188
|
+
}, !0, { refreshInlineHtml: T.interactionMode !== "inline" }), k.value) {
|
|
192
189
|
bt();
|
|
193
190
|
return;
|
|
194
191
|
}
|
|
195
|
-
let n =
|
|
196
|
-
n && (n.type ?? "text") === "text" && (
|
|
192
|
+
let n = W.value.find((t) => t.key === e);
|
|
193
|
+
n && (n.type ?? "text") === "text" && (j.value = [...j.value.filter((t) => t.variableKey !== e), ...re(n, t)], E("validate", U.value));
|
|
197
194
|
}
|
|
198
195
|
function mt(e) {
|
|
199
|
-
if (
|
|
196
|
+
if (T.interactionMode !== "inline") return;
|
|
200
197
|
let t = e.target;
|
|
201
198
|
if (!(t instanceof HTMLInputElement) && !(t instanceof HTMLTextAreaElement)) return;
|
|
202
199
|
let n = t.dataset.key || "";
|
|
203
|
-
n && (t instanceof HTMLInputElement && t.type === "checkbox" ?
|
|
200
|
+
n && (t instanceof HTMLInputElement && t.type === "checkbox" ? q(n, t.checked) : t instanceof HTMLInputElement && t.type === "number" ? q(n, t.value === "" ? void 0 : t.valueAsNumber) : q(n, t.value));
|
|
204
201
|
}
|
|
205
202
|
function ht(e) {
|
|
206
203
|
let t = e.target;
|
|
207
204
|
if (!(t instanceof Element)) return;
|
|
208
205
|
let n = t.closest("[data-render-page-id]");
|
|
209
|
-
n?.dataset.renderPageId && (
|
|
206
|
+
n?.dataset.renderPageId && (I.value = n.dataset.renderPageId);
|
|
210
207
|
let r = t.closest("[data-contract-render-wrapper], [data-contract-render-control]")?.dataset.key || "";
|
|
211
|
-
r &&
|
|
208
|
+
r && Z(r);
|
|
212
209
|
}
|
|
213
210
|
function gt(e) {
|
|
214
|
-
let t =
|
|
215
|
-
if (!(!t || !n || !qt(t.contentHtml).has(e.key)) && !(e.kind === "input" &&
|
|
216
|
-
if (
|
|
217
|
-
|
|
211
|
+
let t = G.value.find((t) => t.id === e.pageId), n = W.value.some((t) => t.key === e.key);
|
|
212
|
+
if (!(!t || !n || !qt(t.contentHtml).has(e.key)) && !(e.kind === "input" && T.interactionMode !== "inline")) {
|
|
213
|
+
if (I.value = e.pageId, e.kind === "input") {
|
|
214
|
+
q(e.key, e.value);
|
|
218
215
|
return;
|
|
219
216
|
}
|
|
220
|
-
|
|
217
|
+
Z(e.key);
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
function _t(e) {
|
|
224
221
|
if (e.key !== "Enter" && e.key !== " ") return;
|
|
225
222
|
let t = e.target;
|
|
226
|
-
!(t instanceof HTMLElement) || !t.dataset.key || (e.preventDefault(),
|
|
223
|
+
!(t instanceof HTMLElement) || !t.dataset.key || (e.preventDefault(), Z(t.dataset.key));
|
|
227
224
|
}
|
|
228
225
|
function vt() {
|
|
229
|
-
return { ...
|
|
226
|
+
return { ...O.value };
|
|
230
227
|
}
|
|
231
228
|
function yt(e) {
|
|
232
|
-
|
|
229
|
+
K(c(T.template, e));
|
|
233
230
|
}
|
|
234
231
|
function bt() {
|
|
235
|
-
let e = ne(
|
|
236
|
-
return Tt(e),
|
|
232
|
+
let e = ne(T.template, O.value);
|
|
233
|
+
return Tt(e), E("validate", e), e;
|
|
237
234
|
}
|
|
238
235
|
function xt() {
|
|
239
|
-
let e = ee(
|
|
240
|
-
if ((
|
|
236
|
+
let e = ee(T.template, O.value, T.validateOnSubmit);
|
|
237
|
+
if ((T.validateOnSubmit || e.length) && (Tt(e), E("validate", e)), e.length) return At(e[0]), !1;
|
|
241
238
|
let t = vt();
|
|
242
|
-
return
|
|
239
|
+
return E("submit", t), t;
|
|
243
240
|
}
|
|
244
241
|
function St() {
|
|
245
|
-
return
|
|
242
|
+
return K(a(T.template)), wt(), vt();
|
|
246
243
|
}
|
|
247
244
|
function Ct() {
|
|
248
|
-
|
|
245
|
+
Qe.value || ve.confirm({
|
|
249
246
|
title: "重置填写内容?",
|
|
250
247
|
content: "将恢复模板中的默认值,当前未提交的填写内容会被覆盖。",
|
|
251
248
|
okText: "确认重置",
|
|
@@ -254,88 +251,88 @@ var De = {
|
|
|
254
251
|
});
|
|
255
252
|
}
|
|
256
253
|
function wt() {
|
|
257
|
-
|
|
254
|
+
j.value = [], k.value = !1, A.value = [], M.value = !1, N.value = !1, Y();
|
|
258
255
|
}
|
|
259
256
|
function Tt(e) {
|
|
260
|
-
if (
|
|
261
|
-
|
|
257
|
+
if (j.value = [], A.value = e, k.value = !0, M.value = !1, e.length) {
|
|
258
|
+
N.value = !1, Y();
|
|
262
259
|
return;
|
|
263
260
|
}
|
|
264
261
|
Et();
|
|
265
262
|
}
|
|
266
|
-
let
|
|
267
|
-
function
|
|
268
|
-
|
|
263
|
+
let J;
|
|
264
|
+
function Y() {
|
|
265
|
+
J &&= (clearTimeout(J), void 0);
|
|
269
266
|
}
|
|
270
267
|
function Et() {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
},
|
|
268
|
+
Y(), N.value = !0, J = setTimeout(() => {
|
|
269
|
+
N.value = !1, J = void 0;
|
|
270
|
+
}, Be);
|
|
274
271
|
}
|
|
275
|
-
function
|
|
276
|
-
|
|
272
|
+
function X(e) {
|
|
273
|
+
Z(e, !0);
|
|
277
274
|
}
|
|
278
275
|
function Dt(e) {
|
|
279
|
-
|
|
276
|
+
T.interactionMode === "panel" && (B.value &&= !1, W.value.some((t) => t.key === e) && !at.value.some((t) => t.key === e) && Ut());
|
|
280
277
|
}
|
|
281
|
-
function
|
|
278
|
+
function Z(e, t = !1) {
|
|
282
279
|
if (!e) return;
|
|
283
|
-
Dt(e),
|
|
280
|
+
Dt(e), F.value = e, P.value = e;
|
|
284
281
|
let n = it.value.get(e);
|
|
285
|
-
n && (
|
|
282
|
+
n && (I.value = n), t && (qe.value += 1), g(() => {
|
|
286
283
|
kt(e);
|
|
287
|
-
let r = n ?
|
|
284
|
+
let r = n ? D.value?.querySelector(`[data-render-page-id="${en(n)}"]`) : void 0;
|
|
288
285
|
t && r?.scrollIntoView({
|
|
289
286
|
behavior: "smooth",
|
|
290
287
|
block: "center",
|
|
291
288
|
inline: "center"
|
|
292
|
-
}),
|
|
289
|
+
}), T.interactionMode === "panel" && Ge.value?.querySelector(`[data-field-key="${en(e)}"]`)?.scrollIntoView({
|
|
293
290
|
behavior: "smooth",
|
|
294
291
|
block: "nearest"
|
|
295
292
|
});
|
|
296
293
|
});
|
|
297
294
|
}
|
|
298
295
|
function Ot() {
|
|
299
|
-
|
|
296
|
+
F.value = "", P.value = "", kt("");
|
|
300
297
|
}
|
|
301
298
|
function kt(e) {
|
|
302
|
-
|
|
299
|
+
D.value?.querySelectorAll("[data-contract-render-wrapper], [data-contract-render-control]").forEach((t) => t.classList.toggle("is-active", !!e && t.dataset.key === e));
|
|
303
300
|
}
|
|
304
301
|
function At(e) {
|
|
305
|
-
e.variableKey ? (
|
|
302
|
+
e.variableKey ? (X(e.variableKey), T.interactionMode === "panel" && g(() => Gt(e.variableKey))) : e.pageId && Qt(e.pageId);
|
|
306
303
|
}
|
|
307
304
|
function jt(e) {
|
|
308
305
|
return rt.value.get(e) ?? [];
|
|
309
306
|
}
|
|
310
307
|
function Mt(e) {
|
|
311
|
-
return
|
|
308
|
+
return Je.value.get(e.key) ?? {
|
|
312
309
|
options: e.options ?? [],
|
|
313
310
|
loading: !1
|
|
314
311
|
};
|
|
315
312
|
}
|
|
316
313
|
function Nt(e) {
|
|
317
314
|
let t = e.componentKey || e.type || "";
|
|
318
|
-
return t ?
|
|
315
|
+
return t ? T.controlRegistry?.[t] : void 0;
|
|
319
316
|
}
|
|
320
|
-
function
|
|
321
|
-
let n = new Map(
|
|
322
|
-
n.set(e, t),
|
|
317
|
+
function Q(e, t) {
|
|
318
|
+
let n = new Map(Je.value);
|
|
319
|
+
n.set(e, t), Je.value = n;
|
|
323
320
|
}
|
|
324
321
|
function Pt(e) {
|
|
325
|
-
|
|
322
|
+
E("control-warning", e);
|
|
326
323
|
}
|
|
327
324
|
async function Ft() {
|
|
328
|
-
|
|
329
|
-
let e = Array.isArray(
|
|
325
|
+
V.forEach((e) => e.abort()), V.clear(), Ye.clear(), Xe.clear();
|
|
326
|
+
let e = Array.isArray(T.template?.variables) ? T.template.variables : [];
|
|
330
327
|
await Promise.all(e.map(async (e) => {
|
|
331
328
|
if (!e?.key) return;
|
|
332
329
|
let t = Array.isArray(e.options) ? e.options.map((e) => ({ ...e })) : [];
|
|
333
|
-
if (e.dataSource ? await It(e, t) :
|
|
330
|
+
if (e.dataSource ? await It(e, t) : Q(e.key, {
|
|
334
331
|
options: t,
|
|
335
332
|
loading: !1
|
|
336
333
|
}), e.type === "custom" && !Nt(e)) {
|
|
337
334
|
let t = e.componentKey || "", n = `${e.key}:${t}`;
|
|
338
|
-
|
|
335
|
+
Xe.has(n) || (Xe.add(n), Pt({
|
|
339
336
|
code: "CONTROL_COMPONENT_MISSING",
|
|
340
337
|
variableKey: e.key,
|
|
341
338
|
componentKey: t,
|
|
@@ -348,32 +345,32 @@ var De = {
|
|
|
348
345
|
let r = e.dataSource;
|
|
349
346
|
if (!r) return;
|
|
350
347
|
let i = new AbortController();
|
|
351
|
-
|
|
348
|
+
V.set(e.key, i), Q(e.key, {
|
|
352
349
|
options: n,
|
|
353
350
|
loading: !0
|
|
354
351
|
});
|
|
355
|
-
let a = Lt(e), o = Date.now(), s =
|
|
352
|
+
let a = Lt(e), o = Date.now(), s = Ye.get(a);
|
|
356
353
|
if (s && s.expiresAt > o) {
|
|
357
|
-
|
|
354
|
+
Q(e.key, {
|
|
358
355
|
options: s.options,
|
|
359
356
|
loading: !1
|
|
360
|
-
}),
|
|
357
|
+
}), V.delete(e.key);
|
|
361
358
|
return;
|
|
362
359
|
}
|
|
363
360
|
let c = "CONTROL_OPTIONS_LOAD_FAILED";
|
|
364
361
|
try {
|
|
365
|
-
r.kind === "url" && !t(r.url,
|
|
366
|
-
let o =
|
|
367
|
-
o || (o = Rt(e, r, c, i),
|
|
368
|
-
|
|
362
|
+
r.kind === "url" && !t(r.url, T.allowedRemoteOrigins) && (c = "CONTROL_REMOTE_URL_BLOCKED");
|
|
363
|
+
let o = H.get(a);
|
|
364
|
+
o || (o = Rt(e, r, c, i), H.set(a, o), o.finally(() => {
|
|
365
|
+
H.get(a) === o && H.delete(a);
|
|
369
366
|
}).catch(() => void 0));
|
|
370
367
|
let s = await o;
|
|
371
368
|
if (i.signal.aborted) return;
|
|
372
|
-
let ee = Math.max(0, Number(
|
|
373
|
-
ee > 0 &&
|
|
369
|
+
let ee = Math.max(0, Number(T.remoteOptionsCacheTtlMs) || 0);
|
|
370
|
+
ee > 0 && Ye.set(a, {
|
|
374
371
|
options: s,
|
|
375
372
|
expiresAt: Date.now() + ee
|
|
376
|
-
}),
|
|
373
|
+
}), Q(e.key, {
|
|
377
374
|
options: s.length ? s : n,
|
|
378
375
|
loading: !1
|
|
379
376
|
});
|
|
@@ -381,7 +378,7 @@ var De = {
|
|
|
381
378
|
let r = t instanceof Error && t.message.startsWith("高级控件请求超时");
|
|
382
379
|
if (i.signal.aborted && !r) return;
|
|
383
380
|
let a = t instanceof Error ? t.message : "高级控件选项加载失败";
|
|
384
|
-
|
|
381
|
+
Q(e.key, {
|
|
385
382
|
options: n,
|
|
386
383
|
loading: !1,
|
|
387
384
|
error: a
|
|
@@ -392,7 +389,7 @@ var De = {
|
|
|
392
389
|
cause: t
|
|
393
390
|
});
|
|
394
391
|
} finally {
|
|
395
|
-
|
|
392
|
+
V.get(e.key) === i && V.delete(e.key);
|
|
396
393
|
}
|
|
397
394
|
}
|
|
398
395
|
function Lt(e) {
|
|
@@ -405,18 +402,18 @@ var De = {
|
|
|
405
402
|
async function Rt(e, r, a, o) {
|
|
406
403
|
let s;
|
|
407
404
|
if (r.kind === "resolver") {
|
|
408
|
-
if (!
|
|
409
|
-
s = await
|
|
405
|
+
if (!T.optionResolver) throw Error(`缺少 resolver ${r.resolverKey} 的宿主实现`);
|
|
406
|
+
s = await T.optionResolver({
|
|
410
407
|
resolverKey: r.resolverKey,
|
|
411
408
|
params: r.params,
|
|
412
409
|
variable: e,
|
|
413
410
|
signal: o.signal
|
|
414
411
|
});
|
|
415
412
|
} else {
|
|
416
|
-
if (!t(r.url,
|
|
417
|
-
if (!
|
|
418
|
-
let n = i(r.timeoutMs,
|
|
419
|
-
s = await zt(
|
|
413
|
+
if (!t(r.url, T.allowedRemoteOrigins)) throw Error(`远程地址未在 allowlist 中:${r.url}`);
|
|
414
|
+
if (!T.requester) throw Error("缺少宿主 requester,组件库不会直接发起网络请求");
|
|
415
|
+
let n = i(r.timeoutMs, T.remoteRequestTimeoutMs);
|
|
416
|
+
s = await zt(T.requester({
|
|
420
417
|
url: r.url,
|
|
421
418
|
method: r.method || "GET",
|
|
422
419
|
params: r.params,
|
|
@@ -444,45 +441,45 @@ var De = {
|
|
|
444
441
|
let t = Mt(e);
|
|
445
442
|
return {
|
|
446
443
|
variable: e,
|
|
447
|
-
value:
|
|
444
|
+
value: O.value[e.key],
|
|
448
445
|
errors: jt(e.key),
|
|
449
|
-
active:
|
|
450
|
-
readonly:
|
|
451
|
-
disabled:
|
|
446
|
+
active: F.value === e.key,
|
|
447
|
+
readonly: T.readonly,
|
|
448
|
+
disabled: T.disabled,
|
|
452
449
|
options: t.options,
|
|
453
450
|
loading: t.loading,
|
|
454
451
|
loadError: t.error,
|
|
455
|
-
updateValue: (t) =>
|
|
456
|
-
focusVariable: () =>
|
|
452
|
+
updateValue: (t) => q(e.key, t),
|
|
453
|
+
focusVariable: () => X(e.key)
|
|
457
454
|
};
|
|
458
455
|
}
|
|
459
456
|
function Vt() {
|
|
460
|
-
let e =
|
|
457
|
+
let e = W.value;
|
|
461
458
|
if (!e.length) return;
|
|
462
|
-
let t = e.findIndex((e) => e.key ===
|
|
459
|
+
let t = e.findIndex((e) => e.key === F.value), n = t < 0 ? 0 : t + 1;
|
|
463
460
|
for (let t = 0; t < e.length; t += 1) {
|
|
464
461
|
let r = e[(n + t) % e.length];
|
|
465
|
-
if (s(
|
|
466
|
-
|
|
462
|
+
if (s(O.value[r.key])) {
|
|
463
|
+
X(r.key);
|
|
467
464
|
return;
|
|
468
465
|
}
|
|
469
466
|
}
|
|
470
467
|
}
|
|
471
468
|
function Ht(e) {
|
|
472
|
-
let t =
|
|
473
|
-
return !t || e.key.toLocaleLowerCase().includes(t) || (e.label ?? "").toLocaleLowerCase().includes(t) ?
|
|
469
|
+
let t = R.value.trim().toLocaleLowerCase();
|
|
470
|
+
return !t || e.key.toLocaleLowerCase().includes(t) || (e.label ?? "").toLocaleLowerCase().includes(t) ? z.value === "unfilled" ? s(O.value[e.key]) : z.value === "error" ? jt(e.key).length > 0 : !0 : !1;
|
|
474
471
|
}
|
|
475
472
|
function Ut() {
|
|
476
|
-
|
|
473
|
+
R.value = "", z.value = "all";
|
|
477
474
|
}
|
|
478
475
|
function Wt(e, t) {
|
|
479
476
|
let n = at.value;
|
|
480
477
|
if (!n.length) return;
|
|
481
478
|
let r = n.findIndex((t) => t.key === e), i = n[r < 0 ? 0 : (r + t + n.length) % n.length]?.key;
|
|
482
|
-
i && (
|
|
479
|
+
i && (X(i), g(() => Gt(i)));
|
|
483
480
|
}
|
|
484
481
|
function Gt(e) {
|
|
485
|
-
(
|
|
482
|
+
(Ge.value?.querySelector(`[data-field-key="${en(e)}"]`))?.querySelector("input:not([disabled]), textarea:not([disabled]), button:not([disabled])")?.focus();
|
|
486
483
|
}
|
|
487
484
|
function Kt(e) {
|
|
488
485
|
if (e.key !== "Enter" || e.target instanceof HTMLTextAreaElement) return;
|
|
@@ -505,25 +502,25 @@ var De = {
|
|
|
505
502
|
return t;
|
|
506
503
|
}
|
|
507
504
|
function Jt() {
|
|
508
|
-
!
|
|
505
|
+
!T.collapsiblePanel || T.interactionMode !== "panel" || (B.value = !B.value);
|
|
509
506
|
}
|
|
510
|
-
function
|
|
507
|
+
function $(e) {
|
|
511
508
|
let t = $t(e);
|
|
512
|
-
return
|
|
509
|
+
return L.value = t, E("update:zoom", t), t;
|
|
513
510
|
}
|
|
514
511
|
function Yt() {
|
|
515
|
-
return
|
|
512
|
+
return $(1);
|
|
516
513
|
}
|
|
517
514
|
function Xt() {
|
|
518
|
-
return
|
|
515
|
+
return L.value;
|
|
519
516
|
}
|
|
520
517
|
function Zt() {
|
|
521
|
-
let e = Math.max(...
|
|
522
|
-
return
|
|
518
|
+
let e = Math.max(...G.value.map((e) => e.width), 1);
|
|
519
|
+
return $(Math.max(0, Ze.value - 48) / e);
|
|
523
520
|
}
|
|
524
521
|
function Qt(e) {
|
|
525
|
-
e && (
|
|
526
|
-
|
|
522
|
+
e && (I.value = e, g(() => {
|
|
523
|
+
D.value?.querySelector(`[data-render-page-id="${en(e)}"]`)?.scrollIntoView({
|
|
527
524
|
behavior: "smooth",
|
|
528
525
|
block: "start",
|
|
529
526
|
inline: "center"
|
|
@@ -532,30 +529,30 @@ var De = {
|
|
|
532
529
|
}
|
|
533
530
|
function $t(e) {
|
|
534
531
|
let t = Number(e);
|
|
535
|
-
return Number.isFinite(t) ? Math.min(
|
|
532
|
+
return Number.isFinite(t) ? Math.min(ze, Math.max(Re, Math.round(t * 100) / 100)) : 1;
|
|
536
533
|
}
|
|
537
|
-
function
|
|
534
|
+
function en(e) {
|
|
538
535
|
return e.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
|
|
539
536
|
}
|
|
540
|
-
function
|
|
537
|
+
function tn(e, t) {
|
|
541
538
|
let n = new Set([...Object.keys(e), ...Object.keys(t)]);
|
|
542
539
|
return Array.from(n).every((n) => e[n] === t[n]);
|
|
543
540
|
}
|
|
544
|
-
function
|
|
545
|
-
!(e.ctrlKey || e.metaKey) || !st.value || (e.preventDefault(),
|
|
541
|
+
function nn(e) {
|
|
542
|
+
!(e.ctrlKey || e.metaKey) || !st.value || (e.preventDefault(), $(e.deltaY > 0 ? L.value - w : L.value + w));
|
|
546
543
|
}
|
|
547
|
-
let
|
|
548
|
-
function
|
|
549
|
-
|
|
544
|
+
let rn;
|
|
545
|
+
function an() {
|
|
546
|
+
rn?.removeEventListener("wheel", nn), rn = void 0;
|
|
550
547
|
}
|
|
551
|
-
function
|
|
552
|
-
|
|
548
|
+
function on(e) {
|
|
549
|
+
an(), e && (e.addEventListener("wheel", nn, { passive: !1 }), rn = e);
|
|
553
550
|
}
|
|
554
|
-
return x(
|
|
555
|
-
|
|
551
|
+
return x(D, (e) => {
|
|
552
|
+
on(e);
|
|
556
553
|
}, { immediate: !0 }), pe(() => {
|
|
557
|
-
|
|
558
|
-
}),
|
|
554
|
+
an(), Y(), V.forEach((e) => e.abort()), V.clear();
|
|
555
|
+
}), Ve({
|
|
559
556
|
showValidation: Tt,
|
|
560
557
|
focusError: (e) => {
|
|
561
558
|
At(e), e.variableKey && g(() => Gt(e.variableKey));
|
|
@@ -565,15 +562,15 @@ var De = {
|
|
|
565
562
|
validate: bt,
|
|
566
563
|
submit: xt,
|
|
567
564
|
resetValues: St,
|
|
568
|
-
scrollToVariable:
|
|
569
|
-
setZoom:
|
|
565
|
+
scrollToVariable: X,
|
|
566
|
+
setZoom: $,
|
|
570
567
|
resetZoom: Yt,
|
|
571
568
|
getZoom: Xt,
|
|
572
569
|
fitWidth: Zt,
|
|
573
570
|
scrollToPage: Qt
|
|
574
571
|
}), (e, t) => (_(), f("section", {
|
|
575
572
|
ref_key: "rendererElement",
|
|
576
|
-
ref:
|
|
573
|
+
ref: We,
|
|
577
574
|
class: fe(["gd-contract-template-renderer", {
|
|
578
575
|
"is-disabled": h.disabled,
|
|
579
576
|
"is-readonly": h.readonly,
|
|
@@ -590,24 +587,24 @@ var De = {
|
|
|
590
587
|
key: 0,
|
|
591
588
|
title: h.title,
|
|
592
589
|
"filled-count": ct.value,
|
|
593
|
-
"total-count":
|
|
590
|
+
"total-count": W.value.length,
|
|
594
591
|
"progress-percent": ut.value,
|
|
595
592
|
"required-missing-count": lt.value,
|
|
596
|
-
zoom:
|
|
597
|
-
pages:
|
|
598
|
-
"active-page-id":
|
|
599
|
-
"min-zoom":
|
|
600
|
-
"max-zoom":
|
|
593
|
+
zoom: L.value,
|
|
594
|
+
pages: G.value,
|
|
595
|
+
"active-page-id": I.value,
|
|
596
|
+
"min-zoom": Re,
|
|
597
|
+
"max-zoom": ze,
|
|
601
598
|
"show-toolbar": h.showToolbar,
|
|
602
599
|
"show-validate-button": h.showValidateButton,
|
|
603
600
|
"show-reset-button": h.showResetButton,
|
|
604
601
|
"show-submit-button": h.showSubmitButton,
|
|
605
602
|
"show-panel-toggle": h.interactionMode === "panel" && h.collapsiblePanel,
|
|
606
|
-
"panel-collapsed":
|
|
603
|
+
"panel-collapsed": B.value,
|
|
607
604
|
readonly: h.readonly,
|
|
608
605
|
disabled: h.disabled,
|
|
609
|
-
onZoomIn: t[0] ||= (e) =>
|
|
610
|
-
onZoomOut: t[1] ||= (e) =>
|
|
606
|
+
onZoomIn: t[0] ||= (e) => $(L.value + w),
|
|
607
|
+
onZoomOut: t[1] ||= (e) => $(L.value - w),
|
|
611
608
|
onResetZoom: Yt,
|
|
612
609
|
onFitWidth: Zt,
|
|
613
610
|
onSelectPage: Qt,
|
|
@@ -640,9 +637,9 @@ var De = {
|
|
|
640
637
|
key: 1,
|
|
641
638
|
passed: dt.value,
|
|
642
639
|
summary: ft.value,
|
|
643
|
-
errors:
|
|
644
|
-
expanded:
|
|
645
|
-
onToggle: t[2] ||= (e) =>
|
|
640
|
+
errors: U.value,
|
|
641
|
+
expanded: M.value,
|
|
642
|
+
onToggle: t[2] ||= (e) => M.value = !M.value,
|
|
646
643
|
onFocusError: At
|
|
647
644
|
}, null, 8, [
|
|
648
645
|
"passed",
|
|
@@ -655,19 +652,19 @@ var De = {
|
|
|
655
652
|
class: fe(["gd-contract-template-renderer__workspace", { "is-inline": h.interactionMode === "inline" }])
|
|
656
653
|
}, [p("div", {
|
|
657
654
|
ref_key: "pagesViewportElement",
|
|
658
|
-
ref:
|
|
655
|
+
ref: D,
|
|
659
656
|
class: "gd-contract-template-renderer__pages-viewport",
|
|
660
|
-
"data-highlighted-variable-key":
|
|
661
|
-
}, [p("div",
|
|
657
|
+
"data-highlighted-variable-key": P.value
|
|
658
|
+
}, [p("div", Oe, [(_(!0), f(ce, null, me(G.value, (e, t) => (_(), u(oe, {
|
|
662
659
|
key: e.id,
|
|
663
660
|
page: e,
|
|
664
661
|
index: t,
|
|
665
|
-
total:
|
|
666
|
-
zoom:
|
|
662
|
+
total: G.value.length,
|
|
663
|
+
zoom: L.value,
|
|
667
664
|
"show-meta": h.showPageMeta,
|
|
668
665
|
"font-base-url": h.contractFontBaseUrl,
|
|
669
|
-
"active-key":
|
|
670
|
-
"scroll-request":
|
|
666
|
+
"active-key": P.value,
|
|
667
|
+
"scroll-request": qe.value,
|
|
671
668
|
onInteraction: gt
|
|
672
669
|
}, null, 8, [
|
|
673
670
|
"page",
|
|
@@ -678,46 +675,46 @@ var De = {
|
|
|
678
675
|
"font-base-url",
|
|
679
676
|
"active-key",
|
|
680
677
|
"scroll-request"
|
|
681
|
-
]))), 128))])], 8,
|
|
678
|
+
]))), 128))])], 8, De), h.interactionMode === "panel" ? (_(), f("div", {
|
|
682
679
|
key: 0,
|
|
683
|
-
class: fe(["gd-contract-template-renderer__panel-wrap", { "is-collapsed":
|
|
684
|
-
}, [h.collapsiblePanel ? (_(), u(b(
|
|
680
|
+
class: fe(["gd-contract-template-renderer__panel-wrap", { "is-collapsed": B.value && h.collapsiblePanel }])
|
|
681
|
+
}, [h.collapsiblePanel ? (_(), u(b(xe), {
|
|
685
682
|
key: 0,
|
|
686
|
-
title:
|
|
683
|
+
title: B.value ? "展开填写面板" : "收起填写面板"
|
|
687
684
|
}, {
|
|
688
685
|
default: S(() => [p("button", {
|
|
689
686
|
type: "button",
|
|
690
687
|
class: "gd-contract-template-renderer__panel-handle",
|
|
691
|
-
"aria-label":
|
|
692
|
-
"aria-expanded": !
|
|
693
|
-
onClick: t[3] ||= (e) =>
|
|
694
|
-
}, [
|
|
688
|
+
"aria-label": B.value ? "展开填写面板" : "收起填写面板",
|
|
689
|
+
"aria-expanded": !B.value,
|
|
690
|
+
onClick: t[3] ||= (e) => B.value = !B.value
|
|
691
|
+
}, [B.value ? (_(), u(b(Ce), {
|
|
695
692
|
key: 0,
|
|
696
693
|
"aria-hidden": "true"
|
|
697
|
-
})) : (_(), u(b(
|
|
694
|
+
})) : (_(), u(b(we), {
|
|
698
695
|
key: 1,
|
|
699
696
|
"aria-hidden": "true"
|
|
700
|
-
}))], 8,
|
|
697
|
+
}))], 8, ke)]),
|
|
701
698
|
_: 1
|
|
702
|
-
}, 8, ["title"])) : d("", !0), p("div",
|
|
703
|
-
p("div",
|
|
704
|
-
m(b(
|
|
705
|
-
value:
|
|
706
|
-
"onUpdate:value": t[4] ||= (e) =>
|
|
699
|
+
}, 8, ["title"])) : d("", !0), p("div", Ae, [p("aside", je, [p("div", Me, [
|
|
700
|
+
p("div", Ne, [p("div", null, [t[6] ||= p("strong", null, "填写项", -1), p("span", null, y(ct.value) + " / " + y(W.value.length) + " 已填写", 1)]), p("span", null, y(lt.value ? `${lt.value} 项必填未完成` : "必填项已完成"), 1)]),
|
|
701
|
+
m(b(_e), {
|
|
702
|
+
value: R.value,
|
|
703
|
+
"onUpdate:value": t[4] ||= (e) => R.value = e,
|
|
707
704
|
"allow-clear": "",
|
|
708
705
|
size: "small",
|
|
709
706
|
class: "gd-contract-template-renderer__field-search",
|
|
710
707
|
placeholder: "搜索字段名称或标识"
|
|
711
708
|
}, {
|
|
712
|
-
prefix: S(() => [m(b(
|
|
709
|
+
prefix: S(() => [m(b(Te), { "aria-hidden": "true" })]),
|
|
713
710
|
_: 1
|
|
714
711
|
}, 8, ["value"]),
|
|
715
|
-
p("div",
|
|
716
|
-
value:
|
|
717
|
-
"onUpdate:value": t[5] ||= (e) =>
|
|
712
|
+
p("div", Pe, [m(b(be), {
|
|
713
|
+
value: z.value,
|
|
714
|
+
"onUpdate:value": t[5] ||= (e) => z.value = e,
|
|
718
715
|
size: "small",
|
|
719
716
|
class: "gd-contract-template-renderer__field-filter",
|
|
720
|
-
options:
|
|
717
|
+
options: Ue
|
|
721
718
|
}, null, 8, ["value"]), m(b(ge), {
|
|
722
719
|
size: "small",
|
|
723
720
|
disabled: !nt.value,
|
|
@@ -726,7 +723,7 @@ var De = {
|
|
|
726
723
|
default: S(() => [...t[7] ||= [ue(" 下一个未填项 ", -1)]]),
|
|
727
724
|
_: 1
|
|
728
725
|
}, 8, ["disabled"])]),
|
|
729
|
-
m(b(
|
|
726
|
+
m(b(ye), {
|
|
730
727
|
percent: ut.value,
|
|
731
728
|
size: "small",
|
|
732
729
|
"show-info": !1
|
|
@@ -734,20 +731,20 @@ var De = {
|
|
|
734
731
|
]), at.value.length ? (_(), f("div", {
|
|
735
732
|
key: 1,
|
|
736
733
|
ref_key: "fieldListElement",
|
|
737
|
-
ref:
|
|
734
|
+
ref: Ge,
|
|
738
735
|
class: "gd-contract-template-renderer__field-list",
|
|
739
736
|
onKeydownCapture: Kt
|
|
740
737
|
}, [(_(!0), f(ce, null, me(ot.value, (t) => (_(), f("div", {
|
|
741
738
|
key: t.id,
|
|
742
739
|
class: "gd-contract-template-renderer__field-group"
|
|
743
|
-
}, [p("div",
|
|
740
|
+
}, [p("div", Fe, [p("strong", null, y(t.title), 1), p("span", null, y(t.variables.length) + " / " + y(t.totalCount) + " 项", 1)]), p("div", Ie, [(_(!0), f(ce, null, me(t.variables, (t) => (_(), f("div", {
|
|
744
741
|
key: t.id || t.key,
|
|
745
742
|
"data-field-key": t.key
|
|
746
743
|
}, [he(e.$slots, "field", de({ ref_for: !0 }, Bt(t)), () => [m(ie, {
|
|
747
744
|
variable: t,
|
|
748
|
-
value:
|
|
745
|
+
value: O.value[t.key],
|
|
749
746
|
errors: jt(t.key),
|
|
750
|
-
active:
|
|
747
|
+
active: F.value === t.key,
|
|
751
748
|
readonly: h.readonly,
|
|
752
749
|
disabled: h.disabled,
|
|
753
750
|
options: Mt(t).options,
|
|
@@ -756,8 +753,8 @@ var De = {
|
|
|
756
753
|
registration: Nt(t),
|
|
757
754
|
"selector-http": h.selectorHttp,
|
|
758
755
|
"selector-url-prefix": h.selectorUrlPrefix,
|
|
759
|
-
onUpdateValue: (e) =>
|
|
760
|
-
onFocusVariable: (e) =>
|
|
756
|
+
onUpdateValue: (e) => q(t.key, e),
|
|
757
|
+
onFocusVariable: (e) => X(t.key)
|
|
761
758
|
}, null, 8, [
|
|
762
759
|
"variable",
|
|
763
760
|
"value",
|
|
@@ -773,13 +770,13 @@ var De = {
|
|
|
773
770
|
"selector-url-prefix",
|
|
774
771
|
"onUpdateValue",
|
|
775
772
|
"onFocusVariable"
|
|
776
|
-
])])], 8,
|
|
773
|
+
])])], 8, Le))), 128))])]))), 128))], 544)) : (_(), u(b(C), {
|
|
777
774
|
key: 0,
|
|
778
775
|
class: "gd-contract-template-renderer__field-empty",
|
|
779
|
-
description:
|
|
780
|
-
image: b(
|
|
776
|
+
description: W.value.length ? "没有符合条件的填写项" : "暂无填写项",
|
|
777
|
+
image: b(C).PRESENTED_IMAGE_SIMPLE
|
|
781
778
|
}, le({
|
|
782
|
-
default: S(() => [
|
|
779
|
+
default: S(() => [R.value || z.value !== "all" ? (_(), u(b(ge), {
|
|
783
780
|
key: 0,
|
|
784
781
|
type: "link",
|
|
785
782
|
size: "small",
|
|
@@ -789,16 +786,16 @@ var De = {
|
|
|
789
786
|
_: 1
|
|
790
787
|
})) : d("", !0)]),
|
|
791
788
|
_: 2
|
|
792
|
-
}, [
|
|
789
|
+
}, [R.value || z.value !== "all" ? {
|
|
793
790
|
name: "description",
|
|
794
791
|
fn: S(() => [t[8] ||= p("span", null, "没有符合条件的填写项", -1)]),
|
|
795
792
|
key: "0"
|
|
796
|
-
} : void 0]), 1032, ["description", "image"]))])])], 2)) : d("", !0)], 2)) : (_(), f("div",
|
|
793
|
+
} : void 0]), 1032, ["description", "image"]))])])], 2)) : d("", !0)], 2)) : (_(), f("div", Ee, [m(b(C), {
|
|
797
794
|
description: "暂无可渲染的合同页面",
|
|
798
|
-
image: b(
|
|
795
|
+
image: b(C).PRESENTED_IMAGE_SIMPLE
|
|
799
796
|
}, null, 8, ["image"])]))
|
|
800
797
|
], 34));
|
|
801
798
|
}
|
|
802
799
|
});
|
|
803
800
|
//#endregion
|
|
804
|
-
export {
|
|
801
|
+
export { Ve as default };
|