@vtj/renderer 0.8.169 → 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 +280 -261
- package/package.json +5 -5
- package/types/constants.d.ts +8 -0
- package/types/plugins/access.d.ts +5 -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,10 +141,10 @@ 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
|
-
function
|
|
147
|
+
function C(n, e, t = !1, s = !1) {
|
|
148
148
|
try {
|
|
149
149
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
|
150
150
|
r.push("return ");
|
|
@@ -154,13 +154,13 @@ function R(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
|
|
162
|
-
const r =
|
|
163
|
-
if (typeof r != "function" && (
|
|
161
|
+
function se(n, e, t = !1, s = !1) {
|
|
162
|
+
const r = C(n, e, t, s);
|
|
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, {
|
|
@@ -216,7 +216,7 @@ function at(n, e) {
|
|
|
216
216
|
query: r
|
|
217
217
|
});
|
|
218
218
|
{
|
|
219
|
-
const r = n.headers ?
|
|
219
|
+
const r = n.headers ? C(n.headers, {}, !0) : void 0, o = {
|
|
220
220
|
url: n.url,
|
|
221
221
|
method: n.method,
|
|
222
222
|
settings: {
|
|
@@ -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,14 +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;
|
|
365
|
+
}
|
|
366
|
+
hasRoutePermission(e) {
|
|
367
|
+
if (e.name === de) {
|
|
368
|
+
const t = e.params.id;
|
|
369
|
+
return t && this.can(t);
|
|
370
|
+
}
|
|
371
|
+
return !0;
|
|
361
372
|
}
|
|
362
373
|
setGuard(e) {
|
|
363
374
|
e.beforeEach((t, s, r) => this.guard(t, r));
|
|
364
375
|
}
|
|
365
376
|
guard(e, t) {
|
|
366
|
-
if (this.isWhiteList(e) || this.
|
|
377
|
+
if (this.isWhiteList(e) || this.isAuthPath(e))
|
|
367
378
|
return t();
|
|
379
|
+
if (this.isLogined())
|
|
380
|
+
return this.hasRoutePermission(e) ? t() : (this.showTip("无权限访问该页面"), t(!1));
|
|
368
381
|
t(!1), this.toLogin();
|
|
369
382
|
}
|
|
370
383
|
isWhiteList(e) {
|
|
@@ -376,11 +389,15 @@ class ps {
|
|
|
376
389
|
return e.status === t || e.data.code === t;
|
|
377
390
|
}
|
|
378
391
|
async showUnauthorizedAlert(e) {
|
|
379
|
-
const {
|
|
380
|
-
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, {
|
|
381
398
|
title: "提示",
|
|
382
399
|
type: "warning"
|
|
383
|
-
}).catch((
|
|
400
|
+
}).catch((s) => s));
|
|
384
401
|
}
|
|
385
402
|
setRequest(e) {
|
|
386
403
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
|
@@ -392,10 +409,10 @@ class ps {
|
|
|
392
409
|
);
|
|
393
410
|
}
|
|
394
411
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
412
|
+
function ht() {
|
|
413
|
+
return ie(ve, null);
|
|
397
414
|
}
|
|
398
|
-
class
|
|
415
|
+
class mt {
|
|
399
416
|
__id = null;
|
|
400
417
|
__mode;
|
|
401
418
|
__instance = null;
|
|
@@ -424,7 +441,7 @@ class ht {
|
|
|
424
441
|
const { mode: t, dsl: s, attrs: r } = e;
|
|
425
442
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
|
426
443
|
}
|
|
427
|
-
setup(e, t =
|
|
444
|
+
setup(e, t = D) {
|
|
428
445
|
const s = t.getCurrentInstance();
|
|
429
446
|
if (!s) return;
|
|
430
447
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
|
@@ -438,12 +455,12 @@ class ht {
|
|
|
438
455
|
});
|
|
439
456
|
}
|
|
440
457
|
__proxy() {
|
|
441
|
-
this.__instance &&
|
|
458
|
+
this.__instance && te.forEach((e) => {
|
|
442
459
|
this[e] = this.__instance?.[e];
|
|
443
460
|
});
|
|
444
461
|
}
|
|
445
462
|
__cleanup() {
|
|
446
|
-
|
|
463
|
+
te.forEach((e) => {
|
|
447
464
|
this[e] = null;
|
|
448
465
|
});
|
|
449
466
|
}
|
|
@@ -451,22 +468,22 @@ class ht {
|
|
|
451
468
|
if (e)
|
|
452
469
|
if (this.__mode === _.Runtime) {
|
|
453
470
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
454
|
-
return
|
|
471
|
+
return se({ type: s, value: r }, this);
|
|
455
472
|
} else
|
|
456
|
-
return
|
|
473
|
+
return se(e, this);
|
|
457
474
|
}
|
|
458
475
|
__parseExpression(e) {
|
|
459
476
|
if (e)
|
|
460
477
|
if (this.__mode === _.Runtime) {
|
|
461
478
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
462
|
-
return
|
|
479
|
+
return C({ type: s, value: r }, this);
|
|
463
480
|
} else
|
|
464
|
-
return
|
|
481
|
+
return C(e, this);
|
|
465
482
|
}
|
|
466
483
|
__ref(e = null, t) {
|
|
467
484
|
if (this.__mode !== _.VNode)
|
|
468
485
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
|
469
|
-
await
|
|
486
|
+
await oe(0);
|
|
470
487
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
|
471
488
|
if (!r) {
|
|
472
489
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
@@ -495,7 +512,7 @@ class ht {
|
|
|
495
512
|
}
|
|
496
513
|
function N(n) {
|
|
497
514
|
const {
|
|
498
|
-
Vue: e =
|
|
515
|
+
Vue: e = D,
|
|
499
516
|
mode: t = _.Runtime,
|
|
500
517
|
components: s = {},
|
|
501
518
|
libs: r = {},
|
|
@@ -505,22 +522,22 @@ function N(n) {
|
|
|
505
522
|
$components: s,
|
|
506
523
|
$libs: r,
|
|
507
524
|
$apis: o
|
|
508
|
-
}, c = new
|
|
525
|
+
}, c = new mt({
|
|
509
526
|
mode: t,
|
|
510
527
|
dsl: i.value,
|
|
511
528
|
attrs: u
|
|
512
529
|
}), p = e.defineComponent({
|
|
513
530
|
name: i.value.name,
|
|
514
531
|
props: {
|
|
515
|
-
...
|
|
532
|
+
...gt(i.value.props ?? [], c)
|
|
516
533
|
},
|
|
517
534
|
setup(l) {
|
|
518
|
-
c.$props = l, c.props = l, i.value.id &&
|
|
535
|
+
c.$props = l, c.props = l, i.value.id && he(
|
|
519
536
|
n.window || window,
|
|
520
537
|
i.value.id,
|
|
521
538
|
i.value.css || ""
|
|
522
|
-
), c.state =
|
|
523
|
-
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(
|
|
524
541
|
i.value.dataSources || {},
|
|
525
542
|
c
|
|
526
543
|
), w = {
|
|
@@ -529,28 +546,28 @@ function N(n) {
|
|
|
529
546
|
...m,
|
|
530
547
|
...h
|
|
531
548
|
};
|
|
532
|
-
return c.setup(w, e),
|
|
549
|
+
return c.setup(w, e), jt(e, i.value.watch ?? [], c), {
|
|
533
550
|
vtj: c
|
|
534
551
|
};
|
|
535
552
|
},
|
|
536
|
-
emits:
|
|
553
|
+
emits: vt(i.value.emits),
|
|
537
554
|
expose: ["vtj"],
|
|
538
555
|
render() {
|
|
539
556
|
if (!i.value.nodes) return null;
|
|
540
557
|
const l = i.value.nodes || [];
|
|
541
|
-
return l.length === 1 ?
|
|
558
|
+
return l.length === 1 ? x(l[0], c, e, a) : l.map((f) => x(f, c, e, a));
|
|
542
559
|
},
|
|
543
|
-
...
|
|
560
|
+
...Et(i.value.lifeCycles ?? {}, c)
|
|
544
561
|
});
|
|
545
562
|
return {
|
|
546
563
|
renderer: e.markRaw(p),
|
|
547
564
|
context: c
|
|
548
565
|
};
|
|
549
566
|
}
|
|
550
|
-
function
|
|
567
|
+
function vt(n = []) {
|
|
551
568
|
return n.map((e) => $(e) ? e : e.name);
|
|
552
569
|
}
|
|
553
|
-
function
|
|
570
|
+
function gt(n = [], e) {
|
|
554
571
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => Ye[o]) : void 0;
|
|
555
572
|
return n.map((s) => $(s) ? {
|
|
556
573
|
name: s
|
|
@@ -568,7 +585,7 @@ function vt(n = [], e) {
|
|
|
568
585
|
{}
|
|
569
586
|
);
|
|
570
587
|
}
|
|
571
|
-
function
|
|
588
|
+
function yt(n, e, t) {
|
|
572
589
|
return n.reactive(
|
|
573
590
|
Object.keys(e || {}).reduce(
|
|
574
591
|
(s, r) => {
|
|
@@ -579,19 +596,19 @@ function gt(n, e, t) {
|
|
|
579
596
|
)
|
|
580
597
|
);
|
|
581
598
|
}
|
|
582
|
-
function
|
|
599
|
+
function _t(n, e, t) {
|
|
583
600
|
return Object.entries(e ?? {}).reduce(
|
|
584
601
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
|
585
602
|
{}
|
|
586
603
|
);
|
|
587
604
|
}
|
|
588
|
-
function
|
|
605
|
+
function wt(n, e) {
|
|
589
606
|
return Object.entries(n ?? {}).reduce(
|
|
590
607
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
591
608
|
{}
|
|
592
609
|
);
|
|
593
610
|
}
|
|
594
|
-
function
|
|
611
|
+
function St(n, e = [], t) {
|
|
595
612
|
return e.reduce(
|
|
596
613
|
(s, r) => {
|
|
597
614
|
const { name: o, from: a } = r || {};
|
|
@@ -602,7 +619,7 @@ function wt(n, e = [], t) {
|
|
|
602
619
|
{}
|
|
603
620
|
);
|
|
604
621
|
}
|
|
605
|
-
function
|
|
622
|
+
function $t(n, e) {
|
|
606
623
|
return Object.keys(n).reduce(
|
|
607
624
|
(t, s) => {
|
|
608
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;
|
|
@@ -614,7 +631,7 @@ function St(n, e) {
|
|
|
614
631
|
{}
|
|
615
632
|
);
|
|
616
633
|
}
|
|
617
|
-
function
|
|
634
|
+
function jt(n, e = [], t) {
|
|
618
635
|
e.forEach((s) => {
|
|
619
636
|
n.watch(
|
|
620
637
|
t.__parseExpression(s.source),
|
|
@@ -626,27 +643,27 @@ function $t(n, e = [], t) {
|
|
|
626
643
|
);
|
|
627
644
|
});
|
|
628
645
|
}
|
|
629
|
-
function
|
|
646
|
+
function Et(n, e) {
|
|
630
647
|
return Object.entries(n ?? {}).reduce(
|
|
631
648
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
632
649
|
{}
|
|
633
650
|
);
|
|
634
651
|
}
|
|
635
|
-
let
|
|
636
|
-
const
|
|
637
|
-
async function
|
|
652
|
+
let U = [];
|
|
653
|
+
const Pt = (n) => n;
|
|
654
|
+
async function ge(n, e = window) {
|
|
638
655
|
const { urls: t = [], library: s } = n, r = t.filter((i) => z(i));
|
|
639
656
|
if (r.length === 0 || !s) return null;
|
|
640
657
|
const o = t.filter((i) => V(i));
|
|
641
|
-
return o.length &&
|
|
658
|
+
return o.length && nt(o, e), await rt(r, s, e).catch(
|
|
642
659
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
|
643
660
|
);
|
|
644
661
|
}
|
|
645
662
|
function L(n) {
|
|
646
663
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
|
647
|
-
return s.window && (
|
|
664
|
+
return s.window && (U.forEach((r) => {
|
|
648
665
|
delete s.window[r];
|
|
649
|
-
}),
|
|
666
|
+
}), U = []), (r, o, a = D) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
650
667
|
const i = await e(o.id);
|
|
651
668
|
return i && (i.name = r), i ? N({
|
|
652
669
|
...s,
|
|
@@ -664,14 +681,14 @@ function L(n) {
|
|
|
664
681
|
mode: _.Runtime,
|
|
665
682
|
loader: L(n)
|
|
666
683
|
}).renderer : null;
|
|
667
|
-
}) : o.type === "Plugin" ? (o.library &&
|
|
668
|
-
const i = await
|
|
684
|
+
}) : o.type === "Plugin" ? (o.library && U.push(o.library), a.defineAsyncComponent(async () => {
|
|
685
|
+
const i = await ge(o, s.window);
|
|
669
686
|
return i || (console.warn("getPlugin result is null", o), null);
|
|
670
687
|
})) : r;
|
|
671
688
|
}
|
|
672
|
-
function
|
|
689
|
+
function x(n, e, t = D, s = Pt) {
|
|
673
690
|
if (!n || !n.name || n.invisible) return null;
|
|
674
|
-
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);
|
|
675
692
|
if (a && !bt(a, e))
|
|
676
693
|
return null;
|
|
677
694
|
const l = (f) => {
|
|
@@ -681,16 +698,16 @@ function A(n, e, t = O, s = Et) {
|
|
|
681
698
|
if (n.name === "slot") return n.name;
|
|
682
699
|
const g = s(n.name, n.from, t);
|
|
683
700
|
return $(g) ? m[g] ?? g : g;
|
|
684
|
-
})(), h =
|
|
701
|
+
})(), h = Ft(r, n.props ?? {}, f), w = At(t, n.events ?? {}, f);
|
|
685
702
|
if (n.name === "slot")
|
|
686
|
-
return
|
|
703
|
+
return It(t, n, h, f, s);
|
|
687
704
|
p && Object.assign(h, f.__parseExpression(p.value)), u && (h.style = Object.assign(
|
|
688
705
|
h.style ?? {},
|
|
689
|
-
|
|
706
|
+
xt(u, f)
|
|
690
707
|
)), c.forEach((g) => {
|
|
691
|
-
Object.assign(h,
|
|
708
|
+
Object.assign(h, Dt(t, g, f));
|
|
692
709
|
});
|
|
693
|
-
const v =
|
|
710
|
+
const v = Ht(
|
|
694
711
|
t,
|
|
695
712
|
n.children ?? [],
|
|
696
713
|
f,
|
|
@@ -701,7 +718,7 @@ function A(n, e, t = O, s = Et) {
|
|
|
701
718
|
};
|
|
702
719
|
return i ? kt(i, l, e) : l(e);
|
|
703
720
|
}
|
|
704
|
-
function
|
|
721
|
+
function Rt(n = []) {
|
|
705
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(
|
|
706
723
|
(i) => !Ge.includes(j(i.name))
|
|
707
724
|
);
|
|
@@ -720,7 +737,7 @@ function bt(n, e) {
|
|
|
720
737
|
function Ct(n, e) {
|
|
721
738
|
return e ? S(e) ? n.__parseExpression(e) : e : "div";
|
|
722
739
|
}
|
|
723
|
-
function
|
|
740
|
+
function Ft(n, e, t) {
|
|
724
741
|
const s = Object.keys(e || {}).reduce(
|
|
725
742
|
(r, o) => {
|
|
726
743
|
let a = e[o];
|
|
@@ -730,7 +747,7 @@ function Rt(n, e, t) {
|
|
|
730
747
|
);
|
|
731
748
|
return s.ref = t.__ref(n, s.ref), s;
|
|
732
749
|
}
|
|
733
|
-
function
|
|
750
|
+
function At(n, e, t) {
|
|
734
751
|
const s = ["passive", "capture", "once"], r = {
|
|
735
752
|
capture: "Capture",
|
|
736
753
|
once: "Once",
|
|
@@ -738,70 +755,70 @@ function Ft(n, e, t) {
|
|
|
738
755
|
};
|
|
739
756
|
return Object.keys(e || {}).reduce(
|
|
740
757
|
(o, a) => {
|
|
741
|
-
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);
|
|
742
759
|
return l && (o[p] = n.withModifiers(l, u)), o;
|
|
743
760
|
},
|
|
744
761
|
{}
|
|
745
762
|
);
|
|
746
763
|
}
|
|
747
|
-
function
|
|
764
|
+
function ye(n = {}, e = !1) {
|
|
748
765
|
const t = Object.keys(n);
|
|
749
766
|
return e ? t.map((s) => "." + s) : t;
|
|
750
767
|
}
|
|
751
|
-
function
|
|
752
|
-
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];
|
|
753
770
|
return i ? i(t) : o ? $(o) ? n.createTextVNode(o) : S(o) ? n.createTextVNode(
|
|
754
|
-
|
|
771
|
+
pe(s.__parseExpression(o))
|
|
755
772
|
) : Array.isArray(o) ? o.map(
|
|
756
|
-
(u) =>
|
|
773
|
+
(u) => x(u, s, n, r)
|
|
757
774
|
) : null : null;
|
|
758
775
|
}
|
|
759
|
-
function
|
|
776
|
+
function Ot(n, e) {
|
|
760
777
|
const { props: t } = n, s = t?.name || "default";
|
|
761
778
|
return {
|
|
762
779
|
name: S(s) ? e.__parseExpression(s) : s,
|
|
763
780
|
params: []
|
|
764
781
|
};
|
|
765
782
|
}
|
|
766
|
-
function
|
|
783
|
+
function xt(n, e) {
|
|
767
784
|
return e.__parseExpression(n.value) ? {} : {
|
|
768
785
|
display: "none"
|
|
769
786
|
};
|
|
770
787
|
}
|
|
771
|
-
function
|
|
788
|
+
function Dt(n, e, t) {
|
|
772
789
|
const s = {
|
|
773
790
|
type: "JSFunction",
|
|
774
791
|
value: e.value?.value ? `(v) => {
|
|
775
792
|
${e.value.value} = v;
|
|
776
793
|
}` : "(v) => {}"
|
|
777
|
-
}, 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";
|
|
778
795
|
return {
|
|
779
796
|
[a]: t.__parseExpression(e.value),
|
|
780
797
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
|
781
798
|
};
|
|
782
799
|
}
|
|
783
|
-
function
|
|
800
|
+
function Ht(n, e, t, s, r) {
|
|
784
801
|
if (!e) return null;
|
|
785
802
|
if ($(e))
|
|
786
803
|
return { default: () => e };
|
|
787
804
|
if (S(e))
|
|
788
805
|
return {
|
|
789
|
-
default: () =>
|
|
806
|
+
default: () => pe(t.__parseExpression(e))
|
|
790
807
|
};
|
|
791
808
|
if (Array.isArray(e) && e.length > 0) {
|
|
792
|
-
const o =
|
|
809
|
+
const o = Mt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
|
793
810
|
[`scope_${r.id}`]: i
|
|
794
811
|
} : {};
|
|
795
812
|
return Object.entries(o).reduce((i, [u, { nodes: c, params: p }]) => (i[u] = (l) => {
|
|
796
|
-
const f = p.length ?
|
|
813
|
+
const f = p.length ? De(l ?? {}, p) : a(l);
|
|
797
814
|
return c.map(
|
|
798
|
-
(m) =>
|
|
815
|
+
(m) => x(m, t.__clone(f), n, s)
|
|
799
816
|
);
|
|
800
817
|
}, i), {});
|
|
801
818
|
}
|
|
802
819
|
return null;
|
|
803
820
|
}
|
|
804
|
-
function
|
|
821
|
+
function Mt(n) {
|
|
805
822
|
const e = {
|
|
806
823
|
default: {
|
|
807
824
|
params: [],
|
|
@@ -809,7 +826,7 @@ function Ht(n) {
|
|
|
809
826
|
}
|
|
810
827
|
};
|
|
811
828
|
for (const t of n) {
|
|
812
|
-
const s =
|
|
829
|
+
const s = Tt(t.slot), r = s.name;
|
|
813
830
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
|
814
831
|
nodes: [t],
|
|
815
832
|
params: s.params
|
|
@@ -817,7 +834,7 @@ function Ht(n) {
|
|
|
817
834
|
}
|
|
818
835
|
return e;
|
|
819
836
|
}
|
|
820
|
-
function
|
|
837
|
+
function Tt(n = "default") {
|
|
821
838
|
return $(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
822
839
|
}
|
|
823
840
|
function kt(n, e, t) {
|
|
@@ -825,53 +842,53 @@ function kt(n, e, t) {
|
|
|
825
842
|
let i = t.__parseExpression(s) || [];
|
|
826
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`), []);
|
|
827
844
|
}
|
|
828
|
-
function
|
|
845
|
+
function Ut(n) {
|
|
829
846
|
return Le() ? (qe(n), !0) : !1;
|
|
830
847
|
}
|
|
831
848
|
function K(n) {
|
|
832
849
|
return typeof n == "function" ? n() : Je(n);
|
|
833
850
|
}
|
|
834
|
-
const
|
|
851
|
+
const _e = typeof window < "u" && typeof document < "u";
|
|
835
852
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
836
|
-
const Bt = (n) => n != null,
|
|
853
|
+
const Bt = (n) => n != null, Nt = () => {
|
|
837
854
|
};
|
|
838
|
-
function
|
|
839
|
-
return
|
|
855
|
+
function Lt(n) {
|
|
856
|
+
return ae();
|
|
840
857
|
}
|
|
841
|
-
function
|
|
858
|
+
function qt(...n) {
|
|
842
859
|
if (n.length !== 1)
|
|
843
|
-
return
|
|
860
|
+
return ke(...n);
|
|
844
861
|
const e = n[0];
|
|
845
|
-
return typeof e == "function" ? Be(
|
|
862
|
+
return typeof e == "function" ? Ue(Be(() => ({ get: e, set: Nt }))) : J(e);
|
|
846
863
|
}
|
|
847
|
-
function
|
|
848
|
-
|
|
864
|
+
function Jt(n, e) {
|
|
865
|
+
Lt() && Ne(n, e);
|
|
849
866
|
}
|
|
850
|
-
const
|
|
851
|
-
function
|
|
867
|
+
const Vt = _e ? window : void 0, zt = _e ? window.document : void 0;
|
|
868
|
+
function Kt(n) {
|
|
852
869
|
var e;
|
|
853
870
|
const t = K(n);
|
|
854
871
|
return (e = t?.$el) != null ? e : t;
|
|
855
872
|
}
|
|
856
|
-
function
|
|
857
|
-
const n = J(!1), e =
|
|
873
|
+
function Wt() {
|
|
874
|
+
const n = J(!1), e = ae();
|
|
858
875
|
return e && Ve(() => {
|
|
859
876
|
n.value = !0;
|
|
860
877
|
}, e), n;
|
|
861
878
|
}
|
|
862
|
-
function
|
|
863
|
-
const e =
|
|
864
|
-
return
|
|
879
|
+
function Gt(n) {
|
|
880
|
+
const e = Wt();
|
|
881
|
+
return ue(() => (e.value, !!n()));
|
|
865
882
|
}
|
|
866
|
-
function
|
|
867
|
-
const { window: s =
|
|
883
|
+
function Yt(n, e, t = {}) {
|
|
884
|
+
const { window: s = Vt, ...r } = t;
|
|
868
885
|
let o;
|
|
869
|
-
const a =
|
|
886
|
+
const a = Gt(() => s && "MutationObserver" in s), i = () => {
|
|
870
887
|
o && (o.disconnect(), o = void 0);
|
|
871
|
-
}, u =
|
|
872
|
-
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);
|
|
873
890
|
return new Set(m);
|
|
874
|
-
}), c =
|
|
891
|
+
}), c = ce(
|
|
875
892
|
() => u.value,
|
|
876
893
|
(f) => {
|
|
877
894
|
i(), a.value && f.size && (o = new MutationObserver(e), f.forEach((m) => o.observe(m, r)));
|
|
@@ -880,48 +897,48 @@ function Gt(n, e, t = {}) {
|
|
|
880
897
|
), p = () => o?.takeRecords(), l = () => {
|
|
881
898
|
c(), i();
|
|
882
899
|
};
|
|
883
|
-
return
|
|
900
|
+
return Ut(l), {
|
|
884
901
|
isSupported: a,
|
|
885
902
|
stop: l,
|
|
886
903
|
takeRecords: p
|
|
887
904
|
};
|
|
888
905
|
}
|
|
889
|
-
function
|
|
906
|
+
function Qt(n = null, e = {}) {
|
|
890
907
|
var t, s, r;
|
|
891
908
|
const {
|
|
892
|
-
document: o =
|
|
909
|
+
document: o = zt,
|
|
893
910
|
restoreOnUnmount: a = (l) => l
|
|
894
|
-
} = 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";
|
|
895
912
|
function p(l) {
|
|
896
913
|
if (!("titleTemplate" in e))
|
|
897
914
|
return l;
|
|
898
915
|
const f = e.titleTemplate || "%s";
|
|
899
916
|
return typeof f == "function" ? f(l) : K(f).replace(/%s/g, l);
|
|
900
917
|
}
|
|
901
|
-
return
|
|
918
|
+
return ce(
|
|
902
919
|
u,
|
|
903
920
|
(l, f) => {
|
|
904
921
|
l !== f && o && (o.title = p(typeof l == "string" ? l : ""));
|
|
905
922
|
},
|
|
906
923
|
{ immediate: !0 }
|
|
907
|
-
), e.observe && !e.titleTemplate && o && !c &&
|
|
924
|
+
), e.observe && !e.titleTemplate && o && !c && Yt(
|
|
908
925
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
|
909
926
|
() => {
|
|
910
927
|
o && o.title !== u.value && (u.value = p(o.title));
|
|
911
928
|
},
|
|
912
929
|
{ childList: !0 }
|
|
913
|
-
),
|
|
930
|
+
), Jt(() => {
|
|
914
931
|
if (a) {
|
|
915
932
|
const l = a(i, u.value || "");
|
|
916
933
|
l != null && o && (o.title = l);
|
|
917
934
|
}
|
|
918
935
|
}), u;
|
|
919
936
|
}
|
|
920
|
-
const
|
|
937
|
+
const ne = le({
|
|
921
938
|
name: "VtjPageContainer",
|
|
922
939
|
async setup() {
|
|
923
|
-
const n =
|
|
924
|
-
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"), {
|
|
925
942
|
provider: n,
|
|
926
943
|
component: r,
|
|
927
944
|
file: s,
|
|
@@ -929,16 +946,16 @@ const se = ue({
|
|
|
929
946
|
};
|
|
930
947
|
},
|
|
931
948
|
render() {
|
|
932
|
-
return this.component ?
|
|
949
|
+
return this.component ? B(this.component, this.query) : B("div", "页面不存在");
|
|
933
950
|
}
|
|
934
|
-
}),
|
|
951
|
+
}), Xt = le({
|
|
935
952
|
name: "VtjStartupContainer",
|
|
936
953
|
render() {
|
|
937
|
-
return
|
|
954
|
+
return B(We);
|
|
938
955
|
}
|
|
939
|
-
}),
|
|
940
|
-
var
|
|
941
|
-
class
|
|
956
|
+
}), we = Symbol("Provider");
|
|
957
|
+
var Zt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Zt || {});
|
|
958
|
+
class es extends Ee {
|
|
942
959
|
constructor(e) {
|
|
943
960
|
super(), this.options = e;
|
|
944
961
|
const {
|
|
@@ -962,7 +979,7 @@ class Zt extends $e {
|
|
|
962
979
|
mode;
|
|
963
980
|
globals = {};
|
|
964
981
|
modules = {};
|
|
965
|
-
adapter = { request:
|
|
982
|
+
adapter = { request: at, jsonp: He };
|
|
966
983
|
apis = {};
|
|
967
984
|
dependencies = {};
|
|
968
985
|
materials = {};
|
|
@@ -979,7 +996,7 @@ class Zt extends $e {
|
|
|
979
996
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
980
997
|
throw new Error("project is null");
|
|
981
998
|
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
|
982
|
-
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();
|
|
983
1000
|
}
|
|
984
1001
|
async loadDependencies(e) {
|
|
985
1002
|
const t = Object.entries(this.dependencies);
|
|
@@ -993,7 +1010,7 @@ class Zt extends $e {
|
|
|
993
1010
|
materials: p,
|
|
994
1011
|
materialExports: l,
|
|
995
1012
|
materialMapLibrary: f
|
|
996
|
-
} =
|
|
1013
|
+
} = et(
|
|
997
1014
|
t,
|
|
998
1015
|
a,
|
|
999
1016
|
i === "development"
|
|
@@ -1008,15 +1025,15 @@ class Zt extends $e {
|
|
|
1008
1025
|
else {
|
|
1009
1026
|
const v = c[d] || [];
|
|
1010
1027
|
for (const g of v)
|
|
1011
|
-
V(g) && await
|
|
1028
|
+
V(g) && await st(d, R.append(g, { v: b })), z(g) && await Z(R.append(g, { v: b }));
|
|
1012
1029
|
r[d] = e[d];
|
|
1013
1030
|
}
|
|
1014
1031
|
}
|
|
1015
1032
|
for (const d of p)
|
|
1016
|
-
await
|
|
1033
|
+
await Z(R.append(d, { v: b }));
|
|
1017
1034
|
const m = this.materials || {};
|
|
1018
1035
|
for (const d of l) {
|
|
1019
|
-
const h = e[f[d]], w =
|
|
1036
|
+
const h = e[f[d]], w = Pe[d];
|
|
1020
1037
|
if (w)
|
|
1021
1038
|
h && w.forEach((v) => {
|
|
1022
1039
|
o[v] = h[v];
|
|
@@ -1024,7 +1041,7 @@ class Zt extends $e {
|
|
|
1024
1041
|
else {
|
|
1025
1042
|
const v = m[d] ? (await m[d]()).default : e[d];
|
|
1026
1043
|
v && h && (v.components || []).forEach((g) => {
|
|
1027
|
-
o[g.name] =
|
|
1044
|
+
o[g.name] = tt(g, h);
|
|
1028
1045
|
});
|
|
1029
1046
|
}
|
|
1030
1047
|
}
|
|
@@ -1033,19 +1050,19 @@ class Zt extends $e {
|
|
|
1033
1050
|
const { router: e, project: t } = this;
|
|
1034
1051
|
e && (e.addRoute({
|
|
1035
1052
|
path: "/page/:id",
|
|
1036
|
-
name:
|
|
1037
|
-
component:
|
|
1053
|
+
name: de,
|
|
1054
|
+
component: ne
|
|
1038
1055
|
}), e.addRoute({
|
|
1039
1056
|
path: "/",
|
|
1040
|
-
name:
|
|
1041
|
-
component: t?.homepage ?
|
|
1057
|
+
name: Qe,
|
|
1058
|
+
component: t?.homepage ? ne : Xt
|
|
1042
1059
|
}));
|
|
1043
1060
|
}
|
|
1044
1061
|
install(e) {
|
|
1045
1062
|
const t = e.config.globalProperties.installed || {};
|
|
1046
1063
|
for (const [s, r] of Object.entries(this.library))
|
|
1047
|
-
!t[s] &&
|
|
1048
|
-
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) => {
|
|
1049
1066
|
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", u = `[ ${a} ] ${i} ${o}`;
|
|
1050
1067
|
console.error(
|
|
1051
1068
|
"[VTJ Error]:",
|
|
@@ -1056,7 +1073,7 @@ class Zt extends $e {
|
|
|
1056
1073
|
},
|
|
1057
1074
|
s?.stack
|
|
1058
1075
|
), H.error({
|
|
1059
|
-
title: "
|
|
1076
|
+
title: "未处理的异常:请在控制台查看详情",
|
|
1060
1077
|
message: u
|
|
1061
1078
|
});
|
|
1062
1079
|
});
|
|
@@ -1121,32 +1138,32 @@ class Zt extends $e {
|
|
|
1121
1138
|
async getRenderComponent(e) {
|
|
1122
1139
|
const t = this.getFile(e);
|
|
1123
1140
|
if (!t)
|
|
1124
|
-
return
|
|
1141
|
+
return O.warn(`Can not find file: ${e}`), null;
|
|
1125
1142
|
const s = `.vtj/vue/${e}.vue`, r = this.modules[s];
|
|
1126
1143
|
if (r)
|
|
1127
1144
|
return (await r())?.default;
|
|
1128
1145
|
const o = await this.getDsl(t.id);
|
|
1129
|
-
return o ? this.createDslRenderer(o).renderer : (
|
|
1146
|
+
return o ? this.createDslRenderer(o).renderer : (O.warn(`Can not find dsl: ${e}`), null);
|
|
1130
1147
|
}
|
|
1131
1148
|
defineUrlSchemaComponent(e, t) {
|
|
1132
|
-
return
|
|
1149
|
+
return ee(async () => {
|
|
1133
1150
|
const s = await this.getDslByUrl(e);
|
|
1134
1151
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
|
1135
1152
|
});
|
|
1136
1153
|
}
|
|
1137
1154
|
definePluginComponent(e) {
|
|
1138
|
-
return
|
|
1155
|
+
return ee(async () => await ge(e, window));
|
|
1139
1156
|
}
|
|
1140
1157
|
}
|
|
1141
|
-
function
|
|
1142
|
-
const e = new
|
|
1158
|
+
function ms(n) {
|
|
1159
|
+
const e = new es(n);
|
|
1143
1160
|
return {
|
|
1144
1161
|
provider: e,
|
|
1145
1162
|
onReady: (s) => e.ready(s)
|
|
1146
1163
|
};
|
|
1147
1164
|
}
|
|
1148
|
-
function
|
|
1149
|
-
const e =
|
|
1165
|
+
function Se(n = {}) {
|
|
1166
|
+
const e = ie(we);
|
|
1150
1167
|
if (!e)
|
|
1151
1168
|
throw new Error("Can not find provider");
|
|
1152
1169
|
if (e.nodeEnv === "development") {
|
|
@@ -1174,7 +1191,7 @@ const W = new Me({
|
|
|
1174
1191
|
});
|
|
1175
1192
|
}
|
|
1176
1193
|
}
|
|
1177
|
-
}),
|
|
1194
|
+
}), ts = (n = "/__vtj__/api/:type.json") => (e, t) => W.send({
|
|
1178
1195
|
url: n,
|
|
1179
1196
|
method: "post",
|
|
1180
1197
|
params: { type: e },
|
|
@@ -1182,7 +1199,7 @@ const W = new Me({
|
|
|
1182
1199
|
type: e,
|
|
1183
1200
|
data: t
|
|
1184
1201
|
}
|
|
1185
|
-
}),
|
|
1202
|
+
}), ss = (n = "/__vtj__/api/uploader.json") => async (e, t) => await W.send({
|
|
1186
1203
|
url: n,
|
|
1187
1204
|
method: "post",
|
|
1188
1205
|
data: {
|
|
@@ -1198,7 +1215,7 @@ class G {
|
|
|
1198
1215
|
pluginCaches = {};
|
|
1199
1216
|
uploader;
|
|
1200
1217
|
constructor() {
|
|
1201
|
-
this.api =
|
|
1218
|
+
this.api = ts(), this.uploader = ss();
|
|
1202
1219
|
}
|
|
1203
1220
|
async getExtension() {
|
|
1204
1221
|
console.log("BaseService.getExtension");
|
|
@@ -1271,7 +1288,7 @@ class G {
|
|
|
1271
1288
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1272
1289
|
}
|
|
1273
1290
|
async getPluginMaterial(e) {
|
|
1274
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
|
1291
|
+
const { urls: t = [] } = e, s = t.filter((o) => Xe(o))[0];
|
|
1275
1292
|
if (!s) return null;
|
|
1276
1293
|
const r = this.pluginCaches[s];
|
|
1277
1294
|
return r || (this.pluginCaches[s] = W.send({
|
|
@@ -1284,12 +1301,12 @@ class G {
|
|
|
1284
1301
|
}).then((o) => o.data).catch(() => null));
|
|
1285
1302
|
}
|
|
1286
1303
|
}
|
|
1287
|
-
const y = new
|
|
1304
|
+
const y = new Te({
|
|
1288
1305
|
type: "local",
|
|
1289
1306
|
expired: 0,
|
|
1290
1307
|
prefix: "__VTJ_"
|
|
1291
1308
|
});
|
|
1292
|
-
class
|
|
1309
|
+
class vs extends G {
|
|
1293
1310
|
init(e) {
|
|
1294
1311
|
const t = new I(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
1295
1312
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
@@ -1323,7 +1340,7 @@ class ms extends G {
|
|
|
1323
1340
|
return Promise.resolve(!0);
|
|
1324
1341
|
}
|
|
1325
1342
|
getHistory(e) {
|
|
1326
|
-
const t = y.get(`history_${e}`), s = new
|
|
1343
|
+
const t = y.get(`history_${e}`), s = new re(t || { id: e });
|
|
1327
1344
|
return Promise.resolve(s.toDsl());
|
|
1328
1345
|
}
|
|
1329
1346
|
getHistoryItem(e, t) {
|
|
@@ -1339,7 +1356,7 @@ class ms extends G {
|
|
|
1339
1356
|
}), Promise.resolve(!0);
|
|
1340
1357
|
}
|
|
1341
1358
|
}
|
|
1342
|
-
class
|
|
1359
|
+
class ns extends G {
|
|
1343
1360
|
projects = {};
|
|
1344
1361
|
materials = {};
|
|
1345
1362
|
files = {};
|
|
@@ -1378,7 +1395,7 @@ class ss extends G {
|
|
|
1378
1395
|
return Promise.resolve(!0);
|
|
1379
1396
|
}
|
|
1380
1397
|
getHistory(e) {
|
|
1381
|
-
const t = this.histories[e], s = new
|
|
1398
|
+
const t = this.histories[e], s = new re(t || { id: e });
|
|
1382
1399
|
return Promise.resolve(s);
|
|
1383
1400
|
}
|
|
1384
1401
|
getHistoryItem(e, t) {
|
|
@@ -1396,11 +1413,11 @@ class ss extends G {
|
|
|
1396
1413
|
}), Promise.resolve(!0);
|
|
1397
1414
|
}
|
|
1398
1415
|
}
|
|
1399
|
-
let
|
|
1400
|
-
function
|
|
1401
|
-
return
|
|
1416
|
+
let A = null;
|
|
1417
|
+
function gs() {
|
|
1418
|
+
return A || (A = new ns(), A);
|
|
1402
1419
|
}
|
|
1403
|
-
class
|
|
1420
|
+
class ys extends G {
|
|
1404
1421
|
getFileCaches = {};
|
|
1405
1422
|
async getExtension() {
|
|
1406
1423
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1455,7 +1472,7 @@ class gs extends G {
|
|
|
1455
1472
|
);
|
|
1456
1473
|
}
|
|
1457
1474
|
}
|
|
1458
|
-
function
|
|
1475
|
+
function $e(n = []) {
|
|
1459
1476
|
return n.map((e) => {
|
|
1460
1477
|
const { id: t, title: s, icon: r, children: o, hidden: a } = e;
|
|
1461
1478
|
return {
|
|
@@ -1464,23 +1481,23 @@ function we(n = []) {
|
|
|
1464
1481
|
icon: r,
|
|
1465
1482
|
hidden: a,
|
|
1466
1483
|
url: `/page/${t}`,
|
|
1467
|
-
children: o && o.length ?
|
|
1484
|
+
children: o && o.length ? $e(o) : void 0
|
|
1468
1485
|
};
|
|
1469
1486
|
});
|
|
1470
1487
|
}
|
|
1471
|
-
function
|
|
1488
|
+
function je(n, e) {
|
|
1472
1489
|
if (!e) return n;
|
|
1473
1490
|
let t = [];
|
|
1474
1491
|
for (const s of n)
|
|
1475
1492
|
if (s.children && s.children.length) {
|
|
1476
|
-
const r =
|
|
1493
|
+
const r = je(s.children, e);
|
|
1477
1494
|
r.length && (s.children = r, t.push(s));
|
|
1478
1495
|
} else
|
|
1479
1496
|
e[s.id] && t.push(s);
|
|
1480
1497
|
return t;
|
|
1481
1498
|
}
|
|
1482
|
-
function
|
|
1483
|
-
const n =
|
|
1499
|
+
function _s() {
|
|
1500
|
+
const n = Se(), e = fe(), t = ht(), s = J(!1), r = t?.getData(), o = n.project;
|
|
1484
1501
|
ze(() => {
|
|
1485
1502
|
const { name: u, params: c, meta: p } = e;
|
|
1486
1503
|
if (u === "VtjPage") {
|
|
@@ -1492,69 +1509,71 @@ function ys() {
|
|
|
1492
1509
|
} else
|
|
1493
1510
|
s.value = !p.mask;
|
|
1494
1511
|
});
|
|
1495
|
-
const a =
|
|
1512
|
+
const a = $e(o?.pages), i = o?.config;
|
|
1496
1513
|
return {
|
|
1497
1514
|
disabled: s,
|
|
1498
1515
|
logo: i?.logo,
|
|
1499
1516
|
themeSwitchable: i?.themeSwitchable,
|
|
1500
1517
|
title: i?.title || o?.description || o?.name || "VTJ App",
|
|
1501
|
-
menus:
|
|
1518
|
+
menus: je(a, r?.permissions)
|
|
1502
1519
|
};
|
|
1503
1520
|
}
|
|
1504
1521
|
export {
|
|
1505
|
-
|
|
1506
|
-
|
|
1522
|
+
ve as ACCESS_KEY,
|
|
1523
|
+
hs as Access,
|
|
1507
1524
|
Ge as BUILT_IN_DIRECTIVES,
|
|
1508
1525
|
G as BaseService,
|
|
1509
|
-
|
|
1510
|
-
|
|
1526
|
+
te as CONTEXT_HOST,
|
|
1527
|
+
mt as Context,
|
|
1511
1528
|
_ as ContextMode,
|
|
1512
1529
|
Ye as DATA_TYPES,
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
Zt as
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
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,
|
|
1525
1544
|
L as createLoader,
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1545
|
+
gs as createMemoryService,
|
|
1546
|
+
ut as createMetaApi,
|
|
1547
|
+
ms as createProvider,
|
|
1529
1548
|
N as createRenderer,
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1549
|
+
ct as createSchemaApi,
|
|
1550
|
+
lt as createSchemaApis,
|
|
1551
|
+
Pt as defaultLoader,
|
|
1533
1552
|
F as fillBasePath,
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1553
|
+
ye as getModifiers,
|
|
1554
|
+
ge as getPlugin,
|
|
1555
|
+
tt as getRawComponent,
|
|
1537
1556
|
V as isCSSUrl,
|
|
1538
|
-
|
|
1557
|
+
it as isJSCode,
|
|
1539
1558
|
S as isJSExpression,
|
|
1540
1559
|
M as isJSFunction,
|
|
1541
|
-
|
|
1560
|
+
Xe as isJSON,
|
|
1542
1561
|
z as isJSUrl,
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
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,
|
|
1571
|
+
C as parseExpression,
|
|
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
|
|
1560
1579
|
};
|