@vtj/renderer 0.12.18 → 0.12.20
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 +5 -5
- package/dist/index.mjs +273 -256
- package/package.json +5 -5
- package/types/provider/enhance.d.ts +5 -0
- package/types/provider/index.d.ts +1 -0
- package/types/provider/provider.d.ts +1 -0
- package/types/utils/deps.d.ts +4 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
1
|
+
import { Base as xe, BUILT_IN_COMPONENTS as Oe, ProjectModel as N, HistoryModel as pe } from "@vtj/core";
|
2
|
+
import { isUrl as Ne, url as b, dedupArray as Be, isString as j, isFunction as V, logger as C, storage as J, cookie as K, toArray as re, unRSA as ie, delay as fe, createRequest as de, jsonp as he, merge as Ue, pathToRegexp as Le, pathToRegexpMatch as qe, formDataToJson as Je, cloneDeep as oe, camelCase as E, upperFirst as Ke, pick as ze, request as W, loadScript as ae, Storage as Ve, mapToObject as te } from "@vtj/utils";
|
3
3
|
import * as B from "vue";
|
4
|
-
import { inject as me, defineComponent as ve, h as
|
4
|
+
import { inject as me, defineComponent as ve, h as G, ref as Y, defineAsyncComponent as ce, watchEffect as We } from "vue";
|
5
5
|
import { useRoute as ge } from "vue-router";
|
6
6
|
/**!
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.12.
|
10
|
+
* @version 0.12.20
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const A = "0.12.
|
13
|
+
const A = "0.12.20";
|
14
14
|
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
15
15
|
const le = [
|
16
16
|
"$el",
|
@@ -24,7 +24,7 @@ const le = [
|
|
24
24
|
"$props",
|
25
25
|
"$options",
|
26
26
|
"$forceUpdate"
|
27
|
-
],
|
27
|
+
], Zt = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -38,7 +38,7 @@ const le = [
|
|
38
38
|
"renderTriggered",
|
39
39
|
"activated",
|
40
40
|
"deactivated"
|
41
|
-
],
|
41
|
+
], Ge = [
|
42
42
|
"vIf",
|
43
43
|
"vElseIf",
|
44
44
|
"vElse",
|
@@ -47,7 +47,7 @@ const le = [
|
|
47
47
|
"vFor",
|
48
48
|
"vBind",
|
49
49
|
"vHtml"
|
50
|
-
],
|
50
|
+
], Ye = {
|
51
51
|
String,
|
52
52
|
Number,
|
53
53
|
Boolean,
|
@@ -55,40 +55,40 @@ const le = [
|
|
55
55
|
Object,
|
56
56
|
Function,
|
57
57
|
Date
|
58
|
-
}, I = "VtjPage", O = "VtjHomepage",
|
58
|
+
}, I = "VtjPage", O = "VtjHomepage", Qe = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
|
59
59
|
","
|
60
|
-
),
|
60
|
+
), Xe = "component,slot".split(",");
|
61
61
|
function D(n, e) {
|
62
|
-
return n.map((t) =>
|
62
|
+
return n.map((t) => Ne(t) || t.startsWith("/") ? t : `${e}${t}`);
|
63
63
|
}
|
64
|
-
function
|
64
|
+
function U(n) {
|
65
65
|
return /\.css$/.test(n);
|
66
66
|
}
|
67
|
-
function
|
67
|
+
function L(n) {
|
68
68
|
return /\.js$/.test(n);
|
69
69
|
}
|
70
|
-
function
|
70
|
+
function Ze(n) {
|
71
71
|
return /\.json$/.test(n);
|
72
72
|
}
|
73
|
-
function
|
73
|
+
function es(n) {
|
74
74
|
return n.map(
|
75
75
|
(e) => `<script src="${b.append(e, { v: A })}"><\/script>`
|
76
76
|
).join("");
|
77
77
|
}
|
78
|
-
function
|
78
|
+
function ts(n = []) {
|
79
79
|
return n.map(
|
80
80
|
(e) => `<link rel="stylesheet" href="${b.append(e, { v: A })}" />`
|
81
81
|
).join("");
|
82
82
|
}
|
83
|
-
function
|
83
|
+
function et(n, e = !1) {
|
84
84
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
85
85
|
}
|
86
|
-
function
|
86
|
+
function tt(n, e, t = !1) {
|
87
87
|
const s = n.filter((m) => !!m.enabled), r = [], i = [], a = [], o = [], c = {}, l = {}, u = [], p = {};
|
88
88
|
return s.forEach(
|
89
89
|
({ urls: m, assetsUrl: f, library: d, assetsLibrary: h, localeLibrary: _ }) => {
|
90
90
|
m?.forEach((v) => {
|
91
|
-
|
91
|
+
L(v) && r.push(et(v, t)), U(v) && i.push(v);
|
92
92
|
}), d && (o.push(d), c[d] = D(m || [], e), _ && (l[d] = _)), f && a.push(f), h && u.push(h), d && h && (p[h] = d);
|
93
93
|
}
|
94
94
|
), {
|
@@ -96,16 +96,23 @@ function Ze(n, e, t = !1) {
|
|
96
96
|
css: D(i, e),
|
97
97
|
materials: D(a, e),
|
98
98
|
libraryExports: o,
|
99
|
-
materialExports:
|
99
|
+
materialExports: Be(u),
|
100
100
|
materialMapLibrary: p,
|
101
101
|
libraryMap: c,
|
102
102
|
libraryLocaleMap: l
|
103
103
|
};
|
104
104
|
}
|
105
|
-
function
|
105
|
+
function st(n, e) {
|
106
106
|
const { name: t, parent: s, alias: r } = n;
|
107
107
|
return s ? e[s]?.[r || t] : e[r || t];
|
108
108
|
}
|
109
|
+
function nt(n = []) {
|
110
|
+
const e = n.filter((s) => U(s)), t = n.filter((s) => L(s));
|
111
|
+
return {
|
112
|
+
css: e,
|
113
|
+
js: t
|
114
|
+
};
|
115
|
+
}
|
109
116
|
function ye(n) {
|
110
117
|
return j(n) ? n : JSON.stringify(n);
|
111
118
|
}
|
@@ -124,11 +131,11 @@ function _e(n, e, t) {
|
|
124
131
|
i ? i.innerHTML = t : (i = r.createElement("style"), i.id = e, i.innerHTML = t, r.head.appendChild(i));
|
125
132
|
}
|
126
133
|
}
|
127
|
-
async function
|
134
|
+
async function rt(n, e) {
|
128
135
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
129
136
|
t && _e(window, n, t);
|
130
137
|
}
|
131
|
-
function
|
138
|
+
function we(n, e = window) {
|
132
139
|
const t = e.document, s = e.document.head;
|
133
140
|
for (const r of n)
|
134
141
|
if (!t.getElementById(r)) {
|
@@ -136,7 +143,7 @@ function st(n, e = window) {
|
|
136
143
|
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
137
144
|
}
|
138
145
|
}
|
139
|
-
async function
|
146
|
+
async function Se(n, e, t = window) {
|
140
147
|
const s = t.document, r = t.document.head;
|
141
148
|
let i = t[e];
|
142
149
|
return i ? i.default || i : new Promise((a, o) => {
|
@@ -150,14 +157,14 @@ async function nt(n, e, t = window) {
|
|
150
157
|
}
|
151
158
|
});
|
152
159
|
}
|
153
|
-
function rt(n) {
|
154
|
-
return K(n) || K(n?.install);
|
155
|
-
}
|
156
160
|
function it(n) {
|
157
|
-
return
|
161
|
+
return V(n) || V(n?.install);
|
158
162
|
}
|
159
163
|
function ot(n) {
|
160
|
-
return
|
164
|
+
return Xe.includes(n);
|
165
|
+
}
|
166
|
+
function at(n) {
|
167
|
+
return Qe.includes(n);
|
161
168
|
}
|
162
169
|
function M(n = window) {
|
163
170
|
const e = window?.Mock;
|
@@ -166,7 +173,7 @@ function M(n = window) {
|
|
166
173
|
if (t && window)
|
167
174
|
return window.Mock = t, t;
|
168
175
|
}
|
169
|
-
function
|
176
|
+
function ss(n, e, t) {
|
170
177
|
Object.assign(e.meta, t.meta);
|
171
178
|
const s = n?._container;
|
172
179
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
@@ -185,7 +192,7 @@ function H(n, e, t = !1, s = !1) {
|
|
185
192
|
throw r;
|
186
193
|
}
|
187
194
|
}
|
188
|
-
function
|
195
|
+
function Q(n, e, t = !1, s = !1) {
|
189
196
|
const r = H(n, e, t, s);
|
190
197
|
if (typeof r != "function" && (C.error(
|
191
198
|
"parseFunction.error",
|
@@ -202,13 +209,13 @@ function w(n) {
|
|
202
209
|
function T(n) {
|
203
210
|
return typeof n == "object" && n && n.type === "JSFunction";
|
204
211
|
}
|
205
|
-
function
|
212
|
+
function ct(n) {
|
206
213
|
return w(n) || T(n);
|
207
214
|
}
|
208
|
-
function
|
209
|
-
return
|
215
|
+
function ns(n) {
|
216
|
+
return ct(n) ? n.value : JSON.stringify(n);
|
210
217
|
}
|
211
|
-
const
|
218
|
+
const lt = {
|
212
219
|
session: !1,
|
213
220
|
authKey: "Authorization",
|
214
221
|
storageKey: "ACCESS_STORAGE",
|
@@ -221,14 +228,14 @@ const ct = {
|
|
221
228
|
noPermissionMessage: "无权限访问该页面",
|
222
229
|
appName: "",
|
223
230
|
statusKey: "code"
|
224
|
-
},
|
225
|
-
class
|
231
|
+
}, $e = Symbol("access");
|
232
|
+
class Ee {
|
226
233
|
options;
|
227
234
|
data = null;
|
228
235
|
mode = y.Raw;
|
229
236
|
interceptResponse = !0;
|
230
237
|
constructor(e) {
|
231
|
-
this.options = Object.assign({},
|
238
|
+
this.options = Object.assign({}, lt, e), this.loadData();
|
232
239
|
}
|
233
240
|
enableIntercept() {
|
234
241
|
this.interceptResponse = !0;
|
@@ -242,17 +249,17 @@ class Se {
|
|
242
249
|
}
|
243
250
|
login(e) {
|
244
251
|
const { storageKey: t, storagePrefix: s, session: r, authKey: i } = this.options;
|
245
|
-
this.setData(e), this.data && (
|
252
|
+
this.setData(e), this.data && (J.save(t, e, {
|
246
253
|
type: "local",
|
247
254
|
prefix: s
|
248
|
-
}), r &&
|
255
|
+
}), r && K.set(i, this.data.token));
|
249
256
|
}
|
250
257
|
clear() {
|
251
258
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
252
|
-
this.data = null,
|
259
|
+
this.data = null, J.remove(e, {
|
253
260
|
type: "local",
|
254
261
|
prefix: t
|
255
|
-
}), s &&
|
262
|
+
}), s && K.remove(r);
|
256
263
|
}
|
257
264
|
logout() {
|
258
265
|
this.clear(), this.toLogin();
|
@@ -272,7 +279,7 @@ class Se {
|
|
272
279
|
return re(e).some((i) => s[i] || s[t + "." + i]);
|
273
280
|
}
|
274
281
|
install(e) {
|
275
|
-
e.config.globalProperties.$access = this, e.provide(
|
282
|
+
e.config.globalProperties.$access = this, e.provide($e, this);
|
276
283
|
}
|
277
284
|
isAuthPath(e) {
|
278
285
|
const { auth: t, isAuth: s } = this.options;
|
@@ -312,7 +319,7 @@ class Se {
|
|
312
319
|
this.data = e;
|
313
320
|
}
|
314
321
|
loadData() {
|
315
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
322
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = J.get(e, {
|
316
323
|
type: "local",
|
317
324
|
prefix: t
|
318
325
|
});
|
@@ -320,7 +327,7 @@ class Se {
|
|
320
327
|
}
|
321
328
|
isLogined() {
|
322
329
|
const { session: e, authKey: t } = this.options;
|
323
|
-
return e && t ? !!
|
330
|
+
return e && t ? !!K.get(t) : !!this.getToken();
|
324
331
|
}
|
325
332
|
hasRoutePermission(e) {
|
326
333
|
if (e.name === I) {
|
@@ -340,7 +347,7 @@ class Se {
|
|
340
347
|
return t();
|
341
348
|
{
|
342
349
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
343
|
-
return await this.showTip(s),
|
350
|
+
return await this.showTip(s), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
344
351
|
}
|
345
352
|
}
|
346
353
|
t(!1), this.toLogin();
|
@@ -375,10 +382,10 @@ class Se {
|
|
375
382
|
);
|
376
383
|
}
|
377
384
|
}
|
378
|
-
function
|
379
|
-
return me(
|
385
|
+
function ut() {
|
386
|
+
return me($e, null);
|
380
387
|
}
|
381
|
-
function
|
388
|
+
function rs(n = {}) {
|
382
389
|
const {
|
383
390
|
notify: e,
|
384
391
|
loading: t,
|
@@ -415,13 +422,13 @@ function ns(n = {}) {
|
|
415
422
|
loading: t,
|
416
423
|
useTitle: a,
|
417
424
|
startupComponent: r,
|
418
|
-
access: i ? new
|
425
|
+
access: i ? new Ee({ alert: o, ...i }) : void 0
|
419
426
|
};
|
420
427
|
}
|
421
|
-
function
|
422
|
-
return new
|
428
|
+
function is(n = {}) {
|
429
|
+
return new Ee(n);
|
423
430
|
}
|
424
|
-
function
|
431
|
+
function pt(n, e) {
|
425
432
|
const { jsonp: t, request: s } = e;
|
426
433
|
if (n.method === "jsonp")
|
427
434
|
return (r = {}) => t(n.url, {
|
@@ -437,10 +444,10 @@ function ut(n, e) {
|
|
437
444
|
headers: r
|
438
445
|
}
|
439
446
|
};
|
440
|
-
return (a, o) => (delete i.data, s.send(
|
447
|
+
return (a, o) => (delete i.data, s.send(Ue(i, o || {}, { data: a })));
|
441
448
|
}
|
442
449
|
}
|
443
|
-
function
|
450
|
+
function ft(n, e) {
|
444
451
|
const { metaQuery: t } = e;
|
445
452
|
if (!t) return;
|
446
453
|
const { code: s, queryCode: r } = n;
|
@@ -452,20 +459,20 @@ function pt(n, e) {
|
|
452
459
|
return t(s, r, i, a);
|
453
460
|
};
|
454
461
|
}
|
455
|
-
function
|
462
|
+
function dt(n = [], e = [], t) {
|
456
463
|
const s = {};
|
457
464
|
for (const r of n)
|
458
|
-
s[r.id] = ut(r, t);
|
459
|
-
for (const r of e)
|
460
465
|
s[r.id] = pt(r, t);
|
466
|
+
for (const r of e)
|
467
|
+
s[r.id] = ft(r, t);
|
461
468
|
return s;
|
462
469
|
}
|
463
|
-
async function
|
470
|
+
async function ht(n = [], e = window) {
|
464
471
|
const t = M(e);
|
465
|
-
t && (
|
472
|
+
t && (je(e), n.forEach((s) => vt(t, s)));
|
466
473
|
}
|
467
|
-
function
|
468
|
-
const t = T(n.mockTemplate) && n.mockTemplate.value ?
|
474
|
+
function mt(n, e = window) {
|
475
|
+
const t = T(n.mockTemplate) && n.mockTemplate.value ? Q(n.mockTemplate, {}, !0) : void 0, s = M(e);
|
469
476
|
return async (...r) => {
|
470
477
|
let i = {};
|
471
478
|
if (t)
|
@@ -477,22 +484,22 @@ function ht(n, e = window) {
|
|
477
484
|
return s?.mock(i);
|
478
485
|
};
|
479
486
|
}
|
480
|
-
function
|
487
|
+
function vt(n, e) {
|
481
488
|
if (!e.mock) return;
|
482
489
|
const { url: t, mockTemplate: s } = e;
|
483
490
|
if (t && s) {
|
484
|
-
const r =
|
491
|
+
const r = Le(`${t}(.*)`), i = qe(t, { decode: decodeURIComponent }), a = H(s, {}, !0);
|
485
492
|
n.mock(r, (o) => {
|
486
|
-
const c = b.parse(o.url) || {}, l = o.body instanceof FormData ?
|
493
|
+
const c = b.parse(o.url) || {}, l = o.body instanceof FormData ? Je(o.body) : o.body, u = i(o.url)?.params;
|
487
494
|
return Object.assign(o, { data: l, params: c, query: u }), n.mock(a(o));
|
488
495
|
});
|
489
496
|
}
|
490
497
|
}
|
491
|
-
function
|
498
|
+
function je(n = window) {
|
492
499
|
const e = M(n);
|
493
500
|
e && (e._mocked = {});
|
494
501
|
}
|
495
|
-
class
|
502
|
+
class gt {
|
496
503
|
__id = null;
|
497
504
|
__mode;
|
498
505
|
__instance = null;
|
@@ -551,9 +558,9 @@ class vt {
|
|
551
558
|
if (e)
|
552
559
|
if (this.__mode === y.Runtime) {
|
553
560
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
554
|
-
return
|
561
|
+
return Q({ type: s, value: r }, this);
|
555
562
|
} else
|
556
|
-
return
|
563
|
+
return Q(e, this);
|
557
564
|
}
|
558
565
|
__parseExpression(e) {
|
559
566
|
if (e)
|
@@ -591,7 +598,7 @@ class vt {
|
|
591
598
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
592
599
|
}
|
593
600
|
}
|
594
|
-
function
|
601
|
+
function X(n) {
|
595
602
|
const {
|
596
603
|
Vue: e = B,
|
597
604
|
mode: t = y.Runtime,
|
@@ -603,22 +610,22 @@ function Y(n) {
|
|
603
610
|
$components: s,
|
604
611
|
$libs: r,
|
605
612
|
$apis: i
|
606
|
-
}, l = new
|
613
|
+
}, l = new gt({
|
607
614
|
mode: t,
|
608
615
|
dsl: o.value,
|
609
616
|
attrs: c
|
610
617
|
}), u = e.defineComponent({
|
611
618
|
name: o.value.name,
|
612
619
|
props: {
|
613
|
-
...
|
620
|
+
..._t(o.value.props ?? [], l)
|
614
621
|
},
|
615
622
|
setup(p) {
|
616
623
|
l.$props = p, l.props = p, o.value.id && _e(
|
617
624
|
n.window || window,
|
618
625
|
o.value.id,
|
619
626
|
o.value.css || ""
|
620
|
-
), l.state =
|
621
|
-
const m =
|
627
|
+
), l.state = wt(e, o.value.state ?? {}, l);
|
628
|
+
const m = St(e, o.value.computed ?? {}, l), f = $t(o.value.methods ?? {}, l), d = Et(e, o.value.inject, l), h = jt(
|
622
629
|
o.value.dataSources || {},
|
623
630
|
l
|
624
631
|
), _ = {
|
@@ -627,11 +634,11 @@ function Y(n) {
|
|
627
634
|
...f,
|
628
635
|
...h
|
629
636
|
};
|
630
|
-
return l.setup(_, e),
|
637
|
+
return l.setup(_, e), Pt(e, o.value.watch ?? [], l), {
|
631
638
|
vtj: l
|
632
639
|
};
|
633
640
|
},
|
634
|
-
emits:
|
641
|
+
emits: yt(o.value.emits),
|
635
642
|
expose: ["vtj"],
|
636
643
|
render() {
|
637
644
|
if (!o.value.nodes) return null;
|
@@ -640,18 +647,18 @@ function Y(n) {
|
|
640
647
|
(m) => k(m, l, e, a, p)
|
641
648
|
);
|
642
649
|
},
|
643
|
-
...
|
650
|
+
...Rt(o.value.lifeCycles ?? {}, l)
|
644
651
|
});
|
645
652
|
return {
|
646
653
|
renderer: e.markRaw(u),
|
647
654
|
context: l
|
648
655
|
};
|
649
656
|
}
|
650
|
-
function
|
657
|
+
function yt(n = []) {
|
651
658
|
return n.map((e) => j(e) ? e : e.name);
|
652
659
|
}
|
653
|
-
function
|
654
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) =>
|
660
|
+
function _t(n = [], e) {
|
661
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => Ye[i]) : void 0;
|
655
662
|
return n.map((s) => j(s) ? {
|
656
663
|
name: s
|
657
664
|
} : {
|
@@ -668,7 +675,7 @@ function yt(n = [], e) {
|
|
668
675
|
{}
|
669
676
|
);
|
670
677
|
}
|
671
|
-
function
|
678
|
+
function wt(n, e, t) {
|
672
679
|
return n.reactive(
|
673
680
|
Object.keys(e || {}).reduce(
|
674
681
|
(s, r) => {
|
@@ -679,19 +686,19 @@ function _t(n, e, t) {
|
|
679
686
|
)
|
680
687
|
);
|
681
688
|
}
|
682
|
-
function
|
689
|
+
function St(n, e, t) {
|
683
690
|
return Object.entries(e ?? {}).reduce(
|
684
691
|
(s, [r, i]) => (s[r] = n.computed(t.__parseFunction(i)), s),
|
685
692
|
{}
|
686
693
|
);
|
687
694
|
}
|
688
|
-
function
|
695
|
+
function $t(n, e) {
|
689
696
|
return Object.entries(n ?? {}).reduce(
|
690
697
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
691
698
|
{}
|
692
699
|
);
|
693
700
|
}
|
694
|
-
function
|
701
|
+
function Et(n, e = [], t) {
|
695
702
|
return e.reduce(
|
696
703
|
(s, r) => {
|
697
704
|
const { name: i, from: a } = r || {};
|
@@ -702,12 +709,12 @@ function $t(n, e = [], t) {
|
|
702
709
|
{}
|
703
710
|
);
|
704
711
|
}
|
705
|
-
function
|
712
|
+
function jt(n, e) {
|
706
713
|
return Object.keys(n).reduce(
|
707
714
|
(t, s) => {
|
708
715
|
const r = n[s];
|
709
716
|
if (r.type === "mock")
|
710
|
-
t[s] =
|
717
|
+
t[s] = mt(r);
|
711
718
|
else if (r.ref) {
|
712
719
|
const i = e.$apis[r.ref], a = T(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
713
720
|
t[s] = async (...o) => {
|
@@ -720,7 +727,7 @@ function Et(n, e) {
|
|
720
727
|
{}
|
721
728
|
);
|
722
729
|
}
|
723
|
-
function
|
730
|
+
function Pt(n, e = [], t) {
|
724
731
|
e.forEach((s) => {
|
725
732
|
n.watch(
|
726
733
|
t.__parseExpression(s.source),
|
@@ -732,55 +739,55 @@ function jt(n, e = [], t) {
|
|
732
739
|
);
|
733
740
|
});
|
734
741
|
}
|
735
|
-
function
|
742
|
+
function Rt(n, e) {
|
736
743
|
return Object.entries(n ?? {}).reduce(
|
737
744
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
738
745
|
{}
|
739
746
|
);
|
740
747
|
}
|
741
|
-
let
|
742
|
-
const
|
743
|
-
async function
|
744
|
-
const { urls: t = [], library: s } = n, r = t.filter((o) =>
|
748
|
+
let z = [], R = {};
|
749
|
+
const bt = (n) => n;
|
750
|
+
async function Pe(n, e = window) {
|
751
|
+
const { urls: t = [], library: s } = n, r = t.filter((o) => L(o));
|
745
752
|
if (r.length === 0 || !s) return null;
|
746
|
-
const i = t.filter((o) =>
|
747
|
-
return i.length &&
|
753
|
+
const i = t.filter((o) => U(o));
|
754
|
+
return i.length && we(i, e), await Se(r, s, e).catch(
|
748
755
|
(o) => (console.warn("loadScriptUrl error", r, s, o), null)
|
749
756
|
);
|
750
757
|
}
|
751
|
-
function
|
758
|
+
function Z(n) {
|
752
759
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
753
|
-
return s.window && (
|
760
|
+
return s.window && (z.forEach((r) => {
|
754
761
|
delete s.window[r];
|
755
|
-
}),
|
762
|
+
}), z = []), (r, i, a = B) => {
|
756
763
|
if (!i || typeof i == "string") return r;
|
757
764
|
if (i.type === "Schema" && i.id)
|
758
765
|
return a.defineAsyncComponent(async () => {
|
759
766
|
const o = R[i.id] || await e(i.id);
|
760
|
-
return o && (o.name = r, R[i.id] = o), o ?
|
767
|
+
return o && (o.name = r, R[i.id] = o), o ? X({
|
761
768
|
...s,
|
762
769
|
Vue: a,
|
763
770
|
dsl: oe(o),
|
764
771
|
mode: y.Runtime,
|
765
|
-
loader:
|
772
|
+
loader: Z(n)
|
766
773
|
}).renderer : null;
|
767
774
|
});
|
768
775
|
if (i.type === "UrlSchema" && i.url)
|
769
776
|
return a.defineAsyncComponent(async () => {
|
770
777
|
const o = R[i.url] || await t(i.url);
|
771
|
-
return o && (o.name = r, R[i.url] = o), o ?
|
778
|
+
return o && (o.name = r, R[i.url] = o), o ? X({
|
772
779
|
...s,
|
773
780
|
Vue: a,
|
774
781
|
dsl: oe(o),
|
775
782
|
mode: y.Runtime,
|
776
|
-
loader:
|
783
|
+
loader: Z(n)
|
777
784
|
}).renderer : null;
|
778
785
|
});
|
779
786
|
if (i.type === "Plugin") {
|
780
787
|
let o = i.library ? R[i.library] : null;
|
781
|
-
return o || (i.library &&
|
788
|
+
return o || (i.library && z.push(i.library), o = R[i.library || Symbol()] = a.defineAsyncComponent(
|
782
789
|
async () => {
|
783
|
-
const c = await
|
790
|
+
const c = await Pe(i, s.window);
|
784
791
|
return c || (console.warn("getPlugin result is null", i), null);
|
785
792
|
}
|
786
793
|
), o);
|
@@ -788,46 +795,46 @@ function Q(n) {
|
|
788
795
|
return r;
|
789
796
|
};
|
790
797
|
}
|
791
|
-
function
|
798
|
+
function os() {
|
792
799
|
R = {};
|
793
800
|
}
|
794
|
-
function k(n, e, t = B, s =
|
801
|
+
function k(n, e, t = B, s = bt, r = [], i = !1) {
|
795
802
|
if (!n || !n.name || n.invisible) return null;
|
796
|
-
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: c = [] } = n, { vIf: l, vElseIf: u, vElse: p, vFor: m, vShow: f, vModels: d, vBind: h, vHtml: _, others: v } =
|
803
|
+
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: c = [] } = n, { vIf: l, vElseIf: u, vElse: p, vFor: m, vShow: f, vModels: d, vBind: h, vHtml: _, others: v } = Re(c);
|
797
804
|
if (!i && (u || p))
|
798
805
|
return null;
|
799
|
-
if (l && !
|
800
|
-
return
|
806
|
+
if (l && !kt(l, e))
|
807
|
+
return Mt(n, e, t, s, r);
|
801
808
|
const F = (S) => {
|
802
|
-
const
|
809
|
+
const Me = S.$components, He = (() => {
|
803
810
|
if (n.name === "component")
|
804
|
-
return
|
811
|
+
return Ft(S, n.props?.is);
|
805
812
|
if (n.name === "slot") return n.name;
|
806
813
|
const $ = s(n.name, n.from, t);
|
807
|
-
return j($) ?
|
808
|
-
})(), P =
|
814
|
+
return j($) ? ot($) || at($) ? $ : Me[$] ?? a?.app?.component($) ?? $ : $;
|
815
|
+
})(), P = At(o, n.props ?? {}, S), Te = It(t, n.events ?? {}, S);
|
809
816
|
if (n.name === "slot")
|
810
|
-
return
|
817
|
+
return Ht(t, n, P, S, s);
|
811
818
|
h && Object.assign(P, S.__parseExpression(h.value)), f && (P.style = Object.assign(
|
812
819
|
P.style ?? {},
|
813
|
-
|
814
|
-
)), _ && Object.assign(P,
|
815
|
-
Object.assign(P,
|
820
|
+
Dt(f, S)
|
821
|
+
)), _ && Object.assign(P, xt(_, S)), d.forEach(($) => {
|
822
|
+
Object.assign(P, Ot(t, $, S));
|
816
823
|
});
|
817
|
-
const
|
824
|
+
const De = Nt(
|
818
825
|
t,
|
819
826
|
n.children ?? [],
|
820
827
|
S,
|
821
828
|
s,
|
822
829
|
n
|
823
830
|
);
|
824
|
-
let
|
825
|
-
const ne = a ?
|
826
|
-
return ne.length && (
|
831
|
+
let q = t.createVNode(He, { ...P, ...Te }, De);
|
832
|
+
const ne = a ? Ct(a, v, S) : [];
|
833
|
+
return ne.length && (q = t.withDirectives(q, ne)), q;
|
827
834
|
};
|
828
|
-
return m ?
|
835
|
+
return m ? Lt(m, F, e) : F(e);
|
829
836
|
}
|
830
|
-
function
|
837
|
+
function Ct(n, e, t) {
|
831
838
|
const s = n.app;
|
832
839
|
return e.map((r) => {
|
833
840
|
const i = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
@@ -836,13 +843,13 @@ function bt(n, e, t) {
|
|
836
843
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
837
844
|
}).filter((r) => !!r);
|
838
845
|
}
|
839
|
-
function
|
846
|
+
function Re(n = []) {
|
840
847
|
const e = n.find((u) => E(u.name) === "vIf"), t = n.find(
|
841
848
|
(u) => E(u.name) === "vElseIf"
|
842
849
|
), s = n.find((u) => E(u.name) === "vElse"), r = n.find((u) => E(u.name) === "vFor"), i = n.find((u) => E(u.name) === "vShow"), a = n.find((u) => E(u.name) === "vBind"), o = n.find((u) => E(u.name) === "vHtml"), c = n.filter(
|
843
850
|
(u) => E(u.name) === "vModel"
|
844
851
|
), l = n.filter(
|
845
|
-
(u) => !
|
852
|
+
(u) => !Ge.includes(E(u.name))
|
846
853
|
);
|
847
854
|
return {
|
848
855
|
vIf: e,
|
@@ -856,26 +863,26 @@ function je(n = []) {
|
|
856
863
|
vHtml: o
|
857
864
|
};
|
858
865
|
}
|
859
|
-
function
|
866
|
+
function kt(n, e) {
|
860
867
|
return !!e.__parseExpression(n.value);
|
861
868
|
}
|
862
|
-
function
|
869
|
+
function Ft(n, e) {
|
863
870
|
return e ? w(e) ? n.__parseExpression(e) : e : "div";
|
864
871
|
}
|
865
|
-
function
|
866
|
-
const s =
|
872
|
+
function At(n, e, t) {
|
873
|
+
const s = ee(e, t);
|
867
874
|
return s.ref = t.__ref(n, s.ref), s;
|
868
875
|
}
|
869
|
-
function
|
870
|
-
return w(n) ? e.__parseExpression(n) : T(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) =>
|
876
|
+
function ee(n, e) {
|
877
|
+
return w(n) ? e.__parseExpression(n) : T(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => ee(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
871
878
|
(t, s) => {
|
872
879
|
let r = n[s];
|
873
|
-
return t[s] =
|
880
|
+
return t[s] = ee(r, e), t;
|
874
881
|
},
|
875
882
|
{}
|
876
883
|
) : n;
|
877
884
|
}
|
878
|
-
function
|
885
|
+
function It(n, e, t) {
|
879
886
|
const s = ["passive", "capture", "once"], r = {
|
880
887
|
capture: "Capture",
|
881
888
|
once: "Once",
|
@@ -883,16 +890,16 @@ function At(n, e, t) {
|
|
883
890
|
};
|
884
891
|
return Object.keys(e || {}).reduce(
|
885
892
|
(i, a) => {
|
886
|
-
const o = e[a], c =
|
893
|
+
const o = e[a], c = be(o.modifiers), l = c.find((m) => s.includes(m)), u = "on" + Ke(a) + (l && r[l] || ""), p = t.__parseFunction(o.handler);
|
887
894
|
return p && (i[u] = n.withModifiers(p, c)), i;
|
888
895
|
},
|
889
896
|
{}
|
890
897
|
);
|
891
898
|
}
|
892
|
-
function
|
899
|
+
function Mt(n, e, t, s, r = []) {
|
893
900
|
let i = r.findIndex((a) => a.id === n.id);
|
894
901
|
for (let a = ++i; a < r.length; a++) {
|
895
|
-
const { directives: o = [] } = r[a], { vElseIf: c, vElse: l } =
|
902
|
+
const { directives: o = [] } = r[a], { vElseIf: c, vElse: l } = Re(o);
|
896
903
|
if (c) {
|
897
904
|
if (e.__parseExpression(c.value))
|
898
905
|
return k(r[a], e, t, s, r, !0);
|
@@ -903,42 +910,42 @@ function It(n, e, t, s, r = []) {
|
|
903
910
|
}
|
904
911
|
return null;
|
905
912
|
}
|
906
|
-
function
|
913
|
+
function be(n = {}, e = !1) {
|
907
914
|
const t = Object.keys(n);
|
908
915
|
return e ? t.map((s) => "." + s) : t;
|
909
916
|
}
|
910
|
-
function
|
911
|
-
const { children: i } = e, a =
|
917
|
+
function Ht(n, e, t, s, r) {
|
918
|
+
const { children: i } = e, a = Tt(e, s), o = s.$slots?.[a.name];
|
912
919
|
return o ? o(t) : i ? j(i) ? n.createTextVNode(i) : w(i) ? n.createTextVNode(
|
913
920
|
ye(s.__parseExpression(i))
|
914
921
|
) : Array.isArray(i) ? i.map(
|
915
922
|
(c) => k(c, s, n, r, i)
|
916
923
|
) : null : null;
|
917
924
|
}
|
918
|
-
function
|
925
|
+
function Tt(n, e) {
|
919
926
|
const { props: t } = n, s = t?.name || "default";
|
920
927
|
return {
|
921
928
|
name: w(s) ? e.__parseExpression(s) : s,
|
922
929
|
params: []
|
923
930
|
};
|
924
931
|
}
|
925
|
-
function
|
932
|
+
function Dt(n, e) {
|
926
933
|
return e.__parseExpression(n.value) ? {} : {
|
927
934
|
display: "none"
|
928
935
|
};
|
929
936
|
}
|
930
|
-
function
|
937
|
+
function xt(n, e) {
|
931
938
|
return {
|
932
939
|
innerHTML: e.__parseExpression(n.value) || ""
|
933
940
|
};
|
934
941
|
}
|
935
|
-
function
|
942
|
+
function Ot(n, e, t) {
|
936
943
|
const s = {
|
937
944
|
type: "JSFunction",
|
938
945
|
value: e.value?.value ? `(v) => {
|
939
946
|
${e.value.value} = v;
|
940
947
|
}` : "(v) => {}"
|
941
|
-
}, r = t.__parseFunction(s), i =
|
948
|
+
}, r = t.__parseFunction(s), i = be(
|
942
949
|
w(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
943
950
|
), a = w(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
944
951
|
return {
|
@@ -946,7 +953,7 @@ function xt(n, e, t) {
|
|
946
953
|
[`onUpdate:${a}`]: i.length && r ? n.withModifiers(r, i) : r
|
947
954
|
};
|
948
955
|
}
|
949
|
-
function
|
956
|
+
function Nt(n, e, t, s, r) {
|
950
957
|
if (!e) return null;
|
951
958
|
if (j(e))
|
952
959
|
return { default: () => e };
|
@@ -955,11 +962,11 @@ function Ot(n, e, t, s, r) {
|
|
955
962
|
default: () => ye(t.__parseExpression(e))
|
956
963
|
};
|
957
964
|
if (Array.isArray(e) && e.length > 0) {
|
958
|
-
const i =
|
965
|
+
const i = Bt(e), a = (o) => !o || !r ? {} : r?.id && Object.keys(o).length ? {
|
959
966
|
[`scope_${r.id}`]: o
|
960
967
|
} : {};
|
961
968
|
return Object.entries(i).reduce((o, [c, { nodes: l, params: u }]) => (o[c] = (p) => {
|
962
|
-
const m = u.length ?
|
969
|
+
const m = u.length ? ze(p ?? {}, u) : a(p);
|
963
970
|
return l.map(
|
964
971
|
(f) => k(f, t.__clone(m), n, s, l)
|
965
972
|
);
|
@@ -967,7 +974,7 @@ function Ot(n, e, t, s, r) {
|
|
967
974
|
}
|
968
975
|
return null;
|
969
976
|
}
|
970
|
-
function
|
977
|
+
function Bt(n) {
|
971
978
|
const e = {
|
972
979
|
default: {
|
973
980
|
params: [],
|
@@ -975,7 +982,7 @@ function Nt(n) {
|
|
975
982
|
}
|
976
983
|
};
|
977
984
|
for (const t of n) {
|
978
|
-
const s =
|
985
|
+
const s = Ut(t.slot), r = s.name;
|
979
986
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
980
987
|
nodes: [t],
|
981
988
|
params: s.params
|
@@ -983,10 +990,10 @@ function Nt(n) {
|
|
983
990
|
}
|
984
991
|
return e;
|
985
992
|
}
|
986
|
-
function
|
993
|
+
function Ut(n = "default") {
|
987
994
|
return j(n) ? { name: n, params: [] } : { params: [], ...n };
|
988
995
|
}
|
989
|
-
function
|
996
|
+
function Lt(n, e, t) {
|
990
997
|
const { value: s, iterator: r } = n, { item: i = "item", index: a = "index" } = r || {};
|
991
998
|
let o = t.__parseExpression(s) || [];
|
992
999
|
return Number.isInteger(o) && (o = new Array(o).fill(!0).map((c, l) => l + 1)), Array.isArray(o) ? o.map((c, l) => e(t.__clone({ [i]: c, [a]: l }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
@@ -994,7 +1001,7 @@ function Ut(n, e, t) {
|
|
994
1001
|
const ue = ve({
|
995
1002
|
name: "VtjPageContainer",
|
996
1003
|
async setup() {
|
997
|
-
const n =
|
1004
|
+
const n = ke(), e = ge(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, i = Y(Symbol());
|
998
1005
|
if (s) {
|
999
1006
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1000
1007
|
const { useTitle: a } = n?.adapter;
|
@@ -1012,19 +1019,19 @@ const ue = ve({
|
|
1012
1019
|
},
|
1013
1020
|
render() {
|
1014
1021
|
const { component: n, query: e, sid: t } = this;
|
1015
|
-
return n ?
|
1022
|
+
return n ? G(n, { ...e, key: t }) : G("div", "页面不存在");
|
1016
1023
|
},
|
1017
1024
|
activated() {
|
1018
1025
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1019
1026
|
}
|
1020
|
-
}),
|
1027
|
+
}), qt = ve({
|
1021
1028
|
name: "VtjStartupContainer",
|
1022
1029
|
render() {
|
1023
|
-
return
|
1030
|
+
return G("div", "page not found!");
|
1024
1031
|
}
|
1025
|
-
}),
|
1026
|
-
var
|
1027
|
-
class
|
1032
|
+
}), Ce = Symbol("Provider");
|
1033
|
+
var Jt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Jt || {});
|
1034
|
+
class Kt extends xe {
|
1028
1035
|
constructor(e) {
|
1029
1036
|
super(), this.options = e;
|
1030
1037
|
const {
|
@@ -1048,7 +1055,7 @@ class Jt extends Te {
|
|
1048
1055
|
mode;
|
1049
1056
|
globals = {};
|
1050
1057
|
modules = {};
|
1051
|
-
adapter = { request:
|
1058
|
+
adapter = { request: W, jsonp: he };
|
1052
1059
|
apis = {};
|
1053
1060
|
dependencies = {};
|
1054
1061
|
materials = {};
|
@@ -1077,7 +1084,7 @@ class Jt extends Te {
|
|
1077
1084
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1078
1085
|
throw new Error("project is null");
|
1079
1086
|
const { apis: s = [], meta: r = [] } = this.project, i = window;
|
1080
|
-
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis =
|
1087
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = dt(s, r, this.adapter), je(i), ht(s, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1081
1088
|
}
|
1082
1089
|
initMock(e) {
|
1083
1090
|
const t = M(e);
|
@@ -1097,7 +1104,7 @@ class Jt extends Te {
|
|
1097
1104
|
materials: u,
|
1098
1105
|
materialExports: p,
|
1099
1106
|
materialMapLibrary: m
|
1100
|
-
} =
|
1107
|
+
} = tt(
|
1101
1108
|
t,
|
1102
1109
|
a,
|
1103
1110
|
o === "development"
|
@@ -1112,7 +1119,7 @@ class Jt extends Te {
|
|
1112
1119
|
else {
|
1113
1120
|
const _ = l[f] || [];
|
1114
1121
|
for (const v of _)
|
1115
|
-
|
1122
|
+
U(v) && await rt(f, b.append(v, { v: A })), L(v) && await ae(b.append(v, { v: A }));
|
1116
1123
|
r[f] = e[f];
|
1117
1124
|
}
|
1118
1125
|
}
|
@@ -1121,7 +1128,7 @@ class Jt extends Te {
|
|
1121
1128
|
await ae(b.append(d, { v: A }));
|
1122
1129
|
const f = this.materials || {};
|
1123
1130
|
for (const d of p) {
|
1124
|
-
const h = e[m[d]], _ =
|
1131
|
+
const h = e[m[d]], _ = Oe[d];
|
1125
1132
|
if (_)
|
1126
1133
|
h && _.forEach((v) => {
|
1127
1134
|
i[v] = h[v];
|
@@ -1129,7 +1136,7 @@ class Jt extends Te {
|
|
1129
1136
|
else {
|
1130
1137
|
const v = f[d] ? (await f[d]()).default : e[d];
|
1131
1138
|
v && h && (v.components || []).forEach((F) => {
|
1132
|
-
i[F.name] =
|
1139
|
+
i[F.name] = st(F, h);
|
1133
1140
|
});
|
1134
1141
|
}
|
1135
1142
|
}
|
@@ -1149,7 +1156,7 @@ class Jt extends Te {
|
|
1149
1156
|
}, p = {
|
1150
1157
|
path: l,
|
1151
1158
|
name: O,
|
1152
|
-
component: t?.homepage ? ue : r.startupComponent ||
|
1159
|
+
component: t?.homepage ? ue : r.startupComponent || qt,
|
1153
1160
|
meta: c
|
1154
1161
|
};
|
1155
1162
|
e.hasRoute(I) && e.removeRoute(I), e.hasRoute(O) && e.removeRoute(O), a ? (e.addRoute(a, u), e.addRoute(a, p)) : (e.addRoute(u), e.addRoute(p));
|
@@ -1157,8 +1164,8 @@ class Jt extends Te {
|
|
1157
1164
|
install(e) {
|
1158
1165
|
const t = e.config.globalProperties.installed || {};
|
1159
1166
|
for (const [s, r] of Object.entries(this.library))
|
1160
|
-
!t[s] &&
|
1161
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1167
|
+
!t[s] && it(r) && (e.use(r), t[s] = !0);
|
1168
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Ce, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, i) => {
|
1162
1169
|
const a = r?.$options.name, o = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${o} ${i}`;
|
1163
1170
|
console.error(
|
1164
1171
|
"[VTJ Error]:",
|
@@ -1169,7 +1176,7 @@ class Jt extends Te {
|
|
1169
1176
|
},
|
1170
1177
|
s?.stack
|
1171
1178
|
), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
|
1172
|
-
});
|
1179
|
+
}), this.options.enhance && e.use(this.options.enhance, this);
|
1173
1180
|
}
|
1174
1181
|
getFile(e) {
|
1175
1182
|
const { blocks: t = [] } = this.project || {};
|
@@ -1217,12 +1224,12 @@ class Jt extends Te {
|
|
1217
1224
|
apis: a,
|
1218
1225
|
window,
|
1219
1226
|
...t
|
1220
|
-
}, c =
|
1227
|
+
}, c = Z({
|
1221
1228
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1222
1229
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1223
1230
|
options: o
|
1224
1231
|
});
|
1225
|
-
return
|
1232
|
+
return X({
|
1226
1233
|
...o,
|
1227
1234
|
dsl: e,
|
1228
1235
|
loader: c
|
@@ -1246,18 +1253,18 @@ class Jt extends Te {
|
|
1246
1253
|
});
|
1247
1254
|
}
|
1248
1255
|
definePluginComponent(e) {
|
1249
|
-
return ce(async () => await
|
1256
|
+
return ce(async () => await Pe(e, window));
|
1250
1257
|
}
|
1251
1258
|
}
|
1252
|
-
function
|
1253
|
-
const e = new
|
1259
|
+
function as(n) {
|
1260
|
+
const e = new Kt(n);
|
1254
1261
|
return {
|
1255
1262
|
provider: e,
|
1256
1263
|
onReady: (s) => e.ready(s)
|
1257
1264
|
};
|
1258
1265
|
}
|
1259
|
-
function
|
1260
|
-
const e = me(
|
1266
|
+
function ke(n = {}) {
|
1267
|
+
const e = me(Ce, null);
|
1261
1268
|
if (!e)
|
1262
1269
|
throw new Error("Can not find provider");
|
1263
1270
|
if (e.nodeEnv === "development") {
|
@@ -1273,13 +1280,21 @@ function be(n = {}) {
|
|
1273
1280
|
}
|
1274
1281
|
return e;
|
1275
1282
|
}
|
1276
|
-
|
1283
|
+
async function cs(n, e = "") {
|
1284
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((o) => e + o), { css: i, js: a } = nt(r);
|
1285
|
+
if (i.length && we(i), a.length)
|
1286
|
+
return await Se(a, t).catch(
|
1287
|
+
() => {
|
1288
|
+
}
|
1289
|
+
);
|
1290
|
+
}
|
1291
|
+
const Fe = {
|
1277
1292
|
type: "json",
|
1278
1293
|
validSuccess: !0,
|
1279
1294
|
originResponse: !1,
|
1280
1295
|
failMessage: !0,
|
1281
1296
|
validate: (n) => n.data?.code === 0
|
1282
|
-
},
|
1297
|
+
}, zt = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
1283
1298
|
url: e,
|
1284
1299
|
method: "post",
|
1285
1300
|
params: { type: t },
|
@@ -1288,8 +1303,8 @@ const Ce = {
|
|
1288
1303
|
type: t,
|
1289
1304
|
data: s
|
1290
1305
|
},
|
1291
|
-
settings:
|
1292
|
-
}),
|
1306
|
+
settings: Fe
|
1307
|
+
}), Vt = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1293
1308
|
url: e,
|
1294
1309
|
method: "post",
|
1295
1310
|
data: {
|
@@ -1297,11 +1312,11 @@ const Ce = {
|
|
1297
1312
|
projectId: s
|
1298
1313
|
},
|
1299
1314
|
settings: {
|
1300
|
-
...
|
1315
|
+
...Fe,
|
1301
1316
|
type: "data"
|
1302
1317
|
}
|
1303
1318
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1304
|
-
function
|
1319
|
+
function ls(n) {
|
1305
1320
|
return de({
|
1306
1321
|
settings: {
|
1307
1322
|
type: "json",
|
@@ -1316,8 +1331,8 @@ function as(n) {
|
|
1316
1331
|
});
|
1317
1332
|
}
|
1318
1333
|
class se {
|
1319
|
-
constructor(e =
|
1320
|
-
this.req = e, this.api =
|
1334
|
+
constructor(e = W) {
|
1335
|
+
this.req = e, this.api = zt(e), this.uploader = Vt(e);
|
1321
1336
|
}
|
1322
1337
|
api;
|
1323
1338
|
pluginCaches = {};
|
@@ -1401,10 +1416,10 @@ class se {
|
|
1401
1416
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1402
1417
|
}
|
1403
1418
|
async getPluginMaterial(e) {
|
1404
|
-
const { urls: t = [] } = e, s = t.filter((i) =>
|
1419
|
+
const { urls: t = [] } = e, s = t.filter((i) => Ze(i))[0];
|
1405
1420
|
if (!s) return null;
|
1406
1421
|
const r = this.pluginCaches[s];
|
1407
|
-
return r || (this.pluginCaches[s] =
|
1422
|
+
return r || (this.pluginCaches[s] = W.send({
|
1408
1423
|
url: s,
|
1409
1424
|
method: "get",
|
1410
1425
|
settings: {
|
@@ -1417,12 +1432,12 @@ class se {
|
|
1417
1432
|
return console.log("BaseService.genSource", e), "";
|
1418
1433
|
}
|
1419
1434
|
}
|
1420
|
-
const g = new
|
1435
|
+
const g = new Ve({
|
1421
1436
|
type: "local",
|
1422
1437
|
expired: 0,
|
1423
1438
|
prefix: "__VTJ_"
|
1424
1439
|
});
|
1425
|
-
class
|
1440
|
+
class us extends se {
|
1426
1441
|
init(e) {
|
1427
1442
|
const t = new N(e), s = g.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1428
1443
|
return g.save(`project_${t.id}`, r), Promise.resolve(r);
|
@@ -1432,7 +1447,7 @@ class cs extends se {
|
|
1432
1447
|
return g.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1433
1448
|
}
|
1434
1449
|
saveMaterials(e, t) {
|
1435
|
-
return g.save(`materials_${e.id}`,
|
1450
|
+
return g.save(`materials_${e.id}`, te(t)), Promise.resolve(!0);
|
1436
1451
|
}
|
1437
1452
|
saveFile(e) {
|
1438
1453
|
return g.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1472,7 +1487,7 @@ class cs extends se {
|
|
1472
1487
|
}), Promise.resolve(!0);
|
1473
1488
|
}
|
1474
1489
|
}
|
1475
|
-
class
|
1490
|
+
class Wt extends se {
|
1476
1491
|
projects = {};
|
1477
1492
|
materials = {};
|
1478
1493
|
files = {};
|
@@ -1487,7 +1502,7 @@ class Vt extends se {
|
|
1487
1502
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1488
1503
|
}
|
1489
1504
|
saveMaterials(e, t) {
|
1490
|
-
return e.id && (this.materials[e.id] =
|
1505
|
+
return e.id && (this.materials[e.id] = te(t)), Promise.resolve(!0);
|
1491
1506
|
}
|
1492
1507
|
saveFile(e) {
|
1493
1508
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1530,10 +1545,10 @@ class Vt extends se {
|
|
1530
1545
|
}
|
1531
1546
|
}
|
1532
1547
|
let x = null;
|
1533
|
-
function
|
1534
|
-
return x || (x = new
|
1548
|
+
function ps() {
|
1549
|
+
return x || (x = new Wt(), x);
|
1535
1550
|
}
|
1536
|
-
class
|
1551
|
+
class fs extends se {
|
1537
1552
|
getFileCaches = {};
|
1538
1553
|
async getExtension() {
|
1539
1554
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1550,7 +1565,7 @@ class us extends se {
|
|
1550
1565
|
async saveMaterials(e, t) {
|
1551
1566
|
return !!await this.api("saveMaterials", {
|
1552
1567
|
project: e,
|
1553
|
-
materials:
|
1568
|
+
materials: te(t)
|
1554
1569
|
}).catch(() => !1);
|
1555
1570
|
}
|
1556
1571
|
async saveFile(e) {
|
@@ -1590,7 +1605,7 @@ class us extends se {
|
|
1590
1605
|
);
|
1591
1606
|
}
|
1592
1607
|
}
|
1593
|
-
function
|
1608
|
+
function Ae(n, e, t = []) {
|
1594
1609
|
return t.map((s) => {
|
1595
1610
|
const { id: r, title: i, icon: a, children: o, hidden: c } = s;
|
1596
1611
|
return {
|
@@ -1599,28 +1614,28 @@ function ke(n, e, t = []) {
|
|
1599
1614
|
icon: a,
|
1600
1615
|
hidden: c,
|
1601
1616
|
url: `${n}/${e}/${r}`,
|
1602
|
-
children: o && o.length ?
|
1617
|
+
children: o && o.length ? Ae(n, e, o) : void 0
|
1603
1618
|
};
|
1604
1619
|
});
|
1605
1620
|
}
|
1606
|
-
function
|
1621
|
+
function Ie(n, e) {
|
1607
1622
|
if (!e) return n;
|
1608
1623
|
let t = [];
|
1609
1624
|
for (const s of n)
|
1610
1625
|
if (s.children && s.children.length) {
|
1611
|
-
const r =
|
1626
|
+
const r = Ie(s.children, e);
|
1612
1627
|
r.length && (s.children = r, t.push(s));
|
1613
1628
|
} else
|
1614
1629
|
e.can(s.id.toString()) && t.push(s);
|
1615
1630
|
return t;
|
1616
1631
|
}
|
1617
|
-
function
|
1632
|
+
function ds(n) {
|
1618
1633
|
const {
|
1619
1634
|
menuPathPrefix: e = "",
|
1620
1635
|
pageRouteName: t = "page",
|
1621
1636
|
disableMenusFilter: s = !1
|
1622
|
-
} = n || {}, r =
|
1623
|
-
|
1637
|
+
} = n || {}, r = ke(), i = ge(), a = ut(), o = Y(!1), c = Y(!1), l = r.project;
|
1638
|
+
We(() => {
|
1624
1639
|
const { name: m, params: f, meta: d } = i;
|
1625
1640
|
if (m === I) {
|
1626
1641
|
const h = r.getPage(f.id);
|
@@ -1631,7 +1646,7 @@ function ps(n) {
|
|
1631
1646
|
} else
|
1632
1647
|
o.value = !d.mask, c.value = !!d.pure;
|
1633
1648
|
});
|
1634
|
-
const u =
|
1649
|
+
const u = Ae(
|
1635
1650
|
e,
|
1636
1651
|
t,
|
1637
1652
|
l?.pages
|
@@ -1641,77 +1656,79 @@ function ps(n) {
|
|
1641
1656
|
logo: p?.logo,
|
1642
1657
|
themeSwitchable: p?.themeSwitchable,
|
1643
1658
|
title: p?.title || l?.description || l?.name || "VTJ App",
|
1644
|
-
menus: s ? u :
|
1659
|
+
menus: s ? u : Ie(u, a),
|
1645
1660
|
pure: c
|
1646
1661
|
};
|
1647
1662
|
}
|
1648
1663
|
export {
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1664
|
+
$e as ACCESS_KEY,
|
1665
|
+
Ee as Access,
|
1666
|
+
Xe as BUILD_IN_TAGS,
|
1667
|
+
Ge as BUILT_IN_DIRECTIVES,
|
1653
1668
|
se as BaseService,
|
1654
1669
|
le as CONTEXT_HOST,
|
1655
|
-
|
1670
|
+
gt as Context,
|
1656
1671
|
y as ContextMode,
|
1657
|
-
|
1672
|
+
Ye as DATA_TYPES,
|
1658
1673
|
O as HOMEPAGE_ROUTE_NAME,
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1674
|
+
Qe as HTML_TAGS,
|
1675
|
+
ns as JSCodeToString,
|
1676
|
+
Zt as LIFE_CYCLES_LIST,
|
1677
|
+
fs as LocalService,
|
1678
|
+
Wt as MemoryService,
|
1679
|
+
Jt as NodeEnv,
|
1665
1680
|
I as PAGE_ROUTE_NAME,
|
1666
|
-
|
1667
|
-
|
1681
|
+
Kt as Provider,
|
1682
|
+
us as StorageService,
|
1668
1683
|
A as VTJ_RENDERER_VERSION,
|
1669
1684
|
_e as adoptedStyleSheets,
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1685
|
+
os as clearLoaderCache,
|
1686
|
+
is as createAccess,
|
1687
|
+
rs as createAdapter,
|
1688
|
+
es as createAssetScripts,
|
1689
|
+
ts as createAssetsCss,
|
1690
|
+
jt as createDataSources,
|
1691
|
+
Z as createLoader,
|
1692
|
+
ps as createMemoryService,
|
1693
|
+
ft as createMetaApi,
|
1694
|
+
mt as createMock,
|
1695
|
+
as as createProvider,
|
1696
|
+
X as createRenderer,
|
1697
|
+
pt as createSchemaApi,
|
1698
|
+
dt as createSchemaApis,
|
1699
|
+
ls as createServiceRequest,
|
1700
|
+
bt as defaultLoader,
|
1686
1701
|
D as fillBasePath,
|
1687
1702
|
M as getMock,
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1703
|
+
be as getModifiers,
|
1704
|
+
Pe as getPlugin,
|
1705
|
+
st as getRawComponent,
|
1706
|
+
ot as isBuiltInTag,
|
1707
|
+
U as isCSSUrl,
|
1708
|
+
ct as isJSCode,
|
1694
1709
|
w as isJSExpression,
|
1695
1710
|
T as isJSFunction,
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1711
|
+
Ze as isJSON,
|
1712
|
+
L as isJSUrl,
|
1713
|
+
at as isNativeTag,
|
1714
|
+
it as isVuePlugin,
|
1715
|
+
rt as loadCss,
|
1716
|
+
we as loadCssUrl,
|
1717
|
+
cs as loadEnhance,
|
1718
|
+
Se as loadScriptUrl,
|
1719
|
+
vt as mockApi,
|
1720
|
+
ht as mockApis,
|
1721
|
+
je as mockCleanup,
|
1706
1722
|
k as nodeRender,
|
1707
|
-
|
1723
|
+
tt as parseDeps,
|
1708
1724
|
H as parseExpression,
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1725
|
+
Q as parseFunction,
|
1726
|
+
nt as parseUrls,
|
1727
|
+
Ce as providerKey,
|
1728
|
+
et as removeProdFlag,
|
1729
|
+
ss as setupPageSetting,
|
1713
1730
|
ye as toString,
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1731
|
+
ut as useAccess,
|
1732
|
+
ds as useMask,
|
1733
|
+
ke as useProvider
|
1717
1734
|
};
|