@vtj/renderer 0.9.0 → 0.9.2
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 +505 -465
- package/package.json +6 -6
- package/types/constants.d.ts +2 -0
- package/types/plugins/access.d.ts +1 -1
- package/types/utils/util.d.ts +2 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
1
|
+
import { Base as Ae, BUILT_IN_COMPONENTS as Te, ProjectModel as H, HistoryModel as de } from "@vtj/core";
|
2
|
+
import { isUrl as Ie, url as x, dedupArray as De, isString as j, isFunction as K, logger as M, createRequest as He, merge as Me, pathToRegexp as Oe, pathToRegexpMatch as Be, formDataToJson as Ne, storage as q, cookie as J, toArray as oe, unRSA as ie, delay as fe, camelCase as $, upperFirst as Ue, pick as Le, jsonp as qe, loadScript as ae, Request as Je, Storage as Ve, mapToObject as Q } from "@vtj/utils";
|
3
3
|
import * as B from "vue";
|
4
|
-
import { inject as
|
5
|
-
import { ElNotification as N, ElLoading as
|
6
|
-
import { useRoute as
|
4
|
+
import { inject as he, toRef as ze, readonly as Ke, customRef as We, ref as F, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, unref as Xe, getCurrentInstance as me, watch as ge, computed as ve, onMounted as Ze, defineComponent as X, h as W, openBlock as et, createElementBlock as tt, createElementVNode as E, toDisplayString as V, defineAsyncComponent as ce, watchEffect as st } from "vue";
|
5
|
+
import { ElNotification as N, ElLoading as nt } from "element-plus";
|
6
|
+
import { useRoute as ye } from "vue-router";
|
7
7
|
/**!
|
8
8
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
9
9
|
* @name @vtj/renderer
|
10
10
|
* @author CHC chenhuachun1549@dingtalk.com
|
11
|
-
* @version 0.9.
|
11
|
+
* @version 0.9.2
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
13
13
|
*/
|
14
|
-
const
|
15
|
-
var
|
16
|
-
const
|
14
|
+
const k = "0.9.2";
|
15
|
+
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
16
|
+
const le = [
|
17
17
|
"$el",
|
18
18
|
"$emit",
|
19
19
|
"$nextTick",
|
@@ -25,7 +25,7 @@ const ae = [
|
|
25
25
|
"$props",
|
26
26
|
"$options",
|
27
27
|
"$forceUpdate"
|
28
|
-
],
|
28
|
+
], Cs = [
|
29
29
|
"beforeCreate",
|
30
30
|
"created",
|
31
31
|
"beforeMount",
|
@@ -39,7 +39,14 @@ const ae = [
|
|
39
39
|
"renderTriggered",
|
40
40
|
"activated",
|
41
41
|
"deactivated"
|
42
|
-
],
|
42
|
+
], rt = [
|
43
|
+
"vIf",
|
44
|
+
"vShow",
|
45
|
+
"vModel",
|
46
|
+
"vFor",
|
47
|
+
"vBind",
|
48
|
+
"vHtml"
|
49
|
+
], ot = {
|
43
50
|
String,
|
44
51
|
Number,
|
45
52
|
Boolean,
|
@@ -47,65 +54,67 @@ const ae = [
|
|
47
54
|
Object,
|
48
55
|
Function,
|
49
56
|
Date
|
50
|
-
},
|
51
|
-
|
52
|
-
|
57
|
+
}, C = "VtjPage", D = "VtjHomepage", it = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
|
58
|
+
","
|
59
|
+
), at = "component,slot".split(",");
|
60
|
+
function T(n, e) {
|
61
|
+
return n.map((t) => Ie(t) || t.startsWith("/") ? t : `${e}${t}`);
|
53
62
|
}
|
54
|
-
function
|
63
|
+
function Z(n) {
|
55
64
|
return /\.css$/.test(n);
|
56
65
|
}
|
57
|
-
function
|
66
|
+
function ee(n) {
|
58
67
|
return /\.js$/.test(n);
|
59
68
|
}
|
60
|
-
function
|
69
|
+
function ct(n) {
|
61
70
|
return /\.json$/.test(n);
|
62
71
|
}
|
63
|
-
function
|
72
|
+
function Fs(n) {
|
64
73
|
return n.map(
|
65
|
-
(e) => `<script src="${
|
74
|
+
(e) => `<script src="${x.append(e, { v: k })}"><\/script>`
|
66
75
|
).join("");
|
67
76
|
}
|
68
|
-
function
|
77
|
+
function As(n = []) {
|
69
78
|
return n.map(
|
70
|
-
(e) => `<link rel="stylesheet" href="${
|
79
|
+
(e) => `<link rel="stylesheet" href="${x.append(e, { v: k })}" />`
|
71
80
|
).join("");
|
72
81
|
}
|
73
|
-
function
|
82
|
+
function lt(n, e = !1) {
|
74
83
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
75
84
|
}
|
76
|
-
function
|
77
|
-
const s = n.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [],
|
85
|
+
function ut(n, e, t = !1) {
|
86
|
+
const s = n.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
|
78
87
|
return s.forEach(
|
79
|
-
({ urls: p, assetsUrl:
|
88
|
+
({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
|
80
89
|
p?.forEach((g) => {
|
81
|
-
|
82
|
-
}),
|
90
|
+
ee(g) && r.push(lt(g, t)), Z(g) && o.push(g);
|
91
|
+
}), m && (i.push(m), c[m] = T(p || [], e), w && (l[m] = w)), h && a.push(h), d && f.push(d), m && d && (u[d] = m);
|
83
92
|
}
|
84
93
|
), {
|
85
|
-
scripts:
|
86
|
-
css:
|
87
|
-
materials:
|
94
|
+
scripts: T(r, e),
|
95
|
+
css: T(o, e),
|
96
|
+
materials: T(a, e),
|
88
97
|
libraryExports: i,
|
89
|
-
materialExports:
|
98
|
+
materialExports: De(f),
|
90
99
|
materialMapLibrary: u,
|
91
|
-
libraryMap:
|
92
|
-
libraryLocaleMap:
|
100
|
+
libraryMap: c,
|
101
|
+
libraryLocaleMap: l
|
93
102
|
};
|
94
103
|
}
|
95
|
-
function
|
104
|
+
function pt(n, e) {
|
96
105
|
const { name: t, parent: s, alias: r } = n;
|
97
106
|
return s ? e[s]?.[r || t] : e[r || t];
|
98
107
|
}
|
99
|
-
function
|
100
|
-
return
|
108
|
+
function _e(n) {
|
109
|
+
return j(n) ? n : JSON.stringify(n);
|
101
110
|
}
|
102
|
-
function
|
111
|
+
function we(n, e, t) {
|
103
112
|
const s = n.CSSStyleSheet;
|
104
113
|
if (s.prototype.replaceSync) {
|
105
114
|
const r = new s();
|
106
115
|
r.id = e, r.replaceSync(t);
|
107
116
|
const o = n.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
|
108
|
-
(
|
117
|
+
(c) => c.id !== e
|
109
118
|
);
|
110
119
|
o.adoptedStyleSheets = [...i, r];
|
111
120
|
} else {
|
@@ -114,11 +123,11 @@ function ye(n, e, t) {
|
|
114
123
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
115
124
|
}
|
116
125
|
}
|
117
|
-
async function
|
126
|
+
async function dt(n, e) {
|
118
127
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
119
|
-
t &&
|
128
|
+
t && we(window, n, t);
|
120
129
|
}
|
121
|
-
function
|
130
|
+
function ft(n, e = window) {
|
122
131
|
const t = e.document, s = e.document.head;
|
123
132
|
for (const r of n)
|
124
133
|
if (!t.getElementById(r)) {
|
@@ -126,40 +135,46 @@ function at(n, e = window) {
|
|
126
135
|
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
127
136
|
}
|
128
137
|
}
|
129
|
-
async function
|
138
|
+
async function ht(n, e, t = window) {
|
130
139
|
const s = t.document, r = t.document.head;
|
131
140
|
let o = t[e];
|
132
141
|
return o ? o.default || o : new Promise((a, i) => {
|
133
|
-
for (const
|
134
|
-
const
|
135
|
-
|
142
|
+
for (const c of n) {
|
143
|
+
const l = s.createElement("script");
|
144
|
+
l.src = c, l.onload = () => {
|
136
145
|
o = t[e], o ? a(o.default || o) : i(null);
|
137
|
-
},
|
146
|
+
}, l.onerror = (f) => {
|
138
147
|
i(f);
|
139
|
-
}, r.appendChild(
|
148
|
+
}, r.appendChild(l);
|
140
149
|
}
|
141
150
|
});
|
142
151
|
}
|
143
|
-
function
|
144
|
-
return
|
152
|
+
function mt(n) {
|
153
|
+
return K(n) || K(n?.install);
|
154
|
+
}
|
155
|
+
function gt(n) {
|
156
|
+
return at.includes(n);
|
157
|
+
}
|
158
|
+
function vt(n) {
|
159
|
+
return it.includes(n);
|
145
160
|
}
|
146
|
-
function
|
161
|
+
function A(n, e, t = !1, s = !1) {
|
147
162
|
try {
|
148
163
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
149
164
|
r.push("return ");
|
150
165
|
let o = (n.value || "").trim();
|
151
|
-
o = o.replace(/this(\W|$)/g, (i,
|
166
|
+
o = o.replace(/this(\W|$)/g, (i, c) => `__self${c}`), o = r.join(`
|
152
167
|
`) + o;
|
153
168
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
154
169
|
return new Function("$scope", a)(e);
|
155
170
|
} catch (r) {
|
156
|
-
if (
|
171
|
+
if (M.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
157
172
|
throw r;
|
158
173
|
}
|
159
174
|
}
|
160
|
-
function
|
161
|
-
const r =
|
162
|
-
if (typeof r != "function" && (
|
175
|
+
function ue(n, e, t = !1, s = !1) {
|
176
|
+
const r = A(n, e, t, s);
|
177
|
+
if (typeof r != "function" && (M.error(
|
163
178
|
"parseFunction.error",
|
164
179
|
"not a function",
|
165
180
|
n,
|
@@ -168,20 +183,20 @@ function ce(n, e, t = !1, s = !1) {
|
|
168
183
|
throw new Error(`"${n.value}" not a function`);
|
169
184
|
return r;
|
170
185
|
}
|
171
|
-
function
|
186
|
+
function _(n) {
|
172
187
|
return n && n.type === "JSExpression";
|
173
188
|
}
|
174
189
|
function U(n) {
|
175
190
|
return typeof n == "object" && n && n.type === "JSFunction";
|
176
191
|
}
|
177
|
-
function
|
178
|
-
return
|
192
|
+
function yt(n) {
|
193
|
+
return _(n) || U(n);
|
179
194
|
}
|
180
|
-
function
|
181
|
-
return
|
195
|
+
function Ts(n) {
|
196
|
+
return yt(n) ? n.value : JSON.stringify(n);
|
182
197
|
}
|
183
|
-
let
|
184
|
-
const
|
198
|
+
let R = null;
|
199
|
+
const _t = He({
|
185
200
|
settings: {
|
186
201
|
type: "form",
|
187
202
|
validSuccess: !0,
|
@@ -195,19 +210,19 @@ const dt = Ae({
|
|
195
210
|
});
|
196
211
|
},
|
197
212
|
showLoading: () => {
|
198
|
-
|
213
|
+
R && R.close(), R = nt.service({
|
199
214
|
lock: !0,
|
200
215
|
text: "Loading",
|
201
216
|
background: "rgba(0, 0, 0, 0.05)"
|
202
217
|
});
|
203
218
|
},
|
204
219
|
hideLoading: () => {
|
205
|
-
|
220
|
+
R && (R.close(), R = null);
|
206
221
|
}
|
207
222
|
}
|
208
223
|
});
|
209
|
-
let
|
210
|
-
function
|
224
|
+
let P;
|
225
|
+
function wt(n, e) {
|
211
226
|
const { jsonp: t, request: s } = e;
|
212
227
|
if (n.method === "jsonp")
|
213
228
|
return (r = {}) => t(n.url, {
|
@@ -215,7 +230,7 @@ function pt(n, e) {
|
|
215
230
|
query: r
|
216
231
|
});
|
217
232
|
{
|
218
|
-
const r = n.headers ?
|
233
|
+
const r = n.headers ? A(n.headers, {}, !0) : void 0, o = {
|
219
234
|
url: n.url,
|
220
235
|
method: n.method,
|
221
236
|
settings: {
|
@@ -223,10 +238,10 @@ function pt(n, e) {
|
|
223
238
|
headers: r
|
224
239
|
}
|
225
240
|
};
|
226
|
-
return (a, i) => (delete o.data, s.send(
|
241
|
+
return (a, i) => (delete o.data, s.send(Me(o, i || {}, { data: a })));
|
227
242
|
}
|
228
243
|
}
|
229
|
-
function
|
244
|
+
function St(n, e) {
|
230
245
|
const { metaQuery: t } = e;
|
231
246
|
if (!t) return;
|
232
247
|
const { code: s, queryCode: r } = n;
|
@@ -238,34 +253,34 @@ function ft(n, e) {
|
|
238
253
|
return t(s, r, o, a);
|
239
254
|
};
|
240
255
|
}
|
241
|
-
function
|
256
|
+
function bt(n = [], e = [], t) {
|
242
257
|
const s = {};
|
243
258
|
for (const r of n)
|
244
|
-
s[r.id] =
|
259
|
+
s[r.id] = wt(r, t);
|
245
260
|
for (const r of e)
|
246
|
-
s[r.id] =
|
261
|
+
s[r.id] = St(r, t);
|
247
262
|
return s;
|
248
263
|
}
|
249
|
-
async function
|
250
|
-
|
264
|
+
async function jt(n = []) {
|
265
|
+
P = await import("mockjs").then((e) => e.default || e), P && (P.setup({
|
251
266
|
timeout: "50-500"
|
252
|
-
}),
|
267
|
+
}), Se(), n.forEach((e) => $t(P, e)));
|
253
268
|
}
|
254
|
-
function
|
269
|
+
function $t(n, e) {
|
255
270
|
if (!e.mock) return;
|
256
271
|
const { url: t, mockTemplate: s } = e;
|
257
272
|
if (t && s) {
|
258
|
-
const r = Oe(`${t}(.*)`), o =
|
273
|
+
const r = Oe(`${t}(.*)`), o = Be(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
|
259
274
|
n.mock(r, (i) => {
|
260
|
-
const
|
261
|
-
return Object.assign(i, { data:
|
275
|
+
const c = x.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
|
276
|
+
return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
|
262
277
|
});
|
263
278
|
}
|
264
279
|
}
|
265
|
-
function
|
266
|
-
|
280
|
+
function Se() {
|
281
|
+
P && (P._mocked = {});
|
267
282
|
}
|
268
|
-
const
|
283
|
+
const Et = {
|
269
284
|
session: !1,
|
270
285
|
authKey: "Authorization",
|
271
286
|
storageKey: "ACCESS_STORAGE",
|
@@ -277,31 +292,31 @@ const vt = {
|
|
277
292
|
unauthorizedMessage: "登录已经失效,请重新登录!",
|
278
293
|
noPermissionMessage: "无权限访问该页面",
|
279
294
|
appName: ""
|
280
|
-
},
|
281
|
-
class
|
295
|
+
}, be = Symbol("access");
|
296
|
+
class Is {
|
282
297
|
options;
|
283
298
|
data = null;
|
284
|
-
mode =
|
299
|
+
mode = y.Raw;
|
285
300
|
constructor(e) {
|
286
|
-
this.options = Object.assign({},
|
301
|
+
this.options = Object.assign({}, Et, e), this.loadData();
|
287
302
|
}
|
288
303
|
connect(e) {
|
289
304
|
const { mode: t, router: s, request: r } = e;
|
290
|
-
this.mode = t, s && this.mode ===
|
305
|
+
this.mode = t, s && this.mode === y.Raw && this.setGuard(s), r && this.setRequest(r);
|
291
306
|
}
|
292
307
|
login(e) {
|
293
308
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
294
|
-
this.setData(e), this.data && (
|
309
|
+
this.setData(e), this.data && (q.save(t, e, {
|
295
310
|
type: "local",
|
296
311
|
prefix: s
|
297
|
-
}), r &&
|
312
|
+
}), r && J.set(o, this.data.token));
|
298
313
|
}
|
299
314
|
clear() {
|
300
315
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
301
|
-
this.data = null,
|
316
|
+
this.data = null, q.remove(e, {
|
302
317
|
type: "local",
|
303
318
|
prefix: t
|
304
|
-
}), s &&
|
319
|
+
}), s && J.remove(r);
|
305
320
|
}
|
306
321
|
logout() {
|
307
322
|
this.clear(), this.toLogin();
|
@@ -314,14 +329,14 @@ class bs {
|
|
314
329
|
}
|
315
330
|
can(e) {
|
316
331
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
317
|
-
return typeof e == "function" ? e(s) :
|
332
|
+
return typeof e == "function" ? e(s) : oe(e).every((o) => s[o] || s[t + "." + o]);
|
318
333
|
}
|
319
334
|
some(e) {
|
320
335
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
321
|
-
return
|
336
|
+
return oe(e).some((o) => s[o] || s[t + "." + o]);
|
322
337
|
}
|
323
338
|
install(e) {
|
324
|
-
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(
|
339
|
+
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(be, this);
|
325
340
|
}
|
326
341
|
isAuthPath(e) {
|
327
342
|
const { auth: t, isAuth: s } = this.options;
|
@@ -342,13 +357,13 @@ class bs {
|
|
342
357
|
setData(e) {
|
343
358
|
const { privateKey: t } = this.options;
|
344
359
|
if (Array.isArray(e) && t) {
|
345
|
-
const s = e.map((r) =>
|
360
|
+
const s = e.map((r) => ie(r, t));
|
346
361
|
this.data = JSON.parse(s.join(""));
|
347
362
|
return;
|
348
363
|
}
|
349
364
|
if (typeof e == "string")
|
350
365
|
try {
|
351
|
-
const s = t ?
|
366
|
+
const s = t ? ie(e, t) : e;
|
352
367
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
353
368
|
} catch (s) {
|
354
369
|
console.warn(s);
|
@@ -357,7 +372,7 @@ class bs {
|
|
357
372
|
this.data = e;
|
358
373
|
}
|
359
374
|
loadData() {
|
360
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
375
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = q.get(e, {
|
361
376
|
type: "local",
|
362
377
|
prefix: t
|
363
378
|
});
|
@@ -365,10 +380,10 @@ class bs {
|
|
365
380
|
}
|
366
381
|
isLogined() {
|
367
382
|
const { session: e, authKey: t } = this.options;
|
368
|
-
return e && t ? !!
|
383
|
+
return e && t ? !!J.get(t) : !!this.getToken();
|
369
384
|
}
|
370
385
|
hasRoutePermission(e) {
|
371
|
-
if (e.name ===
|
386
|
+
if (e.name === C) {
|
372
387
|
const t = e.params.id;
|
373
388
|
return t && this.can(t);
|
374
389
|
}
|
@@ -385,7 +400,7 @@ class bs {
|
|
385
400
|
return t();
|
386
401
|
{
|
387
402
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
388
|
-
return await this.showTip(s),
|
403
|
+
return await this.showTip(s), K(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
389
404
|
}
|
390
405
|
}
|
391
406
|
t(!1), this.toLogin();
|
@@ -404,7 +419,7 @@ class bs {
|
|
404
419
|
}
|
405
420
|
async showTip(e) {
|
406
421
|
const { alert: t } = this.options;
|
407
|
-
return t ? (await
|
422
|
+
return t ? (await fe(150), await t(e, {
|
408
423
|
title: "提示",
|
409
424
|
type: "warning"
|
410
425
|
}).catch(() => !1)) : !1;
|
@@ -419,10 +434,10 @@ class bs {
|
|
419
434
|
);
|
420
435
|
}
|
421
436
|
}
|
422
|
-
function
|
423
|
-
return
|
437
|
+
function Rt() {
|
438
|
+
return he(be, null);
|
424
439
|
}
|
425
|
-
class
|
440
|
+
class Pt {
|
426
441
|
__id = null;
|
427
442
|
__mode;
|
428
443
|
__instance = null;
|
@@ -465,41 +480,41 @@ class _t {
|
|
465
480
|
});
|
466
481
|
}
|
467
482
|
__proxy() {
|
468
|
-
this.__instance &&
|
483
|
+
this.__instance && le.forEach((e) => {
|
469
484
|
this[e] = this.__instance?.[e];
|
470
485
|
});
|
471
486
|
}
|
472
487
|
__cleanup() {
|
473
|
-
|
488
|
+
le.forEach((e) => {
|
474
489
|
this[e] = null;
|
475
490
|
});
|
476
491
|
}
|
477
492
|
__parseFunction(e) {
|
478
493
|
if (e)
|
479
|
-
if (this.__mode ===
|
494
|
+
if (this.__mode === y.Runtime) {
|
480
495
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
481
|
-
return
|
496
|
+
return ue({ type: s, value: r }, this);
|
482
497
|
} else
|
483
|
-
return
|
498
|
+
return ue(e, this);
|
484
499
|
}
|
485
500
|
__parseExpression(e) {
|
486
501
|
if (e)
|
487
|
-
if (this.__mode ===
|
502
|
+
if (this.__mode === y.Runtime) {
|
488
503
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
489
|
-
return
|
504
|
+
return A({ type: s, value: r }, this);
|
490
505
|
} else
|
491
|
-
return
|
506
|
+
return A(e, this);
|
492
507
|
}
|
493
508
|
__ref(e = null, t) {
|
494
|
-
if (this.__mode !==
|
509
|
+
if (this.__mode !== y.VNode)
|
495
510
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
496
|
-
await
|
511
|
+
await fe(0);
|
497
512
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
498
513
|
if (!r) {
|
499
514
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
500
515
|
return;
|
501
516
|
}
|
502
|
-
if (r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e,
|
517
|
+
if (r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, y.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = s), typeof t == "function")
|
503
518
|
t(s);
|
504
519
|
else if (t) {
|
505
520
|
const o = this.$refs[t];
|
@@ -520,72 +535,72 @@ class _t {
|
|
520
535
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
521
536
|
}
|
522
537
|
}
|
523
|
-
function
|
538
|
+
function G(n) {
|
524
539
|
const {
|
525
540
|
Vue: e = B,
|
526
|
-
mode: t =
|
541
|
+
mode: t = y.Runtime,
|
527
542
|
components: s = {},
|
528
543
|
libs: r = {},
|
529
544
|
apis: o = {},
|
530
545
|
loader: a
|
531
|
-
} = n, i = e.computed(() => n.dsl),
|
546
|
+
} = n, i = e.computed(() => n.dsl), c = {
|
532
547
|
$components: s,
|
533
548
|
$libs: r,
|
534
549
|
$apis: o
|
535
|
-
},
|
550
|
+
}, l = new Pt({
|
536
551
|
mode: t,
|
537
552
|
dsl: i.value,
|
538
|
-
attrs:
|
553
|
+
attrs: c
|
539
554
|
}), f = e.defineComponent({
|
540
555
|
name: i.value.name,
|
541
556
|
props: {
|
542
|
-
...
|
557
|
+
...kt(i.value.props ?? [], l)
|
543
558
|
},
|
544
559
|
setup(u) {
|
545
|
-
|
560
|
+
l.$props = u, l.props = u, i.value.id && we(
|
546
561
|
n.window || window,
|
547
562
|
i.value.id,
|
548
563
|
i.value.css || ""
|
549
|
-
),
|
550
|
-
const p =
|
564
|
+
), l.state = Ct(e, i.value.state ?? {}, l);
|
565
|
+
const p = Ft(e, i.value.computed ?? {}, l), h = At(i.value.methods ?? {}, l), m = Tt(e, i.value.inject, l), d = It(
|
551
566
|
i.value.dataSources || {},
|
552
|
-
|
553
|
-
),
|
554
|
-
...
|
567
|
+
l
|
568
|
+
), w = {
|
569
|
+
...m,
|
555
570
|
...p,
|
556
|
-
...
|
557
|
-
...
|
571
|
+
...h,
|
572
|
+
...d
|
558
573
|
};
|
559
|
-
return
|
560
|
-
vtj:
|
574
|
+
return l.setup(w, e), Dt(e, i.value.watch ?? [], l), {
|
575
|
+
vtj: l
|
561
576
|
};
|
562
577
|
},
|
563
|
-
emits:
|
578
|
+
emits: xt(i.value.emits),
|
564
579
|
expose: ["vtj"],
|
565
580
|
render() {
|
566
581
|
if (!i.value.nodes) return null;
|
567
582
|
const u = i.value.nodes || [];
|
568
|
-
return u.length === 1 ?
|
583
|
+
return u.length === 1 ? O(u[0], l, e, a) : u.map((p) => O(p, l, e, a));
|
569
584
|
},
|
570
|
-
...
|
585
|
+
...Ht(i.value.lifeCycles ?? {}, l)
|
571
586
|
});
|
572
587
|
return {
|
573
588
|
renderer: e.markRaw(f),
|
574
|
-
context:
|
589
|
+
context: l
|
575
590
|
};
|
576
591
|
}
|
577
|
-
function
|
578
|
-
return n.map((e) =>
|
592
|
+
function xt(n = []) {
|
593
|
+
return n.map((e) => j(e) ? e : e.name);
|
579
594
|
}
|
580
|
-
function
|
581
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) =>
|
582
|
-
return n.map((s) =>
|
595
|
+
function kt(n = [], e) {
|
596
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ot[o]) : void 0;
|
597
|
+
return n.map((s) => j(s) ? {
|
583
598
|
name: s
|
584
599
|
} : {
|
585
600
|
name: s.name,
|
586
601
|
type: s.type,
|
587
602
|
required: s.required,
|
588
|
-
default:
|
603
|
+
default: _(s.default) ? e.__parseExpression(s.default) : s.default
|
589
604
|
}).reduce(
|
590
605
|
(s, r) => (s[r.name] = {
|
591
606
|
type: t(r.type),
|
@@ -595,53 +610,53 @@ function St(n = [], e) {
|
|
595
610
|
{}
|
596
611
|
);
|
597
612
|
}
|
598
|
-
function
|
613
|
+
function Ct(n, e, t) {
|
599
614
|
return n.reactive(
|
600
615
|
Object.keys(e || {}).reduce(
|
601
616
|
(s, r) => {
|
602
617
|
let o = e[r];
|
603
|
-
return
|
618
|
+
return _(o) ? o = t.__parseExpression(o) : U(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
604
619
|
},
|
605
620
|
{}
|
606
621
|
)
|
607
622
|
);
|
608
623
|
}
|
609
|
-
function
|
624
|
+
function Ft(n, e, t) {
|
610
625
|
return Object.entries(e ?? {}).reduce(
|
611
626
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
612
627
|
{}
|
613
628
|
);
|
614
629
|
}
|
615
|
-
function
|
630
|
+
function At(n, e) {
|
616
631
|
return Object.entries(n ?? {}).reduce(
|
617
632
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
618
633
|
{}
|
619
634
|
);
|
620
635
|
}
|
621
|
-
function
|
636
|
+
function Tt(n, e = [], t) {
|
622
637
|
return e.reduce(
|
623
638
|
(s, r) => {
|
624
639
|
const { name: o, from: a } = r || {};
|
625
640
|
r.default;
|
626
|
-
const i =
|
627
|
-
return s[o] = n.inject(i,
|
641
|
+
const i = _(a) ? t.__parseExpression(a) || o : a ?? o, c = _(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
642
|
+
return s[o] = n.inject(i, c), s;
|
628
643
|
},
|
629
644
|
{}
|
630
645
|
);
|
631
646
|
}
|
632
|
-
function
|
647
|
+
function It(n, e) {
|
633
648
|
return Object.keys(n).reduce(
|
634
649
|
(t, s) => {
|
635
650
|
const r = n[s], o = e.$apis[r.ref], a = U(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
636
651
|
return t[s] = async (...i) => {
|
637
|
-
const
|
638
|
-
return a ? a(
|
652
|
+
const c = await o.apply(e, i);
|
653
|
+
return a ? a(c) : c;
|
639
654
|
}, t;
|
640
655
|
},
|
641
656
|
{}
|
642
657
|
);
|
643
658
|
}
|
644
|
-
function
|
659
|
+
function Dt(n, e = [], t) {
|
645
660
|
e.forEach((s) => {
|
646
661
|
n.watch(
|
647
662
|
t.__parseExpression(s.source),
|
@@ -653,111 +668,125 @@ function Pt(n, e = [], t) {
|
|
653
668
|
);
|
654
669
|
});
|
655
670
|
}
|
656
|
-
function
|
671
|
+
function Ht(n, e) {
|
657
672
|
return Object.entries(n ?? {}).reduce(
|
658
673
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
659
674
|
{}
|
660
675
|
);
|
661
676
|
}
|
662
|
-
let
|
663
|
-
const
|
664
|
-
async function
|
665
|
-
const { urls: t = [], library: s } = n, r = t.filter((i) =>
|
677
|
+
let z = [];
|
678
|
+
const Mt = (n) => n;
|
679
|
+
async function je(n, e = window) {
|
680
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => ee(i));
|
666
681
|
if (r.length === 0 || !s) return null;
|
667
|
-
const o = t.filter((i) =>
|
668
|
-
return o.length &&
|
682
|
+
const o = t.filter((i) => Z(i));
|
683
|
+
return o.length && ft(o, e), await ht(r, s, e).catch(
|
669
684
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
670
685
|
);
|
671
686
|
}
|
672
|
-
function
|
687
|
+
function Y(n) {
|
673
688
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
674
|
-
return s.window && (
|
689
|
+
return s.window && (z.forEach((r) => {
|
675
690
|
delete s.window[r];
|
676
|
-
}),
|
691
|
+
}), z = []), (r, o, a = B) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
677
692
|
const i = await e(o.id);
|
678
|
-
return i && (i.name = r), i ?
|
693
|
+
return i && (i.name = r), i ? G({
|
679
694
|
...s,
|
680
695
|
Vue: a,
|
681
696
|
dsl: i,
|
682
|
-
mode:
|
683
|
-
loader:
|
697
|
+
mode: y.Runtime,
|
698
|
+
loader: Y(n)
|
684
699
|
}).renderer : null;
|
685
700
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
686
701
|
const i = await t(o.url);
|
687
|
-
return i && (i.name = r), i ?
|
702
|
+
return i && (i.name = r), i ? G({
|
688
703
|
...s,
|
689
704
|
Vue: a,
|
690
705
|
dsl: i,
|
691
|
-
mode:
|
692
|
-
loader:
|
706
|
+
mode: y.Runtime,
|
707
|
+
loader: Y(n)
|
693
708
|
}).renderer : null;
|
694
|
-
}) : o.type === "Plugin" ? (o.library &&
|
695
|
-
const i = await
|
709
|
+
}) : o.type === "Plugin" ? (o.library && z.push(o.library), a.defineAsyncComponent(async () => {
|
710
|
+
const i = await je(o, s.window);
|
696
711
|
return i || (console.warn("getPlugin result is null", o), null);
|
697
712
|
})) : r;
|
698
713
|
}
|
699
|
-
function
|
714
|
+
function O(n, e, t = B, s = Mt) {
|
700
715
|
if (!n || !n.name || n.invisible) return null;
|
701
|
-
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor:
|
702
|
-
if (i && !
|
716
|
+
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 } = Bt(a);
|
717
|
+
if (i && !Nt(i, e))
|
703
718
|
return null;
|
704
|
-
const
|
705
|
-
const
|
719
|
+
const m = (d) => {
|
720
|
+
const w = d.$components, g = (() => {
|
706
721
|
if (n.name === "component")
|
707
|
-
return
|
722
|
+
return Ut(d, n.props?.is);
|
708
723
|
if (n.name === "slot") return n.name;
|
709
|
-
const
|
710
|
-
return
|
711
|
-
})(),
|
724
|
+
const b = s(n.name, n.from, t);
|
725
|
+
return j(b) ? gt(b) || vt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
|
726
|
+
})(), S = Lt(o, n.props ?? {}, d), Ce = qt(t, n.events ?? {}, d);
|
712
727
|
if (n.name === "slot")
|
713
|
-
return
|
714
|
-
u && Object.assign(
|
715
|
-
|
716
|
-
|
717
|
-
)), f.forEach((
|
718
|
-
Object.assign(
|
728
|
+
return Jt(t, n, S, d, s);
|
729
|
+
u && Object.assign(S, d.__parseExpression(u.value)), l && (S.style = Object.assign(
|
730
|
+
S.style ?? {},
|
731
|
+
zt(l, d)
|
732
|
+
)), p && Object.assign(S, Kt(p, d)), f.forEach((b) => {
|
733
|
+
Object.assign(S, Wt(t, b, d));
|
719
734
|
});
|
720
|
-
const
|
735
|
+
const Fe = Gt(
|
721
736
|
t,
|
722
737
|
n.children ?? [],
|
723
738
|
d,
|
724
739
|
s,
|
725
740
|
n
|
726
741
|
);
|
727
|
-
|
742
|
+
let L = t.createVNode(g, { ...S, ...Ce }, Fe);
|
743
|
+
const re = r ? Ot(r, h, d) : [];
|
744
|
+
return re.length && (L = t.withDirectives(L, re)), L;
|
728
745
|
};
|
729
|
-
return
|
746
|
+
return c ? Xt(c, m, e) : m(e);
|
730
747
|
}
|
731
|
-
function
|
732
|
-
const
|
733
|
-
|
748
|
+
function Ot(n, e, t) {
|
749
|
+
const s = n.app;
|
750
|
+
return e.map((r) => {
|
751
|
+
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
752
|
+
if (!o) return null;
|
753
|
+
const a = [o];
|
754
|
+
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
755
|
+
}).filter((r) => !!r);
|
756
|
+
}
|
757
|
+
function Bt(n = []) {
|
758
|
+
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(
|
759
|
+
(c) => $(c.name) === "vModel"
|
760
|
+
), i = n.filter(
|
761
|
+
(c) => !rt.includes($(c.name))
|
734
762
|
);
|
735
763
|
return {
|
736
764
|
vIf: e,
|
737
765
|
vFor: t,
|
738
766
|
vShow: s,
|
739
|
-
vModels:
|
767
|
+
vModels: a,
|
740
768
|
vBind: r,
|
741
|
-
others:
|
769
|
+
others: i,
|
770
|
+
vHtml: o
|
742
771
|
};
|
743
772
|
}
|
744
|
-
function
|
773
|
+
function Nt(n, e) {
|
745
774
|
return !!e.__parseExpression(n.value);
|
746
775
|
}
|
747
|
-
function
|
748
|
-
return e ?
|
776
|
+
function Ut(n, e) {
|
777
|
+
return e ? _(e) ? n.__parseExpression(e) : e : "div";
|
749
778
|
}
|
750
|
-
function
|
779
|
+
function Lt(n, e, t) {
|
751
780
|
const s = Object.keys(e || {}).reduce(
|
752
781
|
(r, o) => {
|
753
782
|
let a = e[o];
|
754
|
-
return
|
783
|
+
return _(a) ? a = t.__parseExpression(a) : U(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
755
784
|
},
|
756
785
|
{}
|
757
786
|
);
|
758
787
|
return s.ref = t.__ref(n, s.ref), s;
|
759
788
|
}
|
760
|
-
function
|
789
|
+
function qt(n, e, t) {
|
761
790
|
const s = ["passive", "capture", "once"], r = {
|
762
791
|
capture: "Capture",
|
763
792
|
once: "Once",
|
@@ -765,70 +794,77 @@ function Ot(n, e, t) {
|
|
765
794
|
};
|
766
795
|
return Object.keys(e || {}).reduce(
|
767
796
|
(o, a) => {
|
768
|
-
const i = e[a],
|
769
|
-
return u && (o[f] = n.withModifiers(u,
|
797
|
+
const i = e[a], c = $e(i.modifiers), l = c.find((p) => s.includes(p)), f = "on" + Ue(a) + (l && r[l] || ""), u = t.__parseFunction(i.handler);
|
798
|
+
return u && (o[f] = n.withModifiers(u, c)), o;
|
770
799
|
},
|
771
800
|
{}
|
772
801
|
);
|
773
802
|
}
|
774
|
-
function
|
803
|
+
function $e(n = {}, e = !1) {
|
775
804
|
const t = Object.keys(n);
|
776
805
|
return e ? t.map((s) => "." + s) : t;
|
777
806
|
}
|
778
|
-
function
|
779
|
-
const { children: o } = e, a =
|
780
|
-
return i ? i(t) : o ?
|
781
|
-
|
807
|
+
function Jt(n, e, t, s, r) {
|
808
|
+
const { children: o } = e, a = Vt(e, s), i = s.$slots?.[a.name];
|
809
|
+
return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
|
810
|
+
_e(s.__parseExpression(o))
|
782
811
|
) : Array.isArray(o) ? o.map(
|
783
|
-
(
|
812
|
+
(c) => O(c, s, n, r)
|
784
813
|
) : null : null;
|
785
814
|
}
|
786
|
-
function
|
815
|
+
function Vt(n, e) {
|
787
816
|
const { props: t } = n, s = t?.name || "default";
|
788
817
|
return {
|
789
|
-
name:
|
818
|
+
name: _(s) ? e.__parseExpression(s) : s,
|
790
819
|
params: []
|
791
820
|
};
|
792
821
|
}
|
793
|
-
function
|
822
|
+
function zt(n, e) {
|
794
823
|
return e.__parseExpression(n.value) ? {} : {
|
795
824
|
display: "none"
|
796
825
|
};
|
797
826
|
}
|
798
|
-
function
|
827
|
+
function Kt(n, e) {
|
828
|
+
return {
|
829
|
+
innerHTML: e.__parseExpression(n.value) || ""
|
830
|
+
};
|
831
|
+
}
|
832
|
+
function Wt(n, e, t) {
|
799
833
|
const s = {
|
800
834
|
type: "JSFunction",
|
801
835
|
value: e.value?.value ? `(v) => {
|
802
836
|
${e.value.value} = v;
|
803
837
|
}` : "(v) => {}"
|
804
|
-
}, r = t.__parseFunction(s), o =
|
838
|
+
}, r = t.__parseFunction(s), o = $e(
|
839
|
+
_(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
840
|
+
), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
805
841
|
return {
|
806
842
|
[a]: t.__parseExpression(e.value),
|
807
843
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
808
844
|
};
|
809
845
|
}
|
810
|
-
function
|
846
|
+
function Gt(n, e, t, s, r) {
|
811
847
|
if (!e) return null;
|
812
|
-
if (
|
848
|
+
if (j(e))
|
813
849
|
return { default: () => e };
|
814
|
-
if (
|
850
|
+
if (_(e))
|
815
851
|
return {
|
816
|
-
default: () =>
|
852
|
+
default: () => _e(t.__parseExpression(e))
|
817
853
|
};
|
818
854
|
if (Array.isArray(e) && e.length > 0) {
|
819
|
-
const o =
|
855
|
+
const o = Yt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
820
856
|
[`scope_${r.id}`]: i
|
821
857
|
} : {};
|
822
|
-
return Object.entries(o).reduce((i, [
|
823
|
-
const p = f.length ?
|
824
|
-
return
|
825
|
-
(
|
858
|
+
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
|
859
|
+
const p = f.length ? Le(u ?? {}, f) : a(u);
|
860
|
+
return l.map(
|
861
|
+
(h) => O(h, t.__clone(p), n, s)
|
826
862
|
);
|
827
863
|
}, i), {});
|
828
864
|
}
|
829
865
|
return null;
|
830
866
|
}
|
831
|
-
function
|
867
|
+
function Yt(n) {
|
832
868
|
const e = {
|
833
869
|
default: {
|
834
870
|
params: [],
|
@@ -836,7 +872,7 @@ function Nt(n) {
|
|
836
872
|
}
|
837
873
|
};
|
838
874
|
for (const t of n) {
|
839
|
-
const s =
|
875
|
+
const s = Qt(t.slot), r = s.name;
|
840
876
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
841
877
|
nodes: [t],
|
842
878
|
params: s.params
|
@@ -844,111 +880,111 @@ function Nt(n) {
|
|
844
880
|
}
|
845
881
|
return e;
|
846
882
|
}
|
847
|
-
function
|
848
|
-
return
|
883
|
+
function Qt(n = "default") {
|
884
|
+
return j(n) ? { name: n, params: [] } : { params: [], ...n };
|
849
885
|
}
|
850
|
-
function
|
886
|
+
function Xt(n, e, t) {
|
851
887
|
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
852
888
|
let i = t.__parseExpression(s) || [];
|
853
|
-
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((
|
889
|
+
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`), []);
|
854
890
|
}
|
855
|
-
function
|
856
|
-
return
|
891
|
+
function Zt(n) {
|
892
|
+
return Ye() ? (Qe(n), !0) : !1;
|
857
893
|
}
|
858
|
-
function
|
859
|
-
return typeof n == "function" ? n() :
|
894
|
+
function te(n) {
|
895
|
+
return typeof n == "function" ? n() : Xe(n);
|
860
896
|
}
|
861
|
-
const
|
897
|
+
const Ee = typeof window < "u" && typeof document < "u";
|
862
898
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
863
|
-
const
|
899
|
+
const es = (n) => n != null, ts = () => {
|
864
900
|
};
|
865
|
-
function
|
866
|
-
return
|
901
|
+
function ss(n) {
|
902
|
+
return me();
|
867
903
|
}
|
868
|
-
function
|
904
|
+
function ns(...n) {
|
869
905
|
if (n.length !== 1)
|
870
|
-
return
|
906
|
+
return ze(...n);
|
871
907
|
const e = n[0];
|
872
|
-
return typeof e == "function" ?
|
908
|
+
return typeof e == "function" ? Ke(We(() => ({ get: e, set: ts }))) : F(e);
|
873
909
|
}
|
874
|
-
function
|
875
|
-
|
910
|
+
function rs(n, e) {
|
911
|
+
ss() && Ge(n, e);
|
876
912
|
}
|
877
|
-
const
|
878
|
-
function
|
913
|
+
const os = Ee ? window : void 0, is = Ee ? window.document : void 0;
|
914
|
+
function as(n) {
|
879
915
|
var e;
|
880
|
-
const t =
|
916
|
+
const t = te(n);
|
881
917
|
return (e = t?.$el) != null ? e : t;
|
882
918
|
}
|
883
|
-
function
|
884
|
-
const n =
|
885
|
-
return e &&
|
919
|
+
function cs() {
|
920
|
+
const n = F(!1), e = me();
|
921
|
+
return e && Ze(() => {
|
886
922
|
n.value = !0;
|
887
923
|
}, e), n;
|
888
924
|
}
|
889
|
-
function
|
890
|
-
const e =
|
891
|
-
return
|
925
|
+
function ls(n) {
|
926
|
+
const e = cs();
|
927
|
+
return ve(() => (e.value, !!n()));
|
892
928
|
}
|
893
|
-
function
|
894
|
-
const { window: s =
|
929
|
+
function us(n, e, t = {}) {
|
930
|
+
const { window: s = os, ...r } = t;
|
895
931
|
let o;
|
896
|
-
const a =
|
932
|
+
const a = ls(() => s && "MutationObserver" in s), i = () => {
|
897
933
|
o && (o.disconnect(), o = void 0);
|
898
|
-
},
|
899
|
-
const p =
|
900
|
-
return new Set(
|
901
|
-
}),
|
902
|
-
() =>
|
934
|
+
}, c = ve(() => {
|
935
|
+
const p = te(n), h = (Array.isArray(p) ? p : [p]).map(as).filter(es);
|
936
|
+
return new Set(h);
|
937
|
+
}), l = ge(
|
938
|
+
() => c.value,
|
903
939
|
(p) => {
|
904
|
-
i(), a.value && p.size && (o = new MutationObserver(e), p.forEach((
|
940
|
+
i(), a.value && p.size && (o = new MutationObserver(e), p.forEach((h) => o.observe(h, r)));
|
905
941
|
},
|
906
942
|
{ immediate: !0, flush: "post" }
|
907
943
|
), f = () => o?.takeRecords(), u = () => {
|
908
|
-
|
944
|
+
l(), i();
|
909
945
|
};
|
910
|
-
return
|
946
|
+
return Zt(u), {
|
911
947
|
isSupported: a,
|
912
948
|
stop: u,
|
913
949
|
takeRecords: f
|
914
950
|
};
|
915
951
|
}
|
916
|
-
function
|
952
|
+
function ps(n = null, e = {}) {
|
917
953
|
var t, s, r;
|
918
954
|
const {
|
919
|
-
document: o =
|
955
|
+
document: o = is,
|
920
956
|
restoreOnUnmount: a = (u) => u
|
921
|
-
} = e, i = (t = o?.title) != null ? t : "",
|
957
|
+
} = e, i = (t = o?.title) != null ? t : "", c = ns((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
|
922
958
|
function f(u) {
|
923
959
|
if (!("titleTemplate" in e))
|
924
960
|
return u;
|
925
961
|
const p = e.titleTemplate || "%s";
|
926
|
-
return typeof p == "function" ? p(u) :
|
962
|
+
return typeof p == "function" ? p(u) : te(p).replace(/%s/g, u);
|
927
963
|
}
|
928
|
-
return
|
929
|
-
|
964
|
+
return ge(
|
965
|
+
c,
|
930
966
|
(u, p) => {
|
931
967
|
u !== p && o && (o.title = f(typeof u == "string" ? u : ""));
|
932
968
|
},
|
933
969
|
{ immediate: !0 }
|
934
|
-
), e.observe && !e.titleTemplate && o && !
|
970
|
+
), e.observe && !e.titleTemplate && o && !l && us(
|
935
971
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
936
972
|
() => {
|
937
|
-
o && o.title !==
|
973
|
+
o && o.title !== c.value && (c.value = f(o.title));
|
938
974
|
},
|
939
975
|
{ childList: !0 }
|
940
|
-
),
|
976
|
+
), rs(() => {
|
941
977
|
if (a) {
|
942
|
-
const u = a(i,
|
978
|
+
const u = a(i, c.value || "");
|
943
979
|
u != null && o && (o.title = u);
|
944
980
|
}
|
945
|
-
}),
|
981
|
+
}), c;
|
946
982
|
}
|
947
|
-
const
|
983
|
+
const pe = X({
|
948
984
|
name: "VtjPageContainer",
|
949
985
|
async setup() {
|
950
|
-
const n =
|
951
|
-
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }),
|
986
|
+
const n = Pe(), e = ye(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = F(Symbol());
|
987
|
+
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), ps(s.title || "VTJ")), {
|
952
988
|
provider: n,
|
953
989
|
component: r,
|
954
990
|
file: s,
|
@@ -960,27 +996,27 @@ const le = Q({
|
|
960
996
|
},
|
961
997
|
render() {
|
962
998
|
const { component: n, query: e, sid: t } = this;
|
963
|
-
return n ?
|
999
|
+
return n ? W(n, { ...e, key: t }) : W("div", "页面不存在");
|
964
1000
|
},
|
965
1001
|
activated() {
|
966
1002
|
this.meta.cache === !1 && (this.sid = Symbol());
|
967
1003
|
}
|
968
|
-
}),
|
1004
|
+
}), ds = {
|
969
1005
|
"data-l-h6o7ki7": "",
|
970
1006
|
class: "vtj-startup__wrapper"
|
971
|
-
},
|
1007
|
+
}, fs = {
|
972
1008
|
"data-l-h6o7ki7": "",
|
973
1009
|
class: "vtj-startup"
|
974
|
-
},
|
1010
|
+
}, hs = {
|
975
1011
|
"data-l-h6o7ki7": "",
|
976
1012
|
class: "vtj-startup__name"
|
977
|
-
},
|
1013
|
+
}, ms = { "data-l-h6o7ki7": "" }, gs = {
|
978
1014
|
"data-l-h6o7ki7": "",
|
979
1015
|
class: "vtj-startup__tagline"
|
980
|
-
},
|
1016
|
+
}, vs = {
|
981
1017
|
"data-l-h6o7ki7": "",
|
982
1018
|
class: "vtj-startup__actions"
|
983
|
-
},
|
1019
|
+
}, ys = /* @__PURE__ */ X({
|
984
1020
|
__name: "Startup",
|
985
1021
|
props: {
|
986
1022
|
name: { default: "VTJ.PRO" },
|
@@ -1068,53 +1104,53 @@ const le = Q({
|
|
1068
1104
|
window.location.href = o;
|
1069
1105
|
}
|
1070
1106
|
};
|
1071
|
-
return (r, o) => (
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1107
|
+
return (r, o) => (et(), tt("div", ds, [
|
1108
|
+
E("div", fs, [
|
1109
|
+
E("h1", hs, [
|
1110
|
+
E("span", ms, V(t.name), 1)
|
1075
1111
|
]),
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1112
|
+
E("div", gs, V(t.tagline), 1),
|
1113
|
+
E("div", vs, [
|
1114
|
+
E("button", {
|
1079
1115
|
"data-l-h6o7ki7": "",
|
1080
1116
|
onClick: s
|
1081
|
-
},
|
1117
|
+
}, V(t.actionText), 1)
|
1082
1118
|
])
|
1083
1119
|
])
|
1084
1120
|
]));
|
1085
1121
|
}
|
1086
|
-
}),
|
1122
|
+
}), _s = X({
|
1087
1123
|
name: "VtjStartupContainer",
|
1088
1124
|
render() {
|
1089
|
-
return
|
1125
|
+
return W(ys);
|
1090
1126
|
}
|
1091
|
-
}),
|
1092
|
-
var
|
1093
|
-
class
|
1127
|
+
}), Re = Symbol("Provider");
|
1128
|
+
var ws = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ws || {});
|
1129
|
+
class Ss extends Ae {
|
1094
1130
|
constructor(e) {
|
1095
1131
|
super(), this.options = e;
|
1096
1132
|
const {
|
1097
1133
|
service: t,
|
1098
|
-
mode: s =
|
1134
|
+
mode: s = y.Raw,
|
1099
1135
|
dependencies: r,
|
1100
1136
|
materials: o,
|
1101
1137
|
project: a = {},
|
1102
1138
|
adapter: i = {},
|
1103
|
-
globals:
|
1104
|
-
modules:
|
1139
|
+
globals: c = {},
|
1140
|
+
modules: l = {},
|
1105
1141
|
router: f = null,
|
1106
1142
|
materialPath: u = "./",
|
1107
1143
|
nodeEnv: p = "development"
|
1108
1144
|
/* Development */
|
1109
1145
|
} = e;
|
1110
|
-
this.mode = s, this.modules =
|
1111
|
-
const { access:
|
1112
|
-
|
1146
|
+
this.mode = s, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = p, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
|
1147
|
+
const { access: h, request: m } = this.adapter;
|
1148
|
+
h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a;
|
1113
1149
|
}
|
1114
1150
|
mode;
|
1115
1151
|
globals = {};
|
1116
1152
|
modules = {};
|
1117
|
-
adapter = { request:
|
1153
|
+
adapter = { request: _t, jsonp: qe };
|
1118
1154
|
apis = {};
|
1119
1155
|
dependencies = {};
|
1120
1156
|
materials = {};
|
@@ -1131,7 +1167,7 @@ class ds extends xe {
|
|
1131
1167
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1132
1168
|
throw new Error("project is null");
|
1133
1169
|
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
1134
|
-
o.CKEDITOR_VERSION = void 0, this.mode ===
|
1170
|
+
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = bt(s, r, this.adapter), Se(), this.project.config?.mock && jt(s), this.initRouter(), this.triggerReady();
|
1135
1171
|
}
|
1136
1172
|
async loadDependencies(e) {
|
1137
1173
|
const t = Object.entries(this.dependencies);
|
@@ -1140,44 +1176,44 @@ class ds extends xe {
|
|
1140
1176
|
}
|
1141
1177
|
async loadAssets(e) {
|
1142
1178
|
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1143
|
-
libraryExports:
|
1144
|
-
libraryMap:
|
1179
|
+
libraryExports: c,
|
1180
|
+
libraryMap: l,
|
1145
1181
|
materials: f,
|
1146
1182
|
materialExports: u,
|
1147
1183
|
materialMapLibrary: p
|
1148
|
-
} =
|
1184
|
+
} = ut(
|
1149
1185
|
t,
|
1150
1186
|
a,
|
1151
1187
|
i === "development"
|
1152
1188
|
/* Development */
|
1153
1189
|
);
|
1154
|
-
for (const
|
1155
|
-
const
|
1156
|
-
if (
|
1157
|
-
r[
|
1158
|
-
else if (
|
1159
|
-
e[
|
1190
|
+
for (const h of c) {
|
1191
|
+
const m = s[h], d = e[h];
|
1192
|
+
if (d)
|
1193
|
+
r[h] = d;
|
1194
|
+
else if (m)
|
1195
|
+
e[h] = r[h] = await m();
|
1160
1196
|
else {
|
1161
|
-
const
|
1162
|
-
for (const g of
|
1163
|
-
|
1164
|
-
r[
|
1197
|
+
const w = l[h] || [];
|
1198
|
+
for (const g of w)
|
1199
|
+
Z(g) && await dt(h, x.append(g, { v: k })), ee(g) && await ae(x.append(g, { v: k }));
|
1200
|
+
r[h] = e[h];
|
1165
1201
|
}
|
1166
1202
|
}
|
1167
1203
|
if (i === "development") {
|
1168
|
-
for (const
|
1169
|
-
await
|
1170
|
-
const
|
1171
|
-
for (const
|
1172
|
-
const
|
1173
|
-
if (
|
1174
|
-
|
1175
|
-
o[g] =
|
1204
|
+
for (const m of f)
|
1205
|
+
await ae(x.append(m, { v: k }));
|
1206
|
+
const h = this.materials || {};
|
1207
|
+
for (const m of u) {
|
1208
|
+
const d = e[p[m]], w = Te[m];
|
1209
|
+
if (w)
|
1210
|
+
d && w.forEach((g) => {
|
1211
|
+
o[g] = d[g];
|
1176
1212
|
});
|
1177
1213
|
else {
|
1178
|
-
const g =
|
1179
|
-
g &&
|
1180
|
-
o[
|
1214
|
+
const g = h[m] ? (await h[m]()).default : e[m];
|
1215
|
+
g && d && (g.components || []).forEach((S) => {
|
1216
|
+
o[S.name] = pt(S, d);
|
1181
1217
|
});
|
1182
1218
|
}
|
1183
1219
|
}
|
@@ -1186,24 +1222,24 @@ class ds extends xe {
|
|
1186
1222
|
initRouter() {
|
1187
1223
|
const { router: e, project: t, options: s, adapter: r } = this;
|
1188
1224
|
if (!e) return;
|
1189
|
-
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s,
|
1190
|
-
path: `${
|
1191
|
-
name:
|
1192
|
-
component:
|
1225
|
+
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
|
1226
|
+
path: `${c}${a}/:id`,
|
1227
|
+
name: C,
|
1228
|
+
component: pe
|
1193
1229
|
}, f = {
|
1194
|
-
path:
|
1195
|
-
name:
|
1196
|
-
component: t?.homepage ?
|
1230
|
+
path: c,
|
1231
|
+
name: D,
|
1232
|
+
component: t?.homepage ? pe : r.startupComponent || _s,
|
1197
1233
|
meta: i
|
1198
1234
|
};
|
1199
|
-
e.hasRoute(
|
1235
|
+
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));
|
1200
1236
|
}
|
1201
1237
|
install(e) {
|
1202
1238
|
const t = e.config.globalProperties.installed || {};
|
1203
1239
|
for (const [s, r] of Object.entries(this.library))
|
1204
|
-
!t[s] &&
|
1205
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1206
|
-
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误",
|
1240
|
+
!t[s] && mt(r) && (e.use(r), t[s] = !0);
|
1241
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Re, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
|
1242
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1207
1243
|
console.error(
|
1208
1244
|
"[VTJ Error]:",
|
1209
1245
|
{
|
@@ -1214,7 +1250,7 @@ class ds extends xe {
|
|
1214
1250
|
s?.stack
|
1215
1251
|
), N.error({
|
1216
1252
|
title: "未处理的异常:请在控制台查看详情",
|
1217
|
-
message:
|
1253
|
+
message: c
|
1218
1254
|
});
|
1219
1255
|
});
|
1220
1256
|
}
|
@@ -1264,47 +1300,47 @@ class ds extends xe {
|
|
1264
1300
|
apis: a,
|
1265
1301
|
window,
|
1266
1302
|
...t
|
1267
|
-
},
|
1268
|
-
getDsl: async (
|
1269
|
-
getDslByUrl: async (
|
1303
|
+
}, c = Y({
|
1304
|
+
getDsl: async (l) => await this.getDsl(l) || null,
|
1305
|
+
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1270
1306
|
options: i
|
1271
1307
|
});
|
1272
|
-
return
|
1308
|
+
return G({
|
1273
1309
|
...i,
|
1274
1310
|
dsl: e,
|
1275
|
-
loader:
|
1311
|
+
loader: c
|
1276
1312
|
});
|
1277
1313
|
}
|
1278
1314
|
async getRenderComponent(e, t) {
|
1279
1315
|
const s = this.getFile(e);
|
1280
1316
|
if (!s)
|
1281
|
-
return
|
1317
|
+
return M.warn(`Can not find file: ${e}`), null;
|
1282
1318
|
t && t(s);
|
1283
1319
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1284
1320
|
if (o)
|
1285
1321
|
return (await o())?.default;
|
1286
1322
|
const a = await this.getDsl(s.id);
|
1287
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1323
|
+
return a ? this.createDslRenderer(a).renderer : (M.warn(`Can not find dsl: ${e}`), null);
|
1288
1324
|
}
|
1289
1325
|
defineUrlSchemaComponent(e, t) {
|
1290
|
-
return
|
1326
|
+
return ce(async () => {
|
1291
1327
|
const s = await this.getDslByUrl(e);
|
1292
1328
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1293
1329
|
});
|
1294
1330
|
}
|
1295
1331
|
definePluginComponent(e) {
|
1296
|
-
return
|
1332
|
+
return ce(async () => await je(e, window));
|
1297
1333
|
}
|
1298
1334
|
}
|
1299
|
-
function
|
1300
|
-
const e = new
|
1335
|
+
function Ds(n) {
|
1336
|
+
const e = new Ss(n);
|
1301
1337
|
return {
|
1302
1338
|
provider: e,
|
1303
1339
|
onReady: (s) => e.ready(s)
|
1304
1340
|
};
|
1305
1341
|
}
|
1306
|
-
function
|
1307
|
-
const e =
|
1342
|
+
function Pe(n = {}) {
|
1343
|
+
const e = he(Re);
|
1308
1344
|
if (!e)
|
1309
1345
|
throw new Error("Can not find provider");
|
1310
1346
|
if (e.nodeEnv === "development") {
|
@@ -1319,7 +1355,7 @@ function Ee(n = {}) {
|
|
1319
1355
|
}
|
1320
1356
|
return e;
|
1321
1357
|
}
|
1322
|
-
const
|
1358
|
+
const se = new Je({
|
1323
1359
|
settings: {
|
1324
1360
|
type: "json",
|
1325
1361
|
validSuccess: !0,
|
@@ -1332,7 +1368,7 @@ const te = new Ne({
|
|
1332
1368
|
});
|
1333
1369
|
}
|
1334
1370
|
}
|
1335
|
-
}),
|
1371
|
+
}), bs = (n = "/__vtj__/api/:type.json") => (e, t) => se.send({
|
1336
1372
|
url: n,
|
1337
1373
|
method: "post",
|
1338
1374
|
params: { type: e },
|
@@ -1340,7 +1376,7 @@ const te = new Ne({
|
|
1340
1376
|
type: e,
|
1341
1377
|
data: t
|
1342
1378
|
}
|
1343
|
-
}),
|
1379
|
+
}), js = (n = "/__vtj__/api/uploader.json") => async (e, t) => await se.send({
|
1344
1380
|
url: n,
|
1345
1381
|
method: "post",
|
1346
1382
|
data: {
|
@@ -1351,12 +1387,12 @@ const te = new Ne({
|
|
1351
1387
|
type: "data"
|
1352
1388
|
}
|
1353
1389
|
}).then((s) => s && s[0] ? s[0] : null).catch(() => null);
|
1354
|
-
class
|
1390
|
+
class ne {
|
1355
1391
|
api;
|
1356
1392
|
pluginCaches = {};
|
1357
1393
|
uploader;
|
1358
1394
|
constructor() {
|
1359
|
-
this.api =
|
1395
|
+
this.api = bs(), this.uploader = js();
|
1360
1396
|
}
|
1361
1397
|
async getExtension() {
|
1362
1398
|
console.log("BaseService.getExtension");
|
@@ -1429,10 +1465,10 @@ class se {
|
|
1429
1465
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1430
1466
|
}
|
1431
1467
|
async getPluginMaterial(e) {
|
1432
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
1468
|
+
const { urls: t = [] } = e, s = t.filter((o) => ct(o))[0];
|
1433
1469
|
if (!s) return null;
|
1434
1470
|
const r = this.pluginCaches[s];
|
1435
|
-
return r || (this.pluginCaches[s] =
|
1471
|
+
return r || (this.pluginCaches[s] = se.send({
|
1436
1472
|
url: s,
|
1437
1473
|
method: "get",
|
1438
1474
|
settings: {
|
@@ -1445,77 +1481,77 @@ class se {
|
|
1445
1481
|
return console.log("BaseService.genSource", e), "";
|
1446
1482
|
}
|
1447
1483
|
}
|
1448
|
-
const
|
1484
|
+
const v = new Ve({
|
1449
1485
|
type: "local",
|
1450
1486
|
expired: 0,
|
1451
1487
|
prefix: "__VTJ_"
|
1452
1488
|
});
|
1453
|
-
class
|
1489
|
+
class Hs extends ne {
|
1454
1490
|
init(e) {
|
1455
|
-
const t = new
|
1456
|
-
return
|
1491
|
+
const t = new H(e), s = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1492
|
+
return v.save(`project_${t.id}`, r), Promise.resolve(r);
|
1457
1493
|
}
|
1458
1494
|
saveProject(e) {
|
1459
|
-
const t = new
|
1460
|
-
return
|
1495
|
+
const t = new H(e);
|
1496
|
+
return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1461
1497
|
}
|
1462
1498
|
saveMaterials(e, t) {
|
1463
|
-
return
|
1499
|
+
return v.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
|
1464
1500
|
}
|
1465
1501
|
saveFile(e) {
|
1466
|
-
return
|
1502
|
+
return v.save(`file_${e.id}`, e), Promise.resolve(!0);
|
1467
1503
|
}
|
1468
1504
|
getFile(e) {
|
1469
|
-
const t =
|
1505
|
+
const t = v.get(`file_${e}`);
|
1470
1506
|
return t ? Promise.resolve(t) : Promise.reject(null);
|
1471
1507
|
}
|
1472
1508
|
removeFile(e) {
|
1473
|
-
return
|
1509
|
+
return v.remove(`file_${e}`), Promise.resolve(!0);
|
1474
1510
|
}
|
1475
1511
|
saveHistory(e) {
|
1476
|
-
return
|
1512
|
+
return v.save(`history_${e.id}`, e), Promise.resolve(!0);
|
1477
1513
|
}
|
1478
1514
|
removeHistory(e) {
|
1479
|
-
const t =
|
1515
|
+
const t = v.get(`history_${e}`);
|
1480
1516
|
if (t) {
|
1481
1517
|
const r = (t.items || []).map((o) => o.id);
|
1482
|
-
this.removeHistoryItem(e, r),
|
1518
|
+
this.removeHistoryItem(e, r), v.remove(`history_${e}`);
|
1483
1519
|
}
|
1484
1520
|
return Promise.resolve(!0);
|
1485
1521
|
}
|
1486
1522
|
getHistory(e) {
|
1487
|
-
const t =
|
1523
|
+
const t = v.get(`history_${e}`), s = new de(t || { id: e });
|
1488
1524
|
return Promise.resolve(s.toDsl());
|
1489
1525
|
}
|
1490
1526
|
getHistoryItem(e, t) {
|
1491
|
-
const s =
|
1527
|
+
const s = v.get(`history_${e}_${t}`);
|
1492
1528
|
return Promise.resolve(s);
|
1493
1529
|
}
|
1494
1530
|
saveHistoryItem(e, t) {
|
1495
|
-
return
|
1531
|
+
return v.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1496
1532
|
}
|
1497
1533
|
removeHistoryItem(e, t) {
|
1498
1534
|
return t.forEach((s) => {
|
1499
|
-
|
1535
|
+
v.remove(`history_${e}_${s}`);
|
1500
1536
|
}), Promise.resolve(!0);
|
1501
1537
|
}
|
1502
1538
|
}
|
1503
|
-
class
|
1539
|
+
class $s extends ne {
|
1504
1540
|
projects = {};
|
1505
1541
|
materials = {};
|
1506
1542
|
files = {};
|
1507
1543
|
histories = {};
|
1508
1544
|
historyItems = {};
|
1509
1545
|
init(e) {
|
1510
|
-
const t = new
|
1546
|
+
const t = new H(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1511
1547
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1512
1548
|
}
|
1513
1549
|
saveProject(e) {
|
1514
|
-
const t = new
|
1550
|
+
const t = new H(e);
|
1515
1551
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1516
1552
|
}
|
1517
1553
|
saveMaterials(e, t) {
|
1518
|
-
return e.id && (this.materials[e.id] =
|
1554
|
+
return e.id && (this.materials[e.id] = Q(t)), Promise.resolve(!0);
|
1519
1555
|
}
|
1520
1556
|
saveFile(e) {
|
1521
1557
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1539,7 +1575,7 @@ class hs extends se {
|
|
1539
1575
|
return Promise.resolve(!0);
|
1540
1576
|
}
|
1541
1577
|
getHistory(e) {
|
1542
|
-
const t = this.histories[e], s = new
|
1578
|
+
const t = this.histories[e], s = new de(t || { id: e });
|
1543
1579
|
return Promise.resolve(s);
|
1544
1580
|
}
|
1545
1581
|
getHistoryItem(e, t) {
|
@@ -1557,11 +1593,11 @@ class hs extends se {
|
|
1557
1593
|
}), Promise.resolve(!0);
|
1558
1594
|
}
|
1559
1595
|
}
|
1560
|
-
let
|
1561
|
-
function
|
1562
|
-
return
|
1596
|
+
let I = null;
|
1597
|
+
function Ms() {
|
1598
|
+
return I || (I = new $s(), I);
|
1563
1599
|
}
|
1564
|
-
class
|
1600
|
+
class Os extends ne {
|
1565
1601
|
getFileCaches = {};
|
1566
1602
|
async getExtension() {
|
1567
1603
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1576,7 +1612,7 @@ class xs extends se {
|
|
1576
1612
|
async saveMaterials(e, t) {
|
1577
1613
|
return !!await this.api("saveMaterials", {
|
1578
1614
|
project: e,
|
1579
|
-
materials:
|
1615
|
+
materials: Q(t)
|
1580
1616
|
}).catch(() => !1);
|
1581
1617
|
}
|
1582
1618
|
async saveFile(e) {
|
@@ -1616,118 +1652,122 @@ class xs extends se {
|
|
1616
1652
|
);
|
1617
1653
|
}
|
1618
1654
|
}
|
1619
|
-
function
|
1655
|
+
function xe(n, e, t = []) {
|
1620
1656
|
return t.map((s) => {
|
1621
|
-
const { id: r, title: o, icon: a, children: i, hidden:
|
1657
|
+
const { id: r, title: o, icon: a, children: i, hidden: c } = s;
|
1622
1658
|
return {
|
1623
1659
|
id: r,
|
1624
1660
|
title: o,
|
1625
1661
|
icon: a,
|
1626
|
-
hidden:
|
1662
|
+
hidden: c,
|
1627
1663
|
url: `${n}/${e}/${r}`,
|
1628
|
-
children: i && i.length ?
|
1664
|
+
children: i && i.length ? xe(n, e, i) : void 0
|
1629
1665
|
};
|
1630
1666
|
});
|
1631
1667
|
}
|
1632
|
-
function
|
1668
|
+
function ke(n, e) {
|
1633
1669
|
if (!e) return n;
|
1634
1670
|
let t = [];
|
1635
1671
|
for (const s of n)
|
1636
1672
|
if (s.children && s.children.length) {
|
1637
|
-
const r =
|
1673
|
+
const r = ke(s.children, e);
|
1638
1674
|
r.length && (s.children = r, t.push(s));
|
1639
1675
|
} else
|
1640
1676
|
e.can(s.id.toString()) && t.push(s);
|
1641
1677
|
return t;
|
1642
1678
|
}
|
1643
|
-
function
|
1679
|
+
function Bs(n) {
|
1644
1680
|
const {
|
1645
1681
|
menuPathPrefix: e = "",
|
1646
1682
|
pageRouteName: t = "page",
|
1647
1683
|
disableMenusFilter: s = !1
|
1648
|
-
} = n || {}, r =
|
1649
|
-
|
1650
|
-
const { name: p, params:
|
1651
|
-
if (p ===
|
1652
|
-
const
|
1653
|
-
i.value = !
|
1654
|
-
} else if (p ===
|
1655
|
-
const
|
1656
|
-
i.value = !
|
1684
|
+
} = n || {}, r = Pe(), o = ye(), a = Rt(), i = F(!1), c = F(!1), l = r.project;
|
1685
|
+
st(() => {
|
1686
|
+
const { name: p, params: h, meta: m } = o;
|
1687
|
+
if (p === C) {
|
1688
|
+
const d = r.getPage(h.id);
|
1689
|
+
i.value = !d?.mask, c.value = !!d?.pure;
|
1690
|
+
} else if (p === D) {
|
1691
|
+
const d = r.getHomepage();
|
1692
|
+
i.value = !d?.mask, c.value = !!d?.pure;
|
1657
1693
|
} else
|
1658
|
-
i.value = !
|
1694
|
+
i.value = !m.mask, c.value = !!m.pure;
|
1659
1695
|
});
|
1660
|
-
const f =
|
1696
|
+
const f = xe(
|
1661
1697
|
e,
|
1662
1698
|
t,
|
1663
|
-
|
1664
|
-
), u =
|
1699
|
+
l?.pages
|
1700
|
+
), u = l?.config;
|
1665
1701
|
return {
|
1666
1702
|
disabled: i,
|
1667
1703
|
logo: u?.logo,
|
1668
1704
|
themeSwitchable: u?.themeSwitchable,
|
1669
|
-
title: u?.title ||
|
1670
|
-
menus: s ? f :
|
1671
|
-
pure:
|
1705
|
+
title: u?.title || l?.description || l?.name || "VTJ App",
|
1706
|
+
menus: s ? f : ke(f, a),
|
1707
|
+
pure: c
|
1672
1708
|
};
|
1673
1709
|
}
|
1674
1710
|
export {
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1711
|
+
be as ACCESS_KEY,
|
1712
|
+
Is as Access,
|
1713
|
+
at as BUILD_IN_TAGS,
|
1714
|
+
rt as BUILT_IN_DIRECTIVES,
|
1715
|
+
ne as BaseService,
|
1716
|
+
le as CONTEXT_HOST,
|
1717
|
+
Pt as Context,
|
1718
|
+
y as ContextMode,
|
1719
|
+
ot as DATA_TYPES,
|
1720
|
+
D as HOMEPAGE_ROUTE_NAME,
|
1721
|
+
it as HTML_TAGS,
|
1722
|
+
Ts as JSCodeToString,
|
1723
|
+
Cs as LIFE_CYCLES_LIST,
|
1724
|
+
Os as LocalService,
|
1725
|
+
$s as MemoryService,
|
1726
|
+
ws as NodeEnv,
|
1727
|
+
C as PAGE_ROUTE_NAME,
|
1728
|
+
Ss as Provider,
|
1729
|
+
ys as Startup,
|
1730
|
+
Hs as StorageService,
|
1731
|
+
k as VTJ_RENDERER_VERSION,
|
1732
|
+
we as adoptedStyleSheets,
|
1733
|
+
Fs as createAssetScripts,
|
1734
|
+
As as createAssetsCss,
|
1735
|
+
It as createDataSources,
|
1736
|
+
Y as createLoader,
|
1737
|
+
Ms as createMemoryService,
|
1738
|
+
St as createMetaApi,
|
1739
|
+
Ds as createProvider,
|
1740
|
+
G as createRenderer,
|
1741
|
+
wt as createSchemaApi,
|
1742
|
+
bt as createSchemaApis,
|
1743
|
+
Mt as defaultLoader,
|
1744
|
+
T as fillBasePath,
|
1745
|
+
$e as getModifiers,
|
1746
|
+
je as getPlugin,
|
1747
|
+
pt as getRawComponent,
|
1748
|
+
gt as isBuiltInTag,
|
1749
|
+
Z as isCSSUrl,
|
1750
|
+
yt as isJSCode,
|
1751
|
+
_ as isJSExpression,
|
1713
1752
|
U as isJSFunction,
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1753
|
+
ct as isJSON,
|
1754
|
+
ee as isJSUrl,
|
1755
|
+
vt as isNativeTag,
|
1756
|
+
mt as isVuePlugin,
|
1757
|
+
dt as loadCss,
|
1758
|
+
ft as loadCssUrl,
|
1759
|
+
ht as loadScriptUrl,
|
1760
|
+
$t as mockApi,
|
1761
|
+
jt as mockApis,
|
1762
|
+
Se as mockCleanup,
|
1763
|
+
O as nodeRender,
|
1764
|
+
ut as parseDeps,
|
1765
|
+
A as parseExpression,
|
1766
|
+
ue as parseFunction,
|
1767
|
+
Re as providerKey,
|
1768
|
+
lt as removeProdFlag,
|
1769
|
+
_e as toString,
|
1770
|
+
Rt as useAccess,
|
1771
|
+
Bs as useMask,
|
1772
|
+
Pe as useProvider
|
1733
1773
|
};
|