@vtj/renderer 0.9.0-alpha.10 → 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 +517 -517
- package/package.json +5 -5
- package/types/hooks/mask.d.ts +4 -1
- 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
|
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
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
|
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
|
}
|
@@ -278,7 +278,7 @@ const gt = {
|
|
278
278
|
noPermissionMessage: "无权限访问该页面",
|
279
279
|
keyPrefix: ""
|
280
280
|
}, _e = Symbol("access");
|
281
|
-
class
|
281
|
+
class bn {
|
282
282
|
options;
|
283
283
|
data = null;
|
284
284
|
mode = _.Raw;
|
@@ -286,22 +286,22 @@ class $s {
|
|
286
286
|
this.options = Object.assign({}, gt, e), this.loadData();
|
287
287
|
}
|
288
288
|
connect(e) {
|
289
|
-
const { mode: t, router:
|
290
|
-
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);
|
291
291
|
}
|
292
292
|
login(e) {
|
293
|
-
const { storageKey: t, storagePrefix:
|
293
|
+
const { storageKey: t, storagePrefix: n, session: r, authKey: o } = this.options;
|
294
294
|
this.setData(e), this.data && (B.save(t, e, {
|
295
295
|
type: "local",
|
296
|
-
prefix:
|
296
|
+
prefix: n
|
297
297
|
}), r && U.set(o, this.data.token));
|
298
298
|
}
|
299
299
|
clear() {
|
300
|
-
const { storageKey: e, storagePrefix: t, session:
|
300
|
+
const { storageKey: e, storagePrefix: t, session: n, authKey: r } = this.options;
|
301
301
|
this.data = null, B.remove(e, {
|
302
302
|
type: "local",
|
303
303
|
prefix: t
|
304
|
-
}),
|
304
|
+
}), n && U.remove(r);
|
305
305
|
}
|
306
306
|
logout() {
|
307
307
|
this.clear(), this.toLogin();
|
@@ -313,20 +313,20 @@ class $s {
|
|
313
313
|
return this.data?.token;
|
314
314
|
}
|
315
315
|
can(e) {
|
316
|
-
const { keyPrefix: t } = this.options, { permissions:
|
317
|
-
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]);
|
318
318
|
}
|
319
319
|
some(e) {
|
320
|
-
const { keyPrefix: t } = this.options, { permissions:
|
321
|
-
return te(e).some((o) =>
|
320
|
+
const { keyPrefix: t } = this.options, { permissions: n = {} } = this.data || {};
|
321
|
+
return te(e).some((o) => n[o] || n[t + o]);
|
322
322
|
}
|
323
323
|
install(e) {
|
324
324
|
e.config.globalProperties.$access || (e.config.globalProperties.$access = this), e.provide(_e, this);
|
325
325
|
}
|
326
326
|
isAuthPath(e) {
|
327
|
-
const { auth: t, isAuth:
|
328
|
-
if (
|
329
|
-
return
|
327
|
+
const { auth: t, isAuth: n } = this.options;
|
328
|
+
if (n)
|
329
|
+
return n(e);
|
330
330
|
if (e.path && typeof t == "string") {
|
331
331
|
const r = t.split("#")[1] || t;
|
332
332
|
return e.path === r;
|
@@ -336,32 +336,32 @@ class $s {
|
|
336
336
|
toLogin() {
|
337
337
|
const { auth: e, redirectParam: t } = this.options;
|
338
338
|
if (!e || this.mode !== _.Raw) return;
|
339
|
-
const
|
340
|
-
typeof e == "function" ? e(
|
339
|
+
const n = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
|
340
|
+
typeof e == "function" ? e(n) : location.href = t ? `${e}${n}` : e;
|
341
341
|
}
|
342
342
|
setData(e) {
|
343
343
|
const { privateKey: t } = this.options;
|
344
344
|
if (Array.isArray(e) && t) {
|
345
|
-
const
|
346
|
-
this.data = JSON.parse(
|
345
|
+
const n = e.map((r) => ne(r, t));
|
346
|
+
this.data = JSON.parse(n.join(""));
|
347
347
|
return;
|
348
348
|
}
|
349
349
|
if (typeof e == "string")
|
350
350
|
try {
|
351
|
-
const
|
352
|
-
|
353
|
-
} catch (
|
354
|
-
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);
|
355
355
|
}
|
356
356
|
else
|
357
357
|
this.data = e;
|
358
358
|
}
|
359
359
|
loadData() {
|
360
|
-
const { storageKey: e, storagePrefix: t } = this.options,
|
360
|
+
const { storageKey: e, storagePrefix: t } = this.options, n = B.get(e, {
|
361
361
|
type: "local",
|
362
362
|
prefix: t
|
363
363
|
});
|
364
|
-
this.setData(
|
364
|
+
this.setData(n);
|
365
365
|
}
|
366
366
|
isLogined() {
|
367
367
|
const { session: e, authKey: t } = this.options;
|
@@ -375,7 +375,7 @@ class $s {
|
|
375
375
|
return !0;
|
376
376
|
}
|
377
377
|
setGuard(e) {
|
378
|
-
e.beforeEach((t,
|
378
|
+
e.beforeEach((t, n, r) => this.guard(t, r));
|
379
379
|
}
|
380
380
|
guard(e, t) {
|
381
381
|
if (this.isWhiteList(e) || this.isAuthPath(e))
|
@@ -384,15 +384,15 @@ class $s {
|
|
384
384
|
if (this.hasRoutePermission(e))
|
385
385
|
return t();
|
386
386
|
{
|
387
|
-
const
|
388
|
-
return this.showTip(
|
387
|
+
const n = this.options.noPermissionMessage || "无权限访问";
|
388
|
+
return this.showTip(n), t(!1);
|
389
389
|
}
|
390
390
|
}
|
391
391
|
t(!1), this.toLogin();
|
392
392
|
}
|
393
393
|
isWhiteList(e) {
|
394
394
|
const { whiteList: t } = this.options;
|
395
|
-
return t ? Array.isArray(t) ? t.some((
|
395
|
+
return t ? Array.isArray(t) ? t.some((n) => e.fullPath.startsWith(n)) : t(e) : !1;
|
396
396
|
}
|
397
397
|
isUnauthorized(e) {
|
398
398
|
const { unauthorizedCode: t = 401 } = this.options;
|
@@ -407,14 +407,14 @@ class $s {
|
|
407
407
|
t && (await le(150), await t(e, {
|
408
408
|
title: "提示",
|
409
409
|
type: "warning"
|
410
|
-
}).catch((
|
410
|
+
}).catch((n) => n));
|
411
411
|
}
|
412
412
|
setRequest(e) {
|
413
413
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
414
414
|
async (t) => (await this.showUnauthorizedAlert(t), t),
|
415
415
|
async (t) => {
|
416
|
-
const
|
417
|
-
return await this.showUnauthorizedAlert(
|
416
|
+
const n = t.response || t || {};
|
417
|
+
return await this.showUnauthorizedAlert(n), Promise.reject(t);
|
418
418
|
}
|
419
419
|
);
|
420
420
|
}
|
@@ -448,14 +448,14 @@ class yt {
|
|
448
448
|
$apis = {};
|
449
449
|
__transform = {};
|
450
450
|
constructor(e) {
|
451
|
-
const { mode: t, dsl:
|
452
|
-
this.__mode = t,
|
453
|
-
}
|
454
|
-
setup(e, t =
|
455
|
-
const
|
456
|
-
if (!
|
457
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
458
|
-
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;
|
459
459
|
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
460
460
|
this.__proxy();
|
461
461
|
}), t.onUnmounted(() => {
|
@@ -477,87 +477,87 @@ class yt {
|
|
477
477
|
__parseFunction(e) {
|
478
478
|
if (e)
|
479
479
|
if (this.__mode === _.Runtime) {
|
480
|
-
const { id: t, type:
|
481
|
-
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);
|
482
482
|
} else
|
483
483
|
return ie(e, this);
|
484
484
|
}
|
485
485
|
__parseExpression(e) {
|
486
486
|
if (e)
|
487
487
|
if (this.__mode === _.Runtime) {
|
488
|
-
const { id: t, type:
|
489
|
-
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);
|
490
490
|
} else
|
491
491
|
return k(e, this);
|
492
492
|
}
|
493
493
|
__ref(e = null, t) {
|
494
494
|
if (this.__mode !== _.VNode)
|
495
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
495
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (n) => {
|
496
496
|
await le(0);
|
497
|
-
let r =
|
497
|
+
let r = n?.$vtjEl || n?.$el || n?._?.vnode?.el || n;
|
498
498
|
if (!r) {
|
499
499
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
500
500
|
return;
|
501
501
|
}
|
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] =
|
503
|
-
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);
|
504
504
|
else if (t) {
|
505
505
|
const o = this.$refs[t];
|
506
|
-
if (o &&
|
507
|
-
const a = new Set([].concat(o,
|
506
|
+
if (o && n !== o) {
|
507
|
+
const a = new Set([].concat(o, n));
|
508
508
|
this.$refs[t] = Array.from(a);
|
509
509
|
} else
|
510
|
-
this.$refs[t] =
|
510
|
+
this.$refs[t] = n;
|
511
511
|
}
|
512
|
-
return
|
512
|
+
return n;
|
513
513
|
};
|
514
514
|
}
|
515
515
|
__clone(e = {}) {
|
516
|
-
const t = { ...this.context, ...e },
|
516
|
+
const t = { ...this.context, ...e }, n = {
|
517
517
|
...t,
|
518
518
|
context: t
|
519
519
|
};
|
520
|
-
return
|
520
|
+
return n.context.__proto__ = this.context, n.__proto__ = this, n;
|
521
521
|
}
|
522
522
|
}
|
523
|
-
function J(
|
523
|
+
function J(s) {
|
524
524
|
const {
|
525
|
-
Vue: e =
|
525
|
+
Vue: e = T,
|
526
526
|
mode: t = _.Runtime,
|
527
|
-
components:
|
527
|
+
components: n = {},
|
528
528
|
libs: r = {},
|
529
529
|
apis: o = {},
|
530
530
|
loader: a
|
531
|
-
} =
|
532
|
-
$components:
|
531
|
+
} = s, i = e.computed(() => s.dsl), l = {
|
532
|
+
$components: n,
|
533
533
|
$libs: r,
|
534
534
|
$apis: o
|
535
|
-
},
|
535
|
+
}, c = new yt({
|
536
536
|
mode: t,
|
537
537
|
dsl: i.value,
|
538
|
-
attrs:
|
538
|
+
attrs: l
|
539
539
|
}), f = e.defineComponent({
|
540
540
|
name: i.value.name,
|
541
541
|
props: {
|
542
|
-
...wt(i.value.props ?? [],
|
542
|
+
...wt(i.value.props ?? [], c)
|
543
543
|
},
|
544
544
|
setup(d) {
|
545
|
-
|
546
|
-
|
545
|
+
c.$props = d, c.props = d, i.value.id && ve(
|
546
|
+
s.window || window,
|
547
547
|
i.value.id,
|
548
548
|
i.value.css || ""
|
549
|
-
),
|
550
|
-
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(
|
551
551
|
i.value.dataSources || {},
|
552
|
-
|
552
|
+
c
|
553
553
|
), w = {
|
554
554
|
...p,
|
555
555
|
...u,
|
556
|
-
...
|
557
|
-
...
|
556
|
+
...h,
|
557
|
+
...m
|
558
558
|
};
|
559
|
-
return
|
560
|
-
vtj:
|
559
|
+
return c.setup(w, e), Pt(e, i.value.watch ?? [], c), {
|
560
|
+
vtj: c
|
561
561
|
};
|
562
562
|
},
|
563
563
|
emits: _t(i.value.emits),
|
@@ -565,249 +565,249 @@ function J(n) {
|
|
565
565
|
render() {
|
566
566
|
if (!i.value.nodes) return null;
|
567
567
|
const d = i.value.nodes || [];
|
568
|
-
return d.length === 1 ?
|
568
|
+
return d.length === 1 ? M(d[0], c, e, a) : d.map((u) => M(u, c, e, a));
|
569
569
|
},
|
570
|
-
...xt(i.value.lifeCycles ?? {},
|
570
|
+
...xt(i.value.lifeCycles ?? {}, c)
|
571
571
|
});
|
572
572
|
return {
|
573
573
|
renderer: e.markRaw(f),
|
574
|
-
context:
|
574
|
+
context: c
|
575
575
|
};
|
576
576
|
}
|
577
|
-
function _t(
|
578
|
-
return
|
577
|
+
function _t(s = []) {
|
578
|
+
return s.map((e) => j(e) ? e : e.name);
|
579
579
|
}
|
580
|
-
function wt(
|
581
|
-
const t = (
|
582
|
-
return
|
583
|
-
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
|
584
584
|
} : {
|
585
|
-
name:
|
586
|
-
type:
|
587
|
-
required:
|
588
|
-
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
|
589
589
|
}).reduce(
|
590
|
-
(
|
590
|
+
(n, r) => (n[r.name] = {
|
591
591
|
type: t(r.type),
|
592
592
|
required: r.required,
|
593
593
|
default: r.default
|
594
|
-
},
|
594
|
+
}, n),
|
595
595
|
{}
|
596
596
|
);
|
597
597
|
}
|
598
|
-
function St(
|
599
|
-
return
|
598
|
+
function St(s, e, t) {
|
599
|
+
return s.reactive(
|
600
600
|
Object.keys(e || {}).reduce(
|
601
|
-
(
|
601
|
+
(n, r) => {
|
602
602
|
let o = e[r];
|
603
|
-
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;
|
604
604
|
},
|
605
605
|
{}
|
606
606
|
)
|
607
607
|
);
|
608
608
|
}
|
609
|
-
function jt(
|
609
|
+
function jt(s, e, t) {
|
610
610
|
return Object.entries(e ?? {}).reduce(
|
611
|
-
(
|
611
|
+
(n, [r, o]) => (n[r] = s.computed(t.__parseFunction(o)), n),
|
612
612
|
{}
|
613
613
|
);
|
614
614
|
}
|
615
|
-
function $t(
|
616
|
-
return Object.entries(
|
617
|
-
(t, [
|
615
|
+
function $t(s, e) {
|
616
|
+
return Object.entries(s ?? {}).reduce(
|
617
|
+
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
618
618
|
{}
|
619
619
|
);
|
620
620
|
}
|
621
|
-
function bt(
|
621
|
+
function bt(s, e = [], t) {
|
622
622
|
return e.reduce(
|
623
|
-
(
|
623
|
+
(n, r) => {
|
624
624
|
const { name: o, from: a } = r || {};
|
625
625
|
r.default;
|
626
|
-
const i = S(a) ? t.__parseExpression(a) || o : a ?? o,
|
627
|
-
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;
|
628
628
|
},
|
629
629
|
{}
|
630
630
|
);
|
631
631
|
}
|
632
|
-
function Et(
|
633
|
-
return Object.keys(
|
634
|
-
(t,
|
635
|
-
const r = n
|
636
|
-
return t[
|
637
|
-
const
|
638
|
-
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;
|
639
639
|
}, t;
|
640
640
|
},
|
641
641
|
{}
|
642
642
|
);
|
643
643
|
}
|
644
|
-
function Pt(
|
645
|
-
e.forEach((
|
646
|
-
|
647
|
-
t.__parseExpression(
|
648
|
-
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),
|
649
649
|
{
|
650
|
-
deep:
|
651
|
-
immediate:
|
650
|
+
deep: n.deep,
|
651
|
+
immediate: n.immediate
|
652
652
|
}
|
653
653
|
);
|
654
654
|
});
|
655
655
|
}
|
656
|
-
function xt(
|
657
|
-
return Object.entries(
|
658
|
-
(t, [
|
656
|
+
function xt(s, e) {
|
657
|
+
return Object.entries(s ?? {}).reduce(
|
658
|
+
(t, [n, r]) => (t[n] = e.__parseFunction(r), t),
|
659
659
|
{}
|
660
660
|
);
|
661
661
|
}
|
662
662
|
let L = [];
|
663
|
-
const Rt = (
|
664
|
-
async function we(
|
665
|
-
const { urls: t = [], library:
|
666
|
-
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;
|
667
667
|
const o = t.filter((i) => G(i));
|
668
|
-
return o.length && it(o, e), await at(r,
|
669
|
-
(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)
|
670
670
|
);
|
671
671
|
}
|
672
|
-
function V(
|
673
|
-
const { getDsl: e, getDslByUrl: t, options:
|
674
|
-
return
|
675
|
-
delete
|
676
|
-
}), 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 () => {
|
677
677
|
const i = await e(o.id);
|
678
678
|
return i && (i.name = r), i ? J({
|
679
|
-
...
|
679
|
+
...n,
|
680
680
|
Vue: a,
|
681
681
|
dsl: i,
|
682
682
|
mode: _.Runtime,
|
683
|
-
loader: V(
|
683
|
+
loader: V(s)
|
684
684
|
}).renderer : null;
|
685
685
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
686
686
|
const i = await t(o.url);
|
687
687
|
return i && (i.name = r), i ? J({
|
688
|
-
...
|
688
|
+
...n,
|
689
689
|
Vue: a,
|
690
690
|
dsl: i,
|
691
691
|
mode: _.Runtime,
|
692
|
-
loader: V(
|
692
|
+
loader: V(s)
|
693
693
|
}).renderer : null;
|
694
694
|
}) : o.type === "Plugin" ? (o.library && L.push(o.library), a.defineAsyncComponent(async () => {
|
695
|
-
const i = await we(o,
|
695
|
+
const i = await we(o, n.window);
|
696
696
|
return i || (console.warn("getPlugin result is null", o), null);
|
697
697
|
})) : r;
|
698
698
|
}
|
699
|
-
function
|
700
|
-
if (!
|
701
|
-
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);
|
702
702
|
if (a && !Ct(a, e))
|
703
703
|
return null;
|
704
704
|
const d = (u) => {
|
705
|
-
const
|
706
|
-
if (
|
707
|
-
return Ft(u,
|
708
|
-
if (
|
709
|
-
const v = s
|
710
|
-
return j(v) ?
|
711
|
-
})(),
|
712
|
-
if (
|
713
|
-
return Ot(t,
|
714
|
-
f && Object.assign(
|
715
|
-
|
716
|
-
|
717
|
-
)),
|
718
|
-
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));
|
719
719
|
});
|
720
720
|
const g = Ht(
|
721
721
|
t,
|
722
|
-
|
722
|
+
s.children ?? [],
|
723
723
|
u,
|
724
|
-
|
725
|
-
|
724
|
+
n,
|
725
|
+
s
|
726
726
|
);
|
727
|
-
return t.createVNode(p, { ...
|
727
|
+
return t.createVNode(p, { ...m, ...w }, g);
|
728
728
|
};
|
729
729
|
return i ? Nt(i, d, e) : d(e);
|
730
730
|
}
|
731
|
-
function kt(
|
732
|
-
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(
|
733
733
|
(i) => !Ze.includes($(i.name))
|
734
734
|
);
|
735
735
|
return {
|
736
736
|
vIf: e,
|
737
737
|
vFor: t,
|
738
|
-
vShow:
|
738
|
+
vShow: n,
|
739
739
|
vModels: o,
|
740
740
|
vBind: r,
|
741
741
|
others: a
|
742
742
|
};
|
743
743
|
}
|
744
|
-
function Ct(
|
745
|
-
return !!e.__parseExpression(
|
744
|
+
function Ct(s, e) {
|
745
|
+
return !!e.__parseExpression(s.value);
|
746
746
|
}
|
747
|
-
function Ft(
|
748
|
-
return e ? S(e) ?
|
747
|
+
function Ft(s, e) {
|
748
|
+
return e ? S(e) ? s.__parseExpression(e) : e : "div";
|
749
749
|
}
|
750
|
-
function At(
|
751
|
-
const
|
750
|
+
function At(s, e, t) {
|
751
|
+
const n = Object.keys(e || {}).reduce(
|
752
752
|
(r, o) => {
|
753
753
|
let a = e[o];
|
754
754
|
return S(a) ? a = t.__parseExpression(a) : H(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
755
755
|
},
|
756
756
|
{}
|
757
757
|
);
|
758
|
-
return
|
758
|
+
return n.ref = t.__ref(s, n.ref), n;
|
759
759
|
}
|
760
|
-
function It(
|
761
|
-
const
|
760
|
+
function It(s, e, t) {
|
761
|
+
const n = ["passive", "capture", "once"], r = {
|
762
762
|
capture: "Capture",
|
763
763
|
once: "Once",
|
764
764
|
passive: "OnceCapture"
|
765
765
|
};
|
766
766
|
return Object.keys(e || {}).reduce(
|
767
767
|
(o, a) => {
|
768
|
-
const i = e[a],
|
769
|
-
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;
|
770
770
|
},
|
771
771
|
{}
|
772
772
|
);
|
773
773
|
}
|
774
|
-
function Se(
|
775
|
-
const t = Object.keys(
|
776
|
-
return e ? t.map((
|
774
|
+
function Se(s = {}, e = !1) {
|
775
|
+
const t = Object.keys(s);
|
776
|
+
return e ? t.map((n) => "." + n) : t;
|
777
777
|
}
|
778
|
-
function Ot(
|
779
|
-
const { children: o } = e, a =
|
780
|
-
return i ? i(t) : o ? j(o) ?
|
781
|
-
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))
|
782
782
|
) : Array.isArray(o) ? o.map(
|
783
|
-
(
|
783
|
+
(l) => M(l, n, s, r)
|
784
784
|
) : null : null;
|
785
785
|
}
|
786
|
-
function
|
787
|
-
const { props: t } =
|
786
|
+
function Mt(s, e) {
|
787
|
+
const { props: t } = s, n = t?.name || "default";
|
788
788
|
return {
|
789
|
-
name: S(
|
789
|
+
name: S(n) ? e.__parseExpression(n) : n,
|
790
790
|
params: []
|
791
791
|
};
|
792
792
|
}
|
793
|
-
function
|
794
|
-
return e.__parseExpression(
|
793
|
+
function Tt(s, e) {
|
794
|
+
return e.__parseExpression(s.value) ? {} : {
|
795
795
|
display: "none"
|
796
796
|
};
|
797
797
|
}
|
798
|
-
function
|
799
|
-
const
|
798
|
+
function Dt(s, e, t) {
|
799
|
+
const n = {
|
800
800
|
type: "JSFunction",
|
801
801
|
value: e.value?.value ? `(v) => {
|
802
802
|
${e.value.value} = v;
|
803
803
|
}` : "(v) => {}"
|
804
|
-
}, r = t.__parseFunction(
|
804
|
+
}, r = t.__parseFunction(n), o = Se(e.modifiers), a = S(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
805
805
|
return {
|
806
806
|
[a]: t.__parseExpression(e.value),
|
807
|
-
[`onUpdate:${a}`]: o.length && r ?
|
807
|
+
[`onUpdate:${a}`]: o.length && r ? s.withModifiers(r, o) : r
|
808
808
|
};
|
809
809
|
}
|
810
|
-
function Ht(
|
810
|
+
function Ht(s, e, t, n, r) {
|
811
811
|
if (!e) return null;
|
812
812
|
if (j(e))
|
813
813
|
return { default: () => e };
|
@@ -819,93 +819,93 @@ function Ht(n, e, t, s, r) {
|
|
819
819
|
const o = Bt(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
820
820
|
[`scope_${r.id}`]: i
|
821
821
|
} : {};
|
822
|
-
return Object.entries(o).reduce((i, [
|
823
|
-
const u = f.length ?
|
824
|
-
return
|
825
|
-
(
|
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)
|
826
826
|
);
|
827
827
|
}, i), {});
|
828
828
|
}
|
829
829
|
return null;
|
830
830
|
}
|
831
|
-
function Bt(
|
831
|
+
function Bt(s) {
|
832
832
|
const e = {
|
833
833
|
default: {
|
834
834
|
params: [],
|
835
835
|
nodes: []
|
836
836
|
}
|
837
837
|
};
|
838
|
-
for (const t of
|
839
|
-
const
|
840
|
-
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] = {
|
841
841
|
nodes: [t],
|
842
|
-
params:
|
842
|
+
params: n.params
|
843
843
|
};
|
844
844
|
}
|
845
845
|
return e;
|
846
846
|
}
|
847
|
-
function Ut(
|
848
|
-
return j(
|
847
|
+
function Ut(s = "default") {
|
848
|
+
return j(s) ? { name: s, params: [] } : { params: [], ...s };
|
849
849
|
}
|
850
|
-
function Nt(
|
851
|
-
const { value:
|
852
|
-
let i = t.__parseExpression(
|
853
|
-
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`), []);
|
854
854
|
}
|
855
|
-
function Lt(
|
856
|
-
return Ve() ? (ze(
|
855
|
+
function Lt(s) {
|
856
|
+
return Ve() ? (ze(s), !0) : !1;
|
857
857
|
}
|
858
|
-
function Q(
|
859
|
-
return typeof
|
858
|
+
function Q(s) {
|
859
|
+
return typeof s == "function" ? s() : Ke(s);
|
860
860
|
}
|
861
861
|
const je = typeof window < "u" && typeof document < "u";
|
862
862
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
863
|
-
const qt = (
|
863
|
+
const qt = (s) => s != null, Jt = () => {
|
864
864
|
};
|
865
|
-
function Vt(
|
865
|
+
function Vt(s) {
|
866
866
|
return de();
|
867
867
|
}
|
868
|
-
function zt(...
|
869
|
-
if (
|
870
|
-
return Ne(...
|
871
|
-
const e =
|
868
|
+
function zt(...s) {
|
869
|
+
if (s.length !== 1)
|
870
|
+
return Ne(...s);
|
871
|
+
const e = s[0];
|
872
872
|
return typeof e == "function" ? Le(qe(() => ({ get: e, set: Jt }))) : O(e);
|
873
873
|
}
|
874
|
-
function Kt(
|
875
|
-
Vt() && Je(
|
874
|
+
function Kt(s, e) {
|
875
|
+
Vt() && Je(s, e);
|
876
876
|
}
|
877
877
|
const Wt = je ? window : void 0, Gt = je ? window.document : void 0;
|
878
|
-
function Yt(
|
878
|
+
function Yt(s) {
|
879
879
|
var e;
|
880
|
-
const t = Q(
|
880
|
+
const t = Q(s);
|
881
881
|
return (e = t?.$el) != null ? e : t;
|
882
882
|
}
|
883
883
|
function Qt() {
|
884
|
-
const
|
884
|
+
const s = O(!1), e = de();
|
885
885
|
return e && We(() => {
|
886
|
-
|
887
|
-
}, e),
|
886
|
+
s.value = !0;
|
887
|
+
}, e), s;
|
888
888
|
}
|
889
|
-
function Xt(
|
889
|
+
function Xt(s) {
|
890
890
|
const e = Qt();
|
891
|
-
return fe(() => (e.value, !!
|
891
|
+
return fe(() => (e.value, !!s()));
|
892
892
|
}
|
893
|
-
function Zt(
|
894
|
-
const { window:
|
893
|
+
function Zt(s, e, t = {}) {
|
894
|
+
const { window: n = Wt, ...r } = t;
|
895
895
|
let o;
|
896
|
-
const a = Xt(() =>
|
896
|
+
const a = Xt(() => n && "MutationObserver" in n), i = () => {
|
897
897
|
o && (o.disconnect(), o = void 0);
|
898
|
-
},
|
899
|
-
const u = Q(
|
900
|
-
return new Set(
|
901
|
-
}),
|
902
|
-
() =>
|
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,
|
903
903
|
(u) => {
|
904
|
-
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)));
|
905
905
|
},
|
906
906
|
{ immediate: !0, flush: "post" }
|
907
907
|
), f = () => o?.takeRecords(), d = () => {
|
908
|
-
|
908
|
+
c(), i();
|
909
909
|
};
|
910
910
|
return Lt(d), {
|
911
911
|
isSupported: a,
|
@@ -913,12 +913,12 @@ function Zt(n, e, t = {}) {
|
|
913
913
|
takeRecords: f
|
914
914
|
};
|
915
915
|
}
|
916
|
-
function
|
917
|
-
var t,
|
916
|
+
function en(s = null, e = {}) {
|
917
|
+
var t, n, r;
|
918
918
|
const {
|
919
919
|
document: o = Gt,
|
920
920
|
restoreOnUnmount: a = (d) => d
|
921
|
-
} = 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";
|
922
922
|
function f(d) {
|
923
923
|
if (!("titleTemplate" in e))
|
924
924
|
return d;
|
@@ -926,63 +926,63 @@ function es(n = null, e = {}) {
|
|
926
926
|
return typeof u == "function" ? u(d) : Q(u).replace(/%s/g, d);
|
927
927
|
}
|
928
928
|
return pe(
|
929
|
-
|
929
|
+
l,
|
930
930
|
(d, u) => {
|
931
931
|
d !== u && o && (o.title = f(typeof d == "string" ? d : ""));
|
932
932
|
},
|
933
933
|
{ immediate: !0 }
|
934
|
-
), e.observe && !e.titleTemplate && o && !
|
934
|
+
), e.observe && !e.titleTemplate && o && !c && Zt(
|
935
935
|
(r = o.head) == null ? void 0 : r.querySelector("title"),
|
936
936
|
() => {
|
937
|
-
o && o.title !==
|
937
|
+
o && o.title !== l.value && (l.value = f(o.title));
|
938
938
|
},
|
939
939
|
{ childList: !0 }
|
940
940
|
), Kt(() => {
|
941
941
|
if (a) {
|
942
|
-
const d = a(i,
|
942
|
+
const d = a(i, l.value || "");
|
943
943
|
d != null && o && (o.title = d);
|
944
944
|
}
|
945
|
-
}),
|
945
|
+
}), l;
|
946
946
|
}
|
947
947
|
const ae = K({
|
948
948
|
name: "VtjPageContainer",
|
949
949
|
async setup() {
|
950
|
-
const
|
951
|
-
return
|
952
|
-
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,
|
953
953
|
component: r,
|
954
|
-
file:
|
954
|
+
file: n,
|
955
955
|
query: e.query,
|
956
|
-
meta:
|
956
|
+
meta: n?.meta
|
957
957
|
};
|
958
958
|
},
|
959
959
|
render() {
|
960
|
-
const { component:
|
961
|
-
return
|
960
|
+
const { component: s, query: e } = this;
|
961
|
+
return s ? q(s, e) : q("div", "页面不存在");
|
962
962
|
}
|
963
|
-
}),
|
963
|
+
}), tn = {
|
964
964
|
"data-l-h6o7ki7": "",
|
965
965
|
class: "vtj-startup__wrapper"
|
966
|
-
},
|
966
|
+
}, nn = {
|
967
967
|
"data-l-h6o7ki7": "",
|
968
968
|
class: "vtj-startup"
|
969
|
-
},
|
969
|
+
}, sn = {
|
970
970
|
"data-l-h6o7ki7": "",
|
971
971
|
class: "vtj-startup__name"
|
972
|
-
},
|
972
|
+
}, rn = { "data-l-h6o7ki7": "" }, on = {
|
973
973
|
"data-l-h6o7ki7": "",
|
974
974
|
class: "vtj-startup__tagline"
|
975
|
-
},
|
975
|
+
}, an = {
|
976
976
|
"data-l-h6o7ki7": "",
|
977
977
|
class: "vtj-startup__actions"
|
978
|
-
},
|
978
|
+
}, cn = /* @__PURE__ */ K({
|
979
979
|
__name: "Startup",
|
980
980
|
props: {
|
981
981
|
name: { default: "VTJ.PRO" },
|
982
982
|
tagline: { default: "基于 Vue3 + TypeScript 快速打造高生产力的低代码研发平台" },
|
983
983
|
actionText: { default: "开始设计" }
|
984
984
|
},
|
985
|
-
setup(
|
985
|
+
setup(s) {
|
986
986
|
((r, o) => {
|
987
987
|
let a = document.getElementById("h6o7ki7");
|
988
988
|
a || (a = document.createElement("style"), a.id = "h6o7ki7", document.head.appendChild(a), a.innerHTML = o);
|
@@ -1052,54 +1052,54 @@ const ae = K({
|
|
1052
1052
|
.vtj-startup__actions button[data-l-h6o7ki7]:hover{
|
1053
1053
|
opacity: 0.7;
|
1054
1054
|
}`);
|
1055
|
-
const t =
|
1055
|
+
const t = s, n = () => {
|
1056
1056
|
if (typeof window < "u") {
|
1057
1057
|
let o = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "__vtj__/#/";
|
1058
1058
|
window.location.href = o;
|
1059
1059
|
}
|
1060
1060
|
};
|
1061
|
-
return (r, o) => (Ge(), Ye("div",
|
1062
|
-
b("div",
|
1063
|
-
b("h1",
|
1064
|
-
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)
|
1065
1065
|
]),
|
1066
|
-
b("div",
|
1067
|
-
b("div",
|
1066
|
+
b("div", on, N(t.tagline), 1),
|
1067
|
+
b("div", an, [
|
1068
1068
|
b("button", {
|
1069
1069
|
"data-l-h6o7ki7": "",
|
1070
|
-
onClick:
|
1070
|
+
onClick: n
|
1071
1071
|
}, N(t.actionText), 1)
|
1072
1072
|
])
|
1073
1073
|
])
|
1074
1074
|
]));
|
1075
1075
|
}
|
1076
|
-
}),
|
1076
|
+
}), ln = K({
|
1077
1077
|
name: "VtjStartupContainer",
|
1078
1078
|
render() {
|
1079
|
-
return q(
|
1079
|
+
return q(cn);
|
1080
1080
|
}
|
1081
1081
|
}), $e = Symbol("Provider");
|
1082
|
-
var
|
1083
|
-
class
|
1082
|
+
var un = /* @__PURE__ */ ((s) => (s.Production = "production", s.Development = "development", s))(un || {});
|
1083
|
+
class dn extends xe {
|
1084
1084
|
constructor(e) {
|
1085
1085
|
super(), this.options = e;
|
1086
1086
|
const {
|
1087
1087
|
service: t,
|
1088
|
-
mode:
|
1088
|
+
mode: n = _.Raw,
|
1089
1089
|
dependencies: r,
|
1090
1090
|
materials: o,
|
1091
1091
|
project: a = {},
|
1092
1092
|
adapter: i = {},
|
1093
|
-
globals:
|
1094
|
-
modules:
|
1093
|
+
globals: l = {},
|
1094
|
+
modules: c = {},
|
1095
1095
|
router: f = null,
|
1096
1096
|
materialPath: d = "./",
|
1097
1097
|
nodeEnv: u = "development"
|
1098
1098
|
/* Development */
|
1099
1099
|
} = e;
|
1100
|
-
this.mode =
|
1101
|
-
const { access:
|
1102
|
-
|
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);
|
1103
1103
|
}
|
1104
1104
|
mode;
|
1105
1105
|
globals = {};
|
@@ -1120,109 +1120,109 @@ class us extends xe {
|
|
1120
1120
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
1121
1121
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
1122
1122
|
throw new Error("project is null");
|
1123
|
-
const { apis:
|
1124
|
-
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();
|
1125
1125
|
}
|
1126
1126
|
async loadDependencies(e) {
|
1127
1127
|
const t = Object.entries(this.dependencies);
|
1128
|
-
for (const [
|
1129
|
-
e[
|
1128
|
+
for (const [n, r] of t)
|
1129
|
+
e[n] || (e[n] = await r());
|
1130
1130
|
}
|
1131
1131
|
async loadAssets(e) {
|
1132
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
1133
|
-
libraryExports:
|
1134
|
-
libraryMap:
|
1132
|
+
const { dependencies: t = [] } = this.project, { dependencies: n, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1133
|
+
libraryExports: l,
|
1134
|
+
libraryMap: c,
|
1135
1135
|
materials: f,
|
1136
1136
|
materialExports: d,
|
1137
1137
|
materialMapLibrary: u
|
1138
|
-
} =
|
1138
|
+
} = st(
|
1139
1139
|
t,
|
1140
1140
|
a,
|
1141
1141
|
i === "development"
|
1142
1142
|
/* Development */
|
1143
1143
|
);
|
1144
|
-
for (const p of
|
1145
|
-
const
|
1144
|
+
for (const p of l) {
|
1145
|
+
const m = n[p], w = e[p];
|
1146
1146
|
if (w)
|
1147
1147
|
r[p] = w;
|
1148
|
-
else if (
|
1149
|
-
e[p] = r[p] = await
|
1148
|
+
else if (m)
|
1149
|
+
e[p] = r[p] = await m();
|
1150
1150
|
else {
|
1151
|
-
const g =
|
1151
|
+
const g = c[p] || [];
|
1152
1152
|
for (const v of g)
|
1153
|
-
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 }));
|
1154
1154
|
r[p] = e[p];
|
1155
1155
|
}
|
1156
1156
|
}
|
1157
1157
|
for (const p of f)
|
1158
|
-
await
|
1159
|
-
const
|
1158
|
+
await se(x.append(p, { v: R }));
|
1159
|
+
const h = this.materials || {};
|
1160
1160
|
for (const p of d) {
|
1161
|
-
const
|
1161
|
+
const m = e[u[p]], w = Re[p];
|
1162
1162
|
if (w)
|
1163
|
-
|
1164
|
-
o[g] =
|
1163
|
+
m && w.forEach((g) => {
|
1164
|
+
o[g] = m[g];
|
1165
1165
|
});
|
1166
1166
|
else {
|
1167
|
-
const g =
|
1168
|
-
g &&
|
1169
|
-
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);
|
1170
1170
|
});
|
1171
1171
|
}
|
1172
1172
|
}
|
1173
1173
|
}
|
1174
1174
|
initRouter() {
|
1175
|
-
const { router: e, project: t, options:
|
1175
|
+
const { router: e, project: t, options: n } = this;
|
1176
1176
|
if (!e) return;
|
1177
|
-
const { routeParentName: r, pageRouteName: o = "page", routeMeta: a } =
|
1177
|
+
const { routeParentName: r, pageRouteName: o = "page", routeMeta: a } = n, i = {
|
1178
1178
|
path: `/${o}/:id`,
|
1179
1179
|
name: W,
|
1180
1180
|
component: ae
|
1181
|
-
},
|
1181
|
+
}, l = {
|
1182
1182
|
path: "/",
|
1183
1183
|
name: me,
|
1184
|
-
component: t?.homepage ? ae :
|
1184
|
+
component: t?.homepage ? ae : ln,
|
1185
1185
|
meta: a
|
1186
1186
|
};
|
1187
|
-
r ? (e.addRoute(r, i), e.addRoute(r,
|
1187
|
+
r ? (e.addRoute(r, i), e.addRoute(r, l)) : (e.addRoute(i), e.addRoute(l));
|
1188
1188
|
}
|
1189
1189
|
install(e) {
|
1190
1190
|
const t = e.config.globalProperties.installed || {};
|
1191
|
-
for (const [
|
1192
|
-
!t[
|
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 = (
|
1194
|
-
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}`;
|
1195
1195
|
console.error(
|
1196
1196
|
"[VTJ Error]:",
|
1197
1197
|
{
|
1198
|
-
err:
|
1198
|
+
err: n,
|
1199
1199
|
instance: r,
|
1200
1200
|
info: o
|
1201
1201
|
},
|
1202
|
-
|
1203
|
-
),
|
1202
|
+
n?.stack
|
1203
|
+
), D.error({
|
1204
1204
|
title: "未处理的异常:请在控制台查看详情",
|
1205
|
-
message:
|
1205
|
+
message: l
|
1206
1206
|
});
|
1207
1207
|
});
|
1208
1208
|
}
|
1209
1209
|
getFile(e) {
|
1210
1210
|
const { blocks: t = [] } = this.project || {};
|
1211
|
-
return this.getPage(e) || t.find((
|
1211
|
+
return this.getPage(e) || t.find((n) => n.id === e) || null;
|
1212
1212
|
}
|
1213
1213
|
getPage(e) {
|
1214
|
-
const { pages: t = [] } = this.project || {},
|
1214
|
+
const { pages: t = [] } = this.project || {}, n = (r, o = []) => {
|
1215
1215
|
for (const a of o) {
|
1216
1216
|
if (a.id === r)
|
1217
1217
|
return a;
|
1218
1218
|
if (a.children && a.children.length) {
|
1219
|
-
const i =
|
1219
|
+
const i = n(r, a.children);
|
1220
1220
|
if (i)
|
1221
1221
|
return i;
|
1222
1222
|
}
|
1223
1223
|
}
|
1224
1224
|
};
|
1225
|
-
return
|
1225
|
+
return n(e, t) || null;
|
1226
1226
|
}
|
1227
1227
|
getHomepage() {
|
1228
1228
|
const { homepage: e } = this.project || {};
|
@@ -1241,65 +1241,65 @@ class us extends xe {
|
|
1241
1241
|
validSuccess: !1,
|
1242
1242
|
originResponse: !0
|
1243
1243
|
}
|
1244
|
-
}).then((
|
1244
|
+
}).then((n) => n.data).catch(() => null));
|
1245
1245
|
}
|
1246
1246
|
createDslRenderer(e, t = {}) {
|
1247
|
-
const { library:
|
1247
|
+
const { library: n, components: r, mode: o, apis: a } = this, i = {
|
1248
1248
|
mode: o,
|
1249
|
-
Vue:
|
1249
|
+
Vue: n.Vue,
|
1250
1250
|
components: r,
|
1251
|
-
libs:
|
1251
|
+
libs: n,
|
1252
1252
|
apis: a,
|
1253
1253
|
window,
|
1254
1254
|
...t
|
1255
|
-
},
|
1256
|
-
getDsl: async (
|
1257
|
-
getDslByUrl: async (
|
1255
|
+
}, l = V({
|
1256
|
+
getDsl: async (c) => await this.getDsl(c) || null,
|
1257
|
+
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1258
1258
|
options: i
|
1259
1259
|
});
|
1260
1260
|
return J({
|
1261
1261
|
...i,
|
1262
1262
|
dsl: e,
|
1263
|
-
loader:
|
1263
|
+
loader: l
|
1264
1264
|
});
|
1265
1265
|
}
|
1266
1266
|
async getRenderComponent(e, t) {
|
1267
|
-
const
|
1268
|
-
if (!
|
1267
|
+
const n = this.getFile(e);
|
1268
|
+
if (!n)
|
1269
1269
|
return I.warn(`Can not find file: ${e}`), null;
|
1270
|
-
t && t(
|
1270
|
+
t && t(n);
|
1271
1271
|
const r = `.vtj/vue/${e}.vue`, o = this.modules[r];
|
1272
1272
|
if (o)
|
1273
1273
|
return (await o())?.default;
|
1274
|
-
const a = await this.getDsl(
|
1274
|
+
const a = await this.getDsl(n.id);
|
1275
1275
|
return a ? this.createDslRenderer(a).renderer : (I.warn(`Can not find dsl: ${e}`), null);
|
1276
1276
|
}
|
1277
1277
|
defineUrlSchemaComponent(e, t) {
|
1278
1278
|
return re(async () => {
|
1279
|
-
const
|
1280
|
-
return
|
1279
|
+
const n = await this.getDslByUrl(e);
|
1280
|
+
return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
|
1281
1281
|
});
|
1282
1282
|
}
|
1283
1283
|
definePluginComponent(e) {
|
1284
1284
|
return re(async () => await we(e, window));
|
1285
1285
|
}
|
1286
1286
|
}
|
1287
|
-
function
|
1288
|
-
const e = new
|
1287
|
+
function En(s) {
|
1288
|
+
const e = new dn(s);
|
1289
1289
|
return {
|
1290
1290
|
provider: e,
|
1291
|
-
onReady: (
|
1291
|
+
onReady: (n) => e.ready(n)
|
1292
1292
|
};
|
1293
1293
|
}
|
1294
|
-
function be(
|
1294
|
+
function be(s = {}) {
|
1295
1295
|
const e = ue($e);
|
1296
1296
|
if (!e)
|
1297
1297
|
throw new Error("Can not find provider");
|
1298
1298
|
if (e.nodeEnv === "development") {
|
1299
|
-
const { id: t, version:
|
1300
|
-
t &&
|
1299
|
+
const { id: t, version: n } = s;
|
1300
|
+
t && n && (async () => {
|
1301
1301
|
const r = await e.getDsl(t);
|
1302
|
-
r?.__VERSION__ !==
|
1302
|
+
r?.__VERSION__ !== n && D.warning({
|
1303
1303
|
title: r?.name,
|
1304
1304
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
1305
1305
|
});
|
@@ -1313,23 +1313,23 @@ const X = new Be({
|
|
1313
1313
|
validSuccess: !0,
|
1314
1314
|
originResponse: !1,
|
1315
1315
|
failMessage: !0,
|
1316
|
-
validate: (
|
1317
|
-
showError: (
|
1318
|
-
|
1319
|
-
message:
|
1316
|
+
validate: (s) => s.data?.code === 0,
|
1317
|
+
showError: (s) => {
|
1318
|
+
D.error({
|
1319
|
+
message: s || "未知错误"
|
1320
1320
|
});
|
1321
1321
|
}
|
1322
1322
|
}
|
1323
|
-
}),
|
1324
|
-
url:
|
1323
|
+
}), pn = (s = "/__vtj__/api/:type.json") => (e, t) => X.send({
|
1324
|
+
url: s,
|
1325
1325
|
method: "post",
|
1326
1326
|
params: { type: e },
|
1327
1327
|
data: {
|
1328
1328
|
type: e,
|
1329
1329
|
data: t
|
1330
1330
|
}
|
1331
|
-
}),
|
1332
|
-
url:
|
1331
|
+
}), fn = (s = "/__vtj__/api/uploader.json") => async (e, t) => await X.send({
|
1332
|
+
url: s,
|
1333
1333
|
method: "post",
|
1334
1334
|
data: {
|
1335
1335
|
files: e,
|
@@ -1338,13 +1338,13 @@ const X = new Be({
|
|
1338
1338
|
settings: {
|
1339
1339
|
type: "data"
|
1340
1340
|
}
|
1341
|
-
}).then((
|
1341
|
+
}).then((n) => n && n[0] ? n[0] : null).catch(() => null);
|
1342
1342
|
class Z {
|
1343
1343
|
api;
|
1344
1344
|
pluginCaches = {};
|
1345
1345
|
uploader;
|
1346
1346
|
constructor() {
|
1347
|
-
this.api =
|
1347
|
+
this.api = pn(), this.uploader = fn();
|
1348
1348
|
}
|
1349
1349
|
async getExtension() {
|
1350
1350
|
console.log("BaseService.getExtension");
|
@@ -1417,11 +1417,11 @@ class Z {
|
|
1417
1417
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1418
1418
|
}
|
1419
1419
|
async getPluginMaterial(e) {
|
1420
|
-
const { urls: t = [] } = e,
|
1421
|
-
if (!
|
1422
|
-
const r = this.pluginCaches[
|
1423
|
-
return r || (this.pluginCaches[
|
1424
|
-
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,
|
1425
1425
|
method: "get",
|
1426
1426
|
settings: {
|
1427
1427
|
validSuccess: !1,
|
@@ -1435,9 +1435,9 @@ const y = new Ue({
|
|
1435
1435
|
expired: 0,
|
1436
1436
|
prefix: "__VTJ_"
|
1437
1437
|
});
|
1438
|
-
class
|
1438
|
+
class Pn extends Z {
|
1439
1439
|
init(e) {
|
1440
|
-
const t = new A(e),
|
1440
|
+
const t = new A(e), n = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), n || {});
|
1441
1441
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
1442
1442
|
}
|
1443
1443
|
saveProject(e) {
|
@@ -1469,30 +1469,30 @@ class Es extends Z {
|
|
1469
1469
|
return Promise.resolve(!0);
|
1470
1470
|
}
|
1471
1471
|
getHistory(e) {
|
1472
|
-
const t = y.get(`history_${e}`),
|
1473
|
-
return Promise.resolve(
|
1472
|
+
const t = y.get(`history_${e}`), n = new ce(t || { id: e });
|
1473
|
+
return Promise.resolve(n.toDsl());
|
1474
1474
|
}
|
1475
1475
|
getHistoryItem(e, t) {
|
1476
|
-
const
|
1477
|
-
return Promise.resolve(
|
1476
|
+
const n = y.get(`history_${e}_${t}`);
|
1477
|
+
return Promise.resolve(n);
|
1478
1478
|
}
|
1479
1479
|
saveHistoryItem(e, t) {
|
1480
1480
|
return y.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
1481
1481
|
}
|
1482
1482
|
removeHistoryItem(e, t) {
|
1483
|
-
return t.forEach((
|
1484
|
-
y.remove(`history_${e}_${
|
1483
|
+
return t.forEach((n) => {
|
1484
|
+
y.remove(`history_${e}_${n}`);
|
1485
1485
|
}), Promise.resolve(!0);
|
1486
1486
|
}
|
1487
1487
|
}
|
1488
|
-
class
|
1488
|
+
class hn extends Z {
|
1489
1489
|
projects = {};
|
1490
1490
|
materials = {};
|
1491
1491
|
files = {};
|
1492
1492
|
histories = {};
|
1493
1493
|
historyItems = {};
|
1494
1494
|
init(e) {
|
1495
|
-
const t = new A(e),
|
1495
|
+
const t = new A(e), n = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), n);
|
1496
1496
|
return this.projects[r.id] = r, Promise.resolve(r);
|
1497
1497
|
}
|
1498
1498
|
saveProject(e) {
|
@@ -1524,29 +1524,29 @@ class fs extends Z {
|
|
1524
1524
|
return Promise.resolve(!0);
|
1525
1525
|
}
|
1526
1526
|
getHistory(e) {
|
1527
|
-
const t = this.histories[e],
|
1528
|
-
return Promise.resolve(
|
1527
|
+
const t = this.histories[e], n = new ce(t || { id: e });
|
1528
|
+
return Promise.resolve(n);
|
1529
1529
|
}
|
1530
1530
|
getHistoryItem(e, t) {
|
1531
|
-
const
|
1531
|
+
const n = `${e}_${t}`, r = this.historyItems[n] || {};
|
1532
1532
|
return Promise.resolve(r);
|
1533
1533
|
}
|
1534
1534
|
saveHistoryItem(e, t) {
|
1535
|
-
const
|
1536
|
-
return this.historyItems[
|
1535
|
+
const n = `${e}_${t.id}`;
|
1536
|
+
return this.historyItems[n] = t, Promise.resolve(!0);
|
1537
1537
|
}
|
1538
1538
|
removeHistoryItem(e, t) {
|
1539
|
-
return t.forEach((
|
1540
|
-
const r = `${e}_${
|
1539
|
+
return t.forEach((n) => {
|
1540
|
+
const r = `${e}_${n}`;
|
1541
1541
|
delete this.historyItems[r];
|
1542
1542
|
}), Promise.resolve(!0);
|
1543
1543
|
}
|
1544
1544
|
}
|
1545
1545
|
let F = null;
|
1546
|
-
function
|
1547
|
-
return F || (F = new
|
1546
|
+
function xn() {
|
1547
|
+
return F || (F = new hn(), F);
|
1548
1548
|
}
|
1549
|
-
class
|
1549
|
+
class Rn extends Z {
|
1550
1550
|
getFileCaches = {};
|
1551
1551
|
async getExtension() {
|
1552
1552
|
return await this.api("getExtension", {}).catch(() => {
|
@@ -1601,56 +1601,56 @@ class xs extends Z {
|
|
1601
1601
|
);
|
1602
1602
|
}
|
1603
1603
|
}
|
1604
|
-
function Ee(
|
1605
|
-
return
|
1606
|
-
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;
|
1607
1607
|
return {
|
1608
|
-
id:
|
1609
|
-
title:
|
1610
|
-
icon:
|
1611
|
-
hidden:
|
1612
|
-
url:
|
1613
|
-
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
|
1614
1614
|
};
|
1615
1615
|
});
|
1616
1616
|
}
|
1617
|
-
function Pe(
|
1618
|
-
if (!e) return
|
1617
|
+
function Pe(s, e) {
|
1618
|
+
if (!e) return s;
|
1619
1619
|
let t = [];
|
1620
|
-
for (const
|
1621
|
-
if (
|
1622
|
-
const r = Pe(
|
1623
|
-
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));
|
1624
1624
|
} else
|
1625
|
-
e
|
1625
|
+
e.can(n.id.toString()) && t.push(n);
|
1626
1626
|
return t;
|
1627
1627
|
}
|
1628
|
-
function
|
1629
|
-
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;
|
1630
1630
|
Qe(() => {
|
1631
|
-
const { name:
|
1632
|
-
if (
|
1633
|
-
const
|
1634
|
-
|
1635
|
-
} else if (
|
1636
|
-
const
|
1637
|
-
|
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;
|
1638
1638
|
} else
|
1639
|
-
|
1639
|
+
o.value = !u.mask, a.value = !!u.pure;
|
1640
1640
|
});
|
1641
|
-
const
|
1641
|
+
const l = Ee(e, i?.pages), c = i?.config;
|
1642
1642
|
return {
|
1643
|
-
disabled:
|
1643
|
+
disabled: o,
|
1644
1644
|
logo: c?.logo,
|
1645
1645
|
themeSwitchable: c?.themeSwitchable,
|
1646
|
-
title: c?.title ||
|
1647
|
-
menus: Pe(
|
1648
|
-
pure:
|
1646
|
+
title: c?.title || i?.description || i?.name || "VTJ App",
|
1647
|
+
menus: Pe(l, r),
|
1648
|
+
pure: a
|
1649
1649
|
};
|
1650
1650
|
}
|
1651
1651
|
export {
|
1652
1652
|
_e as ACCESS_KEY,
|
1653
|
-
|
1653
|
+
bn as Access,
|
1654
1654
|
Ze as BUILT_IN_DIRECTIVES,
|
1655
1655
|
Z as BaseService,
|
1656
1656
|
oe as CONTEXT_HOST,
|
@@ -1658,24 +1658,24 @@ export {
|
|
1658
1658
|
_ as ContextMode,
|
1659
1659
|
et as DATA_TYPES,
|
1660
1660
|
me as HOMEPAGE_ROUTE_NAME,
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1661
|
+
$n as JSCodeToString,
|
1662
|
+
wn as LIFE_CYCLES_LIST,
|
1663
|
+
Rn as LocalService,
|
1664
|
+
hn as MemoryService,
|
1665
|
+
un as NodeEnv,
|
1666
1666
|
W as PAGE_ROUTE_NAME,
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1667
|
+
dn as Provider,
|
1668
|
+
cn as Startup,
|
1669
|
+
Pn as StorageService,
|
1670
1670
|
R as VTJ_RENDERER_VERSION,
|
1671
1671
|
ve as adoptedStyleSheets,
|
1672
|
-
|
1673
|
-
|
1672
|
+
Sn as createAssetScripts,
|
1673
|
+
jn as createAssetsCss,
|
1674
1674
|
Et as createDataSources,
|
1675
1675
|
V as createLoader,
|
1676
|
-
|
1676
|
+
xn as createMemoryService,
|
1677
1677
|
pt as createMetaApi,
|
1678
|
-
|
1678
|
+
En as createProvider,
|
1679
1679
|
J as createRenderer,
|
1680
1680
|
dt as createSchemaApi,
|
1681
1681
|
ft as createSchemaApis,
|
@@ -1697,14 +1697,14 @@ export {
|
|
1697
1697
|
mt as mockApi,
|
1698
1698
|
ht as mockApis,
|
1699
1699
|
ye as mockCleanup,
|
1700
|
-
|
1701
|
-
|
1700
|
+
M as nodeRender,
|
1701
|
+
st as parseDeps,
|
1702
1702
|
k as parseExpression,
|
1703
1703
|
ie as parseFunction,
|
1704
1704
|
$e as providerKey,
|
1705
|
-
|
1705
|
+
nt as removeProdFlag,
|
1706
1706
|
ge as toString,
|
1707
1707
|
vt as useAccess,
|
1708
|
-
|
1708
|
+
kn as useMask,
|
1709
1709
|
be as useProvider
|
1710
1710
|
};
|