@guodun/antdv 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/contract-signing-location/index.mjs +1 -0
- package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +304 -289
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +337 -326
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationNavigator.vue.mjs +41 -33
- package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.mjs +5 -0
- package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +23 -0
- package/dist/es/components/contract-signing-location/src/location-rules.mjs +115 -77
- package/dist/es/components/contract-signing-location/src/template-source.mjs +85 -0
- package/dist/es/components/contract-signing-location/style/index.css +1 -1
- package/dist/es/components/index.mjs +8 -6
- package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowCanvas.vue.mjs +164 -57
- package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.mjs +128 -125
- package/dist/es/components/pro-contract-signing-flow/src/ContractSigningFlowNodeCard.vue.mjs +75 -49
- package/dist/es/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.mjs +135 -91
- package/dist/es/components/pro-contract-signing-flow/src/constants.mjs +25 -5
- package/dist/es/components/pro-contract-signing-flow/style/index.css +1 -1
- package/dist/es/components/pro-contract-template-designer/index.mjs +5 -4
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +347 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.mjs +171 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateFileBar.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateFileBar.vue.mjs +166 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.mjs +4 -4
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererValidation.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererValidation.vue.mjs +36 -0
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +202 -202
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1591 -1612
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +235 -239
- package/dist/es/components/pro-contract-template-designer/src/SigningPlacementLayer.vue.mjs +16 -16
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +166 -166
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-draft-cache.mjs +100 -33
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-files.mjs +77 -0
- package/dist/es/components/pro-contract-template-designer/src/extensions/word-paste.mjs +23 -23
- package/dist/es/components/pro-contract-template-designer/src/utils/file-tabs.mjs +14 -0
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +121 -121
- package/dist/es/components/pro-contract-template-designer/src/utils/toolbar-overflow.mjs +19 -0
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +23 -21
- package/dist/lib/components/contract-signing-location/index.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationNavigator.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.cjs +1 -0
- package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -0
- package/dist/lib/components/contract-signing-location/src/location-rules.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -0
- package/dist/lib/components/contract-signing-location/style/index.css +1 -1
- package/dist/lib/components/index.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowCanvas.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowInspector.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ContractSigningFlowNodeCard.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/src/constants.cjs +1 -1
- package/dist/lib/components/pro-contract-signing-flow/style/index.css +1 -1
- package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateFileBar.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateFileBar.vue.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererValidation.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererValidation.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/SigningPlacementLayer.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-draft-cache.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-files.cjs +2 -0
- package/dist/lib/components/pro-contract-template-designer/src/extensions/word-paste.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/file-tabs.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +2 -2
- package/dist/lib/components/pro-contract-template-designer/src/utils/toolbar-overflow.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/theme/contract-signing-location.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/types/components/contract-signing-location/index.d.ts +1 -0
- package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +3 -1
- package/dist/types/components/contract-signing-location/src/ContractSigningLocationInspector.vue.d.ts +2 -2
- package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +6 -0
- package/dist/types/components/contract-signing-location/src/location-rules.d.ts +3 -3
- package/dist/types/components/contract-signing-location/src/template-source.d.ts +20 -0
- package/dist/types/components/contract-signing-location/src/types.d.ts +47 -2
- package/dist/types/components/pro-contract-signing-flow/src/ContractSigningFlowCanvas.vue.d.ts +19 -3
- package/dist/types/components/pro-contract-signing-flow/src/ProContractSigningFlow.vue.d.ts +223 -2
- package/dist/types/components/pro-contract-signing-flow/src/constants.d.ts +15 -0
- package/dist/types/components/pro-contract-signing-flow/src/types.d.ts +12 -0
- package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +103 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerSidebar.vue.d.ts +48 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateFileBar.vue.d.ts +231 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererValidation.vue.d.ts +15 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +1 -1
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +25 -2
- package/dist/types/components/pro-contract-template-designer/src/SigningPlacementInspector.vue.d.ts +2 -2
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +1 -1
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-draft-cache.d.ts +29 -1
- package/dist/types/components/pro-contract-template-designer/src/composables/use-template-files.d.ts +24 -0
- package/dist/types/components/pro-contract-template-designer/src/constants.d.ts +2 -2
- package/dist/types/components/pro-contract-template-designer/src/types.d.ts +59 -1
- package/dist/types/components/pro-contract-template-designer/src/utils/file-tabs.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/toolbar-overflow.d.ts +11 -0
- package/package.json +2 -1
package/dist/es/components/contract-signing-location/src/ContractSigningLocationNavigator.vue.mjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isContractSigningTemplateFile as e } from "./template-source.mjs";
|
|
2
|
+
import { getContractSigningHomePage as t } from "./location-rules.mjs";
|
|
3
|
+
import { Fragment as n, computed as r, createBlock as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, renderList as d, toDisplayString as f, unref as p } from "vue";
|
|
4
|
+
import { FilePdfOutlined as m, FileTextOutlined as h, LoadingOutlined as g } from "@ant-design/icons-vue";
|
|
4
5
|
//#region src/components/contract-signing-location/src/ContractSigningLocationNavigator.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
-
var
|
|
6
|
+
var _ = {
|
|
6
7
|
class: "gd-ant-contract-signing-location__navigator",
|
|
7
8
|
"aria-label": "合同文件"
|
|
8
|
-
},
|
|
9
|
+
}, v = { class: "gd-ant-contract-signing-location__panel-head" }, y = {
|
|
9
10
|
key: 0,
|
|
10
11
|
class: "gd-ant-contract-signing-location__file-list"
|
|
11
|
-
},
|
|
12
|
+
}, b = [
|
|
12
13
|
"aria-pressed",
|
|
13
14
|
"title",
|
|
14
15
|
"onClick"
|
|
15
|
-
],
|
|
16
|
+
], x = { class: "gd-ant-contract-signing-location__thumbnail-preview" }, S = ["src"], C = { key: 2 }, w = { key: 3 }, T = { class: "gd-ant-contract-signing-location__file-title" }, E = {
|
|
16
17
|
key: 1,
|
|
17
18
|
class: "gd-ant-contract-signing-location__panel-empty"
|
|
18
|
-
},
|
|
19
|
+
}, D = /* @__PURE__ */ c({
|
|
19
20
|
name: "ContractSigningLocationNavigator",
|
|
20
21
|
__name: "ContractSigningLocationNavigator",
|
|
21
22
|
props: {
|
|
@@ -25,46 +26,53 @@ var h = {
|
|
|
25
26
|
errorPreviewKeys: {}
|
|
26
27
|
},
|
|
27
28
|
emits: ["select"],
|
|
28
|
-
setup(
|
|
29
|
-
let
|
|
30
|
-
let
|
|
29
|
+
setup(c, { emit: D }) {
|
|
30
|
+
let O = c, k = D, A = r(() => O.files.map((n) => {
|
|
31
|
+
let r = t(n.pages), i = r ? `${n.fileId}:${r.pageIndex}` : "";
|
|
31
32
|
return {
|
|
32
|
-
file:
|
|
33
|
-
home:
|
|
34
|
-
key:
|
|
35
|
-
previewUrl:
|
|
36
|
-
loading: !!(
|
|
37
|
-
error: !!(
|
|
33
|
+
file: n,
|
|
34
|
+
home: r,
|
|
35
|
+
key: i,
|
|
36
|
+
previewUrl: r?.thumbnailUrl || r?.previewUrl,
|
|
37
|
+
loading: !!(i && O.loadingPreviewKeys.includes(i)),
|
|
38
|
+
error: !!(i && O.errorPreviewKeys.includes(i)),
|
|
39
|
+
template: e(n)
|
|
38
40
|
};
|
|
39
41
|
}));
|
|
40
|
-
return (e,
|
|
42
|
+
return (e, t) => (u(), a("aside", _, [o("header", v, [o("div", null, [t[0] ||= o("strong", null, "合同文件", -1), o("span", null, f(c.files.length) + " 个文件", 1)])]), A.value.length ? (u(), a("div", y, [(u(!0), a(n, null, d(A.value, (e) => (u(), a("button", {
|
|
41
43
|
key: e.file.fileId,
|
|
42
44
|
type: "button",
|
|
43
|
-
class:
|
|
44
|
-
"is-active":
|
|
45
|
+
class: l(["gd-ant-contract-signing-location__thumbnail", {
|
|
46
|
+
"is-active": c.activeFileId === e.file.fileId,
|
|
45
47
|
"is-error": e.error
|
|
46
48
|
}]),
|
|
47
|
-
"aria-pressed":
|
|
49
|
+
"aria-pressed": c.activeFileId === e.file.fileId,
|
|
48
50
|
title: e.file.fileName,
|
|
49
|
-
onClick: (t) =>
|
|
50
|
-
}, [
|
|
51
|
+
onClick: (t) => k("select", e.file.fileId)
|
|
52
|
+
}, [o("span", x, [e.previewUrl ? (u(), a("img", {
|
|
51
53
|
key: 0,
|
|
52
54
|
src: e.previewUrl,
|
|
53
55
|
alt: ""
|
|
54
|
-
}, null, 8,
|
|
56
|
+
}, null, 8, S)) : e.loading ? (u(), i(p(g), {
|
|
55
57
|
key: 1,
|
|
56
58
|
spin: "",
|
|
57
59
|
"aria-label": "缩略图加载中"
|
|
58
|
-
})) : e.error ? (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
})) : e.error ? (u(), a("span", C, "重试")) : (u(), a("span", w, f(e.template ? "HTML" : "PDF"), 1))]), o("span", T, [
|
|
61
|
+
e.template ? (u(), i(p(h), {
|
|
62
|
+
key: 0,
|
|
63
|
+
"aria-hidden": "true"
|
|
64
|
+
})) : (u(), i(p(m), {
|
|
65
|
+
key: 1,
|
|
66
|
+
"aria-hidden": "true"
|
|
67
|
+
})),
|
|
68
|
+
o("span", null, f(e.file.fileName), 1),
|
|
69
|
+
o("small", null, f(e.file.pages.length) + " 页", 1)
|
|
70
|
+
])], 10, b))), 128))])) : (u(), a("div", E, [
|
|
71
|
+
s(p(m), { "aria-hidden": "true" }),
|
|
72
|
+
t[1] ||= o("strong", null, "暂无合同文件", -1),
|
|
73
|
+
t[2] ||= o("span", null, "请由宿主传入文件,或配置 dataProvider 自动加载。", -1)
|
|
66
74
|
]))]));
|
|
67
75
|
}
|
|
68
76
|
});
|
|
69
77
|
//#endregion
|
|
70
|
-
export {
|
|
78
|
+
export { D as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createCommentVNode as e, createElementBlock as t, createElementVNode as n, defineComponent as r, openBlock as i, toDisplayString as a } from "vue";
|
|
2
|
+
//#region src/components/contract-signing-location/src/ContractSigningTemplatePage.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var o = ["data-template-page-id", "data-template-page-index"], s = ["innerHTML"], c = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "gd-ant-contract-signing-location__template-warning",
|
|
6
|
+
role: "alert"
|
|
7
|
+
}, l = /* @__PURE__ */ r({
|
|
8
|
+
name: "ContractSigningTemplatePage",
|
|
9
|
+
__name: "ContractSigningTemplatePage",
|
|
10
|
+
props: { page: {} },
|
|
11
|
+
setup(r) {
|
|
12
|
+
return (l, u) => (i(), t("div", {
|
|
13
|
+
class: "gd-ant-contract-signing-location__template-page gd-contract-template-page",
|
|
14
|
+
"data-template-page-id": r.page.pageId,
|
|
15
|
+
"data-template-page-index": r.page.pageIndex
|
|
16
|
+
}, [n("div", {
|
|
17
|
+
class: "gd-ant-contract-signing-location__template-page-content",
|
|
18
|
+
innerHTML: r.page.contentHtml
|
|
19
|
+
}, null, 8, s), r.page.errors.length ? (i(), t("div", c, [u[0] ||= n("strong", null, "模板已安全降级展示", -1), n("span", null, a(r.page.errors[0]), 1)])) : e("", !0)], 8, o));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { l as default };
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { CONTRACT_SIGNING_PLACEMENT_LABELS as e, resolveContractSigningSealSizeInPixels as t } from "./constants.mjs";
|
|
2
2
|
import { clampContractSigningPlacement as n, getContractSigningPlacementSize as r, getContractSigningRuleGeometry as i, normalizeContractSigningCoordinateDimension as a, normalizeContractSigningCoordinateScale as o } from "./coordinates.mjs";
|
|
3
|
+
import { buildContractSigningTemplateRenderPages as s, isContractSigningTemplateFile as c, validateContractSigningTemplateFile as l } from "./template-source.mjs";
|
|
3
4
|
//#region src/components/contract-signing-location/src/location-rules.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
5
|
+
var u = 0;
|
|
6
|
+
function d(e = "") {
|
|
6
7
|
return {
|
|
7
8
|
contractId: e,
|
|
8
9
|
files: [],
|
|
9
10
|
placements: []
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
|
-
function
|
|
13
|
-
let r =
|
|
13
|
+
function f(e, t) {
|
|
14
|
+
let r = T(e?.files), i = M(r);
|
|
14
15
|
return {
|
|
15
16
|
contractId: String(e?.contractId ?? "").trim(),
|
|
16
17
|
files: r,
|
|
17
|
-
placements: Array.isArray(e?.placements) ? e.placements.map(
|
|
18
|
-
let r = i.get(
|
|
18
|
+
placements: Array.isArray(e?.placements) ? e.placements.map(A).map((e) => {
|
|
19
|
+
let r = i.get(N(e.fileId, e.pageIndex));
|
|
19
20
|
return r ? n(e, r, {
|
|
20
21
|
sealSizeLimit: t?.sealSizeLimit,
|
|
21
22
|
sealTypes: e.sealType,
|
|
@@ -24,12 +25,17 @@ function l(e, t) {
|
|
|
24
25
|
}) : []
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function p(e) {
|
|
28
29
|
return {
|
|
29
30
|
contractId: e.contractId,
|
|
30
31
|
files: e.files.map((e) => ({
|
|
31
32
|
...e,
|
|
32
|
-
pages: e.pages.map((e) => ({ ...e }))
|
|
33
|
+
pages: e.pages.map((e) => ({ ...e })),
|
|
34
|
+
...e.source?.type === "template" ? { source: {
|
|
35
|
+
type: "template",
|
|
36
|
+
template: k(e.source.template),
|
|
37
|
+
...e.source.values ? { values: { ...e.source.values } } : {}
|
|
38
|
+
} } : e.source ? { source: { type: "preview" } } : {}
|
|
33
39
|
})),
|
|
34
40
|
placements: e.placements.map((e) => ({
|
|
35
41
|
...e,
|
|
@@ -37,36 +43,36 @@ function u(e) {
|
|
|
37
43
|
}))
|
|
38
44
|
};
|
|
39
45
|
}
|
|
40
|
-
function
|
|
41
|
-
let n = o(t);
|
|
42
|
-
if (
|
|
43
|
-
let
|
|
46
|
+
function m(e, t = 1) {
|
|
47
|
+
let n = f(e), r = o(t);
|
|
48
|
+
if (r === 1) return n;
|
|
49
|
+
let i = (e) => a(e, r);
|
|
44
50
|
return {
|
|
45
|
-
...
|
|
46
|
-
files:
|
|
51
|
+
...n,
|
|
52
|
+
files: n.files.map((e) => c(e) ? e : {
|
|
47
53
|
...e,
|
|
48
54
|
pages: e.pages.map((e) => ({
|
|
49
55
|
...e,
|
|
50
|
-
width:
|
|
51
|
-
height:
|
|
56
|
+
width: i(e.width),
|
|
57
|
+
height: i(e.height)
|
|
52
58
|
}))
|
|
53
|
-
})
|
|
54
|
-
placements:
|
|
59
|
+
}),
|
|
60
|
+
placements: n.placements.map((e) => c(n.files.find((t) => t.fileId === e.fileId)) ? e : {
|
|
55
61
|
...e,
|
|
56
|
-
signLeft:
|
|
57
|
-
signTop:
|
|
58
|
-
signWidth:
|
|
59
|
-
signHeight:
|
|
60
|
-
})
|
|
62
|
+
signLeft: i(e.signLeft),
|
|
63
|
+
signTop: i(e.signTop),
|
|
64
|
+
signWidth: i(e.signWidth),
|
|
65
|
+
signHeight: i(e.signHeight)
|
|
66
|
+
})
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
|
-
function
|
|
69
|
+
function h(e, t, n) {
|
|
64
70
|
return e.files.find((e) => e.fileId === t)?.pages.find((e) => e.pageIndex === n);
|
|
65
71
|
}
|
|
66
|
-
function
|
|
72
|
+
function g(e) {
|
|
67
73
|
if (e?.length) return e.reduce((e, t) => t.pageIndex < e.pageIndex ? t : e);
|
|
68
74
|
}
|
|
69
|
-
function
|
|
75
|
+
function _(e, r, i, a) {
|
|
70
76
|
let o = {
|
|
71
77
|
...e,
|
|
72
78
|
...r,
|
|
@@ -94,37 +100,37 @@ function m(e, r, i, a) {
|
|
|
94
100
|
sealTypeOptions: a?.sealTypeOptions
|
|
95
101
|
}) : o;
|
|
96
102
|
}
|
|
97
|
-
function
|
|
98
|
-
return !!(e &&
|
|
103
|
+
function v(e) {
|
|
104
|
+
return !!(e && R(e.width) && R(e.height));
|
|
99
105
|
}
|
|
100
|
-
function
|
|
101
|
-
if (r ||
|
|
106
|
+
function y(e, t, n = 1, r = !1) {
|
|
107
|
+
if (r || v(e) || !t.width || !t.height) return;
|
|
102
108
|
let i = a(t.width, n), o = a(t.height, n);
|
|
103
109
|
return i > 0 && o > 0 ? {
|
|
104
110
|
width: i,
|
|
105
111
|
height: o
|
|
106
112
|
} : void 0;
|
|
107
113
|
}
|
|
108
|
-
function
|
|
109
|
-
let
|
|
110
|
-
return
|
|
111
|
-
id: `contract-signing-placement-${Date.now().toString(36)}-${
|
|
114
|
+
function b(e, i, a, o = {}) {
|
|
115
|
+
let s = e === "seal" ? t(o.sealType ?? ["04"], o.sealTypeOptions) : r(e, o.sizeProfile);
|
|
116
|
+
return u += 1, n({
|
|
117
|
+
id: `contract-signing-placement-${Date.now().toString(36)}-${u.toString(36)}`,
|
|
112
118
|
fileId: i,
|
|
113
119
|
pageIndex: a.pageIndex,
|
|
114
120
|
signType: e,
|
|
115
|
-
signLeft: o.signLeft ?? (a.width -
|
|
116
|
-
signTop: o.signTop ?? (a.height -
|
|
117
|
-
signWidth:
|
|
118
|
-
signHeight:
|
|
121
|
+
signLeft: o.signLeft ?? (a.width - s.width) / 2,
|
|
122
|
+
signTop: o.signTop ?? (a.height - s.height) / 2,
|
|
123
|
+
signWidth: s.width,
|
|
124
|
+
signHeight: s.height,
|
|
119
125
|
mustSign: !0,
|
|
120
|
-
...e === "seal" ? { sealType: o.sealType === void 0 ? ["04"] :
|
|
126
|
+
...e === "seal" ? { sealType: o.sealType === void 0 ? ["04"] : j(o.sealType) } : {}
|
|
121
127
|
}, a, {
|
|
122
128
|
sealSizeLimit: o.sealSizeLimit,
|
|
123
129
|
sealTypes: o.sealType,
|
|
124
130
|
sealTypeOptions: o.sealTypeOptions
|
|
125
131
|
});
|
|
126
132
|
}
|
|
127
|
-
function
|
|
133
|
+
function x(t, n = {}) {
|
|
128
134
|
let r = [], i = n.allowedSealTypes ? new Set(Array.from(n.allowedSealTypes, (e) => String(e).trim()).filter(Boolean)) : void 0;
|
|
129
135
|
t.files.length || r.push({
|
|
130
136
|
code: "CONTRACT_FILES_MISSING",
|
|
@@ -146,7 +152,7 @@ function v(t, n = {}) {
|
|
|
146
152
|
code: "CONTRACT_PAGES_MISSING",
|
|
147
153
|
message: `文件 ${e.fileName || e.fileId} 没有页面元数据`,
|
|
148
154
|
fileId: e.fileId
|
|
149
|
-
});
|
|
155
|
+
}), r.push(...l(e));
|
|
150
156
|
let t = /* @__PURE__ */ new Set();
|
|
151
157
|
e.pages.forEach((n) => {
|
|
152
158
|
!Number.isInteger(n.pageIndex) || n.pageIndex < 0 ? r.push({
|
|
@@ -159,7 +165,7 @@ function v(t, n = {}) {
|
|
|
159
165
|
message: `文件 ${e.fileName || e.fileId} 的页面索引 ${n.pageIndex} 重复`,
|
|
160
166
|
fileId: e.fileId,
|
|
161
167
|
pageIndex: n.pageIndex
|
|
162
|
-
}), t.add(n.pageIndex),
|
|
168
|
+
}), t.add(n.pageIndex), v(n) || r.push({
|
|
163
169
|
code: "CONTRACT_PAGE_SIZE_INVALID",
|
|
164
170
|
message: "页面缺少有效的原始宽高",
|
|
165
171
|
fileId: e.fileId,
|
|
@@ -176,7 +182,7 @@ function v(t, n = {}) {
|
|
|
176
182
|
code: "SIGNING_PLACEMENT_ID_MISSING",
|
|
177
183
|
message: `${a}缺少唯一 ID`
|
|
178
184
|
}), o.add(n.id);
|
|
179
|
-
let s =
|
|
185
|
+
let s = h(t, n.fileId, n.pageIndex);
|
|
180
186
|
if (!s) {
|
|
181
187
|
r.push({
|
|
182
188
|
code: "SIGNING_PLACEMENT_PAGE_MISSING",
|
|
@@ -221,9 +227,9 @@ function v(t, n = {}) {
|
|
|
221
227
|
});
|
|
222
228
|
}), r;
|
|
223
229
|
}
|
|
224
|
-
function
|
|
225
|
-
let n =
|
|
226
|
-
if (n.length) throw new
|
|
230
|
+
function S(e, t = {}) {
|
|
231
|
+
let n = x(e, t);
|
|
232
|
+
if (n.length) throw new w(n);
|
|
227
233
|
return e.placements.map((e) => {
|
|
228
234
|
let t = i(e);
|
|
229
235
|
return {
|
|
@@ -240,78 +246,110 @@ function y(e, t = {}) {
|
|
|
240
246
|
};
|
|
241
247
|
});
|
|
242
248
|
}
|
|
243
|
-
function
|
|
244
|
-
let n =
|
|
249
|
+
function C(e, t = {}) {
|
|
250
|
+
let n = p(e);
|
|
245
251
|
return {
|
|
246
252
|
...n,
|
|
247
|
-
locationRules:
|
|
253
|
+
locationRules: S(n, t)
|
|
248
254
|
};
|
|
249
255
|
}
|
|
250
|
-
var
|
|
256
|
+
var w = class extends Error {
|
|
251
257
|
constructor(e) {
|
|
252
258
|
super(e[0]?.message || "指定签署位置数据不完整"), this.code = "CONTRACT_SIGNING_LOCATION_INVALID", this.name = "ContractSigningLocationBuildError", this.errors = e;
|
|
253
259
|
}
|
|
254
260
|
};
|
|
255
|
-
function
|
|
261
|
+
function T(e) {
|
|
256
262
|
return Array.isArray(e) ? e.map((e, t) => {
|
|
257
|
-
let n = e && typeof e == "object" ? e : {}, r = String(n.fileId ?? "").trim(), i = Array.isArray(n.pages) ? n.pages : [];
|
|
263
|
+
let n = e && typeof e == "object" ? e : {}, r = String(n.fileId ?? "").trim(), i = E(n.source), a = i?.type === "template" ? D(i.template, i.values) : Array.isArray(n.pages) ? n.pages.map((e, t) => O(e, t)) : [];
|
|
258
264
|
return {
|
|
259
265
|
fileId: r,
|
|
260
266
|
fileName: String(n.fileName ?? `合同文件 ${t + 1}`),
|
|
261
|
-
pages:
|
|
267
|
+
pages: a,
|
|
268
|
+
...i ? { source: i } : {}
|
|
262
269
|
};
|
|
263
270
|
}) : [];
|
|
264
271
|
}
|
|
265
|
-
function
|
|
266
|
-
|
|
272
|
+
function E(e) {
|
|
273
|
+
if (!e || typeof e != "object") return;
|
|
274
|
+
let t = e;
|
|
275
|
+
return t.type === "template" ? {
|
|
276
|
+
type: "template",
|
|
277
|
+
template: k(t.template),
|
|
278
|
+
...t.values && typeof t.values == "object" && !Array.isArray(t.values) ? { values: { ...t.values } } : {}
|
|
279
|
+
} : t.type === "preview" ? { type: "preview" } : void 0;
|
|
280
|
+
}
|
|
281
|
+
function D(e, t) {
|
|
282
|
+
return s({
|
|
283
|
+
type: "template",
|
|
284
|
+
template: e,
|
|
285
|
+
...t ? { values: t } : {}
|
|
286
|
+
}).map((e) => ({
|
|
287
|
+
pageIndex: e.pageIndex,
|
|
288
|
+
displayPageNumber: e.pageIndex + 1,
|
|
289
|
+
pageId: e.pageId,
|
|
290
|
+
width: F(e.width, 0),
|
|
291
|
+
height: F(e.height, 0)
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
function O(e, t) {
|
|
295
|
+
let n = e && typeof e == "object" ? e : {}, r = I(n.pageIndex, t);
|
|
267
296
|
return {
|
|
268
297
|
pageIndex: r,
|
|
269
|
-
displayPageNumber:
|
|
270
|
-
width:
|
|
271
|
-
height:
|
|
298
|
+
displayPageNumber: L(n.displayPageNumber, r + 1),
|
|
299
|
+
width: F(n.width, 0),
|
|
300
|
+
height: F(n.height, 0),
|
|
301
|
+
...n.pageId ? { pageId: String(n.pageId) } : {},
|
|
272
302
|
...n.previewUrl ? { previewUrl: String(n.previewUrl) } : {},
|
|
273
303
|
...n.thumbnailUrl ? { thumbnailUrl: String(n.thumbnailUrl) } : {}
|
|
274
304
|
};
|
|
275
305
|
}
|
|
276
|
-
function
|
|
306
|
+
function k(e) {
|
|
307
|
+
if (e == null) return e;
|
|
308
|
+
try {
|
|
309
|
+
return JSON.parse(JSON.stringify(e));
|
|
310
|
+
} catch {
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function A(e) {
|
|
277
315
|
let t = e?.signType === "seal" || e?.signType === "signature" || e?.signType === "date" ? e.signType : "signature";
|
|
278
316
|
return {
|
|
279
317
|
id: String(e?.id ?? ""),
|
|
280
318
|
fileId: String(e?.fileId ?? "").trim(),
|
|
281
|
-
pageIndex:
|
|
319
|
+
pageIndex: I(e?.pageIndex, 0),
|
|
282
320
|
signType: t,
|
|
283
|
-
signLeft:
|
|
284
|
-
signTop:
|
|
285
|
-
signWidth:
|
|
286
|
-
signHeight:
|
|
321
|
+
signLeft: P(e?.signLeft, 0),
|
|
322
|
+
signTop: P(e?.signTop, 0),
|
|
323
|
+
signWidth: P(e?.signWidth, 0),
|
|
324
|
+
signHeight: P(e?.signHeight, 0),
|
|
287
325
|
mustSign: e?.mustSign !== !1,
|
|
288
326
|
...t === "seal" && Array.isArray(e?.sealType) ? { sealType: e.sealType.map(String) } : {}
|
|
289
327
|
};
|
|
290
328
|
}
|
|
291
|
-
function
|
|
329
|
+
function j(e) {
|
|
292
330
|
return Array.isArray(e) ? Array.from(new Set(e.map(String).map((e) => e.trim()).filter(Boolean))) : [];
|
|
293
331
|
}
|
|
294
|
-
function
|
|
295
|
-
return new Map(e.flatMap((e) => e.pages.map((t) => [
|
|
332
|
+
function M(e) {
|
|
333
|
+
return new Map(e.flatMap((e) => e.pages.map((t) => [N(e.fileId, t.pageIndex), t])));
|
|
296
334
|
}
|
|
297
|
-
function
|
|
335
|
+
function N(e, t) {
|
|
298
336
|
return `${e}\u0000${t}`;
|
|
299
337
|
}
|
|
300
|
-
function
|
|
338
|
+
function P(e, t) {
|
|
301
339
|
let n = Number(e);
|
|
302
340
|
return Number.isFinite(n) ? n : t;
|
|
303
341
|
}
|
|
304
|
-
function
|
|
305
|
-
return Math.max(0,
|
|
342
|
+
function F(e, t) {
|
|
343
|
+
return Math.max(0, P(e, t));
|
|
306
344
|
}
|
|
307
|
-
function
|
|
308
|
-
return Math.max(0, Math.round(
|
|
345
|
+
function I(e, t) {
|
|
346
|
+
return Math.max(0, Math.round(P(e, t)));
|
|
309
347
|
}
|
|
310
|
-
function
|
|
311
|
-
return Math.max(1, Math.round(
|
|
348
|
+
function L(e, t) {
|
|
349
|
+
return Math.max(1, Math.round(P(e, t)));
|
|
312
350
|
}
|
|
313
|
-
function
|
|
351
|
+
function R(e) {
|
|
314
352
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
315
353
|
}
|
|
316
354
|
//#endregion
|
|
317
|
-
export {
|
|
355
|
+
export { w as ContractSigningLocationBuildError, C as buildContractSigningLocationOutput, S as buildContractSigningLocationRules, p as cloneContractSigningLocationValue, d as createContractSigningLocationValue, b as createContractSigningPlacement, h as findContractSigningPage, g as getContractSigningHomePage, v as isContractSigningPageUsable, f as normalizeContractSigningLocationValue, m as normalizeContractSigningProviderValue, _ as patchContractSigningPlacement, y as resolveContractSigningPreviewPageSize, x as validateContractSigningLocationValue };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { buildTemplateRenderPages as e, normalizeRenderValues as t, validateTemplateRenderStructure as n } from "../../pro-contract-template-designer/src/utils/template-renderer.mjs";
|
|
2
|
+
//#region src/components/contract-signing-location/src/template-source.ts
|
|
3
|
+
function r(e) {
|
|
4
|
+
return !!(e && typeof e == "object" && e.type === "template");
|
|
5
|
+
}
|
|
6
|
+
function i(e) {
|
|
7
|
+
return r(e?.source);
|
|
8
|
+
}
|
|
9
|
+
function a(n) {
|
|
10
|
+
if (!r(n) || !l(n.template)) return [];
|
|
11
|
+
try {
|
|
12
|
+
let r = n.template, i = Array.isArray(r.pages) ? r.pages : [], a = t(r, n.values), o = c(r);
|
|
13
|
+
return i.flatMap((t, n) => {
|
|
14
|
+
let i = e({
|
|
15
|
+
...r,
|
|
16
|
+
pages: [t]
|
|
17
|
+
}, a, {
|
|
18
|
+
readonly: !0,
|
|
19
|
+
disabled: !0,
|
|
20
|
+
mode: "display"
|
|
21
|
+
})[0];
|
|
22
|
+
if (!i) return [];
|
|
23
|
+
let s = u(t?.pageSize, r.pageSize, i);
|
|
24
|
+
return [{
|
|
25
|
+
pageIndex: n,
|
|
26
|
+
pageId: i.id,
|
|
27
|
+
title: i.title,
|
|
28
|
+
width: s.width,
|
|
29
|
+
height: s.height,
|
|
30
|
+
contentHtml: i.contentHtml,
|
|
31
|
+
errors: o.filter((e) => !e.pageId || e.pageId === i.id).map((e) => e.message)
|
|
32
|
+
}];
|
|
33
|
+
});
|
|
34
|
+
} catch {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function o(e) {
|
|
39
|
+
if (!r(e.source)) return [];
|
|
40
|
+
if (!l(e.source.template)) return [{
|
|
41
|
+
code: "CONTRACT_TEMPLATE_MISSING",
|
|
42
|
+
message: `文件 ${e.fileName || e.fileId} 缺少可渲染的合同模板`,
|
|
43
|
+
fileId: e.fileId
|
|
44
|
+
}];
|
|
45
|
+
try {
|
|
46
|
+
let t = Array.isArray(e.source.template.pages) ? e.source.template.pages : [];
|
|
47
|
+
return c(e.source.template).map((n) => {
|
|
48
|
+
let r = n.pageId ? t.findIndex((e) => e?.id === n.pageId) : -1;
|
|
49
|
+
return {
|
|
50
|
+
code: `CONTRACT_${n.code || "TEMPLATE_INVALID"}`,
|
|
51
|
+
message: `${e.fileName || e.fileId}:${n.message}`,
|
|
52
|
+
fileId: e.fileId,
|
|
53
|
+
...r >= 0 ? { pageIndex: r } : {}
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
} catch (t) {
|
|
57
|
+
return [{
|
|
58
|
+
code: "CONTRACT_TEMPLATE_RENDER_FAILED",
|
|
59
|
+
message: `文件 ${e.fileName || e.fileId} 的模板数据无法安全渲染`,
|
|
60
|
+
fileId: e.fileId,
|
|
61
|
+
cause: t
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function s(e) {
|
|
66
|
+
return !e || !r(e.source) ? "" : o(e)[0]?.message ?? "";
|
|
67
|
+
}
|
|
68
|
+
function c(e) {
|
|
69
|
+
return n(e);
|
|
70
|
+
}
|
|
71
|
+
function l(e) {
|
|
72
|
+
return !!(e && typeof e == "object");
|
|
73
|
+
}
|
|
74
|
+
function u(e, t, n) {
|
|
75
|
+
return {
|
|
76
|
+
width: d(e?.width, d(t?.width, n.width)),
|
|
77
|
+
height: d(e?.height, d(t?.height, n.height))
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function d(e, t) {
|
|
81
|
+
let n = Number(e);
|
|
82
|
+
return Number.isFinite(n) && n > 0 ? n : t;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { a as buildContractSigningTemplateRenderPages, s as getContractSigningTemplateDisplayError, i as isContractSigningTemplateFile, r as isContractSigningTemplateSource, o as validateContractSigningTemplateFile };
|