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