@vtj/renderer 0.10.1 → 0.10.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 +6 -6
- package/dist/index.mjs +461 -461
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
import { Base as De, BUILT_IN_COMPONENTS as He, ProjectModel as H, HistoryModel as pe } from "@vtj/core";
|
2
2
|
import { isUrl as Oe, url as R, dedupArray as Be, isString as j, isFunction as V, logger as P, storage as U, cookie as L, toArray as ie, unRSA as ae, delay as fe, createRequest as he, jsonp as me, merge as Ne, pathToRegexp as Ue, pathToRegexpMatch as Le, formDataToJson as qe, camelCase as $, upperFirst as Je, pick as ze, request as K, loadScript as ce, Storage as Ve, mapToObject as Z } from "@vtj/utils";
|
3
3
|
import * as B from "vue";
|
4
|
-
import { inject as ge, toRef as Ke, readonly as We, ref as C, customRef as Ge, onBeforeUnmount as Ye, getCurrentScope as Qe, onScopeDispose as Xe, getCurrentInstance as ve, watch as ye, toValue as ee, computed as _e, onMounted as Ze, defineComponent as te, h as W, createElementBlock as et, openBlock as tt, createElementVNode as k, toDisplayString as q, version as J, defineAsyncComponent as le, watchEffect as
|
4
|
+
import { inject as ge, toRef as Ke, readonly as We, ref as C, customRef as Ge, onBeforeUnmount as Ye, getCurrentScope as Qe, onScopeDispose as Xe, getCurrentInstance as ve, watch as ye, toValue as ee, computed as _e, onMounted as Ze, defineComponent as te, h as W, createElementBlock as et, openBlock as tt, createElementVNode as k, toDisplayString as q, version as J, defineAsyncComponent as le, watchEffect as st } from "vue";
|
5
5
|
import { useRoute as we } 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.10.
|
10
|
+
* @version 0.10.3
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const Se = "0.10.
|
14
|
-
var y = /* @__PURE__ */ ((
|
13
|
+
const Se = "0.10.3";
|
14
|
+
var y = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(y || {});
|
15
15
|
const ue = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
@@ -24,7 +24,7 @@ const ue = [
|
|
24
24
|
"$props",
|
25
25
|
"$options",
|
26
26
|
"$forceUpdate"
|
27
|
-
],
|
27
|
+
], xs = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -38,7 +38,7 @@ const ue = [
|
|
38
38
|
"renderTriggered",
|
39
39
|
"activated",
|
40
40
|
"deactivated"
|
41
|
-
],
|
41
|
+
], nt = [
|
42
42
|
"vIf",
|
43
43
|
"vShow",
|
44
44
|
"vModel",
|
@@ -56,37 +56,37 @@ const ue = [
|
|
56
56
|
}, x = "VtjPage", D = "VtjHomepage", ot = "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
57
|
","
|
58
58
|
), it = "component,slot".split(",");
|
59
|
-
function T(
|
60
|
-
return
|
59
|
+
function T(n, e) {
|
60
|
+
return n.map((t) => Oe(t) || t.startsWith("/") ? t : `${e}${t}`);
|
61
61
|
}
|
62
|
-
function
|
63
|
-
return /\.css$/.test(
|
62
|
+
function se(n) {
|
63
|
+
return /\.css$/.test(n);
|
64
64
|
}
|
65
|
-
function
|
66
|
-
return /\.js$/.test(
|
65
|
+
function ne(n) {
|
66
|
+
return /\.js$/.test(n);
|
67
67
|
}
|
68
|
-
function at(
|
69
|
-
return /\.json$/.test(
|
68
|
+
function at(n) {
|
69
|
+
return /\.json$/.test(n);
|
70
70
|
}
|
71
|
-
function
|
72
|
-
return
|
71
|
+
function Cs(n) {
|
72
|
+
return n.map(
|
73
73
|
(e) => `<script src="${R.append(e, { v: Se })}"><\/script>`
|
74
74
|
).join("");
|
75
75
|
}
|
76
|
-
function
|
77
|
-
return
|
76
|
+
function Ms(n = []) {
|
77
|
+
return n.map(
|
78
78
|
(e) => `<link rel="stylesheet" href="${R.append(e, { v: Se })}" />`
|
79
79
|
).join("");
|
80
80
|
}
|
81
|
-
function ct(
|
82
|
-
return e &&
|
81
|
+
function ct(n, e = !1) {
|
82
|
+
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
83
83
|
}
|
84
|
-
function lt(
|
85
|
-
const
|
86
|
-
return
|
84
|
+
function lt(n, e, t = !1) {
|
85
|
+
const s = n.filter((d) => !!d.enabled), r = [], o = [], a = [], i = [], c = {}, l = {}, f = [], u = {};
|
86
|
+
return s.forEach(
|
87
87
|
({ urls: d, assetsUrl: h, library: m, assetsLibrary: p, localeLibrary: w }) => {
|
88
88
|
d?.forEach((g) => {
|
89
|
-
|
89
|
+
ne(g) && r.push(ct(g, t)), se(g) && o.push(g);
|
90
90
|
}), m && (i.push(m), c[m] = T(d || [], e), w && (l[m] = w)), h && a.push(h), p && f.push(p), m && p && (u[p] = m);
|
91
91
|
}
|
92
92
|
), {
|
@@ -100,46 +100,46 @@ function lt(s, e, t = !1) {
|
|
100
100
|
libraryLocaleMap: l
|
101
101
|
};
|
102
102
|
}
|
103
|
-
function ut(
|
104
|
-
const { name: t, parent:
|
105
|
-
return
|
103
|
+
function ut(n, e) {
|
104
|
+
const { name: t, parent: s, alias: r } = n;
|
105
|
+
return s ? e[s]?.[r || t] : e[r || t];
|
106
106
|
}
|
107
|
-
function be(
|
108
|
-
return j(
|
107
|
+
function be(n) {
|
108
|
+
return j(n) ? n : JSON.stringify(n);
|
109
109
|
}
|
110
|
-
function je(
|
111
|
-
const
|
112
|
-
if (
|
113
|
-
const r = new
|
110
|
+
function je(n, e, t) {
|
111
|
+
const s = n.CSSStyleSheet;
|
112
|
+
if (s.prototype.replaceSync) {
|
113
|
+
const r = new s();
|
114
114
|
r.id = e, r.replaceSync(t);
|
115
|
-
const o =
|
115
|
+
const o = n.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
|
116
116
|
(c) => c.id !== e
|
117
117
|
);
|
118
118
|
o.adoptedStyleSheets = [...i, r];
|
119
119
|
} else {
|
120
|
-
const r =
|
120
|
+
const r = n.document;
|
121
121
|
let o = r.getElementById(e);
|
122
122
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
123
123
|
}
|
124
124
|
}
|
125
|
-
async function dt(
|
126
|
-
const t = await window.fetch(e).then((
|
127
|
-
t && je(window,
|
125
|
+
async function dt(n, e) {
|
126
|
+
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
127
|
+
t && je(window, n, t);
|
128
128
|
}
|
129
|
-
function pt(
|
130
|
-
const t = e.document,
|
131
|
-
for (const r of
|
129
|
+
function pt(n, e = window) {
|
130
|
+
const t = e.document, s = e.document.head;
|
131
|
+
for (const r of n)
|
132
132
|
if (!t.getElementById(r)) {
|
133
133
|
const a = t.createElement("link");
|
134
|
-
a.rel = "stylesheet", a.id = r, a.href = r,
|
134
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
135
135
|
}
|
136
136
|
}
|
137
|
-
async function ft(
|
138
|
-
const
|
137
|
+
async function ft(n, e, t = window) {
|
138
|
+
const s = t.document, r = t.document.head;
|
139
139
|
let o = t[e];
|
140
140
|
return o ? o.default || o : new Promise((a, i) => {
|
141
|
-
for (const c of
|
142
|
-
const l =
|
141
|
+
for (const c of n) {
|
142
|
+
const l = s.createElement("script");
|
143
143
|
l.src = c, l.onload = () => {
|
144
144
|
o = t[e], o ? a(o.default || o) : i(null);
|
145
145
|
}, l.onerror = (f) => {
|
@@ -148,58 +148,58 @@ async function ft(s, e, t = window) {
|
|
148
148
|
}
|
149
149
|
});
|
150
150
|
}
|
151
|
-
function ht(
|
152
|
-
return V(
|
151
|
+
function ht(n) {
|
152
|
+
return V(n) || V(n?.install);
|
153
153
|
}
|
154
|
-
function mt(
|
155
|
-
return it.includes(
|
154
|
+
function mt(n) {
|
155
|
+
return it.includes(n);
|
156
156
|
}
|
157
|
-
function gt(
|
158
|
-
return ot.includes(
|
157
|
+
function gt(n) {
|
158
|
+
return ot.includes(n);
|
159
159
|
}
|
160
|
-
function M(
|
160
|
+
function M(n = window) {
|
161
161
|
const e = window.Mock;
|
162
162
|
if (e) return e;
|
163
|
-
const t =
|
163
|
+
const t = n.Mock;
|
164
164
|
if (t)
|
165
165
|
return window.Mock = t, t;
|
166
166
|
}
|
167
|
-
function A(
|
167
|
+
function A(n, e, t = !1, s = !1) {
|
168
168
|
try {
|
169
169
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
170
170
|
r.push("return ");
|
171
|
-
let o = (
|
171
|
+
let o = (n.value || "").trim();
|
172
172
|
o = o.replace(/this(\W|$)/g, (i, c) => `__self${c}`), o = r.join(`
|
173
173
|
`) + o;
|
174
174
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
175
175
|
return new Function("$scope", a)(e);
|
176
176
|
} catch (r) {
|
177
|
-
if (P.error("parseExpression.error", r,
|
177
|
+
if (P.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
178
178
|
throw r;
|
179
179
|
}
|
180
180
|
}
|
181
|
-
function G(
|
182
|
-
const r = A(
|
181
|
+
function G(n, e, t = !1, s = !1) {
|
182
|
+
const r = A(n, e, t, s);
|
183
183
|
if (typeof r != "function" && (P.error(
|
184
184
|
"parseFunction.error",
|
185
185
|
"not a function",
|
186
|
-
|
186
|
+
n,
|
187
187
|
e?.__self ?? e
|
188
|
-
),
|
189
|
-
throw new Error(`"${
|
188
|
+
), s))
|
189
|
+
throw new Error(`"${n.value}" not a function`);
|
190
190
|
return r;
|
191
191
|
}
|
192
|
-
function _(
|
193
|
-
return
|
192
|
+
function _(n) {
|
193
|
+
return n && n.type === "JSExpression";
|
194
194
|
}
|
195
|
-
function F(
|
196
|
-
return typeof
|
195
|
+
function F(n) {
|
196
|
+
return typeof n == "object" && n && n.type === "JSFunction";
|
197
197
|
}
|
198
|
-
function vt(
|
199
|
-
return _(
|
198
|
+
function vt(n) {
|
199
|
+
return _(n) || F(n);
|
200
200
|
}
|
201
|
-
function
|
202
|
-
return vt(
|
201
|
+
function As(n) {
|
202
|
+
return vt(n) ? n.value : JSON.stringify(n);
|
203
203
|
}
|
204
204
|
const yt = {
|
205
205
|
session: !1,
|
@@ -214,7 +214,7 @@ const yt = {
|
|
214
214
|
noPermissionMessage: "无权限访问该页面",
|
215
215
|
appName: ""
|
216
216
|
}, $e = Symbol("access");
|
217
|
-
class
|
217
|
+
class Fs {
|
218
218
|
options;
|
219
219
|
data = null;
|
220
220
|
mode = y.Raw;
|
@@ -222,22 +222,22 @@ class Tn {
|
|
222
222
|
this.options = Object.assign({}, yt, e), this.loadData();
|
223
223
|
}
|
224
224
|
connect(e) {
|
225
|
-
const { mode: t, router:
|
226
|
-
this.mode = t,
|
225
|
+
const { mode: t, router: s, request: r } = e;
|
226
|
+
this.mode = t, s && this.mode === y.Raw && this.setGuard(s), r && this.setRequest(r);
|
227
227
|
}
|
228
228
|
login(e) {
|
229
|
-
const { storageKey: t, storagePrefix:
|
229
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
230
230
|
this.setData(e), this.data && (U.save(t, e, {
|
231
231
|
type: "local",
|
232
|
-
prefix:
|
232
|
+
prefix: s
|
233
233
|
}), r && L.set(o, this.data.token));
|
234
234
|
}
|
235
235
|
clear() {
|
236
|
-
const { storageKey: e, storagePrefix: t, session:
|
236
|
+
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
237
237
|
this.data = null, U.remove(e, {
|
238
238
|
type: "local",
|
239
239
|
prefix: t
|
240
|
-
}),
|
240
|
+
}), s && L.remove(r);
|
241
241
|
}
|
242
242
|
logout() {
|
243
243
|
this.clear(), this.toLogin();
|
@@ -249,20 +249,20 @@ class Tn {
|
|
249
249
|
return this.data || this.loadData(), this.data?.token;
|
250
250
|
}
|
251
251
|
can(e) {
|
252
|
-
const { appName: t } = this.options, { permissions:
|
253
|
-
return typeof e == "function" ? e(
|
252
|
+
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
253
|
+
return typeof e == "function" ? e(s) : ie(e).every((o) => s[o] || s[t + "." + o]);
|
254
254
|
}
|
255
255
|
some(e) {
|
256
|
-
const { appName: t } = this.options, { permissions:
|
257
|
-
return ie(e).some((o) =>
|
256
|
+
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
257
|
+
return ie(e).some((o) => s[o] || s[t + "." + o]);
|
258
258
|
}
|
259
259
|
install(e) {
|
260
260
|
e.config.globalProperties.$access || (e.config.globalProperties.$access = this, e.provide($e, this));
|
261
261
|
}
|
262
262
|
isAuthPath(e) {
|
263
|
-
const { auth: t, isAuth:
|
264
|
-
if (
|
265
|
-
return
|
263
|
+
const { auth: t, isAuth: s } = this.options;
|
264
|
+
if (s)
|
265
|
+
return s(e);
|
266
266
|
if (e.path && typeof t == "string") {
|
267
267
|
const r = t.split("#")[1] || t;
|
268
268
|
return e.path === r;
|
@@ -272,32 +272,32 @@ class Tn {
|
|
272
272
|
toLogin() {
|
273
273
|
const { auth: e, redirectParam: t } = this.options;
|
274
274
|
if (!e) return;
|
275
|
-
const
|
276
|
-
typeof e == "function" ? e(
|
275
|
+
const s = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
|
276
|
+
typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
|
277
277
|
}
|
278
278
|
setData(e) {
|
279
279
|
const { privateKey: t } = this.options;
|
280
280
|
if (Array.isArray(e) && t) {
|
281
|
-
const
|
282
|
-
this.data = JSON.parse(
|
281
|
+
const s = e.map((r) => ae(r, t));
|
282
|
+
this.data = JSON.parse(s.join(""));
|
283
283
|
return;
|
284
284
|
}
|
285
285
|
if (typeof e == "string")
|
286
286
|
try {
|
287
|
-
const
|
288
|
-
|
289
|
-
} catch (
|
290
|
-
console.warn(
|
287
|
+
const s = t ? ae(e, t) : e;
|
288
|
+
s ? this.data = JSON.parse(s) : console.warn("RSA解密失败或登录信息缺失");
|
289
|
+
} catch (s) {
|
290
|
+
console.warn(s);
|
291
291
|
}
|
292
292
|
else
|
293
293
|
this.data = e;
|
294
294
|
}
|
295
295
|
loadData() {
|
296
|
-
const { storageKey: e, storagePrefix: t } = this.options,
|
296
|
+
const { storageKey: e, storagePrefix: t } = this.options, s = U.get(e, {
|
297
297
|
type: "local",
|
298
298
|
prefix: t
|
299
299
|
});
|
300
|
-
this.setData(
|
300
|
+
this.setData(s || null);
|
301
301
|
}
|
302
302
|
isLogined() {
|
303
303
|
const { session: e, authKey: t } = this.options;
|
@@ -311,7 +311,7 @@ class Tn {
|
|
311
311
|
return !0;
|
312
312
|
}
|
313
313
|
setGuard(e) {
|
314
|
-
e.beforeEach((t,
|
314
|
+
e.beforeEach((t, s, r) => this.guard(t, r));
|
315
315
|
}
|
316
316
|
async guard(e, t) {
|
317
317
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
@@ -320,15 +320,15 @@ class Tn {
|
|
320
320
|
if (this.hasRoutePermission(e))
|
321
321
|
return t();
|
322
322
|
{
|
323
|
-
const { noPermissionMessage:
|
324
|
-
return await this.showTip(
|
323
|
+
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
324
|
+
return await this.showTip(s), V(r) ? (r(), t(!1)) : j(r) ? t(r) : t(!1);
|
325
325
|
}
|
326
326
|
}
|
327
327
|
t(!1), this.toLogin();
|
328
328
|
}
|
329
329
|
isWhiteList(e) {
|
330
330
|
const { whiteList: t } = this.options;
|
331
|
-
return t ? Array.isArray(t) ? t.some((
|
331
|
+
return t ? Array.isArray(t) ? t.some((s) => e.fullPath.startsWith(s)) : t(e) : !1;
|
332
332
|
}
|
333
333
|
isUnauthorized(e) {
|
334
334
|
const { unauthorizedCode: t = 401 } = this.options;
|
@@ -349,8 +349,8 @@ class Tn {
|
|
349
349
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
350
350
|
async (t) => (await this.showUnauthorizedAlert(t), t),
|
351
351
|
async (t) => {
|
352
|
-
const
|
353
|
-
return await this.showUnauthorizedAlert(
|
352
|
+
const s = t.response || t || {};
|
353
|
+
return await this.showUnauthorizedAlert(s), Promise.reject(t);
|
354
354
|
}
|
355
355
|
);
|
356
356
|
}
|
@@ -358,8 +358,8 @@ class Tn {
|
|
358
358
|
function _t() {
|
359
359
|
return ge($e, null);
|
360
360
|
}
|
361
|
-
function
|
362
|
-
const { notify: e, loading: t, settings:
|
361
|
+
function Ts(n = {}) {
|
362
|
+
const { notify: e, loading: t, settings: s = {} } = n;
|
363
363
|
let r = null;
|
364
364
|
return {
|
365
365
|
request: he({
|
@@ -379,7 +379,7 @@ function In(s = {}) {
|
|
379
379
|
hideLoading: () => {
|
380
380
|
r && (r.close(), r = null);
|
381
381
|
},
|
382
|
-
...
|
382
|
+
...s
|
383
383
|
}
|
384
384
|
}),
|
385
385
|
jsonp: me,
|
@@ -387,51 +387,51 @@ function In(s = {}) {
|
|
387
387
|
loading: t
|
388
388
|
};
|
389
389
|
}
|
390
|
-
function wt(
|
391
|
-
const { jsonp: t, request:
|
392
|
-
if (
|
393
|
-
return (r = {}) => t(
|
394
|
-
...
|
390
|
+
function wt(n, e) {
|
391
|
+
const { jsonp: t, request: s } = e;
|
392
|
+
if (n.method === "jsonp")
|
393
|
+
return (r = {}) => t(n.url, {
|
394
|
+
...n.jsonpOptions,
|
395
395
|
query: r
|
396
396
|
});
|
397
397
|
{
|
398
|
-
const r =
|
399
|
-
url:
|
400
|
-
method:
|
398
|
+
const r = n.headers ? A(n.headers, {}, !0) : void 0, o = {
|
399
|
+
url: n.url,
|
400
|
+
method: n.method,
|
401
401
|
settings: {
|
402
|
-
...
|
402
|
+
...n.settings,
|
403
403
|
headers: r
|
404
404
|
}
|
405
405
|
};
|
406
|
-
return (a, i) => (delete o.data,
|
406
|
+
return (a, i) => (delete o.data, s.send(Ne(o, i || {}, { data: a })));
|
407
407
|
}
|
408
408
|
}
|
409
|
-
function St(
|
409
|
+
function St(n, e) {
|
410
410
|
const { metaQuery: t } = e;
|
411
411
|
if (!t) return;
|
412
|
-
const { code:
|
412
|
+
const { code: s, queryCode: r } = n;
|
413
413
|
return (o, a) => {
|
414
414
|
if (!t) {
|
415
415
|
console.warn("adapter.metaQuery is not defined!");
|
416
416
|
return;
|
417
417
|
}
|
418
|
-
return t(
|
418
|
+
return t(s, r, o, a);
|
419
419
|
};
|
420
420
|
}
|
421
|
-
function bt(
|
422
|
-
const
|
423
|
-
for (const r of
|
424
|
-
|
421
|
+
function bt(n = [], e = [], t) {
|
422
|
+
const s = {};
|
423
|
+
for (const r of n)
|
424
|
+
s[r.id] = wt(r, t);
|
425
425
|
for (const r of e)
|
426
|
-
|
427
|
-
return
|
426
|
+
s[r.id] = St(r, t);
|
427
|
+
return s;
|
428
428
|
}
|
429
|
-
async function jt(
|
429
|
+
async function jt(n = [], e = window) {
|
430
430
|
const t = M(e);
|
431
|
-
t && (ke(e),
|
431
|
+
t && (ke(e), n.forEach((s) => kt(t, s)));
|
432
432
|
}
|
433
|
-
function $t(
|
434
|
-
const t = F(
|
433
|
+
function $t(n, e = window) {
|
434
|
+
const t = F(n.mockTemplate) && n.mockTemplate.value ? G(n.mockTemplate, {}, !0) : void 0, s = M(e);
|
435
435
|
return async (...r) => {
|
436
436
|
let o = {};
|
437
437
|
if (t)
|
@@ -440,22 +440,22 @@ function $t(s, e = window) {
|
|
440
440
|
} catch (a) {
|
441
441
|
P.warn("模拟数据模版异常", a);
|
442
442
|
}
|
443
|
-
return
|
443
|
+
return s?.mock(o);
|
444
444
|
};
|
445
445
|
}
|
446
|
-
function kt(
|
446
|
+
function kt(n, e) {
|
447
447
|
if (!e.mock) return;
|
448
|
-
const { url: t, mockTemplate:
|
449
|
-
if (t &&
|
450
|
-
const r = Ue(`${t}(.*)`), o = Le(t, { decode: decodeURIComponent }), a = A(
|
451
|
-
|
448
|
+
const { url: t, mockTemplate: s } = e;
|
449
|
+
if (t && s) {
|
450
|
+
const r = Ue(`${t}(.*)`), o = Le(t, { decode: decodeURIComponent }), a = A(s, {}, !0);
|
451
|
+
n.mock(r, (i) => {
|
452
452
|
const c = R.parse(i.url) || {}, l = i.body instanceof FormData ? qe(i.body) : i.body, f = o(i.url)?.params;
|
453
|
-
return Object.assign(i, { data: l, params: c, query: f }),
|
453
|
+
return Object.assign(i, { data: l, params: c, query: f }), n.mock(a(i));
|
454
454
|
});
|
455
455
|
}
|
456
456
|
}
|
457
|
-
function ke(
|
458
|
-
const e = M(
|
457
|
+
function ke(n = window) {
|
458
|
+
const e = M(n);
|
459
459
|
e && (e._mocked = {});
|
460
460
|
}
|
461
461
|
class Et {
|
@@ -484,14 +484,14 @@ class Et {
|
|
484
484
|
$apis = {};
|
485
485
|
__transform = {};
|
486
486
|
constructor(e) {
|
487
|
-
const { mode: t, dsl:
|
488
|
-
this.__mode = t,
|
487
|
+
const { mode: t, dsl: s, attrs: r } = e;
|
488
|
+
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
489
489
|
}
|
490
490
|
setup(e, t = B) {
|
491
|
-
const
|
492
|
-
if (!
|
493
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
494
|
-
const r =
|
491
|
+
const s = t.getCurrentInstance();
|
492
|
+
if (!s) return;
|
493
|
+
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
494
|
+
const r = s.appContext.config.globalProperties;
|
495
495
|
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
496
496
|
this.__proxy();
|
497
497
|
}), t.onUnmounted(() => {
|
@@ -516,57 +516,57 @@ class Et {
|
|
516
516
|
__parseFunction(e) {
|
517
517
|
if (e)
|
518
518
|
if (this.__mode === y.Runtime) {
|
519
|
-
const { id: t, type:
|
520
|
-
return G({ type:
|
519
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
520
|
+
return G({ type: s, value: r }, this);
|
521
521
|
} else
|
522
522
|
return G(e, this);
|
523
523
|
}
|
524
524
|
__parseExpression(e) {
|
525
525
|
if (e)
|
526
526
|
if (this.__mode === y.Runtime) {
|
527
|
-
const { id: t, type:
|
528
|
-
return A({ type:
|
527
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
528
|
+
return A({ type: s, value: r }, this);
|
529
529
|
} else
|
530
530
|
return A(e, this);
|
531
531
|
}
|
532
532
|
__ref(e = null, t) {
|
533
533
|
if (this.__mode !== y.VNode)
|
534
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
534
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
535
535
|
await fe(0);
|
536
|
-
let r =
|
536
|
+
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
537
537
|
if (!r) {
|
538
538
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
539
539
|
return;
|
540
540
|
}
|
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,
|
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, s)), typeof t == "function" ? t(s) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, s)), s;
|
542
542
|
};
|
543
543
|
}
|
544
|
-
__getRefEl(e, t,
|
544
|
+
__getRefEl(e, t, s) {
|
545
545
|
const r = e[t];
|
546
|
-
if (r &&
|
547
|
-
const o = new Set([].concat(r,
|
546
|
+
if (r && s !== r) {
|
547
|
+
const o = new Set([].concat(r, s));
|
548
548
|
return Array.from(o);
|
549
549
|
} else
|
550
|
-
return
|
550
|
+
return s;
|
551
551
|
}
|
552
552
|
__clone(e = {}) {
|
553
|
-
const t = { ...this.context, ...e },
|
553
|
+
const t = { ...this.context, ...e }, s = {
|
554
554
|
...t,
|
555
555
|
context: t
|
556
556
|
};
|
557
|
-
return
|
557
|
+
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
558
558
|
}
|
559
559
|
}
|
560
|
-
function Y(
|
560
|
+
function Y(n) {
|
561
561
|
const {
|
562
562
|
Vue: e = B,
|
563
563
|
mode: t = y.Runtime,
|
564
|
-
components:
|
564
|
+
components: s = {},
|
565
565
|
libs: r = {},
|
566
566
|
apis: o = {},
|
567
567
|
loader: a
|
568
|
-
} =
|
569
|
-
$components:
|
568
|
+
} = n, i = e.computed(() => n.dsl), c = {
|
569
|
+
$components: s,
|
570
570
|
$libs: r,
|
571
571
|
$apis: o
|
572
572
|
}, l = new Et({
|
@@ -580,7 +580,7 @@ function Y(s) {
|
|
580
580
|
},
|
581
581
|
setup(u) {
|
582
582
|
l.$props = u, l.props = u, i.value.id && je(
|
583
|
-
|
583
|
+
n.window || window,
|
584
584
|
i.value.id,
|
585
585
|
i.value.css || ""
|
586
586
|
), l.state = xt(e, i.value.state ?? {}, l);
|
@@ -611,70 +611,70 @@ function Y(s) {
|
|
611
611
|
context: l
|
612
612
|
};
|
613
613
|
}
|
614
|
-
function Rt(
|
615
|
-
return
|
614
|
+
function Rt(n = []) {
|
615
|
+
return n.map((e) => j(e) ? e : e.name);
|
616
616
|
}
|
617
|
-
function Pt(
|
618
|
-
const t = (
|
619
|
-
return
|
620
|
-
name:
|
617
|
+
function Pt(n = [], e) {
|
618
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => rt[o]) : void 0;
|
619
|
+
return n.map((s) => j(s) ? {
|
620
|
+
name: s
|
621
621
|
} : {
|
622
|
-
name:
|
623
|
-
type:
|
624
|
-
required:
|
625
|
-
default: _(
|
622
|
+
name: s.name,
|
623
|
+
type: s.type,
|
624
|
+
required: s.required,
|
625
|
+
default: _(s.default) ? e.__parseExpression(s.default) : s.default
|
626
626
|
}).reduce(
|
627
|
-
(
|
627
|
+
(s, r) => (s[r.name] = {
|
628
628
|
type: t(r.type),
|
629
629
|
required: r.required,
|
630
630
|
default: r.default
|
631
|
-
},
|
631
|
+
}, s),
|
632
632
|
{}
|
633
633
|
);
|
634
634
|
}
|
635
|
-
function xt(
|
636
|
-
return
|
635
|
+
function xt(n, e, t) {
|
636
|
+
return n.reactive(
|
637
637
|
Object.keys(e || {}).reduce(
|
638
|
-
(
|
638
|
+
(s, r) => {
|
639
639
|
let o = e[r];
|
640
|
-
return _(o) ? o = t.__parseExpression(o) : F(o) && (o = t.__parseFunction(o)),
|
640
|
+
return _(o) ? o = t.__parseExpression(o) : F(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
641
641
|
},
|
642
642
|
{}
|
643
643
|
)
|
644
644
|
);
|
645
645
|
}
|
646
|
-
function Ct(
|
646
|
+
function Ct(n, e, t) {
|
647
647
|
return Object.entries(e ?? {}).reduce(
|
648
|
-
(
|
648
|
+
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
649
649
|
{}
|
650
650
|
);
|
651
651
|
}
|
652
|
-
function Mt(
|
653
|
-
return Object.entries(
|
654
|
-
(t, [
|
652
|
+
function Mt(n, e) {
|
653
|
+
return Object.entries(n ?? {}).reduce(
|
654
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
655
655
|
{}
|
656
656
|
);
|
657
657
|
}
|
658
|
-
function At(
|
658
|
+
function At(n, e = [], t) {
|
659
659
|
return e.reduce(
|
660
|
-
(
|
660
|
+
(s, r) => {
|
661
661
|
const { name: o, from: a } = r || {};
|
662
662
|
r.default;
|
663
663
|
const i = _(a) ? t.__parseExpression(a) || o : a ?? o, c = _(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
664
|
-
return
|
664
|
+
return s[o] = n.inject(i, c), s;
|
665
665
|
},
|
666
666
|
{}
|
667
667
|
);
|
668
668
|
}
|
669
|
-
function Ft(
|
670
|
-
return Object.keys(
|
671
|
-
(t,
|
672
|
-
const r = s
|
669
|
+
function Ft(n, e) {
|
670
|
+
return Object.keys(n).reduce(
|
671
|
+
(t, s) => {
|
672
|
+
const r = n[s];
|
673
673
|
if (r.type === "mock")
|
674
|
-
t[
|
674
|
+
t[s] = $t(r);
|
675
675
|
else if (r.ref) {
|
676
676
|
const o = e.$apis[r.ref], a = F(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
677
|
-
t[
|
677
|
+
t[s] = async (...i) => {
|
678
678
|
const c = await o.apply(e, i);
|
679
679
|
return a ? a(c) : c;
|
680
680
|
};
|
@@ -684,38 +684,38 @@ function Ft(s, e) {
|
|
684
684
|
{}
|
685
685
|
);
|
686
686
|
}
|
687
|
-
function Tt(
|
688
|
-
e.forEach((
|
689
|
-
|
690
|
-
t.__parseExpression(
|
691
|
-
t.__parseFunction(
|
687
|
+
function Tt(n, e = [], t) {
|
688
|
+
e.forEach((s) => {
|
689
|
+
n.watch(
|
690
|
+
t.__parseExpression(s.source),
|
691
|
+
t.__parseFunction(s.handler),
|
692
692
|
{
|
693
|
-
deep:
|
694
|
-
immediate:
|
693
|
+
deep: s.deep,
|
694
|
+
immediate: s.immediate
|
695
695
|
}
|
696
696
|
);
|
697
697
|
});
|
698
698
|
}
|
699
|
-
function It(
|
700
|
-
return Object.entries(
|
701
|
-
(t, [
|
699
|
+
function It(n, e) {
|
700
|
+
return Object.entries(n ?? {}).reduce(
|
701
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
702
702
|
{}
|
703
703
|
);
|
704
704
|
}
|
705
705
|
let z = [], E = {};
|
706
|
-
const Dt = (
|
707
|
-
async function Ee(
|
708
|
-
const { urls: t = [], library:
|
709
|
-
if (r.length === 0 || !
|
710
|
-
const o = t.filter((i) =>
|
711
|
-
return o.length && pt(o, e), await ft(r,
|
712
|
-
(i) => (console.warn("loadScriptUrl error", r,
|
706
|
+
const Dt = (n) => n;
|
707
|
+
async function Ee(n, e = window) {
|
708
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => ne(i));
|
709
|
+
if (r.length === 0 || !s) return null;
|
710
|
+
const o = t.filter((i) => se(i));
|
711
|
+
return o.length && pt(o, e), await ft(r, s, e).catch(
|
712
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
713
713
|
);
|
714
714
|
}
|
715
|
-
function Q(
|
716
|
-
const { getDsl: e, getDslByUrl: t, options:
|
717
|
-
return
|
718
|
-
delete
|
715
|
+
function Q(n) {
|
716
|
+
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
717
|
+
return s.window && (z.forEach((r) => {
|
718
|
+
delete s.window[r];
|
719
719
|
}), z = []), (r, o, a = B) => {
|
720
720
|
if (!o || typeof o == "string") return r;
|
721
721
|
if (o.type === "Schema" && o.id) {
|
@@ -723,11 +723,11 @@ function Q(s) {
|
|
723
723
|
return i || (i = E[o.id] = a.defineAsyncComponent(async () => {
|
724
724
|
const c = await e(o.id);
|
725
725
|
return c && (c.name = r), c ? Y({
|
726
|
-
...
|
726
|
+
...s,
|
727
727
|
Vue: a,
|
728
728
|
dsl: c,
|
729
729
|
mode: y.Runtime,
|
730
|
-
loader: Q(
|
730
|
+
loader: Q(n)
|
731
731
|
}).renderer : null;
|
732
732
|
}), i);
|
733
733
|
}
|
@@ -736,11 +736,11 @@ function Q(s) {
|
|
736
736
|
return i || (i = E[o.url] = a.defineAsyncComponent(async () => {
|
737
737
|
const c = await t(o.url);
|
738
738
|
return c && (c.name = r), c ? Y({
|
739
|
-
...
|
739
|
+
...s,
|
740
740
|
Vue: a,
|
741
741
|
dsl: c,
|
742
742
|
mode: y.Runtime,
|
743
|
-
loader: Q(
|
743
|
+
loader: Q(n)
|
744
744
|
}).renderer : null;
|
745
745
|
}), i);
|
746
746
|
}
|
@@ -748,7 +748,7 @@ function Q(s) {
|
|
748
748
|
let i = o.library ? E[o.library] : null;
|
749
749
|
return i || (o.library && z.push(o.library), i = E[o.library || Symbol()] = a.defineAsyncComponent(
|
750
750
|
async () => {
|
751
|
-
const c = await Ee(o,
|
751
|
+
const c = await Ee(o, s.window);
|
752
752
|
return c || (console.warn("getPlugin result is null", o), null);
|
753
753
|
}
|
754
754
|
), i);
|
@@ -756,24 +756,24 @@ function Q(s) {
|
|
756
756
|
return r;
|
757
757
|
};
|
758
758
|
}
|
759
|
-
function
|
759
|
+
function Is() {
|
760
760
|
E = {};
|
761
761
|
}
|
762
|
-
function O(
|
763
|
-
if (!
|
764
|
-
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } =
|
762
|
+
function O(n, e, t = B, s = Dt) {
|
763
|
+
if (!n || !n.name || n.invisible) return null;
|
764
|
+
const r = t.getCurrentInstance()?.appContext, { id: o = null, directives: a = [] } = n, { vIf: i, vFor: c, vShow: l, vModels: f, vBind: u, vHtml: d, others: h } = Ot(a);
|
765
765
|
if (i && !Bt(i, e))
|
766
766
|
return null;
|
767
767
|
const m = (p) => {
|
768
768
|
const w = p.$components, g = (() => {
|
769
|
-
if (
|
770
|
-
return Nt(p,
|
771
|
-
if (
|
772
|
-
const b = n
|
769
|
+
if (n.name === "component")
|
770
|
+
return Nt(p, n.props?.is);
|
771
|
+
if (n.name === "slot") return n.name;
|
772
|
+
const b = s(n.name, n.from, t);
|
773
773
|
return j(b) ? mt(b) || gt(b) ? b : w[b] ?? r?.app?.component(b) ?? b : b;
|
774
|
-
})(), S = Ut(o,
|
775
|
-
if (
|
776
|
-
return qt(t,
|
774
|
+
})(), S = Ut(o, n.props ?? {}, p), Te = Lt(t, n.events ?? {}, p);
|
775
|
+
if (n.name === "slot")
|
776
|
+
return qt(t, n, S, p, s);
|
777
777
|
u && Object.assign(S, p.__parseExpression(u.value)), l && (S.style = Object.assign(
|
778
778
|
S.style ?? {},
|
779
779
|
zt(l, p)
|
@@ -782,10 +782,10 @@ function O(s, e, t = B, n = Dt) {
|
|
782
782
|
});
|
783
783
|
const Ie = Wt(
|
784
784
|
t,
|
785
|
-
|
785
|
+
n.children ?? [],
|
786
786
|
p,
|
787
|
-
|
788
|
-
|
787
|
+
s,
|
788
|
+
n
|
789
789
|
);
|
790
790
|
let N = t.createVNode(g, { ...S, ...Te }, Ie);
|
791
791
|
const oe = r ? Ht(r, h, p) : [];
|
@@ -793,108 +793,108 @@ function O(s, e, t = B, n = Dt) {
|
|
793
793
|
};
|
794
794
|
return c ? Qt(c, m, e) : m(e);
|
795
795
|
}
|
796
|
-
function Ht(
|
797
|
-
const
|
796
|
+
function Ht(n, e, t) {
|
797
|
+
const s = n.app;
|
798
798
|
return e.map((r) => {
|
799
|
-
const o = typeof r.name == "string" ?
|
799
|
+
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
800
800
|
if (!o) return null;
|
801
801
|
const a = [o];
|
802
802
|
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
803
803
|
}).filter((r) => !!r);
|
804
804
|
}
|
805
|
-
function Ot(
|
806
|
-
const e =
|
805
|
+
function Ot(n = []) {
|
806
|
+
const e = n.find((c) => $(c.name) === "vIf"), t = n.find((c) => $(c.name) === "vFor"), s = n.find((c) => $(c.name) === "vShow"), r = n.find((c) => $(c.name) === "vBind"), o = n.find((c) => $(c.name) === "vHtml"), a = n.filter(
|
807
807
|
(c) => $(c.name) === "vModel"
|
808
|
-
), i =
|
809
|
-
(c) => !
|
808
|
+
), i = n.filter(
|
809
|
+
(c) => !nt.includes($(c.name))
|
810
810
|
);
|
811
811
|
return {
|
812
812
|
vIf: e,
|
813
813
|
vFor: t,
|
814
|
-
vShow:
|
814
|
+
vShow: s,
|
815
815
|
vModels: a,
|
816
816
|
vBind: r,
|
817
817
|
others: i,
|
818
818
|
vHtml: o
|
819
819
|
};
|
820
820
|
}
|
821
|
-
function Bt(
|
822
|
-
return !!e.__parseExpression(
|
821
|
+
function Bt(n, e) {
|
822
|
+
return !!e.__parseExpression(n.value);
|
823
823
|
}
|
824
|
-
function Nt(
|
825
|
-
return e ? _(e) ?
|
824
|
+
function Nt(n, e) {
|
825
|
+
return e ? _(e) ? n.__parseExpression(e) : e : "div";
|
826
826
|
}
|
827
|
-
function Ut(
|
828
|
-
const
|
829
|
-
return
|
827
|
+
function Ut(n, e, t) {
|
828
|
+
const s = X(e, t);
|
829
|
+
return s.ref = t.__ref(n, s.ref), s;
|
830
830
|
}
|
831
|
-
function X(
|
832
|
-
return _(
|
833
|
-
(t,
|
834
|
-
let r = s
|
835
|
-
return t[
|
831
|
+
function X(n, e) {
|
832
|
+
return _(n) ? e.__parseExpression(n) : F(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => X(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
833
|
+
(t, s) => {
|
834
|
+
let r = n[s];
|
835
|
+
return t[s] = X(r, e), t;
|
836
836
|
},
|
837
837
|
{}
|
838
|
-
) :
|
838
|
+
) : n;
|
839
839
|
}
|
840
|
-
function Lt(
|
841
|
-
const
|
840
|
+
function Lt(n, e, t) {
|
841
|
+
const s = ["passive", "capture", "once"], r = {
|
842
842
|
capture: "Capture",
|
843
843
|
once: "Once",
|
844
844
|
passive: "OnceCapture"
|
845
845
|
};
|
846
846
|
return Object.keys(e || {}).reduce(
|
847
847
|
(o, a) => {
|
848
|
-
const i = e[a], c = Re(i.modifiers), l = c.find((d) =>
|
849
|
-
return u && (o[f] =
|
848
|
+
const i = e[a], c = Re(i.modifiers), l = c.find((d) => s.includes(d)), f = "on" + Je(a) + (l && r[l] || ""), u = t.__parseFunction(i.handler);
|
849
|
+
return u && (o[f] = n.withModifiers(u, c)), o;
|
850
850
|
},
|
851
851
|
{}
|
852
852
|
);
|
853
853
|
}
|
854
|
-
function Re(
|
855
|
-
const t = Object.keys(
|
856
|
-
return e ? t.map((
|
854
|
+
function Re(n = {}, e = !1) {
|
855
|
+
const t = Object.keys(n);
|
856
|
+
return e ? t.map((s) => "." + s) : t;
|
857
857
|
}
|
858
|
-
function qt(
|
859
|
-
const { children: o } = e, a = Jt(e,
|
860
|
-
return i ? i(t) : o ? j(o) ?
|
861
|
-
be(
|
858
|
+
function qt(n, e, t, s, r) {
|
859
|
+
const { children: o } = e, a = Jt(e, s), i = s.$slots?.[a.name];
|
860
|
+
return i ? i(t) : o ? j(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
|
861
|
+
be(s.__parseExpression(o))
|
862
862
|
) : Array.isArray(o) ? o.map(
|
863
|
-
(c) => O(c,
|
863
|
+
(c) => O(c, s, n, r)
|
864
864
|
) : null : null;
|
865
865
|
}
|
866
|
-
function Jt(
|
867
|
-
const { props: t } =
|
866
|
+
function Jt(n, e) {
|
867
|
+
const { props: t } = n, s = t?.name || "default";
|
868
868
|
return {
|
869
|
-
name: _(
|
869
|
+
name: _(s) ? e.__parseExpression(s) : s,
|
870
870
|
params: []
|
871
871
|
};
|
872
872
|
}
|
873
|
-
function zt(
|
874
|
-
return e.__parseExpression(
|
873
|
+
function zt(n, e) {
|
874
|
+
return e.__parseExpression(n.value) ? {} : {
|
875
875
|
display: "none"
|
876
876
|
};
|
877
877
|
}
|
878
|
-
function Vt(
|
878
|
+
function Vt(n, e) {
|
879
879
|
return {
|
880
|
-
innerHTML: e.__parseExpression(
|
880
|
+
innerHTML: e.__parseExpression(n.value) || ""
|
881
881
|
};
|
882
882
|
}
|
883
|
-
function Kt(
|
884
|
-
const
|
883
|
+
function Kt(n, e, t) {
|
884
|
+
const s = {
|
885
885
|
type: "JSFunction",
|
886
886
|
value: e.value?.value ? `(v) => {
|
887
887
|
${e.value.value} = v;
|
888
888
|
}` : "(v) => {}"
|
889
|
-
}, r = t.__parseFunction(
|
889
|
+
}, r = t.__parseFunction(s), o = Re(
|
890
890
|
_(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
891
891
|
), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
892
892
|
return {
|
893
893
|
[a]: t.__parseExpression(e.value),
|
894
|
-
[`onUpdate:${a}`]: o.length && r ?
|
894
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
895
895
|
};
|
896
896
|
}
|
897
|
-
function Wt(
|
897
|
+
function Wt(n, e, t, s, r) {
|
898
898
|
if (!e) return null;
|
899
899
|
if (j(e))
|
900
900
|
return { default: () => e };
|
@@ -909,81 +909,81 @@ function Wt(s, e, t, n, r) {
|
|
909
909
|
return Object.entries(o).reduce((i, [c, { nodes: l, params: f }]) => (i[c] = (u) => {
|
910
910
|
const d = f.length ? ze(u ?? {}, f) : a(u);
|
911
911
|
return l.map(
|
912
|
-
(h) => O(h, t.__clone(d),
|
912
|
+
(h) => O(h, t.__clone(d), n, s)
|
913
913
|
);
|
914
914
|
}, i), {});
|
915
915
|
}
|
916
916
|
return null;
|
917
917
|
}
|
918
|
-
function Gt(
|
918
|
+
function Gt(n) {
|
919
919
|
const e = {
|
920
920
|
default: {
|
921
921
|
params: [],
|
922
922
|
nodes: []
|
923
923
|
}
|
924
924
|
};
|
925
|
-
for (const t of
|
926
|
-
const
|
927
|
-
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(
|
925
|
+
for (const t of n) {
|
926
|
+
const s = Yt(t.slot), r = s.name;
|
927
|
+
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
928
928
|
nodes: [t],
|
929
|
-
params:
|
929
|
+
params: s.params
|
930
930
|
};
|
931
931
|
}
|
932
932
|
return e;
|
933
933
|
}
|
934
|
-
function Yt(
|
935
|
-
return j(
|
934
|
+
function Yt(n = "default") {
|
935
|
+
return j(n) ? { name: n, params: [] } : { params: [], ...n };
|
936
936
|
}
|
937
|
-
function Qt(
|
938
|
-
const { value:
|
939
|
-
let i = t.__parseExpression(
|
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]:", `${
|
937
|
+
function Qt(n, e, t) {
|
938
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
939
|
+
let i = t.__parseExpression(s) || [];
|
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]:", `${s?.value} is not a Arrary`), []);
|
941
941
|
}
|
942
|
-
function Xt(
|
943
|
-
return Qe() ? (Xe(
|
942
|
+
function Xt(n) {
|
943
|
+
return Qe() ? (Xe(n), !0) : !1;
|
944
944
|
}
|
945
945
|
const Pe = typeof window < "u" && typeof document < "u";
|
946
946
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
947
|
-
const Zt = (
|
947
|
+
const Zt = (n) => n != null, es = () => {
|
948
948
|
};
|
949
|
-
function
|
949
|
+
function ts(n) {
|
950
950
|
return ve();
|
951
951
|
}
|
952
|
-
function
|
953
|
-
return Array.isArray(
|
952
|
+
function ss(n) {
|
953
|
+
return Array.isArray(n) ? n : [n];
|
954
954
|
}
|
955
|
-
function
|
956
|
-
if (
|
957
|
-
return Ke(...
|
958
|
-
const e =
|
959
|
-
return typeof e == "function" ? We(Ge(() => ({ get: e, set:
|
955
|
+
function ns(...n) {
|
956
|
+
if (n.length !== 1)
|
957
|
+
return Ke(...n);
|
958
|
+
const e = n[0];
|
959
|
+
return typeof e == "function" ? We(Ge(() => ({ get: e, set: es }))) : C(e);
|
960
960
|
}
|
961
|
-
function
|
962
|
-
|
961
|
+
function rs(n, e) {
|
962
|
+
ts() && Ye(n, e);
|
963
963
|
}
|
964
|
-
const
|
965
|
-
function
|
964
|
+
const os = Pe ? window : void 0, is = Pe ? window.document : void 0;
|
965
|
+
function as(n) {
|
966
966
|
var e;
|
967
|
-
const t = ee(
|
967
|
+
const t = ee(n);
|
968
968
|
return (e = t?.$el) != null ? e : t;
|
969
969
|
}
|
970
|
-
function
|
971
|
-
const
|
970
|
+
function cs() {
|
971
|
+
const n = C(!1), e = ve();
|
972
972
|
return e && Ze(() => {
|
973
|
-
|
974
|
-
}, e),
|
973
|
+
n.value = !0;
|
974
|
+
}, e), n;
|
975
975
|
}
|
976
|
-
function
|
977
|
-
const e =
|
978
|
-
return _e(() => (e.value, !!
|
976
|
+
function ls(n) {
|
977
|
+
const e = cs();
|
978
|
+
return _e(() => (e.value, !!n()));
|
979
979
|
}
|
980
|
-
function
|
981
|
-
const { window:
|
980
|
+
function us(n, e, t = {}) {
|
981
|
+
const { window: s = os, ...r } = t;
|
982
982
|
let o;
|
983
|
-
const a =
|
983
|
+
const a = ls(() => s && "MutationObserver" in s), i = () => {
|
984
984
|
o && (o.disconnect(), o = void 0);
|
985
985
|
}, c = _e(() => {
|
986
|
-
const d = ee(
|
986
|
+
const d = ee(n), h = ss(d).map(as).filter(Zt);
|
987
987
|
return new Set(h);
|
988
988
|
}), l = ye(
|
989
989
|
() => c.value,
|
@@ -1000,12 +1000,12 @@ function dn(s, e, t = {}) {
|
|
1000
1000
|
takeRecords: f
|
1001
1001
|
};
|
1002
1002
|
}
|
1003
|
-
function
|
1004
|
-
var t,
|
1003
|
+
function ds(n = null, e = {}) {
|
1004
|
+
var t, s, r;
|
1005
1005
|
const {
|
1006
|
-
document: o =
|
1006
|
+
document: o = is,
|
1007
1007
|
restoreOnUnmount: a = (u) => u
|
1008
|
-
} = e, i = (t = o?.title) != null ? t : "", c =
|
1008
|
+
} = e, i = (t = o?.title) != null ? t : "", c = ns((s = n ?? o?.title) != null ? s : null), l = !!(n && typeof n == "function");
|
1009
1009
|
function f(u) {
|
1010
1010
|
if (!("titleTemplate" in e))
|
1011
1011
|
return u;
|
@@ -1018,13 +1018,13 @@ function pn(s = null, e = {}) {
|
|
1018
1018
|
u !== d && o && (o.title = f(u ?? ""));
|
1019
1019
|
},
|
1020
1020
|
{ immediate: !0 }
|
1021
|
-
), e.observe && !e.titleTemplate && o && !l &&
|
1021
|
+
), e.observe && !e.titleTemplate && o && !l && us(
|
1022
1022
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
1023
1023
|
() => {
|
1024
1024
|
o && o.title !== c.value && (c.value = f(o.title));
|
1025
1025
|
},
|
1026
1026
|
{ childList: !0 }
|
1027
|
-
),
|
1027
|
+
), rs(() => {
|
1028
1028
|
if (a) {
|
1029
1029
|
const u = a(i, c.value || "");
|
1030
1030
|
u != null && o && (o.title = u);
|
@@ -1034,11 +1034,11 @@ function pn(s = null, e = {}) {
|
|
1034
1034
|
const de = te({
|
1035
1035
|
name: "VtjPageContainer",
|
1036
1036
|
async setup() {
|
1037
|
-
const
|
1038
|
-
return
|
1039
|
-
provider:
|
1037
|
+
const n = Ce(), e = we(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = C(Symbol());
|
1038
|
+
return s && (Object.assign(e.meta, s.meta || {}, { cache: s.cache }), ds(s.title || "VTJ")), {
|
1039
|
+
provider: n,
|
1040
1040
|
component: r,
|
1041
|
-
file:
|
1041
|
+
file: s,
|
1042
1042
|
query: e.query,
|
1043
1043
|
meta: e.meta,
|
1044
1044
|
sid: o,
|
@@ -1046,31 +1046,31 @@ const de = te({
|
|
1046
1046
|
};
|
1047
1047
|
},
|
1048
1048
|
render() {
|
1049
|
-
const { component:
|
1050
|
-
return
|
1049
|
+
const { component: n, query: e, sid: t } = this;
|
1050
|
+
return n ? W(n, { ...e, key: t }) : W("div", "页面不存在");
|
1051
1051
|
},
|
1052
1052
|
activated() {
|
1053
1053
|
this.meta.cache === !1 && (this.sid = Symbol());
|
1054
1054
|
}
|
1055
|
-
}),
|
1055
|
+
}), ps = {
|
1056
1056
|
"data-l-h6o7ki7": "",
|
1057
1057
|
class: "vtj-startup__wrapper"
|
1058
|
-
},
|
1058
|
+
}, fs = {
|
1059
1059
|
"data-l-h6o7ki7": "",
|
1060
1060
|
class: "vtj-startup"
|
1061
|
-
},
|
1061
|
+
}, hs = {
|
1062
1062
|
"data-l-h6o7ki7": "",
|
1063
1063
|
class: "vtj-startup__name"
|
1064
|
-
},
|
1064
|
+
}, ms = {
|
1065
1065
|
"data-l-h6o7ki7": "",
|
1066
1066
|
class: "span"
|
1067
|
-
},
|
1067
|
+
}, gs = {
|
1068
1068
|
"data-l-h6o7ki7": "",
|
1069
1069
|
class: "vtj-startup__tagline"
|
1070
|
-
},
|
1070
|
+
}, vs = {
|
1071
1071
|
"data-l-h6o7ki7": "",
|
1072
1072
|
class: "vtj-startup__actions"
|
1073
|
-
},
|
1073
|
+
}, ys = /* @__PURE__ */ te({
|
1074
1074
|
__name: "Startup",
|
1075
1075
|
props: {
|
1076
1076
|
name: { default: "VTJ.PRO" },
|
@@ -1078,7 +1078,7 @@ const de = te({
|
|
1078
1078
|
actionText: { default: "开始设计" },
|
1079
1079
|
link: {}
|
1080
1080
|
},
|
1081
|
-
setup(
|
1081
|
+
setup(n) {
|
1082
1082
|
((r, o) => {
|
1083
1083
|
let a = document.getElementById("h6o7ki7");
|
1084
1084
|
a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML = o);
|
@@ -1164,7 +1164,7 @@ const de = te({
|
|
1164
1164
|
.vtj-startup__actions .button[data-l-h6o7ki7]:hover{
|
1165
1165
|
opacity: 0.7;
|
1166
1166
|
}`);
|
1167
|
-
const t =
|
1167
|
+
const t = n, s = () => {
|
1168
1168
|
if (typeof window < "u") {
|
1169
1169
|
if (t.link) {
|
1170
1170
|
typeof t.link == "function" ? t.link() : window.location.href = t.link;
|
@@ -1174,13 +1174,13 @@ const de = te({
|
|
1174
1174
|
window.location.href = o;
|
1175
1175
|
}
|
1176
1176
|
};
|
1177
|
-
return (r, o) => (tt(), et("div",
|
1178
|
-
k("div",
|
1179
|
-
k("h1",
|
1180
|
-
k("span",
|
1177
|
+
return (r, o) => (tt(), et("div", ps, [
|
1178
|
+
k("div", fs, [
|
1179
|
+
k("h1", hs, [
|
1180
|
+
k("span", ms, q(t.name), 1)
|
1181
1181
|
]),
|
1182
|
-
k("div",
|
1183
|
-
k("div",
|
1182
|
+
k("div", gs, q(t.tagline), 1),
|
1183
|
+
k("div", vs, [
|
1184
1184
|
o[0] || (o[0] = k("span", {
|
1185
1185
|
"data-l-h6o7ki7": "",
|
1186
1186
|
class: "span"
|
@@ -1188,25 +1188,25 @@ const de = te({
|
|
1188
1188
|
k("span", {
|
1189
1189
|
"data-l-h6o7ki7": "",
|
1190
1190
|
class: "button",
|
1191
|
-
onClick:
|
1191
|
+
onClick: s
|
1192
1192
|
}, q(t.actionText), 1)
|
1193
1193
|
])
|
1194
1194
|
])
|
1195
1195
|
]));
|
1196
1196
|
}
|
1197
|
-
}),
|
1197
|
+
}), _s = te({
|
1198
1198
|
name: "VtjStartupContainer",
|
1199
1199
|
render() {
|
1200
|
-
return W(
|
1200
|
+
return W(ys);
|
1201
1201
|
}
|
1202
1202
|
}), xe = Symbol("Provider");
|
1203
|
-
var
|
1204
|
-
class
|
1203
|
+
var ws = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(ws || {});
|
1204
|
+
class Ss extends De {
|
1205
1205
|
constructor(e) {
|
1206
1206
|
super(), this.options = e;
|
1207
1207
|
const {
|
1208
1208
|
service: t,
|
1209
|
-
mode:
|
1209
|
+
mode: s = y.Raw,
|
1210
1210
|
dependencies: r,
|
1211
1211
|
materials: o,
|
1212
1212
|
project: a = {},
|
@@ -1218,9 +1218,9 @@ class bn extends De {
|
|
1218
1218
|
nodeEnv: d = "development"
|
1219
1219
|
/* Development */
|
1220
1220
|
} = e;
|
1221
|
-
this.mode =
|
1221
|
+
this.mode = s, this.modules = l, this.service = t, this.router = f, this.materialPath = u, this.nodeEnv = d, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, c), Object.assign(this.adapter, i);
|
1222
1222
|
const { access: h, request: m } = this.adapter;
|
1223
|
-
h && h.connect({ mode:
|
1223
|
+
h && h.connect({ mode: s, router: f, request: m }), a && s !== y.Design ? this.load(a) : this.project = a;
|
1224
1224
|
}
|
1225
1225
|
mode;
|
1226
1226
|
globals = {};
|
@@ -1239,22 +1239,22 @@ class bn extends De {
|
|
1239
1239
|
urlDslCaches = {};
|
1240
1240
|
createMock(e) {
|
1241
1241
|
return async (...t) => {
|
1242
|
-
let
|
1242
|
+
let s = {};
|
1243
1243
|
if (e)
|
1244
1244
|
try {
|
1245
|
-
|
1245
|
+
s = await e.apply(e, t);
|
1246
1246
|
} catch (o) {
|
1247
1247
|
P.warn("模拟数据模版异常", o);
|
1248
1248
|
}
|
1249
|
-
return M()?.mock(
|
1249
|
+
return M()?.mock(s);
|
1250
1250
|
};
|
1251
1251
|
}
|
1252
1252
|
async load(e) {
|
1253
|
-
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1253
|
+
const t = this.modules[`.vtj/projects/${e.id}.json`] || this.modules[`/src/.vtj/projects/${e.id}.json`];
|
1254
1254
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1255
1255
|
throw new Error("project is null");
|
1256
|
-
const { apis:
|
1257
|
-
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.initMock(o), this.apis = bt(
|
1256
|
+
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
1257
|
+
o.CKEDITOR_VERSION = void 0, this.mode === y.Raw ? await this.loadDependencies(o) : await this.loadAssets(o), this.initMock(o), this.apis = bt(s, r, this.adapter), ke(o), jt(s, o), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1258
1258
|
}
|
1259
1259
|
initMock(e) {
|
1260
1260
|
const t = M(e);
|
@@ -1264,11 +1264,11 @@ class bn extends De {
|
|
1264
1264
|
}
|
1265
1265
|
async loadDependencies(e) {
|
1266
1266
|
const t = Object.entries(this.dependencies);
|
1267
|
-
for (const [
|
1268
|
-
e[
|
1267
|
+
for (const [s, r] of t)
|
1268
|
+
e[s] || (e[s] = this.library[s] = await r());
|
1269
1269
|
}
|
1270
1270
|
async loadAssets(e) {
|
1271
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
1271
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1272
1272
|
libraryExports: c,
|
1273
1273
|
libraryMap: l,
|
1274
1274
|
materials: f,
|
@@ -1281,7 +1281,7 @@ class bn extends De {
|
|
1281
1281
|
/* Development */
|
1282
1282
|
);
|
1283
1283
|
for (const h of c) {
|
1284
|
-
const m =
|
1284
|
+
const m = s[h], p = e[h];
|
1285
1285
|
if (p)
|
1286
1286
|
r[h] = p;
|
1287
1287
|
else if (m)
|
@@ -1289,7 +1289,7 @@ class bn extends De {
|
|
1289
1289
|
else {
|
1290
1290
|
const w = l[h] || [];
|
1291
1291
|
for (const g of w)
|
1292
|
-
|
1292
|
+
se(g) && await dt(h, R.append(g, { v: J })), ne(g) && await ce(R.append(g, { v: J }));
|
1293
1293
|
r[h] = e[h];
|
1294
1294
|
}
|
1295
1295
|
}
|
@@ -1313,65 +1313,65 @@ class bn extends De {
|
|
1313
1313
|
}
|
1314
1314
|
}
|
1315
1315
|
initRouter() {
|
1316
|
-
const { router: e, project: t, options:
|
1316
|
+
const { router: e, project: t, options: s, adapter: r } = this;
|
1317
1317
|
if (!e) return;
|
1318
1318
|
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1319
1319
|
routeAppendTo: a,
|
1320
1320
|
pageRouteName: i = o,
|
1321
1321
|
routeMeta: c
|
1322
|
-
} =
|
1322
|
+
} = s, l = a ? "" : "/", f = {
|
1323
1323
|
path: `${l}${i}/:id`,
|
1324
1324
|
name: x,
|
1325
1325
|
component: de
|
1326
1326
|
}, u = {
|
1327
1327
|
path: l,
|
1328
1328
|
name: D,
|
1329
|
-
component: t?.homepage ? de : r.startupComponent ||
|
1329
|
+
component: t?.homepage ? de : r.startupComponent || _s,
|
1330
1330
|
meta: c
|
1331
1331
|
};
|
1332
1332
|
e.hasRoute(x) && e.removeRoute(x), e.hasRoute(D) && e.removeRoute(D), a ? (e.addRoute(a, f), e.addRoute(a, u)) : (e.addRoute(f), e.addRoute(u));
|
1333
1333
|
}
|
1334
1334
|
install(e) {
|
1335
1335
|
const t = e.config.globalProperties.installed || {};
|
1336
|
-
for (const [
|
1337
|
-
!t[
|
1338
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(xe, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (
|
1339
|
-
const a = r?.$options.name, i = typeof
|
1336
|
+
for (const [s, r] of Object.entries(this.library))
|
1337
|
+
!t[s] && ht(r) && (e.use(r), t[s] = !0);
|
1338
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(xe, this), e.config.globalProperties.$provider = this, e.config.globalProperties.installed = t, this.mode === y.Design && (e.config.errorHandler = (s, r, o) => {
|
1339
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", c = `[ ${a} ] ${i} ${o}`;
|
1340
1340
|
console.error(
|
1341
1341
|
"[VTJ Error]:",
|
1342
1342
|
{
|
1343
|
-
err:
|
1343
|
+
err: s,
|
1344
1344
|
instance: r,
|
1345
1345
|
info: o
|
1346
1346
|
},
|
1347
|
-
|
1347
|
+
s?.stack
|
1348
1348
|
), this.adapter.notify && this.adapter.notify(c, "组件渲染错误", "error");
|
1349
1349
|
});
|
1350
1350
|
}
|
1351
1351
|
getFile(e) {
|
1352
1352
|
const { blocks: t = [] } = this.project || {};
|
1353
|
-
return this.getPage(e) || t.find((
|
1353
|
+
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
1354
1354
|
}
|
1355
1355
|
getPage(e) {
|
1356
|
-
const { pages: t = [] } = this.project || {},
|
1356
|
+
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
1357
1357
|
for (const a of o) {
|
1358
1358
|
if (a.id === r)
|
1359
1359
|
return a;
|
1360
1360
|
if (a.children && a.children.length) {
|
1361
|
-
const i =
|
1361
|
+
const i = s(r, a.children);
|
1362
1362
|
if (i)
|
1363
1363
|
return i;
|
1364
1364
|
}
|
1365
1365
|
}
|
1366
1366
|
};
|
1367
|
-
return
|
1367
|
+
return s(e, t) || null;
|
1368
1368
|
}
|
1369
1369
|
getHomepage() {
|
1370
1370
|
const { homepage: e } = this.project || {};
|
1371
1371
|
return e ? this.getPage(e) : null;
|
1372
1372
|
}
|
1373
1373
|
async getDsl(e) {
|
1374
|
-
const t = this.modules[`.vtj/files/${e}.json`];
|
1374
|
+
const t = this.modules[`.vtj/files/${e}.json`] || this.modules[`/src/.vtj/files/${e}.json`];
|
1375
1375
|
return t ? await t() : this.service.getFile(e, this.project || void 0).catch(() => null);
|
1376
1376
|
}
|
1377
1377
|
async getDslByUrl(e) {
|
@@ -1383,14 +1383,14 @@ class bn extends De {
|
|
1383
1383
|
validSuccess: !1,
|
1384
1384
|
originResponse: !0
|
1385
1385
|
}
|
1386
|
-
}).then((
|
1386
|
+
}).then((s) => s.data).catch(() => null));
|
1387
1387
|
}
|
1388
1388
|
createDslRenderer(e, t = {}) {
|
1389
|
-
const { library:
|
1389
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
1390
1390
|
mode: o,
|
1391
|
-
Vue:
|
1391
|
+
Vue: s.Vue,
|
1392
1392
|
components: r,
|
1393
|
-
libs:
|
1393
|
+
libs: s,
|
1394
1394
|
apis: a,
|
1395
1395
|
window,
|
1396
1396
|
...t
|
@@ -1406,42 +1406,42 @@ class bn extends De {
|
|
1406
1406
|
});
|
1407
1407
|
}
|
1408
1408
|
async getRenderComponent(e, t) {
|
1409
|
-
const
|
1410
|
-
if (!
|
1409
|
+
const s = this.getFile(e);
|
1410
|
+
if (!s)
|
1411
1411
|
return P.warn(`Can not find file: ${e}`), null;
|
1412
|
-
t && t(
|
1413
|
-
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1412
|
+
t && t(s);
|
1413
|
+
const r = `.vtj/vue/${e}.vue`, o = this.modules[r] || this.modules[`/src/pages/${e}.vue`];
|
1414
1414
|
if (o)
|
1415
1415
|
return (await o())?.default;
|
1416
|
-
const a = await this.getDsl(
|
1416
|
+
const a = await this.getDsl(s.id);
|
1417
1417
|
return a ? this.createDslRenderer(a).renderer : (P.warn(`Can not find dsl: ${e}`), null);
|
1418
1418
|
}
|
1419
1419
|
defineUrlSchemaComponent(e, t) {
|
1420
1420
|
return le(async () => {
|
1421
|
-
const
|
1422
|
-
return
|
1421
|
+
const s = await this.getDslByUrl(e);
|
1422
|
+
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
1423
1423
|
});
|
1424
1424
|
}
|
1425
1425
|
definePluginComponent(e) {
|
1426
1426
|
return le(async () => await Ee(e, window));
|
1427
1427
|
}
|
1428
1428
|
}
|
1429
|
-
function
|
1430
|
-
const e = new
|
1429
|
+
function Ds(n) {
|
1430
|
+
const e = new Ss(n);
|
1431
1431
|
return {
|
1432
1432
|
provider: e,
|
1433
|
-
onReady: (
|
1433
|
+
onReady: (s) => e.ready(s)
|
1434
1434
|
};
|
1435
1435
|
}
|
1436
|
-
function Ce(
|
1436
|
+
function Ce(n = {}) {
|
1437
1437
|
const e = ge(xe, null);
|
1438
1438
|
if (!e)
|
1439
1439
|
throw new Error("Can not find provider");
|
1440
1440
|
if (e.nodeEnv === "development") {
|
1441
|
-
const { id: t, version:
|
1442
|
-
t &&
|
1441
|
+
const { id: t, version: s } = n;
|
1442
|
+
t && s && (async () => {
|
1443
1443
|
const r = await e.getDsl(t);
|
1444
|
-
r?.__VERSION__ !==
|
1444
|
+
r?.__VERSION__ !== s && e.adapter.notify && e.adapter.notify(
|
1445
1445
|
`[ ${r?.name} ] 组件源码版本与运行时版本不一致,请重新发布组件`,
|
1446
1446
|
"版本不一致",
|
1447
1447
|
"warning"
|
@@ -1455,30 +1455,30 @@ const Me = {
|
|
1455
1455
|
validSuccess: !0,
|
1456
1456
|
originResponse: !1,
|
1457
1457
|
failMessage: !0,
|
1458
|
-
validate: (
|
1459
|
-
},
|
1458
|
+
validate: (n) => n.data?.code === 0
|
1459
|
+
}, bs = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
1460
1460
|
url: e,
|
1461
1461
|
method: "post",
|
1462
1462
|
params: { type: t },
|
1463
1463
|
query: r,
|
1464
1464
|
data: {
|
1465
1465
|
type: t,
|
1466
|
-
data:
|
1466
|
+
data: s
|
1467
1467
|
},
|
1468
1468
|
settings: Me
|
1469
|
-
}),
|
1469
|
+
}), js = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1470
1470
|
url: e,
|
1471
1471
|
method: "post",
|
1472
1472
|
data: {
|
1473
1473
|
files: t,
|
1474
|
-
projectId:
|
1474
|
+
projectId: s
|
1475
1475
|
},
|
1476
1476
|
settings: {
|
1477
1477
|
...Me,
|
1478
1478
|
type: "data"
|
1479
1479
|
}
|
1480
1480
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1481
|
-
function
|
1481
|
+
function Hs(n) {
|
1482
1482
|
return he({
|
1483
1483
|
settings: {
|
1484
1484
|
type: "json",
|
@@ -1487,7 +1487,7 @@ function On(s) {
|
|
1487
1487
|
failMessage: !0,
|
1488
1488
|
validate: (e) => e.data?.code === 0,
|
1489
1489
|
showError: (e) => {
|
1490
|
-
|
1490
|
+
n && n(e || "未知错误");
|
1491
1491
|
}
|
1492
1492
|
}
|
1493
1493
|
});
|
@@ -1497,7 +1497,7 @@ class re {
|
|
1497
1497
|
pluginCaches = {};
|
1498
1498
|
uploader;
|
1499
1499
|
constructor(e = K) {
|
1500
|
-
this.api =
|
1500
|
+
this.api = bs(e), this.uploader = js(e);
|
1501
1501
|
}
|
1502
1502
|
async getExtension() {
|
1503
1503
|
console.log("BaseService.getExtension");
|
@@ -1572,11 +1572,11 @@ class re {
|
|
1572
1572
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1573
1573
|
}
|
1574
1574
|
async getPluginMaterial(e) {
|
1575
|
-
const { urls: t = [] } = e,
|
1576
|
-
if (!
|
1577
|
-
const r = this.pluginCaches[
|
1578
|
-
return r || (this.pluginCaches[
|
1579
|
-
url:
|
1575
|
+
const { urls: t = [] } = e, s = t.filter((o) => at(o))[0];
|
1576
|
+
if (!s) return null;
|
1577
|
+
const r = this.pluginCaches[s];
|
1578
|
+
return r || (this.pluginCaches[s] = K.send({
|
1579
|
+
url: s,
|
1580
1580
|
method: "get",
|
1581
1581
|
settings: {
|
1582
1582
|
validSuccess: !1,
|
@@ -1593,9 +1593,9 @@ const v = new Ve({
|
|
1593
1593
|
expired: 0,
|
1594
1594
|
prefix: "__VTJ_"
|
1595
1595
|
});
|
1596
|
-
class
|
1596
|
+
class Os extends re {
|
1597
1597
|
init(e) {
|
1598
|
-
const t = new H(e),
|
1598
|
+
const t = new H(e), s = v.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
1599
1599
|
return v.save(`project_${t.id}`, r), Promise.resolve(r);
|
1600
1600
|
}
|
1601
1601
|
saveProject(e) {
|
@@ -1627,30 +1627,30 @@ class Bn extends re {
|
|
1627
1627
|
return Promise.resolve(!0);
|
1628
1628
|
}
|
1629
1629
|
getHistory(e) {
|
1630
|
-
const t = v.get(`history_${e}`),
|
1631
|
-
return Promise.resolve(
|
1630
|
+
const t = v.get(`history_${e}`), s = new pe(t || { id: e });
|
1631
|
+
return Promise.resolve(s.toDsl());
|
1632
1632
|
}
|
1633
1633
|
getHistoryItem(e, t) {
|
1634
|
-
const
|
1635
|
-
return Promise.resolve(
|
1634
|
+
const s = v.get(`history_${e}_${t}`);
|
1635
|
+
return Promise.resolve(s);
|
1636
1636
|
}
|
1637
1637
|
saveHistoryItem(e, t) {
|
1638
1638
|
return v.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1639
1639
|
}
|
1640
1640
|
removeHistoryItem(e, t) {
|
1641
|
-
return t.forEach((
|
1642
|
-
v.remove(`history_${e}_${
|
1641
|
+
return t.forEach((s) => {
|
1642
|
+
v.remove(`history_${e}_${s}`);
|
1643
1643
|
}), Promise.resolve(!0);
|
1644
1644
|
}
|
1645
1645
|
}
|
1646
|
-
class
|
1646
|
+
class $s extends re {
|
1647
1647
|
projects = {};
|
1648
1648
|
materials = {};
|
1649
1649
|
files = {};
|
1650
1650
|
histories = {};
|
1651
1651
|
historyItems = {};
|
1652
1652
|
init(e) {
|
1653
|
-
const t = new H(e),
|
1653
|
+
const t = new H(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
1654
1654
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1655
1655
|
}
|
1656
1656
|
saveProject(e) {
|
@@ -1682,29 +1682,29 @@ class kn extends re {
|
|
1682
1682
|
return Promise.resolve(!0);
|
1683
1683
|
}
|
1684
1684
|
getHistory(e) {
|
1685
|
-
const t = this.histories[e],
|
1686
|
-
return Promise.resolve(
|
1685
|
+
const t = this.histories[e], s = new pe(t || { id: e });
|
1686
|
+
return Promise.resolve(s);
|
1687
1687
|
}
|
1688
1688
|
getHistoryItem(e, t) {
|
1689
|
-
const
|
1689
|
+
const s = `${e}_${t}`, r = this.historyItems[s] || {};
|
1690
1690
|
return Promise.resolve(r);
|
1691
1691
|
}
|
1692
1692
|
saveHistoryItem(e, t) {
|
1693
|
-
const
|
1694
|
-
return this.historyItems[
|
1693
|
+
const s = `${e}_${t.id}`;
|
1694
|
+
return this.historyItems[s] = t, Promise.resolve(!0);
|
1695
1695
|
}
|
1696
1696
|
removeHistoryItem(e, t) {
|
1697
|
-
return t.forEach((
|
1698
|
-
const r = `${e}_${
|
1697
|
+
return t.forEach((s) => {
|
1698
|
+
const r = `${e}_${s}`;
|
1699
1699
|
delete this.historyItems[r];
|
1700
1700
|
}), Promise.resolve(!0);
|
1701
1701
|
}
|
1702
1702
|
}
|
1703
1703
|
let I = null;
|
1704
|
-
function
|
1705
|
-
return I || (I = new
|
1704
|
+
function Bs() {
|
1705
|
+
return I || (I = new $s(), I);
|
1706
1706
|
}
|
1707
|
-
class
|
1707
|
+
class Ns extends re {
|
1708
1708
|
getFileCaches = {};
|
1709
1709
|
async getExtension() {
|
1710
1710
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1761,37 +1761,37 @@ class Un extends re {
|
|
1761
1761
|
);
|
1762
1762
|
}
|
1763
1763
|
}
|
1764
|
-
function Ae(
|
1765
|
-
return t.map((
|
1766
|
-
const { id: r, title: o, icon: a, children: i, hidden: c } =
|
1764
|
+
function Ae(n, e, t = []) {
|
1765
|
+
return t.map((s) => {
|
1766
|
+
const { id: r, title: o, icon: a, children: i, hidden: c } = s;
|
1767
1767
|
return {
|
1768
1768
|
id: r,
|
1769
1769
|
title: o,
|
1770
1770
|
icon: a,
|
1771
1771
|
hidden: c,
|
1772
|
-
url: `${
|
1773
|
-
children: i && i.length ? Ae(
|
1772
|
+
url: `${n}/${e}/${r}`,
|
1773
|
+
children: i && i.length ? Ae(n, e, i) : void 0
|
1774
1774
|
};
|
1775
1775
|
});
|
1776
1776
|
}
|
1777
|
-
function Fe(
|
1778
|
-
if (!e) return
|
1777
|
+
function Fe(n, e) {
|
1778
|
+
if (!e) return n;
|
1779
1779
|
let t = [];
|
1780
|
-
for (const
|
1781
|
-
if (
|
1782
|
-
const r = Fe(
|
1783
|
-
r.length && (
|
1780
|
+
for (const s of n)
|
1781
|
+
if (s.children && s.children.length) {
|
1782
|
+
const r = Fe(s.children, e);
|
1783
|
+
r.length && (s.children = r, t.push(s));
|
1784
1784
|
} else
|
1785
|
-
e.can(
|
1785
|
+
e.can(s.id.toString()) && t.push(s);
|
1786
1786
|
return t;
|
1787
1787
|
}
|
1788
|
-
function
|
1788
|
+
function Us(n) {
|
1789
1789
|
const {
|
1790
1790
|
menuPathPrefix: e = "",
|
1791
1791
|
pageRouteName: t = "page",
|
1792
|
-
disableMenusFilter:
|
1793
|
-
} =
|
1794
|
-
|
1792
|
+
disableMenusFilter: s = !1
|
1793
|
+
} = n || {}, r = Ce(), o = we(), a = _t(), i = C(!1), c = C(!1), l = r.project;
|
1794
|
+
st(() => {
|
1795
1795
|
const { name: d, params: h, meta: m } = o;
|
1796
1796
|
if (d === x) {
|
1797
1797
|
const p = r.getPage(h.id);
|
@@ -1812,15 +1812,15 @@ function Ln(s) {
|
|
1812
1812
|
logo: u?.logo,
|
1813
1813
|
themeSwitchable: u?.themeSwitchable,
|
1814
1814
|
title: u?.title || l?.description || l?.name || "VTJ App",
|
1815
|
-
menus:
|
1815
|
+
menus: s ? f : Fe(f, a),
|
1816
1816
|
pure: c
|
1817
1817
|
};
|
1818
1818
|
}
|
1819
1819
|
export {
|
1820
1820
|
$e as ACCESS_KEY,
|
1821
|
-
|
1821
|
+
Fs as Access,
|
1822
1822
|
it as BUILD_IN_TAGS,
|
1823
|
-
|
1823
|
+
nt as BUILT_IN_DIRECTIVES,
|
1824
1824
|
re as BaseService,
|
1825
1825
|
ue as CONTEXT_HOST,
|
1826
1826
|
Et as Context,
|
@@ -1828,31 +1828,31 @@ export {
|
|
1828
1828
|
rt as DATA_TYPES,
|
1829
1829
|
D as HOMEPAGE_ROUTE_NAME,
|
1830
1830
|
ot as HTML_TAGS,
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1831
|
+
As as JSCodeToString,
|
1832
|
+
xs as LIFE_CYCLES_LIST,
|
1833
|
+
Ns as LocalService,
|
1834
|
+
$s as MemoryService,
|
1835
|
+
ws as NodeEnv,
|
1836
1836
|
x as PAGE_ROUTE_NAME,
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1837
|
+
Ss as Provider,
|
1838
|
+
ys as Startup,
|
1839
|
+
Os as StorageService,
|
1840
1840
|
Se as VTJ_RENDERER_VERSION,
|
1841
1841
|
je as adoptedStyleSheets,
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1842
|
+
Is as clearLoaderCache,
|
1843
|
+
Ts as createAdapter,
|
1844
|
+
Cs as createAssetScripts,
|
1845
|
+
Ms as createAssetsCss,
|
1846
1846
|
Ft as createDataSources,
|
1847
1847
|
Q as createLoader,
|
1848
|
-
|
1848
|
+
Bs as createMemoryService,
|
1849
1849
|
St as createMetaApi,
|
1850
1850
|
$t as createMock,
|
1851
|
-
|
1851
|
+
Ds as createProvider,
|
1852
1852
|
Y as createRenderer,
|
1853
1853
|
wt as createSchemaApi,
|
1854
1854
|
bt as createSchemaApis,
|
1855
|
-
|
1855
|
+
Hs as createServiceRequest,
|
1856
1856
|
Dt as defaultLoader,
|
1857
1857
|
T as fillBasePath,
|
1858
1858
|
M as getMock,
|
@@ -1860,12 +1860,12 @@ export {
|
|
1860
1860
|
Ee as getPlugin,
|
1861
1861
|
ut as getRawComponent,
|
1862
1862
|
mt as isBuiltInTag,
|
1863
|
-
|
1863
|
+
se as isCSSUrl,
|
1864
1864
|
vt as isJSCode,
|
1865
1865
|
_ as isJSExpression,
|
1866
1866
|
F as isJSFunction,
|
1867
1867
|
at as isJSON,
|
1868
|
-
|
1868
|
+
ne as isJSUrl,
|
1869
1869
|
gt as isNativeTag,
|
1870
1870
|
ht as isVuePlugin,
|
1871
1871
|
dt as loadCss,
|
@@ -1882,6 +1882,6 @@ export {
|
|
1882
1882
|
ct as removeProdFlag,
|
1883
1883
|
be as toString,
|
1884
1884
|
_t as useAccess,
|
1885
|
-
|
1885
|
+
Us as useMask,
|
1886
1886
|
Ce as useProvider
|
1887
1887
|
};
|