@guodun/antdv 1.4.3 → 1.4.5

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 (118) hide show
  1. package/dist/es/components/contract-signing-location/src/ContractSigningLocation.vue.mjs +85 -85
  2. package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +1 -1
  3. package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +66 -13
  4. package/dist/es/components/contract-signing-location/src/constants.mjs +27 -17
  5. package/dist/es/components/contract-signing-location/src/location-rules.mjs +2 -2
  6. package/dist/es/components/contract-signing-location/src/template-source.mjs +52 -36
  7. package/dist/es/components/contract-signing-location/style/index.css +1 -1
  8. package/dist/es/components/dept-selector/src/dept.mjs +170 -142
  9. package/dist/es/components/index.mjs +2 -1
  10. package/dist/es/components/pro-contract-template-designer/index.mjs +2 -1
  11. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.mjs +372 -185
  12. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +59 -42
  13. package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +4 -4
  14. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.mjs +218 -85
  15. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.mjs +5 -0
  16. package/dist/es/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.mjs +97 -0
  17. package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +50 -50
  18. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +948 -887
  19. package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.mjs +550 -245
  20. package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +225 -150
  21. package/dist/es/components/pro-contract-template-designer/src/extensions/template-variable.mjs +53 -35
  22. package/dist/es/components/pro-contract-template-designer/src/types.mjs +15 -2
  23. package/dist/es/components/pro-contract-template-designer/src/utils/advanced-controls.mjs +91 -0
  24. package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +17 -17
  25. package/dist/es/components/pro-contract-template-designer/src/utils/signing-placement.mjs +14 -14
  26. package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +168 -137
  27. package/dist/es/components/pro-contract-template-designer/src/utils/template-tool-icons.mjs +23 -16
  28. package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
  29. package/dist/es/components/pro-selector/src/components/org-tree.mjs +130 -89
  30. package/dist/es/components/pro-selector/src/components/user.mjs +34 -26
  31. package/dist/es/components/pro-selector/src/pro-user.mjs +86 -72
  32. package/dist/es/components/pro-selector/src/types.mjs +4 -1
  33. package/dist/es/components/pro-selector/src/utils/orgTree.mjs +5 -2
  34. package/dist/es/components/pro-selector-group/src/compoents/dept-tree.vue.mjs +92 -65
  35. package/dist/es/components/pro-selector-group/src/compoents/dept.vue.mjs +3 -3
  36. package/dist/es/components/pro-selector-group/src/compoents/role.vue.mjs +98 -73
  37. package/dist/es/components/pro-selector-group/src/compoents/select-box.vue.mjs +12 -9
  38. package/dist/es/components/pro-selector-group/src/compoents/user.vue.mjs +101 -72
  39. package/dist/es/components/pro-selector-group/src/hooks/useApi.mjs +39 -22
  40. package/dist/es/components/pro-selector-group/src/index.vue.mjs +105 -83
  41. package/dist/es/components/pro-selector-group/src/utils/index.mjs +36 -0
  42. package/dist/es/components/role-selector/src/role.mjs +134 -120
  43. package/dist/es/index.mjs +50 -49
  44. package/dist/lib/components/contract-signing-location/src/ContractSigningLocation.vue.cjs +1 -1
  45. package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
  46. package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
  47. package/dist/lib/components/contract-signing-location/src/constants.cjs +1 -1
  48. package/dist/lib/components/contract-signing-location/src/location-rules.cjs +1 -1
  49. package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
  50. package/dist/lib/components/contract-signing-location/style/index.css +1 -1
  51. package/dist/lib/components/dept-selector/src/dept.cjs +1 -1
  52. package/dist/lib/components/index.cjs +1 -1
  53. package/dist/lib/components/pro-contract-template-designer/index.cjs +1 -1
  54. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.cjs +2 -1
  55. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
  56. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
  57. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.cjs +1 -1
  58. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.cjs +1 -0
  59. package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.cjs +1 -0
  60. package/dist/lib/components/pro-contract-template-designer/src/DesignerPage.vue.cjs +2 -2
  61. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.cjs +1 -1
  62. package/dist/lib/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.cjs +1 -1
  63. package/dist/lib/components/pro-contract-template-designer/src/composables/use-template-designer.cjs +4 -4
  64. package/dist/lib/components/pro-contract-template-designer/src/extensions/template-variable.cjs +1 -1
  65. package/dist/lib/components/pro-contract-template-designer/src/types.cjs +1 -1
  66. package/dist/lib/components/pro-contract-template-designer/src/utils/advanced-controls.cjs +1 -0
  67. package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
  68. package/dist/lib/components/pro-contract-template-designer/src/utils/signing-placement.cjs +1 -1
  69. package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +3 -3
  70. package/dist/lib/components/pro-contract-template-designer/src/utils/template-tool-icons.cjs +1 -1
  71. package/dist/lib/components/pro-contract-template-designer/style/index.css +1 -1
  72. package/dist/lib/components/pro-selector/src/components/org-tree.cjs +1 -1
  73. package/dist/lib/components/pro-selector/src/components/user.cjs +1 -1
  74. package/dist/lib/components/pro-selector/src/pro-user.cjs +1 -1
  75. package/dist/lib/components/pro-selector/src/types.cjs +1 -1
  76. package/dist/lib/components/pro-selector/src/utils/orgTree.cjs +1 -1
  77. package/dist/lib/components/pro-selector-group/src/compoents/dept-tree.vue.cjs +1 -1
  78. package/dist/lib/components/pro-selector-group/src/compoents/dept.vue.cjs +1 -1
  79. package/dist/lib/components/pro-selector-group/src/compoents/role.vue.cjs +1 -1
  80. package/dist/lib/components/pro-selector-group/src/compoents/select-box.vue.cjs +1 -1
  81. package/dist/lib/components/pro-selector-group/src/compoents/user.vue.cjs +1 -1
  82. package/dist/lib/components/pro-selector-group/src/hooks/useApi.cjs +1 -1
  83. package/dist/lib/components/pro-selector-group/src/index.vue.cjs +1 -1
  84. package/dist/lib/components/pro-selector-group/src/utils/index.cjs +1 -0
  85. package/dist/lib/components/role-selector/src/role.cjs +1 -1
  86. package/dist/lib/index.cjs +1 -1
  87. package/dist/theme/contract-signing-location.css +1 -1
  88. package/dist/theme/dept-selector.css +1 -1
  89. package/dist/theme/icon.css +1 -1
  90. package/dist/theme/index.css +1 -1
  91. package/dist/theme/pro-selector-group.css +1 -1
  92. package/dist/theme/pro-selector.css +1 -1
  93. package/dist/theme/role-selector.css +1 -1
  94. package/dist/types/components/contract-signing-location/src/ContractSigningLocation.vue.d.ts +3 -3
  95. package/dist/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +3 -1
  96. package/dist/types/components/contract-signing-location/src/constants.d.ts +18 -0
  97. package/dist/types/components/contract-signing-location/src/coordinates.d.ts +6 -0
  98. package/dist/types/components/contract-signing-location/src/template-source.d.ts +17 -0
  99. package/dist/types/components/pro-contract-template-designer/index.d.ts +1 -0
  100. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerInspector.vue.d.ts +1 -0
  101. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +3 -0
  102. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateRendererField.vue.d.ts +7 -1
  103. package/dist/types/components/pro-contract-template-designer/src/ContractTemplateVariableDataModal.vue.d.ts +14 -0
  104. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +13 -1
  105. package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateRenderer.vue.d.ts +11 -1
  106. package/dist/types/components/pro-contract-template-designer/src/composables/use-template-designer.d.ts +4 -0
  107. package/dist/types/components/pro-contract-template-designer/src/extensions/template-variable.d.ts +11 -1
  108. package/dist/types/components/pro-contract-template-designer/src/types.d.ts +131 -2
  109. package/dist/types/components/pro-contract-template-designer/src/utils/advanced-controls.d.ts +15 -0
  110. package/dist/types/components/pro-contract-template-designer/src/utils/template-renderer.d.ts +10 -2
  111. package/dist/types/components/pro-selector/index.d.ts +9 -0
  112. package/dist/types/components/pro-selector/src/components/user.d.ts +9 -0
  113. package/dist/types/components/pro-selector/src/types.d.ts +2 -0
  114. package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +4 -1
  115. package/dist/types/components/pro-selector-group/src/compoents/select-box.vue.d.ts +4 -4
  116. package/dist/types/components/pro-selector-group/src/hooks/useApi.d.ts +6 -1
  117. package/dist/types/components/pro-selector-group/src/utils/index.d.ts +8 -0
  118. package/package.json +5 -1
@@ -1,31 +1,56 @@
1
- import { isContractTemplateFieldType as e } from "../types.mjs";
2
- import { canParseHtmlDocument as t, canUseDomHtml as n, collectFromHtmlTags as r, escapeHtmlAttribute as i, escapeHtmlText as a, getHtmlAttribute as o, hasPositivePageSize as s, replaceTemplateVariableSpans as c } from "./html.mjs";
3
- import { resolveTemplateVariablePresentation as l } from "./template-variable-render.mjs";
4
- import { buildPageDecorationClassNames as u, buildPageDecorationsHtml as d, collectPageDecorationVariableKeys as f, normalizePageDecorations as p, validatePageDecorations as m } from "./page-decorations.mjs";
5
- import { CONTRACT_TEMPLATE_RESERVED_VARIABLE_KEYS as h, CONTRACT_TEMPLATE_VARIABLE_KEY_PATTERN as g, DEFAULT_PAGE_SIZE as _, resolvePageSize as v, validateContractTemplateVariableKey as y } from "../composables/use-template-designer.mjs";
6
- import { isSafeContractImageUrl as b } from "./image-url.mjs";
1
+ import { canParseHtmlDocument as e, canUseDomHtml as t, collectFromHtmlTags as n, escapeHtmlAttribute as r, escapeHtmlText as i, getHtmlAttribute as a, hasPositivePageSize as o, replaceTemplateVariableSpans as s } from "./html.mjs";
2
+ import { resolveTemplateVariablePresentation as c } from "./template-variable-render.mjs";
3
+ import { buildPageDecorationClassNames as l, buildPageDecorationsHtml as u, collectPageDecorationVariableKeys as d, normalizePageDecorations as f, validatePageDecorations as p } from "./page-decorations.mjs";
4
+ import { isContractTemplateFieldType as m } from "../types.mjs";
5
+ import { formatContractTemplateRenderValue as h, isContractTemplateSelectionValue as g } from "./advanced-controls.mjs";
6
+ import { CONTRACT_TEMPLATE_RESERVED_VARIABLE_KEYS as _, CONTRACT_TEMPLATE_VARIABLE_KEY_PATTERN as v, DEFAULT_PAGE_SIZE as y, resolvePageSize as b, validateContractTemplateVariableKey as x } from "../composables/use-template-designer.mjs";
7
+ import { isSafeContractImageUrl as S } from "./image-url.mjs";
7
8
  //#region src/components/pro-contract-template-designer/src/utils/template-renderer.ts
8
- var x = new Set([
9
+ function C(e) {
10
+ let t = Array.isArray(e?.variables) ? e.variables : [], n = t.map((e) => w(e)), r = {};
11
+ return t.forEach((e) => {
12
+ let t = typeof e?.key == "string" ? e.key : "";
13
+ if (t) {
14
+ if (e.type === "checkbox") {
15
+ r[t] = !1;
16
+ return;
17
+ }
18
+ if (e.type === "number") {
19
+ let n = typeof e.defaultValue == "string" ? e.defaultValue.trim().length > 0 : e.defaultValue !== void 0, i = Number(e.defaultValue);
20
+ r[t] = n && Number.isFinite(i) ? i : "";
21
+ return;
22
+ }
23
+ r[t] = e.defaultValue ?? "";
24
+ }
25
+ }), {
26
+ values: r,
27
+ variables: n
28
+ };
29
+ }
30
+ function w(e) {
31
+ return JSON.parse(JSON.stringify(e));
32
+ }
33
+ var T = new Set([
9
34
  "action",
10
35
  "formaction",
11
36
  "href",
12
37
  "src",
13
38
  "xlink:href"
14
- ]), S = /<[^>]+data-template-variable=["']true["'][^>]*>/gi;
15
- function C(e) {
39
+ ]), E = /<[^>]+data-template-variable=["']true["'][^>]*>/gi;
40
+ function D(e) {
16
41
  let t = {};
17
42
  return (Array.isArray(e?.variables) ? e.variables : []).forEach((e) => {
18
- e?.key && (t[e.key] = I(e));
43
+ e?.key && (t[e.key] = B(e));
19
44
  }), t;
20
45
  }
21
- function w(e, t) {
46
+ function O(e, t) {
22
47
  return {
23
- ...C(e),
48
+ ...D(e),
24
49
  ...t ?? {}
25
50
  };
26
51
  }
27
- function T(e, t) {
28
- let n = D(e);
52
+ function k(e, t) {
53
+ let n = j(e);
29
54
  if (!e) return n;
30
55
  let r = Array.isArray(e.variables) ? e.variables : [], i = new Set(r.map((e) => e?.key).filter(Boolean));
31
56
  return Object.keys(t).forEach((e) => {
@@ -39,7 +64,7 @@ function T(e, t) {
39
64
  }), r.forEach((e) => {
40
65
  if (!e?.key) return;
41
66
  let r = t[e.key];
42
- if (e.required && A(r)) {
67
+ if (e.required && P(r)) {
43
68
  n.push({
44
69
  type: "variable",
45
70
  id: e.id,
@@ -49,7 +74,7 @@ function T(e, t) {
49
74
  });
50
75
  return;
51
76
  }
52
- A(r) || (e.type === "number" && (typeof r != "number" || !Number.isFinite(r)) && n.push({
77
+ P(r) || (e.type === "number" && (typeof r != "number" || !Number.isFinite(r)) && n.push({
53
78
  type: "variable",
54
79
  id: e.id,
55
80
  variableKey: e.key,
@@ -61,111 +86,117 @@ function T(e, t) {
61
86
  variableKey: e.key,
62
87
  message: `${e.label || e.key} 不是合法复选值`,
63
88
  code: "VARIABLE_TYPE_INVALID"
64
- }), e.type === "date" && !K(r) && n.push({
89
+ }), e.type === "date" && !X(r) && n.push({
65
90
  type: "variable",
66
91
  id: e.id,
67
92
  variableKey: e.key,
68
93
  message: `${e.label || e.key} 不是合法日期`,
69
94
  code: "VARIABLE_TYPE_INVALID"
70
- }), e.type === "image" && !b(String(r)) && n.push({
95
+ }), e.type === "image" && !S(String(r)) && n.push({
71
96
  type: "security",
72
97
  id: e.id,
73
98
  variableKey: e.key,
74
99
  message: `${e.label || e.key} 不是安全的图片地址`,
75
100
  code: "IMAGE_URL_UNSAFE"
76
- }));
101
+ }), (e.type === "select" || e.type === "radio" || e.type === "user-selector" || e.type === "dept-selector" || e.type === "role-selector" || e.type === "org-selector") && r !== void 0 && ((Array.isArray(r) ? r.every(g) : g(r)) || n.push({
102
+ type: "variable",
103
+ id: e.id,
104
+ variableKey: e.key,
105
+ message: `${e.label || e.key} 不是合法选择值`,
106
+ code: "VARIABLE_SELECTION_INVALID"
107
+ })));
77
108
  }), n;
78
109
  }
79
- function E(e, t, n) {
80
- return n ? T(e, t) : D(e);
110
+ function A(e, t, n) {
111
+ return n ? k(e, t) : j(e);
81
112
  }
82
- function D(t) {
83
- if (!t) return [{
113
+ function j(e) {
114
+ if (!e) return [{
84
115
  type: "page",
85
116
  id: "template",
86
117
  message: "缺少可渲染的合同模板",
87
118
  code: "TEMPLATE_MISSING"
88
119
  }];
89
- let n = [], r = Array.isArray(t.pages) ? t.pages : [], i = Array.isArray(t.variables) ? t.variables : [];
90
- (!Array.isArray(t.pages) || r.length === 0) && n.push({
120
+ let t = [], n = Array.isArray(e.pages) ? e.pages : [], r = Array.isArray(e.variables) ? e.variables : [];
121
+ (!Array.isArray(e.pages) || n.length === 0) && t.push({
91
122
  type: "page",
92
123
  id: "template-pages",
93
124
  message: "模板至少需要一个合法页面",
94
125
  code: "TEMPLATE_PAGES_INVALID"
95
- }), Array.isArray(t.variables) || n.push({
126
+ }), Array.isArray(e.variables) || t.push({
96
127
  type: "variable",
97
128
  id: "template-variables",
98
129
  message: "模板变量列表格式无效",
99
130
  code: "TEMPLATE_VARIABLES_INVALID"
100
- }), s(t.pageSize) || n.push({
131
+ }), o(e.pageSize) || t.push({
101
132
  type: "page",
102
133
  id: "template-page-size",
103
134
  message: "模板默认页面尺寸无效,已回退为安全默认尺寸",
104
135
  code: "TEMPLATE_PAGE_SIZE_INVALID"
105
136
  });
106
- let a = /* @__PURE__ */ new Map();
107
- i.forEach((t, r) => {
108
- if (!t || typeof t.key != "string" || !t.key.trim()) {
109
- n.push({
137
+ let i = /* @__PURE__ */ new Map();
138
+ r.forEach((e, n) => {
139
+ if (!e || typeof e.key != "string" || !e.key.trim()) {
140
+ t.push({
110
141
  type: "variable",
111
- id: t?.id || `variable-${r}`,
112
- message: `第 ${r + 1} 个变量缺少有效 key`,
142
+ id: e?.id || `variable-${n}`,
143
+ message: `第 ${n + 1} 个变量缺少有效 key`,
113
144
  code: "VARIABLE_KEY_MISSING"
114
145
  });
115
146
  return;
116
147
  }
117
- let o = t.key.trim(), s = i.some((e) => e?.id !== t.id && typeof e?.key == "string" && e.key.trim() === o), c = y(t.key, i, t.id), l = !g.test(o) || h.has(o);
118
- c && (l || !s || t.key !== o) && n.push({
148
+ let a = e.key.trim(), o = r.some((t) => t?.id !== e.id && typeof t?.key == "string" && t.key.trim() === a), s = x(e.key, r, e.id), c = !v.test(a) || _.has(a);
149
+ s && (c || !o || e.key !== a) && t.push({
119
150
  type: "variable",
120
- id: t.id || `variable-${r}`,
121
- variableKey: t.key,
122
- message: `${t.label || t.key}:${c}`,
151
+ id: e.id || `variable-${n}`,
152
+ variableKey: e.key,
153
+ message: `${e.label || e.key}:${s}`,
123
154
  code: "VARIABLE_KEY_INVALID"
124
- }), a.set(o, (a.get(o) ?? 0) + 1), e(t.type ?? "text") || n.push({
155
+ }), i.set(a, (i.get(a) ?? 0) + 1), m(e.type ?? "text") || t.push({
125
156
  type: "variable",
126
- id: t.id,
127
- variableKey: t.key,
128
- message: `${t.label || t.key} 不是正文填写变量`,
157
+ id: e.id,
158
+ variableKey: e.key,
159
+ message: `${e.label || e.key} 不是正文填写变量`,
129
160
  code: "VARIABLE_TYPE_UNSUPPORTED"
130
161
  });
131
- }), a.forEach((e, t) => {
132
- e > 1 && n.push({
162
+ }), i.forEach((e, n) => {
163
+ e > 1 && t.push({
133
164
  type: "variable",
134
- id: t,
135
- variableKey: t,
136
- message: `变量 key ${t} 重复`,
165
+ id: n,
166
+ variableKey: n,
167
+ message: `变量 key ${n} 重复`,
137
168
  code: "VARIABLE_KEY_DUPLICATED"
138
169
  });
139
170
  });
140
- let o = /* @__PURE__ */ new Set();
141
- r.forEach((e, t) => {
171
+ let a = /* @__PURE__ */ new Set();
172
+ n.forEach((e, n) => {
142
173
  if (!e || typeof e.id != "string" || !e.id.trim() || typeof e.contentHtml != "string") {
143
- n.push({
174
+ t.push({
144
175
  type: "page",
145
- id: e?.id || `page-${t}`,
176
+ id: e?.id || `page-${n}`,
146
177
  pageId: e?.id,
147
- message: `第 ${t + 1} 页结构无效,已跳过渲染`,
178
+ message: `第 ${n + 1} 页结构无效,已跳过渲染`,
148
179
  code: "PAGE_INVALID"
149
180
  });
150
181
  return;
151
182
  }
152
- e.pageSize !== void 0 && !s(e.pageSize) && n.push({
183
+ e.pageSize !== void 0 && !o(e.pageSize) && t.push({
153
184
  type: "page",
154
185
  id: `${e.id}-page-size`,
155
186
  pageId: e.id,
156
- message: `${e.title || `第 ${t + 1} 页`}:页面尺寸无效,已回退为安全尺寸`,
187
+ message: `${e.title || `第 ${n + 1} 页`}:页面尺寸无效,已回退为安全尺寸`,
157
188
  code: "PAGE_SIZE_INVALID"
158
- }), V(e.contentHtml).forEach((e) => o.add(e)), H(e.contentHtml).forEach((r, i) => {
159
- n.push({
189
+ }), G(e.contentHtml).forEach((e) => a.add(e)), K(e.contentHtml).forEach((r, i) => {
190
+ t.push({
160
191
  type: "security",
161
192
  id: `${e.id}-security-${i}`,
162
193
  pageId: e.id,
163
- message: `${e.title || `第 ${t + 1} 页`}:${r}`,
194
+ message: `${e.title || `第 ${n + 1} 页`}:${r}`,
164
195
  code: "HTML_UNSAFE"
165
196
  });
166
197
  });
167
- }), o.forEach((e) => {
168
- a.has(e) || n.push({
198
+ }), a.forEach((e) => {
199
+ i.has(e) || t.push({
169
200
  type: "variable",
170
201
  id: e,
171
202
  variableKey: e,
@@ -173,70 +204,70 @@ function D(t) {
173
204
  code: "VARIABLE_CONFIG_MISSING"
174
205
  });
175
206
  });
176
- let c = f(t.pageDecorations);
177
- return a.forEach((e, t) => {
178
- !o.has(t) && !c.has(t) && n.push({
207
+ let s = d(e.pageDecorations);
208
+ return i.forEach((e, n) => {
209
+ !a.has(n) && !s.has(n) && t.push({
179
210
  type: "variable",
180
- id: t,
181
- variableKey: t,
182
- message: `变量 ${t} 缺少正文节点`,
211
+ id: n,
212
+ variableKey: n,
213
+ message: `变量 ${n} 缺少正文节点`,
183
214
  code: "VARIABLE_NODE_MISSING"
184
215
  });
185
- }), n.push(...m(t.pageDecorations, i)), n;
216
+ }), t.push(...p(e.pageDecorations, r)), t;
186
217
  }
187
- function O(e, t, n = {}) {
218
+ function M(e, t, n = {}) {
188
219
  if (!e || !Array.isArray(e.pages)) return [];
189
- let r = Array.isArray(e.variables) ? e.variables : [], i = new Map(r.filter((e) => e?.key).map((e) => [e.key, e])), a = s(e.pageSize) ? e.pageSize : _;
220
+ let r = Array.isArray(e.variables) ? e.variables : [], i = new Map(r.filter((e) => e?.key).map((e) => [e.key, e])), a = o(e.pageSize) ? e.pageSize : y;
190
221
  return e.pages.flatMap((o) => {
191
222
  if (!o || typeof o.id != "string" || !o.id.trim() || typeof o.contentHtml != "string") return [];
192
- let s = v(o.pageSize, a);
223
+ let s = b(o.pageSize, a);
193
224
  return [{
194
225
  id: o.id,
195
226
  title: o.title || "未命名页面",
196
227
  format: s.format ?? "Custom",
197
228
  width: s.width,
198
229
  height: s.height,
199
- contentHtml: j(o.contentHtml, i, t, n),
200
- ...e.pageDecorations ? { pageDecorations: p(e.pageDecorations) } : {},
230
+ contentHtml: F(o.contentHtml, i, t, n),
231
+ ...e.pageDecorations ? { pageDecorations: f(e.pageDecorations) } : {},
201
232
  decorationVariables: r,
202
233
  decorationValues: t
203
234
  }];
204
235
  });
205
236
  }
206
- function k(e, t, n = {}) {
207
- return O(e, t, n).map((e, t, n) => {
208
- let r = d(e.pageDecorations, t + 1, n.length, e.decorationVariables, e.decorationValues);
209
- return `<section class="${u(e.pageDecorations, t + 1)}" data-page-id="${i(e.id)}" data-page-format="${i(e.format)}" data-page-width="${e.width}" data-page-height="${e.height}" style="width:${e.width}px;min-height:${e.height}px">${r}<div class="gd-contract-template-page__content">${e.contentHtml}</div></section>`;
237
+ function N(e, t, n = {}) {
238
+ return M(e, t, n).map((e, t, n) => {
239
+ let i = u(e.pageDecorations, t + 1, n.length, e.decorationVariables, e.decorationValues);
240
+ return `<section class="${l(e.pageDecorations, t + 1)}" data-page-id="${r(e.id)}" data-page-format="${r(e.format)}" data-page-width="${e.width}" data-page-height="${e.height}" style="width:${e.width}px;min-height:${e.height}px">${i}<div class="gd-contract-template-page__content">${e.contentHtml}</div></section>`;
210
241
  }).join("\n");
211
242
  }
212
- function A(e) {
213
- return e == null || e === "";
243
+ function P(e) {
244
+ return e == null || e === "" || Array.isArray(e) && e.length === 0;
214
245
  }
215
- function j(e, t, r, i) {
246
+ function F(e, n, r, i) {
216
247
  if (!e) return e;
217
- let a = B(e);
218
- if (n()) {
219
- let e = new DOMParser().parseFromString(a, "text/html");
248
+ let o = W(e);
249
+ if (t()) {
250
+ let e = new DOMParser().parseFromString(o, "text/html");
220
251
  return e.querySelectorAll("[data-template-variable]").forEach((e) => {
221
- M(e, t, r, i);
252
+ I(e, n, r, i);
222
253
  }), e.body.innerHTML;
223
254
  }
224
- return c(a, (e, n) => {
225
- let a = o(n, "data-key");
226
- return a ? N(t.get(a), a, r[a], i) : e;
255
+ return s(o, (e, t) => {
256
+ let o = a(t, "data-key");
257
+ return o ? L(n.get(o), o, r[o], i) : e;
227
258
  });
228
259
  }
229
- function M(e, t, n, r) {
260
+ function I(e, t, n, r) {
230
261
  let i = e.dataset.key || "", a = t.get(i);
231
262
  if (!i || !a) return;
232
- let o = new DOMParser().parseFromString(N(a, i, n[i], r), "text/html").body.firstElementChild;
263
+ let o = new DOMParser().parseFromString(L(a, i, n[i], r), "text/html").body.firstElementChild;
233
264
  o && e.replaceWith(o);
234
265
  }
235
- function N(e, t, n, r) {
236
- return r.mode === "display" ? P(e, t, n, r) : F(e, t, n, r);
266
+ function L(e, t, n, r) {
267
+ return r.mode === "display" ? R(e, t, n, r) : z(e, t, n, r);
237
268
  }
238
- function P(e, t, n, r) {
239
- let o = e?.type ?? "text", s = n ?? I(e), c = o === "image" && !A(s) && !b(String(s)) ? "" : s, u = R(c), d = l({
269
+ function R(e, t, n, a) {
270
+ let o = e?.type ?? "text", s = n ?? B(e), l = o === "image" && !P(s) && !S(String(s)) ? "" : s, u = H(l), d = c({
240
271
  type: o,
241
272
  width: e?.width,
242
273
  height: e?.height,
@@ -252,31 +283,31 @@ function P(e, t, n, r) {
252
283
  lineHeight: e?.lineHeight,
253
284
  style: e?.style
254
285
  }), f = d.displayText || e?.placeholder || e?.label || t, p = [
255
- `class="${i([
286
+ `class="${r([
256
287
  "gd-contract-template-renderer__control",
257
288
  "gd-contract-template-renderer__preview-control",
258
289
  ...d.classes,
259
- r.activeKey === t ? "is-active" : "",
260
- A(c) ? "is-empty" : ""
290
+ a.activeKey === t ? "is-active" : "",
291
+ P(l) ? "is-empty" : ""
261
292
  ].filter(Boolean).join(" "))}"`,
262
- `style="${i(d.styleText)}"`,
293
+ `style="${r(d.styleText)}"`,
263
294
  "data-contract-render-wrapper=\"true\"",
264
295
  "data-contract-render-preview=\"true\"",
265
- `data-key="${i(t)}"`,
266
- `data-variable-type="${i(o)}"`,
267
- `aria-label="${i(e?.label || t)}"`,
268
- r.disabled ? "" : "role=\"button\"",
269
- r.disabled ? "" : "tabindex=\"0\""
296
+ `data-key="${r(t)}"`,
297
+ `data-variable-type="${r(o)}"`,
298
+ `aria-label="${r(e?.label || t)}"`,
299
+ a.disabled ? "" : "role=\"button\"",
300
+ a.disabled ? "" : "tabindex=\"0\""
270
301
  ].filter(Boolean).join(" ");
271
- return o === "checkbox" ? `<span ${p}><span class="gd-contract-template-renderer__checkbox-mark" aria-hidden="true">${z(c) ? "✓" : ""}</span>${a(f)}</span>` : o === "image" && !A(c) ? `<span ${p}></span>` : `<span ${p}>${a(f)}</span>`;
302
+ return o === "checkbox" ? `<span ${p}><span class="gd-contract-template-renderer__checkbox-mark" aria-hidden="true">${U(l) ? "✓" : ""}</span>${i(f)}</span>` : o === "image" && !P(l) ? `<span ${p}></span>` : `<span ${p}>${i(f)}</span>`;
272
303
  }
273
- function F(e, t, n, r) {
274
- let o = e?.type ?? "text", s = !!r.readonly, c = L(n ?? I(e)), u = l({
304
+ function z(e, t, n, a) {
305
+ let o = e?.type ?? "text", s = !!a.readonly, l = V(n ?? B(e)), u = c({
275
306
  type: o,
276
307
  width: e?.width,
277
308
  height: e?.height,
278
309
  placeholder: e?.placeholder ?? "",
279
- defaultValue: s ? c : "",
310
+ defaultValue: s ? l : "",
280
311
  format: e?.format ?? "",
281
312
  precision: e?.precision,
282
313
  useGrouping: e?.useGrouping,
@@ -286,57 +317,57 @@ function F(e, t, n, r) {
286
317
  rows: e?.rows,
287
318
  lineHeight: e?.lineHeight,
288
319
  style: e?.style
289
- }), d = r.disabled || s, f = [
320
+ }), d = a.disabled || s, f = [
290
321
  "data-contract-render-control=\"true\"",
291
- `data-key="${i(t)}"`,
292
- `data-variable-type="${i(o)}"`,
293
- `aria-label="${i(e?.label || t)}"`,
322
+ `data-key="${r(t)}"`,
323
+ `data-variable-type="${r(o)}"`,
324
+ `aria-label="${r(e?.label || t)}"`,
294
325
  d ? "disabled" : "",
295
326
  s ? "readonly" : ""
296
- ].filter(Boolean).join(" "), p = `style="${i(u.styleText)}"`, m = i(["gd-contract-template-renderer__control", ...u.classes].join(" "));
297
- return o === "checkbox" ? `<label class="${m}" ${p} data-contract-render-wrapper="true" data-key="${i(t)}"><input type="checkbox" ${f} ${z(c) ? "checked" : ""}>${a(e?.checkedText || e?.label || t)}</label>` : s ? `<span class="${m}" ${p} data-contract-render-wrapper="true" data-key="${i(t)}">${a(u.displayText || c)}</span>` : o === "number" ? `<input class="${m}" ${p} type="number" ${f} value="${i(c)}" placeholder="${i(e?.placeholder || "")}">` : o === "date" ? `<input class="${m}" ${p} type="date" ${f} value="${i(c)}" placeholder="${i(e?.placeholder || "")}">` : e?.multiline ? `<textarea class="${m}" ${p} ${f} placeholder="${i(e.placeholder || "")}">${a(c)}</textarea>` : `<input class="${m}" ${p} type="text" ${f} value="${i(c)}" placeholder="${i(e?.placeholder || "")}">`;
327
+ ].filter(Boolean).join(" "), p = `style="${r(u.styleText)}"`, m = r(["gd-contract-template-renderer__control", ...u.classes].join(" "));
328
+ return o === "checkbox" ? `<label class="${m}" ${p} data-contract-render-wrapper="true" data-key="${r(t)}"><input type="checkbox" ${f} ${U(l) ? "checked" : ""}>${i(e?.checkedText || e?.label || t)}</label>` : s ? `<span class="${m}" ${p} data-contract-render-wrapper="true" data-key="${r(t)}">${i(u.displayText || l)}</span>` : o === "number" ? `<input class="${m}" ${p} type="number" ${f} value="${r(l)}" placeholder="${r(e?.placeholder || "")}">` : o === "date" ? `<input class="${m}" ${p} type="date" ${f} value="${r(l)}" placeholder="${r(e?.placeholder || "")}">` : o === "select" || o === "radio" || o.endsWith("-selector") || o === "custom" ? `<span class="${m}" ${p} data-contract-render-wrapper="true" data-key="${r(t)}">${i(h(n))}</span>` : e?.multiline ? `<textarea class="${m}" ${p} ${f} placeholder="${r(e.placeholder || "")}">${i(l)}</textarea>` : `<input class="${m}" ${p} type="text" ${f} value="${r(l)}" placeholder="${r(e?.placeholder || "")}">`;
298
329
  }
299
- function I(e) {
330
+ function B(e) {
300
331
  if (!e) return "";
301
- if (e.type === "checkbox") return z(e.defaultValue);
332
+ if (e.type === "checkbox") return U(e.defaultValue);
302
333
  if (e.type === "number" && e.defaultValue !== void 0) {
303
334
  let t = Number(e.defaultValue);
304
335
  return Number.isFinite(t) ? t : e.defaultValue;
305
336
  }
306
- return e.defaultValue ?? "";
337
+ if (!(e.type === "select" || e.type === "radio" || e.type?.endsWith("-selector"))) return e.defaultValue ?? "";
307
338
  }
308
- function L(e) {
309
- return typeof e == "boolean" ? e ? "true" : "" : e == null ? "" : String(e);
339
+ function V(e) {
340
+ return typeof e == "boolean" ? e ? "true" : "" : e == null ? "" : h(e);
310
341
  }
311
- function R(e) {
312
- return typeof e == "boolean" ? e ? "true" : "false" : e == null ? "" : String(e);
342
+ function H(e) {
343
+ return typeof e == "boolean" ? e ? "true" : "false" : e == null ? "" : h(e);
313
344
  }
314
- function z(e) {
345
+ function U(e) {
315
346
  return e === !0 || e === "true" || e === "1" || e === "yes" || e === "是" || e === "已选";
316
347
  }
317
- function B(e) {
318
- if (t()) {
319
- let t = new DOMParser().parseFromString(e, "text/html");
320
- return t.querySelectorAll("script,style,meta,link,iframe,object,embed").forEach((e) => e.remove()), t.querySelectorAll("*").forEach((e) => {
348
+ function W(t) {
349
+ if (e()) {
350
+ let e = new DOMParser().parseFromString(t, "text/html");
351
+ return e.querySelectorAll("script,style,meta,link,iframe,object,embed").forEach((e) => e.remove()), e.querySelectorAll("*").forEach((e) => {
321
352
  Array.from(e.attributes).forEach((t) => {
322
353
  let n = t.name.toLowerCase();
323
- (n.startsWith("on") || n === "srcdoc" || x.has(n) && U(t.value) || n === "style" && G(t.value)) && e.removeAttribute(t.name);
354
+ (n.startsWith("on") || n === "srcdoc" || T.has(n) && q(t.value) || n === "style" && Y(t.value)) && e.removeAttribute(t.name);
324
355
  });
325
- }), t.body.innerHTML;
356
+ }), e.body.innerHTML;
326
357
  }
327
- return e.replace(/<\s*(script|style|iframe|object|embed)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/<\s*\/?\s*(?:script|style|meta|link|iframe|object|embed)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+srcdoc\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(action|formaction|href|src|xlink:href)\s*=\s*(?:(["'])(.*?)\2|([^\s>]+))/gi, (e, t, n, r, i) => {
358
+ return t.replace(/<\s*(script|style|iframe|object|embed)\b[^>]*>[\s\S]*?<\s*\/\s*\1\s*>/gi, "").replace(/<\s*\/?\s*(?:script|style|meta|link|iframe|object|embed)\b[^>]*>/gi, "").replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+srcdoc\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, "").replace(/\s+(action|formaction|href|src|xlink:href)\s*=\s*(?:(["'])(.*?)\2|([^\s>]+))/gi, (e, t, n, r, i) => {
328
359
  let a = r ?? i ?? "";
329
- return U(a) ? "" : n ? ` ${t}=${n}${a}${n}` : ` ${t}=${a}`;
330
- }).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => G(n) ? "" : ` style=${t}${n}${t}`);
360
+ return q(a) ? "" : n ? ` ${t}=${n}${a}${n}` : ` ${t}=${a}`;
361
+ }).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => Y(n) ? "" : ` style=${t}${n}${t}`);
331
362
  }
332
- function V(e) {
333
- return r(e, S, (e) => o(e, "data-key"));
363
+ function G(e) {
364
+ return n(e, E, (e) => a(e, "data-key"));
334
365
  }
335
- function H(e) {
366
+ function K(e) {
336
367
  let t = [];
337
- return /<\s*(script|style|meta|link|iframe|object|embed)\b/i.test(e) && t.push("正文包含已移除的危险标签"), /\s(?:on[a-z]+|srcdoc)\s*=/i.test(e) && t.push("正文包含已移除的事件或嵌入属性"), (W(e) || /style\s*=\s*["'][^"']*(?:expression\s*\(|url\s*\(\s*["']?\s*(?:javascript|vbscript|data:text\/html))/i.test(e)) && t.push("正文包含已移除的危险 URL 或样式"), t;
368
+ return /<\s*(script|style|meta|link|iframe|object|embed)\b/i.test(e) && t.push("正文包含已移除的危险标签"), /\s(?:on[a-z]+|srcdoc)\s*=/i.test(e) && t.push("正文包含已移除的事件或嵌入属性"), (J(e) || /style\s*=\s*["'][^"']*(?:expression\s*\(|url\s*\(\s*["']?\s*(?:javascript|vbscript|data:text\/html))/i.test(e)) && t.push("正文包含已移除的危险 URL 或样式"), t;
338
369
  }
339
- function U(e) {
370
+ function q(e) {
340
371
  let t = e.replace(/&#(?:x([\da-f]+)|(\d+));?/gi, (e, t, n) => {
341
372
  let r = Number.parseInt(t ?? n ?? "", t ? 16 : 10);
342
373
  try {
@@ -351,22 +382,22 @@ function U(e) {
351
382
  })[t.toLowerCase()] ?? "").trim().replace(/[\u0000-\u0020\u007F]+/g, "");
352
383
  return /^(?:javascript|vbscript|data:text\/html)/i.test(t);
353
384
  }
354
- function W(e) {
385
+ function J(e) {
355
386
  let t = /\s+(?:action|formaction|href|src|xlink:href)\s*=\s*(?:(["'])(.*?)\1|([^\s>]+))/gi, n = t.exec(e);
356
387
  for (; n;) {
357
- if (U(n[2] ?? n[3] ?? "")) return !0;
388
+ if (q(n[2] ?? n[3] ?? "")) return !0;
358
389
  n = t.exec(e);
359
390
  }
360
391
  return !1;
361
392
  }
362
- function G(e) {
393
+ function Y(e) {
363
394
  return /expression\s*\(|url\s*\(\s*["']?\s*(?:javascript|vbscript|data:text\/html)/i.test(e);
364
395
  }
365
- function K(e) {
396
+ function X(e) {
366
397
  let t = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(e));
367
398
  if (!t) return !1;
368
399
  let n = /* @__PURE__ */ new Date(`${t[1]}-${t[2]}-${t[3]}T00:00:00Z`);
369
400
  return !Number.isNaN(n.getTime()) && n.getUTCFullYear() === Number(t[1]) && n.getUTCMonth() + 1 === Number(t[2]) && n.getUTCDate() === Number(t[3]);
370
401
  }
371
402
  //#endregion
372
- export { C as buildInitialRenderValues, k as buildTemplateRenderHtml, O as buildTemplateRenderPages, A as isEmptyRenderValue, w as normalizeRenderValues, E as resolveTemplateRenderSubmitErrors, B as sanitizeContractRendererHtml, D as validateTemplateRenderStructure, T as validateTemplateRenderValues };
403
+ export { D as buildInitialRenderValues, N as buildTemplateRenderHtml, M as buildTemplateRenderPages, C as buildTemplateVariableData, P as isEmptyRenderValue, O as normalizeRenderValues, A as resolveTemplateRenderSubmitErrors, W as sanitizeContractRendererHtml, j as validateTemplateRenderStructure, k as validateTemplateRenderValues };
@@ -1,22 +1,29 @@
1
1
  import { isContractTemplateFieldType as e } from "../types.mjs";
2
- import { CalendarOutlined as t, CheckSquareOutlined as n, EditOutlined as r, FontSizeOutlined as i, NumberOutlined as a, PictureOutlined as o, SafetyCertificateOutlined as s } from "@ant-design/icons-vue";
2
+ import { ApartmentOutlined as t, CalendarOutlined as n, CheckSquareOutlined as r, CodeOutlined as i, DownOutlined as a, EditOutlined as o, FontSizeOutlined as s, NumberOutlined as c, PictureOutlined as l, ProfileOutlined as u, SafetyCertificateOutlined as d, TeamOutlined as f, UserOutlined as p } from "@ant-design/icons-vue";
3
3
  //#region src/components/pro-contract-template-designer/src/utils/template-tool-icons.ts
4
- var c = {
5
- text: i,
6
- date: t,
7
- number: a,
8
- image: o,
9
- checkbox: n
10
- }, l = {
11
- seal: s,
12
- signature: r,
13
- date: t
4
+ var m = {
5
+ text: s,
6
+ date: n,
7
+ number: c,
8
+ image: l,
9
+ checkbox: r,
10
+ select: a,
11
+ radio: u,
12
+ "user-selector": p,
13
+ "dept-selector": t,
14
+ "role-selector": f,
15
+ "org-selector": t,
16
+ custom: i
17
+ }, h = {
18
+ seal: d,
19
+ signature: o,
20
+ date: n
14
21
  };
15
- function u(t) {
16
- return c[e(t) ? t : "text"];
22
+ function g(t) {
23
+ return m[e(t) ? t : "text"];
17
24
  }
18
- function d(e) {
19
- return l[e];
25
+ function _(e) {
26
+ return h[e];
20
27
  }
21
28
  //#endregion
22
- export { u as resolveFieldTypeIcon, d as resolveSigningPlacementTypeIcon };
29
+ export { g as resolveFieldTypeIcon, _ as resolveSigningPlacementTypeIcon };