@vtj/renderer 0.8.26 → 0.8.28
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 +311 -291
- package/package.json +5 -5
- package/types/provider/apis.d.ts +3 -2
- package/types/provider/provider.d.ts +1 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
3
|
-
import * as
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
import { ElNotification as
|
|
1
|
+
import { Base as de, BUILT_IN_COMPONENTS as me, ProjectModel as M, HistoryModel as te } from "@vtj/core";
|
|
2
|
+
import { isUrl as he, url as F, dedupArray as ve, isString as C, isFunction as X, logger as O, createRequest as ye, merge as ge, pathToRegexp as _e, pathToRegexpMatch as we, formDataToJson as Se, camelCase as E, upperFirst as $e, pick as je, jsonp as Ee, loadScript as Y, Request as Pe, Storage as Fe, mapToObject as J } from "@vtj/utils";
|
|
3
|
+
import * as T from "vue";
|
|
4
|
+
import { defineComponent as re, h as N, inject as Ce, defineAsyncComponent as z, ref as be, watchEffect as Re } from "vue";
|
|
5
|
+
import { useRoute as ne } from "vue-router";
|
|
6
|
+
import { ElNotification as V, ElLoading as Ie } from "element-plus";
|
|
7
7
|
import D from "mockjs";
|
|
8
|
-
import { useTitle as
|
|
9
|
-
import { XStartup as
|
|
8
|
+
import { useTitle as He } from "@vueuse/core";
|
|
9
|
+
import { XStartup as xe } from "@vtj/ui";
|
|
10
10
|
/**!
|
|
11
11
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
12
12
|
* @name @vtj/renderer
|
|
13
13
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
14
|
-
* @version 0.8.
|
|
14
|
+
* @version 0.8.28
|
|
15
15
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
18
|
-
var
|
|
17
|
+
const R = "0.8.28";
|
|
18
|
+
var S = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(S || {});
|
|
19
19
|
const G = [
|
|
20
20
|
"$el",
|
|
21
21
|
"$emit",
|
|
@@ -28,7 +28,7 @@ const G = [
|
|
|
28
28
|
"$props",
|
|
29
29
|
"$options",
|
|
30
30
|
"$forceUpdate"
|
|
31
|
-
],
|
|
31
|
+
], It = [
|
|
32
32
|
"beforeCreate",
|
|
33
33
|
"created",
|
|
34
34
|
"beforeMount",
|
|
@@ -42,7 +42,7 @@ const G = [
|
|
|
42
42
|
"renderTriggered",
|
|
43
43
|
"activated",
|
|
44
44
|
"deactivated"
|
|
45
|
-
],
|
|
45
|
+
], Me = ["vIf", "vShow", "vModel", "vFor", "vBind"], Oe = {
|
|
46
46
|
String,
|
|
47
47
|
Number,
|
|
48
48
|
Boolean,
|
|
@@ -51,55 +51,55 @@ const G = [
|
|
|
51
51
|
Function,
|
|
52
52
|
Date
|
|
53
53
|
};
|
|
54
|
-
function
|
|
55
|
-
return n.map((t) =>
|
|
54
|
+
function H(n, e) {
|
|
55
|
+
return n.map((t) => he(t) ? t : `${e}${t}`);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function L(n) {
|
|
58
58
|
return /\.css$/.test(n);
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function K(n) {
|
|
61
61
|
return /\.js$/.test(n);
|
|
62
62
|
}
|
|
63
63
|
function De(n) {
|
|
64
64
|
return /\.json$/.test(n);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Ht(n) {
|
|
67
67
|
return n.map(
|
|
68
|
-
(e) => `<script src="${F.append(e, { v:
|
|
68
|
+
(e) => `<script src="${F.append(e, { v: R })}"><\/script>`
|
|
69
69
|
).join("");
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function xt(n = []) {
|
|
72
72
|
return n.map(
|
|
73
|
-
(e) => `<link rel="stylesheet" href="${F.append(e, { v:
|
|
73
|
+
(e) => `<link rel="stylesheet" href="${F.append(e, { v: R })}" />`
|
|
74
74
|
).join("");
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const t = n.filter((
|
|
76
|
+
function ke(n, e) {
|
|
77
|
+
const t = n.filter((u) => !!u.enabled), r = [], s = [], o = [], a = [], i = {}, l = {}, c = [], d = {};
|
|
78
78
|
return t.forEach(
|
|
79
|
-
({ urls:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}), h && (a.push(h), i[h] =
|
|
79
|
+
({ urls: u, assetsUrl: p, library: h, assetsLibrary: w, localeLibrary: m }) => {
|
|
80
|
+
u?.forEach((g) => {
|
|
81
|
+
K(g) && r.push(g), L(g) && s.push(g);
|
|
82
|
+
}), h && (a.push(h), i[h] = H(u || [], e), m && (l[h] = m)), p && o.push(p), w && c.push(w), h && w && (d[w] = h);
|
|
83
83
|
}
|
|
84
84
|
), {
|
|
85
|
-
scripts:
|
|
86
|
-
css:
|
|
87
|
-
materials:
|
|
85
|
+
scripts: H(r, e),
|
|
86
|
+
css: H(s, e),
|
|
87
|
+
materials: H(o, e),
|
|
88
88
|
libraryExports: a,
|
|
89
|
-
materialExports:
|
|
89
|
+
materialExports: ve(c),
|
|
90
90
|
materialMapLibrary: d,
|
|
91
91
|
libraryMap: i,
|
|
92
92
|
libraryLocaleMap: l
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Te(n, e) {
|
|
96
96
|
const { name: t, parent: r, alias: s } = n;
|
|
97
97
|
return r ? e[r]?.[s || t] : e[s || t];
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return
|
|
99
|
+
function se(n) {
|
|
100
|
+
return C(n) ? n : JSON.stringify(n);
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function oe(n, e, t) {
|
|
103
103
|
const r = n.CSSStyleSheet;
|
|
104
104
|
if (r.prototype.replaceSync) {
|
|
105
105
|
const s = new r();
|
|
@@ -114,11 +114,11 @@ function se(n, e, t) {
|
|
|
114
114
|
o ? o.innerHTML = t : (o = s.createElement("style"), o.id = e, o.innerHTML = t, s.head.appendChild(o));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
async function
|
|
117
|
+
async function Ae(n, e) {
|
|
118
118
|
const t = await window.fetch(e).then((r) => r.text()).catch(() => "");
|
|
119
|
-
t &&
|
|
119
|
+
t && oe(window, n, t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ie(n, e = window) {
|
|
122
122
|
const t = e.document, r = e.document.head;
|
|
123
123
|
for (const s of n)
|
|
124
124
|
if (!t.getElementById(s)) {
|
|
@@ -133,17 +133,17 @@ async function Be(n, e, t = window) {
|
|
|
133
133
|
for (const l of n) {
|
|
134
134
|
const c = r.createElement("script");
|
|
135
135
|
c.src = l, c.onload = () => {
|
|
136
|
-
o = t[e], o
|
|
136
|
+
o = t[e], o ? a(o.default || o) : i(null);
|
|
137
137
|
}, c.onerror = (d) => {
|
|
138
138
|
i(d);
|
|
139
139
|
}, s.appendChild(c);
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Ne(n) {
|
|
144
144
|
return X(n) || X(n?.install);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function I(n, e, t = !1, r = !1) {
|
|
147
147
|
try {
|
|
148
148
|
const s = ['"use strict";', "var __self = arguments[0];"];
|
|
149
149
|
s.push("return ");
|
|
@@ -157,8 +157,8 @@ function R(n, e, t = !1, r = !1) {
|
|
|
157
157
|
throw s;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
const s =
|
|
160
|
+
function Z(n, e, t = !1, r = !1) {
|
|
161
|
+
const s = I(n, e, t, r);
|
|
162
162
|
if (typeof s != "function" && (O.error(
|
|
163
163
|
"parseFunction.error",
|
|
164
164
|
"not a function",
|
|
@@ -171,17 +171,17 @@ function Q(n, e, t = !1, r = !1) {
|
|
|
171
171
|
function _(n) {
|
|
172
172
|
return n && n.type === "JSExpression";
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function A(n) {
|
|
175
175
|
return typeof n == "object" && n && n.type === "JSFunction";
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
return _(n) ||
|
|
177
|
+
function Ue(n) {
|
|
178
|
+
return _(n) || A(n);
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
return
|
|
180
|
+
function Mt(n) {
|
|
181
|
+
return Ue(n) ? n.value : JSON.stringify(n);
|
|
182
182
|
}
|
|
183
183
|
let P = null;
|
|
184
|
-
const
|
|
184
|
+
const qe = ye({
|
|
185
185
|
settings: {
|
|
186
186
|
type: "form",
|
|
187
187
|
validSuccess: !0,
|
|
@@ -190,12 +190,12 @@ const Ue = ve({
|
|
|
190
190
|
validate: (n) => n.data?.code === 0 || !!n.data?.success,
|
|
191
191
|
failMessage: !0,
|
|
192
192
|
showError: (n) => {
|
|
193
|
-
|
|
193
|
+
V.error({
|
|
194
194
|
message: n || "未知错误"
|
|
195
195
|
});
|
|
196
196
|
},
|
|
197
197
|
showLoading: () => {
|
|
198
|
-
P && P.close(), P =
|
|
198
|
+
P && P.close(), P = Ie.service({
|
|
199
199
|
lock: !0,
|
|
200
200
|
text: "Loading",
|
|
201
201
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -206,7 +206,7 @@ const Ue = ve({
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
-
function
|
|
209
|
+
function Je(n, e) {
|
|
210
210
|
const { jsonp: t, request: r } = e;
|
|
211
211
|
if (n.method === "jsonp")
|
|
212
212
|
return (s = {}) => t(n.url, {
|
|
@@ -214,7 +214,7 @@ function qe(n, e) {
|
|
|
214
214
|
query: s
|
|
215
215
|
});
|
|
216
216
|
{
|
|
217
|
-
const s = n.headers ?
|
|
217
|
+
const s = n.headers ? I(n.headers, {}, !0) : void 0, o = {
|
|
218
218
|
url: n.url,
|
|
219
219
|
method: n.method,
|
|
220
220
|
settings: {
|
|
@@ -222,36 +222,51 @@ function qe(n, e) {
|
|
|
222
222
|
headers: s
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
|
-
return (a, i) => r.send(
|
|
225
|
+
return (a, i) => r.send(ge(o, i || {}, { data: a }));
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
function Ve(n, e) {
|
|
229
|
+
const { metaQuery: t } = e;
|
|
230
|
+
if (!t)
|
|
231
|
+
return;
|
|
232
|
+
const { code: r, queryCode: s } = n;
|
|
233
|
+
return (o, a) => {
|
|
234
|
+
if (!t) {
|
|
235
|
+
console.warn("adapter.metaQuery is not defined!");
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
return t(r, s, o, a);
|
|
239
|
+
};
|
|
233
240
|
}
|
|
234
|
-
function
|
|
241
|
+
function Le(n = [], e = [], t) {
|
|
242
|
+
const r = {};
|
|
243
|
+
for (const s of n)
|
|
244
|
+
r[s.id] = Je(s, t);
|
|
245
|
+
for (const s of e)
|
|
246
|
+
r[s.id] = Ve(s, t);
|
|
247
|
+
return r;
|
|
248
|
+
}
|
|
249
|
+
function Ke(n = []) {
|
|
235
250
|
D.setup({
|
|
236
251
|
timeout: "50-500"
|
|
237
|
-
}),
|
|
252
|
+
}), ae(), n.forEach((e) => Qe(e));
|
|
238
253
|
}
|
|
239
|
-
function
|
|
254
|
+
function Qe(n) {
|
|
240
255
|
if (!n.mock)
|
|
241
256
|
return;
|
|
242
257
|
const { url: e, mockTemplate: t } = n;
|
|
243
258
|
if (e && t) {
|
|
244
|
-
const r =
|
|
259
|
+
const r = _e(`${e}(.*)`), s = we(e, { decode: decodeURIComponent }), o = I(t, {}, !0);
|
|
245
260
|
D.mock(r, (a) => {
|
|
246
|
-
const i = F.parse(a.url) || {}, l = a.body instanceof FormData ?
|
|
261
|
+
const i = F.parse(a.url) || {}, l = a.body instanceof FormData ? Se(a.body) : a.body, c = s(a.url)?.params;
|
|
247
262
|
return Object.assign(a, { data: l, params: i, query: c }), D.mock(o(a));
|
|
248
263
|
});
|
|
249
264
|
}
|
|
250
265
|
}
|
|
251
|
-
function
|
|
266
|
+
function ae() {
|
|
252
267
|
D._mocked = {};
|
|
253
268
|
}
|
|
254
|
-
class
|
|
269
|
+
class We {
|
|
255
270
|
__id = null;
|
|
256
271
|
__mode;
|
|
257
272
|
__instance = null;
|
|
@@ -280,7 +295,7 @@ class Ke {
|
|
|
280
295
|
const { mode: t, dsl: r, attrs: s } = e;
|
|
281
296
|
this.__mode = t, r && (this.__id = r.id || null, this.__transform = r.transform || {}), s && Object.assign(this, s);
|
|
282
297
|
}
|
|
283
|
-
setup(e, t =
|
|
298
|
+
setup(e, t = T) {
|
|
284
299
|
const r = t.getCurrentInstance();
|
|
285
300
|
if (!r)
|
|
286
301
|
return;
|
|
@@ -304,29 +319,29 @@ class Ke {
|
|
|
304
319
|
}
|
|
305
320
|
__parseFunction(e) {
|
|
306
321
|
if (e)
|
|
307
|
-
if (this.__mode ===
|
|
322
|
+
if (this.__mode === S.Runtime) {
|
|
308
323
|
const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
|
|
309
|
-
return
|
|
324
|
+
return Z({ type: r, value: s }, this);
|
|
310
325
|
} else
|
|
311
|
-
return
|
|
326
|
+
return Z(e, this);
|
|
312
327
|
}
|
|
313
328
|
__parseExpression(e) {
|
|
314
329
|
if (e)
|
|
315
|
-
if (this.__mode ===
|
|
330
|
+
if (this.__mode === S.Runtime) {
|
|
316
331
|
const { id: t, type: r } = e, s = t ? this.__transform[t] ?? e.value : e.value;
|
|
317
|
-
return
|
|
332
|
+
return I({ type: r, value: s }, this);
|
|
318
333
|
} else
|
|
319
|
-
return
|
|
334
|
+
return I(e, this);
|
|
320
335
|
}
|
|
321
336
|
__ref(e = null, t) {
|
|
322
|
-
if (this.__mode !==
|
|
337
|
+
if (this.__mode !== S.VNode)
|
|
323
338
|
return e && e !== this.__id && (this.__contextRefs[e] = this), (r) => {
|
|
324
339
|
let s = r?.$vtjEl || r?.$el || r;
|
|
325
340
|
if (!s) {
|
|
326
341
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
327
342
|
return;
|
|
328
343
|
}
|
|
329
|
-
if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e,
|
|
344
|
+
if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, S.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] = r), typeof t == "function")
|
|
330
345
|
t(r);
|
|
331
346
|
else if (t) {
|
|
332
347
|
const o = this.$refs[t];
|
|
@@ -347,10 +362,10 @@ class Ke {
|
|
|
347
362
|
return r.context.__proto__ = this.context, r.__proto__ = this, r;
|
|
348
363
|
}
|
|
349
364
|
}
|
|
350
|
-
function
|
|
365
|
+
function U(n) {
|
|
351
366
|
const {
|
|
352
|
-
Vue: e =
|
|
353
|
-
mode: t =
|
|
367
|
+
Vue: e = T,
|
|
368
|
+
mode: t = S.Runtime,
|
|
354
369
|
components: r = {},
|
|
355
370
|
libs: s = {},
|
|
356
371
|
apis: o = {},
|
|
@@ -359,31 +374,31 @@ function N(n) {
|
|
|
359
374
|
$components: r,
|
|
360
375
|
$libs: s,
|
|
361
376
|
$apis: o
|
|
362
|
-
}, c = new
|
|
377
|
+
}, c = new We({
|
|
363
378
|
mode: t,
|
|
364
379
|
dsl: i.value,
|
|
365
380
|
attrs: l
|
|
366
381
|
}), d = e.defineComponent({
|
|
367
382
|
name: i.value.name,
|
|
368
383
|
props: {
|
|
369
|
-
...
|
|
384
|
+
...Xe(i.value.props ?? [], c)
|
|
370
385
|
},
|
|
371
|
-
setup(
|
|
372
|
-
c.$props =
|
|
386
|
+
setup(u) {
|
|
387
|
+
c.$props = u, c.props = u, i.value.id && oe(
|
|
373
388
|
n.window || window,
|
|
374
389
|
i.value.id,
|
|
375
390
|
i.value.css || ""
|
|
376
|
-
), c.state =
|
|
377
|
-
const
|
|
391
|
+
), c.state = Ye(e, i.value.state ?? {}, c);
|
|
392
|
+
const p = ze(e, i.value.computed ?? {}, c), h = Ge(i.value.methods ?? {}, c), w = Ze(e, i.value.inject, c), m = et(
|
|
378
393
|
i.value.dataSources || {},
|
|
379
394
|
c
|
|
380
|
-
),
|
|
381
|
-
...
|
|
382
|
-
...
|
|
395
|
+
), g = {
|
|
396
|
+
...w,
|
|
397
|
+
...p,
|
|
383
398
|
...h,
|
|
384
|
-
...
|
|
399
|
+
...m
|
|
385
400
|
};
|
|
386
|
-
return c.setup(
|
|
401
|
+
return c.setup(g, e), tt(e, i.value.watch ?? [], c), {
|
|
387
402
|
vtj: c
|
|
388
403
|
};
|
|
389
404
|
},
|
|
@@ -392,19 +407,19 @@ function N(n) {
|
|
|
392
407
|
render() {
|
|
393
408
|
if (!i.value.nodes)
|
|
394
409
|
return null;
|
|
395
|
-
const
|
|
396
|
-
return
|
|
410
|
+
const u = i.value.nodes || [];
|
|
411
|
+
return u.length === 1 ? k(u[0], c, e, a) : u.map((p) => k(p, c, e, a));
|
|
397
412
|
},
|
|
398
|
-
...
|
|
413
|
+
...rt(i.value.lifeCycles ?? {}, c)
|
|
399
414
|
});
|
|
400
415
|
return {
|
|
401
416
|
renderer: e.markRaw(d),
|
|
402
417
|
context: c
|
|
403
418
|
};
|
|
404
419
|
}
|
|
405
|
-
function
|
|
420
|
+
function Xe(n = [], e) {
|
|
406
421
|
const t = (r) => r ? (Array.isArray(r) ? r : [r]).map((o) => Oe[o]) : void 0;
|
|
407
|
-
return n.map((r) =>
|
|
422
|
+
return n.map((r) => C(r) ? {
|
|
408
423
|
name: r
|
|
409
424
|
} : {
|
|
410
425
|
name: r.name,
|
|
@@ -420,30 +435,30 @@ function We(n = [], e) {
|
|
|
420
435
|
{}
|
|
421
436
|
);
|
|
422
437
|
}
|
|
423
|
-
function
|
|
438
|
+
function Ye(n, e, t) {
|
|
424
439
|
return n.reactive(
|
|
425
440
|
Object.keys(e || {}).reduce(
|
|
426
441
|
(r, s) => {
|
|
427
442
|
let o = e[s];
|
|
428
|
-
return _(o) ? o = t.__parseExpression(o) :
|
|
443
|
+
return _(o) ? o = t.__parseExpression(o) : A(o) && (o = t.__parseFunction(o)), r[s] = o, r;
|
|
429
444
|
},
|
|
430
445
|
{}
|
|
431
446
|
)
|
|
432
447
|
);
|
|
433
448
|
}
|
|
434
|
-
function
|
|
449
|
+
function ze(n, e, t) {
|
|
435
450
|
return Object.entries(e ?? {}).reduce(
|
|
436
451
|
(r, [s, o]) => (r[s] = n.computed(t.__parseFunction(o)), r),
|
|
437
452
|
{}
|
|
438
453
|
);
|
|
439
454
|
}
|
|
440
|
-
function
|
|
455
|
+
function Ge(n, e) {
|
|
441
456
|
return Object.entries(n ?? {}).reduce(
|
|
442
457
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
443
458
|
{}
|
|
444
459
|
);
|
|
445
460
|
}
|
|
446
|
-
function
|
|
461
|
+
function Ze(n, e = [], t) {
|
|
447
462
|
return e.reduce(
|
|
448
463
|
(r, s) => {
|
|
449
464
|
const { name: o, from: a } = s || {};
|
|
@@ -454,10 +469,10 @@ function Ge(n, e = [], t) {
|
|
|
454
469
|
{}
|
|
455
470
|
);
|
|
456
471
|
}
|
|
457
|
-
function
|
|
472
|
+
function et(n, e) {
|
|
458
473
|
return Object.keys(n).reduce(
|
|
459
474
|
(t, r) => {
|
|
460
|
-
const s = n[r], o = e.$apis[s.ref], a =
|
|
475
|
+
const s = n[r], o = e.$apis[s.ref], a = A(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
|
|
461
476
|
return t[r] = async (...i) => {
|
|
462
477
|
const l = await o.apply(e, i);
|
|
463
478
|
return a ? a(l) : l;
|
|
@@ -466,7 +481,7 @@ function Qe(n, e) {
|
|
|
466
481
|
{}
|
|
467
482
|
);
|
|
468
483
|
}
|
|
469
|
-
function
|
|
484
|
+
function tt(n, e = [], t) {
|
|
470
485
|
e.forEach((r) => {
|
|
471
486
|
n.watch(
|
|
472
487
|
t.__parseExpression(r.source),
|
|
@@ -478,19 +493,19 @@ function Ze(n, e = [], t) {
|
|
|
478
493
|
);
|
|
479
494
|
});
|
|
480
495
|
}
|
|
481
|
-
function
|
|
496
|
+
function rt(n, e) {
|
|
482
497
|
return Object.entries(n ?? {}).reduce(
|
|
483
498
|
(t, [r, s]) => (t[r] = e.__parseFunction(s), t),
|
|
484
499
|
{}
|
|
485
500
|
);
|
|
486
501
|
}
|
|
487
502
|
let B = [];
|
|
488
|
-
const
|
|
489
|
-
async function
|
|
490
|
-
const { urls: t = [], library: r } = n, s = t.filter((i) =>
|
|
503
|
+
const nt = (n) => n;
|
|
504
|
+
async function ce(n, e = window) {
|
|
505
|
+
const { urls: t = [], library: r } = n, s = t.filter((i) => K(i));
|
|
491
506
|
if (s.length === 0 || !r)
|
|
492
507
|
return null;
|
|
493
|
-
const o = t.filter((i) =>
|
|
508
|
+
const o = t.filter((i) => L(i)), a = await Be(s, r, e).catch(
|
|
494
509
|
() => null
|
|
495
510
|
);
|
|
496
511
|
return a ? {
|
|
@@ -498,70 +513,70 @@ async function ae(n, e = window) {
|
|
|
498
513
|
css: o
|
|
499
514
|
} : null;
|
|
500
515
|
}
|
|
501
|
-
function
|
|
516
|
+
function q(n) {
|
|
502
517
|
const { getDsl: e, getDslByUrl: t, options: r } = n;
|
|
503
518
|
return r.window && (B.forEach((s) => {
|
|
504
519
|
delete r.window[s];
|
|
505
|
-
}), B = []), (s, o, a =
|
|
520
|
+
}), B = []), (s, o, a = T) => !o || typeof o == "string" ? s : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
506
521
|
const i = await e(o.id);
|
|
507
|
-
return i && (i.name = s), i ?
|
|
522
|
+
return i && (i.name = s), i ? U({
|
|
508
523
|
...r,
|
|
509
524
|
Vue: a,
|
|
510
525
|
dsl: i,
|
|
511
|
-
mode:
|
|
512
|
-
loader:
|
|
526
|
+
mode: S.Runtime,
|
|
527
|
+
loader: q(n)
|
|
513
528
|
}).renderer : null;
|
|
514
529
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
|
515
530
|
const i = await t(o.url);
|
|
516
|
-
return i && (i.name = s), i ?
|
|
531
|
+
return i && (i.name = s), i ? U({
|
|
517
532
|
...r,
|
|
518
533
|
Vue: a,
|
|
519
534
|
dsl: i,
|
|
520
|
-
mode:
|
|
521
|
-
loader:
|
|
535
|
+
mode: S.Runtime,
|
|
536
|
+
loader: q(n)
|
|
522
537
|
}).renderer : null;
|
|
523
538
|
}) : o.type === "Plugin" ? (o.library && B.push(o.library), a.defineAsyncComponent(async () => {
|
|
524
|
-
const i = await
|
|
525
|
-
return i ? (
|
|
539
|
+
const i = await ce(o, r.window);
|
|
540
|
+
return i ? (ie(i.css, r.window), i.component) : null;
|
|
526
541
|
})) : s;
|
|
527
542
|
}
|
|
528
|
-
function
|
|
543
|
+
function k(n, e, t = T, r = nt) {
|
|
529
544
|
if (!n || !n.name || n.invisible)
|
|
530
545
|
return null;
|
|
531
|
-
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } =
|
|
532
|
-
if (a && !
|
|
546
|
+
const { id: s = null, directives: o = [] } = n, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } = st(o);
|
|
547
|
+
if (a && !ot(a, e))
|
|
533
548
|
return null;
|
|
534
|
-
const
|
|
535
|
-
const h =
|
|
549
|
+
const u = (p) => {
|
|
550
|
+
const h = p.$components, w = (() => {
|
|
536
551
|
if (n.name === "component")
|
|
537
|
-
return
|
|
552
|
+
return it(p, n.props?.is);
|
|
538
553
|
if (n.name === "slot")
|
|
539
554
|
return n.name;
|
|
540
|
-
const
|
|
541
|
-
return
|
|
542
|
-
})(),
|
|
555
|
+
const v = r(n.name, n.from, t);
|
|
556
|
+
return C(v) ? h[v] ?? v : v;
|
|
557
|
+
})(), m = at(s, n.props ?? {}, p), g = ct(t, n.events ?? {}, p);
|
|
543
558
|
if (n.name === "slot")
|
|
544
|
-
return
|
|
545
|
-
d && Object.assign(
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
)), c.forEach((
|
|
549
|
-
Object.assign(
|
|
559
|
+
return lt(t, n, m, p, r);
|
|
560
|
+
d && Object.assign(m, p.__parseExpression(d.value)), l && (m.style = Object.assign(
|
|
561
|
+
m.style ?? {},
|
|
562
|
+
pt(l, p)
|
|
563
|
+
)), c.forEach((v) => {
|
|
564
|
+
Object.assign(m, ft(t, v, p));
|
|
550
565
|
});
|
|
551
|
-
const
|
|
566
|
+
const f = dt(
|
|
552
567
|
t,
|
|
553
568
|
n.children ?? [],
|
|
554
|
-
|
|
569
|
+
p,
|
|
555
570
|
r,
|
|
556
571
|
n
|
|
557
572
|
);
|
|
558
|
-
return t.createVNode(
|
|
573
|
+
return t.createVNode(w, { ...m, ...g }, f);
|
|
559
574
|
};
|
|
560
|
-
return i ?
|
|
575
|
+
return i ? vt(i, u, e) : u(e);
|
|
561
576
|
}
|
|
562
|
-
function
|
|
577
|
+
function st(n = []) {
|
|
563
578
|
const e = n.find((i) => E(i.name) === "vIf"), t = n.find((i) => E(i.name) === "vFor"), r = n.find((i) => E(i.name) === "vShow"), s = n.find((i) => E(i.name) === "vBind"), o = n.filter((i) => E(i.name) === "vModel"), a = n.filter(
|
|
564
|
-
(i) => !
|
|
579
|
+
(i) => !Me.includes(E(i.name))
|
|
565
580
|
);
|
|
566
581
|
return {
|
|
567
582
|
vIf: e,
|
|
@@ -572,23 +587,23 @@ function rt(n = []) {
|
|
|
572
587
|
others: a
|
|
573
588
|
};
|
|
574
589
|
}
|
|
575
|
-
function
|
|
590
|
+
function ot(n, e) {
|
|
576
591
|
return !!e.__parseExpression(n.value);
|
|
577
592
|
}
|
|
578
|
-
function
|
|
593
|
+
function it(n, e) {
|
|
579
594
|
return e ? _(e) ? n.__parseExpression(e) : e : "div";
|
|
580
595
|
}
|
|
581
|
-
function
|
|
596
|
+
function at(n, e, t) {
|
|
582
597
|
const r = Object.keys(e || {}).reduce(
|
|
583
598
|
(s, o) => {
|
|
584
599
|
let a = e[o];
|
|
585
|
-
return _(a) ? a = t.__parseExpression(a) :
|
|
600
|
+
return _(a) ? a = t.__parseExpression(a) : A(a) && (a = t.__parseFunction(a)), s[o] = a, s;
|
|
586
601
|
},
|
|
587
602
|
{}
|
|
588
603
|
);
|
|
589
604
|
return r.ref = t.__ref(n, r.ref), r;
|
|
590
605
|
}
|
|
591
|
-
function
|
|
606
|
+
function ct(n, e, t) {
|
|
592
607
|
const r = ["passive", "capture", "once"], s = {
|
|
593
608
|
capture: "Capture",
|
|
594
609
|
once: "Once",
|
|
@@ -596,71 +611,71 @@ function it(n, e, t) {
|
|
|
596
611
|
};
|
|
597
612
|
return Object.keys(e || {}).reduce(
|
|
598
613
|
(o, a) => {
|
|
599
|
-
const i = e[a], l =
|
|
600
|
-
return
|
|
614
|
+
const i = e[a], l = le(i.modifiers), c = l.find((p) => r.includes(p)), d = "on" + $e(a) + (c && s[c] || ""), u = t.__parseFunction(i.handler);
|
|
615
|
+
return u && (o[d] = n.withModifiers(u, l)), o;
|
|
601
616
|
},
|
|
602
617
|
{}
|
|
603
618
|
);
|
|
604
619
|
}
|
|
605
|
-
function
|
|
620
|
+
function le(n = {}, e = !1) {
|
|
606
621
|
const t = Object.keys(n);
|
|
607
622
|
return e ? t.map((r) => "." + r) : t;
|
|
608
623
|
}
|
|
609
|
-
function
|
|
610
|
-
const { children: o } = e, a =
|
|
611
|
-
return i ? i(t) : o ?
|
|
612
|
-
|
|
624
|
+
function lt(n, e, t, r, s) {
|
|
625
|
+
const { children: o } = e, a = ut(e, r), i = r.$slots?.[a.name];
|
|
626
|
+
return i ? i(t) : o ? C(o) ? n.createTextVNode(o) : _(o) ? n.createTextVNode(
|
|
627
|
+
se(r.__parseExpression(o))
|
|
613
628
|
) : Array.isArray(o) ? o.map(
|
|
614
|
-
(l) =>
|
|
629
|
+
(l) => k(l, r, n, s)
|
|
615
630
|
) : null : null;
|
|
616
631
|
}
|
|
617
|
-
function
|
|
632
|
+
function ut(n, e) {
|
|
618
633
|
const { props: t } = n, r = t?.name || "default";
|
|
619
634
|
return {
|
|
620
635
|
name: _(r) ? e.__parseExpression(r) : r,
|
|
621
636
|
params: []
|
|
622
637
|
};
|
|
623
638
|
}
|
|
624
|
-
function
|
|
639
|
+
function pt(n, e) {
|
|
625
640
|
return e.__parseExpression(n.value) ? {} : {
|
|
626
641
|
display: "none"
|
|
627
642
|
};
|
|
628
643
|
}
|
|
629
|
-
function
|
|
644
|
+
function ft(n, e, t) {
|
|
630
645
|
const r = {
|
|
631
646
|
type: "JSFunction",
|
|
632
647
|
value: e.value?.value ? `(v) => {
|
|
633
648
|
${e.value.value} = v;
|
|
634
649
|
}` : "(v) => {}"
|
|
635
|
-
}, s = t.__parseFunction(r), o =
|
|
650
|
+
}, s = t.__parseFunction(r), o = le(e.modifiers), a = _(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
636
651
|
return {
|
|
637
652
|
[a]: t.__parseExpression(e.value),
|
|
638
653
|
[`onUpdate:${a}`]: o.length && s ? n.withModifiers(s, o) : s
|
|
639
654
|
};
|
|
640
655
|
}
|
|
641
|
-
function
|
|
656
|
+
function dt(n, e, t, r, s) {
|
|
642
657
|
if (!e)
|
|
643
658
|
return null;
|
|
644
|
-
if (
|
|
659
|
+
if (C(e))
|
|
645
660
|
return { default: () => e };
|
|
646
661
|
if (_(e))
|
|
647
662
|
return {
|
|
648
|
-
default: () =>
|
|
663
|
+
default: () => se(t.__parseExpression(e))
|
|
649
664
|
};
|
|
650
665
|
if (Array.isArray(e) && e.length > 0) {
|
|
651
|
-
const o =
|
|
666
|
+
const o = mt(e), a = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
652
667
|
[`scope_${s.id}`]: i
|
|
653
668
|
} : {};
|
|
654
|
-
return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (
|
|
655
|
-
const
|
|
669
|
+
return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (u) => {
|
|
670
|
+
const p = d.length ? je(u ?? {}, d) : a(u);
|
|
656
671
|
return c.map(
|
|
657
|
-
(h) =>
|
|
672
|
+
(h) => k(h, t.__clone(p), n, r)
|
|
658
673
|
);
|
|
659
674
|
}, i), {});
|
|
660
675
|
}
|
|
661
676
|
return null;
|
|
662
677
|
}
|
|
663
|
-
function
|
|
678
|
+
function mt(n) {
|
|
664
679
|
const e = {
|
|
665
680
|
default: {
|
|
666
681
|
params: [],
|
|
@@ -668,7 +683,7 @@ function ft(n) {
|
|
|
668
683
|
}
|
|
669
684
|
};
|
|
670
685
|
for (const t of n) {
|
|
671
|
-
const r =
|
|
686
|
+
const r = ht(t.slot), s = r.name;
|
|
672
687
|
e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(r.params)) : e[s] = {
|
|
673
688
|
nodes: [t],
|
|
674
689
|
params: r.params
|
|
@@ -676,19 +691,19 @@ function ft(n) {
|
|
|
676
691
|
}
|
|
677
692
|
return e;
|
|
678
693
|
}
|
|
679
|
-
function
|
|
680
|
-
return
|
|
694
|
+
function ht(n = "default") {
|
|
695
|
+
return C(n) ? { name: n, params: [] } : { params: [], ...n };
|
|
681
696
|
}
|
|
682
|
-
function
|
|
697
|
+
function vt(n, e, t) {
|
|
683
698
|
const { value: r, iterator: s } = n, { item: o = "item", index: a = "index" } = s || {};
|
|
684
699
|
let i = t.__parseExpression(r) || [];
|
|
685
700
|
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${r?.value} is not a Arrary`), []);
|
|
686
701
|
}
|
|
687
|
-
const
|
|
702
|
+
const ee = re({
|
|
688
703
|
name: "VtjPageContainer",
|
|
689
704
|
async setup() {
|
|
690
|
-
const n =
|
|
691
|
-
return r &&
|
|
705
|
+
const n = pe(), e = ne(), t = e.params.id, r = t ? n.getPage(t) : n.getHomepage(), s = r ? await n.getRenderComponent(r.id) : null;
|
|
706
|
+
return r && He(r.title || "VTJ"), {
|
|
692
707
|
provider: n,
|
|
693
708
|
component: s,
|
|
694
709
|
file: r,
|
|
@@ -696,19 +711,19 @@ const Z = te({
|
|
|
696
711
|
};
|
|
697
712
|
},
|
|
698
713
|
render() {
|
|
699
|
-
return this.component ?
|
|
714
|
+
return this.component ? N(this.component, this.query) : N("div", "页面不存在");
|
|
700
715
|
}
|
|
701
|
-
}),
|
|
716
|
+
}), yt = re({
|
|
702
717
|
name: "VtjStartupContainer",
|
|
703
718
|
render() {
|
|
704
|
-
return
|
|
719
|
+
return N(xe);
|
|
705
720
|
}
|
|
706
|
-
}),
|
|
707
|
-
class
|
|
721
|
+
}), ue = Symbol("Provider");
|
|
722
|
+
class gt extends de {
|
|
708
723
|
mode;
|
|
709
724
|
globals = {};
|
|
710
725
|
modules = {};
|
|
711
|
-
adapter = { request:
|
|
726
|
+
adapter = { request: qe, jsonp: Ee };
|
|
712
727
|
apis = {};
|
|
713
728
|
dependencies = {};
|
|
714
729
|
materials = {};
|
|
@@ -724,7 +739,7 @@ class vt extends fe {
|
|
|
724
739
|
super();
|
|
725
740
|
const {
|
|
726
741
|
service: t,
|
|
727
|
-
mode: r =
|
|
742
|
+
mode: r = S.Raw,
|
|
728
743
|
dependencies: s,
|
|
729
744
|
materials: o,
|
|
730
745
|
project: a = {},
|
|
@@ -732,71 +747,75 @@ class vt extends fe {
|
|
|
732
747
|
globals: l = {},
|
|
733
748
|
modules: c = {},
|
|
734
749
|
router: d = null,
|
|
735
|
-
materialPath:
|
|
736
|
-
nodeEnv:
|
|
750
|
+
materialPath: u = "./",
|
|
751
|
+
nodeEnv: p = "development"
|
|
737
752
|
} = e;
|
|
738
|
-
this.mode = r, this.modules = c, this.service = t, this.router = d, this.materialPath =
|
|
753
|
+
this.mode = r, this.modules = c, this.service = t, this.router = d, this.materialPath = u, this.nodeEnv = p, s && (this.dependencies = s), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i), r !== S.Design && this.load(a);
|
|
739
754
|
}
|
|
740
755
|
async load(e) {
|
|
741
756
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
742
757
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
743
758
|
throw new Error("project is null");
|
|
744
|
-
const {
|
|
745
|
-
|
|
746
|
-
|
|
759
|
+
const {
|
|
760
|
+
dependencies: r = [],
|
|
761
|
+
apis: s = [],
|
|
762
|
+
meta: o = []
|
|
763
|
+
} = this.project, { dependencies: a, library: i, components: l, materialPath: c } = this, {
|
|
764
|
+
libraryExports: d,
|
|
765
|
+
libraryMap: u,
|
|
747
766
|
materials: p,
|
|
748
|
-
materialExports:
|
|
749
|
-
materialMapLibrary:
|
|
750
|
-
} =
|
|
767
|
+
materialExports: h,
|
|
768
|
+
materialMapLibrary: w
|
|
769
|
+
} = ke(r, c), m = window;
|
|
751
770
|
m.CKEDITOR_VERSION = void 0;
|
|
752
|
-
for (const
|
|
753
|
-
const
|
|
754
|
-
if (
|
|
755
|
-
|
|
756
|
-
else if (
|
|
757
|
-
m[
|
|
771
|
+
for (const f of d) {
|
|
772
|
+
const v = a[f], b = m[f];
|
|
773
|
+
if (b)
|
|
774
|
+
i[f] = b;
|
|
775
|
+
else if (v)
|
|
776
|
+
m[f] = i[f] = await v();
|
|
758
777
|
else {
|
|
759
|
-
const $ =
|
|
778
|
+
const $ = u[f] || [];
|
|
760
779
|
for (const j of $)
|
|
761
|
-
|
|
762
|
-
|
|
780
|
+
L(j) && await Ae(f, F.append(j, { v: R })), K(j) && await Y(F.append(j, { v: R }));
|
|
781
|
+
i[f] = m[f];
|
|
763
782
|
}
|
|
764
783
|
}
|
|
765
|
-
for (const
|
|
766
|
-
await Y(F.append(
|
|
767
|
-
const
|
|
768
|
-
for (const
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
|
|
772
|
-
|
|
784
|
+
for (const f of p)
|
|
785
|
+
await Y(F.append(f, { v: R }));
|
|
786
|
+
const g = this.materials || {};
|
|
787
|
+
for (const f of h) {
|
|
788
|
+
const v = m[w[f]], b = me[f];
|
|
789
|
+
if (b)
|
|
790
|
+
v && b.forEach(($) => {
|
|
791
|
+
l[$] = v[$];
|
|
773
792
|
});
|
|
774
793
|
else {
|
|
775
|
-
const $ =
|
|
776
|
-
$ &&
|
|
777
|
-
|
|
794
|
+
const $ = g[f] ? (await g[f]()).default : m[f];
|
|
795
|
+
$ && v && ($.components || []).forEach((j) => {
|
|
796
|
+
l[j.name] = Te(j, v);
|
|
778
797
|
});
|
|
779
798
|
}
|
|
780
799
|
}
|
|
781
|
-
|
|
800
|
+
this.apis = Le(s, o, this.adapter), ae(), this.project.config?.mock && Ke(s), this.initRouter(), this.triggerReady();
|
|
782
801
|
}
|
|
783
802
|
initRouter() {
|
|
784
803
|
const { router: e, project: t } = this;
|
|
785
804
|
e && (e.addRoute({
|
|
786
805
|
path: "/page/:id",
|
|
787
806
|
name: "VtjPage",
|
|
788
|
-
component:
|
|
807
|
+
component: ee
|
|
789
808
|
}), e.addRoute({
|
|
790
809
|
path: "/",
|
|
791
810
|
name: "VtjHomepage",
|
|
792
|
-
component: t?.homepage ?
|
|
811
|
+
component: t?.homepage ? ee : yt
|
|
793
812
|
}));
|
|
794
813
|
}
|
|
795
814
|
install(e) {
|
|
796
815
|
const t = e.config.globalProperties.installed || {};
|
|
797
816
|
for (const [r, s] of Object.entries(this.library))
|
|
798
|
-
!t[r] &&
|
|
799
|
-
e.provide(
|
|
817
|
+
!t[r] && Ne(s) && (e.use(s), t[r] = !0);
|
|
818
|
+
e.provide(ue, this), e.config.globalProperties.installed = t;
|
|
800
819
|
}
|
|
801
820
|
getFile(e) {
|
|
802
821
|
const { blocks: t = [] } = this.project || {};
|
|
@@ -844,12 +863,12 @@ class vt extends fe {
|
|
|
844
863
|
apis: a,
|
|
845
864
|
window,
|
|
846
865
|
...t
|
|
847
|
-
}, l =
|
|
866
|
+
}, l = q({
|
|
848
867
|
getDsl: async (c) => await this.getDsl(c) || null,
|
|
849
868
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
|
850
869
|
options: i
|
|
851
870
|
});
|
|
852
|
-
return
|
|
871
|
+
return U({
|
|
853
872
|
...i,
|
|
854
873
|
dsl: e,
|
|
855
874
|
loader: l
|
|
@@ -873,27 +892,27 @@ class vt extends fe {
|
|
|
873
892
|
}
|
|
874
893
|
definePluginComponent(e) {
|
|
875
894
|
return z(async () => {
|
|
876
|
-
const t = await
|
|
877
|
-
return t ? (
|
|
895
|
+
const t = await ce(e, window);
|
|
896
|
+
return t ? (ie(t.css), t.component) : null;
|
|
878
897
|
});
|
|
879
898
|
}
|
|
880
899
|
}
|
|
881
|
-
function
|
|
882
|
-
const e = new
|
|
900
|
+
function Ot(n) {
|
|
901
|
+
const e = new gt(n);
|
|
883
902
|
return {
|
|
884
903
|
provider: e,
|
|
885
904
|
onReady: (r) => e.ready(r)
|
|
886
905
|
};
|
|
887
906
|
}
|
|
888
|
-
function
|
|
889
|
-
const e =
|
|
907
|
+
function pe(n = {}) {
|
|
908
|
+
const e = Ce(ue);
|
|
890
909
|
if (!e)
|
|
891
910
|
throw new Error("Can not find provider");
|
|
892
911
|
if (e.nodeEnv === "development") {
|
|
893
912
|
const { id: t, version: r } = n;
|
|
894
913
|
t && r && (async () => {
|
|
895
914
|
const s = await e.getDsl(t);
|
|
896
|
-
s?.__VERSION__ !== r &&
|
|
915
|
+
s?.__VERSION__ !== r && V.warning({
|
|
897
916
|
title: s?.name,
|
|
898
917
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
899
918
|
});
|
|
@@ -901,7 +920,7 @@ function ue(n = {}) {
|
|
|
901
920
|
}
|
|
902
921
|
return e;
|
|
903
922
|
}
|
|
904
|
-
const
|
|
923
|
+
const Q = new Pe({
|
|
905
924
|
settings: {
|
|
906
925
|
type: "json",
|
|
907
926
|
validSuccess: !0,
|
|
@@ -909,12 +928,12 @@ const K = new Ee({
|
|
|
909
928
|
failMessage: !0,
|
|
910
929
|
validate: (n) => n.data?.code === 0,
|
|
911
930
|
showError: (n) => {
|
|
912
|
-
|
|
931
|
+
V.error({
|
|
913
932
|
message: n || "未知错误"
|
|
914
933
|
});
|
|
915
934
|
}
|
|
916
935
|
}
|
|
917
|
-
}),
|
|
936
|
+
}), _t = (n = "/vtj/local/repository/${type}.json") => (e, t) => Q.send({
|
|
918
937
|
url: n,
|
|
919
938
|
method: "post",
|
|
920
939
|
query: { type: e },
|
|
@@ -922,7 +941,7 @@ const K = new Ee({
|
|
|
922
941
|
type: e,
|
|
923
942
|
data: t
|
|
924
943
|
}
|
|
925
|
-
}),
|
|
944
|
+
}), wt = (n = "/vtj/local/repository/uploader.json") => async (e, t) => await Q.send({
|
|
926
945
|
url: n,
|
|
927
946
|
method: "post",
|
|
928
947
|
data: {
|
|
@@ -938,7 +957,7 @@ class W {
|
|
|
938
957
|
pluginCaches = {};
|
|
939
958
|
uploader;
|
|
940
959
|
constructor() {
|
|
941
|
-
this.api =
|
|
960
|
+
this.api = _t(), this.uploader = wt();
|
|
942
961
|
}
|
|
943
962
|
async getExtension() {
|
|
944
963
|
console.log("BaseService.getExtension");
|
|
@@ -1015,7 +1034,7 @@ class W {
|
|
|
1015
1034
|
if (!r)
|
|
1016
1035
|
return null;
|
|
1017
1036
|
const s = this.pluginCaches[r];
|
|
1018
|
-
return s || (this.pluginCaches[r] =
|
|
1037
|
+
return s || (this.pluginCaches[r] = Q.send({
|
|
1019
1038
|
url: r,
|
|
1020
1039
|
method: "get",
|
|
1021
1040
|
settings: {
|
|
@@ -1025,22 +1044,22 @@ class W {
|
|
|
1025
1044
|
}).then((o) => o.data).catch(() => null));
|
|
1026
1045
|
}
|
|
1027
1046
|
}
|
|
1028
|
-
const y = new
|
|
1047
|
+
const y = new Fe({
|
|
1029
1048
|
type: "local",
|
|
1030
1049
|
expired: 0,
|
|
1031
1050
|
prefix: "__VTJ_"
|
|
1032
1051
|
});
|
|
1033
|
-
class
|
|
1052
|
+
class Dt extends W {
|
|
1034
1053
|
init(e) {
|
|
1035
|
-
const t = new
|
|
1054
|
+
const t = new M(e), r = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), r || {});
|
|
1036
1055
|
return y.save(`project_${t.id}`, s), Promise.resolve(s);
|
|
1037
1056
|
}
|
|
1038
1057
|
saveProject(e) {
|
|
1039
|
-
const t = new
|
|
1058
|
+
const t = new M(e);
|
|
1040
1059
|
return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
1041
1060
|
}
|
|
1042
1061
|
saveMaterials(e, t) {
|
|
1043
|
-
return y.save(`materials_${e.id}`,
|
|
1062
|
+
return y.save(`materials_${e.id}`, J(t)), Promise.resolve(!0);
|
|
1044
1063
|
}
|
|
1045
1064
|
saveFile(e) {
|
|
1046
1065
|
return y.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -1064,7 +1083,7 @@ class Ot extends W {
|
|
|
1064
1083
|
return Promise.resolve(!0);
|
|
1065
1084
|
}
|
|
1066
1085
|
getHistory(e) {
|
|
1067
|
-
const t = y.get(`history_${e}`), r = new
|
|
1086
|
+
const t = y.get(`history_${e}`), r = new te(t || { id: e });
|
|
1068
1087
|
return Promise.resolve(r.toDsl());
|
|
1069
1088
|
}
|
|
1070
1089
|
getHistoryItem(e, t) {
|
|
@@ -1080,22 +1099,22 @@ class Ot extends W {
|
|
|
1080
1099
|
}), Promise.resolve(!0);
|
|
1081
1100
|
}
|
|
1082
1101
|
}
|
|
1083
|
-
class
|
|
1102
|
+
class St extends W {
|
|
1084
1103
|
projects = {};
|
|
1085
1104
|
materials = {};
|
|
1086
1105
|
files = {};
|
|
1087
1106
|
histories = {};
|
|
1088
1107
|
historyItems = {};
|
|
1089
1108
|
init(e) {
|
|
1090
|
-
const t = new
|
|
1109
|
+
const t = new M(e), r = this.projects[t.id] || {}, s = Object.assign(t.toDsl(), r);
|
|
1091
1110
|
return this.projects[s.id] = s, Promise.resolve(s);
|
|
1092
1111
|
}
|
|
1093
1112
|
saveProject(e) {
|
|
1094
|
-
const t = new
|
|
1113
|
+
const t = new M(e);
|
|
1095
1114
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
1096
1115
|
}
|
|
1097
1116
|
saveMaterials(e, t) {
|
|
1098
|
-
return e.id && (this.materials[e.id] =
|
|
1117
|
+
return e.id && (this.materials[e.id] = J(t)), Promise.resolve(!0);
|
|
1099
1118
|
}
|
|
1100
1119
|
saveFile(e) {
|
|
1101
1120
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1119,7 +1138,7 @@ class _t extends W {
|
|
|
1119
1138
|
return Promise.resolve(!0);
|
|
1120
1139
|
}
|
|
1121
1140
|
getHistory(e) {
|
|
1122
|
-
const t = this.histories[e], r = new
|
|
1141
|
+
const t = this.histories[e], r = new te(t || { id: e });
|
|
1123
1142
|
return Promise.resolve(r);
|
|
1124
1143
|
}
|
|
1125
1144
|
getHistoryItem(e, t) {
|
|
@@ -1137,11 +1156,11 @@ class _t extends W {
|
|
|
1137
1156
|
}), Promise.resolve(!0);
|
|
1138
1157
|
}
|
|
1139
1158
|
}
|
|
1140
|
-
let
|
|
1141
|
-
function
|
|
1142
|
-
return
|
|
1159
|
+
let x = null;
|
|
1160
|
+
function kt() {
|
|
1161
|
+
return x || (x = new St(), x);
|
|
1143
1162
|
}
|
|
1144
|
-
class
|
|
1163
|
+
class Tt extends W {
|
|
1145
1164
|
getFileCaches = {};
|
|
1146
1165
|
async getExtension() {
|
|
1147
1166
|
return await this.api("getExtension", {}).catch(() => {
|
|
@@ -1156,7 +1175,7 @@ class Mt extends W {
|
|
|
1156
1175
|
async saveMaterials(e, t) {
|
|
1157
1176
|
return !!await this.api("saveMaterials", {
|
|
1158
1177
|
project: e,
|
|
1159
|
-
materials:
|
|
1178
|
+
materials: J(t)
|
|
1160
1179
|
}).catch(() => !1);
|
|
1161
1180
|
}
|
|
1162
1181
|
async saveFile(e) {
|
|
@@ -1196,7 +1215,7 @@ class Mt extends W {
|
|
|
1196
1215
|
);
|
|
1197
1216
|
}
|
|
1198
1217
|
}
|
|
1199
|
-
function
|
|
1218
|
+
function fe(n = []) {
|
|
1200
1219
|
return n.map((e) => {
|
|
1201
1220
|
const { id: t, title: r, icon: s, children: o, hidden: a } = e;
|
|
1202
1221
|
return {
|
|
@@ -1205,13 +1224,13 @@ function pe(n = []) {
|
|
|
1205
1224
|
icon: s,
|
|
1206
1225
|
hidden: a,
|
|
1207
1226
|
url: `/page/${t}`,
|
|
1208
|
-
children: o && o.length ?
|
|
1227
|
+
children: o && o.length ? fe(o) : void 0
|
|
1209
1228
|
};
|
|
1210
1229
|
});
|
|
1211
1230
|
}
|
|
1212
|
-
function
|
|
1213
|
-
const n =
|
|
1214
|
-
|
|
1231
|
+
function At() {
|
|
1232
|
+
const n = pe(), e = ne(), t = be(!1), r = n.project;
|
|
1233
|
+
Re(() => {
|
|
1215
1234
|
const { name: a, params: i, meta: l } = e;
|
|
1216
1235
|
if (a === "VtjPage") {
|
|
1217
1236
|
const c = n.getPage(i.id);
|
|
@@ -1222,7 +1241,7 @@ function kt() {
|
|
|
1222
1241
|
} else
|
|
1223
1242
|
t.value = !l.mask;
|
|
1224
1243
|
});
|
|
1225
|
-
const s =
|
|
1244
|
+
const s = fe(r?.pages), o = r?.config;
|
|
1226
1245
|
return {
|
|
1227
1246
|
disabled: t,
|
|
1228
1247
|
logo: o?.logo,
|
|
@@ -1232,53 +1251,54 @@ function kt() {
|
|
|
1232
1251
|
};
|
|
1233
1252
|
}
|
|
1234
1253
|
export {
|
|
1235
|
-
|
|
1254
|
+
Me as BUILT_IN_DIRECTIVES,
|
|
1236
1255
|
W as BaseService,
|
|
1237
1256
|
G as CONTEXT_HOST,
|
|
1238
|
-
|
|
1239
|
-
|
|
1257
|
+
We as Context,
|
|
1258
|
+
S as ContextMode,
|
|
1240
1259
|
Oe as DATA_TYPES,
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
Je as
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1260
|
+
Mt as JSCodeToString,
|
|
1261
|
+
It as LIFE_CYCLES_LIST,
|
|
1262
|
+
Tt as LocalService,
|
|
1263
|
+
St as MemoryService,
|
|
1264
|
+
gt as Provider,
|
|
1265
|
+
Dt as StorageService,
|
|
1266
|
+
R as VTJ_RENDERER_VERSION,
|
|
1267
|
+
oe as adoptedStyleSheets,
|
|
1268
|
+
Ht as createAssetScripts,
|
|
1269
|
+
xt as createAssetsCss,
|
|
1270
|
+
et as createDataSources,
|
|
1271
|
+
q as createLoader,
|
|
1272
|
+
kt as createMemoryService,
|
|
1273
|
+
Ve as createMetaApi,
|
|
1274
|
+
Ot as createProvider,
|
|
1275
|
+
U as createRenderer,
|
|
1276
|
+
Je as createSchemaApi,
|
|
1277
|
+
Le as createSchemaApis,
|
|
1278
|
+
nt as defaultLoader,
|
|
1279
|
+
H as fillBasePath,
|
|
1280
|
+
le as getModifiers,
|
|
1281
|
+
ce as getPlugin,
|
|
1282
|
+
Te as getRawComponent,
|
|
1283
|
+
L as isCSSUrl,
|
|
1284
|
+
Ue as isJSCode,
|
|
1265
1285
|
_ as isJSExpression,
|
|
1266
|
-
|
|
1286
|
+
A as isJSFunction,
|
|
1267
1287
|
De as isJSON,
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1288
|
+
K as isJSUrl,
|
|
1289
|
+
Ne as isVuePlugin,
|
|
1290
|
+
Ae as loadCss,
|
|
1291
|
+
ie as loadCssUrl,
|
|
1272
1292
|
Be as loadScriptUrl,
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1293
|
+
Qe as mockApi,
|
|
1294
|
+
Ke as mockApis,
|
|
1295
|
+
ae as mockCleanup,
|
|
1296
|
+
k as nodeRender,
|
|
1297
|
+
ke as parseDeps,
|
|
1298
|
+
I as parseExpression,
|
|
1299
|
+
Z as parseFunction,
|
|
1300
|
+
ue as providerKey,
|
|
1301
|
+
se as toString,
|
|
1302
|
+
At as useMask,
|
|
1303
|
+
pe as useProvider
|
|
1284
1304
|
};
|