@vtj/renderer 0.9.21 → 0.9.23
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 +6 -6
- package/dist/index.mjs +506 -489
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
3
|
-
import * as
|
4
|
-
import { inject as
|
1
|
+
import { Base as Ie, BUILT_IN_COMPONENTS as Me, ProjectModel as O, HistoryModel as de } from "@vtj/core";
|
2
|
+
import { isUrl as De, url as x, dedupArray as He, isString as j, isFunction as z, logger as P, storage as L, cookie as q, toArray as ie, unRSA as oe, delay as pe, createRequest as fe, jsonp as he, merge as Oe, pathToRegexp as Be, pathToRegexpMatch as Ne, formDataToJson as Ue, camelCase as $, upperFirst as Le, pick as qe, request as K, loadScript as ae, Storage as Je, mapToObject as X } from "@vtj/utils";
|
3
|
+
import * as N from "vue";
|
4
|
+
import { inject as me, toRef as Ve, readonly as ze, customRef as Ke, ref as T, onBeforeUnmount as We, getCurrentScope as Ge, onScopeDispose as Ye, unref as Qe, getCurrentInstance as ge, watch as ve, computed as ye, onMounted as Xe, defineComponent as Z, h as W, openBlock as Ze, createElementBlock as et, createElementVNode as E, toDisplayString as J, defineAsyncComponent as ce, watchEffect as tt } from "vue";
|
5
5
|
import k from "mockjs";
|
6
|
-
import { useRoute as
|
6
|
+
import { useRoute as _e } from "vue-router";
|
7
7
|
/**!
|
8
8
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
9
9
|
* @name @vtj/renderer
|
10
10
|
* @author CHC chenhuachun1549@dingtalk.com
|
11
|
-
* @version 0.9.
|
11
|
+
* @version 0.9.23
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
13
13
|
*/
|
14
|
-
const
|
14
|
+
const C = "0.9.23";
|
15
15
|
var y = /* @__PURE__ */ ((s) => (s.Runtime = "Runtime", s.Design = "Design", s.Raw = "Raw", s.VNode = "VNode", s))(y || {});
|
16
|
-
const
|
16
|
+
const le = [
|
17
17
|
"$el",
|
18
18
|
"$emit",
|
19
19
|
"$nextTick",
|
@@ -25,7 +25,7 @@ const ce = [
|
|
25
25
|
"$props",
|
26
26
|
"$options",
|
27
27
|
"$forceUpdate"
|
28
|
-
],
|
28
|
+
], Pn = [
|
29
29
|
"beforeCreate",
|
30
30
|
"created",
|
31
31
|
"beforeMount",
|
@@ -39,14 +39,14 @@ const ce = [
|
|
39
39
|
"renderTriggered",
|
40
40
|
"activated",
|
41
41
|
"deactivated"
|
42
|
-
],
|
42
|
+
], nt = [
|
43
43
|
"vIf",
|
44
44
|
"vShow",
|
45
45
|
"vModel",
|
46
46
|
"vFor",
|
47
47
|
"vBind",
|
48
48
|
"vHtml"
|
49
|
-
],
|
49
|
+
], st = {
|
50
50
|
String,
|
51
51
|
Number,
|
52
52
|
Boolean,
|
@@ -54,80 +54,80 @@ const ce = [
|
|
54
54
|
Object,
|
55
55
|
Function,
|
56
56
|
Date
|
57
|
-
},
|
57
|
+
}, F = "VtjPage", H = "VtjHomepage", rt = "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(
|
58
58
|
","
|
59
|
-
),
|
60
|
-
function
|
61
|
-
return s.map((t) =>
|
59
|
+
), it = "component,slot".split(",");
|
60
|
+
function M(s, e) {
|
61
|
+
return s.map((t) => De(t) || t.startsWith("/") ? t : `${e}${t}`);
|
62
62
|
}
|
63
|
-
function
|
63
|
+
function ee(s) {
|
64
64
|
return /\.css$/.test(s);
|
65
65
|
}
|
66
|
-
function
|
66
|
+
function te(s) {
|
67
67
|
return /\.js$/.test(s);
|
68
68
|
}
|
69
69
|
function ot(s) {
|
70
70
|
return /\.json$/.test(s);
|
71
71
|
}
|
72
|
-
function
|
72
|
+
function Cn(s) {
|
73
73
|
return s.map(
|
74
|
-
(e) => `<script src="${
|
74
|
+
(e) => `<script src="${x.append(e, { v: C })}"><\/script>`
|
75
75
|
).join("");
|
76
76
|
}
|
77
|
-
function
|
77
|
+
function Fn(s = []) {
|
78
78
|
return s.map(
|
79
|
-
(e) => `<link rel="stylesheet" href="${
|
79
|
+
(e) => `<link rel="stylesheet" href="${x.append(e, { v: C })}" />`
|
80
80
|
).join("");
|
81
81
|
}
|
82
|
-
function
|
82
|
+
function at(s, e = !1) {
|
83
83
|
return e && s.endsWith(".prod.js") ? s.replace(".prod.js", ".js") : s;
|
84
84
|
}
|
85
|
-
function
|
86
|
-
const n = s.filter((d) => !!d.enabled), r = [],
|
85
|
+
function ct(s, e, t = !1) {
|
86
|
+
const n = s.filter((d) => !!d.enabled), r = [], i = [], a = [], o = [], c = {}, l = {}, f = [], u = {};
|
87
87
|
return n.forEach(
|
88
88
|
({ urls: d, assetsUrl: h, library: m, assetsLibrary: p, localeLibrary: w }) => {
|
89
89
|
d?.forEach((g) => {
|
90
|
-
|
91
|
-
}), m && (
|
90
|
+
te(g) && r.push(at(g, t)), ee(g) && i.push(g);
|
91
|
+
}), m && (o.push(m), c[m] = M(d || [], e), w && (l[m] = w)), h && a.push(h), p && f.push(p), m && p && (u[p] = m);
|
92
92
|
}
|
93
93
|
), {
|
94
|
-
scripts:
|
95
|
-
css:
|
96
|
-
materials:
|
97
|
-
libraryExports:
|
98
|
-
materialExports:
|
94
|
+
scripts: M(r, e),
|
95
|
+
css: M(i, e),
|
96
|
+
materials: M(a, e),
|
97
|
+
libraryExports: o,
|
98
|
+
materialExports: He(f),
|
99
99
|
materialMapLibrary: u,
|
100
100
|
libraryMap: c,
|
101
101
|
libraryLocaleMap: l
|
102
102
|
};
|
103
103
|
}
|
104
|
-
function
|
104
|
+
function lt(s, e) {
|
105
105
|
const { name: t, parent: n, alias: r } = s;
|
106
106
|
return n ? e[n]?.[r || t] : e[r || t];
|
107
107
|
}
|
108
|
-
function
|
108
|
+
function we(s) {
|
109
109
|
return j(s) ? s : JSON.stringify(s);
|
110
110
|
}
|
111
|
-
function
|
111
|
+
function Se(s, e, t) {
|
112
112
|
const n = s.CSSStyleSheet;
|
113
113
|
if (n.prototype.replaceSync) {
|
114
114
|
const r = new n();
|
115
115
|
r.id = e, r.replaceSync(t);
|
116
|
-
const
|
116
|
+
const i = s.document, a = i.adoptedStyleSheets, o = Array.from(a).filter(
|
117
117
|
(c) => c.id !== e
|
118
118
|
);
|
119
|
-
|
119
|
+
i.adoptedStyleSheets = [...o, r];
|
120
120
|
} else {
|
121
121
|
const r = s.document;
|
122
|
-
let
|
123
|
-
|
122
|
+
let i = r.getElementById(e);
|
123
|
+
i ? i.innerHTML = t : (i = r.createElement("style"), i.id = e, i.innerHTML = t, r.head.appendChild(i));
|
124
124
|
}
|
125
125
|
}
|
126
|
-
async function
|
126
|
+
async function ut(s, e) {
|
127
127
|
const t = await window.fetch(e).then((n) => n.text()).catch(() => "");
|
128
|
-
t &&
|
128
|
+
t && Se(window, s, t);
|
129
129
|
}
|
130
|
-
function
|
130
|
+
function dt(s, e = window) {
|
131
131
|
const t = e.document, n = e.document.head;
|
132
132
|
for (const r of s)
|
133
133
|
if (!t.getElementById(r)) {
|
@@ -135,46 +135,46 @@ function ut(s, e = window) {
|
|
135
135
|
a.rel = "stylesheet", a.id = r, a.href = r, n.appendChild(a);
|
136
136
|
}
|
137
137
|
}
|
138
|
-
async function
|
138
|
+
async function pt(s, e, t = window) {
|
139
139
|
const n = t.document, r = t.document.head;
|
140
|
-
let
|
141
|
-
return
|
140
|
+
let i = t[e];
|
141
|
+
return i ? i.default || i : new Promise((a, o) => {
|
142
142
|
for (const c of s) {
|
143
143
|
const l = n.createElement("script");
|
144
144
|
l.src = c, l.onload = () => {
|
145
|
-
|
145
|
+
i = t[e], i ? a(i.default || i) : o(null);
|
146
146
|
}, l.onerror = (f) => {
|
147
|
-
|
147
|
+
o(f);
|
148
148
|
}, r.appendChild(l);
|
149
149
|
}
|
150
150
|
});
|
151
151
|
}
|
152
|
-
function pt(s) {
|
153
|
-
return V(s) || V(s?.install);
|
154
|
-
}
|
155
152
|
function ft(s) {
|
156
|
-
return
|
153
|
+
return z(s) || z(s?.install);
|
157
154
|
}
|
158
155
|
function ht(s) {
|
159
|
-
return
|
156
|
+
return it.includes(s);
|
160
157
|
}
|
161
|
-
function
|
158
|
+
function mt(s) {
|
159
|
+
return rt.includes(s);
|
160
|
+
}
|
161
|
+
function A(s, e, t = !1, n = !1) {
|
162
162
|
try {
|
163
163
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
164
164
|
r.push("return ");
|
165
|
-
let
|
166
|
-
|
167
|
-
`) +
|
168
|
-
const a = `with(${t ? "{}" : "$scope || {}"}) { ${
|
165
|
+
let i = (s.value || "").trim();
|
166
|
+
i = i.replace(/this(\W|$)/g, (o, c) => `__self${c}`), i = r.join(`
|
167
|
+
`) + i;
|
168
|
+
const a = `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
169
169
|
return new Function("$scope", a)(e);
|
170
170
|
} catch (r) {
|
171
|
-
if (
|
171
|
+
if (P.error("parseExpression.error", r, s, e?.__self ?? e), n)
|
172
172
|
throw r;
|
173
173
|
}
|
174
174
|
}
|
175
|
-
function
|
176
|
-
const r =
|
177
|
-
if (typeof r != "function" && (
|
175
|
+
function G(s, e, t = !1, n = !1) {
|
176
|
+
const r = A(s, e, t, n);
|
177
|
+
if (typeof r != "function" && (P.error(
|
178
178
|
"parseFunction.error",
|
179
179
|
"not a function",
|
180
180
|
s,
|
@@ -186,16 +186,16 @@ function W(s, e, t = !1, n = !1) {
|
|
186
186
|
function _(s) {
|
187
187
|
return s && s.type === "JSExpression";
|
188
188
|
}
|
189
|
-
function
|
189
|
+
function I(s) {
|
190
190
|
return typeof s == "object" && s && s.type === "JSFunction";
|
191
191
|
}
|
192
|
-
function
|
193
|
-
return _(s) ||
|
192
|
+
function gt(s) {
|
193
|
+
return _(s) || I(s);
|
194
194
|
}
|
195
|
-
function
|
196
|
-
return
|
195
|
+
function Tn(s) {
|
196
|
+
return gt(s) ? s.value : JSON.stringify(s);
|
197
197
|
}
|
198
|
-
const
|
198
|
+
const vt = {
|
199
199
|
session: !1,
|
200
200
|
authKey: "Authorization",
|
201
201
|
storageKey: "ACCESS_STORAGE",
|
@@ -207,31 +207,31 @@ const gt = {
|
|
207
207
|
unauthorizedMessage: "登录已经失效,请重新登录!",
|
208
208
|
noPermissionMessage: "无权限访问该页面",
|
209
209
|
appName: ""
|
210
|
-
},
|
211
|
-
class
|
210
|
+
}, be = Symbol("access");
|
211
|
+
class An {
|
212
212
|
options;
|
213
213
|
data = null;
|
214
214
|
mode = y.Raw;
|
215
215
|
constructor(e) {
|
216
|
-
this.options = Object.assign({},
|
216
|
+
this.options = Object.assign({}, vt, e), this.loadData();
|
217
217
|
}
|
218
218
|
connect(e) {
|
219
219
|
const { mode: t, router: n, request: r } = e;
|
220
220
|
this.mode = t, n && this.mode === y.Raw && this.setGuard(n), r && this.setRequest(r);
|
221
221
|
}
|
222
222
|
login(e) {
|
223
|
-
const { storageKey: t, storagePrefix: n, session: r, authKey:
|
224
|
-
this.setData(e), this.data && (
|
223
|
+
const { storageKey: t, storagePrefix: n, session: r, authKey: i } = this.options;
|
224
|
+
this.setData(e), this.data && (L.save(t, e, {
|
225
225
|
type: "local",
|
226
226
|
prefix: n
|
227
|
-
}), r &&
|
227
|
+
}), r && q.set(i, this.data.token));
|
228
228
|
}
|
229
229
|
clear() {
|
230
230
|
const { storageKey: e, storagePrefix: t, session: n, authKey: r } = this.options;
|
231
|
-
this.data = null,
|
231
|
+
this.data = null, L.remove(e, {
|
232
232
|
type: "local",
|
233
233
|
prefix: t
|
234
|
-
}), n &&
|
234
|
+
}), n && q.remove(r);
|
235
235
|
}
|
236
236
|
logout() {
|
237
237
|
this.clear(), this.toLogin();
|
@@ -244,14 +244,14 @@ class Tn {
|
|
244
244
|
}
|
245
245
|
can(e) {
|
246
246
|
const { appName: t } = this.options, { permissions: n = {} } = this.data || {};
|
247
|
-
return typeof e == "function" ? e(n) :
|
247
|
+
return typeof e == "function" ? e(n) : ie(e).every((i) => n[i] || n[t + "." + i]);
|
248
248
|
}
|
249
249
|
some(e) {
|
250
250
|
const { appName: t } = this.options, { permissions: n = {} } = this.data || {};
|
251
|
-
return
|
251
|
+
return ie(e).some((i) => n[i] || n[t + "." + i]);
|
252
252
|
}
|
253
253
|
install(e) {
|
254
|
-
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(
|
254
|
+
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(be, this);
|
255
255
|
}
|
256
256
|
isAuthPath(e) {
|
257
257
|
const { auth: t, isAuth: n } = this.options;
|
@@ -287,7 +287,7 @@ class Tn {
|
|
287
287
|
this.data = e;
|
288
288
|
}
|
289
289
|
loadData() {
|
290
|
-
const { storageKey: e, storagePrefix: t } = this.options, n =
|
290
|
+
const { storageKey: e, storagePrefix: t } = this.options, n = L.get(e, {
|
291
291
|
type: "local",
|
292
292
|
prefix: t
|
293
293
|
});
|
@@ -295,10 +295,10 @@ class Tn {
|
|
295
295
|
}
|
296
296
|
isLogined() {
|
297
297
|
const { session: e, authKey: t } = this.options;
|
298
|
-
return e && t ? !!
|
298
|
+
return e && t ? !!q.get(t) : !!this.getToken();
|
299
299
|
}
|
300
300
|
hasRoutePermission(e) {
|
301
|
-
if (e.name ===
|
301
|
+
if (e.name === F) {
|
302
302
|
const t = e.params.id;
|
303
303
|
return t && this.can(t);
|
304
304
|
}
|
@@ -315,7 +315,7 @@ class Tn {
|
|
315
315
|
return t();
|
316
316
|
{
|
317
317
|
const { noPermissionMessage: n = "无权限访问", unauthorized: r = !1 } = this.options;
|
318
|
-
return await this.showTip(n),
|
318
|
+
return await this.showTip(n), z(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
319
319
|
}
|
320
320
|
}
|
321
321
|
t(!1), this.toLogin();
|
@@ -334,7 +334,7 @@ class Tn {
|
|
334
334
|
}
|
335
335
|
async showTip(e) {
|
336
336
|
const { alert: t } = this.options;
|
337
|
-
return t ? (await
|
337
|
+
return t ? (await pe(150), await t(e, {
|
338
338
|
title: "提示",
|
339
339
|
type: "warning"
|
340
340
|
}).catch(() => !1)) : !1;
|
@@ -349,14 +349,14 @@ class Tn {
|
|
349
349
|
);
|
350
350
|
}
|
351
351
|
}
|
352
|
-
function
|
353
|
-
return
|
352
|
+
function yt() {
|
353
|
+
return me(be, null);
|
354
354
|
}
|
355
|
-
function
|
355
|
+
function In(s = {}) {
|
356
356
|
const { notify: e, loading: t, settings: n = {} } = s;
|
357
357
|
let r = null;
|
358
358
|
return {
|
359
|
-
request:
|
359
|
+
request: fe({
|
360
360
|
settings: {
|
361
361
|
type: "form",
|
362
362
|
validSuccess: !0,
|
@@ -376,12 +376,12 @@ function An(s = {}) {
|
|
376
376
|
...n
|
377
377
|
}
|
378
378
|
}),
|
379
|
-
jsonp:
|
379
|
+
jsonp: he,
|
380
380
|
notify: e,
|
381
381
|
loading: t
|
382
382
|
};
|
383
383
|
}
|
384
|
-
function
|
384
|
+
function _t(s, e) {
|
385
385
|
const { jsonp: t, request: n } = e;
|
386
386
|
if (s.method === "jsonp")
|
387
387
|
return (r = {}) => t(s.url, {
|
@@ -389,7 +389,7 @@ function yt(s, e) {
|
|
389
389
|
query: r
|
390
390
|
});
|
391
391
|
{
|
392
|
-
const r = s.headers ?
|
392
|
+
const r = s.headers ? A(s.headers, {}, !0) : void 0, i = {
|
393
393
|
url: s.url,
|
394
394
|
method: s.method,
|
395
395
|
settings: {
|
@@ -397,60 +397,60 @@ function yt(s, e) {
|
|
397
397
|
headers: r
|
398
398
|
}
|
399
399
|
};
|
400
|
-
return (a,
|
400
|
+
return (a, o) => (delete i.data, n.send(Oe(i, o || {}, { data: a })));
|
401
401
|
}
|
402
402
|
}
|
403
|
-
function
|
403
|
+
function wt(s, e) {
|
404
404
|
const { metaQuery: t } = e;
|
405
405
|
if (!t) return;
|
406
406
|
const { code: n, queryCode: r } = s;
|
407
|
-
return (
|
407
|
+
return (i, a) => {
|
408
408
|
if (!t) {
|
409
409
|
console.warn("adapter.metaQuery is not defined!");
|
410
410
|
return;
|
411
411
|
}
|
412
|
-
return t(n, r,
|
412
|
+
return t(n, r, i, a);
|
413
413
|
};
|
414
414
|
}
|
415
|
-
function
|
415
|
+
function St(s = [], e = [], t) {
|
416
416
|
const n = {};
|
417
417
|
for (const r of s)
|
418
|
-
n[r.id] = yt(r, t);
|
419
|
-
for (const r of e)
|
420
418
|
n[r.id] = _t(r, t);
|
419
|
+
for (const r of e)
|
420
|
+
n[r.id] = wt(r, t);
|
421
421
|
return n;
|
422
422
|
}
|
423
|
-
async function
|
424
|
-
k && (
|
423
|
+
async function bt(s = []) {
|
424
|
+
k && (je(), s.forEach((e) => $t(k, e)));
|
425
425
|
}
|
426
|
-
function
|
427
|
-
const e =
|
426
|
+
function jt(s) {
|
427
|
+
const e = I(s.mockTemplate) && s.mockTemplate.value ? G(s.mockTemplate, {}, !0) : void 0;
|
428
428
|
return async (...t) => {
|
429
429
|
let n = {};
|
430
430
|
if (e)
|
431
431
|
try {
|
432
432
|
n = await e.apply(e, t);
|
433
433
|
} catch (r) {
|
434
|
-
|
434
|
+
P.warn("模拟数据模版异常", r);
|
435
435
|
}
|
436
436
|
return k.mock(n);
|
437
437
|
};
|
438
438
|
}
|
439
|
-
function
|
439
|
+
function $t(s, e) {
|
440
440
|
if (!e.mock) return;
|
441
441
|
const { url: t, mockTemplate: n } = e;
|
442
442
|
if (t && n) {
|
443
|
-
const r =
|
444
|
-
s.mock(r, (
|
445
|
-
const c =
|
446
|
-
return Object.assign(
|
443
|
+
const r = Be(`${t}(.*)`), i = Ne(t, { decode: decodeURIComponent }), a = A(n, {}, !0);
|
444
|
+
s.mock(r, (o) => {
|
445
|
+
const c = x.parse(o.url) || {}, l = o.body instanceof FormData ? Ue(o.body) : o.body, f = i(o.url)?.params;
|
446
|
+
return Object.assign(o, { data: l, params: c, query: f }), s.mock(a(o));
|
447
447
|
});
|
448
448
|
}
|
449
449
|
}
|
450
|
-
function
|
450
|
+
function je() {
|
451
451
|
k && (k._mocked = {});
|
452
452
|
}
|
453
|
-
class
|
453
|
+
class Et {
|
454
454
|
__id = null;
|
455
455
|
__mode;
|
456
456
|
__instance = null;
|
@@ -479,7 +479,7 @@ class $t {
|
|
479
479
|
const { mode: t, dsl: n, attrs: r } = e;
|
480
480
|
this.__mode = t, n && (this.__id = n.id || null, this.__transform = n.transform || {}), r && Object.assign(this, r);
|
481
481
|
}
|
482
|
-
setup(e, t =
|
482
|
+
setup(e, t = N) {
|
483
483
|
const n = t.getCurrentInstance();
|
484
484
|
if (!n) return;
|
485
485
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = n.proxy;
|
@@ -493,12 +493,12 @@ class $t {
|
|
493
493
|
});
|
494
494
|
}
|
495
495
|
__proxy() {
|
496
|
-
this.__instance &&
|
496
|
+
this.__instance && le.forEach((e) => {
|
497
497
|
this[e] = this.__instance?.[e];
|
498
498
|
});
|
499
499
|
}
|
500
500
|
__cleanup() {
|
501
|
-
|
501
|
+
le.forEach((e) => {
|
502
502
|
this[e] = null;
|
503
503
|
}), this.__reset();
|
504
504
|
}
|
@@ -509,22 +509,22 @@ class $t {
|
|
509
509
|
if (e)
|
510
510
|
if (this.__mode === y.Runtime) {
|
511
511
|
const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
512
|
-
return
|
512
|
+
return G({ type: n, value: r }, this);
|
513
513
|
} else
|
514
|
-
return
|
514
|
+
return G(e, this);
|
515
515
|
}
|
516
516
|
__parseExpression(e) {
|
517
517
|
if (e)
|
518
518
|
if (this.__mode === y.Runtime) {
|
519
519
|
const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
520
|
-
return
|
520
|
+
return A({ type: n, value: r }, this);
|
521
521
|
} else
|
522
|
-
return
|
522
|
+
return A(e, this);
|
523
523
|
}
|
524
524
|
__ref(e = null, t) {
|
525
525
|
if (this.__mode !== y.VNode)
|
526
526
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (n) => {
|
527
|
-
await
|
527
|
+
await pe(0);
|
528
528
|
let r = n?.$vtjEl || n?.$el || n?._?.vnode?.el || n;
|
529
529
|
if (!r) {
|
530
530
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
@@ -536,8 +536,8 @@ class $t {
|
|
536
536
|
__getRefEl(e, t, n) {
|
537
537
|
const r = e[t];
|
538
538
|
if (r && n !== r) {
|
539
|
-
const
|
540
|
-
return Array.from(
|
539
|
+
const i = new Set([].concat(r, n));
|
540
|
+
return Array.from(i);
|
541
541
|
} else
|
542
542
|
return n;
|
543
543
|
}
|
@@ -549,35 +549,35 @@ class $t {
|
|
549
549
|
return n.context.__proto__ = this.context, n.__proto__ = this, n;
|
550
550
|
}
|
551
551
|
}
|
552
|
-
function
|
552
|
+
function Y(s) {
|
553
553
|
const {
|
554
|
-
Vue: e =
|
554
|
+
Vue: e = N,
|
555
555
|
mode: t = y.Runtime,
|
556
556
|
components: n = {},
|
557
557
|
libs: r = {},
|
558
|
-
apis:
|
558
|
+
apis: i = {},
|
559
559
|
loader: a
|
560
|
-
} = s,
|
560
|
+
} = s, o = e.computed(() => s.dsl), c = {
|
561
561
|
$components: n,
|
562
562
|
$libs: r,
|
563
|
-
$apis:
|
564
|
-
}, l = new
|
563
|
+
$apis: i
|
564
|
+
}, l = new Et({
|
565
565
|
mode: t,
|
566
|
-
dsl:
|
566
|
+
dsl: o.value,
|
567
567
|
attrs: c
|
568
568
|
}), f = e.defineComponent({
|
569
|
-
name:
|
569
|
+
name: o.value.name,
|
570
570
|
props: {
|
571
|
-
...
|
571
|
+
...Rt(o.value.props ?? [], l)
|
572
572
|
},
|
573
573
|
setup(u) {
|
574
|
-
l.$props = u, l.props = u,
|
574
|
+
l.$props = u, l.props = u, o.value.id && Se(
|
575
575
|
s.window || window,
|
576
|
-
|
577
|
-
|
578
|
-
), l.state =
|
579
|
-
const d =
|
580
|
-
|
576
|
+
o.value.id,
|
577
|
+
o.value.css || ""
|
578
|
+
), l.state = xt(e, o.value.state ?? {}, l);
|
579
|
+
const d = Pt(e, o.value.computed ?? {}, l), h = Ct(o.value.methods ?? {}, l), m = Ft(e, o.value.inject, l), p = Tt(
|
580
|
+
o.value.dataSources || {},
|
581
581
|
l
|
582
582
|
), w = {
|
583
583
|
...m,
|
@@ -585,29 +585,29 @@ function G(s) {
|
|
585
585
|
...h,
|
586
586
|
...p
|
587
587
|
};
|
588
|
-
return l.setup(w, e),
|
588
|
+
return l.setup(w, e), At(e, o.value.watch ?? [], l), {
|
589
589
|
vtj: l
|
590
590
|
};
|
591
591
|
},
|
592
|
-
emits:
|
592
|
+
emits: kt(o.value.emits),
|
593
593
|
expose: ["vtj"],
|
594
594
|
render() {
|
595
|
-
if (!
|
596
|
-
const u =
|
597
|
-
return u.length === 1 ?
|
595
|
+
if (!o.value.nodes) return null;
|
596
|
+
const u = o.value.nodes || [];
|
597
|
+
return u.length === 1 ? B(u[0], l, e, a) : u.map((d) => B(d, l, e, a));
|
598
598
|
},
|
599
|
-
...
|
599
|
+
...It(o.value.lifeCycles ?? {}, l)
|
600
600
|
});
|
601
601
|
return {
|
602
602
|
renderer: e.markRaw(f),
|
603
603
|
context: l
|
604
604
|
};
|
605
605
|
}
|
606
|
-
function
|
606
|
+
function kt(s = []) {
|
607
607
|
return s.map((e) => j(e) ? e : e.name);
|
608
608
|
}
|
609
|
-
function
|
610
|
-
const t = (n) => n ? (Array.isArray(n) ? n : [n]).map((
|
609
|
+
function Rt(s = [], e) {
|
610
|
+
const t = (n) => n ? (Array.isArray(n) ? n : [n]).map((i) => st[i]) : void 0;
|
611
611
|
return s.map((n) => j(n) ? {
|
612
612
|
name: n
|
613
613
|
} : {
|
@@ -624,50 +624,50 @@ function kt(s = [], e) {
|
|
624
624
|
{}
|
625
625
|
);
|
626
626
|
}
|
627
|
-
function
|
627
|
+
function xt(s, e, t) {
|
628
628
|
return s.reactive(
|
629
629
|
Object.keys(e || {}).reduce(
|
630
630
|
(n, r) => {
|
631
|
-
let
|
632
|
-
return _(
|
631
|
+
let i = e[r];
|
632
|
+
return _(i) ? i = t.__parseExpression(i) : I(i) && (i = t.__parseFunction(i)), n[r] = i, n;
|
633
633
|
},
|
634
634
|
{}
|
635
635
|
)
|
636
636
|
);
|
637
637
|
}
|
638
|
-
function
|
638
|
+
function Pt(s, e, t) {
|
639
639
|
return Object.entries(e ?? {}).reduce(
|
640
|
-
(n, [r,
|
640
|
+
(n, [r, i]) => (n[r] = s.computed(t.__parseFunction(i)), n),
|
641
641
|
{}
|
642
642
|
);
|
643
643
|
}
|
644
|
-
function
|
644
|
+
function Ct(s, e) {
|
645
645
|
return Object.entries(s ?? {}).reduce(
|
646
646
|
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
647
647
|
{}
|
648
648
|
);
|
649
649
|
}
|
650
|
-
function
|
650
|
+
function Ft(s, e = [], t) {
|
651
651
|
return e.reduce(
|
652
652
|
(n, r) => {
|
653
|
-
const { name:
|
653
|
+
const { name: i, from: a } = r || {};
|
654
654
|
r.default;
|
655
|
-
const
|
656
|
-
return n[
|
655
|
+
const o = _(a) ? t.__parseExpression(a) || i : a ?? i, c = _(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
656
|
+
return n[i] = s.inject(o, c), n;
|
657
657
|
},
|
658
658
|
{}
|
659
659
|
);
|
660
660
|
}
|
661
|
-
function
|
661
|
+
function Tt(s, e) {
|
662
662
|
return Object.keys(s).reduce(
|
663
663
|
(t, n) => {
|
664
664
|
const r = s[n];
|
665
665
|
if (r.type === "mock")
|
666
|
-
t[n] =
|
666
|
+
t[n] = jt(r);
|
667
667
|
else if (r.ref) {
|
668
|
-
const
|
669
|
-
t[n] = async (...
|
670
|
-
const c = await
|
668
|
+
const i = e.$apis[r.ref], a = I(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
669
|
+
t[n] = async (...o) => {
|
670
|
+
const c = await i.apply(e, o);
|
671
671
|
return a ? a(c) : c;
|
672
672
|
};
|
673
673
|
}
|
@@ -676,7 +676,7 @@ function Ft(s, e) {
|
|
676
676
|
{}
|
677
677
|
);
|
678
678
|
}
|
679
|
-
function
|
679
|
+
function At(s, e = [], t) {
|
680
680
|
e.forEach((n) => {
|
681
681
|
s.watch(
|
682
682
|
t.__parseExpression(n.source),
|
@@ -688,97 +688,114 @@ function Tt(s, e = [], t) {
|
|
688
688
|
);
|
689
689
|
});
|
690
690
|
}
|
691
|
-
function
|
691
|
+
function It(s, e) {
|
692
692
|
return Object.entries(s ?? {}).reduce(
|
693
693
|
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
694
694
|
{}
|
695
695
|
);
|
696
696
|
}
|
697
|
-
let
|
698
|
-
const
|
699
|
-
async function
|
700
|
-
const { urls: t = [], library: n } = s, r = t.filter((
|
697
|
+
let V = [], R = {};
|
698
|
+
const Mt = (s) => s;
|
699
|
+
async function $e(s, e = window) {
|
700
|
+
const { urls: t = [], library: n } = s, r = t.filter((o) => te(o));
|
701
701
|
if (r.length === 0 || !n) return null;
|
702
|
-
const
|
703
|
-
return
|
704
|
-
(
|
702
|
+
const i = t.filter((o) => ee(o));
|
703
|
+
return i.length && dt(i, e), await pt(r, n, e).catch(
|
704
|
+
(o) => (console.warn("loadScriptUrl error", r, n, o), null)
|
705
705
|
);
|
706
706
|
}
|
707
|
-
function
|
707
|
+
function Q(s) {
|
708
708
|
const { getDsl: e, getDslByUrl: t, options: n } = s;
|
709
|
-
return n.window && (
|
709
|
+
return n.window && (V.forEach((r) => {
|
710
710
|
delete n.window[r];
|
711
|
-
}),
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
711
|
+
}), V = []), (r, i, a = N) => {
|
712
|
+
if (!i || typeof i == "string") return r;
|
713
|
+
if (i.type === "Schema" && i.id) {
|
714
|
+
let o = R[i.id];
|
715
|
+
return o || (o = R[i.id] = a.defineAsyncComponent(async () => {
|
716
|
+
const c = await e(i.id);
|
717
|
+
return c && (c.name = r), c ? Y({
|
718
|
+
...n,
|
719
|
+
Vue: a,
|
720
|
+
dsl: c,
|
721
|
+
mode: y.Runtime,
|
722
|
+
loader: Q(s)
|
723
|
+
}).renderer : null;
|
724
|
+
}), o);
|
725
|
+
}
|
726
|
+
if (i.type === "UrlSchema" && i.url) {
|
727
|
+
let o = R[i.url];
|
728
|
+
return o || (o = R[i.url] = a.defineAsyncComponent(async () => {
|
729
|
+
const c = await t(i.url);
|
730
|
+
return c && (c.name = r), c ? Y({
|
731
|
+
...n,
|
732
|
+
Vue: a,
|
733
|
+
dsl: c,
|
734
|
+
mode: y.Runtime,
|
735
|
+
loader: Q(s)
|
736
|
+
}).renderer : null;
|
737
|
+
}), o);
|
738
|
+
}
|
739
|
+
if (i.type === "Plugin") {
|
740
|
+
let o = i.library ? R[i.library] : null;
|
741
|
+
return o || (i.library && V.push(i.library), o = R[i.library || Symbol()] = a.defineAsyncComponent(
|
742
|
+
async () => {
|
743
|
+
const c = await $e(i, n.window);
|
744
|
+
return c || (console.warn("getPlugin result is null", i), null);
|
745
|
+
}
|
746
|
+
), o);
|
747
|
+
}
|
748
|
+
return r;
|
749
|
+
};
|
750
|
+
}
|
751
|
+
function B(s, e, t = N, n = Mt) {
|
735
752
|
if (!s || !s.name || s.invisible) return null;
|
736
|
-
const r = t.getCurrentInstance()?.appContext, { id:
|
737
|
-
if (
|
753
|
+
const r = t.getCurrentInstance()?.appContext, { id: i = null, directives: a = [] } = s, { vIf: o, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: d, others: h } = Ht(a);
|
754
|
+
if (o && !Ot(o, e))
|
738
755
|
return null;
|
739
756
|
const m = (p) => {
|
740
757
|
const w = p.$components, g = (() => {
|
741
758
|
if (s.name === "component")
|
742
|
-
return
|
759
|
+
return Bt(p, s.props?.is);
|
743
760
|
if (s.name === "slot") return s.name;
|
744
761
|
const b = n(s.name, s.from, t);
|
745
|
-
return j(b) ?
|
746
|
-
})(), S =
|
762
|
+
return j(b) ? ht(b) || mt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
|
763
|
+
})(), S = Nt(i, s.props ?? {}, p), Te = Ut(t, s.events ?? {}, p);
|
747
764
|
if (s.name === "slot")
|
748
|
-
return
|
765
|
+
return Lt(t, s, S, p, n);
|
749
766
|
u && Object.assign(S, p.__parseExpression(u.value)), l && (S.style = Object.assign(
|
750
767
|
S.style ?? {},
|
751
|
-
|
752
|
-
)), d && Object.assign(S,
|
753
|
-
Object.assign(S,
|
768
|
+
Jt(l, p)
|
769
|
+
)), d && Object.assign(S, Vt(d, p)), f.forEach((b) => {
|
770
|
+
Object.assign(S, zt(t, b, p));
|
754
771
|
});
|
755
|
-
const
|
772
|
+
const Ae = Kt(
|
756
773
|
t,
|
757
774
|
s.children ?? [],
|
758
775
|
p,
|
759
776
|
n,
|
760
777
|
s
|
761
778
|
);
|
762
|
-
let
|
763
|
-
const
|
764
|
-
return
|
779
|
+
let U = t.createVNode(g, { ...S, ...Te }, Ae);
|
780
|
+
const re = r ? Dt(r, h, p) : [];
|
781
|
+
return re.length && (U = t.withDirectives(U, re)), U;
|
765
782
|
};
|
766
|
-
return c ?
|
783
|
+
return c ? Yt(c, m, e) : m(e);
|
767
784
|
}
|
768
|
-
function
|
785
|
+
function Dt(s, e, t) {
|
769
786
|
const n = s.app;
|
770
787
|
return e.map((r) => {
|
771
|
-
const
|
772
|
-
if (!
|
773
|
-
const a = [
|
788
|
+
const i = typeof r.name == "string" ? n.directive(r.name) : t.__parseExpression(r.name);
|
789
|
+
if (!i) return null;
|
790
|
+
const a = [i];
|
774
791
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
775
792
|
}).filter((r) => !!r);
|
776
793
|
}
|
777
|
-
function
|
778
|
-
const e = s.find((c) => $(c.name) === "vIf"), t = s.find((c) => $(c.name) === "vFor"), n = s.find((c) => $(c.name) === "vShow"), r = s.find((c) => $(c.name) === "vBind"),
|
794
|
+
function Ht(s = []) {
|
795
|
+
const e = s.find((c) => $(c.name) === "vIf"), t = s.find((c) => $(c.name) === "vFor"), n = s.find((c) => $(c.name) === "vShow"), r = s.find((c) => $(c.name) === "vBind"), i = s.find((c) => $(c.name) === "vHtml"), a = s.filter(
|
779
796
|
(c) => $(c.name) === "vModel"
|
780
|
-
),
|
781
|
-
(c) => !
|
797
|
+
), o = s.filter(
|
798
|
+
(c) => !nt.includes($(c.name))
|
782
799
|
);
|
783
800
|
return {
|
784
801
|
vIf: e,
|
@@ -786,105 +803,105 @@ function Dt(s = []) {
|
|
786
803
|
vShow: n,
|
787
804
|
vModels: a,
|
788
805
|
vBind: r,
|
789
|
-
others:
|
790
|
-
vHtml:
|
806
|
+
others: o,
|
807
|
+
vHtml: i
|
791
808
|
};
|
792
809
|
}
|
793
|
-
function
|
810
|
+
function Ot(s, e) {
|
794
811
|
return !!e.__parseExpression(s.value);
|
795
812
|
}
|
796
|
-
function
|
813
|
+
function Bt(s, e) {
|
797
814
|
return e ? _(e) ? s.__parseExpression(e) : e : "div";
|
798
815
|
}
|
799
|
-
function
|
816
|
+
function Nt(s, e, t) {
|
800
817
|
const n = Object.keys(e || {}).reduce(
|
801
|
-
(r,
|
802
|
-
let a = e[
|
803
|
-
return _(a) ? a = t.__parseExpression(a) :
|
818
|
+
(r, i) => {
|
819
|
+
let a = e[i];
|
820
|
+
return _(a) ? a = t.__parseExpression(a) : I(a) && (a = t.__parseFunction(a)), r[i] = a, r;
|
804
821
|
},
|
805
822
|
{}
|
806
823
|
);
|
807
824
|
return n.ref = t.__ref(s, n.ref), n;
|
808
825
|
}
|
809
|
-
function
|
826
|
+
function Ut(s, e, t) {
|
810
827
|
const n = ["passive", "capture", "once"], r = {
|
811
828
|
capture: "Capture",
|
812
829
|
once: "Once",
|
813
830
|
passive: "OnceCapture"
|
814
831
|
};
|
815
832
|
return Object.keys(e || {}).reduce(
|
816
|
-
(
|
817
|
-
const
|
818
|
-
return u && (
|
833
|
+
(i, a) => {
|
834
|
+
const o = e[a], c = Ee(o.modifiers), l = c.find((d) => n.includes(d)), f = "on" + Le(a) + (l && r[l] || ""), u = t.__parseFunction(o.handler);
|
835
|
+
return u && (i[f] = s.withModifiers(u, c)), i;
|
819
836
|
},
|
820
837
|
{}
|
821
838
|
);
|
822
839
|
}
|
823
|
-
function
|
840
|
+
function Ee(s = {}, e = !1) {
|
824
841
|
const t = Object.keys(s);
|
825
842
|
return e ? t.map((n) => "." + n) : t;
|
826
843
|
}
|
827
|
-
function
|
828
|
-
const { children:
|
829
|
-
return
|
830
|
-
|
831
|
-
) : Array.isArray(
|
832
|
-
(c) =>
|
844
|
+
function Lt(s, e, t, n, r) {
|
845
|
+
const { children: i } = e, a = qt(e, n), o = n.$slots?.[a.name];
|
846
|
+
return o ? o(t) : i ? j(i) ? s.createTextVNode(i) : _(i) ? s.createTextVNode(
|
847
|
+
we(n.__parseExpression(i))
|
848
|
+
) : Array.isArray(i) ? i.map(
|
849
|
+
(c) => B(c, n, s, r)
|
833
850
|
) : null : null;
|
834
851
|
}
|
835
|
-
function
|
852
|
+
function qt(s, e) {
|
836
853
|
const { props: t } = s, n = t?.name || "default";
|
837
854
|
return {
|
838
855
|
name: _(n) ? e.__parseExpression(n) : n,
|
839
856
|
params: []
|
840
857
|
};
|
841
858
|
}
|
842
|
-
function
|
859
|
+
function Jt(s, e) {
|
843
860
|
return e.__parseExpression(s.value) ? {} : {
|
844
861
|
display: "none"
|
845
862
|
};
|
846
863
|
}
|
847
|
-
function
|
864
|
+
function Vt(s, e) {
|
848
865
|
return {
|
849
866
|
innerHTML: e.__parseExpression(s.value) || ""
|
850
867
|
};
|
851
868
|
}
|
852
|
-
function
|
869
|
+
function zt(s, e, t) {
|
853
870
|
const n = {
|
854
871
|
type: "JSFunction",
|
855
872
|
value: e.value?.value ? `(v) => {
|
856
873
|
${e.value.value} = v;
|
857
874
|
}` : "(v) => {}"
|
858
|
-
}, r = t.__parseFunction(n),
|
875
|
+
}, r = t.__parseFunction(n), i = Ee(
|
859
876
|
_(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
860
877
|
), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
861
878
|
return {
|
862
879
|
[a]: t.__parseExpression(e.value),
|
863
|
-
[`onUpdate:${a}`]:
|
880
|
+
[`onUpdate:${a}`]: i.length && r ? s.withModifiers(r, i) : r
|
864
881
|
};
|
865
882
|
}
|
866
|
-
function
|
883
|
+
function Kt(s, e, t, n, r) {
|
867
884
|
if (!e) return null;
|
868
885
|
if (j(e))
|
869
886
|
return { default: () => e };
|
870
887
|
if (_(e))
|
871
888
|
return {
|
872
|
-
default: () =>
|
889
|
+
default: () => we(t.__parseExpression(e))
|
873
890
|
};
|
874
891
|
if (Array.isArray(e) && e.length > 0) {
|
875
|
-
const
|
876
|
-
[`scope_${r.id}`]:
|
892
|
+
const i = Wt(e), a = (o) => !o || !r ? {} : r?.id && Object.keys(o).length ? {
|
893
|
+
[`scope_${r.id}`]: o
|
877
894
|
} : {};
|
878
|
-
return Object.entries(
|
879
|
-
const d = f.length ?
|
895
|
+
return Object.entries(i).reduce((o, [c, { nodes: l, params: f }]) => (o[c] = (u) => {
|
896
|
+
const d = f.length ? qe(u ?? {}, f) : a(u);
|
880
897
|
return l.map(
|
881
|
-
(h) =>
|
898
|
+
(h) => B(h, t.__clone(d), s, n)
|
882
899
|
);
|
883
|
-
},
|
900
|
+
}, o), {});
|
884
901
|
}
|
885
902
|
return null;
|
886
903
|
}
|
887
|
-
function
|
904
|
+
function Wt(s) {
|
888
905
|
const e = {
|
889
906
|
default: {
|
890
907
|
params: [],
|
@@ -892,7 +909,7 @@ function Kt(s) {
|
|
892
909
|
}
|
893
910
|
};
|
894
911
|
for (const t of s) {
|
895
|
-
const n =
|
912
|
+
const n = Gt(t.slot), r = n.name;
|
896
913
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(n.params)) : e[r] = {
|
897
914
|
nodes: [t],
|
898
915
|
params: n.params
|
@@ -900,143 +917,143 @@ function Kt(s) {
|
|
900
917
|
}
|
901
918
|
return e;
|
902
919
|
}
|
903
|
-
function
|
920
|
+
function Gt(s = "default") {
|
904
921
|
return j(s) ? { name: s, params: [] } : { params: [], ...s };
|
905
922
|
}
|
906
|
-
function
|
907
|
-
const { value: n, iterator: r } = s, { item:
|
908
|
-
let
|
909
|
-
return Number.isInteger(
|
923
|
+
function Yt(s, e, t) {
|
924
|
+
const { value: n, iterator: r } = s, { item: i = "item", index: a = "index" } = r || {};
|
925
|
+
let o = t.__parseExpression(n) || [];
|
926
|
+
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]:", `${n?.value} is not a Arrary`), []);
|
910
927
|
}
|
911
|
-
function
|
912
|
-
return
|
928
|
+
function Qt(s) {
|
929
|
+
return Ge() ? (Ye(s), !0) : !1;
|
913
930
|
}
|
914
|
-
function
|
915
|
-
return typeof s == "function" ? s() :
|
931
|
+
function ne(s) {
|
932
|
+
return typeof s == "function" ? s() : Qe(s);
|
916
933
|
}
|
917
|
-
const
|
934
|
+
const ke = typeof window < "u" && typeof document < "u";
|
918
935
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
919
|
-
const
|
936
|
+
const Xt = (s) => s != null, Zt = () => {
|
920
937
|
};
|
921
|
-
function
|
922
|
-
return
|
938
|
+
function en(s) {
|
939
|
+
return ge();
|
923
940
|
}
|
924
|
-
function
|
941
|
+
function tn(...s) {
|
925
942
|
if (s.length !== 1)
|
926
|
-
return
|
943
|
+
return Ve(...s);
|
927
944
|
const e = s[0];
|
928
|
-
return typeof e == "function" ?
|
945
|
+
return typeof e == "function" ? ze(Ke(() => ({ get: e, set: Zt }))) : T(e);
|
929
946
|
}
|
930
|
-
function
|
931
|
-
|
947
|
+
function nn(s, e) {
|
948
|
+
en() && We(s, e);
|
932
949
|
}
|
933
|
-
const
|
934
|
-
function
|
950
|
+
const sn = ke ? window : void 0, rn = ke ? window.document : void 0;
|
951
|
+
function on(s) {
|
935
952
|
var e;
|
936
|
-
const t =
|
953
|
+
const t = ne(s);
|
937
954
|
return (e = t?.$el) != null ? e : t;
|
938
955
|
}
|
939
|
-
function
|
940
|
-
const s =
|
941
|
-
return e &&
|
956
|
+
function an() {
|
957
|
+
const s = T(!1), e = ge();
|
958
|
+
return e && Xe(() => {
|
942
959
|
s.value = !0;
|
943
960
|
}, e), s;
|
944
961
|
}
|
945
|
-
function
|
946
|
-
const e =
|
947
|
-
return
|
948
|
-
}
|
949
|
-
function
|
950
|
-
const { window: n =
|
951
|
-
let
|
952
|
-
const a =
|
953
|
-
|
954
|
-
}, c =
|
955
|
-
const d =
|
962
|
+
function cn(s) {
|
963
|
+
const e = an();
|
964
|
+
return ye(() => (e.value, !!s()));
|
965
|
+
}
|
966
|
+
function ln(s, e, t = {}) {
|
967
|
+
const { window: n = sn, ...r } = t;
|
968
|
+
let i;
|
969
|
+
const a = cn(() => n && "MutationObserver" in n), o = () => {
|
970
|
+
i && (i.disconnect(), i = void 0);
|
971
|
+
}, c = ye(() => {
|
972
|
+
const d = ne(s), h = (Array.isArray(d) ? d : [d]).map(on).filter(Xt);
|
956
973
|
return new Set(h);
|
957
|
-
}), l =
|
974
|
+
}), l = ve(
|
958
975
|
() => c.value,
|
959
976
|
(d) => {
|
960
|
-
|
977
|
+
o(), a.value && d.size && (i = new MutationObserver(e), d.forEach((h) => i.observe(h, r)));
|
961
978
|
},
|
962
979
|
{ immediate: !0, flush: "post" }
|
963
|
-
), f = () =>
|
964
|
-
l(),
|
980
|
+
), f = () => i?.takeRecords(), u = () => {
|
981
|
+
l(), o();
|
965
982
|
};
|
966
|
-
return
|
983
|
+
return Qt(u), {
|
967
984
|
isSupported: a,
|
968
985
|
stop: u,
|
969
986
|
takeRecords: f
|
970
987
|
};
|
971
988
|
}
|
972
|
-
function
|
989
|
+
function un(s = null, e = {}) {
|
973
990
|
var t, n, r;
|
974
991
|
const {
|
975
|
-
document:
|
992
|
+
document: i = rn,
|
976
993
|
restoreOnUnmount: a = (u) => u
|
977
|
-
} = e,
|
994
|
+
} = e, o = (t = i?.title) != null ? t : "", c = tn((n = s ?? i?.title) != null ? n : null), l = s && typeof s == "function";
|
978
995
|
function f(u) {
|
979
996
|
if (!("titleTemplate" in e))
|
980
997
|
return u;
|
981
998
|
const d = e.titleTemplate || "%s";
|
982
|
-
return typeof d == "function" ? d(u) :
|
999
|
+
return typeof d == "function" ? d(u) : ne(d).replace(/%s/g, u);
|
983
1000
|
}
|
984
|
-
return
|
1001
|
+
return ve(
|
985
1002
|
c,
|
986
1003
|
(u, d) => {
|
987
|
-
u !== d &&
|
1004
|
+
u !== d && i && (i.title = f(typeof u == "string" ? u : ""));
|
988
1005
|
},
|
989
1006
|
{ immediate: !0 }
|
990
|
-
), e.observe && !e.titleTemplate &&
|
991
|
-
(r =
|
1007
|
+
), e.observe && !e.titleTemplate && i && !l && ln(
|
1008
|
+
(r = i.head) == null ? void 0 : r.querySelector("title"),
|
992
1009
|
() => {
|
993
|
-
|
1010
|
+
i && i.title !== c.value && (c.value = f(i.title));
|
994
1011
|
},
|
995
1012
|
{ childList: !0 }
|
996
|
-
),
|
1013
|
+
), nn(() => {
|
997
1014
|
if (a) {
|
998
|
-
const u = a(
|
999
|
-
u != null &&
|
1015
|
+
const u = a(o, c.value || "");
|
1016
|
+
u != null && i && (i.title = u);
|
1000
1017
|
}
|
1001
1018
|
}), c;
|
1002
1019
|
}
|
1003
|
-
const
|
1020
|
+
const ue = Z({
|
1004
1021
|
name: "VtjPageContainer",
|
1005
1022
|
async setup() {
|
1006
|
-
const s =
|
1007
|
-
return n && (Object.assign(e.meta, n.meta || {}, { cache: n.cache }),
|
1023
|
+
const s = xe(), e = _e(), t = e.params.id, n = t ? s.getPage(t) : s.getHomepage(), r = n ? await s.getRenderComponent(n.id) : null, i = T(Symbol());
|
1024
|
+
return n && (Object.assign(e.meta, n.meta || {}, { cache: n.cache }), un(n.title || "VTJ")), {
|
1008
1025
|
provider: s,
|
1009
1026
|
component: r,
|
1010
1027
|
file: n,
|
1011
1028
|
query: e.query,
|
1012
1029
|
meta: e.meta,
|
1013
|
-
sid:
|
1030
|
+
sid: i,
|
1014
1031
|
route: e
|
1015
1032
|
};
|
1016
1033
|
},
|
1017
1034
|
render() {
|
1018
1035
|
const { component: s, query: e, sid: t } = this;
|
1019
|
-
return s ?
|
1036
|
+
return s ? W(s, { ...e, key: t }) : W("div", "页面不存在");
|
1020
1037
|
},
|
1021
1038
|
activated() {
|
1022
1039
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1023
1040
|
}
|
1024
|
-
}),
|
1041
|
+
}), dn = {
|
1025
1042
|
"data-l-h6o7ki7": "",
|
1026
1043
|
class: "vtj-startup__wrapper"
|
1027
|
-
},
|
1044
|
+
}, pn = {
|
1028
1045
|
"data-l-h6o7ki7": "",
|
1029
1046
|
class: "vtj-startup"
|
1030
|
-
},
|
1047
|
+
}, fn = {
|
1031
1048
|
"data-l-h6o7ki7": "",
|
1032
1049
|
class: "vtj-startup__name"
|
1033
|
-
},
|
1050
|
+
}, hn = { "data-l-h6o7ki7": "" }, mn = {
|
1034
1051
|
"data-l-h6o7ki7": "",
|
1035
1052
|
class: "vtj-startup__tagline"
|
1036
|
-
},
|
1053
|
+
}, gn = {
|
1037
1054
|
"data-l-h6o7ki7": "",
|
1038
1055
|
class: "vtj-startup__actions"
|
1039
|
-
},
|
1056
|
+
}, vn = /* @__PURE__ */ Z({
|
1040
1057
|
__name: "Startup",
|
1041
1058
|
props: {
|
1042
1059
|
name: { default: "VTJ.PRO" },
|
@@ -1045,9 +1062,9 @@ const le = X({
|
|
1045
1062
|
link: {}
|
1046
1063
|
},
|
1047
1064
|
setup(s) {
|
1048
|
-
((r,
|
1065
|
+
((r, i) => {
|
1049
1066
|
let a = document.getElementById("h6o7ki7");
|
1050
|
-
a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML =
|
1067
|
+
a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML = i);
|
1051
1068
|
})("h6o7ki7", `
|
1052
1069
|
.vtj-startup[data-l-h6o7ki7]{
|
1053
1070
|
padding: 20px;
|
@@ -1132,43 +1149,43 @@ const le = X({
|
|
1132
1149
|
typeof t.link == "function" ? t.link() : window.location.href = t.link;
|
1133
1150
|
return;
|
1134
1151
|
}
|
1135
|
-
let
|
1136
|
-
window.location.href =
|
1152
|
+
let i = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "__vtj__/#/";
|
1153
|
+
window.location.href = i;
|
1137
1154
|
}
|
1138
1155
|
};
|
1139
|
-
return (r,
|
1140
|
-
E("div",
|
1141
|
-
E("h1",
|
1142
|
-
E("span",
|
1156
|
+
return (r, i) => (Ze(), et("div", dn, [
|
1157
|
+
E("div", pn, [
|
1158
|
+
E("h1", fn, [
|
1159
|
+
E("span", hn, J(t.name), 1)
|
1143
1160
|
]),
|
1144
|
-
E("div",
|
1145
|
-
E("div",
|
1146
|
-
|
1161
|
+
E("div", mn, J(t.tagline), 1),
|
1162
|
+
E("div", gn, [
|
1163
|
+
i[0] || (i[0] = E("span", { "data-l-h6o7ki7": "" }, "设置项目主页后,将替换此页面显示", -1)),
|
1147
1164
|
E("button", {
|
1148
1165
|
"data-l-h6o7ki7": "",
|
1149
1166
|
onClick: n
|
1150
|
-
},
|
1167
|
+
}, J(t.actionText), 1)
|
1151
1168
|
])
|
1152
1169
|
])
|
1153
1170
|
]));
|
1154
1171
|
}
|
1155
|
-
}),
|
1172
|
+
}), yn = Z({
|
1156
1173
|
name: "VtjStartupContainer",
|
1157
1174
|
render() {
|
1158
|
-
return
|
1175
|
+
return W(vn);
|
1159
1176
|
}
|
1160
|
-
}),
|
1161
|
-
var
|
1162
|
-
class
|
1177
|
+
}), Re = Symbol("Provider");
|
1178
|
+
var _n = /* @__PURE__ */ ((s) => (s.Production = "production", s.Development = "development", s))(_n || {});
|
1179
|
+
class wn extends Ie {
|
1163
1180
|
constructor(e) {
|
1164
1181
|
super(), this.options = e;
|
1165
1182
|
const {
|
1166
1183
|
service: t,
|
1167
1184
|
mode: n = y.Raw,
|
1168
1185
|
dependencies: r,
|
1169
|
-
materials:
|
1186
|
+
materials: i,
|
1170
1187
|
project: a = {},
|
1171
|
-
adapter:
|
1188
|
+
adapter: o = {},
|
1172
1189
|
globals: c = {},
|
1173
1190
|
modules: l = {},
|
1174
1191
|
router: f = null,
|
@@ -1176,7 +1193,7 @@ class _n extends Ae {
|
|
1176
1193
|
nodeEnv: d = "development"
|
1177
1194
|
/* Development */
|
1178
1195
|
} = e;
|
1179
|
-
this.mode = n, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = d, r && (this.dependencies = r),
|
1196
|
+
this.mode = n, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = d, r && (this.dependencies = r), i && (this.materials = i), Object.assign(this.globals, c), Object.assign(this.adapter, o);
|
1180
1197
|
const { access: h, request: m } = this.adapter;
|
1181
1198
|
h && h.connect({ mode: n, router: f, request: m }), a && n !== y.Design ? this.load(a) : this.project = a, k.setup({
|
1182
1199
|
timeout: "50-500"
|
@@ -1185,7 +1202,7 @@ class _n extends Ae {
|
|
1185
1202
|
mode;
|
1186
1203
|
globals = {};
|
1187
1204
|
modules = {};
|
1188
|
-
adapter = { request:
|
1205
|
+
adapter = { request: K, jsonp: he };
|
1189
1206
|
apis = {};
|
1190
1207
|
dependencies = {};
|
1191
1208
|
materials = {};
|
@@ -1204,7 +1221,7 @@ class _n extends Ae {
|
|
1204
1221
|
try {
|
1205
1222
|
n = await e.apply(e, t);
|
1206
1223
|
} catch (r) {
|
1207
|
-
|
1224
|
+
P.warn("模拟数据模版异常", r);
|
1208
1225
|
}
|
1209
1226
|
return k.mock(n);
|
1210
1227
|
};
|
@@ -1213,8 +1230,8 @@ class _n extends Ae {
|
|
1213
1230
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1214
1231
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1215
1232
|
throw new Error("project is null");
|
1216
|
-
const { apis: n = [], meta: r = [] } = this.project,
|
1217
|
-
|
1233
|
+
const { apis: n = [], meta: r = [] } = this.project, i = window;
|
1234
|
+
i.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.apis = St(n, r, this.adapter), je(), bt(n), this.initRouter(), this.triggerReady();
|
1218
1235
|
}
|
1219
1236
|
async loadDependencies(e) {
|
1220
1237
|
const t = Object.entries(this.dependencies);
|
@@ -1222,16 +1239,16 @@ class _n extends Ae {
|
|
1222
1239
|
e[n] || (e[n] = this.library[n] = await r());
|
1223
1240
|
}
|
1224
1241
|
async loadAssets(e) {
|
1225
|
-
const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components:
|
1242
|
+
const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components: i, materialPath: a, nodeEnv: o } = this, {
|
1226
1243
|
libraryExports: c,
|
1227
1244
|
libraryMap: l,
|
1228
1245
|
materials: f,
|
1229
1246
|
materialExports: u,
|
1230
1247
|
materialMapLibrary: d
|
1231
|
-
} =
|
1248
|
+
} = ct(
|
1232
1249
|
t,
|
1233
1250
|
a,
|
1234
|
-
|
1251
|
+
o === "development"
|
1235
1252
|
/* Development */
|
1236
1253
|
);
|
1237
1254
|
for (const h of c) {
|
@@ -1243,24 +1260,24 @@ class _n extends Ae {
|
|
1243
1260
|
else {
|
1244
1261
|
const w = l[h] || [];
|
1245
1262
|
for (const g of w)
|
1246
|
-
|
1263
|
+
ee(g) && await ut(h, x.append(g, { v: C })), te(g) && await ae(x.append(g, { v: C }));
|
1247
1264
|
r[h] = e[h];
|
1248
1265
|
}
|
1249
1266
|
}
|
1250
|
-
if (
|
1267
|
+
if (o === "development") {
|
1251
1268
|
for (const m of f)
|
1252
|
-
await
|
1269
|
+
await ae(x.append(m, { v: C }));
|
1253
1270
|
const h = this.materials || {};
|
1254
1271
|
for (const m of u) {
|
1255
|
-
const p = e[d[m]], w =
|
1272
|
+
const p = e[d[m]], w = Me[m];
|
1256
1273
|
if (w)
|
1257
1274
|
p && w.forEach((g) => {
|
1258
|
-
|
1275
|
+
i[g] = p[g];
|
1259
1276
|
});
|
1260
1277
|
else {
|
1261
1278
|
const g = h[m] ? (await h[m]()).default : e[m];
|
1262
1279
|
g && p && (g.components || []).forEach((S) => {
|
1263
|
-
|
1280
|
+
i[S.name] = lt(S, p);
|
1264
1281
|
});
|
1265
1282
|
}
|
1266
1283
|
}
|
@@ -1269,30 +1286,30 @@ class _n extends Ae {
|
|
1269
1286
|
initRouter() {
|
1270
1287
|
const { router: e, project: t, options: n, adapter: r } = this;
|
1271
1288
|
if (!e) return;
|
1272
|
-
const { routeAppendTo:
|
1289
|
+
const { routeAppendTo: i, pageRouteName: a = "page", routeMeta: o } = n, c = i ? "" : "/", l = {
|
1273
1290
|
path: `${c}${a}/:id`,
|
1274
|
-
name:
|
1275
|
-
component:
|
1291
|
+
name: F,
|
1292
|
+
component: ue
|
1276
1293
|
}, f = {
|
1277
1294
|
path: c,
|
1278
|
-
name:
|
1279
|
-
component: t?.homepage ?
|
1280
|
-
meta:
|
1295
|
+
name: H,
|
1296
|
+
component: t?.homepage ? ue : r.startupComponent || yn,
|
1297
|
+
meta: o
|
1281
1298
|
};
|
1282
|
-
e.hasRoute(
|
1299
|
+
e.hasRoute(F) && e.removeRoute(F), e.hasRoute(H) && e.removeRoute(H), i ? (e.addRoute(i, l), e.addRoute(i, f)) : (e.addRoute(l), e.addRoute(f));
|
1283
1300
|
}
|
1284
1301
|
install(e) {
|
1285
1302
|
const t = e.config.globalProperties.installed || {};
|
1286
1303
|
for (const [n, r] of Object.entries(this.library))
|
1287
|
-
!t[n] &&
|
1288
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1289
|
-
const a = r?.$options.name,
|
1304
|
+
!t[n] && ft(r) && (e.use(r), t[n] = !0);
|
1305
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Re, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (n, r, i) => {
|
1306
|
+
const a = r?.$options.name, o = typeof n == "string" ? n : n?.message || n?.msg || "未知错误", c = `[ ${a} ] ${o} ${i}`;
|
1290
1307
|
console.error(
|
1291
1308
|
"[VTJ Error]:",
|
1292
1309
|
{
|
1293
1310
|
err: n,
|
1294
1311
|
instance: r,
|
1295
|
-
info:
|
1312
|
+
info: i
|
1296
1313
|
},
|
1297
1314
|
n?.stack
|
1298
1315
|
), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
|
@@ -1303,14 +1320,14 @@ class _n extends Ae {
|
|
1303
1320
|
return this.getPage(e) || t.find((n) => n.id === e) || null;
|
1304
1321
|
}
|
1305
1322
|
getPage(e) {
|
1306
|
-
const { pages: t = [] } = this.project || {}, n = (r,
|
1307
|
-
for (const a of
|
1323
|
+
const { pages: t = [] } = this.project || {}, n = (r, i = []) => {
|
1324
|
+
for (const a of i) {
|
1308
1325
|
if (a.id === r)
|
1309
1326
|
return a;
|
1310
1327
|
if (a.children && a.children.length) {
|
1311
|
-
const
|
1312
|
-
if (
|
1313
|
-
return
|
1328
|
+
const o = n(r, a.children);
|
1329
|
+
if (o)
|
1330
|
+
return o;
|
1314
1331
|
}
|
1315
1332
|
}
|
1316
1333
|
};
|
@@ -1336,21 +1353,21 @@ class _n extends Ae {
|
|
1336
1353
|
}).then((n) => n.data).catch(() => null));
|
1337
1354
|
}
|
1338
1355
|
createDslRenderer(e, t = {}) {
|
1339
|
-
const { library: n, components: r, mode:
|
1340
|
-
mode:
|
1356
|
+
const { library: n, components: r, mode: i, apis: a } = this, o = {
|
1357
|
+
mode: i,
|
1341
1358
|
Vue: n.Vue,
|
1342
1359
|
components: r,
|
1343
1360
|
libs: n,
|
1344
1361
|
apis: a,
|
1345
1362
|
window,
|
1346
1363
|
...t
|
1347
|
-
}, c =
|
1364
|
+
}, c = Q({
|
1348
1365
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1349
1366
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1350
|
-
options:
|
1367
|
+
options: o
|
1351
1368
|
});
|
1352
|
-
return
|
1353
|
-
...
|
1369
|
+
return Y({
|
1370
|
+
...o,
|
1354
1371
|
dsl: e,
|
1355
1372
|
loader: c
|
1356
1373
|
});
|
@@ -1358,33 +1375,33 @@ class _n extends Ae {
|
|
1358
1375
|
async getRenderComponent(e, t) {
|
1359
1376
|
const n = this.getFile(e);
|
1360
1377
|
if (!n)
|
1361
|
-
return
|
1378
|
+
return P.warn(`Can not find file: ${e}`), null;
|
1362
1379
|
t && t(n);
|
1363
|
-
const r = `.vtj/vue/${e}.vue`,
|
1364
|
-
if (
|
1365
|
-
return (await
|
1380
|
+
const r = `.vtj/vue/${e}.vue`, i = this.modules[r];
|
1381
|
+
if (i)
|
1382
|
+
return (await i())?.default;
|
1366
1383
|
const a = await this.getDsl(n.id);
|
1367
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1384
|
+
return a ? this.createDslRenderer(a).renderer : (P.warn(`Can not find dsl: ${e}`), null);
|
1368
1385
|
}
|
1369
1386
|
defineUrlSchemaComponent(e, t) {
|
1370
|
-
return
|
1387
|
+
return ce(async () => {
|
1371
1388
|
const n = await this.getDslByUrl(e);
|
1372
1389
|
return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
|
1373
1390
|
});
|
1374
1391
|
}
|
1375
1392
|
definePluginComponent(e) {
|
1376
|
-
return
|
1393
|
+
return ce(async () => await $e(e, window));
|
1377
1394
|
}
|
1378
1395
|
}
|
1379
|
-
function
|
1380
|
-
const e = new
|
1396
|
+
function Mn(s) {
|
1397
|
+
const e = new wn(s);
|
1381
1398
|
return {
|
1382
1399
|
provider: e,
|
1383
1400
|
onReady: (n) => e.ready(n)
|
1384
1401
|
};
|
1385
1402
|
}
|
1386
|
-
function
|
1387
|
-
const e =
|
1403
|
+
function xe(s = {}) {
|
1404
|
+
const e = me(Re);
|
1388
1405
|
if (!e)
|
1389
1406
|
throw new Error("Can not find provider");
|
1390
1407
|
if (e.nodeEnv === "development") {
|
@@ -1400,13 +1417,13 @@ function Re(s = {}) {
|
|
1400
1417
|
}
|
1401
1418
|
return e;
|
1402
1419
|
}
|
1403
|
-
const
|
1420
|
+
const Pe = {
|
1404
1421
|
type: "json",
|
1405
1422
|
validSuccess: !0,
|
1406
1423
|
originResponse: !1,
|
1407
1424
|
failMessage: !0,
|
1408
1425
|
validate: (s) => s.data?.code === 0
|
1409
|
-
},
|
1426
|
+
}, Sn = (s, e = "/__vtj__/api/:type.json") => (t, n) => s.send({
|
1410
1427
|
url: e,
|
1411
1428
|
method: "post",
|
1412
1429
|
params: { type: t },
|
@@ -1414,8 +1431,8 @@ const xe = {
|
|
1414
1431
|
type: t,
|
1415
1432
|
data: n
|
1416
1433
|
},
|
1417
|
-
settings:
|
1418
|
-
}),
|
1434
|
+
settings: Pe
|
1435
|
+
}), bn = (s, e = "/__vtj__/api/uploader.json") => async (t, n) => await s.send({
|
1419
1436
|
url: e,
|
1420
1437
|
method: "post",
|
1421
1438
|
data: {
|
@@ -1423,12 +1440,12 @@ const xe = {
|
|
1423
1440
|
projectId: n
|
1424
1441
|
},
|
1425
1442
|
settings: {
|
1426
|
-
...
|
1443
|
+
...Pe,
|
1427
1444
|
type: "data"
|
1428
1445
|
}
|
1429
1446
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1430
|
-
function
|
1431
|
-
return
|
1447
|
+
function Dn(s) {
|
1448
|
+
return fe({
|
1432
1449
|
settings: {
|
1433
1450
|
type: "json",
|
1434
1451
|
validSuccess: !0,
|
@@ -1441,12 +1458,12 @@ function Mn(s) {
|
|
1441
1458
|
}
|
1442
1459
|
});
|
1443
1460
|
}
|
1444
|
-
class
|
1461
|
+
class se {
|
1445
1462
|
api;
|
1446
1463
|
pluginCaches = {};
|
1447
1464
|
uploader;
|
1448
|
-
constructor(e =
|
1449
|
-
this.api =
|
1465
|
+
constructor(e = K) {
|
1466
|
+
this.api = Sn(e), this.uploader = bn(e);
|
1450
1467
|
}
|
1451
1468
|
async getExtension() {
|
1452
1469
|
console.log("BaseService.getExtension");
|
@@ -1519,38 +1536,38 @@ class ne {
|
|
1519
1536
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1520
1537
|
}
|
1521
1538
|
async getPluginMaterial(e) {
|
1522
|
-
const { urls: t = [] } = e, n = t.filter((
|
1539
|
+
const { urls: t = [] } = e, n = t.filter((i) => ot(i))[0];
|
1523
1540
|
if (!n) return null;
|
1524
1541
|
const r = this.pluginCaches[n];
|
1525
|
-
return r || (this.pluginCaches[n] =
|
1542
|
+
return r || (this.pluginCaches[n] = K.send({
|
1526
1543
|
url: n,
|
1527
1544
|
method: "get",
|
1528
1545
|
settings: {
|
1529
1546
|
validSuccess: !1,
|
1530
1547
|
originResponse: !0
|
1531
1548
|
}
|
1532
|
-
}).then((
|
1549
|
+
}).then((i) => i.data).catch(() => null));
|
1533
1550
|
}
|
1534
1551
|
async genSource(e) {
|
1535
1552
|
return console.log("BaseService.genSource", e), "";
|
1536
1553
|
}
|
1537
1554
|
}
|
1538
|
-
const v = new
|
1555
|
+
const v = new Je({
|
1539
1556
|
type: "local",
|
1540
1557
|
expired: 0,
|
1541
1558
|
prefix: "__VTJ_"
|
1542
1559
|
});
|
1543
|
-
class
|
1560
|
+
class Hn extends se {
|
1544
1561
|
init(e) {
|
1545
|
-
const t = new
|
1562
|
+
const t = new O(e), n = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), n || {});
|
1546
1563
|
return v.save(`project_${t.id}`, r), Promise.resolve(r);
|
1547
1564
|
}
|
1548
1565
|
saveProject(e) {
|
1549
|
-
const t = new
|
1566
|
+
const t = new O(e);
|
1550
1567
|
return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1551
1568
|
}
|
1552
1569
|
saveMaterials(e, t) {
|
1553
|
-
return v.save(`materials_${e.id}`,
|
1570
|
+
return v.save(`materials_${e.id}`, X(t)), Promise.resolve(!0);
|
1554
1571
|
}
|
1555
1572
|
saveFile(e) {
|
1556
1573
|
return v.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -1568,13 +1585,13 @@ class Dn extends ne {
|
|
1568
1585
|
removeHistory(e) {
|
1569
1586
|
const t = v.get(`history_${e}`);
|
1570
1587
|
if (t) {
|
1571
|
-
const r = (t.items || []).map((
|
1588
|
+
const r = (t.items || []).map((i) => i.id);
|
1572
1589
|
this.removeHistoryItem(e, r), v.remove(`history_${e}`);
|
1573
1590
|
}
|
1574
1591
|
return Promise.resolve(!0);
|
1575
1592
|
}
|
1576
1593
|
getHistory(e) {
|
1577
|
-
const t = v.get(`history_${e}`), n = new
|
1594
|
+
const t = v.get(`history_${e}`), n = new de(t || { id: e });
|
1578
1595
|
return Promise.resolve(n.toDsl());
|
1579
1596
|
}
|
1580
1597
|
getHistoryItem(e, t) {
|
@@ -1590,22 +1607,22 @@ class Dn extends ne {
|
|
1590
1607
|
}), Promise.resolve(!0);
|
1591
1608
|
}
|
1592
1609
|
}
|
1593
|
-
class
|
1610
|
+
class jn extends se {
|
1594
1611
|
projects = {};
|
1595
1612
|
materials = {};
|
1596
1613
|
files = {};
|
1597
1614
|
histories = {};
|
1598
1615
|
historyItems = {};
|
1599
1616
|
init(e) {
|
1600
|
-
const t = new
|
1617
|
+
const t = new O(e), n = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), n);
|
1601
1618
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1602
1619
|
}
|
1603
1620
|
saveProject(e) {
|
1604
|
-
const t = new
|
1621
|
+
const t = new O(e);
|
1605
1622
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1606
1623
|
}
|
1607
1624
|
saveMaterials(e, t) {
|
1608
|
-
return e.id && (this.materials[e.id] =
|
1625
|
+
return e.id && (this.materials[e.id] = X(t)), Promise.resolve(!0);
|
1609
1626
|
}
|
1610
1627
|
saveFile(e) {
|
1611
1628
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1623,13 +1640,13 @@ class bn extends ne {
|
|
1623
1640
|
removeHistory(e) {
|
1624
1641
|
const t = this.histories[e];
|
1625
1642
|
if (t) {
|
1626
|
-
const r = (t.items || []).map((
|
1643
|
+
const r = (t.items || []).map((i) => i.id);
|
1627
1644
|
this.removeHistoryItem(e, r), delete this.historyItems[e];
|
1628
1645
|
}
|
1629
1646
|
return Promise.resolve(!0);
|
1630
1647
|
}
|
1631
1648
|
getHistory(e) {
|
1632
|
-
const t = this.histories[e], n = new
|
1649
|
+
const t = this.histories[e], n = new de(t || { id: e });
|
1633
1650
|
return Promise.resolve(n);
|
1634
1651
|
}
|
1635
1652
|
getHistoryItem(e, t) {
|
@@ -1647,11 +1664,11 @@ class bn extends ne {
|
|
1647
1664
|
}), Promise.resolve(!0);
|
1648
1665
|
}
|
1649
1666
|
}
|
1650
|
-
let
|
1651
|
-
function
|
1652
|
-
return
|
1667
|
+
let D = null;
|
1668
|
+
function On() {
|
1669
|
+
return D || (D = new jn(), D);
|
1653
1670
|
}
|
1654
|
-
class
|
1671
|
+
class Bn extends se {
|
1655
1672
|
getFileCaches = {};
|
1656
1673
|
async getExtension() {
|
1657
1674
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1666,7 +1683,7 @@ class On extends ne {
|
|
1666
1683
|
async saveMaterials(e, t) {
|
1667
1684
|
return !!await this.api("saveMaterials", {
|
1668
1685
|
project: e,
|
1669
|
-
materials:
|
1686
|
+
materials: X(t)
|
1670
1687
|
}).catch(() => !1);
|
1671
1688
|
}
|
1672
1689
|
async saveFile(e) {
|
@@ -1706,125 +1723,125 @@ class On extends ne {
|
|
1706
1723
|
);
|
1707
1724
|
}
|
1708
1725
|
}
|
1709
|
-
function
|
1726
|
+
function Ce(s, e, t = []) {
|
1710
1727
|
return t.map((n) => {
|
1711
|
-
const { id: r, title:
|
1728
|
+
const { id: r, title: i, icon: a, children: o, hidden: c } = n;
|
1712
1729
|
return {
|
1713
1730
|
id: r,
|
1714
|
-
title:
|
1731
|
+
title: i,
|
1715
1732
|
icon: a,
|
1716
1733
|
hidden: c,
|
1717
1734
|
url: `${s}/${e}/${r}`,
|
1718
|
-
children:
|
1735
|
+
children: o && o.length ? Ce(s, e, o) : void 0
|
1719
1736
|
};
|
1720
1737
|
});
|
1721
1738
|
}
|
1722
|
-
function
|
1739
|
+
function Fe(s, e) {
|
1723
1740
|
if (!e) return s;
|
1724
1741
|
let t = [];
|
1725
1742
|
for (const n of s)
|
1726
1743
|
if (n.children && n.children.length) {
|
1727
|
-
const r =
|
1744
|
+
const r = Fe(n.children, e);
|
1728
1745
|
r.length && (n.children = r, t.push(n));
|
1729
1746
|
} else
|
1730
1747
|
e.can(n.id.toString()) && t.push(n);
|
1731
1748
|
return t;
|
1732
1749
|
}
|
1733
|
-
function
|
1750
|
+
function Nn(s) {
|
1734
1751
|
const {
|
1735
1752
|
menuPathPrefix: e = "",
|
1736
1753
|
pageRouteName: t = "page",
|
1737
1754
|
disableMenusFilter: n = !1
|
1738
|
-
} = s || {}, r =
|
1739
|
-
|
1740
|
-
const { name: d, params: h, meta: m } =
|
1741
|
-
if (d ===
|
1755
|
+
} = s || {}, r = xe(), i = _e(), a = yt(), o = T(!1), c = T(!1), l = r.project;
|
1756
|
+
tt(() => {
|
1757
|
+
const { name: d, params: h, meta: m } = i;
|
1758
|
+
if (d === F) {
|
1742
1759
|
const p = r.getPage(h.id);
|
1743
|
-
|
1744
|
-
} else if (d ===
|
1760
|
+
o.value = !p?.mask, c.value = !!p?.pure;
|
1761
|
+
} else if (d === H) {
|
1745
1762
|
const p = r.getHomepage();
|
1746
|
-
|
1763
|
+
o.value = !p?.mask, c.value = !!p?.pure;
|
1747
1764
|
} else
|
1748
|
-
|
1765
|
+
o.value = !m.mask, c.value = !!m.pure;
|
1749
1766
|
});
|
1750
|
-
const f =
|
1767
|
+
const f = Ce(
|
1751
1768
|
e,
|
1752
1769
|
t,
|
1753
1770
|
l?.pages
|
1754
1771
|
), u = l?.config;
|
1755
1772
|
return {
|
1756
|
-
disabled:
|
1773
|
+
disabled: o,
|
1757
1774
|
logo: u?.logo,
|
1758
1775
|
themeSwitchable: u?.themeSwitchable,
|
1759
1776
|
title: u?.title || l?.description || l?.name || "VTJ App",
|
1760
|
-
menus: n ? f :
|
1777
|
+
menus: n ? f : Fe(f, a),
|
1761
1778
|
pure: c
|
1762
1779
|
};
|
1763
1780
|
}
|
1764
1781
|
export {
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1782
|
+
be as ACCESS_KEY,
|
1783
|
+
An as Access,
|
1784
|
+
it as BUILD_IN_TAGS,
|
1785
|
+
nt as BUILT_IN_DIRECTIVES,
|
1786
|
+
se as BaseService,
|
1787
|
+
le as CONTEXT_HOST,
|
1788
|
+
Et as Context,
|
1772
1789
|
y as ContextMode,
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1790
|
+
st as DATA_TYPES,
|
1791
|
+
H as HOMEPAGE_ROUTE_NAME,
|
1792
|
+
rt as HTML_TAGS,
|
1793
|
+
Tn as JSCodeToString,
|
1794
|
+
Pn as LIFE_CYCLES_LIST,
|
1795
|
+
Bn as LocalService,
|
1796
|
+
jn as MemoryService,
|
1797
|
+
_n as NodeEnv,
|
1798
|
+
F as PAGE_ROUTE_NAME,
|
1799
|
+
wn as Provider,
|
1800
|
+
vn as Startup,
|
1801
|
+
Hn as StorageService,
|
1802
|
+
C as VTJ_RENDERER_VERSION,
|
1803
|
+
Se as adoptedStyleSheets,
|
1804
|
+
In as createAdapter,
|
1805
|
+
Cn as createAssetScripts,
|
1806
|
+
Fn as createAssetsCss,
|
1807
|
+
Tt as createDataSources,
|
1808
|
+
Q as createLoader,
|
1809
|
+
On as createMemoryService,
|
1810
|
+
wt as createMetaApi,
|
1811
|
+
jt as createMock,
|
1812
|
+
Mn as createProvider,
|
1813
|
+
Y as createRenderer,
|
1814
|
+
_t as createSchemaApi,
|
1815
|
+
St as createSchemaApis,
|
1816
|
+
Dn as createServiceRequest,
|
1817
|
+
Mt as defaultLoader,
|
1818
|
+
M as fillBasePath,
|
1819
|
+
Ee as getModifiers,
|
1820
|
+
$e as getPlugin,
|
1821
|
+
lt as getRawComponent,
|
1822
|
+
ht as isBuiltInTag,
|
1823
|
+
ee as isCSSUrl,
|
1824
|
+
gt as isJSCode,
|
1808
1825
|
_ as isJSExpression,
|
1809
|
-
|
1826
|
+
I as isJSFunction,
|
1810
1827
|
ot as isJSON,
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1828
|
+
te as isJSUrl,
|
1829
|
+
mt as isNativeTag,
|
1830
|
+
ft as isVuePlugin,
|
1831
|
+
ut as loadCss,
|
1832
|
+
dt as loadCssUrl,
|
1833
|
+
pt as loadScriptUrl,
|
1834
|
+
$t as mockApi,
|
1835
|
+
bt as mockApis,
|
1836
|
+
je as mockCleanup,
|
1837
|
+
B as nodeRender,
|
1838
|
+
ct as parseDeps,
|
1839
|
+
A as parseExpression,
|
1840
|
+
G as parseFunction,
|
1841
|
+
Re as providerKey,
|
1842
|
+
at as removeProdFlag,
|
1843
|
+
we as toString,
|
1844
|
+
yt as useAccess,
|
1845
|
+
Nn as useMask,
|
1846
|
+
xe as useProvider
|
1830
1847
|
};
|