@vtj/renderer 0.12.10 → 0.12.12
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 +5 -5
- package/dist/index.mjs +649 -625
- package/package.json +6 -6
- package/types/render/node.d.ts +1 -1
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
import { Base as
|
2
|
-
import { isUrl as
|
3
|
-
import * as
|
4
|
-
import { inject as
|
5
|
-
import { useRoute as
|
1
|
+
import { Base as Te, BUILT_IN_COMPONENTS as De, ProjectModel as N, HistoryModel as pe } from "@vtj/core";
|
2
|
+
import { isUrl as xe, url as b, dedupArray as Oe, isString as j, isFunction as K, logger as C, storage as L, cookie as q, toArray as re, unRSA as ie, delay as fe, createRequest as de, jsonp as he, merge as Ne, pathToRegexp as Be, pathToRegexpMatch as Ue, formDataToJson as Le, cloneDeep as oe, camelCase as E, upperFirst as qe, pick as Je, request as z, loadScript as ae, Storage as Ke, mapToObject as Z } from "@vtj/utils";
|
3
|
+
import * as B from "vue";
|
4
|
+
import { inject as me, defineComponent as ve, h as V, ref as W, defineAsyncComponent as ce, watchEffect as ze } from "vue";
|
5
|
+
import { useRoute as ge } from "vue-router";
|
6
6
|
/**!
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.12.
|
10
|
+
* @version 0.12.12
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const
|
14
|
-
var y = /* @__PURE__ */ ((
|
15
|
-
const
|
13
|
+
const A = "0.12.12";
|
14
|
+
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
15
|
+
const le = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
18
18
|
"$nextTick",
|
@@ -24,7 +24,7 @@ const ae = [
|
|
24
24
|
"$props",
|
25
25
|
"$options",
|
26
26
|
"$forceUpdate"
|
27
|
-
],
|
27
|
+
], Xt = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -38,14 +38,16 @@ const ae = [
|
|
38
38
|
"renderTriggered",
|
39
39
|
"activated",
|
40
40
|
"deactivated"
|
41
|
-
],
|
41
|
+
], Ve = [
|
42
42
|
"vIf",
|
43
|
+
"vElseIf",
|
44
|
+
"vElse",
|
43
45
|
"vShow",
|
44
46
|
"vModel",
|
45
47
|
"vFor",
|
46
48
|
"vBind",
|
47
49
|
"vHtml"
|
48
|
-
],
|
50
|
+
], We = {
|
49
51
|
String,
|
50
52
|
Number,
|
51
53
|
Boolean,
|
@@ -53,160 +55,160 @@ const ae = [
|
|
53
55
|
Object,
|
54
56
|
Function,
|
55
57
|
Date
|
56
|
-
},
|
58
|
+
}, I = "VtjPage", O = "VtjHomepage", Ge = "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(
|
57
59
|
","
|
58
|
-
),
|
59
|
-
function
|
60
|
-
return
|
60
|
+
), Ye = "component,slot".split(",");
|
61
|
+
function D(n, e) {
|
62
|
+
return n.map((t) => xe(t) || t.startsWith("/") ? t : `${e}${t}`);
|
61
63
|
}
|
62
|
-
function
|
63
|
-
return /\.css$/.test(
|
64
|
+
function ee(n) {
|
65
|
+
return /\.css$/.test(n);
|
64
66
|
}
|
65
|
-
function
|
66
|
-
return /\.js$/.test(
|
67
|
+
function te(n) {
|
68
|
+
return /\.js$/.test(n);
|
67
69
|
}
|
68
|
-
function
|
69
|
-
return /\.json$/.test(
|
70
|
+
function Qe(n) {
|
71
|
+
return /\.json$/.test(n);
|
70
72
|
}
|
71
|
-
function
|
72
|
-
return
|
73
|
-
(e) => `<script src="${
|
73
|
+
function Zt(n) {
|
74
|
+
return n.map(
|
75
|
+
(e) => `<script src="${b.append(e, { v: A })}"><\/script>`
|
74
76
|
).join("");
|
75
77
|
}
|
76
|
-
function
|
77
|
-
return
|
78
|
-
(e) => `<link rel="stylesheet" href="${
|
78
|
+
function es(n = []) {
|
79
|
+
return n.map(
|
80
|
+
(e) => `<link rel="stylesheet" href="${b.append(e, { v: A })}" />`
|
79
81
|
).join("");
|
80
82
|
}
|
81
|
-
function
|
82
|
-
return e &&
|
83
|
+
function Xe(n, e = !1) {
|
84
|
+
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
83
85
|
}
|
84
|
-
function
|
85
|
-
const s =
|
86
|
+
function Ze(n, e, t = !1) {
|
87
|
+
const s = n.filter((m) => !!m.enabled), r = [], i = [], a = [], o = [], c = {}, l = {}, u = [], p = {};
|
86
88
|
return s.forEach(
|
87
|
-
({ urls: m, assetsUrl:
|
88
|
-
m?.forEach((
|
89
|
-
|
90
|
-
}),
|
89
|
+
({ urls: m, assetsUrl: f, library: d, assetsLibrary: h, localeLibrary: _ }) => {
|
90
|
+
m?.forEach((v) => {
|
91
|
+
te(v) && r.push(Xe(v, t)), ee(v) && i.push(v);
|
92
|
+
}), d && (o.push(d), c[d] = D(m || [], e), _ && (l[d] = _)), f && a.push(f), h && u.push(h), d && h && (p[h] = d);
|
91
93
|
}
|
92
94
|
), {
|
93
|
-
scripts:
|
94
|
-
css:
|
95
|
-
materials:
|
95
|
+
scripts: D(r, e),
|
96
|
+
css: D(i, e),
|
97
|
+
materials: D(a, e),
|
96
98
|
libraryExports: o,
|
97
|
-
materialExports:
|
98
|
-
materialMapLibrary:
|
99
|
+
materialExports: Oe(u),
|
100
|
+
materialMapLibrary: p,
|
99
101
|
libraryMap: c,
|
100
|
-
libraryLocaleMap:
|
102
|
+
libraryLocaleMap: l
|
101
103
|
};
|
102
104
|
}
|
103
|
-
function
|
104
|
-
const { name: t, parent: s, alias:
|
105
|
-
return s ? e[s]?.[
|
105
|
+
function et(n, e) {
|
106
|
+
const { name: t, parent: s, alias: r } = n;
|
107
|
+
return s ? e[s]?.[r || t] : e[r || t];
|
106
108
|
}
|
107
|
-
function
|
108
|
-
return j(
|
109
|
+
function ye(n) {
|
110
|
+
return j(n) ? n : JSON.stringify(n);
|
109
111
|
}
|
110
|
-
function
|
111
|
-
const s =
|
112
|
+
function _e(n, e, t) {
|
113
|
+
const s = n.CSSStyleSheet;
|
112
114
|
if (s.prototype.replaceSync) {
|
113
|
-
const
|
114
|
-
|
115
|
-
const i =
|
115
|
+
const r = new s();
|
116
|
+
r.id = e, r.replaceSync(t);
|
117
|
+
const i = n.document, a = i.adoptedStyleSheets, o = Array.from(a).filter(
|
116
118
|
(c) => c.id !== e
|
117
119
|
);
|
118
|
-
i.adoptedStyleSheets = [...o,
|
120
|
+
i.adoptedStyleSheets = [...o, r];
|
119
121
|
} else {
|
120
|
-
const
|
121
|
-
let i =
|
122
|
-
i ? i.innerHTML = t : (i =
|
122
|
+
const r = n.document;
|
123
|
+
let i = r.getElementById(e);
|
124
|
+
i ? i.innerHTML = t : (i = r.createElement("style"), i.id = e, i.innerHTML = t, r.head.appendChild(i));
|
123
125
|
}
|
124
126
|
}
|
125
|
-
async function
|
127
|
+
async function tt(n, e) {
|
126
128
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
127
|
-
t &&
|
129
|
+
t && _e(window, n, t);
|
128
130
|
}
|
129
|
-
function
|
131
|
+
function st(n, e = window) {
|
130
132
|
const t = e.document, s = e.document.head;
|
131
|
-
for (const
|
132
|
-
if (!t.getElementById(
|
133
|
+
for (const r of n)
|
134
|
+
if (!t.getElementById(r)) {
|
133
135
|
const a = t.createElement("link");
|
134
|
-
a.rel = "stylesheet", a.id =
|
136
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
135
137
|
}
|
136
138
|
}
|
137
|
-
async function
|
138
|
-
const s = t.document,
|
139
|
+
async function nt(n, e, t = window) {
|
140
|
+
const s = t.document, r = t.document.head;
|
139
141
|
let i = t[e];
|
140
142
|
return i ? i.default || i : new Promise((a, o) => {
|
141
|
-
for (const c of
|
142
|
-
const
|
143
|
-
|
143
|
+
for (const c of n) {
|
144
|
+
const l = s.createElement("script");
|
145
|
+
l.src = c, l.onload = () => {
|
144
146
|
i = t[e], i ? a(i.default || i) : o(null);
|
145
|
-
},
|
146
|
-
o(
|
147
|
-
},
|
147
|
+
}, l.onerror = (u) => {
|
148
|
+
o(u);
|
149
|
+
}, r.appendChild(l);
|
148
150
|
}
|
149
151
|
});
|
150
152
|
}
|
151
|
-
function
|
152
|
-
return
|
153
|
+
function rt(n) {
|
154
|
+
return K(n) || K(n?.install);
|
153
155
|
}
|
154
|
-
function
|
155
|
-
return
|
156
|
+
function it(n) {
|
157
|
+
return Ye.includes(n);
|
156
158
|
}
|
157
|
-
function
|
158
|
-
return
|
159
|
+
function ot(n) {
|
160
|
+
return Ge.includes(n);
|
159
161
|
}
|
160
|
-
function
|
162
|
+
function M(n = window) {
|
161
163
|
const e = window?.Mock;
|
162
164
|
if (e) return e;
|
163
|
-
const t =
|
165
|
+
const t = n?.Mock;
|
164
166
|
if (t && window)
|
165
167
|
return window.Mock = t, t;
|
166
168
|
}
|
167
|
-
function
|
169
|
+
function ts(n, e, t) {
|
168
170
|
Object.assign(e.meta, t.meta);
|
169
|
-
const s =
|
171
|
+
const s = n?._container;
|
170
172
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
171
173
|
}
|
172
|
-
function
|
174
|
+
function H(n, e, t = !1, s = !1) {
|
173
175
|
try {
|
174
|
-
const
|
175
|
-
|
176
|
-
let i = (
|
177
|
-
i = i.replace(/this(\W|$)/g, (o, c) => `__self${c}`), i =
|
176
|
+
const r = ['"use strict";', "var __self = arguments[0];"];
|
177
|
+
r.push("return ");
|
178
|
+
let i = (n.value || "").trim();
|
179
|
+
i = i.replace(/this(\W|$)/g, (o, c) => `__self${c}`), i = r.join(`
|
178
180
|
`) + i;
|
179
181
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${i} }`;
|
180
182
|
return new Function("$scope", a)(e);
|
181
|
-
} catch (
|
182
|
-
if (
|
183
|
-
throw
|
183
|
+
} catch (r) {
|
184
|
+
if (C.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
185
|
+
throw r;
|
184
186
|
}
|
185
187
|
}
|
186
|
-
function
|
187
|
-
const
|
188
|
-
if (typeof
|
188
|
+
function G(n, e, t = !1, s = !1) {
|
189
|
+
const r = H(n, e, t, s);
|
190
|
+
if (typeof r != "function" && (C.error(
|
189
191
|
"parseFunction.error",
|
190
192
|
"not a function",
|
191
|
-
|
193
|
+
n,
|
192
194
|
e?.__self ?? e
|
193
195
|
), s))
|
194
|
-
throw new Error(`"${
|
195
|
-
return
|
196
|
+
throw new Error(`"${n.value}" not a function`);
|
197
|
+
return r;
|
196
198
|
}
|
197
|
-
function
|
198
|
-
return
|
199
|
+
function w(n) {
|
200
|
+
return n && n.type === "JSExpression";
|
199
201
|
}
|
200
|
-
function
|
201
|
-
return typeof
|
202
|
+
function T(n) {
|
203
|
+
return typeof n == "object" && n && n.type === "JSFunction";
|
202
204
|
}
|
203
|
-
function
|
204
|
-
return
|
205
|
+
function at(n) {
|
206
|
+
return w(n) || T(n);
|
205
207
|
}
|
206
|
-
function
|
207
|
-
return
|
208
|
+
function ss(n) {
|
209
|
+
return at(n) ? n.value : JSON.stringify(n);
|
208
210
|
}
|
209
|
-
const
|
211
|
+
const ct = {
|
210
212
|
session: !1,
|
211
213
|
authKey: "Authorization",
|
212
214
|
storageKey: "ACCESS_STORAGE",
|
@@ -219,14 +221,14 @@ const rt = {
|
|
219
221
|
noPermissionMessage: "无权限访问该页面",
|
220
222
|
appName: "",
|
221
223
|
statusKey: "code"
|
222
|
-
},
|
223
|
-
class
|
224
|
+
}, we = Symbol("access");
|
225
|
+
class Se {
|
224
226
|
options;
|
225
227
|
data = null;
|
226
228
|
mode = y.Raw;
|
227
229
|
interceptResponse = !0;
|
228
230
|
constructor(e) {
|
229
|
-
this.options = Object.assign({},
|
231
|
+
this.options = Object.assign({}, ct, e), this.loadData();
|
230
232
|
}
|
231
233
|
enableIntercept() {
|
232
234
|
this.interceptResponse = !0;
|
@@ -235,22 +237,22 @@ class _e {
|
|
235
237
|
this.interceptResponse = !1;
|
236
238
|
}
|
237
239
|
connect(e) {
|
238
|
-
const { mode: t, router: s, request:
|
239
|
-
this.mode = t, s && this.mode === y.Raw && this.setGuard(s),
|
240
|
+
const { mode: t, router: s, request: r } = e;
|
241
|
+
this.mode = t, s && this.mode === y.Raw && this.setGuard(s), r && this.setRequest(r);
|
240
242
|
}
|
241
243
|
login(e) {
|
242
|
-
const { storageKey: t, storagePrefix: s, session:
|
243
|
-
this.setData(e), this.data && (
|
244
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: i } = this.options;
|
245
|
+
this.setData(e), this.data && (L.save(t, e, {
|
244
246
|
type: "local",
|
245
247
|
prefix: s
|
246
|
-
}),
|
248
|
+
}), r && q.set(i, this.data.token));
|
247
249
|
}
|
248
250
|
clear() {
|
249
|
-
const { storageKey: e, storagePrefix: t, session: s, authKey:
|
250
|
-
this.data = null,
|
251
|
+
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
252
|
+
this.data = null, L.remove(e, {
|
251
253
|
type: "local",
|
252
254
|
prefix: t
|
253
|
-
}), s &&
|
255
|
+
}), s && q.remove(r);
|
254
256
|
}
|
255
257
|
logout() {
|
256
258
|
this.clear(), this.toLogin();
|
@@ -263,22 +265,22 @@ class _e {
|
|
263
265
|
}
|
264
266
|
can(e) {
|
265
267
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
266
|
-
return typeof e == "function" ? e(s) :
|
268
|
+
return typeof e == "function" ? e(s) : re(e).every((i) => s[i] || s[t + "." + i]);
|
267
269
|
}
|
268
270
|
some(e) {
|
269
271
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
270
|
-
return
|
272
|
+
return re(e).some((i) => s[i] || s[t + "." + i]);
|
271
273
|
}
|
272
274
|
install(e) {
|
273
|
-
e.config.globalProperties.$access = this, e.provide(
|
275
|
+
e.config.globalProperties.$access = this, e.provide(we, this);
|
274
276
|
}
|
275
277
|
isAuthPath(e) {
|
276
278
|
const { auth: t, isAuth: s } = this.options;
|
277
279
|
if (s)
|
278
280
|
return s(e);
|
279
281
|
if (e.path && typeof t == "string") {
|
280
|
-
const
|
281
|
-
return e.path ===
|
282
|
+
const r = t.split("#")[1] || t;
|
283
|
+
return e.path === r;
|
282
284
|
}
|
283
285
|
return !1;
|
284
286
|
}
|
@@ -291,17 +293,17 @@ class _e {
|
|
291
293
|
setData(e) {
|
292
294
|
const { privateKey: t } = this.options;
|
293
295
|
if (Array.isArray(e) && t) {
|
294
|
-
const s = e.map((
|
296
|
+
const s = e.map((r) => ie(r, t));
|
295
297
|
try {
|
296
298
|
this.data = JSON.parse(s.join(""));
|
297
|
-
} catch (
|
298
|
-
console.warn(
|
299
|
+
} catch (r) {
|
300
|
+
console.warn(r);
|
299
301
|
}
|
300
302
|
return;
|
301
303
|
}
|
302
304
|
if (typeof e == "string")
|
303
305
|
try {
|
304
|
-
const s = t ?
|
306
|
+
const s = t ? ie(e, t) : e;
|
305
307
|
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
306
308
|
} catch (s) {
|
307
309
|
console.warn(s);
|
@@ -310,7 +312,7 @@ class _e {
|
|
310
312
|
this.data = e;
|
311
313
|
}
|
312
314
|
loadData() {
|
313
|
-
const { storageKey: e, storagePrefix: t } = this.options, s =
|
315
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = L.get(e, {
|
314
316
|
type: "local",
|
315
317
|
prefix: t
|
316
318
|
});
|
@@ -318,17 +320,17 @@ class _e {
|
|
318
320
|
}
|
319
321
|
isLogined() {
|
320
322
|
const { session: e, authKey: t } = this.options;
|
321
|
-
return e && t ? !!
|
323
|
+
return e && t ? !!q.get(t) : !!this.getToken();
|
322
324
|
}
|
323
325
|
hasRoutePermission(e) {
|
324
|
-
if (e.name ===
|
326
|
+
if (e.name === I) {
|
325
327
|
const t = e.params.id;
|
326
328
|
return t && this.can(t);
|
327
329
|
}
|
328
330
|
return !0;
|
329
331
|
}
|
330
332
|
setGuard(e) {
|
331
|
-
e.beforeEach((t, s,
|
333
|
+
e.beforeEach((t, s, r) => this.guard(t, r));
|
332
334
|
}
|
333
335
|
async guard(e, t) {
|
334
336
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
@@ -337,8 +339,8 @@ class _e {
|
|
337
339
|
if (this.hasRoutePermission(e))
|
338
340
|
return t();
|
339
341
|
{
|
340
|
-
const { noPermissionMessage: s = "无权限访问", unauthorized:
|
341
|
-
return await this.showTip(s),
|
342
|
+
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
343
|
+
return await this.showTip(s), K(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
342
344
|
}
|
343
345
|
}
|
344
346
|
t(!1), this.toLogin();
|
@@ -357,7 +359,7 @@ class _e {
|
|
357
359
|
}
|
358
360
|
async showTip(e) {
|
359
361
|
const { alert: t } = this.options;
|
360
|
-
return t ? (await
|
362
|
+
return t ? (await fe(150), await t(e, {
|
361
363
|
title: "提示",
|
362
364
|
type: "warning"
|
363
365
|
}).catch(() => !1)) : !1;
|
@@ -373,31 +375,31 @@ class _e {
|
|
373
375
|
);
|
374
376
|
}
|
375
377
|
}
|
376
|
-
function
|
377
|
-
return
|
378
|
+
function lt() {
|
379
|
+
return me(we, null);
|
378
380
|
}
|
379
|
-
function
|
381
|
+
function ns(n = {}) {
|
380
382
|
const {
|
381
383
|
notify: e,
|
382
384
|
loading: t,
|
383
385
|
settings: s = {},
|
384
|
-
Startup:
|
386
|
+
Startup: r,
|
385
387
|
access: i,
|
386
388
|
useTitle: a,
|
387
389
|
alert: o
|
388
|
-
} =
|
390
|
+
} = n;
|
389
391
|
let c = null;
|
390
392
|
return {
|
391
|
-
request:
|
393
|
+
request: de({
|
392
394
|
settings: {
|
393
395
|
type: "form",
|
394
396
|
validSuccess: !0,
|
395
397
|
originResponse: !1,
|
396
398
|
loading: !0,
|
397
|
-
validate: (
|
399
|
+
validate: (u) => u.data?.code === 0 || !!u.data?.success,
|
398
400
|
failMessage: !0,
|
399
|
-
showError: (
|
400
|
-
e && e(
|
401
|
+
showError: (u) => {
|
402
|
+
e && e(u || "未知错误");
|
401
403
|
},
|
402
404
|
showLoading: () => {
|
403
405
|
c && c.close(), t && (c = t());
|
@@ -408,89 +410,89 @@ function Xt(r = {}) {
|
|
408
410
|
...s
|
409
411
|
}
|
410
412
|
}),
|
411
|
-
jsonp:
|
413
|
+
jsonp: he,
|
412
414
|
notify: e,
|
413
415
|
loading: t,
|
414
416
|
useTitle: a,
|
415
|
-
startupComponent:
|
416
|
-
access: i ? new
|
417
|
+
startupComponent: r,
|
418
|
+
access: i ? new Se({ alert: o, ...i }) : void 0
|
417
419
|
};
|
418
420
|
}
|
419
|
-
function
|
420
|
-
return new
|
421
|
+
function rs(n = {}) {
|
422
|
+
return new Se(n);
|
421
423
|
}
|
422
|
-
function
|
424
|
+
function ut(n, e) {
|
423
425
|
const { jsonp: t, request: s } = e;
|
424
|
-
if (
|
425
|
-
return (
|
426
|
-
...
|
427
|
-
query:
|
426
|
+
if (n.method === "jsonp")
|
427
|
+
return (r = {}) => t(n.url, {
|
428
|
+
...n.jsonpOptions,
|
429
|
+
query: r
|
428
430
|
});
|
429
431
|
{
|
430
|
-
const
|
431
|
-
url:
|
432
|
-
method:
|
432
|
+
const r = n.headers ? H(n.headers, {}, !0) : void 0, i = {
|
433
|
+
url: n.url,
|
434
|
+
method: n.method,
|
433
435
|
settings: {
|
434
|
-
...
|
435
|
-
headers:
|
436
|
+
...n.settings,
|
437
|
+
headers: r
|
436
438
|
}
|
437
439
|
};
|
438
|
-
return (a, o) => (delete i.data, s.send(
|
440
|
+
return (a, o) => (delete i.data, s.send(Ne(i, o || {}, { data: a })));
|
439
441
|
}
|
440
442
|
}
|
441
|
-
function
|
443
|
+
function pt(n, e) {
|
442
444
|
const { metaQuery: t } = e;
|
443
445
|
if (!t) return;
|
444
|
-
const { code: s, queryCode:
|
446
|
+
const { code: s, queryCode: r } = n;
|
445
447
|
return (i, a) => {
|
446
448
|
if (!t) {
|
447
449
|
console.warn("adapter.metaQuery is not defined!");
|
448
450
|
return;
|
449
451
|
}
|
450
|
-
return t(s,
|
452
|
+
return t(s, r, i, a);
|
451
453
|
};
|
452
454
|
}
|
453
|
-
function
|
455
|
+
function ft(n = [], e = [], t) {
|
454
456
|
const s = {};
|
455
|
-
for (const
|
456
|
-
s[
|
457
|
-
for (const
|
458
|
-
s[
|
457
|
+
for (const r of n)
|
458
|
+
s[r.id] = ut(r, t);
|
459
|
+
for (const r of e)
|
460
|
+
s[r.id] = pt(r, t);
|
459
461
|
return s;
|
460
462
|
}
|
461
|
-
async function
|
462
|
-
const t =
|
463
|
-
t && (
|
463
|
+
async function dt(n = [], e = window) {
|
464
|
+
const t = M(e);
|
465
|
+
t && ($e(e), n.forEach((s) => mt(t, s)));
|
464
466
|
}
|
465
|
-
function
|
466
|
-
const t =
|
467
|
-
return async (...
|
467
|
+
function ht(n, e = window) {
|
468
|
+
const t = T(n.mockTemplate) && n.mockTemplate.value ? G(n.mockTemplate, {}, !0) : void 0, s = M(e);
|
469
|
+
return async (...r) => {
|
468
470
|
let i = {};
|
469
471
|
if (t)
|
470
472
|
try {
|
471
|
-
i = await t.apply(t,
|
473
|
+
i = await t.apply(t, r);
|
472
474
|
} catch (a) {
|
473
|
-
|
475
|
+
C.warn("模拟数据模版异常", a);
|
474
476
|
}
|
475
477
|
return s?.mock(i);
|
476
478
|
};
|
477
479
|
}
|
478
|
-
function
|
480
|
+
function mt(n, e) {
|
479
481
|
if (!e.mock) return;
|
480
482
|
const { url: t, mockTemplate: s } = e;
|
481
483
|
if (t && s) {
|
482
|
-
const
|
483
|
-
|
484
|
-
const c =
|
485
|
-
return Object.assign(o, { data:
|
484
|
+
const r = Be(`${t}(.*)`), i = Ue(t, { decode: decodeURIComponent }), a = H(s, {}, !0);
|
485
|
+
n.mock(r, (o) => {
|
486
|
+
const c = b.parse(o.url) || {}, l = o.body instanceof FormData ? Le(o.body) : o.body, u = i(o.url)?.params;
|
487
|
+
return Object.assign(o, { data: l, params: c, query: u }), n.mock(a(o));
|
486
488
|
});
|
487
489
|
}
|
488
490
|
}
|
489
|
-
function
|
490
|
-
const e =
|
491
|
+
function $e(n = window) {
|
492
|
+
const e = M(n);
|
491
493
|
e && (e._mocked = {});
|
492
494
|
}
|
493
|
-
class
|
495
|
+
class vt {
|
494
496
|
__id = null;
|
495
497
|
__mode;
|
496
498
|
__instance = null;
|
@@ -516,15 +518,15 @@ class pt {
|
|
516
518
|
$apis = {};
|
517
519
|
__transform = {};
|
518
520
|
constructor(e) {
|
519
|
-
const { mode: t, dsl: s, attrs:
|
520
|
-
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}),
|
521
|
+
const { mode: t, dsl: s, attrs: r } = e;
|
522
|
+
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
521
523
|
}
|
522
|
-
setup(e, t =
|
524
|
+
setup(e, t = B) {
|
523
525
|
const s = t.getCurrentInstance();
|
524
526
|
if (!s) return;
|
525
527
|
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
526
|
-
const
|
527
|
-
Object.assign(this,
|
528
|
+
const r = s.appContext.config.globalProperties;
|
529
|
+
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
528
530
|
this.__proxy();
|
529
531
|
}), t.onUnmounted(() => {
|
530
532
|
this.__cleanup();
|
@@ -533,12 +535,12 @@ class pt {
|
|
533
535
|
});
|
534
536
|
}
|
535
537
|
__proxy() {
|
536
|
-
this.__instance &&
|
538
|
+
this.__instance && le.forEach((e) => {
|
537
539
|
this[e] = this.__instance?.[e];
|
538
540
|
});
|
539
541
|
}
|
540
542
|
__cleanup() {
|
541
|
-
|
543
|
+
le.forEach((e) => {
|
542
544
|
this[e] = null;
|
543
545
|
}), this.__reset();
|
544
546
|
}
|
@@ -548,35 +550,35 @@ class pt {
|
|
548
550
|
__parseFunction(e) {
|
549
551
|
if (e)
|
550
552
|
if (this.__mode === y.Runtime) {
|
551
|
-
const { id: t, type: s } = e,
|
552
|
-
return
|
553
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
554
|
+
return G({ type: s, value: r }, this);
|
553
555
|
} else
|
554
|
-
return
|
556
|
+
return G(e, this);
|
555
557
|
}
|
556
558
|
__parseExpression(e) {
|
557
559
|
if (e)
|
558
560
|
if (this.__mode === y.Runtime) {
|
559
|
-
const { id: t, type: s } = e,
|
560
|
-
return
|
561
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
562
|
+
return H({ type: s, value: r }, this);
|
561
563
|
} else
|
562
|
-
return
|
564
|
+
return H(e, this);
|
563
565
|
}
|
564
566
|
__ref(e = null, t) {
|
565
567
|
if (this.__mode !== y.VNode)
|
566
568
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
567
|
-
await
|
568
|
-
let
|
569
|
-
if (!
|
569
|
+
await fe(0);
|
570
|
+
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
571
|
+
if (!r) {
|
570
572
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
571
573
|
return;
|
572
574
|
}
|
573
|
-
return
|
575
|
+
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, s)), typeof t == "function" ? t(s) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, s)), s;
|
574
576
|
};
|
575
577
|
}
|
576
578
|
__getRefEl(e, t, s) {
|
577
|
-
const
|
578
|
-
if (
|
579
|
-
const i = new Set([].concat(
|
579
|
+
const r = e[t];
|
580
|
+
if (r && s !== r) {
|
581
|
+
const i = new Set([].concat(r, s));
|
580
582
|
return Array.from(i);
|
581
583
|
} else
|
582
584
|
return s;
|
@@ -589,123 +591,125 @@ class pt {
|
|
589
591
|
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
590
592
|
}
|
591
593
|
}
|
592
|
-
function
|
594
|
+
function Y(n) {
|
593
595
|
const {
|
594
|
-
Vue: e =
|
596
|
+
Vue: e = B,
|
595
597
|
mode: t = y.Runtime,
|
596
598
|
components: s = {},
|
597
|
-
libs:
|
599
|
+
libs: r = {},
|
598
600
|
apis: i = {},
|
599
601
|
loader: a
|
600
|
-
} =
|
602
|
+
} = n, o = e.computed(() => n.dsl), c = {
|
601
603
|
$components: s,
|
602
|
-
$libs:
|
604
|
+
$libs: r,
|
603
605
|
$apis: i
|
604
|
-
},
|
606
|
+
}, l = new vt({
|
605
607
|
mode: t,
|
606
608
|
dsl: o.value,
|
607
609
|
attrs: c
|
608
|
-
}),
|
610
|
+
}), u = e.defineComponent({
|
609
611
|
name: o.value.name,
|
610
612
|
props: {
|
611
|
-
...
|
613
|
+
...yt(o.value.props ?? [], l)
|
612
614
|
},
|
613
|
-
setup(
|
614
|
-
|
615
|
-
|
615
|
+
setup(p) {
|
616
|
+
l.$props = p, l.props = p, o.value.id && _e(
|
617
|
+
n.window || window,
|
616
618
|
o.value.id,
|
617
619
|
o.value.css || ""
|
618
|
-
),
|
619
|
-
const m =
|
620
|
+
), l.state = _t(e, o.value.state ?? {}, l);
|
621
|
+
const m = wt(e, o.value.computed ?? {}, l), f = St(o.value.methods ?? {}, l), d = $t(e, o.value.inject, l), h = Et(
|
620
622
|
o.value.dataSources || {},
|
621
|
-
|
622
|
-
),
|
623
|
-
...
|
623
|
+
l
|
624
|
+
), _ = {
|
625
|
+
...d,
|
624
626
|
...m,
|
625
|
-
...
|
626
|
-
...
|
627
|
+
...f,
|
628
|
+
...h
|
627
629
|
};
|
628
|
-
return
|
629
|
-
vtj:
|
630
|
+
return l.setup(_, e), jt(e, o.value.watch ?? [], l), {
|
631
|
+
vtj: l
|
630
632
|
};
|
631
633
|
},
|
632
|
-
emits:
|
634
|
+
emits: gt(o.value.emits),
|
633
635
|
expose: ["vtj"],
|
634
636
|
render() {
|
635
637
|
if (!o.value.nodes) return null;
|
636
|
-
const
|
637
|
-
return
|
638
|
+
const p = o.value.nodes || [];
|
639
|
+
return p.length === 1 ? k(p[0], l, e, a, p) : p.map(
|
640
|
+
(m) => k(m, l, e, a, p)
|
641
|
+
);
|
638
642
|
},
|
639
|
-
...
|
643
|
+
...Pt(o.value.lifeCycles ?? {}, l)
|
640
644
|
});
|
641
645
|
return {
|
642
|
-
renderer: e.markRaw(
|
643
|
-
context:
|
646
|
+
renderer: e.markRaw(u),
|
647
|
+
context: l
|
644
648
|
};
|
645
649
|
}
|
646
|
-
function
|
647
|
-
return
|
650
|
+
function gt(n = []) {
|
651
|
+
return n.map((e) => j(e) ? e : e.name);
|
648
652
|
}
|
649
|
-
function
|
650
|
-
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) =>
|
651
|
-
return
|
653
|
+
function yt(n = [], e) {
|
654
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((i) => We[i]) : void 0;
|
655
|
+
return n.map((s) => j(s) ? {
|
652
656
|
name: s
|
653
657
|
} : {
|
654
658
|
name: s.name,
|
655
659
|
type: s.type,
|
656
660
|
required: s.required,
|
657
|
-
default:
|
661
|
+
default: w(s.default) ? e.__parseExpression(s.default) : s.default
|
658
662
|
}).reduce(
|
659
|
-
(s,
|
660
|
-
type: t(
|
661
|
-
required:
|
662
|
-
default:
|
663
|
+
(s, r) => (s[r.name] = {
|
664
|
+
type: t(r.type),
|
665
|
+
required: r.required,
|
666
|
+
default: r.default
|
663
667
|
}, s),
|
664
668
|
{}
|
665
669
|
);
|
666
670
|
}
|
667
|
-
function
|
668
|
-
return
|
671
|
+
function _t(n, e, t) {
|
672
|
+
return n.reactive(
|
669
673
|
Object.keys(e || {}).reduce(
|
670
|
-
(s,
|
671
|
-
let i = e[
|
672
|
-
return
|
674
|
+
(s, r) => {
|
675
|
+
let i = e[r];
|
676
|
+
return w(i) ? i = t.__parseExpression(i) : T(i) && (i = t.__parseFunction(i)), s[r] = i, s;
|
673
677
|
},
|
674
678
|
{}
|
675
679
|
)
|
676
680
|
);
|
677
681
|
}
|
678
|
-
function
|
682
|
+
function wt(n, e, t) {
|
679
683
|
return Object.entries(e ?? {}).reduce(
|
680
|
-
(s, [
|
684
|
+
(s, [r, i]) => (s[r] = n.computed(t.__parseFunction(i)), s),
|
681
685
|
{}
|
682
686
|
);
|
683
687
|
}
|
684
|
-
function
|
685
|
-
return Object.entries(
|
686
|
-
(t, [s,
|
688
|
+
function St(n, e) {
|
689
|
+
return Object.entries(n ?? {}).reduce(
|
690
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
687
691
|
{}
|
688
692
|
);
|
689
693
|
}
|
690
|
-
function
|
694
|
+
function $t(n, e = [], t) {
|
691
695
|
return e.reduce(
|
692
|
-
(s,
|
693
|
-
const { name: i, from: a } =
|
694
|
-
|
695
|
-
const o =
|
696
|
-
return s[i] =
|
696
|
+
(s, r) => {
|
697
|
+
const { name: i, from: a } = r || {};
|
698
|
+
r.default;
|
699
|
+
const o = w(a) ? t.__parseExpression(a) || i : a ?? i, c = w(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
700
|
+
return s[i] = n.inject(o, c), s;
|
697
701
|
},
|
698
702
|
{}
|
699
703
|
);
|
700
704
|
}
|
701
|
-
function
|
702
|
-
return Object.keys(
|
705
|
+
function Et(n, e) {
|
706
|
+
return Object.keys(n).reduce(
|
703
707
|
(t, s) => {
|
704
|
-
const
|
705
|
-
if (
|
706
|
-
t[s] =
|
707
|
-
else if (
|
708
|
-
const i = e.$apis[
|
708
|
+
const r = n[s];
|
709
|
+
if (r.type === "mock")
|
710
|
+
t[s] = ht(r);
|
711
|
+
else if (r.ref) {
|
712
|
+
const i = e.$apis[r.ref], a = T(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
709
713
|
t[s] = async (...o) => {
|
710
714
|
const c = await i.apply(e, o);
|
711
715
|
return a ? a(c) : c;
|
@@ -716,9 +720,9 @@ function yt(r, e) {
|
|
716
720
|
{}
|
717
721
|
);
|
718
722
|
}
|
719
|
-
function
|
723
|
+
function jt(n, e = [], t) {
|
720
724
|
e.forEach((s) => {
|
721
|
-
|
725
|
+
n.watch(
|
722
726
|
t.__parseExpression(s.source),
|
723
727
|
t.__parseFunction(s.handler),
|
724
728
|
{
|
@@ -728,257 +732,277 @@ function _t(r, e = [], t) {
|
|
728
732
|
);
|
729
733
|
});
|
730
734
|
}
|
731
|
-
function
|
732
|
-
return Object.entries(
|
733
|
-
(t, [s,
|
735
|
+
function Pt(n, e) {
|
736
|
+
return Object.entries(n ?? {}).reduce(
|
737
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
734
738
|
{}
|
735
739
|
);
|
736
740
|
}
|
737
|
-
let
|
738
|
-
const
|
739
|
-
async function
|
740
|
-
const { urls: t = [], library: s } =
|
741
|
-
if (
|
742
|
-
const i = t.filter((o) =>
|
743
|
-
return i.length &&
|
744
|
-
(o) => (console.warn("loadScriptUrl error",
|
741
|
+
let J = [], R = {};
|
742
|
+
const Rt = (n) => n;
|
743
|
+
async function Ee(n, e = window) {
|
744
|
+
const { urls: t = [], library: s } = n, r = t.filter((o) => te(o));
|
745
|
+
if (r.length === 0 || !s) return null;
|
746
|
+
const i = t.filter((o) => ee(o));
|
747
|
+
return i.length && st(i, e), await nt(r, s, e).catch(
|
748
|
+
(o) => (console.warn("loadScriptUrl error", r, s, o), null)
|
745
749
|
);
|
746
750
|
}
|
747
|
-
function
|
748
|
-
const { getDsl: e, getDslByUrl: t, options: s } =
|
749
|
-
return s.window && (
|
750
|
-
delete s.window[
|
751
|
-
}),
|
752
|
-
if (!i || typeof i == "string") return
|
751
|
+
function Q(n) {
|
752
|
+
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
753
|
+
return s.window && (J.forEach((r) => {
|
754
|
+
delete s.window[r];
|
755
|
+
}), J = []), (r, i, a = B) => {
|
756
|
+
if (!i || typeof i == "string") return r;
|
753
757
|
if (i.type === "Schema" && i.id)
|
754
758
|
return a.defineAsyncComponent(async () => {
|
755
|
-
const o =
|
756
|
-
return o && (o.name =
|
759
|
+
const o = R[i.id] || await e(i.id);
|
760
|
+
return o && (o.name = r, R[i.id] = o), o ? Y({
|
757
761
|
...s,
|
758
762
|
Vue: a,
|
759
|
-
dsl:
|
763
|
+
dsl: oe(o),
|
760
764
|
mode: y.Runtime,
|
761
|
-
loader:
|
765
|
+
loader: Q(n)
|
762
766
|
}).renderer : null;
|
763
767
|
});
|
764
768
|
if (i.type === "UrlSchema" && i.url)
|
765
769
|
return a.defineAsyncComponent(async () => {
|
766
|
-
const o =
|
767
|
-
return o && (o.name =
|
770
|
+
const o = R[i.url] || await t(i.url);
|
771
|
+
return o && (o.name = r, R[i.url] = o), o ? Y({
|
768
772
|
...s,
|
769
773
|
Vue: a,
|
770
|
-
dsl:
|
774
|
+
dsl: oe(o),
|
771
775
|
mode: y.Runtime,
|
772
|
-
loader:
|
776
|
+
loader: Q(n)
|
773
777
|
}).renderer : null;
|
774
778
|
});
|
775
779
|
if (i.type === "Plugin") {
|
776
|
-
let o = i.library ?
|
777
|
-
return o || (i.library &&
|
780
|
+
let o = i.library ? R[i.library] : null;
|
781
|
+
return o || (i.library && J.push(i.library), o = R[i.library || Symbol()] = a.defineAsyncComponent(
|
778
782
|
async () => {
|
779
|
-
const c = await
|
783
|
+
const c = await Ee(i, s.window);
|
780
784
|
return c || (console.warn("getPlugin result is null", i), null);
|
781
785
|
}
|
782
786
|
), o);
|
783
787
|
}
|
784
|
-
return
|
788
|
+
return r;
|
785
789
|
};
|
786
790
|
}
|
787
|
-
function
|
788
|
-
|
791
|
+
function is() {
|
792
|
+
R = {};
|
789
793
|
}
|
790
|
-
function
|
791
|
-
if (!
|
792
|
-
const
|
793
|
-
if (
|
794
|
+
function k(n, e, t = B, s = Rt, r = [], i = !1) {
|
795
|
+
if (!n || !n.name || n.invisible) return null;
|
796
|
+
const a = t.getCurrentInstance()?.appContext, { id: o = null, directives: c = [] } = n, { vIf: l, vElseIf: u, vElse: p, vFor: m, vShow: f, vModels: d, vBind: h, vHtml: _, others: v } = je(c);
|
797
|
+
if (!i && (u || p))
|
794
798
|
return null;
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
if (
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
799
|
+
if (l && !Ct(l, e))
|
800
|
+
return It(n, e, t, s, r);
|
801
|
+
const F = (S) => {
|
802
|
+
const Ae = S.$components, Ie = (() => {
|
803
|
+
if (n.name === "component")
|
804
|
+
return kt(S, n.props?.is);
|
805
|
+
if (n.name === "slot") return n.name;
|
806
|
+
const $ = s(n.name, n.from, t);
|
807
|
+
return j($) ? it($) || ot($) ? $ : Ae[$] ?? a?.app?.component($) ?? $ : $;
|
808
|
+
})(), P = Ft(o, n.props ?? {}, S), Me = At(t, n.events ?? {}, S);
|
809
|
+
if (n.name === "slot")
|
810
|
+
return Mt(t, n, P, S, s);
|
811
|
+
h && Object.assign(P, S.__parseExpression(h.value)), f && (P.style = Object.assign(
|
812
|
+
P.style ?? {},
|
813
|
+
Tt(f, S)
|
814
|
+
)), _ && Object.assign(P, Dt(_, S)), d.forEach(($) => {
|
815
|
+
Object.assign(P, xt(t, $, S));
|
810
816
|
});
|
811
|
-
const
|
817
|
+
const He = Ot(
|
812
818
|
t,
|
813
|
-
|
814
|
-
|
819
|
+
n.children ?? [],
|
820
|
+
S,
|
815
821
|
s,
|
816
|
-
|
822
|
+
n
|
817
823
|
);
|
818
|
-
let
|
819
|
-
const
|
820
|
-
return
|
824
|
+
let U = t.createVNode(Ie, { ...P, ...Me }, He);
|
825
|
+
const ne = a ? bt(a, v, S) : [];
|
826
|
+
return ne.length && (U = t.withDirectives(U, ne)), U;
|
821
827
|
};
|
822
|
-
return
|
828
|
+
return m ? Ut(m, F, e) : F(e);
|
823
829
|
}
|
824
|
-
function
|
825
|
-
const s =
|
826
|
-
return e.map((
|
827
|
-
const i = typeof
|
830
|
+
function bt(n, e, t) {
|
831
|
+
const s = n.app;
|
832
|
+
return e.map((r) => {
|
833
|
+
const i = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
828
834
|
if (!i) return null;
|
829
835
|
const a = [i];
|
830
|
-
return
|
831
|
-
}).filter((
|
832
|
-
}
|
833
|
-
function
|
834
|
-
const e =
|
835
|
-
(
|
836
|
-
),
|
837
|
-
(
|
836
|
+
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
837
|
+
}).filter((r) => !!r);
|
838
|
+
}
|
839
|
+
function je(n = []) {
|
840
|
+
const e = n.find((u) => E(u.name) === "vIf"), t = n.find(
|
841
|
+
(u) => E(u.name) === "vElseIf"
|
842
|
+
), s = n.find((u) => E(u.name) === "vElse"), r = n.find((u) => E(u.name) === "vFor"), i = n.find((u) => E(u.name) === "vShow"), a = n.find((u) => E(u.name) === "vBind"), o = n.find((u) => E(u.name) === "vHtml"), c = n.filter(
|
843
|
+
(u) => E(u.name) === "vModel"
|
844
|
+
), l = n.filter(
|
845
|
+
(u) => !Ve.includes(E(u.name))
|
838
846
|
);
|
839
847
|
return {
|
840
848
|
vIf: e,
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
849
|
+
vElseIf: t,
|
850
|
+
vElse: s,
|
851
|
+
vFor: r,
|
852
|
+
vShow: i,
|
853
|
+
vModels: c,
|
854
|
+
vBind: a,
|
855
|
+
others: l,
|
856
|
+
vHtml: o
|
847
857
|
};
|
848
858
|
}
|
849
|
-
function
|
850
|
-
return !!e.__parseExpression(
|
859
|
+
function Ct(n, e) {
|
860
|
+
return !!e.__parseExpression(n.value);
|
851
861
|
}
|
852
|
-
function
|
853
|
-
return e ?
|
862
|
+
function kt(n, e) {
|
863
|
+
return e ? w(e) ? n.__parseExpression(e) : e : "div";
|
854
864
|
}
|
855
|
-
function
|
856
|
-
const s =
|
857
|
-
return s.ref = t.__ref(
|
865
|
+
function Ft(n, e, t) {
|
866
|
+
const s = X(e, t);
|
867
|
+
return s.ref = t.__ref(n, s.ref), s;
|
858
868
|
}
|
859
|
-
function
|
860
|
-
return
|
869
|
+
function X(n, e) {
|
870
|
+
return w(n) ? e.__parseExpression(n) : T(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => X(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
861
871
|
(t, s) => {
|
862
|
-
let
|
863
|
-
return t[s] =
|
872
|
+
let r = n[s];
|
873
|
+
return t[s] = X(r, e), t;
|
864
874
|
},
|
865
875
|
{}
|
866
|
-
) :
|
876
|
+
) : n;
|
867
877
|
}
|
868
|
-
function
|
869
|
-
const s = ["passive", "capture", "once"],
|
878
|
+
function At(n, e, t) {
|
879
|
+
const s = ["passive", "capture", "once"], r = {
|
870
880
|
capture: "Capture",
|
871
881
|
once: "Once",
|
872
882
|
passive: "OnceCapture"
|
873
883
|
};
|
874
884
|
return Object.keys(e || {}).reduce(
|
875
885
|
(i, a) => {
|
876
|
-
const o = e[a], c =
|
877
|
-
return
|
886
|
+
const o = e[a], c = Pe(o.modifiers), l = c.find((m) => s.includes(m)), u = "on" + qe(a) + (l && r[l] || ""), p = t.__parseFunction(o.handler);
|
887
|
+
return p && (i[u] = n.withModifiers(p, c)), i;
|
878
888
|
},
|
879
889
|
{}
|
880
890
|
);
|
881
891
|
}
|
882
|
-
function
|
883
|
-
|
892
|
+
function It(n, e, t, s, r = []) {
|
893
|
+
let i = r.findIndex((a) => a.id === n.id);
|
894
|
+
for (let a = ++i; a < r.length; a++) {
|
895
|
+
const { directives: o = [] } = r[a], { vElseIf: c, vElse: l } = je(o);
|
896
|
+
if (console.log(o), c) {
|
897
|
+
if (e.__parseExpression(c.value))
|
898
|
+
return k(r[a], e, t, s, r, !0);
|
899
|
+
continue;
|
900
|
+
}
|
901
|
+
if (l)
|
902
|
+
return k(r[a], e, t, s, r, !0);
|
903
|
+
}
|
904
|
+
return null;
|
905
|
+
}
|
906
|
+
function Pe(n = {}, e = !1) {
|
907
|
+
const t = Object.keys(n);
|
884
908
|
return e ? t.map((s) => "." + s) : t;
|
885
909
|
}
|
886
|
-
function
|
887
|
-
const { children: i } = e, a =
|
888
|
-
return o ? o(t) : i ? j(i) ?
|
889
|
-
|
910
|
+
function Mt(n, e, t, s, r) {
|
911
|
+
const { children: i } = e, a = Ht(e, s), o = s.$slots?.[a.name];
|
912
|
+
return o ? o(t) : i ? j(i) ? n.createTextVNode(i) : w(i) ? n.createTextVNode(
|
913
|
+
ye(s.__parseExpression(i))
|
890
914
|
) : Array.isArray(i) ? i.map(
|
891
|
-
(c) =>
|
915
|
+
(c) => k(c, s, n, r, i)
|
892
916
|
) : null : null;
|
893
917
|
}
|
894
|
-
function
|
895
|
-
const { props: t } =
|
918
|
+
function Ht(n, e) {
|
919
|
+
const { props: t } = n, s = t?.name || "default";
|
896
920
|
return {
|
897
|
-
name:
|
921
|
+
name: w(s) ? e.__parseExpression(s) : s,
|
898
922
|
params: []
|
899
923
|
};
|
900
924
|
}
|
901
|
-
function
|
902
|
-
return e.__parseExpression(
|
925
|
+
function Tt(n, e) {
|
926
|
+
return e.__parseExpression(n.value) ? {} : {
|
903
927
|
display: "none"
|
904
928
|
};
|
905
929
|
}
|
906
|
-
function
|
930
|
+
function Dt(n, e) {
|
907
931
|
return {
|
908
|
-
innerHTML: e.__parseExpression(
|
932
|
+
innerHTML: e.__parseExpression(n.value) || ""
|
909
933
|
};
|
910
934
|
}
|
911
|
-
function
|
935
|
+
function xt(n, e, t) {
|
912
936
|
const s = {
|
913
937
|
type: "JSFunction",
|
914
938
|
value: e.value?.value ? `(v) => {
|
915
939
|
${e.value.value} = v;
|
916
940
|
}` : "(v) => {}"
|
917
|
-
},
|
918
|
-
|
919
|
-
), a =
|
941
|
+
}, r = t.__parseFunction(s), i = Pe(
|
942
|
+
w(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
943
|
+
), a = w(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
920
944
|
return {
|
921
945
|
[a]: t.__parseExpression(e.value),
|
922
|
-
[`onUpdate:${a}`]: i.length &&
|
946
|
+
[`onUpdate:${a}`]: i.length && r ? n.withModifiers(r, i) : r
|
923
947
|
};
|
924
948
|
}
|
925
|
-
function
|
949
|
+
function Ot(n, e, t, s, r) {
|
926
950
|
if (!e) return null;
|
927
951
|
if (j(e))
|
928
952
|
return { default: () => e };
|
929
|
-
if (
|
953
|
+
if (w(e))
|
930
954
|
return {
|
931
|
-
default: () =>
|
955
|
+
default: () => ye(t.__parseExpression(e))
|
932
956
|
};
|
933
957
|
if (Array.isArray(e) && e.length > 0) {
|
934
|
-
const i =
|
935
|
-
[`scope_${
|
958
|
+
const i = Nt(e), a = (o) => !o || !r ? {} : r?.id && Object.keys(o).length ? {
|
959
|
+
[`scope_${r.id}`]: o
|
936
960
|
} : {};
|
937
|
-
return Object.entries(i).reduce((o, [c, { nodes:
|
938
|
-
const m =
|
939
|
-
return
|
940
|
-
(
|
961
|
+
return Object.entries(i).reduce((o, [c, { nodes: l, params: u }]) => (o[c] = (p) => {
|
962
|
+
const m = u.length ? Je(p ?? {}, u) : a(p);
|
963
|
+
return l.map(
|
964
|
+
(f) => k(f, t.__clone(m), n, s, l)
|
941
965
|
);
|
942
966
|
}, o), {});
|
943
967
|
}
|
944
968
|
return null;
|
945
969
|
}
|
946
|
-
function
|
970
|
+
function Nt(n) {
|
947
971
|
const e = {
|
948
972
|
default: {
|
949
973
|
params: [],
|
950
974
|
nodes: []
|
951
975
|
}
|
952
976
|
};
|
953
|
-
for (const t of
|
954
|
-
const s =
|
955
|
-
e[
|
977
|
+
for (const t of n) {
|
978
|
+
const s = Bt(t.slot), r = s.name;
|
979
|
+
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
956
980
|
nodes: [t],
|
957
981
|
params: s.params
|
958
982
|
};
|
959
983
|
}
|
960
984
|
return e;
|
961
985
|
}
|
962
|
-
function
|
963
|
-
return j(
|
986
|
+
function Bt(n = "default") {
|
987
|
+
return j(n) ? { name: n, params: [] } : { params: [], ...n };
|
964
988
|
}
|
965
|
-
function
|
966
|
-
const { value: s, iterator:
|
989
|
+
function Ut(n, e, t) {
|
990
|
+
const { value: s, iterator: r } = n, { item: i = "item", index: a = "index" } = r || {};
|
967
991
|
let o = t.__parseExpression(s) || [];
|
968
|
-
return Number.isInteger(o) && (o = new Array(o).fill(!0).map((c,
|
992
|
+
return Number.isInteger(o) && (o = new Array(o).fill(!0).map((c, l) => l + 1)), Array.isArray(o) ? o.map((c, l) => e(t.__clone({ [i]: c, [a]: l }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
969
993
|
}
|
970
|
-
const
|
994
|
+
const ue = ve({
|
971
995
|
name: "VtjPageContainer",
|
972
996
|
async setup() {
|
973
|
-
const
|
997
|
+
const n = be(), e = ge(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, i = W(Symbol());
|
974
998
|
if (s) {
|
975
999
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
976
|
-
const { useTitle: a } =
|
1000
|
+
const { useTitle: a } = n?.adapter;
|
977
1001
|
a && a(s.title || "VTJ");
|
978
1002
|
}
|
979
1003
|
return {
|
980
|
-
provider:
|
981
|
-
component:
|
1004
|
+
provider: n,
|
1005
|
+
component: r,
|
982
1006
|
file: s,
|
983
1007
|
query: e.query,
|
984
1008
|
meta: e.meta,
|
@@ -987,44 +1011,44 @@ const ce = he({
|
|
987
1011
|
};
|
988
1012
|
},
|
989
1013
|
render() {
|
990
|
-
const { component:
|
991
|
-
return
|
1014
|
+
const { component: n, query: e, sid: t } = this;
|
1015
|
+
return n ? V(n, { ...e, key: t }) : V("div", "页面不存在");
|
992
1016
|
},
|
993
1017
|
activated() {
|
994
1018
|
this.meta.cache === !1 && (this.sid = Symbol());
|
995
1019
|
}
|
996
|
-
}),
|
1020
|
+
}), Lt = ve({
|
997
1021
|
name: "VtjStartupContainer",
|
998
1022
|
render() {
|
999
|
-
return
|
1023
|
+
return V("div", "page not found!");
|
1000
1024
|
}
|
1001
|
-
}),
|
1002
|
-
var
|
1003
|
-
class
|
1025
|
+
}), Re = Symbol("Provider");
|
1026
|
+
var qt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(qt || {});
|
1027
|
+
class Jt extends Te {
|
1004
1028
|
constructor(e) {
|
1005
1029
|
super(), this.options = e;
|
1006
1030
|
const {
|
1007
1031
|
service: t,
|
1008
1032
|
mode: s = y.Raw,
|
1009
|
-
dependencies:
|
1033
|
+
dependencies: r,
|
1010
1034
|
materials: i,
|
1011
1035
|
project: a = {},
|
1012
1036
|
adapter: o = {},
|
1013
1037
|
globals: c = {},
|
1014
|
-
modules:
|
1015
|
-
router:
|
1016
|
-
materialPath:
|
1038
|
+
modules: l = {},
|
1039
|
+
router: u = null,
|
1040
|
+
materialPath: p = "./",
|
1017
1041
|
nodeEnv: m = "development"
|
1018
1042
|
/* Development */
|
1019
1043
|
} = e;
|
1020
|
-
this.mode = s, this.modules =
|
1021
|
-
const { access:
|
1022
|
-
|
1044
|
+
this.mode = s, this.modules = l, this.service = t, this.router = u, this.materialPath = p, this.nodeEnv = m, r && (this.dependencies = r), i && (this.materials = i), Object.assign(this.globals, c), Object.assign(this.adapter, o);
|
1045
|
+
const { access: f, request: d } = this.adapter;
|
1046
|
+
f && f.connect({ mode: s, router: u, request: d }), a && s !== y.Design ? this.load(a) : this.project = a;
|
1023
1047
|
}
|
1024
1048
|
mode;
|
1025
1049
|
globals = {};
|
1026
1050
|
modules = {};
|
1027
|
-
adapter = { request:
|
1051
|
+
adapter = { request: z, jsonp: he };
|
1028
1052
|
apis = {};
|
1029
1053
|
dependencies = {};
|
1030
1054
|
materials = {};
|
@@ -1043,104 +1067,104 @@ class Nt extends Fe {
|
|
1043
1067
|
try {
|
1044
1068
|
s = await e.apply(e, t);
|
1045
1069
|
} catch (i) {
|
1046
|
-
|
1070
|
+
C.warn("模拟数据模版异常", i);
|
1047
1071
|
}
|
1048
|
-
return
|
1072
|
+
return M()?.mock(s);
|
1049
1073
|
};
|
1050
1074
|
}
|
1051
1075
|
async load(e) {
|
1052
1076
|
const t = this.modules[`.vtj/projects/${e.id}.json`] || this.modules[`/src/.vtj/projects/${e.id}.json`];
|
1053
1077
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1054
1078
|
throw new Error("project is null");
|
1055
|
-
const { apis: s = [], meta:
|
1056
|
-
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis =
|
1079
|
+
const { apis: s = [], meta: r = [] } = this.project, i = window;
|
1080
|
+
i && (i.CKEDITOR_VERSION = void 0), this.mode === y.Raw ? await this.loadDependencies(i) : await this.loadAssets(i), this.initMock(i), this.apis = ft(s, r, this.adapter), $e(i), dt(s, i), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1057
1081
|
}
|
1058
1082
|
initMock(e) {
|
1059
|
-
const t =
|
1083
|
+
const t = M(e);
|
1060
1084
|
t && t.setup({
|
1061
1085
|
timeout: "50-500"
|
1062
1086
|
});
|
1063
1087
|
}
|
1064
1088
|
async loadDependencies(e) {
|
1065
1089
|
const t = Object.entries(this.dependencies);
|
1066
|
-
for (const [s,
|
1067
|
-
e[s] || (e[s] = this.library[s] = await
|
1090
|
+
for (const [s, r] of t)
|
1091
|
+
e[s] || (e[s] = this.library[s] = await r());
|
1068
1092
|
}
|
1069
1093
|
async loadAssets(e) {
|
1070
|
-
const { dependencies: t = [] } = this.project, { dependencies: s, library:
|
1094
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: i, materialPath: a, nodeEnv: o } = this, {
|
1071
1095
|
libraryExports: c,
|
1072
|
-
libraryMap:
|
1073
|
-
materials:
|
1074
|
-
materialExports:
|
1096
|
+
libraryMap: l,
|
1097
|
+
materials: u,
|
1098
|
+
materialExports: p,
|
1075
1099
|
materialMapLibrary: m
|
1076
|
-
} =
|
1100
|
+
} = Ze(
|
1077
1101
|
t,
|
1078
1102
|
a,
|
1079
1103
|
o === "development"
|
1080
1104
|
/* Development */
|
1081
1105
|
);
|
1082
|
-
for (const
|
1083
|
-
const
|
1084
|
-
if (
|
1085
|
-
|
1086
|
-
else if (
|
1087
|
-
e[
|
1106
|
+
for (const f of c) {
|
1107
|
+
const d = s[f], h = e[f];
|
1108
|
+
if (h)
|
1109
|
+
r[f] = h;
|
1110
|
+
else if (d)
|
1111
|
+
e[f] = r[f] = await d();
|
1088
1112
|
else {
|
1089
|
-
const
|
1090
|
-
for (const
|
1091
|
-
|
1092
|
-
|
1113
|
+
const _ = l[f] || [];
|
1114
|
+
for (const v of _)
|
1115
|
+
ee(v) && await tt(f, b.append(v, { v: A })), te(v) && await ae(b.append(v, { v: A }));
|
1116
|
+
r[f] = e[f];
|
1093
1117
|
}
|
1094
1118
|
}
|
1095
1119
|
if (o === "development") {
|
1096
|
-
for (const
|
1097
|
-
await
|
1098
|
-
const
|
1099
|
-
for (const
|
1100
|
-
const
|
1101
|
-
if (
|
1102
|
-
|
1103
|
-
i[
|
1120
|
+
for (const d of u)
|
1121
|
+
await ae(b.append(d, { v: A }));
|
1122
|
+
const f = this.materials || {};
|
1123
|
+
for (const d of p) {
|
1124
|
+
const h = e[m[d]], _ = De[d];
|
1125
|
+
if (_)
|
1126
|
+
h && _.forEach((v) => {
|
1127
|
+
i[v] = h[v];
|
1104
1128
|
});
|
1105
1129
|
else {
|
1106
|
-
const
|
1107
|
-
|
1108
|
-
i[
|
1130
|
+
const v = f[d] ? (await f[d]()).default : e[d];
|
1131
|
+
v && h && (v.components || []).forEach((F) => {
|
1132
|
+
i[F.name] = et(F, h);
|
1109
1133
|
});
|
1110
1134
|
}
|
1111
1135
|
}
|
1112
1136
|
}
|
1113
1137
|
}
|
1114
1138
|
initRouter() {
|
1115
|
-
const { router: e, project: t, options: s, adapter:
|
1139
|
+
const { router: e, project: t, options: s, adapter: r } = this;
|
1116
1140
|
if (!e) return;
|
1117
1141
|
const i = t?.platform === "uniapp" ? "pages" : "page", {
|
1118
1142
|
routeAppendTo: a,
|
1119
1143
|
pageRouteName: o = i,
|
1120
1144
|
routeMeta: c
|
1121
|
-
} = s,
|
1122
|
-
path: `${
|
1123
|
-
name:
|
1124
|
-
component:
|
1125
|
-
},
|
1126
|
-
path:
|
1127
|
-
name:
|
1128
|
-
component: t?.homepage ?
|
1145
|
+
} = s, l = a ? "" : "/", u = {
|
1146
|
+
path: `${l}${o}/:id`,
|
1147
|
+
name: I,
|
1148
|
+
component: ue
|
1149
|
+
}, p = {
|
1150
|
+
path: l,
|
1151
|
+
name: O,
|
1152
|
+
component: t?.homepage ? ue : r.startupComponent || Lt,
|
1129
1153
|
meta: c
|
1130
1154
|
};
|
1131
|
-
e.hasRoute(
|
1155
|
+
e.hasRoute(I) && e.removeRoute(I), e.hasRoute(O) && e.removeRoute(O), a ? (e.addRoute(a, u), e.addRoute(a, p)) : (e.addRoute(u), e.addRoute(p));
|
1132
1156
|
}
|
1133
1157
|
install(e) {
|
1134
1158
|
const t = e.config.globalProperties.installed || {};
|
1135
|
-
for (const [s,
|
1136
|
-
!t[s] &&
|
1137
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
1138
|
-
const a =
|
1159
|
+
for (const [s, r] of Object.entries(this.library))
|
1160
|
+
!t[s] && rt(r) && (e.use(r), t[s] = !0);
|
1161
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(Re, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, i) => {
|
1162
|
+
const a = r?.$options.name, o = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${o} ${i}`;
|
1139
1163
|
console.error(
|
1140
1164
|
"[VTJ Error]:",
|
1141
1165
|
{
|
1142
1166
|
err: s,
|
1143
|
-
instance:
|
1167
|
+
instance: r,
|
1144
1168
|
info: i
|
1145
1169
|
},
|
1146
1170
|
s?.stack
|
@@ -1152,12 +1176,12 @@ class Nt extends Fe {
|
|
1152
1176
|
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
1153
1177
|
}
|
1154
1178
|
getPage(e) {
|
1155
|
-
const { pages: t = [] } = this.project || {}, s = (
|
1179
|
+
const { pages: t = [] } = this.project || {}, s = (r, i = []) => {
|
1156
1180
|
for (const a of i) {
|
1157
|
-
if (a.id ===
|
1181
|
+
if (a.id === r)
|
1158
1182
|
return a;
|
1159
1183
|
if (a.children && a.children.length) {
|
1160
|
-
const o = s(
|
1184
|
+
const o = s(r, a.children);
|
1161
1185
|
if (o)
|
1162
1186
|
return o;
|
1163
1187
|
}
|
@@ -1185,20 +1209,20 @@ class Nt extends Fe {
|
|
1185
1209
|
}).then((s) => s.data).catch(() => null) : null);
|
1186
1210
|
}
|
1187
1211
|
createDslRenderer(e, t = {}) {
|
1188
|
-
const { library: s, components:
|
1212
|
+
const { library: s, components: r, mode: i, apis: a } = this, o = {
|
1189
1213
|
mode: i,
|
1190
1214
|
Vue: s.Vue,
|
1191
|
-
components:
|
1215
|
+
components: r,
|
1192
1216
|
libs: s,
|
1193
1217
|
apis: a,
|
1194
1218
|
window,
|
1195
1219
|
...t
|
1196
|
-
}, c =
|
1197
|
-
getDsl: async (
|
1198
|
-
getDslByUrl: async (
|
1220
|
+
}, c = Q({
|
1221
|
+
getDsl: async (l) => await this.getDsl(l) || null,
|
1222
|
+
getDslByUrl: async (l) => await this.getDslByUrl(l) || null,
|
1199
1223
|
options: o
|
1200
1224
|
});
|
1201
|
-
return
|
1225
|
+
return Y({
|
1202
1226
|
...o,
|
1203
1227
|
dsl: e,
|
1204
1228
|
loader: c
|
@@ -1207,41 +1231,41 @@ class Nt extends Fe {
|
|
1207
1231
|
async getRenderComponent(e, t) {
|
1208
1232
|
const s = this.getFile(e);
|
1209
1233
|
if (!s)
|
1210
|
-
return
|
1234
|
+
return C.warn(`Can not find file: ${e}`), null;
|
1211
1235
|
t && t(s);
|
1212
|
-
const
|
1236
|
+
const r = `.vtj/vue/${e}.vue`, i = this.modules[r] || this.modules[`/src/pages/${e}.vue`];
|
1213
1237
|
if (i)
|
1214
1238
|
return (await i())?.default;
|
1215
1239
|
const a = await this.getDsl(s.id);
|
1216
|
-
return a ? this.createDslRenderer(a).renderer : (
|
1240
|
+
return a ? this.createDslRenderer(a).renderer : (C.warn(`Can not find dsl: ${e}`), null);
|
1217
1241
|
}
|
1218
1242
|
defineUrlSchemaComponent(e, t) {
|
1219
|
-
return
|
1243
|
+
return ce(async () => {
|
1220
1244
|
const s = await this.getDslByUrl(e);
|
1221
1245
|
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1222
1246
|
});
|
1223
1247
|
}
|
1224
1248
|
definePluginComponent(e) {
|
1225
|
-
return
|
1249
|
+
return ce(async () => await Ee(e, window));
|
1226
1250
|
}
|
1227
1251
|
}
|
1228
|
-
function
|
1229
|
-
const e = new
|
1252
|
+
function os(n) {
|
1253
|
+
const e = new Jt(n);
|
1230
1254
|
return {
|
1231
1255
|
provider: e,
|
1232
1256
|
onReady: (s) => e.ready(s)
|
1233
1257
|
};
|
1234
1258
|
}
|
1235
|
-
function be(
|
1236
|
-
const e =
|
1259
|
+
function be(n = {}) {
|
1260
|
+
const e = me(Re, null);
|
1237
1261
|
if (!e)
|
1238
1262
|
throw new Error("Can not find provider");
|
1239
1263
|
if (e.nodeEnv === "development") {
|
1240
|
-
const { id: t, version: s } =
|
1264
|
+
const { id: t, version: s } = n;
|
1241
1265
|
t && s && (async () => {
|
1242
|
-
const
|
1243
|
-
|
1244
|
-
`[ ${
|
1266
|
+
const r = await e.getDsl(t);
|
1267
|
+
r?.__VERSION__ !== s && e.adapter.notify && e.adapter.notify(
|
1268
|
+
`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
|
1245
1269
|
"版本不一致",
|
1246
1270
|
"warning"
|
1247
1271
|
);
|
@@ -1249,23 +1273,23 @@ function be(r = {}) {
|
|
1249
1273
|
}
|
1250
1274
|
return e;
|
1251
1275
|
}
|
1252
|
-
const
|
1276
|
+
const Ce = {
|
1253
1277
|
type: "json",
|
1254
1278
|
validSuccess: !0,
|
1255
1279
|
originResponse: !1,
|
1256
1280
|
failMessage: !0,
|
1257
|
-
validate: (
|
1258
|
-
},
|
1281
|
+
validate: (n) => n.data?.code === 0
|
1282
|
+
}, Kt = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
1259
1283
|
url: e,
|
1260
1284
|
method: "post",
|
1261
1285
|
params: { type: t },
|
1262
|
-
query:
|
1286
|
+
query: r,
|
1263
1287
|
data: {
|
1264
1288
|
type: t,
|
1265
1289
|
data: s
|
1266
1290
|
},
|
1267
|
-
settings:
|
1268
|
-
}),
|
1291
|
+
settings: Ce
|
1292
|
+
}), zt = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1269
1293
|
url: e,
|
1270
1294
|
method: "post",
|
1271
1295
|
data: {
|
@@ -1273,12 +1297,12 @@ const Ee = {
|
|
1273
1297
|
projectId: s
|
1274
1298
|
},
|
1275
1299
|
settings: {
|
1276
|
-
...
|
1300
|
+
...Ce,
|
1277
1301
|
type: "data"
|
1278
1302
|
}
|
1279
|
-
}).then((
|
1280
|
-
function
|
1281
|
-
return
|
1303
|
+
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1304
|
+
function as(n) {
|
1305
|
+
return de({
|
1282
1306
|
settings: {
|
1283
1307
|
type: "json",
|
1284
1308
|
validSuccess: !0,
|
@@ -1286,14 +1310,14 @@ function ss(r) {
|
|
1286
1310
|
failMessage: !0,
|
1287
1311
|
validate: (e) => e.data?.code === 0,
|
1288
1312
|
showError: (e) => {
|
1289
|
-
|
1313
|
+
n && n(e || "未知错误");
|
1290
1314
|
}
|
1291
1315
|
}
|
1292
1316
|
});
|
1293
1317
|
}
|
1294
|
-
class
|
1295
|
-
constructor(e =
|
1296
|
-
this.req = e, this.api =
|
1318
|
+
class se {
|
1319
|
+
constructor(e = z) {
|
1320
|
+
this.req = e, this.api = Kt(e), this.uploader = zt(e);
|
1297
1321
|
}
|
1298
1322
|
api;
|
1299
1323
|
pluginCaches = {};
|
@@ -1377,10 +1401,10 @@ class ee {
|
|
1377
1401
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1378
1402
|
}
|
1379
1403
|
async getPluginMaterial(e) {
|
1380
|
-
const { urls: t = [] } = e, s = t.filter((i) =>
|
1404
|
+
const { urls: t = [] } = e, s = t.filter((i) => Qe(i))[0];
|
1381
1405
|
if (!s) return null;
|
1382
|
-
const
|
1383
|
-
return
|
1406
|
+
const r = this.pluginCaches[s];
|
1407
|
+
return r || (this.pluginCaches[s] = z.send({
|
1384
1408
|
url: s,
|
1385
1409
|
method: "get",
|
1386
1410
|
settings: {
|
@@ -1393,77 +1417,77 @@ class ee {
|
|
1393
1417
|
return console.log("BaseService.genSource", e), "";
|
1394
1418
|
}
|
1395
1419
|
}
|
1396
|
-
const
|
1420
|
+
const g = new Ke({
|
1397
1421
|
type: "local",
|
1398
1422
|
expired: 0,
|
1399
1423
|
prefix: "__VTJ_"
|
1400
1424
|
});
|
1401
|
-
class
|
1425
|
+
class cs extends se {
|
1402
1426
|
init(e) {
|
1403
|
-
const t = new
|
1404
|
-
return
|
1427
|
+
const t = new N(e), s = g.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1428
|
+
return g.save(`project_${t.id}`, r), Promise.resolve(r);
|
1405
1429
|
}
|
1406
1430
|
saveProject(e) {
|
1407
|
-
const t = new
|
1408
|
-
return
|
1431
|
+
const t = new N(e);
|
1432
|
+
return g.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1409
1433
|
}
|
1410
1434
|
saveMaterials(e, t) {
|
1411
|
-
return
|
1435
|
+
return g.save(`materials_${e.id}`, Z(t)), Promise.resolve(!0);
|
1412
1436
|
}
|
1413
1437
|
saveFile(e) {
|
1414
|
-
return
|
1438
|
+
return g.save(`file_${e.id}`, e), Promise.resolve(!0);
|
1415
1439
|
}
|
1416
1440
|
getFile(e) {
|
1417
|
-
const t =
|
1441
|
+
const t = g.get(`file_${e}`);
|
1418
1442
|
return t ? Promise.resolve(t) : Promise.reject(null);
|
1419
1443
|
}
|
1420
1444
|
removeFile(e) {
|
1421
|
-
return
|
1445
|
+
return g.remove(`file_${e}`), Promise.resolve(!0);
|
1422
1446
|
}
|
1423
1447
|
saveHistory(e) {
|
1424
|
-
return
|
1448
|
+
return g.save(`history_${e.id}`, e), Promise.resolve(!0);
|
1425
1449
|
}
|
1426
1450
|
removeHistory(e) {
|
1427
|
-
const t =
|
1451
|
+
const t = g.get(`history_${e}`);
|
1428
1452
|
if (t) {
|
1429
|
-
const
|
1430
|
-
this.removeHistoryItem(e,
|
1453
|
+
const r = (t.items || []).map((i) => i.id);
|
1454
|
+
this.removeHistoryItem(e, r), g.remove(`history_${e}`);
|
1431
1455
|
}
|
1432
1456
|
return Promise.resolve(!0);
|
1433
1457
|
}
|
1434
1458
|
getHistory(e) {
|
1435
|
-
const t =
|
1459
|
+
const t = g.get(`history_${e}`), s = new pe(t || { id: e });
|
1436
1460
|
return Promise.resolve(s.toDsl());
|
1437
1461
|
}
|
1438
1462
|
getHistoryItem(e, t) {
|
1439
|
-
const s =
|
1463
|
+
const s = g.get(`history_${e}_${t}`);
|
1440
1464
|
return Promise.resolve(s);
|
1441
1465
|
}
|
1442
1466
|
saveHistoryItem(e, t) {
|
1443
|
-
return
|
1467
|
+
return g.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1444
1468
|
}
|
1445
1469
|
removeHistoryItem(e, t) {
|
1446
1470
|
return t.forEach((s) => {
|
1447
|
-
|
1471
|
+
g.remove(`history_${e}_${s}`);
|
1448
1472
|
}), Promise.resolve(!0);
|
1449
1473
|
}
|
1450
1474
|
}
|
1451
|
-
class
|
1475
|
+
class Vt extends se {
|
1452
1476
|
projects = {};
|
1453
1477
|
materials = {};
|
1454
1478
|
files = {};
|
1455
1479
|
histories = {};
|
1456
1480
|
historyItems = {};
|
1457
1481
|
init(e) {
|
1458
|
-
const t = new
|
1459
|
-
return this.projects[
|
1482
|
+
const t = new N(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1483
|
+
return this.projects[r.id] = r, Promise.resolve(r);
|
1460
1484
|
}
|
1461
1485
|
saveProject(e) {
|
1462
|
-
const t = new
|
1486
|
+
const t = new N(e);
|
1463
1487
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
1464
1488
|
}
|
1465
1489
|
saveMaterials(e, t) {
|
1466
|
-
return e.id && (this.materials[e.id] =
|
1490
|
+
return e.id && (this.materials[e.id] = Z(t)), Promise.resolve(!0);
|
1467
1491
|
}
|
1468
1492
|
saveFile(e) {
|
1469
1493
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -1481,18 +1505,18 @@ class Lt extends ee {
|
|
1481
1505
|
removeHistory(e) {
|
1482
1506
|
const t = this.histories[e];
|
1483
1507
|
if (t) {
|
1484
|
-
const
|
1485
|
-
this.removeHistoryItem(e,
|
1508
|
+
const r = (t.items || []).map((i) => i.id);
|
1509
|
+
this.removeHistoryItem(e, r), delete this.historyItems[e];
|
1486
1510
|
}
|
1487
1511
|
return Promise.resolve(!0);
|
1488
1512
|
}
|
1489
1513
|
getHistory(e) {
|
1490
|
-
const t = this.histories[e], s = new
|
1514
|
+
const t = this.histories[e], s = new pe(t || { id: e });
|
1491
1515
|
return Promise.resolve(s);
|
1492
1516
|
}
|
1493
1517
|
getHistoryItem(e, t) {
|
1494
|
-
const s = `${e}_${t}`,
|
1495
|
-
return Promise.resolve(
|
1518
|
+
const s = `${e}_${t}`, r = this.historyItems[s] || {};
|
1519
|
+
return Promise.resolve(r);
|
1496
1520
|
}
|
1497
1521
|
saveHistoryItem(e, t) {
|
1498
1522
|
const s = `${e}_${t.id}`;
|
@@ -1500,16 +1524,16 @@ class Lt extends ee {
|
|
1500
1524
|
}
|
1501
1525
|
removeHistoryItem(e, t) {
|
1502
1526
|
return t.forEach((s) => {
|
1503
|
-
const
|
1504
|
-
delete this.historyItems[
|
1527
|
+
const r = `${e}_${s}`;
|
1528
|
+
delete this.historyItems[r];
|
1505
1529
|
}), Promise.resolve(!0);
|
1506
1530
|
}
|
1507
1531
|
}
|
1508
|
-
let
|
1509
|
-
function
|
1510
|
-
return
|
1532
|
+
let x = null;
|
1533
|
+
function ls() {
|
1534
|
+
return x || (x = new Vt(), x);
|
1511
1535
|
}
|
1512
|
-
class
|
1536
|
+
class us extends se {
|
1513
1537
|
getFileCaches = {};
|
1514
1538
|
async getExtension() {
|
1515
1539
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1526,7 +1550,7 @@ class is extends ee {
|
|
1526
1550
|
async saveMaterials(e, t) {
|
1527
1551
|
return !!await this.api("saveMaterials", {
|
1528
1552
|
project: e,
|
1529
|
-
materials:
|
1553
|
+
materials: Z(t)
|
1530
1554
|
}).catch(() => !1);
|
1531
1555
|
}
|
1532
1556
|
async saveFile(e) {
|
@@ -1566,128 +1590,128 @@ class is extends ee {
|
|
1566
1590
|
);
|
1567
1591
|
}
|
1568
1592
|
}
|
1569
|
-
function
|
1593
|
+
function ke(n, e, t = []) {
|
1570
1594
|
return t.map((s) => {
|
1571
|
-
const { id:
|
1595
|
+
const { id: r, title: i, icon: a, children: o, hidden: c } = s;
|
1572
1596
|
return {
|
1573
|
-
id:
|
1597
|
+
id: r,
|
1574
1598
|
title: i,
|
1575
1599
|
icon: a,
|
1576
1600
|
hidden: c,
|
1577
|
-
url: `${
|
1578
|
-
children: o && o.length ?
|
1601
|
+
url: `${n}/${e}/${r}`,
|
1602
|
+
children: o && o.length ? ke(n, e, o) : void 0
|
1579
1603
|
};
|
1580
1604
|
});
|
1581
1605
|
}
|
1582
|
-
function
|
1583
|
-
if (!e) return
|
1606
|
+
function Fe(n, e) {
|
1607
|
+
if (!e) return n;
|
1584
1608
|
let t = [];
|
1585
|
-
for (const s of
|
1609
|
+
for (const s of n)
|
1586
1610
|
if (s.children && s.children.length) {
|
1587
|
-
const
|
1588
|
-
|
1611
|
+
const r = Fe(s.children, e);
|
1612
|
+
r.length && (s.children = r, t.push(s));
|
1589
1613
|
} else
|
1590
1614
|
e.can(s.id.toString()) && t.push(s);
|
1591
1615
|
return t;
|
1592
1616
|
}
|
1593
|
-
function
|
1617
|
+
function ps(n) {
|
1594
1618
|
const {
|
1595
1619
|
menuPathPrefix: e = "",
|
1596
1620
|
pageRouteName: t = "page",
|
1597
1621
|
disableMenusFilter: s = !1
|
1598
|
-
} =
|
1599
|
-
|
1600
|
-
const { name: m, params:
|
1601
|
-
if (m ===
|
1602
|
-
const
|
1603
|
-
o.value = !
|
1604
|
-
} else if (m ===
|
1605
|
-
const
|
1606
|
-
o.value = !
|
1622
|
+
} = n || {}, r = be(), i = ge(), a = lt(), o = W(!1), c = W(!1), l = r.project;
|
1623
|
+
ze(() => {
|
1624
|
+
const { name: m, params: f, meta: d } = i;
|
1625
|
+
if (m === I) {
|
1626
|
+
const h = r.getPage(f.id);
|
1627
|
+
o.value = !h?.mask, c.value = !!h?.pure;
|
1628
|
+
} else if (m === O) {
|
1629
|
+
const h = r.getHomepage();
|
1630
|
+
o.value = !h?.mask, c.value = !!h?.pure;
|
1607
1631
|
} else
|
1608
|
-
o.value = !
|
1632
|
+
o.value = !d.mask, c.value = !!d.pure;
|
1609
1633
|
});
|
1610
|
-
const
|
1634
|
+
const u = ke(
|
1611
1635
|
e,
|
1612
1636
|
t,
|
1613
|
-
|
1614
|
-
),
|
1637
|
+
l?.pages
|
1638
|
+
), p = l?.config;
|
1615
1639
|
return {
|
1616
1640
|
disabled: o,
|
1617
|
-
logo:
|
1618
|
-
themeSwitchable:
|
1619
|
-
title:
|
1620
|
-
menus: s ?
|
1641
|
+
logo: p?.logo,
|
1642
|
+
themeSwitchable: p?.themeSwitchable,
|
1643
|
+
title: p?.title || l?.description || l?.name || "VTJ App",
|
1644
|
+
menus: s ? u : Fe(u, a),
|
1621
1645
|
pure: c
|
1622
1646
|
};
|
1623
1647
|
}
|
1624
1648
|
export {
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1649
|
+
we as ACCESS_KEY,
|
1650
|
+
Se as Access,
|
1651
|
+
Ye as BUILD_IN_TAGS,
|
1652
|
+
Ve as BUILT_IN_DIRECTIVES,
|
1653
|
+
se as BaseService,
|
1654
|
+
le as CONTEXT_HOST,
|
1655
|
+
vt as Context,
|
1632
1656
|
y as ContextMode,
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1657
|
+
We as DATA_TYPES,
|
1658
|
+
O as HOMEPAGE_ROUTE_NAME,
|
1659
|
+
Ge as HTML_TAGS,
|
1660
|
+
ss as JSCodeToString,
|
1661
|
+
Xt as LIFE_CYCLES_LIST,
|
1662
|
+
us as LocalService,
|
1663
|
+
Vt as MemoryService,
|
1664
|
+
qt as NodeEnv,
|
1665
|
+
I as PAGE_ROUTE_NAME,
|
1666
|
+
Jt as Provider,
|
1667
|
+
cs as StorageService,
|
1668
|
+
A as VTJ_RENDERER_VERSION,
|
1669
|
+
_e as adoptedStyleSheets,
|
1670
|
+
is as clearLoaderCache,
|
1671
|
+
rs as createAccess,
|
1672
|
+
ns as createAdapter,
|
1673
|
+
Zt as createAssetScripts,
|
1674
|
+
es as createAssetsCss,
|
1675
|
+
Et as createDataSources,
|
1676
|
+
Q as createLoader,
|
1677
|
+
ls as createMemoryService,
|
1678
|
+
pt as createMetaApi,
|
1679
|
+
ht as createMock,
|
1680
|
+
os as createProvider,
|
1681
|
+
Y as createRenderer,
|
1682
|
+
ut as createSchemaApi,
|
1683
|
+
ft as createSchemaApis,
|
1684
|
+
as as createServiceRequest,
|
1685
|
+
Rt as defaultLoader,
|
1686
|
+
D as fillBasePath,
|
1687
|
+
M as getMock,
|
1688
|
+
Pe as getModifiers,
|
1689
|
+
Ee as getPlugin,
|
1690
|
+
et as getRawComponent,
|
1691
|
+
it as isBuiltInTag,
|
1692
|
+
ee as isCSSUrl,
|
1693
|
+
at as isJSCode,
|
1694
|
+
w as isJSExpression,
|
1695
|
+
T as isJSFunction,
|
1696
|
+
Qe as isJSON,
|
1697
|
+
te as isJSUrl,
|
1698
|
+
ot as isNativeTag,
|
1699
|
+
rt as isVuePlugin,
|
1700
|
+
tt as loadCss,
|
1701
|
+
st as loadCssUrl,
|
1702
|
+
nt as loadScriptUrl,
|
1703
|
+
mt as mockApi,
|
1704
|
+
dt as mockApis,
|
1705
|
+
$e as mockCleanup,
|
1706
|
+
k as nodeRender,
|
1707
|
+
Ze as parseDeps,
|
1708
|
+
H as parseExpression,
|
1709
|
+
G as parseFunction,
|
1710
|
+
Re as providerKey,
|
1711
|
+
Xe as removeProdFlag,
|
1712
|
+
ts as setupPageSetting,
|
1713
|
+
ye as toString,
|
1714
|
+
lt as useAccess,
|
1715
|
+
ps as useMask,
|
1692
1716
|
be as useProvider
|
1693
1717
|
};
|