@vtj/renderer 0.13.20 → 0.13.22
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 +418 -400
- package/package.json +6 -6
- package/types/provider/provider.d.ts +2 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as
|
2
|
-
import { isUrl as se, url as
|
1
|
+
import { Base as ze, BUILT_IN_COMPONENTS as Ge, ProjectModel as U, HistoryModel as be } from "@vtj/core";
|
2
|
+
import { isUrl as se, url as F, dedupArray as Ve, isString as A, isFunction as q, logger as M, storage as X, cookie as Y, toArray as ve, unRSA as _e, delay as J, createRequest as Ee, jsonp as Re, merge as Qe, pathToRegexp as We, pathToRegexpMatch as Xe, formDataToJson as Ye, Queue as Ze, cloneDeep as we, camelCase as C, isObject as et, upperFirst as tt, pick as st, request as ne, loadScript as Se, Storage as nt, mapToObject as ue } from "@vtj/utils";
|
3
3
|
import * as z from "vue";
|
4
4
|
import { inject as Pe, defineComponent as Ce, h as re, ref as oe, watchEffect as rt, defineAsyncComponent as $e } from "vue";
|
5
5
|
import { useRoute as Ae } from "vue-router";
|
@@ -7,11 +7,11 @@ import { useRoute as Ae } 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.22
|
11
11
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
12
12
|
*/
|
13
|
-
const
|
14
|
-
var
|
13
|
+
const D = "0.13.22";
|
14
|
+
var _ = /* @__PURE__ */ ((n) => (n.Runtime = "Runtime", n.Design = "Design", n.Raw = "Raw", n.VNode = "VNode", n))(_ || {});
|
15
15
|
const je = [
|
16
16
|
"$el",
|
17
17
|
"$emit",
|
@@ -24,7 +24,7 @@ const je = [
|
|
24
24
|
"$props",
|
25
25
|
"$options",
|
26
26
|
"$forceUpdate"
|
27
|
-
],
|
27
|
+
], ys = [
|
28
28
|
"beforeCreate",
|
29
29
|
"created",
|
30
30
|
"beforeMount",
|
@@ -55,9 +55,9 @@ const je = [
|
|
55
55
|
Object,
|
56
56
|
Function,
|
57
57
|
Date
|
58
|
-
},
|
58
|
+
}, T = "VtjPage", N = "VtjHomepage", at = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot,svg".split(
|
59
59
|
","
|
60
|
-
), ct = "component,slot".split(","),
|
60
|
+
), ct = "component,slot".split(","), vs = [
|
61
61
|
"h",
|
62
62
|
"t",
|
63
63
|
"t",
|
@@ -153,32 +153,32 @@ function lt(n) {
|
|
153
153
|
}
|
154
154
|
function ws(n) {
|
155
155
|
return n.map(
|
156
|
-
(e) => `<script src="${
|
156
|
+
(e) => `<script src="${F.append(e, { v: D })}"><\/script>`
|
157
157
|
).join("");
|
158
158
|
}
|
159
159
|
function Ss(n = []) {
|
160
160
|
return n.map(
|
161
|
-
(e) => `<link rel="stylesheet" href="${
|
161
|
+
(e) => `<link rel="stylesheet" href="${F.append(e, { v: D })}" />`
|
162
162
|
).join("");
|
163
163
|
}
|
164
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((
|
168
|
+
const s = n.filter((p) => !!p.enabled), r = [], o = [], a = [], i = [], l = {}, c = {}, u = [], f = {};
|
169
169
|
return s.forEach(
|
170
|
-
({ urls:
|
171
|
-
|
172
|
-
V(
|
173
|
-
}), d && (i.push(d), l[d] = B(
|
170
|
+
({ urls: p, assetsUrl: h, library: d, assetsLibrary: m, localeLibrary: g }) => {
|
171
|
+
p?.forEach((y) => {
|
172
|
+
V(y) && r.push(ut(y, t)), G(y) && o.push(y);
|
173
|
+
}), d && (i.push(d), l[d] = B(p || [], e), g && (c[d] = g)), h && a.push(h), m && u.push(m), d && m && (f[m] = d);
|
174
174
|
}
|
175
175
|
), {
|
176
176
|
scripts: B(r, e),
|
177
177
|
css: B(o, e),
|
178
178
|
materials: B(a, e),
|
179
179
|
libraryExports: i,
|
180
|
-
materialExports: Ve(
|
181
|
-
materialMapLibrary:
|
180
|
+
materialExports: Ve(u),
|
181
|
+
materialMapLibrary: f,
|
182
182
|
libraryMap: l,
|
183
183
|
libraryLocaleMap: c
|
184
184
|
};
|
@@ -196,130 +196,130 @@ 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 u = [];
|
200
|
+
let f = 0;
|
201
|
+
for (; f < c.length; ) {
|
202
|
+
if (/\s/.test(c[f])) {
|
203
|
+
f++;
|
204
204
|
continue;
|
205
205
|
}
|
206
|
-
if (c.substring(
|
207
|
-
const
|
208
|
-
if (
|
209
|
-
|
206
|
+
if (c.substring(f, f + 2) === "/*") {
|
207
|
+
const y = c.indexOf("*/", f + 2);
|
208
|
+
if (y !== -1) {
|
209
|
+
f = y + 2;
|
210
210
|
continue;
|
211
211
|
}
|
212
212
|
}
|
213
|
-
if (c[
|
214
|
-
const
|
215
|
-
for (;
|
216
|
-
|
217
|
-
const
|
218
|
-
if (c[
|
219
|
-
|
213
|
+
if (c[f] === "@") {
|
214
|
+
const y = f;
|
215
|
+
for (; f < c.length && c[f] !== "{" && c[f] !== ";"; )
|
216
|
+
f++;
|
217
|
+
const w = c.substring(y, f).trim(), v = w.includes("@keyframes");
|
218
|
+
if (c[f] === ";")
|
219
|
+
u.push({
|
220
220
|
type: "simple-at-rule",
|
221
|
-
content: c.substring(
|
222
|
-
}),
|
223
|
-
else if (c[
|
224
|
-
const
|
225
|
-
let
|
226
|
-
for (
|
227
|
-
c[
|
228
|
-
const Q = c.substring(
|
229
|
-
|
230
|
-
type:
|
231
|
-
rule:
|
221
|
+
content: c.substring(y, f + 1)
|
222
|
+
}), f++;
|
223
|
+
else if (c[f] === "{") {
|
224
|
+
const $ = f + 1;
|
225
|
+
let I = 1;
|
226
|
+
for (f++; f < c.length && I > 0; )
|
227
|
+
c[f] === "{" ? I++ : c[f] === "}" && I--, f++;
|
228
|
+
const Q = c.substring(y, f), P = c.substring($, f - 1);
|
229
|
+
u.push({
|
230
|
+
type: v ? "keyframes" : "at-rule",
|
231
|
+
rule: w,
|
232
232
|
content: Q,
|
233
|
-
inner:
|
233
|
+
inner: P
|
234
234
|
});
|
235
235
|
}
|
236
236
|
continue;
|
237
237
|
}
|
238
|
-
const
|
239
|
-
for (;
|
240
|
-
|
241
|
-
if (
|
242
|
-
const
|
243
|
-
if (!
|
244
|
-
|
238
|
+
const p = f;
|
239
|
+
for (; f < c.length && c[f] !== "{"; )
|
240
|
+
f++;
|
241
|
+
if (f >= c.length) break;
|
242
|
+
const h = c.substring(p, f).trim();
|
243
|
+
if (!h) {
|
244
|
+
f++;
|
245
245
|
continue;
|
246
246
|
}
|
247
|
-
const d =
|
248
|
-
let
|
249
|
-
for (
|
250
|
-
c[
|
251
|
-
const
|
252
|
-
|
247
|
+
const d = f + 1;
|
248
|
+
let m = 1;
|
249
|
+
for (f++; f < c.length && m > 0; )
|
250
|
+
c[f] === "{" ? m++ : c[f] === "}" && m--, f++;
|
251
|
+
const g = c.substring(d, f - 1);
|
252
|
+
u.push({
|
253
253
|
type: "rule",
|
254
|
-
selector:
|
255
|
-
content:
|
254
|
+
selector: h,
|
255
|
+
content: g.trim()
|
256
256
|
});
|
257
257
|
}
|
258
|
-
return
|
258
|
+
return u;
|
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
|
264
|
-
return
|
260
|
+
const u = c.trim();
|
261
|
+
return /^(from|to|\d+(\.\d+)?%)$/.test(u);
|
262
|
+
}, r = (c) => c.replace(/::v-deep\(/g, ":deep(").replace(/::v-deep\s+/g, ":deep(").replace(/\/deep\//g, " ").replace(/>>>/g, " ").replace(/(.*?):deep\(([^)]+)\)/g, (u, f, p) => {
|
263
|
+
const h = f.trim(), d = p.trim();
|
264
|
+
return h ? `${h}[${e}] ${d}` : d;
|
265
265
|
}), o = (c) => {
|
266
|
-
const
|
267
|
-
if (!
|
268
|
-
return
|
269
|
-
const
|
270
|
-
if (
|
271
|
-
const [,
|
272
|
-
return d ? `${d}[${e}]${
|
266
|
+
const u = c.trim();
|
267
|
+
if (!u || u.includes(`[${e}]`) || /^(:root|:host|html|body)(\s|$|:|\.|\#|\[)/.test(u) || s(u))
|
268
|
+
return u;
|
269
|
+
const f = u.match(/^(.+?)((?:::?[\w-]+(?:\([^)]*\))?)*)\s*$/);
|
270
|
+
if (f) {
|
271
|
+
const [, p, h = ""] = f, d = p.trim();
|
272
|
+
return d ? `${d}[${e}]${h}` : u;
|
273
273
|
}
|
274
|
-
return `${
|
275
|
-
}, a = (c) => r(c).split(",").map((
|
276
|
-
switch (
|
274
|
+
return `${u}[${e}]`;
|
275
|
+
}, a = (c) => r(c).split(",").map((f) => o(f)).filter((f) => f.trim()).join(", "), i = (c) => c.map((u) => {
|
276
|
+
switch (u.type) {
|
277
277
|
case "simple-at-rule":
|
278
|
-
return
|
278
|
+
return u.content;
|
279
279
|
case "keyframes":
|
280
|
-
return
|
280
|
+
return u.content;
|
281
281
|
case "at-rule":
|
282
282
|
try {
|
283
|
-
const
|
284
|
-
return `${
|
283
|
+
const p = t(u.inner), h = i(p);
|
284
|
+
return `${u.rule} { ${h} }`;
|
285
285
|
} catch {
|
286
|
-
return
|
286
|
+
return u.content;
|
287
287
|
}
|
288
288
|
case "rule":
|
289
|
-
if (!
|
289
|
+
if (!u.selector || !u.content)
|
290
290
|
return "";
|
291
|
-
const
|
292
|
-
return
|
291
|
+
const f = a(u.selector);
|
292
|
+
return f.trim() ? `${f} { ${u.content} }` : "";
|
293
293
|
default:
|
294
294
|
return "";
|
295
295
|
}
|
296
|
-
}).filter((
|
296
|
+
}).filter((u) => u.trim()).join(" "), l = (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 l(
|
299
|
+
`), u = t(c), f = i(u);
|
300
|
+
return l(f);
|
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
|
+
(u) => u
|
305
|
+
).replace(/([^{}@]+)(?=\s*{)/g, (u) => {
|
306
|
+
const f = u.trim();
|
307
|
+
return !f || f.startsWith("@") || f.includes(`[${e}]`) || s(f) ? u : `${f}[${e}]`;
|
308
308
|
});
|
309
309
|
}
|
310
310
|
}
|
311
311
|
function Ie(n) {
|
312
|
-
return
|
312
|
+
return A(n) ? n : JSON.stringify(n);
|
313
313
|
}
|
314
314
|
function fe(n, e, t, s = !1) {
|
315
315
|
const r = n.CSSStyleSheet, o = s ? `data-v-${e}` : e, a = s ? ht(t, o) : t;
|
316
316
|
if (r.prototype.replaceSync) {
|
317
317
|
const i = new r();
|
318
318
|
i.id = e, i.replaceSync(a);
|
319
|
-
const l = n.document, c = l.adoptedStyleSheets,
|
320
|
-
(
|
319
|
+
const l = n.document, c = l.adoptedStyleSheets, u = Array.from(c).filter(
|
320
|
+
(f) => f.id !== e
|
321
321
|
);
|
322
|
-
l.adoptedStyleSheets = [...
|
322
|
+
l.adoptedStyleSheets = [...u, i];
|
323
323
|
} else {
|
324
324
|
const i = n.document;
|
325
325
|
let l = i.getElementById(e);
|
@@ -362,22 +362,22 @@ async function Fe(n, e, t = window) {
|
|
362
362
|
const c = s.createElement("script");
|
363
363
|
c.src = l, c.onload = () => {
|
364
364
|
o = t[e], o ? a(o.default || o) : i(null);
|
365
|
-
}, c.onerror = (
|
366
|
-
i(
|
365
|
+
}, c.onerror = (u) => {
|
366
|
+
i(u);
|
367
367
|
}, r.appendChild(c);
|
368
368
|
}
|
369
369
|
});
|
370
370
|
}
|
371
371
|
function gt(n) {
|
372
|
-
return
|
372
|
+
return q(n) && Object.getOwnPropertyNames(n.prototype || {}).length === 0 || q(n?.install);
|
373
373
|
}
|
374
|
-
function
|
374
|
+
function yt(n) {
|
375
375
|
return ct.includes(n);
|
376
376
|
}
|
377
|
-
function
|
377
|
+
function vt(n) {
|
378
378
|
return at.includes(n);
|
379
379
|
}
|
380
|
-
function
|
380
|
+
function H(n = window) {
|
381
381
|
const e = window?.Mock;
|
382
382
|
if (e) return e;
|
383
383
|
const t = n?.Mock;
|
@@ -389,7 +389,7 @@ function js(n, e, t) {
|
|
389
389
|
const s = n?._container;
|
390
390
|
t?.type === "page" && s.classList.add("is-page"), t?.pure && s.classList.add("is-pure");
|
391
391
|
}
|
392
|
-
function
|
392
|
+
function x(n, e, t = !1, s = !1, r = !1) {
|
393
393
|
try {
|
394
394
|
const o = ['"use strict";', "var __self = arguments[0];"];
|
395
395
|
o.push("return ");
|
@@ -401,13 +401,13 @@ ${a}
|
|
401
401
|
` : `with(${t ? "{}" : "$scope || {}"}) { ${a} }`;
|
402
402
|
return new Function("$scope", i)(e);
|
403
403
|
} catch (o) {
|
404
|
-
if (
|
404
|
+
if (M.error("parseExpression.error", o, n, e?.__self ?? e), s)
|
405
405
|
throw o;
|
406
406
|
}
|
407
407
|
}
|
408
|
-
function
|
409
|
-
const o =
|
410
|
-
if (typeof o != "function" && (
|
408
|
+
function R(n, e, t = !1, s = !1, r = !1) {
|
409
|
+
const o = x(n, e, t, s, r);
|
410
|
+
if (typeof o != "function" && (M.error(
|
411
411
|
"parseFunction.error",
|
412
412
|
"not a function",
|
413
413
|
n,
|
@@ -416,16 +416,16 @@ function E(n, e, t = !1, s = !1, r = !1) {
|
|
416
416
|
throw new Error(`"${n.value}" not a function`);
|
417
417
|
return o;
|
418
418
|
}
|
419
|
-
function
|
419
|
+
function E(n) {
|
420
420
|
return n && n.type === "JSExpression";
|
421
421
|
}
|
422
|
-
function
|
422
|
+
function j(n) {
|
423
423
|
return typeof n == "object" && n && n.type === "JSFunction";
|
424
424
|
}
|
425
425
|
function _t(n) {
|
426
|
-
return
|
426
|
+
return E(n) || j(n);
|
427
427
|
}
|
428
|
-
function
|
428
|
+
function bs(n) {
|
429
429
|
return _t(n) ? n.value : JSON.stringify(n);
|
430
430
|
}
|
431
431
|
const wt = {
|
@@ -445,7 +445,7 @@ const wt = {
|
|
445
445
|
class pe {
|
446
446
|
options;
|
447
447
|
data = null;
|
448
|
-
mode =
|
448
|
+
mode = _.Raw;
|
449
449
|
interceptResponse = !0;
|
450
450
|
constructor(e) {
|
451
451
|
this.options = Object.assign({}, wt, e), this.loadData();
|
@@ -458,7 +458,7 @@ class pe {
|
|
458
458
|
}
|
459
459
|
connect(e) {
|
460
460
|
const { mode: t, router: s, request: r } = e;
|
461
|
-
this.mode = t, s && this.mode !==
|
461
|
+
this.mode = t, s && this.mode !== _.Design && this.setGuard(s), r && this.setRequest(r);
|
462
462
|
}
|
463
463
|
login(e) {
|
464
464
|
const { storageKey: t, storagePrefix: s, session: r, authKey: o } = this.options;
|
@@ -485,11 +485,11 @@ class pe {
|
|
485
485
|
}
|
486
486
|
can(e) {
|
487
487
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
488
|
-
return typeof e == "function" ? e(s) :
|
488
|
+
return typeof e == "function" ? e(s) : ve(e).every((o) => s[o] || s[t + "." + o]);
|
489
489
|
}
|
490
490
|
some(e) {
|
491
491
|
const { appName: t } = this.options, { permissions: s = {} } = this.data || {};
|
492
|
-
return
|
492
|
+
return ve(e).some((o) => s[o] || s[t + "." + o]);
|
493
493
|
}
|
494
494
|
install(e) {
|
495
495
|
e.config.globalProperties.$access = this, e.provide(Me, this);
|
@@ -543,7 +543,7 @@ class pe {
|
|
543
543
|
return e && t ? !!Y.get(t) : !!this.getToken();
|
544
544
|
}
|
545
545
|
hasRoutePermission(e) {
|
546
|
-
if (e.name ===
|
546
|
+
if (e.name === T) {
|
547
547
|
const t = e.params.id;
|
548
548
|
return t && this.can(t);
|
549
549
|
}
|
@@ -560,7 +560,7 @@ class pe {
|
|
560
560
|
return t();
|
561
561
|
{
|
562
562
|
const { noPermissionMessage: s = "无权限访问", unauthorized: r = !1 } = this.options;
|
563
|
-
return await this.showTip(s),
|
563
|
+
return await this.showTip(s), q(r) ? (r(), t(!1)) : A(r) ? t(r) : t(!1);
|
564
564
|
}
|
565
565
|
}
|
566
566
|
t(!1), await J(0), this.toLogin();
|
@@ -598,7 +598,7 @@ class pe {
|
|
598
598
|
function St() {
|
599
599
|
return Pe(Me, null);
|
600
600
|
}
|
601
|
-
function
|
601
|
+
function Es(n = {}) {
|
602
602
|
const {
|
603
603
|
notify: e,
|
604
604
|
loading: t,
|
@@ -610,16 +610,16 @@ function Rs(n = {}) {
|
|
610
610
|
} = n;
|
611
611
|
let l = null;
|
612
612
|
return {
|
613
|
-
request:
|
613
|
+
request: Ee({
|
614
614
|
settings: {
|
615
615
|
type: "form",
|
616
616
|
validSuccess: !0,
|
617
617
|
originResponse: !1,
|
618
618
|
loading: !0,
|
619
|
-
validate: (
|
619
|
+
validate: (u) => u.data?.code === 0 || !!u.data?.success,
|
620
620
|
failMessage: !0,
|
621
|
-
showError: (
|
622
|
-
e && e(
|
621
|
+
showError: (u) => {
|
622
|
+
e && e(u || "未知错误");
|
623
623
|
},
|
624
624
|
showLoading: () => {
|
625
625
|
l && l.close(), t && (l = t());
|
@@ -630,7 +630,7 @@ function Rs(n = {}) {
|
|
630
630
|
...s
|
631
631
|
}
|
632
632
|
}),
|
633
|
-
jsonp:
|
633
|
+
jsonp: Re,
|
634
634
|
notify: e,
|
635
635
|
loading: t,
|
636
636
|
useTitle: a,
|
@@ -639,7 +639,7 @@ function Rs(n = {}) {
|
|
639
639
|
access: o ? new pe({ alert: i, ...o }) : void 0
|
640
640
|
};
|
641
641
|
}
|
642
|
-
function
|
642
|
+
function Rs(n = {}) {
|
643
643
|
return new pe(n);
|
644
644
|
}
|
645
645
|
function $t(n, e) {
|
@@ -650,7 +650,7 @@ function $t(n, e) {
|
|
650
650
|
query: r
|
651
651
|
});
|
652
652
|
{
|
653
|
-
const r = n.headers ?
|
653
|
+
const r = n.headers ? x(n.headers, {}, !0) : void 0, o = {
|
654
654
|
url: n.url,
|
655
655
|
method: n.method,
|
656
656
|
settings: {
|
@@ -673,7 +673,7 @@ function jt(n, e) {
|
|
673
673
|
return t(s, r, o, a);
|
674
674
|
};
|
675
675
|
}
|
676
|
-
function
|
676
|
+
function bt(n = [], e = [], t) {
|
677
677
|
const s = {};
|
678
678
|
for (const r of n)
|
679
679
|
s[r.id] = $t(r, t);
|
@@ -681,19 +681,19 @@ function Et(n = [], e = [], t) {
|
|
681
681
|
s[r.id] = jt(r, t);
|
682
682
|
return s;
|
683
683
|
}
|
684
|
-
async function
|
685
|
-
const t =
|
684
|
+
async function Et(n = [], e = window) {
|
685
|
+
const t = H(e);
|
686
686
|
t && (Oe(e), n.forEach((s) => Pt(t, s)));
|
687
687
|
}
|
688
|
-
function
|
689
|
-
const t =
|
688
|
+
function Rt(n, e = window) {
|
689
|
+
const t = j(n.mockTemplate) && n.mockTemplate.value ? R(n.mockTemplate, {}, !0) : void 0, s = H(e);
|
690
690
|
return async (...r) => {
|
691
691
|
let o = {};
|
692
692
|
if (t)
|
693
693
|
try {
|
694
694
|
o = await t.apply(t, r);
|
695
695
|
} catch (a) {
|
696
|
-
|
696
|
+
M.warn("模拟数据模版异常", a);
|
697
697
|
}
|
698
698
|
return s?.mock(o);
|
699
699
|
};
|
@@ -703,14 +703,14 @@ function Pt(n, e) {
|
|
703
703
|
const { url: t, mockTemplate: s } = e;
|
704
704
|
if (t && s)
|
705
705
|
try {
|
706
|
-
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`), a = Xe(r, { decode: decodeURIComponent }), i =
|
706
|
+
const r = se(t) ? new URL(t).pathname : t, o = We(`(.*)${r}(.*)`), a = Xe(r, { decode: decodeURIComponent }), i = x(s, {}, !0);
|
707
707
|
n.mock(o, (l) => {
|
708
|
-
const c =
|
709
|
-
Object.assign(l, { data:
|
708
|
+
const c = F.parse(l.url) || {}, u = l.body instanceof FormData ? Ye(l.body) : l.body, f = se(l.url) ? new URL(l.url).pathname : l.url.split("?")[0], p = a(f)?.params;
|
709
|
+
Object.assign(l, { data: u, params: p, query: c });
|
710
710
|
try {
|
711
711
|
return n.mock(i(l));
|
712
|
-
} catch (
|
713
|
-
return console.warn("[mockApi]", o, l,
|
712
|
+
} catch (h) {
|
713
|
+
return console.warn("[mockApi]", o, l, h), null;
|
714
714
|
}
|
715
715
|
});
|
716
716
|
} catch (r) {
|
@@ -718,7 +718,7 @@ function Pt(n, e) {
|
|
718
718
|
}
|
719
719
|
}
|
720
720
|
function Oe(n = window) {
|
721
|
-
const e =
|
721
|
+
const e = H(n);
|
722
722
|
e && (e._mocked = {});
|
723
723
|
}
|
724
724
|
class Ct {
|
@@ -778,22 +778,22 @@ class Ct {
|
|
778
778
|
}
|
779
779
|
__parseFunction(e) {
|
780
780
|
if (e)
|
781
|
-
if (this.__mode ===
|
781
|
+
if (this.__mode === _.Runtime) {
|
782
782
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
783
|
-
return
|
783
|
+
return R({ type: s, value: r }, this);
|
784
784
|
} else
|
785
|
-
return
|
785
|
+
return R(e, this);
|
786
786
|
}
|
787
787
|
__parseExpression(e) {
|
788
788
|
if (e)
|
789
|
-
if (this.__mode ===
|
789
|
+
if (this.__mode === _.Runtime) {
|
790
790
|
const { id: t, type: s } = e, r = t ? this.__transform[t] ?? e.value : e.value;
|
791
|
-
return
|
791
|
+
return x({ type: s, value: r }, this);
|
792
792
|
} else
|
793
|
-
return
|
793
|
+
return x(e, this);
|
794
794
|
}
|
795
795
|
__ref(e = null, t) {
|
796
|
-
if (this.__mode !==
|
796
|
+
if (this.__mode !== _.VNode)
|
797
797
|
return e && e !== this.__id && (this.__contextRefs[e] = this), async (s) => {
|
798
798
|
await J(0);
|
799
799
|
let r = s?.$vtjEl || s?.$el || s?._?.vnode?.el || s;
|
@@ -801,7 +801,7 @@ class Ct {
|
|
801
801
|
typeof t == "string" && (delete this.$refs[t], e && delete this.__refs[e]);
|
802
802
|
return;
|
803
803
|
}
|
804
|
-
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e,
|
804
|
+
return r.nodeType === 3 && r.nextSibling && (r = r.nextSibling), r.__vtj__ = e, _.Design === this.__mode && (r.__context__ = this, r.draggable = !0), e && (this.__refs[e] = this.__getRefEl(this.__refs, e, s)), typeof t == "function" ? t(s) : t && (this.$refs[t] = this.__getRefEl(this.$refs, t, s)), s;
|
805
805
|
};
|
806
806
|
}
|
807
807
|
__getRefEl(e, t, s) {
|
@@ -823,7 +823,7 @@ class Ct {
|
|
823
823
|
function ie(n) {
|
824
824
|
const {
|
825
825
|
Vue: e = z,
|
826
|
-
mode: t =
|
826
|
+
mode: t = _.Runtime,
|
827
827
|
components: s = {},
|
828
828
|
libs: r = {},
|
829
829
|
apis: o = {},
|
@@ -836,32 +836,32 @@ function ie(n) {
|
|
836
836
|
mode: t,
|
837
837
|
dsl: i.value,
|
838
838
|
attrs: l
|
839
|
-
}),
|
839
|
+
}), u = e.defineComponent({
|
840
840
|
name: i.value.name,
|
841
841
|
__scopeId: i.value.id ? `data-v-${i.value.id}` : void 0,
|
842
842
|
props: {
|
843
843
|
...It(i.value.props ?? [], c)
|
844
844
|
},
|
845
|
-
setup(
|
846
|
-
c.$props =
|
845
|
+
setup(f) {
|
846
|
+
c.$props = f, c.props = f, i.value.id && fe(
|
847
847
|
n.window || window,
|
848
848
|
i.value.id,
|
849
849
|
i.value.css || "",
|
850
850
|
!0
|
851
851
|
), c.state = kt(e, i.value.state ?? {}, c);
|
852
|
-
const
|
853
|
-
for (const [
|
854
|
-
d[
|
855
|
-
const
|
852
|
+
const p = Ft(e, i.value.computed ?? {}, c), h = Mt(i.value.methods ?? {}, c), d = Ot(e, i.value.inject, c);
|
853
|
+
for (const [y, w] of Object.entries(d || {}))
|
854
|
+
d[y] = e.inject(y, w);
|
855
|
+
const m = Dt(
|
856
856
|
i.value.dataSources || {},
|
857
857
|
c
|
858
|
-
),
|
858
|
+
), g = {
|
859
859
|
...d,
|
860
|
-
...h,
|
861
860
|
...p,
|
862
|
-
...
|
861
|
+
...h,
|
862
|
+
...m
|
863
863
|
};
|
864
|
-
return c.setup(
|
864
|
+
return c.setup(g, e), Tt(e, i.value.watch ?? [], c), {
|
865
865
|
vtj: c
|
866
866
|
};
|
867
867
|
},
|
@@ -869,30 +869,30 @@ function ie(n) {
|
|
869
869
|
expose: ["vtj"],
|
870
870
|
render() {
|
871
871
|
if (!i.value.nodes) return null;
|
872
|
-
const
|
873
|
-
return
|
874
|
-
(
|
872
|
+
const f = i.value.nodes || [];
|
873
|
+
return f.length === 1 ? O(f[0], c, e, a, f) : f.map(
|
874
|
+
(p) => O(p, c, e, a, f)
|
875
875
|
);
|
876
876
|
},
|
877
877
|
...Ht(i.value.lifeCycles ?? {}, c)
|
878
878
|
});
|
879
879
|
return {
|
880
|
-
renderer: e.markRaw(
|
880
|
+
renderer: e.markRaw(u),
|
881
881
|
context: c
|
882
882
|
};
|
883
883
|
}
|
884
884
|
function At(n = []) {
|
885
|
-
return n.map((e) =>
|
885
|
+
return n.map((e) => A(e) ? e : e.name);
|
886
886
|
}
|
887
887
|
function It(n = [], e) {
|
888
888
|
const t = (s) => s ? (Array.isArray(s) ? s : [s]).map((o) => it[o]) : void 0;
|
889
|
-
return n.map((s) =>
|
889
|
+
return n.map((s) => A(s) ? {
|
890
890
|
name: s
|
891
891
|
} : {
|
892
892
|
name: s.name,
|
893
893
|
type: s.type,
|
894
894
|
required: s.required,
|
895
|
-
default:
|
895
|
+
default: E(s.default) ? e.__parseExpression(s.default) : s.default
|
896
896
|
}).reduce(
|
897
897
|
(s, r) => (s[r.name] = {
|
898
898
|
type: t(r.type),
|
@@ -907,7 +907,7 @@ function kt(n, e, t) {
|
|
907
907
|
Object.keys(e || {}).reduce(
|
908
908
|
(s, r) => {
|
909
909
|
let o = e[r];
|
910
|
-
return
|
910
|
+
return E(o) ? o = t.__parseExpression(o) : j(o) && (o = t.__parseFunction(o)), s[r] = o, s;
|
911
911
|
},
|
912
912
|
{}
|
913
913
|
)
|
@@ -930,7 +930,7 @@ function Ot(n, e = [], t) {
|
|
930
930
|
(s, r) => {
|
931
931
|
const { name: o, from: a } = r || {};
|
932
932
|
r.default;
|
933
|
-
const i =
|
933
|
+
const i = E(a) ? t.__parseExpression(a) || o : a ?? o, l = E(r.default) ? t.__parseExpression(r.default) : r.default ?? null;
|
934
934
|
return s[o] = n.inject(i, l), s;
|
935
935
|
},
|
936
936
|
{}
|
@@ -941,9 +941,9 @@ function Dt(n, e) {
|
|
941
941
|
(t, s) => {
|
942
942
|
const r = n[s];
|
943
943
|
if (r.type === "mock")
|
944
|
-
t[s] =
|
944
|
+
t[s] = Rt(r);
|
945
945
|
else if (r.ref) {
|
946
|
-
const o = e.$apis[r.ref], a =
|
946
|
+
const o = e.$apis[r.ref], a = j(r.transform) ? r.transform.value ? e.__parseFunction(r.transform) : void 0 : r.transform;
|
947
947
|
t[s] = async (...i) => {
|
948
948
|
const l = await o.apply(e, i);
|
949
949
|
return a ? a(l) : l;
|
@@ -971,14 +971,14 @@ function Ht(n, e) {
|
|
971
971
|
(t, [s, r]) => {
|
972
972
|
const o = e.__parseFunction(r);
|
973
973
|
return t[s] = async () => {
|
974
|
-
await J(0),
|
974
|
+
await J(0), q(o) && o();
|
975
975
|
}, t;
|
976
976
|
},
|
977
977
|
{}
|
978
978
|
);
|
979
979
|
}
|
980
980
|
const De = new Ze();
|
981
|
-
let Z = [],
|
981
|
+
let Z = [], k = {};
|
982
982
|
const xt = (n) => n;
|
983
983
|
async function Te(n, e = window) {
|
984
984
|
const { urls: t = [], library: s } = n, r = t.filter((i) => V(i));
|
@@ -996,32 +996,32 @@ function ae(n) {
|
|
996
996
|
if (!o || typeof o == "string") return r;
|
997
997
|
if (o.type === "Schema" && o.id)
|
998
998
|
return a.defineAsyncComponent(async () => {
|
999
|
-
const i =
|
999
|
+
const i = k[o.id] || await De.add(
|
1000
1000
|
o.id,
|
1001
1001
|
() => e(o.id)
|
1002
1002
|
);
|
1003
|
-
return i && (i.name = r,
|
1003
|
+
return i && (i.name = r, k[o.id] = i), i ? ie({
|
1004
1004
|
...s,
|
1005
1005
|
Vue: a,
|
1006
1006
|
dsl: we(i),
|
1007
|
-
mode:
|
1007
|
+
mode: _.Runtime,
|
1008
1008
|
loader: ae(n)
|
1009
1009
|
}).renderer : null;
|
1010
1010
|
});
|
1011
1011
|
if (o.type === "UrlSchema" && o.url)
|
1012
1012
|
return a.defineAsyncComponent(async () => {
|
1013
|
-
const i =
|
1014
|
-
return i && (i.name = r,
|
1013
|
+
const i = k[o.url] || await t(o.url);
|
1014
|
+
return i && (i.name = r, k[o.url] = i), i ? ie({
|
1015
1015
|
...s,
|
1016
1016
|
Vue: a,
|
1017
1017
|
dsl: we(i),
|
1018
|
-
mode:
|
1018
|
+
mode: _.Runtime,
|
1019
1019
|
loader: ae(n)
|
1020
1020
|
}).renderer : null;
|
1021
1021
|
});
|
1022
1022
|
if (o.type === "Plugin") {
|
1023
|
-
let i = o.library ?
|
1024
|
-
return i || (o.library && Z.push(o.library), i =
|
1023
|
+
let i = o.library ? k[o.library] : null;
|
1024
|
+
return i || (o.library && Z.push(o.library), i = k[o.library || Symbol()] = a.defineAsyncComponent(
|
1025
1025
|
async () => {
|
1026
1026
|
const l = await Te(o, s.window);
|
1027
1027
|
return l || (console.warn("getPlugin result is null", o), null);
|
@@ -1032,53 +1032,53 @@ function ae(n) {
|
|
1032
1032
|
};
|
1033
1033
|
}
|
1034
1034
|
function Ps() {
|
1035
|
-
|
1035
|
+
k = {}, De.clearAllCache();
|
1036
1036
|
}
|
1037
|
-
function
|
1037
|
+
function O(n, e, t = z, s = xt, r = [], o = !1) {
|
1038
1038
|
if (!n || !n.name || n.invisible) return null;
|
1039
|
-
const a = t.getCurrentInstance()?.appContext, { id: i = null, directives: l = [] } = n, { vIf: c, vElseIf:
|
1040
|
-
if (!o && (
|
1039
|
+
const a = t.getCurrentInstance()?.appContext, { id: i = null, directives: l = [] } = n, { vIf: c, vElseIf: u, vElse: f, vFor: p, vShow: h, vModels: d, vBind: m, vHtml: g, others: y } = He(l);
|
1040
|
+
if (!o && (u || f))
|
1041
1041
|
return null;
|
1042
|
-
if (c && !
|
1042
|
+
if (c && !Lt(c, e))
|
1043
1043
|
return Jt(n, e, t, s, r);
|
1044
|
-
const
|
1045
|
-
const
|
1044
|
+
const w = (v, $ = 0) => {
|
1045
|
+
const I = v.$components, Q = (() => {
|
1046
1046
|
if (n.name === "component")
|
1047
|
-
return Nt(
|
1047
|
+
return Nt(v, n.props?.is);
|
1048
1048
|
if (n.name === "slot") return n.name;
|
1049
|
-
const
|
1050
|
-
if (
|
1051
|
-
return
|
1052
|
-
if (et(
|
1053
|
-
const ge = `Loader${n.id}_${
|
1054
|
-
return
|
1049
|
+
const b = s(n.name, n.from, t);
|
1050
|
+
if (A(b))
|
1051
|
+
return yt(b) || vt(b) ? b : I[b] ?? a?.app?.component(b) ?? b;
|
1052
|
+
if (et(b) && n.id) {
|
1053
|
+
const ge = `Loader${n.id}_${$}`, ye = I[ge];
|
1054
|
+
return ye || (I[ge] = b);
|
1055
1055
|
}
|
1056
|
-
return
|
1057
|
-
})(),
|
1056
|
+
return b;
|
1057
|
+
})(), P = Ut(i, n.props ?? {}, v), qe = qt(t, n.events ?? {}, v);
|
1058
1058
|
if (n.name === "slot")
|
1059
|
-
return Kt(t, n,
|
1060
|
-
|
1061
|
-
|
1062
|
-
Gt(
|
1063
|
-
)),
|
1064
|
-
Object.assign(
|
1059
|
+
return Kt(t, n, P, v, s);
|
1060
|
+
m && Object.assign(P, v.__parseExpression(m.value)), h && (P.style = Object.assign(
|
1061
|
+
P.style ?? {},
|
1062
|
+
Gt(h, v)
|
1063
|
+
)), g && Object.assign(P, Vt(g, v)), d.forEach((b) => {
|
1064
|
+
Object.assign(P, Qt(t, b, v));
|
1065
1065
|
});
|
1066
1066
|
const Je = Wt(
|
1067
1067
|
t,
|
1068
1068
|
n.children ?? [],
|
1069
|
-
|
1069
|
+
v,
|
1070
1070
|
s,
|
1071
1071
|
n
|
1072
|
-
), he =
|
1072
|
+
), he = v?.__id ? `data-v-${v.__id}` : void 0, Ke = he ? { [he]: "" } : {};
|
1073
1073
|
let W = t.createVNode(
|
1074
1074
|
Q,
|
1075
|
-
{ key: `${i}_${
|
1075
|
+
{ key: `${i}_${$}`, ...Ke, ...P, ...qe },
|
1076
1076
|
Je
|
1077
1077
|
);
|
1078
|
-
const me = a ? Bt(a,
|
1078
|
+
const me = a ? Bt(a, y, v) : [];
|
1079
1079
|
return me.length && (W = t.withDirectives(W, me)), W;
|
1080
1080
|
};
|
1081
|
-
return
|
1081
|
+
return p ? Zt(p, w, e) : w(e);
|
1082
1082
|
}
|
1083
1083
|
function Bt(n, e, t) {
|
1084
1084
|
const s = n.app;
|
@@ -1090,12 +1090,12 @@ function Bt(n, e, t) {
|
|
1090
1090
|
}).filter((r) => !!r);
|
1091
1091
|
}
|
1092
1092
|
function He(n = []) {
|
1093
|
-
const e = n.find((
|
1094
|
-
(
|
1095
|
-
), s = n.find((
|
1096
|
-
(
|
1093
|
+
const e = n.find((u) => C(u.name) === "vIf"), t = n.find(
|
1094
|
+
(u) => C(u.name) === "vElseIf"
|
1095
|
+
), s = n.find((u) => C(u.name) === "vElse"), r = n.find((u) => C(u.name) === "vFor"), o = n.find((u) => C(u.name) === "vShow"), a = n.find((u) => C(u.name) === "vBind"), i = n.find((u) => C(u.name) === "vHtml"), l = n.filter(
|
1096
|
+
(u) => C(u.name) === "vModel"
|
1097
1097
|
), c = n.filter(
|
1098
|
-
(
|
1098
|
+
(u) => !ot.includes(C(u.name))
|
1099
1099
|
);
|
1100
1100
|
return {
|
1101
1101
|
vIf: e,
|
@@ -1109,18 +1109,18 @@ function He(n = []) {
|
|
1109
1109
|
vHtml: i
|
1110
1110
|
};
|
1111
1111
|
}
|
1112
|
-
function
|
1112
|
+
function Lt(n, e) {
|
1113
1113
|
return !!e.__parseExpression(n.value);
|
1114
1114
|
}
|
1115
1115
|
function Nt(n, e) {
|
1116
|
-
return e ?
|
1116
|
+
return e ? E(e) ? n.__parseExpression(e) : e : "div";
|
1117
1117
|
}
|
1118
|
-
function
|
1118
|
+
function Ut(n, e, t) {
|
1119
1119
|
const s = ce(e, t);
|
1120
1120
|
return s.ref = t.__ref(n, s.ref), s;
|
1121
1121
|
}
|
1122
1122
|
function ce(n, e) {
|
1123
|
-
return
|
1123
|
+
return E(n) ? e.__parseExpression(n) : j(n) ? e.__parseFunction(n) : Array.isArray(n) ? n.map((t) => ce(t, e)) : typeof n == "object" ? Object.keys(n || {}).reduce(
|
1124
1124
|
(t, s) => {
|
1125
1125
|
let r = n[s];
|
1126
1126
|
return t[s] = ce(r, e), t;
|
@@ -1128,7 +1128,7 @@ function ce(n, e) {
|
|
1128
1128
|
{}
|
1129
1129
|
) : n;
|
1130
1130
|
}
|
1131
|
-
function
|
1131
|
+
function qt(n, e, t) {
|
1132
1132
|
const s = ["passive", "capture", "once"], r = {
|
1133
1133
|
capture: "Capture",
|
1134
1134
|
once: "Once",
|
@@ -1136,8 +1136,8 @@ function Lt(n, e, t) {
|
|
1136
1136
|
};
|
1137
1137
|
return Object.keys(e || {}).reduce(
|
1138
1138
|
(o, a) => {
|
1139
|
-
const i = e[a], l = xe(i.modifiers), c = l.find((
|
1140
|
-
return
|
1139
|
+
const i = e[a], l = xe(i.modifiers), c = l.find((p) => s.includes(p)), u = "on" + tt(a) + (c && r[c] || ""), f = t.__parseFunction(i.handler);
|
1140
|
+
return f && (o[u] = n.withModifiers(f, l)), o;
|
1141
1141
|
},
|
1142
1142
|
{}
|
1143
1143
|
);
|
@@ -1148,11 +1148,11 @@ function Jt(n, e, t, s, r = []) {
|
|
1148
1148
|
const { directives: i = [] } = r[a], { vElseIf: l, vElse: c } = He(i);
|
1149
1149
|
if (l) {
|
1150
1150
|
if (e.__parseExpression(l.value))
|
1151
|
-
return
|
1151
|
+
return O(r[a], e, t, s, r, !0);
|
1152
1152
|
continue;
|
1153
1153
|
}
|
1154
1154
|
if (c)
|
1155
|
-
return
|
1155
|
+
return O(r[a], e, t, s, r, !0);
|
1156
1156
|
}
|
1157
1157
|
return null;
|
1158
1158
|
}
|
@@ -1162,16 +1162,16 @@ function xe(n = {}, e = !1) {
|
|
1162
1162
|
}
|
1163
1163
|
function Kt(n, e, t, s, r) {
|
1164
1164
|
const { children: o } = e, a = zt(e, s), i = s.$slots?.[a.name];
|
1165
|
-
return i ? i(t) : o ?
|
1165
|
+
return i ? i(t) : o ? A(o) ? n.createTextVNode(o) : E(o) ? n.createTextVNode(
|
1166
1166
|
Ie(s.__parseExpression(o))
|
1167
1167
|
) : Array.isArray(o) ? o.map(
|
1168
|
-
(l) =>
|
1168
|
+
(l) => O(l, s, n, r, o)
|
1169
1169
|
) : null : null;
|
1170
1170
|
}
|
1171
1171
|
function zt(n, e) {
|
1172
1172
|
const { props: t } = n, s = t?.name || "default";
|
1173
1173
|
return {
|
1174
|
-
name:
|
1174
|
+
name: E(s) ? e.__parseExpression(s) : s,
|
1175
1175
|
params: []
|
1176
1176
|
};
|
1177
1177
|
}
|
@@ -1192,8 +1192,8 @@ function Qt(n, e, t) {
|
|
1192
1192
|
${e.value.value} = v;
|
1193
1193
|
}` : "(v) => {}"
|
1194
1194
|
}, r = t.__parseFunction(s), o = xe(
|
1195
|
-
|
1196
|
-
), a =
|
1195
|
+
E(e.modifiers) ? t.__parseExpression(e.modifiers) : e.modifiers
|
1196
|
+
), a = E(e.arg) ? t.__parseExpression(e.arg) : e.arg || "modelValue";
|
1197
1197
|
return {
|
1198
1198
|
[a]: t.__parseExpression(e.value),
|
1199
1199
|
[`onUpdate:${a}`]: o.length && r ? n.withModifiers(r, o) : r
|
@@ -1201,9 +1201,9 @@ function Qt(n, e, t) {
|
|
1201
1201
|
}
|
1202
1202
|
function Wt(n, e, t, s, r) {
|
1203
1203
|
if (!e) return null;
|
1204
|
-
if (
|
1204
|
+
if (A(e))
|
1205
1205
|
return { default: () => e };
|
1206
|
-
if (
|
1206
|
+
if (E(e))
|
1207
1207
|
return {
|
1208
1208
|
default: () => Ie(t.__parseExpression(e))
|
1209
1209
|
};
|
@@ -1214,10 +1214,10 @@ function Wt(n, e, t, s, r) {
|
|
1214
1214
|
[`scope_${r.id}`]: i
|
1215
1215
|
} : l ? { [l]: /* @__PURE__ */ Object.create(null) } : {};
|
1216
1216
|
return Object.entries(o).reduce(
|
1217
|
-
(i, [l, { nodes: c, params:
|
1218
|
-
const
|
1217
|
+
(i, [l, { nodes: c, params: u, scope: f }]) => (i[l] = (p) => {
|
1218
|
+
const h = u.length ? st(p ?? {}, u) : a(p, f);
|
1219
1219
|
return c.map(
|
1220
|
-
(d) =>
|
1220
|
+
(d) => O(d, t.__clone(h), n, s, c)
|
1221
1221
|
);
|
1222
1222
|
}, i),
|
1223
1223
|
{}
|
@@ -1238,7 +1238,7 @@ function Xt(n) {
|
|
1238
1238
|
return e;
|
1239
1239
|
}
|
1240
1240
|
function Yt(n = "default") {
|
1241
|
-
return
|
1241
|
+
return A(n) ? { name: n, params: [], scope: "" } : { params: [], scope: "", ...n };
|
1242
1242
|
}
|
1243
1243
|
function Zt(n, e, t) {
|
1244
1244
|
const { value: s, iterator: r } = n, { item: o = "item", index: a = "index" } = r || {};
|
@@ -1280,12 +1280,12 @@ const ee = Ce({
|
|
1280
1280
|
function K(n, e, t = []) {
|
1281
1281
|
const s = [];
|
1282
1282
|
for (const r of t) {
|
1283
|
-
const { id: o, title: a, icon: i, children: l, hidden: c, layout:
|
1284
|
-
if (
|
1285
|
-
const
|
1286
|
-
s.push(...
|
1283
|
+
const { id: o, title: a, icon: i, children: l, hidden: c, layout: u } = r;
|
1284
|
+
if (u) {
|
1285
|
+
const f = K(n, e, l || []);
|
1286
|
+
s.push(...f);
|
1287
1287
|
} else {
|
1288
|
-
const
|
1288
|
+
const f = {
|
1289
1289
|
id: o,
|
1290
1290
|
title: a,
|
1291
1291
|
icon: i,
|
@@ -1293,7 +1293,7 @@ function K(n, e, t = []) {
|
|
1293
1293
|
url: `${n}/${e}/${o}`,
|
1294
1294
|
children: l && l.length ? K(n, e, l) : void 0
|
1295
1295
|
};
|
1296
|
-
s.push(
|
1296
|
+
s.push(f);
|
1297
1297
|
}
|
1298
1298
|
}
|
1299
1299
|
return s;
|
@@ -1314,37 +1314,37 @@ function Cs(n) {
|
|
1314
1314
|
menuPathPrefix: e = "",
|
1315
1315
|
pageRouteName: t = "page",
|
1316
1316
|
disableMenusFilter: s = !1
|
1317
|
-
} = n || {}, r = Ne(), o = Ae(), a = St(), i = oe(!1), l = oe(!1), c = r.project,
|
1318
|
-
i.value = !
|
1317
|
+
} = n || {}, r = Ne(), o = Ae(), a = St(), i = oe(!1), l = oe(!1), c = r.project, u = (h, d) => {
|
1318
|
+
i.value = !h?.mask, l.value = d?.pure ?? !!h?.pure;
|
1319
1319
|
};
|
1320
1320
|
rt(() => {
|
1321
|
-
const { name:
|
1322
|
-
if (
|
1323
|
-
const
|
1324
|
-
|
1325
|
-
} else if (
|
1326
|
-
const
|
1327
|
-
|
1321
|
+
const { name: h, params: d, meta: m } = o;
|
1322
|
+
if (h === T) {
|
1323
|
+
const g = r.getPage(d.id);
|
1324
|
+
u(g, m);
|
1325
|
+
} else if (h === N) {
|
1326
|
+
const g = r.getHomepage();
|
1327
|
+
u(g, m);
|
1328
1328
|
} else {
|
1329
|
-
const
|
1330
|
-
if (
|
1331
|
-
const
|
1332
|
-
|
1329
|
+
const g = m.__vtj__;
|
1330
|
+
if (g) {
|
1331
|
+
const y = r.getPage(g);
|
1332
|
+
u(y, m);
|
1333
1333
|
} else
|
1334
|
-
i.value = !
|
1334
|
+
i.value = !m.mask, l.value = !!m.pure;
|
1335
1335
|
}
|
1336
1336
|
});
|
1337
|
-
const
|
1337
|
+
const f = K(
|
1338
1338
|
e,
|
1339
1339
|
t,
|
1340
1340
|
c?.pages
|
1341
|
-
),
|
1341
|
+
), p = c?.config;
|
1342
1342
|
return {
|
1343
1343
|
disabled: i,
|
1344
|
-
logo:
|
1345
|
-
themeSwitchable:
|
1346
|
-
title:
|
1347
|
-
menus: s ?
|
1344
|
+
logo: p?.logo,
|
1345
|
+
themeSwitchable: p?.themeSwitchable,
|
1346
|
+
title: p?.title || c?.description || c?.name || "VTJ App",
|
1347
|
+
menus: s ? f : Be(f, a),
|
1348
1348
|
pure: l
|
1349
1349
|
};
|
1350
1350
|
}
|
@@ -1373,9 +1373,9 @@ function le(n) {
|
|
1373
1373
|
homepage: i
|
1374
1374
|
} = n, l = [];
|
1375
1375
|
for (const c of s) {
|
1376
|
-
const { id:
|
1377
|
-
if (
|
1378
|
-
const
|
1376
|
+
const { id: u, title: f, dir: p, layout: h, children: d, meta: m } = c;
|
1377
|
+
if (p) {
|
1378
|
+
const g = le({
|
1379
1379
|
name: e,
|
1380
1380
|
prefix: t,
|
1381
1381
|
component: r,
|
@@ -1384,9 +1384,9 @@ function le(n) {
|
|
1384
1384
|
loader: o,
|
1385
1385
|
pages: d || []
|
1386
1386
|
});
|
1387
|
-
l.push(...
|
1388
|
-
} else if (
|
1389
|
-
const
|
1387
|
+
l.push(...g);
|
1388
|
+
} else if (h) {
|
1389
|
+
const g = le({
|
1390
1390
|
name: e,
|
1391
1391
|
prefix: t,
|
1392
1392
|
component: r,
|
@@ -1394,40 +1394,40 @@ function le(n) {
|
|
1394
1394
|
homepage: i,
|
1395
1395
|
loader: o,
|
1396
1396
|
pages: d || []
|
1397
|
-
}),
|
1398
|
-
name: `layout_${
|
1397
|
+
}), y = {
|
1398
|
+
name: `layout_${u}`,
|
1399
1399
|
path: t,
|
1400
|
-
component: () => o(
|
1400
|
+
component: () => o(u),
|
1401
1401
|
meta: {
|
1402
|
-
title:
|
1402
|
+
title: f,
|
1403
1403
|
...a,
|
1404
|
-
...
|
1405
|
-
__vtj__:
|
1404
|
+
...m,
|
1405
|
+
__vtj__: u
|
1406
1406
|
},
|
1407
|
-
children:
|
1407
|
+
children: g
|
1408
1408
|
};
|
1409
|
-
l.push(
|
1410
|
-
} else if (l.push(te(c, n)), i ===
|
1411
|
-
const
|
1412
|
-
|
1409
|
+
l.push(y), l.push(te(c, n));
|
1410
|
+
} else if (l.push(te(c, n)), i === u) {
|
1411
|
+
const g = te(c, n);
|
1412
|
+
g.path = "", g.name = `home_${u}`, l.push(g);
|
1413
1413
|
}
|
1414
1414
|
}
|
1415
1415
|
return l;
|
1416
1416
|
}
|
1417
1417
|
function ts(n = {}, e) {
|
1418
|
-
const { css: t, store: s, enhance: r } = n, { window: o, app: a, library: i = {}, adapter: l, mode: c } = e, { Pinia:
|
1419
|
-
a.config.globalProperties.$libs = i, fe(o, "global-css", t || ""),
|
1418
|
+
const { css: t, store: s, enhance: r } = n, { window: o, app: a, library: i = {}, adapter: l, mode: c } = e, { Pinia: u } = i;
|
1419
|
+
a.config.globalProperties.$libs = i, fe(o, "global-css", t || ""), u && s && ss(s, a, u), rs(a, l, n), !l.access && n.access && ns(n.access, a, c, l), os(a, n), r && is(r, a, i);
|
1420
1420
|
}
|
1421
1421
|
function ss(n, e, t) {
|
1422
1422
|
const s = t.createPinia();
|
1423
|
-
if (e.use(s),
|
1424
|
-
const r =
|
1423
|
+
if (e.use(s), j(n) && n.value) {
|
1424
|
+
const r = R(n, {}, !1, !1, !0), o = t.defineStore("$store", r(e) || {});
|
1425
1425
|
e.config.globalProperties.$store = o();
|
1426
1426
|
}
|
1427
1427
|
}
|
1428
1428
|
function ns(n, e, t, s) {
|
1429
|
-
if (
|
1430
|
-
const r =
|
1429
|
+
if (j(n) && n.value) {
|
1430
|
+
const r = R(n, {}, !1, !1, !0), { alert: o, request: a } = s, i = new pe({
|
1431
1431
|
alert: o,
|
1432
1432
|
storagePrefix: "__VTJ_APP_",
|
1433
1433
|
...r(e)
|
@@ -1438,32 +1438,32 @@ function ns(n, e, t, s) {
|
|
1438
1438
|
function rs(n, e, t) {
|
1439
1439
|
if (!e.request) return;
|
1440
1440
|
const { axios: s, request: r, response: o } = t;
|
1441
|
-
if (s &&
|
1442
|
-
const a =
|
1441
|
+
if (s && j(s) && s.value) {
|
1442
|
+
const a = R(s, {}, !1, !1, !0);
|
1443
1443
|
e.request.setConfig(a(n));
|
1444
1444
|
}
|
1445
|
-
if (r &&
|
1446
|
-
const a =
|
1445
|
+
if (r && j(r) && r.value) {
|
1446
|
+
const a = R(r, {}, !1, !1, !0), i = e.request;
|
1447
1447
|
i.__unReq && i.__unReq(), i.__unReq = e.request.useRequest((l) => a(l, n));
|
1448
1448
|
}
|
1449
|
-
if (o &&
|
1450
|
-
const a =
|
1449
|
+
if (o && j(o) && o.value) {
|
1450
|
+
const a = R(o, {}, !1, !1, !0), i = e.request;
|
1451
1451
|
i.__unRes && i.__unRes(), i.__unRes = e.request.useResponse((l) => a(l, n));
|
1452
1452
|
}
|
1453
1453
|
}
|
1454
1454
|
function os(n, e) {
|
1455
1455
|
const { beforeEach: t, afterEach: s } = e, r = n.config.globalProperties.$router;
|
1456
|
-
if (t &&
|
1457
|
-
const o =
|
1456
|
+
if (t && j(t) && t.value) {
|
1457
|
+
const o = R(t, {}, !1, !1, !0);
|
1458
1458
|
r && r.beforeEach((a, i, l) => o(a, i, l, n));
|
1459
1459
|
}
|
1460
|
-
if (s &&
|
1461
|
-
const o =
|
1460
|
+
if (s && j(s) && s.value) {
|
1461
|
+
const o = R(s, {}, !1, !1, !0);
|
1462
1462
|
r && r.afterEach((a, i, l) => o(a, i, l, n));
|
1463
1463
|
}
|
1464
1464
|
}
|
1465
1465
|
function is(n, e, t = {}) {
|
1466
|
-
|
1466
|
+
j(n) && n.value && R(n, {}, !1, !1, !0)(e, t);
|
1467
1467
|
}
|
1468
1468
|
function as(n, e, t) {
|
1469
1469
|
if (!n || !e || !t) return;
|
@@ -1471,9 +1471,9 @@ function as(n, e, t) {
|
|
1471
1471
|
if (s) {
|
1472
1472
|
const { locale: r, fallbackLocale: o, messages: a = [] } = t, i = {};
|
1473
1473
|
for (let c of a) {
|
1474
|
-
const
|
1475
|
-
for (const
|
1476
|
-
i[
|
1474
|
+
const u = Object.keys(c).filter((f) => f !== "key");
|
1475
|
+
for (const f of u)
|
1476
|
+
i[f] || (i[f] = {}), i[f][c.key] = c[f];
|
1477
1477
|
}
|
1478
1478
|
const l = s.createI18n({
|
1479
1479
|
legacy: !1,
|
@@ -1484,7 +1484,7 @@ function as(n, e, t) {
|
|
1484
1484
|
n.use(l);
|
1485
1485
|
}
|
1486
1486
|
}
|
1487
|
-
const
|
1487
|
+
const Le = Symbol("Provider");
|
1488
1488
|
var cs = /* @__PURE__ */ ((n) => (n.Production = "production", n.Development = "development", n))(cs || {});
|
1489
1489
|
class ls extends ze {
|
1490
1490
|
// DSL缓存
|
@@ -1496,21 +1496,21 @@ class ls extends ze {
|
|
1496
1496
|
super(), this.options = e;
|
1497
1497
|
const {
|
1498
1498
|
service: t,
|
1499
|
-
mode: s =
|
1499
|
+
mode: s = _.Raw,
|
1500
1500
|
dependencies: r,
|
1501
1501
|
materials: o,
|
1502
1502
|
project: a = {},
|
1503
1503
|
adapter: i = {},
|
1504
1504
|
globals: l = {},
|
1505
1505
|
modules: c = {},
|
1506
|
-
router:
|
1507
|
-
materialPath:
|
1508
|
-
nodeEnv:
|
1506
|
+
router: u = null,
|
1507
|
+
materialPath: f = "./",
|
1508
|
+
nodeEnv: p = "development"
|
1509
1509
|
/* Development */
|
1510
1510
|
} = e;
|
1511
|
-
this.mode = s, this.modules = c, this.service = t, this.router =
|
1512
|
-
const { access:
|
1513
|
-
|
1511
|
+
this.mode = s, this.modules = c, this.service = t, this.router = u, this.materialPath = f, this.nodeEnv = p, r && (this.dependencies = r), o && (this.materials = o), Object.assign(this.globals, l), Object.assign(this.adapter, i);
|
1512
|
+
const { access: h, request: d } = this.adapter;
|
1513
|
+
h && h.connect({ mode: s, router: u, request: d }), a && s !== _.Design ? this.load(a) : this.project = a;
|
1514
1514
|
}
|
1515
1515
|
mode;
|
1516
1516
|
// 当前运行模式(设计/源码/预览等)
|
@@ -1518,7 +1518,7 @@ class ls extends ze {
|
|
1518
1518
|
// 全局变量
|
1519
1519
|
modules = {};
|
1520
1520
|
// 异步模块加载器
|
1521
|
-
adapter = { request: ne, jsonp:
|
1521
|
+
adapter = { request: ne, jsonp: Re };
|
1522
1522
|
// 适配器接口
|
1523
1523
|
apis = {};
|
1524
1524
|
// API集合
|
@@ -1528,6 +1528,10 @@ class ls extends ze {
|
|
1528
1528
|
// 物料资源
|
1529
1529
|
library = {};
|
1530
1530
|
// 第三方库
|
1531
|
+
libraryLocales = {};
|
1532
|
+
// 第三方库语言包
|
1533
|
+
libraryLocaleMap = {};
|
1534
|
+
// 库名称->语言包映射
|
1531
1535
|
service;
|
1532
1536
|
// 核心服务
|
1533
1537
|
project = null;
|
@@ -1548,9 +1552,9 @@ class ls extends ze {
|
|
1548
1552
|
try {
|
1549
1553
|
s = await e.apply(e, t);
|
1550
1554
|
} catch (o) {
|
1551
|
-
|
1555
|
+
M.warn("模拟数据模版异常", o);
|
1552
1556
|
}
|
1553
|
-
return
|
1557
|
+
return H()?.mock(s);
|
1554
1558
|
};
|
1555
1559
|
}
|
1556
1560
|
/**
|
@@ -1567,10 +1571,10 @@ class ls extends ze {
|
|
1567
1571
|
if (this.project = s ? await s() : await this.service.init(e), !this.project)
|
1568
1572
|
throw new Error("project is null");
|
1569
1573
|
const { apis: r = [], meta: o = [] } = this.project, a = window;
|
1570
|
-
a && (a.CKEDITOR_VERSION = void 0), this.mode ===
|
1574
|
+
a && (a.CKEDITOR_VERSION = void 0), this.mode === _.Raw ? await this.loadDependencies(a) : await this.loadAssets(a), this.initMock(a), this.apis = bt(r, o, this.adapter), Oe(a), Et(r, a), e.platform !== "uniapp" && this.initRouter(), this.triggerReady();
|
1571
1575
|
}
|
1572
1576
|
initMock(e) {
|
1573
|
-
const t =
|
1577
|
+
const t = H(e);
|
1574
1578
|
t && t.setup({
|
1575
1579
|
timeout: "50-500"
|
1576
1580
|
});
|
@@ -1581,45 +1585,56 @@ class ls extends ze {
|
|
1581
1585
|
e[s] || (e[s] = this.library[s] = await r());
|
1582
1586
|
}
|
1583
1587
|
async loadAssets(e) {
|
1584
|
-
const { dependencies: t = [] } = this.project, {
|
1585
|
-
|
1586
|
-
|
1588
|
+
const { dependencies: t = [] } = this.project, {
|
1589
|
+
dependencies: s,
|
1590
|
+
library: r,
|
1591
|
+
components: o,
|
1592
|
+
materialPath: a,
|
1593
|
+
nodeEnv: i,
|
1594
|
+
libraryLocales: l
|
1595
|
+
} = this, {
|
1596
|
+
libraryExports: c,
|
1597
|
+
libraryMap: u,
|
1587
1598
|
materials: f,
|
1588
|
-
materialExports:
|
1589
|
-
materialMapLibrary: h
|
1599
|
+
materialExports: p,
|
1600
|
+
materialMapLibrary: h,
|
1601
|
+
libraryLocaleMap: d
|
1590
1602
|
} = ft(
|
1591
1603
|
t,
|
1592
1604
|
a,
|
1593
1605
|
i === "development"
|
1594
1606
|
/* Development */
|
1595
1607
|
);
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1608
|
+
Object.assign(this.libraryLocaleMap, d);
|
1609
|
+
for (const m of c) {
|
1610
|
+
const g = s[m], y = e[m];
|
1611
|
+
if (y)
|
1612
|
+
r[m] = y;
|
1613
|
+
else if (g)
|
1614
|
+
e[m] = r[m] = await g();
|
1602
1615
|
else {
|
1603
|
-
const v =
|
1604
|
-
for (const
|
1605
|
-
G(
|
1606
|
-
r[
|
1616
|
+
const v = u[m] || [];
|
1617
|
+
for (const $ of v)
|
1618
|
+
G($) && await mt($, F.append($, { v: D })), V($) && await Se(F.append($, { v: D }));
|
1619
|
+
r[m] = e[m];
|
1607
1620
|
}
|
1621
|
+
const w = d[m];
|
1622
|
+
w && (l[w] = e[w]);
|
1608
1623
|
}
|
1609
1624
|
if (i === "development") {
|
1610
|
-
for (const
|
1611
|
-
await Se(
|
1612
|
-
const
|
1613
|
-
for (const
|
1614
|
-
const
|
1615
|
-
if (
|
1616
|
-
|
1617
|
-
o[
|
1625
|
+
for (const g of f)
|
1626
|
+
await Se(F.append(g, { v: D }));
|
1627
|
+
const m = this.materials || {};
|
1628
|
+
for (const g of p) {
|
1629
|
+
const y = e[h[g]], w = Ge[g];
|
1630
|
+
if (w)
|
1631
|
+
y && w.forEach((v) => {
|
1632
|
+
o[v] = y[v];
|
1618
1633
|
});
|
1619
1634
|
else {
|
1620
|
-
const
|
1621
|
-
|
1622
|
-
o[
|
1635
|
+
const v = m[g] ? (await m[g]()).default : e[g];
|
1636
|
+
v && y && (v.components || []).forEach(($) => {
|
1637
|
+
o[$.name] = pt($, y);
|
1623
1638
|
});
|
1624
1639
|
}
|
1625
1640
|
}
|
@@ -1632,30 +1647,30 @@ class ls extends ze {
|
|
1632
1647
|
routeAppendTo: a,
|
1633
1648
|
pageRouteName: i = o,
|
1634
1649
|
routeMeta: l
|
1635
|
-
} = s, c = a ? "" : "/",
|
1650
|
+
} = s, c = a ? "" : "/", u = {
|
1636
1651
|
path: `${c}${i}/:id`,
|
1637
|
-
name:
|
1652
|
+
name: T,
|
1638
1653
|
component: ee
|
1639
|
-
},
|
1654
|
+
}, f = {
|
1640
1655
|
path: c,
|
1641
1656
|
name: N,
|
1642
1657
|
component: t?.homepage ? ee : r.startupComponent || es,
|
1643
1658
|
meta: l
|
1644
1659
|
};
|
1645
|
-
if (e.hasRoute(
|
1646
|
-
const
|
1660
|
+
if (e.hasRoute(T) && e.removeRoute(T), e.hasRoute(N) && e.removeRoute(N), s.enableStaticRoute) {
|
1661
|
+
const p = t?.pages || [];
|
1647
1662
|
le({
|
1648
1663
|
name: i,
|
1649
1664
|
prefix: c,
|
1650
|
-
pages:
|
1665
|
+
pages: p,
|
1651
1666
|
component: ee,
|
1652
1667
|
loader: this.getRenderComponent.bind(this),
|
1653
1668
|
homepage: t?.homepage
|
1654
1669
|
}).forEach((d) => {
|
1655
1670
|
a ? e.addRoute(a, d) : e.addRoute(d);
|
1656
|
-
}), t?.homepage || (a ? e.addRoute(a,
|
1671
|
+
}), t?.homepage || (a ? e.addRoute(a, f) : e.addRoute(f));
|
1657
1672
|
} else
|
1658
|
-
a ? (e.addRoute(a,
|
1673
|
+
a ? (e.addRoute(a, u), e.addRoute(a, f)) : (e.addRoute(u), e.addRoute(f));
|
1659
1674
|
}
|
1660
1675
|
/**
|
1661
1676
|
* Vue 插件安装方法
|
@@ -1668,27 +1683,30 @@ class ls extends ze {
|
|
1668
1683
|
* @param app Vue 应用实例
|
1669
1684
|
*/
|
1670
1685
|
install(e) {
|
1671
|
-
const t = e.config.globalProperties.installed || {};
|
1672
|
-
for (const [
|
1673
|
-
!
|
1674
|
-
|
1686
|
+
const { libraryLocaleMap: t, libraryLocales: s } = this, r = e.config.globalProperties.installed || {};
|
1687
|
+
for (const [o, a] of Object.entries(this.library))
|
1688
|
+
if (!r[o] && gt(a)) {
|
1689
|
+
const i = s[t[o]];
|
1690
|
+
e.use(a, { locale: i }), r[o] = !0;
|
1691
|
+
}
|
1692
|
+
this.options.install && e.use(this.options.install), this.adapter.access && e.use(this.adapter.access), this.project?.platform !== "uniapp" && this.mode !== _.Design && this.initGlobals(this.project?.globals || {}, {
|
1675
1693
|
app: e,
|
1676
1694
|
window,
|
1677
1695
|
adapter: this.adapter,
|
1678
1696
|
library: this.library,
|
1679
1697
|
mode: this.mode
|
1680
|
-
}), this.mode !==
|
1681
|
-
const
|
1698
|
+
}), this.mode !== _.Design && this.project?.i18n && this.initI18n(e, this.library, this.project.i18n), e.provide(Le, this), e.config.globalProperties.$provider = this, this.options.enhance && e.use(this.options.enhance, this), this.mode === _.Design && (e.config.errorHandler = (o, a, i) => {
|
1699
|
+
const l = a?.$options.name, c = typeof o == "string" ? o : o?.message || o?.msg || "未知错误", u = `[ ${l} ] ${c} ${i}`;
|
1682
1700
|
console.error(
|
1683
1701
|
"[VTJ Error]:",
|
1684
1702
|
{
|
1685
|
-
err:
|
1686
|
-
instance:
|
1687
|
-
info:
|
1703
|
+
err: o,
|
1704
|
+
instance: a,
|
1705
|
+
info: i
|
1688
1706
|
},
|
1689
|
-
|
1690
|
-
), this.adapter.notify && this.adapter.notify(
|
1691
|
-
}), e.config.globalProperties.installed =
|
1707
|
+
o?.stack
|
1708
|
+
), this.adapter.notify && this.adapter.notify(u, "组件渲染错误", "error");
|
1709
|
+
}), e.config.globalProperties.installed = r;
|
1692
1710
|
}
|
1693
1711
|
getFile(e) {
|
1694
1712
|
const { blocks: t = [] } = this.project || {};
|
@@ -1772,13 +1790,13 @@ class ls extends ze {
|
|
1772
1790
|
async getRenderComponent(e, t) {
|
1773
1791
|
const s = this.getFile(e);
|
1774
1792
|
if (!s)
|
1775
|
-
return
|
1776
|
-
if (t && t(s), this.mode ===
|
1793
|
+
return M.warn(`Can not find file: ${e}`), null;
|
1794
|
+
if (t && t(s), this.mode === _.Raw) {
|
1777
1795
|
const { vtjRawDir: o = ".vtj/vue" } = this.options, a = `${o}/${e}.vue`, i = this.modules[a] || this.modules[`/src/pages/${e}.vue`];
|
1778
1796
|
return i ? (await i())?.default : this.nodeEnv === "development" && this.adapter.startupComponent || null;
|
1779
1797
|
}
|
1780
1798
|
const r = await this.getDsl(s.id);
|
1781
|
-
return r ? this.createDslRenderer(r).renderer : (
|
1799
|
+
return r ? this.createDslRenderer(r).renderer : (M.warn(`Can not find dsl: ${e}`), null);
|
1782
1800
|
}
|
1783
1801
|
/**
|
1784
1802
|
* 定义基于URL的异步组件
|
@@ -1832,7 +1850,7 @@ function As(n) {
|
|
1832
1850
|
};
|
1833
1851
|
}
|
1834
1852
|
function Ne(n = {}) {
|
1835
|
-
const e = Pe(
|
1853
|
+
const e = Pe(Le, null);
|
1836
1854
|
if (!e)
|
1837
1855
|
throw new Error("Can not find provider");
|
1838
1856
|
if (e.nodeEnv === "development") {
|
@@ -1856,7 +1874,7 @@ async function Is(n, e = "") {
|
|
1856
1874
|
}
|
1857
1875
|
);
|
1858
1876
|
}
|
1859
|
-
const
|
1877
|
+
const Ue = {
|
1860
1878
|
type: "json",
|
1861
1879
|
validSuccess: !0,
|
1862
1880
|
originResponse: !1,
|
@@ -1871,7 +1889,7 @@ const qe = {
|
|
1871
1889
|
type: t,
|
1872
1890
|
data: s
|
1873
1891
|
},
|
1874
|
-
settings:
|
1892
|
+
settings: Ue
|
1875
1893
|
}), fs = (n, e = "/__vtj__/api/uploader.json") => async (t, s) => await n.send({
|
1876
1894
|
url: e,
|
1877
1895
|
method: "post",
|
@@ -1880,12 +1898,12 @@ const qe = {
|
|
1880
1898
|
projectId: s
|
1881
1899
|
},
|
1882
1900
|
settings: {
|
1883
|
-
...
|
1901
|
+
...Ue,
|
1884
1902
|
type: "data"
|
1885
1903
|
}
|
1886
1904
|
}).then((r) => r && r[0] ? r[0] : null).catch(() => null);
|
1887
1905
|
function ks(n) {
|
1888
|
-
return
|
1906
|
+
return Ee({
|
1889
1907
|
settings: {
|
1890
1908
|
type: "json",
|
1891
1909
|
validSuccess: !0,
|
@@ -2000,58 +2018,58 @@ class de {
|
|
2000
2018
|
return console.log("BaseService.genSource", e), "";
|
2001
2019
|
}
|
2002
2020
|
}
|
2003
|
-
const
|
2021
|
+
const S = new nt({
|
2004
2022
|
type: "local",
|
2005
2023
|
expired: 0,
|
2006
2024
|
prefix: "__VTJ_"
|
2007
2025
|
});
|
2008
2026
|
class Fs extends de {
|
2009
2027
|
init(e) {
|
2010
|
-
const t = new
|
2011
|
-
return
|
2028
|
+
const t = new U(e), s = S.get(`project_${t.id}`), r = Object.assign(t.toDsl(), s || {});
|
2029
|
+
return S.save(`project_${t.id}`, r), Promise.resolve(r);
|
2012
2030
|
}
|
2013
2031
|
saveProject(e) {
|
2014
|
-
const t = new
|
2015
|
-
return
|
2032
|
+
const t = new U(e);
|
2033
|
+
return S.save(`project_${t.id}`, t.toDsl()), Promise.resolve(!0);
|
2016
2034
|
}
|
2017
2035
|
saveMaterials(e, t) {
|
2018
|
-
return
|
2036
|
+
return S.save(`materials_${e.id}`, ue(t)), Promise.resolve(!0);
|
2019
2037
|
}
|
2020
2038
|
saveFile(e) {
|
2021
|
-
return
|
2039
|
+
return S.save(`file_${e.id}`, e), Promise.resolve(!0);
|
2022
2040
|
}
|
2023
2041
|
getFile(e) {
|
2024
|
-
const t =
|
2042
|
+
const t = S.get(`file_${e}`);
|
2025
2043
|
return t ? Promise.resolve(t) : Promise.reject(null);
|
2026
2044
|
}
|
2027
2045
|
removeFile(e) {
|
2028
|
-
return
|
2046
|
+
return S.remove(`file_${e}`), Promise.resolve(!0);
|
2029
2047
|
}
|
2030
2048
|
saveHistory(e) {
|
2031
|
-
return
|
2049
|
+
return S.save(`history_${e.id}`, e), Promise.resolve(!0);
|
2032
2050
|
}
|
2033
2051
|
removeHistory(e) {
|
2034
|
-
const t =
|
2052
|
+
const t = S.get(`history_${e}`);
|
2035
2053
|
if (t) {
|
2036
2054
|
const r = (t.items || []).map((o) => o.id);
|
2037
|
-
this.removeHistoryItem(e, r),
|
2055
|
+
this.removeHistoryItem(e, r), S.remove(`history_${e}`);
|
2038
2056
|
}
|
2039
2057
|
return Promise.resolve(!0);
|
2040
2058
|
}
|
2041
2059
|
getHistory(e) {
|
2042
|
-
const t =
|
2060
|
+
const t = S.get(`history_${e}`), s = new be(t || { id: e });
|
2043
2061
|
return Promise.resolve(s.toDsl());
|
2044
2062
|
}
|
2045
2063
|
getHistoryItem(e, t) {
|
2046
|
-
const s =
|
2064
|
+
const s = S.get(`history_${e}_${t}`);
|
2047
2065
|
return Promise.resolve(s);
|
2048
2066
|
}
|
2049
2067
|
saveHistoryItem(e, t) {
|
2050
|
-
return
|
2068
|
+
return S.save(`history_${e}_${t.id}`, t), Promise.resolve(!0);
|
2051
2069
|
}
|
2052
2070
|
removeHistoryItem(e, t) {
|
2053
2071
|
return t.forEach((s) => {
|
2054
|
-
|
2072
|
+
S.remove(`history_${e}_${s}`);
|
2055
2073
|
}), Promise.resolve(!0);
|
2056
2074
|
}
|
2057
2075
|
}
|
@@ -2062,11 +2080,11 @@ class ps extends de {
|
|
2062
2080
|
histories = {};
|
2063
2081
|
historyItems = {};
|
2064
2082
|
init(e) {
|
2065
|
-
const t = new
|
2083
|
+
const t = new U(e), s = this.projects[t.id] || {}, r = Object.assign(t.toDsl(), s);
|
2066
2084
|
return this.projects[r.id] = r, Promise.resolve(r);
|
2067
2085
|
}
|
2068
2086
|
saveProject(e) {
|
2069
|
-
const t = new
|
2087
|
+
const t = new U(e);
|
2070
2088
|
return this.projects[t.id] = t.toDsl(), Promise.resolve(!0);
|
2071
2089
|
}
|
2072
2090
|
saveMaterials(e, t) {
|
@@ -2094,7 +2112,7 @@ class ps extends de {
|
|
2094
2112
|
return Promise.resolve(!0);
|
2095
2113
|
}
|
2096
2114
|
getHistory(e) {
|
2097
|
-
const t = this.histories[e], s = new
|
2115
|
+
const t = this.histories[e], s = new be(t || { id: e });
|
2098
2116
|
return Promise.resolve(s);
|
2099
2117
|
}
|
2100
2118
|
getHistoryItem(e, t) {
|
@@ -2112,9 +2130,9 @@ class ps extends de {
|
|
2112
2130
|
}), Promise.resolve(!0);
|
2113
2131
|
}
|
2114
2132
|
}
|
2115
|
-
let
|
2133
|
+
let L = null;
|
2116
2134
|
function Ms() {
|
2117
|
-
return
|
2135
|
+
return L || (L = new ps(), L);
|
2118
2136
|
}
|
2119
2137
|
class Os extends de {
|
2120
2138
|
getFileCaches = {};
|
@@ -2182,26 +2200,26 @@ export {
|
|
2182
2200
|
de as BaseService,
|
2183
2201
|
je as CONTEXT_HOST,
|
2184
2202
|
Ct as Context,
|
2185
|
-
|
2203
|
+
_ as ContextMode,
|
2186
2204
|
it as DATA_TYPES,
|
2187
2205
|
N as HOMEPAGE_ROUTE_NAME,
|
2188
2206
|
at as HTML_TAGS,
|
2189
|
-
|
2190
|
-
|
2207
|
+
bs as JSCodeToString,
|
2208
|
+
ys as LIFE_CYCLES_LIST,
|
2191
2209
|
Os as LocalService,
|
2192
2210
|
ps as MemoryService,
|
2193
2211
|
cs as NodeEnv,
|
2194
|
-
|
2212
|
+
T as PAGE_ROUTE_NAME,
|
2195
2213
|
ls as Provider,
|
2196
|
-
|
2214
|
+
vs as REMOTE,
|
2197
2215
|
Fs as StorageService,
|
2198
|
-
|
2216
|
+
D as VTJ_RENDERER_VERSION,
|
2199
2217
|
$s as adoptStylesToInline,
|
2200
2218
|
fe as adoptedStyleSheets,
|
2201
2219
|
Ps as clearLoaderCache,
|
2202
2220
|
ht as compileScopedCSS,
|
2203
|
-
|
2204
|
-
|
2221
|
+
Rs as createAccess,
|
2222
|
+
Es as createAdapter,
|
2205
2223
|
ws as createAssetScripts,
|
2206
2224
|
Ss as createAssetsCss,
|
2207
2225
|
Dt as createDataSources,
|
@@ -2209,26 +2227,26 @@ export {
|
|
2209
2227
|
Ms as createMemoryService,
|
2210
2228
|
K as createMenus,
|
2211
2229
|
jt as createMetaApi,
|
2212
|
-
|
2230
|
+
Rt as createMock,
|
2213
2231
|
As as createProvider,
|
2214
2232
|
ie as createRenderer,
|
2215
2233
|
$t as createSchemaApi,
|
2216
|
-
|
2234
|
+
bt as createSchemaApis,
|
2217
2235
|
ks as createServiceRequest,
|
2218
2236
|
xt as defaultLoader,
|
2219
2237
|
B as fillBasePath,
|
2220
|
-
|
2238
|
+
H as getMock,
|
2221
2239
|
xe as getModifiers,
|
2222
2240
|
Te as getPlugin,
|
2223
2241
|
pt as getRawComponent,
|
2224
|
-
|
2242
|
+
yt as isBuiltInTag,
|
2225
2243
|
G as isCSSUrl,
|
2226
2244
|
_t as isJSCode,
|
2227
|
-
|
2228
|
-
|
2245
|
+
E as isJSExpression,
|
2246
|
+
j as isJSFunction,
|
2229
2247
|
lt as isJSON,
|
2230
2248
|
V as isJSUrl,
|
2231
|
-
|
2249
|
+
vt as isNativeTag,
|
2232
2250
|
gt as isVuePlugin,
|
2233
2251
|
mt as loadCss,
|
2234
2252
|
ke as loadCssUrl,
|
@@ -2236,14 +2254,14 @@ export {
|
|
2236
2254
|
Fe as loadScriptUrl,
|
2237
2255
|
Be as menusFilter,
|
2238
2256
|
Pt as mockApi,
|
2239
|
-
|
2257
|
+
Et as mockApis,
|
2240
2258
|
Oe as mockCleanup,
|
2241
|
-
|
2259
|
+
O as nodeRender,
|
2242
2260
|
ft as parseDeps,
|
2243
|
-
|
2244
|
-
|
2261
|
+
x as parseExpression,
|
2262
|
+
R as parseFunction,
|
2245
2263
|
dt as parseUrls,
|
2246
|
-
|
2264
|
+
Le as providerKey,
|
2247
2265
|
ut as removeProdFlag,
|
2248
2266
|
js as setupPageSetting,
|
2249
2267
|
Ie as toString,
|