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