@vtj/renderer 0.10.1-alpha.1 → 0.10.1-alpha.3
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 +8 -6
- package/dist/index.mjs +539 -520
- 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 de } 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.3
|
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.3";
|
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
|
84
|
+
function ct(s, e, t = !1) {
|
85
|
+
const n = s.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
|
86
|
+
return n.forEach(
|
88
87
|
({ urls: p, assetsUrl: h, library: m, assetsLibrary: d, localeLibrary: w }) => {
|
89
88
|
p?.forEach((g) => {
|
90
|
-
|
91
|
-
}), m && (i.push(m), c[m] =
|
89
|
+
se(g) && r.push(at(g, t)), ne(g) && o.push(g);
|
90
|
+
}), m && (i.push(m), c[m] = I(p || [], e), w && (l[m] = w)), h && a.push(h), d && f.push(d), m && d && (u[d] = m);
|
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 pt(
|
131
|
-
const t = e.document,
|
132
|
-
for (const r of
|
129
|
+
function pt(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 dt(
|
139
|
-
const
|
137
|
+
async function dt(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,11 +580,11 @@ 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 p = xt(e, i.value.computed ?? {}, l), h = Ct(i.value.methods ?? {}, l), m =
|
587
|
+
const p = xt(e, i.value.computed ?? {}, l), h = Ct(i.value.methods ?? {}, l), m = Mt(e, i.value.inject, l), d = At(
|
580
588
|
i.value.dataSources || {},
|
581
589
|
l
|
582
590
|
), w = {
|
@@ -585,88 +593,88 @@ function Y(n) {
|
|
585
593
|
...h,
|
586
594
|
...d
|
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
605
|
return u.length === 1 ? B(u[0], l, e, a) : u.map((p) => B(p, 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 && pt(o, e), await dt(r,
|
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 && pt(o, e), await dt(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: p, others: h } = Ht(a);
|
757
765
|
if (i && !Ot(i, e))
|
758
766
|
return null;
|
759
767
|
const m = (d) => {
|
760
768
|
const w = d.$components, g = (() => {
|
761
|
-
if (
|
762
|
-
return Bt(d,
|
763
|
-
if (
|
764
|
-
const b = s
|
769
|
+
if (s.name === "component")
|
770
|
+
return Bt(d, 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,
|
774
|
+
})(), S = Nt(o, s.props ?? {}, d), Fe = Ut(t, s.events ?? {}, d);
|
775
|
+
if (s.name === "slot")
|
776
|
+
return Lt(t, s, S, d, n);
|
769
777
|
u && Object.assign(S, d.__parseExpression(u.value)), l && (S.style = Object.assign(
|
770
778
|
S.style ?? {},
|
771
779
|
Jt(l, d)
|
772
780
|
)), p && Object.assign(S, zt(p, d)), f.forEach((b) => {
|
773
781
|
Object.assign(S, Vt(t, b, d));
|
774
782
|
});
|
775
|
-
const
|
783
|
+
const Te = Kt(
|
776
784
|
t,
|
777
|
-
|
785
|
+
s.children ?? [],
|
778
786
|
d,
|
779
|
-
|
780
|
-
|
787
|
+
n,
|
788
|
+
s
|
781
789
|
);
|
782
|
-
let U = t.createVNode(g, { ...S, ...
|
790
|
+
let U = t.createVNode(g, { ...S, ...Fe }, Te);
|
783
791
|
const oe = r ? Dt(r, h, d) : [];
|
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((p) => n.includes(p)), 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 };
|
@@ -901,81 +909,81 @@ function Kt(n, e, t, s, r) {
|
|
901
909
|
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
|
902
910
|
const p = f.length ? Je(u ?? {}, f) : a(u);
|
903
911
|
return l.map(
|
904
|
-
(h) => B(h, t.__clone(p),
|
912
|
+
(h) => B(h, t.__clone(p), 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 p = ee(
|
986
|
+
const p = ee(s), h = tn(p).map(an).filter(Xt);
|
979
987
|
return new Set(h);
|
980
988
|
}), l = ye(
|
981
989
|
() => c.value,
|
@@ -992,12 +1000,12 @@ function ls(n, e, t = {}) {
|
|
992
1000
|
takeRecords: f
|
993
1001
|
};
|
994
1002
|
}
|
995
|
-
function
|
996
|
-
var t,
|
1003
|
+
function pn(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;
|
@@ -1010,13 +1018,13 @@ function us(n = null, e = {}) {
|
|
1010
1018
|
u !== p && 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);
|
@@ -1026,11 +1034,11 @@ function us(n = null, e = {}) {
|
|
1026
1034
|
const pe = 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 }), pn(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
|
+
}), dn = {
|
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);
|
@@ -1080,6 +1088,7 @@ const pe = te({
|
|
1080
1088
|
grid-row: 1;
|
1081
1089
|
width: 100%;
|
1082
1090
|
max-width: 800px;
|
1091
|
+
margin: 0 10px;
|
1083
1092
|
}
|
1084
1093
|
.vtj-startup__wrapper[data-l-h6o7ki7]{
|
1085
1094
|
height: 100%;
|
@@ -1141,6 +1150,7 @@ const pe = te({
|
|
1141
1150
|
cursor: pointer;
|
1142
1151
|
display: inline-block;
|
1143
1152
|
line-height: 40px;
|
1153
|
+
text-align: center;
|
1144
1154
|
}@media (max-width: 768px){
|
1145
1155
|
|
1146
1156
|
.vtj-startup__actions .button[data-l-h6o7ki7]{
|
@@ -1151,7 +1161,7 @@ const pe = te({
|
|
1151
1161
|
.vtj-startup__actions .button[data-l-h6o7ki7]:hover{
|
1152
1162
|
opacity: 0.7;
|
1153
1163
|
}`);
|
1154
|
-
const t =
|
1164
|
+
const t = s, n = () => {
|
1155
1165
|
if (typeof window < "u") {
|
1156
1166
|
if (t.link) {
|
1157
1167
|
typeof t.link == "function" ? t.link() : window.location.href = t.link;
|
@@ -1161,39 +1171,39 @@ const pe = te({
|
|
1161
1171
|
window.location.href = o;
|
1162
1172
|
}
|
1163
1173
|
};
|
1164
|
-
return (r, o) => (et(), Ze("div",
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1174
|
+
return (r, o) => (et(), Ze("div", dn, [
|
1175
|
+
k("div", fn, [
|
1176
|
+
k("h1", hn, [
|
1177
|
+
k("span", mn, J(t.name), 1)
|
1168
1178
|
]),
|
1169
|
-
|
1170
|
-
|
1171
|
-
o[0] || (o[0] =
|
1179
|
+
k("div", gn, J(t.tagline), 1),
|
1180
|
+
k("div", vn, [
|
1181
|
+
o[0] || (o[0] = k("span", {
|
1172
1182
|
"data-l-h6o7ki7": "",
|
1173
1183
|
class: "span"
|
1174
1184
|
}, "设置项目主页后,将替换此页面显示", -1)),
|
1175
|
-
|
1185
|
+
k("span", {
|
1176
1186
|
"data-l-h6o7ki7": "",
|
1177
1187
|
class: "button",
|
1178
|
-
onClick:
|
1188
|
+
onClick: n
|
1179
1189
|
}, J(t.actionText), 1)
|
1180
1190
|
])
|
1181
1191
|
])
|
1182
1192
|
]));
|
1183
1193
|
}
|
1184
|
-
}),
|
1194
|
+
}), _n = te({
|
1185
1195
|
name: "VtjStartupContainer",
|
1186
1196
|
render() {
|
1187
|
-
return W(
|
1197
|
+
return W(yn);
|
1188
1198
|
}
|
1189
1199
|
}), Pe = Symbol("Provider");
|
1190
|
-
var
|
1191
|
-
class
|
1200
|
+
var wn = /* @__PURE__ */ ((s) => (s.Production = "production", s.Development = "development", s))(wn || {});
|
1201
|
+
class Sn extends Ie {
|
1192
1202
|
constructor(e) {
|
1193
1203
|
super(), this.options = e;
|
1194
1204
|
const {
|
1195
1205
|
service: t,
|
1196
|
-
mode:
|
1206
|
+
mode: n = y.Raw,
|
1197
1207
|
dependencies: r,
|
1198
1208
|
materials: o,
|
1199
1209
|
project: a = {},
|
@@ -1205,11 +1215,9 @@ class ws extends Me {
|
|
1205
1215
|
nodeEnv: p = "development"
|
1206
1216
|
/* Development */
|
1207
1217
|
} = e;
|
1208
|
-
this.mode =
|
1218
|
+
this.mode = n, 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);
|
1209
1219
|
const { access: h, request: m } = this.adapter;
|
1210
|
-
h && h.connect({ mode:
|
1211
|
-
timeout: "50-500"
|
1212
|
-
});
|
1220
|
+
h && h.connect({ mode: n, router: f, request: m }), a && n !== y.Design ? this.load(a) : this.project = a;
|
1213
1221
|
}
|
1214
1222
|
mode;
|
1215
1223
|
globals = {};
|
@@ -1228,30 +1236,36 @@ class ws extends Me {
|
|
1228
1236
|
urlDslCaches = {};
|
1229
1237
|
createMock(e) {
|
1230
1238
|
return async (...t) => {
|
1231
|
-
let
|
1239
|
+
let n = {};
|
1232
1240
|
if (e)
|
1233
1241
|
try {
|
1234
|
-
|
1235
|
-
} catch (
|
1236
|
-
|
1242
|
+
n = await e.apply(e, t);
|
1243
|
+
} catch (o) {
|
1244
|
+
P.warn("模拟数据模版异常", o);
|
1237
1245
|
}
|
1238
|
-
return
|
1246
|
+
return A()?.mock(n);
|
1239
1247
|
};
|
1240
1248
|
}
|
1241
1249
|
async load(e) {
|
1242
1250
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1243
1251
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1244
1252
|
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(
|
1253
|
+
const { apis: n = [], meta: r = [] } = this.project, o = window;
|
1254
|
+
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();
|
1255
|
+
}
|
1256
|
+
initMock(e) {
|
1257
|
+
const t = A(e);
|
1258
|
+
t && t.setup({
|
1259
|
+
timeout: "50-500"
|
1260
|
+
});
|
1247
1261
|
}
|
1248
1262
|
async loadDependencies(e) {
|
1249
1263
|
const t = Object.entries(this.dependencies);
|
1250
|
-
for (const [
|
1251
|
-
e[
|
1264
|
+
for (const [n, r] of t)
|
1265
|
+
e[n] || (e[n] = this.library[n] = await r());
|
1252
1266
|
}
|
1253
1267
|
async loadAssets(e) {
|
1254
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
1268
|
+
const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1255
1269
|
libraryExports: c,
|
1256
1270
|
libraryMap: l,
|
1257
1271
|
materials: f,
|
@@ -1264,7 +1278,7 @@ class ws extends Me {
|
|
1264
1278
|
/* Development */
|
1265
1279
|
);
|
1266
1280
|
for (const h of c) {
|
1267
|
-
const m =
|
1281
|
+
const m = n[h], d = e[h];
|
1268
1282
|
if (d)
|
1269
1283
|
r[h] = d;
|
1270
1284
|
else if (m)
|
@@ -1272,13 +1286,13 @@ class ws extends Me {
|
|
1272
1286
|
else {
|
1273
1287
|
const w = l[h] || [];
|
1274
1288
|
for (const g of w)
|
1275
|
-
|
1289
|
+
ne(g) && await ut(h, R.append(g, { v: x })), se(g) && await ce(R.append(g, { v: x }));
|
1276
1290
|
r[h] = e[h];
|
1277
1291
|
}
|
1278
1292
|
}
|
1279
1293
|
if (i === "development") {
|
1280
1294
|
for (const m of f)
|
1281
|
-
await ce(
|
1295
|
+
await ce(R.append(m, { v: x }));
|
1282
1296
|
const h = this.materials || {};
|
1283
1297
|
for (const m of u) {
|
1284
1298
|
const d = e[p[m]], w = De[m];
|
@@ -1296,54 +1310,58 @@ class ws extends Me {
|
|
1296
1310
|
}
|
1297
1311
|
}
|
1298
1312
|
initRouter() {
|
1299
|
-
const { router: e, project: t, options:
|
1313
|
+
const { router: e, project: t, options: n, adapter: r } = this;
|
1300
1314
|
if (!e) return;
|
1301
|
-
const
|
1302
|
-
|
1303
|
-
|
1315
|
+
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1316
|
+
routeAppendTo: a,
|
1317
|
+
pageRouteName: i = o,
|
1318
|
+
routeMeta: c
|
1319
|
+
} = n, l = a ? "" : "/", f = {
|
1320
|
+
path: `${l}${i}/:id`,
|
1321
|
+
name: C,
|
1304
1322
|
component: pe
|
1305
|
-
},
|
1306
|
-
path:
|
1323
|
+
}, u = {
|
1324
|
+
path: l,
|
1307
1325
|
name: H,
|
1308
|
-
component: t?.homepage ? pe : r.startupComponent ||
|
1309
|
-
meta:
|
1326
|
+
component: t?.homepage ? pe : r.startupComponent || _n,
|
1327
|
+
meta: c
|
1310
1328
|
};
|
1311
|
-
e.hasRoute(
|
1329
|
+
e.hasRoute(C) && e.removeRoute(C), e.hasRoute(H) && e.removeRoute(H), a ? (e.addRoute(a, f), e.addRoute(a, u)) : (e.addRoute(f), e.addRoute(u));
|
1312
1330
|
}
|
1313
1331
|
install(e) {
|
1314
1332
|
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
|
1333
|
+
for (const [n, r] of Object.entries(this.library))
|
1334
|
+
!t[n] && ft(r) && (e.use(r), t[n] = !0);
|
1335
|
+
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) => {
|
1336
|
+
const a = r?.$options.name, i = typeof n == "string" ? n : n?.message || n?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1319
1337
|
console.error(
|
1320
1338
|
"[VTJ Error]:",
|
1321
1339
|
{
|
1322
|
-
err:
|
1340
|
+
err: n,
|
1323
1341
|
instance: r,
|
1324
1342
|
info: o
|
1325
1343
|
},
|
1326
|
-
|
1344
|
+
n?.stack
|
1327
1345
|
), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
|
1328
1346
|
});
|
1329
1347
|
}
|
1330
1348
|
getFile(e) {
|
1331
1349
|
const { blocks: t = [] } = this.project || {};
|
1332
|
-
return this.getPage(e) || t.find((
|
1350
|
+
return this.getPage(e) || t.find((n) => n.id === e) || null;
|
1333
1351
|
}
|
1334
1352
|
getPage(e) {
|
1335
|
-
const { pages: t = [] } = this.project || {},
|
1353
|
+
const { pages: t = [] } = this.project || {}, n = (r, o = []) => {
|
1336
1354
|
for (const a of o) {
|
1337
1355
|
if (a.id === r)
|
1338
1356
|
return a;
|
1339
1357
|
if (a.children && a.children.length) {
|
1340
|
-
const i =
|
1358
|
+
const i = n(r, a.children);
|
1341
1359
|
if (i)
|
1342
1360
|
return i;
|
1343
1361
|
}
|
1344
1362
|
}
|
1345
1363
|
};
|
1346
|
-
return
|
1364
|
+
return n(e, t) || null;
|
1347
1365
|
}
|
1348
1366
|
getHomepage() {
|
1349
1367
|
const { homepage: e } = this.project || {};
|
@@ -1362,14 +1380,14 @@ class ws extends Me {
|
|
1362
1380
|
validSuccess: !1,
|
1363
1381
|
originResponse: !0
|
1364
1382
|
}
|
1365
|
-
}).then((
|
1383
|
+
}).then((n) => n.data).catch(() => null));
|
1366
1384
|
}
|
1367
1385
|
createDslRenderer(e, t = {}) {
|
1368
|
-
const { library:
|
1386
|
+
const { library: n, components: r, mode: o, apis: a } = this, i = {
|
1369
1387
|
mode: o,
|
1370
|
-
Vue:
|
1388
|
+
Vue: n.Vue,
|
1371
1389
|
components: r,
|
1372
|
-
libs:
|
1390
|
+
libs: n,
|
1373
1391
|
apis: a,
|
1374
1392
|
window,
|
1375
1393
|
...t
|
@@ -1385,42 +1403,42 @@ class ws extends Me {
|
|
1385
1403
|
});
|
1386
1404
|
}
|
1387
1405
|
async getRenderComponent(e, t) {
|
1388
|
-
const
|
1389
|
-
if (!
|
1390
|
-
return
|
1391
|
-
t && t(
|
1406
|
+
const n = this.getFile(e);
|
1407
|
+
if (!n)
|
1408
|
+
return P.warn(`Can not find file: ${e}`), null;
|
1409
|
+
t && t(n);
|
1392
1410
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1393
1411
|
if (o)
|
1394
1412
|
return (await o())?.default;
|
1395
|
-
const a = await this.getDsl(
|
1396
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1413
|
+
const a = await this.getDsl(n.id);
|
1414
|
+
return a ? this.createDslRenderer(a).renderer : (P.warn(`Can not find dsl: ${e}`), null);
|
1397
1415
|
}
|
1398
1416
|
defineUrlSchemaComponent(e, t) {
|
1399
1417
|
return le(async () => {
|
1400
|
-
const
|
1401
|
-
return
|
1418
|
+
const n = await this.getDslByUrl(e);
|
1419
|
+
return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
|
1402
1420
|
});
|
1403
1421
|
}
|
1404
1422
|
definePluginComponent(e) {
|
1405
|
-
return le(async () => await
|
1423
|
+
return le(async () => await ke(e, window));
|
1406
1424
|
}
|
1407
1425
|
}
|
1408
|
-
function
|
1409
|
-
const e = new
|
1426
|
+
function Dn(s) {
|
1427
|
+
const e = new Sn(s);
|
1410
1428
|
return {
|
1411
1429
|
provider: e,
|
1412
|
-
onReady: (
|
1430
|
+
onReady: (n) => e.ready(n)
|
1413
1431
|
};
|
1414
1432
|
}
|
1415
|
-
function xe(
|
1433
|
+
function xe(s = {}) {
|
1416
1434
|
const e = ge(Pe);
|
1417
1435
|
if (!e)
|
1418
1436
|
throw new Error("Can not find provider");
|
1419
1437
|
if (e.nodeEnv === "development") {
|
1420
|
-
const { id: t, version:
|
1421
|
-
t &&
|
1438
|
+
const { id: t, version: n } = s;
|
1439
|
+
t && n && (async () => {
|
1422
1440
|
const r = await e.getDsl(t);
|
1423
|
-
r?.__VERSION__ !==
|
1441
|
+
r?.__VERSION__ !== n && e.adapter.notify && e.adapter.notify(
|
1424
1442
|
`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
|
1425
1443
|
"版本不一致",
|
1426
1444
|
"warning"
|
@@ -1434,30 +1452,30 @@ const Ce = {
|
|
1434
1452
|
validSuccess: !0,
|
1435
1453
|
originResponse: !1,
|
1436
1454
|
failMessage: !0,
|
1437
|
-
validate: (
|
1438
|
-
},
|
1455
|
+
validate: (s) => s.data?.code === 0
|
1456
|
+
}, bn = (s, e = "/__vtj__/api/:type.json") => (t, n, r) => s.send({
|
1439
1457
|
url: e,
|
1440
1458
|
method: "post",
|
1441
1459
|
params: { type: t },
|
1442
1460
|
query: r,
|
1443
1461
|
data: {
|
1444
1462
|
type: t,
|
1445
|
-
data:
|
1463
|
+
data: n
|
1446
1464
|
},
|
1447
1465
|
settings: Ce
|
1448
|
-
}),
|
1466
|
+
}), jn = (s, e = "/__vtj__/api/uploader.json") => async (t, n) => await s.send({
|
1449
1467
|
url: e,
|
1450
1468
|
method: "post",
|
1451
1469
|
data: {
|
1452
1470
|
files: t,
|
1453
|
-
projectId:
|
1471
|
+
projectId: n
|
1454
1472
|
},
|
1455
1473
|
settings: {
|
1456
1474
|
...Ce,
|
1457
1475
|
type: "data"
|
1458
1476
|
}
|
1459
1477
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1460
|
-
function
|
1478
|
+
function Hn(s) {
|
1461
1479
|
return he({
|
1462
1480
|
settings: {
|
1463
1481
|
type: "json",
|
@@ -1466,7 +1484,7 @@ function Hs(n) {
|
|
1466
1484
|
failMessage: !0,
|
1467
1485
|
validate: (e) => e.data?.code === 0,
|
1468
1486
|
showError: (e) => {
|
1469
|
-
|
1487
|
+
s && s(e || "未知错误");
|
1470
1488
|
}
|
1471
1489
|
}
|
1472
1490
|
});
|
@@ -1476,7 +1494,7 @@ class re {
|
|
1476
1494
|
pluginCaches = {};
|
1477
1495
|
uploader;
|
1478
1496
|
constructor(e = K) {
|
1479
|
-
this.api =
|
1497
|
+
this.api = bn(e), this.uploader = jn(e);
|
1480
1498
|
}
|
1481
1499
|
async getExtension() {
|
1482
1500
|
console.log("BaseService.getExtension");
|
@@ -1551,11 +1569,11 @@ class re {
|
|
1551
1569
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1552
1570
|
}
|
1553
1571
|
async getPluginMaterial(e) {
|
1554
|
-
const { urls: t = [] } = e,
|
1555
|
-
if (!
|
1556
|
-
const r = this.pluginCaches[
|
1557
|
-
return r || (this.pluginCaches[
|
1558
|
-
url:
|
1572
|
+
const { urls: t = [] } = e, n = t.filter((o) => it(o))[0];
|
1573
|
+
if (!n) return null;
|
1574
|
+
const r = this.pluginCaches[n];
|
1575
|
+
return r || (this.pluginCaches[n] = K.send({
|
1576
|
+
url: n,
|
1559
1577
|
method: "get",
|
1560
1578
|
settings: {
|
1561
1579
|
validSuccess: !1,
|
@@ -1572,9 +1590,9 @@ const v = new ze({
|
|
1572
1590
|
expired: 0,
|
1573
1591
|
prefix: "__VTJ_"
|
1574
1592
|
});
|
1575
|
-
class
|
1593
|
+
class On extends re {
|
1576
1594
|
init(e) {
|
1577
|
-
const t = new O(e),
|
1595
|
+
const t = new O(e), n = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), n || {});
|
1578
1596
|
return v.save(`project_${t.id}`, r), Promise.resolve(r);
|
1579
1597
|
}
|
1580
1598
|
saveProject(e) {
|
@@ -1606,30 +1624,30 @@ class Os extends re {
|
|
1606
1624
|
return Promise.resolve(!0);
|
1607
1625
|
}
|
1608
1626
|
getHistory(e) {
|
1609
|
-
const t = v.get(`history_${e}`),
|
1610
|
-
return Promise.resolve(
|
1627
|
+
const t = v.get(`history_${e}`), n = new de(t || { id: e });
|
1628
|
+
return Promise.resolve(n.toDsl());
|
1611
1629
|
}
|
1612
1630
|
getHistoryItem(e, t) {
|
1613
|
-
const
|
1614
|
-
return Promise.resolve(
|
1631
|
+
const n = v.get(`history_${e}_${t}`);
|
1632
|
+
return Promise.resolve(n);
|
1615
1633
|
}
|
1616
1634
|
saveHistoryItem(e, t) {
|
1617
1635
|
return v.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1618
1636
|
}
|
1619
1637
|
removeHistoryItem(e, t) {
|
1620
|
-
return t.forEach((
|
1621
|
-
v.remove(`history_${e}_${
|
1638
|
+
return t.forEach((n) => {
|
1639
|
+
v.remove(`history_${e}_${n}`);
|
1622
1640
|
}), Promise.resolve(!0);
|
1623
1641
|
}
|
1624
1642
|
}
|
1625
|
-
class
|
1643
|
+
class $n extends re {
|
1626
1644
|
projects = {};
|
1627
1645
|
materials = {};
|
1628
1646
|
files = {};
|
1629
1647
|
histories = {};
|
1630
1648
|
historyItems = {};
|
1631
1649
|
init(e) {
|
1632
|
-
const t = new O(e),
|
1650
|
+
const t = new O(e), n = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), n);
|
1633
1651
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1634
1652
|
}
|
1635
1653
|
saveProject(e) {
|
@@ -1661,29 +1679,29 @@ class js extends re {
|
|
1661
1679
|
return Promise.resolve(!0);
|
1662
1680
|
}
|
1663
1681
|
getHistory(e) {
|
1664
|
-
const t = this.histories[e],
|
1665
|
-
return Promise.resolve(
|
1682
|
+
const t = this.histories[e], n = new de(t || { id: e });
|
1683
|
+
return Promise.resolve(n);
|
1666
1684
|
}
|
1667
1685
|
getHistoryItem(e, t) {
|
1668
|
-
const
|
1686
|
+
const n = `${e}_${t}`, r = this.historyItems[n] || {};
|
1669
1687
|
return Promise.resolve(r);
|
1670
1688
|
}
|
1671
1689
|
saveHistoryItem(e, t) {
|
1672
|
-
const
|
1673
|
-
return this.historyItems[
|
1690
|
+
const n = `${e}_${t.id}`;
|
1691
|
+
return this.historyItems[n] = t, Promise.resolve(!0);
|
1674
1692
|
}
|
1675
1693
|
removeHistoryItem(e, t) {
|
1676
|
-
return t.forEach((
|
1677
|
-
const r = `${e}_${
|
1694
|
+
return t.forEach((n) => {
|
1695
|
+
const r = `${e}_${n}`;
|
1678
1696
|
delete this.historyItems[r];
|
1679
1697
|
}), Promise.resolve(!0);
|
1680
1698
|
}
|
1681
1699
|
}
|
1682
1700
|
let D = null;
|
1683
|
-
function
|
1684
|
-
return D || (D = new
|
1701
|
+
function Bn() {
|
1702
|
+
return D || (D = new $n(), D);
|
1685
1703
|
}
|
1686
|
-
class
|
1704
|
+
class Nn extends re {
|
1687
1705
|
getFileCaches = {};
|
1688
1706
|
async getExtension() {
|
1689
1707
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1740,39 +1758,39 @@ class Ns extends re {
|
|
1740
1758
|
);
|
1741
1759
|
}
|
1742
1760
|
}
|
1743
|
-
function
|
1744
|
-
return t.map((
|
1745
|
-
const { id: r, title: o, icon: a, children: i, hidden: c } =
|
1761
|
+
function Me(s, e, t = []) {
|
1762
|
+
return t.map((n) => {
|
1763
|
+
const { id: r, title: o, icon: a, children: i, hidden: c } = n;
|
1746
1764
|
return {
|
1747
1765
|
id: r,
|
1748
1766
|
title: o,
|
1749
1767
|
icon: a,
|
1750
1768
|
hidden: c,
|
1751
|
-
url: `${
|
1752
|
-
children: i && i.length ?
|
1769
|
+
url: `${s}/${e}/${r}`,
|
1770
|
+
children: i && i.length ? Me(s, e, i) : void 0
|
1753
1771
|
};
|
1754
1772
|
});
|
1755
1773
|
}
|
1756
|
-
function
|
1757
|
-
if (!e) return
|
1774
|
+
function Ae(s, e) {
|
1775
|
+
if (!e) return s;
|
1758
1776
|
let t = [];
|
1759
|
-
for (const
|
1760
|
-
if (
|
1761
|
-
const r =
|
1762
|
-
r.length && (
|
1777
|
+
for (const n of s)
|
1778
|
+
if (n.children && n.children.length) {
|
1779
|
+
const r = Ae(n.children, e);
|
1780
|
+
r.length && (n.children = r, t.push(n));
|
1763
1781
|
} else
|
1764
|
-
e.can(
|
1782
|
+
e.can(n.id.toString()) && t.push(n);
|
1765
1783
|
return t;
|
1766
1784
|
}
|
1767
|
-
function
|
1785
|
+
function Un(s) {
|
1768
1786
|
const {
|
1769
1787
|
menuPathPrefix: e = "",
|
1770
1788
|
pageRouteName: t = "page",
|
1771
|
-
disableMenusFilter:
|
1772
|
-
} =
|
1789
|
+
disableMenusFilter: n = !1
|
1790
|
+
} = s || {}, r = xe(), o = we(), a = yt(), i = M(!1), c = M(!1), l = r.project;
|
1773
1791
|
tt(() => {
|
1774
1792
|
const { name: p, params: h, meta: m } = o;
|
1775
|
-
if (p ===
|
1793
|
+
if (p === C) {
|
1776
1794
|
const d = r.getPage(h.id);
|
1777
1795
|
i.value = !d?.mask, c.value = !!d?.pure;
|
1778
1796
|
} else if (p === H) {
|
@@ -1781,7 +1799,7 @@ function Us(n) {
|
|
1781
1799
|
} else
|
1782
1800
|
i.value = !m.mask, c.value = !!m.pure;
|
1783
1801
|
});
|
1784
|
-
const f =
|
1802
|
+
const f = Me(
|
1785
1803
|
e,
|
1786
1804
|
t,
|
1787
1805
|
l?.pages
|
@@ -1791,59 +1809,60 @@ function Us(n) {
|
|
1791
1809
|
logo: u?.logo,
|
1792
1810
|
themeSwitchable: u?.themeSwitchable,
|
1793
1811
|
title: u?.title || l?.description || l?.name || "VTJ App",
|
1794
|
-
menus:
|
1812
|
+
menus: n ? f : Ae(f, a),
|
1795
1813
|
pure: c
|
1796
1814
|
};
|
1797
1815
|
}
|
1798
1816
|
export {
|
1799
1817
|
je as ACCESS_KEY,
|
1800
|
-
|
1818
|
+
Fn as Access,
|
1801
1819
|
ot as BUILD_IN_TAGS,
|
1802
|
-
|
1820
|
+
nt as BUILT_IN_DIRECTIVES,
|
1803
1821
|
re as BaseService,
|
1804
1822
|
ue as CONTEXT_HOST,
|
1805
|
-
|
1823
|
+
kt as Context,
|
1806
1824
|
y as ContextMode,
|
1807
|
-
|
1825
|
+
st as DATA_TYPES,
|
1808
1826
|
H as HOMEPAGE_ROUTE_NAME,
|
1809
1827
|
rt as HTML_TAGS,
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1828
|
+
An as JSCodeToString,
|
1829
|
+
xn as LIFE_CYCLES_LIST,
|
1830
|
+
Nn as LocalService,
|
1831
|
+
$n as MemoryService,
|
1832
|
+
wn as NodeEnv,
|
1833
|
+
C as PAGE_ROUTE_NAME,
|
1834
|
+
Sn as Provider,
|
1835
|
+
yn as Startup,
|
1836
|
+
On as StorageService,
|
1837
|
+
x as VTJ_RENDERER_VERSION,
|
1820
1838
|
be as adoptedStyleSheets,
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1839
|
+
In as clearLoaderCache,
|
1840
|
+
Tn as createAdapter,
|
1841
|
+
Cn as createAssetScripts,
|
1842
|
+
Mn as createAssetsCss,
|
1843
|
+
At as createDataSources,
|
1826
1844
|
Q as createLoader,
|
1827
|
-
|
1845
|
+
Bn as createMemoryService,
|
1828
1846
|
wt as createMetaApi,
|
1829
1847
|
jt as createMock,
|
1830
|
-
|
1848
|
+
Dn as createProvider,
|
1831
1849
|
Y as createRenderer,
|
1832
1850
|
_t as createSchemaApi,
|
1833
1851
|
St as createSchemaApis,
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
Ee as
|
1852
|
+
Hn as createServiceRequest,
|
1853
|
+
It as defaultLoader,
|
1854
|
+
I as fillBasePath,
|
1855
|
+
A as getMock,
|
1856
|
+
Ee as getModifiers,
|
1857
|
+
ke as getPlugin,
|
1839
1858
|
lt as getRawComponent,
|
1840
1859
|
ht as isBuiltInTag,
|
1841
|
-
|
1860
|
+
ne as isCSSUrl,
|
1842
1861
|
gt as isJSCode,
|
1843
1862
|
_ as isJSExpression,
|
1844
|
-
|
1863
|
+
T as isJSFunction,
|
1845
1864
|
it as isJSON,
|
1846
|
-
|
1865
|
+
se as isJSUrl,
|
1847
1866
|
mt as isNativeTag,
|
1848
1867
|
ft as isVuePlugin,
|
1849
1868
|
ut as loadCss,
|
@@ -1854,12 +1873,12 @@ export {
|
|
1854
1873
|
$e as mockCleanup,
|
1855
1874
|
B as nodeRender,
|
1856
1875
|
ct as parseDeps,
|
1857
|
-
|
1876
|
+
F as parseExpression,
|
1858
1877
|
G as parseFunction,
|
1859
1878
|
Pe as providerKey,
|
1860
1879
|
at as removeProdFlag,
|
1861
1880
|
Se as toString,
|
1862
1881
|
yt as useAccess,
|
1863
|
-
|
1882
|
+
Un as useMask,
|
1864
1883
|
xe as useProvider
|
1865
1884
|
};
|