@vtj/renderer 0.8.170 → 0.8.171
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 -258
- package/package.json +5 -5
- package/types/constants.d.ts +8 -0
- package/types/plugins/access.d.ts +4 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
3
|
-
import * as
|
|
4
|
-
import { inject as
|
|
5
|
-
import { useRoute as
|
|
1
|
+
import { Base as Ee, BUILT_IN_COMPONENTS as Pe, ProjectModel as I, HistoryModel as re } from "@vtj/core";
|
|
2
|
+
import { isUrl as Re, url as R, dedupArray as be, isString as $, isFunction as Y, logger as O, createRequest as Ce, merge as Fe, pathToRegexp as Ae, pathToRegexpMatch as Ie, formDataToJson as Oe, storage as T, cookie as k, toArray as Q, unRSA as X, delay as oe, camelCase as j, upperFirst as xe, pick as De, jsonp as He, loadScript as Z, Request as Me, Storage as Te, mapToObject as q } from "@vtj/utils";
|
|
3
|
+
import * as D from "vue";
|
|
4
|
+
import { inject as ie, toRef as ke, readonly as Ue, customRef as Be, ref as J, onBeforeUnmount as Ne, getCurrentScope as Le, onScopeDispose as qe, unref as Je, getCurrentInstance as ae, watch as ce, computed as ue, onMounted as Ve, defineComponent as le, h as B, defineAsyncComponent as ee, watchEffect as ze } from "vue";
|
|
5
|
+
import { useRoute as fe } from "vue-router";
|
|
6
6
|
import { ElNotification as H, ElLoading as Ke } from "element-plus";
|
|
7
7
|
import { XStartup as We } from "@vtj/ui";
|
|
8
8
|
/**!
|
|
9
9
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
10
10
|
* @name @vtj/renderer
|
|
11
11
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
12
|
-
* @version 0.8.
|
|
12
|
+
* @version 0.8.171
|
|
13
13
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
15
|
+
const b = "0.8.171";
|
|
16
16
|
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
|
17
|
-
const
|
|
17
|
+
const te = [
|
|
18
18
|
"$el",
|
|
19
19
|
"$emit",
|
|
20
20
|
"$nextTick",
|
|
@@ -26,7 +26,7 @@ const ee = [
|
|
|
26
26
|
"$props",
|
|
27
27
|
"$options",
|
|
28
28
|
"$forceUpdate"
|
|
29
|
-
],
|
|
29
|
+
], ls = [
|
|
30
30
|
"beforeCreate",
|
|
31
31
|
"created",
|
|
32
32
|
"beforeMount",
|
|
@@ -48,9 +48,9 @@ const ee = [
|
|
|
48
48
|
Object,
|
|
49
49
|
Function,
|
|
50
50
|
Date
|
|
51
|
-
};
|
|
51
|
+
}, de = "VtjPage", Qe = "VtjHomepage";
|
|
52
52
|
function F(n, e) {
|
|
53
|
-
return n.map((t) =>
|
|
53
|
+
return n.map((t) => Re(t) || t.startsWith("/") ? t : `${e}${t}`);
|
|
54
54
|
}
|
|
55
55
|
function V(n) {
|
|
56
56
|
return /\.css$/.test(n);
|
|
@@ -58,28 +58,28 @@ function V(n) {
|
|
|
58
58
|
function z(n) {
|
|
59
59
|
return /\.js$/.test(n);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function Xe(n) {
|
|
62
62
|
return /\.json$/.test(n);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function fs(n) {
|
|
65
65
|
return n.map(
|
|
66
|
-
(e) => `<script src="${
|
|
66
|
+
(e) => `<script src="${R.append(e, { v: b })}"><\/script>`
|
|
67
67
|
).join("");
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function ds(n = []) {
|
|
70
70
|
return n.map(
|
|
71
|
-
(e) => `<link rel="stylesheet" href="${
|
|
71
|
+
(e) => `<link rel="stylesheet" href="${R.append(e, { v: b })}" />`
|
|
72
72
|
).join("");
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function Ze(n, e = !1) {
|
|
75
75
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function et(n, e, t = !1) {
|
|
78
78
|
const s = n.filter((f) => !!f.enabled), r = [], o = [], a = [], i = [], u = {}, c = {}, p = [], l = {};
|
|
79
79
|
return s.forEach(
|
|
80
80
|
({ urls: f, assetsUrl: m, library: d, assetsLibrary: h, localeLibrary: w }) => {
|
|
81
81
|
f?.forEach((v) => {
|
|
82
|
-
z(v) && r.push(
|
|
82
|
+
z(v) && r.push(Ze(v, t)), V(v) && o.push(v);
|
|
83
83
|
}), d && (i.push(d), u[d] = F(f || [], e), w && (c[d] = w)), m && a.push(m), h && p.push(h), d && h && (l[h] = d);
|
|
84
84
|
}
|
|
85
85
|
), {
|
|
@@ -87,20 +87,20 @@ function Ze(n, e, t = !1) {
|
|
|
87
87
|
css: F(o, e),
|
|
88
88
|
materials: F(a, e),
|
|
89
89
|
libraryExports: i,
|
|
90
|
-
materialExports:
|
|
90
|
+
materialExports: be(p),
|
|
91
91
|
materialMapLibrary: l,
|
|
92
92
|
libraryMap: u,
|
|
93
93
|
libraryLocaleMap: c
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function tt(n, e) {
|
|
97
97
|
const { name: t, parent: s, alias: r } = n;
|
|
98
98
|
return s ? e[s]?.[r || t] : e[r || t];
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function pe(n) {
|
|
101
101
|
return $(n) ? n : JSON.stringify(n);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function he(n, e, t) {
|
|
104
104
|
const s = n.CSSStyleSheet;
|
|
105
105
|
if (s.prototype.replaceSync) {
|
|
106
106
|
const r = new s();
|
|
@@ -115,11 +115,11 @@ function de(n, e, t) {
|
|
|
115
115
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
async function
|
|
118
|
+
async function st(n, e) {
|
|
119
119
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
|
120
|
-
t &&
|
|
120
|
+
t && he(window, n, t);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function nt(n, e = window) {
|
|
123
123
|
const t = e.document, s = e.document.head;
|
|
124
124
|
for (const r of n)
|
|
125
125
|
if (!t.getElementById(r)) {
|
|
@@ -127,7 +127,7 @@ function st(n, e = window) {
|
|
|
127
127
|
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
async function
|
|
130
|
+
async function rt(n, e, t = window) {
|
|
131
131
|
const s = t.document, r = t.document.head;
|
|
132
132
|
let o = t[e];
|
|
133
133
|
return o ? o.default || o : new Promise((a, i) => {
|
|
@@ -141,7 +141,7 @@ async function nt(n, e, t = window) {
|
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function ot(n) {
|
|
145
145
|
return Y(n) || Y(n?.install);
|
|
146
146
|
}
|
|
147
147
|
function C(n, e, t = !1, s = !1) {
|
|
@@ -154,13 +154,13 @@ function C(n, e, t = !1, s = !1) {
|
|
|
154
154
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
155
155
|
return new Function("$scope", a)(e);
|
|
156
156
|
} catch (r) {
|
|
157
|
-
if (
|
|
157
|
+
if (O.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
|
158
158
|
throw r;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function se(n, e, t = !1, s = !1) {
|
|
162
162
|
const r = C(n, e, t, s);
|
|
163
|
-
if (typeof r != "function" && (
|
|
163
|
+
if (typeof r != "function" && (O.error(
|
|
164
164
|
"parseFunction.error",
|
|
165
165
|
"not a function",
|
|
166
166
|
n,
|
|
@@ -175,14 +175,14 @@ function S(n) {
|
|
|
175
175
|
function M(n) {
|
|
176
176
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function it(n) {
|
|
179
179
|
return S(n) || M(n);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
return
|
|
181
|
+
function ps(n) {
|
|
182
|
+
return it(n) ? n.value : JSON.stringify(n);
|
|
183
183
|
}
|
|
184
184
|
let E = null;
|
|
185
|
-
const
|
|
185
|
+
const at = Ce({
|
|
186
186
|
settings: {
|
|
187
187
|
type: "form",
|
|
188
188
|
validSuccess: !0,
|
|
@@ -208,7 +208,7 @@ const it = be({
|
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
210
|
let P;
|
|
211
|
-
function
|
|
211
|
+
function ct(n, e) {
|
|
212
212
|
const { jsonp: t, request: s } = e;
|
|
213
213
|
if (n.method === "jsonp")
|
|
214
214
|
return (r = {}) => t(n.url, {
|
|
@@ -224,10 +224,10 @@ function at(n, e) {
|
|
|
224
224
|
headers: r
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
|
-
return (a, i) => (delete o.data, s.send(
|
|
227
|
+
return (a, i) => (delete o.data, s.send(Fe(o, i || {}, { data: a })));
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function ut(n, e) {
|
|
231
231
|
const { metaQuery: t } = e;
|
|
232
232
|
if (!t) return;
|
|
233
233
|
const { code: s, queryCode: r } = n;
|
|
@@ -239,34 +239,34 @@ function ct(n, e) {
|
|
|
239
239
|
return t(s, r, o, a);
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function lt(n = [], e = [], t) {
|
|
243
243
|
const s = {};
|
|
244
244
|
for (const r of n)
|
|
245
|
-
s[r.id] = at(r, t);
|
|
246
|
-
for (const r of e)
|
|
247
245
|
s[r.id] = ct(r, t);
|
|
246
|
+
for (const r of e)
|
|
247
|
+
s[r.id] = ut(r, t);
|
|
248
248
|
return s;
|
|
249
249
|
}
|
|
250
|
-
async function
|
|
250
|
+
async function ft(n = []) {
|
|
251
251
|
P = await import("mockjs").then((e) => e.default || e), P && (P.setup({
|
|
252
252
|
timeout: "50-500"
|
|
253
|
-
}),
|
|
253
|
+
}), me(), n.forEach((e) => dt(P, e)));
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function dt(n, e) {
|
|
256
256
|
if (!e.mock) return;
|
|
257
257
|
const { url: t, mockTemplate: s } = e;
|
|
258
258
|
if (t && s) {
|
|
259
|
-
const r =
|
|
259
|
+
const r = Ae(`${t}(.*)`), o = Ie(t, { decode: decodeURIComponent }), a = C(s, {}, !0);
|
|
260
260
|
n.mock(r, (i) => {
|
|
261
|
-
const u =
|
|
261
|
+
const u = R.parse(i.url) || {}, c = i.body instanceof FormData ? Oe(i.body) : i.body, p = o(i.url)?.params;
|
|
262
262
|
return Object.assign(i, { data: c, params: u, query: p }), n.mock(a(i));
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function me() {
|
|
267
267
|
P && (P._mocked = {});
|
|
268
268
|
}
|
|
269
|
-
const
|
|
269
|
+
const pt = {
|
|
270
270
|
session: !1,
|
|
271
271
|
authKey: "Authorization",
|
|
272
272
|
storageKey: "ACCESS_STORAGE",
|
|
@@ -276,13 +276,13 @@ const dt = {
|
|
|
276
276
|
redirectParam: "r",
|
|
277
277
|
unauthorizedCode: 401,
|
|
278
278
|
unauthorizedMessage: "登录已经失效,请重新登录!"
|
|
279
|
-
},
|
|
280
|
-
class
|
|
279
|
+
}, ve = Symbol("access");
|
|
280
|
+
class hs {
|
|
281
281
|
options;
|
|
282
282
|
data = null;
|
|
283
283
|
mode = _.Raw;
|
|
284
284
|
constructor(e) {
|
|
285
|
-
this.options = Object.assign({},
|
|
285
|
+
this.options = Object.assign({}, pt, e), this.loadData();
|
|
286
286
|
}
|
|
287
287
|
connect(e) {
|
|
288
288
|
const { mode: t, router: s, request: r } = e;
|
|
@@ -290,17 +290,17 @@ class ps {
|
|
|
290
290
|
}
|
|
291
291
|
login(e) {
|
|
292
292
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
|
293
|
-
this.setData(e), this.data && (
|
|
293
|
+
this.setData(e), this.data && (T.save(t, e, {
|
|
294
294
|
type: "local",
|
|
295
295
|
prefix: s
|
|
296
|
-
}), r &&
|
|
296
|
+
}), r && k.set(o, this.data.token));
|
|
297
297
|
}
|
|
298
298
|
clear() {
|
|
299
299
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
|
300
|
-
this.data = null,
|
|
300
|
+
this.data = null, T.remove(e, {
|
|
301
301
|
type: "local",
|
|
302
302
|
prefix: t
|
|
303
|
-
}), s &&
|
|
303
|
+
}), s && k.remove(r);
|
|
304
304
|
}
|
|
305
305
|
logout() {
|
|
306
306
|
this.clear(), this.toLogin();
|
|
@@ -317,7 +317,7 @@ class ps {
|
|
|
317
317
|
return Q(e).some((r) => t[r]);
|
|
318
318
|
}
|
|
319
319
|
install(e) {
|
|
320
|
-
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(
|
|
320
|
+
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(ve, this);
|
|
321
321
|
}
|
|
322
322
|
isAuthPath(e) {
|
|
323
323
|
const { auth: t, isAuth: s } = this.options;
|
|
@@ -336,12 +336,16 @@ class ps {
|
|
|
336
336
|
typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
|
|
337
337
|
}
|
|
338
338
|
setData(e) {
|
|
339
|
-
const {
|
|
339
|
+
const { privateKey: t } = this.options;
|
|
340
|
+
if (Array.isArray(e) && t) {
|
|
341
|
+
const s = e.map((r) => X(r, t));
|
|
342
|
+
this.data = JSON.parse(s.join(""));
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
340
345
|
if (typeof e == "string")
|
|
341
346
|
try {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
);
|
|
347
|
+
const s = t ? X(e, t) : e;
|
|
348
|
+
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
|
345
349
|
} catch (s) {
|
|
346
350
|
console.warn(s);
|
|
347
351
|
}
|
|
@@ -349,7 +353,7 @@ class ps {
|
|
|
349
353
|
this.data = e;
|
|
350
354
|
}
|
|
351
355
|
loadData() {
|
|
352
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
|
356
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = T.get(e, {
|
|
353
357
|
type: "local",
|
|
354
358
|
prefix: t
|
|
355
359
|
});
|
|
@@ -357,18 +361,23 @@ class ps {
|
|
|
357
361
|
}
|
|
358
362
|
isLogined() {
|
|
359
363
|
const { session: e, authKey: t } = this.options;
|
|
360
|
-
return e && t ? !!
|
|
364
|
+
return e && t ? !!k.get(t) : !!this.data;
|
|
361
365
|
}
|
|
362
366
|
hasRoutePermission(e) {
|
|
363
|
-
|
|
364
|
-
|
|
367
|
+
if (e.name === de) {
|
|
368
|
+
const t = e.params.id;
|
|
369
|
+
return t && this.can(t);
|
|
370
|
+
}
|
|
371
|
+
return !0;
|
|
365
372
|
}
|
|
366
373
|
setGuard(e) {
|
|
367
374
|
e.beforeEach((t, s, r) => this.guard(t, r));
|
|
368
375
|
}
|
|
369
376
|
guard(e, t) {
|
|
370
|
-
if (this.isWhiteList(e) || this.
|
|
377
|
+
if (this.isWhiteList(e) || this.isAuthPath(e))
|
|
371
378
|
return t();
|
|
379
|
+
if (this.isLogined())
|
|
380
|
+
return this.hasRoutePermission(e) ? t() : (this.showTip("无权限访问该页面"), t(!1));
|
|
372
381
|
t(!1), this.toLogin();
|
|
373
382
|
}
|
|
374
383
|
isWhiteList(e) {
|
|
@@ -380,11 +389,15 @@ class ps {
|
|
|
380
389
|
return e.status === t || e.data.code === t;
|
|
381
390
|
}
|
|
382
391
|
async showUnauthorizedAlert(e) {
|
|
383
|
-
const {
|
|
384
|
-
this.isUnauthorized(e) &&
|
|
392
|
+
const { unauthorizedMessage: t = "登录已失效" } = this.options;
|
|
393
|
+
this.isUnauthorized(e) && (await this.showTip(t), this.toLogin());
|
|
394
|
+
}
|
|
395
|
+
async showTip(e) {
|
|
396
|
+
const { alert: t } = this.options;
|
|
397
|
+
t && (await oe(150), await t(e, {
|
|
385
398
|
title: "提示",
|
|
386
399
|
type: "warning"
|
|
387
|
-
}).catch((
|
|
400
|
+
}).catch((s) => s));
|
|
388
401
|
}
|
|
389
402
|
setRequest(e) {
|
|
390
403
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
|
@@ -396,10 +409,10 @@ class ps {
|
|
|
396
409
|
);
|
|
397
410
|
}
|
|
398
411
|
}
|
|
399
|
-
function
|
|
400
|
-
return
|
|
412
|
+
function ht() {
|
|
413
|
+
return ie(ve, null);
|
|
401
414
|
}
|
|
402
|
-
class
|
|
415
|
+
class mt {
|
|
403
416
|
__id = null;
|
|
404
417
|
__mode;
|
|
405
418
|
__instance = null;
|
|
@@ -428,7 +441,7 @@ class ht {
|
|
|
428
441
|
const { mode: t, dsl: s, attrs: r } = e;
|
|
429
442
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
|
430
443
|
}
|
|
431
|
-
setup(e, t =
|
|
444
|
+
setup(e, t = D) {
|
|
432
445
|
const s = t.getCurrentInstance();
|
|
433
446
|
if (!s) return;
|
|
434
447
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
|
@@ -442,12 +455,12 @@ class ht {
|
|
|
442
455
|
});
|
|
443
456
|
}
|
|
444
457
|
__proxy() {
|
|
445
|
-
this.__instance &&
|
|
458
|
+
this.__instance && te.forEach((e) => {
|
|
446
459
|
this[e] = this.__instance?.[e];
|
|
447
460
|
});
|
|
448
461
|
}
|
|
449
462
|
__cleanup() {
|
|
450
|
-
|
|
463
|
+
te.forEach((e) => {
|
|
451
464
|
this[e] = null;
|
|
452
465
|
});
|
|
453
466
|
}
|
|
@@ -455,9 +468,9 @@ class ht {
|
|
|
455
468
|
if (e)
|
|
456
469
|
if (this.__mode === _.Runtime) {
|
|
457
470
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
458
|
-
return
|
|
471
|
+
return se({ type: s, value: r }, this);
|
|
459
472
|
} else
|
|
460
|
-
return
|
|
473
|
+
return se(e, this);
|
|
461
474
|
}
|
|
462
475
|
__parseExpression(e) {
|
|
463
476
|
if (e)
|
|
@@ -470,7 +483,7 @@ class ht {
|
|
|
470
483
|
__ref(e = null, t) {
|
|
471
484
|
if (this.__mode !== _.VNode)
|
|
472
485
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
|
473
|
-
await
|
|
486
|
+
await oe(0);
|
|
474
487
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
|
475
488
|
if (!r) {
|
|
476
489
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
@@ -499,7 +512,7 @@ class ht {
|
|
|
499
512
|
}
|
|
500
513
|
function N(n) {
|
|
501
514
|
const {
|
|
502
|
-
Vue: e =
|
|
515
|
+
Vue: e = D,
|
|
503
516
|
mode: t = _.Runtime,
|
|
504
517
|
components: s = {},
|
|
505
518
|
libs: r = {},
|
|
@@ -509,22 +522,22 @@ function N(n) {
|
|
|
509
522
|
$components: s,
|
|
510
523
|
$libs: r,
|
|
511
524
|
$apis: o
|
|
512
|
-
}, c = new
|
|
525
|
+
}, c = new mt({
|
|
513
526
|
mode: t,
|
|
514
527
|
dsl: i.value,
|
|
515
528
|
attrs: u
|
|
516
529
|
}), p = e.defineComponent({
|
|
517
530
|
name: i.value.name,
|
|
518
531
|
props: {
|
|
519
|
-
...
|
|
532
|
+
...gt(i.value.props ?? [], c)
|
|
520
533
|
},
|
|
521
534
|
setup(l) {
|
|
522
|
-
c.$props = l, c.props = l, i.value.id &&
|
|
535
|
+
c.$props = l, c.props = l, i.value.id && he(
|
|
523
536
|
n.window || window,
|
|
524
537
|
i.value.id,
|
|
525
538
|
i.value.css || ""
|
|
526
|
-
), c.state =
|
|
527
|
-
const f =
|
|
539
|
+
), c.state = yt(e, i.value.state ?? {}, c);
|
|
540
|
+
const f = _t(e, i.value.computed ?? {}, c), m = wt(i.value.methods ?? {}, c), d = St(e, i.value.inject, c), h = $t(
|
|
528
541
|
i.value.dataSources || {},
|
|
529
542
|
c
|
|
530
543
|
), w = {
|
|
@@ -533,28 +546,28 @@ function N(n) {
|
|
|
533
546
|
...m,
|
|
534
547
|
...h
|
|
535
548
|
};
|
|
536
|
-
return c.setup(w, e),
|
|
549
|
+
return c.setup(w, e), jt(e, i.value.watch ?? [], c), {
|
|
537
550
|
vtj: c
|
|
538
551
|
};
|
|
539
552
|
},
|
|
540
|
-
emits:
|
|
553
|
+
emits: vt(i.value.emits),
|
|
541
554
|
expose: ["vtj"],
|
|
542
555
|
render() {
|
|
543
556
|
if (!i.value.nodes) return null;
|
|
544
557
|
const l = i.value.nodes || [];
|
|
545
|
-
return l.length === 1 ?
|
|
558
|
+
return l.length === 1 ? x(l[0], c, e, a) : l.map((f) => x(f, c, e, a));
|
|
546
559
|
},
|
|
547
|
-
...
|
|
560
|
+
...Et(i.value.lifeCycles ?? {}, c)
|
|
548
561
|
});
|
|
549
562
|
return {
|
|
550
563
|
renderer: e.markRaw(p),
|
|
551
564
|
context: c
|
|
552
565
|
};
|
|
553
566
|
}
|
|
554
|
-
function
|
|
567
|
+
function vt(n = []) {
|
|
555
568
|
return n.map((e) => $(e) ? e : e.name);
|
|
556
569
|
}
|
|
557
|
-
function
|
|
570
|
+
function gt(n = [], e) {
|
|
558
571
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => Ye[o]) : void 0;
|
|
559
572
|
return n.map((s) => $(s) ? {
|
|
560
573
|
name: s
|
|
@@ -572,7 +585,7 @@ function vt(n = [], e) {
|
|
|
572
585
|
{}
|
|
573
586
|
);
|
|
574
587
|
}
|
|
575
|
-
function
|
|
588
|
+
function yt(n, e, t) {
|
|
576
589
|
return n.reactive(
|
|
577
590
|
Object.keys(e || {}).reduce(
|
|
578
591
|
(s, r) => {
|
|
@@ -583,19 +596,19 @@ function gt(n, e, t) {
|
|
|
583
596
|
)
|
|
584
597
|
);
|
|
585
598
|
}
|
|
586
|
-
function
|
|
599
|
+
function _t(n, e, t) {
|
|
587
600
|
return Object.entries(e ?? {}).reduce(
|
|
588
601
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
|
589
602
|
{}
|
|
590
603
|
);
|
|
591
604
|
}
|
|
592
|
-
function
|
|
605
|
+
function wt(n, e) {
|
|
593
606
|
return Object.entries(n ?? {}).reduce(
|
|
594
607
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
595
608
|
{}
|
|
596
609
|
);
|
|
597
610
|
}
|
|
598
|
-
function
|
|
611
|
+
function St(n, e = [], t) {
|
|
599
612
|
return e.reduce(
|
|
600
613
|
(s, r) => {
|
|
601
614
|
const { name: o, from: a } = r || {};
|
|
@@ -606,7 +619,7 @@ function wt(n, e = [], t) {
|
|
|
606
619
|
{}
|
|
607
620
|
);
|
|
608
621
|
}
|
|
609
|
-
function
|
|
622
|
+
function $t(n, e) {
|
|
610
623
|
return Object.keys(n).reduce(
|
|
611
624
|
(t, s) => {
|
|
612
625
|
const r = n[s], o = e.$apis[r.ref], a = M(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
|
@@ -618,7 +631,7 @@ function St(n, e) {
|
|
|
618
631
|
{}
|
|
619
632
|
);
|
|
620
633
|
}
|
|
621
|
-
function
|
|
634
|
+
function jt(n, e = [], t) {
|
|
622
635
|
e.forEach((s) => {
|
|
623
636
|
n.watch(
|
|
624
637
|
t.__parseExpression(s.source),
|
|
@@ -630,27 +643,27 @@ function $t(n, e = [], t) {
|
|
|
630
643
|
);
|
|
631
644
|
});
|
|
632
645
|
}
|
|
633
|
-
function
|
|
646
|
+
function Et(n, e) {
|
|
634
647
|
return Object.entries(n ?? {}).reduce(
|
|
635
648
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
636
649
|
{}
|
|
637
650
|
);
|
|
638
651
|
}
|
|
639
|
-
let
|
|
640
|
-
const
|
|
641
|
-
async function
|
|
652
|
+
let U = [];
|
|
653
|
+
const Pt = (n) => n;
|
|
654
|
+
async function ge(n, e = window) {
|
|
642
655
|
const { urls: t = [], library: s } = n, r = t.filter((i) => z(i));
|
|
643
656
|
if (r.length === 0 || !s) return null;
|
|
644
657
|
const o = t.filter((i) => V(i));
|
|
645
|
-
return o.length &&
|
|
658
|
+
return o.length && nt(o, e), await rt(r, s, e).catch(
|
|
646
659
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
|
647
660
|
);
|
|
648
661
|
}
|
|
649
662
|
function L(n) {
|
|
650
663
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
|
651
|
-
return s.window && (
|
|
664
|
+
return s.window && (U.forEach((r) => {
|
|
652
665
|
delete s.window[r];
|
|
653
|
-
}),
|
|
666
|
+
}), U = []), (r, o, a = D) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
654
667
|
const i = await e(o.id);
|
|
655
668
|
return i && (i.name = r), i ? N({
|
|
656
669
|
...s,
|
|
@@ -668,33 +681,33 @@ function L(n) {
|
|
|
668
681
|
mode: _.Runtime,
|
|
669
682
|
loader: L(n)
|
|
670
683
|
}).renderer : null;
|
|
671
|
-
}) : o.type === "Plugin" ? (o.library &&
|
|
672
|
-
const i = await
|
|
684
|
+
}) : o.type === "Plugin" ? (o.library && U.push(o.library), a.defineAsyncComponent(async () => {
|
|
685
|
+
const i = await ge(o, s.window);
|
|
673
686
|
return i || (console.warn("getPlugin result is null", o), null);
|
|
674
687
|
})) : r;
|
|
675
688
|
}
|
|
676
|
-
function
|
|
689
|
+
function x(n, e, t = D, s = Pt) {
|
|
677
690
|
if (!n || !n.name || n.invisible) return null;
|
|
678
|
-
const { id: r = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: u, vModels: c, vBind: p } =
|
|
691
|
+
const { id: r = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: u, vModels: c, vBind: p } = Rt(o);
|
|
679
692
|
if (a && !bt(a, e))
|
|
680
693
|
return null;
|
|
681
694
|
const l = (f) => {
|
|
682
695
|
const m = f.$components, d = (() => {
|
|
683
696
|
if (n.name === "component")
|
|
684
|
-
return
|
|
697
|
+
return Ct(f, n.props?.is);
|
|
685
698
|
if (n.name === "slot") return n.name;
|
|
686
699
|
const g = s(n.name, n.from, t);
|
|
687
700
|
return $(g) ? m[g] ?? g : g;
|
|
688
|
-
})(), h =
|
|
701
|
+
})(), h = Ft(r, n.props ?? {}, f), w = At(t, n.events ?? {}, f);
|
|
689
702
|
if (n.name === "slot")
|
|
690
|
-
return
|
|
703
|
+
return It(t, n, h, f, s);
|
|
691
704
|
p && Object.assign(h, f.__parseExpression(p.value)), u && (h.style = Object.assign(
|
|
692
705
|
h.style ?? {},
|
|
693
|
-
|
|
706
|
+
xt(u, f)
|
|
694
707
|
)), c.forEach((g) => {
|
|
695
|
-
Object.assign(h,
|
|
708
|
+
Object.assign(h, Dt(t, g, f));
|
|
696
709
|
});
|
|
697
|
-
const v =
|
|
710
|
+
const v = Ht(
|
|
698
711
|
t,
|
|
699
712
|
n.children ?? [],
|
|
700
713
|
f,
|
|
@@ -705,7 +718,7 @@ function A(n, e, t = O, s = Et) {
|
|
|
705
718
|
};
|
|
706
719
|
return i ? kt(i, l, e) : l(e);
|
|
707
720
|
}
|
|
708
|
-
function
|
|
721
|
+
function Rt(n = []) {
|
|
709
722
|
const e = n.find((i) => j(i.name) === "vIf"), t = n.find((i) => j(i.name) === "vFor"), s = n.find((i) => j(i.name) === "vShow"), r = n.find((i) => j(i.name) === "vBind"), o = n.filter((i) => j(i.name) === "vModel"), a = n.filter(
|
|
710
723
|
(i) => !Ge.includes(j(i.name))
|
|
711
724
|
);
|
|
@@ -721,10 +734,10 @@ function Pt(n = []) {
|
|
|
721
734
|
function bt(n, e) {
|
|
722
735
|
return !!e.__parseExpression(n.value);
|
|
723
736
|
}
|
|
724
|
-
function
|
|
737
|
+
function Ct(n, e) {
|
|
725
738
|
return e ? S(e) ? n.__parseExpression(e) : e : "div";
|
|
726
739
|
}
|
|
727
|
-
function
|
|
740
|
+
function Ft(n, e, t) {
|
|
728
741
|
const s = Object.keys(e || {}).reduce(
|
|
729
742
|
(r, o) => {
|
|
730
743
|
let a = e[o];
|
|
@@ -734,7 +747,7 @@ function Ct(n, e, t) {
|
|
|
734
747
|
);
|
|
735
748
|
return s.ref = t.__ref(n, s.ref), s;
|
|
736
749
|
}
|
|
737
|
-
function
|
|
750
|
+
function At(n, e, t) {
|
|
738
751
|
const s = ["passive", "capture", "once"], r = {
|
|
739
752
|
capture: "Capture",
|
|
740
753
|
once: "Once",
|
|
@@ -742,70 +755,70 @@ function Ft(n, e, t) {
|
|
|
742
755
|
};
|
|
743
756
|
return Object.keys(e || {}).reduce(
|
|
744
757
|
(o, a) => {
|
|
745
|
-
const i = e[a], u =
|
|
758
|
+
const i = e[a], u = ye(i.modifiers), c = u.find((f) => s.includes(f)), p = "on" + xe(a) + (c && r[c] || ""), l = t.__parseFunction(i.handler);
|
|
746
759
|
return l && (o[p] = n.withModifiers(l, u)), o;
|
|
747
760
|
},
|
|
748
761
|
{}
|
|
749
762
|
);
|
|
750
763
|
}
|
|
751
|
-
function
|
|
764
|
+
function ye(n = {}, e = !1) {
|
|
752
765
|
const t = Object.keys(n);
|
|
753
766
|
return e ? t.map((s) => "." + s) : t;
|
|
754
767
|
}
|
|
755
|
-
function
|
|
756
|
-
const { children: o } = e, a =
|
|
768
|
+
function It(n, e, t, s, r) {
|
|
769
|
+
const { children: o } = e, a = Ot(e, s), i = s.$slots?.[a.name];
|
|
757
770
|
return i ? i(t) : o ? $(o) ? n.createTextVNode(o) : S(o) ? n.createTextVNode(
|
|
758
|
-
|
|
771
|
+
pe(s.__parseExpression(o))
|
|
759
772
|
) : Array.isArray(o) ? o.map(
|
|
760
|
-
(u) =>
|
|
773
|
+
(u) => x(u, s, n, r)
|
|
761
774
|
) : null : null;
|
|
762
775
|
}
|
|
763
|
-
function
|
|
776
|
+
function Ot(n, e) {
|
|
764
777
|
const { props: t } = n, s = t?.name || "default";
|
|
765
778
|
return {
|
|
766
779
|
name: S(s) ? e.__parseExpression(s) : s,
|
|
767
780
|
params: []
|
|
768
781
|
};
|
|
769
782
|
}
|
|
770
|
-
function
|
|
783
|
+
function xt(n, e) {
|
|
771
784
|
return e.__parseExpression(n.value) ? {} : {
|
|
772
785
|
display: "none"
|
|
773
786
|
};
|
|
774
787
|
}
|
|
775
|
-
function
|
|
788
|
+
function Dt(n, e, t) {
|
|
776
789
|
const s = {
|
|
777
790
|
type: "JSFunction",
|
|
778
791
|
value: e.value?.value ? `(v) => {
|
|
779
792
|
${e.value.value} = v;
|
|
780
793
|
}` : "(v) => {}"
|
|
781
|
-
}, r = t.__parseFunction(s), o =
|
|
794
|
+
}, r = t.__parseFunction(s), o = ye(e.modifiers), a = S(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
782
795
|
return {
|
|
783
796
|
[a]: t.__parseExpression(e.value),
|
|
784
797
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
|
785
798
|
};
|
|
786
799
|
}
|
|
787
|
-
function
|
|
800
|
+
function Ht(n, e, t, s, r) {
|
|
788
801
|
if (!e) return null;
|
|
789
802
|
if ($(e))
|
|
790
803
|
return { default: () => e };
|
|
791
804
|
if (S(e))
|
|
792
805
|
return {
|
|
793
|
-
default: () =>
|
|
806
|
+
default: () => pe(t.__parseExpression(e))
|
|
794
807
|
};
|
|
795
808
|
if (Array.isArray(e) && e.length > 0) {
|
|
796
|
-
const o =
|
|
809
|
+
const o = Mt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
|
797
810
|
[`scope_${r.id}`]: i
|
|
798
811
|
} : {};
|
|
799
812
|
return Object.entries(o).reduce((i, [u, { nodes: c, params: p }]) => (i[u] = (l) => {
|
|
800
|
-
const f = p.length ?
|
|
813
|
+
const f = p.length ? De(l ?? {}, p) : a(l);
|
|
801
814
|
return c.map(
|
|
802
|
-
(m) =>
|
|
815
|
+
(m) => x(m, t.__clone(f), n, s)
|
|
803
816
|
);
|
|
804
817
|
}, i), {});
|
|
805
818
|
}
|
|
806
819
|
return null;
|
|
807
820
|
}
|
|
808
|
-
function
|
|
821
|
+
function Mt(n) {
|
|
809
822
|
const e = {
|
|
810
823
|
default: {
|
|
811
824
|
params: [],
|
|
@@ -813,7 +826,7 @@ function Ht(n) {
|
|
|
813
826
|
}
|
|
814
827
|
};
|
|
815
828
|
for (const t of n) {
|
|
816
|
-
const s =
|
|
829
|
+
const s = Tt(t.slot), r = s.name;
|
|
817
830
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
|
818
831
|
nodes: [t],
|
|
819
832
|
params: s.params
|
|
@@ -821,7 +834,7 @@ function Ht(n) {
|
|
|
821
834
|
}
|
|
822
835
|
return e;
|
|
823
836
|
}
|
|
824
|
-
function
|
|
837
|
+
function Tt(n = "default") {
|
|
825
838
|
return $(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
826
839
|
}
|
|
827
840
|
function kt(n, e, t) {
|
|
@@ -829,53 +842,53 @@ function kt(n, e, t) {
|
|
|
829
842
|
let i = t.__parseExpression(s) || [];
|
|
830
843
|
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((u, c) => c + 1)), Array.isArray(i) ? i.map((u, c) => e(t.__clone({ [o]: u, [a]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
831
844
|
}
|
|
832
|
-
function
|
|
845
|
+
function Ut(n) {
|
|
833
846
|
return Le() ? (qe(n), !0) : !1;
|
|
834
847
|
}
|
|
835
848
|
function K(n) {
|
|
836
849
|
return typeof n == "function" ? n() : Je(n);
|
|
837
850
|
}
|
|
838
|
-
const
|
|
851
|
+
const _e = typeof window < "u" && typeof document < "u";
|
|
839
852
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
840
|
-
const Bt = (n) => n != null,
|
|
853
|
+
const Bt = (n) => n != null, Nt = () => {
|
|
841
854
|
};
|
|
842
|
-
function
|
|
843
|
-
return
|
|
855
|
+
function Lt(n) {
|
|
856
|
+
return ae();
|
|
844
857
|
}
|
|
845
|
-
function
|
|
858
|
+
function qt(...n) {
|
|
846
859
|
if (n.length !== 1)
|
|
847
|
-
return
|
|
860
|
+
return ke(...n);
|
|
848
861
|
const e = n[0];
|
|
849
|
-
return typeof e == "function" ? Be(
|
|
862
|
+
return typeof e == "function" ? Ue(Be(() => ({ get: e, set: Nt }))) : J(e);
|
|
850
863
|
}
|
|
851
|
-
function
|
|
852
|
-
|
|
864
|
+
function Jt(n, e) {
|
|
865
|
+
Lt() && Ne(n, e);
|
|
853
866
|
}
|
|
854
|
-
const
|
|
855
|
-
function
|
|
867
|
+
const Vt = _e ? window : void 0, zt = _e ? window.document : void 0;
|
|
868
|
+
function Kt(n) {
|
|
856
869
|
var e;
|
|
857
870
|
const t = K(n);
|
|
858
871
|
return (e = t?.$el) != null ? e : t;
|
|
859
872
|
}
|
|
860
|
-
function
|
|
861
|
-
const n = J(!1), e =
|
|
873
|
+
function Wt() {
|
|
874
|
+
const n = J(!1), e = ae();
|
|
862
875
|
return e && Ve(() => {
|
|
863
876
|
n.value = !0;
|
|
864
877
|
}, e), n;
|
|
865
878
|
}
|
|
866
|
-
function
|
|
867
|
-
const e =
|
|
868
|
-
return
|
|
879
|
+
function Gt(n) {
|
|
880
|
+
const e = Wt();
|
|
881
|
+
return ue(() => (e.value, !!n()));
|
|
869
882
|
}
|
|
870
|
-
function
|
|
871
|
-
const { window: s =
|
|
883
|
+
function Yt(n, e, t = {}) {
|
|
884
|
+
const { window: s = Vt, ...r } = t;
|
|
872
885
|
let o;
|
|
873
|
-
const a =
|
|
886
|
+
const a = Gt(() => s && "MutationObserver" in s), i = () => {
|
|
874
887
|
o && (o.disconnect(), o = void 0);
|
|
875
|
-
}, u =
|
|
876
|
-
const f = K(n), m = (Array.isArray(f) ? f : [f]).map(
|
|
888
|
+
}, u = ue(() => {
|
|
889
|
+
const f = K(n), m = (Array.isArray(f) ? f : [f]).map(Kt).filter(Bt);
|
|
877
890
|
return new Set(m);
|
|
878
|
-
}), c =
|
|
891
|
+
}), c = ce(
|
|
879
892
|
() => u.value,
|
|
880
893
|
(f) => {
|
|
881
894
|
i(), a.value && f.size && (o = new MutationObserver(e), f.forEach((m) => o.observe(m, r)));
|
|
@@ -884,48 +897,48 @@ function Gt(n, e, t = {}) {
|
|
|
884
897
|
), p = () => o?.takeRecords(), l = () => {
|
|
885
898
|
c(), i();
|
|
886
899
|
};
|
|
887
|
-
return
|
|
900
|
+
return Ut(l), {
|
|
888
901
|
isSupported: a,
|
|
889
902
|
stop: l,
|
|
890
903
|
takeRecords: p
|
|
891
904
|
};
|
|
892
905
|
}
|
|
893
|
-
function
|
|
906
|
+
function Qt(n = null, e = {}) {
|
|
894
907
|
var t, s, r;
|
|
895
908
|
const {
|
|
896
|
-
document: o =
|
|
909
|
+
document: o = zt,
|
|
897
910
|
restoreOnUnmount: a = (l) => l
|
|
898
|
-
} = e, i = (t = o?.title) != null ? t : "", u =
|
|
911
|
+
} = e, i = (t = o?.title) != null ? t : "", u = qt((s = n ?? o?.title) != null ? s : null), c = n && typeof n == "function";
|
|
899
912
|
function p(l) {
|
|
900
913
|
if (!("titleTemplate" in e))
|
|
901
914
|
return l;
|
|
902
915
|
const f = e.titleTemplate || "%s";
|
|
903
916
|
return typeof f == "function" ? f(l) : K(f).replace(/%s/g, l);
|
|
904
917
|
}
|
|
905
|
-
return
|
|
918
|
+
return ce(
|
|
906
919
|
u,
|
|
907
920
|
(l, f) => {
|
|
908
921
|
l !== f && o && (o.title = p(typeof l == "string" ? l : ""));
|
|
909
922
|
},
|
|
910
923
|
{ immediate: !0 }
|
|
911
|
-
), e.observe && !e.titleTemplate && o && !c &&
|
|
924
|
+
), e.observe && !e.titleTemplate && o && !c && Yt(
|
|
912
925
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
|
913
926
|
() => {
|
|
914
927
|
o && o.title !== u.value && (u.value = p(o.title));
|
|
915
928
|
},
|
|
916
929
|
{ childList: !0 }
|
|
917
|
-
),
|
|
930
|
+
), Jt(() => {
|
|
918
931
|
if (a) {
|
|
919
932
|
const l = a(i, u.value || "");
|
|
920
933
|
l != null && o && (o.title = l);
|
|
921
934
|
}
|
|
922
935
|
}), u;
|
|
923
936
|
}
|
|
924
|
-
const
|
|
937
|
+
const ne = le({
|
|
925
938
|
name: "VtjPageContainer",
|
|
926
939
|
async setup() {
|
|
927
|
-
const n =
|
|
928
|
-
return s &&
|
|
940
|
+
const n = Se(), e = fe(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null;
|
|
941
|
+
return s && Qt(s.title || "VTJ"), {
|
|
929
942
|
provider: n,
|
|
930
943
|
component: r,
|
|
931
944
|
file: s,
|
|
@@ -933,16 +946,16 @@ const se = ue({
|
|
|
933
946
|
};
|
|
934
947
|
},
|
|
935
948
|
render() {
|
|
936
|
-
return this.component ?
|
|
949
|
+
return this.component ? B(this.component, this.query) : B("div", "页面不存在");
|
|
937
950
|
}
|
|
938
|
-
}),
|
|
951
|
+
}), Xt = le({
|
|
939
952
|
name: "VtjStartupContainer",
|
|
940
953
|
render() {
|
|
941
|
-
return
|
|
954
|
+
return B(We);
|
|
942
955
|
}
|
|
943
|
-
}),
|
|
944
|
-
var
|
|
945
|
-
class
|
|
956
|
+
}), we = Symbol("Provider");
|
|
957
|
+
var Zt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Zt || {});
|
|
958
|
+
class es extends Ee {
|
|
946
959
|
constructor(e) {
|
|
947
960
|
super(), this.options = e;
|
|
948
961
|
const {
|
|
@@ -966,7 +979,7 @@ class Zt extends $e {
|
|
|
966
979
|
mode;
|
|
967
980
|
globals = {};
|
|
968
981
|
modules = {};
|
|
969
|
-
adapter = { request:
|
|
982
|
+
adapter = { request: at, jsonp: He };
|
|
970
983
|
apis = {};
|
|
971
984
|
dependencies = {};
|
|
972
985
|
materials = {};
|
|
@@ -983,7 +996,7 @@ class Zt extends $e {
|
|
|
983
996
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
984
997
|
throw new Error("project is null");
|
|
985
998
|
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
|
986
|
-
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" ? await this.loadAssets(o) : await this.loadDependencies(o), this.apis =
|
|
999
|
+
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" ? await this.loadAssets(o) : await this.loadDependencies(o), this.apis = lt(s, r, this.adapter), me(), this.project.config?.mock && ft(s), this.initRouter(), this.triggerReady();
|
|
987
1000
|
}
|
|
988
1001
|
async loadDependencies(e) {
|
|
989
1002
|
const t = Object.entries(this.dependencies);
|
|
@@ -997,7 +1010,7 @@ class Zt extends $e {
|
|
|
997
1010
|
materials: p,
|
|
998
1011
|
materialExports: l,
|
|
999
1012
|
materialMapLibrary: f
|
|
1000
|
-
} =
|
|
1013
|
+
} = et(
|
|
1001
1014
|
t,
|
|
1002
1015
|
a,
|
|
1003
1016
|
i === "development"
|
|
@@ -1012,15 +1025,15 @@ class Zt extends $e {
|
|
|
1012
1025
|
else {
|
|
1013
1026
|
const v = c[d] || [];
|
|
1014
1027
|
for (const g of v)
|
|
1015
|
-
V(g) && await
|
|
1028
|
+
V(g) && await st(d, R.append(g, { v: b })), z(g) && await Z(R.append(g, { v: b }));
|
|
1016
1029
|
r[d] = e[d];
|
|
1017
1030
|
}
|
|
1018
1031
|
}
|
|
1019
1032
|
for (const d of p)
|
|
1020
|
-
await
|
|
1033
|
+
await Z(R.append(d, { v: b }));
|
|
1021
1034
|
const m = this.materials || {};
|
|
1022
1035
|
for (const d of l) {
|
|
1023
|
-
const h = e[f[d]], w =
|
|
1036
|
+
const h = e[f[d]], w = Pe[d];
|
|
1024
1037
|
if (w)
|
|
1025
1038
|
h && w.forEach((v) => {
|
|
1026
1039
|
o[v] = h[v];
|
|
@@ -1028,7 +1041,7 @@ class Zt extends $e {
|
|
|
1028
1041
|
else {
|
|
1029
1042
|
const v = m[d] ? (await m[d]()).default : e[d];
|
|
1030
1043
|
v && h && (v.components || []).forEach((g) => {
|
|
1031
|
-
o[g.name] =
|
|
1044
|
+
o[g.name] = tt(g, h);
|
|
1032
1045
|
});
|
|
1033
1046
|
}
|
|
1034
1047
|
}
|
|
@@ -1037,19 +1050,19 @@ class Zt extends $e {
|
|
|
1037
1050
|
const { router: e, project: t } = this;
|
|
1038
1051
|
e && (e.addRoute({
|
|
1039
1052
|
path: "/page/:id",
|
|
1040
|
-
name:
|
|
1041
|
-
component:
|
|
1053
|
+
name: de,
|
|
1054
|
+
component: ne
|
|
1042
1055
|
}), e.addRoute({
|
|
1043
1056
|
path: "/",
|
|
1044
|
-
name:
|
|
1045
|
-
component: t?.homepage ?
|
|
1057
|
+
name: Qe,
|
|
1058
|
+
component: t?.homepage ? ne : Xt
|
|
1046
1059
|
}));
|
|
1047
1060
|
}
|
|
1048
1061
|
install(e) {
|
|
1049
1062
|
const t = e.config.globalProperties.installed || {};
|
|
1050
1063
|
for (const [s, r] of Object.entries(this.library))
|
|
1051
|
-
!t[s] &&
|
|
1052
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
|
1064
|
+
!t[s] && ot(r) && (e.use(r), t[s] = !0);
|
|
1065
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(we, this), e.config.globalProperties.installed = t, this.nodeEnv === "development" && (e.config.errorHandler = (s, r, o) => {
|
|
1053
1066
|
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", u = `[ ${a} ] ${i} ${o}`;
|
|
1054
1067
|
console.error(
|
|
1055
1068
|
"[VTJ Error]:",
|
|
@@ -1125,32 +1138,32 @@ class Zt extends $e {
|
|
|
1125
1138
|
async getRenderComponent(e) {
|
|
1126
1139
|
const t = this.getFile(e);
|
|
1127
1140
|
if (!t)
|
|
1128
|
-
return
|
|
1141
|
+
return O.warn(`Can not find file: ${e}`), null;
|
|
1129
1142
|
const s = `.vtj/vue/${e}.vue`, r = this.modules[s];
|
|
1130
1143
|
if (r)
|
|
1131
1144
|
return (await r())?.default;
|
|
1132
1145
|
const o = await this.getDsl(t.id);
|
|
1133
|
-
return o ? this.createDslRenderer(o).renderer : (
|
|
1146
|
+
return o ? this.createDslRenderer(o).renderer : (O.warn(`Can not find dsl: ${e}`), null);
|
|
1134
1147
|
}
|
|
1135
1148
|
defineUrlSchemaComponent(e, t) {
|
|
1136
|
-
return
|
|
1149
|
+
return ee(async () => {
|
|
1137
1150
|
const s = await this.getDslByUrl(e);
|
|
1138
1151
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
|
1139
1152
|
});
|
|
1140
1153
|
}
|
|
1141
1154
|
definePluginComponent(e) {
|
|
1142
|
-
return
|
|
1155
|
+
return ee(async () => await ge(e, window));
|
|
1143
1156
|
}
|
|
1144
1157
|
}
|
|
1145
|
-
function
|
|
1146
|
-
const e = new
|
|
1158
|
+
function ms(n) {
|
|
1159
|
+
const e = new es(n);
|
|
1147
1160
|
return {
|
|
1148
1161
|
provider: e,
|
|
1149
1162
|
onReady: (s) => e.ready(s)
|
|
1150
1163
|
};
|
|
1151
1164
|
}
|
|
1152
|
-
function
|
|
1153
|
-
const e =
|
|
1165
|
+
function Se(n = {}) {
|
|
1166
|
+
const e = ie(we);
|
|
1154
1167
|
if (!e)
|
|
1155
1168
|
throw new Error("Can not find provider");
|
|
1156
1169
|
if (e.nodeEnv === "development") {
|
|
@@ -1178,7 +1191,7 @@ const W = new Me({
|
|
|
1178
1191
|
});
|
|
1179
1192
|
}
|
|
1180
1193
|
}
|
|
1181
|
-
}),
|
|
1194
|
+
}), ts = (n = "/__vtj__/api/:type.json") => (e, t) => W.send({
|
|
1182
1195
|
url: n,
|
|
1183
1196
|
method: "post",
|
|
1184
1197
|
params: { type: e },
|
|
@@ -1186,7 +1199,7 @@ const W = new Me({
|
|
|
1186
1199
|
type: e,
|
|
1187
1200
|
data: t
|
|
1188
1201
|
}
|
|
1189
|
-
}),
|
|
1202
|
+
}), ss = (n = "/__vtj__/api/uploader.json") => async (e, t) => await W.send({
|
|
1190
1203
|
url: n,
|
|
1191
1204
|
method: "post",
|
|
1192
1205
|
data: {
|
|
@@ -1202,7 +1215,7 @@ class G {
|
|
|
1202
1215
|
pluginCaches = {};
|
|
1203
1216
|
uploader;
|
|
1204
1217
|
constructor() {
|
|
1205
|
-
this.api =
|
|
1218
|
+
this.api = ts(), this.uploader = ss();
|
|
1206
1219
|
}
|
|
1207
1220
|
async getExtension() {
|
|
1208
1221
|
console.log("BaseService.getExtension");
|
|
@@ -1275,7 +1288,7 @@ class G {
|
|
|
1275
1288
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1276
1289
|
}
|
|
1277
1290
|
async getPluginMaterial(e) {
|
|
1278
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
|
1291
|
+
const { urls: t = [] } = e, s = t.filter((o) => Xe(o))[0];
|
|
1279
1292
|
if (!s) return null;
|
|
1280
1293
|
const r = this.pluginCaches[s];
|
|
1281
1294
|
return r || (this.pluginCaches[s] = W.send({
|
|
@@ -1288,12 +1301,12 @@ class G {
|
|
|
1288
1301
|
}).then((o) => o.data).catch(() => null));
|
|
1289
1302
|
}
|
|
1290
1303
|
}
|
|
1291
|
-
const y = new
|
|
1304
|
+
const y = new Te({
|
|
1292
1305
|
type: "local",
|
|
1293
1306
|
expired: 0,
|
|
1294
1307
|
prefix: "__VTJ_"
|
|
1295
1308
|
});
|
|
1296
|
-
class
|
|
1309
|
+
class vs extends G {
|
|
1297
1310
|
init(e) {
|
|
1298
1311
|
const t = new I(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
1299
1312
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
@@ -1327,7 +1340,7 @@ class ms extends G {
|
|
|
1327
1340
|
return Promise.resolve(!0);
|
|
1328
1341
|
}
|
|
1329
1342
|
getHistory(e) {
|
|
1330
|
-
const t = y.get(`history_${e}`), s = new
|
|
1343
|
+
const t = y.get(`history_${e}`), s = new re(t || { id: e });
|
|
1331
1344
|
return Promise.resolve(s.toDsl());
|
|
1332
1345
|
}
|
|
1333
1346
|
getHistoryItem(e, t) {
|
|
@@ -1343,7 +1356,7 @@ class ms extends G {
|
|
|
1343
1356
|
}), Promise.resolve(!0);
|
|
1344
1357
|
}
|
|
1345
1358
|
}
|
|
1346
|
-
class
|
|
1359
|
+
class ns extends G {
|
|
1347
1360
|
projects = {};
|
|
1348
1361
|
materials = {};
|
|
1349
1362
|
files = {};
|
|
@@ -1382,7 +1395,7 @@ class ss extends G {
|
|
|
1382
1395
|
return Promise.resolve(!0);
|
|
1383
1396
|
}
|
|
1384
1397
|
getHistory(e) {
|
|
1385
|
-
const t = this.histories[e], s = new
|
|
1398
|
+
const t = this.histories[e], s = new re(t || { id: e });
|
|
1386
1399
|
return Promise.resolve(s);
|
|
1387
1400
|
}
|
|
1388
1401
|
getHistoryItem(e, t) {
|
|
@@ -1400,11 +1413,11 @@ class ss extends G {
|
|
|
1400
1413
|
}), Promise.resolve(!0);
|
|
1401
1414
|
}
|
|
1402
1415
|
}
|
|
1403
|
-
let
|
|
1404
|
-
function
|
|
1405
|
-
return
|
|
1416
|
+
let A = null;
|
|
1417
|
+
function gs() {
|
|
1418
|
+
return A || (A = new ns(), A);
|
|
1406
1419
|
}
|
|
1407
|
-
class
|
|
1420
|
+
class ys extends G {
|
|
1408
1421
|
getFileCaches = {};
|
|
1409
1422
|
async getExtension() {
|
|
1410
1423
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1459,7 +1472,7 @@ class gs extends G {
|
|
|
1459
1472
|
);
|
|
1460
1473
|
}
|
|
1461
1474
|
}
|
|
1462
|
-
function
|
|
1475
|
+
function $e(n = []) {
|
|
1463
1476
|
return n.map((e) => {
|
|
1464
1477
|
const { id: t, title: s, icon: r, children: o, hidden: a } = e;
|
|
1465
1478
|
return {
|
|
@@ -1468,23 +1481,23 @@ function we(n = []) {
|
|
|
1468
1481
|
icon: r,
|
|
1469
1482
|
hidden: a,
|
|
1470
1483
|
url: `/page/${t}`,
|
|
1471
|
-
children: o && o.length ?
|
|
1484
|
+
children: o && o.length ? $e(o) : void 0
|
|
1472
1485
|
};
|
|
1473
1486
|
});
|
|
1474
1487
|
}
|
|
1475
|
-
function
|
|
1488
|
+
function je(n, e) {
|
|
1476
1489
|
if (!e) return n;
|
|
1477
1490
|
let t = [];
|
|
1478
1491
|
for (const s of n)
|
|
1479
1492
|
if (s.children && s.children.length) {
|
|
1480
|
-
const r =
|
|
1493
|
+
const r = je(s.children, e);
|
|
1481
1494
|
r.length && (s.children = r, t.push(s));
|
|
1482
1495
|
} else
|
|
1483
1496
|
e[s.id] && t.push(s);
|
|
1484
1497
|
return t;
|
|
1485
1498
|
}
|
|
1486
|
-
function
|
|
1487
|
-
const n =
|
|
1499
|
+
function _s() {
|
|
1500
|
+
const n = Se(), e = fe(), t = ht(), s = J(!1), r = t?.getData(), o = n.project;
|
|
1488
1501
|
ze(() => {
|
|
1489
1502
|
const { name: u, params: c, meta: p } = e;
|
|
1490
1503
|
if (u === "VtjPage") {
|
|
@@ -1496,69 +1509,71 @@ function ys() {
|
|
|
1496
1509
|
} else
|
|
1497
1510
|
s.value = !p.mask;
|
|
1498
1511
|
});
|
|
1499
|
-
const a =
|
|
1512
|
+
const a = $e(o?.pages), i = o?.config;
|
|
1500
1513
|
return {
|
|
1501
1514
|
disabled: s,
|
|
1502
1515
|
logo: i?.logo,
|
|
1503
1516
|
themeSwitchable: i?.themeSwitchable,
|
|
1504
1517
|
title: i?.title || o?.description || o?.name || "VTJ App",
|
|
1505
|
-
menus:
|
|
1518
|
+
menus: je(a, r?.permissions)
|
|
1506
1519
|
};
|
|
1507
1520
|
}
|
|
1508
1521
|
export {
|
|
1509
|
-
|
|
1510
|
-
|
|
1522
|
+
ve as ACCESS_KEY,
|
|
1523
|
+
hs as Access,
|
|
1511
1524
|
Ge as BUILT_IN_DIRECTIVES,
|
|
1512
1525
|
G as BaseService,
|
|
1513
|
-
|
|
1514
|
-
|
|
1526
|
+
te as CONTEXT_HOST,
|
|
1527
|
+
mt as Context,
|
|
1515
1528
|
_ as ContextMode,
|
|
1516
1529
|
Ye as DATA_TYPES,
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
Zt as
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1530
|
+
Qe as HOMEPAGE_ROUTE_NAME,
|
|
1531
|
+
ps as JSCodeToString,
|
|
1532
|
+
ls as LIFE_CYCLES_LIST,
|
|
1533
|
+
ys as LocalService,
|
|
1534
|
+
ns as MemoryService,
|
|
1535
|
+
Zt as NodeEnv,
|
|
1536
|
+
de as PAGE_ROUTE_NAME,
|
|
1537
|
+
es as Provider,
|
|
1538
|
+
vs as StorageService,
|
|
1539
|
+
b as VTJ_RENDERER_VERSION,
|
|
1540
|
+
he as adoptedStyleSheets,
|
|
1541
|
+
fs as createAssetScripts,
|
|
1542
|
+
ds as createAssetsCss,
|
|
1543
|
+
$t as createDataSources,
|
|
1529
1544
|
L as createLoader,
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1545
|
+
gs as createMemoryService,
|
|
1546
|
+
ut as createMetaApi,
|
|
1547
|
+
ms as createProvider,
|
|
1533
1548
|
N as createRenderer,
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1549
|
+
ct as createSchemaApi,
|
|
1550
|
+
lt as createSchemaApis,
|
|
1551
|
+
Pt as defaultLoader,
|
|
1537
1552
|
F as fillBasePath,
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1553
|
+
ye as getModifiers,
|
|
1554
|
+
ge as getPlugin,
|
|
1555
|
+
tt as getRawComponent,
|
|
1541
1556
|
V as isCSSUrl,
|
|
1542
|
-
|
|
1557
|
+
it as isJSCode,
|
|
1543
1558
|
S as isJSExpression,
|
|
1544
1559
|
M as isJSFunction,
|
|
1545
|
-
|
|
1560
|
+
Xe as isJSON,
|
|
1546
1561
|
z as isJSUrl,
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1562
|
+
ot as isVuePlugin,
|
|
1563
|
+
st as loadCss,
|
|
1564
|
+
nt as loadCssUrl,
|
|
1565
|
+
rt as loadScriptUrl,
|
|
1566
|
+
dt as mockApi,
|
|
1567
|
+
ft as mockApis,
|
|
1568
|
+
me as mockCleanup,
|
|
1569
|
+
x as nodeRender,
|
|
1570
|
+
et as parseDeps,
|
|
1556
1571
|
C as parseExpression,
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1572
|
+
se as parseFunction,
|
|
1573
|
+
we as providerKey,
|
|
1574
|
+
Ze as removeProdFlag,
|
|
1575
|
+
pe as toString,
|
|
1576
|
+
ht as useAccess,
|
|
1577
|
+
_s as useMask,
|
|
1578
|
+
Se as useProvider
|
|
1564
1579
|
};
|