@vtj/renderer 0.16.24 → 0.16.26
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 +3 -3
- package/dist/index.mjs +239 -238
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base as Xe, BUILT_IN_COMPONENTS as Ye, ProjectModel as K, HistoryModel as Ce } from "@vtj/core";
|
|
2
|
-
import { url as O, isUrl as ae, dedupArray as Ze, isFunction as z, isString as I, logger as M, storage as se, cookie as ne, toArray as Se, unRSA as $e, delay as G, createRequest as Pe, jsonp as Ae, merge as et, pathToRegexp as tt, pathToRegexpMatch as st, formDataToJson as nt, isEqual as rt, Queue as
|
|
2
|
+
import { url as O, isUrl as ae, dedupArray as Ze, isFunction as z, isString as I, logger as M, storage as se, cookie as ne, toArray as Se, unRSA as $e, delay as G, createRequest as Pe, jsonp as Ae, merge as et, pathToRegexp as tt, pathToRegexpMatch as st, formDataToJson as nt, isEqual as rt, Queue as it, cloneDeep as Ee, camelCase as P, upperFirstCamelCase as ot, pick as at, request as ce, loadScript as be, debounce as ct, Storage as lt, mapToObject as me } from "@vtj/utils";
|
|
3
3
|
import * as W from "vue";
|
|
4
4
|
import { inject as Ie, defineComponent as Fe, h as le, ref as ue, watchEffect as ut, defineAsyncComponent as je } from "vue";
|
|
5
5
|
import { useRoute as Oe } from "vue-router";
|
|
@@ -7,10 +7,10 @@ import { useRoute as Oe } from "vue-router";
|
|
|
7
7
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
8
8
|
* @name @vtj/renderer
|
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
10
|
-
* @version 0.16.
|
|
10
|
+
* @version 0.16.26
|
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
12
12
|
*/
|
|
13
|
-
const k = "0.16.
|
|
13
|
+
const k = "0.16.26";
|
|
14
14
|
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
|
15
15
|
const Re = [
|
|
16
16
|
"$el",
|
|
@@ -163,17 +163,17 @@ function mt(n, e = !1) {
|
|
|
163
163
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
|
164
164
|
}
|
|
165
165
|
function gt(n, e, t = !1) {
|
|
166
|
-
const s = n.filter((p) => !!p.enabled), r = [],
|
|
166
|
+
const s = n.filter((p) => !!p.enabled), r = [], i = [], o = [], a = [], u = {}, c = {}, l = [], f = {};
|
|
167
167
|
return s.forEach(
|
|
168
168
|
({ urls: p, assetsUrl: d, library: m, assetsLibrary: h, localeLibrary: g }) => {
|
|
169
169
|
p?.forEach((v) => {
|
|
170
|
-
X(v) && r.push(mt(v, t)), Q(v) &&
|
|
171
|
-
}), m && (a.push(m), u[m] = q(p || [], e), g && (c[m] = g)), d &&
|
|
170
|
+
X(v) && r.push(mt(v, t)), Q(v) && i.push(v);
|
|
171
|
+
}), m && (a.push(m), u[m] = q(p || [], e), g && (c[m] = g)), d && o.push(d), h && l.push(h), m && h && (f[h] = m);
|
|
172
172
|
}
|
|
173
173
|
), {
|
|
174
174
|
scripts: q(r, e),
|
|
175
|
-
css: q(
|
|
176
|
-
materials: q(
|
|
175
|
+
css: q(i, e),
|
|
176
|
+
materials: q(o, e),
|
|
177
177
|
libraryExports: a,
|
|
178
178
|
materialExports: Ze(l),
|
|
179
179
|
materialMapLibrary: f,
|
|
@@ -260,7 +260,7 @@ function yt(n, e) {
|
|
|
260
260
|
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (l, f, p) => {
|
|
261
261
|
const d = f.trim(), m = p.trim();
|
|
262
262
|
return d ? `${d}[${e}] ${m}` : m;
|
|
263
|
-
}),
|
|
263
|
+
}), i = (c) => {
|
|
264
264
|
const l = c.trim();
|
|
265
265
|
if (!l || l.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(l) || s(l))
|
|
266
266
|
return l;
|
|
@@ -270,7 +270,7 @@ function yt(n, e) {
|
|
|
270
270
|
return m ? `${m}[${e}]${d}` : l;
|
|
271
271
|
}
|
|
272
272
|
return `${l}[${e}]`;
|
|
273
|
-
},
|
|
273
|
+
}, o = (c) => r(c).split(",").map((f) => i(f)).filter((f) => f.trim()).join(", "), a = (c) => c.map((l) => {
|
|
274
274
|
switch (l.type) {
|
|
275
275
|
case "simple-at-rule":
|
|
276
276
|
return l.content;
|
|
@@ -286,7 +286,7 @@ function yt(n, e) {
|
|
|
286
286
|
case "rule":
|
|
287
287
|
if (!l.selector || !l.content)
|
|
288
288
|
return "";
|
|
289
|
-
const f =
|
|
289
|
+
const f = o(l.selector);
|
|
290
290
|
return f.trim() ? `${f} { ${l.content} }` : "";
|
|
291
291
|
default:
|
|
292
292
|
return "";
|
|
@@ -314,26 +314,26 @@ function St(n, e, t) {
|
|
|
314
314
|
return e * s / r;
|
|
315
315
|
}
|
|
316
316
|
function $t(n, e) {
|
|
317
|
-
let t = !1, s = !1, r = !1,
|
|
318
|
-
for (let
|
|
319
|
-
const a = e[
|
|
320
|
-
if (a === "'" && !s && !r ? t = !t : a === '"' && !t && !r ? s = !s : e.substr(
|
|
321
|
-
const u = e.substr(
|
|
317
|
+
let t = !1, s = !1, r = !1, i = "";
|
|
318
|
+
for (let o = 0; o < e.length; o++) {
|
|
319
|
+
const a = e[o];
|
|
320
|
+
if (a === "'" && !s && !r ? t = !t : a === '"' && !t && !r ? s = !s : e.substr(o, 4).toLowerCase() === "url(" && !t && !s ? r = !0 : a === ")" && r && (r = !1), !t && !s && !r) {
|
|
321
|
+
const u = e.substr(o).match(/^(-?\d+(?:\.\d+)?)\s*rpx/);
|
|
322
322
|
if (u) {
|
|
323
323
|
const c = u[1], l = parseFloat(c), p = `${St(n, l).toFixed(6).replace(/\.?0+$/, "")}px`;
|
|
324
|
-
|
|
324
|
+
i += p, o += u[0].length - 1;
|
|
325
325
|
continue;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
i += a;
|
|
329
329
|
}
|
|
330
|
-
return
|
|
330
|
+
return i;
|
|
331
331
|
}
|
|
332
332
|
function Te(n) {
|
|
333
333
|
return I(n) ? n : JSON.stringify(n);
|
|
334
334
|
}
|
|
335
335
|
function ge(n, e, t, s = !1) {
|
|
336
|
-
const r = n.CSSStyleSheet,
|
|
336
|
+
const r = n.CSSStyleSheet, i = s ? `data-v-${e}` : e, o = n.__uniConfig ? $t(n, t) : t, a = s ? yt(o, i) : o, u = !!n.__uniConfig;
|
|
337
337
|
if (r.prototype.replaceSync && !u) {
|
|
338
338
|
const c = new r();
|
|
339
339
|
c.id = e, c.replaceSync(a);
|
|
@@ -371,18 +371,18 @@ function xe(n, e = window) {
|
|
|
371
371
|
const t = e.document, s = e.document.head;
|
|
372
372
|
for (const r of n)
|
|
373
373
|
if (!t.getElementById(r)) {
|
|
374
|
-
const
|
|
375
|
-
|
|
374
|
+
const o = t.createElement("link");
|
|
375
|
+
o.rel = "stylesheet", o.id = r, o.href = r, s.appendChild(o);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
async function De(n, e, t = window) {
|
|
379
379
|
const s = t.document, r = t.document.head;
|
|
380
|
-
let
|
|
381
|
-
return
|
|
380
|
+
let i = t[e];
|
|
381
|
+
return i ? i.default || i : new Promise((o, a) => {
|
|
382
382
|
for (const u of n) {
|
|
383
383
|
const c = s.createElement("script");
|
|
384
384
|
c.src = u, c.onload = () => {
|
|
385
|
-
|
|
385
|
+
i = t[e], i ? o(i.default || i) : a(null);
|
|
386
386
|
}, c.onerror = (l) => {
|
|
387
387
|
a(l);
|
|
388
388
|
}, r.appendChild(c);
|
|
@@ -412,30 +412,30 @@ function Ts(n, e, t) {
|
|
|
412
412
|
}
|
|
413
413
|
function B(n, e, t = !1, s = !1, r = !1) {
|
|
414
414
|
try {
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
let
|
|
418
|
-
r || (
|
|
419
|
-
`) +
|
|
415
|
+
const i = ['"use strict";', "var __self = arguments[0];"];
|
|
416
|
+
i.push("return ");
|
|
417
|
+
let o = (n.value || "").trim();
|
|
418
|
+
r || (o = o.replace(/this(\W|$)/g, (u, c) => `__self${c}`)), o = i.join(`
|
|
419
|
+
`) + o;
|
|
420
420
|
const a = r ? `
|
|
421
|
-
${
|
|
422
|
-
` : `with(${t ? "{}" : "$scope || {}"}) { ${
|
|
421
|
+
${o}
|
|
422
|
+
` : `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
423
423
|
return new Function("$scope", a)(e);
|
|
424
|
-
} catch (
|
|
425
|
-
if (M.error("parseExpression.error",
|
|
426
|
-
throw
|
|
424
|
+
} catch (i) {
|
|
425
|
+
if (M.error("parseExpression.error", i, n, e?.__self ?? e), s)
|
|
426
|
+
throw i;
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
function R(n, e, t = !1, s = !1, r = !1) {
|
|
430
|
-
const
|
|
431
|
-
if (typeof
|
|
430
|
+
const i = B(n, e, t, s, r);
|
|
431
|
+
if (typeof i != "function" && (M.error(
|
|
432
432
|
"parseFunction.error",
|
|
433
433
|
"not a function",
|
|
434
434
|
n,
|
|
435
435
|
e?.__self ?? e
|
|
436
436
|
), s))
|
|
437
437
|
throw new Error(`"${n.value}" not a function`);
|
|
438
|
-
return
|
|
438
|
+
return i;
|
|
439
439
|
}
|
|
440
440
|
function E(n) {
|
|
441
441
|
return n && n.type === "JSExpression";
|
|
@@ -483,11 +483,11 @@ class _e {
|
|
|
483
483
|
this.mode = t, s && this.mode !== y.Design && this.setGuard(s), r && this.setRequest(r);
|
|
484
484
|
}
|
|
485
485
|
login(e) {
|
|
486
|
-
const { storageKey: t, storagePrefix: s, session: r, authKey:
|
|
486
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: i } = this.options;
|
|
487
487
|
this.setData(e), this.data && (se.save(t, e, {
|
|
488
488
|
type: "local",
|
|
489
489
|
prefix: s
|
|
490
|
-
}), r && ne.set(
|
|
490
|
+
}), r && ne.set(i, this.data.token));
|
|
491
491
|
}
|
|
492
492
|
clear() {
|
|
493
493
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
|
@@ -507,11 +507,11 @@ class _e {
|
|
|
507
507
|
}
|
|
508
508
|
can(e) {
|
|
509
509
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
|
510
|
-
return typeof e == "function" ? e(s) : Se(e).every((
|
|
510
|
+
return typeof e == "function" ? e(s) : Se(e).every((i) => s[i] || s[t + "." + i]);
|
|
511
511
|
}
|
|
512
512
|
some(e) {
|
|
513
513
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
|
514
|
-
return Se(e).some((
|
|
514
|
+
return Se(e).some((i) => s[i] || s[t + "." + i]);
|
|
515
515
|
}
|
|
516
516
|
install(e) {
|
|
517
517
|
e.config.globalProperties.$access = this, e.provide(ke, this);
|
|
@@ -628,8 +628,8 @@ function Ds(n = {}) {
|
|
|
628
628
|
loading: t,
|
|
629
629
|
settings: s = {},
|
|
630
630
|
Startup: r,
|
|
631
|
-
access:
|
|
632
|
-
useTitle:
|
|
631
|
+
access: i,
|
|
632
|
+
useTitle: o,
|
|
633
633
|
alert: a
|
|
634
634
|
} = n;
|
|
635
635
|
let u = null;
|
|
@@ -657,10 +657,10 @@ function Ds(n = {}) {
|
|
|
657
657
|
jsonp: Ae,
|
|
658
658
|
notify: e,
|
|
659
659
|
loading: t,
|
|
660
|
-
useTitle:
|
|
660
|
+
useTitle: o,
|
|
661
661
|
alert: a,
|
|
662
662
|
startupComponent: r,
|
|
663
|
-
access:
|
|
663
|
+
access: i ? new _e({ alert: a, ...i }) : void 0
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
666
|
function ks(n = {}) {
|
|
@@ -674,7 +674,7 @@ function It(n, e) {
|
|
|
674
674
|
query: r
|
|
675
675
|
});
|
|
676
676
|
{
|
|
677
|
-
const r = n.headers ? B(n.headers, {}, !0) : void 0,
|
|
677
|
+
const r = n.headers ? B(n.headers, {}, !0) : void 0, i = {
|
|
678
678
|
url: n.url,
|
|
679
679
|
method: n.method,
|
|
680
680
|
settings: {
|
|
@@ -682,26 +682,26 @@ function It(n, e) {
|
|
|
682
682
|
headers: r
|
|
683
683
|
}
|
|
684
684
|
};
|
|
685
|
-
return (
|
|
685
|
+
return (o, a) => (delete i.data, s.send(et(i, a || {}, { data: o })));
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
function Ft(n, e) {
|
|
689
689
|
const { metaQuery: t } = e;
|
|
690
690
|
if (!t) return;
|
|
691
691
|
const { code: s, queryCode: r } = n;
|
|
692
|
-
return (
|
|
692
|
+
return (i, o) => {
|
|
693
693
|
if (!t) {
|
|
694
694
|
console.warn("adapter.metaQuery is not defined!");
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
return t(s, r,
|
|
697
|
+
return t(s, r, i, o);
|
|
698
698
|
};
|
|
699
699
|
}
|
|
700
700
|
function Ot(n = [], e = [], t) {
|
|
701
701
|
const s = {};
|
|
702
702
|
for (const r of n) {
|
|
703
|
-
const
|
|
704
|
-
s[r.id] =
|
|
703
|
+
const i = It(r, t);
|
|
704
|
+
s[r.id] = i, s[r.name] = i;
|
|
705
705
|
}
|
|
706
706
|
for (const r of e)
|
|
707
707
|
s[r.id] = Ft(r, t);
|
|
@@ -714,14 +714,14 @@ async function Mt(n = [], e = window) {
|
|
|
714
714
|
function Tt(n, e = window) {
|
|
715
715
|
const t = $(n.mockTemplate) && n.mockTemplate.value ? R(n.mockTemplate, {}, !0) : void 0, s = N(e);
|
|
716
716
|
return async (...r) => {
|
|
717
|
-
let
|
|
717
|
+
let i = {};
|
|
718
718
|
if (t)
|
|
719
719
|
try {
|
|
720
|
-
|
|
721
|
-
} catch (
|
|
722
|
-
M.warn("模拟数据模版异常",
|
|
720
|
+
i = await t.apply(t, r);
|
|
721
|
+
} catch (o) {
|
|
722
|
+
M.warn("模拟数据模版异常", o);
|
|
723
723
|
}
|
|
724
|
-
return s?.mock(
|
|
724
|
+
return s?.mock(i);
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
727
|
function xt(n, e) {
|
|
@@ -729,14 +729,14 @@ function xt(n, e) {
|
|
|
729
729
|
const { url: t, mockTemplate: s } = e;
|
|
730
730
|
if (t && s)
|
|
731
731
|
try {
|
|
732
|
-
const r = ae(t) ? new URL(t).pathname : t,
|
|
733
|
-
n.mock(
|
|
734
|
-
const c = O.parse(u.url) || {}, l = u.body instanceof FormData ? nt(u.body) : u.body, f = ae(u.url) ? new URL(u.url).pathname : u.url.split("?")[0], p =
|
|
732
|
+
const r = ae(t) ? new URL(t).pathname : t, i = tt(`(.*)${r}(.*)`), o = st(r, { decode: decodeURIComponent }), a = B(s, {}, !0);
|
|
733
|
+
n.mock(i, (u) => {
|
|
734
|
+
const c = O.parse(u.url) || {}, l = u.body instanceof FormData ? nt(u.body) : u.body, f = ae(u.url) ? new URL(u.url).pathname : u.url.split("?")[0], p = o(f)?.params;
|
|
735
735
|
Object.assign(u, { data: l, params: p, query: c });
|
|
736
736
|
try {
|
|
737
737
|
return n.mock(a(u));
|
|
738
738
|
} catch (d) {
|
|
739
|
-
return console.warn("[mockApi]",
|
|
739
|
+
return console.warn("[mockApi]", i, u, d), null;
|
|
740
740
|
}
|
|
741
741
|
});
|
|
742
742
|
} catch (r) {
|
|
@@ -827,19 +827,19 @@ class Dt {
|
|
|
827
827
|
let s = e ? this.__refCaches[e] : null;
|
|
828
828
|
return s || (s = async (r) => {
|
|
829
829
|
await G(0);
|
|
830
|
-
let
|
|
831
|
-
if (!
|
|
830
|
+
let i = r?.$vtjEl || r?.$el || r?._?.vnode?.el || r;
|
|
831
|
+
if (!i) {
|
|
832
832
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
833
833
|
return;
|
|
834
834
|
}
|
|
835
|
-
return
|
|
835
|
+
return i.nodeType === 3 && i.nextSibling && (i = i.nextSibling), i.__vtj__ = e, y.Design === this.__mode && (i.__context__ = this, i.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, r)), typeof t == "function" ? t(r) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, r)), r;
|
|
836
836
|
}, e && (this.__refCaches[e] = s), s);
|
|
837
837
|
}
|
|
838
838
|
__getRefEl(e, t, s) {
|
|
839
839
|
const r = e[t];
|
|
840
840
|
if (r && s !== r) {
|
|
841
|
-
const
|
|
842
|
-
return Array.from(
|
|
841
|
+
const i = new Set([].concat(r, s));
|
|
842
|
+
return Array.from(i);
|
|
843
843
|
} else
|
|
844
844
|
return s;
|
|
845
845
|
}
|
|
@@ -857,12 +857,12 @@ function fe(n) {
|
|
|
857
857
|
mode: t = y.Runtime,
|
|
858
858
|
components: s = {},
|
|
859
859
|
libs: r = {},
|
|
860
|
-
apis:
|
|
861
|
-
loader:
|
|
860
|
+
apis: i = {},
|
|
861
|
+
loader: o
|
|
862
862
|
} = n, a = e.computed(() => n.dsl), u = {
|
|
863
863
|
$components: s,
|
|
864
864
|
$libs: r,
|
|
865
|
-
$apis:
|
|
865
|
+
$apis: i
|
|
866
866
|
}, c = new Dt({
|
|
867
867
|
mode: t,
|
|
868
868
|
dsl: a.value,
|
|
@@ -873,7 +873,7 @@ function fe(n) {
|
|
|
873
873
|
props: {
|
|
874
874
|
...Ht(a.value.props ?? [], c)
|
|
875
875
|
},
|
|
876
|
-
async setup(f) {
|
|
876
|
+
async setup(f = {}) {
|
|
877
877
|
c.$props = f, c.props = f, a.value.id && ge(
|
|
878
878
|
n.window || window,
|
|
879
879
|
a.value.id,
|
|
@@ -895,6 +895,7 @@ function fe(n) {
|
|
|
895
895
|
return c.setup(g, e), Jt(e, a.value.watch ?? [], c), {
|
|
896
896
|
vtj: c,
|
|
897
897
|
state: c.state,
|
|
898
|
+
...f,
|
|
898
899
|
...p,
|
|
899
900
|
...d
|
|
900
901
|
};
|
|
@@ -905,10 +906,10 @@ function fe(n) {
|
|
|
905
906
|
if (!a.value.nodes) return null;
|
|
906
907
|
const f = a.value.nodes || [];
|
|
907
908
|
if (f.length === 1)
|
|
908
|
-
return T(f[0], c, e,
|
|
909
|
+
return T(f[0], c, e, o, f);
|
|
909
910
|
{
|
|
910
911
|
const p = f.map(
|
|
911
|
-
(d) => T(d, c, e,
|
|
912
|
+
(d) => T(d, c, e, o, f)
|
|
912
913
|
);
|
|
913
914
|
return e.createVNode("div", {}, p);
|
|
914
915
|
}
|
|
@@ -924,7 +925,7 @@ function kt(n = []) {
|
|
|
924
925
|
return n.map((e) => I(e) ? e : e.name);
|
|
925
926
|
}
|
|
926
927
|
function Ht(n = [], e) {
|
|
927
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((
|
|
928
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => pt[i]) : void 0;
|
|
928
929
|
return n.map((s) => I(s) ? {
|
|
929
930
|
name: s
|
|
930
931
|
} : {
|
|
@@ -945,8 +946,8 @@ function Nt(n, e, t) {
|
|
|
945
946
|
return n.reactive(
|
|
946
947
|
Object.keys(e || {}).reduce(
|
|
947
948
|
(s, r) => {
|
|
948
|
-
let
|
|
949
|
-
return E(
|
|
949
|
+
let i = e[r];
|
|
950
|
+
return E(i) ? i = t.__parseExpression(i) : $(i) && (i = t.__parseFunction(i)), s[r] = i, s;
|
|
950
951
|
},
|
|
951
952
|
{}
|
|
952
953
|
)
|
|
@@ -954,7 +955,7 @@ function Nt(n, e, t) {
|
|
|
954
955
|
}
|
|
955
956
|
function Bt(n, e, t) {
|
|
956
957
|
return Object.entries(e ?? {}).reduce(
|
|
957
|
-
(s, [r,
|
|
958
|
+
(s, [r, i]) => (s[r] = n.computed(t.__parseFunction(i)), s),
|
|
958
959
|
{}
|
|
959
960
|
);
|
|
960
961
|
}
|
|
@@ -967,10 +968,10 @@ function Lt(n, e) {
|
|
|
967
968
|
function qt(n, e = [], t) {
|
|
968
969
|
return e.reduce(
|
|
969
970
|
(s, r) => {
|
|
970
|
-
const { name:
|
|
971
|
+
const { name: i, from: o } = r || {};
|
|
971
972
|
r.default;
|
|
972
|
-
const a = E(
|
|
973
|
-
return s[
|
|
973
|
+
const a = E(o) ? t.__parseExpression(o) || i : o ?? i, u = E(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
|
974
|
+
return s[i] = n.inject(a, u), s;
|
|
974
975
|
},
|
|
975
976
|
{}
|
|
976
977
|
);
|
|
@@ -982,10 +983,10 @@ function Ut(n, e) {
|
|
|
982
983
|
if (r.type === "mock")
|
|
983
984
|
t[s] = Tt(r);
|
|
984
985
|
else if (r.ref) {
|
|
985
|
-
const
|
|
986
|
+
const i = e.$apis[r.ref], o = $(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
|
986
987
|
t[s] = async (...a) => {
|
|
987
|
-
const u = await
|
|
988
|
-
return
|
|
988
|
+
const u = await i.apply(e, a);
|
|
989
|
+
return o ? o(u) : u;
|
|
989
990
|
};
|
|
990
991
|
}
|
|
991
992
|
return t;
|
|
@@ -1008,9 +1009,9 @@ function Jt(n, e = [], t) {
|
|
|
1008
1009
|
function Kt(n, e) {
|
|
1009
1010
|
return Object.entries(n ?? {}).reduce(
|
|
1010
1011
|
(t, [s, r]) => {
|
|
1011
|
-
const
|
|
1012
|
+
const i = e.__parseFunction(r);
|
|
1012
1013
|
return t[s] = async () => {
|
|
1013
|
-
z(
|
|
1014
|
+
z(i) && (await G(0), await i());
|
|
1014
1015
|
}, t;
|
|
1015
1016
|
},
|
|
1016
1017
|
{}
|
|
@@ -1058,14 +1059,14 @@ class zt {
|
|
|
1058
1059
|
this.__props = {}, this.__events = {}, this.__nodes = {};
|
|
1059
1060
|
}
|
|
1060
1061
|
}
|
|
1061
|
-
const x = new zt(), Ne = new
|
|
1062
|
+
const x = new zt(), Ne = new it();
|
|
1062
1063
|
let re = [], F = {}, D = {};
|
|
1063
1064
|
const Gt = (n, e) => e;
|
|
1064
1065
|
async function Be(n, e = window) {
|
|
1065
1066
|
const { urls: t = [], library: s } = n, r = t.filter((a) => X(a));
|
|
1066
1067
|
if (r.length === 0 || !s) return null;
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
1068
|
+
const i = t.filter((a) => Q(a));
|
|
1069
|
+
return i.length && xe(i, e), await De(r, s, e).catch(
|
|
1069
1070
|
(a) => (console.warn("loadScriptUrl error", r, s, a), null)
|
|
1070
1071
|
);
|
|
1071
1072
|
}
|
|
@@ -1073,16 +1074,16 @@ function pe(n) {
|
|
|
1073
1074
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
|
1074
1075
|
return s.window && (re.forEach((r) => {
|
|
1075
1076
|
delete s.window[r];
|
|
1076
|
-
}), re = []), (r,
|
|
1077
|
-
if (!
|
|
1077
|
+
}), re = []), (r, i, o, a = W) => {
|
|
1078
|
+
if (!o || typeof o == "string") return i;
|
|
1078
1079
|
let u = "";
|
|
1079
|
-
if (
|
|
1080
|
-
return u =
|
|
1081
|
-
const c = F[
|
|
1082
|
-
|
|
1083
|
-
() => e(
|
|
1080
|
+
if (o.type === "Schema" && o.id)
|
|
1081
|
+
return u = o.id + "_" + r, D[u] || (D[u] = a.defineAsyncComponent(async () => {
|
|
1082
|
+
const c = F[o.id] || await Ne.add(
|
|
1083
|
+
o.id,
|
|
1084
|
+
() => e(o.id)
|
|
1084
1085
|
);
|
|
1085
|
-
return c && (c.name =
|
|
1086
|
+
return c && (c.name = i, F[o.id] = c), c ? fe({
|
|
1086
1087
|
Vue: a,
|
|
1087
1088
|
mode: y.Runtime,
|
|
1088
1089
|
...s,
|
|
@@ -1090,10 +1091,10 @@ function pe(n) {
|
|
|
1090
1091
|
loader: pe(n)
|
|
1091
1092
|
}).renderer : null;
|
|
1092
1093
|
}));
|
|
1093
|
-
if (
|
|
1094
|
-
return u =
|
|
1095
|
-
const c = F[
|
|
1096
|
-
return c && (c.name =
|
|
1094
|
+
if (o.type === "UrlSchema" && o.url)
|
|
1095
|
+
return u = o.url + "_" + r, D[u] || (D[u] = a.defineAsyncComponent(async () => {
|
|
1096
|
+
const c = F[o.url] || await t(o.url);
|
|
1097
|
+
return c && (c.name = i, F[o.url] = c), c ? fe({
|
|
1097
1098
|
...s,
|
|
1098
1099
|
Vue: a,
|
|
1099
1100
|
dsl: Ee(c),
|
|
@@ -1101,25 +1102,25 @@ function pe(n) {
|
|
|
1101
1102
|
loader: pe(n)
|
|
1102
1103
|
}).renderer : null;
|
|
1103
1104
|
}));
|
|
1104
|
-
if (
|
|
1105
|
-
let c =
|
|
1106
|
-
return c || (
|
|
1105
|
+
if (o.type === "Plugin") {
|
|
1106
|
+
let c = o.library ? F[o.library] : null;
|
|
1107
|
+
return c || (o.library && re.push(o.library), c = F[o.library || Symbol()] = a.defineAsyncComponent(
|
|
1107
1108
|
async () => {
|
|
1108
|
-
const l = await Be(
|
|
1109
|
-
return l || (console.warn("getPlugin result is null",
|
|
1109
|
+
const l = await Be(o, s.window);
|
|
1110
|
+
return l || (console.warn("getPlugin result is null", o), null);
|
|
1110
1111
|
}
|
|
1111
1112
|
), c);
|
|
1112
1113
|
}
|
|
1113
|
-
return
|
|
1114
|
+
return i;
|
|
1114
1115
|
};
|
|
1115
1116
|
}
|
|
1116
1117
|
function Hs() {
|
|
1117
1118
|
F = {}, D = {}, Ne.clearAllCache(), x.clear();
|
|
1118
1119
|
}
|
|
1119
|
-
function T(n, e, t = W, s = Gt, r = [],
|
|
1120
|
+
function T(n, e, t = W, s = Gt, r = [], i = !1, o = 0) {
|
|
1120
1121
|
if (!n || !n.name || n.invisible) return null;
|
|
1121
1122
|
const a = t.getCurrentInstance()?.appContext, { id: u = null, directives: c = [] } = n, { vIf: l, vElseIf: f, vElse: p, vFor: d, vShow: m, vModels: h, vBind: g, vHtml: v, others: w } = Le(c);
|
|
1122
|
-
if (!
|
|
1123
|
+
if (!i && (f || p))
|
|
1123
1124
|
return null;
|
|
1124
1125
|
if (l && !Wt(l, e))
|
|
1125
1126
|
return es(n, e, t, s, r);
|
|
@@ -1142,7 +1143,7 @@ function T(n, e, t = W, s = Gt, r = [], o = !1, i = 0) {
|
|
|
1142
1143
|
A.style ?? {},
|
|
1143
1144
|
ns(m, _)
|
|
1144
1145
|
)), v && Object.assign(A, rs(v, _)), h.forEach((j) => {
|
|
1145
|
-
Me.includes(n.name) ? Object.assign(A,
|
|
1146
|
+
Me.includes(n.name) ? Object.assign(A, is(j, _)) : Object.assign(A, os(t, j, _));
|
|
1146
1147
|
});
|
|
1147
1148
|
const Ve = as(
|
|
1148
1149
|
t,
|
|
@@ -1166,21 +1167,21 @@ function T(n, e, t = W, s = Gt, r = [], o = !1, i = 0) {
|
|
|
1166
1167
|
const we = a ? Vt(a, w, _) : [];
|
|
1167
1168
|
return we.length && (te = t.withDirectives(te, we)), te;
|
|
1168
1169
|
};
|
|
1169
|
-
return d ? us(d, b, e) : b(e,
|
|
1170
|
+
return d ? us(d, b, e) : b(e, o);
|
|
1170
1171
|
}
|
|
1171
1172
|
function Vt(n, e, t) {
|
|
1172
1173
|
const s = n.app;
|
|
1173
1174
|
return e.map((r) => {
|
|
1174
|
-
const
|
|
1175
|
-
if (!
|
|
1176
|
-
const
|
|
1177
|
-
return r.value &&
|
|
1175
|
+
const i = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
|
1176
|
+
if (!i) return null;
|
|
1177
|
+
const o = [i];
|
|
1178
|
+
return r.value && o.push(t.__parseExpression(r.value)), r.arg && o.push(r.arg), r.modifiers && o.push(r.modifiers), o;
|
|
1178
1179
|
}).filter((r) => !!r);
|
|
1179
1180
|
}
|
|
1180
1181
|
function Le(n = []) {
|
|
1181
1182
|
const e = n.find((l) => P(l.name) === "vIf"), t = n.find(
|
|
1182
1183
|
(l) => P(l.name) === "vElseIf"
|
|
1183
|
-
), s = n.find((l) => P(l.name) === "vElse"), r = n.find((l) => P(l.name) === "vFor"),
|
|
1184
|
+
), s = n.find((l) => P(l.name) === "vElse"), r = n.find((l) => P(l.name) === "vFor"), i = n.find((l) => P(l.name) === "vShow"), o = n.find((l) => P(l.name) === "vBind"), a = n.find((l) => P(l.name) === "vHtml"), u = n.filter(
|
|
1184
1185
|
(l) => P(l.name) === "vModel"
|
|
1185
1186
|
), c = n.filter(
|
|
1186
1187
|
(l) => !ft.includes(P(l.name))
|
|
@@ -1190,9 +1191,9 @@ function Le(n = []) {
|
|
|
1190
1191
|
vElseIf: t,
|
|
1191
1192
|
vElse: s,
|
|
1192
1193
|
vFor: r,
|
|
1193
|
-
vShow:
|
|
1194
|
+
vShow: i,
|
|
1194
1195
|
vModels: u,
|
|
1195
|
-
vBind:
|
|
1196
|
+
vBind: o,
|
|
1196
1197
|
others: c,
|
|
1197
1198
|
vHtml: a
|
|
1198
1199
|
};
|
|
@@ -1222,14 +1223,14 @@ function Yt(n, e) {
|
|
|
1222
1223
|
};
|
|
1223
1224
|
}
|
|
1224
1225
|
function Zt(n, e, t, s) {
|
|
1225
|
-
const r = ["passive", "capture", "once"],
|
|
1226
|
+
const r = ["passive", "capture", "once"], i = {
|
|
1226
1227
|
capture: "Capture",
|
|
1227
1228
|
once: "Once",
|
|
1228
1229
|
passive: "OnceCapture"
|
|
1229
1230
|
};
|
|
1230
1231
|
return Object.keys(t || {}).reduce(
|
|
1231
1232
|
(a, u) => {
|
|
1232
|
-
const c = t[u], l = qe(c.modifiers), f = l.find((m) => r.includes(m)), p = "on" +
|
|
1233
|
+
const c = t[u], l = qe(c.modifiers), f = l.find((m) => r.includes(m)), p = "on" + ot(u) + (f && i[f] || ""), d = s.__parseFunction(c.handler);
|
|
1233
1234
|
return d && (a[p] = n.withModifiers(
|
|
1234
1235
|
l.includes("enter") ? Yt(d, "enter") : d,
|
|
1235
1236
|
l
|
|
@@ -1239,16 +1240,16 @@ function Zt(n, e, t, s) {
|
|
|
1239
1240
|
);
|
|
1240
1241
|
}
|
|
1241
1242
|
function es(n, e, t, s, r = []) {
|
|
1242
|
-
let
|
|
1243
|
-
for (let
|
|
1244
|
-
const { directives: a = [] } = r[
|
|
1243
|
+
let i = r.findIndex((o) => o.id === n.id);
|
|
1244
|
+
for (let o = ++i; o < r.length; o++) {
|
|
1245
|
+
const { directives: a = [] } = r[o], { vElseIf: u, vElse: c } = Le(a);
|
|
1245
1246
|
if (u) {
|
|
1246
1247
|
if (e.__parseExpression(u.value))
|
|
1247
|
-
return T(r[
|
|
1248
|
+
return T(r[o], e, t, s, r, !0);
|
|
1248
1249
|
continue;
|
|
1249
1250
|
}
|
|
1250
1251
|
if (c)
|
|
1251
|
-
return T(r[
|
|
1252
|
+
return T(r[o], e, t, s, r, !0);
|
|
1252
1253
|
}
|
|
1253
1254
|
return null;
|
|
1254
1255
|
}
|
|
@@ -1257,11 +1258,11 @@ function qe(n = {}, e = !1) {
|
|
|
1257
1258
|
return e ? t.map((s) => "." + s) : t;
|
|
1258
1259
|
}
|
|
1259
1260
|
function ts(n, e, t, s, r) {
|
|
1260
|
-
const { children:
|
|
1261
|
-
return a ? a(t) :
|
|
1262
|
-
Te(s.__parseExpression(
|
|
1263
|
-
) : Array.isArray(
|
|
1264
|
-
(u, c) => T(u, s, n, r,
|
|
1261
|
+
const { children: i } = e, o = ss(e, s), a = s.$slots?.[o.name];
|
|
1262
|
+
return a ? a(t) : i ? I(i) ? n.createTextVNode(i) : E(i) ? n.createTextVNode(
|
|
1263
|
+
Te(s.__parseExpression(i))
|
|
1264
|
+
) : Array.isArray(i) ? i.map(
|
|
1265
|
+
(u, c) => T(u, s, n, r, i, !1, c)
|
|
1265
1266
|
) : null : null;
|
|
1266
1267
|
}
|
|
1267
1268
|
function ss(n, e) {
|
|
@@ -1281,7 +1282,7 @@ function rs(n, e) {
|
|
|
1281
1282
|
innerHTML: e.__parseExpression(n.value) || ""
|
|
1282
1283
|
};
|
|
1283
1284
|
}
|
|
1284
|
-
function
|
|
1285
|
+
function is(n, e) {
|
|
1285
1286
|
const t = {
|
|
1286
1287
|
type: "JSFunction",
|
|
1287
1288
|
value: n.value?.value ? `(v) => {
|
|
@@ -1293,18 +1294,18 @@ function os(n, e) {
|
|
|
1293
1294
|
onInput: e.__parseFunction(t)
|
|
1294
1295
|
};
|
|
1295
1296
|
}
|
|
1296
|
-
function
|
|
1297
|
+
function os(n, e, t) {
|
|
1297
1298
|
const s = {
|
|
1298
1299
|
type: "JSFunction",
|
|
1299
1300
|
value: e.value?.value ? `(v) => {
|
|
1300
1301
|
${e.value.value} = v;
|
|
1301
1302
|
}` : "(v) => {}"
|
|
1302
|
-
}, r = t.__parseFunction(s),
|
|
1303
|
+
}, r = t.__parseFunction(s), i = qe(
|
|
1303
1304
|
E(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
|
1304
|
-
),
|
|
1305
|
+
), o = E(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
1305
1306
|
return {
|
|
1306
|
-
[
|
|
1307
|
-
[`onUpdate:${
|
|
1307
|
+
[o]: t.__parseExpression(e.value),
|
|
1308
|
+
[`onUpdate:${o}`]: i.length && r ? n.withModifiers(r, i) : r
|
|
1308
1309
|
};
|
|
1309
1310
|
}
|
|
1310
1311
|
function as(n, e, t, s, r) {
|
|
@@ -1316,14 +1317,14 @@ function as(n, e, t, s, r) {
|
|
|
1316
1317
|
default: () => Te(t.__parseExpression(e))
|
|
1317
1318
|
};
|
|
1318
1319
|
if (Array.isArray(e) && e.length > 0) {
|
|
1319
|
-
const
|
|
1320
|
+
const i = cs(e), o = (a, u) => !a || !r ? {} : r?.id && Object.keys(a).length ? u ? {
|
|
1320
1321
|
[u]: a
|
|
1321
1322
|
} : {
|
|
1322
1323
|
[`scope_${r.id}`]: a
|
|
1323
1324
|
} : u ? { [u]: /* @__PURE__ */ Object.create(null) } : {};
|
|
1324
|
-
return Object.entries(
|
|
1325
|
+
return Object.entries(i).reduce(
|
|
1325
1326
|
(a, [u, { nodes: c, params: l, scope: f }]) => (a[u] = (p) => {
|
|
1326
|
-
const d = l.length ? at(p ?? {}, l) :
|
|
1327
|
+
const d = l.length ? at(p ?? {}, l) : o(p, f);
|
|
1327
1328
|
return c.map(
|
|
1328
1329
|
(m, h) => T(
|
|
1329
1330
|
m,
|
|
@@ -1357,20 +1358,20 @@ function ls(n = "default") {
|
|
|
1357
1358
|
return I(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
|
1358
1359
|
}
|
|
1359
1360
|
function us(n, e, t) {
|
|
1360
|
-
const { value: s, iterator: r } = n, { item:
|
|
1361
|
+
const { value: s, iterator: r } = n, { item: i = "item", index: o = "index" } = r || {};
|
|
1361
1362
|
let a = t.__parseExpression(s) || [];
|
|
1362
|
-
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [
|
|
1363
|
+
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((u, c) => c + 1)), Array.isArray(a) ? a.map((u, c) => e(t.__clone({ [i]: u, [o]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
1363
1364
|
}
|
|
1364
|
-
const
|
|
1365
|
+
const ie = Fe({
|
|
1365
1366
|
name: "VtjPageContainer",
|
|
1366
1367
|
async setup() {
|
|
1367
|
-
const n = Ke(), e = Oe(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null,
|
|
1368
|
+
const n = Ke(), e = Oe(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, i = ue(Symbol());
|
|
1368
1369
|
if (s) {
|
|
1369
1370
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
|
1370
|
-
const { useTitle:
|
|
1371
|
-
if (
|
|
1371
|
+
const { useTitle: o } = n?.adapter;
|
|
1372
|
+
if (o) {
|
|
1372
1373
|
const a = e.meta.title || s.title || "VTJ.PRO";
|
|
1373
|
-
|
|
1374
|
+
o(a);
|
|
1374
1375
|
}
|
|
1375
1376
|
}
|
|
1376
1377
|
return {
|
|
@@ -1379,7 +1380,7 @@ const oe = Fe({
|
|
|
1379
1380
|
file: s,
|
|
1380
1381
|
query: e.query,
|
|
1381
1382
|
meta: e.meta,
|
|
1382
|
-
sid:
|
|
1383
|
+
sid: i,
|
|
1383
1384
|
route: e
|
|
1384
1385
|
};
|
|
1385
1386
|
},
|
|
@@ -1403,17 +1404,17 @@ const oe = Fe({
|
|
|
1403
1404
|
function V(n, e, t = []) {
|
|
1404
1405
|
const s = [];
|
|
1405
1406
|
for (const r of t) {
|
|
1406
|
-
const { id:
|
|
1407
|
+
const { id: i, title: o, icon: a, children: u, hidden: c, layout: l } = r;
|
|
1407
1408
|
if (l) {
|
|
1408
1409
|
const f = V(n, e, u || []);
|
|
1409
1410
|
s.push(...f);
|
|
1410
1411
|
} else {
|
|
1411
1412
|
const f = {
|
|
1412
|
-
id:
|
|
1413
|
-
title:
|
|
1413
|
+
id: i,
|
|
1414
|
+
title: o,
|
|
1414
1415
|
icon: a,
|
|
1415
1416
|
hidden: c,
|
|
1416
|
-
url: `${n}/${e}/${
|
|
1417
|
+
url: `${n}/${e}/${i}`,
|
|
1417
1418
|
children: u && u.length ? V(n, e, u) : void 0
|
|
1418
1419
|
};
|
|
1419
1420
|
s.push(f);
|
|
@@ -1437,11 +1438,11 @@ function Ns(n) {
|
|
|
1437
1438
|
menuPathPrefix: e = "",
|
|
1438
1439
|
pageRouteName: t = "page",
|
|
1439
1440
|
disableMenusFilter: s = !1
|
|
1440
|
-
} = n || {}, r = Ke(),
|
|
1441
|
+
} = n || {}, r = Ke(), i = Oe(), o = At(), a = ue(!1), u = ue(!1), c = r.project, l = (d, m) => {
|
|
1441
1442
|
a.value = !d?.mask, u.value = m?.pure ?? !!d?.pure;
|
|
1442
1443
|
};
|
|
1443
1444
|
ut(() => {
|
|
1444
|
-
const { name: d, params: m, meta: h } =
|
|
1445
|
+
const { name: d, params: m, meta: h } = i;
|
|
1445
1446
|
if (d === H) {
|
|
1446
1447
|
const g = r.getPage(m.id);
|
|
1447
1448
|
l(g, h);
|
|
@@ -1467,15 +1468,15 @@ function Ns(n) {
|
|
|
1467
1468
|
logo: p?.logo,
|
|
1468
1469
|
themeSwitchable: p?.themeSwitchable,
|
|
1469
1470
|
title: p?.title || c?.description || c?.name || "VTJ App",
|
|
1470
|
-
menus: s ? f : Ue(f,
|
|
1471
|
+
menus: s ? f : Ue(f, o),
|
|
1471
1472
|
pure: u
|
|
1472
1473
|
};
|
|
1473
1474
|
}
|
|
1474
|
-
function
|
|
1475
|
-
const { id: t, title: s, meta: r } = n, { name:
|
|
1475
|
+
function oe(n, e) {
|
|
1476
|
+
const { id: t, title: s, meta: r } = n, { name: i = "page", prefix: o = "", component: a, routeMeta: u } = e;
|
|
1476
1477
|
return {
|
|
1477
1478
|
name: t,
|
|
1478
|
-
path: `${
|
|
1479
|
+
path: `${o}${i}/${t}`,
|
|
1479
1480
|
component: a,
|
|
1480
1481
|
meta: {
|
|
1481
1482
|
title: s,
|
|
@@ -1491,8 +1492,8 @@ function he(n) {
|
|
|
1491
1492
|
prefix: t = "",
|
|
1492
1493
|
pages: s = [],
|
|
1493
1494
|
component: r,
|
|
1494
|
-
loader:
|
|
1495
|
-
routeMeta:
|
|
1495
|
+
loader: i,
|
|
1496
|
+
routeMeta: o,
|
|
1496
1497
|
homepage: a
|
|
1497
1498
|
} = n, u = [];
|
|
1498
1499
|
for (const c of s) {
|
|
@@ -1502,9 +1503,9 @@ function he(n) {
|
|
|
1502
1503
|
name: e,
|
|
1503
1504
|
prefix: t,
|
|
1504
1505
|
component: r,
|
|
1505
|
-
routeMeta:
|
|
1506
|
+
routeMeta: o,
|
|
1506
1507
|
homepage: a,
|
|
1507
|
-
loader:
|
|
1508
|
+
loader: i,
|
|
1508
1509
|
pages: m || []
|
|
1509
1510
|
});
|
|
1510
1511
|
u.push(...g);
|
|
@@ -1513,76 +1514,76 @@ function he(n) {
|
|
|
1513
1514
|
name: e,
|
|
1514
1515
|
prefix: t,
|
|
1515
1516
|
component: r,
|
|
1516
|
-
routeMeta:
|
|
1517
|
+
routeMeta: o,
|
|
1517
1518
|
homepage: a,
|
|
1518
|
-
loader:
|
|
1519
|
+
loader: i,
|
|
1519
1520
|
pages: m || []
|
|
1520
1521
|
}), v = {
|
|
1521
1522
|
name: `layout_${l}`,
|
|
1522
1523
|
path: t,
|
|
1523
|
-
component: () =>
|
|
1524
|
+
component: () => i(l),
|
|
1524
1525
|
meta: {
|
|
1525
1526
|
title: f,
|
|
1526
|
-
...
|
|
1527
|
+
...o,
|
|
1527
1528
|
...h,
|
|
1528
1529
|
__vtj__: l
|
|
1529
1530
|
},
|
|
1530
1531
|
children: g
|
|
1531
1532
|
};
|
|
1532
|
-
u.push(v), u.push(
|
|
1533
|
-
} else if (u.push(
|
|
1534
|
-
const g =
|
|
1533
|
+
u.push(v), u.push(oe(c, n));
|
|
1534
|
+
} else if (u.push(oe(c, n)), a === l) {
|
|
1535
|
+
const g = oe(c, n);
|
|
1535
1536
|
g.path = "", g.name = `home_${l}`, u.push(g);
|
|
1536
1537
|
}
|
|
1537
1538
|
}
|
|
1538
1539
|
return u;
|
|
1539
1540
|
}
|
|
1540
1541
|
function ps(n = {}, e) {
|
|
1541
|
-
const { css: t, store: s, enhance: r } = n, { window:
|
|
1542
|
-
|
|
1542
|
+
const { css: t, store: s, enhance: r } = n, { window: i, app: o, library: a = {}, adapter: u, mode: c } = e, { Pinia: l } = a;
|
|
1543
|
+
o.config.globalProperties.$libs = a, ge(i, "global-css", t || ""), l && s && ds(s, o, l), ms(o, u, n), !u.access && n.access && hs(n.access, o, c, u), gs(o, n), r && _s(r, o, a);
|
|
1543
1544
|
}
|
|
1544
1545
|
function ds(n, e, t) {
|
|
1545
1546
|
const s = t.createPinia();
|
|
1546
1547
|
if (e.use(s), $(n) && n.value) {
|
|
1547
|
-
const r = R(n, {}, !1, !1, !0),
|
|
1548
|
-
e.config.globalProperties.$store =
|
|
1548
|
+
const r = R(n, {}, !1, !1, !0), i = t.defineStore("$store", r(e) || {});
|
|
1549
|
+
e.config.globalProperties.$store = i();
|
|
1549
1550
|
}
|
|
1550
1551
|
}
|
|
1551
1552
|
function hs(n, e, t, s) {
|
|
1552
1553
|
if ($(n) && n.value) {
|
|
1553
|
-
const r = R(n, {}, !1, !1, !0), { alert:
|
|
1554
|
-
alert:
|
|
1554
|
+
const r = R(n, {}, !1, !1, !0), { alert: i, request: o } = s, a = new _e({
|
|
1555
|
+
alert: i,
|
|
1555
1556
|
storagePrefix: "__VTJ_APP_",
|
|
1556
1557
|
...r(e)
|
|
1557
1558
|
}), u = e.config.globalProperties.$router;
|
|
1558
|
-
a.connect({ mode: t, router: u, request:
|
|
1559
|
+
a.connect({ mode: t, router: u, request: o }), e.use(a);
|
|
1559
1560
|
}
|
|
1560
1561
|
}
|
|
1561
1562
|
function ms(n, e, t) {
|
|
1562
1563
|
if (!e.request) return;
|
|
1563
|
-
const { axios: s, request: r, response:
|
|
1564
|
+
const { axios: s, request: r, response: i } = t;
|
|
1564
1565
|
if (s && $(s) && s.value) {
|
|
1565
|
-
const
|
|
1566
|
-
e.request.setConfig(
|
|
1566
|
+
const o = R(s, {}, !1, !1, !0);
|
|
1567
|
+
e.request.setConfig(o(n));
|
|
1567
1568
|
}
|
|
1568
1569
|
if (r && $(r) && r.value) {
|
|
1569
|
-
const
|
|
1570
|
-
a.__unReq && a.__unReq(), a.__unReq = e.request.useRequest((u) =>
|
|
1570
|
+
const o = R(r, {}, !1, !1, !0), a = e.request;
|
|
1571
|
+
a.__unReq && a.__unReq(), a.__unReq = e.request.useRequest((u) => o(u, n));
|
|
1571
1572
|
}
|
|
1572
|
-
if (
|
|
1573
|
-
const
|
|
1574
|
-
a.__unRes && a.__unRes(), a.__unRes = e.request.useResponse((u) =>
|
|
1573
|
+
if (i && $(i) && i.value) {
|
|
1574
|
+
const o = R(i, {}, !1, !1, !0), a = e.request;
|
|
1575
|
+
a.__unRes && a.__unRes(), a.__unRes = e.request.useResponse((u) => o(u, n));
|
|
1575
1576
|
}
|
|
1576
1577
|
}
|
|
1577
1578
|
function gs(n, e) {
|
|
1578
1579
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
|
1579
1580
|
if (t && $(t) && t.value) {
|
|
1580
|
-
const
|
|
1581
|
-
r && r.beforeEach((
|
|
1581
|
+
const i = R(t, {}, !1, !1, !0);
|
|
1582
|
+
r && r.beforeEach((o, a, u) => i(o, a, u, n));
|
|
1582
1583
|
}
|
|
1583
1584
|
if (s && $(s) && s.value) {
|
|
1584
|
-
const
|
|
1585
|
-
r && r.afterEach((
|
|
1585
|
+
const i = R(s, {}, !1, !1, !0);
|
|
1586
|
+
r && r.afterEach((o, a, u) => i(o, a, u, n));
|
|
1586
1587
|
}
|
|
1587
1588
|
}
|
|
1588
1589
|
function _s(n, e, t = {}) {
|
|
@@ -1592,8 +1593,8 @@ function vs(n, e, t) {
|
|
|
1592
1593
|
if (!n || !e || !t) return;
|
|
1593
1594
|
const { VueI18n: s } = e;
|
|
1594
1595
|
if (s) {
|
|
1595
|
-
const { locale: r, fallbackLocale:
|
|
1596
|
-
for (let c of
|
|
1596
|
+
const { locale: r, fallbackLocale: i, messages: o = [] } = t, a = {};
|
|
1597
|
+
for (let c of o) {
|
|
1597
1598
|
const l = Object.keys(c).filter((f) => f !== "key");
|
|
1598
1599
|
for (const f of l)
|
|
1599
1600
|
a[f] || (a[f] = {}), a[f][c.key] = c[f];
|
|
@@ -1601,7 +1602,7 @@ function vs(n, e, t) {
|
|
|
1601
1602
|
const u = s.createI18n({
|
|
1602
1603
|
legacy: !1,
|
|
1603
1604
|
locale: r,
|
|
1604
|
-
fallbackLocale:
|
|
1605
|
+
fallbackLocale: i,
|
|
1605
1606
|
messages: a
|
|
1606
1607
|
});
|
|
1607
1608
|
n.use(u);
|
|
@@ -1620,8 +1621,8 @@ class ws extends Xe {
|
|
|
1620
1621
|
service: t,
|
|
1621
1622
|
mode: s = y.Raw,
|
|
1622
1623
|
dependencies: r,
|
|
1623
|
-
materials:
|
|
1624
|
-
project:
|
|
1624
|
+
materials: i,
|
|
1625
|
+
project: o = {},
|
|
1625
1626
|
adapter: a = {},
|
|
1626
1627
|
globals: u = {},
|
|
1627
1628
|
modules: c = {},
|
|
@@ -1630,9 +1631,9 @@ class ws extends Xe {
|
|
|
1630
1631
|
nodeEnv: p = "development"
|
|
1631
1632
|
/* Development */
|
|
1632
1633
|
} = e;
|
|
1633
|
-
this.mode = s, this.modules = c, this.service = t, this.router = l, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r),
|
|
1634
|
+
this.mode = s, this.modules = c, this.service = t, this.router = l, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r), i && (this.materials = i), Object.assign(this.globals, u), Object.assign(this.adapter, a);
|
|
1634
1635
|
const { access: d, request: m } = this.adapter;
|
|
1635
|
-
d && d.connect({ mode: s, router: l, request: m }),
|
|
1636
|
+
d && d.connect({ mode: s, router: l, request: m }), o && s !== y.Design ? this.load(o) : this.project = o;
|
|
1636
1637
|
}
|
|
1637
1638
|
mode;
|
|
1638
1639
|
// 当前运行模式(设计/源码/预览等)
|
|
@@ -1677,8 +1678,8 @@ class ws extends Xe {
|
|
|
1677
1678
|
if (e)
|
|
1678
1679
|
try {
|
|
1679
1680
|
s = await e.apply(e, t);
|
|
1680
|
-
} catch (
|
|
1681
|
-
M.warn("模拟数据模版异常",
|
|
1681
|
+
} catch (i) {
|
|
1682
|
+
M.warn("模拟数据模版异常", i);
|
|
1682
1683
|
}
|
|
1683
1684
|
return N()?.mock(s);
|
|
1684
1685
|
};
|
|
@@ -1696,8 +1697,8 @@ class ws extends Xe {
|
|
|
1696
1697
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
|
1697
1698
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
|
1698
1699
|
throw new Error("project is null");
|
|
1699
|
-
const { apis: r = [], meta:
|
|
1700
|
-
a && (a.CKEDITOR_VERSION = void 0), this.initEnv(
|
|
1700
|
+
const { apis: r = [], meta: i = [], env: o = [] } = this.project, a = window;
|
|
1701
|
+
a && (a.CKEDITOR_VERSION = void 0), this.initEnv(o), this.mode === y.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Ot(r, i, this.adapter), He(a), Mt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
|
1701
1702
|
}
|
|
1702
1703
|
initMock(e) {
|
|
1703
1704
|
const t = N(e);
|
|
@@ -1714,8 +1715,8 @@ class ws extends Xe {
|
|
|
1714
1715
|
const { dependencies: t = [] } = this.project, {
|
|
1715
1716
|
dependencies: s,
|
|
1716
1717
|
library: r,
|
|
1717
|
-
components:
|
|
1718
|
-
materialPath:
|
|
1718
|
+
components: i,
|
|
1719
|
+
materialPath: o,
|
|
1719
1720
|
nodeEnv: a,
|
|
1720
1721
|
libraryLocales: u
|
|
1721
1722
|
} = this, {
|
|
@@ -1727,7 +1728,7 @@ class ws extends Xe {
|
|
|
1727
1728
|
libraryLocaleMap: m
|
|
1728
1729
|
} = gt(
|
|
1729
1730
|
t,
|
|
1730
|
-
|
|
1731
|
+
o,
|
|
1731
1732
|
a === "development"
|
|
1732
1733
|
/* Development */
|
|
1733
1734
|
);
|
|
@@ -1758,12 +1759,12 @@ class ws extends Xe {
|
|
|
1758
1759
|
const v = e[d[g]], w = v?.default || v, b = Ye[g];
|
|
1759
1760
|
if (b)
|
|
1760
1761
|
w && b.forEach((_) => {
|
|
1761
|
-
|
|
1762
|
+
i[_] = w[_];
|
|
1762
1763
|
});
|
|
1763
1764
|
else {
|
|
1764
1765
|
const _ = h[g] ? (await h[g]()).default : e[g];
|
|
1765
1766
|
_ && w && (_.components || []).forEach((C) => {
|
|
1766
|
-
|
|
1767
|
+
i[C.name] = _t(C, w);
|
|
1767
1768
|
});
|
|
1768
1769
|
}
|
|
1769
1770
|
}
|
|
@@ -1772,18 +1773,18 @@ class ws extends Xe {
|
|
|
1772
1773
|
initRouter() {
|
|
1773
1774
|
const { router: e, project: t, options: s, adapter: r } = this;
|
|
1774
1775
|
if (!e) return;
|
|
1775
|
-
const
|
|
1776
|
-
routeAppendTo:
|
|
1777
|
-
pageRouteName: a =
|
|
1776
|
+
const i = t?.platform === "uniapp" ? "pages" : "page", {
|
|
1777
|
+
routeAppendTo: o,
|
|
1778
|
+
pageRouteName: a = i,
|
|
1778
1779
|
routeMeta: u
|
|
1779
|
-
} = s, c =
|
|
1780
|
+
} = s, c = o ? "" : "/", l = {
|
|
1780
1781
|
path: `${c}${a}/:id`,
|
|
1781
1782
|
name: H,
|
|
1782
|
-
component:
|
|
1783
|
+
component: ie
|
|
1783
1784
|
}, f = this.getHomepage(), p = {
|
|
1784
1785
|
path: c,
|
|
1785
1786
|
name: J,
|
|
1786
|
-
component: f ?
|
|
1787
|
+
component: f ? ie : r.startupComponent || fs,
|
|
1787
1788
|
meta: u
|
|
1788
1789
|
};
|
|
1789
1790
|
if (e.hasRoute(H) && e.removeRoute(H), e.hasRoute(J) && e.removeRoute(J), s.enableStaticRoute) {
|
|
@@ -1792,18 +1793,18 @@ class ws extends Xe {
|
|
|
1792
1793
|
name: a,
|
|
1793
1794
|
prefix: c,
|
|
1794
1795
|
pages: d,
|
|
1795
|
-
component:
|
|
1796
|
+
component: ie,
|
|
1796
1797
|
loader: this.getRenderComponent.bind(this),
|
|
1797
1798
|
homepage: f?.id
|
|
1798
1799
|
}).forEach((h) => {
|
|
1799
|
-
|
|
1800
|
-
}), f || (
|
|
1800
|
+
o ? e.addRoute(o, h) : e.addRoute(h);
|
|
1801
|
+
}), f || (o ? e.addRoute(o, p) : e.addRoute(p));
|
|
1801
1802
|
} else
|
|
1802
|
-
|
|
1803
|
+
o ? (e.addRoute(o, l), e.addRoute(o, p)) : (e.addRoute(l), e.addRoute(p));
|
|
1803
1804
|
}
|
|
1804
1805
|
setErrorHandler(e) {
|
|
1805
1806
|
e.config.errorHandler = ct((t, s, r) => {
|
|
1806
|
-
const
|
|
1807
|
+
const i = s?.$options.name, o = typeof t == "string" ? t : t?.message || t?.msg || "未知错误", a = `[ ${i} ] ${o} ${r}`;
|
|
1807
1808
|
["getComputedStyle", "ResizeObserver"].some((c) => a.includes(c)) || (console.error(
|
|
1808
1809
|
"[VTJ Error]:",
|
|
1809
1810
|
{
|
|
@@ -1826,11 +1827,11 @@ class ws extends Xe {
|
|
|
1826
1827
|
* @param app Vue 应用实例
|
|
1827
1828
|
*/
|
|
1828
1829
|
install(e) {
|
|
1829
|
-
const { libraryLocaleMap: t, libraryLocales: s } = this, { libraryOptions: r = {} } = this.options,
|
|
1830
|
-
for (const [
|
|
1831
|
-
if (!o
|
|
1832
|
-
const c = { locale: s[t[
|
|
1833
|
-
e.use(a, f), o
|
|
1830
|
+
const { libraryLocaleMap: t, libraryLocales: s } = this, { libraryOptions: r = {} } = this.options, i = e.config.globalProperties.installed || {};
|
|
1831
|
+
for (const [o, a] of Object.entries(this.library))
|
|
1832
|
+
if (!i[o] && bt(a)) {
|
|
1833
|
+
const c = { locale: s[t[o]] }, l = r[o] || {}, f = { ...c, ...l };
|
|
1834
|
+
e.use(a, f), i[o] = !0;
|
|
1834
1835
|
}
|
|
1835
1836
|
e.provide(Je, this), e.config.globalProperties.$provider = this, e.config.globalProperties.$request = this.adapter?.request, this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), this.project?.platform !== "uniapp" && this.mode !== y.Design && this.initGlobals(this.project?.globals || {}, {
|
|
1836
1837
|
app: e,
|
|
@@ -1838,19 +1839,19 @@ class ws extends Xe {
|
|
|
1838
1839
|
adapter: this.adapter,
|
|
1839
1840
|
library: this.library,
|
|
1840
1841
|
mode: this.mode
|
|
1841
|
-
}), this.mode !== y.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), this.options.enhance && e.use(this.options.enhance, this), this.mode === y.Design && this.setErrorHandler(e), e.config.globalProperties.installed =
|
|
1842
|
+
}), this.mode !== y.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), this.options.enhance && e.use(this.options.enhance, this), this.mode === y.Design && this.setErrorHandler(e), e.config.globalProperties.installed = i;
|
|
1842
1843
|
}
|
|
1843
1844
|
getFile(e) {
|
|
1844
1845
|
const { blocks: t = [] } = this.project || {};
|
|
1845
1846
|
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
|
1846
1847
|
}
|
|
1847
1848
|
getPage(e) {
|
|
1848
|
-
const { pages: t = [] } = this.project || {}, s = (r,
|
|
1849
|
-
for (const
|
|
1850
|
-
if (
|
|
1851
|
-
return
|
|
1852
|
-
if (
|
|
1853
|
-
const a = s(r,
|
|
1849
|
+
const { pages: t = [] } = this.project || {}, s = (r, i = []) => {
|
|
1850
|
+
for (const o of i) {
|
|
1851
|
+
if (o.id === r)
|
|
1852
|
+
return o;
|
|
1853
|
+
if (o.children && o.children.length) {
|
|
1854
|
+
const a = s(r, o.children);
|
|
1854
1855
|
if (a)
|
|
1855
1856
|
return a;
|
|
1856
1857
|
}
|
|
@@ -1866,9 +1867,9 @@ class ws extends Xe {
|
|
|
1866
1867
|
if (r.type === "page" && !r.dir && !r.layout)
|
|
1867
1868
|
return r;
|
|
1868
1869
|
if (r.children && r.children.length) {
|
|
1869
|
-
const
|
|
1870
|
-
if (
|
|
1871
|
-
return
|
|
1870
|
+
const i = t(r.children);
|
|
1871
|
+
if (i)
|
|
1872
|
+
return i;
|
|
1872
1873
|
}
|
|
1873
1874
|
}
|
|
1874
1875
|
};
|
|
@@ -1906,12 +1907,12 @@ class ws extends Xe {
|
|
|
1906
1907
|
* @returns 渲染器实例
|
|
1907
1908
|
*/
|
|
1908
1909
|
createDslRenderer(e, t = {}) {
|
|
1909
|
-
const { library: s, components: r, mode:
|
|
1910
|
-
mode:
|
|
1910
|
+
const { library: s, components: r, mode: i, apis: o } = this, a = {
|
|
1911
|
+
mode: i,
|
|
1911
1912
|
Vue: s.Vue,
|
|
1912
1913
|
components: r,
|
|
1913
1914
|
libs: s,
|
|
1914
|
-
apis:
|
|
1915
|
+
apis: o,
|
|
1915
1916
|
window,
|
|
1916
1917
|
...t
|
|
1917
1918
|
}, u = pe({
|
|
@@ -1940,7 +1941,7 @@ class ws extends Xe {
|
|
|
1940
1941
|
if (!s)
|
|
1941
1942
|
return M.warn(`Can not find file: ${e}`), null;
|
|
1942
1943
|
if (t && t(s), this.mode === y.Raw) {
|
|
1943
|
-
const { vtjRawDir:
|
|
1944
|
+
const { vtjRawDir: i = ".vtj/vue" } = this.options, o = `${i}/${e}.vue`, a = this.modules[o] || this.modules[`/src/pages/${e}.vue`];
|
|
1944
1945
|
return a ? (await a())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
|
1945
1946
|
}
|
|
1946
1947
|
const r = await this.getDsl(s.id);
|
|
@@ -2021,9 +2022,9 @@ function Ke(n = {}) {
|
|
|
2021
2022
|
return e;
|
|
2022
2023
|
}
|
|
2023
2024
|
async function Ls(n, e = "") {
|
|
2024
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css:
|
|
2025
|
-
if (
|
|
2026
|
-
return await De(
|
|
2025
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((a) => e + a), { css: i, js: o } = vt(r);
|
|
2026
|
+
if (i.length && xe(i), o.length)
|
|
2027
|
+
return await De(o, t).catch(
|
|
2027
2028
|
() => {
|
|
2028
2029
|
}
|
|
2029
2030
|
);
|
|
@@ -2156,7 +2157,7 @@ class ve {
|
|
|
2156
2157
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
2157
2158
|
}
|
|
2158
2159
|
async getPluginMaterial(e) {
|
|
2159
|
-
const { urls: t = [] } = e, s = t.filter((
|
|
2160
|
+
const { urls: t = [] } = e, s = t.filter((i) => ht(i))[0];
|
|
2160
2161
|
if (!s) return null;
|
|
2161
2162
|
const r = this.pluginCaches[s];
|
|
2162
2163
|
return r || (this.pluginCaches[s] = ce.send({
|
|
@@ -2166,7 +2167,7 @@ class ve {
|
|
|
2166
2167
|
validSuccess: !1,
|
|
2167
2168
|
originResponse: !0
|
|
2168
2169
|
}
|
|
2169
|
-
}).then((
|
|
2170
|
+
}).then((i) => i.data).catch(() => null));
|
|
2170
2171
|
}
|
|
2171
2172
|
async genSource(e) {
|
|
2172
2173
|
return console.log("BaseService.genSource", e), "";
|
|
@@ -2205,7 +2206,7 @@ class Us extends ve {
|
|
|
2205
2206
|
removeHistory(e) {
|
|
2206
2207
|
const t = S.get(`history_${e}`);
|
|
2207
2208
|
if (t) {
|
|
2208
|
-
const r = (t.items || []).map((
|
|
2209
|
+
const r = (t.items || []).map((i) => i.id);
|
|
2209
2210
|
this.removeHistoryItem(e, r), S.remove(`history_${e}`);
|
|
2210
2211
|
}
|
|
2211
2212
|
return Promise.resolve(!0);
|
|
@@ -2260,7 +2261,7 @@ class Es extends ve {
|
|
|
2260
2261
|
removeHistory(e) {
|
|
2261
2262
|
const t = this.histories[e];
|
|
2262
2263
|
if (t) {
|
|
2263
|
-
const r = (t.items || []).map((
|
|
2264
|
+
const r = (t.items || []).map((i) => i.id);
|
|
2264
2265
|
this.removeHistoryItem(e, r), delete this.historyItems[e];
|
|
2265
2266
|
}
|
|
2266
2267
|
return Promise.resolve(!0);
|