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