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