@vtj/renderer 0.10.1-alpha.1 → 0.10.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +568 -555
- package/package.json +5 -6
- package/types/provider/provider.d.ts +1 -0
- package/types/utils/util.d.ts +1 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as He, url as
|
1
|
+
import { Base as Ie, BUILT_IN_COMPONENTS as De, ProjectModel as O, HistoryModel as pe } from "@vtj/core";
|
2
|
+
import { isUrl as He, url as R, dedupArray as Oe, isString as j, isFunction as V, logger as P, storage as L, cookie as q, toArray as ie, unRSA as ae, delay as fe, createRequest as he, jsonp as me, merge as Be, pathToRegexp as Ne, pathToRegexpMatch as Ue, formDataToJson as Le, camelCase as $, upperFirst as qe, pick as Je, request as K, loadScript as ce, Storage as ze, mapToObject as Z } from "@vtj/utils";
|
3
3
|
import * as N from "vue";
|
4
|
-
import { inject as ge, toRef as Ve, readonly as Ke, ref as
|
5
|
-
import R from "mockjs";
|
4
|
+
import { inject as ge, toRef as Ve, readonly as Ke, ref as M, customRef as We, onBeforeUnmount as Ge, getCurrentScope as Ye, onScopeDispose as Qe, getCurrentInstance as ve, watch as ye, toValue as ee, computed as _e, onMounted as Xe, defineComponent as te, h as W, createElementBlock as Ze, openBlock as et, createElementVNode as k, toDisplayString as J, defineAsyncComponent as le, watchEffect as tt } from "vue";
|
6
5
|
import { useRoute as we } from "vue-router";
|
7
6
|
/**!
|
8
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
9
8
|
* @name @vtj/renderer
|
10
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
11
|
-
* @version 0.10.1-alpha.
|
10
|
+
* @version 0.10.1-alpha.2
|
12
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
13
12
|
*/
|
14
|
-
const
|
15
|
-
var y = /* @__PURE__ */ ((
|
13
|
+
const x = "0.10.1-alpha.2";
|
14
|
+
var y = /* @__PURE__ */ ((s) => (s.Runtime = "Runtime", s.Design = "Design", s.Raw = "Raw", s.VNode = "VNode", s))(y || {});
|
16
15
|
const ue = [
|
17
16
|
"$el",
|
18
17
|
"$emit",
|
@@ -25,7 +24,7 @@ const ue = [
|
|
25
24
|
"$props",
|
26
25
|
"$options",
|
27
26
|
"$forceUpdate"
|
28
|
-
],
|
27
|
+
], xn = [
|
29
28
|
"beforeCreate",
|
30
29
|
"created",
|
31
30
|
"beforeMount",
|
@@ -39,14 +38,14 @@ const ue = [
|
|
39
38
|
"renderTriggered",
|
40
39
|
"activated",
|
41
40
|
"deactivated"
|
42
|
-
],
|
41
|
+
], nt = [
|
43
42
|
"vIf",
|
44
43
|
"vShow",
|
45
44
|
"vModel",
|
46
45
|
"vFor",
|
47
46
|
"vBind",
|
48
47
|
"vHtml"
|
49
|
-
],
|
48
|
+
], st = {
|
50
49
|
String,
|
51
50
|
Number,
|
52
51
|
Boolean,
|
@@ -54,46 +53,46 @@ const ue = [
|
|
54
53
|
Object,
|
55
54
|
Function,
|
56
55
|
Date
|
57
|
-
},
|
56
|
+
}, C = "VtjPage", H = "VtjHomepage", rt = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot".split(
|
58
57
|
","
|
59
58
|
), ot = "component,slot".split(",");
|
60
|
-
function
|
61
|
-
return
|
59
|
+
function I(s, e) {
|
60
|
+
return s.map((t) => He(t) || t.startsWith("/") ? t : `${e}${t}`);
|
62
61
|
}
|
63
|
-
function
|
64
|
-
return /\.css$/.test(
|
62
|
+
function ne(s) {
|
63
|
+
return /\.css$/.test(s);
|
65
64
|
}
|
66
|
-
function
|
67
|
-
return /\.js$/.test(
|
65
|
+
function se(s) {
|
66
|
+
return /\.js$/.test(s);
|
68
67
|
}
|
69
|
-
function it(
|
70
|
-
return /\.json$/.test(
|
68
|
+
function it(s) {
|
69
|
+
return /\.json$/.test(s);
|
71
70
|
}
|
72
|
-
function
|
73
|
-
return
|
74
|
-
(e) => `<script src="${
|
71
|
+
function Cn(s) {
|
72
|
+
return s.map(
|
73
|
+
(e) => `<script src="${R.append(e, { v: x })}"><\/script>`
|
75
74
|
).join("");
|
76
75
|
}
|
77
|
-
function
|
78
|
-
return
|
79
|
-
(e) => `<link rel="stylesheet" href="${
|
76
|
+
function Mn(s = []) {
|
77
|
+
return s.map(
|
78
|
+
(e) => `<link rel="stylesheet" href="${R.append(e, { v: x })}" />`
|
80
79
|
).join("");
|
81
80
|
}
|
82
|
-
function at(
|
83
|
-
return e &&
|
81
|
+
function at(s, e = !1) {
|
82
|
+
return e && s.endsWith(".prod.js") ? s.replace(".prod.js", ".js") : s;
|
84
83
|
}
|
85
|
-
function ct(
|
86
|
-
const
|
87
|
-
return
|
88
|
-
({ urls:
|
89
|
-
|
90
|
-
|
91
|
-
}), m && (i.push(m), c[m] =
|
84
|
+
function ct(s, e, t = !1) {
|
85
|
+
const n = s.filter((d) => !!d.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
|
86
|
+
return n.forEach(
|
87
|
+
({ urls: d, assetsUrl: h, library: m, assetsLibrary: p, localeLibrary: w }) => {
|
88
|
+
d?.forEach((g) => {
|
89
|
+
se(g) && r.push(at(g, t)), ne(g) && o.push(g);
|
90
|
+
}), m && (i.push(m), c[m] = I(d || [], e), w && (l[m] = w)), h && a.push(h), p && f.push(p), m && p && (u[p] = m);
|
92
91
|
}
|
93
92
|
), {
|
94
|
-
scripts:
|
95
|
-
css:
|
96
|
-
materials:
|
93
|
+
scripts: I(r, e),
|
94
|
+
css: I(o, e),
|
95
|
+
materials: I(a, e),
|
97
96
|
libraryExports: i,
|
98
97
|
materialExports: Oe(f),
|
99
98
|
materialMapLibrary: u,
|
@@ -101,46 +100,46 @@ function ct(n, e, t = !1) {
|
|
101
100
|
libraryLocaleMap: l
|
102
101
|
};
|
103
102
|
}
|
104
|
-
function lt(
|
105
|
-
const { name: t, parent:
|
106
|
-
return
|
103
|
+
function lt(s, e) {
|
104
|
+
const { name: t, parent: n, alias: r } = s;
|
105
|
+
return n ? e[n]?.[r || t] : e[r || t];
|
107
106
|
}
|
108
|
-
function Se(
|
109
|
-
return j(
|
107
|
+
function Se(s) {
|
108
|
+
return j(s) ? s : JSON.stringify(s);
|
110
109
|
}
|
111
|
-
function be(
|
112
|
-
const
|
113
|
-
if (
|
114
|
-
const r = new
|
110
|
+
function be(s, e, t) {
|
111
|
+
const n = s.CSSStyleSheet;
|
112
|
+
if (n.prototype.replaceSync) {
|
113
|
+
const r = new n();
|
115
114
|
r.id = e, r.replaceSync(t);
|
116
|
-
const o =
|
115
|
+
const o = s.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
|
117
116
|
(c) => c.id !== e
|
118
117
|
);
|
119
118
|
o.adoptedStyleSheets = [...i, r];
|
120
119
|
} else {
|
121
|
-
const r =
|
120
|
+
const r = s.document;
|
122
121
|
let o = r.getElementById(e);
|
123
122
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
124
123
|
}
|
125
124
|
}
|
126
|
-
async function ut(
|
127
|
-
const t = await window.fetch(e).then((
|
128
|
-
t && be(window,
|
125
|
+
async function ut(s, e) {
|
126
|
+
const t = await window.fetch(e).then((n) => n.text()).catch(() => "");
|
127
|
+
t && be(window, s, t);
|
129
128
|
}
|
130
|
-
function
|
131
|
-
const t = e.document,
|
132
|
-
for (const r of
|
129
|
+
function dt(s, e = window) {
|
130
|
+
const t = e.document, n = e.document.head;
|
131
|
+
for (const r of s)
|
133
132
|
if (!t.getElementById(r)) {
|
134
133
|
const a = t.createElement("link");
|
135
|
-
a.rel = "stylesheet", a.id = r, a.href = r,
|
134
|
+
a.rel = "stylesheet", a.id = r, a.href = r, n.appendChild(a);
|
136
135
|
}
|
137
136
|
}
|
138
|
-
async function
|
139
|
-
const
|
137
|
+
async function pt(s, e, t = window) {
|
138
|
+
const n = t.document, r = t.document.head;
|
140
139
|
let o = t[e];
|
141
140
|
return o ? o.default || o : new Promise((a, i) => {
|
142
|
-
for (const c of
|
143
|
-
const l =
|
141
|
+
for (const c of s) {
|
142
|
+
const l = n.createElement("script");
|
144
143
|
l.src = c, l.onload = () => {
|
145
144
|
o = t[e], o ? a(o.default || o) : i(null);
|
146
145
|
}, l.onerror = (f) => {
|
@@ -149,51 +148,58 @@ async function dt(n, e, t = window) {
|
|
149
148
|
}
|
150
149
|
});
|
151
150
|
}
|
152
|
-
function ft(
|
153
|
-
return V(
|
151
|
+
function ft(s) {
|
152
|
+
return V(s) || V(s?.install);
|
154
153
|
}
|
155
|
-
function ht(
|
156
|
-
return ot.includes(
|
154
|
+
function ht(s) {
|
155
|
+
return ot.includes(s);
|
157
156
|
}
|
158
|
-
function mt(
|
159
|
-
return rt.includes(
|
157
|
+
function mt(s) {
|
158
|
+
return rt.includes(s);
|
160
159
|
}
|
161
|
-
function
|
160
|
+
function A(s = window) {
|
161
|
+
const e = window.Mock;
|
162
|
+
if (e) return e;
|
163
|
+
const t = s.Mock;
|
164
|
+
if (t)
|
165
|
+
return window.Mock = t, t;
|
166
|
+
}
|
167
|
+
function F(s, e, t = !1, n = !1) {
|
162
168
|
try {
|
163
169
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
164
170
|
r.push("return ");
|
165
|
-
let o = (
|
171
|
+
let o = (s.value || "").trim();
|
166
172
|
o = o.replace(/this(\W|$)/g, (i, c) => `__self${c}`), o = r.join(`
|
167
173
|
`) + o;
|
168
174
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
169
175
|
return new Function("$scope", a)(e);
|
170
176
|
} catch (r) {
|
171
|
-
if (
|
177
|
+
if (P.error("parseExpression.error", r, s, e?.__self ?? e), n)
|
172
178
|
throw r;
|
173
179
|
}
|
174
180
|
}
|
175
|
-
function G(
|
176
|
-
const r =
|
177
|
-
if (typeof r != "function" && (
|
181
|
+
function G(s, e, t = !1, n = !1) {
|
182
|
+
const r = F(s, e, t, n);
|
183
|
+
if (typeof r != "function" && (P.error(
|
178
184
|
"parseFunction.error",
|
179
185
|
"not a function",
|
180
|
-
|
186
|
+
s,
|
181
187
|
e?.__self ?? e
|
182
|
-
),
|
183
|
-
throw new Error(`"${
|
188
|
+
), n))
|
189
|
+
throw new Error(`"${s.value}" not a function`);
|
184
190
|
return r;
|
185
191
|
}
|
186
|
-
function _(
|
187
|
-
return
|
192
|
+
function _(s) {
|
193
|
+
return s && s.type === "JSExpression";
|
188
194
|
}
|
189
|
-
function
|
190
|
-
return typeof
|
195
|
+
function T(s) {
|
196
|
+
return typeof s == "object" && s && s.type === "JSFunction";
|
191
197
|
}
|
192
|
-
function gt(
|
193
|
-
return _(
|
198
|
+
function gt(s) {
|
199
|
+
return _(s) || T(s);
|
194
200
|
}
|
195
|
-
function
|
196
|
-
return gt(
|
201
|
+
function An(s) {
|
202
|
+
return gt(s) ? s.value : JSON.stringify(s);
|
197
203
|
}
|
198
204
|
const vt = {
|
199
205
|
session: !1,
|
@@ -208,7 +214,7 @@ const vt = {
|
|
208
214
|
noPermissionMessage: "无权限访问该页面",
|
209
215
|
appName: ""
|
210
216
|
}, je = Symbol("access");
|
211
|
-
class
|
217
|
+
class Fn {
|
212
218
|
options;
|
213
219
|
data = null;
|
214
220
|
mode = y.Raw;
|
@@ -216,22 +222,22 @@ class Ts {
|
|
216
222
|
this.options = Object.assign({}, vt, e), this.loadData();
|
217
223
|
}
|
218
224
|
connect(e) {
|
219
|
-
const { mode: t, router:
|
220
|
-
this.mode = t,
|
225
|
+
const { mode: t, router: n, request: r } = e;
|
226
|
+
this.mode = t, n && this.mode === y.Raw && this.setGuard(n), r && this.setRequest(r);
|
221
227
|
}
|
222
228
|
login(e) {
|
223
|
-
const { storageKey: t, storagePrefix:
|
229
|
+
const { storageKey: t, storagePrefix: n, session: r, authKey: o } = this.options;
|
224
230
|
this.setData(e), this.data && (L.save(t, e, {
|
225
231
|
type: "local",
|
226
|
-
prefix:
|
232
|
+
prefix: n
|
227
233
|
}), r && q.set(o, this.data.token));
|
228
234
|
}
|
229
235
|
clear() {
|
230
|
-
const { storageKey: e, storagePrefix: t, session:
|
236
|
+
const { storageKey: e, storagePrefix: t, session: n, authKey: r } = this.options;
|
231
237
|
this.data = null, L.remove(e, {
|
232
238
|
type: "local",
|
233
239
|
prefix: t
|
234
|
-
}),
|
240
|
+
}), n && q.remove(r);
|
235
241
|
}
|
236
242
|
logout() {
|
237
243
|
this.clear(), this.toLogin();
|
@@ -243,20 +249,20 @@ class Ts {
|
|
243
249
|
return this.data || this.loadData(), this.data?.token;
|
244
250
|
}
|
245
251
|
can(e) {
|
246
|
-
const { appName: t } = this.options, { permissions:
|
247
|
-
return typeof e == "function" ? e(
|
252
|
+
const { appName: t } = this.options, { permissions: n = {} } = this.data || {};
|
253
|
+
return typeof e == "function" ? e(n) : ie(e).every((o) => n[o] || n[t + "." + o]);
|
248
254
|
}
|
249
255
|
some(e) {
|
250
|
-
const { appName: t } = this.options, { permissions:
|
251
|
-
return ie(e).some((o) =>
|
256
|
+
const { appName: t } = this.options, { permissions: n = {} } = this.data || {};
|
257
|
+
return ie(e).some((o) => n[o] || n[t + "." + o]);
|
252
258
|
}
|
253
259
|
install(e) {
|
254
|
-
e.config.globalProperties.$access || (e.config.globalProperties.$access = this
|
260
|
+
e.config.globalProperties.$access || (e.config.globalProperties.$access = this, e.provide(je, this));
|
255
261
|
}
|
256
262
|
isAuthPath(e) {
|
257
|
-
const { auth: t, isAuth:
|
258
|
-
if (
|
259
|
-
return
|
263
|
+
const { auth: t, isAuth: n } = this.options;
|
264
|
+
if (n)
|
265
|
+
return n(e);
|
260
266
|
if (e.path && typeof t == "string") {
|
261
267
|
const r = t.split("#")[1] || t;
|
262
268
|
return e.path === r;
|
@@ -266,46 +272,46 @@ class Ts {
|
|
266
272
|
toLogin() {
|
267
273
|
const { auth: e, redirectParam: t } = this.options;
|
268
274
|
if (!e) return;
|
269
|
-
const
|
270
|
-
typeof e == "function" ? e(
|
275
|
+
const n = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
|
276
|
+
typeof e == "function" ? e(n) : location.href = t ? `${e}${n}` : e;
|
271
277
|
}
|
272
278
|
setData(e) {
|
273
279
|
const { privateKey: t } = this.options;
|
274
280
|
if (Array.isArray(e) && t) {
|
275
|
-
const
|
276
|
-
this.data = JSON.parse(
|
281
|
+
const n = e.map((r) => ae(r, t));
|
282
|
+
this.data = JSON.parse(n.join(""));
|
277
283
|
return;
|
278
284
|
}
|
279
285
|
if (typeof e == "string")
|
280
286
|
try {
|
281
|
-
const
|
282
|
-
|
283
|
-
} catch (
|
284
|
-
console.warn(
|
287
|
+
const n = t ? ae(e, t) : e;
|
288
|
+
n ? this.data = JSON.parse(n) : console.warn("RSA解密失败或登录信息缺失");
|
289
|
+
} catch (n) {
|
290
|
+
console.warn(n);
|
285
291
|
}
|
286
292
|
else
|
287
293
|
this.data = e;
|
288
294
|
}
|
289
295
|
loadData() {
|
290
|
-
const { storageKey: e, storagePrefix: t } = this.options,
|
296
|
+
const { storageKey: e, storagePrefix: t } = this.options, n = L.get(e, {
|
291
297
|
type: "local",
|
292
298
|
prefix: t
|
293
299
|
});
|
294
|
-
this.setData(
|
300
|
+
this.setData(n || null);
|
295
301
|
}
|
296
302
|
isLogined() {
|
297
303
|
const { session: e, authKey: t } = this.options;
|
298
304
|
return e && t ? !!q.get(t) : !!this.getToken();
|
299
305
|
}
|
300
306
|
hasRoutePermission(e) {
|
301
|
-
if (e.name ===
|
307
|
+
if (e.name === C) {
|
302
308
|
const t = e.params.id;
|
303
309
|
return t && this.can(t);
|
304
310
|
}
|
305
311
|
return !0;
|
306
312
|
}
|
307
313
|
setGuard(e) {
|
308
|
-
e.beforeEach((t,
|
314
|
+
e.beforeEach((t, n, r) => this.guard(t, r));
|
309
315
|
}
|
310
316
|
async guard(e, t) {
|
311
317
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
@@ -314,15 +320,15 @@ class Ts {
|
|
314
320
|
if (this.hasRoutePermission(e))
|
315
321
|
return t();
|
316
322
|
{
|
317
|
-
const { noPermissionMessage:
|
318
|
-
return await this.showTip(
|
323
|
+
const { noPermissionMessage: n = "无权限访问", unauthorized: r = !1 } = this.options;
|
324
|
+
return await this.showTip(n), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
319
325
|
}
|
320
326
|
}
|
321
327
|
t(!1), this.toLogin();
|
322
328
|
}
|
323
329
|
isWhiteList(e) {
|
324
330
|
const { whiteList: t } = this.options;
|
325
|
-
return t ? Array.isArray(t) ? t.some((
|
331
|
+
return t ? Array.isArray(t) ? t.some((n) => e.fullPath.startsWith(n)) : t(e) : !1;
|
326
332
|
}
|
327
333
|
isUnauthorized(e) {
|
328
334
|
const { unauthorizedCode: t = 401 } = this.options;
|
@@ -343,8 +349,8 @@ class Ts {
|
|
343
349
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
344
350
|
async (t) => (await this.showUnauthorizedAlert(t), t),
|
345
351
|
async (t) => {
|
346
|
-
const
|
347
|
-
return await this.showUnauthorizedAlert(
|
352
|
+
const n = t.response || t || {};
|
353
|
+
return await this.showUnauthorizedAlert(n), Promise.reject(t);
|
348
354
|
}
|
349
355
|
);
|
350
356
|
}
|
@@ -352,8 +358,8 @@ class Ts {
|
|
352
358
|
function yt() {
|
353
359
|
return ge(je, null);
|
354
360
|
}
|
355
|
-
function
|
356
|
-
const { notify: e, loading: t, settings:
|
361
|
+
function Tn(s = {}) {
|
362
|
+
const { notify: e, loading: t, settings: n = {} } = s;
|
357
363
|
let r = null;
|
358
364
|
return {
|
359
365
|
request: he({
|
@@ -373,7 +379,7 @@ function Is(n = {}) {
|
|
373
379
|
hideLoading: () => {
|
374
380
|
r && (r.close(), r = null);
|
375
381
|
},
|
376
|
-
...
|
382
|
+
...n
|
377
383
|
}
|
378
384
|
}),
|
379
385
|
jsonp: me,
|
@@ -381,76 +387,78 @@ function Is(n = {}) {
|
|
381
387
|
loading: t
|
382
388
|
};
|
383
389
|
}
|
384
|
-
function _t(
|
385
|
-
const { jsonp: t, request:
|
386
|
-
if (
|
387
|
-
return (r = {}) => t(
|
388
|
-
...
|
390
|
+
function _t(s, e) {
|
391
|
+
const { jsonp: t, request: n } = e;
|
392
|
+
if (s.method === "jsonp")
|
393
|
+
return (r = {}) => t(s.url, {
|
394
|
+
...s.jsonpOptions,
|
389
395
|
query: r
|
390
396
|
});
|
391
397
|
{
|
392
|
-
const r =
|
393
|
-
url:
|
394
|
-
method:
|
398
|
+
const r = s.headers ? F(s.headers, {}, !0) : void 0, o = {
|
399
|
+
url: s.url,
|
400
|
+
method: s.method,
|
395
401
|
settings: {
|
396
|
-
...
|
402
|
+
...s.settings,
|
397
403
|
headers: r
|
398
404
|
}
|
399
405
|
};
|
400
|
-
return (a, i) => (delete o.data,
|
406
|
+
return (a, i) => (delete o.data, n.send(Be(o, i || {}, { data: a })));
|
401
407
|
}
|
402
408
|
}
|
403
|
-
function wt(
|
409
|
+
function wt(s, e) {
|
404
410
|
const { metaQuery: t } = e;
|
405
411
|
if (!t) return;
|
406
|
-
const { code:
|
412
|
+
const { code: n, queryCode: r } = s;
|
407
413
|
return (o, a) => {
|
408
414
|
if (!t) {
|
409
415
|
console.warn("adapter.metaQuery is not defined!");
|
410
416
|
return;
|
411
417
|
}
|
412
|
-
return t(
|
418
|
+
return t(n, r, o, a);
|
413
419
|
};
|
414
420
|
}
|
415
|
-
function St(
|
416
|
-
const
|
417
|
-
for (const r of
|
418
|
-
|
421
|
+
function St(s = [], e = [], t) {
|
422
|
+
const n = {};
|
423
|
+
for (const r of s)
|
424
|
+
n[r.id] = _t(r, t);
|
419
425
|
for (const r of e)
|
420
|
-
|
421
|
-
return
|
426
|
+
n[r.id] = wt(r, t);
|
427
|
+
return n;
|
422
428
|
}
|
423
|
-
async function bt(
|
424
|
-
|
429
|
+
async function bt(s = []) {
|
430
|
+
const e = A();
|
431
|
+
e && ($e(), s.forEach((t) => $t(e, t)));
|
425
432
|
}
|
426
|
-
function jt(
|
427
|
-
const e =
|
428
|
-
return async (...
|
429
|
-
let
|
433
|
+
function jt(s) {
|
434
|
+
const e = T(s.mockTemplate) && s.mockTemplate.value ? G(s.mockTemplate, {}, !0) : void 0, t = A();
|
435
|
+
return async (...n) => {
|
436
|
+
let r = {};
|
430
437
|
if (e)
|
431
438
|
try {
|
432
|
-
|
433
|
-
} catch (
|
434
|
-
|
439
|
+
r = await e.apply(e, n);
|
440
|
+
} catch (o) {
|
441
|
+
P.warn("模拟数据模版异常", o);
|
435
442
|
}
|
436
|
-
return
|
443
|
+
return t?.mock(r);
|
437
444
|
};
|
438
445
|
}
|
439
|
-
function $t(
|
446
|
+
function $t(s, e) {
|
440
447
|
if (!e.mock) return;
|
441
|
-
const { url: t, mockTemplate:
|
442
|
-
if (t &&
|
443
|
-
const r = Ne(`${t}(.*)`), o = Ue(t, { decode: decodeURIComponent }), a =
|
444
|
-
|
445
|
-
const c =
|
446
|
-
return Object.assign(i, { data: l, params: c, query: f }),
|
448
|
+
const { url: t, mockTemplate: n } = e;
|
449
|
+
if (t && n) {
|
450
|
+
const r = Ne(`${t}(.*)`), o = Ue(t, { decode: decodeURIComponent }), a = F(n, {}, !0);
|
451
|
+
s.mock(r, (i) => {
|
452
|
+
const c = R.parse(i.url) || {}, l = i.body instanceof FormData ? Le(i.body) : i.body, f = o(i.url)?.params;
|
453
|
+
return Object.assign(i, { data: l, params: c, query: f }), s.mock(a(i));
|
447
454
|
});
|
448
455
|
}
|
449
456
|
}
|
450
457
|
function $e() {
|
451
|
-
|
458
|
+
const s = A();
|
459
|
+
s && (s._mocked = {});
|
452
460
|
}
|
453
|
-
class
|
461
|
+
class kt {
|
454
462
|
__id = null;
|
455
463
|
__mode;
|
456
464
|
__instance = null;
|
@@ -476,14 +484,14 @@ class Et {
|
|
476
484
|
$apis = {};
|
477
485
|
__transform = {};
|
478
486
|
constructor(e) {
|
479
|
-
const { mode: t, dsl:
|
480
|
-
this.__mode = t,
|
487
|
+
const { mode: t, dsl: n, attrs: r } = e;
|
488
|
+
this.__mode = t, n && (this.__id = n.id || null, this.__transform = n.transform || {}), r && Object.assign(this, r);
|
481
489
|
}
|
482
490
|
setup(e, t = N) {
|
483
|
-
const
|
484
|
-
if (!
|
485
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
486
|
-
const r =
|
491
|
+
const n = t.getCurrentInstance();
|
492
|
+
if (!n) return;
|
493
|
+
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = n.proxy;
|
494
|
+
const r = n.appContext.config.globalProperties;
|
487
495
|
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
488
496
|
this.__proxy();
|
489
497
|
}), t.onUnmounted(() => {
|
@@ -508,60 +516,60 @@ class Et {
|
|
508
516
|
__parseFunction(e) {
|
509
517
|
if (e)
|
510
518
|
if (this.__mode === y.Runtime) {
|
511
|
-
const { id: t, type:
|
512
|
-
return G({ type:
|
519
|
+
const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
520
|
+
return G({ type: n, value: r }, this);
|
513
521
|
} else
|
514
522
|
return G(e, this);
|
515
523
|
}
|
516
524
|
__parseExpression(e) {
|
517
525
|
if (e)
|
518
526
|
if (this.__mode === y.Runtime) {
|
519
|
-
const { id: t, type:
|
520
|
-
return
|
527
|
+
const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
528
|
+
return F({ type: n, value: r }, this);
|
521
529
|
} else
|
522
|
-
return
|
530
|
+
return F(e, this);
|
523
531
|
}
|
524
532
|
__ref(e = null, t) {
|
525
533
|
if (this.__mode !== y.VNode)
|
526
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
534
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (n) => {
|
527
535
|
await fe(0);
|
528
|
-
let r =
|
536
|
+
let r = n?.$vtjEl || n?.$el || n?._?.vnode?.el || n;
|
529
537
|
if (!r) {
|
530
538
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
531
539
|
return;
|
532
540
|
}
|
533
|
-
return 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] = this.__getRefEl(this.__refs, e,
|
541
|
+
return 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] = this.__getRefEl(this.__refs, e, n)), typeof t == "function" ? t(n) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, n)), n;
|
534
542
|
};
|
535
543
|
}
|
536
|
-
__getRefEl(e, t,
|
544
|
+
__getRefEl(e, t, n) {
|
537
545
|
const r = e[t];
|
538
|
-
if (r &&
|
539
|
-
const o = new Set([].concat(r,
|
546
|
+
if (r && n !== r) {
|
547
|
+
const o = new Set([].concat(r, n));
|
540
548
|
return Array.from(o);
|
541
549
|
} else
|
542
|
-
return
|
550
|
+
return n;
|
543
551
|
}
|
544
552
|
__clone(e = {}) {
|
545
|
-
const t = { ...this.context, ...e },
|
553
|
+
const t = { ...this.context, ...e }, n = {
|
546
554
|
...t,
|
547
555
|
context: t
|
548
556
|
};
|
549
|
-
return
|
557
|
+
return n.context.__proto__ = this.context, n.__proto__ = this, n;
|
550
558
|
}
|
551
559
|
}
|
552
|
-
function Y(
|
560
|
+
function Y(s) {
|
553
561
|
const {
|
554
562
|
Vue: e = N,
|
555
563
|
mode: t = y.Runtime,
|
556
|
-
components:
|
564
|
+
components: n = {},
|
557
565
|
libs: r = {},
|
558
566
|
apis: o = {},
|
559
567
|
loader: a
|
560
|
-
} =
|
561
|
-
$components:
|
568
|
+
} = s, i = e.computed(() => s.dsl), c = {
|
569
|
+
$components: n,
|
562
570
|
$libs: r,
|
563
571
|
$apis: o
|
564
|
-
}, l = new
|
572
|
+
}, l = new kt({
|
565
573
|
mode: t,
|
566
574
|
dsl: i.value,
|
567
575
|
attrs: c
|
@@ -572,101 +580,101 @@ function Y(n) {
|
|
572
580
|
},
|
573
581
|
setup(u) {
|
574
582
|
l.$props = u, l.props = u, i.value.id && be(
|
575
|
-
|
583
|
+
s.window || window,
|
576
584
|
i.value.id,
|
577
585
|
i.value.css || ""
|
578
586
|
), l.state = Pt(e, i.value.state ?? {}, l);
|
579
|
-
const
|
587
|
+
const d = xt(e, i.value.computed ?? {}, l), h = Ct(i.value.methods ?? {}, l), m = Mt(e, i.value.inject, l), p = At(
|
580
588
|
i.value.dataSources || {},
|
581
589
|
l
|
582
590
|
), w = {
|
583
591
|
...m,
|
584
|
-
...
|
592
|
+
...d,
|
585
593
|
...h,
|
586
|
-
...
|
594
|
+
...p
|
587
595
|
};
|
588
|
-
return l.setup(w, e),
|
596
|
+
return l.setup(w, e), Ft(e, i.value.watch ?? [], l), {
|
589
597
|
vtj: l
|
590
598
|
};
|
591
599
|
},
|
592
|
-
emits:
|
600
|
+
emits: Et(i.value.emits),
|
593
601
|
expose: ["vtj"],
|
594
602
|
render() {
|
595
603
|
if (!i.value.nodes) return null;
|
596
604
|
const u = i.value.nodes || [];
|
597
|
-
return u.length === 1 ? B(u[0], l, e, a) : u.map((
|
605
|
+
return u.length === 1 ? B(u[0], l, e, a) : u.map((d) => B(d, l, e, a));
|
598
606
|
},
|
599
|
-
...
|
607
|
+
...Tt(i.value.lifeCycles ?? {}, l)
|
600
608
|
});
|
601
609
|
return {
|
602
610
|
renderer: e.markRaw(f),
|
603
611
|
context: l
|
604
612
|
};
|
605
613
|
}
|
606
|
-
function
|
607
|
-
return
|
614
|
+
function Et(s = []) {
|
615
|
+
return s.map((e) => j(e) ? e : e.name);
|
608
616
|
}
|
609
|
-
function Rt(
|
610
|
-
const t = (
|
611
|
-
return
|
612
|
-
name:
|
617
|
+
function Rt(s = [], e) {
|
618
|
+
const t = (n) => n ? (Array.isArray(n) ? n : [n]).map((o) => st[o]) : void 0;
|
619
|
+
return s.map((n) => j(n) ? {
|
620
|
+
name: n
|
613
621
|
} : {
|
614
|
-
name:
|
615
|
-
type:
|
616
|
-
required:
|
617
|
-
default: _(
|
622
|
+
name: n.name,
|
623
|
+
type: n.type,
|
624
|
+
required: n.required,
|
625
|
+
default: _(n.default) ? e.__parseExpression(n.default) : n.default
|
618
626
|
}).reduce(
|
619
|
-
(
|
627
|
+
(n, r) => (n[r.name] = {
|
620
628
|
type: t(r.type),
|
621
629
|
required: r.required,
|
622
630
|
default: r.default
|
623
|
-
},
|
631
|
+
}, n),
|
624
632
|
{}
|
625
633
|
);
|
626
634
|
}
|
627
|
-
function Pt(
|
628
|
-
return
|
635
|
+
function Pt(s, e, t) {
|
636
|
+
return s.reactive(
|
629
637
|
Object.keys(e || {}).reduce(
|
630
|
-
(
|
638
|
+
(n, r) => {
|
631
639
|
let o = e[r];
|
632
|
-
return _(o) ? o = t.__parseExpression(o) :
|
640
|
+
return _(o) ? o = t.__parseExpression(o) : T(o) && (o = t.__parseFunction(o)), n[r] = o, n;
|
633
641
|
},
|
634
642
|
{}
|
635
643
|
)
|
636
644
|
);
|
637
645
|
}
|
638
|
-
function xt(
|
646
|
+
function xt(s, e, t) {
|
639
647
|
return Object.entries(e ?? {}).reduce(
|
640
|
-
(
|
648
|
+
(n, [r, o]) => (n[r] = s.computed(t.__parseFunction(o)), n),
|
641
649
|
{}
|
642
650
|
);
|
643
651
|
}
|
644
|
-
function Ct(
|
645
|
-
return Object.entries(
|
646
|
-
(t, [
|
652
|
+
function Ct(s, e) {
|
653
|
+
return Object.entries(s ?? {}).reduce(
|
654
|
+
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
647
655
|
{}
|
648
656
|
);
|
649
657
|
}
|
650
|
-
function
|
658
|
+
function Mt(s, e = [], t) {
|
651
659
|
return e.reduce(
|
652
|
-
(
|
660
|
+
(n, r) => {
|
653
661
|
const { name: o, from: a } = r || {};
|
654
662
|
r.default;
|
655
663
|
const i = _(a) ? t.__parseExpression(a) || o : a ?? o, c = _(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
656
|
-
return
|
664
|
+
return n[o] = s.inject(i, c), n;
|
657
665
|
},
|
658
666
|
{}
|
659
667
|
);
|
660
668
|
}
|
661
|
-
function
|
662
|
-
return Object.keys(
|
663
|
-
(t,
|
664
|
-
const r = n
|
669
|
+
function At(s, e) {
|
670
|
+
return Object.keys(s).reduce(
|
671
|
+
(t, n) => {
|
672
|
+
const r = s[n];
|
665
673
|
if (r.type === "mock")
|
666
|
-
t[
|
674
|
+
t[n] = jt(r);
|
667
675
|
else if (r.ref) {
|
668
|
-
const o = e.$apis[r.ref], a =
|
669
|
-
t[
|
676
|
+
const o = e.$apis[r.ref], a = T(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
677
|
+
t[n] = async (...i) => {
|
670
678
|
const c = await o.apply(e, i);
|
671
679
|
return a ? a(c) : c;
|
672
680
|
};
|
@@ -676,71 +684,71 @@ function Ft(n, e) {
|
|
676
684
|
{}
|
677
685
|
);
|
678
686
|
}
|
679
|
-
function
|
680
|
-
e.forEach((
|
681
|
-
|
682
|
-
t.__parseExpression(
|
683
|
-
t.__parseFunction(
|
687
|
+
function Ft(s, e = [], t) {
|
688
|
+
e.forEach((n) => {
|
689
|
+
s.watch(
|
690
|
+
t.__parseExpression(n.source),
|
691
|
+
t.__parseFunction(n.handler),
|
684
692
|
{
|
685
|
-
deep:
|
686
|
-
immediate:
|
693
|
+
deep: n.deep,
|
694
|
+
immediate: n.immediate
|
687
695
|
}
|
688
696
|
);
|
689
697
|
});
|
690
698
|
}
|
691
|
-
function
|
692
|
-
return Object.entries(
|
693
|
-
(t, [
|
699
|
+
function Tt(s, e) {
|
700
|
+
return Object.entries(s ?? {}).reduce(
|
701
|
+
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
694
702
|
{}
|
695
703
|
);
|
696
704
|
}
|
697
|
-
let z = [],
|
698
|
-
const
|
699
|
-
async function
|
700
|
-
const { urls: t = [], library:
|
701
|
-
if (r.length === 0 || !
|
702
|
-
const o = t.filter((i) =>
|
703
|
-
return o.length &&
|
704
|
-
(i) => (console.warn("loadScriptUrl error", r,
|
705
|
+
let z = [], E = {};
|
706
|
+
const It = (s) => s;
|
707
|
+
async function ke(s, e = window) {
|
708
|
+
const { urls: t = [], library: n } = s, r = t.filter((i) => se(i));
|
709
|
+
if (r.length === 0 || !n) return null;
|
710
|
+
const o = t.filter((i) => ne(i));
|
711
|
+
return o.length && dt(o, e), await pt(r, n, e).catch(
|
712
|
+
(i) => (console.warn("loadScriptUrl error", r, n, i), null)
|
705
713
|
);
|
706
714
|
}
|
707
|
-
function Q(
|
708
|
-
const { getDsl: e, getDslByUrl: t, options:
|
709
|
-
return
|
710
|
-
delete
|
715
|
+
function Q(s) {
|
716
|
+
const { getDsl: e, getDslByUrl: t, options: n } = s;
|
717
|
+
return n.window && (z.forEach((r) => {
|
718
|
+
delete n.window[r];
|
711
719
|
}), z = []), (r, o, a = N) => {
|
712
720
|
if (!o || typeof o == "string") return r;
|
713
721
|
if (o.type === "Schema" && o.id) {
|
714
|
-
let i =
|
715
|
-
return i || (i =
|
722
|
+
let i = E[o.id];
|
723
|
+
return i || (i = E[o.id] = a.defineAsyncComponent(async () => {
|
716
724
|
const c = await e(o.id);
|
717
725
|
return c && (c.name = r), c ? Y({
|
718
|
-
...
|
726
|
+
...n,
|
719
727
|
Vue: a,
|
720
728
|
dsl: c,
|
721
729
|
mode: y.Runtime,
|
722
|
-
loader: Q(
|
730
|
+
loader: Q(s)
|
723
731
|
}).renderer : null;
|
724
732
|
}), i);
|
725
733
|
}
|
726
734
|
if (o.type === "UrlSchema" && o.url) {
|
727
|
-
let i =
|
728
|
-
return i || (i =
|
735
|
+
let i = E[o.url];
|
736
|
+
return i || (i = E[o.url] = a.defineAsyncComponent(async () => {
|
729
737
|
const c = await t(o.url);
|
730
738
|
return c && (c.name = r), c ? Y({
|
731
|
-
...
|
739
|
+
...n,
|
732
740
|
Vue: a,
|
733
741
|
dsl: c,
|
734
742
|
mode: y.Runtime,
|
735
|
-
loader: Q(
|
743
|
+
loader: Q(s)
|
736
744
|
}).renderer : null;
|
737
745
|
}), i);
|
738
746
|
}
|
739
747
|
if (o.type === "Plugin") {
|
740
|
-
let i = o.library ?
|
741
|
-
return i || (o.library && z.push(o.library), i =
|
748
|
+
let i = o.library ? E[o.library] : null;
|
749
|
+
return i || (o.library && z.push(o.library), i = E[o.library || Symbol()] = a.defineAsyncComponent(
|
742
750
|
async () => {
|
743
|
-
const c = await
|
751
|
+
const c = await ke(o, n.window);
|
744
752
|
return c || (console.warn("getPlugin result is null", o), null);
|
745
753
|
}
|
746
754
|
), i);
|
@@ -748,145 +756,145 @@ function Q(n) {
|
|
748
756
|
return r;
|
749
757
|
};
|
750
758
|
}
|
751
|
-
function
|
752
|
-
|
759
|
+
function In() {
|
760
|
+
E = {};
|
753
761
|
}
|
754
|
-
function B(
|
755
|
-
if (!
|
756
|
-
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } =
|
762
|
+
function B(s, e, t = N, n = It) {
|
763
|
+
if (!s || !s.name || s.invisible) return null;
|
764
|
+
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = s, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: d, others: h } = Ht(a);
|
757
765
|
if (i && !Ot(i, e))
|
758
766
|
return null;
|
759
|
-
const m = (
|
760
|
-
const w =
|
761
|
-
if (
|
762
|
-
return Bt(
|
763
|
-
if (
|
764
|
-
const b = s
|
767
|
+
const m = (p) => {
|
768
|
+
const w = p.$components, g = (() => {
|
769
|
+
if (s.name === "component")
|
770
|
+
return Bt(p, s.props?.is);
|
771
|
+
if (s.name === "slot") return s.name;
|
772
|
+
const b = n(s.name, s.from, t);
|
765
773
|
return j(b) ? ht(b) || mt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
|
766
|
-
})(), S = Nt(o,
|
767
|
-
if (
|
768
|
-
return Lt(t,
|
769
|
-
u && Object.assign(S,
|
774
|
+
})(), S = Nt(o, s.props ?? {}, p), Fe = Ut(t, s.events ?? {}, p);
|
775
|
+
if (s.name === "slot")
|
776
|
+
return Lt(t, s, S, p, n);
|
777
|
+
u && Object.assign(S, p.__parseExpression(u.value)), l && (S.style = Object.assign(
|
770
778
|
S.style ?? {},
|
771
|
-
Jt(l,
|
772
|
-
)),
|
773
|
-
Object.assign(S, Vt(t, b,
|
779
|
+
Jt(l, p)
|
780
|
+
)), d && Object.assign(S, zt(d, p)), f.forEach((b) => {
|
781
|
+
Object.assign(S, Vt(t, b, p));
|
774
782
|
});
|
775
|
-
const
|
783
|
+
const Te = Kt(
|
776
784
|
t,
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
785
|
+
s.children ?? [],
|
786
|
+
p,
|
787
|
+
n,
|
788
|
+
s
|
781
789
|
);
|
782
|
-
let U = t.createVNode(g, { ...S, ...
|
783
|
-
const oe = r ? Dt(r, h,
|
790
|
+
let U = t.createVNode(g, { ...S, ...Fe }, Te);
|
791
|
+
const oe = r ? Dt(r, h, p) : [];
|
784
792
|
return oe.length && (U = t.withDirectives(U, oe)), U;
|
785
793
|
};
|
786
794
|
return c ? Yt(c, m, e) : m(e);
|
787
795
|
}
|
788
|
-
function Dt(
|
789
|
-
const
|
796
|
+
function Dt(s, e, t) {
|
797
|
+
const n = s.app;
|
790
798
|
return e.map((r) => {
|
791
|
-
const o = typeof r.name == "string" ?
|
799
|
+
const o = typeof r.name == "string" ? n.directive(r.name) : t.__parseExpression(r.name);
|
792
800
|
if (!o) return null;
|
793
801
|
const a = [o];
|
794
802
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
795
803
|
}).filter((r) => !!r);
|
796
804
|
}
|
797
|
-
function Ht(
|
798
|
-
const e =
|
805
|
+
function Ht(s = []) {
|
806
|
+
const e = s.find((c) => $(c.name) === "vIf"), t = s.find((c) => $(c.name) === "vFor"), n = s.find((c) => $(c.name) === "vShow"), r = s.find((c) => $(c.name) === "vBind"), o = s.find((c) => $(c.name) === "vHtml"), a = s.filter(
|
799
807
|
(c) => $(c.name) === "vModel"
|
800
|
-
), i =
|
801
|
-
(c) => !
|
808
|
+
), i = s.filter(
|
809
|
+
(c) => !nt.includes($(c.name))
|
802
810
|
);
|
803
811
|
return {
|
804
812
|
vIf: e,
|
805
813
|
vFor: t,
|
806
|
-
vShow:
|
814
|
+
vShow: n,
|
807
815
|
vModels: a,
|
808
816
|
vBind: r,
|
809
817
|
others: i,
|
810
818
|
vHtml: o
|
811
819
|
};
|
812
820
|
}
|
813
|
-
function Ot(
|
814
|
-
return !!e.__parseExpression(
|
821
|
+
function Ot(s, e) {
|
822
|
+
return !!e.__parseExpression(s.value);
|
815
823
|
}
|
816
|
-
function Bt(
|
817
|
-
return e ? _(e) ?
|
824
|
+
function Bt(s, e) {
|
825
|
+
return e ? _(e) ? s.__parseExpression(e) : e : "div";
|
818
826
|
}
|
819
|
-
function Nt(
|
820
|
-
const
|
821
|
-
return
|
827
|
+
function Nt(s, e, t) {
|
828
|
+
const n = X(e, t);
|
829
|
+
return n.ref = t.__ref(s, n.ref), n;
|
822
830
|
}
|
823
|
-
function X(
|
824
|
-
return _(
|
825
|
-
(t,
|
826
|
-
let r = n
|
827
|
-
return t[
|
831
|
+
function X(s, e) {
|
832
|
+
return _(s) ? e.__parseExpression(s) : T(s) ? e.__parseFunction(s) : Array.isArray(s) ? s.map((t) => X(t, e)) : typeof s == "object" ? Object.keys(s || {}).reduce(
|
833
|
+
(t, n) => {
|
834
|
+
let r = s[n];
|
835
|
+
return t[n] = X(r, e), t;
|
828
836
|
},
|
829
837
|
{}
|
830
|
-
) :
|
838
|
+
) : s;
|
831
839
|
}
|
832
|
-
function Ut(
|
833
|
-
const
|
840
|
+
function Ut(s, e, t) {
|
841
|
+
const n = ["passive", "capture", "once"], r = {
|
834
842
|
capture: "Capture",
|
835
843
|
once: "Once",
|
836
844
|
passive: "OnceCapture"
|
837
845
|
};
|
838
846
|
return Object.keys(e || {}).reduce(
|
839
847
|
(o, a) => {
|
840
|
-
const i = e[a], c =
|
841
|
-
return u && (o[f] =
|
848
|
+
const i = e[a], c = Ee(i.modifiers), l = c.find((d) => n.includes(d)), f = "on" + qe(a) + (l && r[l] || ""), u = t.__parseFunction(i.handler);
|
849
|
+
return u && (o[f] = s.withModifiers(u, c)), o;
|
842
850
|
},
|
843
851
|
{}
|
844
852
|
);
|
845
853
|
}
|
846
|
-
function
|
847
|
-
const t = Object.keys(
|
848
|
-
return e ? t.map((
|
854
|
+
function Ee(s = {}, e = !1) {
|
855
|
+
const t = Object.keys(s);
|
856
|
+
return e ? t.map((n) => "." + n) : t;
|
849
857
|
}
|
850
|
-
function Lt(
|
851
|
-
const { children: o } = e, a = qt(e,
|
852
|
-
return i ? i(t) : o ? j(o) ?
|
853
|
-
Se(
|
858
|
+
function Lt(s, e, t, n, r) {
|
859
|
+
const { children: o } = e, a = qt(e, n), i = n.$slots?.[a.name];
|
860
|
+
return i ? i(t) : o ? j(o) ? s.createTextVNode(o) : _(o) ? s.createTextVNode(
|
861
|
+
Se(n.__parseExpression(o))
|
854
862
|
) : Array.isArray(o) ? o.map(
|
855
|
-
(c) => B(c,
|
863
|
+
(c) => B(c, n, s, r)
|
856
864
|
) : null : null;
|
857
865
|
}
|
858
|
-
function qt(
|
859
|
-
const { props: t } =
|
866
|
+
function qt(s, e) {
|
867
|
+
const { props: t } = s, n = t?.name || "default";
|
860
868
|
return {
|
861
|
-
name: _(
|
869
|
+
name: _(n) ? e.__parseExpression(n) : n,
|
862
870
|
params: []
|
863
871
|
};
|
864
872
|
}
|
865
|
-
function Jt(
|
866
|
-
return e.__parseExpression(
|
873
|
+
function Jt(s, e) {
|
874
|
+
return e.__parseExpression(s.value) ? {} : {
|
867
875
|
display: "none"
|
868
876
|
};
|
869
877
|
}
|
870
|
-
function zt(
|
878
|
+
function zt(s, e) {
|
871
879
|
return {
|
872
|
-
innerHTML: e.__parseExpression(
|
880
|
+
innerHTML: e.__parseExpression(s.value) || ""
|
873
881
|
};
|
874
882
|
}
|
875
|
-
function Vt(
|
876
|
-
const
|
883
|
+
function Vt(s, e, t) {
|
884
|
+
const n = {
|
877
885
|
type: "JSFunction",
|
878
886
|
value: e.value?.value ? `(v) => {
|
879
887
|
${e.value.value} = v;
|
880
888
|
}` : "(v) => {}"
|
881
|
-
}, r = t.__parseFunction(
|
889
|
+
}, r = t.__parseFunction(n), o = Ee(
|
882
890
|
_(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
883
891
|
), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
884
892
|
return {
|
885
893
|
[a]: t.__parseExpression(e.value),
|
886
|
-
[`onUpdate:${a}`]: o.length && r ?
|
894
|
+
[`onUpdate:${a}`]: o.length && r ? s.withModifiers(r, o) : r
|
887
895
|
};
|
888
896
|
}
|
889
|
-
function Kt(
|
897
|
+
function Kt(s, e, t, n, r) {
|
890
898
|
if (!e) return null;
|
891
899
|
if (j(e))
|
892
900
|
return { default: () => e };
|
@@ -899,88 +907,88 @@ function Kt(n, e, t, s, r) {
|
|
899
907
|
[`scope_${r.id}`]: i
|
900
908
|
} : {};
|
901
909
|
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
|
902
|
-
const
|
910
|
+
const d = f.length ? Je(u ?? {}, f) : a(u);
|
903
911
|
return l.map(
|
904
|
-
(h) => B(h, t.__clone(
|
912
|
+
(h) => B(h, t.__clone(d), s, n)
|
905
913
|
);
|
906
914
|
}, i), {});
|
907
915
|
}
|
908
916
|
return null;
|
909
917
|
}
|
910
|
-
function Wt(
|
918
|
+
function Wt(s) {
|
911
919
|
const e = {
|
912
920
|
default: {
|
913
921
|
params: [],
|
914
922
|
nodes: []
|
915
923
|
}
|
916
924
|
};
|
917
|
-
for (const t of
|
918
|
-
const
|
919
|
-
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(
|
925
|
+
for (const t of s) {
|
926
|
+
const n = Gt(t.slot), r = n.name;
|
927
|
+
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(n.params)) : e[r] = {
|
920
928
|
nodes: [t],
|
921
|
-
params:
|
929
|
+
params: n.params
|
922
930
|
};
|
923
931
|
}
|
924
932
|
return e;
|
925
933
|
}
|
926
|
-
function Gt(
|
927
|
-
return j(
|
934
|
+
function Gt(s = "default") {
|
935
|
+
return j(s) ? { name: s, params: [] } : { params: [], ...s };
|
928
936
|
}
|
929
|
-
function Yt(
|
930
|
-
const { value:
|
931
|
-
let i = t.__parseExpression(
|
932
|
-
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]:", `${
|
937
|
+
function Yt(s, e, t) {
|
938
|
+
const { value: n, iterator: r } = s, { item: o = "item", index: a = "index" } = r || {};
|
939
|
+
let i = t.__parseExpression(n) || [];
|
940
|
+
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]:", `${n?.value} is not a Arrary`), []);
|
933
941
|
}
|
934
|
-
function Qt(
|
935
|
-
return Ye() ? (Qe(
|
942
|
+
function Qt(s) {
|
943
|
+
return Ye() ? (Qe(s), !0) : !1;
|
936
944
|
}
|
937
945
|
const Re = typeof window < "u" && typeof document < "u";
|
938
946
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
939
|
-
const Xt = (
|
947
|
+
const Xt = (s) => s != null, Zt = () => {
|
940
948
|
};
|
941
|
-
function
|
949
|
+
function en(s) {
|
942
950
|
return ve();
|
943
951
|
}
|
944
|
-
function
|
945
|
-
return Array.isArray(
|
952
|
+
function tn(s) {
|
953
|
+
return Array.isArray(s) ? s : [s];
|
946
954
|
}
|
947
|
-
function
|
948
|
-
if (
|
949
|
-
return Ve(...
|
950
|
-
const e =
|
951
|
-
return typeof e == "function" ? Ke(We(() => ({ get: e, set: Zt }))) :
|
955
|
+
function nn(...s) {
|
956
|
+
if (s.length !== 1)
|
957
|
+
return Ve(...s);
|
958
|
+
const e = s[0];
|
959
|
+
return typeof e == "function" ? Ke(We(() => ({ get: e, set: Zt }))) : M(e);
|
952
960
|
}
|
953
|
-
function
|
954
|
-
|
961
|
+
function sn(s, e) {
|
962
|
+
en() && Ge(s, e);
|
955
963
|
}
|
956
|
-
const
|
957
|
-
function
|
964
|
+
const rn = Re ? window : void 0, on = Re ? window.document : void 0;
|
965
|
+
function an(s) {
|
958
966
|
var e;
|
959
|
-
const t = ee(
|
967
|
+
const t = ee(s);
|
960
968
|
return (e = t?.$el) != null ? e : t;
|
961
969
|
}
|
962
|
-
function
|
963
|
-
const
|
970
|
+
function cn() {
|
971
|
+
const s = M(!1), e = ve();
|
964
972
|
return e && Xe(() => {
|
965
|
-
|
966
|
-
}, e),
|
973
|
+
s.value = !0;
|
974
|
+
}, e), s;
|
967
975
|
}
|
968
|
-
function
|
969
|
-
const e =
|
970
|
-
return _e(() => (e.value, !!
|
976
|
+
function ln(s) {
|
977
|
+
const e = cn();
|
978
|
+
return _e(() => (e.value, !!s()));
|
971
979
|
}
|
972
|
-
function
|
973
|
-
const { window:
|
980
|
+
function un(s, e, t = {}) {
|
981
|
+
const { window: n = rn, ...r } = t;
|
974
982
|
let o;
|
975
|
-
const a =
|
983
|
+
const a = ln(() => n && "MutationObserver" in n), i = () => {
|
976
984
|
o && (o.disconnect(), o = void 0);
|
977
985
|
}, c = _e(() => {
|
978
|
-
const
|
986
|
+
const d = ee(s), h = tn(d).map(an).filter(Xt);
|
979
987
|
return new Set(h);
|
980
988
|
}), l = ye(
|
981
989
|
() => c.value,
|
982
|
-
(
|
983
|
-
i(), a.value &&
|
990
|
+
(d) => {
|
991
|
+
i(), a.value && d.size && (o = new MutationObserver(e), d.forEach((h) => o.observe(h, r)));
|
984
992
|
},
|
985
993
|
{ immediate: !0, flush: "post" }
|
986
994
|
), f = () => o?.takeRecords(), u = () => {
|
@@ -992,45 +1000,45 @@ function ls(n, e, t = {}) {
|
|
992
1000
|
takeRecords: f
|
993
1001
|
};
|
994
1002
|
}
|
995
|
-
function
|
996
|
-
var t,
|
1003
|
+
function dn(s = null, e = {}) {
|
1004
|
+
var t, n, r;
|
997
1005
|
const {
|
998
|
-
document: o =
|
1006
|
+
document: o = on,
|
999
1007
|
restoreOnUnmount: a = (u) => u
|
1000
|
-
} = e, i = (t = o?.title) != null ? t : "", c =
|
1008
|
+
} = e, i = (t = o?.title) != null ? t : "", c = nn((n = s ?? o?.title) != null ? n : null), l = !!(s && typeof s == "function");
|
1001
1009
|
function f(u) {
|
1002
1010
|
if (!("titleTemplate" in e))
|
1003
1011
|
return u;
|
1004
|
-
const
|
1005
|
-
return typeof
|
1012
|
+
const d = e.titleTemplate || "%s";
|
1013
|
+
return typeof d == "function" ? d(u) : ee(d).replace(/%s/g, u);
|
1006
1014
|
}
|
1007
1015
|
return ye(
|
1008
1016
|
c,
|
1009
|
-
(u,
|
1010
|
-
u !==
|
1017
|
+
(u, d) => {
|
1018
|
+
u !== d && o && (o.title = f(u ?? ""));
|
1011
1019
|
},
|
1012
1020
|
{ immediate: !0 }
|
1013
|
-
), e.observe && !e.titleTemplate && o && !l &&
|
1021
|
+
), e.observe && !e.titleTemplate && o && !l && un(
|
1014
1022
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
1015
1023
|
() => {
|
1016
1024
|
o && o.title !== c.value && (c.value = f(o.title));
|
1017
1025
|
},
|
1018
1026
|
{ childList: !0 }
|
1019
|
-
),
|
1027
|
+
), sn(() => {
|
1020
1028
|
if (a) {
|
1021
1029
|
const u = a(i, c.value || "");
|
1022
1030
|
u != null && o && (o.title = u);
|
1023
1031
|
}
|
1024
1032
|
}), c;
|
1025
1033
|
}
|
1026
|
-
const
|
1034
|
+
const de = te({
|
1027
1035
|
name: "VtjPageContainer",
|
1028
1036
|
async setup() {
|
1029
|
-
const
|
1030
|
-
return
|
1031
|
-
provider:
|
1037
|
+
const s = xe(), e = we(), t = e.params.id, n = t ? s.getPage(t) : s.getHomepage(), r = n ? await s.getRenderComponent(n.id) : null, o = M(Symbol());
|
1038
|
+
return n && (Object.assign(e.meta, n.meta || {}, { cache: n.cache }), dn(n.title || "VTJ")), {
|
1039
|
+
provider: s,
|
1032
1040
|
component: r,
|
1033
|
-
file:
|
1041
|
+
file: n,
|
1034
1042
|
query: e.query,
|
1035
1043
|
meta: e.meta,
|
1036
1044
|
sid: o,
|
@@ -1038,28 +1046,28 @@ const pe = te({
|
|
1038
1046
|
};
|
1039
1047
|
},
|
1040
1048
|
render() {
|
1041
|
-
const { component:
|
1042
|
-
return
|
1049
|
+
const { component: s, query: e, sid: t } = this;
|
1050
|
+
return s ? W(s, { ...e, key: t }) : W("div", "页面不存在");
|
1043
1051
|
},
|
1044
1052
|
activated() {
|
1045
1053
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1046
1054
|
}
|
1047
|
-
}),
|
1055
|
+
}), pn = {
|
1048
1056
|
"data-l-h6o7ki7": "",
|
1049
1057
|
class: "vtj-startup__wrapper"
|
1050
|
-
},
|
1058
|
+
}, fn = {
|
1051
1059
|
"data-l-h6o7ki7": "",
|
1052
1060
|
class: "vtj-startup"
|
1053
|
-
},
|
1061
|
+
}, hn = {
|
1054
1062
|
"data-l-h6o7ki7": "",
|
1055
1063
|
class: "vtj-startup__name"
|
1056
|
-
},
|
1064
|
+
}, mn = { "data-l-h6o7ki7": "" }, gn = {
|
1057
1065
|
"data-l-h6o7ki7": "",
|
1058
1066
|
class: "vtj-startup__tagline"
|
1059
|
-
},
|
1067
|
+
}, vn = {
|
1060
1068
|
"data-l-h6o7ki7": "",
|
1061
1069
|
class: "vtj-startup__actions"
|
1062
|
-
},
|
1070
|
+
}, yn = /* @__PURE__ */ te({
|
1063
1071
|
__name: "Startup",
|
1064
1072
|
props: {
|
1065
1073
|
name: { default: "VTJ.PRO" },
|
@@ -1067,7 +1075,7 @@ const pe = te({
|
|
1067
1075
|
actionText: { default: "开始设计" },
|
1068
1076
|
link: {}
|
1069
1077
|
},
|
1070
|
-
setup(
|
1078
|
+
setup(s) {
|
1071
1079
|
((r, o) => {
|
1072
1080
|
let a = document.getElementById("h6o7ki7");
|
1073
1081
|
a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML = o);
|
@@ -1151,7 +1159,7 @@ const pe = te({
|
|
1151
1159
|
.vtj-startup__actions .button[data-l-h6o7ki7]:hover{
|
1152
1160
|
opacity: 0.7;
|
1153
1161
|
}`);
|
1154
|
-
const t =
|
1162
|
+
const t = s, n = () => {
|
1155
1163
|
if (typeof window < "u") {
|
1156
1164
|
if (t.link) {
|
1157
1165
|
typeof t.link == "function" ? t.link() : window.location.href = t.link;
|
@@ -1161,39 +1169,39 @@ const pe = te({
|
|
1161
1169
|
window.location.href = o;
|
1162
1170
|
}
|
1163
1171
|
};
|
1164
|
-
return (r, o) => (et(), Ze("div",
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1172
|
+
return (r, o) => (et(), Ze("div", pn, [
|
1173
|
+
k("div", fn, [
|
1174
|
+
k("h1", hn, [
|
1175
|
+
k("span", mn, J(t.name), 1)
|
1168
1176
|
]),
|
1169
|
-
|
1170
|
-
|
1171
|
-
o[0] || (o[0] =
|
1177
|
+
k("div", gn, J(t.tagline), 1),
|
1178
|
+
k("div", vn, [
|
1179
|
+
o[0] || (o[0] = k("span", {
|
1172
1180
|
"data-l-h6o7ki7": "",
|
1173
1181
|
class: "span"
|
1174
1182
|
}, "设置项目主页后,将替换此页面显示", -1)),
|
1175
|
-
|
1183
|
+
k("span", {
|
1176
1184
|
"data-l-h6o7ki7": "",
|
1177
1185
|
class: "button",
|
1178
|
-
onClick:
|
1186
|
+
onClick: n
|
1179
1187
|
}, J(t.actionText), 1)
|
1180
1188
|
])
|
1181
1189
|
])
|
1182
1190
|
]));
|
1183
1191
|
}
|
1184
|
-
}),
|
1192
|
+
}), _n = te({
|
1185
1193
|
name: "VtjStartupContainer",
|
1186
1194
|
render() {
|
1187
|
-
return W(
|
1195
|
+
return W(yn);
|
1188
1196
|
}
|
1189
1197
|
}), Pe = Symbol("Provider");
|
1190
|
-
var
|
1191
|
-
class
|
1198
|
+
var wn = /* @__PURE__ */ ((s) => (s.Production = "production", s.Development = "development", s))(wn || {});
|
1199
|
+
class Sn extends Ie {
|
1192
1200
|
constructor(e) {
|
1193
1201
|
super(), this.options = e;
|
1194
1202
|
const {
|
1195
1203
|
service: t,
|
1196
|
-
mode:
|
1204
|
+
mode: n = y.Raw,
|
1197
1205
|
dependencies: r,
|
1198
1206
|
materials: o,
|
1199
1207
|
project: a = {},
|
@@ -1202,14 +1210,12 @@ class ws extends Me {
|
|
1202
1210
|
modules: l = {},
|
1203
1211
|
router: f = null,
|
1204
1212
|
materialPath: u = "./",
|
1205
|
-
nodeEnv:
|
1213
|
+
nodeEnv: d = "development"
|
1206
1214
|
/* Development */
|
1207
1215
|
} = e;
|
1208
|
-
this.mode =
|
1216
|
+
this.mode = n, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = d, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
|
1209
1217
|
const { access: h, request: m } = this.adapter;
|
1210
|
-
h && h.connect({ mode:
|
1211
|
-
timeout: "50-500"
|
1212
|
-
});
|
1218
|
+
h && h.connect({ mode: n, router: f, request: m }), a && n !== y.Design ? this.load(a) : this.project = a;
|
1213
1219
|
}
|
1214
1220
|
mode;
|
1215
1221
|
globals = {};
|
@@ -1228,35 +1234,41 @@ class ws extends Me {
|
|
1228
1234
|
urlDslCaches = {};
|
1229
1235
|
createMock(e) {
|
1230
1236
|
return async (...t) => {
|
1231
|
-
let
|
1237
|
+
let n = {};
|
1232
1238
|
if (e)
|
1233
1239
|
try {
|
1234
|
-
|
1235
|
-
} catch (
|
1236
|
-
|
1240
|
+
n = await e.apply(e, t);
|
1241
|
+
} catch (o) {
|
1242
|
+
P.warn("模拟数据模版异常", o);
|
1237
1243
|
}
|
1238
|
-
return
|
1244
|
+
return A()?.mock(n);
|
1239
1245
|
};
|
1240
1246
|
}
|
1241
1247
|
async load(e) {
|
1242
1248
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1243
1249
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1244
1250
|
throw new Error("project is null");
|
1245
|
-
const { apis:
|
1246
|
-
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.apis = St(
|
1251
|
+
const { apis: n = [], meta: r = [] } = this.project, o = window;
|
1252
|
+
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.initMock(o), this.apis = St(n, r, this.adapter), $e(), bt(n), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1253
|
+
}
|
1254
|
+
initMock(e) {
|
1255
|
+
const t = A(e);
|
1256
|
+
t && t.setup({
|
1257
|
+
timeout: "50-500"
|
1258
|
+
});
|
1247
1259
|
}
|
1248
1260
|
async loadDependencies(e) {
|
1249
1261
|
const t = Object.entries(this.dependencies);
|
1250
|
-
for (const [
|
1251
|
-
e[
|
1262
|
+
for (const [n, r] of t)
|
1263
|
+
e[n] || (e[n] = this.library[n] = await r());
|
1252
1264
|
}
|
1253
1265
|
async loadAssets(e) {
|
1254
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
1266
|
+
const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1255
1267
|
libraryExports: c,
|
1256
1268
|
libraryMap: l,
|
1257
1269
|
materials: f,
|
1258
1270
|
materialExports: u,
|
1259
|
-
materialMapLibrary:
|
1271
|
+
materialMapLibrary: d
|
1260
1272
|
} = ct(
|
1261
1273
|
t,
|
1262
1274
|
a,
|
@@ -1264,86 +1276,86 @@ class ws extends Me {
|
|
1264
1276
|
/* Development */
|
1265
1277
|
);
|
1266
1278
|
for (const h of c) {
|
1267
|
-
const m =
|
1268
|
-
if (
|
1269
|
-
r[h] =
|
1279
|
+
const m = n[h], p = e[h];
|
1280
|
+
if (p)
|
1281
|
+
r[h] = p;
|
1270
1282
|
else if (m)
|
1271
1283
|
e[h] = r[h] = await m();
|
1272
1284
|
else {
|
1273
1285
|
const w = l[h] || [];
|
1274
1286
|
for (const g of w)
|
1275
|
-
|
1287
|
+
ne(g) && await ut(h, R.append(g, { v: x })), se(g) && await ce(R.append(g, { v: x }));
|
1276
1288
|
r[h] = e[h];
|
1277
1289
|
}
|
1278
1290
|
}
|
1279
1291
|
if (i === "development") {
|
1280
1292
|
for (const m of f)
|
1281
|
-
await ce(
|
1293
|
+
await ce(R.append(m, { v: x }));
|
1282
1294
|
const h = this.materials || {};
|
1283
1295
|
for (const m of u) {
|
1284
|
-
const
|
1296
|
+
const p = e[d[m]], w = De[m];
|
1285
1297
|
if (w)
|
1286
|
-
|
1287
|
-
o[g] =
|
1298
|
+
p && w.forEach((g) => {
|
1299
|
+
o[g] = p[g];
|
1288
1300
|
});
|
1289
1301
|
else {
|
1290
1302
|
const g = h[m] ? (await h[m]()).default : e[m];
|
1291
|
-
g &&
|
1292
|
-
o[S.name] = lt(S,
|
1303
|
+
g && p && (g.components || []).forEach((S) => {
|
1304
|
+
o[S.name] = lt(S, p);
|
1293
1305
|
});
|
1294
1306
|
}
|
1295
1307
|
}
|
1296
1308
|
}
|
1297
1309
|
}
|
1298
1310
|
initRouter() {
|
1299
|
-
const { router: e, project: t, options:
|
1311
|
+
const { router: e, project: t, options: n, adapter: r } = this;
|
1300
1312
|
if (!e) return;
|
1301
|
-
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } =
|
1313
|
+
const { routeAppendTo: o, pageRouteName: a = "page", routeMeta: i } = n, c = o ? "" : "/", l = {
|
1302
1314
|
path: `${c}${a}/:id`,
|
1303
|
-
name:
|
1304
|
-
component:
|
1315
|
+
name: C,
|
1316
|
+
component: de
|
1305
1317
|
}, f = {
|
1306
1318
|
path: c,
|
1307
1319
|
name: H,
|
1308
|
-
component: t?.homepage ?
|
1320
|
+
component: t?.homepage ? de : r.startupComponent || _n,
|
1309
1321
|
meta: i
|
1310
1322
|
};
|
1311
|
-
e.hasRoute(
|
1323
|
+
e.hasRoute(C) && e.removeRoute(C), e.hasRoute(H) && e.removeRoute(H), o ? (e.addRoute(o, l), e.addRoute(o, f)) : (e.addRoute(l), e.addRoute(f));
|
1312
1324
|
}
|
1313
1325
|
install(e) {
|
1314
1326
|
const t = e.config.globalProperties.installed || {};
|
1315
|
-
for (const [
|
1316
|
-
!t[
|
1317
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Pe, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (
|
1318
|
-
const a = r?.$options.name, i = typeof
|
1327
|
+
for (const [n, r] of Object.entries(this.library))
|
1328
|
+
!t[n] && ft(r) && (e.use(r), t[n] = !0);
|
1329
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Pe, this), e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (n, r, o) => {
|
1330
|
+
const a = r?.$options.name, i = typeof n == "string" ? n : n?.message || n?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1319
1331
|
console.error(
|
1320
1332
|
"[VTJ Error]:",
|
1321
1333
|
{
|
1322
|
-
err:
|
1334
|
+
err: n,
|
1323
1335
|
instance: r,
|
1324
1336
|
info: o
|
1325
1337
|
},
|
1326
|
-
|
1338
|
+
n?.stack
|
1327
1339
|
), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
|
1328
1340
|
});
|
1329
1341
|
}
|
1330
1342
|
getFile(e) {
|
1331
1343
|
const { blocks: t = [] } = this.project || {};
|
1332
|
-
return this.getPage(e) || t.find((
|
1344
|
+
return this.getPage(e) || t.find((n) => n.id === e) || null;
|
1333
1345
|
}
|
1334
1346
|
getPage(e) {
|
1335
|
-
const { pages: t = [] } = this.project || {},
|
1347
|
+
const { pages: t = [] } = this.project || {}, n = (r, o = []) => {
|
1336
1348
|
for (const a of o) {
|
1337
1349
|
if (a.id === r)
|
1338
1350
|
return a;
|
1339
1351
|
if (a.children && a.children.length) {
|
1340
|
-
const i =
|
1352
|
+
const i = n(r, a.children);
|
1341
1353
|
if (i)
|
1342
1354
|
return i;
|
1343
1355
|
}
|
1344
1356
|
}
|
1345
1357
|
};
|
1346
|
-
return
|
1358
|
+
return n(e, t) || null;
|
1347
1359
|
}
|
1348
1360
|
getHomepage() {
|
1349
1361
|
const { homepage: e } = this.project || {};
|
@@ -1362,14 +1374,14 @@ class ws extends Me {
|
|
1362
1374
|
validSuccess: !1,
|
1363
1375
|
originResponse: !0
|
1364
1376
|
}
|
1365
|
-
}).then((
|
1377
|
+
}).then((n) => n.data).catch(() => null));
|
1366
1378
|
}
|
1367
1379
|
createDslRenderer(e, t = {}) {
|
1368
|
-
const { library:
|
1380
|
+
const { library: n, components: r, mode: o, apis: a } = this, i = {
|
1369
1381
|
mode: o,
|
1370
|
-
Vue:
|
1382
|
+
Vue: n.Vue,
|
1371
1383
|
components: r,
|
1372
|
-
libs:
|
1384
|
+
libs: n,
|
1373
1385
|
apis: a,
|
1374
1386
|
window,
|
1375
1387
|
...t
|
@@ -1385,42 +1397,42 @@ class ws extends Me {
|
|
1385
1397
|
});
|
1386
1398
|
}
|
1387
1399
|
async getRenderComponent(e, t) {
|
1388
|
-
const
|
1389
|
-
if (!
|
1390
|
-
return
|
1391
|
-
t && t(
|
1400
|
+
const n = this.getFile(e);
|
1401
|
+
if (!n)
|
1402
|
+
return P.warn(`Can not find file: ${e}`), null;
|
1403
|
+
t && t(n);
|
1392
1404
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1393
1405
|
if (o)
|
1394
1406
|
return (await o())?.default;
|
1395
|
-
const a = await this.getDsl(
|
1396
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1407
|
+
const a = await this.getDsl(n.id);
|
1408
|
+
return a ? this.createDslRenderer(a).renderer : (P.warn(`Can not find dsl: ${e}`), null);
|
1397
1409
|
}
|
1398
1410
|
defineUrlSchemaComponent(e, t) {
|
1399
1411
|
return le(async () => {
|
1400
|
-
const
|
1401
|
-
return
|
1412
|
+
const n = await this.getDslByUrl(e);
|
1413
|
+
return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
|
1402
1414
|
});
|
1403
1415
|
}
|
1404
1416
|
definePluginComponent(e) {
|
1405
|
-
return le(async () => await
|
1417
|
+
return le(async () => await ke(e, window));
|
1406
1418
|
}
|
1407
1419
|
}
|
1408
|
-
function
|
1409
|
-
const e = new
|
1420
|
+
function Dn(s) {
|
1421
|
+
const e = new Sn(s);
|
1410
1422
|
return {
|
1411
1423
|
provider: e,
|
1412
|
-
onReady: (
|
1424
|
+
onReady: (n) => e.ready(n)
|
1413
1425
|
};
|
1414
1426
|
}
|
1415
|
-
function xe(
|
1427
|
+
function xe(s = {}) {
|
1416
1428
|
const e = ge(Pe);
|
1417
1429
|
if (!e)
|
1418
1430
|
throw new Error("Can not find provider");
|
1419
1431
|
if (e.nodeEnv === "development") {
|
1420
|
-
const { id: t, version:
|
1421
|
-
t &&
|
1432
|
+
const { id: t, version: n } = s;
|
1433
|
+
t && n && (async () => {
|
1422
1434
|
const r = await e.getDsl(t);
|
1423
|
-
r?.__VERSION__ !==
|
1435
|
+
r?.__VERSION__ !== n && e.adapter.notify && e.adapter.notify(
|
1424
1436
|
`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
|
1425
1437
|
"版本不一致",
|
1426
1438
|
"warning"
|
@@ -1434,30 +1446,30 @@ const Ce = {
|
|
1434
1446
|
validSuccess: !0,
|
1435
1447
|
originResponse: !1,
|
1436
1448
|
failMessage: !0,
|
1437
|
-
validate: (
|
1438
|
-
},
|
1449
|
+
validate: (s) => s.data?.code === 0
|
1450
|
+
}, bn = (s, e = "/__vtj__/api/:type.json") => (t, n, r) => s.send({
|
1439
1451
|
url: e,
|
1440
1452
|
method: "post",
|
1441
1453
|
params: { type: t },
|
1442
1454
|
query: r,
|
1443
1455
|
data: {
|
1444
1456
|
type: t,
|
1445
|
-
data:
|
1457
|
+
data: n
|
1446
1458
|
},
|
1447
1459
|
settings: Ce
|
1448
|
-
}),
|
1460
|
+
}), jn = (s, e = "/__vtj__/api/uploader.json") => async (t, n) => await s.send({
|
1449
1461
|
url: e,
|
1450
1462
|
method: "post",
|
1451
1463
|
data: {
|
1452
1464
|
files: t,
|
1453
|
-
projectId:
|
1465
|
+
projectId: n
|
1454
1466
|
},
|
1455
1467
|
settings: {
|
1456
1468
|
...Ce,
|
1457
1469
|
type: "data"
|
1458
1470
|
}
|
1459
1471
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1460
|
-
function
|
1472
|
+
function Hn(s) {
|
1461
1473
|
return he({
|
1462
1474
|
settings: {
|
1463
1475
|
type: "json",
|
@@ -1466,7 +1478,7 @@ function Hs(n) {
|
|
1466
1478
|
failMessage: !0,
|
1467
1479
|
validate: (e) => e.data?.code === 0,
|
1468
1480
|
showError: (e) => {
|
1469
|
-
|
1481
|
+
s && s(e || "未知错误");
|
1470
1482
|
}
|
1471
1483
|
}
|
1472
1484
|
});
|
@@ -1476,7 +1488,7 @@ class re {
|
|
1476
1488
|
pluginCaches = {};
|
1477
1489
|
uploader;
|
1478
1490
|
constructor(e = K) {
|
1479
|
-
this.api =
|
1491
|
+
this.api = bn(e), this.uploader = jn(e);
|
1480
1492
|
}
|
1481
1493
|
async getExtension() {
|
1482
1494
|
console.log("BaseService.getExtension");
|
@@ -1551,11 +1563,11 @@ class re {
|
|
1551
1563
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1552
1564
|
}
|
1553
1565
|
async getPluginMaterial(e) {
|
1554
|
-
const { urls: t = [] } = e,
|
1555
|
-
if (!
|
1556
|
-
const r = this.pluginCaches[
|
1557
|
-
return r || (this.pluginCaches[
|
1558
|
-
url:
|
1566
|
+
const { urls: t = [] } = e, n = t.filter((o) => it(o))[0];
|
1567
|
+
if (!n) return null;
|
1568
|
+
const r = this.pluginCaches[n];
|
1569
|
+
return r || (this.pluginCaches[n] = K.send({
|
1570
|
+
url: n,
|
1559
1571
|
method: "get",
|
1560
1572
|
settings: {
|
1561
1573
|
validSuccess: !1,
|
@@ -1572,9 +1584,9 @@ const v = new ze({
|
|
1572
1584
|
expired: 0,
|
1573
1585
|
prefix: "__VTJ_"
|
1574
1586
|
});
|
1575
|
-
class
|
1587
|
+
class On extends re {
|
1576
1588
|
init(e) {
|
1577
|
-
const t = new O(e),
|
1589
|
+
const t = new O(e), n = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), n || {});
|
1578
1590
|
return v.save(`project_${t.id}`, r), Promise.resolve(r);
|
1579
1591
|
}
|
1580
1592
|
saveProject(e) {
|
@@ -1606,30 +1618,30 @@ class Os extends re {
|
|
1606
1618
|
return Promise.resolve(!0);
|
1607
1619
|
}
|
1608
1620
|
getHistory(e) {
|
1609
|
-
const t = v.get(`history_${e}`),
|
1610
|
-
return Promise.resolve(
|
1621
|
+
const t = v.get(`history_${e}`), n = new pe(t || { id: e });
|
1622
|
+
return Promise.resolve(n.toDsl());
|
1611
1623
|
}
|
1612
1624
|
getHistoryItem(e, t) {
|
1613
|
-
const
|
1614
|
-
return Promise.resolve(
|
1625
|
+
const n = v.get(`history_${e}_${t}`);
|
1626
|
+
return Promise.resolve(n);
|
1615
1627
|
}
|
1616
1628
|
saveHistoryItem(e, t) {
|
1617
1629
|
return v.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1618
1630
|
}
|
1619
1631
|
removeHistoryItem(e, t) {
|
1620
|
-
return t.forEach((
|
1621
|
-
v.remove(`history_${e}_${
|
1632
|
+
return t.forEach((n) => {
|
1633
|
+
v.remove(`history_${e}_${n}`);
|
1622
1634
|
}), Promise.resolve(!0);
|
1623
1635
|
}
|
1624
1636
|
}
|
1625
|
-
class
|
1637
|
+
class $n extends re {
|
1626
1638
|
projects = {};
|
1627
1639
|
materials = {};
|
1628
1640
|
files = {};
|
1629
1641
|
histories = {};
|
1630
1642
|
historyItems = {};
|
1631
1643
|
init(e) {
|
1632
|
-
const t = new O(e),
|
1644
|
+
const t = new O(e), n = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), n);
|
1633
1645
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1634
1646
|
}
|
1635
1647
|
saveProject(e) {
|
@@ -1661,29 +1673,29 @@ class js extends re {
|
|
1661
1673
|
return Promise.resolve(!0);
|
1662
1674
|
}
|
1663
1675
|
getHistory(e) {
|
1664
|
-
const t = this.histories[e],
|
1665
|
-
return Promise.resolve(
|
1676
|
+
const t = this.histories[e], n = new pe(t || { id: e });
|
1677
|
+
return Promise.resolve(n);
|
1666
1678
|
}
|
1667
1679
|
getHistoryItem(e, t) {
|
1668
|
-
const
|
1680
|
+
const n = `${e}_${t}`, r = this.historyItems[n] || {};
|
1669
1681
|
return Promise.resolve(r);
|
1670
1682
|
}
|
1671
1683
|
saveHistoryItem(e, t) {
|
1672
|
-
const
|
1673
|
-
return this.historyItems[
|
1684
|
+
const n = `${e}_${t.id}`;
|
1685
|
+
return this.historyItems[n] = t, Promise.resolve(!0);
|
1674
1686
|
}
|
1675
1687
|
removeHistoryItem(e, t) {
|
1676
|
-
return t.forEach((
|
1677
|
-
const r = `${e}_${
|
1688
|
+
return t.forEach((n) => {
|
1689
|
+
const r = `${e}_${n}`;
|
1678
1690
|
delete this.historyItems[r];
|
1679
1691
|
}), Promise.resolve(!0);
|
1680
1692
|
}
|
1681
1693
|
}
|
1682
1694
|
let D = null;
|
1683
|
-
function
|
1684
|
-
return D || (D = new
|
1695
|
+
function Bn() {
|
1696
|
+
return D || (D = new $n(), D);
|
1685
1697
|
}
|
1686
|
-
class
|
1698
|
+
class Nn extends re {
|
1687
1699
|
getFileCaches = {};
|
1688
1700
|
async getExtension() {
|
1689
1701
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1740,48 +1752,48 @@ class Ns extends re {
|
|
1740
1752
|
);
|
1741
1753
|
}
|
1742
1754
|
}
|
1743
|
-
function
|
1744
|
-
return t.map((
|
1745
|
-
const { id: r, title: o, icon: a, children: i, hidden: c } =
|
1755
|
+
function Me(s, e, t = []) {
|
1756
|
+
return t.map((n) => {
|
1757
|
+
const { id: r, title: o, icon: a, children: i, hidden: c } = n;
|
1746
1758
|
return {
|
1747
1759
|
id: r,
|
1748
1760
|
title: o,
|
1749
1761
|
icon: a,
|
1750
1762
|
hidden: c,
|
1751
|
-
url: `${
|
1752
|
-
children: i && i.length ?
|
1763
|
+
url: `${s}/${e}/${r}`,
|
1764
|
+
children: i && i.length ? Me(s, e, i) : void 0
|
1753
1765
|
};
|
1754
1766
|
});
|
1755
1767
|
}
|
1756
|
-
function
|
1757
|
-
if (!e) return
|
1768
|
+
function Ae(s, e) {
|
1769
|
+
if (!e) return s;
|
1758
1770
|
let t = [];
|
1759
|
-
for (const
|
1760
|
-
if (
|
1761
|
-
const r =
|
1762
|
-
r.length && (
|
1771
|
+
for (const n of s)
|
1772
|
+
if (n.children && n.children.length) {
|
1773
|
+
const r = Ae(n.children, e);
|
1774
|
+
r.length && (n.children = r, t.push(n));
|
1763
1775
|
} else
|
1764
|
-
e.can(
|
1776
|
+
e.can(n.id.toString()) && t.push(n);
|
1765
1777
|
return t;
|
1766
1778
|
}
|
1767
|
-
function
|
1779
|
+
function Un(s) {
|
1768
1780
|
const {
|
1769
1781
|
menuPathPrefix: e = "",
|
1770
1782
|
pageRouteName: t = "page",
|
1771
|
-
disableMenusFilter:
|
1772
|
-
} =
|
1783
|
+
disableMenusFilter: n = !1
|
1784
|
+
} = s || {}, r = xe(), o = we(), a = yt(), i = M(!1), c = M(!1), l = r.project;
|
1773
1785
|
tt(() => {
|
1774
|
-
const { name:
|
1775
|
-
if (
|
1776
|
-
const
|
1777
|
-
i.value = !
|
1778
|
-
} else if (
|
1779
|
-
const
|
1780
|
-
i.value = !
|
1786
|
+
const { name: d, params: h, meta: m } = o;
|
1787
|
+
if (d === C) {
|
1788
|
+
const p = r.getPage(h.id);
|
1789
|
+
i.value = !p?.mask, c.value = !!p?.pure;
|
1790
|
+
} else if (d === H) {
|
1791
|
+
const p = r.getHomepage();
|
1792
|
+
i.value = !p?.mask, c.value = !!p?.pure;
|
1781
1793
|
} else
|
1782
1794
|
i.value = !m.mask, c.value = !!m.pure;
|
1783
1795
|
});
|
1784
|
-
const f =
|
1796
|
+
const f = Me(
|
1785
1797
|
e,
|
1786
1798
|
t,
|
1787
1799
|
l?.pages
|
@@ -1791,75 +1803,76 @@ function Us(n) {
|
|
1791
1803
|
logo: u?.logo,
|
1792
1804
|
themeSwitchable: u?.themeSwitchable,
|
1793
1805
|
title: u?.title || l?.description || l?.name || "VTJ App",
|
1794
|
-
menus:
|
1806
|
+
menus: n ? f : Ae(f, a),
|
1795
1807
|
pure: c
|
1796
1808
|
};
|
1797
1809
|
}
|
1798
1810
|
export {
|
1799
1811
|
je as ACCESS_KEY,
|
1800
|
-
|
1812
|
+
Fn as Access,
|
1801
1813
|
ot as BUILD_IN_TAGS,
|
1802
|
-
|
1814
|
+
nt as BUILT_IN_DIRECTIVES,
|
1803
1815
|
re as BaseService,
|
1804
1816
|
ue as CONTEXT_HOST,
|
1805
|
-
|
1817
|
+
kt as Context,
|
1806
1818
|
y as ContextMode,
|
1807
|
-
|
1819
|
+
st as DATA_TYPES,
|
1808
1820
|
H as HOMEPAGE_ROUTE_NAME,
|
1809
1821
|
rt as HTML_TAGS,
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1822
|
+
An as JSCodeToString,
|
1823
|
+
xn as LIFE_CYCLES_LIST,
|
1824
|
+
Nn as LocalService,
|
1825
|
+
$n as MemoryService,
|
1826
|
+
wn as NodeEnv,
|
1827
|
+
C as PAGE_ROUTE_NAME,
|
1828
|
+
Sn as Provider,
|
1829
|
+
yn as Startup,
|
1830
|
+
On as StorageService,
|
1831
|
+
x as VTJ_RENDERER_VERSION,
|
1820
1832
|
be as adoptedStyleSheets,
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1833
|
+
In as clearLoaderCache,
|
1834
|
+
Tn as createAdapter,
|
1835
|
+
Cn as createAssetScripts,
|
1836
|
+
Mn as createAssetsCss,
|
1837
|
+
At as createDataSources,
|
1826
1838
|
Q as createLoader,
|
1827
|
-
|
1839
|
+
Bn as createMemoryService,
|
1828
1840
|
wt as createMetaApi,
|
1829
1841
|
jt as createMock,
|
1830
|
-
|
1842
|
+
Dn as createProvider,
|
1831
1843
|
Y as createRenderer,
|
1832
1844
|
_t as createSchemaApi,
|
1833
1845
|
St as createSchemaApis,
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
Ee as
|
1846
|
+
Hn as createServiceRequest,
|
1847
|
+
It as defaultLoader,
|
1848
|
+
I as fillBasePath,
|
1849
|
+
A as getMock,
|
1850
|
+
Ee as getModifiers,
|
1851
|
+
ke as getPlugin,
|
1839
1852
|
lt as getRawComponent,
|
1840
1853
|
ht as isBuiltInTag,
|
1841
|
-
|
1854
|
+
ne as isCSSUrl,
|
1842
1855
|
gt as isJSCode,
|
1843
1856
|
_ as isJSExpression,
|
1844
|
-
|
1857
|
+
T as isJSFunction,
|
1845
1858
|
it as isJSON,
|
1846
|
-
|
1859
|
+
se as isJSUrl,
|
1847
1860
|
mt as isNativeTag,
|
1848
1861
|
ft as isVuePlugin,
|
1849
1862
|
ut as loadCss,
|
1850
|
-
|
1851
|
-
|
1863
|
+
dt as loadCssUrl,
|
1864
|
+
pt as loadScriptUrl,
|
1852
1865
|
$t as mockApi,
|
1853
1866
|
bt as mockApis,
|
1854
1867
|
$e as mockCleanup,
|
1855
1868
|
B as nodeRender,
|
1856
1869
|
ct as parseDeps,
|
1857
|
-
|
1870
|
+
F as parseExpression,
|
1858
1871
|
G as parseFunction,
|
1859
1872
|
Pe as providerKey,
|
1860
1873
|
at as removeProdFlag,
|
1861
1874
|
Se as toString,
|
1862
1875
|
yt as useAccess,
|
1863
|
-
|
1876
|
+
Un as useMask,
|
1864
1877
|
xe as useProvider
|
1865
1878
|
};
|