@vtj/renderer 0.13.7 → 0.13.9
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/index.cjs +7 -7
- package/dist/index.mjs +432 -430
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
1
|
+
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as L, HistoryModel as Ee } from "@vtj/core";
|
2
|
+
import { isUrl as se, url as F, dedupArray as Ve, isString as C, isFunction as q, logger as k, storage as X, cookie as Y, toArray as ye, unRSA as _e, delay as J, createRequest as be, jsonp as Re, merge as Qe, pathToRegexp as We, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as we, camelCase as P, isObject as et, upperFirst as tt, pick as st, request as ne, loadScript as Se, Storage as nt, mapToObject as ue } from "@vtj/utils";
|
3
3
|
import * as z from "vue";
|
4
|
-
import { inject as
|
5
|
-
import { useRoute as
|
4
|
+
import { inject as Pe, defineComponent as Ce, h as re, ref as oe, watchEffect as rt, defineAsyncComponent as $e } from "vue";
|
5
|
+
import { useRoute as Ae } from "vue-router";
|
6
6
|
/**!
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.13.
|
10
|
+
* @version 0.13.9
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const O = "0.13.
|
13
|
+
const O = "0.13.9";
|
14
14
|
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
15
|
-
const
|
15
|
+
const je = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
18
18
|
"$nextTick",
|
@@ -55,7 +55,7 @@ const $e = [
|
|
55
55
|
Object,
|
56
56
|
Function,
|
57
57
|
Date
|
58
|
-
}, D = "VtjPage",
|
58
|
+
}, D = "VtjPage", N = "VtjHomepage", at = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(
|
59
59
|
","
|
60
60
|
), ct = "component,slot".split(","), vs = [
|
61
61
|
"h",
|
@@ -140,7 +140,7 @@ const $e = [
|
|
140
140
|
privateKey: "MIIBOgIBAAJBAKoIzmn1FYQ1YOhOBw9EhABxZ+PySAIaydI+zdhoKflrdgJ4A5E4/5gbQmRpk09hPWG8nvX7h+l/QLU8kXxAIBECAwEAAQJAAlgpxQY6sByLsXqzJcthC8LSGsLf2JEJkHwlnpwFqlEV8UCkoINpuZ2Wzl+aftURu5rIfAzRCQBvHmeOTW9/zQIhAO5ufWDmnSLyfAAsNo5JRNpVuLFCFodR8Xm+ulDlosR/AiEAtpAltyP9wmCABKG/v/hrtTr3mcvFNGCjoGa9bUAok28CIHbrVs9w1ijrBlvTsXYwJw46uP539uKRRT4ymZzlm9QjAiB+1KH/G9f9pEEL9rtaSOG7JF5D0JcOjlze4MGVFs+ZrQIhALKOUFBNr2zEsyJIjw2PlvEucdlG77UniszjXTROHSPd"
|
141
141
|
};
|
142
142
|
function B(n, e) {
|
143
|
-
return n.map((t) =>
|
143
|
+
return n.map((t) => se(t) || t.startsWith("/") ? t : `${e}${t}`);
|
144
144
|
}
|
145
145
|
function G(n) {
|
146
146
|
return /\.css$/.test(n);
|
@@ -165,21 +165,21 @@ function ut(n, e = !1) {
|
|
165
165
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
166
166
|
}
|
167
167
|
function ft(n, e, t = !1) {
|
168
|
-
const s = n.filter((h) => !!h.enabled), r = [], o = [],
|
168
|
+
const s = n.filter((h) => !!h.enabled), r = [], o = [], i = [], a = [], l = {}, c = {}, u = [], f = {};
|
169
169
|
return s.forEach(
|
170
170
|
({ urls: h, assetsUrl: d, library: p, assetsLibrary: g, localeLibrary: v }) => {
|
171
171
|
h?.forEach((m) => {
|
172
172
|
V(m) && r.push(ut(m, t)), G(m) && o.push(m);
|
173
|
-
}), p && (
|
173
|
+
}), p && (a.push(p), l[p] = B(h || [], e), v && (c[p] = v)), d && i.push(d), g && u.push(g), p && g && (f[g] = p);
|
174
174
|
}
|
175
175
|
), {
|
176
176
|
scripts: B(r, e),
|
177
177
|
css: B(o, e),
|
178
|
-
materials: B(
|
179
|
-
libraryExports:
|
180
|
-
materialExports: Ve(
|
181
|
-
materialMapLibrary:
|
182
|
-
libraryMap:
|
178
|
+
materials: B(i, e),
|
179
|
+
libraryExports: a,
|
180
|
+
materialExports: Ve(u),
|
181
|
+
materialMapLibrary: f,
|
182
|
+
libraryMap: l,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
185
185
|
}
|
@@ -196,37 +196,37 @@ function dt(n = []) {
|
|
196
196
|
}
|
197
197
|
function ht(n, e) {
|
198
198
|
const t = (c) => {
|
199
|
-
const
|
200
|
-
let
|
201
|
-
for (;
|
202
|
-
if (/\s/.test(c[
|
203
|
-
|
199
|
+
const u = [];
|
200
|
+
let f = 0;
|
201
|
+
for (; f < c.length; ) {
|
202
|
+
if (/\s/.test(c[f])) {
|
203
|
+
f++;
|
204
204
|
continue;
|
205
205
|
}
|
206
|
-
if (c.substring(
|
207
|
-
const m = c.indexOf("*/",
|
206
|
+
if (c.substring(f, f + 2) === "/*") {
|
207
|
+
const m = c.indexOf("*/", f + 2);
|
208
208
|
if (m !== -1) {
|
209
|
-
|
209
|
+
f = m + 2;
|
210
210
|
continue;
|
211
211
|
}
|
212
212
|
}
|
213
|
-
if (c[
|
214
|
-
const m =
|
215
|
-
for (;
|
216
|
-
|
217
|
-
const b = c.substring(m,
|
218
|
-
if (c[
|
219
|
-
|
213
|
+
if (c[f] === "@") {
|
214
|
+
const m = f;
|
215
|
+
for (; f < c.length && c[f] !== "{" && c[f] !== ";"; )
|
216
|
+
f++;
|
217
|
+
const b = c.substring(m, f).trim(), y = b.includes("@keyframes");
|
218
|
+
if (c[f] === ";")
|
219
|
+
u.push({
|
220
220
|
type: "simple-at-rule",
|
221
|
-
content: c.substring(m,
|
222
|
-
}),
|
223
|
-
else if (c[
|
224
|
-
const x =
|
221
|
+
content: c.substring(m, f + 1)
|
222
|
+
}), f++;
|
223
|
+
else if (c[f] === "{") {
|
224
|
+
const x = f + 1;
|
225
225
|
let A = 1;
|
226
|
-
for (
|
227
|
-
c[
|
228
|
-
const Q = c.substring(m,
|
229
|
-
|
226
|
+
for (f++; f < c.length && A > 0; )
|
227
|
+
c[f] === "{" ? A++ : c[f] === "}" && A--, f++;
|
228
|
+
const Q = c.substring(m, f), R = c.substring(x, f - 1);
|
229
|
+
u.push({
|
230
230
|
type: y ? "keyframes" : "at-rule",
|
231
231
|
rule: b,
|
232
232
|
content: Q,
|
@@ -235,119 +235,119 @@ function ht(n, e) {
|
|
235
235
|
}
|
236
236
|
continue;
|
237
237
|
}
|
238
|
-
const h =
|
239
|
-
for (;
|
240
|
-
|
241
|
-
if (
|
242
|
-
const d = c.substring(h,
|
238
|
+
const h = f;
|
239
|
+
for (; f < c.length && c[f] !== "{"; )
|
240
|
+
f++;
|
241
|
+
if (f >= c.length) break;
|
242
|
+
const d = c.substring(h, f).trim();
|
243
243
|
if (!d) {
|
244
|
-
|
244
|
+
f++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const p =
|
247
|
+
const p = f + 1;
|
248
248
|
let g = 1;
|
249
|
-
for (
|
250
|
-
c[
|
251
|
-
const v = c.substring(p,
|
252
|
-
|
249
|
+
for (f++; f < c.length && g > 0; )
|
250
|
+
c[f] === "{" ? g++ : c[f] === "}" && g--, f++;
|
251
|
+
const v = c.substring(p, f - 1);
|
252
|
+
u.push({
|
253
253
|
type: "rule",
|
254
254
|
selector: d,
|
255
255
|
content: v.trim()
|
256
256
|
});
|
257
257
|
}
|
258
|
-
return
|
258
|
+
return u;
|
259
259
|
}, s = (c) => {
|
260
|
-
const
|
261
|
-
return /^(from|to|\d+(\.\d+)?%)$/.test(
|
262
|
-
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (
|
263
|
-
const d =
|
260
|
+
const u = c.trim();
|
261
|
+
return /^(from|to|\d+(\.\d+)?%)$/.test(u);
|
262
|
+
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (u, f, h) => {
|
263
|
+
const d = f.trim(), p = h.trim();
|
264
264
|
return d ? `${d}[${e}] ${p}` : p;
|
265
265
|
}), o = (c) => {
|
266
|
-
const
|
267
|
-
if (!
|
268
|
-
return
|
269
|
-
const
|
270
|
-
if (
|
271
|
-
const [, h, d = ""] =
|
272
|
-
return p ? `${p}[${e}]${d}` :
|
266
|
+
const u = c.trim();
|
267
|
+
if (!u || u.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(u) || s(u))
|
268
|
+
return u;
|
269
|
+
const f = u.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
|
+
if (f) {
|
271
|
+
const [, h, d = ""] = f, p = h.trim();
|
272
|
+
return p ? `${p}[${e}]${d}` : u;
|
273
273
|
}
|
274
|
-
return `${
|
275
|
-
},
|
276
|
-
switch (
|
274
|
+
return `${u}[${e}]`;
|
275
|
+
}, i = (c) => r(c).split(",").map((f) => o(f)).filter((f) => f.trim()).join(", "), a = (c) => c.map((u) => {
|
276
|
+
switch (u.type) {
|
277
277
|
case "simple-at-rule":
|
278
|
-
return
|
278
|
+
return u.content;
|
279
279
|
case "keyframes":
|
280
|
-
return
|
280
|
+
return u.content;
|
281
281
|
case "at-rule":
|
282
282
|
try {
|
283
|
-
const h = t(
|
284
|
-
return `${
|
283
|
+
const h = t(u.inner), d = a(h);
|
284
|
+
return `${u.rule} { ${d} }`;
|
285
285
|
} catch {
|
286
|
-
return
|
286
|
+
return u.content;
|
287
287
|
}
|
288
288
|
case "rule":
|
289
|
-
if (!
|
289
|
+
if (!u.selector || !u.content)
|
290
290
|
return "";
|
291
|
-
const
|
292
|
-
return
|
291
|
+
const f = i(u.selector);
|
292
|
+
return f.trim() ? `${f} { ${u.content} }` : "";
|
293
293
|
default:
|
294
294
|
return "";
|
295
295
|
}
|
296
|
-
}).filter((
|
296
|
+
}).filter((u) => u.trim()).join(" "), l = (c) => c.replace(/\s*{\s*/g, " { ").replace(/\s*}\s*/g, " } ").replace(/\s*;\s*/g, "; ").replace(/\s*,\s*/g, ", ").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "").replace(/\s*}\s*}/g, " } }").trim();
|
297
297
|
try {
|
298
298
|
const c = n.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g, "").replace(/^\s+|\s+$/gm, "").replace(/\n\s*\n/g, `
|
299
|
-
`),
|
300
|
-
return f
|
299
|
+
`), u = t(c), f = a(u);
|
300
|
+
return l(f);
|
301
301
|
} catch (c) {
|
302
302
|
return console.error("CSS scoping failed:", c), console.error("Input CSS:", n), n.replace(/\/\*[\s\S]*?\*\//g, "").replace(
|
303
303
|
/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,
|
304
|
-
(
|
305
|
-
).replace(/([^{}@]+)(?=\s*{)/g, (
|
306
|
-
const
|
307
|
-
return !
|
304
|
+
(u) => u
|
305
|
+
).replace(/([^{}@]+)(?=\s*{)/g, (u) => {
|
306
|
+
const f = u.trim();
|
307
|
+
return !f || f.startsWith("@") || f.includes(`[${e}]`) || s(f) ? u : `${f}[${e}]`;
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
311
|
-
function
|
311
|
+
function Ie(n) {
|
312
312
|
return C(n) ? n : JSON.stringify(n);
|
313
313
|
}
|
314
|
-
function
|
315
|
-
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e,
|
314
|
+
function fe(n, e, t, s = !1) {
|
315
|
+
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, i = s ? ht(t, o) : t;
|
316
316
|
if (r.prototype.replaceSync) {
|
317
|
-
const
|
318
|
-
|
319
|
-
const
|
320
|
-
(
|
317
|
+
const a = new r();
|
318
|
+
a.id = e, a.replaceSync(i);
|
319
|
+
const l = n.document, c = l.adoptedStyleSheets, u = Array.from(c).filter(
|
320
|
+
(f) => f.id !== e
|
321
321
|
);
|
322
|
-
|
322
|
+
l.adoptedStyleSheets = [...u, a];
|
323
323
|
} else {
|
324
|
-
const
|
325
|
-
let
|
326
|
-
|
324
|
+
const a = n.document;
|
325
|
+
let l = a.getElementById(e);
|
326
|
+
l ? l.innerHTML = i : (l = a.createElement("style"), l.id = e, l.innerHTML = i, a.head.appendChild(l));
|
327
327
|
}
|
328
328
|
}
|
329
329
|
async function mt(n, e) {
|
330
330
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
331
|
-
t &&
|
331
|
+
t && fe(window, n, t);
|
332
332
|
}
|
333
|
-
function
|
333
|
+
function Fe(n, e = window) {
|
334
334
|
const t = e.document, s = e.document.head;
|
335
335
|
for (const r of n)
|
336
336
|
if (!t.getElementById(r)) {
|
337
|
-
const
|
338
|
-
|
337
|
+
const i = t.createElement("link");
|
338
|
+
i.rel = "stylesheet", i.id = r, i.href = r, s.appendChild(i);
|
339
339
|
}
|
340
340
|
}
|
341
|
-
async function
|
341
|
+
async function ke(n, e, t = window) {
|
342
342
|
const s = t.document, r = t.document.head;
|
343
343
|
let o = t[e];
|
344
|
-
return o ? o.default || o : new Promise((
|
345
|
-
for (const
|
344
|
+
return o ? o.default || o : new Promise((i, a) => {
|
345
|
+
for (const l of n) {
|
346
346
|
const c = s.createElement("script");
|
347
|
-
c.src =
|
348
|
-
o = t[e], o ?
|
349
|
-
}, c.onerror = (
|
350
|
-
|
347
|
+
c.src = l, c.onload = () => {
|
348
|
+
o = t[e], o ? i(o.default || o) : a(null);
|
349
|
+
}, c.onerror = (u) => {
|
350
|
+
a(u);
|
351
351
|
}, r.appendChild(c);
|
352
352
|
}
|
353
353
|
});
|
@@ -377,13 +377,13 @@ function H(n, e, t = !1, s = !1, r = !1) {
|
|
377
377
|
try {
|
378
378
|
const o = ['"use strict";', "var __self = arguments[0];"];
|
379
379
|
o.push("return ");
|
380
|
-
let
|
381
|
-
r || (
|
382
|
-
`) +
|
383
|
-
const
|
384
|
-
${
|
385
|
-
` : `with(${t ? "{}" : "$scope || {}"}) { ${
|
386
|
-
return new Function("$scope",
|
380
|
+
let i = (n.value || "").trim();
|
381
|
+
r || (i = i.replace(/this(\W|$)/g, (l, c) => `__self${c}`)), i = o.join(`
|
382
|
+
`) + i;
|
383
|
+
const a = r ? `
|
384
|
+
${i}
|
385
|
+
` : `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
386
|
+
return new Function("$scope", a)(e);
|
387
387
|
} catch (o) {
|
388
388
|
if (k.error("parseExpression.error", o, n, e?.__self ?? e), s)
|
389
389
|
throw o;
|
@@ -425,8 +425,8 @@ const wt = {
|
|
425
425
|
noPermissionMessage: "无权限访问该页面",
|
426
426
|
appName: "",
|
427
427
|
statusKey: "code"
|
428
|
-
},
|
429
|
-
class
|
428
|
+
}, Me = Symbol("access");
|
429
|
+
class pe {
|
430
430
|
options;
|
431
431
|
data = null;
|
432
432
|
mode = _.Raw;
|
@@ -469,14 +469,14 @@ class fe {
|
|
469
469
|
}
|
470
470
|
can(e) {
|
471
471
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
472
|
-
return typeof e == "function" ? e(s) :
|
472
|
+
return typeof e == "function" ? e(s) : ye(e).every((o) => s[o] || s[t + "." + o]);
|
473
473
|
}
|
474
474
|
some(e) {
|
475
475
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
476
|
-
return
|
476
|
+
return ye(e).some((o) => s[o] || s[t + "." + o]);
|
477
477
|
}
|
478
478
|
install(e) {
|
479
|
-
e.config.globalProperties.$access = this, e.provide(
|
479
|
+
e.config.globalProperties.$access = this, e.provide(Me, this);
|
480
480
|
}
|
481
481
|
isAuthPath(e) {
|
482
482
|
const { auth: t, isAuth: s } = this.options;
|
@@ -497,7 +497,7 @@ class fe {
|
|
497
497
|
setData(e) {
|
498
498
|
const { privateKey: t } = this.options;
|
499
499
|
if (Array.isArray(e) && t) {
|
500
|
-
const s = e.map((r) =>
|
500
|
+
const s = e.map((r) => _e(r, t));
|
501
501
|
try {
|
502
502
|
this.data = JSON.parse(s.join(""));
|
503
503
|
} catch (r) {
|
@@ -507,7 +507,7 @@ class fe {
|
|
507
507
|
}
|
508
508
|
if (typeof e == "string")
|
509
509
|
try {
|
510
|
-
const s = t ?
|
510
|
+
const s = t ? _e(e, t) : e;
|
511
511
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
512
512
|
} catch (s) {
|
513
513
|
console.warn(s);
|
@@ -580,7 +580,7 @@ class fe {
|
|
580
580
|
}
|
581
581
|
}
|
582
582
|
function St() {
|
583
|
-
return
|
583
|
+
return Pe(Me, null);
|
584
584
|
}
|
585
585
|
function js(n = {}) {
|
586
586
|
const {
|
@@ -589,42 +589,42 @@ function js(n = {}) {
|
|
589
589
|
settings: s = {},
|
590
590
|
Startup: r,
|
591
591
|
access: o,
|
592
|
-
useTitle:
|
593
|
-
alert:
|
592
|
+
useTitle: i,
|
593
|
+
alert: a
|
594
594
|
} = n;
|
595
|
-
let
|
595
|
+
let l = null;
|
596
596
|
return {
|
597
|
-
request:
|
597
|
+
request: be({
|
598
598
|
settings: {
|
599
599
|
type: "form",
|
600
600
|
validSuccess: !0,
|
601
601
|
originResponse: !1,
|
602
602
|
loading: !0,
|
603
|
-
validate: (
|
603
|
+
validate: (u) => u.data?.code === 0 || !!u.data?.success,
|
604
604
|
failMessage: !0,
|
605
|
-
showError: (
|
606
|
-
e && e(
|
605
|
+
showError: (u) => {
|
606
|
+
e && e(u || "未知错误");
|
607
607
|
},
|
608
608
|
showLoading: () => {
|
609
|
-
|
609
|
+
l && l.close(), t && (l = t());
|
610
610
|
},
|
611
611
|
hideLoading: () => {
|
612
|
-
|
612
|
+
l && (l.close(), l = null);
|
613
613
|
},
|
614
614
|
...s
|
615
615
|
}
|
616
616
|
}),
|
617
|
-
jsonp:
|
617
|
+
jsonp: Re,
|
618
618
|
notify: e,
|
619
619
|
loading: t,
|
620
|
-
useTitle:
|
621
|
-
alert:
|
620
|
+
useTitle: i,
|
621
|
+
alert: a,
|
622
622
|
startupComponent: r,
|
623
|
-
access: o ? new
|
623
|
+
access: o ? new pe({ alert: a, ...o }) : void 0
|
624
624
|
};
|
625
625
|
}
|
626
626
|
function Es(n = {}) {
|
627
|
-
return new
|
627
|
+
return new pe(n);
|
628
628
|
}
|
629
629
|
function $t(n, e) {
|
630
630
|
const { jsonp: t, request: s } = e;
|
@@ -642,19 +642,19 @@ function $t(n, e) {
|
|
642
642
|
headers: r
|
643
643
|
}
|
644
644
|
};
|
645
|
-
return (
|
645
|
+
return (i, a) => (delete o.data, s.send(Qe(o, a || {}, { data: i })));
|
646
646
|
}
|
647
647
|
}
|
648
648
|
function jt(n, e) {
|
649
649
|
const { metaQuery: t } = e;
|
650
650
|
if (!t) return;
|
651
651
|
const { code: s, queryCode: r } = n;
|
652
|
-
return (o,
|
652
|
+
return (o, i) => {
|
653
653
|
if (!t) {
|
654
654
|
console.warn("adapter.metaQuery is not defined!");
|
655
655
|
return;
|
656
656
|
}
|
657
|
-
return t(s, r, o,
|
657
|
+
return t(s, r, o, i);
|
658
658
|
};
|
659
659
|
}
|
660
660
|
function Et(n = [], e = [], t) {
|
@@ -667,7 +667,7 @@ function Et(n = [], e = [], t) {
|
|
667
667
|
}
|
668
668
|
async function bt(n = [], e = window) {
|
669
669
|
const t = T(e);
|
670
|
-
t && (
|
670
|
+
t && (Oe(e), n.forEach((s) => Pt(t, s)));
|
671
671
|
}
|
672
672
|
function Rt(n, e = window) {
|
673
673
|
const t = S(n.mockTemplate) && n.mockTemplate.value ? E(n.mockTemplate, {}, !0) : void 0, s = T(e);
|
@@ -676,8 +676,8 @@ function Rt(n, e = window) {
|
|
676
676
|
if (t)
|
677
677
|
try {
|
678
678
|
o = await t.apply(t, r);
|
679
|
-
} catch (
|
680
|
-
k.warn("模拟数据模版异常",
|
679
|
+
} catch (i) {
|
680
|
+
k.warn("模拟数据模版异常", i);
|
681
681
|
}
|
682
682
|
return s?.mock(o);
|
683
683
|
};
|
@@ -685,15 +685,18 @@ function Rt(n, e = window) {
|
|
685
685
|
function Pt(n, e) {
|
686
686
|
if (!e.mock) return;
|
687
687
|
const { url: t, mockTemplate: s } = e;
|
688
|
-
if (t && s)
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
688
|
+
if (t && s)
|
689
|
+
try {
|
690
|
+
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`), i = Xe(r, { decode: decodeURIComponent }), a = H(s, {}, !0);
|
691
|
+
n.mock(o, (l) => {
|
692
|
+
const c = F.parse(l.url) || {}, u = l.body instanceof FormData ? Ye(l.body) : l.body, f = se(l.url) ? new URL(l.url).pathname : l.url.split("?")[0], h = i(f)?.params;
|
693
|
+
return Object.assign(l, { data: u, params: h, query: c }), n.mock(a(l));
|
694
|
+
});
|
695
|
+
} catch (r) {
|
696
|
+
console.warn("mockApi", r);
|
697
|
+
}
|
695
698
|
}
|
696
|
-
function
|
699
|
+
function Oe(n = window) {
|
697
700
|
const e = T(n);
|
698
701
|
e && (e._mocked = {});
|
699
702
|
}
|
@@ -740,12 +743,12 @@ class Ct {
|
|
740
743
|
});
|
741
744
|
}
|
742
745
|
__proxy() {
|
743
|
-
this.__instance &&
|
746
|
+
this.__instance && je.forEach((e) => {
|
744
747
|
this[e] = this.__instance?.[e];
|
745
748
|
});
|
746
749
|
}
|
747
750
|
__cleanup() {
|
748
|
-
|
751
|
+
je.forEach((e) => {
|
749
752
|
this[e] = null;
|
750
753
|
}), this.__reset();
|
751
754
|
}
|
@@ -796,40 +799,40 @@ class Ct {
|
|
796
799
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
797
800
|
}
|
798
801
|
}
|
799
|
-
function
|
802
|
+
function ie(n) {
|
800
803
|
const {
|
801
804
|
Vue: e = z,
|
802
805
|
mode: t = _.Runtime,
|
803
806
|
components: s = {},
|
804
807
|
libs: r = {},
|
805
808
|
apis: o = {},
|
806
|
-
loader:
|
807
|
-
} = n,
|
809
|
+
loader: i
|
810
|
+
} = n, a = e.computed(() => n.dsl), l = {
|
808
811
|
$components: s,
|
809
812
|
$libs: r,
|
810
813
|
$apis: o
|
811
814
|
}, c = new Ct({
|
812
815
|
mode: t,
|
813
|
-
dsl:
|
814
|
-
attrs:
|
815
|
-
}),
|
816
|
-
name:
|
817
|
-
__scopeId:
|
816
|
+
dsl: a.value,
|
817
|
+
attrs: l
|
818
|
+
}), u = e.defineComponent({
|
819
|
+
name: a.value.name,
|
820
|
+
__scopeId: a.value.id ? `data-v-${a.value.id}` : void 0,
|
818
821
|
props: {
|
819
|
-
...It(
|
822
|
+
...It(a.value.props ?? [], c)
|
820
823
|
},
|
821
|
-
setup(
|
822
|
-
c.$props =
|
824
|
+
setup(f) {
|
825
|
+
c.$props = f, c.props = f, a.value.id && fe(
|
823
826
|
n.window || window,
|
824
|
-
|
825
|
-
|
827
|
+
a.value.id,
|
828
|
+
a.value.css || "",
|
826
829
|
!0
|
827
|
-
), c.state = Ft(e,
|
828
|
-
const h = kt(e,
|
830
|
+
), c.state = Ft(e, a.value.state ?? {}, c);
|
831
|
+
const h = kt(e, a.value.computed ?? {}, c), d = Mt(a.value.methods ?? {}, c), p = Ot(e, a.value.inject, c);
|
829
832
|
for (const [m, b] of Object.entries(p || {}))
|
830
833
|
p[m] = e.inject(m, b);
|
831
834
|
const g = Dt(
|
832
|
-
|
835
|
+
a.value.dataSources || {},
|
833
836
|
c
|
834
837
|
), v = {
|
835
838
|
...p,
|
@@ -837,23 +840,23 @@ function oe(n) {
|
|
837
840
|
...d,
|
838
841
|
...g
|
839
842
|
};
|
840
|
-
return c.setup(v, e), Tt(e,
|
843
|
+
return c.setup(v, e), Tt(e, a.value.watch ?? [], c), {
|
841
844
|
vtj: c
|
842
845
|
};
|
843
846
|
},
|
844
|
-
emits: At(
|
847
|
+
emits: At(a.value.emits),
|
845
848
|
expose: ["vtj"],
|
846
849
|
render() {
|
847
|
-
if (!
|
848
|
-
const
|
849
|
-
return
|
850
|
-
(h) => M(h, c, e,
|
850
|
+
if (!a.value.nodes) return null;
|
851
|
+
const f = a.value.nodes || [];
|
852
|
+
return f.length === 1 ? M(f[0], c, e, i, f) : f.map(
|
853
|
+
(h) => M(h, c, e, i, f)
|
851
854
|
);
|
852
855
|
},
|
853
|
-
...Ht(
|
856
|
+
...Ht(a.value.lifeCycles ?? {}, c)
|
854
857
|
});
|
855
858
|
return {
|
856
|
-
renderer: e.markRaw(
|
859
|
+
renderer: e.markRaw(u),
|
857
860
|
context: c
|
858
861
|
};
|
859
862
|
}
|
@@ -904,10 +907,10 @@ function Mt(n, e) {
|
|
904
907
|
function Ot(n, e = [], t) {
|
905
908
|
return e.reduce(
|
906
909
|
(s, r) => {
|
907
|
-
const { name: o, from:
|
910
|
+
const { name: o, from: i } = r || {};
|
908
911
|
r.default;
|
909
|
-
const
|
910
|
-
return s[o] = n.inject(
|
912
|
+
const a = j(i) ? t.__parseExpression(i) || o : i ?? o, l = j(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
913
|
+
return s[o] = n.inject(a, l), s;
|
911
914
|
},
|
912
915
|
{}
|
913
916
|
);
|
@@ -919,10 +922,10 @@ function Dt(n, e) {
|
|
919
922
|
if (r.type === "mock")
|
920
923
|
t[s] = Rt(r);
|
921
924
|
else if (r.ref) {
|
922
|
-
const o = e.$apis[r.ref],
|
923
|
-
t[s] = async (...
|
924
|
-
const
|
925
|
-
return
|
925
|
+
const o = e.$apis[r.ref], i = S(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
926
|
+
t[s] = async (...a) => {
|
927
|
+
const l = await o.apply(e, a);
|
928
|
+
return i ? i(l) : l;
|
926
929
|
};
|
927
930
|
}
|
928
931
|
return t;
|
@@ -953,84 +956,84 @@ function Ht(n, e) {
|
|
953
956
|
{}
|
954
957
|
);
|
955
958
|
}
|
956
|
-
const
|
959
|
+
const De = new Ze();
|
957
960
|
let Z = [], I = {};
|
958
961
|
const xt = (n) => n;
|
959
|
-
async function
|
960
|
-
const { urls: t = [], library: s } = n, r = t.filter((
|
962
|
+
async function Te(n, e = window) {
|
963
|
+
const { urls: t = [], library: s } = n, r = t.filter((a) => V(a));
|
961
964
|
if (r.length === 0 || !s) return null;
|
962
|
-
const o = t.filter((
|
963
|
-
return o.length &&
|
964
|
-
(
|
965
|
+
const o = t.filter((a) => G(a));
|
966
|
+
return o.length && Fe(o, e), await ke(r, s, e).catch(
|
967
|
+
(a) => (console.warn("loadScriptUrl error", r, s, a), null)
|
965
968
|
);
|
966
969
|
}
|
967
|
-
function
|
970
|
+
function ae(n) {
|
968
971
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
969
972
|
return s.window && (Z.forEach((r) => {
|
970
973
|
delete s.window[r];
|
971
|
-
}), Z = []), (r, o,
|
974
|
+
}), Z = []), (r, o, i = z) => {
|
972
975
|
if (!o || typeof o == "string") return r;
|
973
976
|
if (o.type === "Schema" && o.id)
|
974
|
-
return
|
975
|
-
const
|
977
|
+
return i.defineAsyncComponent(async () => {
|
978
|
+
const a = I[o.id] || await De.add(
|
976
979
|
o.id,
|
977
980
|
() => e(o.id)
|
978
981
|
);
|
979
|
-
return
|
982
|
+
return a && (a.name = r, I[o.id] = a), a ? ie({
|
980
983
|
...s,
|
981
|
-
Vue:
|
982
|
-
dsl:
|
984
|
+
Vue: i,
|
985
|
+
dsl: we(a),
|
983
986
|
mode: _.Runtime,
|
984
|
-
loader:
|
987
|
+
loader: ae(n)
|
985
988
|
}).renderer : null;
|
986
989
|
});
|
987
990
|
if (o.type === "UrlSchema" && o.url)
|
988
|
-
return
|
989
|
-
const
|
990
|
-
return
|
991
|
+
return i.defineAsyncComponent(async () => {
|
992
|
+
const a = I[o.url] || await t(o.url);
|
993
|
+
return a && (a.name = r, I[o.url] = a), a ? ie({
|
991
994
|
...s,
|
992
|
-
Vue:
|
993
|
-
dsl:
|
995
|
+
Vue: i,
|
996
|
+
dsl: we(a),
|
994
997
|
mode: _.Runtime,
|
995
|
-
loader:
|
998
|
+
loader: ae(n)
|
996
999
|
}).renderer : null;
|
997
1000
|
});
|
998
1001
|
if (o.type === "Plugin") {
|
999
|
-
let
|
1000
|
-
return
|
1002
|
+
let a = o.library ? I[o.library] : null;
|
1003
|
+
return a || (o.library && Z.push(o.library), a = I[o.library || Symbol()] = i.defineAsyncComponent(
|
1001
1004
|
async () => {
|
1002
|
-
const
|
1003
|
-
return
|
1005
|
+
const l = await Te(o, s.window);
|
1006
|
+
return l || (console.warn("getPlugin result is null", o), null);
|
1004
1007
|
}
|
1005
|
-
),
|
1008
|
+
), a);
|
1006
1009
|
}
|
1007
1010
|
return r;
|
1008
1011
|
};
|
1009
1012
|
}
|
1010
1013
|
function bs() {
|
1011
|
-
I = {},
|
1014
|
+
I = {}, De.clearAllCache();
|
1012
1015
|
}
|
1013
1016
|
function M(n, e, t = z, s = xt, r = [], o = !1) {
|
1014
1017
|
if (!n || !n.name || n.invisible) return null;
|
1015
|
-
const
|
1016
|
-
if (!o && (
|
1018
|
+
const i = t.getCurrentInstance()?.appContext, { id: a = null, directives: l = [] } = n, { vIf: c, vElseIf: u, vElse: f, vFor: h, vShow: d, vModels: p, vBind: g, vHtml: v, others: m } = He(l);
|
1019
|
+
if (!o && (u || f))
|
1017
1020
|
return null;
|
1018
|
-
if (c && !
|
1021
|
+
if (c && !Ut(c, e))
|
1019
1022
|
return Jt(n, e, t, s, r);
|
1020
1023
|
const b = (y, x = 0) => {
|
1021
1024
|
const A = y.$components, Q = (() => {
|
1022
1025
|
if (n.name === "component")
|
1023
|
-
return
|
1026
|
+
return Nt(y, n.props?.is);
|
1024
1027
|
if (n.name === "slot") return n.name;
|
1025
1028
|
const $ = s(n.name, n.from, t);
|
1026
1029
|
if (C($))
|
1027
|
-
return vt($) || yt($) ? $ : A[$] ??
|
1030
|
+
return vt($) || yt($) ? $ : A[$] ?? i?.app?.component($) ?? $;
|
1028
1031
|
if (et($) && n.id) {
|
1029
|
-
const
|
1030
|
-
return
|
1032
|
+
const ge = `Loader${n.id}_${x}`, ve = A[ge];
|
1033
|
+
return ve || (A[ge] = $);
|
1031
1034
|
}
|
1032
1035
|
return $;
|
1033
|
-
})(), R = Lt(
|
1036
|
+
})(), R = Lt(a, n.props ?? {}, y), qe = qt(t, n.events ?? {}, y);
|
1034
1037
|
if (n.name === "slot")
|
1035
1038
|
return Kt(t, n, R, y, s);
|
1036
1039
|
g && Object.assign(R, y.__parseExpression(g.value)), d && (R.style = Object.assign(
|
@@ -1039,20 +1042,20 @@ function M(n, e, t = z, s = xt, r = [], o = !1) {
|
|
1039
1042
|
)), v && Object.assign(R, Vt(v, y)), p.forEach(($) => {
|
1040
1043
|
Object.assign(R, Qt(t, $, y));
|
1041
1044
|
});
|
1042
|
-
const
|
1045
|
+
const Je = Wt(
|
1043
1046
|
t,
|
1044
1047
|
n.children ?? [],
|
1045
1048
|
y,
|
1046
1049
|
s,
|
1047
1050
|
n
|
1048
|
-
),
|
1051
|
+
), he = y?.__id ? `data-v-${y.__id}` : void 0, Ke = he ? { [he]: "" } : {};
|
1049
1052
|
let W = t.createVNode(
|
1050
1053
|
Q,
|
1051
|
-
{ key: `${
|
1052
|
-
|
1054
|
+
{ key: `${a}_${x}`, ...Ke, ...R, ...qe },
|
1055
|
+
Je
|
1053
1056
|
);
|
1054
|
-
const
|
1055
|
-
return
|
1057
|
+
const me = i ? Bt(i, m, y) : [];
|
1058
|
+
return me.length && (W = t.withDirectives(W, me)), W;
|
1056
1059
|
};
|
1057
1060
|
return h ? Zt(h, b, e) : b(e);
|
1058
1061
|
}
|
@@ -1061,17 +1064,17 @@ function Bt(n, e, t) {
|
|
1061
1064
|
return e.map((r) => {
|
1062
1065
|
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
1063
1066
|
if (!o) return null;
|
1064
|
-
const
|
1065
|
-
return r.value &&
|
1067
|
+
const i = [o];
|
1068
|
+
return r.value && i.push(t.__parseExpression(r.value)), r.arg && i.push(r.arg), r.modifiers && i.push(r.modifiers), i;
|
1066
1069
|
}).filter((r) => !!r);
|
1067
1070
|
}
|
1068
|
-
function
|
1069
|
-
const e = n.find((
|
1070
|
-
(
|
1071
|
-
), s = n.find((
|
1072
|
-
(
|
1071
|
+
function He(n = []) {
|
1072
|
+
const e = n.find((u) => P(u.name) === "vIf"), t = n.find(
|
1073
|
+
(u) => P(u.name) === "vElseIf"
|
1074
|
+
), s = n.find((u) => P(u.name) === "vElse"), r = n.find((u) => P(u.name) === "vFor"), o = n.find((u) => P(u.name) === "vShow"), i = n.find((u) => P(u.name) === "vBind"), a = n.find((u) => P(u.name) === "vHtml"), l = n.filter(
|
1075
|
+
(u) => P(u.name) === "vModel"
|
1073
1076
|
), c = n.filter(
|
1074
|
-
(
|
1077
|
+
(u) => !ot.includes(P(u.name))
|
1075
1078
|
);
|
1076
1079
|
return {
|
1077
1080
|
vIf: e,
|
@@ -1079,27 +1082,27 @@ function Te(n = []) {
|
|
1079
1082
|
vElse: s,
|
1080
1083
|
vFor: r,
|
1081
1084
|
vShow: o,
|
1082
|
-
vModels:
|
1083
|
-
vBind:
|
1085
|
+
vModels: l,
|
1086
|
+
vBind: i,
|
1084
1087
|
others: c,
|
1085
|
-
vHtml:
|
1088
|
+
vHtml: a
|
1086
1089
|
};
|
1087
1090
|
}
|
1088
|
-
function
|
1091
|
+
function Ut(n, e) {
|
1089
1092
|
return !!e.__parseExpression(n.value);
|
1090
1093
|
}
|
1091
|
-
function
|
1094
|
+
function Nt(n, e) {
|
1092
1095
|
return e ? j(e) ? n.__parseExpression(e) : e : "div";
|
1093
1096
|
}
|
1094
1097
|
function Lt(n, e, t) {
|
1095
|
-
const s =
|
1098
|
+
const s = ce(e, t);
|
1096
1099
|
return s.ref = t.__ref(n, s.ref), s;
|
1097
1100
|
}
|
1098
|
-
function
|
1099
|
-
return j(n) ? e.__parseExpression(n) : S(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) =>
|
1101
|
+
function ce(n, e) {
|
1102
|
+
return j(n) ? e.__parseExpression(n) : S(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => ce(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
1100
1103
|
(t, s) => {
|
1101
1104
|
let r = n[s];
|
1102
|
-
return t[s] =
|
1105
|
+
return t[s] = ce(r, e), t;
|
1103
1106
|
},
|
1104
1107
|
{}
|
1105
1108
|
) : n;
|
@@ -1111,37 +1114,37 @@ function qt(n, e, t) {
|
|
1111
1114
|
passive: "OnceCapture"
|
1112
1115
|
};
|
1113
1116
|
return Object.keys(e || {}).reduce(
|
1114
|
-
(o,
|
1115
|
-
const
|
1116
|
-
return
|
1117
|
+
(o, i) => {
|
1118
|
+
const a = e[i], l = xe(a.modifiers), c = l.find((h) => s.includes(h)), u = "on" + tt(i) + (c && r[c] || ""), f = t.__parseFunction(a.handler);
|
1119
|
+
return f && (o[u] = n.withModifiers(f, l)), o;
|
1117
1120
|
},
|
1118
1121
|
{}
|
1119
1122
|
);
|
1120
1123
|
}
|
1121
1124
|
function Jt(n, e, t, s, r = []) {
|
1122
|
-
let o = r.findIndex((
|
1123
|
-
for (let
|
1124
|
-
const { directives:
|
1125
|
-
if (
|
1126
|
-
if (e.__parseExpression(
|
1127
|
-
return M(r[
|
1125
|
+
let o = r.findIndex((i) => i.id === n.id);
|
1126
|
+
for (let i = ++o; i < r.length; i++) {
|
1127
|
+
const { directives: a = [] } = r[i], { vElseIf: l, vElse: c } = He(a);
|
1128
|
+
if (l) {
|
1129
|
+
if (e.__parseExpression(l.value))
|
1130
|
+
return M(r[i], e, t, s, r, !0);
|
1128
1131
|
continue;
|
1129
1132
|
}
|
1130
1133
|
if (c)
|
1131
|
-
return M(r[
|
1134
|
+
return M(r[i], e, t, s, r, !0);
|
1132
1135
|
}
|
1133
1136
|
return null;
|
1134
1137
|
}
|
1135
|
-
function
|
1138
|
+
function xe(n = {}, e = !1) {
|
1136
1139
|
const t = Object.keys(n);
|
1137
1140
|
return e ? t.map((s) => "." + s) : t;
|
1138
1141
|
}
|
1139
1142
|
function Kt(n, e, t, s, r) {
|
1140
|
-
const { children: o } = e,
|
1141
|
-
return
|
1142
|
-
|
1143
|
+
const { children: o } = e, i = zt(e, s), a = s.$slots?.[i.name];
|
1144
|
+
return a ? a(t) : o ? C(o) ? n.createTextVNode(o) : j(o) ? n.createTextVNode(
|
1145
|
+
Ie(s.__parseExpression(o))
|
1143
1146
|
) : Array.isArray(o) ? o.map(
|
1144
|
-
(
|
1147
|
+
(l) => M(l, s, n, r, o)
|
1145
1148
|
) : null : null;
|
1146
1149
|
}
|
1147
1150
|
function zt(n, e) {
|
@@ -1167,12 +1170,12 @@ function Qt(n, e, t) {
|
|
1167
1170
|
value: e.value?.value ? `(v) => {
|
1168
1171
|
${e.value.value} = v;
|
1169
1172
|
}` : "(v) => {}"
|
1170
|
-
}, r = t.__parseFunction(s), o =
|
1173
|
+
}, r = t.__parseFunction(s), o = xe(
|
1171
1174
|
j(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1172
|
-
),
|
1175
|
+
), i = j(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1173
1176
|
return {
|
1174
|
-
[
|
1175
|
-
[`onUpdate:${
|
1177
|
+
[i]: t.__parseExpression(e.value),
|
1178
|
+
[`onUpdate:${i}`]: o.length && r ? n.withModifiers(r, o) : r
|
1176
1179
|
};
|
1177
1180
|
}
|
1178
1181
|
function Wt(n, e, t, s, r) {
|
@@ -1181,21 +1184,21 @@ function Wt(n, e, t, s, r) {
|
|
1181
1184
|
return { default: () => e };
|
1182
1185
|
if (j(e))
|
1183
1186
|
return {
|
1184
|
-
default: () =>
|
1187
|
+
default: () => Ie(t.__parseExpression(e))
|
1185
1188
|
};
|
1186
1189
|
if (Array.isArray(e) && e.length > 0) {
|
1187
|
-
const o = Xt(e),
|
1188
|
-
[
|
1190
|
+
const o = Xt(e), i = (a, l) => !a || !r ? {} : r?.id && Object.keys(a).length ? l ? {
|
1191
|
+
[l]: a
|
1189
1192
|
} : {
|
1190
|
-
[`scope_${r.id}`]:
|
1191
|
-
} :
|
1193
|
+
[`scope_${r.id}`]: a
|
1194
|
+
} : l ? { [l]: /* @__PURE__ */ Object.create(null) } : {};
|
1192
1195
|
return Object.entries(o).reduce(
|
1193
|
-
(
|
1194
|
-
const d =
|
1196
|
+
(a, [l, { nodes: c, params: u, scope: f }]) => (a[l] = (h) => {
|
1197
|
+
const d = u.length ? st(h ?? {}, u) : i(h, f);
|
1195
1198
|
return c.map(
|
1196
1199
|
(p) => M(p, t.__clone(d), n, s, c)
|
1197
1200
|
);
|
1198
|
-
},
|
1201
|
+
}, a),
|
1199
1202
|
{}
|
1200
1203
|
);
|
1201
1204
|
}
|
@@ -1217,18 +1220,18 @@ function Yt(n = "default") {
|
|
1217
1220
|
return C(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
1218
1221
|
}
|
1219
1222
|
function Zt(n, e, t) {
|
1220
|
-
const { value: s, iterator: r } = n, { item: o = "item", index:
|
1221
|
-
let
|
1222
|
-
return Number.isInteger(
|
1223
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: i = "index" } = r || {};
|
1224
|
+
let a = t.__parseExpression(s) || [];
|
1225
|
+
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((l, c) => c + 1)), Array.isArray(a) ? a.map((l, c) => e(t.__clone({ [o]: l, [i]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1223
1226
|
}
|
1224
|
-
const ee =
|
1227
|
+
const ee = Ce({
|
1225
1228
|
name: "VtjPageContainer",
|
1226
1229
|
async setup() {
|
1227
|
-
const n = Ne(), e =
|
1230
|
+
const n = Ne(), e = Ae(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = oe(Symbol());
|
1228
1231
|
if (s) {
|
1229
1232
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1230
|
-
const { useTitle:
|
1231
|
-
|
1233
|
+
const { useTitle: i } = n?.adapter;
|
1234
|
+
i && i(s.title || "VTJ");
|
1232
1235
|
}
|
1233
1236
|
return {
|
1234
1237
|
provider: n,
|
@@ -1242,44 +1245,44 @@ const ee = Pe({
|
|
1242
1245
|
},
|
1243
1246
|
render() {
|
1244
1247
|
const { component: n, query: e, sid: t } = this;
|
1245
|
-
return n ?
|
1248
|
+
return n ? re(n, { ...e, key: t }) : re("div", "页面不存在");
|
1246
1249
|
},
|
1247
1250
|
activated() {
|
1248
1251
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1249
1252
|
}
|
1250
|
-
}), es =
|
1253
|
+
}), es = Ce({
|
1251
1254
|
name: "VtjStartupContainer",
|
1252
1255
|
render() {
|
1253
|
-
return
|
1256
|
+
return re("div", "page not found!");
|
1254
1257
|
}
|
1255
1258
|
});
|
1256
1259
|
function K(n, e, t = []) {
|
1257
1260
|
const s = [];
|
1258
1261
|
for (const r of t) {
|
1259
|
-
const { id: o, title:
|
1260
|
-
if (
|
1261
|
-
const
|
1262
|
-
s.push(...
|
1262
|
+
const { id: o, title: i, icon: a, children: l, hidden: c, layout: u } = r;
|
1263
|
+
if (u) {
|
1264
|
+
const f = K(n, e, l || []);
|
1265
|
+
s.push(...f);
|
1263
1266
|
} else {
|
1264
|
-
const
|
1267
|
+
const f = {
|
1265
1268
|
id: o,
|
1266
|
-
title:
|
1267
|
-
icon:
|
1269
|
+
title: i,
|
1270
|
+
icon: a,
|
1268
1271
|
hidden: c,
|
1269
1272
|
url: `${n}/${e}/${o}`,
|
1270
|
-
children:
|
1273
|
+
children: l && l.length ? K(n, e, l) : void 0
|
1271
1274
|
};
|
1272
|
-
s.push(
|
1275
|
+
s.push(f);
|
1273
1276
|
}
|
1274
1277
|
}
|
1275
1278
|
return s;
|
1276
1279
|
}
|
1277
|
-
function
|
1280
|
+
function Be(n, e) {
|
1278
1281
|
if (!e) return n;
|
1279
1282
|
let t = [];
|
1280
1283
|
for (const s of n)
|
1281
1284
|
if (s.children && s.children.length) {
|
1282
|
-
const r =
|
1285
|
+
const r = Be(s.children, e);
|
1283
1286
|
r.length && (s.children = r, t.push(s));
|
1284
1287
|
} else
|
1285
1288
|
e.can(s.id.toString()) && t.push(s);
|
@@ -1290,109 +1293,109 @@ function Rs(n) {
|
|
1290
1293
|
menuPathPrefix: e = "",
|
1291
1294
|
pageRouteName: t = "page",
|
1292
1295
|
disableMenusFilter: s = !1
|
1293
|
-
} = n || {}, r = Ne(), o =
|
1294
|
-
|
1296
|
+
} = n || {}, r = Ne(), o = Ae(), i = St(), a = oe(!1), l = oe(!1), c = r.project, u = (d, p) => {
|
1297
|
+
a.value = !d?.mask, l.value = p?.pure ?? !!d?.pure;
|
1295
1298
|
};
|
1296
1299
|
rt(() => {
|
1297
1300
|
const { name: d, params: p, meta: g } = o;
|
1298
1301
|
if (d === D) {
|
1299
1302
|
const v = r.getPage(p.id);
|
1300
|
-
|
1301
|
-
} else if (d ===
|
1303
|
+
u(v, g);
|
1304
|
+
} else if (d === N) {
|
1302
1305
|
const v = r.getHomepage();
|
1303
|
-
|
1306
|
+
u(v, g);
|
1304
1307
|
} else {
|
1305
1308
|
const v = g.__vtj__;
|
1306
1309
|
if (v) {
|
1307
1310
|
const m = r.getPage(v);
|
1308
|
-
|
1311
|
+
u(m, g);
|
1309
1312
|
} else
|
1310
|
-
|
1313
|
+
a.value = !g.mask, l.value = !!g.pure;
|
1311
1314
|
}
|
1312
1315
|
});
|
1313
|
-
const
|
1316
|
+
const f = K(
|
1314
1317
|
e,
|
1315
1318
|
t,
|
1316
1319
|
c?.pages
|
1317
1320
|
), h = c?.config;
|
1318
1321
|
return {
|
1319
|
-
disabled:
|
1322
|
+
disabled: a,
|
1320
1323
|
logo: h?.logo,
|
1321
1324
|
themeSwitchable: h?.themeSwitchable,
|
1322
1325
|
title: h?.title || c?.description || c?.name || "VTJ App",
|
1323
|
-
menus: s ?
|
1324
|
-
pure:
|
1326
|
+
menus: s ? f : Be(f, i),
|
1327
|
+
pure: l
|
1325
1328
|
};
|
1326
1329
|
}
|
1327
1330
|
function te(n, e) {
|
1328
|
-
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix:
|
1331
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: i = "", component: a, routeMeta: l } = e;
|
1329
1332
|
return {
|
1330
1333
|
name: t,
|
1331
|
-
path: `${
|
1332
|
-
component:
|
1334
|
+
path: `${i}${o}/${t}`,
|
1335
|
+
component: a,
|
1333
1336
|
meta: {
|
1334
1337
|
title: s,
|
1335
|
-
...
|
1338
|
+
...l,
|
1336
1339
|
...r,
|
1337
1340
|
__vtj__: t
|
1338
1341
|
}
|
1339
1342
|
};
|
1340
1343
|
}
|
1341
|
-
function
|
1344
|
+
function le(n) {
|
1342
1345
|
const {
|
1343
1346
|
name: e = "page",
|
1344
1347
|
prefix: t = "",
|
1345
1348
|
pages: s = [],
|
1346
1349
|
component: r,
|
1347
1350
|
loader: o,
|
1348
|
-
routeMeta:
|
1349
|
-
homepage:
|
1350
|
-
} = n,
|
1351
|
+
routeMeta: i,
|
1352
|
+
homepage: a
|
1353
|
+
} = n, l = [];
|
1351
1354
|
for (const c of s) {
|
1352
|
-
const { id:
|
1355
|
+
const { id: u, title: f, dir: h, layout: d, children: p, meta: g } = c;
|
1353
1356
|
if (h) {
|
1354
|
-
const v =
|
1357
|
+
const v = le({
|
1355
1358
|
name: e,
|
1356
1359
|
prefix: t,
|
1357
1360
|
component: r,
|
1358
|
-
routeMeta:
|
1359
|
-
homepage:
|
1361
|
+
routeMeta: i,
|
1362
|
+
homepage: a,
|
1360
1363
|
loader: o,
|
1361
1364
|
pages: p || []
|
1362
1365
|
});
|
1363
|
-
|
1366
|
+
l.push(...v);
|
1364
1367
|
} else if (d) {
|
1365
|
-
const v =
|
1368
|
+
const v = le({
|
1366
1369
|
name: e,
|
1367
1370
|
prefix: t,
|
1368
1371
|
component: r,
|
1369
|
-
routeMeta:
|
1370
|
-
homepage:
|
1372
|
+
routeMeta: i,
|
1373
|
+
homepage: a,
|
1371
1374
|
loader: o,
|
1372
1375
|
pages: p || []
|
1373
1376
|
}), m = {
|
1374
|
-
name: `layout_${
|
1377
|
+
name: `layout_${u}`,
|
1375
1378
|
path: t,
|
1376
|
-
component: () => o(
|
1379
|
+
component: () => o(u),
|
1377
1380
|
meta: {
|
1378
|
-
title:
|
1379
|
-
...
|
1381
|
+
title: f,
|
1382
|
+
...i,
|
1380
1383
|
...g,
|
1381
|
-
__vtj__:
|
1384
|
+
__vtj__: u
|
1382
1385
|
},
|
1383
1386
|
children: v
|
1384
1387
|
};
|
1385
|
-
|
1386
|
-
} else if (
|
1388
|
+
l.push(m), l.push(te(c, n));
|
1389
|
+
} else if (l.push(te(c, n)), a === u) {
|
1387
1390
|
const v = te(c, n);
|
1388
|
-
v.path = "", v.name = `home_${
|
1391
|
+
v.path = "", v.name = `home_${u}`, l.push(v);
|
1389
1392
|
}
|
1390
1393
|
}
|
1391
|
-
return
|
1394
|
+
return l;
|
1392
1395
|
}
|
1393
1396
|
function ts(n = {}, e) {
|
1394
|
-
const { css: t, store: s, enhance: r } = n, { window: o, app:
|
1395
|
-
|
1397
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: i, library: a = {}, adapter: l, mode: c } = e, { Pinia: u } = a;
|
1398
|
+
fe(o, "global-css", t || ""), u && s && ss(s, i, u), rs(i, l, n), !l.access && n.access && ns(n.access, i, c, l), os(i, n), r && is(r, i);
|
1396
1399
|
}
|
1397
1400
|
function ss(n, e, t) {
|
1398
1401
|
const s = t.createPinia();
|
@@ -1403,47 +1406,47 @@ function ss(n, e, t) {
|
|
1403
1406
|
}
|
1404
1407
|
function ns(n, e, t, s) {
|
1405
1408
|
if (S(n) && n.value) {
|
1406
|
-
const r = E(n, {}, !1, !1, !0), { alert: o, request:
|
1409
|
+
const r = E(n, {}, !1, !1, !0), { alert: o, request: i } = s, a = new pe({
|
1407
1410
|
alert: o,
|
1408
1411
|
storagePrefix: "__VTJ_APP_",
|
1409
1412
|
...r(e)
|
1410
|
-
}),
|
1411
|
-
|
1413
|
+
}), l = e.config.globalProperties.$router;
|
1414
|
+
a.connect({ mode: t, router: l, request: i }), e.use(a);
|
1412
1415
|
}
|
1413
1416
|
}
|
1414
1417
|
function rs(n, e, t) {
|
1415
1418
|
if (!e.request) return;
|
1416
1419
|
const { axios: s, request: r, response: o } = t;
|
1417
1420
|
if (s && S(s) && s.value) {
|
1418
|
-
const
|
1419
|
-
e.request.setConfig(
|
1421
|
+
const i = E(s, {}, !1, !1, !0);
|
1422
|
+
e.request.setConfig(i(n));
|
1420
1423
|
}
|
1421
1424
|
if (r && S(r) && r.value) {
|
1422
|
-
const
|
1423
|
-
e.request.useRequest((
|
1425
|
+
const i = E(r, {}, !1, !1, !0);
|
1426
|
+
e.request.useRequest((a) => i(a, n));
|
1424
1427
|
}
|
1425
1428
|
if (o && S(o) && o.value) {
|
1426
|
-
const
|
1427
|
-
e.request.useResponse((
|
1429
|
+
const i = E(o, {}, !1, !1, !0);
|
1430
|
+
e.request.useResponse((a) => i(a, n));
|
1428
1431
|
}
|
1429
1432
|
}
|
1430
1433
|
function os(n, e) {
|
1431
1434
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
1432
1435
|
if (t && S(t) && t.value) {
|
1433
1436
|
const o = E(t, {}, !1, !1, !0);
|
1434
|
-
r && r.beforeEach((
|
1437
|
+
r && r.beforeEach((i, a, l) => o(i, a, l, n));
|
1435
1438
|
}
|
1436
1439
|
if (s && S(s) && s.value) {
|
1437
1440
|
const o = E(s, {}, !1, !1, !0);
|
1438
|
-
r && r.afterEach((
|
1441
|
+
r && r.afterEach((i, a, l) => o(i, a, l, n));
|
1439
1442
|
}
|
1440
1443
|
}
|
1441
1444
|
function is(n, e) {
|
1442
1445
|
S(n) && n.value && E(n, {}, !1, !1, !0)(e);
|
1443
1446
|
}
|
1444
|
-
const
|
1447
|
+
const Ue = Symbol("Provider");
|
1445
1448
|
var as = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(as || {});
|
1446
|
-
class cs extends
|
1449
|
+
class cs extends ze {
|
1447
1450
|
// DSL缓存
|
1448
1451
|
/**
|
1449
1452
|
* 创建Provider实例
|
@@ -1456,18 +1459,18 @@ class cs extends Ke {
|
|
1456
1459
|
mode: s = _.Raw,
|
1457
1460
|
dependencies: r,
|
1458
1461
|
materials: o,
|
1459
|
-
project:
|
1460
|
-
adapter:
|
1461
|
-
globals:
|
1462
|
+
project: i = {},
|
1463
|
+
adapter: a = {},
|
1464
|
+
globals: l = {},
|
1462
1465
|
modules: c = {},
|
1463
|
-
router:
|
1464
|
-
materialPath:
|
1466
|
+
router: u = null,
|
1467
|
+
materialPath: f = "./",
|
1465
1468
|
nodeEnv: h = "development"
|
1466
1469
|
/* Development */
|
1467
1470
|
} = e;
|
1468
|
-
this.mode = s, this.modules = c, this.service = t, this.router =
|
1471
|
+
this.mode = s, this.modules = c, this.service = t, this.router = u, this.materialPath = f, this.nodeEnv = h, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, a);
|
1469
1472
|
const { access: d, request: p } = this.adapter;
|
1470
|
-
d && d.connect({ mode: s, router:
|
1473
|
+
d && d.connect({ mode: s, router: u, request: p }), i && s !== _.Design ? this.load(i) : this.project = i;
|
1471
1474
|
}
|
1472
1475
|
mode;
|
1473
1476
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1475,7 +1478,7 @@ class cs extends Ke {
|
|
1475
1478
|
// 全局变量
|
1476
1479
|
modules = {};
|
1477
1480
|
// 异步模块加载器
|
1478
|
-
adapter = { request:
|
1481
|
+
adapter = { request: ne, jsonp: Re };
|
1479
1482
|
// 适配器接口
|
1480
1483
|
apis = {};
|
1481
1484
|
// API集合
|
@@ -1523,8 +1526,8 @@ class cs extends Ke {
|
|
1523
1526
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
1524
1527
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1525
1528
|
throw new Error("project is null");
|
1526
|
-
const { apis: r = [], meta: o = [] } = this.project,
|
1527
|
-
|
1529
|
+
const { apis: r = [], meta: o = [] } = this.project, i = window;
|
1530
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === _.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = Et(r, o, this.adapter), Oe(i), bt(r, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1528
1531
|
}
|
1529
1532
|
initMock(e) {
|
1530
1533
|
const t = T(e);
|
@@ -1538,19 +1541,19 @@ class cs extends Ke {
|
|
1538
1541
|
e[s] || (e[s] = this.library[s] = await r());
|
1539
1542
|
}
|
1540
1543
|
async loadAssets(e) {
|
1541
|
-
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath:
|
1542
|
-
libraryExports:
|
1544
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: i, nodeEnv: a } = this, {
|
1545
|
+
libraryExports: l,
|
1543
1546
|
libraryMap: c,
|
1544
|
-
materials:
|
1545
|
-
materialExports:
|
1547
|
+
materials: u,
|
1548
|
+
materialExports: f,
|
1546
1549
|
materialMapLibrary: h
|
1547
1550
|
} = ft(
|
1548
1551
|
t,
|
1549
|
-
|
1550
|
-
|
1552
|
+
i,
|
1553
|
+
a === "development"
|
1551
1554
|
/* Development */
|
1552
1555
|
);
|
1553
|
-
for (const d of
|
1556
|
+
for (const d of l) {
|
1554
1557
|
const p = s[d], g = e[d];
|
1555
1558
|
if (g)
|
1556
1559
|
r[d] = g;
|
@@ -1559,16 +1562,16 @@ class cs extends Ke {
|
|
1559
1562
|
else {
|
1560
1563
|
const v = c[d] || [];
|
1561
1564
|
for (const m of v)
|
1562
|
-
G(m) && await mt(m, F.append(m, { v: O })), V(m) && await
|
1565
|
+
G(m) && await mt(m, F.append(m, { v: O })), V(m) && await Se(F.append(m, { v: O }));
|
1563
1566
|
r[d] = e[d];
|
1564
1567
|
}
|
1565
1568
|
}
|
1566
|
-
if (
|
1567
|
-
for (const p of
|
1568
|
-
await
|
1569
|
+
if (a === "development") {
|
1570
|
+
for (const p of u)
|
1571
|
+
await Se(F.append(p, { v: O }));
|
1569
1572
|
const d = this.materials || {};
|
1570
|
-
for (const p of
|
1571
|
-
const g = e[h[p]], v =
|
1573
|
+
for (const p of f) {
|
1574
|
+
const g = e[h[p]], v = Ge[p];
|
1572
1575
|
if (v)
|
1573
1576
|
g && v.forEach((m) => {
|
1574
1577
|
o[m] = g[m];
|
@@ -1586,33 +1589,33 @@ class cs extends Ke {
|
|
1586
1589
|
const { router: e, project: t, options: s, adapter: r } = this;
|
1587
1590
|
if (!e) return;
|
1588
1591
|
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1589
|
-
routeAppendTo:
|
1590
|
-
pageRouteName:
|
1591
|
-
routeMeta:
|
1592
|
-
} = s, c =
|
1593
|
-
path: `${c}${
|
1592
|
+
routeAppendTo: i,
|
1593
|
+
pageRouteName: a = o,
|
1594
|
+
routeMeta: l
|
1595
|
+
} = s, c = i ? "" : "/", u = {
|
1596
|
+
path: `${c}${a}/:id`,
|
1594
1597
|
name: D,
|
1595
1598
|
component: ee
|
1596
|
-
},
|
1599
|
+
}, f = {
|
1597
1600
|
path: c,
|
1598
|
-
name:
|
1601
|
+
name: N,
|
1599
1602
|
component: t?.homepage ? ee : r.startupComponent || es,
|
1600
|
-
meta:
|
1603
|
+
meta: l
|
1601
1604
|
};
|
1602
|
-
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(
|
1605
|
+
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
1603
1606
|
const h = t?.pages || [];
|
1604
|
-
|
1605
|
-
name:
|
1607
|
+
le({
|
1608
|
+
name: a,
|
1606
1609
|
prefix: c,
|
1607
1610
|
pages: h,
|
1608
1611
|
component: ee,
|
1609
1612
|
loader: this.getRenderComponent.bind(this),
|
1610
1613
|
homepage: t?.homepage
|
1611
1614
|
}).forEach((p) => {
|
1612
|
-
|
1613
|
-
}), t?.homepage || (
|
1615
|
+
i ? e.addRoute(i, p) : e.addRoute(p);
|
1616
|
+
}), t?.homepage || (i ? e.addRoute(i, f) : e.addRoute(f));
|
1614
1617
|
} else
|
1615
|
-
|
1618
|
+
i ? (e.addRoute(i, u), e.addRoute(i, f)) : (e.addRoute(u), e.addRoute(f));
|
1616
1619
|
}
|
1617
1620
|
/**
|
1618
1621
|
* Vue 插件安装方法
|
@@ -1628,14 +1631,14 @@ class cs extends Ke {
|
|
1628
1631
|
const t = e.config.globalProperties.installed || {};
|
1629
1632
|
for (const [s, r] of Object.entries(this.library))
|
1630
1633
|
!t[s] && gt(r) && (e.use(r), t[s] = !0);
|
1631
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1634
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Ue, this), e.config.globalProperties.$provider = this, this.project?.platform !== "uniapp" && this.initGlobals(this.project?.globals || {}, {
|
1632
1635
|
app: e,
|
1633
1636
|
window,
|
1634
1637
|
adapter: this.adapter,
|
1635
1638
|
library: this.library,
|
1636
1639
|
mode: this.mode
|
1637
1640
|
}), this.options.enhance && e.use(this.options.enhance, this), this.mode === _.Design && (e.config.errorHandler = (s, r, o) => {
|
1638
|
-
const
|
1641
|
+
const i = r?.$options.name, a = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", l = `[ ${i} ] ${a} ${o}`;
|
1639
1642
|
console.error(
|
1640
1643
|
"[VTJ Error]:",
|
1641
1644
|
{
|
@@ -1644,7 +1647,7 @@ class cs extends Ke {
|
|
1644
1647
|
info: o
|
1645
1648
|
},
|
1646
1649
|
s?.stack
|
1647
|
-
), this.adapter.notify && this.adapter.notify(
|
1650
|
+
), this.adapter.notify && this.adapter.notify(l, "组件渲染错误", "error");
|
1648
1651
|
}), e.config.globalProperties.installed = t;
|
1649
1652
|
}
|
1650
1653
|
getFile(e) {
|
@@ -1653,13 +1656,13 @@ class cs extends Ke {
|
|
1653
1656
|
}
|
1654
1657
|
getPage(e) {
|
1655
1658
|
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
1656
|
-
for (const
|
1657
|
-
if (
|
1658
|
-
return
|
1659
|
-
if (
|
1660
|
-
const
|
1661
|
-
if (
|
1662
|
-
return
|
1659
|
+
for (const i of o) {
|
1660
|
+
if (i.id === r)
|
1661
|
+
return i;
|
1662
|
+
if (i.children && i.children.length) {
|
1663
|
+
const a = s(r, i.children);
|
1664
|
+
if (a)
|
1665
|
+
return a;
|
1663
1666
|
}
|
1664
1667
|
}
|
1665
1668
|
};
|
@@ -1697,23 +1700,23 @@ class cs extends Ke {
|
|
1697
1700
|
* @returns 渲染器实例
|
1698
1701
|
*/
|
1699
1702
|
createDslRenderer(e, t = {}) {
|
1700
|
-
const { library: s, components: r, mode: o, apis:
|
1703
|
+
const { library: s, components: r, mode: o, apis: i } = this, a = {
|
1701
1704
|
mode: o,
|
1702
1705
|
Vue: s.Vue,
|
1703
1706
|
components: r,
|
1704
1707
|
libs: s,
|
1705
|
-
apis:
|
1708
|
+
apis: i,
|
1706
1709
|
window,
|
1707
1710
|
...t
|
1708
|
-
},
|
1711
|
+
}, l = ae({
|
1709
1712
|
getDsl: async (c) => await this.getDsl(c) || null,
|
1710
1713
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1711
|
-
options:
|
1714
|
+
options: a
|
1712
1715
|
});
|
1713
|
-
return
|
1714
|
-
...
|
1716
|
+
return ie({
|
1717
|
+
...a,
|
1715
1718
|
dsl: e,
|
1716
|
-
loader:
|
1719
|
+
loader: l
|
1717
1720
|
});
|
1718
1721
|
}
|
1719
1722
|
/**
|
@@ -1731,9 +1734,8 @@ class cs extends Ke {
|
|
1731
1734
|
if (!s)
|
1732
1735
|
return k.warn(`Can not find file: ${e}`), null;
|
1733
1736
|
if (t && t(s), this.mode === _.Raw) {
|
1734
|
-
const { vtjRawDir: o = ".vtj/vue" } = this.options,
|
1735
|
-
|
1736
|
-
return (await i())?.default;
|
1737
|
+
const { vtjRawDir: o = ".vtj/vue" } = this.options, i = `${o}/${e}.vue`, a = this.modules[i] || this.modules[`/src/pages/${e}.vue`];
|
1738
|
+
return a ? (await a())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
1737
1739
|
}
|
1738
1740
|
const r = await this.getDsl(s.id);
|
1739
1741
|
return r ? this.createDslRenderer(r).renderer : (k.warn(`Can not find dsl: ${e}`), null);
|
@@ -1748,7 +1750,7 @@ class cs extends Ke {
|
|
1748
1750
|
* @returns Vue异步组件
|
1749
1751
|
*/
|
1750
1752
|
defineUrlSchemaComponent(e, t) {
|
1751
|
-
return
|
1753
|
+
return $e(async () => {
|
1752
1754
|
const s = await this.getDslByUrl(e);
|
1753
1755
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1754
1756
|
});
|
@@ -1761,7 +1763,7 @@ class cs extends Ke {
|
|
1761
1763
|
* @returns Vue异步组件
|
1762
1764
|
*/
|
1763
1765
|
definePluginComponent(e) {
|
1764
|
-
return
|
1766
|
+
return $e(async () => await Te(e, window));
|
1765
1767
|
}
|
1766
1768
|
/**
|
1767
1769
|
* 设置应用全局
|
@@ -1787,7 +1789,7 @@ function Ps(n) {
|
|
1787
1789
|
};
|
1788
1790
|
}
|
1789
1791
|
function Ne(n = {}) {
|
1790
|
-
const e =
|
1792
|
+
const e = Pe(Ue, null);
|
1791
1793
|
if (!e)
|
1792
1794
|
throw new Error("Can not find provider");
|
1793
1795
|
if (e.nodeEnv === "development") {
|
@@ -1804,14 +1806,14 @@ function Ne(n = {}) {
|
|
1804
1806
|
return e;
|
1805
1807
|
}
|
1806
1808
|
async function Cs(n, e = "") {
|
1807
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((
|
1808
|
-
if (o.length &&
|
1809
|
-
return await
|
1809
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css: o, js: i } = dt(r);
|
1810
|
+
if (o.length && Fe(o), i.length)
|
1811
|
+
return await ke(i, t).catch(
|
1810
1812
|
() => {
|
1811
1813
|
}
|
1812
1814
|
);
|
1813
1815
|
}
|
1814
|
-
const
|
1816
|
+
const Le = {
|
1815
1817
|
type: "json",
|
1816
1818
|
validSuccess: !0,
|
1817
1819
|
originResponse: !1,
|
@@ -1826,7 +1828,7 @@ const Ue = {
|
|
1826
1828
|
type: t,
|
1827
1829
|
data: s
|
1828
1830
|
},
|
1829
|
-
settings:
|
1831
|
+
settings: Le
|
1830
1832
|
}), us = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1831
1833
|
url: e,
|
1832
1834
|
method: "post",
|
@@ -1835,12 +1837,12 @@ const Ue = {
|
|
1835
1837
|
projectId: s
|
1836
1838
|
},
|
1837
1839
|
settings: {
|
1838
|
-
...
|
1840
|
+
...Le,
|
1839
1841
|
type: "data"
|
1840
1842
|
}
|
1841
1843
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1842
1844
|
function As(n) {
|
1843
|
-
return
|
1845
|
+
return be({
|
1844
1846
|
settings: {
|
1845
1847
|
type: "json",
|
1846
1848
|
validSuccess: !0,
|
@@ -1853,8 +1855,8 @@ function As(n) {
|
|
1853
1855
|
}
|
1854
1856
|
});
|
1855
1857
|
}
|
1856
|
-
class
|
1857
|
-
constructor(e =
|
1858
|
+
class de {
|
1859
|
+
constructor(e = ne) {
|
1858
1860
|
this.req = e, this.api = ls(e), this.uploader = us(e);
|
1859
1861
|
}
|
1860
1862
|
api;
|
@@ -1942,7 +1944,7 @@ class pe {
|
|
1942
1944
|
const { urls: t = [] } = e, s = t.filter((o) => lt(o))[0];
|
1943
1945
|
if (!s) return null;
|
1944
1946
|
const r = this.pluginCaches[s];
|
1945
|
-
return r || (this.pluginCaches[s] =
|
1947
|
+
return r || (this.pluginCaches[s] = ne.send({
|
1946
1948
|
url: s,
|
1947
1949
|
method: "get",
|
1948
1950
|
settings: {
|
@@ -1960,7 +1962,7 @@ const w = new nt({
|
|
1960
1962
|
expired: 0,
|
1961
1963
|
prefix: "__VTJ_"
|
1962
1964
|
});
|
1963
|
-
class Is extends
|
1965
|
+
class Is extends de {
|
1964
1966
|
init(e) {
|
1965
1967
|
const t = new L(e), s = w.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1966
1968
|
return w.save(`project_${t.id}`, r), Promise.resolve(r);
|
@@ -1970,7 +1972,7 @@ class Is extends pe {
|
|
1970
1972
|
return w.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1971
1973
|
}
|
1972
1974
|
saveMaterials(e, t) {
|
1973
|
-
return w.save(`materials_${e.id}`,
|
1975
|
+
return w.save(`materials_${e.id}`, ue(t)), Promise.resolve(!0);
|
1974
1976
|
}
|
1975
1977
|
saveFile(e) {
|
1976
1978
|
return w.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1994,7 +1996,7 @@ class Is extends pe {
|
|
1994
1996
|
return Promise.resolve(!0);
|
1995
1997
|
}
|
1996
1998
|
getHistory(e) {
|
1997
|
-
const t = w.get(`history_${e}`), s = new
|
1999
|
+
const t = w.get(`history_${e}`), s = new Ee(t || { id: e });
|
1998
2000
|
return Promise.resolve(s.toDsl());
|
1999
2001
|
}
|
2000
2002
|
getHistoryItem(e, t) {
|
@@ -2010,7 +2012,7 @@ class Is extends pe {
|
|
2010
2012
|
}), Promise.resolve(!0);
|
2011
2013
|
}
|
2012
2014
|
}
|
2013
|
-
class fs extends
|
2015
|
+
class fs extends de {
|
2014
2016
|
projects = {};
|
2015
2017
|
materials = {};
|
2016
2018
|
files = {};
|
@@ -2025,7 +2027,7 @@ class fs extends pe {
|
|
2025
2027
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
2026
2028
|
}
|
2027
2029
|
saveMaterials(e, t) {
|
2028
|
-
return e.id && (this.materials[e.id] =
|
2030
|
+
return e.id && (this.materials[e.id] = ue(t)), Promise.resolve(!0);
|
2029
2031
|
}
|
2030
2032
|
saveFile(e) {
|
2031
2033
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -2049,7 +2051,7 @@ class fs extends pe {
|
|
2049
2051
|
return Promise.resolve(!0);
|
2050
2052
|
}
|
2051
2053
|
getHistory(e) {
|
2052
|
-
const t = this.histories[e], s = new
|
2054
|
+
const t = this.histories[e], s = new Ee(t || { id: e });
|
2053
2055
|
return Promise.resolve(s);
|
2054
2056
|
}
|
2055
2057
|
getHistoryItem(e, t) {
|
@@ -2067,11 +2069,11 @@ class fs extends pe {
|
|
2067
2069
|
}), Promise.resolve(!0);
|
2068
2070
|
}
|
2069
2071
|
}
|
2070
|
-
let
|
2072
|
+
let U = null;
|
2071
2073
|
function Fs() {
|
2072
|
-
return
|
2074
|
+
return U || (U = new fs(), U);
|
2073
2075
|
}
|
2074
|
-
class ks extends
|
2076
|
+
class ks extends de {
|
2075
2077
|
getFileCaches = {};
|
2076
2078
|
async getExtension() {
|
2077
2079
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -2088,7 +2090,7 @@ class ks extends pe {
|
|
2088
2090
|
async saveMaterials(e, t) {
|
2089
2091
|
return !!await this.api("saveMaterials", {
|
2090
2092
|
project: e,
|
2091
|
-
materials:
|
2093
|
+
materials: ue(t)
|
2092
2094
|
}).catch(() => !1);
|
2093
2095
|
}
|
2094
2096
|
async saveFile(e) {
|
@@ -2130,16 +2132,16 @@ class ks extends pe {
|
|
2130
2132
|
}
|
2131
2133
|
export {
|
2132
2134
|
ys as ACCESS,
|
2133
|
-
|
2134
|
-
|
2135
|
+
Me as ACCESS_KEY,
|
2136
|
+
pe as Access,
|
2135
2137
|
ct as BUILD_IN_TAGS,
|
2136
2138
|
ot as BUILT_IN_DIRECTIVES,
|
2137
|
-
|
2138
|
-
|
2139
|
+
de as BaseService,
|
2140
|
+
je as CONTEXT_HOST,
|
2139
2141
|
Ct as Context,
|
2140
2142
|
_ as ContextMode,
|
2141
2143
|
it as DATA_TYPES,
|
2142
|
-
|
2144
|
+
N as HOMEPAGE_ROUTE_NAME,
|
2143
2145
|
at as HTML_TAGS,
|
2144
2146
|
$s as JSCodeToString,
|
2145
2147
|
gs as LIFE_CYCLES_LIST,
|
@@ -2151,7 +2153,7 @@ export {
|
|
2151
2153
|
vs as REMOTE,
|
2152
2154
|
Is as StorageService,
|
2153
2155
|
O as VTJ_RENDERER_VERSION,
|
2154
|
-
|
2156
|
+
fe as adoptedStyleSheets,
|
2155
2157
|
bs as clearLoaderCache,
|
2156
2158
|
ht as compileScopedCSS,
|
2157
2159
|
Es as createAccess,
|
@@ -2159,21 +2161,21 @@ export {
|
|
2159
2161
|
_s as createAssetScripts,
|
2160
2162
|
ws as createAssetsCss,
|
2161
2163
|
Dt as createDataSources,
|
2162
|
-
|
2164
|
+
ae as createLoader,
|
2163
2165
|
Fs as createMemoryService,
|
2164
2166
|
K as createMenus,
|
2165
2167
|
jt as createMetaApi,
|
2166
2168
|
Rt as createMock,
|
2167
2169
|
Ps as createProvider,
|
2168
|
-
|
2170
|
+
ie as createRenderer,
|
2169
2171
|
$t as createSchemaApi,
|
2170
2172
|
Et as createSchemaApis,
|
2171
2173
|
As as createServiceRequest,
|
2172
2174
|
xt as defaultLoader,
|
2173
2175
|
B as fillBasePath,
|
2174
2176
|
T as getMock,
|
2175
|
-
|
2176
|
-
|
2177
|
+
xe as getModifiers,
|
2178
|
+
Te as getPlugin,
|
2177
2179
|
pt as getRawComponent,
|
2178
2180
|
vt as isBuiltInTag,
|
2179
2181
|
G as isCSSUrl,
|
@@ -2185,22 +2187,22 @@ export {
|
|
2185
2187
|
yt as isNativeTag,
|
2186
2188
|
gt as isVuePlugin,
|
2187
2189
|
mt as loadCss,
|
2188
|
-
|
2190
|
+
Fe as loadCssUrl,
|
2189
2191
|
Cs as loadEnhance,
|
2190
|
-
|
2191
|
-
|
2192
|
+
ke as loadScriptUrl,
|
2193
|
+
Be as menusFilter,
|
2192
2194
|
Pt as mockApi,
|
2193
2195
|
bt as mockApis,
|
2194
|
-
|
2196
|
+
Oe as mockCleanup,
|
2195
2197
|
M as nodeRender,
|
2196
2198
|
ft as parseDeps,
|
2197
2199
|
H as parseExpression,
|
2198
2200
|
E as parseFunction,
|
2199
2201
|
dt as parseUrls,
|
2200
|
-
|
2202
|
+
Ue as providerKey,
|
2201
2203
|
ut as removeProdFlag,
|
2202
2204
|
Ss as setupPageSetting,
|
2203
|
-
|
2205
|
+
Ie as toString,
|
2204
2206
|
St as useAccess,
|
2205
2207
|
Rs as useMask,
|
2206
2208
|
Ne as useProvider
|