@guodun/antdv 1.7.0 → 1.7.1

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.
@@ -2,13 +2,13 @@ import "../../pro-contract-template-designer/src/utils/contract-print-document.m
2
2
  import { CONTRACT_SIGNING_SEAL_TYPE_OPTIONS as e } from "./constants.mjs";
3
3
  import { clampContractSigningPlacement as t, clampContractSigningZoom as n, normalizeContractSigningCoordinateScale as r, resolveContractSigningSealSizeLimit as i } from "./coordinates.mjs";
4
4
  import { isContractSigningTemplateFile as a } from "./template-source.mjs";
5
- import { ContractSigningLocationBuildError as o, buildContractSigningLocationOutput as ee, cloneContractSigningLocationValue as s, createContractSigningLocationValue as c, createContractSigningPlacement as te, findContractSigningPage as l, getContractSigningHomePage as ne, isContractSigningPageUsable as re, normalizeContractSigningLocationValue as u, normalizeContractSigningProviderValue as ie, patchContractSigningPlacement as ae, resolveContractSigningPreviewPageSize as oe, validateContractSigningLocationValue as se } from "./location-rules.mjs";
6
- import ce from "./ContractSigningLocationCanvas.mjs";
7
- import le from "./ContractSigningLocationInspector.mjs";
8
- import ue from "./ContractSigningLocationNavigator.mjs";
9
- import { ContractSigningPreviewRequests as de } from "./preview-requests.mjs";
10
- import { computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as fe, createVNode as g, defineComponent as pe, nextTick as _, normalizeClass as me, normalizeStyle as he, onBeforeUnmount as ge, openBlock as v, ref as y, shallowRef as b, toDisplayString as _e, unref as x, watch as S, withCtx as C } from "vue";
11
- import { Button as w, Tooltip as ve } from "ant-design-vue";
5
+ import { ContractSigningLocationBuildError as o, buildContractSigningLocationOutput as ee, cloneContractSigningLocationValue as s, createContractSigningLocationValue as c, createContractSigningPlacement as te, findContractSigningPage as l, getContractSigningHomePage as ne, isContractSigningPageUsable as re, normalizeContractSigningLocationValue as u, normalizeContractSigningProviderValue as ie, patchContractSigningPlacement as ae, resolveContractSigningDefaultSealTypes as oe, resolveContractSigningPreviewPageSize as se, validateContractSigningLocationValue as ce } from "./location-rules.mjs";
6
+ import le from "./ContractSigningLocationCanvas.mjs";
7
+ import ue from "./ContractSigningLocationInspector.mjs";
8
+ import de from "./ContractSigningLocationNavigator.mjs";
9
+ import { ContractSigningPreviewRequests as fe } from "./preview-requests.mjs";
10
+ import { computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as pe, nextTick as v, normalizeClass as me, normalizeStyle as he, onBeforeUnmount as ge, openBlock as y, ref as b, shallowRef as x, toDisplayString as _e, unref as S, watch as C, withCtx as w } from "vue";
11
+ import { Button as T, Tooltip as ve } from "ant-design-vue";
12
12
  import { LeftOutlined as ye, ReloadOutlined as be, RightOutlined as xe } from "@ant-design/icons-vue";
13
13
  //#region src/components/contract-signing-location/src/ContractSigningLocation.vue?vue&type=script&setup=true&lang.ts
14
14
  var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "gd-ant-contract-signing-location__title" }, we = { class: "gd-ant-contract-signing-location__header-actions" }, Te = { class: "gd-ant-contract-signing-location__placement-count" }, Ee = {
@@ -24,6 +24,8 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
24
24
  contractId: { default: "" },
25
25
  dataProvider: { default: void 0 },
26
26
  sealTypeOptions: { default: () => e.map((e) => ({ ...e })) },
27
+ defaultSealTypes: { default: void 0 },
28
+ referencePlacements: { default: () => [] },
27
29
  allowedPlacementTypes: { default: () => [
28
30
  "seal",
29
31
  "signature",
@@ -73,118 +75,121 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
73
75
  "error"
74
76
  ],
75
77
  setup(e, { expose: pe, emit: je }) {
76
- let T = e, E = je, D = d(() => i(T.sealMinSize, T.sealMaxSize)), O = u(T.modelValue ?? c(T.contractId), {
77
- sealSizeLimit: D.value,
78
- sealTypeOptions: T.sealTypeOptions
79
- }), k = b(O), Me = b(s(O)), A = b(O.files[0]?.fileId ?? ""), j = b(O.files[0]?.pages[0]?.pageIndex ?? 0), M = b(""), N = b(!1), P = b(""), F = y([]), I = y({}), L = b(Je(T.zoom)), R = y(null), z = y(!1), B = y(!1), V = b("loading"), Ne = b(""), H = 0, U = !1, Pe, W = [], Fe = 0, G = new de(), K = d(() => T.mode === "preview"), Ie = d(() => K.value || T.readonly || T.disabled), Le = d(() => T.showInspector ?? !K.value), Re = d(() => !K.value && T.showSubmitButton), ze = d(() => k.value.files.length <= 1), Be = d(() => Ot(T.height)), q = d(() => k.value.files.find((e) => e.fileId === A.value) ?? k.value.files[0]), J = d(() => a(q.value) && V.value !== "ready"), Y = d(() => Ie.value || J.value), Ve = d(() => q.value?.pages.find((e) => e.pageIndex === j.value) ?? q.value?.pages[0]), He = d(() => {
80
- let e = q.value;
81
- return e ? k.value.placements.filter((t) => t.fileId === e.fileId) : [];
82
- }), X = d(() => k.value.placements.find((e) => e.id === M.value)), Ue = d(() => {
83
- let e = X.value;
84
- return e ? l(k.value, e.fileId, e.pageIndex) ?? Ve.value : Ve.value;
85
- }), We = d(() => F.value.filter((e) => e.endsWith(":thumbnail")).map((e) => e.slice(0, -10))), Ge = d(() => Object.keys(I.value).filter((e) => e.endsWith(":thumbnail")).map((e) => e.slice(0, -10))), Ke = d(() => F.value.filter((e) => e.endsWith(":preview")).map((e) => e.slice(0, -8))), qe = d(() => {
78
+ let E = e, D = je, O = d(() => i(E.sealMinSize, E.sealMaxSize)), k = u(E.modelValue ?? c(E.contractId), {
79
+ sealSizeLimit: O.value,
80
+ sealTypeOptions: E.sealTypeOptions
81
+ }), A = x(k), Me = x(s(k)), j = x(k.files[0]?.fileId ?? ""), M = x(k.files[0]?.pages[0]?.pageIndex ?? 0), N = x(""), P = x(!1), F = x(""), I = b([]), L = b({}), R = x(Ye(E.zoom)), z = b(null), B = b(!1), V = b(!1), H = x("loading"), Ne = x(""), U = 0, W = !1, Pe, G = [], Fe = 0, K = new fe(), q = d(() => E.mode === "preview"), Ie = d(() => q.value || E.readonly || E.disabled), Le = d(() => E.showInspector ?? !q.value), Re = d(() => !q.value && E.showSubmitButton), ze = d(() => A.value.files.length <= 1), Be = d(() => At(E.height)), J = d(() => A.value.files.find((e) => e.fileId === j.value) ?? A.value.files[0]), Y = d(() => a(J.value) && H.value !== "ready"), X = d(() => Ie.value || Y.value), Ve = d(() => J.value?.pages.find((e) => e.pageIndex === M.value) ?? J.value?.pages[0]), He = d(() => {
82
+ let e = J.value;
83
+ return e ? A.value.placements.filter((t) => t.fileId === e.fileId) : [];
84
+ }), Ue = d(() => {
85
+ let e = J.value;
86
+ return e ? E.referencePlacements.filter((t) => t.fileId === e.fileId) : [];
87
+ }), Z = d(() => A.value.placements.find((e) => e.id === N.value)), We = d(() => {
88
+ let e = Z.value;
89
+ return e ? l(A.value, e.fileId, e.pageIndex) ?? Ve.value : Ve.value;
90
+ }), Ge = d(() => I.value.filter((e) => e.endsWith(":thumbnail")).map((e) => e.slice(0, -10))), Ke = d(() => Object.keys(L.value).filter((e) => e.endsWith(":thumbnail")).map((e) => e.slice(0, -10))), qe = d(() => I.value.filter((e) => e.endsWith(":preview")).map((e) => e.slice(0, -8))), Je = d(() => {
86
91
  let e = {};
87
- return Object.entries(I.value).forEach(([t, n]) => {
92
+ return Object.entries(L.value).forEach(([t, n]) => {
88
93
  t.endsWith(":preview") && (e[t.slice(0, -8)] = n);
89
94
  }), e;
90
95
  });
91
- S(() => T.modelValue, (e) => {
96
+ C(() => E.modelValue, (e) => {
92
97
  if (!e) return;
93
98
  let t = u(e, {
94
- sealSizeLimit: D.value,
95
- sealTypeOptions: T.sealTypeOptions
99
+ sealSizeLimit: O.value,
100
+ sealTypeOptions: E.sealTypeOptions
96
101
  });
97
- $(t) !== $(k.value) && (Ct(), k.value = t, Me.value = s(t), vt(), _(() => R.value?.scrollToPage(j.value)));
98
- }, { deep: !0 }), S(D, () => {
99
- $(u(k.value, {
100
- sealSizeLimit: D.value,
101
- sealTypeOptions: T.sealTypeOptions
102
- })) !== $(k.value) && Z(k.value);
103
- }), S(() => T.zoom, (e) => {
104
- L.value = Je(e);
105
- }), S(() => q.value?.fileId, () => {
106
- V.value = a(q.value) ? "loading" : "ready", Ne.value = "";
107
- }), S(() => [
108
- T.contractId,
109
- T.dataProvider,
110
- T.autoLoad
102
+ Ot(t) !== Ot(A.value) && (wt(), A.value = t, Me.value = s(t), yt(), v(() => z.value?.scrollToPage(M.value)));
103
+ }, { deep: !0 }), C(O, () => {
104
+ Ot(u(A.value, {
105
+ sealSizeLimit: O.value,
106
+ sealTypeOptions: E.sealTypeOptions
107
+ })) !== Ot(A.value) && Q(A.value);
108
+ }), C(() => E.zoom, (e) => {
109
+ R.value = Ye(e);
110
+ }), C(() => J.value?.fileId, () => {
111
+ H.value = a(J.value) ? "loading" : "ready", Ne.value = "";
112
+ }), C(() => [
113
+ E.contractId,
114
+ E.dataProvider,
115
+ E.autoLoad
111
116
  ], ([e, t, n], r) => {
112
- !n || !t || !e || (!r || e !== r[0] || t !== r[1]) && Ze();
117
+ !n || !t || !e || (!r || e !== r[0] || t !== r[1]) && Qe();
113
118
  }, { immediate: !0 }), ge(() => {
114
- U = !0, H += 1, St(), Ct();
119
+ W = !0, U += 1, Ct(), wt();
115
120
  });
116
- function Je(e) {
117
- return n(e, Math.min(T.minZoom, T.maxZoom), Math.max(T.minZoom, T.maxZoom));
118
- }
119
121
  function Ye(e) {
120
- let t = Je(e);
121
- L.value = t, E("update:zoom", t);
122
- }
123
- function Xe() {
124
- return R.value?.fitWidth() ?? L.value;
125
- }
126
- function Z(e, t = {}) {
127
- k.value = u(e, {
128
- sealSizeLimit: D.value,
129
- sealTypeOptions: T.sealTypeOptions
130
- }), t.clearError !== !1 && (P.value = ""), vt();
131
- let n = s(k.value);
132
- return E("update:modelValue", n), E("change", n), n;
133
- }
134
- async function Ze() {
135
- let e = String(T.contractId || k.value.contractId || "").trim();
136
- if (!T.dataProvider) return Q({
122
+ return n(e, Math.min(E.minZoom, E.maxZoom), Math.max(E.minZoom, E.maxZoom));
123
+ }
124
+ function Xe(e) {
125
+ let t = Ye(e);
126
+ R.value = t, D("update:zoom", t);
127
+ }
128
+ function Ze() {
129
+ return z.value?.fitWidth() ?? R.value;
130
+ }
131
+ function Q(e, t = {}) {
132
+ A.value = u(e, {
133
+ sealSizeLimit: O.value,
134
+ sealTypeOptions: E.sealTypeOptions
135
+ }), t.clearError !== !1 && (F.value = ""), yt();
136
+ let n = s(A.value);
137
+ return D("update:modelValue", n), D("change", n), n;
138
+ }
139
+ async function Qe() {
140
+ let e = String(E.contractId || A.value.contractId || "").trim();
141
+ if (!E.dataProvider) return $({
137
142
  code: "CONTRACT_PROVIDER_MISSING",
138
143
  message: "未配置合同数据提供器,请由宿主传入文件数据"
139
144
  }), !1;
140
- if (!e) return Q({
145
+ if (!e) return $({
141
146
  code: "CONTRACT_ID_MISSING",
142
147
  message: "缺少用于加载合同的 PaaS contractId"
143
148
  }), !1;
144
- let t = ++H;
145
- Ct(), N.value = !0, P.value = "";
149
+ let t = ++U;
150
+ wt(), P.value = !0, F.value = "";
146
151
  try {
147
- let n = await T.dataProvider.loadContract({ contractId: e });
148
- if (U || t !== H) return !1;
149
- let i = ie(n, r(T.dataProvider.coordinateScale)), a = u({
152
+ let n = await E.dataProvider.loadContract({ contractId: e });
153
+ if (W || t !== U) return !1;
154
+ let i = ie(n, r(E.dataProvider.coordinateScale)), a = u({
150
155
  ...i,
151
156
  contractId: e,
152
- placements: i.placements.length ? i.placements : k.value.contractId === e ? k.value.placements : []
157
+ placements: i.placements.length ? i.placements : A.value.contractId === e ? A.value.placements : []
153
158
  }, {
154
- sealSizeLimit: D.value,
155
- sealTypeOptions: T.sealTypeOptions
159
+ sealSizeLimit: O.value,
160
+ sealTypeOptions: E.sealTypeOptions
156
161
  });
157
- k.value = a, Me.value = s(a), M.value = "", vt();
162
+ A.value = a, Me.value = s(a), N.value = "", yt();
158
163
  let o = s(a);
159
- return E("update:modelValue", o), E("change", o), E("ready", o), Qe(), _(() => R.value?.scrollToPage(j.value)), o;
164
+ return D("update:modelValue", o), D("change", o), D("ready", o), $e(), v(() => z.value?.scrollToPage(M.value)), o;
160
165
  } catch (e) {
161
- return U || t !== H || Q(yt(e, "CONTRACT_LOAD_FAILED", "合同加载失败,请检查授权后重试")), !1;
166
+ return W || t !== U || $(bt(e, "CONTRACT_LOAD_FAILED", "合同加载失败,请检查授权后重试")), !1;
162
167
  } finally {
163
- !U && t === H && (N.value = !1);
168
+ !W && t === U && (P.value = !1);
164
169
  }
165
170
  }
166
- async function Qe() {
167
- T.dataProvider?.loadPagePreview && await Promise.allSettled(k.value.files.map((e) => {
171
+ async function $e() {
172
+ E.dataProvider?.loadPagePreview && await Promise.allSettled(A.value.files.map((e) => {
168
173
  if (a(e)) return Promise.resolve();
169
174
  let t = ne(e.pages);
170
- return t && !t.thumbnailUrl ? $e(e.fileId, t.pageIndex, !0) : Promise.resolve();
175
+ return t && !t.thumbnailUrl ? et(e.fileId, t.pageIndex, !0) : Promise.resolve();
171
176
  }));
172
177
  }
173
- async function $e(e, t, n) {
174
- let i = T.dataProvider?.loadPagePreview, o = k.value.files.find((t) => t.fileId === e), ee = l(k.value, e, t), s = bt(e, t, n);
175
- if (!i || a(o) || !ee || F.value.includes(s)) return;
176
- xt(s), F.value = [...F.value, s];
177
- let c = G.start(s);
178
+ async function et(e, t, n) {
179
+ let i = E.dataProvider?.loadPagePreview, o = A.value.files.find((t) => t.fileId === e), ee = l(A.value, e, t), s = xt(e, t, n);
180
+ if (!i || a(o) || !ee || I.value.includes(s)) return;
181
+ St(s), I.value = [...I.value, s];
182
+ let c = K.start(s);
178
183
  try {
179
184
  let a = await i({
180
- contractId: k.value.contractId || T.contractId,
185
+ contractId: A.value.contractId || E.contractId,
181
186
  fileId: e,
182
187
  pageIndex: t,
183
188
  thumbnail: n,
184
189
  signal: c.signal
185
190
  });
186
- if (U || !G.isCurrent(s, c) || !l(k.value, e, t)) return;
187
- let o = oe(l(k.value, e, t), a, r(T.dataProvider?.coordinateScale), n), ee = k.value.files.map((r) => r.fileId === e ? {
191
+ if (W || !K.isCurrent(s, c) || !l(A.value, e, t)) return;
192
+ let o = se(l(A.value, e, t), a, r(E.dataProvider?.coordinateScale), n), ee = A.value.files.map((r) => r.fileId === e ? {
188
193
  ...r,
189
194
  pages: r.pages.map((e) => e.pageIndex === t ? {
190
195
  ...e,
@@ -192,74 +197,74 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
192
197
  ...n ? { thumbnailUrl: a.url } : { previewUrl: a.url }
193
198
  } : e)
194
199
  } : r);
195
- Z({
196
- ...k.value,
200
+ Q({
201
+ ...A.value,
197
202
  files: ee
198
203
  }, { clearError: !1 });
199
204
  } catch (n) {
200
- if (!G.isCurrent(s, c) || wt(n)) return;
201
- let r = yt(n, "CONTRACT_PREVIEW_FAILED", "合同页面预览加载失败,可切换页面或重试", {
205
+ if (!K.isCurrent(s, c) || Tt(n)) return;
206
+ let r = bt(n, "CONTRACT_PREVIEW_FAILED", "合同页面预览加载失败,可切换页面或重试", {
202
207
  fileId: e,
203
208
  pageIndex: t
204
209
  });
205
- E("error", r), I.value = {
206
- ...I.value,
210
+ D("error", r), L.value = {
211
+ ...L.value,
207
212
  [s]: r.message
208
213
  };
209
214
  } finally {
210
- G.finish(s, c) && (F.value = F.value.filter((e) => e !== s));
215
+ K.finish(s, c) && (I.value = I.value.filter((e) => e !== s));
211
216
  }
212
217
  }
213
- function et(e) {
214
- if (e === A.value) return;
215
- let t = A.value;
216
- St(), t && (Ct((e) => e.startsWith(`${t}:`) && e.endsWith(":preview")), W = W.filter((t) => t.fileId === e)), A.value = e, j.value = ne(k.value.files.find((t) => t.fileId === e)?.pages)?.pageIndex ?? 0, M.value = "", E("file-change", e), E("page-change", e, j.value), _(() => R.value?.scrollToPage(j.value));
217
- }
218
218
  function tt(e) {
219
- j.value = e;
219
+ if (e === j.value) return;
220
+ let t = j.value;
221
+ Ct(), t && (wt((e) => e.startsWith(`${t}:`) && e.endsWith(":preview")), G = G.filter((t) => t.fileId === e)), j.value = e, M.value = ne(A.value.files.find((t) => t.fileId === e)?.pages)?.pageIndex ?? 0, N.value = "", D("file-change", e), D("page-change", e, M.value), v(() => z.value?.scrollToPage(M.value));
220
222
  }
221
223
  function nt(e) {
222
- j.value !== e && (j.value = e), E("page-change", A.value, e);
224
+ M.value = e;
223
225
  }
224
226
  function rt(e) {
225
- St();
226
- let t = A.value;
227
+ M.value !== e && (M.value = e), D("page-change", j.value, e);
228
+ }
229
+ function it(e) {
230
+ Ct();
231
+ let t = j.value;
227
232
  Pe = setTimeout(() => {
228
- Pe = void 0, A.value === t && it(t, e);
233
+ Pe = void 0, j.value === t && at(t, e);
229
234
  }, 150);
230
235
  }
231
- function it(e, t) {
232
- let n = k.value.files.find((t) => t.fileId === e);
233
- !n || a(n) || e !== A.value || (t.forEach((e) => {
236
+ function at(e, t) {
237
+ let n = A.value.files.find((t) => t.fileId === e);
238
+ !n || a(n) || e !== j.value || (t.forEach((e) => {
234
239
  let t = n.pages.find((t) => t.pageIndex === e);
235
- !t || t.previewUrl || F.value.includes(bt(n.fileId, e, !1)) || W.some((t) => t.fileId === n.fileId && t.pageIndex === e) || W.push({
240
+ !t || t.previewUrl || I.value.includes(xt(n.fileId, e, !1)) || G.some((t) => t.fileId === n.fileId && t.pageIndex === e) || G.push({
236
241
  fileId: n.fileId,
237
242
  pageIndex: e
238
243
  });
239
- }), at());
244
+ }), ot());
240
245
  }
241
- async function at() {
242
- let e = A.value;
243
- for (W = W.filter((t) => t.fileId === e); Fe < 3 && W.length;) {
244
- let t = W.shift();
246
+ async function ot() {
247
+ let e = j.value;
248
+ for (G = G.filter((t) => t.fileId === e); Fe < 3 && G.length;) {
249
+ let t = G.shift();
245
250
  if (!t || t.fileId !== e) continue;
246
- let n = l(k.value, t.fileId, t.pageIndex), r = k.value.files.find((e) => e.fileId === t.fileId);
247
- !n || a(r) || n.previewUrl || F.value.includes(bt(t.fileId, t.pageIndex, !1)) || (Fe += 1, $e(t.fileId, t.pageIndex, !1).finally(() => {
248
- Fe = Math.max(0, Fe - 1), at();
251
+ let n = l(A.value, t.fileId, t.pageIndex), r = A.value.files.find((e) => e.fileId === t.fileId);
252
+ !n || a(r) || n.previewUrl || I.value.includes(xt(t.fileId, t.pageIndex, !1)) || (Fe += 1, et(t.fileId, t.pageIndex, !1).finally(() => {
253
+ Fe = Math.max(0, Fe - 1), ot();
249
254
  }));
250
255
  }
251
256
  }
252
- function ot(e) {
253
- let t = k.value.placements.find((t) => t.id === e);
254
- t && (t.fileId !== A.value && et(t.fileId), M.value = e, _(() => R.value?.scrollToPlacement(e)));
257
+ function st(e) {
258
+ let t = A.value.placements.find((t) => t.id === e);
259
+ t && (t.fileId !== j.value && tt(t.fileId), N.value = e, v(() => z.value?.scrollToPlacement(e)));
255
260
  }
256
- function st(e, t = {}) {
257
- if (Y.value || !T.allowedPlacementTypes.includes(e)) return;
258
- let n = t.fileId ?? q.value?.fileId, r = t.pageIndex ?? Ve.value?.pageIndex;
261
+ function ct(e, t = {}) {
262
+ if (X.value || !E.allowedPlacementTypes.includes(e)) return;
263
+ let n = t.fileId ?? J.value?.fileId, r = t.pageIndex ?? Ve.value?.pageIndex;
259
264
  if (!n || r === void 0) return;
260
- let i = l(k.value, n, r);
265
+ let i = l(A.value, n, r);
261
266
  if (!i || !re(i)) {
262
- Q({
267
+ $({
263
268
  code: "CONTRACT_PAGE_SIZE_INVALID",
264
269
  message: "当前页面缺少有效的原始宽高,暂时不能添加签署位置",
265
270
  fileId: n,
@@ -267,9 +272,9 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
267
272
  });
268
273
  return;
269
274
  }
270
- let a = T.sealTypeOptions.find((e) => String(e.value).trim())?.value;
271
- if (e === "seal" && !a) {
272
- Q({
275
+ let a = oe(E.defaultSealTypes, E.sealTypeOptions);
276
+ if (e === "seal" && !a.length) {
277
+ $({
273
278
  code: "CONTRACT_SEAL_TYPES_MISSING",
274
279
  message: "当前未配置可用的印章类型,暂时不能添加印章位置",
275
280
  fileId: n,
@@ -280,105 +285,105 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
280
285
  let o = te(e, n, i, {
281
286
  signLeft: t.signLeft,
282
287
  signTop: t.signTop,
283
- sizeProfile: T.sizeProfile,
284
- sealSizeLimit: D.value,
285
- sealTypeOptions: T.sealTypeOptions,
286
- ...e === "seal" ? { sealType: [String(a)] } : {}
288
+ sizeProfile: E.sizeProfile,
289
+ sealSizeLimit: O.value,
290
+ sealTypeOptions: E.sealTypeOptions,
291
+ ...e === "seal" ? { sealType: a } : {}
287
292
  });
288
- return Z({
289
- ...k.value,
290
- placements: [...k.value.placements, o]
291
- }), A.value = n, j.value = r, M.value = o.id, Et(o);
292
- }
293
- function ct(e, t) {
294
- Y.value || Z({
295
- ...k.value,
296
- placements: k.value.placements.map((n) => {
293
+ return Q({
294
+ ...A.value,
295
+ placements: [...A.value.placements, o]
296
+ }), j.value = n, M.value = r, N.value = o.id, Dt(o);
297
+ }
298
+ function lt(e, t) {
299
+ X.value || Q({
300
+ ...A.value,
301
+ placements: A.value.placements.map((n) => {
297
302
  if (n.id !== e) return n;
298
303
  let r = t.pageIndex === void 0 ? n.pageIndex : t.pageIndex;
299
- return ae(n, t, l(k.value, n.fileId, r), {
300
- sealSizeLimit: D.value,
301
- sealTypeOptions: T.sealTypeOptions
304
+ return ae(n, t, l(A.value, n.fileId, r), {
305
+ sealSizeLimit: O.value,
306
+ sealTypeOptions: E.sealTypeOptions
302
307
  });
303
308
  })
304
309
  });
305
310
  }
306
- function lt() {
307
- let e = X.value;
308
- if (!e || Y.value) return;
309
- let n = l(k.value, e.fileId, e.pageIndex);
311
+ function ut() {
312
+ let e = Z.value;
313
+ if (!e || X.value) return;
314
+ let n = l(A.value, e.fileId, e.pageIndex);
310
315
  if (!n) return;
311
316
  let r = t({
312
- ...Et(e),
313
- id: Dt(),
317
+ ...Dt(e),
318
+ id: kt(),
314
319
  signLeft: e.signLeft + 16,
315
320
  signTop: e.signTop + 16
316
- }, n, { sealSizeLimit: D.value });
317
- Z({
318
- ...k.value,
319
- placements: [...k.value.placements, r]
320
- }), M.value = r.id;
321
- }
322
- function ut(e) {
323
- Y.value || (Z({
324
- ...k.value,
325
- placements: k.value.placements.filter((t) => t.id !== e)
326
- }), M.value === e && (M.value = ""));
327
- }
328
- function dt() {
329
- let e = se(k.value, { allowedSealTypes: T.sealTypeOptions.map((e) => e.value) });
330
- return J.value ? [...e, {
331
- code: "CONTRACT_TEMPLATE_FONT_UNAVAILABLE",
332
- message: gt()
333
- }] : e;
321
+ }, n, { sealSizeLimit: O.value });
322
+ Q({
323
+ ...A.value,
324
+ placements: [...A.value.placements, r]
325
+ }), N.value = r.id;
326
+ }
327
+ function dt(e) {
328
+ X.value || (Q({
329
+ ...A.value,
330
+ placements: A.value.placements.filter((t) => t.id !== e)
331
+ }), N.value === e && (N.value = ""));
334
332
  }
335
333
  function ft() {
336
- return s(k.value);
334
+ let e = ce(A.value, { allowedSealTypes: E.sealTypeOptions.map((e) => e.value) });
335
+ return Y.value ? [...e, {
336
+ code: "CONTRACT_TEMPLATE_FONT_UNAVAILABLE",
337
+ message: _t()
338
+ }] : e;
337
339
  }
338
340
  function pt() {
339
- if (J.value) throw new o([{
341
+ return s(A.value);
342
+ }
343
+ function mt() {
344
+ if (Y.value) throw new o([{
340
345
  code: "CONTRACT_TEMPLATE_FONT_UNAVAILABLE",
341
- message: gt()
346
+ message: _t()
342
347
  }]);
343
- return ee(ft(), { allowedSealTypes: T.sealTypeOptions.map((e) => e.value) });
348
+ return ee(pt(), { allowedSealTypes: E.sealTypeOptions.map((e) => e.value) });
344
349
  }
345
- function mt() {
346
- if (J.value) {
347
- let e = gt();
348
- return console.error("[GD-SIGN-COORD]", e), Q({
350
+ function ht() {
351
+ if (Y.value) {
352
+ let e = _t();
353
+ return console.error("[GD-SIGN-COORD]", e), $({
349
354
  code: "CONTRACT_TEMPLATE_FONT_UNAVAILABLE",
350
355
  message: e
351
356
  }), !1;
352
357
  }
353
358
  try {
354
- let e = pt();
355
- return P.value = "", E("submit", e), e;
359
+ let e = mt();
360
+ return F.value = "", D("submit", e), e;
356
361
  } catch (e) {
357
- return Q(e instanceof o ? {
362
+ return $(e instanceof o ? {
358
363
  ...e.errors[0],
359
364
  cause: e
360
- } : yt(e, "CONTRACT_SIGNING_LOCATION_INVALID", "指定签署位置数据不完整")), !1;
365
+ } : bt(e, "CONTRACT_SIGNING_LOCATION_INVALID", "指定签署位置数据不完整")), !1;
361
366
  }
362
367
  }
363
- function ht(e, t) {
364
- V.value = e, Ne.value = e === "error" ? t || "合同排版度量校验失败" : "";
365
- }
366
- function gt() {
367
- return V.value === "error" ? Ne.value || "合同排版度量校验失败,禁止生成签署坐标" : "合同排版度量校验中,请稍后再保存签署坐标";
368
+ function gt(e, t) {
369
+ H.value = e, Ne.value = e === "error" ? t || "合同排版度量校验失败" : "";
368
370
  }
369
371
  function _t() {
370
- if (Y.value) return s(k.value);
371
- let e = Z(s(Me.value));
372
- return M.value = "", vt(!0), _(() => R.value?.scrollToPage(j.value)), e;
372
+ return H.value === "error" ? Ne.value || "合同排版度量校验失败,禁止生成签署坐标" : "合同排版度量校验中,请稍后再保存签署坐标";
373
373
  }
374
- function vt(e = !1) {
375
- let t = (e ? void 0 : k.value.files.find((e) => e.fileId === A.value)) ?? k.value.files[0];
376
- A.value = t?.fileId ?? "", j.value = ((e ? void 0 : t?.pages.find((e) => e.pageIndex === j.value)) ?? t?.pages[0])?.pageIndex ?? 0, k.value.placements.some((e) => e.id === M.value) || (M.value = "");
374
+ function vt() {
375
+ if (X.value) return s(A.value);
376
+ let e = Q(s(Me.value));
377
+ return N.value = "", yt(!0), v(() => z.value?.scrollToPage(M.value)), e;
377
378
  }
378
- function Q(e) {
379
- P.value = e.message, E("error", e);
379
+ function yt(e = !1) {
380
+ let t = (e ? void 0 : A.value.files.find((e) => e.fileId === j.value)) ?? A.value.files[0];
381
+ j.value = t?.fileId ?? "", M.value = ((e ? void 0 : t?.pages.find((e) => e.pageIndex === M.value)) ?? t?.pages[0])?.pageIndex ?? 0, A.value.placements.some((e) => e.id === N.value) || (N.value = "");
380
382
  }
381
- function yt(e, t, n, r = {}) {
383
+ function $(e) {
384
+ F.value = e.message, D("error", e);
385
+ }
386
+ function bt(e, t, n, r = {}) {
382
387
  let i = typeof e == "object" && e && "status" in e ? Number(e.status) : void 0;
383
388
  return {
384
389
  code: t,
@@ -387,173 +392,175 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
387
392
  cause: e
388
393
  };
389
394
  }
390
- function bt(e, t, n) {
395
+ function xt(e, t, n) {
391
396
  return `${e}:${t}:${n ? "thumbnail" : "preview"}`;
392
397
  }
393
- function xt(e) {
394
- if (!(e in I.value)) return;
395
- let t = { ...I.value };
396
- delete t[e], I.value = t;
398
+ function St(e) {
399
+ if (!(e in L.value)) return;
400
+ let t = { ...L.value };
401
+ delete t[e], L.value = t;
397
402
  }
398
- function St() {
403
+ function Ct() {
399
404
  Pe &&= (clearTimeout(Pe), void 0);
400
405
  }
401
- function Ct(e) {
402
- let t = e ?? (() => !0), n = new Set(G.abort(t));
403
- n.size && (F.value = F.value.filter((e) => !n.has(e))), e || (W = []);
404
- }
405
406
  function wt(e) {
406
- return !!(e && typeof e == "object" && "cancelled" in e && e.cancelled) || e instanceof DOMException && e.name === "AbortError";
407
+ let t = e ?? (() => !0), n = new Set(K.abort(t));
408
+ n.size && (I.value = I.value.filter((e) => !n.has(e))), e || (G = []);
407
409
  }
408
410
  function Tt(e) {
409
- let t = q.value;
410
- t && $e(t.fileId, e, !1);
411
+ return !!(e && typeof e == "object" && "cancelled" in e && e.cancelled) || e instanceof DOMException && e.name === "AbortError";
411
412
  }
412
413
  function Et(e) {
414
+ let t = J.value;
415
+ t && et(t.fileId, e, !1);
416
+ }
417
+ function Dt(e) {
413
418
  return {
414
419
  ...e,
415
420
  sealType: e.sealType ? [...e.sealType] : void 0
416
421
  };
417
422
  }
418
- function $(e) {
423
+ function Ot(e) {
419
424
  return JSON.stringify(e);
420
425
  }
421
- function Dt() {
426
+ function kt() {
422
427
  return typeof crypto < "u" && "randomUUID" in crypto ? `contract-signing-placement-${crypto.randomUUID()}` : `contract-signing-placement-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
423
428
  }
424
- function Ot(e) {
429
+ function At(e) {
425
430
  if (typeof e == "number" && Number.isFinite(e) && e > 0) return { "--gd-ant-contract-signing-location-height": `${e}px` };
426
431
  if (typeof e == "string" && e.trim()) return { "--gd-ant-contract-signing-location-height": e.trim() };
427
432
  }
428
433
  return pe({
429
- load: Ze,
430
- validate: dt,
431
- getValue: ft,
432
- getOutput: pt,
433
- submit: mt,
434
- reset: _t,
435
- addPlacement: st,
436
- removePlacement: ut,
437
- fitWidth: Xe
438
- }), (t, n) => (v(), m("section", {
434
+ load: Qe,
435
+ validate: ft,
436
+ getValue: pt,
437
+ getOutput: mt,
438
+ submit: ht,
439
+ reset: vt,
440
+ addPlacement: ct,
441
+ removePlacement: dt,
442
+ fitWidth: Ze
443
+ }), (t, n) => (y(), m("section", {
439
444
  class: me(["gd-ant-contract-signing-location", {
440
445
  "is-readonly": Ie.value,
441
446
  "is-disabled": e.disabled,
442
- "is-preview": K.value
447
+ "is-preview": q.value
443
448
  }]),
444
449
  style: he(Be.value)
445
450
  }, [
446
451
  h("header", Se, [h("div", Ce, [n[6] ||= h("span", {
447
452
  class: "gd-ant-contract-signing-location__title-bar",
448
453
  "aria-hidden": "true"
449
- }, null, -1), h("div", null, [h("strong", null, _e(K.value ? "合同预览" : "指定合同签署位置"), 1)])]), h("div", we, [
450
- h("span", Te, _e(k.value.placements.length) + " 个位置", 1),
451
- e.dataProvider ? (v(), f(x(w), {
454
+ }, null, -1), h("div", null, [h("strong", null, _e(q.value ? "合同预览" : "指定合同签署位置"), 1)])]), h("div", we, [
455
+ h("span", Te, _e(A.value.placements.length) + " 个位置", 1),
456
+ e.dataProvider ? (y(), f(S(T), {
452
457
  key: 0,
453
- loading: N.value,
454
- onClick: Ze
458
+ loading: P.value,
459
+ onClick: Qe
455
460
  }, {
456
- default: C(() => [g(x(be), { "aria-hidden": "true" }), n[7] ||= fe(" 重新加载 ", -1)]),
461
+ default: w(() => [_(S(be), { "aria-hidden": "true" }), n[7] ||= g(" 重新加载 ", -1)]),
457
462
  _: 1
458
463
  }, 8, ["loading"])) : p("", !0),
459
- K.value ? p("", !0) : (v(), f(x(w), {
464
+ q.value ? p("", !0) : (y(), f(S(T), {
460
465
  key: 1,
461
- disabled: Y.value,
462
- onClick: _t
466
+ disabled: X.value,
467
+ onClick: vt
463
468
  }, {
464
- default: C(() => [...n[8] ||= [fe("重置", -1)]]),
469
+ default: w(() => [...n[8] ||= [g("重置", -1)]]),
465
470
  _: 1
466
471
  }, 8, ["disabled"])),
467
- Re.value ? (v(), f(x(w), {
472
+ Re.value ? (y(), f(S(T), {
468
473
  key: 2,
469
474
  type: "primary",
470
- loading: N.value,
471
- disabled: e.disabled || J.value,
472
- onClick: mt
475
+ loading: P.value,
476
+ disabled: e.disabled || Y.value,
477
+ onClick: ht
473
478
  }, {
474
- default: C(() => [...n[9] ||= [fe("确认并生成规则", -1)]]),
479
+ default: w(() => [...n[9] ||= [g("确认并生成规则", -1)]]),
475
480
  _: 1
476
481
  }, 8, ["loading", "disabled"])) : p("", !0)
477
482
  ])]),
478
- P.value ? (v(), m("div", Ee, [h("span", null, _e(P.value), 1), e.dataProvider && e.contractId ? (v(), f(x(w), {
483
+ F.value ? (y(), m("div", Ee, [h("span", null, _e(F.value), 1), e.dataProvider && e.contractId ? (y(), f(S(T), {
479
484
  key: 0,
480
485
  type: "link",
481
486
  size: "small",
482
- onClick: Ze
487
+ onClick: Qe
483
488
  }, {
484
- default: C(() => [...n[10] ||= [fe("重试", -1)]]),
489
+ default: w(() => [...n[10] ||= [g("重试", -1)]]),
485
490
  _: 1
486
491
  })) : p("", !0)])) : p("", !0),
487
492
  h("div", { class: me(["gd-ant-contract-signing-location__body", {
488
493
  "is-single-file": ze.value,
489
494
  "is-inspector-hidden": !Le.value
490
495
  }]) }, [
491
- ze.value ? p("", !0) : (v(), m("div", {
496
+ ze.value ? p("", !0) : (y(), m("div", {
492
497
  key: 0,
493
- class: me(["gd-ant-contract-signing-location__navigator-wrap", { "is-collapsed": B.value }])
494
- }, [g(x(ve), { title: B.value ? "展开页面栏" : "收起页面栏" }, {
495
- default: C(() => [h("button", {
498
+ class: me(["gd-ant-contract-signing-location__navigator-wrap", { "is-collapsed": V.value }])
499
+ }, [_(S(ve), { title: V.value ? "展开页面栏" : "收起页面栏" }, {
500
+ default: w(() => [h("button", {
496
501
  type: "button",
497
502
  class: "gd-ant-contract-signing-location__panel-handle",
498
- "aria-label": B.value ? "展开页面栏" : "收起页面栏",
499
- "aria-expanded": !B.value,
500
- onClick: n[0] ||= (e) => B.value = !B.value
501
- }, [B.value ? (v(), f(x(xe), {
503
+ "aria-label": V.value ? "展开页面栏" : "收起页面栏",
504
+ "aria-expanded": !V.value,
505
+ onClick: n[0] ||= (e) => V.value = !V.value
506
+ }, [V.value ? (y(), f(S(xe), {
502
507
  key: 0,
503
508
  "aria-hidden": "true"
504
- })) : (v(), f(x(ye), {
509
+ })) : (y(), f(S(ye), {
505
510
  key: 1,
506
511
  "aria-hidden": "true"
507
512
  }))], 8, De)]),
508
513
  _: 1
509
- }, 8, ["title"]), h("div", Oe, [g(ue, {
510
- files: k.value.files,
511
- "active-file-id": A.value,
512
- "loading-preview-keys": We.value,
513
- "error-preview-keys": Ge.value,
514
- onSelect: et
514
+ }, 8, ["title"]), h("div", Oe, [_(de, {
515
+ files: A.value.files,
516
+ "active-file-id": j.value,
517
+ "loading-preview-keys": Ge.value,
518
+ "error-preview-keys": Ke.value,
519
+ onSelect: tt
515
520
  }, null, 8, [
516
521
  "files",
517
522
  "active-file-id",
518
523
  "loading-preview-keys",
519
524
  "error-preview-keys"
520
525
  ])])], 2)),
521
- g(ce, {
526
+ _(le, {
522
527
  ref_key: "canvasRef",
523
- ref: R,
524
- file: q.value,
525
- pages: q.value?.pages ?? [],
528
+ ref: z,
529
+ file: J.value,
530
+ pages: J.value?.pages ?? [],
526
531
  placements: He.value,
527
- "selected-placement-id": M.value,
528
- readonly: Y.value,
532
+ "reference-placements": Ue.value,
533
+ "selected-placement-id": N.value,
534
+ readonly: X.value,
529
535
  resizable: e.resizable,
530
- "seal-size-limit": D.value,
536
+ "seal-size-limit": O.value,
531
537
  "seal-type-options": e.sealTypeOptions,
532
- zoom: L.value,
533
- "preview-loading-keys": Ke.value,
534
- "preview-error-map": qe.value,
535
- "active-page-index": j.value,
538
+ zoom: R.value,
539
+ "preview-loading-keys": qe.value,
540
+ "preview-error-map": Je.value,
541
+ "active-page-index": M.value,
536
542
  "min-zoom": e.minZoom,
537
543
  "max-zoom": e.maxZoom,
538
544
  "font-base-url": e.contractFontBaseUrl,
539
- onSelect: n[1] ||= (e) => M.value = e,
540
- onRetry: Tt,
541
- onAdd: n[2] ||= (e, t, n, r) => st(e, {
545
+ onSelect: n[1] ||= (e) => N.value = e,
546
+ onRetry: Et,
547
+ onAdd: n[2] ||= (e, t, n, r) => ct(e, {
542
548
  signLeft: t,
543
549
  signTop: n,
544
550
  pageIndex: r
545
551
  }),
546
- onUpdate: n[3] ||= (e) => ct(e.id, e),
547
- onRemove: ut,
548
- onVisiblePages: rt,
549
- onViewPage: tt,
550
- onPageChange: nt,
551
- onZoomChange: Ye,
552
- onTemplateStatus: ht
552
+ onUpdate: n[3] ||= (e) => lt(e.id, e),
553
+ onRemove: dt,
554
+ onVisiblePages: it,
555
+ onViewPage: nt,
556
+ onPageChange: rt,
557
+ onZoomChange: Xe,
558
+ onTemplateStatus: gt
553
559
  }, null, 8, [
554
560
  "file",
555
561
  "pages",
556
562
  "placements",
563
+ "reference-placements",
557
564
  "selected-placement-id",
558
565
  "readonly",
559
566
  "resizable",
@@ -567,40 +574,40 @@ var Se = { class: "gd-ant-contract-signing-location__header" }, Ce = { class: "g
567
574
  "max-zoom",
568
575
  "font-base-url"
569
576
  ]),
570
- Le.value ? (v(), m("div", {
577
+ Le.value ? (y(), m("div", {
571
578
  key: 1,
572
- class: me(["gd-ant-contract-signing-location__inspector-wrap", { "is-collapsed": z.value }])
573
- }, [g(x(ve), { title: z.value ? "展开属性栏" : "收起属性栏" }, {
574
- default: C(() => [h("button", {
579
+ class: me(["gd-ant-contract-signing-location__inspector-wrap", { "is-collapsed": B.value }])
580
+ }, [_(S(ve), { title: B.value ? "展开属性栏" : "收起属性栏" }, {
581
+ default: w(() => [h("button", {
575
582
  type: "button",
576
583
  class: "gd-ant-contract-signing-location__panel-handle",
577
- "aria-label": z.value ? "展开属性栏" : "收起属性栏",
578
- "aria-expanded": !z.value,
579
- onClick: n[4] ||= (e) => z.value = !z.value
580
- }, [z.value ? (v(), f(x(ye), {
584
+ "aria-label": B.value ? "展开属性栏" : "收起属性栏",
585
+ "aria-expanded": !B.value,
586
+ onClick: n[4] ||= (e) => B.value = !B.value
587
+ }, [B.value ? (y(), f(S(ye), {
581
588
  key: 0,
582
589
  "aria-hidden": "true"
583
- })) : (v(), f(x(xe), {
590
+ })) : (y(), f(S(xe), {
584
591
  key: 1,
585
592
  "aria-hidden": "true"
586
593
  }))], 8, ke)]),
587
594
  _: 1
588
- }, 8, ["title"]), h("div", Ae, [g(le, {
589
- placement: X.value,
590
- page: Ue.value,
591
- pages: q.value?.pages ?? [],
595
+ }, 8, ["title"]), h("div", Ae, [_(ue, {
596
+ placement: Z.value,
597
+ page: We.value,
598
+ pages: J.value?.pages ?? [],
592
599
  placements: He.value,
593
- readonly: Y.value,
600
+ readonly: X.value,
594
601
  resizable: e.resizable,
595
- "seal-size-limit": D.value,
602
+ "seal-size-limit": O.value,
596
603
  "seal-type-options": e.sealTypeOptions,
597
604
  "allowed-placement-types": e.allowedPlacementTypes,
598
605
  "size-profile": e.sizeProfile,
599
- onAdd: st,
600
- onUpdate: n[5] ||= (e) => X.value && ct(X.value.id, e),
601
- onDuplicate: lt,
602
- onRemove: ut,
603
- onLocate: ot
606
+ onAdd: ct,
607
+ onUpdate: n[5] ||= (e) => Z.value && lt(Z.value.id, e),
608
+ onDuplicate: ut,
609
+ onRemove: dt,
610
+ onLocate: st
604
611
  }, null, 8, [
605
612
  "placement",
606
613
  "page",