@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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 { DEFAULT_PAGE_SIZE as u, resolvePageSize as d } from "../composables/use-template-designer.mjs";
|
|
5
|
+
import { isSafeContractImageUrl as f } from "./image-url.mjs";
|
|
6
6
|
//#region src/components/pro-contract-template-designer/src/utils/template-renderer.ts
|
|
7
7
|
var p = new Set([
|
|
8
8
|
"action",
|
|
@@ -23,23 +23,23 @@ function g(e, t) {
|
|
|
23
23
|
...t ?? {}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function _(e,
|
|
27
|
-
let
|
|
28
|
-
if (!e) return
|
|
29
|
-
let
|
|
30
|
-
return Object.keys(
|
|
31
|
-
|
|
26
|
+
function _(e, t) {
|
|
27
|
+
let n = y(e);
|
|
28
|
+
if (!e) return n;
|
|
29
|
+
let r = Array.isArray(e.variables) ? e.variables : [], i = new Set(r.map((e) => e?.key).filter(Boolean));
|
|
30
|
+
return Object.keys(t).forEach((e) => {
|
|
31
|
+
i.has(e) || n.push({
|
|
32
32
|
type: "variable",
|
|
33
33
|
id: e,
|
|
34
34
|
variableKey: e,
|
|
35
35
|
message: `提交值 ${e} 不属于模板变量`,
|
|
36
36
|
code: "VARIABLE_UNKNOWN"
|
|
37
37
|
});
|
|
38
|
-
}),
|
|
38
|
+
}), r.forEach((e) => {
|
|
39
39
|
if (!e?.key) return;
|
|
40
|
-
let
|
|
41
|
-
if (e.required && S(
|
|
42
|
-
|
|
40
|
+
let r = t[e.key];
|
|
41
|
+
if (e.required && S(r)) {
|
|
42
|
+
n.push({
|
|
43
43
|
type: "variable",
|
|
44
44
|
id: e.id,
|
|
45
45
|
variableKey: e.key,
|
|
@@ -48,138 +48,138 @@ function _(e, n) {
|
|
|
48
48
|
});
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
|
-
S(
|
|
51
|
+
S(r) || (e.type === "number" && (typeof r != "number" || !Number.isFinite(r)) && n.push({
|
|
52
52
|
type: "variable",
|
|
53
53
|
id: e.id,
|
|
54
54
|
variableKey: e.key,
|
|
55
55
|
message: `${e.label || e.key} 不是合法数字`,
|
|
56
56
|
code: "VARIABLE_TYPE_INVALID"
|
|
57
|
-
}), e.type === "checkbox" && typeof
|
|
57
|
+
}), e.type === "checkbox" && typeof r != "boolean" && n.push({
|
|
58
58
|
type: "variable",
|
|
59
59
|
id: e.id,
|
|
60
60
|
variableKey: e.key,
|
|
61
61
|
message: `${e.label || e.key} 不是合法复选值`,
|
|
62
62
|
code: "VARIABLE_TYPE_INVALID"
|
|
63
|
-
}), e.type === "date" && !R(
|
|
63
|
+
}), e.type === "date" && !R(r) && n.push({
|
|
64
64
|
type: "variable",
|
|
65
65
|
id: e.id,
|
|
66
66
|
variableKey: e.key,
|
|
67
67
|
message: `${e.label || e.key} 不是合法日期`,
|
|
68
68
|
code: "VARIABLE_TYPE_INVALID"
|
|
69
|
-
}), e.type === "image" && !
|
|
69
|
+
}), e.type === "image" && !f(String(r)) && n.push({
|
|
70
70
|
type: "security",
|
|
71
71
|
id: e.id,
|
|
72
72
|
variableKey: e.key,
|
|
73
73
|
message: `${e.label || e.key} 不是安全的图片地址`,
|
|
74
74
|
code: "IMAGE_URL_UNSAFE"
|
|
75
75
|
}));
|
|
76
|
-
}),
|
|
76
|
+
}), n;
|
|
77
77
|
}
|
|
78
78
|
function v(e, t, n) {
|
|
79
79
|
return n ? _(e, t) : y(e);
|
|
80
80
|
}
|
|
81
|
-
function y(
|
|
82
|
-
if (!
|
|
81
|
+
function y(t) {
|
|
82
|
+
if (!t) return [{
|
|
83
83
|
type: "page",
|
|
84
84
|
id: "template",
|
|
85
85
|
message: "缺少可渲染的合同模板",
|
|
86
86
|
code: "TEMPLATE_MISSING"
|
|
87
87
|
}];
|
|
88
|
-
let
|
|
89
|
-
(!Array.isArray(
|
|
88
|
+
let n = [], r = Array.isArray(t.pages) ? t.pages : [], i = Array.isArray(t.variables) ? t.variables : [];
|
|
89
|
+
(!Array.isArray(t.pages) || r.length === 0) && n.push({
|
|
90
90
|
type: "page",
|
|
91
91
|
id: "template-pages",
|
|
92
92
|
message: "模板至少需要一个合法页面",
|
|
93
93
|
code: "TEMPLATE_PAGES_INVALID"
|
|
94
|
-
}), Array.isArray(
|
|
94
|
+
}), Array.isArray(t.variables) || n.push({
|
|
95
95
|
type: "variable",
|
|
96
96
|
id: "template-variables",
|
|
97
97
|
message: "模板变量列表格式无效",
|
|
98
98
|
code: "TEMPLATE_VARIABLES_INVALID"
|
|
99
|
-
}),
|
|
99
|
+
}), s(t.pageSize) || n.push({
|
|
100
100
|
type: "page",
|
|
101
101
|
id: "template-page-size",
|
|
102
102
|
message: "模板默认页面尺寸无效,已回退为安全默认尺寸",
|
|
103
103
|
code: "TEMPLATE_PAGE_SIZE_INVALID"
|
|
104
104
|
});
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
if (!
|
|
108
|
-
|
|
105
|
+
let a = /* @__PURE__ */ new Map();
|
|
106
|
+
i.forEach((t, r) => {
|
|
107
|
+
if (!t || typeof t.key != "string" || !t.key.trim()) {
|
|
108
|
+
n.push({
|
|
109
109
|
type: "variable",
|
|
110
|
-
id:
|
|
111
|
-
message: `第 ${
|
|
110
|
+
id: t?.id || `variable-${r}`,
|
|
111
|
+
message: `第 ${r + 1} 个变量缺少有效 key`,
|
|
112
112
|
code: "VARIABLE_KEY_MISSING"
|
|
113
113
|
});
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
a.set(t.key, (a.get(t.key) ?? 0) + 1), e(t.type ?? "text") || n.push({
|
|
117
117
|
type: "variable",
|
|
118
|
-
id:
|
|
119
|
-
variableKey:
|
|
120
|
-
message: `${
|
|
118
|
+
id: t.id,
|
|
119
|
+
variableKey: t.key,
|
|
120
|
+
message: `${t.label || t.key} 不是正文填写变量`,
|
|
121
121
|
code: "VARIABLE_TYPE_UNSUPPORTED"
|
|
122
122
|
});
|
|
123
|
-
}),
|
|
124
|
-
e > 1 &&
|
|
123
|
+
}), a.forEach((e, t) => {
|
|
124
|
+
e > 1 && n.push({
|
|
125
125
|
type: "variable",
|
|
126
|
-
id:
|
|
127
|
-
variableKey:
|
|
128
|
-
message: `变量 key ${
|
|
126
|
+
id: t,
|
|
127
|
+
variableKey: t,
|
|
128
|
+
message: `变量 key ${t} 重复`,
|
|
129
129
|
code: "VARIABLE_KEY_DUPLICATED"
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
|
-
let
|
|
133
|
-
return
|
|
132
|
+
let o = /* @__PURE__ */ new Set();
|
|
133
|
+
return r.forEach((e, t) => {
|
|
134
134
|
if (!e || typeof e.id != "string" || !e.id.trim() || typeof e.contentHtml != "string") {
|
|
135
|
-
|
|
135
|
+
n.push({
|
|
136
136
|
type: "page",
|
|
137
|
-
id: e?.id || `page-${
|
|
137
|
+
id: e?.id || `page-${t}`,
|
|
138
138
|
pageId: e?.id,
|
|
139
|
-
message: `第 ${
|
|
139
|
+
message: `第 ${t + 1} 页结构无效,已跳过渲染`,
|
|
140
140
|
code: "PAGE_INVALID"
|
|
141
141
|
});
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
e.pageSize !== void 0 && !
|
|
144
|
+
e.pageSize !== void 0 && !s(e.pageSize) && n.push({
|
|
145
145
|
type: "page",
|
|
146
146
|
id: `${e.id}-page-size`,
|
|
147
147
|
pageId: e.id,
|
|
148
|
-
message: `${e.title || `第 ${
|
|
148
|
+
message: `${e.title || `第 ${t + 1} 页`}:页面尺寸无效,已回退为安全尺寸`,
|
|
149
149
|
code: "PAGE_SIZE_INVALID"
|
|
150
|
-
}), N(e.contentHtml).forEach((e) =>
|
|
151
|
-
|
|
150
|
+
}), N(e.contentHtml).forEach((e) => o.add(e)), P(e.contentHtml).forEach((r, i) => {
|
|
151
|
+
n.push({
|
|
152
152
|
type: "security",
|
|
153
153
|
id: `${e.id}-security-${i}`,
|
|
154
154
|
pageId: e.id,
|
|
155
|
-
message: `${e.title || `第 ${
|
|
155
|
+
message: `${e.title || `第 ${t + 1} 页`}:${r}`,
|
|
156
156
|
code: "HTML_UNSAFE"
|
|
157
157
|
});
|
|
158
158
|
});
|
|
159
|
-
}),
|
|
160
|
-
|
|
159
|
+
}), o.forEach((e) => {
|
|
160
|
+
a.has(e) || n.push({
|
|
161
161
|
type: "variable",
|
|
162
162
|
id: e,
|
|
163
163
|
variableKey: e,
|
|
164
164
|
message: `正文引用的变量 ${e} 缺少配置`,
|
|
165
165
|
code: "VARIABLE_CONFIG_MISSING"
|
|
166
166
|
});
|
|
167
|
-
}),
|
|
168
|
-
|
|
167
|
+
}), a.forEach((e, t) => {
|
|
168
|
+
o.has(t) || n.push({
|
|
169
169
|
type: "variable",
|
|
170
|
-
id:
|
|
171
|
-
variableKey:
|
|
172
|
-
message: `变量 ${
|
|
170
|
+
id: t,
|
|
171
|
+
variableKey: t,
|
|
172
|
+
message: `变量 ${t} 缺少正文节点`,
|
|
173
173
|
code: "VARIABLE_NODE_MISSING"
|
|
174
174
|
});
|
|
175
|
-
}),
|
|
175
|
+
}), n;
|
|
176
176
|
}
|
|
177
177
|
function b(e, t, n = {}) {
|
|
178
178
|
if (!e || !Array.isArray(e.pages)) return [];
|
|
179
|
-
let r = Array.isArray(e.variables) ? e.variables : [], i = new Map(r.filter((e) => e?.key).map((e) => [e.key, e])), a =
|
|
179
|
+
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 : u;
|
|
180
180
|
return e.pages.flatMap((e) => {
|
|
181
181
|
if (!e || typeof e.id != "string" || !e.id.trim() || typeof e.contentHtml != "string") return [];
|
|
182
|
-
let r =
|
|
182
|
+
let r = d(e.pageSize, a);
|
|
183
183
|
return [{
|
|
184
184
|
id: e.id,
|
|
185
185
|
title: e.title || "未命名页面",
|
|
@@ -191,23 +191,23 @@ function b(e, t, n = {}) {
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
function x(e, t, n = {}) {
|
|
194
|
-
return b(e, t, n).map((e) => `<section class="gd-contract-template-page" data-page-id="${
|
|
194
|
+
return b(e, t, n).map((e) => `<section class="gd-contract-template-page" 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">${e.contentHtml}</section>`).join("\n");
|
|
195
195
|
}
|
|
196
196
|
function S(e) {
|
|
197
197
|
return e == null || e === "";
|
|
198
198
|
}
|
|
199
|
-
function C(e, t,
|
|
199
|
+
function C(e, t, r, i) {
|
|
200
200
|
if (!e) return e;
|
|
201
201
|
let a = M(e);
|
|
202
|
-
if (
|
|
202
|
+
if (n()) {
|
|
203
203
|
let e = new DOMParser().parseFromString(a, "text/html");
|
|
204
204
|
return e.querySelectorAll("[data-template-variable]").forEach((e) => {
|
|
205
|
-
w(e, t,
|
|
205
|
+
w(e, t, r, i);
|
|
206
206
|
}), e.body.innerHTML;
|
|
207
207
|
}
|
|
208
|
-
return
|
|
209
|
-
let a =
|
|
210
|
-
return a ? T(t.get(a), a,
|
|
208
|
+
return c(a, (e, n) => {
|
|
209
|
+
let a = o(n, "data-key");
|
|
210
|
+
return a ? T(t.get(a), a, r[a], i) : e;
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
function w(e, t, n, r) {
|
|
@@ -219,66 +219,66 @@ function w(e, t, n, r) {
|
|
|
219
219
|
function T(e, t, n, r) {
|
|
220
220
|
return r.mode === "display" ? E(e, t, n, r) : D(e, t, n, r);
|
|
221
221
|
}
|
|
222
|
-
function E(
|
|
223
|
-
let
|
|
224
|
-
type:
|
|
225
|
-
width:
|
|
226
|
-
height:
|
|
227
|
-
placeholder:
|
|
228
|
-
defaultValue:
|
|
229
|
-
format:
|
|
230
|
-
precision:
|
|
231
|
-
useGrouping:
|
|
232
|
-
checkedText:
|
|
233
|
-
uncheckedText:
|
|
234
|
-
multiline:
|
|
235
|
-
rows:
|
|
236
|
-
lineHeight:
|
|
237
|
-
style:
|
|
238
|
-
}), p =
|
|
239
|
-
`class="${
|
|
222
|
+
function E(e, t, n, r) {
|
|
223
|
+
let o = e?.type ?? "text", s = n ?? O(e), c = o === "image" && !S(s) && !f(String(s)) ? "" : s, u = A(c), d = l({
|
|
224
|
+
type: o,
|
|
225
|
+
width: e?.width,
|
|
226
|
+
height: e?.height,
|
|
227
|
+
placeholder: e?.placeholder ?? "",
|
|
228
|
+
defaultValue: u,
|
|
229
|
+
format: e?.format ?? "",
|
|
230
|
+
precision: e?.precision,
|
|
231
|
+
useGrouping: e?.useGrouping,
|
|
232
|
+
checkedText: e?.checkedText ?? "",
|
|
233
|
+
uncheckedText: e?.uncheckedText ?? "",
|
|
234
|
+
multiline: e?.multiline,
|
|
235
|
+
rows: e?.rows,
|
|
236
|
+
lineHeight: e?.lineHeight,
|
|
237
|
+
style: e?.style
|
|
238
|
+
}), p = d.displayText || e?.placeholder || e?.label || t, m = [
|
|
239
|
+
`class="${i([
|
|
240
240
|
"gd-contract-template-renderer__control",
|
|
241
241
|
"gd-contract-template-renderer__preview-control",
|
|
242
|
-
...
|
|
243
|
-
|
|
244
|
-
S(
|
|
242
|
+
...d.classes,
|
|
243
|
+
r.activeKey === t ? "is-active" : "",
|
|
244
|
+
S(c) ? "is-empty" : ""
|
|
245
245
|
].filter(Boolean).join(" "))}"`,
|
|
246
|
-
`style="${
|
|
246
|
+
`style="${i(d.styleText)}"`,
|
|
247
247
|
"data-contract-render-wrapper=\"true\"",
|
|
248
248
|
"data-contract-render-preview=\"true\"",
|
|
249
|
-
`data-key="${
|
|
250
|
-
`data-variable-type="${
|
|
251
|
-
`aria-label="${
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
`data-key="${i(t)}"`,
|
|
250
|
+
`data-variable-type="${i(o)}"`,
|
|
251
|
+
`aria-label="${i(e?.label || t)}"`,
|
|
252
|
+
r.disabled ? "" : "role=\"button\"",
|
|
253
|
+
r.disabled ? "" : "tabindex=\"0\""
|
|
254
254
|
].filter(Boolean).join(" ");
|
|
255
|
-
return
|
|
255
|
+
return o === "checkbox" ? `<span ${m}><span class="gd-contract-template-renderer__checkbox-mark" aria-hidden="true">${j(c) ? "✓" : ""}</span>${a(p)}</span>` : o === "image" && !S(c) ? `<span ${m}></span>` : `<span ${m}>${a(p)}</span>`;
|
|
256
256
|
}
|
|
257
|
-
function D(t, n, r
|
|
258
|
-
let
|
|
259
|
-
type:
|
|
260
|
-
width:
|
|
261
|
-
height:
|
|
262
|
-
placeholder:
|
|
263
|
-
defaultValue:
|
|
264
|
-
format:
|
|
265
|
-
precision:
|
|
266
|
-
useGrouping:
|
|
267
|
-
checkedText:
|
|
268
|
-
uncheckedText:
|
|
269
|
-
multiline:
|
|
270
|
-
rows:
|
|
271
|
-
lineHeight:
|
|
272
|
-
style:
|
|
273
|
-
}), d =
|
|
257
|
+
function D(e, t, n, r) {
|
|
258
|
+
let o = e?.type ?? "text", s = !!r.readonly, c = k(n ?? O(e)), u = l({
|
|
259
|
+
type: o,
|
|
260
|
+
width: e?.width,
|
|
261
|
+
height: e?.height,
|
|
262
|
+
placeholder: e?.placeholder ?? "",
|
|
263
|
+
defaultValue: s ? c : "",
|
|
264
|
+
format: e?.format ?? "",
|
|
265
|
+
precision: e?.precision,
|
|
266
|
+
useGrouping: e?.useGrouping,
|
|
267
|
+
checkedText: e?.checkedText ?? "",
|
|
268
|
+
uncheckedText: e?.uncheckedText ?? "",
|
|
269
|
+
multiline: e?.multiline,
|
|
270
|
+
rows: e?.rows,
|
|
271
|
+
lineHeight: e?.lineHeight,
|
|
272
|
+
style: e?.style
|
|
273
|
+
}), d = r.disabled || s, f = [
|
|
274
274
|
"data-contract-render-control=\"true\"",
|
|
275
|
-
`data-key="${
|
|
276
|
-
`data-variable-type="${
|
|
277
|
-
`aria-label="${
|
|
275
|
+
`data-key="${i(t)}"`,
|
|
276
|
+
`data-variable-type="${i(o)}"`,
|
|
277
|
+
`aria-label="${i(e?.label || t)}"`,
|
|
278
278
|
d ? "disabled" : "",
|
|
279
|
-
|
|
280
|
-
].filter(Boolean).join(" "), p = `style="${
|
|
281
|
-
return
|
|
279
|
+
s ? "readonly" : ""
|
|
280
|
+
].filter(Boolean).join(" "), p = `style="${i(u.styleText)}"`, m = i(["gd-contract-template-renderer__control", ...u.classes].join(" "));
|
|
281
|
+
return o === "checkbox" ? `<label class="${m}" ${p} data-contract-render-wrapper="true" data-key="${i(t)}"><input type="checkbox" ${f} ${j(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 || "")}">`;
|
|
282
282
|
}
|
|
283
283
|
function O(e) {
|
|
284
284
|
if (!e) return "";
|
|
@@ -299,7 +299,7 @@ function j(e) {
|
|
|
299
299
|
return e === !0 || e === "true" || e === "1" || e === "yes" || e === "是" || e === "已选";
|
|
300
300
|
}
|
|
301
301
|
function M(e) {
|
|
302
|
-
if (
|
|
302
|
+
if (t()) {
|
|
303
303
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
304
304
|
return t.querySelectorAll("script,style,meta,link,iframe,object,embed").forEach((e) => e.remove()), t.querySelectorAll("*").forEach((e) => {
|
|
305
305
|
Array.from(e.attributes).forEach((t) => {
|
|
@@ -314,7 +314,7 @@ function M(e) {
|
|
|
314
314
|
}).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => L(n) ? "" : ` style=${t}${n}${t}`);
|
|
315
315
|
}
|
|
316
316
|
function N(e) {
|
|
317
|
-
return
|
|
317
|
+
return r(e, m, (e) => o(e, "data-key"));
|
|
318
318
|
}
|
|
319
319
|
function P(e) {
|
|
320
320
|
let t = [];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/components/pro-contract-template-designer/src/utils/toolbar-overflow.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"table",
|
|
4
|
+
"cleanup",
|
|
5
|
+
"typography",
|
|
6
|
+
"insert"
|
|
7
|
+
];
|
|
8
|
+
function t(t) {
|
|
9
|
+
let n = t.buffer ?? 0, r = e.reduce((e, n) => e + (t.groupWidths[n] ?? 0), 0);
|
|
10
|
+
if (t.fixedWidth + r + n <= t.availableWidth) return [];
|
|
11
|
+
let i = [], a = t.fixedWidth + r + t.moreWidth;
|
|
12
|
+
for (let n of e) {
|
|
13
|
+
if (a <= t.availableWidth) break;
|
|
14
|
+
i.push(n), a -= t.groupWidths[n] ?? 0;
|
|
15
|
+
}
|
|
16
|
+
return i;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { e as CONTRACT_TEMPLATE_TOOLBAR_OVERFLOW_PRIORITY, t as resolveContractTemplateToolbarOverflowKeys };
|