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