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