@vtj/renderer 0.9.0-alpha.9 → 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 +540 -481
- package/package.json +7 -7
- package/types/components/Startup.d.ts +1 -0
- package/types/constants.d.ts +2 -0
- package/types/hooks/mask.d.ts +6 -1
- package/types/plugins/access.d.ts +5 -1
- package/types/provider/page.d.ts +5 -3
- package/types/provider/provider.d.ts +2 -1
- package/types/services/base.d.ts +1 -0
- 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
|
3
|
-
import * as
|
4
|
-
import { inject as
|
5
|
-
import { ElNotification as
|
6
|
-
import { useRoute 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
|
+
import * as B from "vue";
|
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 oe = [
|
|
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 oe = [
|
|
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,59 +47,61 @@ const oe = [
|
|
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="${x.append(e, { v:
|
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="${x.append(e, { v:
|
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((
|
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:
|
80
|
-
|
81
|
-
|
82
|
-
}),
|
81
|
+
({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
|
82
|
+
p?.forEach((g) => {
|
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:
|
90
|
-
materialMapLibrary:
|
91
|
+
materialExports: De(f),
|
92
|
+
materialMapLibrary: u,
|
91
93
|
libraryMap: c,
|
92
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
|
101
|
+
function _e(n) {
|
100
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();
|
@@ -114,11 +116,11 @@ function ve(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,7 +128,7 @@ function it(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) => {
|
@@ -140,10 +142,16 @@ async function at(n, e, t = window) {
|
|
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);
|
145
150
|
}
|
146
|
-
function
|
151
|
+
function vt(n) {
|
152
|
+
return it.includes(n);
|
153
|
+
}
|
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 ");
|
@@ -153,13 +161,13 @@ function k(n, e, t = !1, s = !1) {
|
|
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 ie(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
|
-
function
|
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,
|
@@ -190,24 +198,24 @@ const ut = Fe({
|
|
190
198
|
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
191
199
|
failMessage: !0,
|
192
200
|
showError: (n) => {
|
193
|
-
|
201
|
+
N.error({
|
194
202
|
message: n || "未知错误"
|
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
217
|
let P;
|
210
|
-
function
|
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 dt(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 dt(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,89 +246,90 @@ function pt(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
|
257
|
+
async function jt(n = []) {
|
250
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 c = x.parse(i.url) || {}, l = i.body instanceof FormData ?
|
268
|
+
const c = x.parse(i.url) || {}, l = i.body instanceof FormData ? Ne(i.body) : i.body, f = o(i.url)?.params;
|
261
269
|
return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
|
262
270
|
});
|
263
271
|
}
|
264
272
|
}
|
265
|
-
function
|
273
|
+
function Se() {
|
266
274
|
P && (P._mocked = {});
|
267
275
|
}
|
268
|
-
const
|
276
|
+
const Et = {
|
269
277
|
session: !1,
|
270
278
|
authKey: "Authorization",
|
271
279
|
storageKey: "ACCESS_STORAGE",
|
272
280
|
storagePrefix: "__VTJ_",
|
273
|
-
unauthorized:
|
281
|
+
unauthorized: void 0,
|
274
282
|
auth: "/#/login",
|
275
283
|
redirectParam: "r",
|
276
284
|
unauthorizedCode: 401,
|
277
285
|
unauthorizedMessage: "登录已经失效,请重新登录!",
|
278
|
-
noPermissionMessage: "无权限访问该页面"
|
279
|
-
|
280
|
-
|
286
|
+
noPermissionMessage: "无权限访问该页面",
|
287
|
+
appName: ""
|
288
|
+
}, be = Symbol("access");
|
289
|
+
class Is {
|
281
290
|
options;
|
282
291
|
data = null;
|
283
|
-
mode =
|
292
|
+
mode = y.Raw;
|
284
293
|
constructor(e) {
|
285
|
-
this.options = Object.assign({},
|
294
|
+
this.options = Object.assign({}, Et, e), this.loadData();
|
286
295
|
}
|
287
296
|
connect(e) {
|
288
297
|
const { mode: t, router: s, request: r } = e;
|
289
|
-
this.mode = t, s &&
|
298
|
+
this.mode = t, s && this.mode === y.Raw && this.setGuard(s), r && this.setRequest(r);
|
290
299
|
}
|
291
300
|
login(e) {
|
292
301
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
293
|
-
this.setData(e), this.data && (
|
302
|
+
this.setData(e), this.data && (q.save(t, e, {
|
294
303
|
type: "local",
|
295
304
|
prefix: s
|
296
|
-
}), r &&
|
305
|
+
}), r && J.set(o, this.data.token));
|
297
306
|
}
|
298
307
|
clear() {
|
299
308
|
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
300
|
-
this.data = null,
|
309
|
+
this.data = null, q.remove(e, {
|
301
310
|
type: "local",
|
302
311
|
prefix: t
|
303
|
-
}), s &&
|
312
|
+
}), s && J.remove(r);
|
304
313
|
}
|
305
314
|
logout() {
|
306
315
|
this.clear(), this.toLogin();
|
307
316
|
}
|
308
317
|
getData() {
|
309
|
-
return this.data;
|
318
|
+
return this.data ? this.data : (this.loadData(), this.data);
|
310
319
|
}
|
311
320
|
getToken() {
|
312
|
-
return this.data?.token;
|
321
|
+
return this.data || this.loadData(), this.data?.token;
|
313
322
|
}
|
314
323
|
can(e) {
|
315
|
-
const {
|
316
|
-
return typeof e == "function" ? e(
|
324
|
+
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
325
|
+
return typeof e == "function" ? e(s) : oe(e).every((o) => s[o] || s[t + "." + o]);
|
317
326
|
}
|
318
327
|
some(e) {
|
319
|
-
const {
|
320
|
-
return
|
328
|
+
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
329
|
+
return oe(e).some((o) => s[o] || s[t + "." + o]);
|
321
330
|
}
|
322
331
|
install(e) {
|
323
|
-
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);
|
324
333
|
}
|
325
334
|
isAuthPath(e) {
|
326
335
|
const { auth: t, isAuth: s } = this.options;
|
@@ -334,20 +343,20 @@ class $s {
|
|
334
343
|
}
|
335
344
|
toLogin() {
|
336
345
|
const { auth: e, redirectParam: t } = this.options;
|
337
|
-
if (!e
|
346
|
+
if (!e) return;
|
338
347
|
const s = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
|
339
348
|
typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
|
340
349
|
}
|
341
350
|
setData(e) {
|
342
351
|
const { privateKey: t } = this.options;
|
343
352
|
if (Array.isArray(e) && t) {
|
344
|
-
const s = e.map((r) =>
|
353
|
+
const s = e.map((r) => ie(r, t));
|
345
354
|
this.data = JSON.parse(s.join(""));
|
346
355
|
return;
|
347
356
|
}
|
348
357
|
if (typeof e == "string")
|
349
358
|
try {
|
350
|
-
const s = t ?
|
359
|
+
const s = t ? ie(e, t) : e;
|
351
360
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
352
361
|
} catch (s) {
|
353
362
|
console.warn(s);
|
@@ -356,18 +365,18 @@ class $s {
|
|
356
365
|
this.data = e;
|
357
366
|
}
|
358
367
|
loadData() {
|
359
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
368
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = q.get(e, {
|
360
369
|
type: "local",
|
361
370
|
prefix: t
|
362
371
|
});
|
363
|
-
this.setData(s);
|
372
|
+
this.setData(s || null);
|
364
373
|
}
|
365
374
|
isLogined() {
|
366
375
|
const { session: e, authKey: t } = this.options;
|
367
|
-
return e && t ? !!
|
376
|
+
return e && t ? !!J.get(t) : !!this.getToken();
|
368
377
|
}
|
369
378
|
hasRoutePermission(e) {
|
370
|
-
if (e.name ===
|
379
|
+
if (e.name === C) {
|
371
380
|
const t = e.params.id;
|
372
381
|
return t && this.can(t);
|
373
382
|
}
|
@@ -376,15 +385,15 @@ class $s {
|
|
376
385
|
setGuard(e) {
|
377
386
|
e.beforeEach((t, s, r) => this.guard(t, r));
|
378
387
|
}
|
379
|
-
guard(e, t) {
|
388
|
+
async guard(e, t) {
|
380
389
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
381
390
|
return t();
|
382
391
|
if (this.isLogined()) {
|
383
392
|
if (this.hasRoutePermission(e))
|
384
393
|
return t();
|
385
394
|
{
|
386
|
-
const s = this.options
|
387
|
-
return this.showTip(s), t(!1);
|
395
|
+
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
396
|
+
return await this.showTip(s), K(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
388
397
|
}
|
389
398
|
}
|
390
399
|
t(!1), this.toLogin();
|
@@ -403,10 +412,10 @@ class $s {
|
|
403
412
|
}
|
404
413
|
async showTip(e) {
|
405
414
|
const { alert: t } = this.options;
|
406
|
-
t
|
415
|
+
return t ? (await fe(150), await t(e, {
|
407
416
|
title: "提示",
|
408
417
|
type: "warning"
|
409
|
-
}).catch((
|
418
|
+
}).catch(() => !1)) : !1;
|
410
419
|
}
|
411
420
|
setRequest(e) {
|
412
421
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
@@ -418,10 +427,10 @@ class $s {
|
|
418
427
|
);
|
419
428
|
}
|
420
429
|
}
|
421
|
-
function
|
422
|
-
return
|
430
|
+
function Rt() {
|
431
|
+
return he(be, null);
|
423
432
|
}
|
424
|
-
class
|
433
|
+
class Pt {
|
425
434
|
__id = null;
|
426
435
|
__mode;
|
427
436
|
__instance = null;
|
@@ -450,7 +459,7 @@ class yt {
|
|
450
459
|
const { mode: t, dsl: s, attrs: r } = e;
|
451
460
|
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
452
461
|
}
|
453
|
-
setup(e, t =
|
462
|
+
setup(e, t = B) {
|
454
463
|
const s = t.getCurrentInstance();
|
455
464
|
if (!s) return;
|
456
465
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
@@ -464,41 +473,41 @@ class yt {
|
|
464
473
|
});
|
465
474
|
}
|
466
475
|
__proxy() {
|
467
|
-
this.__instance &&
|
476
|
+
this.__instance && le.forEach((e) => {
|
468
477
|
this[e] = this.__instance?.[e];
|
469
478
|
});
|
470
479
|
}
|
471
480
|
__cleanup() {
|
472
|
-
|
481
|
+
le.forEach((e) => {
|
473
482
|
this[e] = null;
|
474
483
|
});
|
475
484
|
}
|
476
485
|
__parseFunction(e) {
|
477
486
|
if (e)
|
478
|
-
if (this.__mode ===
|
487
|
+
if (this.__mode === y.Runtime) {
|
479
488
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
480
|
-
return
|
489
|
+
return ue({ type: s, value: r }, this);
|
481
490
|
} else
|
482
|
-
return
|
491
|
+
return ue(e, this);
|
483
492
|
}
|
484
493
|
__parseExpression(e) {
|
485
494
|
if (e)
|
486
|
-
if (this.__mode ===
|
495
|
+
if (this.__mode === y.Runtime) {
|
487
496
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
488
|
-
return
|
497
|
+
return A({ type: s, value: r }, this);
|
489
498
|
} else
|
490
|
-
return
|
499
|
+
return A(e, this);
|
491
500
|
}
|
492
501
|
__ref(e = null, t) {
|
493
|
-
if (this.__mode !==
|
502
|
+
if (this.__mode !== y.VNode)
|
494
503
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
495
|
-
await
|
504
|
+
await fe(0);
|
496
505
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
497
506
|
if (!r) {
|
498
507
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
499
508
|
return;
|
500
509
|
}
|
501
|
-
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")
|
502
511
|
t(s);
|
503
512
|
else if (t) {
|
504
513
|
const o = this.$refs[t];
|
@@ -519,10 +528,10 @@ class yt {
|
|
519
528
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
520
529
|
}
|
521
530
|
}
|
522
|
-
function
|
531
|
+
function G(n) {
|
523
532
|
const {
|
524
|
-
Vue: e =
|
525
|
-
mode: t =
|
533
|
+
Vue: e = B,
|
534
|
+
mode: t = y.Runtime,
|
526
535
|
components: s = {},
|
527
536
|
libs: r = {},
|
528
537
|
apis: o = {},
|
@@ -531,60 +540,60 @@ function J(n) {
|
|
531
540
|
$components: s,
|
532
541
|
$libs: r,
|
533
542
|
$apis: o
|
534
|
-
}, l = new
|
543
|
+
}, l = new Pt({
|
535
544
|
mode: t,
|
536
545
|
dsl: i.value,
|
537
546
|
attrs: c
|
538
547
|
}), f = e.defineComponent({
|
539
548
|
name: i.value.name,
|
540
549
|
props: {
|
541
|
-
...
|
550
|
+
...kt(i.value.props ?? [], l)
|
542
551
|
},
|
543
|
-
setup(
|
544
|
-
l.$props =
|
552
|
+
setup(u) {
|
553
|
+
l.$props = u, l.props = u, i.value.id && we(
|
545
554
|
n.window || window,
|
546
555
|
i.value.id,
|
547
556
|
i.value.css || ""
|
548
|
-
), l.state =
|
549
|
-
const
|
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(
|
550
559
|
i.value.dataSources || {},
|
551
560
|
l
|
552
561
|
), w = {
|
553
|
-
...p,
|
554
|
-
...u,
|
555
562
|
...m,
|
556
|
-
...
|
563
|
+
...p,
|
564
|
+
...h,
|
565
|
+
...d
|
557
566
|
};
|
558
|
-
return l.setup(w, e),
|
567
|
+
return l.setup(w, e), Dt(e, i.value.watch ?? [], l), {
|
559
568
|
vtj: l
|
560
569
|
};
|
561
570
|
},
|
562
|
-
emits:
|
571
|
+
emits: xt(i.value.emits),
|
563
572
|
expose: ["vtj"],
|
564
573
|
render() {
|
565
574
|
if (!i.value.nodes) return null;
|
566
|
-
const
|
567
|
-
return
|
575
|
+
const u = i.value.nodes || [];
|
576
|
+
return u.length === 1 ? H(u[0], l, e, a) : u.map((p) => H(p, l, e, a));
|
568
577
|
},
|
569
|
-
...
|
578
|
+
...Mt(i.value.lifeCycles ?? {}, l)
|
570
579
|
});
|
571
580
|
return {
|
572
581
|
renderer: e.markRaw(f),
|
573
582
|
context: l
|
574
583
|
};
|
575
584
|
}
|
576
|
-
function
|
585
|
+
function xt(n = []) {
|
577
586
|
return n.map((e) => j(e) ? e : e.name);
|
578
587
|
}
|
579
|
-
function
|
580
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) =>
|
588
|
+
function kt(n = [], e) {
|
589
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ot[o]) : void 0;
|
581
590
|
return n.map((s) => j(s) ? {
|
582
591
|
name: s
|
583
592
|
} : {
|
584
593
|
name: s.name,
|
585
594
|
type: s.type,
|
586
595
|
required: s.required,
|
587
|
-
default:
|
596
|
+
default: _(s.default) ? e.__parseExpression(s.default) : s.default
|
588
597
|
}).reduce(
|
589
598
|
(s, r) => (s[r.name] = {
|
590
599
|
type: t(r.type),
|
@@ -594,44 +603,44 @@ function wt(n = [], e) {
|
|
594
603
|
{}
|
595
604
|
);
|
596
605
|
}
|
597
|
-
function
|
606
|
+
function Ct(n, e, t) {
|
598
607
|
return n.reactive(
|
599
608
|
Object.keys(e || {}).reduce(
|
600
609
|
(s, r) => {
|
601
610
|
let o = e[r];
|
602
|
-
return
|
611
|
+
return _(o) ? o = t.__parseExpression(o) : U(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
603
612
|
},
|
604
613
|
{}
|
605
614
|
)
|
606
615
|
);
|
607
616
|
}
|
608
|
-
function
|
617
|
+
function Ft(n, e, t) {
|
609
618
|
return Object.entries(e ?? {}).reduce(
|
610
619
|
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
611
620
|
{}
|
612
621
|
);
|
613
622
|
}
|
614
|
-
function
|
623
|
+
function At(n, e) {
|
615
624
|
return Object.entries(n ?? {}).reduce(
|
616
625
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
617
626
|
{}
|
618
627
|
);
|
619
628
|
}
|
620
|
-
function
|
629
|
+
function Tt(n, e = [], t) {
|
621
630
|
return e.reduce(
|
622
631
|
(s, r) => {
|
623
632
|
const { name: o, from: a } = r || {};
|
624
633
|
r.default;
|
625
|
-
const i =
|
634
|
+
const i = _(a) ? t.__parseExpression(a) || o : a ?? o, c = _(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
626
635
|
return s[o] = n.inject(i, c), s;
|
627
636
|
},
|
628
637
|
{}
|
629
638
|
);
|
630
639
|
}
|
631
|
-
function
|
640
|
+
function It(n, e) {
|
632
641
|
return Object.keys(n).reduce(
|
633
642
|
(t, s) => {
|
634
|
-
const r = n[s], o = e.$apis[r.ref], a =
|
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;
|
635
644
|
return t[s] = async (...i) => {
|
636
645
|
const c = await o.apply(e, i);
|
637
646
|
return a ? a(c) : c;
|
@@ -640,7 +649,7 @@ function Et(n, e) {
|
|
640
649
|
{}
|
641
650
|
);
|
642
651
|
}
|
643
|
-
function
|
652
|
+
function Dt(n, e = [], t) {
|
644
653
|
e.forEach((s) => {
|
645
654
|
n.watch(
|
646
655
|
t.__parseExpression(s.source),
|
@@ -652,111 +661,127 @@ function Pt(n, e = [], t) {
|
|
652
661
|
);
|
653
662
|
});
|
654
663
|
}
|
655
|
-
function
|
664
|
+
function Mt(n, e) {
|
656
665
|
return Object.entries(n ?? {}).reduce(
|
657
666
|
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
658
667
|
{}
|
659
668
|
);
|
660
669
|
}
|
661
|
-
let
|
662
|
-
const
|
663
|
-
async function
|
664
|
-
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));
|
665
674
|
if (r.length === 0 || !s) return null;
|
666
|
-
const o = t.filter((i) =>
|
667
|
-
return o.length &&
|
675
|
+
const o = t.filter((i) => Z(i));
|
676
|
+
return o.length && ft(o, e), await ht(r, s, e).catch(
|
668
677
|
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
669
678
|
);
|
670
679
|
}
|
671
|
-
function
|
680
|
+
function Y(n) {
|
672
681
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
673
|
-
return s.window && (
|
682
|
+
return s.window && (z.forEach((r) => {
|
674
683
|
delete s.window[r];
|
675
|
-
}),
|
684
|
+
}), z = []), (r, o, a = B) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
676
685
|
const i = await e(o.id);
|
677
|
-
return i && (i.name = r), i ?
|
686
|
+
return i && (i.name = r), i ? G({
|
678
687
|
...s,
|
679
688
|
Vue: a,
|
680
689
|
dsl: i,
|
681
|
-
mode:
|
682
|
-
loader:
|
690
|
+
mode: y.Runtime,
|
691
|
+
loader: Y(n)
|
683
692
|
}).renderer : null;
|
684
693
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
685
694
|
const i = await t(o.url);
|
686
|
-
return i && (i.name = r), i ?
|
695
|
+
return i && (i.name = r), i ? G({
|
687
696
|
...s,
|
688
697
|
Vue: a,
|
689
698
|
dsl: i,
|
690
|
-
mode:
|
691
|
-
loader:
|
699
|
+
mode: y.Runtime,
|
700
|
+
loader: Y(n)
|
692
701
|
}).renderer : null;
|
693
|
-
}) : o.type === "Plugin" ? (o.library &&
|
694
|
-
const i = await
|
702
|
+
}) : o.type === "Plugin" ? (o.library && z.push(o.library), a.defineAsyncComponent(async () => {
|
703
|
+
const i = await je(o, s.window);
|
695
704
|
return i || (console.warn("getPlugin result is null", o), null);
|
696
705
|
})) : r;
|
697
706
|
}
|
698
|
-
function
|
707
|
+
function H(n, e, t = B, s = Ot) {
|
699
708
|
if (!n || !n.name || n.invisible) return null;
|
700
|
-
const { id:
|
701
|
-
if (
|
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))
|
702
711
|
return null;
|
703
|
-
const
|
704
|
-
const
|
712
|
+
const m = (d) => {
|
713
|
+
const w = d.$components, g = (() => {
|
705
714
|
if (n.name === "component")
|
706
|
-
return
|
715
|
+
return Ut(d, n.props?.is);
|
707
716
|
if (n.name === "slot") return n.name;
|
708
|
-
const
|
709
|
-
return j(
|
710
|
-
})(),
|
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);
|
711
720
|
if (n.name === "slot")
|
712
|
-
return
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
)),
|
717
|
-
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));
|
718
727
|
});
|
719
|
-
const
|
728
|
+
const Fe = Gt(
|
720
729
|
t,
|
721
730
|
n.children ?? [],
|
722
|
-
|
731
|
+
d,
|
723
732
|
s,
|
724
733
|
n
|
725
734
|
);
|
726
|
-
|
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;
|
727
738
|
};
|
728
|
-
return
|
729
|
-
}
|
730
|
-
function
|
731
|
-
const
|
732
|
-
|
739
|
+
return c ? Xt(c, m, e) : m(e);
|
740
|
+
}
|
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))
|
733
757
|
);
|
734
758
|
return {
|
735
759
|
vIf: e,
|
736
760
|
vFor: t,
|
737
761
|
vShow: s,
|
738
|
-
vModels:
|
762
|
+
vModels: a,
|
739
763
|
vBind: r,
|
740
|
-
others:
|
764
|
+
others: i,
|
765
|
+
vHtml: o
|
741
766
|
};
|
742
767
|
}
|
743
|
-
function
|
768
|
+
function Nt(n, e) {
|
744
769
|
return !!e.__parseExpression(n.value);
|
745
770
|
}
|
746
|
-
function
|
747
|
-
return e ?
|
771
|
+
function Ut(n, e) {
|
772
|
+
return e ? _(e) ? n.__parseExpression(e) : e : "div";
|
748
773
|
}
|
749
|
-
function
|
774
|
+
function Lt(n, e, t) {
|
750
775
|
const s = Object.keys(e || {}).reduce(
|
751
776
|
(r, o) => {
|
752
777
|
let a = e[o];
|
753
|
-
return
|
778
|
+
return _(a) ? a = t.__parseExpression(a) : U(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
754
779
|
},
|
755
780
|
{}
|
756
781
|
);
|
757
782
|
return s.ref = t.__ref(n, s.ref), s;
|
758
783
|
}
|
759
|
-
function
|
784
|
+
function qt(n, e, t) {
|
760
785
|
const s = ["passive", "capture", "once"], r = {
|
761
786
|
capture: "Capture",
|
762
787
|
once: "Once",
|
@@ -764,70 +789,77 @@ function It(n, e, t) {
|
|
764
789
|
};
|
765
790
|
return Object.keys(e || {}).reduce(
|
766
791
|
(o, a) => {
|
767
|
-
const i = e[a], c =
|
768
|
-
return
|
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;
|
769
794
|
},
|
770
795
|
{}
|
771
796
|
);
|
772
797
|
}
|
773
|
-
function
|
798
|
+
function $e(n = {}, e = !1) {
|
774
799
|
const t = Object.keys(n);
|
775
800
|
return e ? t.map((s) => "." + s) : t;
|
776
801
|
}
|
777
|
-
function
|
778
|
-
const { children: o } = e, a =
|
779
|
-
return i ? i(t) : o ? j(o) ? n.createTextVNode(o) :
|
780
|
-
|
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))
|
781
806
|
) : Array.isArray(o) ? o.map(
|
782
|
-
(c) =>
|
807
|
+
(c) => H(c, s, n, r)
|
783
808
|
) : null : null;
|
784
809
|
}
|
785
|
-
function
|
810
|
+
function Vt(n, e) {
|
786
811
|
const { props: t } = n, s = t?.name || "default";
|
787
812
|
return {
|
788
|
-
name:
|
813
|
+
name: _(s) ? e.__parseExpression(s) : s,
|
789
814
|
params: []
|
790
815
|
};
|
791
816
|
}
|
792
|
-
function
|
817
|
+
function zt(n, e) {
|
793
818
|
return e.__parseExpression(n.value) ? {} : {
|
794
819
|
display: "none"
|
795
820
|
};
|
796
821
|
}
|
797
|
-
function
|
822
|
+
function Kt(n, e) {
|
823
|
+
return {
|
824
|
+
innerHTML: e.__parseExpression(n.value) || ""
|
825
|
+
};
|
826
|
+
}
|
827
|
+
function Wt(n, e, t) {
|
798
828
|
const s = {
|
799
829
|
type: "JSFunction",
|
800
830
|
value: e.value?.value ? `(v) => {
|
801
831
|
${e.value.value} = v;
|
802
832
|
}` : "(v) => {}"
|
803
|
-
}, 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";
|
804
836
|
return {
|
805
837
|
[a]: t.__parseExpression(e.value),
|
806
838
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
807
839
|
};
|
808
840
|
}
|
809
|
-
function
|
841
|
+
function Gt(n, e, t, s, r) {
|
810
842
|
if (!e) return null;
|
811
843
|
if (j(e))
|
812
844
|
return { default: () => e };
|
813
|
-
if (
|
845
|
+
if (_(e))
|
814
846
|
return {
|
815
|
-
default: () =>
|
847
|
+
default: () => _e(t.__parseExpression(e))
|
816
848
|
};
|
817
849
|
if (Array.isArray(e) && e.length > 0) {
|
818
|
-
const o =
|
850
|
+
const o = Yt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
819
851
|
[`scope_${r.id}`]: i
|
820
852
|
} : {};
|
821
|
-
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (
|
822
|
-
const
|
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);
|
823
855
|
return l.map(
|
824
|
-
(
|
856
|
+
(h) => H(h, t.__clone(p), n, s)
|
825
857
|
);
|
826
858
|
}, i), {});
|
827
859
|
}
|
828
860
|
return null;
|
829
861
|
}
|
830
|
-
function
|
862
|
+
function Yt(n) {
|
831
863
|
const e = {
|
832
864
|
default: {
|
833
865
|
params: [],
|
@@ -835,7 +867,7 @@ function Bt(n) {
|
|
835
867
|
}
|
836
868
|
};
|
837
869
|
for (const t of n) {
|
838
|
-
const s =
|
870
|
+
const s = Qt(t.slot), r = s.name;
|
839
871
|
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
840
872
|
nodes: [t],
|
841
873
|
params: s.params
|
@@ -843,143 +875,149 @@ function Bt(n) {
|
|
843
875
|
}
|
844
876
|
return e;
|
845
877
|
}
|
846
|
-
function
|
878
|
+
function Qt(n = "default") {
|
847
879
|
return j(n) ? { name: n, params: [] } : { params: [], ...n };
|
848
880
|
}
|
849
|
-
function
|
881
|
+
function Xt(n, e, t) {
|
850
882
|
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
851
883
|
let i = t.__parseExpression(s) || [];
|
852
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`), []);
|
853
885
|
}
|
854
|
-
function
|
855
|
-
return
|
886
|
+
function Zt(n) {
|
887
|
+
return Ye() ? (Qe(n), !0) : !1;
|
856
888
|
}
|
857
|
-
function
|
858
|
-
return typeof n == "function" ? n() :
|
889
|
+
function te(n) {
|
890
|
+
return typeof n == "function" ? n() : Xe(n);
|
859
891
|
}
|
860
|
-
const
|
892
|
+
const Ee = typeof window < "u" && typeof document < "u";
|
861
893
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
862
|
-
const
|
894
|
+
const es = (n) => n != null, ts = () => {
|
863
895
|
};
|
864
|
-
function
|
865
|
-
return
|
896
|
+
function ss(n) {
|
897
|
+
return me();
|
866
898
|
}
|
867
|
-
function
|
899
|
+
function ns(...n) {
|
868
900
|
if (n.length !== 1)
|
869
|
-
return
|
901
|
+
return ze(...n);
|
870
902
|
const e = n[0];
|
871
|
-
return typeof e == "function" ?
|
903
|
+
return typeof e == "function" ? Ke(We(() => ({ get: e, set: ts }))) : F(e);
|
872
904
|
}
|
873
|
-
function
|
874
|
-
|
905
|
+
function rs(n, e) {
|
906
|
+
ss() && Ge(n, e);
|
875
907
|
}
|
876
|
-
const
|
877
|
-
function
|
908
|
+
const os = Ee ? window : void 0, is = Ee ? window.document : void 0;
|
909
|
+
function as(n) {
|
878
910
|
var e;
|
879
|
-
const t =
|
911
|
+
const t = te(n);
|
880
912
|
return (e = t?.$el) != null ? e : t;
|
881
913
|
}
|
882
|
-
function
|
883
|
-
const n =
|
884
|
-
return e &&
|
914
|
+
function cs() {
|
915
|
+
const n = F(!1), e = me();
|
916
|
+
return e && Ze(() => {
|
885
917
|
n.value = !0;
|
886
918
|
}, e), n;
|
887
919
|
}
|
888
|
-
function
|
889
|
-
const e =
|
890
|
-
return
|
920
|
+
function ls(n) {
|
921
|
+
const e = cs();
|
922
|
+
return ve(() => (e.value, !!n()));
|
891
923
|
}
|
892
|
-
function
|
893
|
-
const { window: s =
|
924
|
+
function us(n, e, t = {}) {
|
925
|
+
const { window: s = os, ...r } = t;
|
894
926
|
let o;
|
895
|
-
const a =
|
927
|
+
const a = ls(() => s && "MutationObserver" in s), i = () => {
|
896
928
|
o && (o.disconnect(), o = void 0);
|
897
|
-
}, c =
|
898
|
-
const
|
899
|
-
return new Set(
|
900
|
-
}), l =
|
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(
|
901
933
|
() => c.value,
|
902
|
-
(
|
903
|
-
i(), a.value &&
|
934
|
+
(p) => {
|
935
|
+
i(), a.value && p.size && (o = new MutationObserver(e), p.forEach((h) => o.observe(h, r)));
|
904
936
|
},
|
905
937
|
{ immediate: !0, flush: "post" }
|
906
|
-
), f = () => o?.takeRecords(),
|
938
|
+
), f = () => o?.takeRecords(), u = () => {
|
907
939
|
l(), i();
|
908
940
|
};
|
909
|
-
return
|
941
|
+
return Zt(u), {
|
910
942
|
isSupported: a,
|
911
|
-
stop:
|
943
|
+
stop: u,
|
912
944
|
takeRecords: f
|
913
945
|
};
|
914
946
|
}
|
915
|
-
function
|
947
|
+
function ps(n = null, e = {}) {
|
916
948
|
var t, s, r;
|
917
949
|
const {
|
918
|
-
document: o =
|
919
|
-
restoreOnUnmount: a = (
|
920
|
-
} = e, i = (t = o?.title) != null ? t : "", c =
|
921
|
-
function f(
|
950
|
+
document: o = is,
|
951
|
+
restoreOnUnmount: a = (u) => u
|
952
|
+
} = e, i = (t = o?.title) != null ? t : "", c = ns((s = n ?? o?.title) != null ? s : null), l = n && typeof n == "function";
|
953
|
+
function f(u) {
|
922
954
|
if (!("titleTemplate" in e))
|
923
|
-
return
|
924
|
-
const
|
925
|
-
return typeof
|
955
|
+
return u;
|
956
|
+
const p = e.titleTemplate || "%s";
|
957
|
+
return typeof p == "function" ? p(u) : te(p).replace(/%s/g, u);
|
926
958
|
}
|
927
|
-
return
|
959
|
+
return ge(
|
928
960
|
c,
|
929
|
-
(
|
930
|
-
|
961
|
+
(u, p) => {
|
962
|
+
u !== p && o && (o.title = f(typeof u == "string" ? u : ""));
|
931
963
|
},
|
932
964
|
{ immediate: !0 }
|
933
|
-
), e.observe && !e.titleTemplate && o && !l &&
|
965
|
+
), e.observe && !e.titleTemplate && o && !l && us(
|
934
966
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
935
967
|
() => {
|
936
968
|
o && o.title !== c.value && (c.value = f(o.title));
|
937
969
|
},
|
938
970
|
{ childList: !0 }
|
939
|
-
),
|
971
|
+
), rs(() => {
|
940
972
|
if (a) {
|
941
|
-
const
|
942
|
-
|
973
|
+
const u = a(i, c.value || "");
|
974
|
+
u != null && o && (o.title = u);
|
943
975
|
}
|
944
976
|
}), c;
|
945
977
|
}
|
946
|
-
const
|
978
|
+
const pe = X({
|
947
979
|
name: "VtjPageContainer",
|
948
980
|
async setup() {
|
949
|
-
const n =
|
950
|
-
return s && (Object.assign(e.meta, s.meta || {}),
|
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")), {
|
951
983
|
provider: n,
|
952
984
|
component: r,
|
953
985
|
file: s,
|
954
986
|
query: e.query,
|
955
|
-
meta:
|
987
|
+
meta: e.meta,
|
988
|
+
sid: o,
|
989
|
+
route: e
|
956
990
|
};
|
957
991
|
},
|
958
992
|
render() {
|
959
|
-
const { component: n, query: e } = this;
|
960
|
-
return n ?
|
993
|
+
const { component: n, query: e, sid: t } = this;
|
994
|
+
return n ? W(n, { ...e, key: t }) : W("div", "页面不存在");
|
995
|
+
},
|
996
|
+
activated() {
|
997
|
+
this.meta.cache === !1 && (this.sid = Symbol());
|
961
998
|
}
|
962
|
-
}),
|
999
|
+
}), ds = {
|
963
1000
|
"data-l-h6o7ki7": "",
|
964
1001
|
class: "vtj-startup__wrapper"
|
965
|
-
},
|
1002
|
+
}, fs = {
|
966
1003
|
"data-l-h6o7ki7": "",
|
967
1004
|
class: "vtj-startup"
|
968
|
-
},
|
1005
|
+
}, hs = {
|
969
1006
|
"data-l-h6o7ki7": "",
|
970
1007
|
class: "vtj-startup__name"
|
971
|
-
},
|
1008
|
+
}, ms = { "data-l-h6o7ki7": "" }, gs = {
|
972
1009
|
"data-l-h6o7ki7": "",
|
973
1010
|
class: "vtj-startup__tagline"
|
974
|
-
},
|
1011
|
+
}, vs = {
|
975
1012
|
"data-l-h6o7ki7": "",
|
976
1013
|
class: "vtj-startup__actions"
|
977
|
-
},
|
1014
|
+
}, ys = /* @__PURE__ */ X({
|
978
1015
|
__name: "Startup",
|
979
1016
|
props: {
|
980
1017
|
name: { default: "VTJ.PRO" },
|
981
1018
|
tagline: { default: "基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台" },
|
982
|
-
actionText: { default: "开始设计" }
|
1019
|
+
actionText: { default: "开始设计" },
|
1020
|
+
link: {}
|
983
1021
|
},
|
984
1022
|
setup(n) {
|
985
1023
|
((r, o) => {
|
@@ -1053,38 +1091,42 @@ const ae = K({
|
|
1053
1091
|
}`);
|
1054
1092
|
const t = n, s = () => {
|
1055
1093
|
if (typeof window < "u") {
|
1094
|
+
if (t.link) {
|
1095
|
+
typeof t.link == "function" ? t.link() : window.location.href = t.link;
|
1096
|
+
return;
|
1097
|
+
}
|
1056
1098
|
let o = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "__vtj__/#/";
|
1057
1099
|
window.location.href = o;
|
1058
1100
|
}
|
1059
1101
|
};
|
1060
|
-
return (r, o) => (
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1102
|
+
return (r, o) => (et(), tt("div", ds, [
|
1103
|
+
E("div", fs, [
|
1104
|
+
E("h1", hs, [
|
1105
|
+
E("span", ms, V(t.name), 1)
|
1064
1106
|
]),
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1107
|
+
E("div", gs, V(t.tagline), 1),
|
1108
|
+
E("div", vs, [
|
1109
|
+
E("button", {
|
1068
1110
|
"data-l-h6o7ki7": "",
|
1069
1111
|
onClick: s
|
1070
|
-
},
|
1112
|
+
}, V(t.actionText), 1)
|
1071
1113
|
])
|
1072
1114
|
])
|
1073
1115
|
]));
|
1074
1116
|
}
|
1075
|
-
}),
|
1117
|
+
}), _s = X({
|
1076
1118
|
name: "VtjStartupContainer",
|
1077
1119
|
render() {
|
1078
|
-
return
|
1120
|
+
return W(ys);
|
1079
1121
|
}
|
1080
|
-
}),
|
1081
|
-
var
|
1082
|
-
class
|
1122
|
+
}), Re = Symbol("Provider");
|
1123
|
+
var ws = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ws || {});
|
1124
|
+
class Ss extends Ae {
|
1083
1125
|
constructor(e) {
|
1084
1126
|
super(), this.options = e;
|
1085
1127
|
const {
|
1086
1128
|
service: t,
|
1087
|
-
mode: s =
|
1129
|
+
mode: s = y.Raw,
|
1088
1130
|
dependencies: r,
|
1089
1131
|
materials: o,
|
1090
1132
|
project: a = {},
|
@@ -1092,18 +1134,18 @@ class us extends xe {
|
|
1092
1134
|
globals: c = {},
|
1093
1135
|
modules: l = {},
|
1094
1136
|
router: f = null,
|
1095
|
-
materialPath:
|
1096
|
-
nodeEnv:
|
1137
|
+
materialPath: u = "./",
|
1138
|
+
nodeEnv: p = "development"
|
1097
1139
|
/* Development */
|
1098
1140
|
} = e;
|
1099
|
-
this.mode = s, this.modules = l, this.service = t, this.router = f, this.materialPath =
|
1100
|
-
const { access:
|
1101
|
-
|
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;
|
1102
1144
|
}
|
1103
1145
|
mode;
|
1104
1146
|
globals = {};
|
1105
1147
|
modules = {};
|
1106
|
-
adapter = { request:
|
1148
|
+
adapter = { request: _t, jsonp: qe };
|
1107
1149
|
apis = {};
|
1108
1150
|
dependencies = {};
|
1109
1151
|
materials = {};
|
@@ -1120,76 +1162,78 @@ class us extends xe {
|
|
1120
1162
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1121
1163
|
throw new Error("project is null");
|
1122
1164
|
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
1123
|
-
o.CKEDITOR_VERSION = void 0, this.
|
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();
|
1124
1166
|
}
|
1125
1167
|
async loadDependencies(e) {
|
1126
1168
|
const t = Object.entries(this.dependencies);
|
1127
1169
|
for (const [s, r] of t)
|
1128
|
-
e[s] || (e[s] = await r());
|
1170
|
+
e[s] || (e[s] = this.library[s] = await r());
|
1129
1171
|
}
|
1130
1172
|
async loadAssets(e) {
|
1131
1173
|
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1132
1174
|
libraryExports: c,
|
1133
1175
|
libraryMap: l,
|
1134
1176
|
materials: f,
|
1135
|
-
materialExports:
|
1136
|
-
materialMapLibrary:
|
1137
|
-
} =
|
1177
|
+
materialExports: u,
|
1178
|
+
materialMapLibrary: p
|
1179
|
+
} = ut(
|
1138
1180
|
t,
|
1139
1181
|
a,
|
1140
1182
|
i === "development"
|
1141
1183
|
/* Development */
|
1142
1184
|
);
|
1143
|
-
for (const
|
1144
|
-
const
|
1145
|
-
if (
|
1146
|
-
r[
|
1147
|
-
else if (
|
1148
|
-
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();
|
1149
1191
|
else {
|
1150
|
-
const
|
1151
|
-
for (const
|
1152
|
-
|
1153
|
-
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];
|
1154
1196
|
}
|
1155
1197
|
}
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
const
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1198
|
+
if (i === "development") {
|
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];
|
1207
|
+
});
|
1208
|
+
else {
|
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);
|
1212
|
+
});
|
1213
|
+
}
|
1170
1214
|
}
|
1171
1215
|
}
|
1172
1216
|
}
|
1173
1217
|
initRouter() {
|
1174
|
-
const { router: e, project: t, options: s } = this;
|
1218
|
+
const { router: e, project: t, options: s, adapter: r } = this;
|
1175
1219
|
if (!e) return;
|
1176
|
-
const {
|
1177
|
-
path:
|
1178
|
-
name:
|
1179
|
-
component:
|
1180
|
-
},
|
1181
|
-
path:
|
1182
|
-
name:
|
1183
|
-
component: t?.homepage ?
|
1184
|
-
meta:
|
1220
|
+
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = s, c = o ? "" : "/", l = {
|
1221
|
+
path: `${c}${a}/:id`,
|
1222
|
+
name: C,
|
1223
|
+
component: pe
|
1224
|
+
}, f = {
|
1225
|
+
path: c,
|
1226
|
+
name: D,
|
1227
|
+
component: t?.homepage ? pe : r.startupComponent || _s,
|
1228
|
+
meta: i
|
1185
1229
|
};
|
1186
|
-
|
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));
|
1187
1231
|
}
|
1188
1232
|
install(e) {
|
1189
1233
|
const t = e.config.globalProperties.installed || {};
|
1190
1234
|
for (const [s, r] of Object.entries(this.library))
|
1191
|
-
!t[s] &&
|
1192
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
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) => {
|
1193
1237
|
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1194
1238
|
console.error(
|
1195
1239
|
"[VTJ Error]:",
|
@@ -1199,7 +1243,7 @@ class us extends xe {
|
|
1199
1243
|
info: o
|
1200
1244
|
},
|
1201
1245
|
s?.stack
|
1202
|
-
),
|
1246
|
+
), N.error({
|
1203
1247
|
title: "未处理的异常:请在控制台查看详情",
|
1204
1248
|
message: c
|
1205
1249
|
});
|
@@ -1229,7 +1273,7 @@ class us extends xe {
|
|
1229
1273
|
}
|
1230
1274
|
async getDsl(e) {
|
1231
1275
|
const t = this.modules[`.vtj/files/${e}.json`];
|
1232
|
-
return t ? await t() : this.service.getFile(e).catch(() => null);
|
1276
|
+
return t ? await t() : this.service.getFile(e, this.project || void 0).catch(() => null);
|
1233
1277
|
}
|
1234
1278
|
async getDslByUrl(e) {
|
1235
1279
|
const t = this.urlDslCaches[e];
|
@@ -1251,12 +1295,12 @@ class us extends xe {
|
|
1251
1295
|
apis: a,
|
1252
1296
|
window,
|
1253
1297
|
...t
|
1254
|
-
}, c =
|
1298
|
+
}, c = Y({
|
1255
1299
|
getDsl: async (l) => await this.getDsl(l) || null,
|
1256
1300
|
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1257
1301
|
options: i
|
1258
1302
|
});
|
1259
|
-
return
|
1303
|
+
return G({
|
1260
1304
|
...i,
|
1261
1305
|
dsl: e,
|
1262
1306
|
loader: c
|
@@ -1265,40 +1309,40 @@ class us extends xe {
|
|
1265
1309
|
async getRenderComponent(e, t) {
|
1266
1310
|
const s = this.getFile(e);
|
1267
1311
|
if (!s)
|
1268
|
-
return
|
1312
|
+
return O.warn(`Can not find file: ${e}`), null;
|
1269
1313
|
t && t(s);
|
1270
1314
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1271
1315
|
if (o)
|
1272
1316
|
return (await o())?.default;
|
1273
1317
|
const a = await this.getDsl(s.id);
|
1274
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1318
|
+
return a ? this.createDslRenderer(a).renderer : (O.warn(`Can not find dsl: ${e}`), null);
|
1275
1319
|
}
|
1276
1320
|
defineUrlSchemaComponent(e, t) {
|
1277
|
-
return
|
1321
|
+
return ce(async () => {
|
1278
1322
|
const s = await this.getDslByUrl(e);
|
1279
1323
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1280
1324
|
});
|
1281
1325
|
}
|
1282
1326
|
definePluginComponent(e) {
|
1283
|
-
return
|
1327
|
+
return ce(async () => await je(e, window));
|
1284
1328
|
}
|
1285
1329
|
}
|
1286
|
-
function
|
1287
|
-
const e = new
|
1330
|
+
function Ds(n) {
|
1331
|
+
const e = new Ss(n);
|
1288
1332
|
return {
|
1289
1333
|
provider: e,
|
1290
1334
|
onReady: (s) => e.ready(s)
|
1291
1335
|
};
|
1292
1336
|
}
|
1293
|
-
function
|
1294
|
-
const e =
|
1337
|
+
function Pe(n = {}) {
|
1338
|
+
const e = he(Re);
|
1295
1339
|
if (!e)
|
1296
1340
|
throw new Error("Can not find provider");
|
1297
1341
|
if (e.nodeEnv === "development") {
|
1298
1342
|
const { id: t, version: s } = n;
|
1299
1343
|
t && s && (async () => {
|
1300
1344
|
const r = await e.getDsl(t);
|
1301
|
-
r?.__VERSION__ !== s &&
|
1345
|
+
r?.__VERSION__ !== s && N.warning({
|
1302
1346
|
title: r?.name,
|
1303
1347
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
1304
1348
|
});
|
@@ -1306,7 +1350,7 @@ function be(n = {}) {
|
|
1306
1350
|
}
|
1307
1351
|
return e;
|
1308
1352
|
}
|
1309
|
-
const
|
1353
|
+
const se = new Je({
|
1310
1354
|
settings: {
|
1311
1355
|
type: "json",
|
1312
1356
|
validSuccess: !0,
|
@@ -1314,12 +1358,12 @@ const X = new Be({
|
|
1314
1358
|
failMessage: !0,
|
1315
1359
|
validate: (n) => n.data?.code === 0,
|
1316
1360
|
showError: (n) => {
|
1317
|
-
|
1361
|
+
N.error({
|
1318
1362
|
message: n || "未知错误"
|
1319
1363
|
});
|
1320
1364
|
}
|
1321
1365
|
}
|
1322
|
-
}),
|
1366
|
+
}), bs = (n = "/__vtj__/api/:type.json") => (e, t) => se.send({
|
1323
1367
|
url: n,
|
1324
1368
|
method: "post",
|
1325
1369
|
params: { type: e },
|
@@ -1327,7 +1371,7 @@ const X = new Be({
|
|
1327
1371
|
type: e,
|
1328
1372
|
data: t
|
1329
1373
|
}
|
1330
|
-
}),
|
1374
|
+
}), js = (n = "/__vtj__/api/uploader.json") => async (e, t) => await se.send({
|
1331
1375
|
url: n,
|
1332
1376
|
method: "post",
|
1333
1377
|
data: {
|
@@ -1338,12 +1382,12 @@ const X = new Be({
|
|
1338
1382
|
type: "data"
|
1339
1383
|
}
|
1340
1384
|
}).then((s) => s && s[0] ? s[0] : null).catch(() => null);
|
1341
|
-
class
|
1385
|
+
class ne {
|
1342
1386
|
api;
|
1343
1387
|
pluginCaches = {};
|
1344
1388
|
uploader;
|
1345
1389
|
constructor() {
|
1346
|
-
this.api =
|
1390
|
+
this.api = bs(), this.uploader = js();
|
1347
1391
|
}
|
1348
1392
|
async getExtension() {
|
1349
1393
|
console.log("BaseService.getExtension");
|
@@ -1416,10 +1460,10 @@ class Z {
|
|
1416
1460
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1417
1461
|
}
|
1418
1462
|
async getPluginMaterial(e) {
|
1419
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
1463
|
+
const { urls: t = [] } = e, s = t.filter((o) => ct(o))[0];
|
1420
1464
|
if (!s) return null;
|
1421
1465
|
const r = this.pluginCaches[s];
|
1422
|
-
return r || (this.pluginCaches[s] =
|
1466
|
+
return r || (this.pluginCaches[s] = se.send({
|
1423
1467
|
url: s,
|
1424
1468
|
method: "get",
|
1425
1469
|
settings: {
|
@@ -1428,78 +1472,81 @@ class Z {
|
|
1428
1472
|
}
|
1429
1473
|
}).then((o) => o.data).catch(() => null));
|
1430
1474
|
}
|
1475
|
+
async genSource(e) {
|
1476
|
+
return console.log("BaseService.genSource", e), "";
|
1477
|
+
}
|
1431
1478
|
}
|
1432
|
-
const
|
1479
|
+
const v = new Ve({
|
1433
1480
|
type: "local",
|
1434
1481
|
expired: 0,
|
1435
1482
|
prefix: "__VTJ_"
|
1436
1483
|
});
|
1437
|
-
class
|
1484
|
+
class Ms extends ne {
|
1438
1485
|
init(e) {
|
1439
|
-
const t = new
|
1440
|
-
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);
|
1441
1488
|
}
|
1442
1489
|
saveProject(e) {
|
1443
|
-
const t = new
|
1444
|
-
return
|
1490
|
+
const t = new M(e);
|
1491
|
+
return v.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1445
1492
|
}
|
1446
1493
|
saveMaterials(e, t) {
|
1447
|
-
return
|
1494
|
+
return v.save(`materials_${e.id}`, Q(t)), Promise.resolve(!0);
|
1448
1495
|
}
|
1449
1496
|
saveFile(e) {
|
1450
|
-
return
|
1497
|
+
return v.save(`file_${e.id}`, e), Promise.resolve(!0);
|
1451
1498
|
}
|
1452
1499
|
getFile(e) {
|
1453
|
-
const t =
|
1500
|
+
const t = v.get(`file_${e}`);
|
1454
1501
|
return t ? Promise.resolve(t) : Promise.reject(null);
|
1455
1502
|
}
|
1456
1503
|
removeFile(e) {
|
1457
|
-
return
|
1504
|
+
return v.remove(`file_${e}`), Promise.resolve(!0);
|
1458
1505
|
}
|
1459
1506
|
saveHistory(e) {
|
1460
|
-
return
|
1507
|
+
return v.save(`history_${e.id}`, e), Promise.resolve(!0);
|
1461
1508
|
}
|
1462
1509
|
removeHistory(e) {
|
1463
|
-
const t =
|
1510
|
+
const t = v.get(`history_${e}`);
|
1464
1511
|
if (t) {
|
1465
1512
|
const r = (t.items || []).map((o) => o.id);
|
1466
|
-
this.removeHistoryItem(e, r),
|
1513
|
+
this.removeHistoryItem(e, r), v.remove(`history_${e}`);
|
1467
1514
|
}
|
1468
1515
|
return Promise.resolve(!0);
|
1469
1516
|
}
|
1470
1517
|
getHistory(e) {
|
1471
|
-
const t =
|
1518
|
+
const t = v.get(`history_${e}`), s = new de(t || { id: e });
|
1472
1519
|
return Promise.resolve(s.toDsl());
|
1473
1520
|
}
|
1474
1521
|
getHistoryItem(e, t) {
|
1475
|
-
const s =
|
1522
|
+
const s = v.get(`history_${e}_${t}`);
|
1476
1523
|
return Promise.resolve(s);
|
1477
1524
|
}
|
1478
1525
|
saveHistoryItem(e, t) {
|
1479
|
-
return
|
1526
|
+
return v.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1480
1527
|
}
|
1481
1528
|
removeHistoryItem(e, t) {
|
1482
1529
|
return t.forEach((s) => {
|
1483
|
-
|
1530
|
+
v.remove(`history_${e}_${s}`);
|
1484
1531
|
}), Promise.resolve(!0);
|
1485
1532
|
}
|
1486
1533
|
}
|
1487
|
-
class
|
1534
|
+
class $s extends ne {
|
1488
1535
|
projects = {};
|
1489
1536
|
materials = {};
|
1490
1537
|
files = {};
|
1491
1538
|
histories = {};
|
1492
1539
|
historyItems = {};
|
1493
1540
|
init(e) {
|
1494
|
-
const t = new
|
1541
|
+
const t = new M(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1495
1542
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1496
1543
|
}
|
1497
1544
|
saveProject(e) {
|
1498
|
-
const t = new
|
1545
|
+
const t = new M(e);
|
1499
1546
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1500
1547
|
}
|
1501
1548
|
saveMaterials(e, t) {
|
1502
|
-
return e.id && (this.materials[e.id] =
|
1549
|
+
return e.id && (this.materials[e.id] = Q(t)), Promise.resolve(!0);
|
1503
1550
|
}
|
1504
1551
|
saveFile(e) {
|
1505
1552
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1523,7 +1570,7 @@ class fs extends Z {
|
|
1523
1570
|
return Promise.resolve(!0);
|
1524
1571
|
}
|
1525
1572
|
getHistory(e) {
|
1526
|
-
const t = this.histories[e], s = new
|
1573
|
+
const t = this.histories[e], s = new de(t || { id: e });
|
1527
1574
|
return Promise.resolve(s);
|
1528
1575
|
}
|
1529
1576
|
getHistoryItem(e, t) {
|
@@ -1541,11 +1588,11 @@ class fs extends Z {
|
|
1541
1588
|
}), Promise.resolve(!0);
|
1542
1589
|
}
|
1543
1590
|
}
|
1544
|
-
let
|
1545
|
-
function
|
1546
|
-
return
|
1591
|
+
let I = null;
|
1592
|
+
function Os() {
|
1593
|
+
return I || (I = new $s(), I);
|
1547
1594
|
}
|
1548
|
-
class
|
1595
|
+
class Hs extends ne {
|
1549
1596
|
getFileCaches = {};
|
1550
1597
|
async getExtension() {
|
1551
1598
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1560,7 +1607,7 @@ class xs extends Z {
|
|
1560
1607
|
async saveMaterials(e, t) {
|
1561
1608
|
return !!await this.api("saveMaterials", {
|
1562
1609
|
project: e,
|
1563
|
-
materials:
|
1610
|
+
materials: Q(t)
|
1564
1611
|
}).catch(() => !1);
|
1565
1612
|
}
|
1566
1613
|
async saveFile(e) {
|
@@ -1600,110 +1647,122 @@ class xs extends Z {
|
|
1600
1647
|
);
|
1601
1648
|
}
|
1602
1649
|
}
|
1603
|
-
function
|
1604
|
-
return
|
1605
|
-
const { id:
|
1650
|
+
function xe(n, e, t = []) {
|
1651
|
+
return t.map((s) => {
|
1652
|
+
const { id: r, title: o, icon: a, children: i, hidden: c } = s;
|
1606
1653
|
return {
|
1607
|
-
id:
|
1608
|
-
title:
|
1609
|
-
icon:
|
1610
|
-
hidden:
|
1611
|
-
url:
|
1612
|
-
children:
|
1654
|
+
id: r,
|
1655
|
+
title: o,
|
1656
|
+
icon: a,
|
1657
|
+
hidden: c,
|
1658
|
+
url: `${n}/${e}/${r}`,
|
1659
|
+
children: i && i.length ? xe(n, e, i) : void 0
|
1613
1660
|
};
|
1614
1661
|
});
|
1615
1662
|
}
|
1616
|
-
function
|
1663
|
+
function ke(n, e) {
|
1617
1664
|
if (!e) return n;
|
1618
1665
|
let t = [];
|
1619
1666
|
for (const s of n)
|
1620
1667
|
if (s.children && s.children.length) {
|
1621
|
-
const r =
|
1668
|
+
const r = ke(s.children, e);
|
1622
1669
|
r.length && (s.children = r, t.push(s));
|
1623
1670
|
} else
|
1624
|
-
e
|
1671
|
+
e.can(s.id.toString()) && t.push(s);
|
1625
1672
|
return t;
|
1626
1673
|
}
|
1627
|
-
function
|
1628
|
-
const
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1674
|
+
function Bs(n) {
|
1675
|
+
const {
|
1676
|
+
menuPathPrefix: e = "",
|
1677
|
+
pageRouteName: t = "page",
|
1678
|
+
disableMenusFilter: s = !1
|
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;
|
1637
1688
|
} else
|
1638
|
-
|
1689
|
+
i.value = !m.mask, c.value = !!m.pure;
|
1639
1690
|
});
|
1640
|
-
const
|
1691
|
+
const f = xe(
|
1692
|
+
e,
|
1693
|
+
t,
|
1694
|
+
l?.pages
|
1695
|
+
), u = l?.config;
|
1641
1696
|
return {
|
1642
|
-
disabled:
|
1643
|
-
logo:
|
1644
|
-
themeSwitchable:
|
1645
|
-
title:
|
1646
|
-
menus:
|
1647
|
-
pure:
|
1697
|
+
disabled: i,
|
1698
|
+
logo: u?.logo,
|
1699
|
+
themeSwitchable: u?.themeSwitchable,
|
1700
|
+
title: u?.title || l?.description || l?.name || "VTJ App",
|
1701
|
+
menus: s ? f : ke(f, a),
|
1702
|
+
pure: c
|
1648
1703
|
};
|
1649
1704
|
}
|
1650
1705
|
export {
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
mt as
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
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,
|
1747
|
+
U as isJSFunction,
|
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,
|
1758
|
+
H as nodeRender,
|
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
|
1709
1768
|
};
|