@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.
@@ -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 _e, Input as ve, Modal as ye, Progress as be, Segmented as xe, Tooltip as Se } from "ant-design-vue";
10
- import { useElementSize as Ce } from "@vueuse/core";
11
- import { LeftOutlined as we, RightOutlined as Te, SearchOutlined as Ee } from "@ant-design/icons-vue";
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 De = {
13
+ var Ee = {
14
14
  key: 2,
15
15
  class: "gd-contract-template-renderer__empty"
16
- }, Oe = ["data-highlighted-variable-key"], ke = { class: "gd-contract-template-renderer__pages" }, Ae = ["aria-label", "aria-expanded"], je = { class: "gd-contract-template-renderer__panel-clip" }, Me = { class: "gd-contract-template-renderer__panel" }, Ne = { class: "gd-contract-template-renderer__panel-head" }, Pe = { class: "gd-contract-template-renderer__panel-head-row" }, Fe = { class: "gd-contract-template-renderer__panel-head-actions" }, Ie = { class: "gd-contract-template-renderer__field-group-head" }, Le = { class: "gd-contract-template-renderer__field-group-items" }, Re = ["data-field-key"], ze = .5, Be = 1.5, C = .1, Ve = 3e3, He = /* @__PURE__ */ h({
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: He, emit: Ue }) {
91
- let w = h, T = Ue, We = [
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
- ], Ge = v(), E = v(), Ke = v(), D = v(c(w.template, w.values)), qe = v({ ...D.value }), O = v(!1), k = v([]), A = v([]), j = v(!1), M = v(!1), N = v(""), P = v(""), F = v(""), Je = v(0), I = v($t(w.zoom)), L = v(""), R = v("all"), z = v(!1), Ye = v(/* @__PURE__ */ new Map()), B = /* @__PURE__ */ new Map(), Xe = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ new Set(), { width: Qe } = Ce(E), $e = l(() => w.readonly || w.disabled), et = l(() => te(w.template)), H = l(() => O.value ? k.value : [...et.value, ...A.value]), U = l(() => (Array.isArray(w.template?.variables) ? w.template.variables : []).filter((t) => !!t?.key && e(t.type ?? "text"))), tt = l(() => {
105
- let e = { ...D.value };
106
- return U.value.forEach((t) => {
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(() => U.value.filter((e) => s(D.value[e.key])).length), rt = 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 H.value.forEach((t) => {
117
+ return U.value.forEach((t) => {
118
118
  t.variableKey && e.set(t.variableKey, [...e.get(t.variableKey) ?? [], t]);
119
119
  }), e;
120
- }), W = l(() => {
121
- let e = w.interactionMode === "panel";
122
- return o(w.template, e ? tt.value : qe.value, {
123
- readonly: w.readonly,
124
- disabled: w.disabled,
125
- mode: e ? "display" : "control"
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(() => U.value.filter(Ht)), ot = l(() => {
135
- let e = W.value.map((e, t) => ({
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 U.value.forEach((e) => {
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(() => W.value.length > 0), ct = l(() => U.value.filter((e) => !s(D.value[e.key])).length), lt = l(() => U.value.filter((e) => e.required && s(D.value[e.key])).length), ut = l(() => U.value.length ? Math.round(ct.value / U.value.length * 100) : 0), dt = l(() => O.value && k.value.length === 0), ft = l(() => O.value ? dt.value ? "校验通过,模板与填写值均符合规则" : `发现 ${k.value.length} 个模板或填写问题` : A.value.length ? `发现 ${H.value.length} 个模板或填写问题` : et.value.length ? `模板存在 ${et.value.length} 个问题,已安全降级展示` : ""), pt = l(() => O.value ? H.value.length > 0 || M.value : H.value.length > 0);
157
- x(() => w.template, (e) => {
158
- G(c(e, w.values), !1), wt();
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(F.value) || (F.value = t.find(Boolean) ?? ""), P.value && !U.value.some((e) => e.key === P.value) && Ot();
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
- w.template?.variables,
163
- w.optionResolver,
164
- w.requester,
165
- w.allowedRemoteOrigins,
166
- w.remoteRequestTimeoutMs,
167
- w.remoteOptionsCacheTtlMs
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(() => w.values, (e) => {
174
- let t = c(w.template, e);
175
- en(t, D.value) || (G(t, !1, { refreshInlineHtml: w.interactionMode !== "inline" }), wt());
176
- }, { deep: !0 }), x(() => w.interactionMode, (e) => {
177
- e === "inline" && (qe.value = { ...D.value });
178
- }), x(() => w.collapsiblePanel, (e) => {
179
- e || (z.value = !1);
180
- }), x(() => w.zoom, (e) => I.value = $t(e)), x(W, (e) => {
181
- !F.value && e.length && (F.value = e[0].id);
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 G(e, t = !0, n = {}) {
184
- D.value = { ...e }, n.refreshInlineHtml !== !1 && (qe.value = { ...e }), t && (T("update:values", { ...D.value }), T("change", { ...D.value }));
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 K(e, t) {
187
- if (!e || $e.value) return;
188
- if (G({
189
- ...D.value,
183
+ function q(e, t) {
184
+ if (!e || Qe.value) return;
185
+ if (K({
186
+ ...O.value,
190
187
  [e]: t
191
- }, !0, { refreshInlineHtml: w.interactionMode !== "inline" }), O.value) {
188
+ }, !0, { refreshInlineHtml: T.interactionMode !== "inline" }), k.value) {
192
189
  bt();
193
190
  return;
194
191
  }
195
- let n = U.value.find((t) => t.key === e);
196
- n && (n.type ?? "text") === "text" && (A.value = [...A.value.filter((t) => t.variableKey !== e), ...re(n, t)], T("validate", H.value));
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 (w.interactionMode !== "inline") return;
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" ? K(n, t.checked) : t instanceof HTMLInputElement && t.type === "number" ? K(n, t.value === "" ? void 0 : t.valueAsNumber) : K(n, t.value));
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 && (F.value = 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 && X(r);
208
+ r && Z(r);
212
209
  }
213
210
  function gt(e) {
214
- let t = W.value.find((t) => t.id === e.pageId), n = U.value.some((t) => t.key === e.key);
215
- if (!(!t || !n || !qt(t.contentHtml).has(e.key)) && !(e.kind === "input" && w.interactionMode !== "inline")) {
216
- if (F.value = e.pageId, e.kind === "input") {
217
- K(e.key, e.value);
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
- X(e.key);
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(), X(t.dataset.key));
223
+ !(t instanceof HTMLElement) || !t.dataset.key || (e.preventDefault(), Z(t.dataset.key));
227
224
  }
228
225
  function vt() {
229
- return { ...D.value };
226
+ return { ...O.value };
230
227
  }
231
228
  function yt(e) {
232
- G(c(w.template, e));
229
+ K(c(T.template, e));
233
230
  }
234
231
  function bt() {
235
- let e = ne(w.template, D.value);
236
- return Tt(e), T("validate", e), 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(w.template, D.value, w.validateOnSubmit);
240
- if ((w.validateOnSubmit || e.length) && (Tt(e), T("validate", e)), e.length) return At(e[0]), !1;
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 T("submit", t), t;
239
+ return E("submit", t), t;
243
240
  }
244
241
  function St() {
245
- return G(a(w.template)), wt(), vt();
242
+ return K(a(T.template)), wt(), vt();
246
243
  }
247
244
  function Ct() {
248
- $e.value || ye.confirm({
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
- A.value = [], O.value = !1, k.value = [], j.value = !1, M.value = !1, J();
254
+ j.value = [], k.value = !1, A.value = [], M.value = !1, N.value = !1, Y();
258
255
  }
259
256
  function Tt(e) {
260
- if (A.value = [], k.value = e, O.value = !0, j.value = !1, e.length) {
261
- M.value = !1, J();
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 q;
267
- function J() {
268
- q &&= (clearTimeout(q), void 0);
263
+ let J;
264
+ function Y() {
265
+ J &&= (clearTimeout(J), void 0);
269
266
  }
270
267
  function Et() {
271
- J(), M.value = !0, q = setTimeout(() => {
272
- M.value = !1, q = void 0;
273
- }, Ve);
268
+ Y(), N.value = !0, J = setTimeout(() => {
269
+ N.value = !1, J = void 0;
270
+ }, Be);
274
271
  }
275
- function Y(e) {
276
- X(e, !0);
272
+ function X(e) {
273
+ Z(e, !0);
277
274
  }
278
275
  function Dt(e) {
279
- w.interactionMode === "panel" && (z.value &&= !1, U.value.some((t) => t.key === e) && !at.value.some((t) => t.key === e) && Ut());
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 X(e, t = !1) {
278
+ function Z(e, t = !1) {
282
279
  if (!e) return;
283
- Dt(e), P.value = e, N.value = e;
280
+ Dt(e), F.value = e, P.value = e;
284
281
  let n = it.value.get(e);
285
- n && (F.value = n), t && (Je.value += 1), g(() => {
282
+ n && (I.value = n), t && (qe.value += 1), g(() => {
286
283
  kt(e);
287
- let r = n ? E.value?.querySelector(`[data-render-page-id="${$(n)}"]`) : void 0;
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
- }), w.interactionMode === "panel" && Ke.value?.querySelector(`[data-field-key="${$(e)}"]`)?.scrollIntoView({
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
- P.value = "", N.value = "", kt("");
296
+ F.value = "", P.value = "", kt("");
300
297
  }
301
298
  function kt(e) {
302
- E.value?.querySelectorAll("[data-contract-render-wrapper], [data-contract-render-control]").forEach((t) => t.classList.toggle("is-active", !!e && t.dataset.key === e));
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 ? (Y(e.variableKey), w.interactionMode === "panel" && g(() => Gt(e.variableKey))) : e.pageId && Qt(e.pageId);
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 Ye.value.get(e.key) ?? {
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 ? w.controlRegistry?.[t] : void 0;
315
+ return t ? T.controlRegistry?.[t] : void 0;
319
316
  }
320
- function Z(e, t) {
321
- let n = new Map(Ye.value);
322
- n.set(e, t), Ye.value = n;
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
- T("control-warning", e);
322
+ E("control-warning", e);
326
323
  }
327
324
  async function Ft() {
328
- B.forEach((e) => e.abort()), B.clear(), Xe.clear(), Ze.clear();
329
- let e = Array.isArray(w.template?.variables) ? w.template.variables : [];
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) : Z(e.key, {
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
- Ze.has(n) || (Ze.add(n), Pt({
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
- B.set(e.key, i), Z(e.key, {
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 = Xe.get(a);
352
+ let a = Lt(e), o = Date.now(), s = Ye.get(a);
356
353
  if (s && s.expiresAt > o) {
357
- Z(e.key, {
354
+ Q(e.key, {
358
355
  options: s.options,
359
356
  loading: !1
360
- }), B.delete(e.key);
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, w.allowedRemoteOrigins) && (c = "CONTROL_REMOTE_URL_BLOCKED");
366
- let o = V.get(a);
367
- o || (o = Rt(e, r, c, i), V.set(a, o), o.finally(() => {
368
- V.get(a) === o && V.delete(a);
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(w.remoteOptionsCacheTtlMs) || 0);
373
- ee > 0 && Xe.set(a, {
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
- }), Z(e.key, {
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
- Z(e.key, {
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
- B.get(e.key) === i && B.delete(e.key);
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 (!w.optionResolver) throw Error(`缺少 resolver ${r.resolverKey} 的宿主实现`);
409
- s = await w.optionResolver({
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, w.allowedRemoteOrigins)) throw Error(`远程地址未在 allowlist 中:${r.url}`);
417
- if (!w.requester) throw Error("缺少宿主 requester,组件库不会直接发起网络请求");
418
- let n = i(r.timeoutMs, w.remoteRequestTimeoutMs);
419
- s = await zt(w.requester({
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: D.value[e.key],
444
+ value: O.value[e.key],
448
445
  errors: jt(e.key),
449
- active: P.value === e.key,
450
- readonly: w.readonly,
451
- disabled: w.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) => K(e.key, t),
456
- focusVariable: () => Y(e.key)
452
+ updateValue: (t) => q(e.key, t),
453
+ focusVariable: () => X(e.key)
457
454
  };
458
455
  }
459
456
  function Vt() {
460
- let e = U.value;
457
+ let e = W.value;
461
458
  if (!e.length) return;
462
- let t = e.findIndex((e) => e.key === P.value), n = t < 0 ? 0 : t + 1;
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(D.value[r.key])) {
466
- Y(r.key);
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 = L.value.trim().toLocaleLowerCase();
473
- return !t || e.key.toLocaleLowerCase().includes(t) || (e.label ?? "").toLocaleLowerCase().includes(t) ? R.value === "unfilled" ? s(D.value[e.key]) : R.value === "error" ? jt(e.key).length > 0 : !0 : !1;
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
- L.value = "", R.value = "all";
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 && (Y(i), g(() => Gt(i)));
479
+ i && (X(i), g(() => Gt(i)));
483
480
  }
484
481
  function Gt(e) {
485
- (Ke.value?.querySelector(`[data-field-key="${$(e)}"]`))?.querySelector("input:not([disabled]), textarea:not([disabled]), button:not([disabled])")?.focus();
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
- !w.collapsiblePanel || w.interactionMode !== "panel" || (z.value = !z.value);
505
+ !T.collapsiblePanel || T.interactionMode !== "panel" || (B.value = !B.value);
509
506
  }
510
- function Q(e) {
507
+ function $(e) {
511
508
  let t = $t(e);
512
- return I.value = t, T("update:zoom", t), t;
509
+ return L.value = t, E("update:zoom", t), t;
513
510
  }
514
511
  function Yt() {
515
- return Q(1);
512
+ return $(1);
516
513
  }
517
514
  function Xt() {
518
- return I.value;
515
+ return L.value;
519
516
  }
520
517
  function Zt() {
521
- let e = Math.max(...W.value.map((e) => e.width), 1);
522
- return Q(Math.max(0, Qe.value - 48) / e);
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 && (F.value = e, g(() => {
526
- E.value?.querySelector(`[data-render-page-id="${$(e)}"]`)?.scrollIntoView({
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(Be, Math.max(ze, Math.round(t * 100) / 100)) : 1;
532
+ return Number.isFinite(t) ? Math.min(ze, Math.max(Re, Math.round(t * 100) / 100)) : 1;
536
533
  }
537
- function $(e) {
534
+ function en(e) {
538
535
  return e.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
539
536
  }
540
- function en(e, t) {
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 tn(e) {
545
- !(e.ctrlKey || e.metaKey) || !st.value || (e.preventDefault(), Q(e.deltaY > 0 ? I.value - C : I.value + C));
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 nn;
548
- function rn() {
549
- nn?.removeEventListener("wheel", tn), nn = void 0;
544
+ let rn;
545
+ function an() {
546
+ rn?.removeEventListener("wheel", nn), rn = void 0;
550
547
  }
551
- function an(e) {
552
- rn(), e && (e.addEventListener("wheel", tn, { passive: !1 }), nn = e);
548
+ function on(e) {
549
+ an(), e && (e.addEventListener("wheel", nn, { passive: !1 }), rn = e);
553
550
  }
554
- return x(E, (e) => {
555
- an(e);
551
+ return x(D, (e) => {
552
+ on(e);
556
553
  }, { immediate: !0 }), pe(() => {
557
- rn(), J(), B.forEach((e) => e.abort()), B.clear();
558
- }), He({
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: Y,
569
- setZoom: Q,
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: Ge,
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": U.value.length,
590
+ "total-count": W.value.length,
594
591
  "progress-percent": ut.value,
595
592
  "required-missing-count": lt.value,
596
- zoom: I.value,
597
- pages: W.value,
598
- "active-page-id": F.value,
599
- "min-zoom": ze,
600
- "max-zoom": Be,
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": z.value,
603
+ "panel-collapsed": B.value,
607
604
  readonly: h.readonly,
608
605
  disabled: h.disabled,
609
- onZoomIn: t[0] ||= (e) => Q(I.value + C),
610
- onZoomOut: t[1] ||= (e) => Q(I.value - C),
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: H.value,
644
- expanded: j.value,
645
- onToggle: t[2] ||= (e) => j.value = !j.value,
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: E,
655
+ ref: D,
659
656
  class: "gd-contract-template-renderer__pages-viewport",
660
- "data-highlighted-variable-key": N.value
661
- }, [p("div", ke, [(_(!0), f(ce, null, me(W.value, (e, t) => (_(), u(oe, {
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: W.value.length,
666
- zoom: I.value,
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": N.value,
670
- "scroll-request": Je.value,
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, Oe), h.interactionMode === "panel" ? (_(), f("div", {
678
+ ]))), 128))])], 8, De), h.interactionMode === "panel" ? (_(), f("div", {
682
679
  key: 0,
683
- class: fe(["gd-contract-template-renderer__panel-wrap", { "is-collapsed": z.value && h.collapsiblePanel }])
684
- }, [h.collapsiblePanel ? (_(), u(b(Se), {
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: z.value ? "展开填写面板" : "收起填写面板"
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": z.value ? "展开填写面板" : "收起填写面板",
692
- "aria-expanded": !z.value,
693
- onClick: t[3] ||= (e) => z.value = !z.value
694
- }, [z.value ? (_(), u(b(we), {
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(Te), {
694
+ })) : (_(), u(b(we), {
698
695
  key: 1,
699
696
  "aria-hidden": "true"
700
- }))], 8, Ae)]),
697
+ }))], 8, ke)]),
701
698
  _: 1
702
- }, 8, ["title"])) : d("", !0), p("div", je, [p("aside", Me, [p("div", Ne, [
703
- p("div", Pe, [p("div", null, [t[6] ||= p("strong", null, "填写项", -1), p("span", null, y(ct.value) + " / " + y(U.value.length) + " 已填写", 1)]), p("span", null, y(lt.value ? `${lt.value} 项必填未完成` : "必填项已完成"), 1)]),
704
- m(b(ve), {
705
- value: L.value,
706
- "onUpdate:value": t[4] ||= (e) => L.value = 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(Ee), { "aria-hidden": "true" })]),
709
+ prefix: S(() => [m(b(Te), { "aria-hidden": "true" })]),
713
710
  _: 1
714
711
  }, 8, ["value"]),
715
- p("div", Fe, [m(b(xe), {
716
- value: R.value,
717
- "onUpdate:value": t[5] ||= (e) => R.value = 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: We
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(be), {
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: Ke,
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", Ie, [p("strong", null, y(t.title), 1), p("span", null, y(t.variables.length) + " / " + y(t.totalCount) + " 项", 1)]), p("div", Le, [(_(!0), f(ce, null, me(t.variables, (t) => (_(), f("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: D.value[t.key],
745
+ value: O.value[t.key],
749
746
  errors: jt(t.key),
750
- active: P.value === t.key,
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) => K(t.key, e),
760
- onFocusVariable: (e) => Y(t.key)
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, Re))), 128))])]))), 128))], 544)) : (_(), u(b(_e), {
773
+ ])])], 8, Le))), 128))])]))), 128))], 544)) : (_(), u(b(C), {
777
774
  key: 0,
778
775
  class: "gd-contract-template-renderer__field-empty",
779
- description: U.value.length ? "没有符合条件的填写项" : "暂无填写项",
780
- image: b(_e).PRESENTED_IMAGE_SIMPLE
776
+ description: W.value.length ? "没有符合条件的填写项" : "暂无填写项",
777
+ image: b(C).PRESENTED_IMAGE_SIMPLE
781
778
  }, le({
782
- default: S(() => [L.value || R.value !== "all" ? (_(), u(b(ge), {
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
- }, [L.value || R.value !== "all" ? {
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", De, [m(b(_e), {
793
+ } : void 0]), 1032, ["description", "image"]))])])], 2)) : d("", !0)], 2)) : (_(), f("div", Ee, [m(b(C), {
797
794
  description: "暂无可渲染的合同页面",
798
- image: b(_e).PRESENTED_IMAGE_SIMPLE
795
+ image: b(C).PRESENTED_IMAGE_SIMPLE
799
796
  }, null, 8, ["image"])]))
800
797
  ], 34));
801
798
  }
802
799
  });
803
800
  //#endregion
804
- export { He as default };
801
+ export { Ve as default };