@guodun/antdv 1.7.12 → 1.7.13

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.
Files changed (62) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +370 -294
  2. package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +219 -202
  3. package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +18 -18
  4. package/dist/es/components/contract-signing-location/src/template-source.mjs +62 -49
  5. package/dist/es/components/index.mjs +1 -0
  6. package/dist/es/components/pro-contract-template-designer/index.mjs +1 -0
  7. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +37 -42
  8. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.mjs +69 -55
  9. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.mjs +278 -270
  10. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +344 -343
  11. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1046 -1000
  12. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +120 -74
  13. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +133 -132
  14. package/dist/es/components/pro-contract-template-designer/src/utils/contract-layout-check.mjs +239 -0
  15. package/dist/es/components/pro-contract-template-designer/src/utils/contract-print-document.mjs +95 -71
  16. package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +67 -76
  17. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +96 -83
  18. package/dist/es/components/pro-contract-template-designer/src/utils/template-variable-render.mjs +23 -15
  19. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  20. package/dist/es/contract-print-css/index.mjs +122 -25
  21. package/dist/es/contract-print.mjs +2 -0
  22. package/dist/es/index.mjs +21 -20
  23. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  24. package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
  25. package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
  26. package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
  27. package/dist/lib/components/index.cjs +1 -1
  28. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  29. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
  30. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue.cjs +1 -1
  31. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.cjs +1 -1
  32. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  33. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  34. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  35. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  36. package/dist/lib/components/pro-contract-template-designer/src/utils/contract-layout-check.cjs +1 -0
  37. package/dist/lib/components/pro-contract-template-designer/src/utils/contract-print-document.cjs +50 -28
  38. package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
  39. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +5 -5
  40. package/dist/lib/components/pro-contract-template-designer/src/utils/template-variable-render.cjs +1 -1
  41. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  42. package/dist/lib/contract-print-css/index.cjs +62 -18
  43. package/dist/lib/contract-print.cjs +1 -0
  44. package/dist/lib/index.cjs +1 -1
  45. package/dist/theme/icon.css +1 -1
  46. package/dist/theme/index.css +1 -1
  47. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +9 -0
  48. package/dist/types/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.d.ts +7 -0
  49. package/dist/types/components/contract-signing-location/src/template-source.d.ts +6 -0
  50. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  51. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateSingleRenderer.vue.d.ts +2 -0
  52. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +5 -1
  53. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +7 -2
  54. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +2 -2
  55. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +36 -0
  56. package/dist/types/components/pro-contract-template-designer/src/utils/contract-layout-check.d.ts +104 -0
  57. package/dist/types/components/pro-contract-template-designer/src/utils/contract-print-document.d.ts +4 -1
  58. package/dist/types/components/pro-contract-template-designer/src/utils/page-decorations.d.ts +2 -8
  59. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +6 -1
  60. package/dist/types/contract-print-css/index.d.ts +70 -0
  61. package/dist/types/contract-print.d.ts +2 -0
  62. package/package.json +14 -2
@@ -20,28 +20,28 @@ var p = [
20
20
  },
21
21
  emits: ["status", "metrics"],
22
22
  setup(c, { emit: h }) {
23
- let g = c, _ = h, v = d(0), y = d(0), b = d("loading"), x = r(() => ({
23
+ let g = c, _ = h, v = d(0), y = d(0), b = d(0), x = d("loading"), S = r(() => ({
24
24
  width: `${g.page.displayWidth}px`,
25
25
  minHeight: `${g.page.displayHeight}px`,
26
26
  height: `${Math.max(g.page.displayHeight, v.value)}px`
27
- })), S = r(() => t(g.page.pageDecorations, g.page.pageNumber)), C = r(() => n(g.page.pageDecorations, g.page.pageNumber, g.page.totalPages, g.page.decorationVariables, g.page.decorationValues)), w = r(() => y.value > 1 ? `第 ${g.page.pageNumber} 页正文超出纸张 ${Math.round(y.value)}px,生成 PDF 时会分页,请回模板设计器调整后再指定位置。` : ""), T = r(() => g.page.errors[0] || w.value), E = r(() => g.page.errors.length ? "模板已安全降级展示" : "该页签署位置不可信");
28
- function D(e) {
29
- v.value = e.contentHeight, y.value = e.overflowHeight, _("metrics", e), k();
27
+ })), C = r(() => t(g.page.pageDecorations, g.page.pageNumber)), w = r(() => n(g.page.pageDecorations, g.page.pageNumber, g.page.totalPages, g.page.decorationVariables, g.page.decorationValues)), T = r(() => y.value > 1 ? `第 ${g.page.pageNumber} 页正文超出纸张 ${Math.round(y.value)}px,请回模板设计器调整后再指定位置。` : b.value > 1 ? `第 ${g.page.pageNumber} 页正文超出纸张宽度 ${Math.round(b.value)}px,请回模板设计器调整后再指定位置。` : ""), E = r(() => g.page.errors[0] || T.value), D = r(() => g.page.errors.length ? "模板已安全降级展示" : "该页签署位置不可信");
28
+ function O(e) {
29
+ v.value = e.contentHeight, y.value = e.overflowHeight, b.value = e.overflowWidth, _("metrics", e), A();
30
30
  }
31
- function O(e, t) {
32
- if (b.value = e, e === "error") {
31
+ function k(e, t) {
32
+ if (x.value = e, e === "error") {
33
33
  _("status", e, t);
34
34
  return;
35
35
  }
36
- k();
36
+ A();
37
37
  }
38
- function k() {
39
- if (b.value !== "ready") {
40
- _("status", b.value);
38
+ function A() {
39
+ if (x.value !== "ready") {
40
+ _("status", x.value);
41
41
  return;
42
42
  }
43
- if (y.value > 1) {
44
- _("status", "error", w.value);
43
+ if (y.value > 1 || b.value > 1) {
44
+ _("status", "error", T.value);
45
45
  return;
46
46
  }
47
47
  _("status", "ready");
@@ -52,20 +52,20 @@ var p = [
52
52
  "data-template-page-index": c.page.pageIndex,
53
53
  "data-page-width": c.page.displayWidth,
54
54
  "data-page-height": c.page.displayHeight,
55
- style: l(x.value)
55
+ style: l(S.value)
56
56
  }, [s(e, {
57
57
  "page-id": c.page.pageId,
58
58
  width: c.page.displayWidth,
59
59
  height: c.page.displayHeight,
60
60
  "padding-top": c.page.paddingTop,
61
61
  "padding-bottom": c.page.paddingBottom,
62
- "class-names": S.value,
63
- "decorations-html": C.value,
62
+ "class-names": C.value,
63
+ "decorations-html": w.value,
64
64
  "content-html": c.page.contentHtml,
65
65
  "font-base-url": c.fontBaseUrl,
66
66
  title: `第 ${c.page.pageNumber} 页合同签署底图`,
67
- onMetrics: D,
68
- onStatus: O
67
+ onMetrics: O,
68
+ onStatus: k
69
69
  }, null, 8, [
70
70
  "page-id",
71
71
  "width",
@@ -77,7 +77,7 @@ var p = [
77
77
  "content-html",
78
78
  "font-base-url",
79
79
  "title"
80
- ]), T.value ? (u(), a("div", m, [o("strong", null, f(E.value), 1), o("span", null, f(T.value), 1)])) : i("", !0)], 12, p));
80
+ ]), E.value ? (u(), a("div", m, [o("strong", null, f(D.value), 1), o("span", null, f(E.value), 1)])) : i("", !0)], 12, p));
81
81
  }
82
82
  });
83
83
  //#endregion
@@ -1,68 +1,81 @@
1
- import { toContractSigningRulePageSize as e } from "./constants.mjs";
2
- import { CONTRACT_PAGE_BASE_PADDING as t, getPageDecorationSafePadding as n, hasEnabledPageFooter as r, hasEnabledPageHeader as i, normalizePageDecorations as a } from "../../pro-contract-template-designer/src/utils/page-decorations.mjs";
3
- import { buildTemplateRenderPages as o, normalizeRenderValues as s, validateTemplateRenderStructure as c } from "../../pro-contract-template-designer/src/utils/template-renderer.mjs";
1
+ import { resolveContractPagePadding as e } from "../../../contract-print-css/index.mjs";
2
+ import { toContractSigningRulePageSize as t } from "./constants.mjs";
3
+ import { normalizePageDecorations as n } from "../../pro-contract-template-designer/src/utils/page-decorations.mjs";
4
+ import { buildTemplateRenderPages as r, normalizeRenderValues as i, validateTemplateRenderStructure as a } from "../../pro-contract-template-designer/src/utils/template-renderer.mjs";
5
+ import { createContractTemplateLayoutPage as o } from "../../pro-contract-template-designer/src/utils/contract-layout-check.mjs";
4
6
  //#region src/components/contract-signing-location/src/template-source.ts
5
- function l(e) {
7
+ function s(e) {
6
8
  return !!(e && typeof e == "object" && e.type === "template");
7
9
  }
8
- function u(e) {
9
- return l(e?.source);
10
+ function c(e) {
11
+ return s(e?.source);
10
12
  }
11
- function d(t) {
12
- if (!l(t) || !g(t.template)) return [];
13
+ function l(a) {
14
+ if (!s(a) || !m(a.template)) return [];
13
15
  try {
14
- let n = t.template, r = Array.isArray(n.pages) ? n.pages : [], i = s(n, t.values), a = h(n), c = r.length;
15
- return r.flatMap((t, r) => {
16
- let s = o({
17
- ...n,
18
- pages: [t]
19
- }, i, {
16
+ let o = a.template, s = Array.isArray(o.pages) ? o.pages : [], c = i(o, a.values), l = p(o), u = s.length;
17
+ return s.flatMap((i, a) => {
18
+ let s = r({
19
+ ...o,
20
+ pages: [i]
21
+ }, c, {
20
22
  readonly: !0,
21
23
  disabled: !0,
22
24
  mode: "display"
23
25
  })[0];
24
26
  if (!s) return [];
25
- let l = _(t?.pageSize, n.pageSize, s), u = e(l), d = r + 1, p = f(s.pageDecorations, d);
27
+ let d = h(i?.pageSize, o.pageSize, s), f = t(d), p = a + 1, m = e(n(s.pageDecorations), p);
26
28
  return [{
27
- pageIndex: r,
29
+ pageIndex: a,
28
30
  pageId: s.id,
29
31
  title: s.title,
30
- width: u.width || l.width,
31
- height: u.height || l.height,
32
- displayWidth: l.width,
33
- displayHeight: l.height,
32
+ width: f.width || d.width,
33
+ height: f.height || d.height,
34
+ displayWidth: d.width,
35
+ displayHeight: d.height,
34
36
  contentHtml: s.contentHtml,
35
37
  ...s.pageDecorations ? { pageDecorations: s.pageDecorations } : {},
36
38
  decorationVariables: s.decorationVariables,
37
39
  decorationValues: s.decorationValues,
38
- pageNumber: d,
39
- totalPages: c,
40
- paddingTop: p.top,
41
- paddingBottom: p.bottom,
42
- errors: a.filter((e) => !e.pageId || e.pageId === s.id).map((e) => e.message)
40
+ pageNumber: p,
41
+ totalPages: u,
42
+ paddingTop: m.top,
43
+ paddingBottom: m.bottom,
44
+ errors: l.filter((e) => !e.pageId || e.pageId === s.id).map((e) => e.message)
43
45
  }];
44
46
  });
45
47
  } catch {
46
48
  return [];
47
49
  }
48
50
  }
49
- function f(e, o) {
50
- let s = a(e);
51
- return {
52
- top: i(s, o) ? n(s.header) : t.top,
53
- bottom: r(s, o) ? n(s.footer) : t.bottom
54
- };
51
+ function u(e, t) {
52
+ return l(t).map((t) => o({
53
+ id: t.pageId,
54
+ title: t.title,
55
+ format: "Custom",
56
+ width: t.displayWidth,
57
+ height: t.displayHeight,
58
+ contentHtml: t.contentHtml,
59
+ ...t.pageDecorations ? { pageDecorations: t.pageDecorations } : {},
60
+ decorationVariables: t.decorationVariables,
61
+ decorationValues: t.decorationValues
62
+ }, {
63
+ fileId: e,
64
+ pageIndex: t.pageIndex,
65
+ pageNumber: t.pageNumber,
66
+ totalPages: t.totalPages
67
+ }));
55
68
  }
56
- function p(e) {
57
- if (!l(e.source)) return [];
58
- if (!g(e.source.template)) return [{
69
+ function d(e) {
70
+ if (!s(e.source)) return [];
71
+ if (!m(e.source.template)) return [{
59
72
  code: "CONTRACT_TEMPLATE_MISSING",
60
73
  message: `文件 ${e.fileName || e.fileId} 缺少可渲染的合同模板`,
61
74
  fileId: e.fileId
62
75
  }];
63
76
  try {
64
77
  let t = Array.isArray(e.source.template.pages) ? e.source.template.pages : [];
65
- return h(e.source.template).map((n) => {
78
+ return p(e.source.template).map((n) => {
66
79
  let r = n.pageId ? t.findIndex((e) => e?.id === n.pageId) : -1;
67
80
  return {
68
81
  code: `CONTRACT_${n.code || "TEMPLATE_INVALID"}`,
@@ -80,22 +93,22 @@ function p(e) {
80
93
  }];
81
94
  }
82
95
  }
83
- function m(e) {
84
- return !e || !l(e.source) ? "" : p(e)[0]?.message ?? "";
96
+ function f(e) {
97
+ return !e || !s(e.source) ? "" : d(e)[0]?.message ?? "";
85
98
  }
86
- function h(e) {
87
- return c(e);
99
+ function p(e) {
100
+ return a(e);
88
101
  }
89
- function g(e) {
102
+ function m(e) {
90
103
  return !!(e && typeof e == "object");
91
104
  }
92
- function _(e, t, n) {
93
- return y(e) || y(t) || {
94
- width: b(e?.width, b(t?.width, n.width)),
95
- height: b(e?.height, b(t?.height, n.height))
105
+ function h(e, t, n) {
106
+ return _(e) || _(t) || {
107
+ width: v(e?.width, v(t?.width, n.width)),
108
+ height: v(e?.height, v(t?.height, n.height))
96
109
  };
97
110
  }
98
- var v = [
111
+ var g = [
99
112
  {
100
113
  pointWidth: 595.5,
101
114
  pointHeight: 842.25,
@@ -145,18 +158,18 @@ var v = [
145
158
  cssHeight: 1344
146
159
  }
147
160
  ];
148
- function y(e) {
161
+ function _(e) {
149
162
  let t = Number(e?.width), n = Number(e?.height);
150
163
  if (!Number.isFinite(t) || !Number.isFinite(n) || t <= 0 || n <= 0) return;
151
- let r = v.find((e) => Math.abs(t - e.pointWidth) <= 1.1 && Math.abs(n - e.pointHeight) <= 1.1);
164
+ let r = g.find((e) => Math.abs(t - e.pointWidth) <= 1.1 && Math.abs(n - e.pointHeight) <= 1.1);
152
165
  return r ? {
153
166
  width: r.cssWidth,
154
167
  height: r.cssHeight
155
168
  } : void 0;
156
169
  }
157
- function b(e, t) {
170
+ function v(e, t) {
158
171
  let n = Number(e);
159
172
  return Number.isFinite(n) && n > 0 ? n : t;
160
173
  }
161
174
  //#endregion
162
- export { d as buildContractSigningTemplateRenderPages, m as getContractSigningTemplateDisplayError, u as isContractSigningTemplateFile, l as isContractSigningTemplateSource, p as validateContractSigningTemplateFile };
175
+ export { u as buildContractSigningLayoutPages, l as buildContractSigningTemplateRenderPages, f as getContractSigningTemplateDisplayError, c as isContractSigningTemplateFile, s as isContractSigningTemplateSource, d as validateContractSigningTemplateFile };
@@ -64,6 +64,7 @@ import "./pro-contract-template-designer/src/utils/advanced-controls.mjs";
64
64
  import "./pro-contract-template-designer/src/composables/use-template-designer.mjs";
65
65
  import "./pro-contract-template-designer/src/utils/image-url.mjs";
66
66
  import "./pro-contract-template-designer/src/utils/template-renderer.mjs";
67
+ import "./pro-contract-template-designer/src/utils/contract-layout-check.mjs";
67
68
  import "./contract-signing-location/src/template-source.mjs";
68
69
  import "./contract-signing-location/src/location-rules.mjs";
69
70
  import "./contract-signing-location/src/page-layout.mjs";
@@ -7,6 +7,7 @@ import "./src/utils/advanced-controls.mjs";
7
7
  import "./src/composables/use-template-designer.mjs";
8
8
  import "./src/utils/image-url.mjs";
9
9
  import "./src/utils/template-renderer.mjs";
10
+ import "./src/utils/contract-layout-check.mjs";
10
11
  import "./src/utils/content-image.mjs";
11
12
  import "./src/utils/signing-layout-presets.mjs";
12
13
  import "./src/composables/use-template-draft-cache.mjs";
@@ -1,19 +1,20 @@
1
- import e from "./ContractPrintIframe.mjs";
2
- import { CONTRACT_PAGE_BASE_PADDING as t, buildPageDecorationClassNames as n, buildPageDecorationsHtml as r, getPageDecorationSafePadding as i, hasEnabledPageFooter as a, hasEnabledPageHeader as o, normalizePageDecorations as s } from "./utils/page-decorations.mjs";
3
- import { resolvePageSize as c } from "./composables/use-template-designer.mjs";
4
- import { computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, normalizeStyle as h, openBlock as g, shallowRef as _, toDisplayString as v } from "vue";
1
+ import { resolveContractPagePadding as e } from "../../../contract-print-css/index.mjs";
2
+ import t from "./ContractPrintIframe.mjs";
3
+ import { buildPageDecorationClassNames as n, buildPageDecorationsHtml as r, normalizePageDecorations as i } from "./utils/page-decorations.mjs";
4
+ import { resolvePageSize as a } from "./composables/use-template-designer.mjs";
5
+ import { computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, normalizeStyle as f, openBlock as p, shallowRef as m, toDisplayString as h } from "vue";
5
6
  //#region src/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue?vue&type=script&setup=true&lang.ts
6
- var y = { class: "gd-contract-template-designer__preview-page-shell" }, b = [
7
+ var g = { class: "gd-contract-template-designer__preview-page-shell" }, _ = [
7
8
  "data-page-id",
8
9
  "data-page-format",
9
10
  "data-page-label",
10
11
  "data-page-width",
11
12
  "data-page-height"
12
- ], x = {
13
+ ], v = {
13
14
  key: 0,
14
15
  class: "gd-contract-template-designer__preview-font-error",
15
16
  role: "alert"
16
- }, S = /* @__PURE__ */ m({
17
+ }, y = /* @__PURE__ */ d({
17
18
  name: "ContractTemplatePreviewPage",
18
19
  __name: "ContractTemplatePreviewPage",
19
20
  props: {
@@ -26,41 +27,35 @@ var y = { class: "gd-contract-template-designer__preview-page-shell" }, b = [
26
27
  variables: {},
27
28
  fontBaseUrl: {}
28
29
  },
29
- setup(m) {
30
- let S = m, C = l(() => c(S.page.pageSize, S.fallbackPageSize)), w = l(() => {
31
- let e = s(S.pageDecorations);
32
- return {
33
- top: o(e, S.pageNumber) ? i(e.header) : t.top,
34
- bottom: a(e, S.pageNumber) ? i(e.footer) : t.bottom
35
- };
36
- }), T = l(() => ({
37
- width: `${C.value.width}px`,
38
- height: `${C.value.height}px`
39
- })), E = l(() => n(S.pageDecorations, S.pageNumber)), D = l(() => r(S.pageDecorations, S.pageNumber, S.totalPages, S.variables)), O = _("");
40
- function k(e, t) {
41
- O.value = e === "error" ? t || "合同排版度量校验失败" : "";
30
+ setup(d) {
31
+ let y = d, b = o(() => a(y.page.pageSize, y.fallbackPageSize)), x = o(() => e(i(y.pageDecorations), y.pageNumber)), S = o(() => ({
32
+ width: `${b.value.width}px`,
33
+ height: `${b.value.height}px`
34
+ })), C = o(() => n(y.pageDecorations, y.pageNumber)), w = o(() => r(y.pageDecorations, y.pageNumber, y.totalPages, y.variables)), T = m("");
35
+ function E(e, t) {
36
+ T.value = e === "error" ? t || "合同排版度量校验失败" : "";
42
37
  }
43
- return (t, n) => (g(), d("article", y, [f("section", {
38
+ return (e, n) => (p(), c("article", g, [l("section", {
44
39
  class: "gd-contract-template-designer__preview-page",
45
- "data-page-id": m.page.id,
46
- "data-page-format": C.value.format ?? "Custom",
47
- "data-page-label": C.value.label ?? C.value.format ?? "自定义",
48
- "data-page-width": C.value.width,
49
- "data-page-height": C.value.height,
50
- style: h(T.value)
51
- }, [p(e, {
52
- "page-id": m.page.id,
53
- "page-format": C.value.format,
54
- width: C.value.width,
55
- height: C.value.height,
56
- "padding-top": w.value.top,
57
- "padding-bottom": w.value.bottom,
58
- "class-names": E.value,
59
- "decorations-html": D.value,
60
- "content-html": m.contentHtml,
61
- "font-base-url": m.fontBaseUrl,
62
- title: `第 ${m.pageNumber} 页合同预览`,
63
- onStatus: k
40
+ "data-page-id": d.page.id,
41
+ "data-page-format": b.value.format ?? "Custom",
42
+ "data-page-label": b.value.label ?? b.value.format ?? "自定义",
43
+ "data-page-width": b.value.width,
44
+ "data-page-height": b.value.height,
45
+ style: f(S.value)
46
+ }, [u(t, {
47
+ "page-id": d.page.id,
48
+ "page-format": b.value.format,
49
+ width: b.value.width,
50
+ height: b.value.height,
51
+ "padding-top": x.value.top,
52
+ "padding-bottom": x.value.bottom,
53
+ "class-names": C.value,
54
+ "decorations-html": w.value,
55
+ "content-html": d.contentHtml,
56
+ "font-base-url": d.fontBaseUrl,
57
+ title: `第 ${d.pageNumber} 页合同预览`,
58
+ onStatus: E
64
59
  }, null, 8, [
65
60
  "page-id",
66
61
  "page-format",
@@ -73,8 +68,8 @@ var y = { class: "gd-contract-template-designer__preview-page-shell" }, b = [
73
68
  "content-html",
74
69
  "font-base-url",
75
70
  "title"
76
- ]), O.value ? (g(), d("div", x, v(O.value), 1)) : u("", !0)], 12, b)]));
71
+ ]), T.value ? (p(), c("div", v, h(T.value), 1)) : s("", !0)], 12, _)]));
77
72
  }
78
73
  });
79
74
  //#endregion
80
- export { S as default };
75
+ export { y as default };
@@ -1,20 +1,22 @@
1
- import e from "./ContractPrintIframe.mjs";
2
- import { CONTRACT_PAGE_BASE_PADDING as t, buildPageDecorationClassNames as n, buildPageDecorationsHtml as r, getPageDecorationSafePadding as i, hasEnabledPageFooter as a, hasEnabledPageHeader as o, normalizePageDecorations as s } from "./utils/page-decorations.mjs";
3
- import { computed as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, normalizeStyle as m, openBlock as h, shallowRef as g, toDisplayString as _ } from "vue";
1
+ import { resolveContractPagePadding as e } from "../../../contract-print-css/index.mjs";
2
+ import t from "./ContractPrintIframe.mjs";
3
+ import { buildPageDecorationClassNames as n, buildPageDecorationsHtml as r, normalizePageDecorations as i } from "./utils/page-decorations.mjs";
4
+ import { describeContractTemplateLayoutIssue as a } from "./utils/contract-layout-check.mjs";
5
+ import { computed as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, normalizeStyle as f, openBlock as p, shallowRef as m, toDisplayString as h } from "vue";
4
6
  //#region src/components/pro-contract-template-designer/src/ContractTemplateRendererPage.vue?vue&type=script&setup=true&lang.ts
5
- var v = ["data-render-page-id"], y = {
7
+ var g = ["data-render-page-id"], _ = {
6
8
  key: 0,
7
9
  class: "gd-contract-template-renderer__page-meta"
8
- }, b = [
10
+ }, v = [
9
11
  "data-page-id",
10
12
  "data-page-format",
11
13
  "data-page-width",
12
14
  "data-page-height"
13
- ], x = {
15
+ ], y = {
14
16
  key: 0,
15
17
  class: "gd-contract-template-renderer__font-error",
16
18
  role: "alert"
17
- }, S = /* @__PURE__ */ p({
19
+ }, b = /* @__PURE__ */ d({
18
20
  name: "ContractTemplateRendererPage",
19
21
  __name: "ContractTemplateRendererPage",
20
22
  props: {
@@ -32,57 +34,69 @@ var v = ["data-render-page-id"], y = {
32
34
  "metrics",
33
35
  "interaction"
34
36
  ],
35
- setup(p, { emit: S }) {
36
- let C = p, w = S, T = c(() => ({
37
- width: `${C.page.width * C.zoom}px`,
38
- height: `${C.page.height * C.zoom}px`
39
- })), E = c(() => {
40
- let e = s(C.page.pageDecorations);
41
- return {
42
- top: o(e, C.index + 1) ? i(e.header) : t.top,
43
- bottom: a(e, C.index + 1) ? i(e.footer) : t.bottom
44
- };
45
- }), D = c(() => ({
46
- width: `${C.page.width}px`,
47
- height: `${C.page.height}px`,
48
- transform: `scale(${C.zoom})`
49
- })), O = c(() => n(C.page.pageDecorations, C.index + 1)), k = c(() => r(C.page.pageDecorations, C.index + 1, C.total, C.page.decorationVariables, C.page.decorationValues)), A = g("");
37
+ setup(d, { emit: b }) {
38
+ let x = d, S = b, C = o(() => ({
39
+ width: `${x.page.width * x.zoom}px`,
40
+ height: `${x.page.height * x.zoom}px`
41
+ })), w = o(() => e(i(x.page.pageDecorations), x.index + 1)), T = o(() => ({
42
+ width: `${x.page.width}px`,
43
+ height: `${x.page.height}px`,
44
+ transform: `scale(${x.zoom})`
45
+ })), E = o(() => n(x.page.pageDecorations, x.index + 1)), D = o(() => r(x.page.pageDecorations, x.index + 1, x.total, x.page.decorationVariables, x.page.decorationValues)), O = m(""), k = m(), A = o(() => O.value ? O.value : k.value ? a({
46
+ pageIndex: x.index,
47
+ pageNumber: x.index + 1,
48
+ pageId: x.page.id,
49
+ kind: "overflow",
50
+ overflowHeight: k.value.overflowHeight,
51
+ overflowWidth: k.value.overflowWidth
52
+ })[0] ?? "" : "");
50
53
  function j(e, t) {
51
- A.value = e === "error" ? t || "合同排版度量校验失败" : "", w("status", e, t);
54
+ e === "loading" && (k.value = void 0), O.value = e === "error" ? a({
55
+ pageIndex: x.index,
56
+ pageNumber: x.index + 1,
57
+ pageId: x.page.id,
58
+ kind: "measure-failed",
59
+ overflowHeight: 0,
60
+ overflowWidth: 0,
61
+ error: t
62
+ })[0] ?? "无法确认排版,请稍后重试" : "", S("status", e, t);
52
63
  }
53
- return (t, n) => (h(), u("article", {
64
+ function M(e) {
65
+ k.value = e, S("metrics", e);
66
+ }
67
+ return (e, n) => (p(), c("article", {
54
68
  class: "gd-contract-template-renderer__page-shell",
55
- "data-render-page-id": p.page.id
56
- }, [p.showMeta ? (h(), u("header", y, [
57
- d("strong", null, "第 " + _(p.index + 1) + " / " + _(p.total) + " 页", 1),
58
- d("span", null, _(p.page.title), 1),
59
- d("small", null, _(p.page.format) + " · " + _(p.page.width) + " × " + _(p.page.height) + " px", 1)
60
- ])) : l("", !0), d("div", {
69
+ "data-render-page-id": d.page.id
70
+ }, [d.showMeta ? (p(), c("header", _, [
71
+ l("strong", null, "第 " + h(d.index + 1) + " / " + h(d.total) + " 页", 1),
72
+ l("span", null, h(d.page.title), 1),
73
+ l("small", null, h(d.page.format) + " · " + h(d.page.width) + " × " + h(d.page.height) + " px", 1)
74
+ ])) : s("", !0), l("div", {
61
75
  class: "gd-contract-template-renderer__page-frame",
62
- style: m(T.value)
63
- }, [d("div", {
76
+ style: f(C.value)
77
+ }, [l("div", {
64
78
  class: "gd-contract-template-renderer__print-page",
65
- "data-page-id": p.page.id,
66
- "data-page-format": p.page.format,
67
- "data-page-width": p.page.width,
68
- "data-page-height": p.page.height,
69
- style: m(D.value)
70
- }, [f(e, {
71
- "page-id": p.page.id,
72
- "page-format": p.page.format,
73
- width: p.page.width,
74
- height: p.page.height,
75
- "padding-top": E.value.top,
76
- "padding-bottom": E.value.bottom,
77
- "class-names": O.value,
78
- "decorations-html": k.value,
79
- "content-html": p.page.contentHtml,
80
- "font-base-url": p.fontBaseUrl,
81
- "active-key": p.activeKey,
82
- "scroll-request": p.scrollRequest,
83
- title: `第 ${p.index + 1} 页合同填写内容`,
84
- onInteraction: n[0] ||= (e) => w("interaction", e),
85
- onMetrics: n[1] ||= (e) => w("metrics", e),
79
+ "data-page-id": d.page.id,
80
+ "data-page-format": d.page.format,
81
+ "data-page-width": d.page.width,
82
+ "data-page-height": d.page.height,
83
+ style: f(T.value)
84
+ }, [u(t, {
85
+ "page-id": d.page.id,
86
+ "page-format": d.page.format,
87
+ width: d.page.width,
88
+ height: d.page.height,
89
+ "padding-top": w.value.top,
90
+ "padding-bottom": w.value.bottom,
91
+ "class-names": E.value,
92
+ "decorations-html": D.value,
93
+ "content-html": d.page.contentHtml,
94
+ "font-base-url": d.fontBaseUrl,
95
+ "active-key": d.activeKey,
96
+ "scroll-request": d.scrollRequest,
97
+ title: `第 ${d.index + 1} 页合同填写内容`,
98
+ onInteraction: n[0] ||= (e) => S("interaction", e),
99
+ onMetrics: M,
86
100
  onStatus: j
87
101
  }, null, 8, [
88
102
  "page-id",
@@ -98,8 +112,8 @@ var v = ["data-render-page-id"], y = {
98
112
  "active-key",
99
113
  "scroll-request",
100
114
  "title"
101
- ]), A.value ? (h(), u("div", x, _(A.value), 1)) : l("", !0)], 12, b)], 4)], 8, v));
115
+ ]), A.value ? (p(), c("div", y, h(A.value), 1)) : s("", !0)], 12, v)], 4)], 8, g));
102
116
  }
103
117
  });
104
118
  //#endregion
105
- export { S as default };
119
+ export { b as default };