@guodun/antdv 1.7.2 → 1.7.4
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/CHANGELOG.md +8 -0
- package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +313 -308
- package/dist/es/components/contract-signing-location/style/index.css +1 -1
- package/dist/es/components/dept-selector/src/DeptSelector.vue.mjs +1 -0
- package/dist/es/components/pro-contract-signing-flow/style/index.css +1 -1
- package/dist/es/components/pro-contract-template-agent/style/index.css +1 -1
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +796 -0
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +16 -5
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +3 -1
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +123 -710
- package/dist/es/components/pro-contract-template-designer/src/composables/use-renderer-files.mjs +80 -0
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +172 -134
- package/dist/es/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.mjs +11 -9
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +136 -76
- package/dist/es/components/pro-contract-template-designer/src/utils/toolbar-overflow.mjs +10 -9
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/components/pro-selector/src/ProUserSelector.vue.mjs +1 -0
- package/dist/es/components/pro-selector-group/src/index.vue.mjs +1 -0
- package/dist/es/components/pro-table/src/form-render.vue.mjs +1 -0
- package/dist/es/components/pro-table/src/pro-table.vue.mjs +23 -29
- package/dist/es/components/role-selector/src/RoleSelector.vue.mjs +1 -0
- package/dist/es/components/selector-core/components/DepartmentTree.vue.mjs +12 -10
- package/dist/es/components/selector-core/components/SelectionSummary.vue.mjs +1 -0
- package/dist/es/components/selector-core/components/SelectorDialog.vue.mjs +175 -171
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/style/index.css +1 -1
- package/dist/lib/components/dept-selector/src/DeptSelector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/style/index.css +1 -1
- package/dist/lib/components/pro-contract-template-agent/style/index.css +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-renderer-files.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-toolbar-overflow.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
- package/dist/lib/components/pro-contract-template-designer/src/utils/toolbar-overflow.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/components/pro-selector/src/ProUserSelector.vue.cjs +1 -1
- package/dist/lib/components/pro-selector-group/src/index.vue.cjs +1 -1
- package/dist/lib/components/pro-table/src/form-render.vue.cjs +1 -1
- package/dist/lib/components/pro-table/src/pro-table.vue.cjs +1 -1
- package/dist/lib/components/role-selector/src/RoleSelector.vue.cjs +1 -1
- package/dist/lib/components/selector-core/components/DepartmentTree.vue.cjs +1 -1
- package/dist/lib/components/selector-core/components/SelectionSummary.vue.cjs +1 -1
- package/dist/lib/components/selector-core/components/SelectorDialog.vue.cjs +1 -1
- package/dist/theme/base.css +1 -1
- package/dist/theme/contract-signing-location.css +1 -1
- package/dist/theme/controls.css +1 -1
- package/dist/theme/icon.css +1 -1
- package/dist/theme/index.css +1 -1
- package/dist/theme/pro-contract-signing-flow.css +1 -1
- package/dist/theme/pro-drawer.css +1 -1
- package/dist/theme/pro-modal.css +1 -1
- package/dist/theme/pro-table.css +1 -1
- package/dist/theme/selector-core.css +1 -1
- package/dist/theme/var.css +1 -1
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.d.ts +89 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +2 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +388 -10
- package/dist/types/components/pro-contract-template-designer/src/composables/use-renderer-files.d.ts +14 -0
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +9 -2
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +16 -2
- package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +3 -3
- package/dist/types/components/pro-contract-template-designer/src/utils/toolbar-overflow.d.ts +2 -0
- package/package.json +5 -5
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import e from "../../pro-modal/src/ProModal.mjs";
|
|
2
2
|
import t from "../../icon/src/icon.mjs";
|
|
3
|
-
import { cloneEntities as n, entityKey as r, flattenDepartments as i, selectionLimit as
|
|
4
|
-
import { DEFAULT_SELECTION_ACTIVE_COLOR as
|
|
5
|
-
import { useSelectorData as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { Fragment as
|
|
11
|
-
import { Button as
|
|
3
|
+
import { cloneEntities as n, entityKey as r, flattenDepartments as i, selectionLimit as a, selectorLabels as o, toggleEntity as ee, toggleVisible as s } from "../model.mjs";
|
|
4
|
+
import { DEFAULT_SELECTION_ACTIVE_COLOR as c, createSelectionTheme as te } from "../selection-theme.mjs";
|
|
5
|
+
import { useSelectorData as ne } from "../useSelectorData.mjs";
|
|
6
|
+
import re from "./DepartmentTree.mjs";
|
|
7
|
+
import ie from "./PeoplePane.mjs";
|
|
8
|
+
import ae from "./RolePane.mjs";
|
|
9
|
+
import oe from "./SelectionSummary.mjs";
|
|
10
|
+
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, mergeModels as v, nextTick as se, normalizeClass as y, openBlock as b, ref as x, renderList as ce, toDisplayString as S, unref as C, useModel as le, watch as w, withCtx as T } from "vue";
|
|
11
|
+
import { Button as E, ConfigProvider as ue } from "ant-design-vue";
|
|
12
12
|
//#region src/components/selector-core/components/SelectorDialog.vue?vue&type=script&setup=true&lang.ts
|
|
13
|
-
var
|
|
13
|
+
var de = { class: "gd-ant-selector__dialog-root" }, fe = {
|
|
14
14
|
key: 0,
|
|
15
15
|
class: "gd-ant-selector__variant-toolbar",
|
|
16
16
|
"aria-label": "用户方案比较"
|
|
17
|
-
},
|
|
17
|
+
}, pe = { class: "gd-ant-selector__segmented" }, me = ["aria-pressed"], he = ["aria-pressed"], ge = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "gd-ant-selector__tabs",
|
|
20
20
|
role: "tablist",
|
|
21
21
|
"aria-label": "选择对象类型"
|
|
22
|
-
},
|
|
22
|
+
}, _e = [
|
|
23
23
|
"id",
|
|
24
24
|
"aria-selected",
|
|
25
25
|
"tabindex",
|
|
26
26
|
"onClick",
|
|
27
27
|
"onKeydown"
|
|
28
|
-
],
|
|
28
|
+
], ve = ["role", "aria-labelledby"], ye = { class: "gd-ant-selector__footer" }, be = ["role"], xe = { class: "gd-ant-selector__footer-actions" }, Se = { key: 0 }, D = /* @__PURE__ */ _({
|
|
29
29
|
__name: "SelectorDialog",
|
|
30
|
-
props: /* @__PURE__ */
|
|
30
|
+
props: /* @__PURE__ */ v({
|
|
31
31
|
mode: {},
|
|
32
32
|
selected: {},
|
|
33
33
|
selection: { default: "checkbox" },
|
|
@@ -50,7 +50,7 @@ var fe = { class: "gd-ant-selector__dialog-root" }, pe = {
|
|
|
50
50
|
default: !1
|
|
51
51
|
},
|
|
52
52
|
valueField: { default: "roleKey" },
|
|
53
|
-
activeColor: { default:
|
|
53
|
+
activeColor: { default: c },
|
|
54
54
|
modalProps: { default: () => ({}) }
|
|
55
55
|
}, {
|
|
56
56
|
open: {
|
|
@@ -59,104 +59,104 @@ var fe = { class: "gd-ant-selector__dialog-root" }, pe = {
|
|
|
59
59
|
},
|
|
60
60
|
openModifiers: {}
|
|
61
61
|
}),
|
|
62
|
-
emits: /* @__PURE__ */
|
|
62
|
+
emits: /* @__PURE__ */ v([
|
|
63
63
|
"update:variant",
|
|
64
64
|
"confirm",
|
|
65
65
|
"cancel",
|
|
66
66
|
"changeTab"
|
|
67
67
|
], ["update:open"]),
|
|
68
|
-
setup(
|
|
69
|
-
let
|
|
70
|
-
function
|
|
68
|
+
setup(c, { emit: _ }) {
|
|
69
|
+
let v = le(c, "open"), D = c, O = _;
|
|
70
|
+
function k(e = D.selected) {
|
|
71
71
|
let t = n(e);
|
|
72
|
-
return
|
|
72
|
+
return D.mode === "group" && D.isSingle ? t.filter((e) => e.type === (D.initialTab || "dept")) : t;
|
|
73
73
|
}
|
|
74
|
-
let
|
|
75
|
-
mode:
|
|
74
|
+
let A = x(k()), j = x(D.variant), M = x(D.mode === "group" ? D.initialTab : D.mode), N = x(""), P = x(""), F = ne({
|
|
75
|
+
mode: D.mode,
|
|
76
76
|
get http() {
|
|
77
|
-
return
|
|
77
|
+
return D.http;
|
|
78
78
|
},
|
|
79
79
|
get prefix() {
|
|
80
|
-
return
|
|
80
|
+
return D.prefix;
|
|
81
81
|
},
|
|
82
82
|
get isBuiltInRequest() {
|
|
83
|
-
return
|
|
83
|
+
return D.isBuiltInRequest;
|
|
84
84
|
},
|
|
85
|
-
initData: () =>
|
|
86
|
-
treeData: () =>
|
|
87
|
-
roleOptions: () =>
|
|
88
|
-
fieldNames: () =>
|
|
89
|
-
valueField: () =>
|
|
90
|
-
}), { departments:
|
|
91
|
-
mode:
|
|
92
|
-
selection:
|
|
93
|
-
maxCount:
|
|
94
|
-
})), H =
|
|
85
|
+
initData: () => D.initData?.(),
|
|
86
|
+
treeData: () => D.treeData || [],
|
|
87
|
+
roleOptions: () => D.roleOptions || [],
|
|
88
|
+
fieldNames: () => D.fieldNames,
|
|
89
|
+
valueField: () => D.valueField
|
|
90
|
+
}), { departments: I, roles: L, members: R, treeLoading: z, roleLoading: Ce, memberLoading: we, treeError: B, roleError: Te, memberError: Ee } = F, V = u(() => a({
|
|
91
|
+
mode: D.mode,
|
|
92
|
+
selection: D.selection,
|
|
93
|
+
maxCount: D.maxCount
|
|
94
|
+
})), H = u(() => D.mode === "group"), U = u(() => D.mode !== "group" && D.selection === "radio"), W = u(() => M.value === "user" && (H.value || j.value === "B")), G = u(() => H.value || W.value), De = u(() => H.value ? "选择部门、角色与用户" : D.title || `选择${o[M.value]}`), K = u(() => H.value && !D.isSingle ? [
|
|
95
95
|
"dept",
|
|
96
96
|
"role",
|
|
97
97
|
"user"
|
|
98
|
-
] : [
|
|
98
|
+
] : [M.value]), Oe = u(() => G.value ? 1040 : D.mode === "user" ? 880 : D.mode === "dept" ? 800 : 760), q = u(() => te(D.activeColor));
|
|
99
99
|
async function ke(e) {
|
|
100
100
|
if (e === "role") {
|
|
101
|
-
await
|
|
101
|
+
await F.loadRoles();
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
-
await
|
|
104
|
+
await F.loadTree(), e === "user" && (H.value || j.value === "B") && !N.value && (N.value = I.value[0]?.key || "");
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
w([M, v], ([e, t]) => {
|
|
107
107
|
t && ke(e);
|
|
108
|
-
}, { immediate: !0 }),
|
|
108
|
+
}, { immediate: !0 }), w([
|
|
109
|
+
N,
|
|
109
110
|
M,
|
|
110
|
-
|
|
111
|
-
_
|
|
111
|
+
v
|
|
112
112
|
], ([e, t, n]) => {
|
|
113
|
-
n && H.value && t === "user" &&
|
|
114
|
-
}),
|
|
115
|
-
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
n && H.value && t === "user" && F.loadMembers(e);
|
|
114
|
+
}), w(() => D.variant, (e) => {
|
|
115
|
+
j.value = e;
|
|
116
|
+
}), w(() => [
|
|
117
|
+
D.http,
|
|
118
|
+
D.prefix,
|
|
119
|
+
D.isBuiltInRequest
|
|
120
120
|
], () => {
|
|
121
|
-
|
|
121
|
+
F.reset();
|
|
122
122
|
});
|
|
123
|
-
function
|
|
124
|
-
|
|
123
|
+
function J(e) {
|
|
124
|
+
j.value !== e && (j.value = e, O("update:variant", e), e === "B" && !N.value && (N.value = I.value[0]?.key || ""));
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}, { deep: !0 }),
|
|
129
|
-
|
|
130
|
-
}, { deep: !0 }),
|
|
131
|
-
|
|
126
|
+
w(() => D.treeData, () => {
|
|
127
|
+
D.mode === "dept" && !D.isBuiltInRequest && F.loadTree(!0);
|
|
128
|
+
}, { deep: !0 }), w(() => D.roleOptions, () => {
|
|
129
|
+
D.mode === "role" && !D.isBuiltInRequest && F.loadRoles(!0);
|
|
130
|
+
}, { deep: !0 }), w(() => D.selected, (e) => {
|
|
131
|
+
v.value || (A.value = k(e));
|
|
132
132
|
}, {
|
|
133
133
|
deep: !0,
|
|
134
134
|
immediate: !0
|
|
135
|
-
}),
|
|
136
|
-
e ? (
|
|
135
|
+
}), w(v, (e) => {
|
|
136
|
+
e ? (j.value = D.variant, A.value = k(), M.value = D.mode === "group" ? D.initialTab : D.mode, N.value = "", P.value = "") : (A.value = k(), P.value = "");
|
|
137
137
|
}, { immediate: !0 });
|
|
138
|
-
async function
|
|
139
|
-
await
|
|
138
|
+
async function Y() {
|
|
139
|
+
await F.loadTree(!0), !N.value && (H.value || j.value === "B") && (N.value = I.value[0]?.key || "");
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
mode:
|
|
144
|
-
selection:
|
|
145
|
-
maxCount:
|
|
146
|
-
}),
|
|
141
|
+
function X(e) {
|
|
142
|
+
A.value = ee(A.value, e, {
|
|
143
|
+
mode: D.mode,
|
|
144
|
+
selection: D.selection,
|
|
145
|
+
maxCount: D.maxCount
|
|
146
|
+
}), P.value = "";
|
|
147
147
|
}
|
|
148
148
|
function Ae(e) {
|
|
149
|
-
|
|
149
|
+
A.value = A.value.filter((t) => r(t) !== r(e)), P.value = "";
|
|
150
150
|
}
|
|
151
151
|
function je(e) {
|
|
152
|
-
|
|
152
|
+
A.value = e ? A.value.filter((t) => t.type !== e) : [], P.value = "";
|
|
153
153
|
}
|
|
154
|
-
let Me =
|
|
155
|
-
...i(
|
|
156
|
-
...I.value,
|
|
154
|
+
let Me = u(() => [
|
|
155
|
+
...i(I.value).map((e) => e.entity),
|
|
157
156
|
...L.value,
|
|
158
|
-
...
|
|
159
|
-
|
|
157
|
+
...R.value,
|
|
158
|
+
...i(I.value).flatMap((e) => e.members)
|
|
159
|
+
]), Z = u(() => A.value.map((e) => {
|
|
160
160
|
let t = Me.value.find((t) => r(t) === r(e));
|
|
161
161
|
return t ? {
|
|
162
162
|
...t,
|
|
@@ -166,127 +166,131 @@ var fe = { class: "gd-ant-selector__dialog-root" }, pe = {
|
|
|
166
166
|
subtitle: e.subtitle || t.subtitle
|
|
167
167
|
} : e;
|
|
168
168
|
}));
|
|
169
|
-
function
|
|
170
|
-
let e =
|
|
171
|
-
if (!e.length &&
|
|
172
|
-
|
|
169
|
+
function Q() {
|
|
170
|
+
let e = D.mode === "group" && D.isSingle ? Z.value.filter((e) => e.type === (D.initialTab || "dept")) : Z.value;
|
|
171
|
+
if (!e.length && D.mode !== "group") {
|
|
172
|
+
P.value = `请至少选择一项${o[M.value]}`;
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
O("confirm", n(e)), v.value = !1;
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
177
|
+
function $() {
|
|
178
|
+
A.value = k(), O("cancel"), v.value = !1;
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
180
|
+
function Ne(e) {
|
|
181
|
+
M.value !== e && (M.value = e, O("changeTab", e));
|
|
182
182
|
}
|
|
183
|
-
async function
|
|
183
|
+
async function Pe(e, t) {
|
|
184
184
|
let n = t;
|
|
185
|
-
if (e.key === "ArrowRight") n = (t + 1) %
|
|
186
|
-
else if (e.key === "ArrowLeft") n = (t - 1 +
|
|
185
|
+
if (e.key === "ArrowRight") n = (t + 1) % K.value.length;
|
|
186
|
+
else if (e.key === "ArrowLeft") n = (t - 1 + K.value.length) % K.value.length;
|
|
187
187
|
else if (e.key === "Home") n = 0;
|
|
188
|
-
else if (e.key === "End") n =
|
|
188
|
+
else if (e.key === "End") n = K.value.length - 1;
|
|
189
189
|
else return;
|
|
190
190
|
let r = e.currentTarget.parentElement;
|
|
191
|
-
e.preventDefault(),
|
|
191
|
+
e.preventDefault(), Ne(K.value[n]), await se(), r?.querySelector("[aria-selected=\"true\"]")?.focus();
|
|
192
192
|
}
|
|
193
|
-
let
|
|
194
|
-
let { class: e, style: t,
|
|
193
|
+
let Fe = u(() => {
|
|
194
|
+
let { class: e, style: t, width: n, ...r } = D.modalProps || {}, i = Array.isArray(e) ? e : e ? [e] : [], a = typeof t == "string" ? `${t};${Object.entries(q.value.style).map(([e, t]) => `${e}:${t}`).join(";")}` : {
|
|
195
195
|
...t || {},
|
|
196
|
-
...
|
|
197
|
-
}
|
|
196
|
+
...q.value.style
|
|
197
|
+
}, o = G.value ? "min(var(--gdant-selector-dialog-wide-width), calc(100vw - var(--gdant-selector-dialog-viewport-gap)))" : n ?? `min(${Oe.value}px, calc(100vw - var(--gdant-selector-dialog-viewport-gap)))`;
|
|
198
198
|
return {
|
|
199
|
-
width: `min(${Oe.value}px, calc(100vw - 32px))`,
|
|
200
199
|
centered: !0,
|
|
201
200
|
destroyOnClose: !0,
|
|
202
|
-
...
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
...r,
|
|
202
|
+
width: o,
|
|
203
|
+
class: [
|
|
204
|
+
"gd-ant-selector-modal",
|
|
205
|
+
G.value && "gd-ant-selector-modal--wide",
|
|
206
|
+
...i
|
|
207
|
+
].filter(Boolean).join(" "),
|
|
208
|
+
style: a
|
|
205
209
|
};
|
|
206
210
|
});
|
|
207
|
-
return (n, r) => (
|
|
208
|
-
default:
|
|
209
|
-
modelValue:
|
|
210
|
-
"onUpdate:modelValue": r[7] ||= (e) =>
|
|
211
|
+
return (n, r) => (b(), d(C(ue), { theme: q.value.config }, {
|
|
212
|
+
default: T(() => [g(e, {
|
|
213
|
+
modelValue: v.value,
|
|
214
|
+
"onUpdate:modelValue": r[7] ||= (e) => v.value = e,
|
|
211
215
|
title: De.value,
|
|
212
|
-
"modal-props":
|
|
213
|
-
onOnCancel:
|
|
214
|
-
onOnConfirm:
|
|
216
|
+
"modal-props": Fe.value,
|
|
217
|
+
onOnCancel: $,
|
|
218
|
+
onOnConfirm: Q
|
|
215
219
|
}, {
|
|
216
|
-
footer:
|
|
217
|
-
class:
|
|
218
|
-
role:
|
|
219
|
-
}, [
|
|
220
|
+
footer: T(() => [m("div", ye, [m("span", {
|
|
221
|
+
class: y(["gd-ant-selector__footer-status", { "gd-ant-selector__footer-status--warning": P.value || Number.isFinite(V.value) && A.value.length >= V.value && !U.value }]),
|
|
222
|
+
role: P.value ? "alert" : "status"
|
|
223
|
+
}, [P.value ? (b(), p(l, { key: 0 }, [h(S(P.value), 1)], 64)) : !U.value && Number.isFinite(V.value) && A.value.length >= V.value ? (b(), p(l, { key: 1 }, [h("已达 " + S(V.value) + " 人上限,取消已选后可继续选择", 1)], 64)) : (b(), p(l, { key: 2 }, [g(t, {
|
|
220
224
|
name: "carry-out",
|
|
221
225
|
size: 14,
|
|
222
226
|
"aria-hidden": "true"
|
|
223
|
-
}),
|
|
224
|
-
default:
|
|
227
|
+
}), h(" " + S(A.value.length ? `已选择 ${A.value.length} 项` : U.value ? "请选择一项" : "选择完成后点击确认"), 1)], 64))], 10, be), m("div", xe, [g(C(E), { onClick: $ }, {
|
|
228
|
+
default: T(() => [...r[9] ||= [h("取消", -1)]]),
|
|
225
229
|
_: 1
|
|
226
|
-
}),
|
|
230
|
+
}), g(C(E), {
|
|
227
231
|
type: "primary",
|
|
228
|
-
onClick:
|
|
232
|
+
onClick: Q
|
|
229
233
|
}, {
|
|
230
|
-
default:
|
|
234
|
+
default: T(() => [r[10] ||= h(" 确认选择", -1), A.value.length ? (b(), p("span", Se, "(" + S(A.value.length) + ")", 1)) : f("", !0)]),
|
|
231
235
|
_: 1
|
|
232
236
|
})])])]),
|
|
233
|
-
default:
|
|
234
|
-
|
|
237
|
+
default: T(() => [m("div", de, [
|
|
238
|
+
c.mode === "user" ? (b(), p("div", fe, [r[8] ||= m("span", null, [h("方案比较 "), m("small", null, "切换保留本次选择")], -1), m("div", pe, [m("button", {
|
|
235
239
|
type: "button",
|
|
236
|
-
"aria-pressed":
|
|
237
|
-
onClick: r[0] ||= (e) =>
|
|
238
|
-
}, "A · 逐级浏览", 8,
|
|
240
|
+
"aria-pressed": j.value === "A",
|
|
241
|
+
onClick: r[0] ||= (e) => J("A")
|
|
242
|
+
}, "A · 逐级浏览", 8, me), m("button", {
|
|
239
243
|
type: "button",
|
|
240
|
-
"aria-pressed":
|
|
241
|
-
onClick: r[1] ||= (e) =>
|
|
242
|
-
}, "B · 通讯录", 8,
|
|
243
|
-
H.value ? (
|
|
244
|
+
"aria-pressed": j.value === "B",
|
|
245
|
+
onClick: r[1] ||= (e) => J("B")
|
|
246
|
+
}, "B · 通讯录", 8, he)])])) : f("", !0),
|
|
247
|
+
H.value ? (b(), p("div", ge, [(b(!0), p(l, null, ce(K.value, (e, n) => (b(), p("button", {
|
|
244
248
|
id: `gd-ant-selector-tab-${e}`,
|
|
245
249
|
key: e,
|
|
246
250
|
type: "button",
|
|
247
251
|
role: "tab",
|
|
248
|
-
"aria-selected":
|
|
249
|
-
tabindex:
|
|
252
|
+
"aria-selected": M.value === e,
|
|
253
|
+
tabindex: M.value === e ? 0 : -1,
|
|
250
254
|
"aria-controls": "gd-ant-selector-panel",
|
|
251
|
-
onClick: (t) =>
|
|
252
|
-
onKeydown: (e) =>
|
|
255
|
+
onClick: (t) => Ne(e),
|
|
256
|
+
onKeydown: (e) => Pe(e, n)
|
|
253
257
|
}, [
|
|
254
|
-
|
|
258
|
+
g(t, {
|
|
255
259
|
name: e === "dept" ? "bumen" : e === "role" ? "a-jiaoseguanli2" : "zuzhijiagou",
|
|
256
260
|
size: 16,
|
|
257
261
|
"aria-hidden": "true"
|
|
258
262
|
}, null, 8, ["name"]),
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
], 40,
|
|
262
|
-
|
|
263
|
+
h(" " + S(C(o)[e]) + " ", 1),
|
|
264
|
+
m("span", null, S(A.value.filter((t) => t.type === e).length), 1)
|
|
265
|
+
], 40, _e))), 128))])) : f("", !0),
|
|
266
|
+
m("div", { class: y(["gd-ant-selector__dialog-layout", { "gd-ant-selector__dialog-layout--three": W.value }]) }, [m("div", {
|
|
263
267
|
id: "gd-ant-selector-panel",
|
|
264
268
|
class: "gd-ant-selector__candidates",
|
|
265
269
|
role: H.value ? "tabpanel" : void 0,
|
|
266
|
-
"aria-labelledby": H.value ? `gd-ant-selector-tab-${
|
|
267
|
-
}, [
|
|
270
|
+
"aria-labelledby": H.value ? `gd-ant-selector-tab-${M.value}` : void 0
|
|
271
|
+
}, [M.value === "user" ? (b(), d(ie, {
|
|
268
272
|
key: 0,
|
|
269
|
-
nodes:
|
|
270
|
-
variant: H.value ? "B" :
|
|
271
|
-
active:
|
|
272
|
-
selected:
|
|
273
|
+
nodes: C(I),
|
|
274
|
+
variant: H.value ? "B" : j.value,
|
|
275
|
+
active: N.value,
|
|
276
|
+
selected: A.value,
|
|
273
277
|
limit: V.value,
|
|
274
278
|
radio: U.value,
|
|
275
279
|
group: H.value,
|
|
276
|
-
members:
|
|
277
|
-
loading: H.value ?
|
|
278
|
-
"tree-loading":
|
|
279
|
-
error: H.value ?
|
|
280
|
-
"tree-error":
|
|
281
|
-
onNavigate: r[2] ||= (e) =>
|
|
282
|
-
onToggle:
|
|
283
|
-
onBulk: r[3] ||= (e) =>
|
|
284
|
-
mode:
|
|
285
|
-
selection:
|
|
286
|
-
maxCount:
|
|
280
|
+
members: C(R),
|
|
281
|
+
loading: H.value ? C(we) : C(z),
|
|
282
|
+
"tree-loading": C(z),
|
|
283
|
+
error: H.value ? C(Ee) : C(B),
|
|
284
|
+
"tree-error": C(B),
|
|
285
|
+
onNavigate: r[2] ||= (e) => N.value = e,
|
|
286
|
+
onToggle: X,
|
|
287
|
+
onBulk: r[3] ||= (e) => A.value = C(s)(A.value, e, {
|
|
288
|
+
mode: c.mode,
|
|
289
|
+
selection: c.selection,
|
|
290
|
+
maxCount: c.maxCount
|
|
287
291
|
}),
|
|
288
|
-
onRetry: r[4] ||= (e) => H.value ?
|
|
289
|
-
onRetryTree:
|
|
292
|
+
onRetry: r[4] ||= (e) => H.value ? C(F).loadMembers(N.value, !0) : Y(),
|
|
293
|
+
onRetryTree: Y
|
|
290
294
|
}, null, 8, [
|
|
291
295
|
"nodes",
|
|
292
296
|
"variant",
|
|
@@ -300,36 +304,36 @@ var fe = { class: "gd-ant-selector__dialog-root" }, pe = {
|
|
|
300
304
|
"tree-loading",
|
|
301
305
|
"error",
|
|
302
306
|
"tree-error"
|
|
303
|
-
])) :
|
|
307
|
+
])) : M.value === "dept" ? (b(), d(re, {
|
|
304
308
|
key: 1,
|
|
305
|
-
nodes:
|
|
306
|
-
selected:
|
|
309
|
+
nodes: C(I),
|
|
310
|
+
selected: A.value,
|
|
307
311
|
radio: U.value,
|
|
308
|
-
loading:
|
|
309
|
-
error:
|
|
310
|
-
onToggle:
|
|
311
|
-
onRetry:
|
|
312
|
+
loading: C(z),
|
|
313
|
+
error: C(B),
|
|
314
|
+
onToggle: X,
|
|
315
|
+
onRetry: Y
|
|
312
316
|
}, null, 8, [
|
|
313
317
|
"nodes",
|
|
314
318
|
"selected",
|
|
315
319
|
"radio",
|
|
316
320
|
"loading",
|
|
317
321
|
"error"
|
|
318
|
-
])) : (
|
|
322
|
+
])) : (b(), d(ae, {
|
|
319
323
|
key: 2,
|
|
320
|
-
roles:
|
|
321
|
-
selected:
|
|
324
|
+
roles: C(L),
|
|
325
|
+
selected: A.value,
|
|
322
326
|
radio: U.value,
|
|
323
327
|
group: H.value,
|
|
324
|
-
loading:
|
|
325
|
-
error:
|
|
326
|
-
onToggle:
|
|
327
|
-
onBulk: r[5] ||= (e) =>
|
|
328
|
-
mode:
|
|
329
|
-
selection:
|
|
330
|
-
maxCount:
|
|
328
|
+
loading: C(Ce),
|
|
329
|
+
error: C(Te),
|
|
330
|
+
onToggle: X,
|
|
331
|
+
onBulk: r[5] ||= (e) => A.value = C(s)(A.value, e, {
|
|
332
|
+
mode: c.mode,
|
|
333
|
+
selection: c.selection,
|
|
334
|
+
maxCount: c.maxCount
|
|
331
335
|
}),
|
|
332
|
-
onRetry: r[6] ||= (e) =>
|
|
336
|
+
onRetry: r[6] ||= (e) => C(F).loadRoles(!0)
|
|
333
337
|
}, null, 8, [
|
|
334
338
|
"roles",
|
|
335
339
|
"selected",
|
|
@@ -337,8 +341,8 @@ var fe = { class: "gd-ant-selector__dialog-root" }, pe = {
|
|
|
337
341
|
"group",
|
|
338
342
|
"loading",
|
|
339
343
|
"error"
|
|
340
|
-
]))], 8,
|
|
341
|
-
selected:
|
|
344
|
+
]))], 8, ve), g(oe, {
|
|
345
|
+
selected: Z.value,
|
|
342
346
|
limit: V.value,
|
|
343
347
|
grouped: H.value,
|
|
344
348
|
onRemove: Ae,
|
|
@@ -360,4 +364,4 @@ var fe = { class: "gd-ant-selector__dialog-root" }, pe = {
|
|
|
360
364
|
}
|
|
361
365
|
});
|
|
362
366
|
//#endregion
|
|
363
|
-
export {
|
|
367
|
+
export { D as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../../../_virtual/_rolldown/runtime.cjs`),require(`../../pro-contract-template-designer/src/utils/contract-print-document.cjs`);const e=require(`./constants.cjs`),t=require(`./coordinates.cjs`),n=require(`./template-source.cjs`),r=require(`./location-rules.cjs`),i=require(`./ContractSigningLocationCanvas.cjs`),a=require(`./ContractSigningLocationInspector.cjs`),o=require(`./ContractSigningLocationNavigator.cjs`),s=require(`./preview-requests.cjs`);let c=require(`vue`),l=require(`ant-design-vue`),u=require(`@ant-design/icons-vue`);var ee={class:`gd-ant-contract-signing-location__header`},te={class:`gd-ant-contract-signing-location__title`},ne={class:`gd-ant-contract-signing-location__header-actions`},re={class:`gd-ant-contract-signing-location__placement-count`},ie={key:0,class:`gd-ant-contract-signing-location__error`,role:`alert`},ae=[`aria-label`,`aria-expanded`],oe={class:`gd-ant-contract-signing-location__panel-stack`},se=[`aria-label`,`aria-expanded`],ce={class:`gd-ant-contract-signing-location__panel-stack`},le=(0,c.defineComponent)({name:`ContractSigningLocation`,__name:`ContractSigningLocation`,props:{modelValue:{default:void 0},mode:{default:`placement`},contractId:{default:``},dataProvider:{default:void 0},sealTypeOptions:{default:()=>e.CONTRACT_SIGNING_SEAL_TYPE_OPTIONS.map(e=>({...e}))},defaultSealTypes:{default:void 0},referencePlacements:{default:()=>[]},allowedPlacementTypes:{default:()=>[`seal`,`signature`,`date`]},sizeProfile:{default:`default`},autoLoad:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minZoom:{default:.5},maxZoom:{default:1.5},zoom:{default:1},resizable:{type:Boolean,default:!1},sealMinSize:{default:8},sealMaxSize:{default:640},height:{default:void 0},showSubmitButton:{type:Boolean,default:!0},showInspector:{type:Boolean,default:void 0},contractFontBaseUrl:{default:void 0}},emits:[`update:modelValue`,`update:zoom`,`change`,`ready`,`file-change`,`page-change`,`submit`,`error`],setup(e,{expose:le,emit:ue}){let d=e,f=ue,p=(0,c.computed)(()=>t.resolveContractSigningSealSizeLimit(d.sealMinSize,d.sealMaxSize)),m=r.normalizeContractSigningLocationValue(d.modelValue??r.createContractSigningLocationValue(d.contractId),{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions}),h=(0,c.shallowRef)(m),g=(0,c.shallowRef)(r.cloneContractSigningLocationValue(m)),_=(0,c.shallowRef)(m.files[0]?.fileId??``),v=(0,c.shallowRef)(m.files[0]?.pages[0]?.pageIndex??0),y=(0,c.shallowRef)(``),b=(0,c.shallowRef)(!1),x=(0,c.shallowRef)(``),S=(0,c.ref)([]),C=(0,c.ref)({}),w=(0,c.shallowRef)(H(d.zoom)),T=(0,c.ref)(null),E=(0,c.ref)(!1),D=(0,c.ref)(!1),O=(0,c.shallowRef)(`loading`),k=(0,c.shallowRef)(``),A=0,j=!1,M,N=[],P=0,F=new s.ContractSigningPreviewRequests,I=(0,c.computed)(()=>d.mode===`preview`),de=(0,c.computed)(()=>I.value||d.readonly||d.disabled),fe=(0,c.computed)(()=>d.showInspector??!I.value),pe=(0,c.computed)(()=>!I.value&&d.showSubmitButton),me=(0,c.computed)(()=>h.value.files.length<=1),he=(0,c.computed)(()=>Je(d.height)),L=(0,c.computed)(()=>h.value.files.find(e=>e.fileId===_.value)??h.value.files[0]),R=(0,c.computed)(()=>n.isContractSigningTemplateFile(L.value)&&O.value!==`ready`),z=(0,c.computed)(()=>de.value||R.value),B=(0,c.computed)(()=>L.value?.pages.find(e=>e.pageIndex===v.value)??L.value?.pages[0]),ge=(0,c.computed)(()=>{let e=L.value;return e?h.value.placements.filter(t=>t.fileId===e.fileId):[]}),_e=(0,c.computed)(()=>{let e=L.value;return e?d.referencePlacements.filter(t=>t.fileId===e.fileId):[]}),V=(0,c.computed)(()=>h.value.placements.find(e=>e.id===y.value)),ve=(0,c.computed)(()=>{let e=V.value;return e?r.findContractSigningPage(h.value,e.fileId,e.pageIndex)??B.value:B.value}),ye=(0,c.computed)(()=>S.value.filter(e=>e.endsWith(`:thumbnail`)).map(e=>e.slice(0,-10))),be=(0,c.computed)(()=>Object.keys(C.value).filter(e=>e.endsWith(`:thumbnail`)).map(e=>e.slice(0,-10))),xe=(0,c.computed)(()=>S.value.filter(e=>e.endsWith(`:preview`)).map(e=>e.slice(0,-8))),Se=(0,c.computed)(()=>{let e={};return Object.entries(C.value).forEach(([t,n])=>{t.endsWith(`:preview`)&&(e[t.slice(0,-8)]=n)}),e});(0,c.watch)(()=>d.modelValue,e=>{if(!e)return;let t=r.normalizeContractSigningLocationValue(e,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions});$(t)!==$(h.value)&&(Q(),h.value=t,g.value=r.cloneContractSigningLocationValue(t),Y(),(0,c.nextTick)(()=>T.value?.scrollToPage(v.value)))},{deep:!0}),(0,c.watch)(p,()=>{$(r.normalizeContractSigningLocationValue(h.value,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions}))!==$(h.value)&&U(h.value)}),(0,c.watch)(()=>d.zoom,e=>{w.value=H(e)}),(0,c.watch)(()=>L.value?.fileId,()=>{O.value=n.isContractSigningTemplateFile(L.value)?`loading`:`ready`,k.value=``}),(0,c.watch)(()=>[d.contractId,d.dataProvider,d.autoLoad],([e,t,n],r)=>{!n||!t||!e||(!r||e!==r[0]||t!==r[1])&&W()},{immediate:!0}),(0,c.onBeforeUnmount)(()=>{j=!0,A+=1,Ue(),Q()});function H(e){let n=Math.min(d.minZoom,d.maxZoom),r=Math.max(d.minZoom,d.maxZoom);return t.clampContractSigningZoom(e,n,r)}function Ce(e){let t=H(e);w.value=t,f(`update:zoom`,t)}function we(){return T.value?.fitWidth()??w.value}function U(e,t={}){h.value=r.normalizeContractSigningLocationValue(e,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions}),t.clearError!==!1&&(x.value=``),Y();let n=r.cloneContractSigningLocationValue(h.value);return f(`update:modelValue`,n),f(`change`,n),n}async function W(){let e=String(d.contractId||h.value.contractId||``).trim();if(!d.dataProvider)return X({code:`CONTRACT_PROVIDER_MISSING`,message:`未配置合同数据提供器,请由宿主传入文件数据`}),!1;if(!e)return X({code:`CONTRACT_ID_MISSING`,message:`缺少用于加载合同的 PaaS contractId`}),!1;let n=++A;Q(),b.value=!0,x.value=``;try{let i=await d.dataProvider.loadContract({contractId:e});if(j||n!==A)return!1;let a=r.normalizeContractSigningProviderValue(i,t.normalizeContractSigningCoordinateScale(d.dataProvider.coordinateScale)),o=r.normalizeContractSigningLocationValue({...a,contractId:e,placements:a.placements.length?a.placements:h.value.contractId===e?h.value.placements:[]},{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions});h.value=o,g.value=r.cloneContractSigningLocationValue(o),y.value=``,Y();let s=r.cloneContractSigningLocationValue(o);return f(`update:modelValue`,s),f(`change`,s),f(`ready`,s),Te(),(0,c.nextTick)(()=>T.value?.scrollToPage(v.value)),s}catch(e){return j||n!==A||X(Z(e,`CONTRACT_LOAD_FAILED`,`合同加载失败,请检查授权后重试`)),!1}finally{!j&&n===A&&(b.value=!1)}}async function Te(){d.dataProvider?.loadPagePreview&&await Promise.allSettled(h.value.files.map(e=>{if(n.isContractSigningTemplateFile(e))return Promise.resolve();let t=r.getContractSigningHomePage(e.pages);return t&&!t.thumbnailUrl?G(e.fileId,t.pageIndex,!0):Promise.resolve()}))}async function G(e,i,a){let o=d.dataProvider?.loadPagePreview,s=h.value.files.find(t=>t.fileId===e),c=r.findContractSigningPage(h.value,e,i),l=Ve(e,i,a);if(!o||n.isContractSigningTemplateFile(s)||!c||S.value.includes(l))return;He(l),S.value=[...S.value,l];let u=F.start(l);try{let n=await o({contractId:h.value.contractId||d.contractId,fileId:e,pageIndex:i,thumbnail:a,signal:u.signal});if(j||!F.isCurrent(l,u)||!r.findContractSigningPage(h.value,e,i))return;let s=r.findContractSigningPage(h.value,e,i),c=r.resolveContractSigningPreviewPageSize(s,n,t.normalizeContractSigningCoordinateScale(d.dataProvider?.coordinateScale),a),ee=h.value.files.map(t=>t.fileId===e?{...t,pages:t.pages.map(e=>e.pageIndex===i?{...e,...c||{},...a?{thumbnailUrl:n.url}:{previewUrl:n.url}}:e)}:t);U({...h.value,files:ee},{clearError:!1})}catch(t){if(!F.isCurrent(l,u)||We(t))return;let n=Z(t,`CONTRACT_PREVIEW_FAILED`,`合同页面预览加载失败,可切换页面或重试`,{fileId:e,pageIndex:i});f(`error`,n),C.value={...C.value,[l]:n.message}}finally{F.finish(l,u)&&(S.value=S.value.filter(e=>e!==l))}}function Ee(e){if(e===_.value)return;let t=_.value;Ue(),t&&(Q(e=>e.startsWith(`${t}:`)&&e.endsWith(`:preview`)),N=N.filter(t=>t.fileId===e)),_.value=e;let n=h.value.files.find(t=>t.fileId===e);v.value=r.getContractSigningHomePage(n?.pages)?.pageIndex??0,y.value=``,f(`file-change`,e),f(`page-change`,e,v.value),(0,c.nextTick)(()=>T.value?.scrollToPage(v.value))}function De(e){v.value=e}function Oe(e){v.value!==e&&(v.value=e),f(`page-change`,_.value,e)}function ke(e){Ue();let t=_.value;M=setTimeout(()=>{M=void 0,_.value===t&&Ae(t,e)},150)}function Ae(e,t){let r=h.value.files.find(t=>t.fileId===e);!r||n.isContractSigningTemplateFile(r)||e!==_.value||(t.forEach(e=>{let t=r.pages.find(t=>t.pageIndex===e);!t||t.previewUrl||S.value.includes(Ve(r.fileId,e,!1))||N.some(t=>t.fileId===r.fileId&&t.pageIndex===e)||N.push({fileId:r.fileId,pageIndex:e})}),je())}async function je(){let e=_.value;for(N=N.filter(t=>t.fileId===e);P<3&&N.length;){let t=N.shift();if(!t||t.fileId!==e)continue;let i=r.findContractSigningPage(h.value,t.fileId,t.pageIndex),a=h.value.files.find(e=>e.fileId===t.fileId);!i||n.isContractSigningTemplateFile(a)||i.previewUrl||S.value.includes(Ve(t.fileId,t.pageIndex,!1))||(P+=1,G(t.fileId,t.pageIndex,!1).finally(()=>{P=Math.max(0,P-1),je()}))}}function Me(e){let t=h.value.placements.find(t=>t.id===e);t&&(t.fileId!==_.value&&Ee(t.fileId),y.value=e,(0,c.nextTick)(()=>T.value?.scrollToPlacement(e)))}function K(e,t={}){if(z.value||!d.allowedPlacementTypes.includes(e))return;let n=t.fileId??L.value?.fileId,i=t.pageIndex??B.value?.pageIndex;if(!n||i===void 0)return;let a=r.findContractSigningPage(h.value,n,i);if(!a||!r.isContractSigningPageUsable(a)){X({code:`CONTRACT_PAGE_SIZE_INVALID`,message:`当前页面缺少有效的原始宽高,暂时不能添加签署位置`,fileId:n,pageIndex:i});return}let o=r.resolveContractSigningDefaultSealTypes(d.defaultSealTypes,d.sealTypeOptions);if(e===`seal`&&!o.length){X({code:`CONTRACT_SEAL_TYPES_MISSING`,message:`当前未配置可用的印章类型,暂时不能添加印章位置`,fileId:n,pageIndex:i});return}let s=r.createContractSigningPlacement(e,n,a,{signLeft:t.signLeft,signTop:t.signTop,sizeProfile:d.sizeProfile,sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions,...e===`seal`?{sealType:o}:{}});return U({...h.value,placements:[...h.value.placements,s]}),_.value=n,v.value=i,y.value=s.id,Ke(s)}function Ne(e,t){z.value||U({...h.value,placements:h.value.placements.map(n=>{if(n.id!==e)return n;let i=t.pageIndex===void 0?n.pageIndex:t.pageIndex,a=r.findContractSigningPage(h.value,n.fileId,i);return r.patchContractSigningPlacement(n,t,a,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions})})})}function Pe(){let e=V.value;if(!e||z.value)return;let n=r.findContractSigningPage(h.value,e.fileId,e.pageIndex);if(!n)return;let i=t.clampContractSigningPlacement({...Ke(e),id:qe(),signLeft:e.signLeft+16,signTop:e.signTop+16},n,{sealSizeLimit:p.value});U({...h.value,placements:[...h.value.placements,i]}),y.value=i.id}function q(e){z.value||(U({...h.value,placements:h.value.placements.filter(t=>t.id!==e)}),y.value===e&&(y.value=``))}function Fe(){let e=r.validateContractSigningLocationValue(h.value,{allowedSealTypes:d.sealTypeOptions.map(e=>e.value)});return R.value?[...e,{code:`CONTRACT_TEMPLATE_FONT_UNAVAILABLE`,message:J()}]:e}function Ie(){return r.cloneContractSigningLocationValue(h.value)}function Le(){if(R.value)throw new r.ContractSigningLocationBuildError([{code:`CONTRACT_TEMPLATE_FONT_UNAVAILABLE`,message:J()}]);return r.buildContractSigningLocationOutput(Ie(),{allowedSealTypes:d.sealTypeOptions.map(e=>e.value)})}function Re(){if(R.value){let e=J();return console.error(`[GD-SIGN-COORD]`,e),X({code:`CONTRACT_TEMPLATE_FONT_UNAVAILABLE`,message:e}),!1}try{let e=Le();return x.value=``,f(`submit`,e),e}catch(e){return X(e instanceof r.ContractSigningLocationBuildError?{...e.errors[0],cause:e}:Z(e,`CONTRACT_SIGNING_LOCATION_INVALID`,`指定签署位置数据不完整`)),!1}}function ze(e,t){O.value=e,k.value=e===`error`?t||`合同排版度量校验失败`:``}function J(){return O.value===`error`?k.value||`合同排版度量校验失败,禁止生成签署坐标`:`合同排版度量校验中,请稍后再保存签署坐标`}function Be(){if(z.value)return r.cloneContractSigningLocationValue(h.value);let e=U(r.cloneContractSigningLocationValue(g.value));return y.value=``,Y(!0),(0,c.nextTick)(()=>T.value?.scrollToPage(v.value)),e}function Y(e=!1){let t=(e?void 0:h.value.files.find(e=>e.fileId===_.value))??h.value.files[0];_.value=t?.fileId??``,v.value=((e?void 0:t?.pages.find(e=>e.pageIndex===v.value))??t?.pages[0])?.pageIndex??0,h.value.placements.some(e=>e.id===y.value)||(y.value=``)}function X(e){x.value=e.message,f(`error`,e)}function Z(e,t,n,r={}){let i=typeof e==`object`&&e&&`status`in e?Number(e.status):void 0;return{code:t,message:i===401||i===403?`授权已失效,请重新获取签署凭证`:e instanceof Error&&e.message?e.message:n,...r,cause:e}}function Ve(e,t,n){return`${e}:${t}:${n?`thumbnail`:`preview`}`}function He(e){if(!(e in C.value))return;let t={...C.value};delete t[e],C.value=t}function Ue(){M&&=(clearTimeout(M),void 0)}function Q(e){let t=e??(()=>!0),n=new Set(F.abort(t));n.size&&(S.value=S.value.filter(e=>!n.has(e))),e||(N=[])}function We(e){return!!(e&&typeof e==`object`&&`cancelled`in e&&e.cancelled)||e instanceof DOMException&&e.name===`AbortError`}function Ge(e){let t=L.value;t&&G(t.fileId,e,!1)}function Ke(e){return{...e,sealType:e.sealType?[...e.sealType]:void 0}}function $(e){return JSON.stringify(e)}function qe(){return typeof crypto<`u`&&`randomUUID`in crypto?`contract-signing-placement-${crypto.randomUUID()}`:`contract-signing-placement-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Je(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return{"--gd-ant-contract-signing-location-height":`${e}px`};if(typeof e==`string`&&e.trim())return{"--gd-ant-contract-signing-location-height":e.trim()}}return le({load:W,validate:Fe,getValue:Ie,getOutput:Le,submit:Re,reset:Be,addPlacement:K,removePlacement:q,fitWidth:we}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`section`,{class:(0,c.normalizeClass)([`gd-ant-contract-signing-location`,{"is-readonly":de.value,"is-disabled":e.disabled,"is-preview":I.value}]),style:(0,c.normalizeStyle)(he.value)},[(0,c.createElementVNode)(`header`,ee,[(0,c.createElementVNode)(`div`,te,[n[6]||=(0,c.createElementVNode)(`span`,{class:`gd-ant-contract-signing-location__title-bar`,"aria-hidden":`true`},null,-1),(0,c.createElementVNode)(`div`,null,[(0,c.createElementVNode)(`strong`,null,(0,c.toDisplayString)(I.value?`合同预览`:`指定合同签署位置`),1)])]),(0,c.createElementVNode)(`div`,ne,[(0,c.createElementVNode)(`span`,re,(0,c.toDisplayString)(h.value.placements.length)+` 个位置`,1),e.dataProvider?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:0,loading:b.value,onClick:W},{default:(0,c.withCtx)(()=>[(0,c.createVNode)((0,c.unref)(u.ReloadOutlined),{"aria-hidden":`true`}),n[7]||=(0,c.createTextVNode)(` 重新加载 `,-1)]),_:1},8,[`loading`])):(0,c.createCommentVNode)(``,!0),I.value?(0,c.createCommentVNode)(``,!0):((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:1,disabled:z.value,onClick:Be},{default:(0,c.withCtx)(()=>[...n[8]||=[(0,c.createTextVNode)(`重置`,-1)]]),_:1},8,[`disabled`])),pe.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:2,type:`primary`,loading:b.value,disabled:e.disabled||R.value,onClick:Re},{default:(0,c.withCtx)(()=>[...n[9]||=[(0,c.createTextVNode)(`确认并生成规则`,-1)]]),_:1},8,[`loading`,`disabled`])):(0,c.createCommentVNode)(``,!0)])]),x.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ie,[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(x.value),1),e.dataProvider&&e.contractId?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:0,type:`link`,size:`small`,onClick:W},{default:(0,c.withCtx)(()=>[...n[10]||=[(0,c.createTextVNode)(`重试`,-1)]]),_:1})):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`gd-ant-contract-signing-location__body`,{"is-single-file":me.value,"is-inspector-hidden":!fe.value}])},[me.value?(0,c.createCommentVNode)(``,!0):((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:(0,c.normalizeClass)([`gd-ant-contract-signing-location__navigator-wrap`,{"is-collapsed":D.value}])},[(0,c.createVNode)((0,c.unref)(l.Tooltip),{title:D.value?`展开页面栏`:`收起页面栏`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{type:`button`,class:`gd-ant-contract-signing-location__panel-handle`,"aria-label":D.value?`展开页面栏`:`收起页面栏`,"aria-expanded":!D.value,onClick:n[0]||=e=>D.value=!D.value},[D.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.RightOutlined),{key:0,"aria-hidden":`true`})):((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.LeftOutlined),{key:1,"aria-hidden":`true`}))],8,ae)]),_:1},8,[`title`]),(0,c.createElementVNode)(`div`,oe,[(0,c.createVNode)(o.default,{files:h.value.files,"active-file-id":_.value,"loading-preview-keys":ye.value,"error-preview-keys":be.value,onSelect:Ee},null,8,[`files`,`active-file-id`,`loading-preview-keys`,`error-preview-keys`])])],2)),(0,c.createVNode)(i.default,{ref_key:`canvasRef`,ref:T,file:L.value,pages:L.value?.pages??[],placements:ge.value,"reference-placements":_e.value,"selected-placement-id":y.value,readonly:z.value,resizable:e.resizable,"seal-size-limit":p.value,"seal-type-options":e.sealTypeOptions,zoom:w.value,"preview-loading-keys":xe.value,"preview-error-map":Se.value,"active-page-index":v.value,"min-zoom":e.minZoom,"max-zoom":e.maxZoom,"font-base-url":e.contractFontBaseUrl,onSelect:n[1]||=e=>y.value=e,onRetry:Ge,onAdd:n[2]||=(e,t,n,r)=>K(e,{signLeft:t,signTop:n,pageIndex:r}),onUpdate:n[3]||=e=>Ne(e.id,e),onRemove:q,onVisiblePages:ke,onViewPage:De,onPageChange:Oe,onZoomChange:Ce,onTemplateStatus:ze},null,8,[`file`,`pages`,`placements`,`reference-placements`,`selected-placement-id`,`readonly`,`resizable`,`seal-size-limit`,`seal-type-options`,`zoom`,`preview-loading-keys`,`preview-error-map`,`active-page-index`,`min-zoom`,`max-zoom`,`font-base-url`]),fe.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:1,class:(0,c.normalizeClass)([`gd-ant-contract-signing-location__inspector-wrap`,{"is-collapsed":E.value}])},[(0,c.createVNode)((0,c.unref)(l.Tooltip),{title:E.value?`展开属性栏`:`收起属性栏`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{type:`button`,class:`gd-ant-contract-signing-location__panel-handle`,"aria-label":E.value?`展开属性栏`:`收起属性栏`,"aria-expanded":!E.value,onClick:n[4]||=e=>E.value=!E.value},[E.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.LeftOutlined),{key:0,"aria-hidden":`true`})):((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.RightOutlined),{key:1,"aria-hidden":`true`}))],8,se)]),_:1},8,[`title`]),(0,c.createElementVNode)(`div`,ce,[(0,c.createVNode)(a.default,{placement:V.value,page:ve.value,pages:L.value?.pages??[],placements:ge.value,readonly:z.value,resizable:e.resizable,"seal-size-limit":p.value,"seal-type-options":e.sealTypeOptions,"allowed-placement-types":e.allowedPlacementTypes,"size-profile":e.sizeProfile,onAdd:K,onUpdate:n[5]||=e=>V.value&&Ne(V.value.id,e),onDuplicate:Pe,onRemove:q,onLocate:Me},null,8,[`placement`,`page`,`pages`,`placements`,`readonly`,`resizable`,`seal-size-limit`,`seal-type-options`,`allowed-placement-types`,`size-profile`])])],2)):(0,c.createCommentVNode)(``,!0)],2)],6))}});exports.default=le;
|
|
1
|
+
require(`../../../_virtual/_rolldown/runtime.cjs`),require(`../../pro-contract-template-designer/src/utils/contract-print-document.cjs`);const e=require(`./constants.cjs`),t=require(`./coordinates.cjs`),n=require(`./template-source.cjs`),r=require(`./location-rules.cjs`),i=require(`./ContractSigningLocationCanvas.cjs`),a=require(`./ContractSigningLocationInspector.cjs`),o=require(`./ContractSigningLocationNavigator.cjs`),s=require(`./preview-requests.cjs`);let c=require(`vue`),l=require(`ant-design-vue`),u=require(`@ant-design/icons-vue`);var ee={class:`gd-ant-contract-signing-location__header`},te={class:`gd-ant-contract-signing-location__title`},ne={class:`gd-ant-contract-signing-location__header-actions`},re={class:`gd-ant-contract-signing-location__placement-count`},ie={key:0,class:`gd-ant-contract-signing-location__error`,role:`alert`},ae=[`aria-label`,`aria-expanded`],oe={class:`gd-ant-contract-signing-location__panel-stack`},se=[`aria-label`,`aria-expanded`],ce={class:`gd-ant-contract-signing-location__panel-stack`},le=(0,c.defineComponent)({name:`ContractSigningLocation`,__name:`ContractSigningLocation`,props:{modelValue:{default:void 0},mode:{default:`placement`},contractId:{default:``},dataProvider:{default:void 0},sealTypeOptions:{default:()=>e.CONTRACT_SIGNING_SEAL_TYPE_OPTIONS.map(e=>({...e}))},defaultSealTypes:{default:void 0},referencePlacements:{default:()=>[]},allowedPlacementTypes:{default:()=>[`seal`,`signature`,`date`]},sizeProfile:{default:`default`},autoLoad:{type:Boolean,default:!0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},minZoom:{default:.5},maxZoom:{default:1.5},zoom:{default:1},resizable:{type:Boolean,default:!1},sealMinSize:{default:8},sealMaxSize:{default:640},height:{default:void 0},showSubmitButton:{type:Boolean,default:!0},showInspector:{type:Boolean,default:void 0},contractFontBaseUrl:{default:void 0}},emits:[`update:modelValue`,`update:zoom`,`change`,`ready`,`file-change`,`page-change`,`submit`,`error`],setup(e,{expose:le,emit:ue}){let d=e,f=ue,p=(0,c.computed)(()=>t.resolveContractSigningSealSizeLimit(d.sealMinSize,d.sealMaxSize)),m=r.normalizeContractSigningLocationValue(d.modelValue??r.createContractSigningLocationValue(d.contractId),{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions}),h=(0,c.shallowRef)(m),de=(0,c.shallowRef)(r.cloneContractSigningLocationValue(m)),g=(0,c.shallowRef)(m.files[0]?.fileId??``),_=(0,c.shallowRef)(m.files[0]?.pages[0]?.pageIndex??0),v=(0,c.shallowRef)(``),y=(0,c.shallowRef)(!1),b=(0,c.shallowRef)(``),x=(0,c.ref)([]),S=(0,c.ref)({}),C=(0,c.shallowRef)(B(d.zoom)),w=(0,c.ref)(null),T=(0,c.ref)(!1),E=(0,c.ref)(!1),D=(0,c.shallowRef)(`loading`),O=(0,c.shallowRef)(``),k=0,A=!1,j,M=[],N=0,P=new s.ContractSigningPreviewRequests,F=(0,c.computed)(()=>d.mode===`preview`),fe=(0,c.computed)(()=>F.value||d.readonly||d.disabled),pe=(0,c.computed)(()=>d.showInspector??!F.value),me=(0,c.computed)(()=>!F.value&&d.showSubmitButton),he=(0,c.computed)(()=>h.value.files.length<=1),ge=(0,c.computed)(()=>Ye(d.height)),I=(0,c.computed)(()=>h.value.files.find(e=>e.fileId===g.value)??h.value.files[0]),L=(0,c.computed)(()=>n.isContractSigningTemplateFile(I.value)&&D.value!==`ready`),_e=(0,c.computed)(()=>{if(!L.value||F.value)return``;if(D.value===`loading`)return`合同排版校验中,暂不可指定签署位置`;let e=O.value.match(/第\s*(\d+)\s*页正文超出纸张/);return e?`第 ${e[1]} 页正文超出纸张,请回模板设计器调整后重试`:`合同排版校验失败,请检查模板后重试`}),R=(0,c.computed)(()=>fe.value||L.value),ve=(0,c.computed)(()=>I.value?.pages.find(e=>e.pageIndex===_.value)??I.value?.pages[0]),ye=(0,c.computed)(()=>{let e=I.value;return e?h.value.placements.filter(t=>t.fileId===e.fileId):[]}),be=(0,c.computed)(()=>{let e=I.value;return e?d.referencePlacements.filter(t=>t.fileId===e.fileId):[]}),z=(0,c.computed)(()=>h.value.placements.find(e=>e.id===v.value)),xe=(0,c.computed)(()=>{let e=z.value;return e?r.findContractSigningPage(h.value,e.fileId,e.pageIndex)??ve.value:ve.value}),Se=(0,c.computed)(()=>x.value.filter(e=>e.endsWith(`:thumbnail`)).map(e=>e.slice(0,-10))),Ce=(0,c.computed)(()=>Object.keys(S.value).filter(e=>e.endsWith(`:thumbnail`)).map(e=>e.slice(0,-10))),we=(0,c.computed)(()=>x.value.filter(e=>e.endsWith(`:preview`)).map(e=>e.slice(0,-8))),Te=(0,c.computed)(()=>{let e={};return Object.entries(S.value).forEach(([t,n])=>{t.endsWith(`:preview`)&&(e[t.slice(0,-8)]=n)}),e});(0,c.watch)(()=>d.modelValue,e=>{if(!e)return;let t=r.normalizeContractSigningLocationValue(e,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions});$(t)!==$(h.value)&&(Q(),h.value=t,de.value=r.cloneContractSigningLocationValue(t),q(),(0,c.nextTick)(()=>w.value?.scrollToPage(_.value)))},{deep:!0}),(0,c.watch)(p,()=>{$(r.normalizeContractSigningLocationValue(h.value,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions}))!==$(h.value)&&V(h.value)}),(0,c.watch)(()=>d.zoom,e=>{C.value=B(e)}),(0,c.watch)(()=>I.value?.fileId,()=>{D.value=n.isContractSigningTemplateFile(I.value)?`loading`:`ready`,O.value=``}),(0,c.watch)(()=>[d.contractId,d.dataProvider,d.autoLoad],([e,t,n],r)=>{!n||!t||!e||(!r||e!==r[0]||t!==r[1])&&H()},{immediate:!0}),(0,c.onBeforeUnmount)(()=>{A=!0,k+=1,Z(),Q()});function B(e){let n=Math.min(d.minZoom,d.maxZoom),r=Math.max(d.minZoom,d.maxZoom);return t.clampContractSigningZoom(e,n,r)}function Ee(e){let t=B(e);C.value=t,f(`update:zoom`,t)}function De(){return w.value?.fitWidth()??C.value}function V(e,t={}){h.value=r.normalizeContractSigningLocationValue(e,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions}),t.clearError!==!1&&(b.value=``),q();let n=r.cloneContractSigningLocationValue(h.value);return f(`update:modelValue`,n),f(`change`,n),n}async function H(){let e=String(d.contractId||h.value.contractId||``).trim();if(!d.dataProvider)return J({code:`CONTRACT_PROVIDER_MISSING`,message:`未配置合同数据提供器,请由宿主传入文件数据`}),!1;if(!e)return J({code:`CONTRACT_ID_MISSING`,message:`缺少用于加载合同的 PaaS contractId`}),!1;let n=++k;Q(),y.value=!0,b.value=``;try{let i=await d.dataProvider.loadContract({contractId:e});if(A||n!==k)return!1;let a=r.normalizeContractSigningProviderValue(i,t.normalizeContractSigningCoordinateScale(d.dataProvider.coordinateScale)),o=r.normalizeContractSigningLocationValue({...a,contractId:e,placements:a.placements.length?a.placements:h.value.contractId===e?h.value.placements:[]},{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions});h.value=o,de.value=r.cloneContractSigningLocationValue(o),v.value=``,q();let s=r.cloneContractSigningLocationValue(o);return f(`update:modelValue`,s),f(`change`,s),f(`ready`,s),Oe(),(0,c.nextTick)(()=>w.value?.scrollToPage(_.value)),s}catch(e){return A||n!==k||J(Y(e,`CONTRACT_LOAD_FAILED`,`合同加载失败,请检查授权后重试`)),!1}finally{!A&&n===k&&(y.value=!1)}}async function Oe(){d.dataProvider?.loadPagePreview&&await Promise.allSettled(h.value.files.map(e=>{if(n.isContractSigningTemplateFile(e))return Promise.resolve();let t=r.getContractSigningHomePage(e.pages);return t&&!t.thumbnailUrl?U(e.fileId,t.pageIndex,!0):Promise.resolve()}))}async function U(e,i,a){let o=d.dataProvider?.loadPagePreview,s=h.value.files.find(t=>t.fileId===e),c=r.findContractSigningPage(h.value,e,i),l=X(e,i,a);if(!o||n.isContractSigningTemplateFile(s)||!c||x.value.includes(l))return;We(l),x.value=[...x.value,l];let u=P.start(l);try{let n=await o({contractId:h.value.contractId||d.contractId,fileId:e,pageIndex:i,thumbnail:a,signal:u.signal});if(A||!P.isCurrent(l,u)||!r.findContractSigningPage(h.value,e,i))return;let s=r.findContractSigningPage(h.value,e,i),c=r.resolveContractSigningPreviewPageSize(s,n,t.normalizeContractSigningCoordinateScale(d.dataProvider?.coordinateScale),a),ee=h.value.files.map(t=>t.fileId===e?{...t,pages:t.pages.map(e=>e.pageIndex===i?{...e,...c||{},...a?{thumbnailUrl:n.url}:{previewUrl:n.url}}:e)}:t);V({...h.value,files:ee},{clearError:!1})}catch(t){if(!P.isCurrent(l,u)||Ge(t))return;let n=Y(t,`CONTRACT_PREVIEW_FAILED`,`合同页面预览加载失败,可切换页面或重试`,{fileId:e,pageIndex:i});f(`error`,n),S.value={...S.value,[l]:n.message}}finally{P.finish(l,u)&&(x.value=x.value.filter(e=>e!==l))}}function ke(e){if(e===g.value)return;let t=g.value;Z(),t&&(Q(e=>e.startsWith(`${t}:`)&&e.endsWith(`:preview`)),M=M.filter(t=>t.fileId===e)),g.value=e;let n=h.value.files.find(t=>t.fileId===e);_.value=r.getContractSigningHomePage(n?.pages)?.pageIndex??0,v.value=``,f(`file-change`,e),f(`page-change`,e,_.value),(0,c.nextTick)(()=>w.value?.scrollToPage(_.value))}function Ae(e){_.value=e}function je(e){_.value!==e&&(_.value=e),f(`page-change`,g.value,e)}function Me(e){Z();let t=g.value;j=setTimeout(()=>{j=void 0,g.value===t&&Ne(t,e)},150)}function Ne(e,t){let r=h.value.files.find(t=>t.fileId===e);!r||n.isContractSigningTemplateFile(r)||e!==g.value||(t.forEach(e=>{let t=r.pages.find(t=>t.pageIndex===e);!t||t.previewUrl||x.value.includes(X(r.fileId,e,!1))||M.some(t=>t.fileId===r.fileId&&t.pageIndex===e)||M.push({fileId:r.fileId,pageIndex:e})}),Pe())}async function Pe(){let e=g.value;for(M=M.filter(t=>t.fileId===e);N<3&&M.length;){let t=M.shift();if(!t||t.fileId!==e)continue;let i=r.findContractSigningPage(h.value,t.fileId,t.pageIndex),a=h.value.files.find(e=>e.fileId===t.fileId);!i||n.isContractSigningTemplateFile(a)||i.previewUrl||x.value.includes(X(t.fileId,t.pageIndex,!1))||(N+=1,U(t.fileId,t.pageIndex,!1).finally(()=>{N=Math.max(0,N-1),Pe()}))}}function Fe(e){let t=h.value.placements.find(t=>t.id===e);t&&(t.fileId!==g.value&&ke(t.fileId),v.value=e,(0,c.nextTick)(()=>w.value?.scrollToPlacement(e)))}function W(e,t={}){if(R.value||!d.allowedPlacementTypes.includes(e))return;let n=t.fileId??I.value?.fileId,i=t.pageIndex??ve.value?.pageIndex;if(!n||i===void 0)return;let a=r.findContractSigningPage(h.value,n,i);if(!a||!r.isContractSigningPageUsable(a)){J({code:`CONTRACT_PAGE_SIZE_INVALID`,message:`当前页面缺少有效的原始宽高,暂时不能添加签署位置`,fileId:n,pageIndex:i});return}let o=r.resolveContractSigningDefaultSealTypes(d.defaultSealTypes,d.sealTypeOptions);if(e===`seal`&&!o.length){J({code:`CONTRACT_SEAL_TYPES_MISSING`,message:`当前未配置可用的印章类型,暂时不能添加印章位置`,fileId:n,pageIndex:i});return}let s=r.createContractSigningPlacement(e,n,a,{signLeft:t.signLeft,signTop:t.signTop,sizeProfile:d.sizeProfile,sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions,...e===`seal`?{sealType:o}:{}});return V({...h.value,placements:[...h.value.placements,s]}),g.value=n,_.value=i,v.value=s.id,qe(s)}function Ie(e,t){R.value||V({...h.value,placements:h.value.placements.map(n=>{if(n.id!==e)return n;let i=t.pageIndex===void 0?n.pageIndex:t.pageIndex,a=r.findContractSigningPage(h.value,n.fileId,i);return r.patchContractSigningPlacement(n,t,a,{sealSizeLimit:p.value,sealTypeOptions:d.sealTypeOptions})})})}function Le(){let e=z.value;if(!e||R.value)return;let n=r.findContractSigningPage(h.value,e.fileId,e.pageIndex);if(!n)return;let i=t.clampContractSigningPlacement({...qe(e),id:Je(),signLeft:e.signLeft+16,signTop:e.signTop+16},n,{sealSizeLimit:p.value});V({...h.value,placements:[...h.value.placements,i]}),v.value=i.id}function G(e){R.value||(V({...h.value,placements:h.value.placements.filter(t=>t.id!==e)}),v.value===e&&(v.value=``))}function Re(){let e=r.validateContractSigningLocationValue(h.value,{allowedSealTypes:d.sealTypeOptions.map(e=>e.value)});return L.value?[...e,{code:`CONTRACT_TEMPLATE_FONT_UNAVAILABLE`,message:K()}]:e}function ze(){return r.cloneContractSigningLocationValue(h.value)}function Be(){if(L.value)throw new r.ContractSigningLocationBuildError([{code:`CONTRACT_TEMPLATE_FONT_UNAVAILABLE`,message:K()}]);return r.buildContractSigningLocationOutput(ze(),{allowedSealTypes:d.sealTypeOptions.map(e=>e.value)})}function Ve(){if(L.value){let e=K();return console.error(`[GD-SIGN-COORD]`,e),J({code:`CONTRACT_TEMPLATE_FONT_UNAVAILABLE`,message:e}),!1}try{let e=Be();return b.value=``,f(`submit`,e),e}catch(e){return J(e instanceof r.ContractSigningLocationBuildError?{...e.errors[0],cause:e}:Y(e,`CONTRACT_SIGNING_LOCATION_INVALID`,`指定签署位置数据不完整`)),!1}}function He(e,t){D.value=e,O.value=e===`error`?t||`合同排版度量校验失败`:``}function K(){return D.value===`error`?O.value||`合同排版度量校验失败,禁止生成签署坐标`:`合同排版度量校验中,请稍后再保存签署坐标`}function Ue(){if(R.value)return r.cloneContractSigningLocationValue(h.value);let e=V(r.cloneContractSigningLocationValue(de.value));return v.value=``,q(!0),(0,c.nextTick)(()=>w.value?.scrollToPage(_.value)),e}function q(e=!1){let t=(e?void 0:h.value.files.find(e=>e.fileId===g.value))??h.value.files[0];g.value=t?.fileId??``,_.value=((e?void 0:t?.pages.find(e=>e.pageIndex===_.value))??t?.pages[0])?.pageIndex??0,h.value.placements.some(e=>e.id===v.value)||(v.value=``)}function J(e){b.value=e.message,f(`error`,e)}function Y(e,t,n,r={}){let i=typeof e==`object`&&e&&`status`in e?Number(e.status):void 0;return{code:t,message:i===401||i===403?`授权已失效,请重新获取签署凭证`:e instanceof Error&&e.message?e.message:n,...r,cause:e}}function X(e,t,n){return`${e}:${t}:${n?`thumbnail`:`preview`}`}function We(e){if(!(e in S.value))return;let t={...S.value};delete t[e],S.value=t}function Z(){j&&=(clearTimeout(j),void 0)}function Q(e){let t=e??(()=>!0),n=new Set(P.abort(t));n.size&&(x.value=x.value.filter(e=>!n.has(e))),e||(M=[])}function Ge(e){return!!(e&&typeof e==`object`&&`cancelled`in e&&e.cancelled)||e instanceof DOMException&&e.name===`AbortError`}function Ke(e){let t=I.value;t&&U(t.fileId,e,!1)}function qe(e){return{...e,sealType:e.sealType?[...e.sealType]:void 0}}function $(e){return JSON.stringify(e)}function Je(){return typeof crypto<`u`&&`randomUUID`in crypto?`contract-signing-placement-${crypto.randomUUID()}`:`contract-signing-placement-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Ye(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return{"--gd-ant-contract-signing-location-height":`${e}px`};if(typeof e==`string`&&e.trim())return{"--gd-ant-contract-signing-location-height":e.trim()}}return le({load:H,validate:Re,getValue:ze,getOutput:Be,submit:Ve,reset:Ue,addPlacement:W,removePlacement:G,fitWidth:De}),(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`section`,{class:(0,c.normalizeClass)([`gd-ant-contract-signing-location`,{"is-readonly":fe.value,"is-disabled":e.disabled,"is-preview":F.value}]),style:(0,c.normalizeStyle)(ge.value)},[(0,c.createElementVNode)(`header`,ee,[(0,c.createElementVNode)(`div`,te,[n[6]||=(0,c.createElementVNode)(`span`,{class:`gd-ant-contract-signing-location__title-bar`,"aria-hidden":`true`},null,-1),(0,c.createElementVNode)(`div`,null,[(0,c.createElementVNode)(`strong`,null,(0,c.toDisplayString)(F.value?`合同预览`:`指定合同签署位置`),1)])]),(0,c.createElementVNode)(`div`,ne,[(0,c.createElementVNode)(`span`,re,(0,c.toDisplayString)(h.value.placements.length)+` 个位置`,1),e.dataProvider?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:0,loading:y.value,onClick:H},{default:(0,c.withCtx)(()=>[(0,c.createVNode)((0,c.unref)(u.ReloadOutlined),{"aria-hidden":`true`}),n[7]||=(0,c.createTextVNode)(` 重新加载 `,-1)]),_:1},8,[`loading`])):(0,c.createCommentVNode)(``,!0),F.value?(0,c.createCommentVNode)(``,!0):((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:1,disabled:R.value,onClick:Ue},{default:(0,c.withCtx)(()=>[...n[8]||=[(0,c.createTextVNode)(`重置`,-1)]]),_:1},8,[`disabled`])),me.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:2,type:`primary`,loading:y.value,disabled:e.disabled||L.value,onClick:Ve},{default:(0,c.withCtx)(()=>[...n[9]||=[(0,c.createTextVNode)(`确认并生成规则`,-1)]]),_:1},8,[`loading`,`disabled`])):(0,c.createCommentVNode)(``,!0)])]),b.value||_e.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ie,[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(b.value||_e.value),1),b.value&&e.dataProvider&&e.contractId?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(l.Button),{key:0,type:`link`,size:`small`,onClick:H},{default:(0,c.withCtx)(()=>[...n[10]||=[(0,c.createTextVNode)(`重试`,-1)]]),_:1})):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,{class:(0,c.normalizeClass)([`gd-ant-contract-signing-location__body`,{"is-single-file":he.value,"is-inspector-hidden":!pe.value}])},[he.value?(0,c.createCommentVNode)(``,!0):((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:(0,c.normalizeClass)([`gd-ant-contract-signing-location__navigator-wrap`,{"is-collapsed":E.value}])},[(0,c.createVNode)((0,c.unref)(l.Tooltip),{title:E.value?`展开页面栏`:`收起页面栏`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{type:`button`,class:`gd-ant-contract-signing-location__panel-handle`,"aria-label":E.value?`展开页面栏`:`收起页面栏`,"aria-expanded":!E.value,onClick:n[0]||=e=>E.value=!E.value},[E.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.RightOutlined),{key:0,"aria-hidden":`true`})):((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.LeftOutlined),{key:1,"aria-hidden":`true`}))],8,ae)]),_:1},8,[`title`]),(0,c.createElementVNode)(`div`,oe,[(0,c.createVNode)(o.default,{files:h.value.files,"active-file-id":g.value,"loading-preview-keys":Se.value,"error-preview-keys":Ce.value,onSelect:ke},null,8,[`files`,`active-file-id`,`loading-preview-keys`,`error-preview-keys`])])],2)),(0,c.createVNode)(i.default,{ref_key:`canvasRef`,ref:w,file:I.value,pages:I.value?.pages??[],placements:ye.value,"reference-placements":be.value,"selected-placement-id":v.value,readonly:R.value,resizable:e.resizable,"seal-size-limit":p.value,"seal-type-options":e.sealTypeOptions,zoom:C.value,"preview-loading-keys":we.value,"preview-error-map":Te.value,"active-page-index":_.value,"min-zoom":e.minZoom,"max-zoom":e.maxZoom,"font-base-url":e.contractFontBaseUrl,onSelect:n[1]||=e=>v.value=e,onRetry:Ke,onAdd:n[2]||=(e,t,n,r)=>W(e,{signLeft:t,signTop:n,pageIndex:r}),onUpdate:n[3]||=e=>Ie(e.id,e),onRemove:G,onVisiblePages:Me,onViewPage:Ae,onPageChange:je,onZoomChange:Ee,onTemplateStatus:He},null,8,[`file`,`pages`,`placements`,`reference-placements`,`selected-placement-id`,`readonly`,`resizable`,`seal-size-limit`,`seal-type-options`,`zoom`,`preview-loading-keys`,`preview-error-map`,`active-page-index`,`min-zoom`,`max-zoom`,`font-base-url`]),pe.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:1,class:(0,c.normalizeClass)([`gd-ant-contract-signing-location__inspector-wrap`,{"is-collapsed":T.value}])},[(0,c.createVNode)((0,c.unref)(l.Tooltip),{title:T.value?`展开属性栏`:`收起属性栏`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{type:`button`,class:`gd-ant-contract-signing-location__panel-handle`,"aria-label":T.value?`展开属性栏`:`收起属性栏`,"aria-expanded":!T.value,onClick:n[4]||=e=>T.value=!T.value},[T.value?((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.LeftOutlined),{key:0,"aria-hidden":`true`})):((0,c.openBlock)(),(0,c.createBlock)((0,c.unref)(u.RightOutlined),{key:1,"aria-hidden":`true`}))],8,se)]),_:1},8,[`title`]),(0,c.createElementVNode)(`div`,ce,[(0,c.createVNode)(a.default,{placement:z.value,page:xe.value,pages:I.value?.pages??[],placements:ye.value,readonly:R.value,resizable:e.resizable,"seal-size-limit":p.value,"seal-type-options":e.sealTypeOptions,"allowed-placement-types":e.allowedPlacementTypes,"size-profile":e.sizeProfile,onAdd:W,onUpdate:n[5]||=e=>z.value&&Ie(z.value.id,e),onDuplicate:Le,onRemove:G,onLocate:Fe},null,8,[`placement`,`page`,`pages`,`placements`,`readonly`,`resizable`,`seal-size-limit`,`seal-type-options`,`allowed-placement-types`,`size-profile`])])],2)):(0,c.createCommentVNode)(``,!0)],2)],6))}});exports.default=le;
|