@vtj/renderer 0.9.0-alpha.1 → 0.9.0-alpha.11
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 +520 -519
- package/package.json +6 -6
- package/types/hooks/mask.d.ts +4 -1
- package/types/plugins/access.d.ts +4 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
import { Base as xe, BUILT_IN_COMPONENTS as Re, ProjectModel as A, HistoryModel as ce } from "@vtj/core";
|
2
|
-
import { isUrl as ke, url as x, dedupArray as Ce, isString as j, isFunction as ee, logger as I, createRequest as Fe, merge as Ae, pathToRegexp as Ie, pathToRegexpMatch as Oe, formDataToJson as
|
3
|
-
import * as
|
4
|
-
import { inject as ue, toRef as Ne, readonly as Le, customRef as qe, ref as O,
|
5
|
-
import {
|
2
|
+
import { isUrl as ke, url as x, dedupArray as Ce, isString as j, isFunction as ee, logger as I, createRequest as Fe, merge as Ae, pathToRegexp as Ie, pathToRegexpMatch as Oe, formDataToJson as Me, storage as B, cookie as U, toArray as te, unRSA as ne, delay as le, camelCase as $, upperFirst as Te, pick as De, jsonp as He, loadScript as se, Request as Be, Storage as Ue, mapToObject as z } from "@vtj/utils";
|
3
|
+
import * as T from "vue";
|
4
|
+
import { inject as ue, toRef as Ne, readonly as Le, customRef as qe, ref as O, onBeforeUnmount as Je, getCurrentScope as Ve, onScopeDispose as ze, unref as Ke, getCurrentInstance as de, watch as pe, computed as fe, onMounted as We, defineComponent as K, h as q, openBlock as Ge, createElementBlock as Ye, createElementVNode as b, toDisplayString as N, defineAsyncComponent as re, watchEffect as Qe } from "vue";
|
5
|
+
import { ElNotification as D, ElLoading as Xe } from "element-plus";
|
6
6
|
import { useRoute as he } from "vue-router";
|
7
7
|
/**!
|
8
8
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
9
9
|
* @name @vtj/renderer
|
10
10
|
* @author CHC chenhuachun1549@dingtalk.com
|
11
|
-
* @version 0.9.0-alpha.
|
11
|
+
* @version 0.9.0-alpha.11
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
13
13
|
*/
|
14
|
-
const R = "0.9.0-alpha.
|
15
|
-
var _ = /* @__PURE__ */ ((
|
14
|
+
const R = "0.9.0-alpha.11";
|
15
|
+
var _ = /* @__PURE__ */ ((s) => (s.Runtime = "Runtime", s.Design = "Design", s.Raw = "Raw", s.VNode = "VNode", s))(_ || {});
|
16
16
|
const oe = [
|
17
17
|
"$el",
|
18
18
|
"$emit",
|
@@ -25,7 +25,7 @@ const oe = [
|
|
25
25
|
"$props",
|
26
26
|
"$options",
|
27
27
|
"$forceUpdate"
|
28
|
-
],
|
28
|
+
], wn = [
|
29
29
|
"beforeCreate",
|
30
30
|
"created",
|
31
31
|
"beforeMount",
|
@@ -48,38 +48,38 @@ const oe = [
|
|
48
48
|
Function,
|
49
49
|
Date
|
50
50
|
}, W = "VtjPage", me = "VtjHomepage";
|
51
|
-
function C(
|
52
|
-
return
|
51
|
+
function C(s, e) {
|
52
|
+
return s.map((t) => ke(t) || t.startsWith("/") ? t : `${e}${t}`);
|
53
53
|
}
|
54
|
-
function G(
|
55
|
-
return /\.css$/.test(
|
54
|
+
function G(s) {
|
55
|
+
return /\.css$/.test(s);
|
56
56
|
}
|
57
|
-
function Y(
|
58
|
-
return /\.js$/.test(
|
57
|
+
function Y(s) {
|
58
|
+
return /\.js$/.test(s);
|
59
59
|
}
|
60
|
-
function tt(
|
61
|
-
return /\.json$/.test(
|
60
|
+
function tt(s) {
|
61
|
+
return /\.json$/.test(s);
|
62
62
|
}
|
63
|
-
function
|
64
|
-
return
|
63
|
+
function Sn(s) {
|
64
|
+
return s.map(
|
65
65
|
(e) => `<script src="${x.append(e, { v: R })}"><\/script>`
|
66
66
|
).join("");
|
67
67
|
}
|
68
|
-
function
|
69
|
-
return
|
68
|
+
function jn(s = []) {
|
69
|
+
return s.map(
|
70
70
|
(e) => `<link rel="stylesheet" href="${x.append(e, { v: R })}" />`
|
71
71
|
).join("");
|
72
72
|
}
|
73
|
-
function
|
74
|
-
return e &&
|
73
|
+
function nt(s, e = !1) {
|
74
|
+
return e && s.endsWith(".prod.js") ? s.replace(".prod.js", ".js") : s;
|
75
75
|
}
|
76
|
-
function
|
77
|
-
const
|
78
|
-
return
|
79
|
-
({ urls: u, assetsUrl:
|
76
|
+
function st(s, e, t = !1) {
|
77
|
+
const n = s.filter((u) => !!u.enabled), r = [], o = [], a = [], i = [], l = {}, c = {}, f = [], d = {};
|
78
|
+
return n.forEach(
|
79
|
+
({ urls: u, assetsUrl: h, library: p, assetsLibrary: m, localeLibrary: w }) => {
|
80
80
|
u?.forEach((g) => {
|
81
|
-
Y(g) && r.push(
|
82
|
-
}), p && (i.push(p),
|
81
|
+
Y(g) && r.push(nt(g, t)), G(g) && o.push(g);
|
82
|
+
}), p && (i.push(p), l[p] = C(u || [], e), w && (c[p] = w)), h && a.push(h), m && f.push(m), p && m && (d[m] = p);
|
83
83
|
}
|
84
84
|
), {
|
85
85
|
scripts: C(r, e),
|
@@ -88,97 +88,97 @@ function nt(n, e, t = !1) {
|
|
88
88
|
libraryExports: i,
|
89
89
|
materialExports: Ce(f),
|
90
90
|
materialMapLibrary: d,
|
91
|
-
libraryMap:
|
92
|
-
libraryLocaleMap:
|
91
|
+
libraryMap: l,
|
92
|
+
libraryLocaleMap: c
|
93
93
|
};
|
94
94
|
}
|
95
|
-
function rt(
|
96
|
-
const { name: t, parent:
|
97
|
-
return
|
95
|
+
function rt(s, e) {
|
96
|
+
const { name: t, parent: n, alias: r } = s;
|
97
|
+
return n ? e[n]?.[r || t] : e[r || t];
|
98
98
|
}
|
99
|
-
function ge(
|
100
|
-
return j(
|
99
|
+
function ge(s) {
|
100
|
+
return j(s) ? s : JSON.stringify(s);
|
101
101
|
}
|
102
|
-
function ve(
|
103
|
-
const
|
104
|
-
if (
|
105
|
-
const r = new
|
102
|
+
function ve(s, e, t) {
|
103
|
+
const n = s.CSSStyleSheet;
|
104
|
+
if (n.prototype.replaceSync) {
|
105
|
+
const r = new n();
|
106
106
|
r.id = e, r.replaceSync(t);
|
107
|
-
const o =
|
108
|
-
(
|
107
|
+
const o = s.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
|
108
|
+
(l) => l.id !== e
|
109
109
|
);
|
110
110
|
o.adoptedStyleSheets = [...i, r];
|
111
111
|
} else {
|
112
|
-
const r =
|
112
|
+
const r = s.document;
|
113
113
|
let o = r.getElementById(e);
|
114
114
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
115
115
|
}
|
116
116
|
}
|
117
|
-
async function ot(
|
118
|
-
const t = await window.fetch(e).then((
|
119
|
-
t && ve(window,
|
117
|
+
async function ot(s, e) {
|
118
|
+
const t = await window.fetch(e).then((n) => n.text()).catch(() => "");
|
119
|
+
t && ve(window, s, t);
|
120
120
|
}
|
121
|
-
function it(
|
122
|
-
const t = e.document,
|
123
|
-
for (const r of
|
121
|
+
function it(s, e = window) {
|
122
|
+
const t = e.document, n = e.document.head;
|
123
|
+
for (const r of s)
|
124
124
|
if (!t.getElementById(r)) {
|
125
125
|
const a = t.createElement("link");
|
126
|
-
a.rel = "stylesheet", a.id = r, a.href = r,
|
126
|
+
a.rel = "stylesheet", a.id = r, a.href = r, n.appendChild(a);
|
127
127
|
}
|
128
128
|
}
|
129
|
-
async function at(
|
130
|
-
const
|
129
|
+
async function at(s, e, t = window) {
|
130
|
+
const n = t.document, r = t.document.head;
|
131
131
|
let o = t[e];
|
132
132
|
return o ? o.default || o : new Promise((a, i) => {
|
133
|
-
for (const
|
134
|
-
const
|
135
|
-
|
133
|
+
for (const l of s) {
|
134
|
+
const c = n.createElement("script");
|
135
|
+
c.src = l, c.onload = () => {
|
136
136
|
o = t[e], o ? a(o.default || o) : i(null);
|
137
|
-
},
|
137
|
+
}, c.onerror = (f) => {
|
138
138
|
i(f);
|
139
|
-
}, r.appendChild(
|
139
|
+
}, r.appendChild(c);
|
140
140
|
}
|
141
141
|
});
|
142
142
|
}
|
143
|
-
function ct(
|
144
|
-
return ee(
|
143
|
+
function ct(s) {
|
144
|
+
return ee(s) || ee(s?.install);
|
145
145
|
}
|
146
|
-
function k(
|
146
|
+
function k(s, e, t = !1, n = !1) {
|
147
147
|
try {
|
148
148
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
149
149
|
r.push("return ");
|
150
|
-
let o = (
|
151
|
-
o = o.replace(/this(\W|$)/g, (i,
|
150
|
+
let o = (s.value || "").trim();
|
151
|
+
o = o.replace(/this(\W|$)/g, (i, l) => `__self${l}`), o = r.join(`
|
152
152
|
`) + o;
|
153
153
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
154
154
|
return new Function("$scope", a)(e);
|
155
155
|
} catch (r) {
|
156
|
-
if (I.error("parseExpression.error", r,
|
156
|
+
if (I.error("parseExpression.error", r, s, e?.__self ?? e), n)
|
157
157
|
throw r;
|
158
158
|
}
|
159
159
|
}
|
160
|
-
function ie(
|
161
|
-
const r = k(
|
160
|
+
function ie(s, e, t = !1, n = !1) {
|
161
|
+
const r = k(s, e, t, n);
|
162
162
|
if (typeof r != "function" && (I.error(
|
163
163
|
"parseFunction.error",
|
164
164
|
"not a function",
|
165
|
-
|
165
|
+
s,
|
166
166
|
e?.__self ?? e
|
167
|
-
),
|
168
|
-
throw new Error(`"${
|
167
|
+
), n))
|
168
|
+
throw new Error(`"${s.value}" not a function`);
|
169
169
|
return r;
|
170
170
|
}
|
171
|
-
function S(
|
172
|
-
return
|
171
|
+
function S(s) {
|
172
|
+
return s && s.type === "JSExpression";
|
173
173
|
}
|
174
|
-
function H(
|
175
|
-
return typeof
|
174
|
+
function H(s) {
|
175
|
+
return typeof s == "object" && s && s.type === "JSFunction";
|
176
176
|
}
|
177
|
-
function lt(
|
178
|
-
return S(
|
177
|
+
function lt(s) {
|
178
|
+
return S(s) || H(s);
|
179
179
|
}
|
180
|
-
function
|
181
|
-
return lt(
|
180
|
+
function $n(s) {
|
181
|
+
return lt(s) ? s.value : JSON.stringify(s);
|
182
182
|
}
|
183
183
|
let E = null;
|
184
184
|
const ut = Fe({
|
@@ -187,11 +187,11 @@ const ut = Fe({
|
|
187
187
|
validSuccess: !0,
|
188
188
|
originResponse: !1,
|
189
189
|
loading: !0,
|
190
|
-
validate: (
|
190
|
+
validate: (s) => s.data?.code === 0 || !!s.data?.success,
|
191
191
|
failMessage: !0,
|
192
|
-
showError: (
|
193
|
-
|
194
|
-
message:
|
192
|
+
showError: (s) => {
|
193
|
+
D.error({
|
194
|
+
message: s || "未知错误"
|
195
195
|
});
|
196
196
|
},
|
197
197
|
showLoading: () => {
|
@@ -207,58 +207,58 @@ const ut = Fe({
|
|
207
207
|
}
|
208
208
|
});
|
209
209
|
let P;
|
210
|
-
function dt(
|
211
|
-
const { jsonp: t, request:
|
212
|
-
if (
|
213
|
-
return (r = {}) => t(
|
214
|
-
...
|
210
|
+
function dt(s, e) {
|
211
|
+
const { jsonp: t, request: n } = e;
|
212
|
+
if (s.method === "jsonp")
|
213
|
+
return (r = {}) => t(s.url, {
|
214
|
+
...s.jsonpOptions,
|
215
215
|
query: r
|
216
216
|
});
|
217
217
|
{
|
218
|
-
const r =
|
219
|
-
url:
|
220
|
-
method:
|
218
|
+
const r = s.headers ? k(s.headers, {}, !0) : void 0, o = {
|
219
|
+
url: s.url,
|
220
|
+
method: s.method,
|
221
221
|
settings: {
|
222
|
-
...
|
222
|
+
...s.settings,
|
223
223
|
headers: r
|
224
224
|
}
|
225
225
|
};
|
226
|
-
return (a, i) => (delete o.data,
|
226
|
+
return (a, i) => (delete o.data, n.send(Ae(o, i || {}, { data: a })));
|
227
227
|
}
|
228
228
|
}
|
229
|
-
function pt(
|
229
|
+
function pt(s, e) {
|
230
230
|
const { metaQuery: t } = e;
|
231
231
|
if (!t) return;
|
232
|
-
const { code:
|
232
|
+
const { code: n, queryCode: r } = s;
|
233
233
|
return (o, a) => {
|
234
234
|
if (!t) {
|
235
235
|
console.warn("adapter.metaQuery is not defined!");
|
236
236
|
return;
|
237
237
|
}
|
238
|
-
return t(
|
238
|
+
return t(n, r, o, a);
|
239
239
|
};
|
240
240
|
}
|
241
|
-
function ft(
|
242
|
-
const
|
243
|
-
for (const r of
|
244
|
-
|
241
|
+
function ft(s = [], e = [], t) {
|
242
|
+
const n = {};
|
243
|
+
for (const r of s)
|
244
|
+
n[r.id] = dt(r, t);
|
245
245
|
for (const r of e)
|
246
|
-
|
247
|
-
return
|
246
|
+
n[r.id] = pt(r, t);
|
247
|
+
return n;
|
248
248
|
}
|
249
|
-
async function ht(
|
249
|
+
async function ht(s = []) {
|
250
250
|
P = await import("mockjs").then((e) => e.default || e), P && (P.setup({
|
251
251
|
timeout: "50-500"
|
252
|
-
}), ye(),
|
252
|
+
}), ye(), s.forEach((e) => mt(P, e)));
|
253
253
|
}
|
254
|
-
function mt(
|
254
|
+
function mt(s, e) {
|
255
255
|
if (!e.mock) return;
|
256
|
-
const { url: t, mockTemplate:
|
257
|
-
if (t &&
|
258
|
-
const r = Ie(`${t}(.*)`), o = Oe(t, { decode: decodeURIComponent }), a = k(
|
259
|
-
|
260
|
-
const
|
261
|
-
return Object.assign(i, { data:
|
256
|
+
const { url: t, mockTemplate: n } = e;
|
257
|
+
if (t && n) {
|
258
|
+
const r = Ie(`${t}(.*)`), o = Oe(t, { decode: decodeURIComponent }), a = k(n, {}, !0);
|
259
|
+
s.mock(r, (i) => {
|
260
|
+
const l = x.parse(i.url) || {}, c = i.body instanceof FormData ? Me(i.body) : i.body, f = o(i.url)?.params;
|
261
|
+
return Object.assign(i, { data: c, params: l, query: f }), s.mock(a(i));
|
262
262
|
});
|
263
263
|
}
|
264
264
|
}
|
@@ -275,9 +275,10 @@ const gt = {
|
|
275
275
|
redirectParam: "r",
|
276
276
|
unauthorizedCode: 401,
|
277
277
|
unauthorizedMessage: "登录已经失效,请重新登录!",
|
278
|
-
noPermissionMessage: "无权限访问该页面"
|
278
|
+
noPermissionMessage: "无权限访问该页面",
|
279
|
+
keyPrefix: ""
|
279
280
|
}, _e = Symbol("access");
|
280
|
-
class
|
281
|
+
class bn {
|
281
282
|
options;
|
282
283
|
data = null;
|
283
284
|
mode = _.Raw;
|
@@ -285,22 +286,22 @@ class $s {
|
|
285
286
|
this.options = Object.assign({}, gt, e), this.loadData();
|
286
287
|
}
|
287
288
|
connect(e) {
|
288
|
-
const { mode: t, router:
|
289
|
-
this.mode = t,
|
289
|
+
const { mode: t, router: n, request: r } = e;
|
290
|
+
this.mode = t, n && t === _.Raw && this.setGuard(n), r && this.setRequest(r);
|
290
291
|
}
|
291
292
|
login(e) {
|
292
|
-
const { storageKey: t, storagePrefix:
|
293
|
+
const { storageKey: t, storagePrefix: n, session: r, authKey: o } = this.options;
|
293
294
|
this.setData(e), this.data && (B.save(t, e, {
|
294
295
|
type: "local",
|
295
|
-
prefix:
|
296
|
+
prefix: n
|
296
297
|
}), r && U.set(o, this.data.token));
|
297
298
|
}
|
298
299
|
clear() {
|
299
|
-
const { storageKey: e, storagePrefix: t, session:
|
300
|
+
const { storageKey: e, storagePrefix: t, session: n, authKey: r } = this.options;
|
300
301
|
this.data = null, B.remove(e, {
|
301
302
|
type: "local",
|
302
303
|
prefix: t
|
303
|
-
}),
|
304
|
+
}), n && U.remove(r);
|
304
305
|
}
|
305
306
|
logout() {
|
306
307
|
this.clear(), this.toLogin();
|
@@ -312,20 +313,20 @@ class $s {
|
|
312
313
|
return this.data?.token;
|
313
314
|
}
|
314
315
|
can(e) {
|
315
|
-
const {
|
316
|
-
return typeof e == "function" ? e(
|
316
|
+
const { keyPrefix: t } = this.options, { permissions: n = {} } = this.data || {};
|
317
|
+
return typeof e == "function" ? e(n) : te(e).every((o) => n[o] || n[t + o]);
|
317
318
|
}
|
318
319
|
some(e) {
|
319
|
-
const {
|
320
|
-
return te(e).some((
|
320
|
+
const { keyPrefix: t } = this.options, { permissions: n = {} } = this.data || {};
|
321
|
+
return te(e).some((o) => n[o] || n[t + o]);
|
321
322
|
}
|
322
323
|
install(e) {
|
323
324
|
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(_e, this);
|
324
325
|
}
|
325
326
|
isAuthPath(e) {
|
326
|
-
const { auth: t, isAuth:
|
327
|
-
if (
|
328
|
-
return
|
327
|
+
const { auth: t, isAuth: n } = this.options;
|
328
|
+
if (n)
|
329
|
+
return n(e);
|
329
330
|
if (e.path && typeof t == "string") {
|
330
331
|
const r = t.split("#")[1] || t;
|
331
332
|
return e.path === r;
|
@@ -335,32 +336,32 @@ class $s {
|
|
335
336
|
toLogin() {
|
336
337
|
const { auth: e, redirectParam: t } = this.options;
|
337
338
|
if (!e || this.mode !== _.Raw) return;
|
338
|
-
const
|
339
|
-
typeof e == "function" ? e(
|
339
|
+
const n = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
|
340
|
+
typeof e == "function" ? e(n) : location.href = t ? `${e}${n}` : e;
|
340
341
|
}
|
341
342
|
setData(e) {
|
342
343
|
const { privateKey: t } = this.options;
|
343
344
|
if (Array.isArray(e) && t) {
|
344
|
-
const
|
345
|
-
this.data = JSON.parse(
|
345
|
+
const n = e.map((r) => ne(r, t));
|
346
|
+
this.data = JSON.parse(n.join(""));
|
346
347
|
return;
|
347
348
|
}
|
348
349
|
if (typeof e == "string")
|
349
350
|
try {
|
350
|
-
const
|
351
|
-
|
352
|
-
} catch (
|
353
|
-
console.warn(
|
351
|
+
const n = t ? ne(e, t) : e;
|
352
|
+
n ? this.data = JSON.parse(n) : console.warn("RSA解密失败或登录信息缺失");
|
353
|
+
} catch (n) {
|
354
|
+
console.warn(n);
|
354
355
|
}
|
355
356
|
else
|
356
357
|
this.data = e;
|
357
358
|
}
|
358
359
|
loadData() {
|
359
|
-
const { storageKey: e, storagePrefix: t } = this.options,
|
360
|
+
const { storageKey: e, storagePrefix: t } = this.options, n = B.get(e, {
|
360
361
|
type: "local",
|
361
362
|
prefix: t
|
362
363
|
});
|
363
|
-
this.setData(
|
364
|
+
this.setData(n);
|
364
365
|
}
|
365
366
|
isLogined() {
|
366
367
|
const { session: e, authKey: t } = this.options;
|
@@ -374,7 +375,7 @@ class $s {
|
|
374
375
|
return !0;
|
375
376
|
}
|
376
377
|
setGuard(e) {
|
377
|
-
e.beforeEach((t,
|
378
|
+
e.beforeEach((t, n, r) => this.guard(t, r));
|
378
379
|
}
|
379
380
|
guard(e, t) {
|
380
381
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
@@ -383,15 +384,15 @@ class $s {
|
|
383
384
|
if (this.hasRoutePermission(e))
|
384
385
|
return t();
|
385
386
|
{
|
386
|
-
const
|
387
|
-
return this.showTip(
|
387
|
+
const n = this.options.noPermissionMessage || "无权限访问";
|
388
|
+
return this.showTip(n), t(!1);
|
388
389
|
}
|
389
390
|
}
|
390
391
|
t(!1), this.toLogin();
|
391
392
|
}
|
392
393
|
isWhiteList(e) {
|
393
394
|
const { whiteList: t } = this.options;
|
394
|
-
return t ? Array.isArray(t) ? t.some((
|
395
|
+
return t ? Array.isArray(t) ? t.some((n) => e.fullPath.startsWith(n)) : t(e) : !1;
|
395
396
|
}
|
396
397
|
isUnauthorized(e) {
|
397
398
|
const { unauthorizedCode: t = 401 } = this.options;
|
@@ -406,14 +407,14 @@ class $s {
|
|
406
407
|
t && (await le(150), await t(e, {
|
407
408
|
title: "提示",
|
408
409
|
type: "warning"
|
409
|
-
}).catch((
|
410
|
+
}).catch((n) => n));
|
410
411
|
}
|
411
412
|
setRequest(e) {
|
412
413
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
413
414
|
async (t) => (await this.showUnauthorizedAlert(t), t),
|
414
415
|
async (t) => {
|
415
|
-
const
|
416
|
-
return await this.showUnauthorizedAlert(
|
416
|
+
const n = t.response || t || {};
|
417
|
+
return await this.showUnauthorizedAlert(n), Promise.reject(t);
|
417
418
|
}
|
418
419
|
);
|
419
420
|
}
|
@@ -447,14 +448,14 @@ class yt {
|
|
447
448
|
$apis = {};
|
448
449
|
__transform = {};
|
449
450
|
constructor(e) {
|
450
|
-
const { mode: t, dsl:
|
451
|
-
this.__mode = t,
|
452
|
-
}
|
453
|
-
setup(e, t =
|
454
|
-
const
|
455
|
-
if (!
|
456
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
457
|
-
const r =
|
451
|
+
const { mode: t, dsl: n, attrs: r } = e;
|
452
|
+
this.__mode = t, n && (this.__id = n.id || null, this.__transform = n.transform || {}), r && Object.assign(this, r);
|
453
|
+
}
|
454
|
+
setup(e, t = T) {
|
455
|
+
const n = t.getCurrentInstance();
|
456
|
+
if (!n) return;
|
457
|
+
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = n.proxy;
|
458
|
+
const r = n.appContext.config.globalProperties;
|
458
459
|
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
459
460
|
this.__proxy();
|
460
461
|
}), t.onUnmounted(() => {
|
@@ -476,87 +477,87 @@ class yt {
|
|
476
477
|
__parseFunction(e) {
|
477
478
|
if (e)
|
478
479
|
if (this.__mode === _.Runtime) {
|
479
|
-
const { id: t, type:
|
480
|
-
return ie({ type:
|
480
|
+
const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
481
|
+
return ie({ type: n, value: r }, this);
|
481
482
|
} else
|
482
483
|
return ie(e, this);
|
483
484
|
}
|
484
485
|
__parseExpression(e) {
|
485
486
|
if (e)
|
486
487
|
if (this.__mode === _.Runtime) {
|
487
|
-
const { id: t, type:
|
488
|
-
return k({ type:
|
488
|
+
const { id: t, type: n } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
489
|
+
return k({ type: n, value: r }, this);
|
489
490
|
} else
|
490
491
|
return k(e, this);
|
491
492
|
}
|
492
493
|
__ref(e = null, t) {
|
493
494
|
if (this.__mode !== _.VNode)
|
494
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
495
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (n) => {
|
495
496
|
await le(0);
|
496
|
-
let r =
|
497
|
+
let r = n?.$vtjEl || n?.$el || n?._?.vnode?.el || n;
|
497
498
|
if (!r) {
|
498
499
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
499
500
|
return;
|
500
501
|
}
|
501
|
-
if (r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, _.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] =
|
502
|
-
t(
|
502
|
+
if (r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, _.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = n), typeof t == "function")
|
503
|
+
t(n);
|
503
504
|
else if (t) {
|
504
505
|
const o = this.$refs[t];
|
505
|
-
if (o &&
|
506
|
-
const a = new Set([].concat(o,
|
506
|
+
if (o && n !== o) {
|
507
|
+
const a = new Set([].concat(o, n));
|
507
508
|
this.$refs[t] = Array.from(a);
|
508
509
|
} else
|
509
|
-
this.$refs[t] =
|
510
|
+
this.$refs[t] = n;
|
510
511
|
}
|
511
|
-
return
|
512
|
+
return n;
|
512
513
|
};
|
513
514
|
}
|
514
515
|
__clone(e = {}) {
|
515
|
-
const t = { ...this.context, ...e },
|
516
|
+
const t = { ...this.context, ...e }, n = {
|
516
517
|
...t,
|
517
518
|
context: t
|
518
519
|
};
|
519
|
-
return
|
520
|
+
return n.context.__proto__ = this.context, n.__proto__ = this, n;
|
520
521
|
}
|
521
522
|
}
|
522
|
-
function J(
|
523
|
+
function J(s) {
|
523
524
|
const {
|
524
|
-
Vue: e =
|
525
|
+
Vue: e = T,
|
525
526
|
mode: t = _.Runtime,
|
526
|
-
components:
|
527
|
+
components: n = {},
|
527
528
|
libs: r = {},
|
528
529
|
apis: o = {},
|
529
530
|
loader: a
|
530
|
-
} =
|
531
|
-
$components:
|
531
|
+
} = s, i = e.computed(() => s.dsl), l = {
|
532
|
+
$components: n,
|
532
533
|
$libs: r,
|
533
534
|
$apis: o
|
534
|
-
},
|
535
|
+
}, c = new yt({
|
535
536
|
mode: t,
|
536
537
|
dsl: i.value,
|
537
|
-
attrs:
|
538
|
+
attrs: l
|
538
539
|
}), f = e.defineComponent({
|
539
540
|
name: i.value.name,
|
540
541
|
props: {
|
541
|
-
...wt(i.value.props ?? [],
|
542
|
+
...wt(i.value.props ?? [], c)
|
542
543
|
},
|
543
544
|
setup(d) {
|
544
|
-
|
545
|
-
|
545
|
+
c.$props = d, c.props = d, i.value.id && ve(
|
546
|
+
s.window || window,
|
546
547
|
i.value.id,
|
547
548
|
i.value.css || ""
|
548
|
-
),
|
549
|
-
const u = jt(e, i.value.computed ?? {},
|
549
|
+
), c.state = St(e, i.value.state ?? {}, c);
|
550
|
+
const u = jt(e, i.value.computed ?? {}, c), h = $t(i.value.methods ?? {}, c), p = bt(e, i.value.inject, c), m = Et(
|
550
551
|
i.value.dataSources || {},
|
551
|
-
|
552
|
+
c
|
552
553
|
), w = {
|
553
554
|
...p,
|
554
555
|
...u,
|
555
|
-
...
|
556
|
-
...
|
556
|
+
...h,
|
557
|
+
...m
|
557
558
|
};
|
558
|
-
return
|
559
|
-
vtj:
|
559
|
+
return c.setup(w, e), Pt(e, i.value.watch ?? [], c), {
|
560
|
+
vtj: c
|
560
561
|
};
|
561
562
|
},
|
562
563
|
emits: _t(i.value.emits),
|
@@ -564,249 +565,249 @@ function J(n) {
|
|
564
565
|
render() {
|
565
566
|
if (!i.value.nodes) return null;
|
566
567
|
const d = i.value.nodes || [];
|
567
|
-
return d.length === 1 ?
|
568
|
+
return d.length === 1 ? M(d[0], c, e, a) : d.map((u) => M(u, c, e, a));
|
568
569
|
},
|
569
|
-
...xt(i.value.lifeCycles ?? {},
|
570
|
+
...xt(i.value.lifeCycles ?? {}, c)
|
570
571
|
});
|
571
572
|
return {
|
572
573
|
renderer: e.markRaw(f),
|
573
|
-
context:
|
574
|
+
context: c
|
574
575
|
};
|
575
576
|
}
|
576
|
-
function _t(
|
577
|
-
return
|
577
|
+
function _t(s = []) {
|
578
|
+
return s.map((e) => j(e) ? e : e.name);
|
578
579
|
}
|
579
|
-
function wt(
|
580
|
-
const t = (
|
581
|
-
return
|
582
|
-
name:
|
580
|
+
function wt(s = [], e) {
|
581
|
+
const t = (n) => n ? (Array.isArray(n) ? n : [n]).map((o) => et[o]) : void 0;
|
582
|
+
return s.map((n) => j(n) ? {
|
583
|
+
name: n
|
583
584
|
} : {
|
584
|
-
name:
|
585
|
-
type:
|
586
|
-
required:
|
587
|
-
default: S(
|
585
|
+
name: n.name,
|
586
|
+
type: n.type,
|
587
|
+
required: n.required,
|
588
|
+
default: S(n.default) ? e.__parseExpression(n.default) : n.default
|
588
589
|
}).reduce(
|
589
|
-
(
|
590
|
+
(n, r) => (n[r.name] = {
|
590
591
|
type: t(r.type),
|
591
592
|
required: r.required,
|
592
593
|
default: r.default
|
593
|
-
},
|
594
|
+
}, n),
|
594
595
|
{}
|
595
596
|
);
|
596
597
|
}
|
597
|
-
function St(
|
598
|
-
return
|
598
|
+
function St(s, e, t) {
|
599
|
+
return s.reactive(
|
599
600
|
Object.keys(e || {}).reduce(
|
600
|
-
(
|
601
|
+
(n, r) => {
|
601
602
|
let o = e[r];
|
602
|
-
return S(o) ? o = t.__parseExpression(o) : H(o) && (o = t.__parseFunction(o)),
|
603
|
+
return S(o) ? o = t.__parseExpression(o) : H(o) && (o = t.__parseFunction(o)), n[r] = o, n;
|
603
604
|
},
|
604
605
|
{}
|
605
606
|
)
|
606
607
|
);
|
607
608
|
}
|
608
|
-
function jt(
|
609
|
+
function jt(s, e, t) {
|
609
610
|
return Object.entries(e ?? {}).reduce(
|
610
|
-
(
|
611
|
+
(n, [r, o]) => (n[r] = s.computed(t.__parseFunction(o)), n),
|
611
612
|
{}
|
612
613
|
);
|
613
614
|
}
|
614
|
-
function $t(
|
615
|
-
return Object.entries(
|
616
|
-
(t, [
|
615
|
+
function $t(s, e) {
|
616
|
+
return Object.entries(s ?? {}).reduce(
|
617
|
+
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
617
618
|
{}
|
618
619
|
);
|
619
620
|
}
|
620
|
-
function bt(
|
621
|
+
function bt(s, e = [], t) {
|
621
622
|
return e.reduce(
|
622
|
-
(
|
623
|
+
(n, r) => {
|
623
624
|
const { name: o, from: a } = r || {};
|
624
625
|
r.default;
|
625
|
-
const i = S(a) ? t.__parseExpression(a) || o : a ?? o,
|
626
|
-
return
|
626
|
+
const i = S(a) ? t.__parseExpression(a) || o : a ?? o, l = S(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
627
|
+
return n[o] = s.inject(i, l), n;
|
627
628
|
},
|
628
629
|
{}
|
629
630
|
);
|
630
631
|
}
|
631
|
-
function Et(
|
632
|
-
return Object.keys(
|
633
|
-
(t,
|
634
|
-
const r = n
|
635
|
-
return t[
|
636
|
-
const
|
637
|
-
return a ? a(
|
632
|
+
function Et(s, e) {
|
633
|
+
return Object.keys(s).reduce(
|
634
|
+
(t, n) => {
|
635
|
+
const r = s[n], o = e.$apis[r.ref], a = H(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
636
|
+
return t[n] = async (...i) => {
|
637
|
+
const l = await o.apply(e, i);
|
638
|
+
return a ? a(l) : l;
|
638
639
|
}, t;
|
639
640
|
},
|
640
641
|
{}
|
641
642
|
);
|
642
643
|
}
|
643
|
-
function Pt(
|
644
|
-
e.forEach((
|
645
|
-
|
646
|
-
t.__parseExpression(
|
647
|
-
t.__parseFunction(
|
644
|
+
function Pt(s, e = [], t) {
|
645
|
+
e.forEach((n) => {
|
646
|
+
s.watch(
|
647
|
+
t.__parseExpression(n.source),
|
648
|
+
t.__parseFunction(n.handler),
|
648
649
|
{
|
649
|
-
deep:
|
650
|
-
immediate:
|
650
|
+
deep: n.deep,
|
651
|
+
immediate: n.immediate
|
651
652
|
}
|
652
653
|
);
|
653
654
|
});
|
654
655
|
}
|
655
|
-
function xt(
|
656
|
-
return Object.entries(
|
657
|
-
(t, [
|
656
|
+
function xt(s, e) {
|
657
|
+
return Object.entries(s ?? {}).reduce(
|
658
|
+
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
658
659
|
{}
|
659
660
|
);
|
660
661
|
}
|
661
662
|
let L = [];
|
662
|
-
const Rt = (
|
663
|
-
async function we(
|
664
|
-
const { urls: t = [], library:
|
665
|
-
if (r.length === 0 || !
|
663
|
+
const Rt = (s) => s;
|
664
|
+
async function we(s, e = window) {
|
665
|
+
const { urls: t = [], library: n } = s, r = t.filter((i) => Y(i));
|
666
|
+
if (r.length === 0 || !n) return null;
|
666
667
|
const o = t.filter((i) => G(i));
|
667
|
-
return o.length && it(o, e), await at(r,
|
668
|
-
(i) => (console.warn("loadScriptUrl error", r,
|
668
|
+
return o.length && it(o, e), await at(r, n, e).catch(
|
669
|
+
(i) => (console.warn("loadScriptUrl error", r, n, i), null)
|
669
670
|
);
|
670
671
|
}
|
671
|
-
function V(
|
672
|
-
const { getDsl: e, getDslByUrl: t, options:
|
673
|
-
return
|
674
|
-
delete
|
675
|
-
}), L = []), (r, o, a =
|
672
|
+
function V(s) {
|
673
|
+
const { getDsl: e, getDslByUrl: t, options: n } = s;
|
674
|
+
return n.window && (L.forEach((r) => {
|
675
|
+
delete n.window[r];
|
676
|
+
}), L = []), (r, o, a = T) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
676
677
|
const i = await e(o.id);
|
677
678
|
return i && (i.name = r), i ? J({
|
678
|
-
...
|
679
|
+
...n,
|
679
680
|
Vue: a,
|
680
681
|
dsl: i,
|
681
682
|
mode: _.Runtime,
|
682
|
-
loader: V(
|
683
|
+
loader: V(s)
|
683
684
|
}).renderer : null;
|
684
685
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
685
686
|
const i = await t(o.url);
|
686
687
|
return i && (i.name = r), i ? J({
|
687
|
-
...
|
688
|
+
...n,
|
688
689
|
Vue: a,
|
689
690
|
dsl: i,
|
690
691
|
mode: _.Runtime,
|
691
|
-
loader: V(
|
692
|
+
loader: V(s)
|
692
693
|
}).renderer : null;
|
693
694
|
}) : o.type === "Plugin" ? (o.library && L.push(o.library), a.defineAsyncComponent(async () => {
|
694
|
-
const i = await we(o,
|
695
|
+
const i = await we(o, n.window);
|
695
696
|
return i || (console.warn("getPlugin result is null", o), null);
|
696
697
|
})) : r;
|
697
698
|
}
|
698
|
-
function
|
699
|
-
if (!
|
700
|
-
const { id: r = null, directives: o = [] } =
|
699
|
+
function M(s, e, t = T, n = Rt) {
|
700
|
+
if (!s || !s.name || s.invisible) return null;
|
701
|
+
const { id: r = null, directives: o = [] } = s, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: f } = kt(o);
|
701
702
|
if (a && !Ct(a, e))
|
702
703
|
return null;
|
703
704
|
const d = (u) => {
|
704
|
-
const
|
705
|
-
if (
|
706
|
-
return Ft(u,
|
707
|
-
if (
|
708
|
-
const v = s
|
709
|
-
return j(v) ?
|
710
|
-
})(),
|
711
|
-
if (
|
712
|
-
return Ot(t,
|
713
|
-
f && Object.assign(
|
714
|
-
|
715
|
-
|
716
|
-
)),
|
717
|
-
Object.assign(
|
705
|
+
const h = u.$components, p = (() => {
|
706
|
+
if (s.name === "component")
|
707
|
+
return Ft(u, s.props?.is);
|
708
|
+
if (s.name === "slot") return s.name;
|
709
|
+
const v = n(s.name, s.from, t);
|
710
|
+
return j(v) ? h[v] ?? v : v;
|
711
|
+
})(), m = At(r, s.props ?? {}, u), w = It(t, s.events ?? {}, u);
|
712
|
+
if (s.name === "slot")
|
713
|
+
return Ot(t, s, m, u, n);
|
714
|
+
f && Object.assign(m, u.__parseExpression(f.value)), l && (m.style = Object.assign(
|
715
|
+
m.style ?? {},
|
716
|
+
Tt(l, u)
|
717
|
+
)), c.forEach((v) => {
|
718
|
+
Object.assign(m, Dt(t, v, u));
|
718
719
|
});
|
719
720
|
const g = Ht(
|
720
721
|
t,
|
721
|
-
|
722
|
+
s.children ?? [],
|
722
723
|
u,
|
723
|
-
|
724
|
-
|
724
|
+
n,
|
725
|
+
s
|
725
726
|
);
|
726
|
-
return t.createVNode(p, { ...
|
727
|
+
return t.createVNode(p, { ...m, ...w }, g);
|
727
728
|
};
|
728
729
|
return i ? Nt(i, d, e) : d(e);
|
729
730
|
}
|
730
|
-
function kt(
|
731
|
-
const e =
|
731
|
+
function kt(s = []) {
|
732
|
+
const e = s.find((i) => $(i.name) === "vIf"), t = s.find((i) => $(i.name) === "vFor"), n = s.find((i) => $(i.name) === "vShow"), r = s.find((i) => $(i.name) === "vBind"), o = s.filter((i) => $(i.name) === "vModel"), a = s.filter(
|
732
733
|
(i) => !Ze.includes($(i.name))
|
733
734
|
);
|
734
735
|
return {
|
735
736
|
vIf: e,
|
736
737
|
vFor: t,
|
737
|
-
vShow:
|
738
|
+
vShow: n,
|
738
739
|
vModels: o,
|
739
740
|
vBind: r,
|
740
741
|
others: a
|
741
742
|
};
|
742
743
|
}
|
743
|
-
function Ct(
|
744
|
-
return !!e.__parseExpression(
|
744
|
+
function Ct(s, e) {
|
745
|
+
return !!e.__parseExpression(s.value);
|
745
746
|
}
|
746
|
-
function Ft(
|
747
|
-
return e ? S(e) ?
|
747
|
+
function Ft(s, e) {
|
748
|
+
return e ? S(e) ? s.__parseExpression(e) : e : "div";
|
748
749
|
}
|
749
|
-
function At(
|
750
|
-
const
|
750
|
+
function At(s, e, t) {
|
751
|
+
const n = Object.keys(e || {}).reduce(
|
751
752
|
(r, o) => {
|
752
753
|
let a = e[o];
|
753
754
|
return S(a) ? a = t.__parseExpression(a) : H(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
754
755
|
},
|
755
756
|
{}
|
756
757
|
);
|
757
|
-
return
|
758
|
+
return n.ref = t.__ref(s, n.ref), n;
|
758
759
|
}
|
759
|
-
function It(
|
760
|
-
const
|
760
|
+
function It(s, e, t) {
|
761
|
+
const n = ["passive", "capture", "once"], r = {
|
761
762
|
capture: "Capture",
|
762
763
|
once: "Once",
|
763
764
|
passive: "OnceCapture"
|
764
765
|
};
|
765
766
|
return Object.keys(e || {}).reduce(
|
766
767
|
(o, a) => {
|
767
|
-
const i = e[a],
|
768
|
-
return d && (o[f] =
|
768
|
+
const i = e[a], l = Se(i.modifiers), c = l.find((u) => n.includes(u)), f = "on" + Te(a) + (c && r[c] || ""), d = t.__parseFunction(i.handler);
|
769
|
+
return d && (o[f] = s.withModifiers(d, l)), o;
|
769
770
|
},
|
770
771
|
{}
|
771
772
|
);
|
772
773
|
}
|
773
|
-
function Se(
|
774
|
-
const t = Object.keys(
|
775
|
-
return e ? t.map((
|
774
|
+
function Se(s = {}, e = !1) {
|
775
|
+
const t = Object.keys(s);
|
776
|
+
return e ? t.map((n) => "." + n) : t;
|
776
777
|
}
|
777
|
-
function Ot(
|
778
|
-
const { children: o } = e, a =
|
779
|
-
return i ? i(t) : o ? j(o) ?
|
780
|
-
ge(
|
778
|
+
function Ot(s, e, t, n, r) {
|
779
|
+
const { children: o } = e, a = Mt(e, n), i = n.$slots?.[a.name];
|
780
|
+
return i ? i(t) : o ? j(o) ? s.createTextVNode(o) : S(o) ? s.createTextVNode(
|
781
|
+
ge(n.__parseExpression(o))
|
781
782
|
) : Array.isArray(o) ? o.map(
|
782
|
-
(
|
783
|
+
(l) => M(l, n, s, r)
|
783
784
|
) : null : null;
|
784
785
|
}
|
785
|
-
function
|
786
|
-
const { props: t } =
|
786
|
+
function Mt(s, e) {
|
787
|
+
const { props: t } = s, n = t?.name || "default";
|
787
788
|
return {
|
788
|
-
name: S(
|
789
|
+
name: S(n) ? e.__parseExpression(n) : n,
|
789
790
|
params: []
|
790
791
|
};
|
791
792
|
}
|
792
|
-
function
|
793
|
-
return e.__parseExpression(
|
793
|
+
function Tt(s, e) {
|
794
|
+
return e.__parseExpression(s.value) ? {} : {
|
794
795
|
display: "none"
|
795
796
|
};
|
796
797
|
}
|
797
|
-
function
|
798
|
-
const
|
798
|
+
function Dt(s, e, t) {
|
799
|
+
const n = {
|
799
800
|
type: "JSFunction",
|
800
801
|
value: e.value?.value ? `(v) => {
|
801
802
|
${e.value.value} = v;
|
802
803
|
}` : "(v) => {}"
|
803
|
-
}, r = t.__parseFunction(
|
804
|
+
}, r = t.__parseFunction(n), o = Se(e.modifiers), a = S(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
804
805
|
return {
|
805
806
|
[a]: t.__parseExpression(e.value),
|
806
|
-
[`onUpdate:${a}`]: o.length && r ?
|
807
|
+
[`onUpdate:${a}`]: o.length && r ? s.withModifiers(r, o) : r
|
807
808
|
};
|
808
809
|
}
|
809
|
-
function Ht(
|
810
|
+
function Ht(s, e, t, n, r) {
|
810
811
|
if (!e) return null;
|
811
812
|
if (j(e))
|
812
813
|
return { default: () => e };
|
@@ -818,93 +819,93 @@ function Ht(n, e, t, s, r) {
|
|
818
819
|
const o = Bt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
819
820
|
[`scope_${r.id}`]: i
|
820
821
|
} : {};
|
821
|
-
return Object.entries(o).reduce((i, [
|
822
|
-
const u = f.length ?
|
823
|
-
return
|
824
|
-
(
|
822
|
+
return Object.entries(o).reduce((i, [l, { nodes: c, params: f }]) => (i[l] = (d) => {
|
823
|
+
const u = f.length ? De(d ?? {}, f) : a(d);
|
824
|
+
return c.map(
|
825
|
+
(h) => M(h, t.__clone(u), s, n)
|
825
826
|
);
|
826
827
|
}, i), {});
|
827
828
|
}
|
828
829
|
return null;
|
829
830
|
}
|
830
|
-
function Bt(
|
831
|
+
function Bt(s) {
|
831
832
|
const e = {
|
832
833
|
default: {
|
833
834
|
params: [],
|
834
835
|
nodes: []
|
835
836
|
}
|
836
837
|
};
|
837
|
-
for (const t of
|
838
|
-
const
|
839
|
-
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(
|
838
|
+
for (const t of s) {
|
839
|
+
const n = Ut(t.slot), r = n.name;
|
840
|
+
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(n.params)) : e[r] = {
|
840
841
|
nodes: [t],
|
841
|
-
params:
|
842
|
+
params: n.params
|
842
843
|
};
|
843
844
|
}
|
844
845
|
return e;
|
845
846
|
}
|
846
|
-
function Ut(
|
847
|
-
return j(
|
847
|
+
function Ut(s = "default") {
|
848
|
+
return j(s) ? { name: s, params: [] } : { params: [], ...s };
|
848
849
|
}
|
849
|
-
function Nt(
|
850
|
-
const { value:
|
851
|
-
let i = t.__parseExpression(
|
852
|
-
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((
|
850
|
+
function Nt(s, e, t) {
|
851
|
+
const { value: n, iterator: r } = s, { item: o = "item", index: a = "index" } = r || {};
|
852
|
+
let i = t.__parseExpression(n) || [];
|
853
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${n?.value} is not a Arrary`), []);
|
853
854
|
}
|
854
|
-
function Lt(
|
855
|
-
return
|
855
|
+
function Lt(s) {
|
856
|
+
return Ve() ? (ze(s), !0) : !1;
|
856
857
|
}
|
857
|
-
function Q(
|
858
|
-
return typeof
|
858
|
+
function Q(s) {
|
859
|
+
return typeof s == "function" ? s() : Ke(s);
|
859
860
|
}
|
860
861
|
const je = typeof window < "u" && typeof document < "u";
|
861
862
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
862
|
-
const qt = (
|
863
|
+
const qt = (s) => s != null, Jt = () => {
|
863
864
|
};
|
864
|
-
function Vt(
|
865
|
+
function Vt(s) {
|
865
866
|
return de();
|
866
867
|
}
|
867
|
-
function zt(...
|
868
|
-
if (
|
869
|
-
return Ne(...
|
870
|
-
const e =
|
868
|
+
function zt(...s) {
|
869
|
+
if (s.length !== 1)
|
870
|
+
return Ne(...s);
|
871
|
+
const e = s[0];
|
871
872
|
return typeof e == "function" ? Le(qe(() => ({ get: e, set: Jt }))) : O(e);
|
872
873
|
}
|
873
|
-
function Kt(
|
874
|
-
Vt() &&
|
874
|
+
function Kt(s, e) {
|
875
|
+
Vt() && Je(s, e);
|
875
876
|
}
|
876
877
|
const Wt = je ? window : void 0, Gt = je ? window.document : void 0;
|
877
|
-
function Yt(
|
878
|
+
function Yt(s) {
|
878
879
|
var e;
|
879
|
-
const t = Q(
|
880
|
+
const t = Q(s);
|
880
881
|
return (e = t?.$el) != null ? e : t;
|
881
882
|
}
|
882
883
|
function Qt() {
|
883
|
-
const
|
884
|
+
const s = O(!1), e = de();
|
884
885
|
return e && We(() => {
|
885
|
-
|
886
|
-
}, e),
|
886
|
+
s.value = !0;
|
887
|
+
}, e), s;
|
887
888
|
}
|
888
|
-
function Xt(
|
889
|
+
function Xt(s) {
|
889
890
|
const e = Qt();
|
890
|
-
return fe(() => (e.value, !!
|
891
|
+
return fe(() => (e.value, !!s()));
|
891
892
|
}
|
892
|
-
function Zt(
|
893
|
-
const { window:
|
893
|
+
function Zt(s, e, t = {}) {
|
894
|
+
const { window: n = Wt, ...r } = t;
|
894
895
|
let o;
|
895
|
-
const a = Xt(() =>
|
896
|
+
const a = Xt(() => n && "MutationObserver" in n), i = () => {
|
896
897
|
o && (o.disconnect(), o = void 0);
|
897
|
-
},
|
898
|
-
const u = Q(
|
899
|
-
return new Set(
|
900
|
-
}),
|
901
|
-
() =>
|
898
|
+
}, l = fe(() => {
|
899
|
+
const u = Q(s), h = (Array.isArray(u) ? u : [u]).map(Yt).filter(qt);
|
900
|
+
return new Set(h);
|
901
|
+
}), c = pe(
|
902
|
+
() => l.value,
|
902
903
|
(u) => {
|
903
|
-
i(), a.value && u.size && (o = new MutationObserver(e), u.forEach((
|
904
|
+
i(), a.value && u.size && (o = new MutationObserver(e), u.forEach((h) => o.observe(h, r)));
|
904
905
|
},
|
905
906
|
{ immediate: !0, flush: "post" }
|
906
907
|
), f = () => o?.takeRecords(), d = () => {
|
907
|
-
|
908
|
+
c(), i();
|
908
909
|
};
|
909
910
|
return Lt(d), {
|
910
911
|
isSupported: a,
|
@@ -912,12 +913,12 @@ function Zt(n, e, t = {}) {
|
|
912
913
|
takeRecords: f
|
913
914
|
};
|
914
915
|
}
|
915
|
-
function
|
916
|
-
var t,
|
916
|
+
function en(s = null, e = {}) {
|
917
|
+
var t, n, r;
|
917
918
|
const {
|
918
919
|
document: o = Gt,
|
919
920
|
restoreOnUnmount: a = (d) => d
|
920
|
-
} = e, i = (t = o?.title) != null ? t : "",
|
921
|
+
} = e, i = (t = o?.title) != null ? t : "", l = zt((n = s ?? o?.title) != null ? n : null), c = s && typeof s == "function";
|
921
922
|
function f(d) {
|
922
923
|
if (!("titleTemplate" in e))
|
923
924
|
return d;
|
@@ -925,63 +926,63 @@ function es(n = null, e = {}) {
|
|
925
926
|
return typeof u == "function" ? u(d) : Q(u).replace(/%s/g, d);
|
926
927
|
}
|
927
928
|
return pe(
|
928
|
-
|
929
|
+
l,
|
929
930
|
(d, u) => {
|
930
931
|
d !== u && o && (o.title = f(typeof d == "string" ? d : ""));
|
931
932
|
},
|
932
933
|
{ immediate: !0 }
|
933
|
-
), e.observe && !e.titleTemplate && o && !
|
934
|
+
), e.observe && !e.titleTemplate && o && !c && Zt(
|
934
935
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
935
936
|
() => {
|
936
|
-
o && o.title !==
|
937
|
+
o && o.title !== l.value && (l.value = f(o.title));
|
937
938
|
},
|
938
939
|
{ childList: !0 }
|
939
940
|
), Kt(() => {
|
940
941
|
if (a) {
|
941
|
-
const d = a(i,
|
942
|
+
const d = a(i, l.value || "");
|
942
943
|
d != null && o && (o.title = d);
|
943
944
|
}
|
944
|
-
}),
|
945
|
+
}), l;
|
945
946
|
}
|
946
947
|
const ae = K({
|
947
948
|
name: "VtjPageContainer",
|
948
949
|
async setup() {
|
949
|
-
const
|
950
|
-
return
|
951
|
-
provider:
|
950
|
+
const s = be(), e = he(), t = e.params.id, n = t ? s.getPage(t) : s.getHomepage(), r = n ? await s.getRenderComponent(n.id) : null;
|
951
|
+
return n && (Object.assign(e.meta, n.meta || {}), en(n.title || "VTJ")), {
|
952
|
+
provider: s,
|
952
953
|
component: r,
|
953
|
-
file:
|
954
|
+
file: n,
|
954
955
|
query: e.query,
|
955
|
-
meta:
|
956
|
+
meta: n?.meta
|
956
957
|
};
|
957
958
|
},
|
958
959
|
render() {
|
959
|
-
const { component:
|
960
|
-
return
|
960
|
+
const { component: s, query: e } = this;
|
961
|
+
return s ? q(s, e) : q("div", "页面不存在");
|
961
962
|
}
|
962
|
-
}),
|
963
|
+
}), tn = {
|
963
964
|
"data-l-h6o7ki7": "",
|
964
965
|
class: "vtj-startup__wrapper"
|
965
|
-
},
|
966
|
+
}, nn = {
|
966
967
|
"data-l-h6o7ki7": "",
|
967
968
|
class: "vtj-startup"
|
968
|
-
},
|
969
|
+
}, sn = {
|
969
970
|
"data-l-h6o7ki7": "",
|
970
971
|
class: "vtj-startup__name"
|
971
|
-
},
|
972
|
+
}, rn = { "data-l-h6o7ki7": "" }, on = {
|
972
973
|
"data-l-h6o7ki7": "",
|
973
974
|
class: "vtj-startup__tagline"
|
974
|
-
},
|
975
|
+
}, an = {
|
975
976
|
"data-l-h6o7ki7": "",
|
976
977
|
class: "vtj-startup__actions"
|
977
|
-
},
|
978
|
+
}, cn = /* @__PURE__ */ K({
|
978
979
|
__name: "Startup",
|
979
980
|
props: {
|
980
981
|
name: { default: "VTJ.PRO" },
|
981
982
|
tagline: { default: "基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台" },
|
982
983
|
actionText: { default: "开始设计" }
|
983
984
|
},
|
984
|
-
setup(
|
985
|
+
setup(s) {
|
985
986
|
((r, o) => {
|
986
987
|
let a = document.getElementById("h6o7ki7");
|
987
988
|
a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML = o);
|
@@ -1051,54 +1052,54 @@ const ae = K({
|
|
1051
1052
|
.vtj-startup__actions button[data-l-h6o7ki7]:hover{
|
1052
1053
|
opacity: 0.7;
|
1053
1054
|
}`);
|
1054
|
-
const t =
|
1055
|
+
const t = s, n = () => {
|
1055
1056
|
if (typeof window < "u") {
|
1056
1057
|
let o = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "__vtj__/#/";
|
1057
1058
|
window.location.href = o;
|
1058
1059
|
}
|
1059
1060
|
};
|
1060
|
-
return (r, o) => (Ge(), Ye("div",
|
1061
|
-
b("div",
|
1062
|
-
b("h1",
|
1063
|
-
b("span",
|
1061
|
+
return (r, o) => (Ge(), Ye("div", tn, [
|
1062
|
+
b("div", nn, [
|
1063
|
+
b("h1", sn, [
|
1064
|
+
b("span", rn, N(t.name), 1)
|
1064
1065
|
]),
|
1065
|
-
b("div",
|
1066
|
-
b("div",
|
1066
|
+
b("div", on, N(t.tagline), 1),
|
1067
|
+
b("div", an, [
|
1067
1068
|
b("button", {
|
1068
1069
|
"data-l-h6o7ki7": "",
|
1069
|
-
onClick:
|
1070
|
+
onClick: n
|
1070
1071
|
}, N(t.actionText), 1)
|
1071
1072
|
])
|
1072
1073
|
])
|
1073
1074
|
]));
|
1074
1075
|
}
|
1075
|
-
}),
|
1076
|
+
}), ln = K({
|
1076
1077
|
name: "VtjStartupContainer",
|
1077
1078
|
render() {
|
1078
|
-
return q(
|
1079
|
+
return q(cn);
|
1079
1080
|
}
|
1080
1081
|
}), $e = Symbol("Provider");
|
1081
|
-
var
|
1082
|
-
class
|
1082
|
+
var un = /* @__PURE__ */ ((s) => (s.Production = "production", s.Development = "development", s))(un || {});
|
1083
|
+
class dn extends xe {
|
1083
1084
|
constructor(e) {
|
1084
1085
|
super(), this.options = e;
|
1085
1086
|
const {
|
1086
1087
|
service: t,
|
1087
|
-
mode:
|
1088
|
+
mode: n = _.Raw,
|
1088
1089
|
dependencies: r,
|
1089
1090
|
materials: o,
|
1090
1091
|
project: a = {},
|
1091
1092
|
adapter: i = {},
|
1092
|
-
globals:
|
1093
|
-
modules:
|
1093
|
+
globals: l = {},
|
1094
|
+
modules: c = {},
|
1094
1095
|
router: f = null,
|
1095
1096
|
materialPath: d = "./",
|
1096
1097
|
nodeEnv: u = "development"
|
1097
1098
|
/* Development */
|
1098
1099
|
} = e;
|
1099
|
-
this.mode =
|
1100
|
-
const { access:
|
1101
|
-
|
1100
|
+
this.mode = n, this.modules = c, this.service = t, this.router = f, this.materialPath = d, this.nodeEnv = u, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i);
|
1101
|
+
const { access: h, request: p } = this.adapter;
|
1102
|
+
h && h.connect({ mode: n, router: f, request: p }), n !== _.Design && this.load(a);
|
1102
1103
|
}
|
1103
1104
|
mode;
|
1104
1105
|
globals = {};
|
@@ -1119,109 +1120,109 @@ class us extends xe {
|
|
1119
1120
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1120
1121
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1121
1122
|
throw new Error("project is null");
|
1122
|
-
const { apis:
|
1123
|
-
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" ? await this.loadAssets(o) : await this.loadDependencies(o), this.apis = ft(
|
1123
|
+
const { apis: n = [], meta: r = [] } = this.project, o = window;
|
1124
|
+
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" ? await this.loadAssets(o) : await this.loadDependencies(o), this.apis = ft(n, r, this.adapter), ye(), this.project.config?.mock && ht(n), this.initRouter(), this.triggerReady();
|
1124
1125
|
}
|
1125
1126
|
async loadDependencies(e) {
|
1126
1127
|
const t = Object.entries(this.dependencies);
|
1127
|
-
for (const [
|
1128
|
-
e[
|
1128
|
+
for (const [n, r] of t)
|
1129
|
+
e[n] || (e[n] = await r());
|
1129
1130
|
}
|
1130
1131
|
async loadAssets(e) {
|
1131
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
1132
|
-
libraryExports:
|
1133
|
-
libraryMap:
|
1132
|
+
const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1133
|
+
libraryExports: l,
|
1134
|
+
libraryMap: c,
|
1134
1135
|
materials: f,
|
1135
1136
|
materialExports: d,
|
1136
1137
|
materialMapLibrary: u
|
1137
|
-
} =
|
1138
|
+
} = st(
|
1138
1139
|
t,
|
1139
1140
|
a,
|
1140
1141
|
i === "development"
|
1141
1142
|
/* Development */
|
1142
1143
|
);
|
1143
|
-
for (const p of
|
1144
|
-
const
|
1144
|
+
for (const p of l) {
|
1145
|
+
const m = n[p], w = e[p];
|
1145
1146
|
if (w)
|
1146
1147
|
r[p] = w;
|
1147
|
-
else if (
|
1148
|
-
e[p] = r[p] = await
|
1148
|
+
else if (m)
|
1149
|
+
e[p] = r[p] = await m();
|
1149
1150
|
else {
|
1150
|
-
const g =
|
1151
|
+
const g = c[p] || [];
|
1151
1152
|
for (const v of g)
|
1152
|
-
G(v) && await ot(p, x.append(v, { v: R })), Y(v) && await
|
1153
|
+
G(v) && await ot(p, x.append(v, { v: R })), Y(v) && await se(x.append(v, { v: R }));
|
1153
1154
|
r[p] = e[p];
|
1154
1155
|
}
|
1155
1156
|
}
|
1156
1157
|
for (const p of f)
|
1157
|
-
await
|
1158
|
-
const
|
1158
|
+
await se(x.append(p, { v: R }));
|
1159
|
+
const h = this.materials || {};
|
1159
1160
|
for (const p of d) {
|
1160
|
-
const
|
1161
|
+
const m = e[u[p]], w = Re[p];
|
1161
1162
|
if (w)
|
1162
|
-
|
1163
|
-
o[g] =
|
1163
|
+
m && w.forEach((g) => {
|
1164
|
+
o[g] = m[g];
|
1164
1165
|
});
|
1165
1166
|
else {
|
1166
|
-
const g =
|
1167
|
-
g &&
|
1168
|
-
o[v.name] = rt(v,
|
1167
|
+
const g = h[p] ? (await h[p]()).default : e[p];
|
1168
|
+
g && m && (g.components || []).forEach((v) => {
|
1169
|
+
o[v.name] = rt(v, m);
|
1169
1170
|
});
|
1170
1171
|
}
|
1171
1172
|
}
|
1172
1173
|
}
|
1173
1174
|
initRouter() {
|
1174
|
-
const { router: e, project: t, options:
|
1175
|
+
const { router: e, project: t, options: n } = this;
|
1175
1176
|
if (!e) return;
|
1176
|
-
const { routeParentName: r, pageRouteName: o = "page", routeMeta: a } =
|
1177
|
+
const { routeParentName: r, pageRouteName: o = "page", routeMeta: a } = n, i = {
|
1177
1178
|
path: `/${o}/:id`,
|
1178
1179
|
name: W,
|
1179
1180
|
component: ae
|
1180
|
-
},
|
1181
|
+
}, l = {
|
1181
1182
|
path: "/",
|
1182
1183
|
name: me,
|
1183
|
-
component: t?.homepage ? ae :
|
1184
|
+
component: t?.homepage ? ae : ln,
|
1184
1185
|
meta: a
|
1185
1186
|
};
|
1186
|
-
r ? (e.addRoute(r, i), e.addRoute(r,
|
1187
|
+
r ? (e.addRoute(r, i), e.addRoute(r, l)) : (e.addRoute(i), e.addRoute(l));
|
1187
1188
|
}
|
1188
1189
|
install(e) {
|
1189
1190
|
const t = e.config.globalProperties.installed || {};
|
1190
|
-
for (const [
|
1191
|
-
!t[
|
1192
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide($e, this), e.config.globalProperties.installed = t, this.mode === _.Design && (e.config.errorHandler = (
|
1193
|
-
const a = r?.$options.name, i = typeof
|
1191
|
+
for (const [n, r] of Object.entries(this.library))
|
1192
|
+
!t[n] && ct(r) && (e.use(r), t[n] = !0);
|
1193
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide($e, this), e.config.globalProperties.installed = t, this.mode === _.Design && (e.config.errorHandler = (n, r, o) => {
|
1194
|
+
const a = r?.$options.name, i = typeof n == "string" ? n : n?.message || n?.msg || "未知错误", l = `[ ${a} ] ${i} ${o}`;
|
1194
1195
|
console.error(
|
1195
1196
|
"[VTJ Error]:",
|
1196
1197
|
{
|
1197
|
-
err:
|
1198
|
+
err: n,
|
1198
1199
|
instance: r,
|
1199
1200
|
info: o
|
1200
1201
|
},
|
1201
|
-
|
1202
|
-
),
|
1202
|
+
n?.stack
|
1203
|
+
), D.error({
|
1203
1204
|
title: "未处理的异常:请在控制台查看详情",
|
1204
|
-
message:
|
1205
|
+
message: l
|
1205
1206
|
});
|
1206
1207
|
});
|
1207
1208
|
}
|
1208
1209
|
getFile(e) {
|
1209
1210
|
const { blocks: t = [] } = this.project || {};
|
1210
|
-
return this.getPage(e) || t.find((
|
1211
|
+
return this.getPage(e) || t.find((n) => n.id === e) || null;
|
1211
1212
|
}
|
1212
1213
|
getPage(e) {
|
1213
|
-
const { pages: t = [] } = this.project || {},
|
1214
|
+
const { pages: t = [] } = this.project || {}, n = (r, o = []) => {
|
1214
1215
|
for (const a of o) {
|
1215
1216
|
if (a.id === r)
|
1216
1217
|
return a;
|
1217
1218
|
if (a.children && a.children.length) {
|
1218
|
-
const i =
|
1219
|
+
const i = n(r, a.children);
|
1219
1220
|
if (i)
|
1220
1221
|
return i;
|
1221
1222
|
}
|
1222
1223
|
}
|
1223
1224
|
};
|
1224
|
-
return
|
1225
|
+
return n(e, t) || null;
|
1225
1226
|
}
|
1226
1227
|
getHomepage() {
|
1227
1228
|
const { homepage: e } = this.project || {};
|
@@ -1240,65 +1241,65 @@ class us extends xe {
|
|
1240
1241
|
validSuccess: !1,
|
1241
1242
|
originResponse: !0
|
1242
1243
|
}
|
1243
|
-
}).then((
|
1244
|
+
}).then((n) => n.data).catch(() => null));
|
1244
1245
|
}
|
1245
1246
|
createDslRenderer(e, t = {}) {
|
1246
|
-
const { library:
|
1247
|
+
const { library: n, components: r, mode: o, apis: a } = this, i = {
|
1247
1248
|
mode: o,
|
1248
|
-
Vue:
|
1249
|
+
Vue: n.Vue,
|
1249
1250
|
components: r,
|
1250
|
-
libs:
|
1251
|
+
libs: n,
|
1251
1252
|
apis: a,
|
1252
1253
|
window,
|
1253
1254
|
...t
|
1254
|
-
},
|
1255
|
-
getDsl: async (
|
1256
|
-
getDslByUrl: async (
|
1255
|
+
}, l = V({
|
1256
|
+
getDsl: async (c) => await this.getDsl(c) || null,
|
1257
|
+
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1257
1258
|
options: i
|
1258
1259
|
});
|
1259
1260
|
return J({
|
1260
1261
|
...i,
|
1261
1262
|
dsl: e,
|
1262
|
-
loader:
|
1263
|
+
loader: l
|
1263
1264
|
});
|
1264
1265
|
}
|
1265
1266
|
async getRenderComponent(e, t) {
|
1266
|
-
const
|
1267
|
-
if (!
|
1267
|
+
const n = this.getFile(e);
|
1268
|
+
if (!n)
|
1268
1269
|
return I.warn(`Can not find file: ${e}`), null;
|
1269
|
-
t && t(
|
1270
|
+
t && t(n);
|
1270
1271
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1271
1272
|
if (o)
|
1272
1273
|
return (await o())?.default;
|
1273
|
-
const a = await this.getDsl(
|
1274
|
+
const a = await this.getDsl(n.id);
|
1274
1275
|
return a ? this.createDslRenderer(a).renderer : (I.warn(`Can not find dsl: ${e}`), null);
|
1275
1276
|
}
|
1276
1277
|
defineUrlSchemaComponent(e, t) {
|
1277
1278
|
return re(async () => {
|
1278
|
-
const
|
1279
|
-
return
|
1279
|
+
const n = await this.getDslByUrl(e);
|
1280
|
+
return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
|
1280
1281
|
});
|
1281
1282
|
}
|
1282
1283
|
definePluginComponent(e) {
|
1283
1284
|
return re(async () => await we(e, window));
|
1284
1285
|
}
|
1285
1286
|
}
|
1286
|
-
function
|
1287
|
-
const e = new
|
1287
|
+
function En(s) {
|
1288
|
+
const e = new dn(s);
|
1288
1289
|
return {
|
1289
1290
|
provider: e,
|
1290
|
-
onReady: (
|
1291
|
+
onReady: (n) => e.ready(n)
|
1291
1292
|
};
|
1292
1293
|
}
|
1293
|
-
function be(
|
1294
|
+
function be(s = {}) {
|
1294
1295
|
const e = ue($e);
|
1295
1296
|
if (!e)
|
1296
1297
|
throw new Error("Can not find provider");
|
1297
1298
|
if (e.nodeEnv === "development") {
|
1298
|
-
const { id: t, version:
|
1299
|
-
t &&
|
1299
|
+
const { id: t, version: n } = s;
|
1300
|
+
t && n && (async () => {
|
1300
1301
|
const r = await e.getDsl(t);
|
1301
|
-
r?.__VERSION__ !==
|
1302
|
+
r?.__VERSION__ !== n && D.warning({
|
1302
1303
|
title: r?.name,
|
1303
1304
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
1304
1305
|
});
|
@@ -1312,23 +1313,23 @@ const X = new Be({
|
|
1312
1313
|
validSuccess: !0,
|
1313
1314
|
originResponse: !1,
|
1314
1315
|
failMessage: !0,
|
1315
|
-
validate: (
|
1316
|
-
showError: (
|
1317
|
-
|
1318
|
-
message:
|
1316
|
+
validate: (s) => s.data?.code === 0,
|
1317
|
+
showError: (s) => {
|
1318
|
+
D.error({
|
1319
|
+
message: s || "未知错误"
|
1319
1320
|
});
|
1320
1321
|
}
|
1321
1322
|
}
|
1322
|
-
}),
|
1323
|
-
url:
|
1323
|
+
}), pn = (s = "/__vtj__/api/:type.json") => (e, t) => X.send({
|
1324
|
+
url: s,
|
1324
1325
|
method: "post",
|
1325
1326
|
params: { type: e },
|
1326
1327
|
data: {
|
1327
1328
|
type: e,
|
1328
1329
|
data: t
|
1329
1330
|
}
|
1330
|
-
}),
|
1331
|
-
url:
|
1331
|
+
}), fn = (s = "/__vtj__/api/uploader.json") => async (e, t) => await X.send({
|
1332
|
+
url: s,
|
1332
1333
|
method: "post",
|
1333
1334
|
data: {
|
1334
1335
|
files: e,
|
@@ -1337,13 +1338,13 @@ const X = new Be({
|
|
1337
1338
|
settings: {
|
1338
1339
|
type: "data"
|
1339
1340
|
}
|
1340
|
-
}).then((
|
1341
|
+
}).then((n) => n && n[0] ? n[0] : null).catch(() => null);
|
1341
1342
|
class Z {
|
1342
1343
|
api;
|
1343
1344
|
pluginCaches = {};
|
1344
1345
|
uploader;
|
1345
1346
|
constructor() {
|
1346
|
-
this.api =
|
1347
|
+
this.api = pn(), this.uploader = fn();
|
1347
1348
|
}
|
1348
1349
|
async getExtension() {
|
1349
1350
|
console.log("BaseService.getExtension");
|
@@ -1416,11 +1417,11 @@ class Z {
|
|
1416
1417
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1417
1418
|
}
|
1418
1419
|
async getPluginMaterial(e) {
|
1419
|
-
const { urls: t = [] } = e,
|
1420
|
-
if (!
|
1421
|
-
const r = this.pluginCaches[
|
1422
|
-
return r || (this.pluginCaches[
|
1423
|
-
url:
|
1420
|
+
const { urls: t = [] } = e, n = t.filter((o) => tt(o))[0];
|
1421
|
+
if (!n) return null;
|
1422
|
+
const r = this.pluginCaches[n];
|
1423
|
+
return r || (this.pluginCaches[n] = X.send({
|
1424
|
+
url: n,
|
1424
1425
|
method: "get",
|
1425
1426
|
settings: {
|
1426
1427
|
validSuccess: !1,
|
@@ -1434,9 +1435,9 @@ const y = new Ue({
|
|
1434
1435
|
expired: 0,
|
1435
1436
|
prefix: "__VTJ_"
|
1436
1437
|
});
|
1437
|
-
class
|
1438
|
+
class Pn extends Z {
|
1438
1439
|
init(e) {
|
1439
|
-
const t = new A(e),
|
1440
|
+
const t = new A(e), n = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), n || {});
|
1440
1441
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
1441
1442
|
}
|
1442
1443
|
saveProject(e) {
|
@@ -1468,30 +1469,30 @@ class Es extends Z {
|
|
1468
1469
|
return Promise.resolve(!0);
|
1469
1470
|
}
|
1470
1471
|
getHistory(e) {
|
1471
|
-
const t = y.get(`history_${e}`),
|
1472
|
-
return Promise.resolve(
|
1472
|
+
const t = y.get(`history_${e}`), n = new ce(t || { id: e });
|
1473
|
+
return Promise.resolve(n.toDsl());
|
1473
1474
|
}
|
1474
1475
|
getHistoryItem(e, t) {
|
1475
|
-
const
|
1476
|
-
return Promise.resolve(
|
1476
|
+
const n = y.get(`history_${e}_${t}`);
|
1477
|
+
return Promise.resolve(n);
|
1477
1478
|
}
|
1478
1479
|
saveHistoryItem(e, t) {
|
1479
1480
|
return y.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1480
1481
|
}
|
1481
1482
|
removeHistoryItem(e, t) {
|
1482
|
-
return t.forEach((
|
1483
|
-
y.remove(`history_${e}_${
|
1483
|
+
return t.forEach((n) => {
|
1484
|
+
y.remove(`history_${e}_${n}`);
|
1484
1485
|
}), Promise.resolve(!0);
|
1485
1486
|
}
|
1486
1487
|
}
|
1487
|
-
class
|
1488
|
+
class hn extends Z {
|
1488
1489
|
projects = {};
|
1489
1490
|
materials = {};
|
1490
1491
|
files = {};
|
1491
1492
|
histories = {};
|
1492
1493
|
historyItems = {};
|
1493
1494
|
init(e) {
|
1494
|
-
const t = new A(e),
|
1495
|
+
const t = new A(e), n = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), n);
|
1495
1496
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1496
1497
|
}
|
1497
1498
|
saveProject(e) {
|
@@ -1523,29 +1524,29 @@ class fs extends Z {
|
|
1523
1524
|
return Promise.resolve(!0);
|
1524
1525
|
}
|
1525
1526
|
getHistory(e) {
|
1526
|
-
const t = this.histories[e],
|
1527
|
-
return Promise.resolve(
|
1527
|
+
const t = this.histories[e], n = new ce(t || { id: e });
|
1528
|
+
return Promise.resolve(n);
|
1528
1529
|
}
|
1529
1530
|
getHistoryItem(e, t) {
|
1530
|
-
const
|
1531
|
+
const n = `${e}_${t}`, r = this.historyItems[n] || {};
|
1531
1532
|
return Promise.resolve(r);
|
1532
1533
|
}
|
1533
1534
|
saveHistoryItem(e, t) {
|
1534
|
-
const
|
1535
|
-
return this.historyItems[
|
1535
|
+
const n = `${e}_${t.id}`;
|
1536
|
+
return this.historyItems[n] = t, Promise.resolve(!0);
|
1536
1537
|
}
|
1537
1538
|
removeHistoryItem(e, t) {
|
1538
|
-
return t.forEach((
|
1539
|
-
const r = `${e}_${
|
1539
|
+
return t.forEach((n) => {
|
1540
|
+
const r = `${e}_${n}`;
|
1540
1541
|
delete this.historyItems[r];
|
1541
1542
|
}), Promise.resolve(!0);
|
1542
1543
|
}
|
1543
1544
|
}
|
1544
1545
|
let F = null;
|
1545
|
-
function
|
1546
|
-
return F || (F = new
|
1546
|
+
function xn() {
|
1547
|
+
return F || (F = new hn(), F);
|
1547
1548
|
}
|
1548
|
-
class
|
1549
|
+
class Rn extends Z {
|
1549
1550
|
getFileCaches = {};
|
1550
1551
|
async getExtension() {
|
1551
1552
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1600,56 +1601,56 @@ class xs extends Z {
|
|
1600
1601
|
);
|
1601
1602
|
}
|
1602
1603
|
}
|
1603
|
-
function Ee(
|
1604
|
-
return
|
1605
|
-
const { id:
|
1604
|
+
function Ee(s, e = []) {
|
1605
|
+
return e.map((t) => {
|
1606
|
+
const { id: n, title: r, icon: o, children: a, hidden: i } = t;
|
1606
1607
|
return {
|
1607
|
-
id:
|
1608
|
-
title:
|
1609
|
-
icon:
|
1610
|
-
hidden:
|
1611
|
-
url:
|
1612
|
-
children:
|
1608
|
+
id: n,
|
1609
|
+
title: r,
|
1610
|
+
icon: o,
|
1611
|
+
hidden: i,
|
1612
|
+
url: `${s}/${n}`,
|
1613
|
+
children: a && a.length ? Ee(s, a) : void 0
|
1613
1614
|
};
|
1614
1615
|
});
|
1615
1616
|
}
|
1616
|
-
function Pe(
|
1617
|
-
if (!e) return
|
1617
|
+
function Pe(s, e) {
|
1618
|
+
if (!e) return s;
|
1618
1619
|
let t = [];
|
1619
|
-
for (const
|
1620
|
-
if (
|
1621
|
-
const r = Pe(
|
1622
|
-
r.length && (
|
1620
|
+
for (const n of s)
|
1621
|
+
if (n.children && n.children.length) {
|
1622
|
+
const r = Pe(n.children, e);
|
1623
|
+
r.length && (n.children = r, t.push(n));
|
1623
1624
|
} else
|
1624
|
-
e
|
1625
|
+
e.can(n.id.toString()) && t.push(n);
|
1625
1626
|
return t;
|
1626
1627
|
}
|
1627
|
-
function
|
1628
|
-
const
|
1628
|
+
function kn(s) {
|
1629
|
+
const { menuBasePath: e = "/page" } = s || {}, t = be(), n = he(), r = vt(), o = O(!1), a = O(!1), i = t.project;
|
1629
1630
|
Qe(() => {
|
1630
|
-
const { name:
|
1631
|
-
if (
|
1632
|
-
const
|
1633
|
-
|
1634
|
-
} else if (
|
1635
|
-
const
|
1636
|
-
|
1631
|
+
const { name: f, params: d, meta: u } = n;
|
1632
|
+
if (f === W) {
|
1633
|
+
const h = t.getPage(d.id);
|
1634
|
+
o.value = !h?.mask, a.value = !!h?.pure;
|
1635
|
+
} else if (f === me) {
|
1636
|
+
const h = t.getHomepage();
|
1637
|
+
o.value = !h?.mask, a.value = !!h?.pure;
|
1637
1638
|
} else
|
1638
|
-
|
1639
|
+
o.value = !u.mask, a.value = !!u.pure;
|
1639
1640
|
});
|
1640
|
-
const
|
1641
|
+
const l = Ee(e, i?.pages), c = i?.config;
|
1641
1642
|
return {
|
1642
|
-
disabled:
|
1643
|
+
disabled: o,
|
1643
1644
|
logo: c?.logo,
|
1644
1645
|
themeSwitchable: c?.themeSwitchable,
|
1645
|
-
title: c?.title ||
|
1646
|
-
menus: Pe(
|
1647
|
-
pure:
|
1646
|
+
title: c?.title || i?.description || i?.name || "VTJ App",
|
1647
|
+
menus: Pe(l, r),
|
1648
|
+
pure: a
|
1648
1649
|
};
|
1649
1650
|
}
|
1650
1651
|
export {
|
1651
1652
|
_e as ACCESS_KEY,
|
1652
|
-
|
1653
|
+
bn as Access,
|
1653
1654
|
Ze as BUILT_IN_DIRECTIVES,
|
1654
1655
|
Z as BaseService,
|
1655
1656
|
oe as CONTEXT_HOST,
|
@@ -1657,24 +1658,24 @@ export {
|
|
1657
1658
|
_ as ContextMode,
|
1658
1659
|
et as DATA_TYPES,
|
1659
1660
|
me as HOMEPAGE_ROUTE_NAME,
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1661
|
+
$n as JSCodeToString,
|
1662
|
+
wn as LIFE_CYCLES_LIST,
|
1663
|
+
Rn as LocalService,
|
1664
|
+
hn as MemoryService,
|
1665
|
+
un as NodeEnv,
|
1665
1666
|
W as PAGE_ROUTE_NAME,
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1667
|
+
dn as Provider,
|
1668
|
+
cn as Startup,
|
1669
|
+
Pn as StorageService,
|
1669
1670
|
R as VTJ_RENDERER_VERSION,
|
1670
1671
|
ve as adoptedStyleSheets,
|
1671
|
-
|
1672
|
-
|
1672
|
+
Sn as createAssetScripts,
|
1673
|
+
jn as createAssetsCss,
|
1673
1674
|
Et as createDataSources,
|
1674
1675
|
V as createLoader,
|
1675
|
-
|
1676
|
+
xn as createMemoryService,
|
1676
1677
|
pt as createMetaApi,
|
1677
|
-
|
1678
|
+
En as createProvider,
|
1678
1679
|
J as createRenderer,
|
1679
1680
|
dt as createSchemaApi,
|
1680
1681
|
ft as createSchemaApis,
|
@@ -1696,14 +1697,14 @@ export {
|
|
1696
1697
|
mt as mockApi,
|
1697
1698
|
ht as mockApis,
|
1698
1699
|
ye as mockCleanup,
|
1699
|
-
|
1700
|
-
|
1700
|
+
M as nodeRender,
|
1701
|
+
st as parseDeps,
|
1701
1702
|
k as parseExpression,
|
1702
1703
|
ie as parseFunction,
|
1703
1704
|
$e as providerKey,
|
1704
|
-
|
1705
|
+
nt as removeProdFlag,
|
1705
1706
|
ge as toString,
|
1706
1707
|
vt as useAccess,
|
1707
|
-
|
1708
|
+
kn as useMask,
|
1708
1709
|
be as useProvider
|
1709
1710
|
};
|