@vtj/renderer 0.8.165 → 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 +4 -4
- package/dist/index.mjs +433 -429
- package/package.json +5 -5
- package/types/plugins/access.d.ts +1 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl 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
3
|
import * as O from "vue";
|
|
4
|
-
import { inject as
|
|
5
|
-
import { useRoute as
|
|
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",
|
|
@@ -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 V(
|
|
56
|
-
return /\.css$/.test(
|
|
55
|
+
function V(n) {
|
|
56
|
+
return /\.css$/.test(n);
|
|
57
57
|
}
|
|
58
|
-
function z(
|
|
59
|
-
return /\.js$/.test(
|
|
58
|
+
function z(n) {
|
|
59
|
+
return /\.js$/.test(n);
|
|
60
60
|
}
|
|
61
|
-
function We(
|
|
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
82
|
z(v) && r.push(Ge(v, t)), V(v) && o.push(v);
|
|
83
|
-
}), d && (i.push(d), u[d] = F(l || [], e),
|
|
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 Y(
|
|
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 (A.error("parseExpression.error", r,
|
|
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 =
|
|
161
|
+
function te(n, e, t = !1, s = !1) {
|
|
162
|
+
const r = C(n, e, t, s);
|
|
163
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,31 @@ 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
|
+
prefix: s
|
|
295
296
|
}), r && T.set(o, e.token);
|
|
296
297
|
}
|
|
297
298
|
clear() {
|
|
298
|
-
const { storageKey: e, storagePrefix: t, session:
|
|
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);
|
|
303
304
|
}
|
|
304
305
|
logout() {
|
|
305
306
|
this.clear(), this.toLogin();
|
|
@@ -316,12 +317,12 @@ class ln {
|
|
|
316
317
|
return Q(e).some((r) => t[r]);
|
|
317
318
|
}
|
|
318
319
|
install(e) {
|
|
319
|
-
e.config.globalProperties.$access = this, e.provide(
|
|
320
|
+
e.config.globalProperties.$access = this, e.provide(he, this);
|
|
320
321
|
}
|
|
321
322
|
isAuthPath(e) {
|
|
322
|
-
const { auth: t, isAuth:
|
|
323
|
-
if (
|
|
324
|
-
return
|
|
323
|
+
const { auth: t, isAuth: s } = this.options;
|
|
324
|
+
if (s)
|
|
325
|
+
return s(e);
|
|
325
326
|
if (e.path && typeof t == "string") {
|
|
326
327
|
const r = t.split("#")[1] || t;
|
|
327
328
|
return e.path === r;
|
|
@@ -330,9 +331,9 @@ class ln {
|
|
|
330
331
|
}
|
|
331
332
|
toLogin() {
|
|
332
333
|
const { auth: e, redirectParam: t } = this.options;
|
|
333
|
-
if (!e) return;
|
|
334
|
-
const
|
|
335
|
-
typeof e == "function" ? e(
|
|
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;
|
|
336
337
|
}
|
|
337
338
|
loadData() {
|
|
338
339
|
const { storageKey: e, storagePrefix: t } = this.options;
|
|
@@ -346,7 +347,7 @@ class ln {
|
|
|
346
347
|
return e && t ? !!T.get(t) : !!this.data;
|
|
347
348
|
}
|
|
348
349
|
setGuard(e) {
|
|
349
|
-
e.beforeEach((t,
|
|
350
|
+
e.beforeEach((t, s, r) => this.guard(t, r));
|
|
350
351
|
}
|
|
351
352
|
guard(e, t) {
|
|
352
353
|
if (this.isWhiteList(e) || this.isLogined() || this.isAuthPath(e))
|
|
@@ -355,29 +356,32 @@ class ln {
|
|
|
355
356
|
}
|
|
356
357
|
isWhiteList(e) {
|
|
357
358
|
const { whiteList: t } = this.options;
|
|
358
|
-
return t ? Array.isArray(t) ? t.some((
|
|
359
|
+
return t ? Array.isArray(t) ? t.some((s) => e.fullPath.startsWith(s)) : t(e) : !1;
|
|
359
360
|
}
|
|
360
361
|
isUnauthorized(e) {
|
|
361
362
|
const { unauthorizedCode: t = 401 } = this.options;
|
|
362
363
|
return e.status === t || e.data.code === t;
|
|
363
364
|
}
|
|
364
365
|
async showUnauthorizedAlert(e) {
|
|
365
|
-
const { alert: t, unauthorizedMessage:
|
|
366
|
-
this.isUnauthorized(e) && t && (await
|
|
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());
|
|
367
371
|
}
|
|
368
372
|
setRequest(e) {
|
|
369
|
-
e.useRequest((t) => (t.headers.
|
|
373
|
+
e.useRequest((t) => (t.headers[this.options.authKey] = this.data?.token, t)), e.useResponse(
|
|
370
374
|
async (t) => (await this.showUnauthorizedAlert(t), t),
|
|
371
375
|
async (t) => {
|
|
372
|
-
const
|
|
373
|
-
return await this.showUnauthorizedAlert(
|
|
376
|
+
const s = t.response || t || {};
|
|
377
|
+
return await this.showUnauthorizedAlert(s), Promise.reject(t);
|
|
374
378
|
}
|
|
375
379
|
);
|
|
376
380
|
}
|
|
377
381
|
}
|
|
378
|
-
function
|
|
379
|
-
const
|
|
380
|
-
return
|
|
382
|
+
function ls() {
|
|
383
|
+
const n = oe(he, null);
|
|
384
|
+
return n || console.warn("access is null"), n;
|
|
381
385
|
}
|
|
382
386
|
class lt {
|
|
383
387
|
__id = null;
|
|
@@ -405,14 +409,14 @@ class lt {
|
|
|
405
409
|
$apis = {};
|
|
406
410
|
__transform = {};
|
|
407
411
|
constructor(e) {
|
|
408
|
-
const { mode: t, dsl:
|
|
409
|
-
this.__mode = t,
|
|
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);
|
|
410
414
|
}
|
|
411
415
|
setup(e, t = O) {
|
|
412
|
-
const
|
|
413
|
-
if (!
|
|
414
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
|
415
|
-
const r =
|
|
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;
|
|
416
420
|
Object.assign(this, r), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
|
417
421
|
this.__proxy();
|
|
418
422
|
}), t.onUnmounted(() => {
|
|
@@ -433,60 +437,60 @@ class lt {
|
|
|
433
437
|
}
|
|
434
438
|
__parseFunction(e) {
|
|
435
439
|
if (e)
|
|
436
|
-
if (this.__mode ===
|
|
437
|
-
const { id: t, type:
|
|
438
|
-
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);
|
|
439
443
|
} else
|
|
440
444
|
return te(e, this);
|
|
441
445
|
}
|
|
442
446
|
__parseExpression(e) {
|
|
443
447
|
if (e)
|
|
444
|
-
if (this.__mode ===
|
|
445
|
-
const { id: t, type:
|
|
446
|
-
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);
|
|
447
451
|
} else
|
|
448
|
-
return
|
|
452
|
+
return C(e, this);
|
|
449
453
|
}
|
|
450
454
|
__ref(e = null, t) {
|
|
451
|
-
if (this.__mode !==
|
|
452
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
|
453
|
-
await
|
|
454
|
-
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;
|
|
455
459
|
if (!r) {
|
|
456
460
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
457
461
|
return;
|
|
458
462
|
}
|
|
459
|
-
if (r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e,
|
|
460
|
-
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);
|
|
461
465
|
else if (t) {
|
|
462
466
|
const o = this.$refs[t];
|
|
463
|
-
if (o &&
|
|
464
|
-
const a = new Set([].concat(o,
|
|
467
|
+
if (o && s !== o) {
|
|
468
|
+
const a = new Set([].concat(o, s));
|
|
465
469
|
this.$refs[t] = Array.from(a);
|
|
466
470
|
} else
|
|
467
|
-
this.$refs[t] =
|
|
471
|
+
this.$refs[t] = s;
|
|
468
472
|
}
|
|
469
|
-
return
|
|
473
|
+
return s;
|
|
470
474
|
};
|
|
471
475
|
}
|
|
472
476
|
__clone(e = {}) {
|
|
473
|
-
const t = { ...this.context, ...e },
|
|
477
|
+
const t = { ...this.context, ...e }, s = {
|
|
474
478
|
...t,
|
|
475
479
|
context: t
|
|
476
480
|
};
|
|
477
|
-
return
|
|
481
|
+
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
|
478
482
|
}
|
|
479
483
|
}
|
|
480
|
-
function N(
|
|
484
|
+
function N(n) {
|
|
481
485
|
const {
|
|
482
486
|
Vue: e = O,
|
|
483
|
-
mode: t =
|
|
484
|
-
components:
|
|
487
|
+
mode: t = _.Runtime,
|
|
488
|
+
components: s = {},
|
|
485
489
|
libs: r = {},
|
|
486
490
|
apis: o = {},
|
|
487
491
|
loader: a
|
|
488
|
-
} =
|
|
489
|
-
$components:
|
|
492
|
+
} = n, i = e.computed(() => n.dsl), u = {
|
|
493
|
+
$components: s,
|
|
490
494
|
$libs: r,
|
|
491
495
|
$apis: o
|
|
492
496
|
}, c = new lt({
|
|
@@ -499,21 +503,21 @@ function N(s) {
|
|
|
499
503
|
...dt(i.value.props ?? [], c)
|
|
500
504
|
},
|
|
501
505
|
setup(f) {
|
|
502
|
-
c.$props = f, c.props = f, i.value.id &&
|
|
503
|
-
|
|
506
|
+
c.$props = f, c.props = f, i.value.id && de(
|
|
507
|
+
n.window || window,
|
|
504
508
|
i.value.id,
|
|
505
509
|
i.value.css || ""
|
|
506
510
|
), c.state = pt(e, i.value.state ?? {}, c);
|
|
507
511
|
const l = ht(e, i.value.computed ?? {}, c), m = mt(i.value.methods ?? {}, c), d = vt(e, i.value.inject, c), h = gt(
|
|
508
512
|
i.value.dataSources || {},
|
|
509
513
|
c
|
|
510
|
-
),
|
|
514
|
+
), w = {
|
|
511
515
|
...d,
|
|
512
516
|
...l,
|
|
513
517
|
...m,
|
|
514
518
|
...h
|
|
515
519
|
};
|
|
516
|
-
return c.setup(
|
|
520
|
+
return c.setup(w, e), yt(e, i.value.watch ?? [], c), {
|
|
517
521
|
vtj: c
|
|
518
522
|
};
|
|
519
523
|
},
|
|
@@ -531,66 +535,66 @@ function N(s) {
|
|
|
531
535
|
context: c
|
|
532
536
|
};
|
|
533
537
|
}
|
|
534
|
-
function ft(
|
|
535
|
-
return
|
|
538
|
+
function ft(n = []) {
|
|
539
|
+
return n.map((e) => $(e) ? e : e.name);
|
|
536
540
|
}
|
|
537
|
-
function dt(
|
|
538
|
-
const t = (
|
|
539
|
-
return
|
|
540
|
-
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
|
|
541
545
|
} : {
|
|
542
|
-
name:
|
|
543
|
-
type:
|
|
544
|
-
required:
|
|
545
|
-
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
|
|
546
550
|
}).reduce(
|
|
547
|
-
(
|
|
551
|
+
(s, r) => (s[r.name] = {
|
|
548
552
|
type: t(r.type),
|
|
549
553
|
required: r.required,
|
|
550
554
|
default: r.default
|
|
551
|
-
},
|
|
555
|
+
}, s),
|
|
552
556
|
{}
|
|
553
557
|
);
|
|
554
558
|
}
|
|
555
|
-
function pt(
|
|
556
|
-
return
|
|
559
|
+
function pt(n, e, t) {
|
|
560
|
+
return n.reactive(
|
|
557
561
|
Object.keys(e || {}).reduce(
|
|
558
|
-
(
|
|
562
|
+
(s, r) => {
|
|
559
563
|
let o = e[r];
|
|
560
|
-
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;
|
|
561
565
|
},
|
|
562
566
|
{}
|
|
563
567
|
)
|
|
564
568
|
);
|
|
565
569
|
}
|
|
566
|
-
function ht(
|
|
570
|
+
function ht(n, e, t) {
|
|
567
571
|
return Object.entries(e ?? {}).reduce(
|
|
568
|
-
(
|
|
572
|
+
(s, [r, o]) => (s[r] = n.computed(t.__parseFunction(o)), s),
|
|
569
573
|
{}
|
|
570
574
|
);
|
|
571
575
|
}
|
|
572
|
-
function mt(
|
|
573
|
-
return Object.entries(
|
|
574
|
-
(t, [
|
|
576
|
+
function mt(n, e) {
|
|
577
|
+
return Object.entries(n ?? {}).reduce(
|
|
578
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
575
579
|
{}
|
|
576
580
|
);
|
|
577
581
|
}
|
|
578
|
-
function vt(
|
|
582
|
+
function vt(n, e = [], t) {
|
|
579
583
|
return e.reduce(
|
|
580
|
-
(
|
|
584
|
+
(s, r) => {
|
|
581
585
|
const { name: o, from: a } = r || {};
|
|
582
586
|
r.default;
|
|
583
587
|
const i = S(a) ? t.__parseExpression(a) || o : a ?? o, u = S(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
|
584
|
-
return
|
|
588
|
+
return s[o] = n.inject(i, u), s;
|
|
585
589
|
},
|
|
586
590
|
{}
|
|
587
591
|
);
|
|
588
592
|
}
|
|
589
|
-
function gt(
|
|
590
|
-
return Object.keys(
|
|
591
|
-
(t,
|
|
592
|
-
const r = s
|
|
593
|
-
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) => {
|
|
594
598
|
const u = await o.apply(e, i);
|
|
595
599
|
return a ? a(u) : u;
|
|
596
600
|
}, t;
|
|
@@ -598,179 +602,179 @@ function gt(s, e) {
|
|
|
598
602
|
{}
|
|
599
603
|
);
|
|
600
604
|
}
|
|
601
|
-
function yt(
|
|
602
|
-
e.forEach((
|
|
603
|
-
|
|
604
|
-
t.__parseExpression(
|
|
605
|
-
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),
|
|
606
610
|
{
|
|
607
|
-
deep:
|
|
608
|
-
immediate:
|
|
611
|
+
deep: s.deep,
|
|
612
|
+
immediate: s.immediate
|
|
609
613
|
}
|
|
610
614
|
);
|
|
611
615
|
});
|
|
612
616
|
}
|
|
613
|
-
function _t(
|
|
614
|
-
return Object.entries(
|
|
615
|
-
(t, [
|
|
617
|
+
function _t(n, e) {
|
|
618
|
+
return Object.entries(n ?? {}).reduce(
|
|
619
|
+
(t, [s, r]) => (t[s] = e.__parseFunction(r), t),
|
|
616
620
|
{}
|
|
617
621
|
);
|
|
618
622
|
}
|
|
619
623
|
let B = [];
|
|
620
|
-
const wt = (
|
|
621
|
-
async function
|
|
622
|
-
const { urls: t = [], library:
|
|
623
|
-
if (r.length === 0 || !
|
|
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;
|
|
624
628
|
const o = t.filter((i) => V(i));
|
|
625
|
-
return o.length && Ze(o, e), await et(r,
|
|
626
|
-
(i) => (console.warn("loadScriptUrl error", r,
|
|
629
|
+
return o.length && Ze(o, e), await et(r, s, e).catch(
|
|
630
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
|
627
631
|
);
|
|
628
632
|
}
|
|
629
|
-
function L(
|
|
630
|
-
const { getDsl: e, getDslByUrl: t, options:
|
|
631
|
-
return
|
|
632
|
-
delete
|
|
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];
|
|
633
637
|
}), B = []), (r, o, a = O) => !o || typeof o == "string" ? r : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
634
638
|
const i = await e(o.id);
|
|
635
639
|
return i && (i.name = r), i ? N({
|
|
636
|
-
...
|
|
640
|
+
...s,
|
|
637
641
|
Vue: a,
|
|
638
642
|
dsl: i,
|
|
639
|
-
mode:
|
|
640
|
-
loader: L(
|
|
643
|
+
mode: _.Runtime,
|
|
644
|
+
loader: L(n)
|
|
641
645
|
}).renderer : null;
|
|
642
646
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
|
643
647
|
const i = await t(o.url);
|
|
644
648
|
return i && (i.name = r), i ? N({
|
|
645
|
-
...
|
|
649
|
+
...s,
|
|
646
650
|
Vue: a,
|
|
647
651
|
dsl: i,
|
|
648
|
-
mode:
|
|
649
|
-
loader: L(
|
|
652
|
+
mode: _.Runtime,
|
|
653
|
+
loader: L(n)
|
|
650
654
|
}).renderer : null;
|
|
651
655
|
}) : o.type === "Plugin" ? (o.library && B.push(o.library), a.defineAsyncComponent(async () => {
|
|
652
|
-
const i = await
|
|
656
|
+
const i = await me(o, s.window);
|
|
653
657
|
return i || (console.warn("getPlugin result is null", o), null);
|
|
654
658
|
})) : r;
|
|
655
659
|
}
|
|
656
|
-
function H(
|
|
657
|
-
if (!
|
|
658
|
-
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);
|
|
659
663
|
if (a && !$t(a, e))
|
|
660
664
|
return null;
|
|
661
665
|
const f = (l) => {
|
|
662
666
|
const m = l.$components, d = (() => {
|
|
663
|
-
if (
|
|
664
|
-
return jt(l,
|
|
665
|
-
if (
|
|
666
|
-
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);
|
|
667
671
|
return $(g) ? m[g] ?? g : g;
|
|
668
|
-
})(), h = Et(r,
|
|
669
|
-
if (
|
|
670
|
-
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);
|
|
671
675
|
p && Object.assign(h, l.__parseExpression(p.value)), u && (h.style = Object.assign(
|
|
672
676
|
h.style ?? {},
|
|
673
|
-
|
|
677
|
+
Ct(u, l)
|
|
674
678
|
)), c.forEach((g) => {
|
|
675
679
|
Object.assign(h, Ft(t, g, l));
|
|
676
680
|
});
|
|
677
681
|
const v = xt(
|
|
678
682
|
t,
|
|
679
|
-
|
|
683
|
+
n.children ?? [],
|
|
680
684
|
l,
|
|
681
|
-
|
|
682
|
-
|
|
685
|
+
s,
|
|
686
|
+
n
|
|
683
687
|
);
|
|
684
|
-
return t.createVNode(d, { ...h, ...
|
|
688
|
+
return t.createVNode(d, { ...h, ...w }, v);
|
|
685
689
|
};
|
|
686
690
|
return i ? Ht(i, f, e) : f(e);
|
|
687
691
|
}
|
|
688
|
-
function St(
|
|
689
|
-
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(
|
|
690
694
|
(i) => !ze.includes(j(i.name))
|
|
691
695
|
);
|
|
692
696
|
return {
|
|
693
697
|
vIf: e,
|
|
694
698
|
vFor: t,
|
|
695
|
-
vShow:
|
|
699
|
+
vShow: s,
|
|
696
700
|
vModels: o,
|
|
697
701
|
vBind: r,
|
|
698
702
|
others: a
|
|
699
703
|
};
|
|
700
704
|
}
|
|
701
|
-
function $t(
|
|
702
|
-
return !!e.__parseExpression(
|
|
705
|
+
function $t(n, e) {
|
|
706
|
+
return !!e.__parseExpression(n.value);
|
|
703
707
|
}
|
|
704
|
-
function jt(
|
|
705
|
-
return e ? S(e) ?
|
|
708
|
+
function jt(n, e) {
|
|
709
|
+
return e ? S(e) ? n.__parseExpression(e) : e : "div";
|
|
706
710
|
}
|
|
707
|
-
function Et(
|
|
708
|
-
const
|
|
711
|
+
function Et(n, e, t) {
|
|
712
|
+
const s = Object.keys(e || {}).reduce(
|
|
709
713
|
(r, o) => {
|
|
710
714
|
let a = e[o];
|
|
711
715
|
return S(a) ? a = t.__parseExpression(a) : M(a) && (a = t.__parseFunction(a)), r[o] = a, r;
|
|
712
716
|
},
|
|
713
717
|
{}
|
|
714
718
|
);
|
|
715
|
-
return
|
|
719
|
+
return s.ref = t.__ref(n, s.ref), s;
|
|
716
720
|
}
|
|
717
|
-
function Pt(
|
|
718
|
-
const
|
|
721
|
+
function Pt(n, e, t) {
|
|
722
|
+
const s = ["passive", "capture", "once"], r = {
|
|
719
723
|
capture: "Capture",
|
|
720
724
|
once: "Once",
|
|
721
725
|
passive: "OnceCapture"
|
|
722
726
|
};
|
|
723
727
|
return Object.keys(e || {}).reduce(
|
|
724
728
|
(o, a) => {
|
|
725
|
-
const i = e[a], u =
|
|
726
|
-
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;
|
|
727
731
|
},
|
|
728
732
|
{}
|
|
729
733
|
);
|
|
730
734
|
}
|
|
731
|
-
function
|
|
732
|
-
const t = Object.keys(
|
|
733
|
-
return e ? t.map((
|
|
735
|
+
function ve(n = {}, e = !1) {
|
|
736
|
+
const t = Object.keys(n);
|
|
737
|
+
return e ? t.map((s) => "." + s) : t;
|
|
734
738
|
}
|
|
735
|
-
function bt(
|
|
736
|
-
const { children: o } = e, a =
|
|
737
|
-
return i ? i(t) : o ? $(o) ?
|
|
738
|
-
|
|
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))
|
|
739
743
|
) : Array.isArray(o) ? o.map(
|
|
740
|
-
(u) => H(u,
|
|
744
|
+
(u) => H(u, s, n, r)
|
|
741
745
|
) : null : null;
|
|
742
746
|
}
|
|
743
|
-
function
|
|
744
|
-
const { props: t } =
|
|
747
|
+
function Rt(n, e) {
|
|
748
|
+
const { props: t } = n, s = t?.name || "default";
|
|
745
749
|
return {
|
|
746
|
-
name: S(
|
|
750
|
+
name: S(s) ? e.__parseExpression(s) : s,
|
|
747
751
|
params: []
|
|
748
752
|
};
|
|
749
753
|
}
|
|
750
|
-
function
|
|
751
|
-
return e.__parseExpression(
|
|
754
|
+
function Ct(n, e) {
|
|
755
|
+
return e.__parseExpression(n.value) ? {} : {
|
|
752
756
|
display: "none"
|
|
753
757
|
};
|
|
754
758
|
}
|
|
755
|
-
function Ft(
|
|
756
|
-
const
|
|
759
|
+
function Ft(n, e, t) {
|
|
760
|
+
const s = {
|
|
757
761
|
type: "JSFunction",
|
|
758
762
|
value: e.value?.value ? `(v) => {
|
|
759
763
|
${e.value.value} = v;
|
|
760
764
|
}` : "(v) => {}"
|
|
761
|
-
}, r = t.__parseFunction(
|
|
765
|
+
}, r = t.__parseFunction(s), o = ve(e.modifiers), a = S(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
762
766
|
return {
|
|
763
767
|
[a]: t.__parseExpression(e.value),
|
|
764
|
-
[`onUpdate:${a}`]: o.length && r ?
|
|
768
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
|
765
769
|
};
|
|
766
770
|
}
|
|
767
|
-
function xt(
|
|
771
|
+
function xt(n, e, t, s, r) {
|
|
768
772
|
if (!e) return null;
|
|
769
773
|
if ($(e))
|
|
770
774
|
return { default: () => e };
|
|
771
775
|
if (S(e))
|
|
772
776
|
return {
|
|
773
|
-
default: () =>
|
|
777
|
+
default: () => fe(t.__parseExpression(e))
|
|
774
778
|
};
|
|
775
779
|
if (Array.isArray(e) && e.length > 0) {
|
|
776
780
|
const o = It(e), a = (i) => !i || !r ? {} : r?.id && Object.keys(i).length ? {
|
|
@@ -779,83 +783,83 @@ function xt(s, e, t, n, r) {
|
|
|
779
783
|
return Object.entries(o).reduce((i, [u, { nodes: c, params: p }]) => (i[u] = (f) => {
|
|
780
784
|
const l = p.length ? Ie(f ?? {}, p) : a(f);
|
|
781
785
|
return c.map(
|
|
782
|
-
(m) => H(m, t.__clone(l),
|
|
786
|
+
(m) => H(m, t.__clone(l), n, s)
|
|
783
787
|
);
|
|
784
788
|
}, i), {});
|
|
785
789
|
}
|
|
786
790
|
return null;
|
|
787
791
|
}
|
|
788
|
-
function It(
|
|
792
|
+
function It(n) {
|
|
789
793
|
const e = {
|
|
790
794
|
default: {
|
|
791
795
|
params: [],
|
|
792
796
|
nodes: []
|
|
793
797
|
}
|
|
794
798
|
};
|
|
795
|
-
for (const t of
|
|
796
|
-
const
|
|
797
|
-
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] = {
|
|
798
802
|
nodes: [t],
|
|
799
|
-
params:
|
|
803
|
+
params: s.params
|
|
800
804
|
};
|
|
801
805
|
}
|
|
802
806
|
return e;
|
|
803
807
|
}
|
|
804
|
-
function At(
|
|
805
|
-
return $(
|
|
808
|
+
function At(n = "default") {
|
|
809
|
+
return $(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
806
810
|
}
|
|
807
|
-
function Ht(
|
|
808
|
-
const { value:
|
|
809
|
-
let i = t.__parseExpression(
|
|
810
|
-
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`), []);
|
|
811
815
|
}
|
|
812
|
-
function Ot(
|
|
813
|
-
return Be() ? (Ue(
|
|
816
|
+
function Ot(n) {
|
|
817
|
+
return Be() ? (Ue(n), !0) : !1;
|
|
814
818
|
}
|
|
815
|
-
function K(
|
|
816
|
-
return typeof
|
|
819
|
+
function K(n) {
|
|
820
|
+
return typeof n == "function" ? n() : Ne(n);
|
|
817
821
|
}
|
|
818
|
-
const
|
|
822
|
+
const ge = typeof window < "u" && typeof document < "u";
|
|
819
823
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
820
|
-
const Dt = (
|
|
824
|
+
const Dt = (n) => n != null, Mt = () => {
|
|
821
825
|
};
|
|
822
|
-
function kt(
|
|
823
|
-
return
|
|
826
|
+
function kt(n) {
|
|
827
|
+
return ie();
|
|
824
828
|
}
|
|
825
|
-
function Tt(...
|
|
826
|
-
if (
|
|
827
|
-
return De(...
|
|
828
|
-
const e =
|
|
829
|
+
function Tt(...n) {
|
|
830
|
+
if (n.length !== 1)
|
|
831
|
+
return De(...n);
|
|
832
|
+
const e = n[0];
|
|
829
833
|
return typeof e == "function" ? Me(ke(() => ({ get: e, set: Mt }))) : J(e);
|
|
830
834
|
}
|
|
831
|
-
function Bt(
|
|
832
|
-
kt() && Te(
|
|
835
|
+
function Bt(n, e) {
|
|
836
|
+
kt() && Te(n, e);
|
|
833
837
|
}
|
|
834
|
-
const Ut =
|
|
835
|
-
function Lt(
|
|
838
|
+
const Ut = ge ? window : void 0, Nt = ge ? window.document : void 0;
|
|
839
|
+
function Lt(n) {
|
|
836
840
|
var e;
|
|
837
|
-
const t = K(
|
|
841
|
+
const t = K(n);
|
|
838
842
|
return (e = t?.$el) != null ? e : t;
|
|
839
843
|
}
|
|
840
844
|
function qt() {
|
|
841
|
-
const
|
|
845
|
+
const n = J(!1), e = ie();
|
|
842
846
|
return e && Le(() => {
|
|
843
|
-
|
|
844
|
-
}, e),
|
|
847
|
+
n.value = !0;
|
|
848
|
+
}, e), n;
|
|
845
849
|
}
|
|
846
|
-
function Jt(
|
|
850
|
+
function Jt(n) {
|
|
847
851
|
const e = qt();
|
|
848
|
-
return
|
|
852
|
+
return ce(() => (e.value, !!n()));
|
|
849
853
|
}
|
|
850
|
-
function Vt(
|
|
851
|
-
const { window:
|
|
854
|
+
function Vt(n, e, t = {}) {
|
|
855
|
+
const { window: s = Ut, ...r } = t;
|
|
852
856
|
let o;
|
|
853
|
-
const a = Jt(() =>
|
|
857
|
+
const a = Jt(() => s && "MutationObserver" in s), i = () => {
|
|
854
858
|
o && (o.disconnect(), o = void 0);
|
|
855
|
-
}, u =
|
|
856
|
-
const l = K(
|
|
859
|
+
}, u = ce(() => {
|
|
860
|
+
const l = K(n), m = (Array.isArray(l) ? l : [l]).map(Lt).filter(Dt);
|
|
857
861
|
return new Set(m);
|
|
858
|
-
}), c =
|
|
862
|
+
}), c = ae(
|
|
859
863
|
() => u.value,
|
|
860
864
|
(l) => {
|
|
861
865
|
i(), a.value && l.size && (o = new MutationObserver(e), l.forEach((m) => o.observe(m, r)));
|
|
@@ -870,19 +874,19 @@ function Vt(s, e, t = {}) {
|
|
|
870
874
|
takeRecords: p
|
|
871
875
|
};
|
|
872
876
|
}
|
|
873
|
-
function zt(
|
|
874
|
-
var t,
|
|
877
|
+
function zt(n = null, e = {}) {
|
|
878
|
+
var t, s, r;
|
|
875
879
|
const {
|
|
876
880
|
document: o = Nt,
|
|
877
881
|
restoreOnUnmount: a = (f) => f
|
|
878
|
-
} = 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";
|
|
879
883
|
function p(f) {
|
|
880
884
|
if (!("titleTemplate" in e))
|
|
881
885
|
return f;
|
|
882
886
|
const l = e.titleTemplate || "%s";
|
|
883
887
|
return typeof l == "function" ? l(f) : K(l).replace(/%s/g, f);
|
|
884
888
|
}
|
|
885
|
-
return
|
|
889
|
+
return ae(
|
|
886
890
|
u,
|
|
887
891
|
(f, l) => {
|
|
888
892
|
f !== l && o && (o.title = p(typeof f == "string" ? f : ""));
|
|
@@ -901,33 +905,33 @@ function zt(s = null, e = {}) {
|
|
|
901
905
|
}
|
|
902
906
|
}), u;
|
|
903
907
|
}
|
|
904
|
-
const
|
|
908
|
+
const se = ue({
|
|
905
909
|
name: "VtjPageContainer",
|
|
906
910
|
async setup() {
|
|
907
|
-
const
|
|
908
|
-
return
|
|
909
|
-
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,
|
|
910
914
|
component: r,
|
|
911
|
-
file:
|
|
915
|
+
file: s,
|
|
912
916
|
query: e.query
|
|
913
917
|
};
|
|
914
918
|
},
|
|
915
919
|
render() {
|
|
916
920
|
return this.component ? U(this.component, this.query) : U("div", "页面不存在");
|
|
917
921
|
}
|
|
918
|
-
}), Kt =
|
|
922
|
+
}), Kt = ue({
|
|
919
923
|
name: "VtjStartupContainer",
|
|
920
924
|
render() {
|
|
921
925
|
return U(Ve);
|
|
922
926
|
}
|
|
923
|
-
}),
|
|
924
|
-
var Wt = /* @__PURE__ */ ((
|
|
925
|
-
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 {
|
|
926
930
|
constructor(e) {
|
|
927
931
|
super(), this.options = e;
|
|
928
932
|
const {
|
|
929
933
|
service: t,
|
|
930
|
-
mode:
|
|
934
|
+
mode: s = _.Raw,
|
|
931
935
|
dependencies: r,
|
|
932
936
|
materials: o,
|
|
933
937
|
project: a = {},
|
|
@@ -939,14 +943,14 @@ class Gt extends we {
|
|
|
939
943
|
nodeEnv: l = "development"
|
|
940
944
|
/* Development */
|
|
941
945
|
} = e;
|
|
942
|
-
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);
|
|
943
947
|
const { access: m, request: d } = this.adapter;
|
|
944
|
-
m && m.connect({ mode:
|
|
948
|
+
m && m.connect({ mode: s, router: p, request: d }), s !== _.Design && this.load(a);
|
|
945
949
|
}
|
|
946
950
|
mode;
|
|
947
951
|
globals = {};
|
|
948
952
|
modules = {};
|
|
949
|
-
adapter = { request:
|
|
953
|
+
adapter = { request: nt, jsonp: Ae };
|
|
950
954
|
apis = {};
|
|
951
955
|
dependencies = {};
|
|
952
956
|
materials = {};
|
|
@@ -962,16 +966,16 @@ class Gt extends we {
|
|
|
962
966
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
963
967
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
964
968
|
throw new Error("project is null");
|
|
965
|
-
const { apis:
|
|
966
|
-
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();
|
|
967
971
|
}
|
|
968
972
|
async loadDependencies(e) {
|
|
969
973
|
const t = Object.entries(this.dependencies);
|
|
970
|
-
for (const [
|
|
971
|
-
e[
|
|
974
|
+
for (const [s, r] of t)
|
|
975
|
+
e[s] || (e[s] = await r());
|
|
972
976
|
}
|
|
973
977
|
async loadAssets(e) {
|
|
974
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
|
978
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
|
975
979
|
libraryExports: u,
|
|
976
980
|
libraryMap: c,
|
|
977
981
|
materials: p,
|
|
@@ -984,25 +988,25 @@ class Gt extends we {
|
|
|
984
988
|
/* Development */
|
|
985
989
|
);
|
|
986
990
|
for (const d of u) {
|
|
987
|
-
const h =
|
|
988
|
-
if (
|
|
989
|
-
r[d] =
|
|
991
|
+
const h = s[d], w = e[d];
|
|
992
|
+
if (w)
|
|
993
|
+
r[d] = w;
|
|
990
994
|
else if (h)
|
|
991
995
|
e[d] = r[d] = await h();
|
|
992
996
|
else {
|
|
993
997
|
const v = c[d] || [];
|
|
994
998
|
for (const g of v)
|
|
995
|
-
V(g) && await Xe(d, b.append(g, { v:
|
|
999
|
+
V(g) && await Xe(d, b.append(g, { v: R })), z(g) && await X(b.append(g, { v: R }));
|
|
996
1000
|
r[d] = e[d];
|
|
997
1001
|
}
|
|
998
1002
|
}
|
|
999
1003
|
for (const d of p)
|
|
1000
|
-
await X(b.append(d, { v:
|
|
1004
|
+
await X(b.append(d, { v: R }));
|
|
1001
1005
|
const m = this.materials || {};
|
|
1002
1006
|
for (const d of f) {
|
|
1003
|
-
const h = e[l[d]],
|
|
1004
|
-
if (
|
|
1005
|
-
h &&
|
|
1007
|
+
const h = e[l[d]], w = $e[d];
|
|
1008
|
+
if (w)
|
|
1009
|
+
h && w.forEach((v) => {
|
|
1006
1010
|
o[v] = h[v];
|
|
1007
1011
|
});
|
|
1008
1012
|
else {
|
|
@@ -1018,27 +1022,27 @@ class Gt extends we {
|
|
|
1018
1022
|
e && (e.addRoute({
|
|
1019
1023
|
path: "/page/:id",
|
|
1020
1024
|
name: "VtjPage",
|
|
1021
|
-
component:
|
|
1025
|
+
component: se
|
|
1022
1026
|
}), e.addRoute({
|
|
1023
1027
|
path: "/",
|
|
1024
1028
|
name: "VtjHomepage",
|
|
1025
|
-
component: t?.homepage ?
|
|
1029
|
+
component: t?.homepage ? se : Kt
|
|
1026
1030
|
}));
|
|
1027
1031
|
}
|
|
1028
1032
|
install(e) {
|
|
1029
1033
|
const t = e.config.globalProperties.installed || {};
|
|
1030
|
-
for (const [
|
|
1031
|
-
!t[
|
|
1032
|
-
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), e.provide(
|
|
1033
|
-
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}`;
|
|
1034
1038
|
console.error(
|
|
1035
1039
|
"[VTJ Error]:",
|
|
1036
1040
|
{
|
|
1037
|
-
err:
|
|
1041
|
+
err: s,
|
|
1038
1042
|
instance: r,
|
|
1039
1043
|
info: o
|
|
1040
1044
|
},
|
|
1041
|
-
|
|
1045
|
+
s?.stack
|
|
1042
1046
|
), D.error({
|
|
1043
1047
|
title: "运行时错误:请在控制台查看详情",
|
|
1044
1048
|
message: u
|
|
@@ -1047,21 +1051,21 @@ class Gt extends we {
|
|
|
1047
1051
|
}
|
|
1048
1052
|
getFile(e) {
|
|
1049
1053
|
const { blocks: t = [] } = this.project || {};
|
|
1050
|
-
return this.getPage(e) || t.find((
|
|
1054
|
+
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
|
1051
1055
|
}
|
|
1052
1056
|
getPage(e) {
|
|
1053
|
-
const { pages: t = [] } = this.project || {},
|
|
1057
|
+
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
|
1054
1058
|
for (const a of o) {
|
|
1055
1059
|
if (a.id === r)
|
|
1056
1060
|
return a;
|
|
1057
1061
|
if (a.children && a.children.length) {
|
|
1058
|
-
const i =
|
|
1062
|
+
const i = s(r, a.children);
|
|
1059
1063
|
if (i)
|
|
1060
1064
|
return i;
|
|
1061
1065
|
}
|
|
1062
1066
|
}
|
|
1063
1067
|
};
|
|
1064
|
-
return
|
|
1068
|
+
return s(e, t) || null;
|
|
1065
1069
|
}
|
|
1066
1070
|
getHomepage() {
|
|
1067
1071
|
const { homepage: e } = this.project || {};
|
|
@@ -1080,14 +1084,14 @@ class Gt extends we {
|
|
|
1080
1084
|
validSuccess: !1,
|
|
1081
1085
|
originResponse: !0
|
|
1082
1086
|
}
|
|
1083
|
-
}).then((
|
|
1087
|
+
}).then((s) => s.data).catch(() => null));
|
|
1084
1088
|
}
|
|
1085
1089
|
createDslRenderer(e, t = {}) {
|
|
1086
|
-
const { library:
|
|
1090
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
|
1087
1091
|
mode: o,
|
|
1088
|
-
Vue:
|
|
1092
|
+
Vue: s.Vue,
|
|
1089
1093
|
components: r,
|
|
1090
|
-
libs:
|
|
1094
|
+
libs: s,
|
|
1091
1095
|
apis: a,
|
|
1092
1096
|
window,
|
|
1093
1097
|
...t
|
|
@@ -1106,7 +1110,7 @@ class Gt extends we {
|
|
|
1106
1110
|
const t = this.getFile(e);
|
|
1107
1111
|
if (!t)
|
|
1108
1112
|
return A.warn(`Can not find file: ${e}`), null;
|
|
1109
|
-
const
|
|
1113
|
+
const s = `.vtj/vue/${e}.vue`, r = this.modules[s];
|
|
1110
1114
|
if (r)
|
|
1111
1115
|
return (await r())?.default;
|
|
1112
1116
|
const o = await this.getDsl(t.id);
|
|
@@ -1114,30 +1118,30 @@ class Gt extends we {
|
|
|
1114
1118
|
}
|
|
1115
1119
|
defineUrlSchemaComponent(e, t) {
|
|
1116
1120
|
return Z(async () => {
|
|
1117
|
-
const
|
|
1118
|
-
return
|
|
1121
|
+
const s = await this.getDslByUrl(e);
|
|
1122
|
+
return s ? (s.name = t || s.name, this.createDslRenderer(s).renderer) : null;
|
|
1119
1123
|
});
|
|
1120
1124
|
}
|
|
1121
1125
|
definePluginComponent(e) {
|
|
1122
|
-
return Z(async () => await
|
|
1126
|
+
return Z(async () => await me(e, window));
|
|
1123
1127
|
}
|
|
1124
1128
|
}
|
|
1125
|
-
function
|
|
1126
|
-
const e = new Gt(
|
|
1129
|
+
function fs(n) {
|
|
1130
|
+
const e = new Gt(n);
|
|
1127
1131
|
return {
|
|
1128
1132
|
provider: e,
|
|
1129
|
-
onReady: (
|
|
1133
|
+
onReady: (s) => e.ready(s)
|
|
1130
1134
|
};
|
|
1131
1135
|
}
|
|
1132
|
-
function
|
|
1133
|
-
const e =
|
|
1136
|
+
function _e(n = {}) {
|
|
1137
|
+
const e = oe(ye);
|
|
1134
1138
|
if (!e)
|
|
1135
1139
|
throw new Error("Can not find provider");
|
|
1136
1140
|
if (e.nodeEnv === "development") {
|
|
1137
|
-
const { id: t, version:
|
|
1138
|
-
t &&
|
|
1141
|
+
const { id: t, version: s } = n;
|
|
1142
|
+
t && s && (async () => {
|
|
1139
1143
|
const r = await e.getDsl(t);
|
|
1140
|
-
r?.__VERSION__ !==
|
|
1144
|
+
r?.__VERSION__ !== s && D.warning({
|
|
1141
1145
|
title: r?.name,
|
|
1142
1146
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
1143
1147
|
});
|
|
@@ -1151,23 +1155,23 @@ const W = new He({
|
|
|
1151
1155
|
validSuccess: !0,
|
|
1152
1156
|
originResponse: !1,
|
|
1153
1157
|
failMessage: !0,
|
|
1154
|
-
validate: (
|
|
1155
|
-
showError: (
|
|
1158
|
+
validate: (n) => n.data?.code === 0,
|
|
1159
|
+
showError: (n) => {
|
|
1156
1160
|
D.error({
|
|
1157
|
-
message:
|
|
1161
|
+
message: n || "未知错误"
|
|
1158
1162
|
});
|
|
1159
1163
|
}
|
|
1160
1164
|
}
|
|
1161
|
-
}), Yt = (
|
|
1162
|
-
url:
|
|
1165
|
+
}), Yt = (n = "/__vtj__/api/:type.json") => (e, t) => W.send({
|
|
1166
|
+
url: n,
|
|
1163
1167
|
method: "post",
|
|
1164
1168
|
params: { type: e },
|
|
1165
1169
|
data: {
|
|
1166
1170
|
type: e,
|
|
1167
1171
|
data: t
|
|
1168
1172
|
}
|
|
1169
|
-
}), Qt = (
|
|
1170
|
-
url:
|
|
1173
|
+
}), Qt = (n = "/__vtj__/api/uploader.json") => async (e, t) => await W.send({
|
|
1174
|
+
url: n,
|
|
1171
1175
|
method: "post",
|
|
1172
1176
|
data: {
|
|
1173
1177
|
files: e,
|
|
@@ -1176,7 +1180,7 @@ const W = new He({
|
|
|
1176
1180
|
settings: {
|
|
1177
1181
|
type: "data"
|
|
1178
1182
|
}
|
|
1179
|
-
}).then((
|
|
1183
|
+
}).then((s) => s && s[0] ? s[0] : null).catch(() => null);
|
|
1180
1184
|
class G {
|
|
1181
1185
|
api;
|
|
1182
1186
|
pluginCaches = {};
|
|
@@ -1255,11 +1259,11 @@ class G {
|
|
|
1255
1259
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1256
1260
|
}
|
|
1257
1261
|
async getPluginMaterial(e) {
|
|
1258
|
-
const { urls: t = [] } = e,
|
|
1259
|
-
if (!
|
|
1260
|
-
const r = this.pluginCaches[
|
|
1261
|
-
return r || (this.pluginCaches[
|
|
1262
|
-
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,
|
|
1263
1267
|
method: "get",
|
|
1264
1268
|
settings: {
|
|
1265
1269
|
validSuccess: !1,
|
|
@@ -1273,9 +1277,9 @@ const y = new Oe({
|
|
|
1273
1277
|
expired: 0,
|
|
1274
1278
|
prefix: "__VTJ_"
|
|
1275
1279
|
});
|
|
1276
|
-
class
|
|
1280
|
+
class ds extends G {
|
|
1277
1281
|
init(e) {
|
|
1278
|
-
const t = new I(e),
|
|
1282
|
+
const t = new I(e), s = y.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
|
1279
1283
|
return y.save(`project_${t.id}`, r), Promise.resolve(r);
|
|
1280
1284
|
}
|
|
1281
1285
|
saveProject(e) {
|
|
@@ -1307,19 +1311,19 @@ class pn extends G {
|
|
|
1307
1311
|
return Promise.resolve(!0);
|
|
1308
1312
|
}
|
|
1309
1313
|
getHistory(e) {
|
|
1310
|
-
const t = y.get(`history_${e}`),
|
|
1311
|
-
return Promise.resolve(
|
|
1314
|
+
const t = y.get(`history_${e}`), s = new ne(t || { id: e });
|
|
1315
|
+
return Promise.resolve(s.toDsl());
|
|
1312
1316
|
}
|
|
1313
1317
|
getHistoryItem(e, t) {
|
|
1314
|
-
const
|
|
1315
|
-
return Promise.resolve(
|
|
1318
|
+
const s = y.get(`history_${e}_${t}`);
|
|
1319
|
+
return Promise.resolve(s);
|
|
1316
1320
|
}
|
|
1317
1321
|
saveHistoryItem(e, t) {
|
|
1318
1322
|
return y.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
|
1319
1323
|
}
|
|
1320
1324
|
removeHistoryItem(e, t) {
|
|
1321
|
-
return t.forEach((
|
|
1322
|
-
y.remove(`history_${e}_${
|
|
1325
|
+
return t.forEach((s) => {
|
|
1326
|
+
y.remove(`history_${e}_${s}`);
|
|
1323
1327
|
}), Promise.resolve(!0);
|
|
1324
1328
|
}
|
|
1325
1329
|
}
|
|
@@ -1330,7 +1334,7 @@ class Xt extends G {
|
|
|
1330
1334
|
histories = {};
|
|
1331
1335
|
historyItems = {};
|
|
1332
1336
|
init(e) {
|
|
1333
|
-
const t = new I(e),
|
|
1337
|
+
const t = new I(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
|
1334
1338
|
return this.projects[r.id] = r, Promise.resolve(r);
|
|
1335
1339
|
}
|
|
1336
1340
|
saveProject(e) {
|
|
@@ -1362,29 +1366,29 @@ class Xt extends G {
|
|
|
1362
1366
|
return Promise.resolve(!0);
|
|
1363
1367
|
}
|
|
1364
1368
|
getHistory(e) {
|
|
1365
|
-
const t = this.histories[e],
|
|
1366
|
-
return Promise.resolve(
|
|
1369
|
+
const t = this.histories[e], s = new ne(t || { id: e });
|
|
1370
|
+
return Promise.resolve(s);
|
|
1367
1371
|
}
|
|
1368
1372
|
getHistoryItem(e, t) {
|
|
1369
|
-
const
|
|
1373
|
+
const s = `${e}_${t}`, r = this.historyItems[s] || {};
|
|
1370
1374
|
return Promise.resolve(r);
|
|
1371
1375
|
}
|
|
1372
1376
|
saveHistoryItem(e, t) {
|
|
1373
|
-
const
|
|
1374
|
-
return this.historyItems[
|
|
1377
|
+
const s = `${e}_${t.id}`;
|
|
1378
|
+
return this.historyItems[s] = t, Promise.resolve(!0);
|
|
1375
1379
|
}
|
|
1376
1380
|
removeHistoryItem(e, t) {
|
|
1377
|
-
return t.forEach((
|
|
1378
|
-
const r = `${e}_${
|
|
1381
|
+
return t.forEach((s) => {
|
|
1382
|
+
const r = `${e}_${s}`;
|
|
1379
1383
|
delete this.historyItems[r];
|
|
1380
1384
|
}), Promise.resolve(!0);
|
|
1381
1385
|
}
|
|
1382
1386
|
}
|
|
1383
1387
|
let x = null;
|
|
1384
|
-
function
|
|
1388
|
+
function ps() {
|
|
1385
1389
|
return x || (x = new Xt(), x);
|
|
1386
1390
|
}
|
|
1387
|
-
class
|
|
1391
|
+
class hs extends G {
|
|
1388
1392
|
getFileCaches = {};
|
|
1389
1393
|
async getExtension() {
|
|
1390
1394
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1439,76 +1443,76 @@ class mn extends G {
|
|
|
1439
1443
|
);
|
|
1440
1444
|
}
|
|
1441
1445
|
}
|
|
1442
|
-
function
|
|
1443
|
-
return
|
|
1444
|
-
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;
|
|
1445
1449
|
return {
|
|
1446
1450
|
id: t,
|
|
1447
|
-
title:
|
|
1451
|
+
title: s,
|
|
1448
1452
|
icon: r,
|
|
1449
1453
|
hidden: a,
|
|
1450
1454
|
url: `/page/${t}`,
|
|
1451
|
-
children: o && o.length ?
|
|
1455
|
+
children: o && o.length ? we(o) : void 0
|
|
1452
1456
|
};
|
|
1453
1457
|
});
|
|
1454
1458
|
}
|
|
1455
|
-
function
|
|
1456
|
-
const
|
|
1459
|
+
function ms() {
|
|
1460
|
+
const n = _e(), e = le(), t = J(!1), s = n.project;
|
|
1457
1461
|
qe(() => {
|
|
1458
1462
|
const { name: a, params: i, meta: u } = e;
|
|
1459
1463
|
if (a === "VtjPage") {
|
|
1460
|
-
const c =
|
|
1464
|
+
const c = n.getPage(i.id);
|
|
1461
1465
|
t.value = !c?.mask;
|
|
1462
1466
|
} else if (a === "VtjHomepage") {
|
|
1463
|
-
const c =
|
|
1467
|
+
const c = n.getHomepage();
|
|
1464
1468
|
t.value = !c?.mask;
|
|
1465
1469
|
} else
|
|
1466
1470
|
t.value = !u.mask;
|
|
1467
1471
|
});
|
|
1468
|
-
const r =
|
|
1472
|
+
const r = we(s?.pages), o = s?.config;
|
|
1469
1473
|
return {
|
|
1470
1474
|
disabled: t,
|
|
1471
1475
|
logo: o?.logo,
|
|
1472
1476
|
themeSwitchable: o?.themeSwitchable,
|
|
1473
|
-
title: o?.title ||
|
|
1477
|
+
title: o?.title || s?.description || s?.name || "VTJ App",
|
|
1474
1478
|
menus: r
|
|
1475
1479
|
};
|
|
1476
1480
|
}
|
|
1477
1481
|
export {
|
|
1478
|
-
|
|
1479
|
-
|
|
1482
|
+
he as ACCESS_KEY,
|
|
1483
|
+
us as Access,
|
|
1480
1484
|
ze as BUILT_IN_DIRECTIVES,
|
|
1481
1485
|
G as BaseService,
|
|
1482
1486
|
ee as CONTEXT_HOST,
|
|
1483
1487
|
lt as Context,
|
|
1484
|
-
|
|
1488
|
+
_ as ContextMode,
|
|
1485
1489
|
Ke as DATA_TYPES,
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1490
|
+
cs as JSCodeToString,
|
|
1491
|
+
os as LIFE_CYCLES_LIST,
|
|
1492
|
+
hs as LocalService,
|
|
1489
1493
|
Xt as MemoryService,
|
|
1490
1494
|
Wt as NodeEnv,
|
|
1491
1495
|
Gt as Provider,
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1496
|
+
ds as StorageService,
|
|
1497
|
+
R as VTJ_RENDERER_VERSION,
|
|
1498
|
+
de as adoptedStyleSheets,
|
|
1499
|
+
is as createAssetScripts,
|
|
1500
|
+
as as createAssetsCss,
|
|
1497
1501
|
gt as createDataSources,
|
|
1498
1502
|
L as createLoader,
|
|
1499
|
-
|
|
1503
|
+
ps as createMemoryService,
|
|
1500
1504
|
ot as createMetaApi,
|
|
1501
|
-
|
|
1505
|
+
fs as createProvider,
|
|
1502
1506
|
N as createRenderer,
|
|
1503
1507
|
rt as createSchemaApi,
|
|
1504
1508
|
it as createSchemaApis,
|
|
1505
1509
|
wt as defaultLoader,
|
|
1506
1510
|
F as fillBasePath,
|
|
1507
|
-
|
|
1508
|
-
|
|
1511
|
+
ve as getModifiers,
|
|
1512
|
+
me as getPlugin,
|
|
1509
1513
|
Qe as getRawComponent,
|
|
1510
1514
|
V as isCSSUrl,
|
|
1511
|
-
|
|
1515
|
+
st as isJSCode,
|
|
1512
1516
|
S as isJSExpression,
|
|
1513
1517
|
M as isJSFunction,
|
|
1514
1518
|
We as isJSON,
|
|
@@ -1519,15 +1523,15 @@ export {
|
|
|
1519
1523
|
et as loadScriptUrl,
|
|
1520
1524
|
ct as mockApi,
|
|
1521
1525
|
at as mockApis,
|
|
1522
|
-
|
|
1526
|
+
pe as mockCleanup,
|
|
1523
1527
|
H as nodeRender,
|
|
1524
1528
|
Ye as parseDeps,
|
|
1525
|
-
|
|
1529
|
+
C as parseExpression,
|
|
1526
1530
|
te as parseFunction,
|
|
1527
|
-
|
|
1531
|
+
ye as providerKey,
|
|
1528
1532
|
Ge as removeProdFlag,
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
+
fe as toString,
|
|
1534
|
+
ls as useAccess,
|
|
1535
|
+
ms as useMask,
|
|
1536
|
+
_e as useProvider
|
|
1533
1537
|
};
|