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