@guodun/antdv 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.mjs +304 -293
- package/dist/es/components/contract-signing-location/src/ContractSigningTemplatePage.vue.mjs +66 -13
- package/dist/es/components/contract-signing-location/src/constants.mjs +27 -17
- package/dist/es/components/contract-signing-location/src/coordinates.mjs +23 -23
- package/dist/es/components/contract-signing-location/src/location-rules.mjs +20 -10
- package/dist/es/components/contract-signing-location/src/page-layout.mjs +12 -9
- package/dist/es/components/contract-signing-location/src/template-source.mjs +52 -34
- package/dist/es/components/contract-signing-location/style/index.css +1 -1
- package/dist/es/components/index.mjs +1 -1
- package/dist/es/components/pro-contract-template-designer/index.mjs +1 -1
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.mjs +186 -148
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.mjs +4 -4
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.mjs +5 -0
- package/dist/es/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.mjs +179 -0
- package/dist/es/components/pro-contract-template-designer/src/DesignerPage.vue.mjs +149 -126
- package/dist/es/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.mjs +1229 -1059
- package/dist/es/components/pro-contract-template-designer/src/composables/use-template-designer.mjs +34 -34
- package/dist/es/components/pro-contract-template-designer/src/utils/page-decorations.mjs +17 -17
- package/dist/es/components/pro-contract-template-designer/src/utils/signing-placement.mjs +14 -14
- package/dist/es/components/pro-contract-template-designer/src/utils/template-renderer.mjs +89 -89
- package/dist/es/components/pro-contract-template-designer/style/index.css +1 -1
- package/dist/es/index.mjs +25 -25
- package/dist/lib/components/contract-signing-location/src/ContractSigningLocationCanvas.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/ContractSigningTemplatePage.vue.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/constants.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/coordinates.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/location-rules.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/page-layout.cjs +1 -1
- package/dist/lib/components/contract-signing-location/src/template-source.cjs +1 -1
- 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-template-designer/index.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplatePreviewPage.vue.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.cjs +1 -0
- package/dist/lib/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.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/composables/use-template-designer.cjs +3 -3
- package/dist/lib/components/pro-contract-template-designer/src/utils/page-decorations.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/signing-placement.cjs +1 -1
- package/dist/lib/components/pro-contract-template-designer/src/utils/template-renderer.cjs +2 -2
- 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/types/components/contract-signing-location/src/ContractSigningTemplatePage.vue.d.ts +3 -1
- package/dist/types/components/contract-signing-location/src/constants.d.ts +18 -0
- package/dist/types/components/contract-signing-location/src/coordinates.d.ts +8 -2
- package/dist/types/components/contract-signing-location/src/page-layout.d.ts +2 -2
- package/dist/types/components/contract-signing-location/src/template-source.d.ts +19 -0
- package/dist/types/components/contract-signing-location/src/types.d.ts +3 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateDesignerWorkspaceHeader.vue.d.ts +10 -0
- package/dist/types/components/pro-contract-template-designer/src/ContractTemplateTextBubbleMenu.vue.d.ts +43 -0
- package/dist/types/components/pro-contract-template-designer/src/DesignerPage.vue.d.ts +22 -0
- package/dist/types/components/pro-contract-template-designer/src/ProContractTemplateDesigner.vue.d.ts +90 -0
- package/dist/types/components/pro-contract-template-designer/src/utils/context-menu-viewport.d.ts +3 -0
- package/package.json +5 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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
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
6
|
import { isSafeContractImageUrl as b } from "./image-url.mjs";
|
|
7
7
|
//#region src/components/pro-contract-template-designer/src/utils/template-renderer.ts
|
|
@@ -79,93 +79,93 @@ function T(e, t) {
|
|
|
79
79
|
function E(e, t, n) {
|
|
80
80
|
return n ? T(e, t) : D(e);
|
|
81
81
|
}
|
|
82
|
-
function D(
|
|
83
|
-
if (!
|
|
82
|
+
function D(e) {
|
|
83
|
+
if (!e) return [{
|
|
84
84
|
type: "page",
|
|
85
85
|
id: "template",
|
|
86
86
|
message: "缺少可渲染的合同模板",
|
|
87
87
|
code: "TEMPLATE_MISSING"
|
|
88
88
|
}];
|
|
89
|
-
let
|
|
90
|
-
(!Array.isArray(
|
|
89
|
+
let t = [], n = Array.isArray(e.pages) ? e.pages : [], r = Array.isArray(e.variables) ? e.variables : [];
|
|
90
|
+
(!Array.isArray(e.pages) || n.length === 0) && t.push({
|
|
91
91
|
type: "page",
|
|
92
92
|
id: "template-pages",
|
|
93
93
|
message: "模板至少需要一个合法页面",
|
|
94
94
|
code: "TEMPLATE_PAGES_INVALID"
|
|
95
|
-
}), Array.isArray(
|
|
95
|
+
}), Array.isArray(e.variables) || t.push({
|
|
96
96
|
type: "variable",
|
|
97
97
|
id: "template-variables",
|
|
98
98
|
message: "模板变量列表格式无效",
|
|
99
99
|
code: "TEMPLATE_VARIABLES_INVALID"
|
|
100
|
-
}),
|
|
100
|
+
}), o(e.pageSize) || t.push({
|
|
101
101
|
type: "page",
|
|
102
102
|
id: "template-page-size",
|
|
103
103
|
message: "模板默认页面尺寸无效,已回退为安全默认尺寸",
|
|
104
104
|
code: "TEMPLATE_PAGE_SIZE_INVALID"
|
|
105
105
|
});
|
|
106
|
-
let
|
|
107
|
-
|
|
108
|
-
if (!
|
|
109
|
-
|
|
106
|
+
let i = /* @__PURE__ */ new Map();
|
|
107
|
+
r.forEach((e, n) => {
|
|
108
|
+
if (!e || typeof e.key != "string" || !e.key.trim()) {
|
|
109
|
+
t.push({
|
|
110
110
|
type: "variable",
|
|
111
|
-
id:
|
|
112
|
-
message: `第 ${
|
|
111
|
+
id: e?.id || `variable-${n}`,
|
|
112
|
+
message: `第 ${n + 1} 个变量缺少有效 key`,
|
|
113
113
|
code: "VARIABLE_KEY_MISSING"
|
|
114
114
|
});
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
let
|
|
118
|
-
|
|
117
|
+
let a = e.key.trim(), o = r.some((t) => t?.id !== e.id && typeof t?.key == "string" && t.key.trim() === a), s = y(e.key, r, e.id), c = !g.test(a) || h.has(a);
|
|
118
|
+
s && (c || !o || e.key !== a) && t.push({
|
|
119
119
|
type: "variable",
|
|
120
|
-
id:
|
|
121
|
-
variableKey:
|
|
122
|
-
message: `${
|
|
120
|
+
id: e.id || `variable-${n}`,
|
|
121
|
+
variableKey: e.key,
|
|
122
|
+
message: `${e.label || e.key}:${s}`,
|
|
123
123
|
code: "VARIABLE_KEY_INVALID"
|
|
124
|
-
}),
|
|
124
|
+
}), i.set(a, (i.get(a) ?? 0) + 1), m(e.type ?? "text") || t.push({
|
|
125
125
|
type: "variable",
|
|
126
|
-
id:
|
|
127
|
-
variableKey:
|
|
128
|
-
message: `${
|
|
126
|
+
id: e.id,
|
|
127
|
+
variableKey: e.key,
|
|
128
|
+
message: `${e.label || e.key} 不是正文填写变量`,
|
|
129
129
|
code: "VARIABLE_TYPE_UNSUPPORTED"
|
|
130
130
|
});
|
|
131
|
-
}),
|
|
132
|
-
e > 1 &&
|
|
131
|
+
}), i.forEach((e, n) => {
|
|
132
|
+
e > 1 && t.push({
|
|
133
133
|
type: "variable",
|
|
134
|
-
id:
|
|
135
|
-
variableKey:
|
|
136
|
-
message: `变量 key ${
|
|
134
|
+
id: n,
|
|
135
|
+
variableKey: n,
|
|
136
|
+
message: `变量 key ${n} 重复`,
|
|
137
137
|
code: "VARIABLE_KEY_DUPLICATED"
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
|
-
let
|
|
141
|
-
|
|
140
|
+
let a = /* @__PURE__ */ new Set();
|
|
141
|
+
n.forEach((e, n) => {
|
|
142
142
|
if (!e || typeof e.id != "string" || !e.id.trim() || typeof e.contentHtml != "string") {
|
|
143
|
-
|
|
143
|
+
t.push({
|
|
144
144
|
type: "page",
|
|
145
|
-
id: e?.id || `page-${
|
|
145
|
+
id: e?.id || `page-${n}`,
|
|
146
146
|
pageId: e?.id,
|
|
147
|
-
message: `第 ${
|
|
147
|
+
message: `第 ${n + 1} 页结构无效,已跳过渲染`,
|
|
148
148
|
code: "PAGE_INVALID"
|
|
149
149
|
});
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
|
-
e.pageSize !== void 0 && !
|
|
152
|
+
e.pageSize !== void 0 && !o(e.pageSize) && t.push({
|
|
153
153
|
type: "page",
|
|
154
154
|
id: `${e.id}-page-size`,
|
|
155
155
|
pageId: e.id,
|
|
156
|
-
message: `${e.title || `第 ${
|
|
156
|
+
message: `${e.title || `第 ${n + 1} 页`}:页面尺寸无效,已回退为安全尺寸`,
|
|
157
157
|
code: "PAGE_SIZE_INVALID"
|
|
158
|
-
}), V(e.contentHtml).forEach((e) =>
|
|
159
|
-
|
|
158
|
+
}), V(e.contentHtml).forEach((e) => a.add(e)), H(e.contentHtml).forEach((r, i) => {
|
|
159
|
+
t.push({
|
|
160
160
|
type: "security",
|
|
161
161
|
id: `${e.id}-security-${i}`,
|
|
162
162
|
pageId: e.id,
|
|
163
|
-
message: `${e.title || `第 ${
|
|
163
|
+
message: `${e.title || `第 ${n + 1} 页`}:${r}`,
|
|
164
164
|
code: "HTML_UNSAFE"
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
|
-
}),
|
|
168
|
-
|
|
167
|
+
}), a.forEach((e) => {
|
|
168
|
+
i.has(e) || t.push({
|
|
169
169
|
type: "variable",
|
|
170
170
|
id: e,
|
|
171
171
|
variableKey: e,
|
|
@@ -173,20 +173,20 @@ function D(t) {
|
|
|
173
173
|
code: "VARIABLE_CONFIG_MISSING"
|
|
174
174
|
});
|
|
175
175
|
});
|
|
176
|
-
let
|
|
177
|
-
return
|
|
178
|
-
!
|
|
176
|
+
let s = d(e.pageDecorations);
|
|
177
|
+
return i.forEach((e, n) => {
|
|
178
|
+
!a.has(n) && !s.has(n) && t.push({
|
|
179
179
|
type: "variable",
|
|
180
|
-
id:
|
|
181
|
-
variableKey:
|
|
182
|
-
message: `变量 ${
|
|
180
|
+
id: n,
|
|
181
|
+
variableKey: n,
|
|
182
|
+
message: `变量 ${n} 缺少正文节点`,
|
|
183
183
|
code: "VARIABLE_NODE_MISSING"
|
|
184
184
|
});
|
|
185
|
-
}),
|
|
185
|
+
}), t.push(...p(e.pageDecorations, r)), t;
|
|
186
186
|
}
|
|
187
187
|
function O(e, t, n = {}) {
|
|
188
188
|
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 =
|
|
189
|
+
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 : _;
|
|
190
190
|
return e.pages.flatMap((o) => {
|
|
191
191
|
if (!o || typeof o.id != "string" || !o.id.trim() || typeof o.contentHtml != "string") return [];
|
|
192
192
|
let s = v(o.pageSize, a);
|
|
@@ -197,7 +197,7 @@ function O(e, t, n = {}) {
|
|
|
197
197
|
width: s.width,
|
|
198
198
|
height: s.height,
|
|
199
199
|
contentHtml: j(o.contentHtml, i, t, n),
|
|
200
|
-
...e.pageDecorations ? { pageDecorations:
|
|
200
|
+
...e.pageDecorations ? { pageDecorations: f(e.pageDecorations) } : {},
|
|
201
201
|
decorationVariables: r,
|
|
202
202
|
decorationValues: t
|
|
203
203
|
}];
|
|
@@ -205,25 +205,25 @@ function O(e, t, n = {}) {
|
|
|
205
205
|
}
|
|
206
206
|
function k(e, t, n = {}) {
|
|
207
207
|
return O(e, t, n).map((e, t, n) => {
|
|
208
|
-
let
|
|
209
|
-
return `<section class="${
|
|
208
|
+
let i = u(e.pageDecorations, t + 1, n.length, e.decorationVariables, e.decorationValues);
|
|
209
|
+
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
210
|
}).join("\n");
|
|
211
211
|
}
|
|
212
212
|
function A(e) {
|
|
213
213
|
return e == null || e === "";
|
|
214
214
|
}
|
|
215
|
-
function j(e,
|
|
215
|
+
function j(e, n, r, i) {
|
|
216
216
|
if (!e) return e;
|
|
217
|
-
let
|
|
218
|
-
if (
|
|
219
|
-
let e = new DOMParser().parseFromString(
|
|
217
|
+
let o = B(e);
|
|
218
|
+
if (t()) {
|
|
219
|
+
let e = new DOMParser().parseFromString(o, "text/html");
|
|
220
220
|
return e.querySelectorAll("[data-template-variable]").forEach((e) => {
|
|
221
|
-
M(e,
|
|
221
|
+
M(e, n, r, i);
|
|
222
222
|
}), e.body.innerHTML;
|
|
223
223
|
}
|
|
224
|
-
return
|
|
225
|
-
let
|
|
226
|
-
return
|
|
224
|
+
return s(o, (e, t) => {
|
|
225
|
+
let o = a(t, "data-key");
|
|
226
|
+
return o ? N(n.get(o), o, r[o], i) : e;
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
function M(e, t, n, r) {
|
|
@@ -235,8 +235,8 @@ function M(e, t, n, r) {
|
|
|
235
235
|
function N(e, t, n, r) {
|
|
236
236
|
return r.mode === "display" ? P(e, t, n, r) : F(e, t, n, r);
|
|
237
237
|
}
|
|
238
|
-
function P(e, t, n,
|
|
239
|
-
let o = e?.type ?? "text", s = n ?? I(e),
|
|
238
|
+
function P(e, t, n, a) {
|
|
239
|
+
let o = e?.type ?? "text", s = n ?? I(e), l = o === "image" && !A(s) && !b(String(s)) ? "" : s, u = R(l), d = c({
|
|
240
240
|
type: o,
|
|
241
241
|
width: e?.width,
|
|
242
242
|
height: e?.height,
|
|
@@ -252,31 +252,31 @@ function P(e, t, n, r) {
|
|
|
252
252
|
lineHeight: e?.lineHeight,
|
|
253
253
|
style: e?.style
|
|
254
254
|
}), f = d.displayText || e?.placeholder || e?.label || t, p = [
|
|
255
|
-
`class="${
|
|
255
|
+
`class="${r([
|
|
256
256
|
"gd-contract-template-renderer__control",
|
|
257
257
|
"gd-contract-template-renderer__preview-control",
|
|
258
258
|
...d.classes,
|
|
259
|
-
|
|
260
|
-
A(
|
|
259
|
+
a.activeKey === t ? "is-active" : "",
|
|
260
|
+
A(l) ? "is-empty" : ""
|
|
261
261
|
].filter(Boolean).join(" "))}"`,
|
|
262
|
-
`style="${
|
|
262
|
+
`style="${r(d.styleText)}"`,
|
|
263
263
|
"data-contract-render-wrapper=\"true\"",
|
|
264
264
|
"data-contract-render-preview=\"true\"",
|
|
265
|
-
`data-key="${
|
|
266
|
-
`data-variable-type="${
|
|
267
|
-
`aria-label="${
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
`data-key="${r(t)}"`,
|
|
266
|
+
`data-variable-type="${r(o)}"`,
|
|
267
|
+
`aria-label="${r(e?.label || t)}"`,
|
|
268
|
+
a.disabled ? "" : "role=\"button\"",
|
|
269
|
+
a.disabled ? "" : "tabindex=\"0\""
|
|
270
270
|
].filter(Boolean).join(" ");
|
|
271
|
-
return o === "checkbox" ? `<span ${p}><span class="gd-contract-template-renderer__checkbox-mark" aria-hidden="true">${z(
|
|
271
|
+
return o === "checkbox" ? `<span ${p}><span class="gd-contract-template-renderer__checkbox-mark" aria-hidden="true">${z(l) ? "✓" : ""}</span>${i(f)}</span>` : o === "image" && !A(l) ? `<span ${p}></span>` : `<span ${p}>${i(f)}</span>`;
|
|
272
272
|
}
|
|
273
|
-
function F(e, t, n,
|
|
274
|
-
let o = e?.type ?? "text", s = !!
|
|
273
|
+
function F(e, t, n, a) {
|
|
274
|
+
let o = e?.type ?? "text", s = !!a.readonly, l = L(n ?? I(e)), u = c({
|
|
275
275
|
type: o,
|
|
276
276
|
width: e?.width,
|
|
277
277
|
height: e?.height,
|
|
278
278
|
placeholder: e?.placeholder ?? "",
|
|
279
|
-
defaultValue: s ?
|
|
279
|
+
defaultValue: s ? l : "",
|
|
280
280
|
format: e?.format ?? "",
|
|
281
281
|
precision: e?.precision,
|
|
282
282
|
useGrouping: e?.useGrouping,
|
|
@@ -286,15 +286,15 @@ function F(e, t, n, r) {
|
|
|
286
286
|
rows: e?.rows,
|
|
287
287
|
lineHeight: e?.lineHeight,
|
|
288
288
|
style: e?.style
|
|
289
|
-
}), d =
|
|
289
|
+
}), d = a.disabled || s, f = [
|
|
290
290
|
"data-contract-render-control=\"true\"",
|
|
291
|
-
`data-key="${
|
|
292
|
-
`data-variable-type="${
|
|
293
|
-
`aria-label="${
|
|
291
|
+
`data-key="${r(t)}"`,
|
|
292
|
+
`data-variable-type="${r(o)}"`,
|
|
293
|
+
`aria-label="${r(e?.label || t)}"`,
|
|
294
294
|
d ? "disabled" : "",
|
|
295
295
|
s ? "readonly" : ""
|
|
296
|
-
].filter(Boolean).join(" "), p = `style="${
|
|
297
|
-
return o === "checkbox" ? `<label class="${m}" ${p} data-contract-render-wrapper="true" data-key="${
|
|
296
|
+
].filter(Boolean).join(" "), p = `style="${r(u.styleText)}"`, m = r(["gd-contract-template-renderer__control", ...u.classes].join(" "));
|
|
297
|
+
return o === "checkbox" ? `<label class="${m}" ${p} data-contract-render-wrapper="true" data-key="${r(t)}"><input type="checkbox" ${f} ${z(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 || "")}">` : 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
298
|
}
|
|
299
299
|
function I(e) {
|
|
300
300
|
if (!e) return "";
|
|
@@ -314,23 +314,23 @@ function R(e) {
|
|
|
314
314
|
function z(e) {
|
|
315
315
|
return e === !0 || e === "true" || e === "1" || e === "yes" || e === "是" || e === "已选";
|
|
316
316
|
}
|
|
317
|
-
function B(
|
|
318
|
-
if (
|
|
319
|
-
let
|
|
320
|
-
return
|
|
317
|
+
function B(t) {
|
|
318
|
+
if (e()) {
|
|
319
|
+
let e = new DOMParser().parseFromString(t, "text/html");
|
|
320
|
+
return e.querySelectorAll("script,style,meta,link,iframe,object,embed").forEach((e) => e.remove()), e.querySelectorAll("*").forEach((e) => {
|
|
321
321
|
Array.from(e.attributes).forEach((t) => {
|
|
322
322
|
let n = t.name.toLowerCase();
|
|
323
323
|
(n.startsWith("on") || n === "srcdoc" || x.has(n) && U(t.value) || n === "style" && G(t.value)) && e.removeAttribute(t.name);
|
|
324
324
|
});
|
|
325
|
-
}),
|
|
325
|
+
}), e.body.innerHTML;
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
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
328
|
let a = r ?? i ?? "";
|
|
329
329
|
return U(a) ? "" : n ? ` ${t}=${n}${a}${n}` : ` ${t}=${a}`;
|
|
330
330
|
}).replace(/\s+style\s*=\s*(["'])(.*?)\1/gi, (e, t, n) => G(n) ? "" : ` style=${t}${n}${t}`);
|
|
331
331
|
}
|
|
332
332
|
function V(e) {
|
|
333
|
-
return
|
|
333
|
+
return n(e, S, (e) => a(e, "data-key"));
|
|
334
334
|
}
|
|
335
335
|
function H(e) {
|
|
336
336
|
let t = [];
|