@vtj/renderer 0.8.170 → 0.8.172
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 +292 -270
- package/package.json +5 -5
- package/types/constants.d.ts +8 -0
- package/types/plugins/access.d.ts +8 -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
|
6
|
-
import { ElNotification 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 Me, loadScript as Z, Request as He, 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
|
+
import { ElNotification as M, 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.172
|
13
13
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
14
14
|
*/
|
15
|
-
const
|
15
|
+
const b = "0.8.172";
|
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,
|
@@ -172,17 +172,17 @@ function te(n, e, t = !1, s = !1) {
|
|
172
172
|
function S(n) {
|
173
173
|
return n && n.type === "JSExpression";
|
174
174
|
}
|
175
|
-
function
|
175
|
+
function H(n) {
|
176
176
|
return typeof n == "object" && n && n.type === "JSFunction";
|
177
177
|
}
|
178
|
-
function
|
179
|
-
return S(n) ||
|
178
|
+
function it(n) {
|
179
|
+
return S(n) || H(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,
|
@@ -191,7 +191,7 @@ const it = be({
|
|
191
191
|
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
192
192
|
failMessage: !0,
|
193
193
|
showError: (n) => {
|
194
|
-
|
194
|
+
M.error({
|
195
195
|
message: n || "未知错误"
|
196
196
|
});
|
197
197
|
},
|
@@ -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,50 +239,51 @@ 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",
|
273
|
-
storagePrefix: "
|
273
|
+
storagePrefix: "__VTJ_",
|
274
274
|
unauthorized: "/unauthorized",
|
275
275
|
auth: "/#/login",
|
276
276
|
redirectParam: "r",
|
277
277
|
unauthorizedCode: 401,
|
278
|
-
unauthorizedMessage: "登录已经失效,请重新登录!"
|
279
|
-
|
280
|
-
|
278
|
+
unauthorizedMessage: "登录已经失效,请重新登录!",
|
279
|
+
noPermissionMessage: "无权限访问该页面"
|
280
|
+
}, ve = Symbol("access");
|
281
|
+
class hs {
|
281
282
|
options;
|
282
283
|
data = null;
|
283
284
|
mode = _.Raw;
|
284
285
|
constructor(e) {
|
285
|
-
this.options = Object.assign({},
|
286
|
+
this.options = Object.assign({}, pt, e), this.loadData();
|
286
287
|
}
|
287
288
|
connect(e) {
|
288
289
|
const { mode: t, router: s, request: r } = e;
|
@@ -290,17 +291,17 @@ class ps {
|
|
290
291
|
}
|
291
292
|
login(e) {
|
292
293
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
293
|
-
this.setData(e), this.data && (
|
294
|
+
this.setData(e), this.data && (T.save(t, e, {
|
294
295
|
type: "local",
|
295
296
|
prefix: s
|
296
|
-
}), r &&
|
297
|
+
}), r && k.set(o, this.data.token));
|
297
298
|
}
|
298
299
|
clear() {
|
299
300
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
300
|
-
this.data = null,
|
301
|
+
this.data = null, T.remove(e, {
|
301
302
|
type: "local",
|
302
303
|
prefix: t
|
303
|
-
}), s &&
|
304
|
+
}), s && k.remove(r);
|
304
305
|
}
|
305
306
|
logout() {
|
306
307
|
this.clear(), this.toLogin();
|
@@ -317,7 +318,7 @@ class ps {
|
|
317
318
|
return Q(e).some((r) => t[r]);
|
318
319
|
}
|
319
320
|
install(e) {
|
320
|
-
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(
|
321
|
+
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(ve, this);
|
321
322
|
}
|
322
323
|
isAuthPath(e) {
|
323
324
|
const { auth: t, isAuth: s } = this.options;
|
@@ -336,12 +337,16 @@ class ps {
|
|
336
337
|
typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
|
337
338
|
}
|
338
339
|
setData(e) {
|
339
|
-
const {
|
340
|
+
const { privateKey: t } = this.options;
|
341
|
+
if (Array.isArray(e) && t) {
|
342
|
+
const s = e.map((r) => X(r, t));
|
343
|
+
this.data = JSON.parse(s.join(""));
|
344
|
+
return;
|
345
|
+
}
|
340
346
|
if (typeof e == "string")
|
341
347
|
try {
|
342
|
-
|
343
|
-
|
344
|
-
);
|
348
|
+
const s = t ? X(e, t) : e;
|
349
|
+
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
345
350
|
} catch (s) {
|
346
351
|
console.warn(s);
|
347
352
|
}
|
@@ -349,7 +354,7 @@ class ps {
|
|
349
354
|
this.data = e;
|
350
355
|
}
|
351
356
|
loadData() {
|
352
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
357
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = T.get(e, {
|
353
358
|
type: "local",
|
354
359
|
prefix: t
|
355
360
|
});
|
@@ -357,18 +362,29 @@ class ps {
|
|
357
362
|
}
|
358
363
|
isLogined() {
|
359
364
|
const { session: e, authKey: t } = this.options;
|
360
|
-
return e && t ? !!
|
365
|
+
return e && t ? !!k.get(t) : !!this.data;
|
361
366
|
}
|
362
367
|
hasRoutePermission(e) {
|
363
|
-
|
364
|
-
|
368
|
+
if (e.name === de) {
|
369
|
+
const t = e.params.id;
|
370
|
+
return t && this.can(t);
|
371
|
+
}
|
372
|
+
return !0;
|
365
373
|
}
|
366
374
|
setGuard(e) {
|
367
375
|
e.beforeEach((t, s, r) => this.guard(t, r));
|
368
376
|
}
|
369
377
|
guard(e, t) {
|
370
|
-
if (this.isWhiteList(e) || this.
|
378
|
+
if (this.isWhiteList(e) || this.isAuthPath(e))
|
371
379
|
return t();
|
380
|
+
if (this.isLogined()) {
|
381
|
+
if (this.hasRoutePermission(e))
|
382
|
+
return t();
|
383
|
+
{
|
384
|
+
const s = this.options.noPermissionMessage || "无权限访问";
|
385
|
+
return this.showTip(s), t(!1);
|
386
|
+
}
|
387
|
+
}
|
372
388
|
t(!1), this.toLogin();
|
373
389
|
}
|
374
390
|
isWhiteList(e) {
|
@@ -380,11 +396,15 @@ class ps {
|
|
380
396
|
return e.status === t || e.data.code === t;
|
381
397
|
}
|
382
398
|
async showUnauthorizedAlert(e) {
|
383
|
-
const {
|
384
|
-
this.isUnauthorized(e) &&
|
399
|
+
const { unauthorizedMessage: t = "登录已失效" } = this.options;
|
400
|
+
this.isUnauthorized(e) && (await this.showTip(t), this.toLogin());
|
401
|
+
}
|
402
|
+
async showTip(e) {
|
403
|
+
const { alert: t } = this.options;
|
404
|
+
t && (await oe(150), await t(e, {
|
385
405
|
title: "提示",
|
386
406
|
type: "warning"
|
387
|
-
}).catch((
|
407
|
+
}).catch((s) => s));
|
388
408
|
}
|
389
409
|
setRequest(e) {
|
390
410
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
@@ -396,10 +416,10 @@ class ps {
|
|
396
416
|
);
|
397
417
|
}
|
398
418
|
}
|
399
|
-
function
|
400
|
-
return
|
419
|
+
function ht() {
|
420
|
+
return ie(ve, null);
|
401
421
|
}
|
402
|
-
class
|
422
|
+
class mt {
|
403
423
|
__id = null;
|
404
424
|
__mode;
|
405
425
|
__instance = null;
|
@@ -428,7 +448,7 @@ class ht {
|
|
428
448
|
const { mode: t, dsl: s, attrs: r } = e;
|
429
449
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
430
450
|
}
|
431
|
-
setup(e, t =
|
451
|
+
setup(e, t = D) {
|
432
452
|
const s = t.getCurrentInstance();
|
433
453
|
if (!s) return;
|
434
454
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -442,12 +462,12 @@ class ht {
|
|
442
462
|
});
|
443
463
|
}
|
444
464
|
__proxy() {
|
445
|
-
this.__instance &&
|
465
|
+
this.__instance && te.forEach((e) => {
|
446
466
|
this[e] = this.__instance?.[e];
|
447
467
|
});
|
448
468
|
}
|
449
469
|
__cleanup() {
|
450
|
-
|
470
|
+
te.forEach((e) => {
|
451
471
|
this[e] = null;
|
452
472
|
});
|
453
473
|
}
|
@@ -455,9 +475,9 @@ class ht {
|
|
455
475
|
if (e)
|
456
476
|
if (this.__mode === _.Runtime) {
|
457
477
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
458
|
-
return
|
478
|
+
return se({ type: s, value: r }, this);
|
459
479
|
} else
|
460
|
-
return
|
480
|
+
return se(e, this);
|
461
481
|
}
|
462
482
|
__parseExpression(e) {
|
463
483
|
if (e)
|
@@ -470,7 +490,7 @@ class ht {
|
|
470
490
|
__ref(e = null, t) {
|
471
491
|
if (this.__mode !== _.VNode)
|
472
492
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
473
|
-
await
|
493
|
+
await oe(0);
|
474
494
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
475
495
|
if (!r) {
|
476
496
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
@@ -499,7 +519,7 @@ class ht {
|
|
499
519
|
}
|
500
520
|
function N(n) {
|
501
521
|
const {
|
502
|
-
Vue: e =
|
522
|
+
Vue: e = D,
|
503
523
|
mode: t = _.Runtime,
|
504
524
|
components: s = {},
|
505
525
|
libs: r = {},
|
@@ -509,22 +529,22 @@ function N(n) {
|
|
509
529
|
$components: s,
|
510
530
|
$libs: r,
|
511
531
|
$apis: o
|
512
|
-
}, c = new
|
532
|
+
}, c = new mt({
|
513
533
|
mode: t,
|
514
534
|
dsl: i.value,
|
515
535
|
attrs: u
|
516
536
|
}), p = e.defineComponent({
|
517
537
|
name: i.value.name,
|
518
538
|
props: {
|
519
|
-
...
|
539
|
+
...gt(i.value.props ?? [], c)
|
520
540
|
},
|
521
541
|
setup(l) {
|
522
|
-
c.$props = l, c.props = l, i.value.id &&
|
542
|
+
c.$props = l, c.props = l, i.value.id && he(
|
523
543
|
n.window || window,
|
524
544
|
i.value.id,
|
525
545
|
i.value.css || ""
|
526
|
-
), c.state =
|
527
|
-
const f =
|
546
|
+
), c.state = yt(e, i.value.state ?? {}, c);
|
547
|
+
const f = _t(e, i.value.computed ?? {}, c), m = wt(i.value.methods ?? {}, c), d = St(e, i.value.inject, c), h = $t(
|
528
548
|
i.value.dataSources || {},
|
529
549
|
c
|
530
550
|
), w = {
|
@@ -533,28 +553,28 @@ function N(n) {
|
|
533
553
|
...m,
|
534
554
|
...h
|
535
555
|
};
|
536
|
-
return c.setup(w, e),
|
556
|
+
return c.setup(w, e), jt(e, i.value.watch ?? [], c), {
|
537
557
|
vtj: c
|
538
558
|
};
|
539
559
|
},
|
540
|
-
emits:
|
560
|
+
emits: vt(i.value.emits),
|
541
561
|
expose: ["vtj"],
|
542
562
|
render() {
|
543
563
|
if (!i.value.nodes) return null;
|
544
564
|
const l = i.value.nodes || [];
|
545
|
-
return l.length === 1 ?
|
565
|
+
return l.length === 1 ? x(l[0], c, e, a) : l.map((f) => x(f, c, e, a));
|
546
566
|
},
|
547
|
-
...
|
567
|
+
...Et(i.value.lifeCycles ?? {}, c)
|
548
568
|
});
|
549
569
|
return {
|
550
570
|
renderer: e.markRaw(p),
|
551
571
|
context: c
|
552
572
|
};
|
553
573
|
}
|
554
|
-
function
|
574
|
+
function vt(n = []) {
|
555
575
|
return n.map((e) => $(e) ? e : e.name);
|
556
576
|
}
|
557
|
-
function
|
577
|
+
function gt(n = [], e) {
|
558
578
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => Ye[o]) : void 0;
|
559
579
|
return n.map((s) => $(s) ? {
|
560
580
|
name: s
|
@@ -572,30 +592,30 @@ function vt(n = [], e) {
|
|
572
592
|
{}
|
573
593
|
);
|
574
594
|
}
|
575
|
-
function
|
595
|
+
function yt(n, e, t) {
|
576
596
|
return n.reactive(
|
577
597
|
Object.keys(e || {}).reduce(
|
578
598
|
(s, r) => {
|
579
599
|
let o = e[r];
|
580
|
-
return S(o) ? o = t.__parseExpression(o) :
|
600
|
+
return S(o) ? o = t.__parseExpression(o) : H(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
581
601
|
},
|
582
602
|
{}
|
583
603
|
)
|
584
604
|
);
|
585
605
|
}
|
586
|
-
function
|
606
|
+
function _t(n, e, t) {
|
587
607
|
return Object.entries(e ?? {}).reduce(
|
588
608
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
589
609
|
{}
|
590
610
|
);
|
591
611
|
}
|
592
|
-
function
|
612
|
+
function wt(n, e) {
|
593
613
|
return Object.entries(n ?? {}).reduce(
|
594
614
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
595
615
|
{}
|
596
616
|
);
|
597
617
|
}
|
598
|
-
function
|
618
|
+
function St(n, e = [], t) {
|
599
619
|
return e.reduce(
|
600
620
|
(s, r) => {
|
601
621
|
const { name: o, from: a } = r || {};
|
@@ -606,10 +626,10 @@ function wt(n, e = [], t) {
|
|
606
626
|
{}
|
607
627
|
);
|
608
628
|
}
|
609
|
-
function
|
629
|
+
function $t(n, e) {
|
610
630
|
return Object.keys(n).reduce(
|
611
631
|
(t, s) => {
|
612
|
-
const r = n[s], o = e.$apis[r.ref], a =
|
632
|
+
const r = n[s], o = e.$apis[r.ref], a = H(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
613
633
|
return t[s] = async (...i) => {
|
614
634
|
const u = await o.apply(e, i);
|
615
635
|
return a ? a(u) : u;
|
@@ -618,7 +638,7 @@ function St(n, e) {
|
|
618
638
|
{}
|
619
639
|
);
|
620
640
|
}
|
621
|
-
function
|
641
|
+
function jt(n, e = [], t) {
|
622
642
|
e.forEach((s) => {
|
623
643
|
n.watch(
|
624
644
|
t.__parseExpression(s.source),
|
@@ -630,27 +650,27 @@ function $t(n, e = [], t) {
|
|
630
650
|
);
|
631
651
|
});
|
632
652
|
}
|
633
|
-
function
|
653
|
+
function Et(n, e) {
|
634
654
|
return Object.entries(n ?? {}).reduce(
|
635
655
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
636
656
|
{}
|
637
657
|
);
|
638
658
|
}
|
639
|
-
let
|
640
|
-
const
|
641
|
-
async function
|
659
|
+
let U = [];
|
660
|
+
const Pt = (n) => n;
|
661
|
+
async function ge(n, e = window) {
|
642
662
|
const { urls: t = [], library: s } = n, r = t.filter((i) => z(i));
|
643
663
|
if (r.length === 0 || !s) return null;
|
644
664
|
const o = t.filter((i) => V(i));
|
645
|
-
return o.length &&
|
665
|
+
return o.length && nt(o, e), await rt(r, s, e).catch(
|
646
666
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
647
667
|
);
|
648
668
|
}
|
649
669
|
function L(n) {
|
650
670
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
651
|
-
return s.window && (
|
671
|
+
return s.window && (U.forEach((r) => {
|
652
672
|
delete s.window[r];
|
653
|
-
}),
|
673
|
+
}), U = []), (r, o, a = D) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
654
674
|
const i = await e(o.id);
|
655
675
|
return i && (i.name = r), i ? N({
|
656
676
|
...s,
|
@@ -668,33 +688,33 @@ function L(n) {
|
|
668
688
|
mode: _.Runtime,
|
669
689
|
loader: L(n)
|
670
690
|
}).renderer : null;
|
671
|
-
}) : o.type === "Plugin" ? (o.library &&
|
672
|
-
const i = await
|
691
|
+
}) : o.type === "Plugin" ? (o.library && U.push(o.library), a.defineAsyncComponent(async () => {
|
692
|
+
const i = await ge(o, s.window);
|
673
693
|
return i || (console.warn("getPlugin result is null", o), null);
|
674
694
|
})) : r;
|
675
695
|
}
|
676
|
-
function
|
696
|
+
function x(n, e, t = D, s = Pt) {
|
677
697
|
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 } =
|
698
|
+
const { id: r = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: u, vModels: c, vBind: p } = Rt(o);
|
679
699
|
if (a && !bt(a, e))
|
680
700
|
return null;
|
681
701
|
const l = (f) => {
|
682
702
|
const m = f.$components, d = (() => {
|
683
703
|
if (n.name === "component")
|
684
|
-
return
|
704
|
+
return Ct(f, n.props?.is);
|
685
705
|
if (n.name === "slot") return n.name;
|
686
706
|
const g = s(n.name, n.from, t);
|
687
707
|
return $(g) ? m[g] ?? g : g;
|
688
|
-
})(), h =
|
708
|
+
})(), h = Ft(r, n.props ?? {}, f), w = At(t, n.events ?? {}, f);
|
689
709
|
if (n.name === "slot")
|
690
|
-
return
|
710
|
+
return It(t, n, h, f, s);
|
691
711
|
p && Object.assign(h, f.__parseExpression(p.value)), u && (h.style = Object.assign(
|
692
712
|
h.style ?? {},
|
693
|
-
|
713
|
+
xt(u, f)
|
694
714
|
)), c.forEach((g) => {
|
695
|
-
Object.assign(h,
|
715
|
+
Object.assign(h, Dt(t, g, f));
|
696
716
|
});
|
697
|
-
const v =
|
717
|
+
const v = Mt(
|
698
718
|
t,
|
699
719
|
n.children ?? [],
|
700
720
|
f,
|
@@ -705,7 +725,7 @@ function A(n, e, t = O, s = Et) {
|
|
705
725
|
};
|
706
726
|
return i ? kt(i, l, e) : l(e);
|
707
727
|
}
|
708
|
-
function
|
728
|
+
function Rt(n = []) {
|
709
729
|
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
730
|
(i) => !Ge.includes(j(i.name))
|
711
731
|
);
|
@@ -721,20 +741,20 @@ function Pt(n = []) {
|
|
721
741
|
function bt(n, e) {
|
722
742
|
return !!e.__parseExpression(n.value);
|
723
743
|
}
|
724
|
-
function
|
744
|
+
function Ct(n, e) {
|
725
745
|
return e ? S(e) ? n.__parseExpression(e) : e : "div";
|
726
746
|
}
|
727
|
-
function
|
747
|
+
function Ft(n, e, t) {
|
728
748
|
const s = Object.keys(e || {}).reduce(
|
729
749
|
(r, o) => {
|
730
750
|
let a = e[o];
|
731
|
-
return S(a) ? a = t.__parseExpression(a) :
|
751
|
+
return S(a) ? a = t.__parseExpression(a) : H(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
732
752
|
},
|
733
753
|
{}
|
734
754
|
);
|
735
755
|
return s.ref = t.__ref(n, s.ref), s;
|
736
756
|
}
|
737
|
-
function
|
757
|
+
function At(n, e, t) {
|
738
758
|
const s = ["passive", "capture", "once"], r = {
|
739
759
|
capture: "Capture",
|
740
760
|
once: "Once",
|
@@ -742,64 +762,64 @@ function Ft(n, e, t) {
|
|
742
762
|
};
|
743
763
|
return Object.keys(e || {}).reduce(
|
744
764
|
(o, a) => {
|
745
|
-
const i = e[a], u =
|
765
|
+
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
766
|
return l && (o[p] = n.withModifiers(l, u)), o;
|
747
767
|
},
|
748
768
|
{}
|
749
769
|
);
|
750
770
|
}
|
751
|
-
function
|
771
|
+
function ye(n = {}, e = !1) {
|
752
772
|
const t = Object.keys(n);
|
753
773
|
return e ? t.map((s) => "." + s) : t;
|
754
774
|
}
|
755
|
-
function
|
756
|
-
const { children: o } = e, a =
|
775
|
+
function It(n, e, t, s, r) {
|
776
|
+
const { children: o } = e, a = Ot(e, s), i = s.$slots?.[a.name];
|
757
777
|
return i ? i(t) : o ? $(o) ? n.createTextVNode(o) : S(o) ? n.createTextVNode(
|
758
|
-
|
778
|
+
pe(s.__parseExpression(o))
|
759
779
|
) : Array.isArray(o) ? o.map(
|
760
|
-
(u) =>
|
780
|
+
(u) => x(u, s, n, r)
|
761
781
|
) : null : null;
|
762
782
|
}
|
763
|
-
function
|
783
|
+
function Ot(n, e) {
|
764
784
|
const { props: t } = n, s = t?.name || "default";
|
765
785
|
return {
|
766
786
|
name: S(s) ? e.__parseExpression(s) : s,
|
767
787
|
params: []
|
768
788
|
};
|
769
789
|
}
|
770
|
-
function
|
790
|
+
function xt(n, e) {
|
771
791
|
return e.__parseExpression(n.value) ? {} : {
|
772
792
|
display: "none"
|
773
793
|
};
|
774
794
|
}
|
775
|
-
function
|
795
|
+
function Dt(n, e, t) {
|
776
796
|
const s = {
|
777
797
|
type: "JSFunction",
|
778
798
|
value: e.value?.value ? `(v) => {
|
779
799
|
${e.value.value} = v;
|
780
800
|
}` : "(v) => {}"
|
781
|
-
}, r = t.__parseFunction(s), o =
|
801
|
+
}, r = t.__parseFunction(s), o = ye(e.modifiers), a = S(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
782
802
|
return {
|
783
803
|
[a]: t.__parseExpression(e.value),
|
784
804
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
785
805
|
};
|
786
806
|
}
|
787
|
-
function
|
807
|
+
function Mt(n, e, t, s, r) {
|
788
808
|
if (!e) return null;
|
789
809
|
if ($(e))
|
790
810
|
return { default: () => e };
|
791
811
|
if (S(e))
|
792
812
|
return {
|
793
|
-
default: () =>
|
813
|
+
default: () => pe(t.__parseExpression(e))
|
794
814
|
};
|
795
815
|
if (Array.isArray(e) && e.length > 0) {
|
796
816
|
const o = Ht(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
797
817
|
[`scope_${r.id}`]: i
|
798
818
|
} : {};
|
799
819
|
return Object.entries(o).reduce((i, [u, { nodes: c, params: p }]) => (i[u] = (l) => {
|
800
|
-
const f = p.length ?
|
820
|
+
const f = p.length ? De(l ?? {}, p) : a(l);
|
801
821
|
return c.map(
|
802
|
-
(m) =>
|
822
|
+
(m) => x(m, t.__clone(f), n, s)
|
803
823
|
);
|
804
824
|
}, i), {});
|
805
825
|
}
|
@@ -813,7 +833,7 @@ function Ht(n) {
|
|
813
833
|
}
|
814
834
|
};
|
815
835
|
for (const t of n) {
|
816
|
-
const s =
|
836
|
+
const s = Tt(t.slot), r = s.name;
|
817
837
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
818
838
|
nodes: [t],
|
819
839
|
params: s.params
|
@@ -821,7 +841,7 @@ function Ht(n) {
|
|
821
841
|
}
|
822
842
|
return e;
|
823
843
|
}
|
824
|
-
function
|
844
|
+
function Tt(n = "default") {
|
825
845
|
return $(n) ? { name: n, params: [] } : { params: [], ...n };
|
826
846
|
}
|
827
847
|
function kt(n, e, t) {
|
@@ -829,53 +849,53 @@ function kt(n, e, t) {
|
|
829
849
|
let i = t.__parseExpression(s) || [];
|
830
850
|
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
851
|
}
|
832
|
-
function
|
852
|
+
function Ut(n) {
|
833
853
|
return Le() ? (qe(n), !0) : !1;
|
834
854
|
}
|
835
855
|
function K(n) {
|
836
856
|
return typeof n == "function" ? n() : Je(n);
|
837
857
|
}
|
838
|
-
const
|
858
|
+
const _e = typeof window < "u" && typeof document < "u";
|
839
859
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
840
|
-
const Bt = (n) => n != null,
|
860
|
+
const Bt = (n) => n != null, Nt = () => {
|
841
861
|
};
|
842
|
-
function
|
843
|
-
return
|
862
|
+
function Lt(n) {
|
863
|
+
return ae();
|
844
864
|
}
|
845
|
-
function
|
865
|
+
function qt(...n) {
|
846
866
|
if (n.length !== 1)
|
847
|
-
return
|
867
|
+
return ke(...n);
|
848
868
|
const e = n[0];
|
849
|
-
return typeof e == "function" ? Be(
|
869
|
+
return typeof e == "function" ? Ue(Be(() => ({ get: e, set: Nt }))) : J(e);
|
850
870
|
}
|
851
|
-
function
|
852
|
-
|
871
|
+
function Jt(n, e) {
|
872
|
+
Lt() && Ne(n, e);
|
853
873
|
}
|
854
|
-
const
|
855
|
-
function
|
874
|
+
const Vt = _e ? window : void 0, zt = _e ? window.document : void 0;
|
875
|
+
function Kt(n) {
|
856
876
|
var e;
|
857
877
|
const t = K(n);
|
858
878
|
return (e = t?.$el) != null ? e : t;
|
859
879
|
}
|
860
|
-
function
|
861
|
-
const n = J(!1), e =
|
880
|
+
function Wt() {
|
881
|
+
const n = J(!1), e = ae();
|
862
882
|
return e && Ve(() => {
|
863
883
|
n.value = !0;
|
864
884
|
}, e), n;
|
865
885
|
}
|
866
|
-
function
|
867
|
-
const e =
|
868
|
-
return
|
886
|
+
function Gt(n) {
|
887
|
+
const e = Wt();
|
888
|
+
return ue(() => (e.value, !!n()));
|
869
889
|
}
|
870
|
-
function
|
871
|
-
const { window: s =
|
890
|
+
function Yt(n, e, t = {}) {
|
891
|
+
const { window: s = Vt, ...r } = t;
|
872
892
|
let o;
|
873
|
-
const a =
|
893
|
+
const a = Gt(() => s && "MutationObserver" in s), i = () => {
|
874
894
|
o && (o.disconnect(), o = void 0);
|
875
|
-
}, u =
|
876
|
-
const f = K(n), m = (Array.isArray(f) ? f : [f]).map(
|
895
|
+
}, u = ue(() => {
|
896
|
+
const f = K(n), m = (Array.isArray(f) ? f : [f]).map(Kt).filter(Bt);
|
877
897
|
return new Set(m);
|
878
|
-
}), c =
|
898
|
+
}), c = ce(
|
879
899
|
() => u.value,
|
880
900
|
(f) => {
|
881
901
|
i(), a.value && f.size && (o = new MutationObserver(e), f.forEach((m) => o.observe(m, r)));
|
@@ -884,48 +904,48 @@ function Gt(n, e, t = {}) {
|
|
884
904
|
), p = () => o?.takeRecords(), l = () => {
|
885
905
|
c(), i();
|
886
906
|
};
|
887
|
-
return
|
907
|
+
return Ut(l), {
|
888
908
|
isSupported: a,
|
889
909
|
stop: l,
|
890
910
|
takeRecords: p
|
891
911
|
};
|
892
912
|
}
|
893
|
-
function
|
913
|
+
function Qt(n = null, e = {}) {
|
894
914
|
var t, s, r;
|
895
915
|
const {
|
896
|
-
document: o =
|
916
|
+
document: o = zt,
|
897
917
|
restoreOnUnmount: a = (l) => l
|
898
|
-
} = e, i = (t = o?.title) != null ? t : "", u =
|
918
|
+
} = e, i = (t = o?.title) != null ? t : "", u = qt((s = n ?? o?.title) != null ? s : null), c = n && typeof n == "function";
|
899
919
|
function p(l) {
|
900
920
|
if (!("titleTemplate" in e))
|
901
921
|
return l;
|
902
922
|
const f = e.titleTemplate || "%s";
|
903
923
|
return typeof f == "function" ? f(l) : K(f).replace(/%s/g, l);
|
904
924
|
}
|
905
|
-
return
|
925
|
+
return ce(
|
906
926
|
u,
|
907
927
|
(l, f) => {
|
908
928
|
l !== f && o && (o.title = p(typeof l == "string" ? l : ""));
|
909
929
|
},
|
910
930
|
{ immediate: !0 }
|
911
|
-
), e.observe && !e.titleTemplate && o && !c &&
|
931
|
+
), e.observe && !e.titleTemplate && o && !c && Yt(
|
912
932
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
913
933
|
() => {
|
914
934
|
o && o.title !== u.value && (u.value = p(o.title));
|
915
935
|
},
|
916
936
|
{ childList: !0 }
|
917
|
-
),
|
937
|
+
), Jt(() => {
|
918
938
|
if (a) {
|
919
939
|
const l = a(i, u.value || "");
|
920
940
|
l != null && o && (o.title = l);
|
921
941
|
}
|
922
942
|
}), u;
|
923
943
|
}
|
924
|
-
const
|
944
|
+
const ne = le({
|
925
945
|
name: "VtjPageContainer",
|
926
946
|
async setup() {
|
927
|
-
const n =
|
928
|
-
return s &&
|
947
|
+
const n = Se(), e = fe(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null;
|
948
|
+
return s && Qt(s.title || "VTJ"), {
|
929
949
|
provider: n,
|
930
950
|
component: r,
|
931
951
|
file: s,
|
@@ -933,16 +953,16 @@ const se = ue({
|
|
933
953
|
};
|
934
954
|
},
|
935
955
|
render() {
|
936
|
-
return this.component ?
|
956
|
+
return this.component ? B(this.component, this.query) : B("div", "页面不存在");
|
937
957
|
}
|
938
|
-
}),
|
958
|
+
}), Xt = le({
|
939
959
|
name: "VtjStartupContainer",
|
940
960
|
render() {
|
941
|
-
return
|
961
|
+
return B(We);
|
942
962
|
}
|
943
|
-
}),
|
944
|
-
var
|
945
|
-
class
|
963
|
+
}), we = Symbol("Provider");
|
964
|
+
var Zt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Zt || {});
|
965
|
+
class es extends Ee {
|
946
966
|
constructor(e) {
|
947
967
|
super(), this.options = e;
|
948
968
|
const {
|
@@ -966,7 +986,7 @@ class Zt extends $e {
|
|
966
986
|
mode;
|
967
987
|
globals = {};
|
968
988
|
modules = {};
|
969
|
-
adapter = { request:
|
989
|
+
adapter = { request: at, jsonp: Me };
|
970
990
|
apis = {};
|
971
991
|
dependencies = {};
|
972
992
|
materials = {};
|
@@ -983,7 +1003,7 @@ class Zt extends $e {
|
|
983
1003
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
984
1004
|
throw new Error("project is null");
|
985
1005
|
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 =
|
1006
|
+
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
1007
|
}
|
988
1008
|
async loadDependencies(e) {
|
989
1009
|
const t = Object.entries(this.dependencies);
|
@@ -997,7 +1017,7 @@ class Zt extends $e {
|
|
997
1017
|
materials: p,
|
998
1018
|
materialExports: l,
|
999
1019
|
materialMapLibrary: f
|
1000
|
-
} =
|
1020
|
+
} = et(
|
1001
1021
|
t,
|
1002
1022
|
a,
|
1003
1023
|
i === "development"
|
@@ -1012,15 +1032,15 @@ class Zt extends $e {
|
|
1012
1032
|
else {
|
1013
1033
|
const v = c[d] || [];
|
1014
1034
|
for (const g of v)
|
1015
|
-
V(g) && await
|
1035
|
+
V(g) && await st(d, R.append(g, { v: b })), z(g) && await Z(R.append(g, { v: b }));
|
1016
1036
|
r[d] = e[d];
|
1017
1037
|
}
|
1018
1038
|
}
|
1019
1039
|
for (const d of p)
|
1020
|
-
await
|
1040
|
+
await Z(R.append(d, { v: b }));
|
1021
1041
|
const m = this.materials || {};
|
1022
1042
|
for (const d of l) {
|
1023
|
-
const h = e[f[d]], w =
|
1043
|
+
const h = e[f[d]], w = Pe[d];
|
1024
1044
|
if (w)
|
1025
1045
|
h && w.forEach((v) => {
|
1026
1046
|
o[v] = h[v];
|
@@ -1028,7 +1048,7 @@ class Zt extends $e {
|
|
1028
1048
|
else {
|
1029
1049
|
const v = m[d] ? (await m[d]()).default : e[d];
|
1030
1050
|
v && h && (v.components || []).forEach((g) => {
|
1031
|
-
o[g.name] =
|
1051
|
+
o[g.name] = tt(g, h);
|
1032
1052
|
});
|
1033
1053
|
}
|
1034
1054
|
}
|
@@ -1037,19 +1057,19 @@ class Zt extends $e {
|
|
1037
1057
|
const { router: e, project: t } = this;
|
1038
1058
|
e && (e.addRoute({
|
1039
1059
|
path: "/page/:id",
|
1040
|
-
name:
|
1041
|
-
component:
|
1060
|
+
name: de,
|
1061
|
+
component: ne
|
1042
1062
|
}), e.addRoute({
|
1043
1063
|
path: "/",
|
1044
|
-
name:
|
1045
|
-
component: t?.homepage ?
|
1064
|
+
name: Qe,
|
1065
|
+
component: t?.homepage ? ne : Xt
|
1046
1066
|
}));
|
1047
1067
|
}
|
1048
1068
|
install(e) {
|
1049
1069
|
const t = e.config.globalProperties.installed || {};
|
1050
1070
|
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(
|
1071
|
+
!t[s] && ot(r) && (e.use(r), t[s] = !0);
|
1072
|
+
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
1073
|
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", u = `[ ${a} ] ${i} ${o}`;
|
1054
1074
|
console.error(
|
1055
1075
|
"[VTJ Error]:",
|
@@ -1059,7 +1079,7 @@ class Zt extends $e {
|
|
1059
1079
|
info: o
|
1060
1080
|
},
|
1061
1081
|
s?.stack
|
1062
|
-
),
|
1082
|
+
), M.error({
|
1063
1083
|
title: "未处理的异常:请在控制台查看详情",
|
1064
1084
|
message: u
|
1065
1085
|
});
|
@@ -1125,39 +1145,39 @@ class Zt extends $e {
|
|
1125
1145
|
async getRenderComponent(e) {
|
1126
1146
|
const t = this.getFile(e);
|
1127
1147
|
if (!t)
|
1128
|
-
return
|
1148
|
+
return O.warn(`Can not find file: ${e}`), null;
|
1129
1149
|
const s = `.vtj/vue/${e}.vue`, r = this.modules[s];
|
1130
1150
|
if (r)
|
1131
1151
|
return (await r())?.default;
|
1132
1152
|
const o = await this.getDsl(t.id);
|
1133
|
-
return o ? this.createDslRenderer(o).renderer : (
|
1153
|
+
return o ? this.createDslRenderer(o).renderer : (O.warn(`Can not find dsl: ${e}`), null);
|
1134
1154
|
}
|
1135
1155
|
defineUrlSchemaComponent(e, t) {
|
1136
|
-
return
|
1156
|
+
return ee(async () => {
|
1137
1157
|
const s = await this.getDslByUrl(e);
|
1138
1158
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1139
1159
|
});
|
1140
1160
|
}
|
1141
1161
|
definePluginComponent(e) {
|
1142
|
-
return
|
1162
|
+
return ee(async () => await ge(e, window));
|
1143
1163
|
}
|
1144
1164
|
}
|
1145
|
-
function
|
1146
|
-
const e = new
|
1165
|
+
function ms(n) {
|
1166
|
+
const e = new es(n);
|
1147
1167
|
return {
|
1148
1168
|
provider: e,
|
1149
1169
|
onReady: (s) => e.ready(s)
|
1150
1170
|
};
|
1151
1171
|
}
|
1152
|
-
function
|
1153
|
-
const e =
|
1172
|
+
function Se(n = {}) {
|
1173
|
+
const e = ie(we);
|
1154
1174
|
if (!e)
|
1155
1175
|
throw new Error("Can not find provider");
|
1156
1176
|
if (e.nodeEnv === "development") {
|
1157
1177
|
const { id: t, version: s } = n;
|
1158
1178
|
t && s && (async () => {
|
1159
1179
|
const r = await e.getDsl(t);
|
1160
|
-
r?.__VERSION__ !== s &&
|
1180
|
+
r?.__VERSION__ !== s && M.warning({
|
1161
1181
|
title: r?.name,
|
1162
1182
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
1163
1183
|
});
|
@@ -1165,7 +1185,7 @@ function _e(n = {}) {
|
|
1165
1185
|
}
|
1166
1186
|
return e;
|
1167
1187
|
}
|
1168
|
-
const W = new
|
1188
|
+
const W = new He({
|
1169
1189
|
settings: {
|
1170
1190
|
type: "json",
|
1171
1191
|
validSuccess: !0,
|
@@ -1173,12 +1193,12 @@ const W = new Me({
|
|
1173
1193
|
failMessage: !0,
|
1174
1194
|
validate: (n) => n.data?.code === 0,
|
1175
1195
|
showError: (n) => {
|
1176
|
-
|
1196
|
+
M.error({
|
1177
1197
|
message: n || "未知错误"
|
1178
1198
|
});
|
1179
1199
|
}
|
1180
1200
|
}
|
1181
|
-
}),
|
1201
|
+
}), ts = (n = "/__vtj__/api/:type.json") => (e, t) => W.send({
|
1182
1202
|
url: n,
|
1183
1203
|
method: "post",
|
1184
1204
|
params: { type: e },
|
@@ -1186,7 +1206,7 @@ const W = new Me({
|
|
1186
1206
|
type: e,
|
1187
1207
|
data: t
|
1188
1208
|
}
|
1189
|
-
}),
|
1209
|
+
}), ss = (n = "/__vtj__/api/uploader.json") => async (e, t) => await W.send({
|
1190
1210
|
url: n,
|
1191
1211
|
method: "post",
|
1192
1212
|
data: {
|
@@ -1202,7 +1222,7 @@ class G {
|
|
1202
1222
|
pluginCaches = {};
|
1203
1223
|
uploader;
|
1204
1224
|
constructor() {
|
1205
|
-
this.api =
|
1225
|
+
this.api = ts(), this.uploader = ss();
|
1206
1226
|
}
|
1207
1227
|
async getExtension() {
|
1208
1228
|
console.log("BaseService.getExtension");
|
@@ -1275,7 +1295,7 @@ class G {
|
|
1275
1295
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1276
1296
|
}
|
1277
1297
|
async getPluginMaterial(e) {
|
1278
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
1298
|
+
const { urls: t = [] } = e, s = t.filter((o) => Xe(o))[0];
|
1279
1299
|
if (!s) return null;
|
1280
1300
|
const r = this.pluginCaches[s];
|
1281
1301
|
return r || (this.pluginCaches[s] = W.send({
|
@@ -1288,12 +1308,12 @@ class G {
|
|
1288
1308
|
}).then((o) => o.data).catch(() => null));
|
1289
1309
|
}
|
1290
1310
|
}
|
1291
|
-
const y = new
|
1311
|
+
const y = new Te({
|
1292
1312
|
type: "local",
|
1293
1313
|
expired: 0,
|
1294
1314
|
prefix: "__VTJ_"
|
1295
1315
|
});
|
1296
|
-
class
|
1316
|
+
class vs extends G {
|
1297
1317
|
init(e) {
|
1298
1318
|
const t = new I(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1299
1319
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
@@ -1327,7 +1347,7 @@ class ms extends G {
|
|
1327
1347
|
return Promise.resolve(!0);
|
1328
1348
|
}
|
1329
1349
|
getHistory(e) {
|
1330
|
-
const t = y.get(`history_${e}`), s = new
|
1350
|
+
const t = y.get(`history_${e}`), s = new re(t || { id: e });
|
1331
1351
|
return Promise.resolve(s.toDsl());
|
1332
1352
|
}
|
1333
1353
|
getHistoryItem(e, t) {
|
@@ -1343,7 +1363,7 @@ class ms extends G {
|
|
1343
1363
|
}), Promise.resolve(!0);
|
1344
1364
|
}
|
1345
1365
|
}
|
1346
|
-
class
|
1366
|
+
class ns extends G {
|
1347
1367
|
projects = {};
|
1348
1368
|
materials = {};
|
1349
1369
|
files = {};
|
@@ -1382,7 +1402,7 @@ class ss extends G {
|
|
1382
1402
|
return Promise.resolve(!0);
|
1383
1403
|
}
|
1384
1404
|
getHistory(e) {
|
1385
|
-
const t = this.histories[e], s = new
|
1405
|
+
const t = this.histories[e], s = new re(t || { id: e });
|
1386
1406
|
return Promise.resolve(s);
|
1387
1407
|
}
|
1388
1408
|
getHistoryItem(e, t) {
|
@@ -1400,11 +1420,11 @@ class ss extends G {
|
|
1400
1420
|
}), Promise.resolve(!0);
|
1401
1421
|
}
|
1402
1422
|
}
|
1403
|
-
let
|
1404
|
-
function
|
1405
|
-
return
|
1423
|
+
let A = null;
|
1424
|
+
function gs() {
|
1425
|
+
return A || (A = new ns(), A);
|
1406
1426
|
}
|
1407
|
-
class
|
1427
|
+
class ys extends G {
|
1408
1428
|
getFileCaches = {};
|
1409
1429
|
async getExtension() {
|
1410
1430
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1459,7 +1479,7 @@ class gs extends G {
|
|
1459
1479
|
);
|
1460
1480
|
}
|
1461
1481
|
}
|
1462
|
-
function
|
1482
|
+
function $e(n = []) {
|
1463
1483
|
return n.map((e) => {
|
1464
1484
|
const { id: t, title: s, icon: r, children: o, hidden: a } = e;
|
1465
1485
|
return {
|
@@ -1468,23 +1488,23 @@ function we(n = []) {
|
|
1468
1488
|
icon: r,
|
1469
1489
|
hidden: a,
|
1470
1490
|
url: `/page/${t}`,
|
1471
|
-
children: o && o.length ?
|
1491
|
+
children: o && o.length ? $e(o) : void 0
|
1472
1492
|
};
|
1473
1493
|
});
|
1474
1494
|
}
|
1475
|
-
function
|
1495
|
+
function je(n, e) {
|
1476
1496
|
if (!e) return n;
|
1477
1497
|
let t = [];
|
1478
1498
|
for (const s of n)
|
1479
1499
|
if (s.children && s.children.length) {
|
1480
|
-
const r =
|
1500
|
+
const r = je(s.children, e);
|
1481
1501
|
r.length && (s.children = r, t.push(s));
|
1482
1502
|
} else
|
1483
1503
|
e[s.id] && t.push(s);
|
1484
1504
|
return t;
|
1485
1505
|
}
|
1486
|
-
function
|
1487
|
-
const n =
|
1506
|
+
function _s() {
|
1507
|
+
const n = Se(), e = fe(), t = ht(), s = J(!1), r = t?.getData(), o = n.project;
|
1488
1508
|
ze(() => {
|
1489
1509
|
const { name: u, params: c, meta: p } = e;
|
1490
1510
|
if (u === "VtjPage") {
|
@@ -1496,69 +1516,71 @@ function ys() {
|
|
1496
1516
|
} else
|
1497
1517
|
s.value = !p.mask;
|
1498
1518
|
});
|
1499
|
-
const a =
|
1519
|
+
const a = $e(o?.pages), i = o?.config;
|
1500
1520
|
return {
|
1501
1521
|
disabled: s,
|
1502
1522
|
logo: i?.logo,
|
1503
1523
|
themeSwitchable: i?.themeSwitchable,
|
1504
1524
|
title: i?.title || o?.description || o?.name || "VTJ App",
|
1505
|
-
menus:
|
1525
|
+
menus: je(a, r?.permissions)
|
1506
1526
|
};
|
1507
1527
|
}
|
1508
1528
|
export {
|
1509
|
-
|
1510
|
-
|
1529
|
+
ve as ACCESS_KEY,
|
1530
|
+
hs as Access,
|
1511
1531
|
Ge as BUILT_IN_DIRECTIVES,
|
1512
1532
|
G as BaseService,
|
1513
|
-
|
1514
|
-
|
1533
|
+
te as CONTEXT_HOST,
|
1534
|
+
mt as Context,
|
1515
1535
|
_ as ContextMode,
|
1516
1536
|
Ye as DATA_TYPES,
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
Zt as
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1537
|
+
Qe as HOMEPAGE_ROUTE_NAME,
|
1538
|
+
ps as JSCodeToString,
|
1539
|
+
ls as LIFE_CYCLES_LIST,
|
1540
|
+
ys as LocalService,
|
1541
|
+
ns as MemoryService,
|
1542
|
+
Zt as NodeEnv,
|
1543
|
+
de as PAGE_ROUTE_NAME,
|
1544
|
+
es as Provider,
|
1545
|
+
vs as StorageService,
|
1546
|
+
b as VTJ_RENDERER_VERSION,
|
1547
|
+
he as adoptedStyleSheets,
|
1548
|
+
fs as createAssetScripts,
|
1549
|
+
ds as createAssetsCss,
|
1550
|
+
$t as createDataSources,
|
1529
1551
|
L as createLoader,
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1552
|
+
gs as createMemoryService,
|
1553
|
+
ut as createMetaApi,
|
1554
|
+
ms as createProvider,
|
1533
1555
|
N as createRenderer,
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1556
|
+
ct as createSchemaApi,
|
1557
|
+
lt as createSchemaApis,
|
1558
|
+
Pt as defaultLoader,
|
1537
1559
|
F as fillBasePath,
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1560
|
+
ye as getModifiers,
|
1561
|
+
ge as getPlugin,
|
1562
|
+
tt as getRawComponent,
|
1541
1563
|
V as isCSSUrl,
|
1542
|
-
|
1564
|
+
it as isJSCode,
|
1543
1565
|
S as isJSExpression,
|
1544
|
-
|
1545
|
-
|
1566
|
+
H as isJSFunction,
|
1567
|
+
Xe as isJSON,
|
1546
1568
|
z as isJSUrl,
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1569
|
+
ot as isVuePlugin,
|
1570
|
+
st as loadCss,
|
1571
|
+
nt as loadCssUrl,
|
1572
|
+
rt as loadScriptUrl,
|
1573
|
+
dt as mockApi,
|
1574
|
+
ft as mockApis,
|
1575
|
+
me as mockCleanup,
|
1576
|
+
x as nodeRender,
|
1577
|
+
et as parseDeps,
|
1556
1578
|
C as parseExpression,
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1579
|
+
se as parseFunction,
|
1580
|
+
we as providerKey,
|
1581
|
+
Ze as removeProdFlag,
|
1582
|
+
pe as toString,
|
1583
|
+
ht as useAccess,
|
1584
|
+
_s as useMask,
|
1585
|
+
Se as useProvider
|
1564
1586
|
};
|