@vtj/renderer 0.13.15 → 0.13.16
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 +323 -323
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as
|
2
|
-
import { isUrl as se, url as k, dedupArray as Ve, isString as C, isFunction as
|
1
|
+
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as q, HistoryModel as Ee } from "@vtj/core";
|
2
|
+
import { isUrl as se, url as k, dedupArray as Ve, isString as C, isFunction as L, logger as F, storage as X, cookie as Y, toArray as ye, unRSA as _e, delay as J, createRequest as Re, jsonp as be, 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
4
|
import { inject as Pe, defineComponent as Ce, h as re, ref as oe, watchEffect as rt, defineAsyncComponent as $e } from "vue";
|
5
5
|
import { useRoute as Ae } from "vue-router";
|
@@ -7,10 +7,10 @@ import { useRoute as Ae } from "vue-router";
|
|
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.16
|
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.16";
|
14
14
|
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
15
15
|
const je = [
|
16
16
|
"$el",
|
@@ -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 = [], a = [], i = [], l = {}, c = {}, f = [], u = {};
|
169
169
|
return s.forEach(
|
170
170
|
({ urls: h, assetsUrl: p, library: d, assetsLibrary: g, localeLibrary: v }) => {
|
171
171
|
h?.forEach((m) => {
|
172
172
|
V(m) && r.push(ut(m, t)), G(m) && o.push(m);
|
173
|
-
}), d && (
|
173
|
+
}), d && (i.push(d), l[d] = B(h || [], e), v && (c[d] = v)), p && a.push(p), g && f.push(g), d && g && (u[g] = d);
|
174
174
|
}
|
175
175
|
), {
|
176
176
|
scripts: B(r, e),
|
177
177
|
css: B(o, e),
|
178
|
-
materials: B(
|
179
|
-
libraryExports:
|
178
|
+
materials: B(a, e),
|
179
|
+
libraryExports: i,
|
180
180
|
materialExports: Ve(f),
|
181
|
-
materialMapLibrary:
|
182
|
-
libraryMap:
|
181
|
+
materialMapLibrary: u,
|
182
|
+
libraryMap: l,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
185
185
|
}
|
@@ -197,58 +197,58 @@ function dt(n = []) {
|
|
197
197
|
function ht(n, e) {
|
198
198
|
const t = (c) => {
|
199
199
|
const f = [];
|
200
|
-
let
|
201
|
-
for (;
|
202
|
-
if (/\s/.test(c[
|
203
|
-
|
200
|
+
let u = 0;
|
201
|
+
for (; u < c.length; ) {
|
202
|
+
if (/\s/.test(c[u])) {
|
203
|
+
u++;
|
204
204
|
continue;
|
205
205
|
}
|
206
|
-
if (c.substring(
|
207
|
-
const m = c.indexOf("*/",
|
206
|
+
if (c.substring(u, u + 2) === "/*") {
|
207
|
+
const m = c.indexOf("*/", u + 2);
|
208
208
|
if (m !== -1) {
|
209
|
-
|
209
|
+
u = m + 2;
|
210
210
|
continue;
|
211
211
|
}
|
212
212
|
}
|
213
|
-
if (c[
|
214
|
-
const m =
|
215
|
-
for (;
|
216
|
-
|
217
|
-
const
|
218
|
-
if (c[
|
213
|
+
if (c[u] === "@") {
|
214
|
+
const m = u;
|
215
|
+
for (; u < c.length && c[u] !== "{" && c[u] !== ";"; )
|
216
|
+
u++;
|
217
|
+
const R = c.substring(m, u).trim(), _ = R.includes("@keyframes");
|
218
|
+
if (c[u] === ";")
|
219
219
|
f.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, u + 1)
|
222
|
+
}), u++;
|
223
|
+
else if (c[u] === "{") {
|
224
|
+
const x = u + 1;
|
225
225
|
let A = 1;
|
226
|
-
for (
|
227
|
-
c[
|
228
|
-
const Q = c.substring(m,
|
226
|
+
for (u++; u < c.length && A > 0; )
|
227
|
+
c[u] === "{" ? A++ : c[u] === "}" && A--, u++;
|
228
|
+
const Q = c.substring(m, u), b = c.substring(x, u - 1);
|
229
229
|
f.push({
|
230
230
|
type: _ ? "keyframes" : "at-rule",
|
231
|
-
rule:
|
231
|
+
rule: R,
|
232
232
|
content: Q,
|
233
|
-
inner:
|
233
|
+
inner: b
|
234
234
|
});
|
235
235
|
}
|
236
236
|
continue;
|
237
237
|
}
|
238
|
-
const h =
|
239
|
-
for (;
|
240
|
-
|
241
|
-
if (
|
242
|
-
const p = c.substring(h,
|
238
|
+
const h = u;
|
239
|
+
for (; u < c.length && c[u] !== "{"; )
|
240
|
+
u++;
|
241
|
+
if (u >= c.length) break;
|
242
|
+
const p = c.substring(h, u).trim();
|
243
243
|
if (!p) {
|
244
|
-
|
244
|
+
u++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const d =
|
247
|
+
const d = u + 1;
|
248
248
|
let g = 1;
|
249
|
-
for (
|
250
|
-
c[
|
251
|
-
const v = c.substring(d,
|
249
|
+
for (u++; u < c.length && g > 0; )
|
250
|
+
c[u] === "{" ? g++ : c[u] === "}" && g--, u++;
|
251
|
+
const v = c.substring(d, u - 1);
|
252
252
|
f.push({
|
253
253
|
type: "rule",
|
254
254
|
selector: p,
|
@@ -259,20 +259,20 @@ function ht(n, e) {
|
|
259
259
|
}, s = (c) => {
|
260
260
|
const f = c.trim();
|
261
261
|
return /^(from|to|\d+(\.\d+)?%)$/.test(f);
|
262
|
-
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (f,
|
263
|
-
const p =
|
262
|
+
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (f, u, h) => {
|
263
|
+
const p = u.trim(), d = h.trim();
|
264
264
|
return p ? `${p}[${e}] ${d}` : d;
|
265
265
|
}), o = (c) => {
|
266
266
|
const f = c.trim();
|
267
267
|
if (!f || f.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(f) || s(f))
|
268
268
|
return f;
|
269
|
-
const
|
270
|
-
if (
|
271
|
-
const [, h, p = ""] =
|
269
|
+
const u = f.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
|
+
if (u) {
|
271
|
+
const [, h, p = ""] = u, d = h.trim();
|
272
272
|
return d ? `${d}[${e}]${p}` : f;
|
273
273
|
}
|
274
274
|
return `${f}[${e}]`;
|
275
|
-
},
|
275
|
+
}, a = (c) => r(c).split(",").map((u) => o(u)).filter((u) => u.trim()).join(", "), i = (c) => c.map((f) => {
|
276
276
|
switch (f.type) {
|
277
277
|
case "simple-at-rule":
|
278
278
|
return f.content;
|
@@ -280,7 +280,7 @@ function ht(n, e) {
|
|
280
280
|
return f.content;
|
281
281
|
case "at-rule":
|
282
282
|
try {
|
283
|
-
const h = t(f.inner), p =
|
283
|
+
const h = t(f.inner), p = i(h);
|
284
284
|
return `${f.rule} { ${p} }`;
|
285
285
|
} catch {
|
286
286
|
return f.content;
|
@@ -288,23 +288,23 @@ function ht(n, e) {
|
|
288
288
|
case "rule":
|
289
289
|
if (!f.selector || !f.content)
|
290
290
|
return "";
|
291
|
-
const
|
292
|
-
return
|
291
|
+
const u = a(f.selector);
|
292
|
+
return u.trim() ? `${u} { ${f.content} }` : "";
|
293
293
|
default:
|
294
294
|
return "";
|
295
295
|
}
|
296
|
-
}).filter((f) => f.trim()).join(" "),
|
296
|
+
}).filter((f) => f.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
|
-
`), f = t(c),
|
300
|
-
return u
|
299
|
+
`), f = t(c), u = i(f);
|
300
|
+
return l(u);
|
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
304
|
(f) => f
|
305
305
|
).replace(/([^{}@]+)(?=\s*{)/g, (f) => {
|
306
|
-
const
|
307
|
-
return !
|
306
|
+
const u = f.trim();
|
307
|
+
return !u || u.startsWith("@") || u.includes(`[${e}]`) || s(u) ? f : `${u}[${e}]`;
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
@@ -312,18 +312,18 @@ function Ie(n) {
|
|
312
312
|
return C(n) ? n : JSON.stringify(n);
|
313
313
|
}
|
314
314
|
function fe(n, e, t, s = !1) {
|
315
|
-
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e,
|
315
|
+
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, a = s ? ht(t, o) : t;
|
316
316
|
if (r.prototype.replaceSync) {
|
317
|
-
const
|
318
|
-
|
319
|
-
const
|
320
|
-
(
|
317
|
+
const i = new r();
|
318
|
+
i.id = e, i.replaceSync(a);
|
319
|
+
const l = n.document, c = l.adoptedStyleSheets, f = Array.from(c).filter(
|
320
|
+
(u) => u.id !== e
|
321
321
|
);
|
322
|
-
|
322
|
+
l.adoptedStyleSheets = [...f, i];
|
323
323
|
} else {
|
324
|
-
const
|
325
|
-
let
|
326
|
-
|
324
|
+
const i = n.document;
|
325
|
+
let l = i.getElementById(e);
|
326
|
+
l ? l.innerHTML = a : (l = i.createElement("style"), l.id = e, l.innerHTML = a, i.head.appendChild(l));
|
327
327
|
}
|
328
328
|
}
|
329
329
|
async function mt(n, e) {
|
@@ -334,26 +334,26 @@ function ke(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 a = t.createElement("link");
|
338
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
339
339
|
}
|
340
340
|
}
|
341
341
|
async function Fe(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((a, i) => {
|
345
|
+
for (const l of n) {
|
346
346
|
const c = s.createElement("script");
|
347
|
-
c.src =
|
348
|
-
o = t[e], o ?
|
347
|
+
c.src = l, c.onload = () => {
|
348
|
+
o = t[e], o ? a(o.default || o) : i(null);
|
349
349
|
}, c.onerror = (f) => {
|
350
|
-
|
350
|
+
i(f);
|
351
351
|
}, r.appendChild(c);
|
352
352
|
}
|
353
353
|
});
|
354
354
|
}
|
355
355
|
function gt(n) {
|
356
|
-
return
|
356
|
+
return L(n) || L(n?.install);
|
357
357
|
}
|
358
358
|
function vt(n) {
|
359
359
|
return ct.includes(n);
|
@@ -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 a = (n.value || "").trim();
|
381
|
+
r || (a = a.replace(/this(\W|$)/g, (l, c) => `__self${c}`)), a = o.join(`
|
382
|
+
`) + a;
|
383
|
+
const i = r ? `
|
384
|
+
${a}
|
385
|
+
` : `with(${t ? "{}" : "$scope || {}"}) { ${a} }`;
|
386
|
+
return new Function("$scope", i)(e);
|
387
387
|
} catch (o) {
|
388
388
|
if (F.error("parseExpression.error", o, n, e?.__self ?? e), s)
|
389
389
|
throw o;
|
@@ -544,7 +544,7 @@ class pe {
|
|
544
544
|
return t();
|
545
545
|
{
|
546
546
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
547
|
-
return await this.showTip(s),
|
547
|
+
return await this.showTip(s), L(r) ? (r(), t(!1)) : C(r) ? t(r) : t(!1);
|
548
548
|
}
|
549
549
|
}
|
550
550
|
t(!1), await J(0), this.toLogin();
|
@@ -589,12 +589,12 @@ function Es(n = {}) {
|
|
589
589
|
settings: s = {},
|
590
590
|
Startup: r,
|
591
591
|
access: o,
|
592
|
-
useTitle:
|
593
|
-
alert:
|
592
|
+
useTitle: a,
|
593
|
+
alert: i
|
594
594
|
} = n;
|
595
|
-
let
|
595
|
+
let l = null;
|
596
596
|
return {
|
597
|
-
request:
|
597
|
+
request: Re({
|
598
598
|
settings: {
|
599
599
|
type: "form",
|
600
600
|
validSuccess: !0,
|
@@ -606,24 +606,24 @@ function Es(n = {}) {
|
|
606
606
|
e && e(f || "未知错误");
|
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: be,
|
618
618
|
notify: e,
|
619
619
|
loading: t,
|
620
|
-
useTitle:
|
621
|
-
alert:
|
620
|
+
useTitle: a,
|
621
|
+
alert: i,
|
622
622
|
startupComponent: r,
|
623
|
-
access: o ? new pe({ alert:
|
623
|
+
access: o ? new pe({ alert: i, ...o }) : void 0
|
624
624
|
};
|
625
625
|
}
|
626
|
-
function
|
626
|
+
function Rs(n = {}) {
|
627
627
|
return new pe(n);
|
628
628
|
}
|
629
629
|
function $t(n, e) {
|
@@ -642,19 +642,19 @@ function $t(n, e) {
|
|
642
642
|
headers: r
|
643
643
|
}
|
644
644
|
};
|
645
|
-
return (
|
645
|
+
return (a, i) => (delete o.data, s.send(Qe(o, i || {}, { data: a })));
|
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, a) => {
|
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, a);
|
658
658
|
};
|
659
659
|
}
|
660
660
|
function Et(n = [], e = [], t) {
|
@@ -665,19 +665,19 @@ function Et(n = [], e = [], t) {
|
|
665
665
|
s[r.id] = jt(r, t);
|
666
666
|
return s;
|
667
667
|
}
|
668
|
-
async function
|
668
|
+
async function Rt(n = [], e = window) {
|
669
669
|
const t = T(e);
|
670
670
|
t && (Oe(e), n.forEach((s) => Pt(t, s)));
|
671
671
|
}
|
672
|
-
function
|
672
|
+
function bt(n, e = window) {
|
673
673
|
const t = S(n.mockTemplate) && n.mockTemplate.value ? E(n.mockTemplate, {}, !0) : void 0, s = T(e);
|
674
674
|
return async (...r) => {
|
675
675
|
let o = {};
|
676
676
|
if (t)
|
677
677
|
try {
|
678
678
|
o = await t.apply(t, r);
|
679
|
-
} catch (
|
680
|
-
F.warn("模拟数据模版异常",
|
679
|
+
} catch (a) {
|
680
|
+
F.warn("模拟数据模版异常", a);
|
681
681
|
}
|
682
682
|
return s?.mock(o);
|
683
683
|
};
|
@@ -687,14 +687,14 @@ function Pt(n, e) {
|
|
687
687
|
const { url: t, mockTemplate: s } = e;
|
688
688
|
if (t && s)
|
689
689
|
try {
|
690
|
-
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`),
|
691
|
-
n.mock(o, (
|
692
|
-
const c = k.parse(
|
693
|
-
Object.assign(
|
690
|
+
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`), a = Xe(r, { decode: decodeURIComponent }), i = H(s, {}, !0);
|
691
|
+
n.mock(o, (l) => {
|
692
|
+
const c = k.parse(l.url) || {}, f = l.body instanceof FormData ? Ye(l.body) : l.body, u = se(l.url) ? new URL(l.url).pathname : l.url.split("?")[0], h = a(u)?.params;
|
693
|
+
Object.assign(l, { data: f, params: h, query: c });
|
694
694
|
try {
|
695
|
-
return n.mock(
|
695
|
+
return n.mock(i(l));
|
696
696
|
} catch (p) {
|
697
|
-
return console.warn("[mockApi]", o,
|
697
|
+
return console.warn("[mockApi]", o, l, p), null;
|
698
698
|
}
|
699
699
|
});
|
700
700
|
} catch (r) {
|
@@ -811,33 +811,33 @@ function ie(n) {
|
|
811
811
|
components: s = {},
|
812
812
|
libs: r = {},
|
813
813
|
apis: o = {},
|
814
|
-
loader:
|
815
|
-
} = n,
|
814
|
+
loader: a
|
815
|
+
} = n, i = e.computed(() => n.dsl), l = {
|
816
816
|
$components: s,
|
817
817
|
$libs: r,
|
818
818
|
$apis: o
|
819
819
|
}, c = new Ct({
|
820
820
|
mode: t,
|
821
|
-
dsl:
|
822
|
-
attrs:
|
821
|
+
dsl: i.value,
|
822
|
+
attrs: l
|
823
823
|
}), f = e.defineComponent({
|
824
|
-
name:
|
825
|
-
__scopeId:
|
824
|
+
name: i.value.name,
|
825
|
+
__scopeId: i.value.id ? `data-v-${i.value.id}` : void 0,
|
826
826
|
props: {
|
827
|
-
...It(
|
827
|
+
...It(i.value.props ?? [], c)
|
828
828
|
},
|
829
|
-
setup(
|
830
|
-
c.$props =
|
829
|
+
setup(u) {
|
830
|
+
c.$props = u, c.props = u, i.value.id && fe(
|
831
831
|
n.window || window,
|
832
|
-
|
833
|
-
|
832
|
+
i.value.id,
|
833
|
+
i.value.css || "",
|
834
834
|
!0
|
835
|
-
), c.state = kt(e,
|
836
|
-
const h = Ft(e,
|
837
|
-
for (const [m,
|
838
|
-
d[m] = e.inject(m,
|
835
|
+
), c.state = kt(e, i.value.state ?? {}, c);
|
836
|
+
const h = Ft(e, i.value.computed ?? {}, c), p = Mt(i.value.methods ?? {}, c), d = Ot(e, i.value.inject, c);
|
837
|
+
for (const [m, R] of Object.entries(d || {}))
|
838
|
+
d[m] = e.inject(m, R);
|
839
839
|
const g = Dt(
|
840
|
-
|
840
|
+
i.value.dataSources || {},
|
841
841
|
c
|
842
842
|
), v = {
|
843
843
|
...d,
|
@@ -845,20 +845,20 @@ function ie(n) {
|
|
845
845
|
...p,
|
846
846
|
...g
|
847
847
|
};
|
848
|
-
return c.setup(v, e), Tt(e,
|
848
|
+
return c.setup(v, e), Tt(e, i.value.watch ?? [], c), {
|
849
849
|
vtj: c
|
850
850
|
};
|
851
851
|
},
|
852
|
-
emits: At(
|
852
|
+
emits: At(i.value.emits),
|
853
853
|
expose: ["vtj"],
|
854
854
|
render() {
|
855
|
-
if (!
|
856
|
-
const
|
857
|
-
return
|
858
|
-
(h) => M(h, c, e,
|
855
|
+
if (!i.value.nodes) return null;
|
856
|
+
const u = i.value.nodes || [];
|
857
|
+
return u.length === 1 ? M(u[0], c, e, a, u) : u.map(
|
858
|
+
(h) => M(h, c, e, a, u)
|
859
859
|
);
|
860
860
|
},
|
861
|
-
...Ht(
|
861
|
+
...Ht(i.value.lifeCycles ?? {}, c)
|
862
862
|
});
|
863
863
|
return {
|
864
864
|
renderer: e.markRaw(f),
|
@@ -912,10 +912,10 @@ function Mt(n, e) {
|
|
912
912
|
function Ot(n, e = [], t) {
|
913
913
|
return e.reduce(
|
914
914
|
(s, r) => {
|
915
|
-
const { name: o, from:
|
915
|
+
const { name: o, from: a } = r || {};
|
916
916
|
r.default;
|
917
|
-
const
|
918
|
-
return s[o] = n.inject(
|
917
|
+
const i = j(a) ? t.__parseExpression(a) || o : a ?? o, l = j(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
918
|
+
return s[o] = n.inject(i, l), s;
|
919
919
|
},
|
920
920
|
{}
|
921
921
|
);
|
@@ -925,12 +925,12 @@ function Dt(n, e) {
|
|
925
925
|
(t, s) => {
|
926
926
|
const r = n[s];
|
927
927
|
if (r.type === "mock")
|
928
|
-
t[s] =
|
928
|
+
t[s] = bt(r);
|
929
929
|
else if (r.ref) {
|
930
|
-
const o = e.$apis[r.ref],
|
931
|
-
t[s] = async (...
|
932
|
-
const
|
933
|
-
return
|
930
|
+
const o = e.$apis[r.ref], a = S(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
931
|
+
t[s] = async (...i) => {
|
932
|
+
const l = await o.apply(e, i);
|
933
|
+
return a ? a(l) : l;
|
934
934
|
};
|
935
935
|
}
|
936
936
|
return t;
|
@@ -955,7 +955,7 @@ function Ht(n, e) {
|
|
955
955
|
(t, [s, r]) => {
|
956
956
|
const o = e.__parseFunction(r);
|
957
957
|
return t[s] = async () => {
|
958
|
-
await J(0),
|
958
|
+
await J(0), L(o) && o();
|
959
959
|
}, t;
|
960
960
|
},
|
961
961
|
{}
|
@@ -965,87 +965,87 @@ const De = new Ze();
|
|
965
965
|
let Z = [], I = {};
|
966
966
|
const xt = (n) => n;
|
967
967
|
async function Te(n, e = window) {
|
968
|
-
const { urls: t = [], library: s } = n, r = t.filter((
|
968
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => V(i));
|
969
969
|
if (r.length === 0 || !s) return null;
|
970
|
-
const o = t.filter((
|
970
|
+
const o = t.filter((i) => G(i));
|
971
971
|
return o.length && ke(o, e), await Fe(r, s, e).catch(
|
972
|
-
(
|
972
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
973
973
|
);
|
974
974
|
}
|
975
975
|
function ae(n) {
|
976
976
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
977
977
|
return s.window && (Z.forEach((r) => {
|
978
978
|
delete s.window[r];
|
979
|
-
}), Z = []), (r, o,
|
979
|
+
}), Z = []), (r, o, a = z) => {
|
980
980
|
if (!o || typeof o == "string") return r;
|
981
981
|
if (o.type === "Schema" && o.id)
|
982
|
-
return
|
983
|
-
const
|
982
|
+
return a.defineAsyncComponent(async () => {
|
983
|
+
const i = I[o.id] || await De.add(
|
984
984
|
o.id,
|
985
985
|
() => e(o.id)
|
986
986
|
);
|
987
|
-
return
|
987
|
+
return i && (i.name = r, I[o.id] = i), i ? ie({
|
988
988
|
...s,
|
989
|
-
Vue:
|
990
|
-
dsl: we(
|
989
|
+
Vue: a,
|
990
|
+
dsl: we(i),
|
991
991
|
mode: y.Runtime,
|
992
992
|
loader: ae(n)
|
993
993
|
}).renderer : null;
|
994
994
|
});
|
995
995
|
if (o.type === "UrlSchema" && o.url)
|
996
|
-
return
|
997
|
-
const
|
998
|
-
return
|
996
|
+
return a.defineAsyncComponent(async () => {
|
997
|
+
const i = I[o.url] || await t(o.url);
|
998
|
+
return i && (i.name = r, I[o.url] = i), i ? ie({
|
999
999
|
...s,
|
1000
|
-
Vue:
|
1001
|
-
dsl: we(
|
1000
|
+
Vue: a,
|
1001
|
+
dsl: we(i),
|
1002
1002
|
mode: y.Runtime,
|
1003
1003
|
loader: ae(n)
|
1004
1004
|
}).renderer : null;
|
1005
1005
|
});
|
1006
1006
|
if (o.type === "Plugin") {
|
1007
|
-
let
|
1008
|
-
return
|
1007
|
+
let i = o.library ? I[o.library] : null;
|
1008
|
+
return i || (o.library && Z.push(o.library), i = I[o.library || Symbol()] = a.defineAsyncComponent(
|
1009
1009
|
async () => {
|
1010
|
-
const
|
1011
|
-
return
|
1010
|
+
const l = await Te(o, s.window);
|
1011
|
+
return l || (console.warn("getPlugin result is null", o), null);
|
1012
1012
|
}
|
1013
|
-
),
|
1013
|
+
), i);
|
1014
1014
|
}
|
1015
1015
|
return r;
|
1016
1016
|
};
|
1017
1017
|
}
|
1018
|
-
function
|
1018
|
+
function bs() {
|
1019
1019
|
I = {}, De.clearAllCache();
|
1020
1020
|
}
|
1021
1021
|
function M(n, e, t = z, s = xt, r = [], o = !1) {
|
1022
1022
|
if (!n || !n.name || n.invisible) return null;
|
1023
|
-
const
|
1024
|
-
if (!o && (f ||
|
1023
|
+
const a = t.getCurrentInstance()?.appContext, { id: i = null, directives: l = [] } = n, { vIf: c, vElseIf: f, vElse: u, vFor: h, vShow: p, vModels: d, vBind: g, vHtml: v, others: m } = He(l);
|
1024
|
+
if (!o && (f || u))
|
1025
1025
|
return null;
|
1026
1026
|
if (c && !Ut(c, e))
|
1027
1027
|
return Jt(n, e, t, s, r);
|
1028
|
-
const
|
1028
|
+
const R = (_, x = 0) => {
|
1029
1029
|
const A = _.$components, Q = (() => {
|
1030
1030
|
if (n.name === "component")
|
1031
1031
|
return Nt(_, n.props?.is);
|
1032
1032
|
if (n.name === "slot") return n.name;
|
1033
1033
|
const $ = s(n.name, n.from, t);
|
1034
1034
|
if (C($))
|
1035
|
-
return vt($) || yt($) ? $ : A[$] ??
|
1035
|
+
return vt($) || yt($) ? $ : A[$] ?? a?.app?.component($) ?? $;
|
1036
1036
|
if (et($) && n.id) {
|
1037
1037
|
const ge = `Loader${n.id}_${x}`, ve = A[ge];
|
1038
1038
|
return ve || (A[ge] = $);
|
1039
1039
|
}
|
1040
1040
|
return $;
|
1041
|
-
})(),
|
1041
|
+
})(), b = qt(i, n.props ?? {}, _), Le = Lt(t, n.events ?? {}, _);
|
1042
1042
|
if (n.name === "slot")
|
1043
|
-
return Kt(t, n,
|
1044
|
-
g && Object.assign(
|
1045
|
-
|
1043
|
+
return Kt(t, n, b, _, s);
|
1044
|
+
g && Object.assign(b, _.__parseExpression(g.value)), p && (b.style = Object.assign(
|
1045
|
+
b.style ?? {},
|
1046
1046
|
Gt(p, _)
|
1047
|
-
)), v && Object.assign(
|
1048
|
-
Object.assign(
|
1047
|
+
)), v && Object.assign(b, Vt(v, _)), d.forEach(($) => {
|
1048
|
+
Object.assign(b, Qt(t, $, _));
|
1049
1049
|
});
|
1050
1050
|
const Je = Wt(
|
1051
1051
|
t,
|
@@ -1056,27 +1056,27 @@ function M(n, e, t = z, s = xt, r = [], o = !1) {
|
|
1056
1056
|
), he = _?.__id ? `data-v-${_.__id}` : void 0, Ke = he ? { [he]: "" } : {};
|
1057
1057
|
let W = t.createVNode(
|
1058
1058
|
Q,
|
1059
|
-
{ key: `${
|
1059
|
+
{ key: `${i}_${x}`, ...Ke, ...b, ...Le },
|
1060
1060
|
Je
|
1061
1061
|
);
|
1062
|
-
const me =
|
1062
|
+
const me = a ? Bt(a, m, _) : [];
|
1063
1063
|
return me.length && (W = t.withDirectives(W, me)), W;
|
1064
1064
|
};
|
1065
|
-
return h ? Zt(h,
|
1065
|
+
return h ? Zt(h, R, e) : R(e);
|
1066
1066
|
}
|
1067
1067
|
function Bt(n, e, t) {
|
1068
1068
|
const s = n.app;
|
1069
1069
|
return e.map((r) => {
|
1070
1070
|
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
1071
1071
|
if (!o) return null;
|
1072
|
-
const
|
1073
|
-
return r.value &&
|
1072
|
+
const a = [o];
|
1073
|
+
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
1074
1074
|
}).filter((r) => !!r);
|
1075
1075
|
}
|
1076
1076
|
function He(n = []) {
|
1077
1077
|
const e = n.find((f) => P(f.name) === "vIf"), t = n.find(
|
1078
1078
|
(f) => P(f.name) === "vElseIf"
|
1079
|
-
), s = n.find((f) => P(f.name) === "vElse"), r = n.find((f) => P(f.name) === "vFor"), o = n.find((f) => P(f.name) === "vShow"),
|
1079
|
+
), s = n.find((f) => P(f.name) === "vElse"), r = n.find((f) => P(f.name) === "vFor"), o = n.find((f) => P(f.name) === "vShow"), a = n.find((f) => P(f.name) === "vBind"), i = n.find((f) => P(f.name) === "vHtml"), l = n.filter(
|
1080
1080
|
(f) => P(f.name) === "vModel"
|
1081
1081
|
), c = n.filter(
|
1082
1082
|
(f) => !ot.includes(P(f.name))
|
@@ -1087,10 +1087,10 @@ function He(n = []) {
|
|
1087
1087
|
vElse: s,
|
1088
1088
|
vFor: r,
|
1089
1089
|
vShow: o,
|
1090
|
-
vModels:
|
1091
|
-
vBind:
|
1090
|
+
vModels: l,
|
1091
|
+
vBind: a,
|
1092
1092
|
others: c,
|
1093
|
-
vHtml:
|
1093
|
+
vHtml: i
|
1094
1094
|
};
|
1095
1095
|
}
|
1096
1096
|
function Ut(n, e) {
|
@@ -1099,7 +1099,7 @@ function Ut(n, e) {
|
|
1099
1099
|
function Nt(n, e) {
|
1100
1100
|
return e ? j(e) ? n.__parseExpression(e) : e : "div";
|
1101
1101
|
}
|
1102
|
-
function
|
1102
|
+
function qt(n, e, t) {
|
1103
1103
|
const s = ce(e, t);
|
1104
1104
|
return s.ref = t.__ref(n, s.ref), s;
|
1105
1105
|
}
|
@@ -1112,31 +1112,31 @@ function ce(n, e) {
|
|
1112
1112
|
{}
|
1113
1113
|
) : n;
|
1114
1114
|
}
|
1115
|
-
function
|
1115
|
+
function Lt(n, e, t) {
|
1116
1116
|
const s = ["passive", "capture", "once"], r = {
|
1117
1117
|
capture: "Capture",
|
1118
1118
|
once: "Once",
|
1119
1119
|
passive: "OnceCapture"
|
1120
1120
|
};
|
1121
1121
|
return Object.keys(e || {}).reduce(
|
1122
|
-
(o,
|
1123
|
-
const
|
1124
|
-
return
|
1122
|
+
(o, a) => {
|
1123
|
+
const i = e[a], l = xe(i.modifiers), c = l.find((h) => s.includes(h)), f = "on" + tt(a) + (c && r[c] || ""), u = t.__parseFunction(i.handler);
|
1124
|
+
return u && (o[f] = n.withModifiers(u, l)), o;
|
1125
1125
|
},
|
1126
1126
|
{}
|
1127
1127
|
);
|
1128
1128
|
}
|
1129
1129
|
function Jt(n, e, t, s, r = []) {
|
1130
|
-
let o = r.findIndex((
|
1131
|
-
for (let
|
1132
|
-
const { directives:
|
1133
|
-
if (
|
1134
|
-
if (e.__parseExpression(
|
1135
|
-
return M(r[
|
1130
|
+
let o = r.findIndex((a) => a.id === n.id);
|
1131
|
+
for (let a = ++o; a < r.length; a++) {
|
1132
|
+
const { directives: i = [] } = r[a], { vElseIf: l, vElse: c } = He(i);
|
1133
|
+
if (l) {
|
1134
|
+
if (e.__parseExpression(l.value))
|
1135
|
+
return M(r[a], e, t, s, r, !0);
|
1136
1136
|
continue;
|
1137
1137
|
}
|
1138
1138
|
if (c)
|
1139
|
-
return M(r[
|
1139
|
+
return M(r[a], e, t, s, r, !0);
|
1140
1140
|
}
|
1141
1141
|
return null;
|
1142
1142
|
}
|
@@ -1145,11 +1145,11 @@ function xe(n = {}, e = !1) {
|
|
1145
1145
|
return e ? t.map((s) => "." + s) : t;
|
1146
1146
|
}
|
1147
1147
|
function Kt(n, e, t, s, r) {
|
1148
|
-
const { children: o } = e,
|
1149
|
-
return
|
1148
|
+
const { children: o } = e, a = zt(e, s), i = s.$slots?.[a.name];
|
1149
|
+
return i ? i(t) : o ? C(o) ? n.createTextVNode(o) : j(o) ? n.createTextVNode(
|
1150
1150
|
Ie(s.__parseExpression(o))
|
1151
1151
|
) : Array.isArray(o) ? o.map(
|
1152
|
-
(
|
1152
|
+
(l) => M(l, s, n, r, o)
|
1153
1153
|
) : null : null;
|
1154
1154
|
}
|
1155
1155
|
function zt(n, e) {
|
@@ -1177,10 +1177,10 @@ function Qt(n, e, t) {
|
|
1177
1177
|
}` : "(v) => {}"
|
1178
1178
|
}, r = t.__parseFunction(s), o = xe(
|
1179
1179
|
j(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1180
|
-
),
|
1180
|
+
), a = j(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1181
1181
|
return {
|
1182
|
-
[
|
1183
|
-
[`onUpdate:${
|
1182
|
+
[a]: t.__parseExpression(e.value),
|
1183
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
1184
1184
|
};
|
1185
1185
|
}
|
1186
1186
|
function Wt(n, e, t, s, r) {
|
@@ -1192,18 +1192,18 @@ function Wt(n, e, t, s, r) {
|
|
1192
1192
|
default: () => Ie(t.__parseExpression(e))
|
1193
1193
|
};
|
1194
1194
|
if (Array.isArray(e) && e.length > 0) {
|
1195
|
-
const o = Xt(e),
|
1196
|
-
[
|
1195
|
+
const o = Xt(e), a = (i, l) => !i || !r ? {} : r?.id && Object.keys(i).length ? l ? {
|
1196
|
+
[l]: i
|
1197
1197
|
} : {
|
1198
|
-
[`scope_${r.id}`]:
|
1199
|
-
} :
|
1198
|
+
[`scope_${r.id}`]: i
|
1199
|
+
} : l ? { [l]: /* @__PURE__ */ Object.create(null) } : {};
|
1200
1200
|
return Object.entries(o).reduce(
|
1201
|
-
(
|
1202
|
-
const p = f.length ? st(h ?? {}, f) :
|
1201
|
+
(i, [l, { nodes: c, params: f, scope: u }]) => (i[l] = (h) => {
|
1202
|
+
const p = f.length ? st(h ?? {}, f) : a(h, u);
|
1203
1203
|
return c.map(
|
1204
1204
|
(d) => M(d, t.__clone(p), n, s, c)
|
1205
1205
|
);
|
1206
|
-
},
|
1206
|
+
}, i),
|
1207
1207
|
{}
|
1208
1208
|
);
|
1209
1209
|
}
|
@@ -1225,9 +1225,9 @@ function Yt(n = "default") {
|
|
1225
1225
|
return C(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
1226
1226
|
}
|
1227
1227
|
function Zt(n, e, t) {
|
1228
|
-
const { value: s, iterator: r } = n, { item: o = "item", index:
|
1229
|
-
let
|
1230
|
-
return Number.isInteger(
|
1228
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
1229
|
+
let i = t.__parseExpression(s) || [];
|
1230
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1231
1231
|
}
|
1232
1232
|
const ee = Ce({
|
1233
1233
|
name: "VtjPageContainer",
|
@@ -1235,8 +1235,8 @@ const ee = Ce({
|
|
1235
1235
|
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());
|
1236
1236
|
if (s) {
|
1237
1237
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1238
|
-
const { useTitle:
|
1239
|
-
|
1238
|
+
const { useTitle: a } = n?.adapter;
|
1239
|
+
a && a(s.title || "VTJ");
|
1240
1240
|
}
|
1241
1241
|
return {
|
1242
1242
|
provider: n,
|
@@ -1264,20 +1264,20 @@ const ee = Ce({
|
|
1264
1264
|
function K(n, e, t = []) {
|
1265
1265
|
const s = [];
|
1266
1266
|
for (const r of t) {
|
1267
|
-
const { id: o, title:
|
1267
|
+
const { id: o, title: a, icon: i, children: l, hidden: c, layout: f } = r;
|
1268
1268
|
if (f) {
|
1269
|
-
const
|
1270
|
-
s.push(...
|
1269
|
+
const u = K(n, e, l || []);
|
1270
|
+
s.push(...u);
|
1271
1271
|
} else {
|
1272
|
-
const
|
1272
|
+
const u = {
|
1273
1273
|
id: o,
|
1274
|
-
title:
|
1275
|
-
icon:
|
1274
|
+
title: a,
|
1275
|
+
icon: i,
|
1276
1276
|
hidden: c,
|
1277
1277
|
url: `${n}/${e}/${o}`,
|
1278
|
-
children:
|
1278
|
+
children: l && l.length ? K(n, e, l) : void 0
|
1279
1279
|
};
|
1280
|
-
s.push(
|
1280
|
+
s.push(u);
|
1281
1281
|
}
|
1282
1282
|
}
|
1283
1283
|
return s;
|
@@ -1298,8 +1298,8 @@ function Ps(n) {
|
|
1298
1298
|
menuPathPrefix: e = "",
|
1299
1299
|
pageRouteName: t = "page",
|
1300
1300
|
disableMenusFilter: s = !1
|
1301
|
-
} = n || {}, r = Ne(), o = Ae(),
|
1302
|
-
|
1301
|
+
} = n || {}, r = Ne(), o = Ae(), a = St(), i = oe(!1), l = oe(!1), c = r.project, f = (p, d) => {
|
1302
|
+
i.value = !p?.mask, l.value = d?.pure ?? !!p?.pure;
|
1303
1303
|
};
|
1304
1304
|
rt(() => {
|
1305
1305
|
const { name: p, params: d, meta: g } = o;
|
@@ -1315,32 +1315,32 @@ function Ps(n) {
|
|
1315
1315
|
const m = r.getPage(v);
|
1316
1316
|
f(m, g);
|
1317
1317
|
} else
|
1318
|
-
|
1318
|
+
i.value = !g.mask, l.value = !!g.pure;
|
1319
1319
|
}
|
1320
1320
|
});
|
1321
|
-
const
|
1321
|
+
const u = K(
|
1322
1322
|
e,
|
1323
1323
|
t,
|
1324
1324
|
c?.pages
|
1325
1325
|
), h = c?.config;
|
1326
1326
|
return {
|
1327
|
-
disabled:
|
1327
|
+
disabled: i,
|
1328
1328
|
logo: h?.logo,
|
1329
1329
|
themeSwitchable: h?.themeSwitchable,
|
1330
1330
|
title: h?.title || c?.description || c?.name || "VTJ App",
|
1331
|
-
menus: s ?
|
1332
|
-
pure:
|
1331
|
+
menus: s ? u : Be(u, a),
|
1332
|
+
pure: l
|
1333
1333
|
};
|
1334
1334
|
}
|
1335
1335
|
function te(n, e) {
|
1336
|
-
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix:
|
1336
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: a = "", component: i, routeMeta: l } = e;
|
1337
1337
|
return {
|
1338
1338
|
name: t,
|
1339
|
-
path: `${
|
1340
|
-
component:
|
1339
|
+
path: `${a}${o}/${t}`,
|
1340
|
+
component: i,
|
1341
1341
|
meta: {
|
1342
1342
|
title: s,
|
1343
|
-
...
|
1343
|
+
...l,
|
1344
1344
|
...r,
|
1345
1345
|
__vtj__: t
|
1346
1346
|
}
|
@@ -1353,29 +1353,29 @@ function le(n) {
|
|
1353
1353
|
pages: s = [],
|
1354
1354
|
component: r,
|
1355
1355
|
loader: o,
|
1356
|
-
routeMeta:
|
1357
|
-
homepage:
|
1358
|
-
} = n,
|
1356
|
+
routeMeta: a,
|
1357
|
+
homepage: i
|
1358
|
+
} = n, l = [];
|
1359
1359
|
for (const c of s) {
|
1360
|
-
const { id: f, title:
|
1360
|
+
const { id: f, title: u, dir: h, layout: p, children: d, meta: g } = c;
|
1361
1361
|
if (h) {
|
1362
1362
|
const v = le({
|
1363
1363
|
name: e,
|
1364
1364
|
prefix: t,
|
1365
1365
|
component: r,
|
1366
|
-
routeMeta:
|
1367
|
-
homepage:
|
1366
|
+
routeMeta: a,
|
1367
|
+
homepage: i,
|
1368
1368
|
loader: o,
|
1369
1369
|
pages: d || []
|
1370
1370
|
});
|
1371
|
-
|
1371
|
+
l.push(...v);
|
1372
1372
|
} else if (p) {
|
1373
1373
|
const v = le({
|
1374
1374
|
name: e,
|
1375
1375
|
prefix: t,
|
1376
1376
|
component: r,
|
1377
|
-
routeMeta:
|
1378
|
-
homepage:
|
1377
|
+
routeMeta: a,
|
1378
|
+
homepage: i,
|
1379
1379
|
loader: o,
|
1380
1380
|
pages: d || []
|
1381
1381
|
}), m = {
|
@@ -1383,24 +1383,24 @@ function le(n) {
|
|
1383
1383
|
path: t,
|
1384
1384
|
component: () => o(f),
|
1385
1385
|
meta: {
|
1386
|
-
title:
|
1387
|
-
...
|
1386
|
+
title: u,
|
1387
|
+
...a,
|
1388
1388
|
...g,
|
1389
1389
|
__vtj__: f
|
1390
1390
|
},
|
1391
1391
|
children: v
|
1392
1392
|
};
|
1393
|
-
|
1394
|
-
} else if (
|
1393
|
+
l.push(m), l.push(te(c, n));
|
1394
|
+
} else if (l.push(te(c, n)), i === f) {
|
1395
1395
|
const v = te(c, n);
|
1396
|
-
v.path = "", v.name = `home_${f}`,
|
1396
|
+
v.path = "", v.name = `home_${f}`, l.push(v);
|
1397
1397
|
}
|
1398
1398
|
}
|
1399
|
-
return
|
1399
|
+
return l;
|
1400
1400
|
}
|
1401
1401
|
function ts(n = {}, e) {
|
1402
|
-
const { css: t, store: s, enhance: r } = n, { window: o, app:
|
1403
|
-
fe(o, "global-css", t || ""), f && s && ss(s,
|
1402
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: a, library: i = {}, adapter: l, mode: c } = e, { Pinia: f } = i;
|
1403
|
+
a.config.globalProperties.$libs = i, fe(o, "global-css", t || ""), f && s && ss(s, a, f), rs(a, l, n), !l.access && n.access && ns(n.access, a, c, l), os(a, n), r && is(r, a, i);
|
1404
1404
|
}
|
1405
1405
|
function ss(n, e, t) {
|
1406
1406
|
const s = t.createPinia();
|
@@ -1411,39 +1411,39 @@ function ss(n, e, t) {
|
|
1411
1411
|
}
|
1412
1412
|
function ns(n, e, t, s) {
|
1413
1413
|
if (S(n) && n.value) {
|
1414
|
-
const r = E(n, {}, !1, !1, !0), { alert: o, request:
|
1414
|
+
const r = E(n, {}, !1, !1, !0), { alert: o, request: a } = s, i = new pe({
|
1415
1415
|
alert: o,
|
1416
1416
|
storagePrefix: "__VTJ_APP_",
|
1417
1417
|
...r(e)
|
1418
|
-
}),
|
1419
|
-
|
1418
|
+
}), l = e.config.globalProperties.$router;
|
1419
|
+
i.connect({ mode: t, router: l, request: a }), e.use(i);
|
1420
1420
|
}
|
1421
1421
|
}
|
1422
1422
|
function rs(n, e, t) {
|
1423
1423
|
if (!e.request) return;
|
1424
1424
|
const { axios: s, request: r, response: o } = t;
|
1425
1425
|
if (s && S(s) && s.value) {
|
1426
|
-
const
|
1427
|
-
e.request.setConfig(
|
1426
|
+
const a = E(s, {}, !1, !1, !0);
|
1427
|
+
e.request.setConfig(a(n));
|
1428
1428
|
}
|
1429
1429
|
if (r && S(r) && r.value) {
|
1430
|
-
const
|
1431
|
-
e.request.useRequest((
|
1430
|
+
const a = E(r, {}, !1, !1, !0), i = e.request;
|
1431
|
+
i.__unReq && i.__unReq(), i.__unReq = e.request.useRequest((l) => a(l, n));
|
1432
1432
|
}
|
1433
1433
|
if (o && S(o) && o.value) {
|
1434
|
-
const
|
1435
|
-
e.request.useResponse((
|
1434
|
+
const a = E(o, {}, !1, !1, !0), i = e.request;
|
1435
|
+
i.__unRes && i.__unRes(), i.__unRes = e.request.useResponse((l) => a(l, n));
|
1436
1436
|
}
|
1437
1437
|
}
|
1438
1438
|
function os(n, e) {
|
1439
1439
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
1440
1440
|
if (t && S(t) && t.value) {
|
1441
1441
|
const o = E(t, {}, !1, !1, !0);
|
1442
|
-
r && r.beforeEach((
|
1442
|
+
r && r.beforeEach((a, i, l) => o(a, i, l, n));
|
1443
1443
|
}
|
1444
1444
|
if (s && S(s) && s.value) {
|
1445
1445
|
const o = E(s, {}, !1, !1, !0);
|
1446
|
-
r && r.afterEach((
|
1446
|
+
r && r.afterEach((a, i, l) => o(a, i, l, n));
|
1447
1447
|
}
|
1448
1448
|
}
|
1449
1449
|
function is(n, e, t = {}) {
|
@@ -1453,19 +1453,19 @@ function as(n, e, t) {
|
|
1453
1453
|
if (!n || !e || !t) return;
|
1454
1454
|
const { VueI18n: s } = e;
|
1455
1455
|
if (s) {
|
1456
|
-
const { locale: r, fallbackLocale: o, messages:
|
1457
|
-
for (let c of
|
1458
|
-
const f = Object.keys(c).filter((
|
1459
|
-
for (const
|
1460
|
-
|
1456
|
+
const { locale: r, fallbackLocale: o, messages: a = [] } = t, i = {};
|
1457
|
+
for (let c of a) {
|
1458
|
+
const f = Object.keys(c).filter((u) => u !== "key");
|
1459
|
+
for (const u of f)
|
1460
|
+
i[u] || (i[u] = {}), i[u][c.key] = c[u];
|
1461
1461
|
}
|
1462
|
-
const
|
1462
|
+
const l = s.createI18n({
|
1463
1463
|
legacy: !1,
|
1464
1464
|
locale: r,
|
1465
1465
|
fallbackLocale: o,
|
1466
|
-
messages:
|
1466
|
+
messages: i
|
1467
1467
|
});
|
1468
|
-
n.use(
|
1468
|
+
n.use(l);
|
1469
1469
|
}
|
1470
1470
|
}
|
1471
1471
|
const Ue = Symbol("Provider");
|
@@ -1483,18 +1483,18 @@ class ls extends ze {
|
|
1483
1483
|
mode: s = y.Raw,
|
1484
1484
|
dependencies: r,
|
1485
1485
|
materials: o,
|
1486
|
-
project:
|
1487
|
-
adapter:
|
1488
|
-
globals:
|
1486
|
+
project: a = {},
|
1487
|
+
adapter: i = {},
|
1488
|
+
globals: l = {},
|
1489
1489
|
modules: c = {},
|
1490
1490
|
router: f = null,
|
1491
|
-
materialPath:
|
1491
|
+
materialPath: u = "./",
|
1492
1492
|
nodeEnv: h = "development"
|
1493
1493
|
/* Development */
|
1494
1494
|
} = e;
|
1495
|
-
this.mode = s, this.modules = c, this.service = t, this.router = f, this.materialPath =
|
1495
|
+
this.mode = s, this.modules = c, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = h, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i);
|
1496
1496
|
const { access: p, request: d } = this.adapter;
|
1497
|
-
p && p.connect({ mode: s, router: f, request: d }),
|
1497
|
+
p && p.connect({ mode: s, router: f, request: d }), a && s !== y.Design ? this.load(a) : this.project = a;
|
1498
1498
|
}
|
1499
1499
|
mode;
|
1500
1500
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1502,7 +1502,7 @@ class ls extends ze {
|
|
1502
1502
|
// 全局变量
|
1503
1503
|
modules = {};
|
1504
1504
|
// 异步模块加载器
|
1505
|
-
adapter = { request: ne, jsonp:
|
1505
|
+
adapter = { request: ne, jsonp: be };
|
1506
1506
|
// 适配器接口
|
1507
1507
|
apis = {};
|
1508
1508
|
// API集合
|
@@ -1550,8 +1550,8 @@ class ls extends ze {
|
|
1550
1550
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
1551
1551
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1552
1552
|
throw new Error("project is null");
|
1553
|
-
const { apis: r = [], meta: o = [] } = this.project,
|
1554
|
-
|
1553
|
+
const { apis: r = [], meta: o = [] } = this.project, a = window;
|
1554
|
+
a && (a.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Et(r, o, this.adapter), Oe(a), Rt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1555
1555
|
}
|
1556
1556
|
initMock(e) {
|
1557
1557
|
const t = T(e);
|
@@ -1565,19 +1565,19 @@ class ls extends ze {
|
|
1565
1565
|
e[s] || (e[s] = this.library[s] = await r());
|
1566
1566
|
}
|
1567
1567
|
async loadAssets(e) {
|
1568
|
-
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath:
|
1569
|
-
libraryExports:
|
1568
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1569
|
+
libraryExports: l,
|
1570
1570
|
libraryMap: c,
|
1571
1571
|
materials: f,
|
1572
|
-
materialExports:
|
1572
|
+
materialExports: u,
|
1573
1573
|
materialMapLibrary: h
|
1574
1574
|
} = ft(
|
1575
1575
|
t,
|
1576
|
-
|
1577
|
-
|
1576
|
+
a,
|
1577
|
+
i === "development"
|
1578
1578
|
/* Development */
|
1579
1579
|
);
|
1580
|
-
for (const p of
|
1580
|
+
for (const p of l) {
|
1581
1581
|
const d = s[p], g = e[p];
|
1582
1582
|
if (g)
|
1583
1583
|
r[p] = g;
|
@@ -1590,11 +1590,11 @@ class ls extends ze {
|
|
1590
1590
|
r[p] = e[p];
|
1591
1591
|
}
|
1592
1592
|
}
|
1593
|
-
if (
|
1593
|
+
if (i === "development") {
|
1594
1594
|
for (const d of f)
|
1595
1595
|
await Se(k.append(d, { v: O }));
|
1596
1596
|
const p = this.materials || {};
|
1597
|
-
for (const d of
|
1597
|
+
for (const d of u) {
|
1598
1598
|
const g = e[h[d]], v = Ge[d];
|
1599
1599
|
if (v)
|
1600
1600
|
g && v.forEach((m) => {
|
@@ -1602,8 +1602,8 @@ class ls extends ze {
|
|
1602
1602
|
});
|
1603
1603
|
else {
|
1604
1604
|
const m = p[d] ? (await p[d]()).default : e[d];
|
1605
|
-
m && g && (m.components || []).forEach((
|
1606
|
-
o[
|
1605
|
+
m && g && (m.components || []).forEach((R) => {
|
1606
|
+
o[R.name] = pt(R, g);
|
1607
1607
|
});
|
1608
1608
|
}
|
1609
1609
|
}
|
@@ -1613,33 +1613,33 @@ class ls extends ze {
|
|
1613
1613
|
const { router: e, project: t, options: s, adapter: r } = this;
|
1614
1614
|
if (!e) return;
|
1615
1615
|
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1616
|
-
routeAppendTo:
|
1617
|
-
pageRouteName:
|
1618
|
-
routeMeta:
|
1619
|
-
} = s, c =
|
1620
|
-
path: `${c}${
|
1616
|
+
routeAppendTo: a,
|
1617
|
+
pageRouteName: i = o,
|
1618
|
+
routeMeta: l
|
1619
|
+
} = s, c = a ? "" : "/", f = {
|
1620
|
+
path: `${c}${i}/:id`,
|
1621
1621
|
name: D,
|
1622
1622
|
component: ee
|
1623
|
-
},
|
1623
|
+
}, u = {
|
1624
1624
|
path: c,
|
1625
1625
|
name: N,
|
1626
1626
|
component: t?.homepage ? ee : r.startupComponent || es,
|
1627
|
-
meta:
|
1627
|
+
meta: l
|
1628
1628
|
};
|
1629
1629
|
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
1630
1630
|
const h = t?.pages || [];
|
1631
1631
|
le({
|
1632
|
-
name:
|
1632
|
+
name: i,
|
1633
1633
|
prefix: c,
|
1634
1634
|
pages: h,
|
1635
1635
|
component: ee,
|
1636
1636
|
loader: this.getRenderComponent.bind(this),
|
1637
1637
|
homepage: t?.homepage
|
1638
1638
|
}).forEach((d) => {
|
1639
|
-
|
1640
|
-
}), t?.homepage || (
|
1639
|
+
a ? e.addRoute(a, d) : e.addRoute(d);
|
1640
|
+
}), t?.homepage || (a ? e.addRoute(a, u) : e.addRoute(u));
|
1641
1641
|
} else
|
1642
|
-
|
1642
|
+
a ? (e.addRoute(a, f), e.addRoute(a, u)) : (e.addRoute(f), e.addRoute(u));
|
1643
1643
|
}
|
1644
1644
|
/**
|
1645
1645
|
* Vue 插件安装方法
|
@@ -1662,7 +1662,7 @@ class ls extends ze {
|
|
1662
1662
|
library: this.library,
|
1663
1663
|
mode: this.mode
|
1664
1664
|
}), this.mode !== y.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), e.provide(Ue, this), e.config.globalProperties.$provider = this, this.options.enhance && e.use(this.options.enhance, this), this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
|
1665
|
-
const
|
1665
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", l = `[ ${a} ] ${i} ${o}`;
|
1666
1666
|
console.error(
|
1667
1667
|
"[VTJ Error]:",
|
1668
1668
|
{
|
@@ -1671,7 +1671,7 @@ class ls extends ze {
|
|
1671
1671
|
info: o
|
1672
1672
|
},
|
1673
1673
|
s?.stack
|
1674
|
-
), this.adapter.notify && this.adapter.notify(
|
1674
|
+
), this.adapter.notify && this.adapter.notify(l, "组件渲染错误", "error");
|
1675
1675
|
}), e.config.globalProperties.installed = t;
|
1676
1676
|
}
|
1677
1677
|
getFile(e) {
|
@@ -1680,13 +1680,13 @@ class ls extends ze {
|
|
1680
1680
|
}
|
1681
1681
|
getPage(e) {
|
1682
1682
|
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
1683
|
-
for (const
|
1684
|
-
if (
|
1685
|
-
return
|
1686
|
-
if (
|
1687
|
-
const
|
1688
|
-
if (
|
1689
|
-
return
|
1683
|
+
for (const a of o) {
|
1684
|
+
if (a.id === r)
|
1685
|
+
return a;
|
1686
|
+
if (a.children && a.children.length) {
|
1687
|
+
const i = s(r, a.children);
|
1688
|
+
if (i)
|
1689
|
+
return i;
|
1690
1690
|
}
|
1691
1691
|
}
|
1692
1692
|
};
|
@@ -1724,23 +1724,23 @@ class ls extends ze {
|
|
1724
1724
|
* @returns 渲染器实例
|
1725
1725
|
*/
|
1726
1726
|
createDslRenderer(e, t = {}) {
|
1727
|
-
const { library: s, components: r, mode: o, apis:
|
1727
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
1728
1728
|
mode: o,
|
1729
1729
|
Vue: s.Vue,
|
1730
1730
|
components: r,
|
1731
1731
|
libs: s,
|
1732
|
-
apis:
|
1732
|
+
apis: a,
|
1733
1733
|
window,
|
1734
1734
|
...t
|
1735
|
-
},
|
1735
|
+
}, l = ae({
|
1736
1736
|
getDsl: async (c) => await this.getDsl(c) || null,
|
1737
1737
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1738
|
-
options:
|
1738
|
+
options: i
|
1739
1739
|
});
|
1740
1740
|
return ie({
|
1741
|
-
...
|
1741
|
+
...i,
|
1742
1742
|
dsl: e,
|
1743
|
-
loader:
|
1743
|
+
loader: l
|
1744
1744
|
});
|
1745
1745
|
}
|
1746
1746
|
/**
|
@@ -1758,8 +1758,8 @@ class ls extends ze {
|
|
1758
1758
|
if (!s)
|
1759
1759
|
return F.warn(`Can not find file: ${e}`), null;
|
1760
1760
|
if (t && t(s), this.mode === y.Raw) {
|
1761
|
-
const { vtjRawDir: o = ".vtj/vue" } = this.options,
|
1762
|
-
return
|
1761
|
+
const { vtjRawDir: o = ".vtj/vue" } = this.options, a = `${o}/${e}.vue`, i = this.modules[a] || this.modules[`/src/pages/${e}.vue`];
|
1762
|
+
return i ? (await i())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
1763
1763
|
}
|
1764
1764
|
const r = await this.getDsl(s.id);
|
1765
1765
|
return r ? this.createDslRenderer(r).renderer : (F.warn(`Can not find dsl: ${e}`), null);
|
@@ -1833,14 +1833,14 @@ function Ne(n = {}) {
|
|
1833
1833
|
return e;
|
1834
1834
|
}
|
1835
1835
|
async function As(n, e = "") {
|
1836
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((
|
1837
|
-
if (o.length && ke(o),
|
1838
|
-
return await Fe(
|
1836
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((i) => e + i), { css: o, js: a } = dt(r);
|
1837
|
+
if (o.length && ke(o), a.length)
|
1838
|
+
return await Fe(a, t).catch(
|
1839
1839
|
() => {
|
1840
1840
|
}
|
1841
1841
|
);
|
1842
1842
|
}
|
1843
|
-
const
|
1843
|
+
const qe = {
|
1844
1844
|
type: "json",
|
1845
1845
|
validSuccess: !0,
|
1846
1846
|
originResponse: !1,
|
@@ -1855,7 +1855,7 @@ const Le = {
|
|
1855
1855
|
type: t,
|
1856
1856
|
data: s
|
1857
1857
|
},
|
1858
|
-
settings:
|
1858
|
+
settings: qe
|
1859
1859
|
}), fs = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1860
1860
|
url: e,
|
1861
1861
|
method: "post",
|
@@ -1864,12 +1864,12 @@ const Le = {
|
|
1864
1864
|
projectId: s
|
1865
1865
|
},
|
1866
1866
|
settings: {
|
1867
|
-
...
|
1867
|
+
...qe,
|
1868
1868
|
type: "data"
|
1869
1869
|
}
|
1870
1870
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1871
1871
|
function Is(n) {
|
1872
|
-
return
|
1872
|
+
return Re({
|
1873
1873
|
settings: {
|
1874
1874
|
type: "json",
|
1875
1875
|
validSuccess: !0,
|
@@ -1991,11 +1991,11 @@ const w = new nt({
|
|
1991
1991
|
});
|
1992
1992
|
class ks extends de {
|
1993
1993
|
init(e) {
|
1994
|
-
const t = new
|
1994
|
+
const t = new q(e), s = w.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1995
1995
|
return w.save(`project_${t.id}`, r), Promise.resolve(r);
|
1996
1996
|
}
|
1997
1997
|
saveProject(e) {
|
1998
|
-
const t = new
|
1998
|
+
const t = new q(e);
|
1999
1999
|
return w.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
2000
2000
|
}
|
2001
2001
|
saveMaterials(e, t) {
|
@@ -2046,11 +2046,11 @@ class ps extends de {
|
|
2046
2046
|
histories = {};
|
2047
2047
|
historyItems = {};
|
2048
2048
|
init(e) {
|
2049
|
-
const t = new
|
2049
|
+
const t = new q(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
2050
2050
|
return this.projects[r.id] = r, Promise.resolve(r);
|
2051
2051
|
}
|
2052
2052
|
saveProject(e) {
|
2053
|
-
const t = new
|
2053
|
+
const t = new q(e);
|
2054
2054
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
2055
2055
|
}
|
2056
2056
|
saveMaterials(e, t) {
|
@@ -2181,9 +2181,9 @@ export {
|
|
2181
2181
|
ks as StorageService,
|
2182
2182
|
O as VTJ_RENDERER_VERSION,
|
2183
2183
|
fe as adoptedStyleSheets,
|
2184
|
-
|
2184
|
+
bs as clearLoaderCache,
|
2185
2185
|
ht as compileScopedCSS,
|
2186
|
-
|
2186
|
+
Rs as createAccess,
|
2187
2187
|
Es as createAdapter,
|
2188
2188
|
ws as createAssetScripts,
|
2189
2189
|
Ss as createAssetsCss,
|
@@ -2192,7 +2192,7 @@ export {
|
|
2192
2192
|
Fs as createMemoryService,
|
2193
2193
|
K as createMenus,
|
2194
2194
|
jt as createMetaApi,
|
2195
|
-
|
2195
|
+
bt as createMock,
|
2196
2196
|
Cs as createProvider,
|
2197
2197
|
ie as createRenderer,
|
2198
2198
|
$t as createSchemaApi,
|
@@ -2219,7 +2219,7 @@ export {
|
|
2219
2219
|
Fe as loadScriptUrl,
|
2220
2220
|
Be as menusFilter,
|
2221
2221
|
Pt as mockApi,
|
2222
|
-
|
2222
|
+
Rt as mockApis,
|
2223
2223
|
Oe as mockCleanup,
|
2224
2224
|
M as nodeRender,
|
2225
2225
|
ft as parseDeps,
|