@vtj/renderer 0.7.10 → 0.7.12
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 +389 -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.12
|
|
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.12";
|
|
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,32 @@ 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
|
-
|
|
686
|
-
|
|
625
|
+
props: at,
|
|
626
|
+
setup(s) {
|
|
627
|
+
const e = s, t = () => {
|
|
628
|
+
if (typeof window < "u") {
|
|
629
|
+
let r = (window.__VTJ_LINK__ || {}).href || window.location.pathname + "@vtj/pro/#/";
|
|
630
|
+
window.location.href = r;
|
|
631
|
+
}
|
|
687
632
|
};
|
|
688
|
-
return (
|
|
689
|
-
E("div",
|
|
690
|
-
E("div",
|
|
691
|
-
E("span",
|
|
633
|
+
return (r, n) => (ve(), _e("div", ct, [
|
|
634
|
+
E("div", lt, [
|
|
635
|
+
E("div", ut, [
|
|
636
|
+
E("span", pt, B(e.name), 1)
|
|
692
637
|
]),
|
|
693
|
-
E("div",
|
|
694
|
-
E("div",
|
|
695
|
-
|
|
638
|
+
E("div", ft, B(e.tagline), 1),
|
|
639
|
+
E("div", mt, [
|
|
640
|
+
ye(U(Ee), {
|
|
696
641
|
type: "primary",
|
|
697
642
|
size: "large",
|
|
698
643
|
round: "",
|
|
699
|
-
icon:
|
|
644
|
+
icon: U(Fe),
|
|
700
645
|
onClick: t
|
|
701
646
|
}, {
|
|
702
|
-
default:
|
|
703
|
-
|
|
647
|
+
default: ge(() => [
|
|
648
|
+
we(B(e.actionText), 1)
|
|
704
649
|
]),
|
|
705
650
|
_: 1
|
|
706
651
|
}, 8, ["icon"])
|
|
@@ -708,17 +653,17 @@ const X = L({
|
|
|
708
653
|
])
|
|
709
654
|
]));
|
|
710
655
|
}
|
|
711
|
-
}),
|
|
656
|
+
}), ht = A({
|
|
712
657
|
name: "VtjStartupContainer",
|
|
713
658
|
render() {
|
|
714
|
-
return D(
|
|
659
|
+
return D(dt);
|
|
715
660
|
}
|
|
716
|
-
}),
|
|
717
|
-
class
|
|
661
|
+
}), ne = Symbol("Provider");
|
|
662
|
+
class vt extends ae {
|
|
718
663
|
mode;
|
|
719
664
|
globals = {};
|
|
720
665
|
modules = {};
|
|
721
|
-
adapter = { request:
|
|
666
|
+
adapter = { request: Te, jsonp: me };
|
|
722
667
|
apis = {};
|
|
723
668
|
dependencies = {};
|
|
724
669
|
materials = {};
|
|
@@ -732,7 +677,7 @@ class Pt extends le {
|
|
|
732
677
|
super();
|
|
733
678
|
const {
|
|
734
679
|
service: t,
|
|
735
|
-
mode:
|
|
680
|
+
mode: r = g.Raw,
|
|
736
681
|
dependencies: n,
|
|
737
682
|
materials: o,
|
|
738
683
|
project: i = {},
|
|
@@ -742,19 +687,19 @@ class Pt extends le {
|
|
|
742
687
|
router: m = null,
|
|
743
688
|
materialPath: f = "./"
|
|
744
689
|
} = e;
|
|
745
|
-
this.mode =
|
|
690
|
+
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
691
|
}
|
|
747
692
|
async load(e) {
|
|
748
693
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
749
694
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
750
695
|
throw new Error("project is null");
|
|
751
|
-
const { dependencies:
|
|
696
|
+
const { dependencies: r = [], apis: n } = this.project, { dependencies: o, library: i, components: a, materialPath: l } = this, {
|
|
752
697
|
libraryExports: c,
|
|
753
698
|
libraryMap: m,
|
|
754
699
|
materials: f,
|
|
755
700
|
materialExports: u,
|
|
756
701
|
materialMapLibrary: h
|
|
757
|
-
} =
|
|
702
|
+
} = Re(r, l);
|
|
758
703
|
for (const p of c) {
|
|
759
704
|
const w = o[p], S = window[p];
|
|
760
705
|
if (S)
|
|
@@ -762,57 +707,57 @@ class Pt extends le {
|
|
|
762
707
|
else if (w)
|
|
763
708
|
window[p] = i[p] = await w();
|
|
764
709
|
else {
|
|
765
|
-
const
|
|
766
|
-
for (const
|
|
767
|
-
|
|
710
|
+
const _ = m[p] || [];
|
|
711
|
+
for (const H of _)
|
|
712
|
+
G(H) && await Ce(p, b.append(H, { v: F })), Q(H) && await q(b.append(H, { v: F })), i[p] = window[p];
|
|
768
713
|
}
|
|
769
714
|
}
|
|
770
715
|
for (const p of f)
|
|
771
|
-
await
|
|
716
|
+
await q(b.append(p, { v: F }));
|
|
772
717
|
const v = this.materials || {};
|
|
773
718
|
for (const p of u) {
|
|
774
719
|
const w = v[p] ? (await v[p]()).default : window[p], S = window[h[p]];
|
|
775
|
-
w && S && w.components.forEach((
|
|
776
|
-
a[
|
|
720
|
+
w && S && w.components.forEach((_) => {
|
|
721
|
+
a[_.name] = Ie(_, S);
|
|
777
722
|
});
|
|
778
723
|
}
|
|
779
|
-
n && (this.apis =
|
|
724
|
+
n && (this.apis = Be(n, this.adapter)), this.initRouter(), this.triggerReady();
|
|
780
725
|
}
|
|
781
726
|
initRouter() {
|
|
782
727
|
const { router: e, project: t } = this;
|
|
783
728
|
e && (e.addRoute({
|
|
784
729
|
path: "/page/:id",
|
|
785
730
|
name: "VtjPage",
|
|
786
|
-
component:
|
|
731
|
+
component: W
|
|
787
732
|
}), e.addRoute({
|
|
788
733
|
path: "/",
|
|
789
734
|
name: "VtjHomepage",
|
|
790
|
-
component: t?.homepage ?
|
|
735
|
+
component: t?.homepage ? W : ht
|
|
791
736
|
}));
|
|
792
737
|
}
|
|
793
738
|
install(e) {
|
|
794
739
|
const t = e.config.globalProperties.installed || {};
|
|
795
|
-
for (const [
|
|
796
|
-
!t[
|
|
797
|
-
e.provide(
|
|
740
|
+
for (const [r, n] of Object.entries(this.library))
|
|
741
|
+
!t[r] && Oe(n) && (e.use(n), t[r] = !0);
|
|
742
|
+
e.provide(ne, this), e.config.globalProperties.installed = t;
|
|
798
743
|
}
|
|
799
744
|
getFile(e) {
|
|
800
745
|
const { blocks: t = [] } = this.project || {};
|
|
801
|
-
return this.getPage(e) || t.find((
|
|
746
|
+
return this.getPage(e) || t.find((r) => r.id === e) || null;
|
|
802
747
|
}
|
|
803
748
|
getPage(e) {
|
|
804
|
-
const { pages: t = [] } = this.project || {},
|
|
749
|
+
const { pages: t = [] } = this.project || {}, r = (n, o = []) => {
|
|
805
750
|
for (const i of o) {
|
|
806
751
|
if (i.id === n)
|
|
807
752
|
return i;
|
|
808
753
|
if (i.children && i.children.length) {
|
|
809
|
-
const a =
|
|
754
|
+
const a = r(n, i.children);
|
|
810
755
|
if (a)
|
|
811
756
|
return a;
|
|
812
757
|
}
|
|
813
758
|
}
|
|
814
759
|
};
|
|
815
|
-
return
|
|
760
|
+
return r(e, t) || null;
|
|
816
761
|
}
|
|
817
762
|
getHomepage() {
|
|
818
763
|
const { homepage: e } = this.project || {};
|
|
@@ -825,13 +770,13 @@ class Pt extends le {
|
|
|
825
770
|
async getRenderComponent(e) {
|
|
826
771
|
const t = this.getFile(e);
|
|
827
772
|
if (!t)
|
|
828
|
-
return
|
|
829
|
-
const
|
|
773
|
+
return C.warn(`Can not find file: ${e}`), null;
|
|
774
|
+
const r = `.vtj/vue/${e}.vue`, n = this.modules[r];
|
|
830
775
|
if (n)
|
|
831
776
|
return (await n())?.default;
|
|
832
777
|
const o = await this.getDsl(t.id);
|
|
833
778
|
if (!o)
|
|
834
|
-
return
|
|
779
|
+
return C.warn(`Can not find dsl: ${e}`), null;
|
|
835
780
|
const { library: i, components: a, mode: l, apis: c } = this, m = {
|
|
836
781
|
mode: l,
|
|
837
782
|
Vue: i.Vue,
|
|
@@ -839,10 +784,10 @@ class Pt extends le {
|
|
|
839
784
|
libs: i,
|
|
840
785
|
apis: c,
|
|
841
786
|
window
|
|
842
|
-
}, f =
|
|
787
|
+
}, f = re({
|
|
843
788
|
getDsl: async (h) => await this.getDsl(h) || null,
|
|
844
789
|
options: m
|
|
845
|
-
}), { renderer: u } =
|
|
790
|
+
}), { renderer: u } = te({
|
|
846
791
|
...m,
|
|
847
792
|
dsl: o,
|
|
848
793
|
loader: f
|
|
@@ -850,22 +795,22 @@ class Pt extends le {
|
|
|
850
795
|
return u;
|
|
851
796
|
}
|
|
852
797
|
}
|
|
853
|
-
function
|
|
854
|
-
const e = new
|
|
798
|
+
function It(s) {
|
|
799
|
+
const e = new vt(s);
|
|
855
800
|
return {
|
|
856
801
|
provider: e,
|
|
857
|
-
onReady: (
|
|
802
|
+
onReady: (r) => e.ready(r)
|
|
858
803
|
};
|
|
859
804
|
}
|
|
860
|
-
function
|
|
861
|
-
const e =
|
|
805
|
+
function oe(s = {}) {
|
|
806
|
+
const e = Se(ne);
|
|
862
807
|
if (!e)
|
|
863
808
|
throw new Error("Can not find provider");
|
|
864
|
-
if (e.mode ===
|
|
865
|
-
const { id: t, version:
|
|
866
|
-
t &&
|
|
809
|
+
if (e.mode === g.Raw) {
|
|
810
|
+
const { id: t, version: r } = s;
|
|
811
|
+
t && r && (async () => {
|
|
867
812
|
const n = await e.getDsl(t);
|
|
868
|
-
n?.__VERSION__ !==
|
|
813
|
+
n?.__VERSION__ !== r && V.warning({
|
|
869
814
|
title: n?.name,
|
|
870
815
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
871
816
|
});
|
|
@@ -873,21 +818,21 @@ function ae(r = {}) {
|
|
|
873
818
|
}
|
|
874
819
|
return e;
|
|
875
820
|
}
|
|
876
|
-
const
|
|
821
|
+
const _t = new de({
|
|
877
822
|
settings: {
|
|
878
823
|
type: "json",
|
|
879
824
|
validSuccess: !0,
|
|
880
825
|
originResponse: !1,
|
|
881
826
|
failMessage: !0,
|
|
882
|
-
validate: (
|
|
883
|
-
showError: (
|
|
884
|
-
|
|
885
|
-
message:
|
|
827
|
+
validate: (s) => s.data?.code === 0,
|
|
828
|
+
showError: (s) => {
|
|
829
|
+
V.error({
|
|
830
|
+
message: s || "未知错误"
|
|
886
831
|
});
|
|
887
832
|
}
|
|
888
833
|
}
|
|
889
|
-
}),
|
|
890
|
-
url:
|
|
834
|
+
}), yt = (s = "/vtj/local/repository/${type}.json") => (e, t) => _t.send({
|
|
835
|
+
url: s,
|
|
891
836
|
method: "post",
|
|
892
837
|
query: { type: e },
|
|
893
838
|
data: {
|
|
@@ -895,10 +840,10 @@ const Et = new ve({
|
|
|
895
840
|
data: t
|
|
896
841
|
}
|
|
897
842
|
});
|
|
898
|
-
class
|
|
843
|
+
class J {
|
|
899
844
|
api;
|
|
900
845
|
constructor() {
|
|
901
|
-
this.api =
|
|
846
|
+
this.api = yt();
|
|
902
847
|
}
|
|
903
848
|
async init(e) {
|
|
904
849
|
return console.log("BaseService.init", e), {};
|
|
@@ -954,14 +899,14 @@ class q {
|
|
|
954
899
|
return await this.api("removeRawPage", e).catch(() => "");
|
|
955
900
|
}
|
|
956
901
|
}
|
|
957
|
-
const d = new
|
|
902
|
+
const d = new he({
|
|
958
903
|
type: "local",
|
|
959
904
|
expired: 0,
|
|
960
905
|
prefix: "__VTJ_"
|
|
961
906
|
});
|
|
962
|
-
class
|
|
907
|
+
class Ct extends J {
|
|
963
908
|
init(e) {
|
|
964
|
-
const t = new I(e),
|
|
909
|
+
const t = new I(e), r = d.get(`project_${t.id}`), n = Object.assign(t.toDsl(), r || {});
|
|
965
910
|
return d.save(`project_${t.id}`, n), Promise.resolve(n);
|
|
966
911
|
}
|
|
967
912
|
saveProject(e) {
|
|
@@ -969,7 +914,7 @@ class At extends q {
|
|
|
969
914
|
return d.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
970
915
|
}
|
|
971
916
|
saveMaterials(e, t) {
|
|
972
|
-
return d.save(`materials_${e.id}`,
|
|
917
|
+
return d.save(`materials_${e.id}`, N(t)), Promise.resolve(!0);
|
|
973
918
|
}
|
|
974
919
|
saveFile(e) {
|
|
975
920
|
return d.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -993,30 +938,30 @@ class At extends q {
|
|
|
993
938
|
return Promise.resolve(!0);
|
|
994
939
|
}
|
|
995
940
|
getHistory(e) {
|
|
996
|
-
const t = d.get(`history_${e}`),
|
|
997
|
-
return Promise.resolve(
|
|
941
|
+
const t = d.get(`history_${e}`), r = new Y(t || { id: e });
|
|
942
|
+
return Promise.resolve(r.toDsl());
|
|
998
943
|
}
|
|
999
944
|
getHistoryItem(e, t) {
|
|
1000
|
-
const
|
|
1001
|
-
return Promise.resolve(
|
|
945
|
+
const r = d.get(`history_${e}_${t}`);
|
|
946
|
+
return Promise.resolve(r);
|
|
1002
947
|
}
|
|
1003
948
|
saveHistoryItem(e, t) {
|
|
1004
949
|
return d.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
|
1005
950
|
}
|
|
1006
951
|
removeHistoryItem(e, t) {
|
|
1007
|
-
return t.forEach((
|
|
1008
|
-
d.remove(`history_${e}_${
|
|
952
|
+
return t.forEach((r) => {
|
|
953
|
+
d.remove(`history_${e}_${r}`);
|
|
1009
954
|
}), Promise.resolve(!0);
|
|
1010
955
|
}
|
|
1011
956
|
}
|
|
1012
|
-
class
|
|
957
|
+
class gt extends J {
|
|
1013
958
|
projects = {};
|
|
1014
959
|
materials = {};
|
|
1015
960
|
files = {};
|
|
1016
961
|
histories = {};
|
|
1017
962
|
historyItems = {};
|
|
1018
963
|
init(e) {
|
|
1019
|
-
const t = new I(e),
|
|
964
|
+
const t = new I(e), r = this.projects[t.id] || {}, n = Object.assign(t.toDsl(), r);
|
|
1020
965
|
return this.projects[n.id] = n, Promise.resolve(n);
|
|
1021
966
|
}
|
|
1022
967
|
saveProject(e) {
|
|
@@ -1024,7 +969,7 @@ class Ft extends q {
|
|
|
1024
969
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
1025
970
|
}
|
|
1026
971
|
saveMaterials(e, t) {
|
|
1027
|
-
return e.id && (this.materials[e.id] =
|
|
972
|
+
return e.id && (this.materials[e.id] = N(t)), Promise.resolve(!0);
|
|
1028
973
|
}
|
|
1029
974
|
saveFile(e) {
|
|
1030
975
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1048,29 +993,29 @@ class Ft extends q {
|
|
|
1048
993
|
return Promise.resolve(!0);
|
|
1049
994
|
}
|
|
1050
995
|
getHistory(e) {
|
|
1051
|
-
const t = this.histories[e],
|
|
1052
|
-
return Promise.resolve(
|
|
996
|
+
const t = this.histories[e], r = new Y(t || { id: e });
|
|
997
|
+
return Promise.resolve(r);
|
|
1053
998
|
}
|
|
1054
999
|
getHistoryItem(e, t) {
|
|
1055
|
-
const
|
|
1000
|
+
const r = `${e}_${t}`, n = this.historyItems[r] || {};
|
|
1056
1001
|
return Promise.resolve(n);
|
|
1057
1002
|
}
|
|
1058
1003
|
saveHistoryItem(e, t) {
|
|
1059
|
-
const
|
|
1060
|
-
return this.historyItems[
|
|
1004
|
+
const r = `${e}_${t.id}`;
|
|
1005
|
+
return this.historyItems[r] = t, Promise.resolve(!0);
|
|
1061
1006
|
}
|
|
1062
1007
|
removeHistoryItem(e, t) {
|
|
1063
|
-
return t.forEach((
|
|
1064
|
-
const n = `${e}_${
|
|
1008
|
+
return t.forEach((r) => {
|
|
1009
|
+
const n = `${e}_${r}`;
|
|
1065
1010
|
delete this.historyItems[n];
|
|
1066
1011
|
}), Promise.resolve(!0);
|
|
1067
1012
|
}
|
|
1068
1013
|
}
|
|
1069
1014
|
let R = null;
|
|
1070
|
-
function
|
|
1071
|
-
return R || (R = new
|
|
1015
|
+
function Ot() {
|
|
1016
|
+
return R || (R = new gt(), R);
|
|
1072
1017
|
}
|
|
1073
|
-
class
|
|
1018
|
+
class Mt extends J {
|
|
1074
1019
|
async init(e) {
|
|
1075
1020
|
return await this.api("init", e).catch(() => null) || {};
|
|
1076
1021
|
}
|
|
@@ -1080,7 +1025,7 @@ class Lt extends q {
|
|
|
1080
1025
|
async saveMaterials(e, t) {
|
|
1081
1026
|
return !!await this.api("saveMaterials", {
|
|
1082
1027
|
project: e,
|
|
1083
|
-
materials:
|
|
1028
|
+
materials: N(t)
|
|
1084
1029
|
}).catch(() => !1);
|
|
1085
1030
|
}
|
|
1086
1031
|
async saveFile(e) {
|
|
@@ -1115,83 +1060,80 @@ class Lt extends q {
|
|
|
1115
1060
|
);
|
|
1116
1061
|
}
|
|
1117
1062
|
}
|
|
1118
|
-
function
|
|
1119
|
-
return
|
|
1120
|
-
const { id: t, title:
|
|
1063
|
+
function ie(s = []) {
|
|
1064
|
+
return s.map((e) => {
|
|
1065
|
+
const { id: t, title: r, icon: n, children: o, hidden: i } = e;
|
|
1121
1066
|
return {
|
|
1122
1067
|
id: t,
|
|
1123
|
-
title:
|
|
1068
|
+
title: r,
|
|
1124
1069
|
icon: n,
|
|
1125
1070
|
hidden: i,
|
|
1126
1071
|
url: `/page/${t}`,
|
|
1127
|
-
children: o && o.length ?
|
|
1072
|
+
children: o && o.length ? ie(o) : void 0
|
|
1128
1073
|
};
|
|
1129
1074
|
});
|
|
1130
1075
|
}
|
|
1131
|
-
function
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1076
|
+
function Tt() {
|
|
1077
|
+
const s = oe(), e = X(), t = $e(!1), r = s.project;
|
|
1078
|
+
je(() => {
|
|
1134
1079
|
const { name: o, params: i, meta: a } = e;
|
|
1135
1080
|
if (o === "VtjPage") {
|
|
1136
|
-
const l =
|
|
1081
|
+
const l = s.getPage(i.id);
|
|
1137
1082
|
t.value = !l?.mask;
|
|
1138
1083
|
} else if (o === "VtjHomepage") {
|
|
1139
|
-
const l =
|
|
1084
|
+
const l = s.getHomepage();
|
|
1140
1085
|
t.value = !l?.mask;
|
|
1141
1086
|
} else
|
|
1142
1087
|
t.value = !a.mask;
|
|
1143
1088
|
});
|
|
1144
|
-
const n =
|
|
1089
|
+
const n = ie(r?.pages);
|
|
1145
1090
|
return {
|
|
1146
1091
|
disabled: t,
|
|
1147
|
-
title:
|
|
1092
|
+
title: r?.description || r?.name || "VTJ App",
|
|
1148
1093
|
menus: n
|
|
1149
1094
|
};
|
|
1150
1095
|
}
|
|
1151
1096
|
export {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
At as StorageService,
|
|
1097
|
+
He as BUILDIN_DIRECTIVES,
|
|
1098
|
+
J as BaseService,
|
|
1099
|
+
K as CONTEXT_HOST,
|
|
1100
|
+
De as Context,
|
|
1101
|
+
g as ContextMode,
|
|
1102
|
+
xe as DATA_TYPES,
|
|
1103
|
+
Rt as JSCodeToString,
|
|
1104
|
+
Ft as LIFE_CYCLES_LIST,
|
|
1105
|
+
Mt as LocalService,
|
|
1106
|
+
gt as MemoryService,
|
|
1107
|
+
vt as Provider,
|
|
1108
|
+
Ct as StorageService,
|
|
1165
1109
|
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
|
|
1110
|
+
ee as adoptedStyleSheets,
|
|
1111
|
+
Ht as createAssetScripts,
|
|
1112
|
+
xt as createAssetsCss,
|
|
1113
|
+
qe as createDataSources,
|
|
1114
|
+
re as createLoader,
|
|
1115
|
+
Ot as createMemoryService,
|
|
1116
|
+
It as createProvider,
|
|
1117
|
+
te as createRenderer,
|
|
1118
|
+
ke as createSchemaApi,
|
|
1119
|
+
Be as createSchemaApis,
|
|
1120
|
+
ze as defaultLoader,
|
|
1121
|
+
x as fillBasePath,
|
|
1122
|
+
se as getModifiers,
|
|
1123
|
+
Ie as getRawComponent,
|
|
1124
|
+
G as isCSSUrl,
|
|
1125
|
+
Me as isJSCode,
|
|
1126
|
+
y as isJSExpression,
|
|
1127
|
+
k as isJSFunction,
|
|
1128
|
+
Q as isJSUrl,
|
|
1129
|
+
Oe as isVuePlugin,
|
|
1130
|
+
Ce as loadCss,
|
|
1131
|
+
M as nodeRender,
|
|
1132
|
+
Re as parseDeps,
|
|
1133
|
+
O as parseExpression,
|
|
1134
|
+
z as parseFunction,
|
|
1135
|
+
ne as providerKey,
|
|
1136
|
+
Z as toString,
|
|
1137
|
+
Tt as useMask,
|
|
1138
|
+
oe as useProvider
|
|
1197
1139
|
};
|