@vtj/renderer 0.9.7 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +472 -462
- package/package.json +6 -6
- package/types/provider/apis.d.ts +1 -1
- package/types/provider/defaults.d.ts +20 -2
- package/types/provider/index.d.ts +1 -0
- package/types/provider/provider.d.ts +2 -15
- package/types/services/base.d.ts +3 -1
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,20 +1,19 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
3
|
-
import * as
|
4
|
-
import { inject as he, toRef as
|
5
|
-
import { ElNotification as U, ElLoading as nt } from "element-plus";
|
1
|
+
import { Base as Ae, BUILT_IN_COMPONENTS as Ie, ProjectModel as H, HistoryModel as ue } from "@vtj/core";
|
2
|
+
import { isUrl as Me, url as R, dedupArray as De, isString as j, isFunction as V, logger as P, storage as U, cookie as L, toArray as re, unRSA as oe, delay as pe, createRequest as de, jsonp as fe, merge as He, pathToRegexp as Oe, pathToRegexpMatch as Be, formDataToJson as Ne, camelCase as $, upperFirst as Ue, pick as Le, request as z, loadScript as ie, Storage as qe, mapToObject as Q } from "@vtj/utils";
|
3
|
+
import * as B from "vue";
|
4
|
+
import { inject as he, toRef as Je, readonly as Ve, customRef as ze, ref as F, onBeforeUnmount as Ke, getCurrentScope as We, onScopeDispose as Ge, unref as Ye, getCurrentInstance as me, watch as ve, computed as ge, onMounted as Qe, defineComponent as X, h as K, openBlock as Xe, createElementBlock as Ze, createElementVNode as k, toDisplayString as q, defineAsyncComponent as ae, watchEffect as et } from "vue";
|
6
5
|
import E from "mockjs";
|
7
6
|
import { useRoute as ye } from "vue-router";
|
8
7
|
/**!
|
9
8
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
10
9
|
* @name @vtj/renderer
|
11
10
|
* @author CHC chenhuachun1549@dingtalk.com
|
12
|
-
* @version 0.9.
|
11
|
+
* @version 0.9.9
|
13
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
14
13
|
*/
|
15
|
-
const
|
14
|
+
const x = "0.9.9";
|
16
15
|
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
17
|
-
const
|
16
|
+
const ce = [
|
18
17
|
"$el",
|
19
18
|
"$emit",
|
20
19
|
"$nextTick",
|
@@ -26,7 +25,7 @@ const ue = [
|
|
26
25
|
"$props",
|
27
26
|
"$options",
|
28
27
|
"$forceUpdate"
|
29
|
-
],
|
28
|
+
], Rs = [
|
30
29
|
"beforeCreate",
|
31
30
|
"created",
|
32
31
|
"beforeMount",
|
@@ -40,14 +39,14 @@ const ue = [
|
|
40
39
|
"renderTriggered",
|
41
40
|
"activated",
|
42
41
|
"deactivated"
|
43
|
-
],
|
42
|
+
], tt = [
|
44
43
|
"vIf",
|
45
44
|
"vShow",
|
46
45
|
"vModel",
|
47
46
|
"vFor",
|
48
47
|
"vBind",
|
49
48
|
"vHtml"
|
50
|
-
],
|
49
|
+
], st = {
|
51
50
|
String,
|
52
51
|
Number,
|
53
52
|
Boolean,
|
@@ -55,54 +54,54 @@ const ue = [
|
|
55
54
|
Object,
|
56
55
|
Function,
|
57
56
|
Date
|
58
|
-
},
|
57
|
+
}, C = "VtjPage", D = "VtjHomepage", nt = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
|
59
58
|
","
|
60
|
-
),
|
61
|
-
function
|
62
|
-
return n.map((t) =>
|
59
|
+
), rt = "component,slot".split(",");
|
60
|
+
function I(n, e) {
|
61
|
+
return n.map((t) => Me(t) || t.startsWith("/") ? t : `${e}${t}`);
|
63
62
|
}
|
64
|
-
function
|
63
|
+
function Z(n) {
|
65
64
|
return /\.css$/.test(n);
|
66
65
|
}
|
67
|
-
function
|
66
|
+
function ee(n) {
|
68
67
|
return /\.js$/.test(n);
|
69
68
|
}
|
70
|
-
function
|
69
|
+
function ot(n) {
|
71
70
|
return /\.json$/.test(n);
|
72
71
|
}
|
73
|
-
function
|
72
|
+
function Ps(n) {
|
74
73
|
return n.map(
|
75
|
-
(e) => `<script src="${
|
74
|
+
(e) => `<script src="${R.append(e, { v: x })}"><\/script>`
|
76
75
|
).join("");
|
77
76
|
}
|
78
|
-
function
|
77
|
+
function xs(n = []) {
|
79
78
|
return n.map(
|
80
|
-
(e) => `<link rel="stylesheet" href="${
|
79
|
+
(e) => `<link rel="stylesheet" href="${R.append(e, { v: x })}" />`
|
81
80
|
).join("");
|
82
81
|
}
|
83
|
-
function
|
82
|
+
function it(n, e = !1) {
|
84
83
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
85
84
|
}
|
86
|
-
function
|
85
|
+
function at(n, e, t = !1) {
|
87
86
|
const s = n.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
|
88
87
|
return s.forEach(
|
89
88
|
({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
|
90
|
-
p?.forEach((
|
91
|
-
|
92
|
-
}), m && (i.push(m), c[m] =
|
89
|
+
p?.forEach((v) => {
|
90
|
+
ee(v) && r.push(it(v, t)), Z(v) && o.push(v);
|
91
|
+
}), m && (i.push(m), c[m] = I(p || [], e), w && (l[m] = w)), h && a.push(h), d && f.push(d), m && d && (u[d] = m);
|
93
92
|
}
|
94
93
|
), {
|
95
|
-
scripts:
|
96
|
-
css:
|
97
|
-
materials:
|
94
|
+
scripts: I(r, e),
|
95
|
+
css: I(o, e),
|
96
|
+
materials: I(a, e),
|
98
97
|
libraryExports: i,
|
99
|
-
materialExports:
|
98
|
+
materialExports: De(f),
|
100
99
|
materialMapLibrary: u,
|
101
100
|
libraryMap: c,
|
102
101
|
libraryLocaleMap: l
|
103
102
|
};
|
104
103
|
}
|
105
|
-
function
|
104
|
+
function ct(n, e) {
|
106
105
|
const { name: t, parent: s, alias: r } = n;
|
107
106
|
return s ? e[s]?.[r || t] : e[r || t];
|
108
107
|
}
|
@@ -124,11 +123,11 @@ function we(n, e, t) {
|
|
124
123
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
125
124
|
}
|
126
125
|
}
|
127
|
-
async function
|
126
|
+
async function lt(n, e) {
|
128
127
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
129
128
|
t && we(window, n, t);
|
130
129
|
}
|
131
|
-
function
|
130
|
+
function ut(n, e = window) {
|
132
131
|
const t = e.document, s = e.document.head;
|
133
132
|
for (const r of n)
|
134
133
|
if (!t.getElementById(r)) {
|
@@ -136,7 +135,7 @@ function ft(n, e = window) {
|
|
136
135
|
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
137
136
|
}
|
138
137
|
}
|
139
|
-
async function
|
138
|
+
async function pt(n, e, t = window) {
|
140
139
|
const s = t.document, r = t.document.head;
|
141
140
|
let o = t[e];
|
142
141
|
return o ? o.default || o : new Promise((a, i) => {
|
@@ -150,16 +149,16 @@ async function ht(n, e, t = window) {
|
|
150
149
|
}
|
151
150
|
});
|
152
151
|
}
|
153
|
-
function
|
154
|
-
return
|
152
|
+
function dt(n) {
|
153
|
+
return V(n) || V(n?.install);
|
155
154
|
}
|
156
|
-
function
|
157
|
-
return
|
155
|
+
function ft(n) {
|
156
|
+
return rt.includes(n);
|
158
157
|
}
|
159
|
-
function
|
160
|
-
return
|
158
|
+
function ht(n) {
|
159
|
+
return nt.includes(n);
|
161
160
|
}
|
162
|
-
function
|
161
|
+
function T(n, e, t = !1, s = !1) {
|
163
162
|
try {
|
164
163
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
165
164
|
r.push("return ");
|
@@ -169,13 +168,13 @@ function A(n, e, t = !1, s = !1) {
|
|
169
168
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
170
169
|
return new Function("$scope", a)(e);
|
171
170
|
} catch (r) {
|
172
|
-
if (
|
171
|
+
if (P.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
173
172
|
throw r;
|
174
173
|
}
|
175
174
|
}
|
176
|
-
function
|
177
|
-
const r =
|
178
|
-
if (typeof r != "function" && (
|
175
|
+
function W(n, e, t = !1, s = !1) {
|
176
|
+
const r = T(n, e, t, s);
|
177
|
+
if (typeof r != "function" && (P.error(
|
179
178
|
"parseFunction.error",
|
180
179
|
"not a function",
|
181
180
|
n,
|
@@ -187,111 +186,16 @@ function G(n, e, t = !1, s = !1) {
|
|
187
186
|
function _(n) {
|
188
187
|
return n && n.type === "JSExpression";
|
189
188
|
}
|
190
|
-
function
|
189
|
+
function A(n) {
|
191
190
|
return typeof n == "object" && n && n.type === "JSFunction";
|
192
191
|
}
|
193
|
-
function
|
194
|
-
return _(n) ||
|
195
|
-
}
|
196
|
-
function Ms(n) {
|
197
|
-
return yt(n) ? n.value : JSON.stringify(n);
|
198
|
-
}
|
199
|
-
let R = null;
|
200
|
-
const _t = De({
|
201
|
-
settings: {
|
202
|
-
type: "form",
|
203
|
-
validSuccess: !0,
|
204
|
-
originResponse: !1,
|
205
|
-
loading: !0,
|
206
|
-
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
207
|
-
failMessage: !0,
|
208
|
-
showError: (n) => {
|
209
|
-
U.error({
|
210
|
-
message: n || "未知错误"
|
211
|
-
});
|
212
|
-
},
|
213
|
-
showLoading: () => {
|
214
|
-
R && R.close(), R = nt.service({
|
215
|
-
lock: !0,
|
216
|
-
text: "Loading",
|
217
|
-
background: "rgba(0, 0, 0, 0.05)"
|
218
|
-
});
|
219
|
-
},
|
220
|
-
hideLoading: () => {
|
221
|
-
R && (R.close(), R = null);
|
222
|
-
}
|
223
|
-
}
|
224
|
-
});
|
225
|
-
function wt(n, e) {
|
226
|
-
const { jsonp: t, request: s } = e;
|
227
|
-
if (n.method === "jsonp")
|
228
|
-
return (r = {}) => t(n.url, {
|
229
|
-
...n.jsonpOptions,
|
230
|
-
query: r
|
231
|
-
});
|
232
|
-
{
|
233
|
-
const r = n.headers ? A(n.headers, {}, !0) : void 0, o = {
|
234
|
-
url: n.url,
|
235
|
-
method: n.method,
|
236
|
-
settings: {
|
237
|
-
...n.settings,
|
238
|
-
headers: r
|
239
|
-
}
|
240
|
-
};
|
241
|
-
return (a, i) => (delete o.data, s.send(He(o, i || {}, { data: a })));
|
242
|
-
}
|
243
|
-
}
|
244
|
-
function St(n, e) {
|
245
|
-
const { metaQuery: t } = e;
|
246
|
-
if (!t) return;
|
247
|
-
const { code: s, queryCode: r } = n;
|
248
|
-
return (o, a) => {
|
249
|
-
if (!t) {
|
250
|
-
console.warn("adapter.metaQuery is not defined!");
|
251
|
-
return;
|
252
|
-
}
|
253
|
-
return t(s, r, o, a);
|
254
|
-
};
|
255
|
-
}
|
256
|
-
function bt(n = [], e = [], t) {
|
257
|
-
const s = {};
|
258
|
-
for (const r of n)
|
259
|
-
s[r.id] = wt(r, t);
|
260
|
-
for (const r of e)
|
261
|
-
s[r.id] = St(r, t);
|
262
|
-
return s;
|
263
|
-
}
|
264
|
-
async function jt(n = []) {
|
265
|
-
E && (Se(), n.forEach((e) => Et(E, e)));
|
266
|
-
}
|
267
|
-
function $t(n) {
|
268
|
-
const e = I(n.mockTemplate) && n.mockTemplate.value ? G(n.mockTemplate, {}, !0) : void 0;
|
269
|
-
return async (...t) => {
|
270
|
-
let s = {};
|
271
|
-
if (e)
|
272
|
-
try {
|
273
|
-
s = await e.apply(e, t);
|
274
|
-
} catch (r) {
|
275
|
-
x.warn("模拟数据模版异常", r);
|
276
|
-
}
|
277
|
-
return E.mock(s);
|
278
|
-
};
|
279
|
-
}
|
280
|
-
function Et(n, e) {
|
281
|
-
if (!e.mock) return;
|
282
|
-
const { url: t, mockTemplate: s } = e;
|
283
|
-
if (t && s) {
|
284
|
-
const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
|
285
|
-
n.mock(r, (i) => {
|
286
|
-
const c = P.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
|
287
|
-
return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
|
288
|
-
});
|
289
|
-
}
|
192
|
+
function mt(n) {
|
193
|
+
return _(n) || A(n);
|
290
194
|
}
|
291
|
-
function
|
292
|
-
|
195
|
+
function Cs(n) {
|
196
|
+
return mt(n) ? n.value : JSON.stringify(n);
|
293
197
|
}
|
294
|
-
const
|
198
|
+
const vt = {
|
295
199
|
session: !1,
|
296
200
|
authKey: "Authorization",
|
297
201
|
storageKey: "ACCESS_STORAGE",
|
@@ -303,13 +207,13 @@ const kt = {
|
|
303
207
|
unauthorizedMessage: "登录已经失效,请重新登录!",
|
304
208
|
noPermissionMessage: "无权限访问该页面",
|
305
209
|
appName: ""
|
306
|
-
},
|
307
|
-
class
|
210
|
+
}, Se = Symbol("access");
|
211
|
+
class Fs {
|
308
212
|
options;
|
309
213
|
data = null;
|
310
214
|
mode = y.Raw;
|
311
215
|
constructor(e) {
|
312
|
-
this.options = Object.assign({},
|
216
|
+
this.options = Object.assign({}, vt, e), this.loadData();
|
313
217
|
}
|
314
218
|
connect(e) {
|
315
219
|
const { mode: t, router: s, request: r } = e;
|
@@ -317,17 +221,17 @@ class Ds {
|
|
317
221
|
}
|
318
222
|
login(e) {
|
319
223
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
320
|
-
this.setData(e), this.data && (
|
224
|
+
this.setData(e), this.data && (U.save(t, e, {
|
321
225
|
type: "local",
|
322
226
|
prefix: s
|
323
|
-
}), r &&
|
227
|
+
}), r && L.set(o, this.data.token));
|
324
228
|
}
|
325
229
|
clear() {
|
326
230
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
327
|
-
this.data = null,
|
231
|
+
this.data = null, U.remove(e, {
|
328
232
|
type: "local",
|
329
233
|
prefix: t
|
330
|
-
}), s &&
|
234
|
+
}), s && L.remove(r);
|
331
235
|
}
|
332
236
|
logout() {
|
333
237
|
this.clear(), this.toLogin();
|
@@ -340,14 +244,14 @@ class Ds {
|
|
340
244
|
}
|
341
245
|
can(e) {
|
342
246
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
343
|
-
return typeof e == "function" ? e(s) :
|
247
|
+
return typeof e == "function" ? e(s) : re(e).every((o) => s[o] || s[t + "." + o]);
|
344
248
|
}
|
345
249
|
some(e) {
|
346
250
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
347
|
-
return
|
251
|
+
return re(e).some((o) => s[o] || s[t + "." + o]);
|
348
252
|
}
|
349
253
|
install(e) {
|
350
|
-
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(
|
254
|
+
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(Se, this);
|
351
255
|
}
|
352
256
|
isAuthPath(e) {
|
353
257
|
const { auth: t, isAuth: s } = this.options;
|
@@ -368,13 +272,13 @@ class Ds {
|
|
368
272
|
setData(e) {
|
369
273
|
const { privateKey: t } = this.options;
|
370
274
|
if (Array.isArray(e) && t) {
|
371
|
-
const s = e.map((r) =>
|
275
|
+
const s = e.map((r) => oe(r, t));
|
372
276
|
this.data = JSON.parse(s.join(""));
|
373
277
|
return;
|
374
278
|
}
|
375
279
|
if (typeof e == "string")
|
376
280
|
try {
|
377
|
-
const s = t ?
|
281
|
+
const s = t ? oe(e, t) : e;
|
378
282
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
379
283
|
} catch (s) {
|
380
284
|
console.warn(s);
|
@@ -383,7 +287,7 @@ class Ds {
|
|
383
287
|
this.data = e;
|
384
288
|
}
|
385
289
|
loadData() {
|
386
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
290
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = U.get(e, {
|
387
291
|
type: "local",
|
388
292
|
prefix: t
|
389
293
|
});
|
@@ -391,10 +295,10 @@ class Ds {
|
|
391
295
|
}
|
392
296
|
isLogined() {
|
393
297
|
const { session: e, authKey: t } = this.options;
|
394
|
-
return e && t ? !!
|
298
|
+
return e && t ? !!L.get(t) : !!this.getToken();
|
395
299
|
}
|
396
300
|
hasRoutePermission(e) {
|
397
|
-
if (e.name ===
|
301
|
+
if (e.name === C) {
|
398
302
|
const t = e.params.id;
|
399
303
|
return t && this.can(t);
|
400
304
|
}
|
@@ -411,7 +315,7 @@ class Ds {
|
|
411
315
|
return t();
|
412
316
|
{
|
413
317
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
414
|
-
return await this.showTip(s),
|
318
|
+
return await this.showTip(s), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
415
319
|
}
|
416
320
|
}
|
417
321
|
t(!1), this.toLogin();
|
@@ -430,7 +334,7 @@ class Ds {
|
|
430
334
|
}
|
431
335
|
async showTip(e) {
|
432
336
|
const { alert: t } = this.options;
|
433
|
-
return t ? (await
|
337
|
+
return t ? (await pe(150), await t(e, {
|
434
338
|
title: "提示",
|
435
339
|
type: "warning"
|
436
340
|
}).catch(() => !1)) : !1;
|
@@ -445,10 +349,108 @@ class Ds {
|
|
445
349
|
);
|
446
350
|
}
|
447
351
|
}
|
448
|
-
function
|
449
|
-
return he(
|
352
|
+
function gt() {
|
353
|
+
return he(Se, null);
|
354
|
+
}
|
355
|
+
function Ts(n = {}) {
|
356
|
+
const { notify: e, loading: t, settings: s = {} } = n;
|
357
|
+
let r = null;
|
358
|
+
return {
|
359
|
+
request: de({
|
360
|
+
settings: {
|
361
|
+
type: "form",
|
362
|
+
validSuccess: !0,
|
363
|
+
originResponse: !1,
|
364
|
+
loading: !0,
|
365
|
+
validate: (a) => a.data?.code === 0 || !!a.data?.success,
|
366
|
+
failMessage: !0,
|
367
|
+
showError: (a) => {
|
368
|
+
e && e(a || "未知错误");
|
369
|
+
},
|
370
|
+
showLoading: () => {
|
371
|
+
r && r.close(), t && (r = t());
|
372
|
+
},
|
373
|
+
hideLoading: () => {
|
374
|
+
r && (r.close(), r = null);
|
375
|
+
},
|
376
|
+
...s
|
377
|
+
}
|
378
|
+
}),
|
379
|
+
jsonp: fe,
|
380
|
+
notify: e,
|
381
|
+
loading: t
|
382
|
+
};
|
383
|
+
}
|
384
|
+
function yt(n, e) {
|
385
|
+
const { jsonp: t, request: s } = e;
|
386
|
+
if (n.method === "jsonp")
|
387
|
+
return (r = {}) => t(n.url, {
|
388
|
+
...n.jsonpOptions,
|
389
|
+
query: r
|
390
|
+
});
|
391
|
+
{
|
392
|
+
const r = n.headers ? T(n.headers, {}, !0) : void 0, o = {
|
393
|
+
url: n.url,
|
394
|
+
method: n.method,
|
395
|
+
settings: {
|
396
|
+
...n.settings,
|
397
|
+
headers: r
|
398
|
+
}
|
399
|
+
};
|
400
|
+
return (a, i) => (delete o.data, s.send(He(o, i || {}, { data: a })));
|
401
|
+
}
|
402
|
+
}
|
403
|
+
function _t(n, e) {
|
404
|
+
const { metaQuery: t } = e;
|
405
|
+
if (!t) return;
|
406
|
+
const { code: s, queryCode: r } = n;
|
407
|
+
return (o, a) => {
|
408
|
+
if (!t) {
|
409
|
+
console.warn("adapter.metaQuery is not defined!");
|
410
|
+
return;
|
411
|
+
}
|
412
|
+
return t(s, r, o, a);
|
413
|
+
};
|
414
|
+
}
|
415
|
+
function wt(n = [], e = [], t) {
|
416
|
+
const s = {};
|
417
|
+
for (const r of n)
|
418
|
+
s[r.id] = yt(r, t);
|
419
|
+
for (const r of e)
|
420
|
+
s[r.id] = _t(r, t);
|
421
|
+
return s;
|
450
422
|
}
|
451
|
-
|
423
|
+
async function St(n = []) {
|
424
|
+
E && (be(), n.forEach((e) => jt(E, e)));
|
425
|
+
}
|
426
|
+
function bt(n) {
|
427
|
+
const e = A(n.mockTemplate) && n.mockTemplate.value ? W(n.mockTemplate, {}, !0) : void 0;
|
428
|
+
return async (...t) => {
|
429
|
+
let s = {};
|
430
|
+
if (e)
|
431
|
+
try {
|
432
|
+
s = await e.apply(e, t);
|
433
|
+
} catch (r) {
|
434
|
+
P.warn("模拟数据模版异常", r);
|
435
|
+
}
|
436
|
+
return E.mock(s);
|
437
|
+
};
|
438
|
+
}
|
439
|
+
function jt(n, e) {
|
440
|
+
if (!e.mock) return;
|
441
|
+
const { url: t, mockTemplate: s } = e;
|
442
|
+
if (t && s) {
|
443
|
+
const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = T(s, {}, !0);
|
444
|
+
n.mock(r, (i) => {
|
445
|
+
const c = R.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
|
446
|
+
return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
|
447
|
+
});
|
448
|
+
}
|
449
|
+
}
|
450
|
+
function be() {
|
451
|
+
E && (E._mocked = {});
|
452
|
+
}
|
453
|
+
class $t {
|
452
454
|
__id = null;
|
453
455
|
__mode;
|
454
456
|
__instance = null;
|
@@ -477,7 +479,7 @@ class Pt {
|
|
477
479
|
const { mode: t, dsl: s, attrs: r } = e;
|
478
480
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
479
481
|
}
|
480
|
-
setup(e, t =
|
482
|
+
setup(e, t = B) {
|
481
483
|
const s = t.getCurrentInstance();
|
482
484
|
if (!s) return;
|
483
485
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -491,12 +493,12 @@ class Pt {
|
|
491
493
|
});
|
492
494
|
}
|
493
495
|
__proxy() {
|
494
|
-
this.__instance &&
|
496
|
+
this.__instance && ce.forEach((e) => {
|
495
497
|
this[e] = this.__instance?.[e];
|
496
498
|
});
|
497
499
|
}
|
498
500
|
__cleanup() {
|
499
|
-
|
501
|
+
ce.forEach((e) => {
|
500
502
|
this[e] = null;
|
501
503
|
});
|
502
504
|
}
|
@@ -504,22 +506,22 @@ class Pt {
|
|
504
506
|
if (e)
|
505
507
|
if (this.__mode === y.Runtime) {
|
506
508
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
507
|
-
return
|
509
|
+
return W({ type: s, value: r }, this);
|
508
510
|
} else
|
509
|
-
return
|
511
|
+
return W(e, this);
|
510
512
|
}
|
511
513
|
__parseExpression(e) {
|
512
514
|
if (e)
|
513
515
|
if (this.__mode === y.Runtime) {
|
514
516
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
515
|
-
return
|
517
|
+
return T({ type: s, value: r }, this);
|
516
518
|
} else
|
517
|
-
return
|
519
|
+
return T(e, this);
|
518
520
|
}
|
519
521
|
__ref(e = null, t) {
|
520
522
|
if (this.__mode !== y.VNode)
|
521
523
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
522
|
-
await
|
524
|
+
await pe(0);
|
523
525
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
524
526
|
if (!r) {
|
525
527
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
@@ -546,9 +548,9 @@ class Pt {
|
|
546
548
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
547
549
|
}
|
548
550
|
}
|
549
|
-
function
|
551
|
+
function G(n) {
|
550
552
|
const {
|
551
|
-
Vue: e =
|
553
|
+
Vue: e = B,
|
552
554
|
mode: t = y.Runtime,
|
553
555
|
components: s = {},
|
554
556
|
libs: r = {},
|
@@ -558,22 +560,22 @@ function Y(n) {
|
|
558
560
|
$components: s,
|
559
561
|
$libs: r,
|
560
562
|
$apis: o
|
561
|
-
}, l = new
|
563
|
+
}, l = new $t({
|
562
564
|
mode: t,
|
563
565
|
dsl: i.value,
|
564
566
|
attrs: c
|
565
567
|
}), f = e.defineComponent({
|
566
568
|
name: i.value.name,
|
567
569
|
props: {
|
568
|
-
...
|
570
|
+
...kt(i.value.props ?? [], l)
|
569
571
|
},
|
570
572
|
setup(u) {
|
571
573
|
l.$props = u, l.props = u, i.value.id && we(
|
572
574
|
n.window || window,
|
573
575
|
i.value.id,
|
574
576
|
i.value.css || ""
|
575
|
-
), l.state =
|
576
|
-
const p =
|
577
|
+
), l.state = Rt(e, i.value.state ?? {}, l);
|
578
|
+
const p = Pt(e, i.value.computed ?? {}, l), h = xt(i.value.methods ?? {}, l), m = Ct(e, i.value.inject, l), d = Ft(
|
577
579
|
i.value.dataSources || {},
|
578
580
|
l
|
579
581
|
), w = {
|
@@ -582,29 +584,29 @@ function Y(n) {
|
|
582
584
|
...h,
|
583
585
|
...d
|
584
586
|
};
|
585
|
-
return l.setup(w, e),
|
587
|
+
return l.setup(w, e), Tt(e, i.value.watch ?? [], l), {
|
586
588
|
vtj: l
|
587
589
|
};
|
588
590
|
},
|
589
|
-
emits:
|
591
|
+
emits: Et(i.value.emits),
|
590
592
|
expose: ["vtj"],
|
591
593
|
render() {
|
592
594
|
if (!i.value.nodes) return null;
|
593
595
|
const u = i.value.nodes || [];
|
594
|
-
return u.length === 1 ?
|
596
|
+
return u.length === 1 ? O(u[0], l, e, a) : u.map((p) => O(p, l, e, a));
|
595
597
|
},
|
596
|
-
...
|
598
|
+
...At(i.value.lifeCycles ?? {}, l)
|
597
599
|
});
|
598
600
|
return {
|
599
601
|
renderer: e.markRaw(f),
|
600
602
|
context: l
|
601
603
|
};
|
602
604
|
}
|
603
|
-
function
|
605
|
+
function Et(n = []) {
|
604
606
|
return n.map((e) => j(e) ? e : e.name);
|
605
607
|
}
|
606
|
-
function
|
607
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) =>
|
608
|
+
function kt(n = [], e) {
|
609
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => st[o]) : void 0;
|
608
610
|
return n.map((s) => j(s) ? {
|
609
611
|
name: s
|
610
612
|
} : {
|
@@ -621,30 +623,30 @@ function Ct(n = [], e) {
|
|
621
623
|
{}
|
622
624
|
);
|
623
625
|
}
|
624
|
-
function
|
626
|
+
function Rt(n, e, t) {
|
625
627
|
return n.reactive(
|
626
628
|
Object.keys(e || {}).reduce(
|
627
629
|
(s, r) => {
|
628
630
|
let o = e[r];
|
629
|
-
return _(o) ? o = t.__parseExpression(o) :
|
631
|
+
return _(o) ? o = t.__parseExpression(o) : A(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
630
632
|
},
|
631
633
|
{}
|
632
634
|
)
|
633
635
|
);
|
634
636
|
}
|
635
|
-
function
|
637
|
+
function Pt(n, e, t) {
|
636
638
|
return Object.entries(e ?? {}).reduce(
|
637
639
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
638
640
|
{}
|
639
641
|
);
|
640
642
|
}
|
641
|
-
function
|
643
|
+
function xt(n, e) {
|
642
644
|
return Object.entries(n ?? {}).reduce(
|
643
645
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
644
646
|
{}
|
645
647
|
);
|
646
648
|
}
|
647
|
-
function
|
649
|
+
function Ct(n, e = [], t) {
|
648
650
|
return e.reduce(
|
649
651
|
(s, r) => {
|
650
652
|
const { name: o, from: a } = r || {};
|
@@ -655,14 +657,14 @@ function It(n, e = [], t) {
|
|
655
657
|
{}
|
656
658
|
);
|
657
659
|
}
|
658
|
-
function
|
660
|
+
function Ft(n, e) {
|
659
661
|
return Object.keys(n).reduce(
|
660
662
|
(t, s) => {
|
661
663
|
const r = n[s];
|
662
664
|
if (r.type === "mock")
|
663
|
-
t[s] =
|
665
|
+
t[s] = bt(r);
|
664
666
|
else if (r.ref) {
|
665
|
-
const o = e.$apis[r.ref], a =
|
667
|
+
const o = e.$apis[r.ref], a = A(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
666
668
|
t[s] = async (...i) => {
|
667
669
|
const c = await o.apply(e, i);
|
668
670
|
return a ? a(c) : c;
|
@@ -673,7 +675,7 @@ function Mt(n, e) {
|
|
673
675
|
{}
|
674
676
|
);
|
675
677
|
}
|
676
|
-
function
|
678
|
+
function Tt(n, e = [], t) {
|
677
679
|
e.forEach((s) => {
|
678
680
|
n.watch(
|
679
681
|
t.__parseExpression(s.source),
|
@@ -685,84 +687,84 @@ function Dt(n, e = [], t) {
|
|
685
687
|
);
|
686
688
|
});
|
687
689
|
}
|
688
|
-
function
|
690
|
+
function At(n, e) {
|
689
691
|
return Object.entries(n ?? {}).reduce(
|
690
692
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
691
693
|
{}
|
692
694
|
);
|
693
695
|
}
|
694
|
-
let
|
695
|
-
const
|
696
|
+
let J = [];
|
697
|
+
const It = (n) => n;
|
696
698
|
async function je(n, e = window) {
|
697
|
-
const { urls: t = [], library: s } = n, r = t.filter((i) =>
|
699
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => ee(i));
|
698
700
|
if (r.length === 0 || !s) return null;
|
699
|
-
const o = t.filter((i) =>
|
700
|
-
return o.length &&
|
701
|
+
const o = t.filter((i) => Z(i));
|
702
|
+
return o.length && ut(o, e), await pt(r, s, e).catch(
|
701
703
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
702
704
|
);
|
703
705
|
}
|
704
|
-
function
|
706
|
+
function Y(n) {
|
705
707
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
706
|
-
return s.window && (
|
708
|
+
return s.window && (J.forEach((r) => {
|
707
709
|
delete s.window[r];
|
708
|
-
}),
|
710
|
+
}), J = []), (r, o, a = B) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
709
711
|
const i = await e(o.id);
|
710
|
-
return i && (i.name = r), i ?
|
712
|
+
return i && (i.name = r), i ? G({
|
711
713
|
...s,
|
712
714
|
Vue: a,
|
713
715
|
dsl: i,
|
714
716
|
mode: y.Runtime,
|
715
|
-
loader:
|
717
|
+
loader: Y(n)
|
716
718
|
}).renderer : null;
|
717
719
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
718
720
|
const i = await t(o.url);
|
719
|
-
return i && (i.name = r), i ?
|
721
|
+
return i && (i.name = r), i ? G({
|
720
722
|
...s,
|
721
723
|
Vue: a,
|
722
724
|
dsl: i,
|
723
725
|
mode: y.Runtime,
|
724
|
-
loader:
|
726
|
+
loader: Y(n)
|
725
727
|
}).renderer : null;
|
726
|
-
}) : o.type === "Plugin" ? (o.library &&
|
728
|
+
}) : o.type === "Plugin" ? (o.library && J.push(o.library), a.defineAsyncComponent(async () => {
|
727
729
|
const i = await je(o, s.window);
|
728
730
|
return i || (console.warn("getPlugin result is null", o), null);
|
729
731
|
})) : r;
|
730
732
|
}
|
731
|
-
function
|
733
|
+
function O(n, e, t = B, s = It) {
|
732
734
|
if (!n || !n.name || n.invisible) return null;
|
733
|
-
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: p, others: h } =
|
734
|
-
if (i && !
|
735
|
+
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: p, others: h } = Dt(a);
|
736
|
+
if (i && !Ht(i, e))
|
735
737
|
return null;
|
736
738
|
const m = (d) => {
|
737
|
-
const w = d.$components,
|
739
|
+
const w = d.$components, v = (() => {
|
738
740
|
if (n.name === "component")
|
739
|
-
return
|
741
|
+
return Ot(d, n.props?.is);
|
740
742
|
if (n.name === "slot") return n.name;
|
741
743
|
const b = s(n.name, n.from, t);
|
742
|
-
return j(b) ?
|
743
|
-
})(), S =
|
744
|
+
return j(b) ? ft(b) || ht(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
|
745
|
+
})(), S = Bt(o, n.props ?? {}, d), Fe = Nt(t, n.events ?? {}, d);
|
744
746
|
if (n.name === "slot")
|
745
|
-
return
|
747
|
+
return Ut(t, n, S, d, s);
|
746
748
|
u && Object.assign(S, d.__parseExpression(u.value)), l && (S.style = Object.assign(
|
747
749
|
S.style ?? {},
|
748
|
-
|
749
|
-
)), p && Object.assign(S,
|
750
|
-
Object.assign(S,
|
750
|
+
qt(l, d)
|
751
|
+
)), p && Object.assign(S, Jt(p, d)), f.forEach((b) => {
|
752
|
+
Object.assign(S, Vt(t, b, d));
|
751
753
|
});
|
752
|
-
const
|
754
|
+
const Te = zt(
|
753
755
|
t,
|
754
756
|
n.children ?? [],
|
755
757
|
d,
|
756
758
|
s,
|
757
759
|
n
|
758
760
|
);
|
759
|
-
let
|
760
|
-
const
|
761
|
-
return
|
761
|
+
let N = t.createVNode(v, { ...S, ...Fe }, Te);
|
762
|
+
const ne = r ? Mt(r, h, d) : [];
|
763
|
+
return ne.length && (N = t.withDirectives(N, ne)), N;
|
762
764
|
};
|
763
|
-
return c ?
|
765
|
+
return c ? Gt(c, m, e) : m(e);
|
764
766
|
}
|
765
|
-
function
|
767
|
+
function Mt(n, e, t) {
|
766
768
|
const s = n.app;
|
767
769
|
return e.map((r) => {
|
768
770
|
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
@@ -771,11 +773,11 @@ function Bt(n, e, t) {
|
|
771
773
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
772
774
|
}).filter((r) => !!r);
|
773
775
|
}
|
774
|
-
function
|
776
|
+
function Dt(n = []) {
|
775
777
|
const e = n.find((c) => $(c.name) === "vIf"), t = n.find((c) => $(c.name) === "vFor"), s = n.find((c) => $(c.name) === "vShow"), r = n.find((c) => $(c.name) === "vBind"), o = n.find((c) => $(c.name) === "vHtml"), a = n.filter(
|
776
778
|
(c) => $(c.name) === "vModel"
|
777
779
|
), i = n.filter(
|
778
|
-
(c) => !
|
780
|
+
(c) => !tt.includes($(c.name))
|
779
781
|
);
|
780
782
|
return {
|
781
783
|
vIf: e,
|
@@ -787,23 +789,23 @@ function Nt(n = []) {
|
|
787
789
|
vHtml: o
|
788
790
|
};
|
789
791
|
}
|
790
|
-
function
|
792
|
+
function Ht(n, e) {
|
791
793
|
return !!e.__parseExpression(n.value);
|
792
794
|
}
|
793
|
-
function
|
795
|
+
function Ot(n, e) {
|
794
796
|
return e ? _(e) ? n.__parseExpression(e) : e : "div";
|
795
797
|
}
|
796
|
-
function
|
798
|
+
function Bt(n, e, t) {
|
797
799
|
const s = Object.keys(e || {}).reduce(
|
798
800
|
(r, o) => {
|
799
801
|
let a = e[o];
|
800
|
-
return _(a) ? a = t.__parseExpression(a) :
|
802
|
+
return _(a) ? a = t.__parseExpression(a) : A(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
801
803
|
},
|
802
804
|
{}
|
803
805
|
);
|
804
806
|
return s.ref = t.__ref(n, s.ref), s;
|
805
807
|
}
|
806
|
-
function
|
808
|
+
function Nt(n, e, t) {
|
807
809
|
const s = ["passive", "capture", "once"], r = {
|
808
810
|
capture: "Capture",
|
809
811
|
once: "Once",
|
@@ -821,32 +823,32 @@ function $e(n = {}, e = !1) {
|
|
821
823
|
const t = Object.keys(n);
|
822
824
|
return e ? t.map((s) => "." + s) : t;
|
823
825
|
}
|
824
|
-
function
|
825
|
-
const { children: o } = e, a =
|
826
|
+
function Ut(n, e, t, s, r) {
|
827
|
+
const { children: o } = e, a = Lt(e, s), i = s.$slots?.[a.name];
|
826
828
|
return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
|
827
829
|
_e(s.__parseExpression(o))
|
828
830
|
) : Array.isArray(o) ? o.map(
|
829
|
-
(c) =>
|
831
|
+
(c) => O(c, s, n, r)
|
830
832
|
) : null : null;
|
831
833
|
}
|
832
|
-
function
|
834
|
+
function Lt(n, e) {
|
833
835
|
const { props: t } = n, s = t?.name || "default";
|
834
836
|
return {
|
835
837
|
name: _(s) ? e.__parseExpression(s) : s,
|
836
838
|
params: []
|
837
839
|
};
|
838
840
|
}
|
839
|
-
function
|
841
|
+
function qt(n, e) {
|
840
842
|
return e.__parseExpression(n.value) ? {} : {
|
841
843
|
display: "none"
|
842
844
|
};
|
843
845
|
}
|
844
|
-
function
|
846
|
+
function Jt(n, e) {
|
845
847
|
return {
|
846
848
|
innerHTML: e.__parseExpression(n.value) || ""
|
847
849
|
};
|
848
850
|
}
|
849
|
-
function
|
851
|
+
function Vt(n, e, t) {
|
850
852
|
const s = {
|
851
853
|
type: "JSFunction",
|
852
854
|
value: e.value?.value ? `(v) => {
|
@@ -860,7 +862,7 @@ function Gt(n, e, t) {
|
|
860
862
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
861
863
|
};
|
862
864
|
}
|
863
|
-
function
|
865
|
+
function zt(n, e, t, s, r) {
|
864
866
|
if (!e) return null;
|
865
867
|
if (j(e))
|
866
868
|
return { default: () => e };
|
@@ -869,19 +871,19 @@ function Yt(n, e, t, s, r) {
|
|
869
871
|
default: () => _e(t.__parseExpression(e))
|
870
872
|
};
|
871
873
|
if (Array.isArray(e) && e.length > 0) {
|
872
|
-
const o =
|
874
|
+
const o = Kt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
873
875
|
[`scope_${r.id}`]: i
|
874
876
|
} : {};
|
875
877
|
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
|
876
878
|
const p = f.length ? Le(u ?? {}, f) : a(u);
|
877
879
|
return l.map(
|
878
|
-
(h) =>
|
880
|
+
(h) => O(h, t.__clone(p), n, s)
|
879
881
|
);
|
880
882
|
}, i), {});
|
881
883
|
}
|
882
884
|
return null;
|
883
885
|
}
|
884
|
-
function
|
886
|
+
function Kt(n) {
|
885
887
|
const e = {
|
886
888
|
default: {
|
887
889
|
params: [],
|
@@ -889,7 +891,7 @@ function Qt(n) {
|
|
889
891
|
}
|
890
892
|
};
|
891
893
|
for (const t of n) {
|
892
|
-
const s =
|
894
|
+
const s = Wt(t.slot), r = s.name;
|
893
895
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
894
896
|
nodes: [t],
|
895
897
|
params: s.params
|
@@ -897,61 +899,61 @@ function Qt(n) {
|
|
897
899
|
}
|
898
900
|
return e;
|
899
901
|
}
|
900
|
-
function
|
902
|
+
function Wt(n = "default") {
|
901
903
|
return j(n) ? { name: n, params: [] } : { params: [], ...n };
|
902
904
|
}
|
903
|
-
function
|
905
|
+
function Gt(n, e, t) {
|
904
906
|
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
905
907
|
let i = t.__parseExpression(s) || [];
|
906
908
|
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((c, l) => l + 1)), Array.isArray(i) ? i.map((c, l) => e(t.__clone({ [o]: c, [a]: l }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
907
909
|
}
|
908
|
-
function
|
909
|
-
return
|
910
|
+
function Yt(n) {
|
911
|
+
return We() ? (Ge(n), !0) : !1;
|
910
912
|
}
|
911
|
-
function
|
912
|
-
return typeof n == "function" ? n() :
|
913
|
+
function te(n) {
|
914
|
+
return typeof n == "function" ? n() : Ye(n);
|
913
915
|
}
|
914
916
|
const Ee = typeof window < "u" && typeof document < "u";
|
915
917
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
916
|
-
const
|
918
|
+
const Qt = (n) => n != null, Xt = () => {
|
917
919
|
};
|
918
|
-
function
|
920
|
+
function Zt(n) {
|
919
921
|
return me();
|
920
922
|
}
|
921
|
-
function
|
923
|
+
function es(...n) {
|
922
924
|
if (n.length !== 1)
|
923
|
-
return
|
925
|
+
return Je(...n);
|
924
926
|
const e = n[0];
|
925
|
-
return typeof e == "function" ?
|
927
|
+
return typeof e == "function" ? Ve(ze(() => ({ get: e, set: Xt }))) : F(e);
|
926
928
|
}
|
927
|
-
function
|
928
|
-
|
929
|
+
function ts(n, e) {
|
930
|
+
Zt() && Ke(n, e);
|
929
931
|
}
|
930
|
-
const
|
931
|
-
function
|
932
|
+
const ss = Ee ? window : void 0, ns = Ee ? window.document : void 0;
|
933
|
+
function rs(n) {
|
932
934
|
var e;
|
933
|
-
const t =
|
935
|
+
const t = te(n);
|
934
936
|
return (e = t?.$el) != null ? e : t;
|
935
937
|
}
|
936
|
-
function
|
937
|
-
const n =
|
938
|
-
return e &&
|
938
|
+
function os() {
|
939
|
+
const n = F(!1), e = me();
|
940
|
+
return e && Qe(() => {
|
939
941
|
n.value = !0;
|
940
942
|
}, e), n;
|
941
943
|
}
|
942
|
-
function
|
943
|
-
const e =
|
944
|
-
return
|
944
|
+
function is(n) {
|
945
|
+
const e = os();
|
946
|
+
return ge(() => (e.value, !!n()));
|
945
947
|
}
|
946
|
-
function
|
947
|
-
const { window: s =
|
948
|
+
function as(n, e, t = {}) {
|
949
|
+
const { window: s = ss, ...r } = t;
|
948
950
|
let o;
|
949
|
-
const a =
|
951
|
+
const a = is(() => s && "MutationObserver" in s), i = () => {
|
950
952
|
o && (o.disconnect(), o = void 0);
|
951
|
-
}, c =
|
952
|
-
const p =
|
953
|
+
}, c = ge(() => {
|
954
|
+
const p = te(n), h = (Array.isArray(p) ? p : [p]).map(rs).filter(Qt);
|
953
955
|
return new Set(h);
|
954
|
-
}), l =
|
956
|
+
}), l = ve(
|
955
957
|
() => c.value,
|
956
958
|
(p) => {
|
957
959
|
i(), a.value && p.size && (o = new MutationObserver(e), p.forEach((h) => o.observe(h, r)));
|
@@ -960,48 +962,48 @@ function ps(n, e, t = {}) {
|
|
960
962
|
), f = () => o?.takeRecords(), u = () => {
|
961
963
|
l(), i();
|
962
964
|
};
|
963
|
-
return
|
965
|
+
return Yt(u), {
|
964
966
|
isSupported: a,
|
965
967
|
stop: u,
|
966
968
|
takeRecords: f
|
967
969
|
};
|
968
970
|
}
|
969
|
-
function
|
971
|
+
function cs(n = null, e = {}) {
|
970
972
|
var t, s, r;
|
971
973
|
const {
|
972
|
-
document: o =
|
974
|
+
document: o = ns,
|
973
975
|
restoreOnUnmount: a = (u) => u
|
974
|
-
} = e, i = (t = o?.title) != null ? t : "", c =
|
976
|
+
} = e, i = (t = o?.title) != null ? t : "", c = es((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
|
975
977
|
function f(u) {
|
976
978
|
if (!("titleTemplate" in e))
|
977
979
|
return u;
|
978
980
|
const p = e.titleTemplate || "%s";
|
979
|
-
return typeof p == "function" ? p(u) :
|
981
|
+
return typeof p == "function" ? p(u) : te(p).replace(/%s/g, u);
|
980
982
|
}
|
981
|
-
return
|
983
|
+
return ve(
|
982
984
|
c,
|
983
985
|
(u, p) => {
|
984
986
|
u !== p && o && (o.title = f(typeof u == "string" ? u : ""));
|
985
987
|
},
|
986
988
|
{ immediate: !0 }
|
987
|
-
), e.observe && !e.titleTemplate && o && !l &&
|
989
|
+
), e.observe && !e.titleTemplate && o && !l && as(
|
988
990
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
989
991
|
() => {
|
990
992
|
o && o.title !== c.value && (c.value = f(o.title));
|
991
993
|
},
|
992
994
|
{ childList: !0 }
|
993
|
-
),
|
995
|
+
), ts(() => {
|
994
996
|
if (a) {
|
995
997
|
const u = a(i, c.value || "");
|
996
998
|
u != null && o && (o.title = u);
|
997
999
|
}
|
998
1000
|
}), c;
|
999
1001
|
}
|
1000
|
-
const
|
1002
|
+
const le = X({
|
1001
1003
|
name: "VtjPageContainer",
|
1002
1004
|
async setup() {
|
1003
|
-
const n = Re(), e = ye(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o =
|
1004
|
-
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }),
|
1005
|
+
const n = Re(), e = ye(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = F(Symbol());
|
1006
|
+
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), cs(s.title || "VTJ")), {
|
1005
1007
|
provider: n,
|
1006
1008
|
component: r,
|
1007
1009
|
file: s,
|
@@ -1013,27 +1015,27 @@ const pe = Z({
|
|
1013
1015
|
},
|
1014
1016
|
render() {
|
1015
1017
|
const { component: n, query: e, sid: t } = this;
|
1016
|
-
return n ?
|
1018
|
+
return n ? K(n, { ...e, key: t }) : K("div", "页面不存在");
|
1017
1019
|
},
|
1018
1020
|
activated() {
|
1019
1021
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1020
1022
|
}
|
1021
|
-
}),
|
1023
|
+
}), ls = {
|
1022
1024
|
"data-l-h6o7ki7": "",
|
1023
1025
|
class: "vtj-startup__wrapper"
|
1024
|
-
},
|
1026
|
+
}, us = {
|
1025
1027
|
"data-l-h6o7ki7": "",
|
1026
1028
|
class: "vtj-startup"
|
1027
|
-
},
|
1029
|
+
}, ps = {
|
1028
1030
|
"data-l-h6o7ki7": "",
|
1029
1031
|
class: "vtj-startup__name"
|
1030
|
-
},
|
1032
|
+
}, ds = { "data-l-h6o7ki7": "" }, fs = {
|
1031
1033
|
"data-l-h6o7ki7": "",
|
1032
1034
|
class: "vtj-startup__tagline"
|
1033
|
-
},
|
1035
|
+
}, hs = {
|
1034
1036
|
"data-l-h6o7ki7": "",
|
1035
1037
|
class: "vtj-startup__actions"
|
1036
|
-
},
|
1038
|
+
}, ms = /* @__PURE__ */ X({
|
1037
1039
|
__name: "Startup",
|
1038
1040
|
props: {
|
1039
1041
|
name: { default: "VTJ.PRO" },
|
@@ -1121,29 +1123,29 @@ const pe = Z({
|
|
1121
1123
|
window.location.href = o;
|
1122
1124
|
}
|
1123
1125
|
};
|
1124
|
-
return (r, o) => (
|
1125
|
-
k("div",
|
1126
|
-
k("h1",
|
1127
|
-
k("span",
|
1126
|
+
return (r, o) => (Xe(), Ze("div", ls, [
|
1127
|
+
k("div", us, [
|
1128
|
+
k("h1", ps, [
|
1129
|
+
k("span", ds, q(t.name), 1)
|
1128
1130
|
]),
|
1129
|
-
k("div",
|
1130
|
-
k("div",
|
1131
|
+
k("div", fs, q(t.tagline), 1),
|
1132
|
+
k("div", hs, [
|
1131
1133
|
k("button", {
|
1132
1134
|
"data-l-h6o7ki7": "",
|
1133
1135
|
onClick: s
|
1134
|
-
},
|
1136
|
+
}, q(t.actionText), 1)
|
1135
1137
|
])
|
1136
1138
|
])
|
1137
1139
|
]));
|
1138
1140
|
}
|
1139
|
-
}),
|
1141
|
+
}), vs = X({
|
1140
1142
|
name: "VtjStartupContainer",
|
1141
1143
|
render() {
|
1142
|
-
return
|
1144
|
+
return K(ms);
|
1143
1145
|
}
|
1144
1146
|
}), ke = Symbol("Provider");
|
1145
|
-
var
|
1146
|
-
class
|
1147
|
+
var gs = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(gs || {});
|
1148
|
+
class ys extends Ae {
|
1147
1149
|
constructor(e) {
|
1148
1150
|
super(), this.options = e;
|
1149
1151
|
const {
|
@@ -1169,9 +1171,8 @@ class bs extends Te {
|
|
1169
1171
|
mode;
|
1170
1172
|
globals = {};
|
1171
1173
|
modules = {};
|
1172
|
-
adapter = { request:
|
1174
|
+
adapter = { request: z, jsonp: fe };
|
1173
1175
|
apis = {};
|
1174
|
-
// public createMock: typeof createMock = createMock;
|
1175
1176
|
dependencies = {};
|
1176
1177
|
materials = {};
|
1177
1178
|
library = {};
|
@@ -1189,7 +1190,7 @@ class bs extends Te {
|
|
1189
1190
|
try {
|
1190
1191
|
s = await e.apply(e, t);
|
1191
1192
|
} catch (r) {
|
1192
|
-
|
1193
|
+
P.warn("模拟数据模版异常", r);
|
1193
1194
|
}
|
1194
1195
|
return E.mock(s);
|
1195
1196
|
};
|
@@ -1199,7 +1200,7 @@ class bs extends Te {
|
|
1199
1200
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1200
1201
|
throw new Error("project is null");
|
1201
1202
|
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
1202
|
-
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis =
|
1203
|
+
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = wt(s, r, this.adapter), be(), St(s), this.initRouter(), this.triggerReady();
|
1203
1204
|
}
|
1204
1205
|
async loadDependencies(e) {
|
1205
1206
|
const t = Object.entries(this.dependencies);
|
@@ -1213,7 +1214,7 @@ class bs extends Te {
|
|
1213
1214
|
materials: f,
|
1214
1215
|
materialExports: u,
|
1215
1216
|
materialMapLibrary: p
|
1216
|
-
} =
|
1217
|
+
} = at(
|
1217
1218
|
t,
|
1218
1219
|
a,
|
1219
1220
|
i === "development"
|
@@ -1227,25 +1228,25 @@ class bs extends Te {
|
|
1227
1228
|
e[h] = r[h] = await m();
|
1228
1229
|
else {
|
1229
1230
|
const w = l[h] || [];
|
1230
|
-
for (const
|
1231
|
-
|
1231
|
+
for (const v of w)
|
1232
|
+
Z(v) && await lt(h, R.append(v, { v: x })), ee(v) && await ie(R.append(v, { v: x }));
|
1232
1233
|
r[h] = e[h];
|
1233
1234
|
}
|
1234
1235
|
}
|
1235
1236
|
if (i === "development") {
|
1236
1237
|
for (const m of f)
|
1237
|
-
await
|
1238
|
+
await ie(R.append(m, { v: x }));
|
1238
1239
|
const h = this.materials || {};
|
1239
1240
|
for (const m of u) {
|
1240
|
-
const d = e[p[m]], w =
|
1241
|
+
const d = e[p[m]], w = Ie[m];
|
1241
1242
|
if (w)
|
1242
|
-
d && w.forEach((
|
1243
|
-
o[
|
1243
|
+
d && w.forEach((v) => {
|
1244
|
+
o[v] = d[v];
|
1244
1245
|
});
|
1245
1246
|
else {
|
1246
|
-
const
|
1247
|
-
|
1248
|
-
o[S.name] =
|
1247
|
+
const v = h[m] ? (await h[m]()).default : e[m];
|
1248
|
+
v && d && (v.components || []).forEach((S) => {
|
1249
|
+
o[S.name] = ct(S, d);
|
1249
1250
|
});
|
1250
1251
|
}
|
1251
1252
|
}
|
@@ -1256,20 +1257,20 @@ class bs extends Te {
|
|
1256
1257
|
if (!e) return;
|
1257
1258
|
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
|
1258
1259
|
path: `${c}${a}/:id`,
|
1259
|
-
name:
|
1260
|
-
component:
|
1260
|
+
name: C,
|
1261
|
+
component: le
|
1261
1262
|
}, f = {
|
1262
1263
|
path: c,
|
1263
|
-
name:
|
1264
|
-
component: t?.homepage ?
|
1264
|
+
name: D,
|
1265
|
+
component: t?.homepage ? le : r.startupComponent || vs,
|
1265
1266
|
meta: i
|
1266
1267
|
};
|
1267
|
-
e.hasRoute(
|
1268
|
+
e.hasRoute(C) && e.removeRoute(C), e.hasRoute(D) && e.removeRoute(D), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
|
1268
1269
|
}
|
1269
1270
|
install(e) {
|
1270
1271
|
const t = e.config.globalProperties.installed || {};
|
1271
1272
|
for (const [s, r] of Object.entries(this.library))
|
1272
|
-
!t[s] &&
|
1273
|
+
!t[s] && dt(r) && (e.use(r), t[s] = !0);
|
1273
1274
|
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(ke, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
|
1274
1275
|
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1275
1276
|
console.error(
|
@@ -1280,10 +1281,7 @@ class bs extends Te {
|
|
1280
1281
|
info: o
|
1281
1282
|
},
|
1282
1283
|
s?.stack
|
1283
|
-
),
|
1284
|
-
title: "未处理的异常:请在控制台查看详情",
|
1285
|
-
message: c
|
1286
|
-
});
|
1284
|
+
), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
|
1287
1285
|
});
|
1288
1286
|
}
|
1289
1287
|
getFile(e) {
|
@@ -1332,12 +1330,12 @@ class bs extends Te {
|
|
1332
1330
|
apis: a,
|
1333
1331
|
window,
|
1334
1332
|
...t
|
1335
|
-
}, c =
|
1333
|
+
}, c = Y({
|
1336
1334
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1337
1335
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1338
1336
|
options: i
|
1339
1337
|
});
|
1340
|
-
return
|
1338
|
+
return G({
|
1341
1339
|
...i,
|
1342
1340
|
dsl: e,
|
1343
1341
|
loader: c
|
@@ -1346,26 +1344,26 @@ class bs extends Te {
|
|
1346
1344
|
async getRenderComponent(e, t) {
|
1347
1345
|
const s = this.getFile(e);
|
1348
1346
|
if (!s)
|
1349
|
-
return
|
1347
|
+
return P.warn(`Can not find file: ${e}`), null;
|
1350
1348
|
t && t(s);
|
1351
1349
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1352
1350
|
if (o)
|
1353
1351
|
return (await o())?.default;
|
1354
1352
|
const a = await this.getDsl(s.id);
|
1355
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1353
|
+
return a ? this.createDslRenderer(a).renderer : (P.warn(`Can not find dsl: ${e}`), null);
|
1356
1354
|
}
|
1357
1355
|
defineUrlSchemaComponent(e, t) {
|
1358
|
-
return
|
1356
|
+
return ae(async () => {
|
1359
1357
|
const s = await this.getDslByUrl(e);
|
1360
1358
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1361
1359
|
});
|
1362
1360
|
}
|
1363
1361
|
definePluginComponent(e) {
|
1364
|
-
return
|
1362
|
+
return ae(async () => await je(e, window));
|
1365
1363
|
}
|
1366
1364
|
}
|
1367
|
-
function
|
1368
|
-
const e = new
|
1365
|
+
function As(n) {
|
1366
|
+
const e = new ys(n);
|
1369
1367
|
return {
|
1370
1368
|
provider: e,
|
1371
1369
|
onReady: (s) => e.ready(s)
|
@@ -1379,52 +1377,62 @@ function Re(n = {}) {
|
|
1379
1377
|
const { id: t, version: s } = n;
|
1380
1378
|
t && s && (async () => {
|
1381
1379
|
const r = await e.getDsl(t);
|
1382
|
-
r?.__VERSION__ !== s &&
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1380
|
+
r?.__VERSION__ !== s && e.adapter.notify && e.adapter.notify(
|
1381
|
+
`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
|
1382
|
+
"版本不一致",
|
1383
|
+
"warning"
|
1384
|
+
);
|
1386
1385
|
})();
|
1387
1386
|
}
|
1388
1387
|
return e;
|
1389
1388
|
}
|
1390
|
-
const
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
U.error({
|
1399
|
-
message: n || "未知错误"
|
1400
|
-
});
|
1401
|
-
}
|
1402
|
-
}
|
1403
|
-
}), js = (n = "/__vtj__/api/:type.json") => (e, t) => ne.send({
|
1404
|
-
url: n,
|
1389
|
+
const Pe = {
|
1390
|
+
type: "json",
|
1391
|
+
validSuccess: !0,
|
1392
|
+
originResponse: !1,
|
1393
|
+
failMessage: !0,
|
1394
|
+
validate: (n) => n.data?.code === 0
|
1395
|
+
}, _s = (n, e = "/__vtj__/api/:type.json") => (t, s) => n.send({
|
1396
|
+
url: e,
|
1405
1397
|
method: "post",
|
1406
|
-
params: { type:
|
1398
|
+
params: { type: t },
|
1407
1399
|
data: {
|
1408
|
-
type:
|
1409
|
-
data:
|
1410
|
-
}
|
1411
|
-
|
1412
|
-
|
1400
|
+
type: t,
|
1401
|
+
data: s
|
1402
|
+
},
|
1403
|
+
settings: Pe
|
1404
|
+
}), ws = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1405
|
+
url: e,
|
1413
1406
|
method: "post",
|
1414
1407
|
data: {
|
1415
|
-
files:
|
1416
|
-
projectId:
|
1408
|
+
files: t,
|
1409
|
+
projectId: s
|
1417
1410
|
},
|
1418
1411
|
settings: {
|
1412
|
+
...Pe,
|
1419
1413
|
type: "data"
|
1420
1414
|
}
|
1421
|
-
}).then((
|
1422
|
-
|
1415
|
+
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1416
|
+
function Is(n) {
|
1417
|
+
return de({
|
1418
|
+
settings: {
|
1419
|
+
type: "json",
|
1420
|
+
validSuccess: !0,
|
1421
|
+
originResponse: !1,
|
1422
|
+
failMessage: !0,
|
1423
|
+
validate: (e) => e.data?.code === 0,
|
1424
|
+
showError: (e) => {
|
1425
|
+
n && n(e || "未知错误");
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
});
|
1429
|
+
}
|
1430
|
+
class se {
|
1423
1431
|
api;
|
1424
1432
|
pluginCaches = {};
|
1425
1433
|
uploader;
|
1426
|
-
constructor() {
|
1427
|
-
this.api =
|
1434
|
+
constructor(e = z) {
|
1435
|
+
this.api = _s(e), this.uploader = ws(e);
|
1428
1436
|
}
|
1429
1437
|
async getExtension() {
|
1430
1438
|
console.log("BaseService.getExtension");
|
@@ -1497,10 +1505,10 @@ class re {
|
|
1497
1505
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1498
1506
|
}
|
1499
1507
|
async getPluginMaterial(e) {
|
1500
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
1508
|
+
const { urls: t = [] } = e, s = t.filter((o) => ot(o))[0];
|
1501
1509
|
if (!s) return null;
|
1502
1510
|
const r = this.pluginCaches[s];
|
1503
|
-
return r || (this.pluginCaches[s] =
|
1511
|
+
return r || (this.pluginCaches[s] = z.send({
|
1504
1512
|
url: s,
|
1505
1513
|
method: "get",
|
1506
1514
|
settings: {
|
@@ -1513,77 +1521,77 @@ class re {
|
|
1513
1521
|
return console.log("BaseService.genSource", e), "";
|
1514
1522
|
}
|
1515
1523
|
}
|
1516
|
-
const
|
1524
|
+
const g = new qe({
|
1517
1525
|
type: "local",
|
1518
1526
|
expired: 0,
|
1519
1527
|
prefix: "__VTJ_"
|
1520
1528
|
});
|
1521
|
-
class
|
1529
|
+
class Ms extends se {
|
1522
1530
|
init(e) {
|
1523
|
-
const t = new
|
1524
|
-
return
|
1531
|
+
const t = new H(e), s = g.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1532
|
+
return g.save(`project_${t.id}`, r), Promise.resolve(r);
|
1525
1533
|
}
|
1526
1534
|
saveProject(e) {
|
1527
|
-
const t = new
|
1528
|
-
return
|
1535
|
+
const t = new H(e);
|
1536
|
+
return g.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1529
1537
|
}
|
1530
1538
|
saveMaterials(e, t) {
|
1531
|
-
return
|
1539
|
+
return g.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
|
1532
1540
|
}
|
1533
1541
|
saveFile(e) {
|
1534
|
-
return
|
1542
|
+
return g.save(`file_${e.id}`, e), Promise.resolve(!0);
|
1535
1543
|
}
|
1536
1544
|
getFile(e) {
|
1537
|
-
const t =
|
1545
|
+
const t = g.get(`file_${e}`);
|
1538
1546
|
return t ? Promise.resolve(t) : Promise.reject(null);
|
1539
1547
|
}
|
1540
1548
|
removeFile(e) {
|
1541
|
-
return
|
1549
|
+
return g.remove(`file_${e}`), Promise.resolve(!0);
|
1542
1550
|
}
|
1543
1551
|
saveHistory(e) {
|
1544
|
-
return
|
1552
|
+
return g.save(`history_${e.id}`, e), Promise.resolve(!0);
|
1545
1553
|
}
|
1546
1554
|
removeHistory(e) {
|
1547
|
-
const t =
|
1555
|
+
const t = g.get(`history_${e}`);
|
1548
1556
|
if (t) {
|
1549
1557
|
const r = (t.items || []).map((o) => o.id);
|
1550
|
-
this.removeHistoryItem(e, r),
|
1558
|
+
this.removeHistoryItem(e, r), g.remove(`history_${e}`);
|
1551
1559
|
}
|
1552
1560
|
return Promise.resolve(!0);
|
1553
1561
|
}
|
1554
1562
|
getHistory(e) {
|
1555
|
-
const t =
|
1563
|
+
const t = g.get(`history_${e}`), s = new ue(t || { id: e });
|
1556
1564
|
return Promise.resolve(s.toDsl());
|
1557
1565
|
}
|
1558
1566
|
getHistoryItem(e, t) {
|
1559
|
-
const s =
|
1567
|
+
const s = g.get(`history_${e}_${t}`);
|
1560
1568
|
return Promise.resolve(s);
|
1561
1569
|
}
|
1562
1570
|
saveHistoryItem(e, t) {
|
1563
|
-
return
|
1571
|
+
return g.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1564
1572
|
}
|
1565
1573
|
removeHistoryItem(e, t) {
|
1566
1574
|
return t.forEach((s) => {
|
1567
|
-
|
1575
|
+
g.remove(`history_${e}_${s}`);
|
1568
1576
|
}), Promise.resolve(!0);
|
1569
1577
|
}
|
1570
1578
|
}
|
1571
|
-
class
|
1579
|
+
class Ss extends se {
|
1572
1580
|
projects = {};
|
1573
1581
|
materials = {};
|
1574
1582
|
files = {};
|
1575
1583
|
histories = {};
|
1576
1584
|
historyItems = {};
|
1577
1585
|
init(e) {
|
1578
|
-
const t = new
|
1586
|
+
const t = new H(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1579
1587
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1580
1588
|
}
|
1581
1589
|
saveProject(e) {
|
1582
|
-
const t = new
|
1590
|
+
const t = new H(e);
|
1583
1591
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1584
1592
|
}
|
1585
1593
|
saveMaterials(e, t) {
|
1586
|
-
return e.id && (this.materials[e.id] =
|
1594
|
+
return e.id && (this.materials[e.id] = Q(t)), Promise.resolve(!0);
|
1587
1595
|
}
|
1588
1596
|
saveFile(e) {
|
1589
1597
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1607,7 +1615,7 @@ class Es extends re {
|
|
1607
1615
|
return Promise.resolve(!0);
|
1608
1616
|
}
|
1609
1617
|
getHistory(e) {
|
1610
|
-
const t = this.histories[e], s = new
|
1618
|
+
const t = this.histories[e], s = new ue(t || { id: e });
|
1611
1619
|
return Promise.resolve(s);
|
1612
1620
|
}
|
1613
1621
|
getHistoryItem(e, t) {
|
@@ -1625,11 +1633,11 @@ class Es extends re {
|
|
1625
1633
|
}), Promise.resolve(!0);
|
1626
1634
|
}
|
1627
1635
|
}
|
1628
|
-
let
|
1629
|
-
function
|
1630
|
-
return
|
1636
|
+
let M = null;
|
1637
|
+
function Ds() {
|
1638
|
+
return M || (M = new Ss(), M);
|
1631
1639
|
}
|
1632
|
-
class
|
1640
|
+
class Hs extends se {
|
1633
1641
|
getFileCaches = {};
|
1634
1642
|
async getExtension() {
|
1635
1643
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1644,7 +1652,7 @@ class Ns extends re {
|
|
1644
1652
|
async saveMaterials(e, t) {
|
1645
1653
|
return !!await this.api("saveMaterials", {
|
1646
1654
|
project: e,
|
1647
|
-
materials:
|
1655
|
+
materials: Q(t)
|
1648
1656
|
}).catch(() => !1);
|
1649
1657
|
}
|
1650
1658
|
async saveFile(e) {
|
@@ -1684,7 +1692,7 @@ class Ns extends re {
|
|
1684
1692
|
);
|
1685
1693
|
}
|
1686
1694
|
}
|
1687
|
-
function
|
1695
|
+
function xe(n, e, t = []) {
|
1688
1696
|
return t.map((s) => {
|
1689
1697
|
const { id: r, title: o, icon: a, children: i, hidden: c } = s;
|
1690
1698
|
return {
|
@@ -1693,39 +1701,39 @@ function Pe(n, e, t = []) {
|
|
1693
1701
|
icon: a,
|
1694
1702
|
hidden: c,
|
1695
1703
|
url: `${n}/${e}/${r}`,
|
1696
|
-
children: i && i.length ?
|
1704
|
+
children: i && i.length ? xe(n, e, i) : void 0
|
1697
1705
|
};
|
1698
1706
|
});
|
1699
1707
|
}
|
1700
|
-
function
|
1708
|
+
function Ce(n, e) {
|
1701
1709
|
if (!e) return n;
|
1702
1710
|
let t = [];
|
1703
1711
|
for (const s of n)
|
1704
1712
|
if (s.children && s.children.length) {
|
1705
|
-
const r =
|
1713
|
+
const r = Ce(s.children, e);
|
1706
1714
|
r.length && (s.children = r, t.push(s));
|
1707
1715
|
} else
|
1708
1716
|
e.can(s.id.toString()) && t.push(s);
|
1709
1717
|
return t;
|
1710
1718
|
}
|
1711
|
-
function
|
1719
|
+
function Os(n) {
|
1712
1720
|
const {
|
1713
1721
|
menuPathPrefix: e = "",
|
1714
1722
|
pageRouteName: t = "page",
|
1715
1723
|
disableMenusFilter: s = !1
|
1716
|
-
} = n || {}, r = Re(), o = ye(), a =
|
1717
|
-
|
1724
|
+
} = n || {}, r = Re(), o = ye(), a = gt(), i = F(!1), c = F(!1), l = r.project;
|
1725
|
+
et(() => {
|
1718
1726
|
const { name: p, params: h, meta: m } = o;
|
1719
|
-
if (p ===
|
1727
|
+
if (p === C) {
|
1720
1728
|
const d = r.getPage(h.id);
|
1721
1729
|
i.value = !d?.mask, c.value = !!d?.pure;
|
1722
|
-
} else if (p ===
|
1730
|
+
} else if (p === D) {
|
1723
1731
|
const d = r.getHomepage();
|
1724
1732
|
i.value = !d?.mask, c.value = !!d?.pure;
|
1725
1733
|
} else
|
1726
1734
|
i.value = !m.mask, c.value = !!m.pure;
|
1727
1735
|
});
|
1728
|
-
const f =
|
1736
|
+
const f = xe(
|
1729
1737
|
e,
|
1730
1738
|
t,
|
1731
1739
|
l?.pages
|
@@ -1735,72 +1743,74 @@ function Us(n) {
|
|
1735
1743
|
logo: u?.logo,
|
1736
1744
|
themeSwitchable: u?.themeSwitchable,
|
1737
1745
|
title: u?.title || l?.description || l?.name || "VTJ App",
|
1738
|
-
menus: s ? f :
|
1746
|
+
menus: s ? f : Ce(f, a),
|
1739
1747
|
pure: c
|
1740
1748
|
};
|
1741
1749
|
}
|
1742
1750
|
export {
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1751
|
+
Se as ACCESS_KEY,
|
1752
|
+
Fs as Access,
|
1753
|
+
rt as BUILD_IN_TAGS,
|
1754
|
+
tt as BUILT_IN_DIRECTIVES,
|
1755
|
+
se as BaseService,
|
1756
|
+
ce as CONTEXT_HOST,
|
1757
|
+
$t as Context,
|
1750
1758
|
y as ContextMode,
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1759
|
+
st as DATA_TYPES,
|
1760
|
+
D as HOMEPAGE_ROUTE_NAME,
|
1761
|
+
nt as HTML_TAGS,
|
1762
|
+
Cs as JSCodeToString,
|
1763
|
+
Rs as LIFE_CYCLES_LIST,
|
1764
|
+
Hs as LocalService,
|
1765
|
+
Ss as MemoryService,
|
1766
|
+
gs as NodeEnv,
|
1767
|
+
C as PAGE_ROUTE_NAME,
|
1768
|
+
ys as Provider,
|
1769
|
+
ms as Startup,
|
1770
|
+
Ms as StorageService,
|
1771
|
+
x as VTJ_RENDERER_VERSION,
|
1764
1772
|
we as adoptedStyleSheets,
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1773
|
+
Ts as createAdapter,
|
1774
|
+
Ps as createAssetScripts,
|
1775
|
+
xs as createAssetsCss,
|
1776
|
+
Ft as createDataSources,
|
1777
|
+
Y as createLoader,
|
1778
|
+
Ds as createMemoryService,
|
1779
|
+
_t as createMetaApi,
|
1780
|
+
bt as createMock,
|
1781
|
+
As as createProvider,
|
1782
|
+
G as createRenderer,
|
1783
|
+
yt as createSchemaApi,
|
1784
|
+
wt as createSchemaApis,
|
1785
|
+
Is as createServiceRequest,
|
1786
|
+
It as defaultLoader,
|
1787
|
+
I as fillBasePath,
|
1778
1788
|
$e as getModifiers,
|
1779
1789
|
je as getPlugin,
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1790
|
+
ct as getRawComponent,
|
1791
|
+
ft as isBuiltInTag,
|
1792
|
+
Z as isCSSUrl,
|
1793
|
+
mt as isJSCode,
|
1784
1794
|
_ as isJSExpression,
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1795
|
+
A as isJSFunction,
|
1796
|
+
ot as isJSON,
|
1797
|
+
ee as isJSUrl,
|
1798
|
+
ht as isNativeTag,
|
1799
|
+
dt as isVuePlugin,
|
1800
|
+
lt as loadCss,
|
1801
|
+
ut as loadCssUrl,
|
1802
|
+
pt as loadScriptUrl,
|
1803
|
+
jt as mockApi,
|
1804
|
+
St as mockApis,
|
1805
|
+
be as mockCleanup,
|
1806
|
+
O as nodeRender,
|
1807
|
+
at as parseDeps,
|
1808
|
+
T as parseExpression,
|
1809
|
+
W as parseFunction,
|
1800
1810
|
ke as providerKey,
|
1801
|
-
|
1811
|
+
it as removeProdFlag,
|
1802
1812
|
_e as toString,
|
1803
|
-
|
1804
|
-
|
1813
|
+
gt as useAccess,
|
1814
|
+
Os as useMask,
|
1805
1815
|
Re as useProvider
|
1806
1816
|
};
|