@vtj/renderer 0.8.164 → 0.8.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +488 -470
- package/package.json +5 -5
- package/types/plugins/access.d.ts +6 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
3
|
-
import * as
|
|
4
|
-
import { inject as
|
|
5
|
-
import { useRoute as
|
|
1
|
+
import { Base as Se, BUILT_IN_COMPONENTS as $e, ProjectModel as I, HistoryModel as ne } from "@vtj/core";
|
|
2
|
+
import { isUrl as je, url as b, dedupArray as Ee, isString as $, isFunction as Y, logger as A, createRequest as Pe, merge as be, pathToRegexp as Re, pathToRegexpMatch as Ce, formDataToJson as Fe, storage as k, cookie as T, toArray as Q, delay as re, camelCase as j, upperFirst as xe, pick as Ie, jsonp as Ae, loadScript as X, Request as He, Storage as Oe, mapToObject as q } from "@vtj/utils";
|
|
3
|
+
import * as O from "vue";
|
|
4
|
+
import { inject as oe, toRef as De, readonly as Me, customRef as ke, ref as J, onBeforeUnmount as Te, getCurrentScope as Be, onScopeDispose as Ue, unref as Ne, getCurrentInstance as ie, watch as ae, computed as ce, onMounted as Le, defineComponent as ue, h as U, defineAsyncComponent as Z, watchEffect as qe } from "vue";
|
|
5
|
+
import { useRoute as le } from "vue-router";
|
|
6
6
|
import { ElNotification as D, ElLoading as Je } from "element-plus";
|
|
7
7
|
import { XStartup as Ve } from "@vtj/ui";
|
|
8
8
|
/**!
|
|
9
9
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
10
10
|
* @name @vtj/renderer
|
|
11
11
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
12
|
-
* @version 0.8.
|
|
12
|
+
* @version 0.8.166
|
|
13
13
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
14
14
|
*/
|
|
15
|
-
const
|
|
16
|
-
var
|
|
15
|
+
const R = "0.8.166";
|
|
16
|
+
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
|
17
17
|
const ee = [
|
|
18
18
|
"$el",
|
|
19
19
|
"$emit",
|
|
@@ -26,7 +26,7 @@ const ee = [
|
|
|
26
26
|
"$props",
|
|
27
27
|
"$options",
|
|
28
28
|
"$forceUpdate"
|
|
29
|
-
],
|
|
29
|
+
], os = [
|
|
30
30
|
"beforeCreate",
|
|
31
31
|
"created",
|
|
32
32
|
"beforeMount",
|
|
@@ -40,7 +40,7 @@ const ee = [
|
|
|
40
40
|
"renderTriggered",
|
|
41
41
|
"activated",
|
|
42
42
|
"deactivated"
|
|
43
|
-
], ze = ["vIf", "vShow", "vModel", "vFor", "vBind"],
|
|
43
|
+
], ze = ["vIf", "vShow", "vModel", "vFor", "vBind"], Ke = {
|
|
44
44
|
String,
|
|
45
45
|
Number,
|
|
46
46
|
Boolean,
|
|
@@ -49,90 +49,90 @@ const ee = [
|
|
|
49
49
|
Function,
|
|
50
50
|
Date
|
|
51
51
|
};
|
|
52
|
-
function F(
|
|
53
|
-
return
|
|
52
|
+
function F(n, e) {
|
|
53
|
+
return n.map((t) => je(t) || t.startsWith("/") ? t : `${e}${t}`);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return /\.css$/.test(
|
|
55
|
+
function V(n) {
|
|
56
|
+
return /\.css$/.test(n);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
return /\.js$/.test(
|
|
58
|
+
function z(n) {
|
|
59
|
+
return /\.js$/.test(n);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
return /\.json$/.test(
|
|
61
|
+
function We(n) {
|
|
62
|
+
return /\.json$/.test(n);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
return
|
|
66
|
-
(e) => `<script src="${b.append(e, { v:
|
|
64
|
+
function is(n) {
|
|
65
|
+
return n.map(
|
|
66
|
+
(e) => `<script src="${b.append(e, { v: R })}"><\/script>`
|
|
67
67
|
).join("");
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
71
|
-
(e) => `<link rel="stylesheet" href="${b.append(e, { v:
|
|
69
|
+
function as(n = []) {
|
|
70
|
+
return n.map(
|
|
71
|
+
(e) => `<link rel="stylesheet" href="${b.append(e, { v: R })}" />`
|
|
72
72
|
).join("");
|
|
73
73
|
}
|
|
74
|
-
function Ge(
|
|
75
|
-
return e &&
|
|
74
|
+
function Ge(n, e = !1) {
|
|
75
|
+
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
|
76
76
|
}
|
|
77
|
-
function Ye(
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
({ urls: l, assetsUrl: m, library: d, assetsLibrary: h, localeLibrary:
|
|
77
|
+
function Ye(n, e, t = !1) {
|
|
78
|
+
const s = n.filter((l) => !!l.enabled), r = [], o = [], a = [], i = [], u = {}, c = {}, p = [], f = {};
|
|
79
|
+
return s.forEach(
|
|
80
|
+
({ urls: l, assetsUrl: m, library: d, assetsLibrary: h, localeLibrary: w }) => {
|
|
81
81
|
l?.forEach((v) => {
|
|
82
|
-
|
|
83
|
-
}), d && (i.push(d), u[d] = F(l || [], e),
|
|
82
|
+
z(v) && r.push(Ge(v, t)), V(v) && o.push(v);
|
|
83
|
+
}), d && (i.push(d), u[d] = F(l || [], e), w && (c[d] = w)), m && a.push(m), h && p.push(h), d && h && (f[h] = d);
|
|
84
84
|
}
|
|
85
85
|
), {
|
|
86
86
|
scripts: F(r, e),
|
|
87
87
|
css: F(o, e),
|
|
88
88
|
materials: F(a, e),
|
|
89
89
|
libraryExports: i,
|
|
90
|
-
materialExports:
|
|
90
|
+
materialExports: Ee(p),
|
|
91
91
|
materialMapLibrary: f,
|
|
92
92
|
libraryMap: u,
|
|
93
93
|
libraryLocaleMap: c
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function Qe(
|
|
97
|
-
const { name: t, parent:
|
|
98
|
-
return
|
|
96
|
+
function Qe(n, e) {
|
|
97
|
+
const { name: t, parent: s, alias: r } = n;
|
|
98
|
+
return s ? e[s]?.[r || t] : e[r || t];
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
return $(
|
|
100
|
+
function fe(n) {
|
|
101
|
+
return $(n) ? n : JSON.stringify(n);
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
const r = new
|
|
103
|
+
function de(n, e, t) {
|
|
104
|
+
const s = n.CSSStyleSheet;
|
|
105
|
+
if (s.prototype.replaceSync) {
|
|
106
|
+
const r = new s();
|
|
107
107
|
r.id = e, r.replaceSync(t);
|
|
108
|
-
const o =
|
|
108
|
+
const o = n.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
|
|
109
109
|
(u) => u.id !== e
|
|
110
110
|
);
|
|
111
111
|
o.adoptedStyleSheets = [...i, r];
|
|
112
112
|
} else {
|
|
113
|
-
const r =
|
|
113
|
+
const r = n.document;
|
|
114
114
|
let o = r.getElementById(e);
|
|
115
115
|
o ? o.innerHTML = t : (o = r.createElement("style"), o.id = e, o.innerHTML = t, r.head.appendChild(o));
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
async function Xe(
|
|
119
|
-
const t = await window.fetch(e).then((
|
|
120
|
-
t &&
|
|
118
|
+
async function Xe(n, e) {
|
|
119
|
+
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
|
120
|
+
t && de(window, n, t);
|
|
121
121
|
}
|
|
122
|
-
function Ze(
|
|
123
|
-
const t = e.document,
|
|
124
|
-
for (const r of
|
|
122
|
+
function Ze(n, e = window) {
|
|
123
|
+
const t = e.document, s = e.document.head;
|
|
124
|
+
for (const r of n)
|
|
125
125
|
if (!t.getElementById(r)) {
|
|
126
126
|
const a = t.createElement("link");
|
|
127
|
-
a.rel = "stylesheet", a.id = r, a.href = r,
|
|
127
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
async function et(
|
|
131
|
-
const
|
|
130
|
+
async function et(n, e, t = window) {
|
|
131
|
+
const s = t.document, r = t.document.head;
|
|
132
132
|
let o = t[e];
|
|
133
133
|
return o ? o.default || o : new Promise((a, i) => {
|
|
134
|
-
for (const u of
|
|
135
|
-
const c =
|
|
134
|
+
for (const u of n) {
|
|
135
|
+
const c = s.createElement("script");
|
|
136
136
|
c.src = u, c.onload = () => {
|
|
137
137
|
o = t[e], o ? a(o.default || o) : i(null);
|
|
138
138
|
}, c.onerror = (p) => {
|
|
@@ -141,58 +141,58 @@ async function et(s, e, t = window) {
|
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
function tt(
|
|
145
|
-
return
|
|
144
|
+
function tt(n) {
|
|
145
|
+
return Y(n) || Y(n?.install);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function C(n, e, t = !1, s = !1) {
|
|
148
148
|
try {
|
|
149
149
|
const r = ['"use strict";', "var __self = arguments[0];"];
|
|
150
150
|
r.push("return ");
|
|
151
|
-
let o = (
|
|
151
|
+
let o = (n.value || "").trim();
|
|
152
152
|
o = o.replace(/this(\W|$)/g, (i, u) => `__self${u}`), o = r.join(`
|
|
153
153
|
`) + o;
|
|
154
154
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
155
155
|
return new Function("$scope", a)(e);
|
|
156
156
|
} catch (r) {
|
|
157
|
-
if (
|
|
157
|
+
if (A.error("parseExpression.error", r, n, e?.__self ?? e), s)
|
|
158
158
|
throw r;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
function te(
|
|
162
|
-
const r =
|
|
163
|
-
if (typeof r != "function" && (
|
|
161
|
+
function te(n, e, t = !1, s = !1) {
|
|
162
|
+
const r = C(n, e, t, s);
|
|
163
|
+
if (typeof r != "function" && (A.error(
|
|
164
164
|
"parseFunction.error",
|
|
165
165
|
"not a function",
|
|
166
|
-
|
|
166
|
+
n,
|
|
167
167
|
e?.__self ?? e
|
|
168
|
-
),
|
|
169
|
-
throw new Error(`"${
|
|
168
|
+
), s))
|
|
169
|
+
throw new Error(`"${n.value}" not a function`);
|
|
170
170
|
return r;
|
|
171
171
|
}
|
|
172
|
-
function S(
|
|
173
|
-
return
|
|
172
|
+
function S(n) {
|
|
173
|
+
return n && n.type === "JSExpression";
|
|
174
174
|
}
|
|
175
|
-
function M(
|
|
176
|
-
return typeof
|
|
175
|
+
function M(n) {
|
|
176
|
+
return typeof n == "object" && n && n.type === "JSFunction";
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return S(
|
|
178
|
+
function st(n) {
|
|
179
|
+
return S(n) || M(n);
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
return
|
|
181
|
+
function cs(n) {
|
|
182
|
+
return st(n) ? n.value : JSON.stringify(n);
|
|
183
183
|
}
|
|
184
184
|
let E = null;
|
|
185
|
-
const
|
|
185
|
+
const nt = Pe({
|
|
186
186
|
settings: {
|
|
187
187
|
type: "form",
|
|
188
188
|
validSuccess: !0,
|
|
189
189
|
originResponse: !1,
|
|
190
190
|
loading: !0,
|
|
191
|
-
validate: (
|
|
191
|
+
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
|
192
192
|
failMessage: !0,
|
|
193
|
-
showError: (
|
|
193
|
+
showError: (n) => {
|
|
194
194
|
D.error({
|
|
195
|
-
message:
|
|
195
|
+
message: n || "未知错误"
|
|
196
196
|
});
|
|
197
197
|
},
|
|
198
198
|
showLoading: () => {
|
|
@@ -208,62 +208,62 @@ const st = Ee({
|
|
|
208
208
|
}
|
|
209
209
|
});
|
|
210
210
|
let P;
|
|
211
|
-
function rt(
|
|
212
|
-
const { jsonp: t, request:
|
|
213
|
-
if (
|
|
214
|
-
return (r = {}) => t(
|
|
215
|
-
...
|
|
211
|
+
function rt(n, e) {
|
|
212
|
+
const { jsonp: t, request: s } = e;
|
|
213
|
+
if (n.method === "jsonp")
|
|
214
|
+
return (r = {}) => t(n.url, {
|
|
215
|
+
...n.jsonpOptions,
|
|
216
216
|
query: r
|
|
217
217
|
});
|
|
218
218
|
{
|
|
219
|
-
const r =
|
|
220
|
-
url:
|
|
221
|
-
method:
|
|
219
|
+
const r = n.headers ? C(n.headers, {}, !0) : void 0, o = {
|
|
220
|
+
url: n.url,
|
|
221
|
+
method: n.method,
|
|
222
222
|
settings: {
|
|
223
|
-
...
|
|
223
|
+
...n.settings,
|
|
224
224
|
headers: r
|
|
225
225
|
}
|
|
226
226
|
};
|
|
227
|
-
return (a, i) => (delete o.data,
|
|
227
|
+
return (a, i) => (delete o.data, s.send(be(o, i || {}, { data: a })));
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function ot(
|
|
230
|
+
function ot(n, e) {
|
|
231
231
|
const { metaQuery: t } = e;
|
|
232
232
|
if (!t) return;
|
|
233
|
-
const { code:
|
|
233
|
+
const { code: s, queryCode: r } = n;
|
|
234
234
|
return (o, a) => {
|
|
235
235
|
if (!t) {
|
|
236
236
|
console.warn("adapter.metaQuery is not defined!");
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
return t(
|
|
239
|
+
return t(s, r, o, a);
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
function it(
|
|
243
|
-
const
|
|
244
|
-
for (const r of
|
|
245
|
-
|
|
242
|
+
function it(n = [], e = [], t) {
|
|
243
|
+
const s = {};
|
|
244
|
+
for (const r of n)
|
|
245
|
+
s[r.id] = rt(r, t);
|
|
246
246
|
for (const r of e)
|
|
247
|
-
|
|
248
|
-
return
|
|
247
|
+
s[r.id] = ot(r, t);
|
|
248
|
+
return s;
|
|
249
249
|
}
|
|
250
|
-
async function at(
|
|
250
|
+
async function at(n = []) {
|
|
251
251
|
P = await import("mockjs").then((e) => e.default || e), P && (P.setup({
|
|
252
252
|
timeout: "50-500"
|
|
253
|
-
}),
|
|
253
|
+
}), pe(), n.forEach((e) => ct(P, e)));
|
|
254
254
|
}
|
|
255
|
-
function ct(
|
|
255
|
+
function ct(n, e) {
|
|
256
256
|
if (!e.mock) return;
|
|
257
|
-
const { url: t, mockTemplate:
|
|
258
|
-
if (t &&
|
|
259
|
-
const r =
|
|
260
|
-
|
|
261
|
-
const u = b.parse(i.url) || {}, c = i.body instanceof FormData ?
|
|
262
|
-
return Object.assign(i, { data: c, params: u, query: p }),
|
|
257
|
+
const { url: t, mockTemplate: s } = e;
|
|
258
|
+
if (t && s) {
|
|
259
|
+
const r = Re(`${t}(.*)`), o = Ce(t, { decode: decodeURIComponent }), a = C(s, {}, !0);
|
|
260
|
+
n.mock(r, (i) => {
|
|
261
|
+
const u = b.parse(i.url) || {}, c = i.body instanceof FormData ? Fe(i.body) : i.body, p = o(i.url)?.params;
|
|
262
|
+
return Object.assign(i, { data: c, params: u, query: p }), n.mock(a(i));
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function pe() {
|
|
267
267
|
P && (P._mocked = {});
|
|
268
268
|
}
|
|
269
269
|
const ut = {
|
|
@@ -276,30 +276,34 @@ const ut = {
|
|
|
276
276
|
redirectParam: "r",
|
|
277
277
|
unauthorizedCode: 401,
|
|
278
278
|
unauthorizedMessage: "登录已经失效,请重新登录!"
|
|
279
|
-
},
|
|
280
|
-
class
|
|
279
|
+
}, he = Symbol("access");
|
|
280
|
+
class us {
|
|
281
281
|
options;
|
|
282
282
|
data = null;
|
|
283
|
+
mode = _.Raw;
|
|
283
284
|
constructor(e) {
|
|
284
285
|
this.options = Object.assign({}, ut, e), this.loadData();
|
|
285
286
|
}
|
|
286
287
|
connect(e) {
|
|
287
|
-
const { mode: t, router:
|
|
288
|
-
|
|
288
|
+
const { mode: t, router: s, request: r } = e;
|
|
289
|
+
this.mode = t, s && t === _.Raw && this.setGuard(s), r && this.setRequest(r);
|
|
289
290
|
}
|
|
290
291
|
login(e) {
|
|
291
|
-
const { storageKey: t, storagePrefix:
|
|
292
|
+
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
|
292
293
|
this.data = e, k.save(t, e, {
|
|
293
294
|
type: "local",
|
|
294
|
-
prefix:
|
|
295
|
-
}), r &&
|
|
295
|
+
prefix: s
|
|
296
|
+
}), r && T.set(o, e.token);
|
|
296
297
|
}
|
|
297
|
-
|
|
298
|
-
const { storageKey: e, storagePrefix: t } = this.options;
|
|
298
|
+
clear() {
|
|
299
|
+
const { storageKey: e, storagePrefix: t, session: s, authKey: r } = this.options;
|
|
299
300
|
this.data = null, k.remove(e, {
|
|
300
301
|
type: "local",
|
|
301
302
|
prefix: t
|
|
302
|
-
}),
|
|
303
|
+
}), s && T.remove(r);
|
|
304
|
+
}
|
|
305
|
+
logout() {
|
|
306
|
+
this.clear(), this.toLogin();
|
|
303
307
|
}
|
|
304
308
|
getData() {
|
|
305
309
|
return this.data;
|
|
@@ -313,15 +317,23 @@ class ln {
|
|
|
313
317
|
return Q(e).some((r) => t[r]);
|
|
314
318
|
}
|
|
315
319
|
install(e) {
|
|
316
|
-
e.config.globalProperties.$access = this, e.provide(
|
|
320
|
+
e.config.globalProperties.$access = this, e.provide(he, this);
|
|
317
321
|
}
|
|
318
322
|
isAuthPath(e) {
|
|
319
|
-
const { auth: t, isAuth:
|
|
320
|
-
|
|
323
|
+
const { auth: t, isAuth: s } = this.options;
|
|
324
|
+
if (s)
|
|
325
|
+
return s(e);
|
|
326
|
+
if (e.path && typeof t == "string") {
|
|
327
|
+
const r = t.split("#")[1] || t;
|
|
328
|
+
return e.path === r;
|
|
329
|
+
}
|
|
330
|
+
return !1;
|
|
321
331
|
}
|
|
322
332
|
toLogin() {
|
|
323
333
|
const { auth: e, redirectParam: t } = this.options;
|
|
324
|
-
|
|
334
|
+
if (!e || this.mode !== _.Raw) return;
|
|
335
|
+
const s = t ? `?${t}=${encodeURIComponent(location.href)}` : "";
|
|
336
|
+
typeof e == "function" ? e(s) : location.href = t ? `${e}${s}` : e;
|
|
325
337
|
}
|
|
326
338
|
loadData() {
|
|
327
339
|
const { storageKey: e, storagePrefix: t } = this.options;
|
|
@@ -332,10 +344,10 @@ class ln {
|
|
|
332
344
|
}
|
|
333
345
|
isLogined() {
|
|
334
346
|
const { session: e, authKey: t } = this.options;
|
|
335
|
-
return e && t ? !!
|
|
347
|
+
return e && t ? !!T.get(t) : !!this.data;
|
|
336
348
|
}
|
|
337
349
|
setGuard(e) {
|
|
338
|
-
e.beforeEach((t,
|
|
350
|
+
e.beforeEach((t, s, r) => this.guard(t, r));
|
|
339
351
|
}
|
|
340
352
|
guard(e, t) {
|
|
341
353
|
if (this.isWhiteList(e) || this.isLogined() || this.isAuthPath(e))
|
|
@@ -344,26 +356,32 @@ class ln {
|
|
|
344
356
|
}
|
|
345
357
|
isWhiteList(e) {
|
|
346
358
|
const { whiteList: t } = this.options;
|
|
347
|
-
return t ? Array.isArray(t) ? t.some((
|
|
359
|
+
return t ? Array.isArray(t) ? t.some((s) => e.fullPath.startsWith(s)) : t(e) : !1;
|
|
348
360
|
}
|
|
349
361
|
isUnauthorized(e) {
|
|
350
362
|
const { unauthorizedCode: t = 401 } = this.options;
|
|
351
363
|
return e.status === t || e.data.code === t;
|
|
352
364
|
}
|
|
365
|
+
async showUnauthorizedAlert(e) {
|
|
366
|
+
const { alert: t, unauthorizedMessage: s = "登录已失效" } = this.options;
|
|
367
|
+
this.isUnauthorized(e) && t && (await re(150), await t(s, {
|
|
368
|
+
title: "提示",
|
|
369
|
+
type: "warning"
|
|
370
|
+
}).catch((r) => r), this.toLogin());
|
|
371
|
+
}
|
|
353
372
|
setRequest(e) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return this.isUnauthorized(o) && t && t(n), r;
|
|
373
|
+
e.useRequest((t) => (t.headers[this.options.authKey] = this.data?.token, t)), e.useResponse(
|
|
374
|
+
async (t) => (await this.showUnauthorizedAlert(t), t),
|
|
375
|
+
async (t) => {
|
|
376
|
+
const s = t.response || t || {};
|
|
377
|
+
return await this.showUnauthorizedAlert(s), Promise.reject(t);
|
|
360
378
|
}
|
|
361
379
|
);
|
|
362
380
|
}
|
|
363
381
|
}
|
|
364
|
-
function
|
|
365
|
-
const
|
|
366
|
-
return
|
|
382
|
+
function ls() {
|
|
383
|
+
const n = oe(he, null);
|
|
384
|
+
return n || console.warn("access is null"), n;
|
|
367
385
|
}
|
|
368
386
|
class lt {
|
|
369
387
|
__id = null;
|
|
@@ -391,14 +409,14 @@ class lt {
|
|
|
391
409
|
$apis = {};
|
|
392
410
|
__transform = {};
|
|
393
411
|
constructor(e) {
|
|
394
|
-
const { mode: t, dsl:
|
|
395
|
-
this.__mode = t,
|
|
396
|
-
}
|
|
397
|
-
setup(e, t =
|
|
398
|
-
const
|
|
399
|
-
if (!
|
|
400
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
|
401
|
-
const r =
|
|
412
|
+
const { mode: t, dsl: s, attrs: r } = e;
|
|
413
|
+
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), r && Object.assign(this, r);
|
|
414
|
+
}
|
|
415
|
+
setup(e, t = O) {
|
|
416
|
+
const s = t.getCurrentInstance();
|
|
417
|
+
if (!s) return;
|
|
418
|
+
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = s.proxy;
|
|
419
|
+
const r = s.appContext.config.globalProperties;
|
|
402
420
|
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
|
403
421
|
this.__proxy();
|
|
404
422
|
}), t.onUnmounted(() => {
|
|
@@ -419,60 +437,60 @@ class lt {
|
|
|
419
437
|
}
|
|
420
438
|
__parseFunction(e) {
|
|
421
439
|
if (e)
|
|
422
|
-
if (this.__mode ===
|
|
423
|
-
const { id: t, type:
|
|
424
|
-
return te({ type:
|
|
440
|
+
if (this.__mode === _.Runtime) {
|
|
441
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
442
|
+
return te({ type: s, value: r }, this);
|
|
425
443
|
} else
|
|
426
444
|
return te(e, this);
|
|
427
445
|
}
|
|
428
446
|
__parseExpression(e) {
|
|
429
447
|
if (e)
|
|
430
|
-
if (this.__mode ===
|
|
431
|
-
const { id: t, type:
|
|
432
|
-
return
|
|
448
|
+
if (this.__mode === _.Runtime) {
|
|
449
|
+
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
|
450
|
+
return C({ type: s, value: r }, this);
|
|
433
451
|
} else
|
|
434
|
-
return
|
|
452
|
+
return C(e, this);
|
|
435
453
|
}
|
|
436
454
|
__ref(e = null, t) {
|
|
437
|
-
if (this.__mode !==
|
|
438
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
|
439
|
-
await
|
|
440
|
-
let r =
|
|
455
|
+
if (this.__mode !== _.VNode)
|
|
456
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
|
457
|
+
await re(0);
|
|
458
|
+
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
|
441
459
|
if (!r) {
|
|
442
460
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
443
461
|
return;
|
|
444
462
|
}
|
|
445
|
-
if (r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e,
|
|
446
|
-
t(
|
|
463
|
+
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] = s), typeof t == "function")
|
|
464
|
+
t(s);
|
|
447
465
|
else if (t) {
|
|
448
466
|
const o = this.$refs[t];
|
|
449
|
-
if (o &&
|
|
450
|
-
const a = new Set([].concat(o,
|
|
467
|
+
if (o && s !== o) {
|
|
468
|
+
const a = new Set([].concat(o, s));
|
|
451
469
|
this.$refs[t] = Array.from(a);
|
|
452
470
|
} else
|
|
453
|
-
this.$refs[t] =
|
|
471
|
+
this.$refs[t] = s;
|
|
454
472
|
}
|
|
455
|
-
return
|
|
473
|
+
return s;
|
|
456
474
|
};
|
|
457
475
|
}
|
|
458
476
|
__clone(e = {}) {
|
|
459
|
-
const t = { ...this.context, ...e },
|
|
477
|
+
const t = { ...this.context, ...e }, s = {
|
|
460
478
|
...t,
|
|
461
479
|
context: t
|
|
462
480
|
};
|
|
463
|
-
return
|
|
481
|
+
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
|
464
482
|
}
|
|
465
483
|
}
|
|
466
|
-
function
|
|
484
|
+
function N(n) {
|
|
467
485
|
const {
|
|
468
|
-
Vue: e =
|
|
469
|
-
mode: t =
|
|
470
|
-
components:
|
|
486
|
+
Vue: e = O,
|
|
487
|
+
mode: t = _.Runtime,
|
|
488
|
+
components: s = {},
|
|
471
489
|
libs: r = {},
|
|
472
490
|
apis: o = {},
|
|
473
491
|
loader: a
|
|
474
|
-
} =
|
|
475
|
-
$components:
|
|
492
|
+
} = n, i = e.computed(() => n.dsl), u = {
|
|
493
|
+
$components: s,
|
|
476
494
|
$libs: r,
|
|
477
495
|
$apis: o
|
|
478
496
|
}, c = new lt({
|
|
@@ -485,21 +503,21 @@ function U(s) {
|
|
|
485
503
|
...dt(i.value.props ?? [], c)
|
|
486
504
|
},
|
|
487
505
|
setup(f) {
|
|
488
|
-
c.$props = f, c.props = f, i.value.id &&
|
|
489
|
-
|
|
506
|
+
c.$props = f, c.props = f, i.value.id && de(
|
|
507
|
+
n.window || window,
|
|
490
508
|
i.value.id,
|
|
491
509
|
i.value.css || ""
|
|
492
510
|
), c.state = pt(e, i.value.state ?? {}, c);
|
|
493
511
|
const l = ht(e, i.value.computed ?? {}, c), m = mt(i.value.methods ?? {}, c), d = vt(e, i.value.inject, c), h = gt(
|
|
494
512
|
i.value.dataSources || {},
|
|
495
513
|
c
|
|
496
|
-
),
|
|
514
|
+
), w = {
|
|
497
515
|
...d,
|
|
498
516
|
...l,
|
|
499
517
|
...m,
|
|
500
518
|
...h
|
|
501
519
|
};
|
|
502
|
-
return c.setup(
|
|
520
|
+
return c.setup(w, e), yt(e, i.value.watch ?? [], c), {
|
|
503
521
|
vtj: c
|
|
504
522
|
};
|
|
505
523
|
},
|
|
@@ -508,7 +526,7 @@ function U(s) {
|
|
|
508
526
|
render() {
|
|
509
527
|
if (!i.value.nodes) return null;
|
|
510
528
|
const f = i.value.nodes || [];
|
|
511
|
-
return f.length === 1 ?
|
|
529
|
+
return f.length === 1 ? H(f[0], c, e, a) : f.map((l) => H(l, c, e, a));
|
|
512
530
|
},
|
|
513
531
|
..._t(i.value.lifeCycles ?? {}, c)
|
|
514
532
|
});
|
|
@@ -517,66 +535,66 @@ function U(s) {
|
|
|
517
535
|
context: c
|
|
518
536
|
};
|
|
519
537
|
}
|
|
520
|
-
function ft(
|
|
521
|
-
return
|
|
538
|
+
function ft(n = []) {
|
|
539
|
+
return n.map((e) => $(e) ? e : e.name);
|
|
522
540
|
}
|
|
523
|
-
function dt(
|
|
524
|
-
const t = (
|
|
525
|
-
return
|
|
526
|
-
name:
|
|
541
|
+
function dt(n = [], e) {
|
|
542
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => Ke[o]) : void 0;
|
|
543
|
+
return n.map((s) => $(s) ? {
|
|
544
|
+
name: s
|
|
527
545
|
} : {
|
|
528
|
-
name:
|
|
529
|
-
type:
|
|
530
|
-
required:
|
|
531
|
-
default: S(
|
|
546
|
+
name: s.name,
|
|
547
|
+
type: s.type,
|
|
548
|
+
required: s.required,
|
|
549
|
+
default: S(s.default) ? e.__parseExpression(s.default) : s.default
|
|
532
550
|
}).reduce(
|
|
533
|
-
(
|
|
551
|
+
(s, r) => (s[r.name] = {
|
|
534
552
|
type: t(r.type),
|
|
535
553
|
required: r.required,
|
|
536
554
|
default: r.default
|
|
537
|
-
},
|
|
555
|
+
}, s),
|
|
538
556
|
{}
|
|
539
557
|
);
|
|
540
558
|
}
|
|
541
|
-
function pt(
|
|
542
|
-
return
|
|
559
|
+
function pt(n, e, t) {
|
|
560
|
+
return n.reactive(
|
|
543
561
|
Object.keys(e || {}).reduce(
|
|
544
|
-
(
|
|
562
|
+
(s, r) => {
|
|
545
563
|
let o = e[r];
|
|
546
|
-
return S(o) ? o = t.__parseExpression(o) : M(o) && (o = t.__parseFunction(o)),
|
|
564
|
+
return S(o) ? o = t.__parseExpression(o) : M(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
|
547
565
|
},
|
|
548
566
|
{}
|
|
549
567
|
)
|
|
550
568
|
);
|
|
551
569
|
}
|
|
552
|
-
function ht(
|
|
570
|
+
function ht(n, e, t) {
|
|
553
571
|
return Object.entries(e ?? {}).reduce(
|
|
554
|
-
(
|
|
572
|
+
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
|
555
573
|
{}
|
|
556
574
|
);
|
|
557
575
|
}
|
|
558
|
-
function mt(
|
|
559
|
-
return Object.entries(
|
|
560
|
-
(t, [
|
|
576
|
+
function mt(n, e) {
|
|
577
|
+
return Object.entries(n ?? {}).reduce(
|
|
578
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
561
579
|
{}
|
|
562
580
|
);
|
|
563
581
|
}
|
|
564
|
-
function vt(
|
|
582
|
+
function vt(n, e = [], t) {
|
|
565
583
|
return e.reduce(
|
|
566
|
-
(
|
|
584
|
+
(s, r) => {
|
|
567
585
|
const { name: o, from: a } = r || {};
|
|
568
586
|
r.default;
|
|
569
587
|
const i = S(a) ? t.__parseExpression(a) || o : a ?? o, u = S(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
|
570
|
-
return
|
|
588
|
+
return s[o] = n.inject(i, u), s;
|
|
571
589
|
},
|
|
572
590
|
{}
|
|
573
591
|
);
|
|
574
592
|
}
|
|
575
|
-
function gt(
|
|
576
|
-
return Object.keys(
|
|
577
|
-
(t,
|
|
578
|
-
const r = s
|
|
579
|
-
return t[
|
|
593
|
+
function gt(n, e) {
|
|
594
|
+
return Object.keys(n).reduce(
|
|
595
|
+
(t, s) => {
|
|
596
|
+
const r = n[s], o = e.$apis[r.ref], a = M(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
|
597
|
+
return t[s] = async (...i) => {
|
|
580
598
|
const u = await o.apply(e, i);
|
|
581
599
|
return a ? a(u) : u;
|
|
582
600
|
}, t;
|
|
@@ -584,179 +602,179 @@ function gt(s, e) {
|
|
|
584
602
|
{}
|
|
585
603
|
);
|
|
586
604
|
}
|
|
587
|
-
function yt(
|
|
588
|
-
e.forEach((
|
|
589
|
-
|
|
590
|
-
t.__parseExpression(
|
|
591
|
-
t.__parseFunction(
|
|
605
|
+
function yt(n, e = [], t) {
|
|
606
|
+
e.forEach((s) => {
|
|
607
|
+
n.watch(
|
|
608
|
+
t.__parseExpression(s.source),
|
|
609
|
+
t.__parseFunction(s.handler),
|
|
592
610
|
{
|
|
593
|
-
deep:
|
|
594
|
-
immediate:
|
|
611
|
+
deep: s.deep,
|
|
612
|
+
immediate: s.immediate
|
|
595
613
|
}
|
|
596
614
|
);
|
|
597
615
|
});
|
|
598
616
|
}
|
|
599
|
-
function _t(
|
|
600
|
-
return Object.entries(
|
|
601
|
-
(t, [
|
|
617
|
+
function _t(n, e) {
|
|
618
|
+
return Object.entries(n ?? {}).reduce(
|
|
619
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
602
620
|
{}
|
|
603
621
|
);
|
|
604
622
|
}
|
|
605
|
-
let
|
|
606
|
-
const wt = (
|
|
607
|
-
async function
|
|
608
|
-
const { urls: t = [], library:
|
|
609
|
-
if (r.length === 0 || !
|
|
610
|
-
const o = t.filter((i) =>
|
|
611
|
-
return o.length && Ze(o, e), await et(r,
|
|
612
|
-
(i) => (console.warn("loadScriptUrl error", r,
|
|
623
|
+
let B = [];
|
|
624
|
+
const wt = (n) => n;
|
|
625
|
+
async function me(n, e = window) {
|
|
626
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => z(i));
|
|
627
|
+
if (r.length === 0 || !s) return null;
|
|
628
|
+
const o = t.filter((i) => V(i));
|
|
629
|
+
return o.length && Ze(o, e), await et(r, s, e).catch(
|
|
630
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
|
613
631
|
);
|
|
614
632
|
}
|
|
615
|
-
function
|
|
616
|
-
const { getDsl: e, getDslByUrl: t, options:
|
|
617
|
-
return
|
|
618
|
-
delete
|
|
619
|
-
}),
|
|
633
|
+
function L(n) {
|
|
634
|
+
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
|
635
|
+
return s.window && (B.forEach((r) => {
|
|
636
|
+
delete s.window[r];
|
|
637
|
+
}), B = []), (r, o, a = O) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
620
638
|
const i = await e(o.id);
|
|
621
|
-
return i && (i.name = r), i ?
|
|
622
|
-
...
|
|
639
|
+
return i && (i.name = r), i ? N({
|
|
640
|
+
...s,
|
|
623
641
|
Vue: a,
|
|
624
642
|
dsl: i,
|
|
625
|
-
mode:
|
|
626
|
-
loader:
|
|
643
|
+
mode: _.Runtime,
|
|
644
|
+
loader: L(n)
|
|
627
645
|
}).renderer : null;
|
|
628
646
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
|
629
647
|
const i = await t(o.url);
|
|
630
|
-
return i && (i.name = r), i ?
|
|
631
|
-
...
|
|
648
|
+
return i && (i.name = r), i ? N({
|
|
649
|
+
...s,
|
|
632
650
|
Vue: a,
|
|
633
651
|
dsl: i,
|
|
634
|
-
mode:
|
|
635
|
-
loader:
|
|
652
|
+
mode: _.Runtime,
|
|
653
|
+
loader: L(n)
|
|
636
654
|
}).renderer : null;
|
|
637
|
-
}) : o.type === "Plugin" ? (o.library &&
|
|
638
|
-
const i = await
|
|
655
|
+
}) : o.type === "Plugin" ? (o.library && B.push(o.library), a.defineAsyncComponent(async () => {
|
|
656
|
+
const i = await me(o, s.window);
|
|
639
657
|
return i || (console.warn("getPlugin result is null", o), null);
|
|
640
658
|
})) : r;
|
|
641
659
|
}
|
|
642
|
-
function
|
|
643
|
-
if (!
|
|
644
|
-
const { id: r = null, directives: o = [] } =
|
|
660
|
+
function H(n, e, t = O, s = wt) {
|
|
661
|
+
if (!n || !n.name || n.invisible) return null;
|
|
662
|
+
const { id: r = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: u, vModels: c, vBind: p } = St(o);
|
|
645
663
|
if (a && !$t(a, e))
|
|
646
664
|
return null;
|
|
647
665
|
const f = (l) => {
|
|
648
666
|
const m = l.$components, d = (() => {
|
|
649
|
-
if (
|
|
650
|
-
return jt(l,
|
|
651
|
-
if (
|
|
652
|
-
const g = n
|
|
667
|
+
if (n.name === "component")
|
|
668
|
+
return jt(l, n.props?.is);
|
|
669
|
+
if (n.name === "slot") return n.name;
|
|
670
|
+
const g = s(n.name, n.from, t);
|
|
653
671
|
return $(g) ? m[g] ?? g : g;
|
|
654
|
-
})(), h = Et(r,
|
|
655
|
-
if (
|
|
656
|
-
return bt(t,
|
|
672
|
+
})(), h = Et(r, n.props ?? {}, l), w = Pt(t, n.events ?? {}, l);
|
|
673
|
+
if (n.name === "slot")
|
|
674
|
+
return bt(t, n, h, l, s);
|
|
657
675
|
p && Object.assign(h, l.__parseExpression(p.value)), u && (h.style = Object.assign(
|
|
658
676
|
h.style ?? {},
|
|
659
|
-
|
|
677
|
+
Ct(u, l)
|
|
660
678
|
)), c.forEach((g) => {
|
|
661
679
|
Object.assign(h, Ft(t, g, l));
|
|
662
680
|
});
|
|
663
681
|
const v = xt(
|
|
664
682
|
t,
|
|
665
|
-
|
|
683
|
+
n.children ?? [],
|
|
666
684
|
l,
|
|
667
|
-
|
|
668
|
-
|
|
685
|
+
s,
|
|
686
|
+
n
|
|
669
687
|
);
|
|
670
|
-
return t.createVNode(d, { ...h, ...
|
|
688
|
+
return t.createVNode(d, { ...h, ...w }, v);
|
|
671
689
|
};
|
|
672
|
-
return i ?
|
|
690
|
+
return i ? Ht(i, f, e) : f(e);
|
|
673
691
|
}
|
|
674
|
-
function St(
|
|
675
|
-
const e =
|
|
692
|
+
function St(n = []) {
|
|
693
|
+
const e = n.find((i) => j(i.name) === "vIf"), t = n.find((i) => j(i.name) === "vFor"), s = n.find((i) => j(i.name) === "vShow"), r = n.find((i) => j(i.name) === "vBind"), o = n.filter((i) => j(i.name) === "vModel"), a = n.filter(
|
|
676
694
|
(i) => !ze.includes(j(i.name))
|
|
677
695
|
);
|
|
678
696
|
return {
|
|
679
697
|
vIf: e,
|
|
680
698
|
vFor: t,
|
|
681
|
-
vShow:
|
|
699
|
+
vShow: s,
|
|
682
700
|
vModels: o,
|
|
683
701
|
vBind: r,
|
|
684
702
|
others: a
|
|
685
703
|
};
|
|
686
704
|
}
|
|
687
|
-
function $t(
|
|
688
|
-
return !!e.__parseExpression(
|
|
705
|
+
function $t(n, e) {
|
|
706
|
+
return !!e.__parseExpression(n.value);
|
|
689
707
|
}
|
|
690
|
-
function jt(
|
|
691
|
-
return e ? S(e) ?
|
|
708
|
+
function jt(n, e) {
|
|
709
|
+
return e ? S(e) ? n.__parseExpression(e) : e : "div";
|
|
692
710
|
}
|
|
693
|
-
function Et(
|
|
694
|
-
const
|
|
711
|
+
function Et(n, e, t) {
|
|
712
|
+
const s = Object.keys(e || {}).reduce(
|
|
695
713
|
(r, o) => {
|
|
696
714
|
let a = e[o];
|
|
697
715
|
return S(a) ? a = t.__parseExpression(a) : M(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
|
698
716
|
},
|
|
699
717
|
{}
|
|
700
718
|
);
|
|
701
|
-
return
|
|
719
|
+
return s.ref = t.__ref(n, s.ref), s;
|
|
702
720
|
}
|
|
703
|
-
function Pt(
|
|
704
|
-
const
|
|
721
|
+
function Pt(n, e, t) {
|
|
722
|
+
const s = ["passive", "capture", "once"], r = {
|
|
705
723
|
capture: "Capture",
|
|
706
724
|
once: "Once",
|
|
707
725
|
passive: "OnceCapture"
|
|
708
726
|
};
|
|
709
727
|
return Object.keys(e || {}).reduce(
|
|
710
728
|
(o, a) => {
|
|
711
|
-
const i = e[a], u =
|
|
712
|
-
return f && (o[p] =
|
|
729
|
+
const i = e[a], u = ve(i.modifiers), c = u.find((l) => s.includes(l)), p = "on" + xe(a) + (c && r[c] || ""), f = t.__parseFunction(i.handler);
|
|
730
|
+
return f && (o[p] = n.withModifiers(f, u)), o;
|
|
713
731
|
},
|
|
714
732
|
{}
|
|
715
733
|
);
|
|
716
734
|
}
|
|
717
|
-
function
|
|
718
|
-
const t = Object.keys(
|
|
719
|
-
return e ? t.map((
|
|
735
|
+
function ve(n = {}, e = !1) {
|
|
736
|
+
const t = Object.keys(n);
|
|
737
|
+
return e ? t.map((s) => "." + s) : t;
|
|
720
738
|
}
|
|
721
|
-
function bt(
|
|
722
|
-
const { children: o } = e, a =
|
|
723
|
-
return i ? i(t) : o ? $(o) ?
|
|
724
|
-
|
|
739
|
+
function bt(n, e, t, s, r) {
|
|
740
|
+
const { children: o } = e, a = Rt(e, s), i = s.$slots?.[a.name];
|
|
741
|
+
return i ? i(t) : o ? $(o) ? n.createTextVNode(o) : S(o) ? n.createTextVNode(
|
|
742
|
+
fe(s.__parseExpression(o))
|
|
725
743
|
) : Array.isArray(o) ? o.map(
|
|
726
|
-
(u) =>
|
|
744
|
+
(u) => H(u, s, n, r)
|
|
727
745
|
) : null : null;
|
|
728
746
|
}
|
|
729
|
-
function
|
|
730
|
-
const { props: t } =
|
|
747
|
+
function Rt(n, e) {
|
|
748
|
+
const { props: t } = n, s = t?.name || "default";
|
|
731
749
|
return {
|
|
732
|
-
name: S(
|
|
750
|
+
name: S(s) ? e.__parseExpression(s) : s,
|
|
733
751
|
params: []
|
|
734
752
|
};
|
|
735
753
|
}
|
|
736
|
-
function
|
|
737
|
-
return e.__parseExpression(
|
|
754
|
+
function Ct(n, e) {
|
|
755
|
+
return e.__parseExpression(n.value) ? {} : {
|
|
738
756
|
display: "none"
|
|
739
757
|
};
|
|
740
758
|
}
|
|
741
|
-
function Ft(
|
|
742
|
-
const
|
|
759
|
+
function Ft(n, e, t) {
|
|
760
|
+
const s = {
|
|
743
761
|
type: "JSFunction",
|
|
744
762
|
value: e.value?.value ? `(v) => {
|
|
745
763
|
${e.value.value} = v;
|
|
746
764
|
}` : "(v) => {}"
|
|
747
|
-
}, r = t.__parseFunction(
|
|
765
|
+
}, r = t.__parseFunction(s), o = ve(e.modifiers), a = S(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
748
766
|
return {
|
|
749
767
|
[a]: t.__parseExpression(e.value),
|
|
750
|
-
[`onUpdate:${a}`]: o.length && r ?
|
|
768
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
|
751
769
|
};
|
|
752
770
|
}
|
|
753
|
-
function xt(
|
|
771
|
+
function xt(n, e, t, s, r) {
|
|
754
772
|
if (!e) return null;
|
|
755
773
|
if ($(e))
|
|
756
774
|
return { default: () => e };
|
|
757
775
|
if (S(e))
|
|
758
776
|
return {
|
|
759
|
-
default: () =>
|
|
777
|
+
default: () => fe(t.__parseExpression(e))
|
|
760
778
|
};
|
|
761
779
|
if (Array.isArray(e) && e.length > 0) {
|
|
762
780
|
const o = It(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
|
@@ -765,83 +783,83 @@ function xt(s, e, t, n, r) {
|
|
|
765
783
|
return Object.entries(o).reduce((i, [u, { nodes: c, params: p }]) => (i[u] = (f) => {
|
|
766
784
|
const l = p.length ? Ie(f ?? {}, p) : a(f);
|
|
767
785
|
return c.map(
|
|
768
|
-
(m) =>
|
|
786
|
+
(m) => H(m, t.__clone(l), n, s)
|
|
769
787
|
);
|
|
770
788
|
}, i), {});
|
|
771
789
|
}
|
|
772
790
|
return null;
|
|
773
791
|
}
|
|
774
|
-
function It(
|
|
792
|
+
function It(n) {
|
|
775
793
|
const e = {
|
|
776
794
|
default: {
|
|
777
795
|
params: [],
|
|
778
796
|
nodes: []
|
|
779
797
|
}
|
|
780
798
|
};
|
|
781
|
-
for (const t of
|
|
782
|
-
const
|
|
783
|
-
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(
|
|
799
|
+
for (const t of n) {
|
|
800
|
+
const s = At(t.slot), r = s.name;
|
|
801
|
+
e[r] ? (e[r].nodes.push(t), e[r].params = e[r].params.concat(s.params)) : e[r] = {
|
|
784
802
|
nodes: [t],
|
|
785
|
-
params:
|
|
803
|
+
params: s.params
|
|
786
804
|
};
|
|
787
805
|
}
|
|
788
806
|
return e;
|
|
789
807
|
}
|
|
790
|
-
function
|
|
791
|
-
return $(
|
|
808
|
+
function At(n = "default") {
|
|
809
|
+
return $(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
792
810
|
}
|
|
793
|
-
function
|
|
794
|
-
const { value:
|
|
795
|
-
let i = t.__parseExpression(
|
|
796
|
-
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((u, c) => c + 1)), Array.isArray(i) ? i.map((u, c) => e(t.__clone({ [o]: u, [a]: c }))) : (console.warn("[vForRender]:", `${
|
|
811
|
+
function Ht(n, e, t) {
|
|
812
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
|
813
|
+
let i = t.__parseExpression(s) || [];
|
|
814
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((u, c) => c + 1)), Array.isArray(i) ? i.map((u, c) => e(t.__clone({ [o]: u, [a]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
797
815
|
}
|
|
798
|
-
function
|
|
799
|
-
return Be() ? (Ue(
|
|
816
|
+
function Ot(n) {
|
|
817
|
+
return Be() ? (Ue(n), !0) : !1;
|
|
800
818
|
}
|
|
801
|
-
function
|
|
802
|
-
return typeof
|
|
819
|
+
function K(n) {
|
|
820
|
+
return typeof n == "function" ? n() : Ne(n);
|
|
803
821
|
}
|
|
804
|
-
const
|
|
822
|
+
const ge = typeof window < "u" && typeof document < "u";
|
|
805
823
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
806
|
-
const Dt = (
|
|
824
|
+
const Dt = (n) => n != null, Mt = () => {
|
|
807
825
|
};
|
|
808
|
-
function kt(
|
|
809
|
-
return
|
|
826
|
+
function kt(n) {
|
|
827
|
+
return ie();
|
|
810
828
|
}
|
|
811
|
-
function Tt(...
|
|
812
|
-
if (
|
|
813
|
-
return De(...
|
|
814
|
-
const e =
|
|
815
|
-
return typeof e == "function" ? Me(ke(() => ({ get: e, set: Mt }))) :
|
|
829
|
+
function Tt(...n) {
|
|
830
|
+
if (n.length !== 1)
|
|
831
|
+
return De(...n);
|
|
832
|
+
const e = n[0];
|
|
833
|
+
return typeof e == "function" ? Me(ke(() => ({ get: e, set: Mt }))) : J(e);
|
|
816
834
|
}
|
|
817
|
-
function Bt(
|
|
818
|
-
kt() && Te(
|
|
835
|
+
function Bt(n, e) {
|
|
836
|
+
kt() && Te(n, e);
|
|
819
837
|
}
|
|
820
|
-
const Ut =
|
|
821
|
-
function Lt(
|
|
838
|
+
const Ut = ge ? window : void 0, Nt = ge ? window.document : void 0;
|
|
839
|
+
function Lt(n) {
|
|
822
840
|
var e;
|
|
823
|
-
const t =
|
|
841
|
+
const t = K(n);
|
|
824
842
|
return (e = t?.$el) != null ? e : t;
|
|
825
843
|
}
|
|
826
844
|
function qt() {
|
|
827
|
-
const
|
|
845
|
+
const n = J(!1), e = ie();
|
|
828
846
|
return e && Le(() => {
|
|
829
|
-
|
|
830
|
-
}, e),
|
|
847
|
+
n.value = !0;
|
|
848
|
+
}, e), n;
|
|
831
849
|
}
|
|
832
|
-
function Jt(
|
|
850
|
+
function Jt(n) {
|
|
833
851
|
const e = qt();
|
|
834
|
-
return
|
|
852
|
+
return ce(() => (e.value, !!n()));
|
|
835
853
|
}
|
|
836
|
-
function Vt(
|
|
837
|
-
const { window:
|
|
854
|
+
function Vt(n, e, t = {}) {
|
|
855
|
+
const { window: s = Ut, ...r } = t;
|
|
838
856
|
let o;
|
|
839
|
-
const a = Jt(() =>
|
|
857
|
+
const a = Jt(() => s && "MutationObserver" in s), i = () => {
|
|
840
858
|
o && (o.disconnect(), o = void 0);
|
|
841
|
-
}, u =
|
|
842
|
-
const l =
|
|
859
|
+
}, u = ce(() => {
|
|
860
|
+
const l = K(n), m = (Array.isArray(l) ? l : [l]).map(Lt).filter(Dt);
|
|
843
861
|
return new Set(m);
|
|
844
|
-
}), c =
|
|
862
|
+
}), c = ae(
|
|
845
863
|
() => u.value,
|
|
846
864
|
(l) => {
|
|
847
865
|
i(), a.value && l.size && (o = new MutationObserver(e), l.forEach((m) => o.observe(m, r)));
|
|
@@ -850,25 +868,25 @@ function Vt(s, e, t = {}) {
|
|
|
850
868
|
), p = () => o?.takeRecords(), f = () => {
|
|
851
869
|
c(), i();
|
|
852
870
|
};
|
|
853
|
-
return
|
|
871
|
+
return Ot(f), {
|
|
854
872
|
isSupported: a,
|
|
855
873
|
stop: f,
|
|
856
874
|
takeRecords: p
|
|
857
875
|
};
|
|
858
876
|
}
|
|
859
|
-
function zt(
|
|
860
|
-
var t,
|
|
877
|
+
function zt(n = null, e = {}) {
|
|
878
|
+
var t, s, r;
|
|
861
879
|
const {
|
|
862
880
|
document: o = Nt,
|
|
863
881
|
restoreOnUnmount: a = (f) => f
|
|
864
|
-
} = e, i = (t = o?.title) != null ? t : "", u = Tt((
|
|
882
|
+
} = e, i = (t = o?.title) != null ? t : "", u = Tt((s = n ?? o?.title) != null ? s : null), c = n && typeof n == "function";
|
|
865
883
|
function p(f) {
|
|
866
884
|
if (!("titleTemplate" in e))
|
|
867
885
|
return f;
|
|
868
886
|
const l = e.titleTemplate || "%s";
|
|
869
|
-
return typeof l == "function" ? l(f) :
|
|
887
|
+
return typeof l == "function" ? l(f) : K(l).replace(/%s/g, f);
|
|
870
888
|
}
|
|
871
|
-
return
|
|
889
|
+
return ae(
|
|
872
890
|
u,
|
|
873
891
|
(f, l) => {
|
|
874
892
|
f !== l && o && (o.title = p(typeof f == "string" ? f : ""));
|
|
@@ -887,33 +905,33 @@ function zt(s = null, e = {}) {
|
|
|
887
905
|
}
|
|
888
906
|
}), u;
|
|
889
907
|
}
|
|
890
|
-
const
|
|
908
|
+
const se = ue({
|
|
891
909
|
name: "VtjPageContainer",
|
|
892
910
|
async setup() {
|
|
893
|
-
const
|
|
894
|
-
return
|
|
895
|
-
provider:
|
|
911
|
+
const n = _e(), e = le(), t = e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null;
|
|
912
|
+
return s && zt(s.title || "VTJ"), {
|
|
913
|
+
provider: n,
|
|
896
914
|
component: r,
|
|
897
|
-
file:
|
|
915
|
+
file: s,
|
|
898
916
|
query: e.query
|
|
899
917
|
};
|
|
900
918
|
},
|
|
901
919
|
render() {
|
|
902
|
-
return this.component ?
|
|
920
|
+
return this.component ? U(this.component, this.query) : U("div", "页面不存在");
|
|
903
921
|
}
|
|
904
|
-
}),
|
|
922
|
+
}), Kt = ue({
|
|
905
923
|
name: "VtjStartupContainer",
|
|
906
924
|
render() {
|
|
907
|
-
return
|
|
925
|
+
return U(Ve);
|
|
908
926
|
}
|
|
909
|
-
}),
|
|
910
|
-
var
|
|
911
|
-
class Gt extends
|
|
927
|
+
}), ye = Symbol("Provider");
|
|
928
|
+
var Wt = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(Wt || {});
|
|
929
|
+
class Gt extends Se {
|
|
912
930
|
constructor(e) {
|
|
913
931
|
super(), this.options = e;
|
|
914
932
|
const {
|
|
915
933
|
service: t,
|
|
916
|
-
mode:
|
|
934
|
+
mode: s = _.Raw,
|
|
917
935
|
dependencies: r,
|
|
918
936
|
materials: o,
|
|
919
937
|
project: a = {},
|
|
@@ -925,14 +943,14 @@ class Gt extends we {
|
|
|
925
943
|
nodeEnv: l = "development"
|
|
926
944
|
/* Development */
|
|
927
945
|
} = e;
|
|
928
|
-
this.mode =
|
|
946
|
+
this.mode = s, this.modules = c, this.service = t, this.router = p, this.materialPath = f, this.nodeEnv = l, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, u), Object.assign(this.adapter, i);
|
|
929
947
|
const { access: m, request: d } = this.adapter;
|
|
930
|
-
m && m.connect({ mode:
|
|
948
|
+
m && m.connect({ mode: s, router: p, request: d }), s !== _.Design && this.load(a);
|
|
931
949
|
}
|
|
932
950
|
mode;
|
|
933
951
|
globals = {};
|
|
934
952
|
modules = {};
|
|
935
|
-
adapter = { request:
|
|
953
|
+
adapter = { request: nt, jsonp: Ae };
|
|
936
954
|
apis = {};
|
|
937
955
|
dependencies = {};
|
|
938
956
|
materials = {};
|
|
@@ -948,16 +966,16 @@ class Gt extends we {
|
|
|
948
966
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
949
967
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
950
968
|
throw new Error("project is null");
|
|
951
|
-
const { apis:
|
|
952
|
-
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" ? await this.loadAssets(o) : await this.loadDependencies(o), this.apis = it(
|
|
969
|
+
const { apis: s = [], meta: r = [] } = this.project, o = window;
|
|
970
|
+
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" ? await this.loadAssets(o) : await this.loadDependencies(o), this.apis = it(s, r, this.adapter), pe(), this.project.config?.mock && at(s), this.initRouter(), this.triggerReady();
|
|
953
971
|
}
|
|
954
972
|
async loadDependencies(e) {
|
|
955
973
|
const t = Object.entries(this.dependencies);
|
|
956
|
-
for (const [
|
|
957
|
-
e[
|
|
974
|
+
for (const [s, r] of t)
|
|
975
|
+
e[s] || (e[s] = await r());
|
|
958
976
|
}
|
|
959
977
|
async loadAssets(e) {
|
|
960
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
|
978
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
|
961
979
|
libraryExports: u,
|
|
962
980
|
libraryMap: c,
|
|
963
981
|
materials: p,
|
|
@@ -970,25 +988,25 @@ class Gt extends we {
|
|
|
970
988
|
/* Development */
|
|
971
989
|
);
|
|
972
990
|
for (const d of u) {
|
|
973
|
-
const h =
|
|
974
|
-
if (
|
|
975
|
-
r[d] =
|
|
991
|
+
const h = s[d], w = e[d];
|
|
992
|
+
if (w)
|
|
993
|
+
r[d] = w;
|
|
976
994
|
else if (h)
|
|
977
995
|
e[d] = r[d] = await h();
|
|
978
996
|
else {
|
|
979
997
|
const v = c[d] || [];
|
|
980
998
|
for (const g of v)
|
|
981
|
-
|
|
999
|
+
V(g) && await Xe(d, b.append(g, { v: R })), z(g) && await X(b.append(g, { v: R }));
|
|
982
1000
|
r[d] = e[d];
|
|
983
1001
|
}
|
|
984
1002
|
}
|
|
985
1003
|
for (const d of p)
|
|
986
|
-
await X(b.append(d, { v:
|
|
1004
|
+
await X(b.append(d, { v: R }));
|
|
987
1005
|
const m = this.materials || {};
|
|
988
1006
|
for (const d of f) {
|
|
989
|
-
const h = e[l[d]],
|
|
990
|
-
if (
|
|
991
|
-
h &&
|
|
1007
|
+
const h = e[l[d]], w = $e[d];
|
|
1008
|
+
if (w)
|
|
1009
|
+
h && w.forEach((v) => {
|
|
992
1010
|
o[v] = h[v];
|
|
993
1011
|
});
|
|
994
1012
|
else {
|
|
@@ -1004,27 +1022,27 @@ class Gt extends we {
|
|
|
1004
1022
|
e && (e.addRoute({
|
|
1005
1023
|
path: "/page/:id",
|
|
1006
1024
|
name: "VtjPage",
|
|
1007
|
-
component:
|
|
1025
|
+
component: se
|
|
1008
1026
|
}), e.addRoute({
|
|
1009
1027
|
path: "/",
|
|
1010
1028
|
name: "VtjHomepage",
|
|
1011
|
-
component: t?.homepage ?
|
|
1029
|
+
component: t?.homepage ? se : Kt
|
|
1012
1030
|
}));
|
|
1013
1031
|
}
|
|
1014
1032
|
install(e) {
|
|
1015
1033
|
const t = e.config.globalProperties.installed || {};
|
|
1016
|
-
for (const [
|
|
1017
|
-
!t[
|
|
1018
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
|
1019
|
-
const a = r?.$options.name, i = typeof
|
|
1034
|
+
for (const [s, r] of Object.entries(this.library))
|
|
1035
|
+
!t[s] && tt(r) && (e.use(r), t[s] = !0);
|
|
1036
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(ye, this), e.config.globalProperties.installed = t, this.nodeEnv === "development" && (e.config.errorHandler = (s, r, o) => {
|
|
1037
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", u = `[ ${a} ] ${i} ${o}`;
|
|
1020
1038
|
console.error(
|
|
1021
1039
|
"[VTJ Error]:",
|
|
1022
1040
|
{
|
|
1023
|
-
err:
|
|
1041
|
+
err: s,
|
|
1024
1042
|
instance: r,
|
|
1025
1043
|
info: o
|
|
1026
1044
|
},
|
|
1027
|
-
|
|
1045
|
+
s?.stack
|
|
1028
1046
|
), D.error({
|
|
1029
1047
|
title: "运行时错误:请在控制台查看详情",
|
|
1030
1048
|
message: u
|
|
@@ -1033,21 +1051,21 @@ class Gt extends we {
|
|
|
1033
1051
|
}
|
|
1034
1052
|
getFile(e) {
|
|
1035
1053
|
const { blocks: t = [] } = this.project || {};
|
|
1036
|
-
return this.getPage(e) || t.find((
|
|
1054
|
+
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
|
1037
1055
|
}
|
|
1038
1056
|
getPage(e) {
|
|
1039
|
-
const { pages: t = [] } = this.project || {},
|
|
1057
|
+
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
|
1040
1058
|
for (const a of o) {
|
|
1041
1059
|
if (a.id === r)
|
|
1042
1060
|
return a;
|
|
1043
1061
|
if (a.children && a.children.length) {
|
|
1044
|
-
const i =
|
|
1062
|
+
const i = s(r, a.children);
|
|
1045
1063
|
if (i)
|
|
1046
1064
|
return i;
|
|
1047
1065
|
}
|
|
1048
1066
|
}
|
|
1049
1067
|
};
|
|
1050
|
-
return
|
|
1068
|
+
return s(e, t) || null;
|
|
1051
1069
|
}
|
|
1052
1070
|
getHomepage() {
|
|
1053
1071
|
const { homepage: e } = this.project || {};
|
|
@@ -1066,23 +1084,23 @@ class Gt extends we {
|
|
|
1066
1084
|
validSuccess: !1,
|
|
1067
1085
|
originResponse: !0
|
|
1068
1086
|
}
|
|
1069
|
-
}).then((
|
|
1087
|
+
}).then((s) => s.data).catch(() => null));
|
|
1070
1088
|
}
|
|
1071
1089
|
createDslRenderer(e, t = {}) {
|
|
1072
|
-
const { library:
|
|
1090
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
|
1073
1091
|
mode: o,
|
|
1074
|
-
Vue:
|
|
1092
|
+
Vue: s.Vue,
|
|
1075
1093
|
components: r,
|
|
1076
|
-
libs:
|
|
1094
|
+
libs: s,
|
|
1077
1095
|
apis: a,
|
|
1078
1096
|
window,
|
|
1079
1097
|
...t
|
|
1080
|
-
}, u =
|
|
1098
|
+
}, u = L({
|
|
1081
1099
|
getDsl: async (c) => await this.getDsl(c) || null,
|
|
1082
1100
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
|
1083
1101
|
options: i
|
|
1084
1102
|
});
|
|
1085
|
-
return
|
|
1103
|
+
return N({
|
|
1086
1104
|
...i,
|
|
1087
1105
|
dsl: e,
|
|
1088
1106
|
loader: u
|
|
@@ -1091,39 +1109,39 @@ class Gt extends we {
|
|
|
1091
1109
|
async getRenderComponent(e) {
|
|
1092
1110
|
const t = this.getFile(e);
|
|
1093
1111
|
if (!t)
|
|
1094
|
-
return
|
|
1095
|
-
const
|
|
1112
|
+
return A.warn(`Can not find file: ${e}`), null;
|
|
1113
|
+
const s = `.vtj/vue/${e}.vue`, r = this.modules[s];
|
|
1096
1114
|
if (r)
|
|
1097
1115
|
return (await r())?.default;
|
|
1098
1116
|
const o = await this.getDsl(t.id);
|
|
1099
|
-
return o ? this.createDslRenderer(o).renderer : (
|
|
1117
|
+
return o ? this.createDslRenderer(o).renderer : (A.warn(`Can not find dsl: ${e}`), null);
|
|
1100
1118
|
}
|
|
1101
1119
|
defineUrlSchemaComponent(e, t) {
|
|
1102
1120
|
return Z(async () => {
|
|
1103
|
-
const
|
|
1104
|
-
return
|
|
1121
|
+
const s = await this.getDslByUrl(e);
|
|
1122
|
+
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
|
1105
1123
|
});
|
|
1106
1124
|
}
|
|
1107
1125
|
definePluginComponent(e) {
|
|
1108
|
-
return Z(async () => await
|
|
1126
|
+
return Z(async () => await me(e, window));
|
|
1109
1127
|
}
|
|
1110
1128
|
}
|
|
1111
|
-
function
|
|
1112
|
-
const e = new Gt(
|
|
1129
|
+
function fs(n) {
|
|
1130
|
+
const e = new Gt(n);
|
|
1113
1131
|
return {
|
|
1114
1132
|
provider: e,
|
|
1115
|
-
onReady: (
|
|
1133
|
+
onReady: (s) => e.ready(s)
|
|
1116
1134
|
};
|
|
1117
1135
|
}
|
|
1118
|
-
function
|
|
1119
|
-
const e =
|
|
1136
|
+
function _e(n = {}) {
|
|
1137
|
+
const e = oe(ye);
|
|
1120
1138
|
if (!e)
|
|
1121
1139
|
throw new Error("Can not find provider");
|
|
1122
1140
|
if (e.nodeEnv === "development") {
|
|
1123
|
-
const { id: t, version:
|
|
1124
|
-
t &&
|
|
1141
|
+
const { id: t, version: s } = n;
|
|
1142
|
+
t && s && (async () => {
|
|
1125
1143
|
const r = await e.getDsl(t);
|
|
1126
|
-
r?.__VERSION__ !==
|
|
1144
|
+
r?.__VERSION__ !== s && D.warning({
|
|
1127
1145
|
title: r?.name,
|
|
1128
1146
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
1129
1147
|
});
|
|
@@ -1131,29 +1149,29 @@ function ye(s = {}) {
|
|
|
1131
1149
|
}
|
|
1132
1150
|
return e;
|
|
1133
1151
|
}
|
|
1134
|
-
const W = new
|
|
1152
|
+
const W = new He({
|
|
1135
1153
|
settings: {
|
|
1136
1154
|
type: "json",
|
|
1137
1155
|
validSuccess: !0,
|
|
1138
1156
|
originResponse: !1,
|
|
1139
1157
|
failMessage: !0,
|
|
1140
|
-
validate: (
|
|
1141
|
-
showError: (
|
|
1158
|
+
validate: (n) => n.data?.code === 0,
|
|
1159
|
+
showError: (n) => {
|
|
1142
1160
|
D.error({
|
|
1143
|
-
message:
|
|
1161
|
+
message: n || "未知错误"
|
|
1144
1162
|
});
|
|
1145
1163
|
}
|
|
1146
1164
|
}
|
|
1147
|
-
}), Yt = (
|
|
1148
|
-
url:
|
|
1165
|
+
}), Yt = (n = "/__vtj__/api/:type.json") => (e, t) => W.send({
|
|
1166
|
+
url: n,
|
|
1149
1167
|
method: "post",
|
|
1150
1168
|
params: { type: e },
|
|
1151
1169
|
data: {
|
|
1152
1170
|
type: e,
|
|
1153
1171
|
data: t
|
|
1154
1172
|
}
|
|
1155
|
-
}), Qt = (
|
|
1156
|
-
url:
|
|
1173
|
+
}), Qt = (n = "/__vtj__/api/uploader.json") => async (e, t) => await W.send({
|
|
1174
|
+
url: n,
|
|
1157
1175
|
method: "post",
|
|
1158
1176
|
data: {
|
|
1159
1177
|
files: e,
|
|
@@ -1162,8 +1180,8 @@ const W = new Oe({
|
|
|
1162
1180
|
settings: {
|
|
1163
1181
|
type: "data"
|
|
1164
1182
|
}
|
|
1165
|
-
}).then((
|
|
1166
|
-
class
|
|
1183
|
+
}).then((s) => s && s[0] ? s[0] : null).catch(() => null);
|
|
1184
|
+
class G {
|
|
1167
1185
|
api;
|
|
1168
1186
|
pluginCaches = {};
|
|
1169
1187
|
uploader;
|
|
@@ -1241,11 +1259,11 @@ class K {
|
|
|
1241
1259
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1242
1260
|
}
|
|
1243
1261
|
async getPluginMaterial(e) {
|
|
1244
|
-
const { urls: t = [] } = e,
|
|
1245
|
-
if (!
|
|
1246
|
-
const r = this.pluginCaches[
|
|
1247
|
-
return r || (this.pluginCaches[
|
|
1248
|
-
url:
|
|
1262
|
+
const { urls: t = [] } = e, s = t.filter((o) => We(o))[0];
|
|
1263
|
+
if (!s) return null;
|
|
1264
|
+
const r = this.pluginCaches[s];
|
|
1265
|
+
return r || (this.pluginCaches[s] = W.send({
|
|
1266
|
+
url: s,
|
|
1249
1267
|
method: "get",
|
|
1250
1268
|
settings: {
|
|
1251
1269
|
validSuccess: !1,
|
|
@@ -1254,14 +1272,14 @@ class K {
|
|
|
1254
1272
|
}).then((o) => o.data).catch(() => null));
|
|
1255
1273
|
}
|
|
1256
1274
|
}
|
|
1257
|
-
const y = new
|
|
1275
|
+
const y = new Oe({
|
|
1258
1276
|
type: "local",
|
|
1259
1277
|
expired: 0,
|
|
1260
1278
|
prefix: "__VTJ_"
|
|
1261
1279
|
});
|
|
1262
|
-
class
|
|
1280
|
+
class ds extends G {
|
|
1263
1281
|
init(e) {
|
|
1264
|
-
const t = new I(e),
|
|
1282
|
+
const t = new I(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
1265
1283
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
1266
1284
|
}
|
|
1267
1285
|
saveProject(e) {
|
|
@@ -1269,7 +1287,7 @@ class pn extends K {
|
|
|
1269
1287
|
return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
1270
1288
|
}
|
|
1271
1289
|
saveMaterials(e, t) {
|
|
1272
|
-
return y.save(`materials_${e.id}`,
|
|
1290
|
+
return y.save(`materials_${e.id}`, q(t)), Promise.resolve(!0);
|
|
1273
1291
|
}
|
|
1274
1292
|
saveFile(e) {
|
|
1275
1293
|
return y.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -1293,30 +1311,30 @@ class pn extends K {
|
|
|
1293
1311
|
return Promise.resolve(!0);
|
|
1294
1312
|
}
|
|
1295
1313
|
getHistory(e) {
|
|
1296
|
-
const t = y.get(`history_${e}`),
|
|
1297
|
-
return Promise.resolve(
|
|
1314
|
+
const t = y.get(`history_${e}`), s = new ne(t || { id: e });
|
|
1315
|
+
return Promise.resolve(s.toDsl());
|
|
1298
1316
|
}
|
|
1299
1317
|
getHistoryItem(e, t) {
|
|
1300
|
-
const
|
|
1301
|
-
return Promise.resolve(
|
|
1318
|
+
const s = y.get(`history_${e}_${t}`);
|
|
1319
|
+
return Promise.resolve(s);
|
|
1302
1320
|
}
|
|
1303
1321
|
saveHistoryItem(e, t) {
|
|
1304
1322
|
return y.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
|
1305
1323
|
}
|
|
1306
1324
|
removeHistoryItem(e, t) {
|
|
1307
|
-
return t.forEach((
|
|
1308
|
-
y.remove(`history_${e}_${
|
|
1325
|
+
return t.forEach((s) => {
|
|
1326
|
+
y.remove(`history_${e}_${s}`);
|
|
1309
1327
|
}), Promise.resolve(!0);
|
|
1310
1328
|
}
|
|
1311
1329
|
}
|
|
1312
|
-
class Xt extends
|
|
1330
|
+
class Xt extends G {
|
|
1313
1331
|
projects = {};
|
|
1314
1332
|
materials = {};
|
|
1315
1333
|
files = {};
|
|
1316
1334
|
histories = {};
|
|
1317
1335
|
historyItems = {};
|
|
1318
1336
|
init(e) {
|
|
1319
|
-
const t = new I(e),
|
|
1337
|
+
const t = new I(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
|
1320
1338
|
return this.projects[r.id] = r, Promise.resolve(r);
|
|
1321
1339
|
}
|
|
1322
1340
|
saveProject(e) {
|
|
@@ -1324,7 +1342,7 @@ class Xt extends K {
|
|
|
1324
1342
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
1325
1343
|
}
|
|
1326
1344
|
saveMaterials(e, t) {
|
|
1327
|
-
return e.id && (this.materials[e.id] =
|
|
1345
|
+
return e.id && (this.materials[e.id] = q(t)), Promise.resolve(!0);
|
|
1328
1346
|
}
|
|
1329
1347
|
saveFile(e) {
|
|
1330
1348
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1348,29 +1366,29 @@ class Xt extends K {
|
|
|
1348
1366
|
return Promise.resolve(!0);
|
|
1349
1367
|
}
|
|
1350
1368
|
getHistory(e) {
|
|
1351
|
-
const t = this.histories[e],
|
|
1352
|
-
return Promise.resolve(
|
|
1369
|
+
const t = this.histories[e], s = new ne(t || { id: e });
|
|
1370
|
+
return Promise.resolve(s);
|
|
1353
1371
|
}
|
|
1354
1372
|
getHistoryItem(e, t) {
|
|
1355
|
-
const
|
|
1373
|
+
const s = `${e}_${t}`, r = this.historyItems[s] || {};
|
|
1356
1374
|
return Promise.resolve(r);
|
|
1357
1375
|
}
|
|
1358
1376
|
saveHistoryItem(e, t) {
|
|
1359
|
-
const
|
|
1360
|
-
return this.historyItems[
|
|
1377
|
+
const s = `${e}_${t.id}`;
|
|
1378
|
+
return this.historyItems[s] = t, Promise.resolve(!0);
|
|
1361
1379
|
}
|
|
1362
1380
|
removeHistoryItem(e, t) {
|
|
1363
|
-
return t.forEach((
|
|
1364
|
-
const r = `${e}_${
|
|
1381
|
+
return t.forEach((s) => {
|
|
1382
|
+
const r = `${e}_${s}`;
|
|
1365
1383
|
delete this.historyItems[r];
|
|
1366
1384
|
}), Promise.resolve(!0);
|
|
1367
1385
|
}
|
|
1368
1386
|
}
|
|
1369
1387
|
let x = null;
|
|
1370
|
-
function
|
|
1388
|
+
function ps() {
|
|
1371
1389
|
return x || (x = new Xt(), x);
|
|
1372
1390
|
}
|
|
1373
|
-
class
|
|
1391
|
+
class hs extends G {
|
|
1374
1392
|
getFileCaches = {};
|
|
1375
1393
|
async getExtension() {
|
|
1376
1394
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1385,7 +1403,7 @@ class mn extends K {
|
|
|
1385
1403
|
async saveMaterials(e, t) {
|
|
1386
1404
|
return !!await this.api("saveMaterials", {
|
|
1387
1405
|
project: e,
|
|
1388
|
-
materials:
|
|
1406
|
+
materials: q(t)
|
|
1389
1407
|
}).catch(() => !1);
|
|
1390
1408
|
}
|
|
1391
1409
|
async saveFile(e) {
|
|
@@ -1425,95 +1443,95 @@ class mn extends K {
|
|
|
1425
1443
|
);
|
|
1426
1444
|
}
|
|
1427
1445
|
}
|
|
1428
|
-
function
|
|
1429
|
-
return
|
|
1430
|
-
const { id: t, title:
|
|
1446
|
+
function we(n = []) {
|
|
1447
|
+
return n.map((e) => {
|
|
1448
|
+
const { id: t, title: s, icon: r, children: o, hidden: a } = e;
|
|
1431
1449
|
return {
|
|
1432
1450
|
id: t,
|
|
1433
|
-
title:
|
|
1451
|
+
title: s,
|
|
1434
1452
|
icon: r,
|
|
1435
1453
|
hidden: a,
|
|
1436
1454
|
url: `/page/${t}`,
|
|
1437
|
-
children: o && o.length ?
|
|
1455
|
+
children: o && o.length ? we(o) : void 0
|
|
1438
1456
|
};
|
|
1439
1457
|
});
|
|
1440
1458
|
}
|
|
1441
|
-
function
|
|
1442
|
-
const
|
|
1459
|
+
function ms() {
|
|
1460
|
+
const n = _e(), e = le(), t = J(!1), s = n.project;
|
|
1443
1461
|
qe(() => {
|
|
1444
1462
|
const { name: a, params: i, meta: u } = e;
|
|
1445
1463
|
if (a === "VtjPage") {
|
|
1446
|
-
const c =
|
|
1464
|
+
const c = n.getPage(i.id);
|
|
1447
1465
|
t.value = !c?.mask;
|
|
1448
1466
|
} else if (a === "VtjHomepage") {
|
|
1449
|
-
const c =
|
|
1467
|
+
const c = n.getHomepage();
|
|
1450
1468
|
t.value = !c?.mask;
|
|
1451
1469
|
} else
|
|
1452
1470
|
t.value = !u.mask;
|
|
1453
1471
|
});
|
|
1454
|
-
const r =
|
|
1472
|
+
const r = we(s?.pages), o = s?.config;
|
|
1455
1473
|
return {
|
|
1456
1474
|
disabled: t,
|
|
1457
1475
|
logo: o?.logo,
|
|
1458
1476
|
themeSwitchable: o?.themeSwitchable,
|
|
1459
|
-
title: o?.title ||
|
|
1477
|
+
title: o?.title || s?.description || s?.name || "VTJ App",
|
|
1460
1478
|
menus: r
|
|
1461
1479
|
};
|
|
1462
1480
|
}
|
|
1463
1481
|
export {
|
|
1464
|
-
|
|
1465
|
-
|
|
1482
|
+
he as ACCESS_KEY,
|
|
1483
|
+
us as Access,
|
|
1466
1484
|
ze as BUILT_IN_DIRECTIVES,
|
|
1467
|
-
|
|
1485
|
+
G as BaseService,
|
|
1468
1486
|
ee as CONTEXT_HOST,
|
|
1469
1487
|
lt as Context,
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1488
|
+
_ as ContextMode,
|
|
1489
|
+
Ke as DATA_TYPES,
|
|
1490
|
+
cs as JSCodeToString,
|
|
1491
|
+
os as LIFE_CYCLES_LIST,
|
|
1492
|
+
hs as LocalService,
|
|
1475
1493
|
Xt as MemoryService,
|
|
1476
|
-
|
|
1494
|
+
Wt as NodeEnv,
|
|
1477
1495
|
Gt as Provider,
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1496
|
+
ds as StorageService,
|
|
1497
|
+
R as VTJ_RENDERER_VERSION,
|
|
1498
|
+
de as adoptedStyleSheets,
|
|
1499
|
+
is as createAssetScripts,
|
|
1500
|
+
as as createAssetsCss,
|
|
1483
1501
|
gt as createDataSources,
|
|
1484
|
-
|
|
1485
|
-
|
|
1502
|
+
L as createLoader,
|
|
1503
|
+
ps as createMemoryService,
|
|
1486
1504
|
ot as createMetaApi,
|
|
1487
|
-
|
|
1488
|
-
|
|
1505
|
+
fs as createProvider,
|
|
1506
|
+
N as createRenderer,
|
|
1489
1507
|
rt as createSchemaApi,
|
|
1490
1508
|
it as createSchemaApis,
|
|
1491
1509
|
wt as defaultLoader,
|
|
1492
1510
|
F as fillBasePath,
|
|
1493
|
-
|
|
1494
|
-
|
|
1511
|
+
ve as getModifiers,
|
|
1512
|
+
me as getPlugin,
|
|
1495
1513
|
Qe as getRawComponent,
|
|
1496
|
-
|
|
1497
|
-
|
|
1514
|
+
V as isCSSUrl,
|
|
1515
|
+
st as isJSCode,
|
|
1498
1516
|
S as isJSExpression,
|
|
1499
1517
|
M as isJSFunction,
|
|
1500
|
-
|
|
1501
|
-
|
|
1518
|
+
We as isJSON,
|
|
1519
|
+
z as isJSUrl,
|
|
1502
1520
|
tt as isVuePlugin,
|
|
1503
1521
|
Xe as loadCss,
|
|
1504
1522
|
Ze as loadCssUrl,
|
|
1505
1523
|
et as loadScriptUrl,
|
|
1506
1524
|
ct as mockApi,
|
|
1507
1525
|
at as mockApis,
|
|
1508
|
-
|
|
1509
|
-
|
|
1526
|
+
pe as mockCleanup,
|
|
1527
|
+
H as nodeRender,
|
|
1510
1528
|
Ye as parseDeps,
|
|
1511
|
-
|
|
1529
|
+
C as parseExpression,
|
|
1512
1530
|
te as parseFunction,
|
|
1513
|
-
|
|
1531
|
+
ye as providerKey,
|
|
1514
1532
|
Ge as removeProdFlag,
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1533
|
+
fe as toString,
|
|
1534
|
+
ls as useAccess,
|
|
1535
|
+
ms as useMask,
|
|
1536
|
+
_e as useProvider
|
|
1519
1537
|
};
|