@vtj/renderer 0.13.4 → 0.13.6
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 +7 -7
- package/dist/index.mjs +306 -301
- package/package.json +5 -5
- package/types/provider/defaults.d.ts +4 -1
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Base as Ke, BUILT_IN_COMPONENTS as ze, ProjectModel as L, HistoryModel as je } from "@vtj/core";
|
2
|
-
import { isUrl as Ge, url as F, dedupArray as Ve, isString as C, isFunction as q, logger as k, storage as X, cookie as Y, toArray as ve, unRSA as ye, delay as J, createRequest as Ee, jsonp as be, merge as Qe, pathToRegexp as We, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as _e, camelCase as P, isObject as et, upperFirst as tt, pick as st, request as se, loadScript as we, Storage as nt, mapToObject as
|
2
|
+
import { isUrl as Ge, url as F, dedupArray as Ve, isString as C, isFunction as q, logger as k, storage as X, cookie as Y, toArray as ve, unRSA as ye, delay as J, createRequest as Ee, jsonp as be, merge as Qe, pathToRegexp as We, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as _e, camelCase as P, isObject as et, upperFirst as tt, pick as st, request as se, loadScript as we, Storage as nt, mapToObject as le } from "@vtj/utils";
|
3
3
|
import * as z from "vue";
|
4
4
|
import { inject as Re, defineComponent as Pe, h as ne, ref as re, watchEffect as rt, defineAsyncComponent as Se } from "vue";
|
5
5
|
import { useRoute as Ce } from "vue-router";
|
@@ -7,10 +7,10 @@ import { useRoute as Ce } from "vue-router";
|
|
7
7
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
8
8
|
* @name @vtj/renderer
|
9
9
|
* @author CHC chenhuachun1549@dingtalk.com
|
10
|
-
* @version 0.13.
|
10
|
+
* @version 0.13.6
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const O = "0.13.
|
13
|
+
const O = "0.13.6";
|
14
14
|
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
15
15
|
const $e = [
|
16
16
|
"$el",
|
@@ -148,7 +148,7 @@ function G(n) {
|
|
148
148
|
function V(n) {
|
149
149
|
return /\.js$/.test(n);
|
150
150
|
}
|
151
|
-
function
|
151
|
+
function lt(n) {
|
152
152
|
return /\.json$/.test(n);
|
153
153
|
}
|
154
154
|
function _s(n) {
|
@@ -161,24 +161,24 @@ function ws(n = []) {
|
|
161
161
|
(e) => `<link rel="stylesheet" href="${F.append(e, { v: O })}" />`
|
162
162
|
).join("");
|
163
163
|
}
|
164
|
-
function
|
164
|
+
function ut(n, e = !1) {
|
165
165
|
return e && n.endsWith(".prod.js") ? n.replace(".prod.js", ".js") : n;
|
166
166
|
}
|
167
167
|
function ft(n, e, t = !1) {
|
168
|
-
const s = n.filter((h) => !!h.enabled), r = [], o = [],
|
168
|
+
const s = n.filter((h) => !!h.enabled), r = [], o = [], a = [], i = [], f = {}, c = {}, l = [], u = {};
|
169
169
|
return s.forEach(
|
170
170
|
({ urls: h, assetsUrl: d, library: p, assetsLibrary: g, localeLibrary: v }) => {
|
171
171
|
h?.forEach((m) => {
|
172
|
-
V(m) && r.push(
|
173
|
-
}), p && (
|
172
|
+
V(m) && r.push(ut(m, t)), G(m) && o.push(m);
|
173
|
+
}), p && (i.push(p), f[p] = B(h || [], e), v && (c[p] = v)), d && a.push(d), g && l.push(g), p && g && (u[g] = p);
|
174
174
|
}
|
175
175
|
), {
|
176
176
|
scripts: B(r, e),
|
177
177
|
css: B(o, e),
|
178
|
-
materials: B(
|
179
|
-
libraryExports:
|
180
|
-
materialExports: Ve(
|
181
|
-
materialMapLibrary:
|
178
|
+
materials: B(a, e),
|
179
|
+
libraryExports: i,
|
180
|
+
materialExports: Ve(l),
|
181
|
+
materialMapLibrary: u,
|
182
182
|
libraryMap: f,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
@@ -196,37 +196,37 @@ function dt(n = []) {
|
|
196
196
|
}
|
197
197
|
function ht(n, e) {
|
198
198
|
const t = (c) => {
|
199
|
-
const
|
200
|
-
let
|
201
|
-
for (;
|
202
|
-
if (/\s/.test(c[
|
203
|
-
|
199
|
+
const l = [];
|
200
|
+
let u = 0;
|
201
|
+
for (; u < c.length; ) {
|
202
|
+
if (/\s/.test(c[u])) {
|
203
|
+
u++;
|
204
204
|
continue;
|
205
205
|
}
|
206
|
-
if (c.substring(
|
207
|
-
const m = c.indexOf("*/",
|
206
|
+
if (c.substring(u, u + 2) === "/*") {
|
207
|
+
const m = c.indexOf("*/", u + 2);
|
208
208
|
if (m !== -1) {
|
209
|
-
|
209
|
+
u = m + 2;
|
210
210
|
continue;
|
211
211
|
}
|
212
212
|
}
|
213
|
-
if (c[
|
214
|
-
const m =
|
215
|
-
for (;
|
216
|
-
|
217
|
-
const b = c.substring(m,
|
218
|
-
if (c[
|
219
|
-
|
213
|
+
if (c[u] === "@") {
|
214
|
+
const m = u;
|
215
|
+
for (; u < c.length && c[u] !== "{" && c[u] !== ";"; )
|
216
|
+
u++;
|
217
|
+
const b = c.substring(m, u).trim(), y = b.includes("@keyframes");
|
218
|
+
if (c[u] === ";")
|
219
|
+
l.push({
|
220
220
|
type: "simple-at-rule",
|
221
|
-
content: c.substring(m,
|
222
|
-
}),
|
223
|
-
else if (c[
|
224
|
-
const x =
|
221
|
+
content: c.substring(m, u + 1)
|
222
|
+
}), u++;
|
223
|
+
else if (c[u] === "{") {
|
224
|
+
const x = u + 1;
|
225
225
|
let A = 1;
|
226
|
-
for (
|
227
|
-
c[
|
228
|
-
const Q = c.substring(m,
|
229
|
-
|
226
|
+
for (u++; u < c.length && A > 0; )
|
227
|
+
c[u] === "{" ? A++ : c[u] === "}" && A--, u++;
|
228
|
+
const Q = c.substring(m, u), R = c.substring(x, u - 1);
|
229
|
+
l.push({
|
230
230
|
type: y ? "keyframes" : "at-rule",
|
231
231
|
rule: b,
|
232
232
|
content: Q,
|
@@ -235,119 +235,119 @@ function ht(n, e) {
|
|
235
235
|
}
|
236
236
|
continue;
|
237
237
|
}
|
238
|
-
const h =
|
239
|
-
for (;
|
240
|
-
|
241
|
-
if (
|
242
|
-
const d = c.substring(h,
|
238
|
+
const h = u;
|
239
|
+
for (; u < c.length && c[u] !== "{"; )
|
240
|
+
u++;
|
241
|
+
if (u >= c.length) break;
|
242
|
+
const d = c.substring(h, u).trim();
|
243
243
|
if (!d) {
|
244
|
-
|
244
|
+
u++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const p =
|
247
|
+
const p = u + 1;
|
248
248
|
let g = 1;
|
249
|
-
for (
|
250
|
-
c[
|
251
|
-
const v = c.substring(p,
|
252
|
-
|
249
|
+
for (u++; u < c.length && g > 0; )
|
250
|
+
c[u] === "{" ? g++ : c[u] === "}" && g--, u++;
|
251
|
+
const v = c.substring(p, u - 1);
|
252
|
+
l.push({
|
253
253
|
type: "rule",
|
254
254
|
selector: d,
|
255
255
|
content: v.trim()
|
256
256
|
});
|
257
257
|
}
|
258
|
-
return
|
258
|
+
return l;
|
259
259
|
}, s = (c) => {
|
260
|
-
const
|
261
|
-
return /^(from|to|\d+(\.\d+)?%)$/.test(
|
262
|
-
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (
|
263
|
-
const d =
|
260
|
+
const l = c.trim();
|
261
|
+
return /^(from|to|\d+(\.\d+)?%)$/.test(l);
|
262
|
+
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (l, u, h) => {
|
263
|
+
const d = u.trim(), p = h.trim();
|
264
264
|
return d ? `${d}[${e}] ${p}` : p;
|
265
265
|
}), o = (c) => {
|
266
|
-
const
|
267
|
-
if (!
|
268
|
-
return
|
269
|
-
const
|
270
|
-
if (
|
271
|
-
const [, h, d = ""] =
|
272
|
-
return p ? `${p}[${e}]${d}` :
|
266
|
+
const l = c.trim();
|
267
|
+
if (!l || l.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(l) || s(l))
|
268
|
+
return l;
|
269
|
+
const u = l.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
|
+
if (u) {
|
271
|
+
const [, h, d = ""] = u, p = h.trim();
|
272
|
+
return p ? `${p}[${e}]${d}` : l;
|
273
273
|
}
|
274
|
-
return `${
|
275
|
-
},
|
276
|
-
switch (
|
274
|
+
return `${l}[${e}]`;
|
275
|
+
}, a = (c) => r(c).split(",").map((u) => o(u)).filter((u) => u.trim()).join(", "), i = (c) => c.map((l) => {
|
276
|
+
switch (l.type) {
|
277
277
|
case "simple-at-rule":
|
278
|
-
return
|
278
|
+
return l.content;
|
279
279
|
case "keyframes":
|
280
|
-
return
|
280
|
+
return l.content;
|
281
281
|
case "at-rule":
|
282
282
|
try {
|
283
|
-
const h = t(
|
284
|
-
return `${
|
283
|
+
const h = t(l.inner), d = i(h);
|
284
|
+
return `${l.rule} { ${d} }`;
|
285
285
|
} catch {
|
286
|
-
return
|
286
|
+
return l.content;
|
287
287
|
}
|
288
288
|
case "rule":
|
289
|
-
if (!
|
289
|
+
if (!l.selector || !l.content)
|
290
290
|
return "";
|
291
|
-
const
|
292
|
-
return
|
291
|
+
const u = a(l.selector);
|
292
|
+
return u.trim() ? `${u} { ${l.content} }` : "";
|
293
293
|
default:
|
294
294
|
return "";
|
295
295
|
}
|
296
|
-
}).filter((
|
296
|
+
}).filter((l) => l.trim()).join(" "), f = (c) => c.replace(/\s*{\s*/g, " { ").replace(/\s*}\s*/g, " } ").replace(/\s*;\s*/g, "; ").replace(/\s*,\s*/g, ", ").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "").replace(/\s*}\s*}/g, " } }").trim();
|
297
297
|
try {
|
298
298
|
const c = n.replace(/\/\*(?!\s*!)[\s\S]*?\*\//g, "").replace(/^\s+|\s+$/gm, "").replace(/\n\s*\n/g, `
|
299
|
-
`),
|
300
|
-
return f(
|
299
|
+
`), l = t(c), u = i(l);
|
300
|
+
return f(u);
|
301
301
|
} catch (c) {
|
302
302
|
return console.error("CSS scoping failed:", c), console.error("Input CSS:", n), n.replace(/\/\*[\s\S]*?\*\//g, "").replace(
|
303
303
|
/(@keyframes\s+[^{]+\s*{[^{}]*(?:{[^}]*}[^{}]*)*})/g,
|
304
|
-
(
|
305
|
-
).replace(/([^{}@]+)(?=\s*{)/g, (
|
306
|
-
const
|
307
|
-
return !
|
304
|
+
(l) => l
|
305
|
+
).replace(/([^{}@]+)(?=\s*{)/g, (l) => {
|
306
|
+
const u = l.trim();
|
307
|
+
return !u || u.startsWith("@") || u.includes(`[${e}]`) || s(u) ? l : `${u}[${e}]`;
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
311
311
|
function Ae(n) {
|
312
312
|
return C(n) ? n : JSON.stringify(n);
|
313
313
|
}
|
314
|
-
function
|
315
|
-
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e,
|
314
|
+
function ue(n, e, t, s = !1) {
|
315
|
+
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, a = s ? ht(t, o) : t;
|
316
316
|
if (r.prototype.replaceSync) {
|
317
|
-
const
|
318
|
-
|
319
|
-
const f = n.document, c = f.adoptedStyleSheets,
|
320
|
-
(
|
317
|
+
const i = new r();
|
318
|
+
i.id = e, i.replaceSync(a);
|
319
|
+
const f = n.document, c = f.adoptedStyleSheets, l = Array.from(c).filter(
|
320
|
+
(u) => u.id !== e
|
321
321
|
);
|
322
|
-
f.adoptedStyleSheets = [...
|
322
|
+
f.adoptedStyleSheets = [...l, i];
|
323
323
|
} else {
|
324
|
-
const
|
325
|
-
let f =
|
326
|
-
f ? f.innerHTML =
|
324
|
+
const i = n.document;
|
325
|
+
let f = i.getElementById(e);
|
326
|
+
f ? f.innerHTML = a : (f = i.createElement("style"), f.id = e, f.innerHTML = a, i.head.appendChild(f));
|
327
327
|
}
|
328
328
|
}
|
329
329
|
async function mt(n, e) {
|
330
330
|
const t = await window.fetch(e).then((s) => s.text()).catch(() => "");
|
331
|
-
t &&
|
331
|
+
t && ue(window, n, t);
|
332
332
|
}
|
333
333
|
function Ie(n, e = window) {
|
334
334
|
const t = e.document, s = e.document.head;
|
335
335
|
for (const r of n)
|
336
336
|
if (!t.getElementById(r)) {
|
337
|
-
const
|
338
|
-
|
337
|
+
const a = t.createElement("link");
|
338
|
+
a.rel = "stylesheet", a.id = r, a.href = r, s.appendChild(a);
|
339
339
|
}
|
340
340
|
}
|
341
341
|
async function Fe(n, e, t = window) {
|
342
342
|
const s = t.document, r = t.document.head;
|
343
343
|
let o = t[e];
|
344
|
-
return o ? o.default || o : new Promise((
|
344
|
+
return o ? o.default || o : new Promise((a, i) => {
|
345
345
|
for (const f of n) {
|
346
346
|
const c = s.createElement("script");
|
347
347
|
c.src = f, c.onload = () => {
|
348
|
-
o = t[e], o ?
|
349
|
-
}, c.onerror = (
|
350
|
-
|
348
|
+
o = t[e], o ? a(o.default || o) : i(null);
|
349
|
+
}, c.onerror = (l) => {
|
350
|
+
i(l);
|
351
351
|
}, r.appendChild(c);
|
352
352
|
}
|
353
353
|
});
|
@@ -377,13 +377,13 @@ function H(n, e, t = !1, s = !1, r = !1) {
|
|
377
377
|
try {
|
378
378
|
const o = ['"use strict";', "var __self = arguments[0];"];
|
379
379
|
o.push("return ");
|
380
|
-
let
|
381
|
-
r || (
|
382
|
-
`) +
|
383
|
-
const
|
384
|
-
${
|
385
|
-
` : `with(${t ? "{}" : "$scope || {}"}) { ${
|
386
|
-
return new Function("$scope",
|
380
|
+
let a = (n.value || "").trim();
|
381
|
+
r || (a = a.replace(/this(\W|$)/g, (f, c) => `__self${c}`)), a = o.join(`
|
382
|
+
`) + a;
|
383
|
+
const i = r ? `
|
384
|
+
${a}
|
385
|
+
` : `with(${t ? "{}" : "$scope || {}"}) { ${a} }`;
|
386
|
+
return new Function("$scope", i)(e);
|
387
387
|
} catch (o) {
|
388
388
|
if (k.error("parseExpression.error", o, n, e?.__self ?? e), s)
|
389
389
|
throw o;
|
@@ -566,7 +566,7 @@ class fe {
|
|
566
566
|
return t ? (await J(150), await t(e, {
|
567
567
|
title: "提示",
|
568
568
|
type: "warning"
|
569
|
-
})?.catch(() => !1)) : !1;
|
569
|
+
})?.catch(() => !1)) : (window.alert(e), !1);
|
570
570
|
}
|
571
571
|
setRequest(e) {
|
572
572
|
e.useRequest((t) => (this.data?.token && (t.headers[this.options.authKey] = this.data?.token), t)), e.useResponse(
|
@@ -589,8 +589,8 @@ function js(n = {}) {
|
|
589
589
|
settings: s = {},
|
590
590
|
Startup: r,
|
591
591
|
access: o,
|
592
|
-
useTitle:
|
593
|
-
alert:
|
592
|
+
useTitle: a,
|
593
|
+
alert: i
|
594
594
|
} = n;
|
595
595
|
let f = null;
|
596
596
|
return {
|
@@ -600,10 +600,10 @@ function js(n = {}) {
|
|
600
600
|
validSuccess: !0,
|
601
601
|
originResponse: !1,
|
602
602
|
loading: !0,
|
603
|
-
validate: (
|
603
|
+
validate: (l) => l.data?.code === 0 || !!l.data?.success,
|
604
604
|
failMessage: !0,
|
605
|
-
showError: (
|
606
|
-
e && e(
|
605
|
+
showError: (l) => {
|
606
|
+
e && e(l || "未知错误");
|
607
607
|
},
|
608
608
|
showLoading: () => {
|
609
609
|
f && f.close(), t && (f = t());
|
@@ -617,9 +617,10 @@ function js(n = {}) {
|
|
617
617
|
jsonp: be,
|
618
618
|
notify: e,
|
619
619
|
loading: t,
|
620
|
-
useTitle:
|
620
|
+
useTitle: a,
|
621
|
+
alert: i,
|
621
622
|
startupComponent: r,
|
622
|
-
access: o ? new fe({ alert:
|
623
|
+
access: o ? new fe({ alert: i, ...o }) : void 0
|
623
624
|
};
|
624
625
|
}
|
625
626
|
function Es(n = {}) {
|
@@ -641,19 +642,19 @@ function $t(n, e) {
|
|
641
642
|
headers: r
|
642
643
|
}
|
643
644
|
};
|
644
|
-
return (
|
645
|
+
return (a, i) => (delete o.data, s.send(Qe(o, i || {}, { data: a })));
|
645
646
|
}
|
646
647
|
}
|
647
648
|
function jt(n, e) {
|
648
649
|
const { metaQuery: t } = e;
|
649
650
|
if (!t) return;
|
650
651
|
const { code: s, queryCode: r } = n;
|
651
|
-
return (o,
|
652
|
+
return (o, a) => {
|
652
653
|
if (!t) {
|
653
654
|
console.warn("adapter.metaQuery is not defined!");
|
654
655
|
return;
|
655
656
|
}
|
656
|
-
return t(s, r, o,
|
657
|
+
return t(s, r, o, a);
|
657
658
|
};
|
658
659
|
}
|
659
660
|
function Et(n = [], e = [], t) {
|
@@ -675,8 +676,8 @@ function Rt(n, e = window) {
|
|
675
676
|
if (t)
|
676
677
|
try {
|
677
678
|
o = await t.apply(t, r);
|
678
|
-
} catch (
|
679
|
-
k.warn("模拟数据模版异常",
|
679
|
+
} catch (a) {
|
680
|
+
k.warn("模拟数据模版异常", a);
|
680
681
|
}
|
681
682
|
return s?.mock(o);
|
682
683
|
};
|
@@ -685,10 +686,10 @@ function Pt(n, e) {
|
|
685
686
|
if (!e.mock) return;
|
686
687
|
const { url: t, mockTemplate: s } = e;
|
687
688
|
if (t && s) {
|
688
|
-
const r = We(`${t}(.*)`), o = Xe(t, { decode: decodeURIComponent }),
|
689
|
-
n.mock(r, (
|
690
|
-
const f = F.parse(
|
691
|
-
return Object.assign(
|
689
|
+
const r = We(`${t}(.*)`), o = Xe(t, { decode: decodeURIComponent }), a = H(s, {}, !0);
|
690
|
+
n.mock(r, (i) => {
|
691
|
+
const f = F.parse(i.url) || {}, c = i.body instanceof FormData ? Ye(i.body) : i.body, l = o(i.url)?.params;
|
692
|
+
return Object.assign(i, { data: c, params: f, query: l }), n.mock(a(i));
|
692
693
|
});
|
693
694
|
}
|
694
695
|
}
|
@@ -802,33 +803,33 @@ function oe(n) {
|
|
802
803
|
components: s = {},
|
803
804
|
libs: r = {},
|
804
805
|
apis: o = {},
|
805
|
-
loader:
|
806
|
-
} = n,
|
806
|
+
loader: a
|
807
|
+
} = n, i = e.computed(() => n.dsl), f = {
|
807
808
|
$components: s,
|
808
809
|
$libs: r,
|
809
810
|
$apis: o
|
810
811
|
}, c = new Ct({
|
811
812
|
mode: t,
|
812
|
-
dsl:
|
813
|
+
dsl: i.value,
|
813
814
|
attrs: f
|
814
|
-
}),
|
815
|
-
name:
|
816
|
-
__scopeId:
|
815
|
+
}), l = e.defineComponent({
|
816
|
+
name: i.value.name,
|
817
|
+
__scopeId: i.value.id ? `data-v-${i.value.id}` : void 0,
|
817
818
|
props: {
|
818
|
-
...It(
|
819
|
+
...It(i.value.props ?? [], c)
|
819
820
|
},
|
820
|
-
setup(
|
821
|
-
c.$props =
|
821
|
+
setup(u) {
|
822
|
+
c.$props = u, c.props = u, i.value.id && ue(
|
822
823
|
n.window || window,
|
823
|
-
|
824
|
-
|
824
|
+
i.value.id,
|
825
|
+
i.value.css || "",
|
825
826
|
!0
|
826
|
-
), c.state = Ft(e,
|
827
|
-
const h = kt(e,
|
827
|
+
), c.state = Ft(e, i.value.state ?? {}, c);
|
828
|
+
const h = kt(e, i.value.computed ?? {}, c), d = Mt(i.value.methods ?? {}, c), p = Ot(e, i.value.inject, c);
|
828
829
|
for (const [m, b] of Object.entries(p || {}))
|
829
830
|
p[m] = e.inject(m, b);
|
830
831
|
const g = Dt(
|
831
|
-
|
832
|
+
i.value.dataSources || {},
|
832
833
|
c
|
833
834
|
), v = {
|
834
835
|
...p,
|
@@ -836,23 +837,23 @@ function oe(n) {
|
|
836
837
|
...d,
|
837
838
|
...g
|
838
839
|
};
|
839
|
-
return c.setup(v, e), Tt(e,
|
840
|
+
return c.setup(v, e), Tt(e, i.value.watch ?? [], c), {
|
840
841
|
vtj: c
|
841
842
|
};
|
842
843
|
},
|
843
|
-
emits: At(
|
844
|
+
emits: At(i.value.emits),
|
844
845
|
expose: ["vtj"],
|
845
846
|
render() {
|
846
|
-
if (!
|
847
|
-
const
|
848
|
-
return
|
849
|
-
(h) => M(h, c, e,
|
847
|
+
if (!i.value.nodes) return null;
|
848
|
+
const u = i.value.nodes || [];
|
849
|
+
return u.length === 1 ? M(u[0], c, e, a, u) : u.map(
|
850
|
+
(h) => M(h, c, e, a, u)
|
850
851
|
);
|
851
852
|
},
|
852
|
-
...Ht(
|
853
|
+
...Ht(i.value.lifeCycles ?? {}, c)
|
853
854
|
});
|
854
855
|
return {
|
855
|
-
renderer: e.markRaw(
|
856
|
+
renderer: e.markRaw(l),
|
856
857
|
context: c
|
857
858
|
};
|
858
859
|
}
|
@@ -903,10 +904,10 @@ function Mt(n, e) {
|
|
903
904
|
function Ot(n, e = [], t) {
|
904
905
|
return e.reduce(
|
905
906
|
(s, r) => {
|
906
|
-
const { name: o, from:
|
907
|
+
const { name: o, from: a } = r || {};
|
907
908
|
r.default;
|
908
|
-
const
|
909
|
-
return s[o] = n.inject(
|
909
|
+
const i = j(a) ? t.__parseExpression(a) || o : a ?? o, f = j(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
910
|
+
return s[o] = n.inject(i, f), s;
|
910
911
|
},
|
911
912
|
{}
|
912
913
|
);
|
@@ -918,10 +919,10 @@ function Dt(n, e) {
|
|
918
919
|
if (r.type === "mock")
|
919
920
|
t[s] = Rt(r);
|
920
921
|
else if (r.ref) {
|
921
|
-
const o = e.$apis[r.ref],
|
922
|
-
t[s] = async (...
|
923
|
-
const f = await o.apply(e,
|
924
|
-
return
|
922
|
+
const o = e.$apis[r.ref], a = S(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
923
|
+
t[s] = async (...i) => {
|
924
|
+
const f = await o.apply(e, i);
|
925
|
+
return a ? a(f) : f;
|
925
926
|
};
|
926
927
|
}
|
927
928
|
return t;
|
@@ -956,52 +957,52 @@ const Oe = new Ze();
|
|
956
957
|
let Z = [], I = {};
|
957
958
|
const xt = (n) => n;
|
958
959
|
async function De(n, e = window) {
|
959
|
-
const { urls: t = [], library: s } = n, r = t.filter((
|
960
|
+
const { urls: t = [], library: s } = n, r = t.filter((i) => V(i));
|
960
961
|
if (r.length === 0 || !s) return null;
|
961
|
-
const o = t.filter((
|
962
|
+
const o = t.filter((i) => G(i));
|
962
963
|
return o.length && Ie(o, e), await Fe(r, s, e).catch(
|
963
|
-
(
|
964
|
+
(i) => (console.warn("loadScriptUrl error", r, s, i), null)
|
964
965
|
);
|
965
966
|
}
|
966
967
|
function ie(n) {
|
967
968
|
const { getDsl: e, getDslByUrl: t, options: s } = n;
|
968
969
|
return s.window && (Z.forEach((r) => {
|
969
970
|
delete s.window[r];
|
970
|
-
}), Z = []), (r, o,
|
971
|
+
}), Z = []), (r, o, a = z) => {
|
971
972
|
if (!o || typeof o == "string") return r;
|
972
973
|
if (o.type === "Schema" && o.id)
|
973
|
-
return
|
974
|
-
const
|
974
|
+
return a.defineAsyncComponent(async () => {
|
975
|
+
const i = I[o.id] || await Oe.add(
|
975
976
|
o.id,
|
976
977
|
() => e(o.id)
|
977
978
|
);
|
978
|
-
return
|
979
|
+
return i && (i.name = r, I[o.id] = i), i ? oe({
|
979
980
|
...s,
|
980
|
-
Vue:
|
981
|
-
dsl: _e(
|
981
|
+
Vue: a,
|
982
|
+
dsl: _e(i),
|
982
983
|
mode: _.Runtime,
|
983
984
|
loader: ie(n)
|
984
985
|
}).renderer : null;
|
985
986
|
});
|
986
987
|
if (o.type === "UrlSchema" && o.url)
|
987
|
-
return
|
988
|
-
const
|
989
|
-
return
|
988
|
+
return a.defineAsyncComponent(async () => {
|
989
|
+
const i = I[o.url] || await t(o.url);
|
990
|
+
return i && (i.name = r, I[o.url] = i), i ? oe({
|
990
991
|
...s,
|
991
|
-
Vue:
|
992
|
-
dsl: _e(
|
992
|
+
Vue: a,
|
993
|
+
dsl: _e(i),
|
993
994
|
mode: _.Runtime,
|
994
995
|
loader: ie(n)
|
995
996
|
}).renderer : null;
|
996
997
|
});
|
997
998
|
if (o.type === "Plugin") {
|
998
|
-
let
|
999
|
-
return
|
999
|
+
let i = o.library ? I[o.library] : null;
|
1000
|
+
return i || (o.library && Z.push(o.library), i = I[o.library || Symbol()] = a.defineAsyncComponent(
|
1000
1001
|
async () => {
|
1001
1002
|
const f = await De(o, s.window);
|
1002
1003
|
return f || (console.warn("getPlugin result is null", o), null);
|
1003
1004
|
}
|
1004
|
-
),
|
1005
|
+
), i);
|
1005
1006
|
}
|
1006
1007
|
return r;
|
1007
1008
|
};
|
@@ -1011,8 +1012,8 @@ function bs() {
|
|
1011
1012
|
}
|
1012
1013
|
function M(n, e, t = z, s = xt, r = [], o = !1) {
|
1013
1014
|
if (!n || !n.name || n.invisible) return null;
|
1014
|
-
const
|
1015
|
-
if (!o && (
|
1015
|
+
const a = t.getCurrentInstance()?.appContext, { id: i = null, directives: f = [] } = n, { vIf: c, vElseIf: l, vElse: u, vFor: h, vShow: d, vModels: p, vBind: g, vHtml: v, others: m } = Te(f);
|
1016
|
+
if (!o && (l || u))
|
1016
1017
|
return null;
|
1017
1018
|
if (c && !Nt(c, e))
|
1018
1019
|
return Jt(n, e, t, s, r);
|
@@ -1023,13 +1024,13 @@ function M(n, e, t = z, s = xt, r = [], o = !1) {
|
|
1023
1024
|
if (n.name === "slot") return n.name;
|
1024
1025
|
const $ = s(n.name, n.from, t);
|
1025
1026
|
if (C($))
|
1026
|
-
return vt($) || yt($) ? $ : A[$] ??
|
1027
|
+
return vt($) || yt($) ? $ : A[$] ?? a?.app?.component($) ?? $;
|
1027
1028
|
if (et($) && n.id) {
|
1028
1029
|
const me = `Loader${n.id}_${x}`, ge = A[me];
|
1029
1030
|
return ge || (A[me] = $);
|
1030
1031
|
}
|
1031
1032
|
return $;
|
1032
|
-
})(), R = Lt(
|
1033
|
+
})(), R = Lt(i, n.props ?? {}, y), Le = qt(t, n.events ?? {}, y);
|
1033
1034
|
if (n.name === "slot")
|
1034
1035
|
return Kt(t, n, R, y, s);
|
1035
1036
|
g && Object.assign(R, y.__parseExpression(g.value)), d && (R.style = Object.assign(
|
@@ -1047,10 +1048,10 @@ function M(n, e, t = z, s = xt, r = [], o = !1) {
|
|
1047
1048
|
), de = y?.__id ? `data-v-${y.__id}` : void 0, Je = de ? { [de]: "" } : {};
|
1048
1049
|
let W = t.createVNode(
|
1049
1050
|
Q,
|
1050
|
-
{ key: `${
|
1051
|
+
{ key: `${i}_${x}`, ...Je, ...R, ...Le },
|
1051
1052
|
qe
|
1052
1053
|
);
|
1053
|
-
const he =
|
1054
|
+
const he = a ? Bt(a, m, y) : [];
|
1054
1055
|
return he.length && (W = t.withDirectives(W, he)), W;
|
1055
1056
|
};
|
1056
1057
|
return h ? Zt(h, b, e) : b(e);
|
@@ -1060,17 +1061,17 @@ function Bt(n, e, t) {
|
|
1060
1061
|
return e.map((r) => {
|
1061
1062
|
const o = typeof r.name == "string" ? s.directive(r.name) : t.__parseExpression(r.name);
|
1062
1063
|
if (!o) return null;
|
1063
|
-
const
|
1064
|
-
return r.value &&
|
1064
|
+
const a = [o];
|
1065
|
+
return r.value && a.push(t.__parseExpression(r.value)), r.arg && a.push(r.arg), r.modifiers && a.push(r.modifiers), a;
|
1065
1066
|
}).filter((r) => !!r);
|
1066
1067
|
}
|
1067
1068
|
function Te(n = []) {
|
1068
|
-
const e = n.find((
|
1069
|
-
(
|
1070
|
-
), s = n.find((
|
1071
|
-
(
|
1069
|
+
const e = n.find((l) => P(l.name) === "vIf"), t = n.find(
|
1070
|
+
(l) => P(l.name) === "vElseIf"
|
1071
|
+
), s = n.find((l) => P(l.name) === "vElse"), r = n.find((l) => P(l.name) === "vFor"), o = n.find((l) => P(l.name) === "vShow"), a = n.find((l) => P(l.name) === "vBind"), i = n.find((l) => P(l.name) === "vHtml"), f = n.filter(
|
1072
|
+
(l) => P(l.name) === "vModel"
|
1072
1073
|
), c = n.filter(
|
1073
|
-
(
|
1074
|
+
(l) => !ot.includes(P(l.name))
|
1074
1075
|
);
|
1075
1076
|
return {
|
1076
1077
|
vIf: e,
|
@@ -1079,9 +1080,9 @@ function Te(n = []) {
|
|
1079
1080
|
vFor: r,
|
1080
1081
|
vShow: o,
|
1081
1082
|
vModels: f,
|
1082
|
-
vBind:
|
1083
|
+
vBind: a,
|
1083
1084
|
others: c,
|
1084
|
-
vHtml:
|
1085
|
+
vHtml: i
|
1085
1086
|
};
|
1086
1087
|
}
|
1087
1088
|
function Nt(n, e) {
|
@@ -1110,24 +1111,24 @@ function qt(n, e, t) {
|
|
1110
1111
|
passive: "OnceCapture"
|
1111
1112
|
};
|
1112
1113
|
return Object.keys(e || {}).reduce(
|
1113
|
-
(o,
|
1114
|
-
const
|
1115
|
-
return
|
1114
|
+
(o, a) => {
|
1115
|
+
const i = e[a], f = He(i.modifiers), c = f.find((h) => s.includes(h)), l = "on" + tt(a) + (c && r[c] || ""), u = t.__parseFunction(i.handler);
|
1116
|
+
return u && (o[l] = n.withModifiers(u, f)), o;
|
1116
1117
|
},
|
1117
1118
|
{}
|
1118
1119
|
);
|
1119
1120
|
}
|
1120
1121
|
function Jt(n, e, t, s, r = []) {
|
1121
|
-
let o = r.findIndex((
|
1122
|
-
for (let
|
1123
|
-
const { directives:
|
1122
|
+
let o = r.findIndex((a) => a.id === n.id);
|
1123
|
+
for (let a = ++o; a < r.length; a++) {
|
1124
|
+
const { directives: i = [] } = r[a], { vElseIf: f, vElse: c } = Te(i);
|
1124
1125
|
if (f) {
|
1125
1126
|
if (e.__parseExpression(f.value))
|
1126
|
-
return M(r[
|
1127
|
+
return M(r[a], e, t, s, r, !0);
|
1127
1128
|
continue;
|
1128
1129
|
}
|
1129
1130
|
if (c)
|
1130
|
-
return M(r[
|
1131
|
+
return M(r[a], e, t, s, r, !0);
|
1131
1132
|
}
|
1132
1133
|
return null;
|
1133
1134
|
}
|
@@ -1136,8 +1137,8 @@ function He(n = {}, e = !1) {
|
|
1136
1137
|
return e ? t.map((s) => "." + s) : t;
|
1137
1138
|
}
|
1138
1139
|
function Kt(n, e, t, s, r) {
|
1139
|
-
const { children: o } = e,
|
1140
|
-
return
|
1140
|
+
const { children: o } = e, a = zt(e, s), i = s.$slots?.[a.name];
|
1141
|
+
return i ? i(t) : o ? C(o) ? n.createTextVNode(o) : j(o) ? n.createTextVNode(
|
1141
1142
|
Ae(s.__parseExpression(o))
|
1142
1143
|
) : Array.isArray(o) ? o.map(
|
1143
1144
|
(f) => M(f, s, n, r, o)
|
@@ -1168,10 +1169,10 @@ function Qt(n, e, t) {
|
|
1168
1169
|
}` : "(v) => {}"
|
1169
1170
|
}, r = t.__parseFunction(s), o = He(
|
1170
1171
|
j(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1171
|
-
),
|
1172
|
+
), a = j(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1172
1173
|
return {
|
1173
|
-
[
|
1174
|
-
[`onUpdate:${
|
1174
|
+
[a]: t.__parseExpression(e.value),
|
1175
|
+
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
1175
1176
|
};
|
1176
1177
|
}
|
1177
1178
|
function Wt(n, e, t, s, r) {
|
@@ -1183,18 +1184,18 @@ function Wt(n, e, t, s, r) {
|
|
1183
1184
|
default: () => Ae(t.__parseExpression(e))
|
1184
1185
|
};
|
1185
1186
|
if (Array.isArray(e) && e.length > 0) {
|
1186
|
-
const o = Xt(e),
|
1187
|
-
[f]:
|
1187
|
+
const o = Xt(e), a = (i, f) => !i || !r ? {} : r?.id && Object.keys(i).length ? f ? {
|
1188
|
+
[f]: i
|
1188
1189
|
} : {
|
1189
|
-
[`scope_${r.id}`]:
|
1190
|
+
[`scope_${r.id}`]: i
|
1190
1191
|
} : f ? { [f]: /* @__PURE__ */ Object.create(null) } : {};
|
1191
1192
|
return Object.entries(o).reduce(
|
1192
|
-
(
|
1193
|
-
const d =
|
1193
|
+
(i, [f, { nodes: c, params: l, scope: u }]) => (i[f] = (h) => {
|
1194
|
+
const d = l.length ? st(h ?? {}, l) : a(h, u);
|
1194
1195
|
return c.map(
|
1195
1196
|
(p) => M(p, t.__clone(d), n, s, c)
|
1196
1197
|
);
|
1197
|
-
},
|
1198
|
+
}, i),
|
1198
1199
|
{}
|
1199
1200
|
);
|
1200
1201
|
}
|
@@ -1216,9 +1217,9 @@ function Yt(n = "default") {
|
|
1216
1217
|
return C(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
1217
1218
|
}
|
1218
1219
|
function Zt(n, e, t) {
|
1219
|
-
const { value: s, iterator: r } = n, { item: o = "item", index:
|
1220
|
-
let
|
1221
|
-
return Number.isInteger(
|
1220
|
+
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
1221
|
+
let i = t.__parseExpression(s) || [];
|
1222
|
+
return Number.isInteger(i) && (i = new Array(i).fill(!0).map((f, c) => c + 1)), Array.isArray(i) ? i.map((f, c) => e(t.__clone({ [o]: f, [a]: c }), c)) : (console.warn("[vForRender]:", `${s?.value} is not a Arrary`), []);
|
1222
1223
|
}
|
1223
1224
|
const ee = Pe({
|
1224
1225
|
name: "VtjPageContainer",
|
@@ -1226,8 +1227,8 @@ const ee = Pe({
|
|
1226
1227
|
const n = Ne(), e = Ce(), t = e.meta.__vtj__ || e.params.id, s = t ? n.getPage(t) : n.getHomepage(), r = s ? await n.getRenderComponent(s.id) : null, o = re(Symbol());
|
1227
1228
|
if (s) {
|
1228
1229
|
Object.assign(e.meta, s.meta || {}, { cache: s.cache });
|
1229
|
-
const { useTitle:
|
1230
|
-
|
1230
|
+
const { useTitle: a } = n?.adapter;
|
1231
|
+
a && a(s.title || "VTJ");
|
1231
1232
|
}
|
1232
1233
|
return {
|
1233
1234
|
provider: n,
|
@@ -1255,20 +1256,20 @@ const ee = Pe({
|
|
1255
1256
|
function K(n, e, t = []) {
|
1256
1257
|
const s = [];
|
1257
1258
|
for (const r of t) {
|
1258
|
-
const { id: o, title:
|
1259
|
-
if (
|
1260
|
-
const
|
1261
|
-
s.push(...
|
1259
|
+
const { id: o, title: a, icon: i, children: f, hidden: c, layout: l } = r;
|
1260
|
+
if (l) {
|
1261
|
+
const u = K(n, e, f || []);
|
1262
|
+
s.push(...u);
|
1262
1263
|
} else {
|
1263
|
-
const
|
1264
|
+
const u = {
|
1264
1265
|
id: o,
|
1265
|
-
title:
|
1266
|
-
icon:
|
1266
|
+
title: a,
|
1267
|
+
icon: i,
|
1267
1268
|
hidden: c,
|
1268
1269
|
url: `${n}/${e}/${o}`,
|
1269
1270
|
children: f && f.length ? K(n, e, f) : void 0
|
1270
1271
|
};
|
1271
|
-
s.push(
|
1272
|
+
s.push(u);
|
1272
1273
|
}
|
1273
1274
|
}
|
1274
1275
|
return s;
|
@@ -1289,46 +1290,46 @@ function Rs(n) {
|
|
1289
1290
|
menuPathPrefix: e = "",
|
1290
1291
|
pageRouteName: t = "page",
|
1291
1292
|
disableMenusFilter: s = !1
|
1292
|
-
} = n || {}, r = Ne(), o = Ce(),
|
1293
|
-
|
1293
|
+
} = n || {}, r = Ne(), o = Ce(), a = St(), i = re(!1), f = re(!1), c = r.project, l = (d, p) => {
|
1294
|
+
i.value = !d?.mask, f.value = p?.pure ?? !!d?.pure;
|
1294
1295
|
};
|
1295
1296
|
rt(() => {
|
1296
1297
|
const { name: d, params: p, meta: g } = o;
|
1297
1298
|
if (d === D) {
|
1298
1299
|
const v = r.getPage(p.id);
|
1299
|
-
|
1300
|
+
l(v, g);
|
1300
1301
|
} else if (d === U) {
|
1301
1302
|
const v = r.getHomepage();
|
1302
|
-
|
1303
|
+
l(v, g);
|
1303
1304
|
} else {
|
1304
1305
|
const v = g.__vtj__;
|
1305
1306
|
if (v) {
|
1306
1307
|
const m = r.getPage(v);
|
1307
|
-
|
1308
|
+
l(m, g);
|
1308
1309
|
} else
|
1309
|
-
|
1310
|
+
i.value = !g.mask, f.value = !!g.pure;
|
1310
1311
|
}
|
1311
1312
|
});
|
1312
|
-
const
|
1313
|
+
const u = K(
|
1313
1314
|
e,
|
1314
1315
|
t,
|
1315
1316
|
c?.pages
|
1316
1317
|
), h = c?.config;
|
1317
1318
|
return {
|
1318
|
-
disabled:
|
1319
|
+
disabled: i,
|
1319
1320
|
logo: h?.logo,
|
1320
1321
|
themeSwitchable: h?.themeSwitchable,
|
1321
1322
|
title: h?.title || c?.description || c?.name || "VTJ App",
|
1322
|
-
menus: s ?
|
1323
|
+
menus: s ? u : xe(u, a),
|
1323
1324
|
pure: f
|
1324
1325
|
};
|
1325
1326
|
}
|
1326
1327
|
function te(n, e) {
|
1327
|
-
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix:
|
1328
|
+
const { id: t, title: s, meta: r } = n, { name: o = "page", prefix: a = "", component: i, routeMeta: f } = e;
|
1328
1329
|
return {
|
1329
1330
|
name: t,
|
1330
|
-
path: `${
|
1331
|
-
component:
|
1331
|
+
path: `${a}${o}/${t}`,
|
1332
|
+
component: i,
|
1332
1333
|
meta: {
|
1333
1334
|
title: s,
|
1334
1335
|
...f,
|
@@ -1344,18 +1345,18 @@ function ce(n) {
|
|
1344
1345
|
pages: s = [],
|
1345
1346
|
component: r,
|
1346
1347
|
loader: o,
|
1347
|
-
routeMeta:
|
1348
|
-
homepage:
|
1348
|
+
routeMeta: a,
|
1349
|
+
homepage: i
|
1349
1350
|
} = n, f = [];
|
1350
1351
|
for (const c of s) {
|
1351
|
-
const { id:
|
1352
|
+
const { id: l, title: u, dir: h, layout: d, children: p, meta: g } = c;
|
1352
1353
|
if (h) {
|
1353
1354
|
const v = ce({
|
1354
1355
|
name: e,
|
1355
1356
|
prefix: t,
|
1356
1357
|
component: r,
|
1357
|
-
routeMeta:
|
1358
|
-
homepage:
|
1358
|
+
routeMeta: a,
|
1359
|
+
homepage: i,
|
1359
1360
|
loader: o,
|
1360
1361
|
pages: p || []
|
1361
1362
|
});
|
@@ -1365,33 +1366,33 @@ function ce(n) {
|
|
1365
1366
|
name: e,
|
1366
1367
|
prefix: t,
|
1367
1368
|
component: r,
|
1368
|
-
routeMeta:
|
1369
|
-
homepage:
|
1369
|
+
routeMeta: a,
|
1370
|
+
homepage: i,
|
1370
1371
|
loader: o,
|
1371
1372
|
pages: p || []
|
1372
1373
|
}), m = {
|
1373
|
-
name: `layout_${
|
1374
|
+
name: `layout_${l}`,
|
1374
1375
|
path: t,
|
1375
|
-
component: () => o(
|
1376
|
+
component: () => o(l),
|
1376
1377
|
meta: {
|
1377
|
-
title:
|
1378
|
-
...
|
1378
|
+
title: u,
|
1379
|
+
...a,
|
1379
1380
|
...g,
|
1380
|
-
__vtj__:
|
1381
|
+
__vtj__: l
|
1381
1382
|
},
|
1382
1383
|
children: v
|
1383
1384
|
};
|
1384
1385
|
f.push(m), f.push(te(c, n));
|
1385
|
-
} else if (f.push(te(c, n)),
|
1386
|
+
} else if (f.push(te(c, n)), i === l) {
|
1386
1387
|
const v = te(c, n);
|
1387
|
-
v.path = "", v.name = `home_${
|
1388
|
+
v.path = "", v.name = `home_${l}`, f.push(v);
|
1388
1389
|
}
|
1389
1390
|
}
|
1390
1391
|
return f;
|
1391
1392
|
}
|
1392
1393
|
function ts(n = {}, e) {
|
1393
|
-
const { css: t, store: s, enhance: r } = n, { window: o, app:
|
1394
|
-
|
1394
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: a, library: i = {}, adapter: f, mode: c } = e, { Pinia: l } = i;
|
1395
|
+
ue(o, "global-css", t || ""), l && s && ss(s, a, l), rs(a, f, n), !f.access && n.access && ns(n.access, a, c, f), os(a, n), r && is(r, a);
|
1395
1396
|
}
|
1396
1397
|
function ss(n, e, t) {
|
1397
1398
|
const s = t.createPinia();
|
@@ -1402,35 +1403,39 @@ function ss(n, e, t) {
|
|
1402
1403
|
}
|
1403
1404
|
function ns(n, e, t, s) {
|
1404
1405
|
if (S(n) && n.value) {
|
1405
|
-
const r = E(n, {}, !1, !1, !0), o
|
1406
|
-
|
1406
|
+
const r = E(n, {}, !1, !1, !0), { alert: o, request: a } = s, i = new fe({
|
1407
|
+
alert: o,
|
1408
|
+
storagePrefix: "__VTJ_APP_",
|
1409
|
+
...r(e)
|
1410
|
+
}), f = e.config.globalProperties.$router;
|
1411
|
+
i.connect({ mode: t, router: f, request: a }), e.use(i);
|
1407
1412
|
}
|
1408
1413
|
}
|
1409
1414
|
function rs(n, e, t) {
|
1410
1415
|
if (!e.request) return;
|
1411
1416
|
const { axios: s, request: r, response: o } = t;
|
1412
1417
|
if (s && S(s) && s.value) {
|
1413
|
-
const
|
1414
|
-
e.request.setConfig(
|
1418
|
+
const a = E(s, {}, !1, !1, !0);
|
1419
|
+
e.request.setConfig(a(n));
|
1415
1420
|
}
|
1416
1421
|
if (r && S(r) && r.value) {
|
1417
|
-
const
|
1418
|
-
e.request.useRequest((
|
1422
|
+
const a = E(r, {}, !1, !1, !0);
|
1423
|
+
e.request.useRequest((i) => a(i, n));
|
1419
1424
|
}
|
1420
1425
|
if (o && S(o) && o.value) {
|
1421
|
-
const
|
1422
|
-
e.request.useResponse((
|
1426
|
+
const a = E(o, {}, !1, !1, !0);
|
1427
|
+
e.request.useResponse((i) => a(i, n));
|
1423
1428
|
}
|
1424
1429
|
}
|
1425
1430
|
function os(n, e) {
|
1426
1431
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
1427
1432
|
if (t && S(t) && t.value) {
|
1428
1433
|
const o = E(t, {}, !1, !1, !0);
|
1429
|
-
r && r.beforeEach((
|
1434
|
+
r && r.beforeEach((a, i, f) => o(a, i, f, n));
|
1430
1435
|
}
|
1431
1436
|
if (s && S(s) && s.value) {
|
1432
1437
|
const o = E(s, {}, !1, !1, !0);
|
1433
|
-
r && r.afterEach((
|
1438
|
+
r && r.afterEach((a, i, f) => o(a, i, f, n));
|
1434
1439
|
}
|
1435
1440
|
}
|
1436
1441
|
function is(n, e) {
|
@@ -1451,18 +1456,18 @@ class cs extends Ke {
|
|
1451
1456
|
mode: s = _.Raw,
|
1452
1457
|
dependencies: r,
|
1453
1458
|
materials: o,
|
1454
|
-
project:
|
1455
|
-
adapter:
|
1459
|
+
project: a = {},
|
1460
|
+
adapter: i = {},
|
1456
1461
|
globals: f = {},
|
1457
1462
|
modules: c = {},
|
1458
|
-
router:
|
1459
|
-
materialPath:
|
1463
|
+
router: l = null,
|
1464
|
+
materialPath: u = "./",
|
1460
1465
|
nodeEnv: h = "development"
|
1461
1466
|
/* Development */
|
1462
1467
|
} = e;
|
1463
|
-
this.mode = s, this.modules = c, this.service = t, this.router =
|
1468
|
+
this.mode = s, this.modules = c, this.service = t, this.router = l, this.materialPath = u, this.nodeEnv = h, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, f), Object.assign(this.adapter, i);
|
1464
1469
|
const { access: d, request: p } = this.adapter;
|
1465
|
-
d && d.connect({ mode: s, router:
|
1470
|
+
d && d.connect({ mode: s, router: l, request: p }), a && s !== _.Design ? this.load(a) : this.project = a;
|
1466
1471
|
}
|
1467
1472
|
mode;
|
1468
1473
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1518,8 +1523,8 @@ class cs extends Ke {
|
|
1518
1523
|
const { vtjDir: t = ".vtj" } = this.options, s = this.modules[`${t}/projects/${e.id}.json`] || this.modules[`/src/${t}/projects/${e.id}.json`];
|
1519
1524
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1520
1525
|
throw new Error("project is null");
|
1521
|
-
const { apis: r = [], meta: o = [] } = this.project,
|
1522
|
-
|
1526
|
+
const { apis: r = [], meta: o = [] } = this.project, a = window;
|
1527
|
+
a && (a.CKEDITOR_VERSION = void 0), this.mode === _.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = Et(r, o, this.adapter), Me(a), bt(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1523
1528
|
}
|
1524
1529
|
initMock(e) {
|
1525
1530
|
const t = T(e);
|
@@ -1533,16 +1538,16 @@ class cs extends Ke {
|
|
1533
1538
|
e[s] || (e[s] = this.library[s] = await r());
|
1534
1539
|
}
|
1535
1540
|
async loadAssets(e) {
|
1536
|
-
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath:
|
1541
|
+
const { dependencies: t = [] } = this.project, { dependencies: s, library: r, components: o, materialPath: a, nodeEnv: i } = this, {
|
1537
1542
|
libraryExports: f,
|
1538
1543
|
libraryMap: c,
|
1539
|
-
materials:
|
1540
|
-
materialExports:
|
1544
|
+
materials: l,
|
1545
|
+
materialExports: u,
|
1541
1546
|
materialMapLibrary: h
|
1542
1547
|
} = ft(
|
1543
1548
|
t,
|
1544
|
-
|
1545
|
-
|
1549
|
+
a,
|
1550
|
+
i === "development"
|
1546
1551
|
/* Development */
|
1547
1552
|
);
|
1548
1553
|
for (const d of f) {
|
@@ -1558,11 +1563,11 @@ class cs extends Ke {
|
|
1558
1563
|
r[d] = e[d];
|
1559
1564
|
}
|
1560
1565
|
}
|
1561
|
-
if (
|
1562
|
-
for (const p of
|
1566
|
+
if (i === "development") {
|
1567
|
+
for (const p of l)
|
1563
1568
|
await we(F.append(p, { v: O }));
|
1564
1569
|
const d = this.materials || {};
|
1565
|
-
for (const p of
|
1570
|
+
for (const p of u) {
|
1566
1571
|
const g = e[h[p]], v = ze[p];
|
1567
1572
|
if (v)
|
1568
1573
|
g && v.forEach((m) => {
|
@@ -1581,14 +1586,14 @@ class cs extends Ke {
|
|
1581
1586
|
const { router: e, project: t, options: s, adapter: r } = this;
|
1582
1587
|
if (!e) return;
|
1583
1588
|
const o = t?.platform === "uniapp" ? "pages" : "page", {
|
1584
|
-
routeAppendTo:
|
1585
|
-
pageRouteName:
|
1589
|
+
routeAppendTo: a,
|
1590
|
+
pageRouteName: i = o,
|
1586
1591
|
routeMeta: f
|
1587
|
-
} = s, c =
|
1588
|
-
path: `${c}${
|
1592
|
+
} = s, c = a ? "" : "/", l = {
|
1593
|
+
path: `${c}${i}/:id`,
|
1589
1594
|
name: D,
|
1590
1595
|
component: ee
|
1591
|
-
},
|
1596
|
+
}, u = {
|
1592
1597
|
path: c,
|
1593
1598
|
name: U,
|
1594
1599
|
component: t?.homepage ? ee : r.startupComponent || es,
|
@@ -1597,17 +1602,17 @@ class cs extends Ke {
|
|
1597
1602
|
if (e.hasRoute(D) && e.removeRoute(D), e.hasRoute(U) && e.removeRoute(U), s.enableStaticRoute) {
|
1598
1603
|
const h = t?.pages || [];
|
1599
1604
|
ce({
|
1600
|
-
name:
|
1605
|
+
name: i,
|
1601
1606
|
prefix: c,
|
1602
1607
|
pages: h,
|
1603
1608
|
component: ee,
|
1604
1609
|
loader: this.getRenderComponent.bind(this),
|
1605
1610
|
homepage: t?.homepage
|
1606
1611
|
}).forEach((p) => {
|
1607
|
-
|
1608
|
-
}), t?.homepage || (
|
1612
|
+
a ? e.addRoute(a, p) : e.addRoute(p);
|
1613
|
+
}), t?.homepage || (a ? e.addRoute(a, u) : e.addRoute(u));
|
1609
1614
|
} else
|
1610
|
-
|
1615
|
+
a ? (e.addRoute(a, l), e.addRoute(a, u)) : (e.addRoute(l), e.addRoute(u));
|
1611
1616
|
}
|
1612
1617
|
/**
|
1613
1618
|
* Vue 插件安装方法
|
@@ -1630,7 +1635,7 @@ class cs extends Ke {
|
|
1630
1635
|
library: this.library,
|
1631
1636
|
mode: this.mode
|
1632
1637
|
}), this.options.enhance && e.use(this.options.enhance, this), this.mode === _.Design && (e.config.errorHandler = (s, r, o) => {
|
1633
|
-
const
|
1638
|
+
const a = r?.$options.name, i = typeof s == "string" ? s : s?.message || s?.msg || "未知错误", f = `[ ${a} ] ${i} ${o}`;
|
1634
1639
|
console.error(
|
1635
1640
|
"[VTJ Error]:",
|
1636
1641
|
{
|
@@ -1648,13 +1653,13 @@ class cs extends Ke {
|
|
1648
1653
|
}
|
1649
1654
|
getPage(e) {
|
1650
1655
|
const { pages: t = [] } = this.project || {}, s = (r, o = []) => {
|
1651
|
-
for (const
|
1652
|
-
if (
|
1653
|
-
return
|
1654
|
-
if (
|
1655
|
-
const
|
1656
|
-
if (
|
1657
|
-
return
|
1656
|
+
for (const a of o) {
|
1657
|
+
if (a.id === r)
|
1658
|
+
return a;
|
1659
|
+
if (a.children && a.children.length) {
|
1660
|
+
const i = s(r, a.children);
|
1661
|
+
if (i)
|
1662
|
+
return i;
|
1658
1663
|
}
|
1659
1664
|
}
|
1660
1665
|
};
|
@@ -1692,21 +1697,21 @@ class cs extends Ke {
|
|
1692
1697
|
* @returns 渲染器实例
|
1693
1698
|
*/
|
1694
1699
|
createDslRenderer(e, t = {}) {
|
1695
|
-
const { library: s, components: r, mode: o, apis:
|
1700
|
+
const { library: s, components: r, mode: o, apis: a } = this, i = {
|
1696
1701
|
mode: o,
|
1697
1702
|
Vue: s.Vue,
|
1698
1703
|
components: r,
|
1699
1704
|
libs: s,
|
1700
|
-
apis:
|
1705
|
+
apis: a,
|
1701
1706
|
window,
|
1702
1707
|
...t
|
1703
1708
|
}, f = ie({
|
1704
1709
|
getDsl: async (c) => await this.getDsl(c) || null,
|
1705
1710
|
getDslByUrl: async (c) => await this.getDslByUrl(c) || null,
|
1706
|
-
options:
|
1711
|
+
options: i
|
1707
1712
|
});
|
1708
1713
|
return oe({
|
1709
|
-
...
|
1714
|
+
...i,
|
1710
1715
|
dsl: e,
|
1711
1716
|
loader: f
|
1712
1717
|
});
|
@@ -1726,9 +1731,9 @@ class cs extends Ke {
|
|
1726
1731
|
if (!s)
|
1727
1732
|
return k.warn(`Can not find file: ${e}`), null;
|
1728
1733
|
if (t && t(s), this.mode === _.Raw) {
|
1729
|
-
const { vtjRawDir: o = ".vtj/vue" } = this.options,
|
1730
|
-
if (
|
1731
|
-
return (await
|
1734
|
+
const { vtjRawDir: o = ".vtj/vue" } = this.options, a = `${o}/${e}.vue`, i = this.modules[a] || this.modules[`/src/pages/${e}.vue`];
|
1735
|
+
if (i)
|
1736
|
+
return (await i())?.default;
|
1732
1737
|
}
|
1733
1738
|
const r = await this.getDsl(s.id);
|
1734
1739
|
return r ? this.createDslRenderer(r).renderer : (k.warn(`Can not find dsl: ${e}`), null);
|
@@ -1799,9 +1804,9 @@ function Ne(n = {}) {
|
|
1799
1804
|
return e;
|
1800
1805
|
}
|
1801
1806
|
async function Cs(n, e = "") {
|
1802
|
-
const { name: t, urls: s = [] } = n || {}, r = s.map((
|
1803
|
-
if (o.length && Ie(o),
|
1804
|
-
return await Fe(
|
1807
|
+
const { name: t, urls: s = [] } = n || {}, r = s.map((i) => e + i), { css: o, js: a } = dt(r);
|
1808
|
+
if (o.length && Ie(o), a.length)
|
1809
|
+
return await Fe(a, t).catch(
|
1805
1810
|
() => {
|
1806
1811
|
}
|
1807
1812
|
);
|
@@ -1812,7 +1817,7 @@ const Ue = {
|
|
1812
1817
|
originResponse: !1,
|
1813
1818
|
failMessage: !0,
|
1814
1819
|
validate: (n) => n.data?.code === 0
|
1815
|
-
},
|
1820
|
+
}, ls = (n, e = "/__vtj__/api/:type.json") => (t, s, r) => n.send({
|
1816
1821
|
url: e,
|
1817
1822
|
method: "post",
|
1818
1823
|
params: { type: t },
|
@@ -1822,7 +1827,7 @@ const Ue = {
|
|
1822
1827
|
data: s
|
1823
1828
|
},
|
1824
1829
|
settings: Ue
|
1825
|
-
}),
|
1830
|
+
}), us = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1826
1831
|
url: e,
|
1827
1832
|
method: "post",
|
1828
1833
|
data: {
|
@@ -1850,7 +1855,7 @@ function As(n) {
|
|
1850
1855
|
}
|
1851
1856
|
class pe {
|
1852
1857
|
constructor(e = se) {
|
1853
|
-
this.req = e, this.api =
|
1858
|
+
this.req = e, this.api = ls(e), this.uploader = us(e);
|
1854
1859
|
}
|
1855
1860
|
api;
|
1856
1861
|
pluginCaches = {};
|
@@ -1934,7 +1939,7 @@ class pe {
|
|
1934
1939
|
return await this.api("clearStaticFiles", e).catch(() => "");
|
1935
1940
|
}
|
1936
1941
|
async getPluginMaterial(e) {
|
1937
|
-
const { urls: t = [] } = e, s = t.filter((o) =>
|
1942
|
+
const { urls: t = [] } = e, s = t.filter((o) => lt(o))[0];
|
1938
1943
|
if (!s) return null;
|
1939
1944
|
const r = this.pluginCaches[s];
|
1940
1945
|
return r || (this.pluginCaches[s] = se.send({
|
@@ -1965,7 +1970,7 @@ class Is extends pe {
|
|
1965
1970
|
return w.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
1966
1971
|
}
|
1967
1972
|
saveMaterials(e, t) {
|
1968
|
-
return w.save(`materials_${e.id}`,
|
1973
|
+
return w.save(`materials_${e.id}`, le(t)), Promise.resolve(!0);
|
1969
1974
|
}
|
1970
1975
|
saveFile(e) {
|
1971
1976
|
return w.save(`file_${e.id}`, e), Promise.resolve(!0);
|
@@ -2020,7 +2025,7 @@ class fs extends pe {
|
|
2020
2025
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
2021
2026
|
}
|
2022
2027
|
saveMaterials(e, t) {
|
2023
|
-
return e.id && (this.materials[e.id] =
|
2028
|
+
return e.id && (this.materials[e.id] = le(t)), Promise.resolve(!0);
|
2024
2029
|
}
|
2025
2030
|
saveFile(e) {
|
2026
2031
|
return this.files[e.id] = e, Promise.resolve(!0);
|
@@ -2083,7 +2088,7 @@ class ks extends pe {
|
|
2083
2088
|
async saveMaterials(e, t) {
|
2084
2089
|
return !!await this.api("saveMaterials", {
|
2085
2090
|
project: e,
|
2086
|
-
materials:
|
2091
|
+
materials: le(t)
|
2087
2092
|
}).catch(() => !1);
|
2088
2093
|
}
|
2089
2094
|
async saveFile(e) {
|
@@ -2146,7 +2151,7 @@ export {
|
|
2146
2151
|
vs as REMOTE,
|
2147
2152
|
Is as StorageService,
|
2148
2153
|
O as VTJ_RENDERER_VERSION,
|
2149
|
-
|
2154
|
+
ue as adoptedStyleSheets,
|
2150
2155
|
bs as clearLoaderCache,
|
2151
2156
|
ht as compileScopedCSS,
|
2152
2157
|
Es as createAccess,
|
@@ -2175,7 +2180,7 @@ export {
|
|
2175
2180
|
_t as isJSCode,
|
2176
2181
|
j as isJSExpression,
|
2177
2182
|
S as isJSFunction,
|
2178
|
-
|
2183
|
+
lt as isJSON,
|
2179
2184
|
V as isJSUrl,
|
2180
2185
|
yt as isNativeTag,
|
2181
2186
|
gt as isVuePlugin,
|
@@ -2193,7 +2198,7 @@ export {
|
|
2193
2198
|
E as parseFunction,
|
2194
2199
|
dt as parseUrls,
|
2195
2200
|
Be as providerKey,
|
2196
|
-
|
2201
|
+
ut as removeProdFlag,
|
2197
2202
|
Ss as setupPageSetting,
|
2198
2203
|
Ae as toString,
|
2199
2204
|
St as useAccess,
|