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