@vtj/renderer 0.7.30 → 0.7.32
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 +433 -404
- package/package.json +8 -7
- package/types/hooks/mask.d.ts +2 -0
- package/types/provider/apis.d.ts +29 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { Base as
|
|
2
|
-
import { isUrl as
|
|
3
|
-
import * as
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
import { ElNotification as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
1
|
+
import { Base as le, BUILT_IN_COMPONENTS as ue, ProjectModel as C, HistoryModel as G } from "@vtj/core";
|
|
2
|
+
import { isUrl as pe, url as P, dedupArray as fe, isString as b, isFunction as q, logger as T, createRequest as me, merge as de, pathToRegexp as he, pathToRegexpMatch as ve, formDataToJson as _e, camelCase as j, upperFirst as ye, pick as ge, jsonp as we, loadScript as U, Request as Se, Storage as $e, mapToObject as D } from "@vtj/utils";
|
|
3
|
+
import * as k from "vue";
|
|
4
|
+
import { defineComponent as V, h as B, openBlock as je, createElementBlock as Ee, createElementVNode as F, toDisplayString as A, createVNode as Pe, unref as z, withCtx as be, createTextVNode as Fe, inject as Ie, ref as Re, watchEffect as xe } from "vue";
|
|
5
|
+
import { useRoute as X } from "vue-router";
|
|
6
|
+
import { ElNotification as J, ElLoading as He, ElButton as Ce } from "element-plus";
|
|
7
|
+
import M from "mockjs";
|
|
8
|
+
import { useTitle as Te } from "@vueuse/core";
|
|
9
|
+
import { EditPen as Me } from "@vtj/icons";
|
|
9
10
|
/**!
|
|
10
11
|
* Copyright (c) 2024, VTJ.PRO All rights reserved.
|
|
11
12
|
* @name @vtj/renderer
|
|
12
13
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
13
|
-
* @version 0.7.
|
|
14
|
+
* @version 0.7.32
|
|
14
15
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
15
16
|
*/
|
|
16
|
-
const I = "0.7.
|
|
17
|
-
var w = /* @__PURE__ */ ((
|
|
18
|
-
const
|
|
17
|
+
const I = "0.7.32";
|
|
18
|
+
var w = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(w || {});
|
|
19
|
+
const K = [
|
|
19
20
|
"$el",
|
|
20
21
|
"$emit",
|
|
21
22
|
"$nextTick",
|
|
@@ -27,7 +28,7 @@ const z = [
|
|
|
27
28
|
"$props",
|
|
28
29
|
"$options",
|
|
29
30
|
"$forceUpdate"
|
|
30
|
-
],
|
|
31
|
+
], Nt = [
|
|
31
32
|
"beforeCreate",
|
|
32
33
|
"created",
|
|
33
34
|
"beforeMount",
|
|
@@ -41,7 +42,7 @@ const z = [
|
|
|
41
42
|
"renderTriggered",
|
|
42
43
|
"activated",
|
|
43
44
|
"deactivated"
|
|
44
|
-
],
|
|
45
|
+
], Oe = ["vIf", "vShow", "vModel", "vFor", "vBind"], ke = {
|
|
45
46
|
String,
|
|
46
47
|
Number,
|
|
47
48
|
Boolean,
|
|
@@ -50,123 +51,123 @@ const z = [
|
|
|
50
51
|
Function,
|
|
51
52
|
Date
|
|
52
53
|
};
|
|
53
|
-
function
|
|
54
|
-
return
|
|
54
|
+
function x(r, e) {
|
|
55
|
+
return r.map((t) => pe(t) ? t : `${e}${t}`);
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
-
return /\.css$/.test(
|
|
57
|
+
function Q(r) {
|
|
58
|
+
return /\.css$/.test(r);
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
-
return /\.js$/.test(
|
|
60
|
+
function Z(r) {
|
|
61
|
+
return /\.js$/.test(r);
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
64
|
-
(e) => `<script src="${
|
|
63
|
+
function At(r) {
|
|
64
|
+
return r.map(
|
|
65
|
+
(e) => `<script src="${P.append(e, { v: I })}"><\/script>`
|
|
65
66
|
).join("");
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
69
|
-
(e) => `<link rel="stylesheet" href="${
|
|
68
|
+
function Bt(r = []) {
|
|
69
|
+
return r.map(
|
|
70
|
+
(e) => `<link rel="stylesheet" href="${P.append(e, { v: I })}" />`
|
|
70
71
|
).join("");
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
const t =
|
|
74
|
-
return t.forEach(({ urls:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}), u && (i.push(u), a[u] =
|
|
73
|
+
function Ne(r, e) {
|
|
74
|
+
const t = r.filter((m) => !!m.enabled), s = [], n = [], o = [], i = [], a = {}, l = [], c = {};
|
|
75
|
+
return t.forEach(({ urls: m, assetsUrl: f, library: u, assetsLibrary: v }) => {
|
|
76
|
+
m?.forEach((_) => {
|
|
77
|
+
Z(_) && s.push(_), Q(_) && n.push(_);
|
|
78
|
+
}), u && (i.push(u), a[u] = x(m || [], e)), f && o.push(f), v && l.push(v), u && v && (c[v] = u);
|
|
78
79
|
}), {
|
|
79
|
-
scripts:
|
|
80
|
-
css:
|
|
81
|
-
materials:
|
|
80
|
+
scripts: x(s, e),
|
|
81
|
+
css: x(n, e),
|
|
82
|
+
materials: x(o, e),
|
|
82
83
|
libraryExports: i,
|
|
83
|
-
materialExports:
|
|
84
|
+
materialExports: fe(l),
|
|
84
85
|
materialMapLibrary: c,
|
|
85
86
|
libraryMap: a
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
-
const { name: t, parent:
|
|
90
|
-
return
|
|
89
|
+
function Ae(r, e) {
|
|
90
|
+
const { name: t, parent: s, alias: n } = r;
|
|
91
|
+
return s ? e[s]?.[n || t] : e[n || t];
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
93
|
+
function ee(r) {
|
|
94
|
+
return b(r) ? r : JSON.stringify(r);
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
const n = new
|
|
96
|
+
function te(r, e, t) {
|
|
97
|
+
const s = r.CSSStyleSheet;
|
|
98
|
+
if (s.prototype.replaceSync) {
|
|
99
|
+
const n = new s();
|
|
99
100
|
n.id = e, n.replaceSync(t);
|
|
100
|
-
const o =
|
|
101
|
+
const o = r.document, i = o.adoptedStyleSheets, a = Array.from(i).filter(
|
|
101
102
|
(l) => l.id !== e
|
|
102
103
|
);
|
|
103
104
|
o.adoptedStyleSheets = [...a, n];
|
|
104
105
|
} else {
|
|
105
|
-
const n =
|
|
106
|
+
const n = r.document;
|
|
106
107
|
let o = n.getElementById(e);
|
|
107
108
|
o ? o.innerHTML = t : (o = n.createElement("style"), o.id = e, o.innerHTML = t, n.head.appendChild(o));
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
|
-
async function
|
|
111
|
-
const t = await window.fetch(e).then((
|
|
112
|
-
t &&
|
|
111
|
+
async function Be(r, e) {
|
|
112
|
+
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
|
113
|
+
t && te(window, r, t);
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
115
|
+
function De(r) {
|
|
116
|
+
return q(r) || q(r?.install);
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
+
function R(r, e, t = !1, s = !1) {
|
|
118
119
|
try {
|
|
119
120
|
const n = ['"use strict";', "var __self = arguments[0];"];
|
|
120
121
|
n.push("return ");
|
|
121
|
-
let o = (
|
|
122
|
+
let o = (r.value || "").trim();
|
|
122
123
|
o = o.replace(/this(\W|$)/g, (a, l) => `__self${l}`), o = n.join(`
|
|
123
124
|
`) + o;
|
|
124
125
|
const i = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
125
126
|
return new Function("$scope", i)(e);
|
|
126
127
|
} catch (n) {
|
|
127
|
-
if (
|
|
128
|
+
if (T.error("parseExpression.error", n, r, e?.__self ?? e), s)
|
|
128
129
|
throw n;
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
-
const n =
|
|
133
|
-
if (typeof n != "function" && (
|
|
132
|
+
function W(r, e, t = !1, s = !1) {
|
|
133
|
+
const n = R(r, e, t, s);
|
|
134
|
+
if (typeof n != "function" && (T.error(
|
|
134
135
|
"parseFunction.error",
|
|
135
136
|
"not a function",
|
|
136
|
-
|
|
137
|
+
r,
|
|
137
138
|
e?.__self ?? e
|
|
138
|
-
),
|
|
139
|
-
throw new Error(`"${
|
|
139
|
+
), s))
|
|
140
|
+
throw new Error(`"${r.value}" not a function`);
|
|
140
141
|
return n;
|
|
141
142
|
}
|
|
142
|
-
function g(
|
|
143
|
-
return
|
|
143
|
+
function g(r) {
|
|
144
|
+
return r && r.type === "JSExpression";
|
|
144
145
|
}
|
|
145
|
-
function N(
|
|
146
|
-
return typeof
|
|
146
|
+
function N(r) {
|
|
147
|
+
return typeof r == "object" && r && r.type === "JSFunction";
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
-
return g(
|
|
149
|
+
function Ve(r) {
|
|
150
|
+
return g(r) || N(r);
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
152
|
+
function Dt(r) {
|
|
153
|
+
return Ve(r) ? r.value : JSON.stringify(r);
|
|
153
154
|
}
|
|
154
155
|
let E = null;
|
|
155
|
-
const
|
|
156
|
+
const Je = me({
|
|
156
157
|
settings: {
|
|
157
158
|
type: "form",
|
|
158
159
|
validSuccess: !0,
|
|
159
160
|
originResponse: !1,
|
|
160
161
|
loading: !0,
|
|
161
|
-
validate: (
|
|
162
|
+
validate: (r) => r.data?.code === 0 || !!r.data?.success,
|
|
162
163
|
failMessage: !0,
|
|
163
|
-
showError: (
|
|
164
|
-
|
|
165
|
-
message:
|
|
164
|
+
showError: (r) => {
|
|
165
|
+
J.error({
|
|
166
|
+
message: r || "未知错误"
|
|
166
167
|
});
|
|
167
168
|
},
|
|
168
169
|
showLoading: () => {
|
|
169
|
-
E && E.close(), E =
|
|
170
|
+
E && E.close(), E = He.service({
|
|
170
171
|
lock: !0,
|
|
171
172
|
text: "Loading",
|
|
172
173
|
background: "rgba(0, 0, 0, 0.05)"
|
|
@@ -177,29 +178,52 @@ const Be = pe({
|
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
});
|
|
180
|
-
function
|
|
181
|
-
const { jsonp: t, request:
|
|
182
|
-
if (
|
|
183
|
-
return (n = {}) => t(
|
|
184
|
-
...
|
|
181
|
+
function Le(r, e) {
|
|
182
|
+
const { jsonp: t, request: s } = e;
|
|
183
|
+
if (r.method === "jsonp")
|
|
184
|
+
return (n = {}) => t(r.url, {
|
|
185
|
+
...r.jsonpOptions,
|
|
185
186
|
query: n
|
|
186
187
|
});
|
|
187
188
|
{
|
|
188
|
-
const n =
|
|
189
|
-
url:
|
|
190
|
-
method:
|
|
189
|
+
const n = r.headers ? R(r.headers, {}, !0) : void 0, o = {
|
|
190
|
+
url: r.url,
|
|
191
|
+
method: r.method,
|
|
191
192
|
settings: {
|
|
192
|
-
...
|
|
193
|
+
...r.settings,
|
|
193
194
|
headers: n
|
|
194
195
|
}
|
|
195
196
|
};
|
|
196
|
-
return (i, a) =>
|
|
197
|
+
return (i, a) => s.send(de(o, a || {}, { data: i }));
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
-
return
|
|
200
|
+
function qe(r = [], e) {
|
|
201
|
+
return r.reduce(
|
|
202
|
+
(t, s) => (t[s.id] = Le(s, e), t),
|
|
203
|
+
{}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
function Ue(r = []) {
|
|
207
|
+
M.setup({
|
|
208
|
+
timeout: "50-500"
|
|
209
|
+
}), re(), r.forEach((e) => ze(e));
|
|
210
|
+
}
|
|
211
|
+
function ze(r) {
|
|
212
|
+
if (!r.mock)
|
|
213
|
+
return;
|
|
214
|
+
const { url: e, mockTemplate: t } = r;
|
|
215
|
+
if (e && t) {
|
|
216
|
+
const s = he(`${e}(.*)`), n = ve(e, { decode: decodeURIComponent }), o = R(t, {}, !0);
|
|
217
|
+
M.mock(s, (i) => {
|
|
218
|
+
const a = P.parse(i.url) || {}, l = i.body instanceof FormData ? _e(i.body) : i.body, c = n(i.url)?.params;
|
|
219
|
+
return Object.assign(i, { data: l, params: a, query: c }), M.mock(o(i));
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function re() {
|
|
224
|
+
M._mocked = {};
|
|
201
225
|
}
|
|
202
|
-
class
|
|
226
|
+
class Ke {
|
|
203
227
|
__id = null;
|
|
204
228
|
__mode;
|
|
205
229
|
__instance = null;
|
|
@@ -224,15 +248,15 @@ class De {
|
|
|
224
248
|
$apis = {};
|
|
225
249
|
__transform = {};
|
|
226
250
|
constructor(e) {
|
|
227
|
-
const { mode: t, dsl:
|
|
228
|
-
this.__mode = t,
|
|
251
|
+
const { mode: t, dsl: s, attrs: n } = e;
|
|
252
|
+
this.__mode = t, s && (this.__id = s.id || null, this.__transform = s.transform || {}), n && Object.assign(this, n);
|
|
229
253
|
}
|
|
230
|
-
setup(e, t =
|
|
231
|
-
const
|
|
232
|
-
if (!
|
|
254
|
+
setup(e, t = k) {
|
|
255
|
+
const s = t.getCurrentInstance();
|
|
256
|
+
if (!s)
|
|
233
257
|
return;
|
|
234
|
-
this.__instance =
|
|
235
|
-
const n =
|
|
258
|
+
this.__instance = s.proxy;
|
|
259
|
+
const n = s.appContext.config.globalProperties;
|
|
236
260
|
Object.assign(this, n), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
|
237
261
|
this.__proxy();
|
|
238
262
|
}), t.onUnmounted(() => {
|
|
@@ -240,88 +264,88 @@ class De {
|
|
|
240
264
|
});
|
|
241
265
|
}
|
|
242
266
|
__proxy() {
|
|
243
|
-
this.__instance &&
|
|
267
|
+
this.__instance && K.forEach((e) => {
|
|
244
268
|
this[e] = this.__instance?.[e];
|
|
245
269
|
});
|
|
246
270
|
}
|
|
247
271
|
__cleanup() {
|
|
248
|
-
|
|
272
|
+
K.forEach((e) => {
|
|
249
273
|
this[e] = null;
|
|
250
274
|
});
|
|
251
275
|
}
|
|
252
276
|
__parseFunction(e) {
|
|
253
277
|
if (e)
|
|
254
278
|
if (this.__mode === w.Runtime) {
|
|
255
|
-
const { id: t, type:
|
|
256
|
-
return
|
|
279
|
+
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
|
280
|
+
return W({ type: s, value: n }, this);
|
|
257
281
|
} else
|
|
258
|
-
return
|
|
282
|
+
return W(e, this);
|
|
259
283
|
}
|
|
260
284
|
__parseExpression(e) {
|
|
261
285
|
if (e)
|
|
262
286
|
if (this.__mode === w.Runtime) {
|
|
263
|
-
const { id: t, type:
|
|
264
|
-
return
|
|
287
|
+
const { id: t, type: s } = e, n = t ? this.__transform[t] ?? e.value : e.value;
|
|
288
|
+
return R({ type: s, value: n }, this);
|
|
265
289
|
} else
|
|
266
|
-
return
|
|
290
|
+
return R(e, this);
|
|
267
291
|
}
|
|
268
292
|
__ref(e = null, t) {
|
|
269
293
|
if (this.__mode !== w.VNode)
|
|
270
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), (
|
|
271
|
-
let n =
|
|
294
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), (s) => {
|
|
295
|
+
let n = s?.$vtjEl || s?.$el || s;
|
|
272
296
|
if (!n) {
|
|
273
297
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
274
298
|
return;
|
|
275
299
|
}
|
|
276
|
-
if (n.__vtj__ = e, n.nodeType === 3 && n.nextSibling && (n = n.nextSibling), w.Design === this.__mode && (n.__context__ = this), e && (this.__refs[e] =
|
|
277
|
-
t(
|
|
300
|
+
if (n.__vtj__ = e, n.nodeType === 3 && n.nextSibling && (n = n.nextSibling), w.Design === this.__mode && (n.__context__ = this), e && (this.__refs[e] = s), typeof t == "function")
|
|
301
|
+
t(s);
|
|
278
302
|
else if (t) {
|
|
279
303
|
const o = this.$refs[t];
|
|
280
304
|
if (o) {
|
|
281
|
-
const i = new Set([].concat(o,
|
|
305
|
+
const i = new Set([].concat(o, s));
|
|
282
306
|
this.$refs[t] = Array.from(i);
|
|
283
307
|
} else
|
|
284
|
-
this.$refs[t] =
|
|
308
|
+
this.$refs[t] = s;
|
|
285
309
|
}
|
|
286
|
-
return
|
|
310
|
+
return s;
|
|
287
311
|
};
|
|
288
312
|
}
|
|
289
313
|
__clone(e = {}) {
|
|
290
|
-
const t = { ...this.context, ...e },
|
|
314
|
+
const t = { ...this.context, ...e }, s = {
|
|
291
315
|
...t,
|
|
292
316
|
context: t
|
|
293
317
|
};
|
|
294
|
-
return
|
|
318
|
+
return s.context.__proto__ = this.context, s.__proto__ = this, s;
|
|
295
319
|
}
|
|
296
320
|
}
|
|
297
|
-
function
|
|
321
|
+
function se(r) {
|
|
298
322
|
const {
|
|
299
|
-
Vue: e =
|
|
323
|
+
Vue: e = k,
|
|
300
324
|
mode: t = w.Runtime,
|
|
301
|
-
components:
|
|
325
|
+
components: s = {},
|
|
302
326
|
libs: n = {},
|
|
303
327
|
apis: o = {},
|
|
304
328
|
loader: i
|
|
305
|
-
} =
|
|
306
|
-
$components:
|
|
329
|
+
} = r, a = e.computed(() => r.dsl), l = {
|
|
330
|
+
$components: s,
|
|
307
331
|
$libs: n,
|
|
308
332
|
$apis: o
|
|
309
|
-
}, c = new
|
|
333
|
+
}, c = new Ke({
|
|
310
334
|
mode: t,
|
|
311
335
|
dsl: a.value,
|
|
312
336
|
attrs: l
|
|
313
|
-
}),
|
|
337
|
+
}), m = e.defineComponent({
|
|
314
338
|
name: a.value.name,
|
|
315
339
|
props: {
|
|
316
|
-
...
|
|
340
|
+
...We(a.value.props ?? [], c)
|
|
317
341
|
},
|
|
318
342
|
setup(f) {
|
|
319
|
-
c.$props = f, a.value.id &&
|
|
320
|
-
|
|
343
|
+
c.$props = f, a.value.id && te(
|
|
344
|
+
r.window || window,
|
|
321
345
|
a.value.id,
|
|
322
346
|
a.value.css || ""
|
|
323
|
-
), c.state =
|
|
324
|
-
const u =
|
|
347
|
+
), c.state = Ye(e, a.value.state ?? {}, c);
|
|
348
|
+
const u = Ge(e, a.value.computed ?? {}, c), v = Xe(a.value.methods ?? {}, c), _ = Qe(e, a.value.inject, c), p = Ze(
|
|
325
349
|
a.value.dataSources || {},
|
|
326
350
|
c
|
|
327
351
|
), y = {
|
|
@@ -330,7 +354,7 @@ function te(s) {
|
|
|
330
354
|
...v,
|
|
331
355
|
...p
|
|
332
356
|
};
|
|
333
|
-
return c.setup(y, e),
|
|
357
|
+
return c.setup(y, e), et(e, a.value.watch ?? [], c), {
|
|
334
358
|
vtj: c
|
|
335
359
|
};
|
|
336
360
|
},
|
|
@@ -340,72 +364,72 @@ function te(s) {
|
|
|
340
364
|
if (!a.value.nodes)
|
|
341
365
|
return null;
|
|
342
366
|
const f = a.value.nodes || [];
|
|
343
|
-
return f.length === 1 ?
|
|
367
|
+
return f.length === 1 ? O(f[0], c, e, i) : f.map((u) => O(u, c, e, i));
|
|
344
368
|
},
|
|
345
|
-
...
|
|
369
|
+
...tt(a.value.lifeCycles ?? {}, c)
|
|
346
370
|
});
|
|
347
371
|
return {
|
|
348
|
-
renderer: e.markRaw(
|
|
372
|
+
renderer: e.markRaw(m),
|
|
349
373
|
context: c
|
|
350
374
|
};
|
|
351
375
|
}
|
|
352
|
-
function
|
|
353
|
-
const t = (
|
|
354
|
-
return
|
|
355
|
-
name:
|
|
376
|
+
function We(r = [], e) {
|
|
377
|
+
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => ke[o]) : void 0;
|
|
378
|
+
return r.map((s) => b(s) ? {
|
|
379
|
+
name: s
|
|
356
380
|
} : {
|
|
357
|
-
name:
|
|
358
|
-
type:
|
|
359
|
-
required:
|
|
360
|
-
default: g(
|
|
381
|
+
name: s.name,
|
|
382
|
+
type: s.type,
|
|
383
|
+
required: s.required,
|
|
384
|
+
default: g(s.default) ? e.__parseExpression(s.default) : s.default
|
|
361
385
|
}).reduce(
|
|
362
|
-
(
|
|
386
|
+
(s, n) => (s[n.name] = {
|
|
363
387
|
type: t(n.type),
|
|
364
388
|
required: n.required,
|
|
365
389
|
default: n.default
|
|
366
|
-
},
|
|
390
|
+
}, s),
|
|
367
391
|
{}
|
|
368
392
|
);
|
|
369
393
|
}
|
|
370
|
-
function
|
|
371
|
-
return
|
|
394
|
+
function Ye(r, e, t) {
|
|
395
|
+
return r.reactive(
|
|
372
396
|
Object.keys(e || {}).reduce(
|
|
373
|
-
(
|
|
397
|
+
(s, n) => {
|
|
374
398
|
let o = e[n];
|
|
375
|
-
return g(o) ? o = t.__parseExpression(o) : N(o) && (o = t.__parseFunction(o)),
|
|
399
|
+
return g(o) ? o = t.__parseExpression(o) : N(o) && (o = t.__parseFunction(o)), s[n] = o, s;
|
|
376
400
|
},
|
|
377
401
|
{}
|
|
378
402
|
)
|
|
379
403
|
);
|
|
380
404
|
}
|
|
381
|
-
function
|
|
405
|
+
function Ge(r, e, t) {
|
|
382
406
|
return Object.entries(e ?? {}).reduce(
|
|
383
|
-
(
|
|
407
|
+
(s, [n, o]) => (s[n] = r.computed(t.__parseFunction(o)), s),
|
|
384
408
|
{}
|
|
385
409
|
);
|
|
386
410
|
}
|
|
387
|
-
function
|
|
388
|
-
return Object.entries(
|
|
389
|
-
(t, [
|
|
411
|
+
function Xe(r, e) {
|
|
412
|
+
return Object.entries(r ?? {}).reduce(
|
|
413
|
+
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
|
390
414
|
{}
|
|
391
415
|
);
|
|
392
416
|
}
|
|
393
|
-
function
|
|
417
|
+
function Qe(r, e = [], t) {
|
|
394
418
|
return e.reduce(
|
|
395
|
-
(
|
|
419
|
+
(s, n) => {
|
|
396
420
|
const { name: o, from: i } = n || {};
|
|
397
421
|
n.default;
|
|
398
422
|
const a = g(i) ? t.__parseExpression(i) || o : i ?? o, l = g(n.default) ? t.__parseExpression(n.default) : n.default ?? null;
|
|
399
|
-
return
|
|
423
|
+
return s[o] = r.inject(a, l), s;
|
|
400
424
|
},
|
|
401
425
|
{}
|
|
402
426
|
);
|
|
403
427
|
}
|
|
404
|
-
function
|
|
405
|
-
return Object.keys(
|
|
406
|
-
(t,
|
|
407
|
-
const n = s
|
|
408
|
-
return t[
|
|
428
|
+
function Ze(r, e) {
|
|
429
|
+
return Object.keys(r).reduce(
|
|
430
|
+
(t, s) => {
|
|
431
|
+
const n = r[s], o = e.$apis[n.ref], i = N(n.transform) ? n.transform.value ? e.__parseFunction(n.transform) : void 0 : n.transform;
|
|
432
|
+
return t[s] = async (...a) => {
|
|
409
433
|
const l = await o.apply(e, a);
|
|
410
434
|
return i ? i(l) : l;
|
|
411
435
|
}, t;
|
|
@@ -413,204 +437,204 @@ function ze(s, e) {
|
|
|
413
437
|
{}
|
|
414
438
|
);
|
|
415
439
|
}
|
|
416
|
-
function
|
|
417
|
-
e.forEach((
|
|
418
|
-
|
|
419
|
-
t.__parseExpression(
|
|
420
|
-
t.__parseFunction(
|
|
440
|
+
function et(r, e = [], t) {
|
|
441
|
+
e.forEach((s) => {
|
|
442
|
+
r.watch(
|
|
443
|
+
t.__parseExpression(s.source),
|
|
444
|
+
t.__parseFunction(s.handler),
|
|
421
445
|
{
|
|
422
|
-
deep:
|
|
423
|
-
immediate:
|
|
446
|
+
deep: s.deep,
|
|
447
|
+
immediate: s.immediate
|
|
424
448
|
}
|
|
425
449
|
);
|
|
426
450
|
});
|
|
427
451
|
}
|
|
428
|
-
function
|
|
429
|
-
return Object.entries(
|
|
430
|
-
(t, [
|
|
452
|
+
function tt(r, e) {
|
|
453
|
+
return Object.entries(r ?? {}).reduce(
|
|
454
|
+
(t, [s, n]) => (t[s] = e.__parseFunction(n), t),
|
|
431
455
|
{}
|
|
432
456
|
);
|
|
433
457
|
}
|
|
434
|
-
const
|
|
435
|
-
function
|
|
436
|
-
const { getDsl: e, options: t } =
|
|
437
|
-
return (
|
|
458
|
+
const rt = (r) => r;
|
|
459
|
+
function ne(r) {
|
|
460
|
+
const { getDsl: e, options: t } = r;
|
|
461
|
+
return (s, n, o = k) => !n || typeof n == "string" ? s : n.type === "Schema" ? o.defineAsyncComponent(async () => {
|
|
438
462
|
const i = await e(n.id);
|
|
439
|
-
return i ?
|
|
463
|
+
return i ? se({
|
|
440
464
|
...t,
|
|
441
465
|
Vue: o,
|
|
442
466
|
dsl: i,
|
|
443
467
|
mode: w.Runtime,
|
|
444
|
-
loader:
|
|
468
|
+
loader: ne(r)
|
|
445
469
|
}).renderer : null;
|
|
446
|
-
}) :
|
|
470
|
+
}) : s;
|
|
447
471
|
}
|
|
448
|
-
function
|
|
449
|
-
if (!
|
|
472
|
+
function O(r, e, t = k, s = rt) {
|
|
473
|
+
if (!r || !r.name || r.invisible)
|
|
450
474
|
return null;
|
|
451
|
-
const { id: n = null, directives: o = [] } =
|
|
452
|
-
if (i && !
|
|
475
|
+
const { id: n = null, directives: o = [] } = r, { vIf: i, vFor: a, vShow: l, vModels: c, vBind: m } = st(o);
|
|
476
|
+
if (i && !nt(i, e))
|
|
453
477
|
return null;
|
|
454
478
|
const f = (u) => {
|
|
455
479
|
const v = u.$components, _ = (() => {
|
|
456
|
-
if (
|
|
457
|
-
return
|
|
458
|
-
if (
|
|
459
|
-
return
|
|
460
|
-
const
|
|
461
|
-
return
|
|
462
|
-
})(), p =
|
|
463
|
-
if (
|
|
464
|
-
return
|
|
465
|
-
|
|
480
|
+
if (r.name === "component")
|
|
481
|
+
return ot(u, r.props?.is);
|
|
482
|
+
if (r.name === "slot")
|
|
483
|
+
return r.name;
|
|
484
|
+
const d = s(r.name, r.from, t);
|
|
485
|
+
return b(d) ? v[d] ?? d : d;
|
|
486
|
+
})(), p = it(n, r.props ?? {}, u), y = at(t, r.events ?? {}, u);
|
|
487
|
+
if (r.name === "slot")
|
|
488
|
+
return ct(t, r, p, u);
|
|
489
|
+
m && Object.assign(p, u.__parseExpression(m.value)), l && (p.style = Object.assign(
|
|
466
490
|
p.style ?? {},
|
|
467
|
-
|
|
468
|
-
)), c.forEach((
|
|
469
|
-
Object.assign(p,
|
|
491
|
+
ut(l, u)
|
|
492
|
+
)), c.forEach((d) => {
|
|
493
|
+
Object.assign(p, pt(t, d, u));
|
|
470
494
|
});
|
|
471
|
-
const S =
|
|
495
|
+
const S = ft(t, r.children ?? [], u, r);
|
|
472
496
|
return t.createVNode(_, { ...p, ...y }, S);
|
|
473
497
|
};
|
|
474
|
-
return a ?
|
|
498
|
+
return a ? ht(a, f, e) : f(e);
|
|
475
499
|
}
|
|
476
|
-
function
|
|
477
|
-
const e =
|
|
478
|
-
(a) => !
|
|
500
|
+
function st(r = []) {
|
|
501
|
+
const e = r.find((a) => j(a.name) === "vIf"), t = r.find((a) => j(a.name) === "vFor"), s = r.find((a) => j(a.name) === "vShow"), n = r.find((a) => j(a.name) === "vBind"), o = r.filter((a) => j(a.name) === "vModel"), i = r.filter(
|
|
502
|
+
(a) => !Oe.includes(j(a.name))
|
|
479
503
|
);
|
|
480
504
|
return {
|
|
481
505
|
vIf: e,
|
|
482
506
|
vFor: t,
|
|
483
|
-
vShow:
|
|
507
|
+
vShow: s,
|
|
484
508
|
vModels: o,
|
|
485
509
|
vBind: n,
|
|
486
510
|
others: i
|
|
487
511
|
};
|
|
488
512
|
}
|
|
489
|
-
function
|
|
490
|
-
return !!e.__parseExpression(
|
|
513
|
+
function nt(r, e) {
|
|
514
|
+
return !!e.__parseExpression(r.value);
|
|
491
515
|
}
|
|
492
|
-
function
|
|
493
|
-
return e ? g(e) ?
|
|
516
|
+
function ot(r, e) {
|
|
517
|
+
return e ? g(e) ? r.__parseExpression(e) : e : "div";
|
|
494
518
|
}
|
|
495
|
-
function
|
|
496
|
-
const
|
|
519
|
+
function it(r, e, t) {
|
|
520
|
+
const s = Object.keys(e || {}).reduce(
|
|
497
521
|
(n, o) => {
|
|
498
522
|
let i = e[o];
|
|
499
523
|
return g(i) ? i = t.__parseExpression(i) : N(i) && (i = t.__parseFunction(i)), n[o] = i, n;
|
|
500
524
|
},
|
|
501
525
|
{}
|
|
502
526
|
);
|
|
503
|
-
return
|
|
527
|
+
return s.ref = t.__ref(r, s.ref), s;
|
|
504
528
|
}
|
|
505
|
-
function
|
|
506
|
-
const
|
|
529
|
+
function at(r, e, t) {
|
|
530
|
+
const s = ["passive", "capture", "once"], n = {
|
|
507
531
|
capture: "Capture",
|
|
508
532
|
once: "Once",
|
|
509
533
|
passive: "OnceCapture"
|
|
510
534
|
};
|
|
511
535
|
return Object.keys(e || {}).reduce(
|
|
512
536
|
(o, i) => {
|
|
513
|
-
const a = e[i], l =
|
|
514
|
-
return f && (o[
|
|
537
|
+
const a = e[i], l = oe(a.modifiers), c = l.find((u) => s.includes(u)), m = "on" + ye(i) + (c && n[c] || ""), f = t.__parseFunction(a.handler);
|
|
538
|
+
return f && (o[m] = r.withModifiers(f, l)), o;
|
|
515
539
|
},
|
|
516
540
|
{}
|
|
517
541
|
);
|
|
518
542
|
}
|
|
519
|
-
function
|
|
520
|
-
const t = Object.keys(
|
|
521
|
-
return e ? t.map((
|
|
543
|
+
function oe(r = {}, e = !1) {
|
|
544
|
+
const t = Object.keys(r);
|
|
545
|
+
return e ? t.map((s) => "." + s) : t;
|
|
522
546
|
}
|
|
523
|
-
function
|
|
524
|
-
const { children: n } = e, o =
|
|
525
|
-
return i ? i(t) : n ?
|
|
526
|
-
|
|
527
|
-
) : Array.isArray(n) ? n.map((a) =>
|
|
547
|
+
function ct(r, e, t, s) {
|
|
548
|
+
const { children: n } = e, o = lt(e, s), i = s.$slots?.[o.name];
|
|
549
|
+
return i ? i(t) : n ? b(n) ? r.createTextVNode(n) : g(n) ? r.createTextVNode(
|
|
550
|
+
ee(s.__parseExpression(n))
|
|
551
|
+
) : Array.isArray(n) ? n.map((a) => O(a, s, r)) : null : null;
|
|
528
552
|
}
|
|
529
|
-
function
|
|
530
|
-
const { props: t } =
|
|
553
|
+
function lt(r, e) {
|
|
554
|
+
const { props: t } = r, s = t?.name || "default";
|
|
531
555
|
return {
|
|
532
|
-
name: g(
|
|
556
|
+
name: g(s) ? e.__parseExpression(s) : s,
|
|
533
557
|
params: []
|
|
534
558
|
};
|
|
535
559
|
}
|
|
536
|
-
function
|
|
537
|
-
return e.__parseExpression(
|
|
560
|
+
function ut(r, e) {
|
|
561
|
+
return e.__parseExpression(r.value) ? {} : {
|
|
538
562
|
display: "none"
|
|
539
563
|
};
|
|
540
564
|
}
|
|
541
|
-
function
|
|
542
|
-
const
|
|
565
|
+
function pt(r, e, t) {
|
|
566
|
+
const s = {
|
|
543
567
|
type: "JSFunction",
|
|
544
568
|
value: e.value?.value ? `(v) => {
|
|
545
569
|
${e.value.value} = v;
|
|
546
570
|
}` : "(v) => {}"
|
|
547
|
-
}, n = t.__parseFunction(
|
|
571
|
+
}, n = t.__parseFunction(s), o = oe(e.modifiers), i = g(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
548
572
|
return {
|
|
549
573
|
[i]: t.__parseExpression(e.value),
|
|
550
|
-
[`onUpdate:${i}`]: o.length && n ?
|
|
574
|
+
[`onUpdate:${i}`]: o.length && n ? r.withModifiers(n, o) : n
|
|
551
575
|
};
|
|
552
576
|
}
|
|
553
|
-
function
|
|
577
|
+
function ft(r, e, t, s) {
|
|
554
578
|
if (!e)
|
|
555
579
|
return null;
|
|
556
|
-
if (
|
|
580
|
+
if (b(e))
|
|
557
581
|
return { default: () => e };
|
|
558
582
|
if (g(e))
|
|
559
583
|
return {
|
|
560
|
-
default: () =>
|
|
584
|
+
default: () => ee(t.__parseExpression(e))
|
|
561
585
|
};
|
|
562
586
|
if (Array.isArray(e) && e.length > 0) {
|
|
563
|
-
const n =
|
|
564
|
-
[`scope_${
|
|
587
|
+
const n = mt(e), o = (i) => !i || !s ? {} : s?.id && Object.keys(i).length ? {
|
|
588
|
+
[`scope_${s.id}`]: i
|
|
565
589
|
} : {};
|
|
566
|
-
return Object.entries(n).reduce((i, [a, { nodes: l, params: c }]) => (i[a] = (
|
|
567
|
-
const f = c.length ?
|
|
590
|
+
return Object.entries(n).reduce((i, [a, { nodes: l, params: c }]) => (i[a] = (m) => {
|
|
591
|
+
const f = c.length ? ge(m ?? {}, c) : o(m);
|
|
568
592
|
return l.map(
|
|
569
|
-
(u) =>
|
|
593
|
+
(u) => O(u, t.__clone(f), r)
|
|
570
594
|
);
|
|
571
595
|
}, i), {});
|
|
572
596
|
}
|
|
573
597
|
return null;
|
|
574
598
|
}
|
|
575
|
-
function
|
|
599
|
+
function mt(r) {
|
|
576
600
|
const e = {
|
|
577
601
|
default: {
|
|
578
602
|
params: [],
|
|
579
603
|
nodes: []
|
|
580
604
|
}
|
|
581
605
|
};
|
|
582
|
-
for (const t of
|
|
583
|
-
const
|
|
584
|
-
e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(
|
|
606
|
+
for (const t of r) {
|
|
607
|
+
const s = dt(t.slot), n = s.name;
|
|
608
|
+
e[n] ? (e[n].nodes.push(t), e[n].params = e[n].params.concat(s.params)) : e[n] = {
|
|
585
609
|
nodes: [t],
|
|
586
|
-
params:
|
|
610
|
+
params: s.params
|
|
587
611
|
};
|
|
588
612
|
}
|
|
589
613
|
return e;
|
|
590
614
|
}
|
|
591
|
-
function
|
|
592
|
-
return
|
|
615
|
+
function dt(r = "default") {
|
|
616
|
+
return b(r) ? { name: r, params: [] } : { params: [], ...r };
|
|
593
617
|
}
|
|
594
|
-
function
|
|
595
|
-
const { value:
|
|
596
|
-
let a = t.__parseExpression(
|
|
597
|
-
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((l, c) => c + 1)), Array.isArray(a) ? a.map((l, c) => e(t.__clone({ [o]: l, [i]: c }))) : (console.warn("[vForRender]:", `${
|
|
618
|
+
function ht(r, e, t) {
|
|
619
|
+
const { value: s, iterator: n } = r, { item: o = "item", index: i = "index" } = n || {};
|
|
620
|
+
let a = t.__parseExpression(s) || [];
|
|
621
|
+
return Number.isInteger(a) && (a = new Array(a).fill(!0).map((l, c) => c + 1)), Array.isArray(a) ? a.map((l, c) => e(t.__clone({ [o]: l, [i]: c }))) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
|
598
622
|
}
|
|
599
|
-
const
|
|
623
|
+
const Y = V({
|
|
600
624
|
name: "VtjPageContainer",
|
|
601
625
|
async setup() {
|
|
602
|
-
const
|
|
603
|
-
return
|
|
604
|
-
provider:
|
|
626
|
+
const r = ae(), e = X(), t = e.params.id, s = t ? r.getPage(t) : r.getHomepage(), n = s ? await r.getRenderComponent(s.id) : null;
|
|
627
|
+
return s && Te(s.title || "VTJ"), {
|
|
628
|
+
provider: r,
|
|
605
629
|
component: n,
|
|
606
|
-
file:
|
|
630
|
+
file: s,
|
|
607
631
|
query: e.query
|
|
608
632
|
};
|
|
609
633
|
},
|
|
610
634
|
render() {
|
|
611
|
-
return this.component ?
|
|
635
|
+
return this.component ? B(this.component, this.query) : B("div", "页面不存在");
|
|
612
636
|
}
|
|
613
|
-
}),
|
|
637
|
+
}), vt = {
|
|
614
638
|
name: {
|
|
615
639
|
type: String,
|
|
616
640
|
default: "VTJ.PRO"
|
|
@@ -627,32 +651,32 @@ const W = D({
|
|
|
627
651
|
type: String,
|
|
628
652
|
default: "/@vtj/pro/"
|
|
629
653
|
}
|
|
630
|
-
},
|
|
654
|
+
}, _t = { class: "x-startup" }, yt = { class: "x-startup__wrapper" }, gt = { class: "x-startup__name" }, wt = { class: "clip" }, St = { class: "x-startup__tagline" }, $t = { class: "x-startup__actions" }, jt = /* @__PURE__ */ V({
|
|
631
655
|
__name: "Startup",
|
|
632
|
-
props:
|
|
633
|
-
setup(
|
|
634
|
-
const e =
|
|
656
|
+
props: vt,
|
|
657
|
+
setup(r) {
|
|
658
|
+
const e = r, t = () => {
|
|
635
659
|
if (typeof window < "u") {
|
|
636
|
-
let
|
|
637
|
-
window.location.href =
|
|
660
|
+
let s = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "@vtj/pro/#/";
|
|
661
|
+
window.location.href = s;
|
|
638
662
|
}
|
|
639
663
|
};
|
|
640
|
-
return (
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
664
|
+
return (s, n) => (je(), Ee("div", _t, [
|
|
665
|
+
F("div", yt, [
|
|
666
|
+
F("div", gt, [
|
|
667
|
+
F("span", wt, A(e.name), 1)
|
|
644
668
|
]),
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
669
|
+
F("div", St, A(e.tagline), 1),
|
|
670
|
+
F("div", $t, [
|
|
671
|
+
Pe(z(Ce), {
|
|
648
672
|
type: "primary",
|
|
649
673
|
size: "large",
|
|
650
674
|
round: "",
|
|
651
|
-
icon:
|
|
675
|
+
icon: z(Me),
|
|
652
676
|
onClick: t
|
|
653
677
|
}, {
|
|
654
|
-
default:
|
|
655
|
-
|
|
678
|
+
default: be(() => [
|
|
679
|
+
Fe(A(e.actionText), 1)
|
|
656
680
|
]),
|
|
657
681
|
_: 1
|
|
658
682
|
}, 8, ["icon"])
|
|
@@ -660,17 +684,17 @@ const W = D({
|
|
|
660
684
|
])
|
|
661
685
|
]));
|
|
662
686
|
}
|
|
663
|
-
}),
|
|
687
|
+
}), Et = V({
|
|
664
688
|
name: "VtjStartupContainer",
|
|
665
689
|
render() {
|
|
666
|
-
return
|
|
690
|
+
return B(jt);
|
|
667
691
|
}
|
|
668
|
-
}),
|
|
669
|
-
class
|
|
692
|
+
}), ie = Symbol("Provider");
|
|
693
|
+
class Pt extends le {
|
|
670
694
|
mode;
|
|
671
695
|
globals = {};
|
|
672
696
|
modules = {};
|
|
673
|
-
adapter = { request:
|
|
697
|
+
adapter = { request: Je, jsonp: we };
|
|
674
698
|
apis = {};
|
|
675
699
|
dependencies = {};
|
|
676
700
|
materials = {};
|
|
@@ -685,30 +709,30 @@ class yt extends ae {
|
|
|
685
709
|
super();
|
|
686
710
|
const {
|
|
687
711
|
service: t,
|
|
688
|
-
mode:
|
|
712
|
+
mode: s = w.Raw,
|
|
689
713
|
dependencies: n,
|
|
690
714
|
materials: o,
|
|
691
715
|
project: i = {},
|
|
692
716
|
adapter: a = {},
|
|
693
717
|
globals: l = {},
|
|
694
718
|
modules: c = {},
|
|
695
|
-
router:
|
|
719
|
+
router: m = null,
|
|
696
720
|
materialPath: f = "./",
|
|
697
721
|
nodeEnv: u = "development"
|
|
698
722
|
} = e;
|
|
699
|
-
this.mode =
|
|
723
|
+
this.mode = s, this.modules = c, this.service = t, this.router = m, this.materialPath = f, this.nodeEnv = u, n && (this.dependencies = n), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, a), s !== w.Design && this.load(i);
|
|
700
724
|
}
|
|
701
725
|
async load(e) {
|
|
702
726
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
703
727
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
704
728
|
throw new Error("project is null");
|
|
705
|
-
const { dependencies:
|
|
729
|
+
const { dependencies: s = [], apis: n } = this.project, { dependencies: o, library: i, components: a, materialPath: l } = this, {
|
|
706
730
|
libraryExports: c,
|
|
707
|
-
libraryMap:
|
|
731
|
+
libraryMap: m,
|
|
708
732
|
materials: f,
|
|
709
733
|
materialExports: u,
|
|
710
734
|
materialMapLibrary: v
|
|
711
|
-
} =
|
|
735
|
+
} = Ne(s, l);
|
|
712
736
|
for (const p of c) {
|
|
713
737
|
const y = o[p], S = window[p];
|
|
714
738
|
if (S)
|
|
@@ -716,64 +740,64 @@ class yt extends ae {
|
|
|
716
740
|
else if (y)
|
|
717
741
|
window[p] = i[p] = await y();
|
|
718
742
|
else {
|
|
719
|
-
const
|
|
720
|
-
for (const $ of
|
|
721
|
-
|
|
743
|
+
const d = m[p] || [];
|
|
744
|
+
for (const $ of d)
|
|
745
|
+
Q($) && await Be(p, P.append($, { v: I })), Z($) && await U(P.append($, { v: I })), i[p] = window[p];
|
|
722
746
|
}
|
|
723
747
|
}
|
|
724
748
|
for (const p of f)
|
|
725
|
-
await
|
|
749
|
+
await U(P.append(p, { v: I }));
|
|
726
750
|
const _ = this.materials || {};
|
|
727
751
|
for (const p of u) {
|
|
728
|
-
const y = window[v[p]], S =
|
|
752
|
+
const y = window[v[p]], S = ue[p];
|
|
729
753
|
if (S)
|
|
730
|
-
y && S.forEach((
|
|
731
|
-
a[
|
|
754
|
+
y && S.forEach((d) => {
|
|
755
|
+
a[d] = y[d];
|
|
732
756
|
});
|
|
733
757
|
else {
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
a[$.name] =
|
|
758
|
+
const d = _[p] ? (await _[p]()).default : window[p];
|
|
759
|
+
d && y && (d.components || []).forEach(($) => {
|
|
760
|
+
a[$.name] = Ae($, y);
|
|
737
761
|
});
|
|
738
762
|
}
|
|
739
763
|
}
|
|
740
|
-
n && (this.apis =
|
|
764
|
+
n && (this.apis = qe(n, this.adapter), re(), this.project.config?.mock && Ue(n)), this.initRouter(), this.triggerReady();
|
|
741
765
|
}
|
|
742
766
|
initRouter() {
|
|
743
767
|
const { router: e, project: t } = this;
|
|
744
768
|
e && (e.addRoute({
|
|
745
769
|
path: "/page/:id",
|
|
746
770
|
name: "VtjPage",
|
|
747
|
-
component:
|
|
771
|
+
component: Y
|
|
748
772
|
}), e.addRoute({
|
|
749
773
|
path: "/",
|
|
750
774
|
name: "VtjHomepage",
|
|
751
|
-
component: t?.homepage ?
|
|
775
|
+
component: t?.homepage ? Y : Et
|
|
752
776
|
}));
|
|
753
777
|
}
|
|
754
778
|
install(e) {
|
|
755
779
|
const t = e.config.globalProperties.installed || {};
|
|
756
|
-
for (const [
|
|
757
|
-
!t[
|
|
758
|
-
e.provide(
|
|
780
|
+
for (const [s, n] of Object.entries(this.library))
|
|
781
|
+
!t[s] && De(n) && (e.use(n), t[s] = !0);
|
|
782
|
+
e.provide(ie, this), e.config.globalProperties.installed = t;
|
|
759
783
|
}
|
|
760
784
|
getFile(e) {
|
|
761
785
|
const { blocks: t = [] } = this.project || {};
|
|
762
|
-
return this.getPage(e) || t.find((
|
|
786
|
+
return this.getPage(e) || t.find((s) => s.id === e) || null;
|
|
763
787
|
}
|
|
764
788
|
getPage(e) {
|
|
765
|
-
const { pages: t = [] } = this.project || {},
|
|
789
|
+
const { pages: t = [] } = this.project || {}, s = (n, o = []) => {
|
|
766
790
|
for (const i of o) {
|
|
767
791
|
if (i.id === n)
|
|
768
792
|
return i;
|
|
769
793
|
if (i.children && i.children.length) {
|
|
770
|
-
const a =
|
|
794
|
+
const a = s(n, i.children);
|
|
771
795
|
if (a)
|
|
772
796
|
return a;
|
|
773
797
|
}
|
|
774
798
|
}
|
|
775
799
|
};
|
|
776
|
-
return
|
|
800
|
+
return s(e, t) || null;
|
|
777
801
|
}
|
|
778
802
|
getHomepage() {
|
|
779
803
|
const { homepage: e } = this.project || {};
|
|
@@ -786,47 +810,47 @@ class yt extends ae {
|
|
|
786
810
|
async getRenderComponent(e) {
|
|
787
811
|
const t = this.getFile(e);
|
|
788
812
|
if (!t)
|
|
789
|
-
return
|
|
790
|
-
const
|
|
813
|
+
return T.warn(`Can not find file: ${e}`), null;
|
|
814
|
+
const s = `.vtj/vue/${e}.vue`, n = this.modules[s];
|
|
791
815
|
if (n)
|
|
792
816
|
return (await n())?.default;
|
|
793
817
|
const o = await this.getDsl(t.id);
|
|
794
818
|
if (!o)
|
|
795
|
-
return
|
|
796
|
-
const { library: i, components: a, mode: l, apis: c } = this,
|
|
819
|
+
return T.warn(`Can not find dsl: ${e}`), null;
|
|
820
|
+
const { library: i, components: a, mode: l, apis: c } = this, m = {
|
|
797
821
|
mode: l,
|
|
798
822
|
Vue: i.Vue,
|
|
799
823
|
components: a,
|
|
800
824
|
libs: i,
|
|
801
825
|
apis: c,
|
|
802
826
|
window
|
|
803
|
-
}, f =
|
|
827
|
+
}, f = ne({
|
|
804
828
|
getDsl: async (v) => await this.getDsl(v) || null,
|
|
805
|
-
options:
|
|
806
|
-
}), { renderer: u } =
|
|
807
|
-
...
|
|
829
|
+
options: m
|
|
830
|
+
}), { renderer: u } = se({
|
|
831
|
+
...m,
|
|
808
832
|
dsl: o,
|
|
809
833
|
loader: f
|
|
810
834
|
});
|
|
811
835
|
return u;
|
|
812
836
|
}
|
|
813
837
|
}
|
|
814
|
-
function
|
|
815
|
-
const e = new
|
|
838
|
+
function Vt(r) {
|
|
839
|
+
const e = new Pt(r);
|
|
816
840
|
return {
|
|
817
841
|
provider: e,
|
|
818
|
-
onReady: (
|
|
842
|
+
onReady: (s) => e.ready(s)
|
|
819
843
|
};
|
|
820
844
|
}
|
|
821
|
-
function
|
|
822
|
-
const e =
|
|
845
|
+
function ae(r = {}) {
|
|
846
|
+
const e = Ie(ie);
|
|
823
847
|
if (!e)
|
|
824
848
|
throw new Error("Can not find provider");
|
|
825
849
|
if (e.mode === w.Raw && e.nodeEnv === "development") {
|
|
826
|
-
const { id: t, version:
|
|
827
|
-
t &&
|
|
850
|
+
const { id: t, version: s } = r;
|
|
851
|
+
t && s && (async () => {
|
|
828
852
|
const n = await e.getDsl(t);
|
|
829
|
-
n?.__VERSION__ !==
|
|
853
|
+
n?.__VERSION__ !== s && J.warning({
|
|
830
854
|
title: n?.name,
|
|
831
855
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
832
856
|
});
|
|
@@ -834,21 +858,21 @@ function oe(s = {}) {
|
|
|
834
858
|
}
|
|
835
859
|
return e;
|
|
836
860
|
}
|
|
837
|
-
const
|
|
861
|
+
const bt = new Se({
|
|
838
862
|
settings: {
|
|
839
863
|
type: "json",
|
|
840
864
|
validSuccess: !0,
|
|
841
865
|
originResponse: !1,
|
|
842
866
|
failMessage: !0,
|
|
843
|
-
validate: (
|
|
844
|
-
showError: (
|
|
845
|
-
|
|
846
|
-
message:
|
|
867
|
+
validate: (r) => r.data?.code === 0,
|
|
868
|
+
showError: (r) => {
|
|
869
|
+
J.error({
|
|
870
|
+
message: r || "未知错误"
|
|
847
871
|
});
|
|
848
872
|
}
|
|
849
873
|
}
|
|
850
|
-
}),
|
|
851
|
-
url:
|
|
874
|
+
}), Ft = (r = "/vtj/local/repository/${type}.json") => (e, t) => bt.send({
|
|
875
|
+
url: r,
|
|
852
876
|
method: "post",
|
|
853
877
|
query: { type: e },
|
|
854
878
|
data: {
|
|
@@ -856,10 +880,10 @@ const gt = new ve({
|
|
|
856
880
|
data: t
|
|
857
881
|
}
|
|
858
882
|
});
|
|
859
|
-
class
|
|
883
|
+
class L {
|
|
860
884
|
api;
|
|
861
885
|
constructor() {
|
|
862
|
-
this.api =
|
|
886
|
+
this.api = Ft();
|
|
863
887
|
}
|
|
864
888
|
async init(e) {
|
|
865
889
|
return console.log("BaseService.init", e), {};
|
|
@@ -915,22 +939,22 @@ class J {
|
|
|
915
939
|
return await this.api("removeRawPage", e).catch(() => "");
|
|
916
940
|
}
|
|
917
941
|
}
|
|
918
|
-
const h = new
|
|
942
|
+
const h = new $e({
|
|
919
943
|
type: "local",
|
|
920
944
|
expired: 0,
|
|
921
945
|
prefix: "__VTJ_"
|
|
922
946
|
});
|
|
923
|
-
class
|
|
947
|
+
class Jt extends L {
|
|
924
948
|
init(e) {
|
|
925
|
-
const t = new
|
|
949
|
+
const t = new C(e), s = h.get(`project_${t.id}`), n = Object.assign(t.toDsl(), s || {});
|
|
926
950
|
return h.save(`project_${t.id}`, n), Promise.resolve(n);
|
|
927
951
|
}
|
|
928
952
|
saveProject(e) {
|
|
929
|
-
const t = new
|
|
953
|
+
const t = new C(e);
|
|
930
954
|
return h.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
931
955
|
}
|
|
932
956
|
saveMaterials(e, t) {
|
|
933
|
-
return h.save(`materials_${e.id}`,
|
|
957
|
+
return h.save(`materials_${e.id}`, D(t)), Promise.resolve(!0);
|
|
934
958
|
}
|
|
935
959
|
saveFile(e) {
|
|
936
960
|
return h.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -954,38 +978,38 @@ class Tt extends J {
|
|
|
954
978
|
return Promise.resolve(!0);
|
|
955
979
|
}
|
|
956
980
|
getHistory(e) {
|
|
957
|
-
const t = h.get(`history_${e}`),
|
|
958
|
-
return Promise.resolve(
|
|
981
|
+
const t = h.get(`history_${e}`), s = new G(t || { id: e });
|
|
982
|
+
return Promise.resolve(s.toDsl());
|
|
959
983
|
}
|
|
960
984
|
getHistoryItem(e, t) {
|
|
961
|
-
const
|
|
962
|
-
return Promise.resolve(
|
|
985
|
+
const s = h.get(`history_${e}_${t}`);
|
|
986
|
+
return Promise.resolve(s);
|
|
963
987
|
}
|
|
964
988
|
saveHistoryItem(e, t) {
|
|
965
989
|
return h.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
|
966
990
|
}
|
|
967
991
|
removeHistoryItem(e, t) {
|
|
968
|
-
return t.forEach((
|
|
969
|
-
h.remove(`history_${e}_${
|
|
992
|
+
return t.forEach((s) => {
|
|
993
|
+
h.remove(`history_${e}_${s}`);
|
|
970
994
|
}), Promise.resolve(!0);
|
|
971
995
|
}
|
|
972
996
|
}
|
|
973
|
-
class
|
|
997
|
+
class It extends L {
|
|
974
998
|
projects = {};
|
|
975
999
|
materials = {};
|
|
976
1000
|
files = {};
|
|
977
1001
|
histories = {};
|
|
978
1002
|
historyItems = {};
|
|
979
1003
|
init(e) {
|
|
980
|
-
const t = new
|
|
1004
|
+
const t = new C(e), s = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), s);
|
|
981
1005
|
return this.projects[n.id] = n, Promise.resolve(n);
|
|
982
1006
|
}
|
|
983
1007
|
saveProject(e) {
|
|
984
|
-
const t = new
|
|
1008
|
+
const t = new C(e);
|
|
985
1009
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
986
1010
|
}
|
|
987
1011
|
saveMaterials(e, t) {
|
|
988
|
-
return e.id && (this.materials[e.id] =
|
|
1012
|
+
return e.id && (this.materials[e.id] = D(t)), Promise.resolve(!0);
|
|
989
1013
|
}
|
|
990
1014
|
saveFile(e) {
|
|
991
1015
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1009,29 +1033,29 @@ class St extends J {
|
|
|
1009
1033
|
return Promise.resolve(!0);
|
|
1010
1034
|
}
|
|
1011
1035
|
getHistory(e) {
|
|
1012
|
-
const t = this.histories[e],
|
|
1013
|
-
return Promise.resolve(
|
|
1036
|
+
const t = this.histories[e], s = new G(t || { id: e });
|
|
1037
|
+
return Promise.resolve(s);
|
|
1014
1038
|
}
|
|
1015
1039
|
getHistoryItem(e, t) {
|
|
1016
|
-
const
|
|
1040
|
+
const s = `${e}_${t}`, n = this.historyItems[s] || {};
|
|
1017
1041
|
return Promise.resolve(n);
|
|
1018
1042
|
}
|
|
1019
1043
|
saveHistoryItem(e, t) {
|
|
1020
|
-
const
|
|
1021
|
-
return this.historyItems[
|
|
1044
|
+
const s = `${e}_${t.id}`;
|
|
1045
|
+
return this.historyItems[s] = t, Promise.resolve(!0);
|
|
1022
1046
|
}
|
|
1023
1047
|
removeHistoryItem(e, t) {
|
|
1024
|
-
return t.forEach((
|
|
1025
|
-
const n = `${e}_${
|
|
1048
|
+
return t.forEach((s) => {
|
|
1049
|
+
const n = `${e}_${s}`;
|
|
1026
1050
|
delete this.historyItems[n];
|
|
1027
1051
|
}), Promise.resolve(!0);
|
|
1028
1052
|
}
|
|
1029
1053
|
}
|
|
1030
|
-
let
|
|
1031
|
-
function
|
|
1032
|
-
return
|
|
1054
|
+
let H = null;
|
|
1055
|
+
function Lt() {
|
|
1056
|
+
return H || (H = new It(), H);
|
|
1033
1057
|
}
|
|
1034
|
-
class
|
|
1058
|
+
class qt extends L {
|
|
1035
1059
|
async init(e) {
|
|
1036
1060
|
return await this.api("init", e).catch(() => null) || {};
|
|
1037
1061
|
}
|
|
@@ -1041,7 +1065,7 @@ class Nt extends J {
|
|
|
1041
1065
|
async saveMaterials(e, t) {
|
|
1042
1066
|
return !!await this.api("saveMaterials", {
|
|
1043
1067
|
project: e,
|
|
1044
|
-
materials:
|
|
1068
|
+
materials: D(t)
|
|
1045
1069
|
}).catch(() => !1);
|
|
1046
1070
|
}
|
|
1047
1071
|
async saveFile(e) {
|
|
@@ -1076,80 +1100,85 @@ class Nt extends J {
|
|
|
1076
1100
|
);
|
|
1077
1101
|
}
|
|
1078
1102
|
}
|
|
1079
|
-
function
|
|
1080
|
-
return
|
|
1081
|
-
const { id: t, title:
|
|
1103
|
+
function ce(r = []) {
|
|
1104
|
+
return r.map((e) => {
|
|
1105
|
+
const { id: t, title: s, icon: n, children: o, hidden: i } = e;
|
|
1082
1106
|
return {
|
|
1083
1107
|
id: t,
|
|
1084
|
-
title:
|
|
1108
|
+
title: s,
|
|
1085
1109
|
icon: n,
|
|
1086
1110
|
hidden: i,
|
|
1087
1111
|
url: `/page/${t}`,
|
|
1088
|
-
children: o && o.length ?
|
|
1112
|
+
children: o && o.length ? ce(o) : void 0
|
|
1089
1113
|
};
|
|
1090
1114
|
});
|
|
1091
1115
|
}
|
|
1092
|
-
function
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1095
|
-
const { name:
|
|
1096
|
-
if (
|
|
1097
|
-
const
|
|
1098
|
-
t.value = !
|
|
1099
|
-
} else if (
|
|
1100
|
-
const
|
|
1101
|
-
t.value = !
|
|
1116
|
+
function Ut() {
|
|
1117
|
+
const r = ae(), e = X(), t = Re(!1), s = r.project;
|
|
1118
|
+
xe(() => {
|
|
1119
|
+
const { name: i, params: a, meta: l } = e;
|
|
1120
|
+
if (i === "VtjPage") {
|
|
1121
|
+
const c = r.getPage(a.id);
|
|
1122
|
+
t.value = !c?.mask;
|
|
1123
|
+
} else if (i === "VtjHomepage") {
|
|
1124
|
+
const c = r.getHomepage();
|
|
1125
|
+
t.value = !c?.mask;
|
|
1102
1126
|
} else
|
|
1103
|
-
t.value = !
|
|
1127
|
+
t.value = !l.mask;
|
|
1104
1128
|
});
|
|
1105
|
-
const n =
|
|
1129
|
+
const n = ce(s?.pages), o = s?.config;
|
|
1106
1130
|
return {
|
|
1107
1131
|
disabled: t,
|
|
1108
|
-
|
|
1132
|
+
logo: o?.logo,
|
|
1133
|
+
themeSwitchable: o?.themeSwitchable,
|
|
1134
|
+
title: o?.title || s?.description || s?.name || "VTJ App",
|
|
1109
1135
|
menus: n
|
|
1110
1136
|
};
|
|
1111
1137
|
}
|
|
1112
1138
|
export {
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1139
|
+
Oe as BUILT_IN_DIRECTIVES,
|
|
1140
|
+
L as BaseService,
|
|
1141
|
+
K as CONTEXT_HOST,
|
|
1142
|
+
Ke as Context,
|
|
1117
1143
|
w as ContextMode,
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1144
|
+
ke as DATA_TYPES,
|
|
1145
|
+
Dt as JSCodeToString,
|
|
1146
|
+
Nt as LIFE_CYCLES_LIST,
|
|
1147
|
+
qt as LocalService,
|
|
1148
|
+
It as MemoryService,
|
|
1149
|
+
Pt as Provider,
|
|
1150
|
+
Jt as StorageService,
|
|
1125
1151
|
I as VTJ_RENDERER_VERSION,
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1152
|
+
te as adoptedStyleSheets,
|
|
1153
|
+
At as createAssetScripts,
|
|
1154
|
+
Bt as createAssetsCss,
|
|
1155
|
+
Ze as createDataSources,
|
|
1156
|
+
ne as createLoader,
|
|
1157
|
+
Lt as createMemoryService,
|
|
1158
|
+
Vt as createProvider,
|
|
1159
|
+
se as createRenderer,
|
|
1160
|
+
Le as createSchemaApi,
|
|
1161
|
+
qe as createSchemaApis,
|
|
1162
|
+
rt as defaultLoader,
|
|
1163
|
+
x as fillBasePath,
|
|
1164
|
+
oe as getModifiers,
|
|
1165
|
+
Ae as getRawComponent,
|
|
1166
|
+
Q as isCSSUrl,
|
|
1167
|
+
Ve as isJSCode,
|
|
1142
1168
|
g as isJSExpression,
|
|
1143
1169
|
N as isJSFunction,
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1170
|
+
Z as isJSUrl,
|
|
1171
|
+
De as isVuePlugin,
|
|
1172
|
+
Be as loadCss,
|
|
1173
|
+
ze as mockApi,
|
|
1174
|
+
Ue as mockApis,
|
|
1175
|
+
re as mockCleanup,
|
|
1176
|
+
O as nodeRender,
|
|
1177
|
+
Ne as parseDeps,
|
|
1178
|
+
R as parseExpression,
|
|
1179
|
+
W as parseFunction,
|
|
1180
|
+
ie as providerKey,
|
|
1181
|
+
ee as toString,
|
|
1182
|
+
Ut as useMask,
|
|
1183
|
+
ae as useProvider
|
|
1155
1184
|
};
|