@vtj/renderer 0.8.70 → 0.8.72
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 +361 -347
- package/package.json +5 -5
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Base as ve, BUILT_IN_COMPONENTS as ye, ProjectModel as I, HistoryModel as ee } from "@vtj/core";
|
|
2
|
-
import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as
|
|
2
|
+
import { isUrl as ge, url as b, dedupArray as _e, isString as S, isFunction as K, logger as H, createRequest as we, merge as Se, pathToRegexp as $e, pathToRegexpMatch as je, formDataToJson as Ee, delay as be, camelCase as j, upperFirst as Pe, pick as Ce, jsonp as Re, loadScript as Q, Request as Fe, Storage as Ie, mapToObject as N } from "@vtj/utils";
|
|
3
3
|
import * as O from "vue";
|
|
4
|
-
import { toRef as
|
|
4
|
+
import { toRef as He, readonly as xe, customRef as Me, ref as q, onBeforeUnmount as Oe, getCurrentScope as De, onScopeDispose as ke, unref as Te, getCurrentInstance as te, watch as ne, computed as re, onMounted as Ae, defineComponent as se, h as A, inject as Be, defineAsyncComponent as X, watchEffect as Ue } from "vue";
|
|
5
5
|
import { useRoute as oe } from "vue-router";
|
|
6
|
-
import { ElNotification as
|
|
7
|
-
import
|
|
6
|
+
import { ElNotification as D, ElLoading as Ne } from "element-plus";
|
|
7
|
+
import x from "mockjs";
|
|
8
8
|
import { XStartup as qe } from "@vtj/ui";
|
|
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.8.
|
|
13
|
+
* @version 0.8.72
|
|
14
14
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
15
15
|
*/
|
|
16
|
-
const P = "0.8.
|
|
17
|
-
var _ = /* @__PURE__ */ ((
|
|
16
|
+
const P = "0.8.72";
|
|
17
|
+
var _ = /* @__PURE__ */ ((r) => (r.Runtime = "Runtime", r.Design = "Design", r.Raw = "Raw", r.VNode = "VNode", r))(_ || {});
|
|
18
18
|
const Y = [
|
|
19
19
|
"$el",
|
|
20
20
|
"$emit",
|
|
@@ -50,38 +50,38 @@ const Y = [
|
|
|
50
50
|
Function,
|
|
51
51
|
Date
|
|
52
52
|
};
|
|
53
|
-
function R(
|
|
54
|
-
return
|
|
53
|
+
function R(r, e) {
|
|
54
|
+
return r.map((t) => ge(t) ? t : `${e}${t}`);
|
|
55
55
|
}
|
|
56
|
-
function J(
|
|
57
|
-
return /\.css$/.test(
|
|
56
|
+
function J(r) {
|
|
57
|
+
return /\.css$/.test(r);
|
|
58
58
|
}
|
|
59
|
-
function L(
|
|
60
|
-
return /\.js$/.test(
|
|
59
|
+
function L(r) {
|
|
60
|
+
return /\.js$/.test(r);
|
|
61
61
|
}
|
|
62
|
-
function Ve(
|
|
63
|
-
return /\.json$/.test(
|
|
62
|
+
function Ve(r) {
|
|
63
|
+
return /\.json$/.test(r);
|
|
64
64
|
}
|
|
65
|
-
function en(
|
|
66
|
-
return
|
|
65
|
+
function en(r) {
|
|
66
|
+
return r.map(
|
|
67
67
|
(e) => `<script src="${b.append(e, { v: P })}"><\/script>`
|
|
68
68
|
).join("");
|
|
69
69
|
}
|
|
70
|
-
function tn(
|
|
71
|
-
return
|
|
70
|
+
function tn(r = []) {
|
|
71
|
+
return r.map(
|
|
72
72
|
(e) => `<link rel="stylesheet" href="${b.append(e, { v: P })}" />`
|
|
73
73
|
).join("");
|
|
74
74
|
}
|
|
75
|
-
function We(
|
|
76
|
-
const t =
|
|
75
|
+
function We(r, e) {
|
|
76
|
+
const t = r.filter((u) => !!u.enabled), n = [], s = [], o = [], a = [], i = {}, l = {}, c = [], d = {};
|
|
77
77
|
return t.forEach(
|
|
78
78
|
({ urls: u, assetsUrl: f, library: p, assetsLibrary: h, localeLibrary: m }) => {
|
|
79
79
|
u?.forEach((v) => {
|
|
80
|
-
L(v) &&
|
|
80
|
+
L(v) && n.push(v), J(v) && s.push(v);
|
|
81
81
|
}), p && (a.push(p), i[p] = R(u || [], e), m && (l[p] = m)), f && o.push(f), h && c.push(h), p && h && (d[h] = p);
|
|
82
82
|
}
|
|
83
83
|
), {
|
|
84
|
-
scripts: R(
|
|
84
|
+
scripts: R(n, e),
|
|
85
85
|
css: R(s, e),
|
|
86
86
|
materials: R(o, e),
|
|
87
87
|
libraryExports: a,
|
|
@@ -91,46 +91,46 @@ function We(n, e) {
|
|
|
91
91
|
libraryLocaleMap: l
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
function Ge(
|
|
95
|
-
const { name: t, parent:
|
|
96
|
-
return
|
|
94
|
+
function Ge(r, e) {
|
|
95
|
+
const { name: t, parent: n, alias: s } = r;
|
|
96
|
+
return n ? e[n]?.[s || t] : e[s || t];
|
|
97
97
|
}
|
|
98
|
-
function ie(
|
|
99
|
-
return S(
|
|
98
|
+
function ie(r) {
|
|
99
|
+
return S(r) ? r : JSON.stringify(r);
|
|
100
100
|
}
|
|
101
|
-
function ae(
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const s = new
|
|
101
|
+
function ae(r, e, t) {
|
|
102
|
+
const n = r.CSSStyleSheet;
|
|
103
|
+
if (n.prototype.replaceSync) {
|
|
104
|
+
const s = new n();
|
|
105
105
|
s.id = e, s.replaceSync(t);
|
|
106
|
-
const o =
|
|
106
|
+
const o = r.document, a = o.adoptedStyleSheets, i = Array.from(a).filter(
|
|
107
107
|
(l) => l.id !== e
|
|
108
108
|
);
|
|
109
109
|
o.adoptedStyleSheets = [...i, s];
|
|
110
110
|
} else {
|
|
111
|
-
const s =
|
|
111
|
+
const s = r.document;
|
|
112
112
|
let o = s.getElementById(e);
|
|
113
113
|
o ? o.innerHTML = t : (o = s.createElement("style"), o.id = e, o.innerHTML = t, s.head.appendChild(o));
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
async function Ke(
|
|
117
|
-
const t = await window.fetch(e).then((
|
|
118
|
-
t && ae(window,
|
|
116
|
+
async function Ke(r, e) {
|
|
117
|
+
const t = await window.fetch(e).then((n) => n.text()).catch(() => "");
|
|
118
|
+
t && ae(window, r, t);
|
|
119
119
|
}
|
|
120
|
-
function ce(
|
|
121
|
-
const t = e.document,
|
|
122
|
-
for (const s of
|
|
120
|
+
function ce(r, e = window) {
|
|
121
|
+
const t = e.document, n = e.document.head;
|
|
122
|
+
for (const s of r)
|
|
123
123
|
if (!t.getElementById(s)) {
|
|
124
124
|
const a = t.createElement("link");
|
|
125
|
-
a.rel = "stylesheet", a.id = s, a.href = s,
|
|
125
|
+
a.rel = "stylesheet", a.id = s, a.href = s, n.appendChild(a);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
async function Qe(
|
|
129
|
-
const
|
|
128
|
+
async function Qe(r, e, t = window) {
|
|
129
|
+
const n = t.document, s = t.document.head;
|
|
130
130
|
let o = t[e];
|
|
131
131
|
return o ? o.default || o : new Promise((a, i) => {
|
|
132
|
-
for (const l of
|
|
133
|
-
const c =
|
|
132
|
+
for (const l of r) {
|
|
133
|
+
const c = n.createElement("script");
|
|
134
134
|
c.src = l, c.onload = () => {
|
|
135
135
|
o = t[e], o ? a(o.default || o) : i(null);
|
|
136
136
|
}, c.onerror = (d) => {
|
|
@@ -139,45 +139,45 @@ async function Qe(n, e, t = window) {
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
function Xe(
|
|
143
|
-
return K(
|
|
142
|
+
function Xe(r) {
|
|
143
|
+
return K(r) || K(r?.install);
|
|
144
144
|
}
|
|
145
|
-
function C(
|
|
145
|
+
function C(r, e, t = !1, n = !1) {
|
|
146
146
|
try {
|
|
147
147
|
const s = ['"use strict";', "var __self = arguments[0];"];
|
|
148
148
|
s.push("return ");
|
|
149
|
-
let o = (
|
|
149
|
+
let o = (r.value || "").trim();
|
|
150
150
|
o = o.replace(/this(\W|$)/g, (i, l) => `__self${l}`), o = s.join(`
|
|
151
151
|
`) + o;
|
|
152
152
|
const a = `with(${t ? "{}" : "$scope || {}"}) { ${o} }`;
|
|
153
153
|
return new Function("$scope", a)(e);
|
|
154
154
|
} catch (s) {
|
|
155
|
-
if (
|
|
155
|
+
if (H.error("parseExpression.error", s, r, e?.__self ?? e), n)
|
|
156
156
|
throw s;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
function z(
|
|
160
|
-
const s = C(
|
|
161
|
-
if (typeof s != "function" && (
|
|
159
|
+
function z(r, e, t = !1, n = !1) {
|
|
160
|
+
const s = C(r, e, t, n);
|
|
161
|
+
if (typeof s != "function" && (H.error(
|
|
162
162
|
"parseFunction.error",
|
|
163
163
|
"not a function",
|
|
164
|
-
|
|
164
|
+
r,
|
|
165
165
|
e?.__self ?? e
|
|
166
|
-
),
|
|
167
|
-
throw new Error(`"${
|
|
166
|
+
), n))
|
|
167
|
+
throw new Error(`"${r.value}" not a function`);
|
|
168
168
|
return s;
|
|
169
169
|
}
|
|
170
|
-
function g(
|
|
171
|
-
return
|
|
170
|
+
function g(r) {
|
|
171
|
+
return r && r.type === "JSExpression";
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
return typeof
|
|
173
|
+
function k(r) {
|
|
174
|
+
return typeof r == "object" && r && r.type === "JSFunction";
|
|
175
175
|
}
|
|
176
|
-
function Ye(
|
|
177
|
-
return g(
|
|
176
|
+
function Ye(r) {
|
|
177
|
+
return g(r) || k(r);
|
|
178
178
|
}
|
|
179
|
-
function nn(
|
|
180
|
-
return Ye(
|
|
179
|
+
function nn(r) {
|
|
180
|
+
return Ye(r) ? r.value : JSON.stringify(r);
|
|
181
181
|
}
|
|
182
182
|
let E = null;
|
|
183
183
|
const ze = we({
|
|
@@ -186,11 +186,11 @@ const ze = we({
|
|
|
186
186
|
validSuccess: !0,
|
|
187
187
|
originResponse: !1,
|
|
188
188
|
loading: !0,
|
|
189
|
-
validate: (
|
|
189
|
+
validate: (r) => r.data?.code === 0 || !!r.data?.success,
|
|
190
190
|
failMessage: !0,
|
|
191
|
-
showError: (
|
|
192
|
-
|
|
193
|
-
message:
|
|
191
|
+
showError: (r) => {
|
|
192
|
+
D.error({
|
|
193
|
+
message: r || "未知错误"
|
|
194
194
|
});
|
|
195
195
|
},
|
|
196
196
|
showLoading: () => {
|
|
@@ -205,63 +205,63 @@ const ze = we({
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
});
|
|
208
|
-
function Ze(
|
|
209
|
-
const { jsonp: t, request:
|
|
210
|
-
if (
|
|
211
|
-
return (s = {}) => t(
|
|
212
|
-
...
|
|
208
|
+
function Ze(r, e) {
|
|
209
|
+
const { jsonp: t, request: n } = e;
|
|
210
|
+
if (r.method === "jsonp")
|
|
211
|
+
return (s = {}) => t(r.url, {
|
|
212
|
+
...r.jsonpOptions,
|
|
213
213
|
query: s
|
|
214
214
|
});
|
|
215
215
|
{
|
|
216
|
-
const s =
|
|
217
|
-
url:
|
|
218
|
-
method:
|
|
216
|
+
const s = r.headers ? C(r.headers, {}, !0) : void 0, o = {
|
|
217
|
+
url: r.url,
|
|
218
|
+
method: r.method,
|
|
219
219
|
settings: {
|
|
220
|
-
...
|
|
220
|
+
...r.settings,
|
|
221
221
|
headers: s
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
return (a, i) =>
|
|
224
|
+
return (a, i) => n.send(Se(o, i || {}, { data: a }));
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function et(
|
|
227
|
+
function et(r, e) {
|
|
228
228
|
const { metaQuery: t } = e;
|
|
229
229
|
if (!t) return;
|
|
230
|
-
const { code:
|
|
230
|
+
const { code: n, queryCode: s } = r;
|
|
231
231
|
return (o, a) => {
|
|
232
232
|
if (!t) {
|
|
233
233
|
console.warn("adapter.metaQuery is not defined!");
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
return t(
|
|
236
|
+
return t(n, s, o, a);
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
function tt(
|
|
240
|
-
const
|
|
241
|
-
for (const s of
|
|
242
|
-
|
|
239
|
+
function tt(r = [], e = [], t) {
|
|
240
|
+
const n = {};
|
|
241
|
+
for (const s of r)
|
|
242
|
+
n[s.id] = Ze(s, t);
|
|
243
243
|
for (const s of e)
|
|
244
|
-
|
|
245
|
-
return
|
|
244
|
+
n[s.id] = et(s, t);
|
|
245
|
+
return n;
|
|
246
246
|
}
|
|
247
|
-
function nt(
|
|
248
|
-
|
|
247
|
+
function nt(r = []) {
|
|
248
|
+
x.setup({
|
|
249
249
|
timeout: "50-500"
|
|
250
|
-
}), le(),
|
|
250
|
+
}), le(), r.forEach((e) => rt(e));
|
|
251
251
|
}
|
|
252
|
-
function rt(
|
|
253
|
-
if (!
|
|
254
|
-
const { url: e, mockTemplate: t } =
|
|
252
|
+
function rt(r) {
|
|
253
|
+
if (!r.mock) return;
|
|
254
|
+
const { url: e, mockTemplate: t } = r;
|
|
255
255
|
if (e && t) {
|
|
256
|
-
const
|
|
257
|
-
|
|
256
|
+
const n = $e(`${e}(.*)`), s = je(e, { decode: decodeURIComponent }), o = C(t, {}, !0);
|
|
257
|
+
x.mock(n, (a) => {
|
|
258
258
|
const i = b.parse(a.url) || {}, l = a.body instanceof FormData ? Ee(a.body) : a.body, c = s(a.url)?.params;
|
|
259
|
-
return Object.assign(a, { data: l, params: i, query: c }),
|
|
259
|
+
return Object.assign(a, { data: l, params: i, query: c }), x.mock(o(a));
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
function le() {
|
|
264
|
-
|
|
264
|
+
x._mocked = {};
|
|
265
265
|
}
|
|
266
266
|
class st {
|
|
267
267
|
__id = null;
|
|
@@ -289,14 +289,14 @@ class st {
|
|
|
289
289
|
$apis = {};
|
|
290
290
|
__transform = {};
|
|
291
291
|
constructor(e) {
|
|
292
|
-
const { mode: t, dsl:
|
|
293
|
-
this.__mode = t,
|
|
292
|
+
const { mode: t, dsl: n, attrs: s } = e;
|
|
293
|
+
this.__mode = t, n && (this.__id = n.id || null, this.__transform = n.transform || {}), s && Object.assign(this, s);
|
|
294
294
|
}
|
|
295
295
|
setup(e, t = O) {
|
|
296
|
-
const
|
|
297
|
-
if (!
|
|
298
|
-
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance =
|
|
299
|
-
const s =
|
|
296
|
+
const n = t.getCurrentInstance();
|
|
297
|
+
if (!n) return;
|
|
298
|
+
this.__refs = {}, this.$refs = {}, this.context = {}, this.__contextRefs = {}, this.__instance = n.proxy;
|
|
299
|
+
const s = n.appContext.config.globalProperties;
|
|
300
300
|
Object.assign(this, s), Object.assign(this, e || {}), this.__proxy(), t.onMounted(() => {
|
|
301
301
|
this.__proxy();
|
|
302
302
|
}), t.onUnmounted(() => {
|
|
@@ -318,59 +318,59 @@ class st {
|
|
|
318
318
|
__parseFunction(e) {
|
|
319
319
|
if (e)
|
|
320
320
|
if (this.__mode === _.Runtime) {
|
|
321
|
-
const { id: t, type:
|
|
322
|
-
return z({ type:
|
|
321
|
+
const { id: t, type: n } = e, s = t ? this.__transform[t] ?? e.value : e.value;
|
|
322
|
+
return z({ type: n, value: s }, this);
|
|
323
323
|
} else
|
|
324
324
|
return z(e, this);
|
|
325
325
|
}
|
|
326
326
|
__parseExpression(e) {
|
|
327
327
|
if (e)
|
|
328
328
|
if (this.__mode === _.Runtime) {
|
|
329
|
-
const { id: t, type:
|
|
330
|
-
return C({ type:
|
|
329
|
+
const { id: t, type: n } = e, s = t ? this.__transform[t] ?? e.value : e.value;
|
|
330
|
+
return C({ type: n, value: s }, this);
|
|
331
331
|
} else
|
|
332
332
|
return C(e, this);
|
|
333
333
|
}
|
|
334
334
|
__ref(e = null, t) {
|
|
335
335
|
if (this.__mode !== _.VNode)
|
|
336
|
-
return e && e !== this.__id && (this.__contextRefs[e] = this), async (
|
|
336
|
+
return e && e !== this.__id && (this.__contextRefs[e] = this), async (n) => {
|
|
337
337
|
await be(0);
|
|
338
|
-
let s =
|
|
338
|
+
let s = n?.$vtjEl || n?.$el || n?._?.vnode?.el || n;
|
|
339
339
|
if (!s) {
|
|
340
340
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
343
|
-
if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, _.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] =
|
|
344
|
-
t(
|
|
343
|
+
if (s.nodeType === 3 && s.nextSibling && (s = s.nextSibling), s.__vtj__ = e, _.Design === this.__mode && (s.__context__ = this), e && (this.__refs[e] = n), typeof t == "function")
|
|
344
|
+
t(n);
|
|
345
345
|
else if (t) {
|
|
346
346
|
const o = this.$refs[t];
|
|
347
347
|
if (o) {
|
|
348
|
-
const a = new Set([].concat(o,
|
|
348
|
+
const a = new Set([].concat(o, n));
|
|
349
349
|
this.$refs[t] = Array.from(a);
|
|
350
350
|
} else
|
|
351
|
-
this.$refs[t] =
|
|
351
|
+
this.$refs[t] = n;
|
|
352
352
|
}
|
|
353
|
-
return
|
|
353
|
+
return n;
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
356
|
__clone(e = {}) {
|
|
357
|
-
const t = { ...this.context, ...e },
|
|
357
|
+
const t = { ...this.context, ...e }, n = {
|
|
358
358
|
...t,
|
|
359
359
|
context: t
|
|
360
360
|
};
|
|
361
|
-
return
|
|
361
|
+
return n.context.__proto__ = this.context, n.__proto__ = this, n;
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function B(r) {
|
|
365
365
|
const {
|
|
366
366
|
Vue: e = O,
|
|
367
367
|
mode: t = _.Runtime,
|
|
368
|
-
components:
|
|
368
|
+
components: n = {},
|
|
369
369
|
libs: s = {},
|
|
370
370
|
apis: o = {},
|
|
371
371
|
loader: a
|
|
372
|
-
} =
|
|
373
|
-
$components:
|
|
372
|
+
} = r, i = e.computed(() => r.dsl), l = {
|
|
373
|
+
$components: n,
|
|
374
374
|
$libs: s,
|
|
375
375
|
$apis: o
|
|
376
376
|
}, c = new st({
|
|
@@ -384,7 +384,7 @@ function A(n) {
|
|
|
384
384
|
},
|
|
385
385
|
setup(u) {
|
|
386
386
|
c.$props = u, c.props = u, i.value.id && ae(
|
|
387
|
-
|
|
387
|
+
r.window || window,
|
|
388
388
|
i.value.id,
|
|
389
389
|
i.value.css || ""
|
|
390
390
|
), c.state = at(e, i.value.state ?? {}, c);
|
|
@@ -415,66 +415,66 @@ function A(n) {
|
|
|
415
415
|
context: c
|
|
416
416
|
};
|
|
417
417
|
}
|
|
418
|
-
function ot(
|
|
419
|
-
return
|
|
418
|
+
function ot(r = []) {
|
|
419
|
+
return r.map((e) => S(e) ? e : e.name);
|
|
420
420
|
}
|
|
421
|
-
function it(
|
|
422
|
-
const t = (
|
|
423
|
-
return
|
|
424
|
-
name:
|
|
421
|
+
function it(r = [], e) {
|
|
422
|
+
const t = (n) => n ? (Array.isArray(n) ? n : [n]).map((o) => Le[o]) : void 0;
|
|
423
|
+
return r.map((n) => S(n) ? {
|
|
424
|
+
name: n
|
|
425
425
|
} : {
|
|
426
|
-
name:
|
|
427
|
-
type:
|
|
428
|
-
required:
|
|
429
|
-
default: g(
|
|
426
|
+
name: n.name,
|
|
427
|
+
type: n.type,
|
|
428
|
+
required: n.required,
|
|
429
|
+
default: g(n.default) ? e.__parseExpression(n.default) : n.default
|
|
430
430
|
}).reduce(
|
|
431
|
-
(
|
|
431
|
+
(n, s) => (n[s.name] = {
|
|
432
432
|
type: t(s.type),
|
|
433
433
|
required: s.required,
|
|
434
434
|
default: s.default
|
|
435
|
-
},
|
|
435
|
+
}, n),
|
|
436
436
|
{}
|
|
437
437
|
);
|
|
438
438
|
}
|
|
439
|
-
function at(
|
|
440
|
-
return
|
|
439
|
+
function at(r, e, t) {
|
|
440
|
+
return r.reactive(
|
|
441
441
|
Object.keys(e || {}).reduce(
|
|
442
|
-
(
|
|
442
|
+
(n, s) => {
|
|
443
443
|
let o = e[s];
|
|
444
|
-
return g(o) ? o = t.__parseExpression(o) :
|
|
444
|
+
return g(o) ? o = t.__parseExpression(o) : k(o) && (o = t.__parseFunction(o)), n[s] = o, n;
|
|
445
445
|
},
|
|
446
446
|
{}
|
|
447
447
|
)
|
|
448
448
|
);
|
|
449
449
|
}
|
|
450
|
-
function ct(
|
|
450
|
+
function ct(r, e, t) {
|
|
451
451
|
return Object.entries(e ?? {}).reduce(
|
|
452
|
-
(
|
|
452
|
+
(n, [s, o]) => (n[s] = r.computed(t.__parseFunction(o)), n),
|
|
453
453
|
{}
|
|
454
454
|
);
|
|
455
455
|
}
|
|
456
|
-
function lt(
|
|
457
|
-
return Object.entries(
|
|
458
|
-
(t, [
|
|
456
|
+
function lt(r, e) {
|
|
457
|
+
return Object.entries(r ?? {}).reduce(
|
|
458
|
+
(t, [n, s]) => (t[n] = e.__parseFunction(s), t),
|
|
459
459
|
{}
|
|
460
460
|
);
|
|
461
461
|
}
|
|
462
|
-
function ut(
|
|
462
|
+
function ut(r, e = [], t) {
|
|
463
463
|
return e.reduce(
|
|
464
|
-
(
|
|
464
|
+
(n, s) => {
|
|
465
465
|
const { name: o, from: a } = s || {};
|
|
466
466
|
s.default;
|
|
467
467
|
const i = g(a) ? t.__parseExpression(a) || o : a ?? o, l = g(s.default) ? t.__parseExpression(s.default) : s.default ?? null;
|
|
468
|
-
return
|
|
468
|
+
return n[o] = r.inject(i, l), n;
|
|
469
469
|
},
|
|
470
470
|
{}
|
|
471
471
|
);
|
|
472
472
|
}
|
|
473
|
-
function ft(
|
|
474
|
-
return Object.keys(
|
|
475
|
-
(t,
|
|
476
|
-
const s = n
|
|
477
|
-
return t[
|
|
473
|
+
function ft(r, e) {
|
|
474
|
+
return Object.keys(r).reduce(
|
|
475
|
+
(t, n) => {
|
|
476
|
+
const s = r[n], o = e.$apis[s.ref], a = k(s.transform) ? s.transform.value ? e.__parseFunction(s.transform) : void 0 : s.transform;
|
|
477
|
+
return t[n] = async (...i) => {
|
|
478
478
|
const l = await o.apply(e, i);
|
|
479
479
|
return a ? a(l) : l;
|
|
480
480
|
}, t;
|
|
@@ -482,79 +482,79 @@ function ft(n, e) {
|
|
|
482
482
|
{}
|
|
483
483
|
);
|
|
484
484
|
}
|
|
485
|
-
function pt(
|
|
486
|
-
e.forEach((
|
|
487
|
-
|
|
488
|
-
t.__parseExpression(
|
|
489
|
-
t.__parseFunction(
|
|
485
|
+
function pt(r, e = [], t) {
|
|
486
|
+
e.forEach((n) => {
|
|
487
|
+
r.watch(
|
|
488
|
+
t.__parseExpression(n.source),
|
|
489
|
+
t.__parseFunction(n.handler),
|
|
490
490
|
{
|
|
491
|
-
deep:
|
|
492
|
-
immediate:
|
|
491
|
+
deep: n.deep,
|
|
492
|
+
immediate: n.immediate
|
|
493
493
|
}
|
|
494
494
|
);
|
|
495
495
|
});
|
|
496
496
|
}
|
|
497
|
-
function dt(
|
|
498
|
-
return Object.entries(
|
|
499
|
-
(t, [
|
|
497
|
+
function dt(r, e) {
|
|
498
|
+
return Object.entries(r ?? {}).reduce(
|
|
499
|
+
(t, [n, s]) => (t[n] = e.__parseFunction(s), t),
|
|
500
500
|
{}
|
|
501
501
|
);
|
|
502
502
|
}
|
|
503
|
-
let
|
|
504
|
-
const mt = (
|
|
505
|
-
async function ue(
|
|
506
|
-
const { urls: t = [], library:
|
|
507
|
-
if (s.length === 0 || !
|
|
508
|
-
const o = t.filter((i) => J(i)), a = await Qe(s,
|
|
509
|
-
(i) => (console.warn("loadScriptUrl error", s,
|
|
503
|
+
let T = [];
|
|
504
|
+
const mt = (r) => r;
|
|
505
|
+
async function ue(r, e = window) {
|
|
506
|
+
const { urls: t = [], library: n } = r, s = t.filter((i) => L(i));
|
|
507
|
+
if (s.length === 0 || !n) return null;
|
|
508
|
+
const o = t.filter((i) => J(i)), a = await Qe(s, n, e).catch(
|
|
509
|
+
(i) => (console.warn("loadScriptUrl error", s, n, i), null)
|
|
510
510
|
);
|
|
511
511
|
return a ? {
|
|
512
512
|
component: a,
|
|
513
513
|
css: o
|
|
514
514
|
} : null;
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
const { getDsl: e, getDslByUrl: t, options:
|
|
518
|
-
return
|
|
519
|
-
delete
|
|
520
|
-
}),
|
|
516
|
+
function U(r) {
|
|
517
|
+
const { getDsl: e, getDslByUrl: t, options: n } = r;
|
|
518
|
+
return n.window && (T.forEach((s) => {
|
|
519
|
+
delete n.window[s];
|
|
520
|
+
}), T = []), (s, o, a = O) => !o || typeof o == "string" ? s : o.type === "Schema" && o.id ? a.defineAsyncComponent(async () => {
|
|
521
521
|
const i = await e(o.id);
|
|
522
|
-
return i && (i.name = s), i ?
|
|
523
|
-
...
|
|
522
|
+
return i && (i.name = s), i ? B({
|
|
523
|
+
...n,
|
|
524
524
|
Vue: a,
|
|
525
525
|
dsl: i,
|
|
526
526
|
mode: _.Runtime,
|
|
527
|
-
loader:
|
|
527
|
+
loader: U(r)
|
|
528
528
|
}).renderer : null;
|
|
529
529
|
}) : o.type === "UrlSchema" && o.url ? a.defineAsyncComponent(async () => {
|
|
530
530
|
const i = await t(o.url);
|
|
531
|
-
return i && (i.name = s), i ?
|
|
532
|
-
...
|
|
531
|
+
return i && (i.name = s), i ? B({
|
|
532
|
+
...n,
|
|
533
533
|
Vue: a,
|
|
534
534
|
dsl: i,
|
|
535
535
|
mode: _.Runtime,
|
|
536
|
-
loader:
|
|
536
|
+
loader: U(r)
|
|
537
537
|
}).renderer : null;
|
|
538
|
-
}) : o.type === "Plugin" ? (o.library &&
|
|
539
|
-
const i = await ue(o,
|
|
540
|
-
return i ? (ce(i.css,
|
|
538
|
+
}) : o.type === "Plugin" ? (o.library && T.push(o.library), a.defineAsyncComponent(async () => {
|
|
539
|
+
const i = await ue(o, n.window);
|
|
540
|
+
return i ? (ce(i.css, n.window), i.component) : (console.warn("getPlugin result is null", o), null);
|
|
541
541
|
})) : s;
|
|
542
542
|
}
|
|
543
|
-
function M(
|
|
544
|
-
if (!
|
|
545
|
-
const { id: s = null, directives: o = [] } =
|
|
543
|
+
function M(r, e, t = O, n = mt) {
|
|
544
|
+
if (!r || !r.name || r.invisible) return null;
|
|
545
|
+
const { id: s = null, directives: o = [] } = r, { vIf: a, vFor: i, vShow: l, vModels: c, vBind: d } = ht(o);
|
|
546
546
|
if (a && !vt(a, e))
|
|
547
547
|
return null;
|
|
548
548
|
const u = (f) => {
|
|
549
549
|
const p = f.$components, h = (() => {
|
|
550
|
-
if (
|
|
551
|
-
return yt(f,
|
|
552
|
-
if (
|
|
553
|
-
const $ = r
|
|
550
|
+
if (r.name === "component")
|
|
551
|
+
return yt(f, r.props?.is);
|
|
552
|
+
if (r.name === "slot") return r.name;
|
|
553
|
+
const $ = n(r.name, r.from, t);
|
|
554
554
|
return S($) ? p[$] ?? $ : $;
|
|
555
|
-
})(), m = gt(s,
|
|
556
|
-
if (
|
|
557
|
-
return wt(t,
|
|
555
|
+
})(), m = gt(s, r.props ?? {}, f), v = _t(t, r.events ?? {}, f);
|
|
556
|
+
if (r.name === "slot")
|
|
557
|
+
return wt(t, r, m, f, n);
|
|
558
558
|
d && Object.assign(m, f.__parseExpression(d.value)), l && (m.style = Object.assign(
|
|
559
559
|
m.style ?? {},
|
|
560
560
|
$t(l, f)
|
|
@@ -563,95 +563,95 @@ function M(n, e, t = O, r = mt) {
|
|
|
563
563
|
});
|
|
564
564
|
const w = Et(
|
|
565
565
|
t,
|
|
566
|
-
|
|
566
|
+
r.children ?? [],
|
|
567
567
|
f,
|
|
568
|
-
|
|
569
|
-
|
|
568
|
+
n,
|
|
569
|
+
r
|
|
570
570
|
);
|
|
571
571
|
return t.createVNode(h, { ...m, ...v }, w);
|
|
572
572
|
};
|
|
573
573
|
return i ? Ct(i, u, e) : u(e);
|
|
574
574
|
}
|
|
575
|
-
function ht(
|
|
576
|
-
const e =
|
|
575
|
+
function ht(r = []) {
|
|
576
|
+
const e = r.find((i) => j(i.name) === "vIf"), t = r.find((i) => j(i.name) === "vFor"), n = r.find((i) => j(i.name) === "vShow"), s = r.find((i) => j(i.name) === "vBind"), o = r.filter((i) => j(i.name) === "vModel"), a = r.filter(
|
|
577
577
|
(i) => !Je.includes(j(i.name))
|
|
578
578
|
);
|
|
579
579
|
return {
|
|
580
580
|
vIf: e,
|
|
581
581
|
vFor: t,
|
|
582
|
-
vShow:
|
|
582
|
+
vShow: n,
|
|
583
583
|
vModels: o,
|
|
584
584
|
vBind: s,
|
|
585
585
|
others: a
|
|
586
586
|
};
|
|
587
587
|
}
|
|
588
|
-
function vt(
|
|
589
|
-
return !!e.__parseExpression(
|
|
588
|
+
function vt(r, e) {
|
|
589
|
+
return !!e.__parseExpression(r.value);
|
|
590
590
|
}
|
|
591
|
-
function yt(
|
|
592
|
-
return e ? g(e) ?
|
|
591
|
+
function yt(r, e) {
|
|
592
|
+
return e ? g(e) ? r.__parseExpression(e) : e : "div";
|
|
593
593
|
}
|
|
594
|
-
function gt(
|
|
595
|
-
const
|
|
594
|
+
function gt(r, e, t) {
|
|
595
|
+
const n = Object.keys(e || {}).reduce(
|
|
596
596
|
(s, o) => {
|
|
597
597
|
let a = e[o];
|
|
598
|
-
return g(a) ? a = t.__parseExpression(a) :
|
|
598
|
+
return g(a) ? a = t.__parseExpression(a) : k(a) && (a = t.__parseFunction(a)), s[o] = a, s;
|
|
599
599
|
},
|
|
600
600
|
{}
|
|
601
601
|
);
|
|
602
|
-
return
|
|
602
|
+
return n.ref = t.__ref(r, n.ref), n;
|
|
603
603
|
}
|
|
604
|
-
function _t(
|
|
605
|
-
const
|
|
604
|
+
function _t(r, e, t) {
|
|
605
|
+
const n = ["passive", "capture", "once"], s = {
|
|
606
606
|
capture: "Capture",
|
|
607
607
|
once: "Once",
|
|
608
608
|
passive: "OnceCapture"
|
|
609
609
|
};
|
|
610
610
|
return Object.keys(e || {}).reduce(
|
|
611
611
|
(o, a) => {
|
|
612
|
-
const i = e[a], l = fe(i.modifiers), c = l.find((f) =>
|
|
613
|
-
return u && (o[d] =
|
|
612
|
+
const i = e[a], l = fe(i.modifiers), c = l.find((f) => n.includes(f)), d = "on" + Pe(a) + (c && s[c] || ""), u = t.__parseFunction(i.handler);
|
|
613
|
+
return u && (o[d] = r.withModifiers(u, l)), o;
|
|
614
614
|
},
|
|
615
615
|
{}
|
|
616
616
|
);
|
|
617
617
|
}
|
|
618
|
-
function fe(
|
|
619
|
-
const t = Object.keys(
|
|
620
|
-
return e ? t.map((
|
|
618
|
+
function fe(r = {}, e = !1) {
|
|
619
|
+
const t = Object.keys(r);
|
|
620
|
+
return e ? t.map((n) => "." + n) : t;
|
|
621
621
|
}
|
|
622
|
-
function wt(
|
|
623
|
-
const { children: o } = e, a = St(e,
|
|
624
|
-
return i ? i(t) : o ? S(o) ?
|
|
625
|
-
ie(
|
|
622
|
+
function wt(r, e, t, n, s) {
|
|
623
|
+
const { children: o } = e, a = St(e, n), i = n.$slots?.[a.name];
|
|
624
|
+
return i ? i(t) : o ? S(o) ? r.createTextVNode(o) : g(o) ? r.createTextVNode(
|
|
625
|
+
ie(n.__parseExpression(o))
|
|
626
626
|
) : Array.isArray(o) ? o.map(
|
|
627
|
-
(l) => M(l,
|
|
627
|
+
(l) => M(l, n, r, s)
|
|
628
628
|
) : null : null;
|
|
629
629
|
}
|
|
630
|
-
function St(
|
|
631
|
-
const { props: t } =
|
|
630
|
+
function St(r, e) {
|
|
631
|
+
const { props: t } = r, n = t?.name || "default";
|
|
632
632
|
return {
|
|
633
|
-
name: g(
|
|
633
|
+
name: g(n) ? e.__parseExpression(n) : n,
|
|
634
634
|
params: []
|
|
635
635
|
};
|
|
636
636
|
}
|
|
637
|
-
function $t(
|
|
638
|
-
return e.__parseExpression(
|
|
637
|
+
function $t(r, e) {
|
|
638
|
+
return e.__parseExpression(r.value) ? {} : {
|
|
639
639
|
display: "none"
|
|
640
640
|
};
|
|
641
641
|
}
|
|
642
|
-
function jt(
|
|
643
|
-
const
|
|
642
|
+
function jt(r, e, t) {
|
|
643
|
+
const n = {
|
|
644
644
|
type: "JSFunction",
|
|
645
645
|
value: e.value?.value ? `(v) => {
|
|
646
646
|
${e.value.value} = v;
|
|
647
647
|
}` : "(v) => {}"
|
|
648
|
-
}, s = t.__parseFunction(
|
|
648
|
+
}, s = t.__parseFunction(n), o = fe(e.modifiers), a = g(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
|
649
649
|
return {
|
|
650
650
|
[a]: t.__parseExpression(e.value),
|
|
651
|
-
[`onUpdate:${a}`]: o.length && s ?
|
|
651
|
+
[`onUpdate:${a}`]: o.length && s ? r.withModifiers(s, o) : s
|
|
652
652
|
};
|
|
653
653
|
}
|
|
654
|
-
function Et(
|
|
654
|
+
function Et(r, e, t, n, s) {
|
|
655
655
|
if (!e) return null;
|
|
656
656
|
if (S(e))
|
|
657
657
|
return { default: () => e };
|
|
@@ -666,81 +666,81 @@ function Et(n, e, t, r, s) {
|
|
|
666
666
|
return Object.entries(o).reduce((i, [l, { nodes: c, params: d }]) => (i[l] = (u) => {
|
|
667
667
|
const f = d.length ? Ce(u ?? {}, d) : a(u);
|
|
668
668
|
return c.map(
|
|
669
|
-
(p) => M(p, t.__clone(f),
|
|
669
|
+
(p) => M(p, t.__clone(f), r, n)
|
|
670
670
|
);
|
|
671
671
|
}, i), {});
|
|
672
672
|
}
|
|
673
673
|
return null;
|
|
674
674
|
}
|
|
675
|
-
function bt(
|
|
675
|
+
function bt(r) {
|
|
676
676
|
const e = {
|
|
677
677
|
default: {
|
|
678
678
|
params: [],
|
|
679
679
|
nodes: []
|
|
680
680
|
}
|
|
681
681
|
};
|
|
682
|
-
for (const t of
|
|
683
|
-
const
|
|
684
|
-
e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(
|
|
682
|
+
for (const t of r) {
|
|
683
|
+
const n = Pt(t.slot), s = n.name;
|
|
684
|
+
e[s] ? (e[s].nodes.push(t), e[s].params = e[s].params.concat(n.params)) : e[s] = {
|
|
685
685
|
nodes: [t],
|
|
686
|
-
params:
|
|
686
|
+
params: n.params
|
|
687
687
|
};
|
|
688
688
|
}
|
|
689
689
|
return e;
|
|
690
690
|
}
|
|
691
|
-
function Pt(
|
|
692
|
-
return S(
|
|
691
|
+
function Pt(r = "default") {
|
|
692
|
+
return S(r) ? { name: r, params: [] } : { params: [], ...r };
|
|
693
693
|
}
|
|
694
|
-
function Ct(
|
|
695
|
-
const { value:
|
|
696
|
-
let i = t.__parseExpression(
|
|
697
|
-
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${
|
|
694
|
+
function Ct(r, e, t) {
|
|
695
|
+
const { value: n, iterator: s } = r, { item: o = "item", index: a = "index" } = s || {};
|
|
696
|
+
let i = t.__parseExpression(n) || [];
|
|
697
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((l, c) => c + 1)), Array.isArray(i) ? i.map((l, c) => e(t.__clone({ [o]: l, [a]: c }))) : (console.warn("[vForRender]:", `${n?.value} is not a Arrary`), []);
|
|
698
698
|
}
|
|
699
|
-
function Rt(
|
|
700
|
-
return De() ? (ke(
|
|
699
|
+
function Rt(r) {
|
|
700
|
+
return De() ? (ke(r), !0) : !1;
|
|
701
701
|
}
|
|
702
|
-
function V(
|
|
703
|
-
return typeof
|
|
702
|
+
function V(r) {
|
|
703
|
+
return typeof r == "function" ? r() : Te(r);
|
|
704
704
|
}
|
|
705
705
|
const pe = typeof window < "u" && typeof document < "u";
|
|
706
706
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
707
|
-
const Ft = (
|
|
707
|
+
const Ft = (r) => r != null, It = () => {
|
|
708
708
|
};
|
|
709
|
-
function
|
|
709
|
+
function Ht(r) {
|
|
710
710
|
return te();
|
|
711
711
|
}
|
|
712
|
-
function
|
|
713
|
-
if (
|
|
714
|
-
return
|
|
715
|
-
const e =
|
|
716
|
-
return typeof e == "function" ?
|
|
712
|
+
function xt(...r) {
|
|
713
|
+
if (r.length !== 1)
|
|
714
|
+
return He(...r);
|
|
715
|
+
const e = r[0];
|
|
716
|
+
return typeof e == "function" ? xe(Me(() => ({ get: e, set: It }))) : q(e);
|
|
717
717
|
}
|
|
718
|
-
function Mt(
|
|
719
|
-
|
|
718
|
+
function Mt(r, e) {
|
|
719
|
+
Ht() && Oe(r, e);
|
|
720
720
|
}
|
|
721
|
-
function Ot(
|
|
721
|
+
function Ot(r) {
|
|
722
722
|
var e;
|
|
723
|
-
const t = V(
|
|
723
|
+
const t = V(r);
|
|
724
724
|
return (e = t?.$el) != null ? e : t;
|
|
725
725
|
}
|
|
726
726
|
const Dt = pe ? window : void 0, kt = pe ? window.document : void 0;
|
|
727
727
|
function Tt() {
|
|
728
|
-
const
|
|
728
|
+
const r = q(!1), e = te();
|
|
729
729
|
return e && Ae(() => {
|
|
730
|
-
|
|
731
|
-
}, e),
|
|
730
|
+
r.value = !0;
|
|
731
|
+
}, e), r;
|
|
732
732
|
}
|
|
733
|
-
function At(
|
|
733
|
+
function At(r) {
|
|
734
734
|
const e = Tt();
|
|
735
|
-
return re(() => (e.value, !!
|
|
735
|
+
return re(() => (e.value, !!r()));
|
|
736
736
|
}
|
|
737
|
-
function Bt(
|
|
738
|
-
const { window:
|
|
737
|
+
function Bt(r, e, t = {}) {
|
|
738
|
+
const { window: n = Dt, ...s } = t;
|
|
739
739
|
let o;
|
|
740
|
-
const a = At(() =>
|
|
740
|
+
const a = At(() => n && "MutationObserver" in n), i = () => {
|
|
741
741
|
o && (o.disconnect(), o = void 0);
|
|
742
742
|
}, l = re(() => {
|
|
743
|
-
const f = V(
|
|
743
|
+
const f = V(r), p = (Array.isArray(f) ? f : [f]).map(Ot).filter(Ft);
|
|
744
744
|
return new Set(p);
|
|
745
745
|
}), c = ne(
|
|
746
746
|
() => l.value,
|
|
@@ -757,12 +757,12 @@ function Bt(n, e, t = {}) {
|
|
|
757
757
|
takeRecords: d
|
|
758
758
|
};
|
|
759
759
|
}
|
|
760
|
-
function Ut(
|
|
761
|
-
var t,
|
|
760
|
+
function Ut(r = null, e = {}) {
|
|
761
|
+
var t, n, s;
|
|
762
762
|
const {
|
|
763
763
|
document: o = kt,
|
|
764
764
|
restoreOnUnmount: a = (u) => u
|
|
765
|
-
} = e, i = (t = o?.title) != null ? t : "", l =
|
|
765
|
+
} = e, i = (t = o?.title) != null ? t : "", l = xt((n = r ?? o?.title) != null ? n : null), c = r && typeof r == "function";
|
|
766
766
|
function d(u) {
|
|
767
767
|
if (!("titleTemplate" in e))
|
|
768
768
|
return u;
|
|
@@ -791,21 +791,21 @@ function Ut(n = null, e = {}) {
|
|
|
791
791
|
const Z = se({
|
|
792
792
|
name: "VtjPageContainer",
|
|
793
793
|
async setup() {
|
|
794
|
-
const
|
|
795
|
-
return
|
|
796
|
-
provider:
|
|
794
|
+
const r = me(), e = oe(), t = e.params.id, n = t ? r.getPage(t) : r.getHomepage(), s = n ? await r.getRenderComponent(n.id) : null;
|
|
795
|
+
return n && Ut(n.title || "VTJ"), {
|
|
796
|
+
provider: r,
|
|
797
797
|
component: s,
|
|
798
|
-
file:
|
|
798
|
+
file: n,
|
|
799
799
|
query: e.query
|
|
800
800
|
};
|
|
801
801
|
},
|
|
802
802
|
render() {
|
|
803
|
-
return this.component ?
|
|
803
|
+
return this.component ? A(this.component, this.query) : A("div", "页面不存在");
|
|
804
804
|
}
|
|
805
805
|
}), Nt = se({
|
|
806
806
|
name: "VtjStartupContainer",
|
|
807
807
|
render() {
|
|
808
|
-
return
|
|
808
|
+
return A(qe);
|
|
809
809
|
}
|
|
810
810
|
}), de = Symbol("Provider");
|
|
811
811
|
class qt extends ve {
|
|
@@ -813,7 +813,7 @@ class qt extends ve {
|
|
|
813
813
|
super(), this.options = e;
|
|
814
814
|
const {
|
|
815
815
|
service: t,
|
|
816
|
-
mode:
|
|
816
|
+
mode: n = _.Raw,
|
|
817
817
|
dependencies: s,
|
|
818
818
|
materials: o,
|
|
819
819
|
project: a = {},
|
|
@@ -824,7 +824,7 @@ class qt extends ve {
|
|
|
824
824
|
materialPath: u = "./",
|
|
825
825
|
nodeEnv: f = "development"
|
|
826
826
|
} = e;
|
|
827
|
-
this.mode =
|
|
827
|
+
this.mode = n, this.modules = c, this.service = t, this.router = d, this.materialPath = u, this.nodeEnv = f, s && (this.dependencies = s), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i), n !== _.Design && this.load(a);
|
|
828
828
|
}
|
|
829
829
|
mode;
|
|
830
830
|
globals = {};
|
|
@@ -845,11 +845,11 @@ class qt extends ve {
|
|
|
845
845
|
const t = this.modules[`.vtj/projects/${e.id}.json`];
|
|
846
846
|
if (this.project = t ? await t() : await this.service.init(e), !this.project)
|
|
847
847
|
throw new Error("project is null");
|
|
848
|
-
const { apis:
|
|
849
|
-
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis = tt(
|
|
848
|
+
const { apis: n = [], meta: s = [] } = this.project, o = window;
|
|
849
|
+
o.CKEDITOR_VERSION = void 0, this.nodeEnv !== "production" && await this.loadAssets(o), this.apis = tt(n, s, this.adapter), le(), this.project.config?.mock && nt(n), this.initRouter(), this.triggerReady();
|
|
850
850
|
}
|
|
851
851
|
async loadAssets(e) {
|
|
852
|
-
const { dependencies: t = [] } = this.project, { dependencies:
|
|
852
|
+
const { dependencies: t = [] } = this.project, { dependencies: n, library: s, components: o, materialPath: a } = this, {
|
|
853
853
|
libraryExports: i,
|
|
854
854
|
libraryMap: l,
|
|
855
855
|
materials: c,
|
|
@@ -857,7 +857,7 @@ class qt extends ve {
|
|
|
857
857
|
materialMapLibrary: u
|
|
858
858
|
} = We(t, a);
|
|
859
859
|
for (const p of i) {
|
|
860
|
-
const h =
|
|
860
|
+
const h = n[p], m = e[p];
|
|
861
861
|
if (m)
|
|
862
862
|
s[p] = m;
|
|
863
863
|
else if (h)
|
|
@@ -900,27 +900,41 @@ class qt extends ve {
|
|
|
900
900
|
}
|
|
901
901
|
install(e) {
|
|
902
902
|
const t = e.config.globalProperties.installed || {};
|
|
903
|
-
for (const [
|
|
904
|
-
!t[
|
|
905
|
-
this.options.install && e.use(this.options.install), e.provide(de, this), e.config.globalProperties.installed = t
|
|
903
|
+
for (const [n, s] of Object.entries(this.library))
|
|
904
|
+
!t[n] && Xe(s) && (e.use(s), t[n] = !0);
|
|
905
|
+
this.options.install && e.use(this.options.install), e.provide(de, this), e.config.globalProperties.installed = t, this.nodeEnv === "development" && (e.config.errorHandler = (n, s, o) => {
|
|
906
|
+
const a = s?.$options.name, i = n?.message || n?.msg || "未知错误", l = `[ ${a} ] ${i}`;
|
|
907
|
+
console.error(
|
|
908
|
+
"[VTJ Error]:",
|
|
909
|
+
{
|
|
910
|
+
err: n,
|
|
911
|
+
instance: s,
|
|
912
|
+
info: o
|
|
913
|
+
},
|
|
914
|
+
n?.stack
|
|
915
|
+
), D.error({
|
|
916
|
+
title: "运行时错误:请在控制台查看详情",
|
|
917
|
+
message: l
|
|
918
|
+
});
|
|
919
|
+
});
|
|
906
920
|
}
|
|
907
921
|
getFile(e) {
|
|
908
922
|
const { blocks: t = [] } = this.project || {};
|
|
909
|
-
return this.getPage(e) || t.find((
|
|
923
|
+
return this.getPage(e) || t.find((n) => n.id === e) || null;
|
|
910
924
|
}
|
|
911
925
|
getPage(e) {
|
|
912
|
-
const { pages: t = [] } = this.project || {},
|
|
926
|
+
const { pages: t = [] } = this.project || {}, n = (s, o = []) => {
|
|
913
927
|
for (const a of o) {
|
|
914
928
|
if (a.id === s)
|
|
915
929
|
return a;
|
|
916
930
|
if (a.children && a.children.length) {
|
|
917
|
-
const i =
|
|
931
|
+
const i = n(s, a.children);
|
|
918
932
|
if (i)
|
|
919
933
|
return i;
|
|
920
934
|
}
|
|
921
935
|
}
|
|
922
936
|
};
|
|
923
|
-
return
|
|
937
|
+
return n(e, t) || null;
|
|
924
938
|
}
|
|
925
939
|
getHomepage() {
|
|
926
940
|
const { homepage: e } = this.project || {};
|
|
@@ -939,23 +953,23 @@ class qt extends ve {
|
|
|
939
953
|
validSuccess: !1,
|
|
940
954
|
originResponse: !0
|
|
941
955
|
}
|
|
942
|
-
}).then((
|
|
956
|
+
}).then((n) => n.data).catch(() => null));
|
|
943
957
|
}
|
|
944
958
|
createDslRenderer(e, t = {}) {
|
|
945
|
-
const { library:
|
|
959
|
+
const { library: n, components: s, mode: o, apis: a } = this, i = {
|
|
946
960
|
mode: o,
|
|
947
|
-
Vue:
|
|
961
|
+
Vue: n.Vue,
|
|
948
962
|
components: s,
|
|
949
|
-
libs:
|
|
963
|
+
libs: n,
|
|
950
964
|
apis: a,
|
|
951
965
|
window,
|
|
952
966
|
...t
|
|
953
|
-
}, l =
|
|
967
|
+
}, l = U({
|
|
954
968
|
getDsl: async (c) => await this.getDsl(c) || null,
|
|
955
969
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
|
956
970
|
options: i
|
|
957
971
|
});
|
|
958
|
-
return
|
|
972
|
+
return B({
|
|
959
973
|
...i,
|
|
960
974
|
dsl: e,
|
|
961
975
|
loader: l
|
|
@@ -964,17 +978,17 @@ class qt extends ve {
|
|
|
964
978
|
async getRenderComponent(e) {
|
|
965
979
|
const t = this.getFile(e);
|
|
966
980
|
if (!t)
|
|
967
|
-
return
|
|
968
|
-
const
|
|
981
|
+
return H.warn(`Can not find file: ${e}`), null;
|
|
982
|
+
const n = `.vtj/vue/${e}.vue`, s = this.modules[n];
|
|
969
983
|
if (s)
|
|
970
984
|
return (await s())?.default;
|
|
971
985
|
const o = await this.getDsl(t.id);
|
|
972
|
-
return o ? this.createDslRenderer(o).renderer : (
|
|
986
|
+
return o ? this.createDslRenderer(o).renderer : (H.warn(`Can not find dsl: ${e}`), null);
|
|
973
987
|
}
|
|
974
988
|
defineUrlSchemaComponent(e, t) {
|
|
975
989
|
return X(async () => {
|
|
976
|
-
const
|
|
977
|
-
return
|
|
990
|
+
const n = await this.getDslByUrl(e);
|
|
991
|
+
return n ? (n.name = t || n.name, this.createDslRenderer(n).renderer) : null;
|
|
978
992
|
});
|
|
979
993
|
}
|
|
980
994
|
definePluginComponent(e) {
|
|
@@ -984,22 +998,22 @@ class qt extends ve {
|
|
|
984
998
|
});
|
|
985
999
|
}
|
|
986
1000
|
}
|
|
987
|
-
function rn(
|
|
988
|
-
const e = new qt(
|
|
1001
|
+
function rn(r) {
|
|
1002
|
+
const e = new qt(r);
|
|
989
1003
|
return {
|
|
990
1004
|
provider: e,
|
|
991
|
-
onReady: (
|
|
1005
|
+
onReady: (n) => e.ready(n)
|
|
992
1006
|
};
|
|
993
1007
|
}
|
|
994
|
-
function me(
|
|
1008
|
+
function me(r = {}) {
|
|
995
1009
|
const e = Be(de);
|
|
996
1010
|
if (!e)
|
|
997
1011
|
throw new Error("Can not find provider");
|
|
998
1012
|
if (e.nodeEnv === "development") {
|
|
999
|
-
const { id: t, version:
|
|
1000
|
-
t &&
|
|
1013
|
+
const { id: t, version: n } = r;
|
|
1014
|
+
t && n && (async () => {
|
|
1001
1015
|
const s = await e.getDsl(t);
|
|
1002
|
-
s?.__VERSION__ !==
|
|
1016
|
+
s?.__VERSION__ !== n && D.warning({
|
|
1003
1017
|
title: s?.name,
|
|
1004
1018
|
message: "当前组件源码版本与运行时版本不一致,请重新发布组件"
|
|
1005
1019
|
});
|
|
@@ -1013,23 +1027,23 @@ const W = new Fe({
|
|
|
1013
1027
|
validSuccess: !0,
|
|
1014
1028
|
originResponse: !1,
|
|
1015
1029
|
failMessage: !0,
|
|
1016
|
-
validate: (
|
|
1017
|
-
showError: (
|
|
1018
|
-
|
|
1019
|
-
message:
|
|
1030
|
+
validate: (r) => r.data?.code === 0,
|
|
1031
|
+
showError: (r) => {
|
|
1032
|
+
D.error({
|
|
1033
|
+
message: r || "未知错误"
|
|
1020
1034
|
});
|
|
1021
1035
|
}
|
|
1022
1036
|
}
|
|
1023
|
-
}), Jt = (
|
|
1024
|
-
url:
|
|
1037
|
+
}), Jt = (r = "/vtj/local/repository/${type}.json") => (e, t) => W.send({
|
|
1038
|
+
url: r,
|
|
1025
1039
|
method: "post",
|
|
1026
1040
|
query: { type: e },
|
|
1027
1041
|
data: {
|
|
1028
1042
|
type: e,
|
|
1029
1043
|
data: t
|
|
1030
1044
|
}
|
|
1031
|
-
}), Lt = (
|
|
1032
|
-
url:
|
|
1045
|
+
}), Lt = (r = "/vtj/local/repository/uploader.json") => async (e, t) => await W.send({
|
|
1046
|
+
url: r,
|
|
1033
1047
|
method: "post",
|
|
1034
1048
|
data: {
|
|
1035
1049
|
files: e,
|
|
@@ -1038,7 +1052,7 @@ const W = new Fe({
|
|
|
1038
1052
|
settings: {
|
|
1039
1053
|
type: "data"
|
|
1040
1054
|
}
|
|
1041
|
-
}).then((
|
|
1055
|
+
}).then((n) => n && n[0] ? n[0] : null).catch(() => null);
|
|
1042
1056
|
class G {
|
|
1043
1057
|
api;
|
|
1044
1058
|
pluginCaches = {};
|
|
@@ -1117,11 +1131,11 @@ class G {
|
|
|
1117
1131
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
|
1118
1132
|
}
|
|
1119
1133
|
async getPluginMaterial(e) {
|
|
1120
|
-
const { urls: t = [] } = e,
|
|
1121
|
-
if (!
|
|
1122
|
-
const s = this.pluginCaches[
|
|
1123
|
-
return s || (this.pluginCaches[
|
|
1124
|
-
url:
|
|
1134
|
+
const { urls: t = [] } = e, n = t.filter((o) => Ve(o))[0];
|
|
1135
|
+
if (!n) return null;
|
|
1136
|
+
const s = this.pluginCaches[n];
|
|
1137
|
+
return s || (this.pluginCaches[n] = W.send({
|
|
1138
|
+
url: n,
|
|
1125
1139
|
method: "get",
|
|
1126
1140
|
settings: {
|
|
1127
1141
|
validSuccess: !1,
|
|
@@ -1137,7 +1151,7 @@ const y = new Ie({
|
|
|
1137
1151
|
});
|
|
1138
1152
|
class sn extends G {
|
|
1139
1153
|
init(e) {
|
|
1140
|
-
const t = new I(e),
|
|
1154
|
+
const t = new I(e), n = y.get(`project_${t.id}`), s = Object.assign(t.toDsl(), n || {});
|
|
1141
1155
|
return y.save(`project_${t.id}`, s), Promise.resolve(s);
|
|
1142
1156
|
}
|
|
1143
1157
|
saveProject(e) {
|
|
@@ -1145,7 +1159,7 @@ class sn extends G {
|
|
|
1145
1159
|
return y.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
|
1146
1160
|
}
|
|
1147
1161
|
saveMaterials(e, t) {
|
|
1148
|
-
return y.save(`materials_${e.id}`,
|
|
1162
|
+
return y.save(`materials_${e.id}`, N(t)), Promise.resolve(!0);
|
|
1149
1163
|
}
|
|
1150
1164
|
saveFile(e) {
|
|
1151
1165
|
return y.save(`file_${e.id}`, e), Promise.resolve(!0);
|
|
@@ -1169,19 +1183,19 @@ class sn extends G {
|
|
|
1169
1183
|
return Promise.resolve(!0);
|
|
1170
1184
|
}
|
|
1171
1185
|
getHistory(e) {
|
|
1172
|
-
const t = y.get(`history_${e}`),
|
|
1173
|
-
return Promise.resolve(
|
|
1186
|
+
const t = y.get(`history_${e}`), n = new ee(t || { id: e });
|
|
1187
|
+
return Promise.resolve(n.toDsl());
|
|
1174
1188
|
}
|
|
1175
1189
|
getHistoryItem(e, t) {
|
|
1176
|
-
const
|
|
1177
|
-
return Promise.resolve(
|
|
1190
|
+
const n = y.get(`history_${e}_${t}`);
|
|
1191
|
+
return Promise.resolve(n);
|
|
1178
1192
|
}
|
|
1179
1193
|
saveHistoryItem(e, t) {
|
|
1180
1194
|
return y.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
|
1181
1195
|
}
|
|
1182
1196
|
removeHistoryItem(e, t) {
|
|
1183
|
-
return t.forEach((
|
|
1184
|
-
y.remove(`history_${e}_${
|
|
1197
|
+
return t.forEach((n) => {
|
|
1198
|
+
y.remove(`history_${e}_${n}`);
|
|
1185
1199
|
}), Promise.resolve(!0);
|
|
1186
1200
|
}
|
|
1187
1201
|
}
|
|
@@ -1192,7 +1206,7 @@ class Vt extends G {
|
|
|
1192
1206
|
histories = {};
|
|
1193
1207
|
historyItems = {};
|
|
1194
1208
|
init(e) {
|
|
1195
|
-
const t = new I(e),
|
|
1209
|
+
const t = new I(e), n = this.projects[t.id] || {}, s = Object.assign(t.toDsl(), n);
|
|
1196
1210
|
return this.projects[s.id] = s, Promise.resolve(s);
|
|
1197
1211
|
}
|
|
1198
1212
|
saveProject(e) {
|
|
@@ -1200,7 +1214,7 @@ class Vt extends G {
|
|
|
1200
1214
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
|
1201
1215
|
}
|
|
1202
1216
|
saveMaterials(e, t) {
|
|
1203
|
-
return e.id && (this.materials[e.id] =
|
|
1217
|
+
return e.id && (this.materials[e.id] = N(t)), Promise.resolve(!0);
|
|
1204
1218
|
}
|
|
1205
1219
|
saveFile(e) {
|
|
1206
1220
|
return this.files[e.id] = e, Promise.resolve(!0);
|
|
@@ -1224,20 +1238,20 @@ class Vt extends G {
|
|
|
1224
1238
|
return Promise.resolve(!0);
|
|
1225
1239
|
}
|
|
1226
1240
|
getHistory(e) {
|
|
1227
|
-
const t = this.histories[e],
|
|
1228
|
-
return Promise.resolve(
|
|
1241
|
+
const t = this.histories[e], n = new ee(t || { id: e });
|
|
1242
|
+
return Promise.resolve(n);
|
|
1229
1243
|
}
|
|
1230
1244
|
getHistoryItem(e, t) {
|
|
1231
|
-
const
|
|
1245
|
+
const n = `${e}_${t}`, s = this.historyItems[n] || {};
|
|
1232
1246
|
return Promise.resolve(s);
|
|
1233
1247
|
}
|
|
1234
1248
|
saveHistoryItem(e, t) {
|
|
1235
|
-
const
|
|
1236
|
-
return this.historyItems[
|
|
1249
|
+
const n = `${e}_${t.id}`;
|
|
1250
|
+
return this.historyItems[n] = t, Promise.resolve(!0);
|
|
1237
1251
|
}
|
|
1238
1252
|
removeHistoryItem(e, t) {
|
|
1239
|
-
return t.forEach((
|
|
1240
|
-
const s = `${e}_${
|
|
1253
|
+
return t.forEach((n) => {
|
|
1254
|
+
const s = `${e}_${n}`;
|
|
1241
1255
|
delete this.historyItems[s];
|
|
1242
1256
|
}), Promise.resolve(!0);
|
|
1243
1257
|
}
|
|
@@ -1261,7 +1275,7 @@ class an extends G {
|
|
|
1261
1275
|
async saveMaterials(e, t) {
|
|
1262
1276
|
return !!await this.api("saveMaterials", {
|
|
1263
1277
|
project: e,
|
|
1264
|
-
materials:
|
|
1278
|
+
materials: N(t)
|
|
1265
1279
|
}).catch(() => !1);
|
|
1266
1280
|
}
|
|
1267
1281
|
async saveFile(e) {
|
|
@@ -1301,12 +1315,12 @@ class an extends G {
|
|
|
1301
1315
|
);
|
|
1302
1316
|
}
|
|
1303
1317
|
}
|
|
1304
|
-
function he(
|
|
1305
|
-
return
|
|
1306
|
-
const { id: t, title:
|
|
1318
|
+
function he(r = []) {
|
|
1319
|
+
return r.map((e) => {
|
|
1320
|
+
const { id: t, title: n, icon: s, children: o, hidden: a } = e;
|
|
1307
1321
|
return {
|
|
1308
1322
|
id: t,
|
|
1309
|
-
title:
|
|
1323
|
+
title: n,
|
|
1310
1324
|
icon: s,
|
|
1311
1325
|
hidden: a,
|
|
1312
1326
|
url: `/page/${t}`,
|
|
@@ -1315,24 +1329,24 @@ function he(n = []) {
|
|
|
1315
1329
|
});
|
|
1316
1330
|
}
|
|
1317
1331
|
function cn() {
|
|
1318
|
-
const
|
|
1332
|
+
const r = me(), e = oe(), t = q(!1), n = r.project;
|
|
1319
1333
|
Ue(() => {
|
|
1320
1334
|
const { name: a, params: i, meta: l } = e;
|
|
1321
1335
|
if (a === "VtjPage") {
|
|
1322
|
-
const c =
|
|
1336
|
+
const c = r.getPage(i.id);
|
|
1323
1337
|
t.value = !c?.mask;
|
|
1324
1338
|
} else if (a === "VtjHomepage") {
|
|
1325
|
-
const c =
|
|
1339
|
+
const c = r.getHomepage();
|
|
1326
1340
|
t.value = !c?.mask;
|
|
1327
1341
|
} else
|
|
1328
1342
|
t.value = !l.mask;
|
|
1329
1343
|
});
|
|
1330
|
-
const s = he(
|
|
1344
|
+
const s = he(n?.pages), o = n?.config;
|
|
1331
1345
|
return {
|
|
1332
1346
|
disabled: t,
|
|
1333
1347
|
logo: o?.logo,
|
|
1334
1348
|
themeSwitchable: o?.themeSwitchable,
|
|
1335
|
-
title: o?.title ||
|
|
1349
|
+
title: o?.title || n?.description || n?.name || "VTJ App",
|
|
1336
1350
|
menus: s
|
|
1337
1351
|
};
|
|
1338
1352
|
}
|
|
@@ -1354,11 +1368,11 @@ export {
|
|
|
1354
1368
|
en as createAssetScripts,
|
|
1355
1369
|
tn as createAssetsCss,
|
|
1356
1370
|
ft as createDataSources,
|
|
1357
|
-
|
|
1371
|
+
U as createLoader,
|
|
1358
1372
|
on as createMemoryService,
|
|
1359
1373
|
et as createMetaApi,
|
|
1360
1374
|
rn as createProvider,
|
|
1361
|
-
|
|
1375
|
+
B as createRenderer,
|
|
1362
1376
|
Ze as createSchemaApi,
|
|
1363
1377
|
tt as createSchemaApis,
|
|
1364
1378
|
mt as defaultLoader,
|
|
@@ -1369,7 +1383,7 @@ export {
|
|
|
1369
1383
|
J as isCSSUrl,
|
|
1370
1384
|
Ye as isJSCode,
|
|
1371
1385
|
g as isJSExpression,
|
|
1372
|
-
|
|
1386
|
+
k as isJSFunction,
|
|
1373
1387
|
Ve as isJSON,
|
|
1374
1388
|
L as isJSUrl,
|
|
1375
1389
|
Xe as isVuePlugin,
|